Browse Source

修改检查计划

v6
Chendy 1 year ago
parent
commit
810f2a7f10
  1. 182
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statistical/staticProgram.html
  2. 5
      lib/EmergencyService/zdxtLawEnforcementCodeService/pom.xml
  3. 57
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementInspectionProgramController.java
  4. 24
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/EnforcementInspectionProgramDto.java
  5. 14
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnforcementInspectionProgramMapper.java
  6. 7
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementInspectionProgramService.java
  7. 78
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementInspectionProgramServiceImpl.java
  8. 74
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml

182
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statistical/staticProgram.html

@ -29,39 +29,14 @@
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<input type="hidden" id="timeType" name="timeType"/>
<input type="hidden" id="bureauDeptId" name="bureauDeptId"/>
<div class="select-list">
<ul>
<li>
<p>执法部门:</p>
<input type="text" name="bureauDeptName"/>
</li>
<!--<li>
<p>时段:</p>
<select name="timeType" id="timeType" onchange="changeSelect()">
<option value="">所有</option>
<option value="year">年度</option>
<option value="quarter">季度</option>
<option value="month">月度</option>
</select>
</li>
<li class="select-time" id="yearDom">
<label>年度:</label>
<input type="text" class="year-input" style="width: 150px" id="yearSearch" name="year">
<li>
<li class="select-time" id="quarterDom">
<label>季度:</label>
<select id="quarter" name="quarter">
<option value="">请选择</option>
<option value="1">1季度</option>
<option value="2">2季度</option>
<option value="3">3季度</option>
<option value="4">4季度</option>
</select>
<li>
<li class="select-time" id="monthDom">
<label>月度:</label>
<input type="text" class="month-input" style="width: 150px" id="monthSearch" name="month">
<li>-->
<li>
<p>时段:</p>
<select id="year" name="year">
@ -124,10 +99,15 @@
</form>
</div>
<div class="col-sm-12 select-table table-bordered">
<div id="detail" class="detail-list" style="width:1300px">
<span id="closeComplaint" class="detail-close" onclick="closePlan()">×</span>
<table id="bootstrap-table2"></table>
</div>
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<div id="con_one_2" class="tab_item" style="height: 110%">
<form id="form2">
@ -191,6 +171,7 @@
$("#chart-box-3").hide();
echartsTotal();
$(".fixed-table-toolbar").hide();
$("#detail").hide();
};
function setTab(name, cursel, n) {
@ -452,41 +433,152 @@
field : 'yearTotal',
title : '年度计划',
align : 'center',
formatter:function (value,row,index) {
return '<span style="cursor: pointer;color: blue;" onclick="planInfo(\'year\',\''+row.bureauDeptId+'\')">'+value+'</span>';
}
},
{
field : 'quarterTotal',
title : '季度计划',
align : 'center',
formatter:function (value,row,index) {
return '<span style="cursor: pointer;color: blue;" onclick="planInfo(\'quarter\',\''+row.bureauDeptId+'\')">'+value+'</span>';
}
},
{
field : 'monthTotal',
title : '月度计划',
align : 'center',
formatter:function (value,row,index) {
return '<span style="cursor: pointer;color: blue;" onclick="planInfo(\'month\',\''+row.bureauDeptId+'\')">'+value+'</span>';
}
}]
};
$.table.init(options);
/*layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: '#yearSearch',
type: 'year',
trigger: 'click',
change: function(value, date, endDate){
console.log(value); //得到日期生成的值,如:2017-08-18
console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
$("#yearDate").text(value)
var planOptions={
modalName: "详情",
pagination: true,
pageSize: 10,
pageList: [10, 25, 50],
columns: [
{
field : 'id',
title : '主键ID',
visible: false
},
{
field : 'planName',
title : '计划名称',
align : 'center',
width:'350px'
},
{
field : 'bureauDeptName',
title : '执法部门',
align : 'center'
},
{
field : 'enforcementArea',
title : '执法区域',
align : 'center'
},
{
field : 'enforcementTime',
title : '上传时间',
align : 'center'
},
{
title : '附件',
align : 'center',
formatter:function (value,row,index) {
var actions = [];
actions.push('<span style="cursor: pointer;color: blue;" onclick="previewFile(\'' + row.id + '\')">预览 </span>');
actions.push('<span style="cursor: pointer;color: blue;" onclick="downloadFile(\'' + row.id + '\')"> 下载</span>');
return actions.join('');
}
}
});
laydate.render({
elem: '#monthSearch',
type: 'month',
trigger: 'click'
})
});*/
]
}
$("#bootstrap-table2").bootstrapTable(planOptions);
});
// 计划列表
function planInfo(type,burDeptId){
$("#timeType").val(type)
$("#bureauDeptId").val(burDeptId)
$.ajax({
url:prefix+'/getPlanInfo',
type:'post',
data:$("#formId").serialize(),
success: function (res) {
$('#detail').show();
$('#bootstrap-table2').bootstrapTable('load', res);
}
})
}
function closePlan(){
$('#detail').hide();
}
/**
* check 文件是否存在
* @param id
* @returns {boolean}
*/
function checkFile(id){
var result=true;
$.ajax({
url:prefix+"/checkFile",
type:"post",
data:{id:id},
async:false,
success:function (res){
result=res;
}
})
return result;
}
// 预览
function previewFile(id){
if(checkFile(id)){
var url=prefix+"/previewFile?id="+window.btoa(id);
window.open(url);
}else{
$.modal.alertWarning("无附件。");
}
}
// 下载
function downloadFile(id){
if(checkFile(id)){
var xhr= new XMLHttpRequest();
var url=prefix+"/downloadFile?id="+window.btoa(id);
xhr.open('POST',url,true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.responseType="blob";
xhr.onload=function (){
if(this.status === 200){
var blob = this.response;
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload=function(e) {
var a = document.createElement('a');
a.download ="附件.pdf";
a.href = e.target.result;
$("body").append(a);
a.click();
$(a).remove();
}
}
}
xhr.send();
}else{
$.modal.alertWarning("无附件。");
}
}
/**
* 初始化
*/

5
lib/EmergencyService/zdxtLawEnforcementCodeService/pom.xml

@ -52,6 +52,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
</project>

57
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/EnforcementInspectionProgramController.java

@ -4,16 +4,21 @@ import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.zdxt.auth.feign.ZdxtFileCommonApi;
import com.zdxt.code.domain.*;
import com.zdxt.code.domain.dto.EnforcementInspectionProgramDto;
import com.zdxt.code.service.ILawEnforcementEnterpriseService;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.controller.BaseController;
import com.zdxt.common.util.ExcelUtils;
import com.zdxt.common.util.StringUtils;
import com.zdxt.common.util.TableDataInfo;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -46,6 +51,9 @@ public class EnforcementInspectionProgramController extends BaseController
@Autowired
private ILawEnforcementEnterpriseService lawEnforcementEnterpriseService;
@Autowired
ZdxtFileCommonApi zdxtFileCommonApi;
@RequiresPermissions("code:enforcementInspectionProgram:view")
@GetMapping()
public String enforcementInspectionProgram()
@ -322,4 +330,53 @@ public class EnforcementInspectionProgramController extends BaseController
}
return yearList;
}
/**
* 获取计划详情
* @param param
* @return
*/
@PostMapping("/getPlanInfo")
@ResponseBody
public TableDataInfo getPlanInfo(EnforcementInspectionProgramDto param){
startPage();
List<EnforcementInspectionProgram> list=enforcementInspectionProgramService.getPlanInfo(param);
return getDataTable(list);
}
/**
* check 文件是否存在
* @param id
* @return
*/
@PostMapping("/checkFile")
@ResponseBody
public boolean checkFile(String id){
List<ZdxtFileCommon> files = zdxtFileCommonApi.selectZdxtFileById(id);
return files.size()>0?true:false;
}
/**
* 预览pdf
* @param
*/
@RequestMapping("/previewFile")
public void previewFile (String id,HttpServletResponse response){
if(StringUtils.isEmpty(id)) return;
byte[] decodedBytes = Base64.getDecoder().decode(id);
String guid = new String(decodedBytes);
enforcementInspectionProgramService.previewFile(guid,response);
}
/**
* 下载pdf
* @param id
*/
@PostMapping("/downloadFile")
public void downloadFile (String id,HttpServletResponse response){
if(StringUtils.isEmpty(id)) return;
byte[] decodedBytes = Base64.getDecoder().decode(id);
String guid = new String(decodedBytes);
enforcementInspectionProgramService.previewFile(guid,response);
}
}

24
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/dto/EnforcementInspectionProgramDto.java

@ -86,6 +86,30 @@ public class EnforcementInspectionProgramDto extends BaseDomain {
private Integer monthTotal10 = 0;
private Integer monthTotal11 = 0;
private Integer monthTotal12 = 0;
/**
* 是否发布 0否 1是
*/
private Integer isPublish;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getIsPublish() {
return isPublish;
}
public void setIsPublish(Integer isPublish) {
this.isPublish = isPublish;
}
public String getBeginTime() {
return beginTime;
}

14
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/EnforcementInspectionProgramMapper.java

@ -68,6 +68,13 @@ public interface EnforcementInspectionProgramMapper
*/
List<EnforcementInspectionProgramDto> staticProgram(EnforcementInspectionProgramDto enforcementInspectionProgramDto);
/**
* 统计执法计划按照执法部门统计
* @return
*/
List<EnforcementInspectionProgramDto> staticProgramPublish(EnforcementInspectionProgramDto enforcementInspectionProgramDto);
/**
* 统计总数
* @param enforcementInspectionProgramDto
@ -109,4 +116,11 @@ public interface EnforcementInspectionProgramMapper
* @return 执法检查计划集合
*/
List<EnforcementInspectionProgram> selectPlanList(EnforcementInspectionProgram enforcementInspectionProgram);
List<EnforcementInspectionProgram> getPlanInfo(EnforcementInspectionProgramDto param);
List<EnforcementInspectionProgramDto> getAllList(EnforcementInspectionProgramDto param);
List<EnforcementInspectionProgramDto> getAllListNoPermission(EnforcementInspectionProgramDto param);
}

7
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/IEnforcementInspectionProgramService.java

@ -2,7 +2,9 @@ package com.zdxt.code.service;
import com.zdxt.code.domain.EnforcementInspectionProgram;
import com.zdxt.code.domain.dto.EnforcementInspectionProgramDto;
import org.springframework.web.bind.annotation.PathVariable;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -107,4 +109,9 @@ public interface IEnforcementInspectionProgramService
* @return
*/
List<EnforcementInspectionProgramDto> staticProgramWithMonth(EnforcementInspectionProgramDto enforcementInspectionProgramDto);
List<EnforcementInspectionProgram> getPlanInfo(EnforcementInspectionProgramDto param);
void previewFile (String id, HttpServletResponse response);
}

78
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementInspectionProgramServiceImpl.java

@ -1,7 +1,10 @@
package com.zdxt.code.service.impl;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import cn.hutool.core.convert.Convert;
@ -16,12 +19,18 @@ import com.zdxt.common.annotation.DataScope;
import com.zdxt.common.util.DateUtils;
import com.zdxt.common.zdxtFile.ZdxtFileCommon;
import org.apache.commons.collections.CollectionUtils;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.zdxt.code.mapper.EnforcementInspectionProgramMapper;
import com.zdxt.code.domain.EnforcementInspectionProgram;
import com.zdxt.code.service.IEnforcementInspectionProgramService;
import javax.servlet.http.HttpServletResponse;
/**
* 执法检查计划Service业务层处理
*
@ -43,6 +52,9 @@ public class EnforcementInspectionProgramServiceImpl implements IEnforcementInsp
@Autowired
private UserApi userApi;
@Value("${ruoyi.profile}")
private String urlProfile;
/**
* 查询执法检查计划
@ -212,15 +224,16 @@ public class EnforcementInspectionProgramServiceImpl implements IEnforcementInsp
@Override
@DataScope(deptField = "enforcement_department_id")
public List<EnforcementInspectionProgramDto> staticProgram(EnforcementInspectionProgramDto enforcementInspectionProgramDto) {
return enforcementInspectionProgramMapper.staticProgram(enforcementInspectionProgramDto);
public List<EnforcementInspectionProgramDto> staticProgram(EnforcementInspectionProgramDto dto) {
getPublish(dto);
return enforcementInspectionProgramMapper.staticProgram(dto);
}
@Override
@DataScope(deptField = "enforcement_department_id")
public EnforcementInspectionProgramDto staticAllProgram(EnforcementInspectionProgramDto enforcementInspectionProgramDto) {
return enforcementInspectionProgramMapper.staticAllProgram(enforcementInspectionProgramDto);
public EnforcementInspectionProgramDto staticAllProgram(EnforcementInspectionProgramDto dto) {
getPublish(dto);
return enforcementInspectionProgramMapper.staticAllProgram(dto);
}
@Override
@ -262,4 +275,59 @@ public class EnforcementInspectionProgramServiceImpl implements IEnforcementInsp
});
return enforcementInspectionPrograms;
}
@Override
@DataScope(deptField = "enforcement_department_id")
public List<EnforcementInspectionProgram> getPlanInfo(EnforcementInspectionProgramDto dto) {
getPublish(dto);
return enforcementInspectionProgramMapper.getPlanInfo(dto);
}
/**
* 查询公开
* @param dto
*/
public void getPublish(EnforcementInspectionProgramDto dto){
if(dto.getParams()!=null && !dto.getParams().isEmpty()){
Map map=dto.getParams();
String scope=map.get("dataScope").toString();
scope=scope.substring(4,scope.length()-1);
scope="and ("+scope+") or is_publish =1 )";
dto.getParams().put("dataScope",scope);
}
}
@Override
public void previewFile(String id, HttpServletResponse response) {
List<ZdxtFileCommon> files = zdxtFileCommonApi.selectZdxtFileById(id);
if (files.size() == 0) return;
String path = files.get(0).getUploadPath().replace("/profile", urlProfile);
OutputStream os=null;
try{
FileInputStream is=new FileInputStream(path);
response.reset();
response.setContentType("application/pdf;charset=UTF-8");
response.setHeader("Content-Disposition", "inline;filename=file." + path);
byte[] bs = new byte[is.available()];
is.read(bs);
os = response.getOutputStream();
PDDocument doc= Loader.loadPDF(bs);
PDDocumentInformation info =doc.getDocumentInformation();
info.setTitle("附件");
doc.setDocumentInformation(info);
doc.save(os);
doc.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if(os!=null){
try{
os.flush();
os.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}

74
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementInspectionProgramMapper.xml

@ -176,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="staticProgram" resultType="com.zdxt.code.domain.dto.EnforcementInspectionProgramDto" >
SELECT
bureau_dept_name,
bureau_dept_id,
count(*) as total,
SUM(CASE WHEN time_type = 'year' THEN 1 ELSE 0 END ) as yearTotal,
SUM(CASE WHEN time_type = 'quarter' THEN 1 ELSE 0 END ) as quarterTotal,
@ -204,7 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
</if>
AND bureau_dept_id is not null
and time_type is not null
and time_type is not null and time_type !='0'
and (plan_year is not null or quarter is not null or mouth is not null)
</where>
GROUP BY bureau_dept_id
@ -448,4 +449,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by create_time desc
</select>
<select id="getPlanInfo" parameterType="EnforcementInspectionProgramDto" resultType="EnforcementInspectionProgram">
SELECT
id,plan_name,bureau_dept_name,enforcement_area,enforcement_time
FROM
enforcement_inspection_program
<where>
<if test="bureauDeptName != null and bureauDeptName != ''">
and bureau_dept_name like concat('%', #{bureauDeptName}, '%')
</if>
<if test="beginTime != null and beginTime != ''">
and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
and #{endTime} >= DATE_FORMAT(create_time,'%Y-%m-%d')
</if>
<if test="year != null and year != ''">
and YEAR(create_time) = #{year}
</if>
<if test="quarter != null and quarter != '' ">
and QUARTER(create_time) = #{quarter}
</if>
<if test="month != null and month != '' ">
and DATE_FORMAT(create_time, '%m') = #{month}
</if>
<if test="params.dataScope != null and params.dataScope != ''">
${params.dataScope}
</if>
AND bureau_dept_id=#{bureauDeptId}
and time_type=#{timeType}
and (plan_year is not null or quarter is not null or mouth is not null)
</where>
</select>
<select id="staticProgramPublish" resultType="com.zdxt.code.domain.dto.EnforcementInspectionProgramDto" >
SELECT
bureau_dept_name,
bureau_dept_id,
count(*) as total,
SUM(CASE WHEN time_type = 'year' THEN 1 ELSE 0 END ) as yearTotal,
SUM(CASE WHEN time_type = 'quarter' THEN 1 ELSE 0 END ) as quarterTotal,
SUM(CASE WHEN time_type = 'month' THEN 1 ELSE 0 END ) as monthTotal
FROM enforcement_inspection_program
<where>
<if test="bureauDeptName != null and bureauDeptName != ''">
and bureau_dept_name like concat('%', #{bureauDeptName}, '%')
</if>
<if test="beginTime != null and beginTime != ''">
and DATE_FORMAT(create_time,'%Y-%m-%d') >= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
and #{endTime} >= DATE_FORMAT(create_time,'%Y-%m-%d')
</if>
<if test="year != null and year != ''">
and YEAR(create_time) = #{year}
</if>
<if test="quarter != null and quarter != '' ">
and QUARTER(create_time) = #{quarter}
</if>
<if test="month != null and month != '' ">
and DATE_FORMAT(create_time, '%m') = #{month}
</if>
and is_publish =#{isPublish}
AND bureau_dept_id is not null
and time_type is not null and time_type !='0'
and (plan_year is not null or quarter is not null or mouth is not null)
</where>
GROUP BY bureau_dept_id
order by total desc
</select>
</mapper>
Loading…
Cancel
Save