Browse Source

监督端-预警信息管理修改

v6
zouyx 2 years ago
parent
commit
4908bc1a9b
  1. 105
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/LawEnforcementWarningList/LawEnforcementWarningList.html
  2. 73
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/LawEnforcementWarningListController.java
  3. 6
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LawEnforcementWarningListMapper.xml

105
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/LawEnforcementWarningList/LawEnforcementWarningList.html

@ -23,27 +23,28 @@
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select> </select>
</li> </li>
<li class="select-time"> <li class="select-time" onmouseover="tipShow()" onmouseleave="tipHide()">
<p>预警时间:</p> <p>预警时间:</p>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginWarningTime]"/> <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTime"/>
<span>-</span> <span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endWarningTime]"/> <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTime"/>
<input type="hidden" name="currentMonth"> <input type="hidden" name="currentMonth">
</li> </li>
<li> <li>
<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <a class="btn btn-success btn-sm" onclick="searchW()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-reset btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> <a class="btn btn-reset btn-sm" onclick="resetW()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
<a class="btn btn-warning btn-sm" onclick="downloadRW()"><i class="fa fa-share-square-o"></i> 导出</a> <a class="btn btn-warning btn-sm" onclick="downloadRW()"><i class="fa fa-share-square-o"></i> 导出</a>
</li> </li>
</ul> </ul>
</div> </div>
</form> </form>
</div> </div>
<div class="btn-group-sm" id="toolbar" role="group" style="color: orange"> <div class="btn-group-sm" id="toolbar" role="group" style="color: orange">
当月累计接受行政检查三至四次为黄色提示,五至六次为橙色提示,七次及以上为红色提示。 当月累计接受行政检查三至四次为黄色提示,五至六次为橙色提示,七次及以上为红色提示。
</div> </div>
<div class="btn-group-sm" id="tip" >当筛选起止日期为同年同月时有统计</div>
<div class="btn-group-sm" id="tips" role="group">
</div>
<div class="col-sm-12 select-table table-bordered"> <div class="col-sm-12 select-table table-bordered">
<div id="detail2" class="detail-list" style="width: 75%;"> <div id="detail2" class="detail-list" style="width: 75%;">
<span id="closeButton2" class="detail-close" onclick="closeUnite()">×</span> <span id="closeButton2" class="detail-close" onclick="closeUnite()">×</span>
@ -60,19 +61,29 @@
var prefix2 = ctx + "code/registration"; var prefix2 = ctx + "code/registration";
var warnLevel = [[${@dict.getType('warnLevel')}]]; var warnLevel = [[${@dict.getType('warnLevel')}]];
window.onload = function () { window.onload = function () {
$("#tip").hide();
if(window.sessionStorage.getItem('registrationDetailVueGo')){ if(window.sessionStorage.getItem('registrationDetailVueGo')){
document.getElementById("enterpriseName").value=window.sessionStorage.getItem('lawEnforcementWarningList-enterpriseName'); document.getElementById("enterpriseName").value=window.sessionStorage.getItem('lawEnforcementWarningList-enterpriseName');
document.getElementById("warningLevel").value=window.sessionStorage.getItem('lawEnforcementWarningList-warningLevel'); document.getElementById("warningLevel").value=window.sessionStorage.getItem('lawEnforcementWarningList-warningLevel');
document.getElementById("startTime").value=window.sessionStorage.getItem('lawEnforcementWarningList-startTime'); document.getElementById("startTime").value=window.sessionStorage.getItem('lawEnforcementWarningList-startTime');
document.getElementById("endTime").value=window.sessionStorage.getItem('lawEnforcementWarningList-endTime'); document.getElementById("endTime").value=window.sessionStorage.getItem('lawEnforcementWarningList-endTime');
$.table.search(); // $.table.search();
searchW();
sessionStorage.clear(); sessionStorage.clear();
console.log(window.sessionStorage.getItem('lawEnforcementWarningList-enterpriseName')); console.log(window.sessionStorage.getItem('lawEnforcementWarningList-enterpriseName'));
console.log(window.sessionStorage.getItem('lawEnforcementWarningList-warningLevel')); console.log(window.sessionStorage.getItem('lawEnforcementWarningList-warningLevel'));
console.log(window.sessionStorage.getItem('lawEnforcementWarningList-startTime')); console.log(window.sessionStorage.getItem('lawEnforcementWarningList-startTime'));
console.log(window.sessionStorage.getItem('lawEnforcementWarningList-endTime')); console.log(window.sessionStorage.getItem('lawEnforcementWarningList-endTime'));
}else{
searchW();
} }
} }
function tipShow(){
$("#tip").show();
}
function tipHide(){
$("#tip").hide();
}
$(function() { $(function() {
$('#detail2').hide(); $('#detail2').hide();
var date = new Date(); var date = new Date();
@ -80,11 +91,6 @@
var month = date.getMonth() + 1; var month = date.getMonth() + 1;
$("input[name='currentMonth']").val(year + "-" + month); $("input[name='currentMonth']").val(year + "-" + month);
var options = { var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "执法预警列表", modalName: "执法预警列表",
showHeader: true, showHeader: true,
showFooter: false, showFooter: false,
@ -146,7 +152,8 @@
} }
] ]
}; };
$.table.init(options); // $.table.init(options);
$("#bootstrap-table").bootstrapTable(options);
}); });
function getColor(){ function getColor(){
var map=new Map([ var map=new Map([
@ -217,10 +224,62 @@
}; };
$("#bootstrap-table3").bootstrapTable(options); $("#bootstrap-table3").bootstrapTable(options);
}); });
function downloadRW(){ function searchW(){
$("#tips").hide()
rTable()
tipsChange()
}
function rTable(){
var currentId=$('form').eq(0).attr('id'); var currentId=$('form').eq(0).attr('id');
var params = $.common.formToJSON(currentId); var params = $.common.formToJSON(currentId);
$.ajax({ $.ajax({
url: prefix + "/list",
method: 'post',
data:params,
success:function (response){
$('#bootstrap-table').bootstrapTable('load', response);
data1=response;
console.log(data1);
},error:function (xhr,status,error){
console.error("请求失败:",status,error);
}
})
}
function resetW(){
$('form').eq(0).trigger("reset");
console.log($.common.formToJSON($('form').eq(0).attr('id')));
searchW();
}
function tipsChange(){
var beginTime=document.getElementById('startTime').value;
var endTime=document.getElementById('endTime').value;
if(beginTime!=null&&beginTime!=""&&endTime!=null&&endTime!=""){
var beginDate=new Date(beginTime);
var endDate=new Date(endTime);
if(beginDate.getFullYear()==endDate.getFullYear()&&beginDate.getMonth()==endDate.getMonth()){
var currentId=$('form').eq(0).attr('id');
var params = $.common.formToJSON(currentId);
$.ajax({
url: prefix + "/tips",
method: 'GET',
data:params,
success:function (response){
console.log(response)
document.getElementById("tips").textContent = "被预警企业数"+response[0]+"家 被检査次数:3~4次"+response[1]+"家、5~6次"+response[2]+"家、7次以上"+response[3]+"家";
$("#tips").show()
},error:function (xhr,status,error){
console.error("请求失败:",status,error);
}
})
}
}
}
function downloadRW(){
var currentId=$('form').eq(0).attr('id');
var params = $.common.formToJSON(currentId);
/* $.ajax({
type: "POST", type: "POST",
data: JSON.stringify(params), data: JSON.stringify(params),
contentType: 'application/json', contentType: 'application/json',
@ -237,7 +296,21 @@
link.click(); link.click();
document.body.removeChild(link) document.body.removeChild(link)
} }
}) })*/
console.log(params)
let paramsList=[]
for(var key in params){
if (params.hasOwnProperty(key)) {
var value = params[key];
// 检查值是否为空
if (value!== null && value!== undefined && value!== '') {
paramsList.push(key + '=' + value);
}
}
}
console.log(paramsList)
console.log(paramsList.join("&"))
window.location.href = prefix +"/exportWarnList?"+paramsList.join("&")
} }
</script> </script>
</body> </body>

73
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/LawEnforcementWarningListController.java

@ -1,6 +1,10 @@
package com.zdxt.code.controller; package com.zdxt.code.controller;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
@ -15,6 +19,7 @@ import com.zdxt.common.util.TableDataInfo;
import com.zdxt.domain.auth.DictData; import com.zdxt.domain.auth.DictData;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -23,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
import com.zdxt.code.domain.LawEnforcementWarningList; import com.zdxt.code.domain.LawEnforcementWarningList;
import com.zdxt.code.service.ILawEnforcementWarningListService; import com.zdxt.code.service.ILawEnforcementWarningListService;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -64,6 +70,31 @@ public class LawEnforcementWarningListController extends BaseController
} }
@GetMapping("/tips")
@ResponseBody
public List<Integer> tips(LawEnforcementWarningList lawEnforcementWarningList)
{
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningListListOrderByNumber(lawEnforcementWarningList);
List<Integer> numList=new ArrayList<>();
numList.add(list.size());
Map<Integer,List<LawEnforcementWarningList>> map=list.stream().collect(Collectors.groupingBy(LawEnforcementWarningList::getWarningLevel));
Integer numLevel1=0;
Integer numLevel2=0;
Integer numLevel3=0;
for(Integer i:map.keySet()){
if(i==3){
numLevel3+=map.get(i).size();
} else if (i==2) {
numLevel2+=map.get(i).size();
} else if (i==1) {
numLevel1+=map.get(i).size();
}
}
numList.add(numLevel3);
numList.add(numLevel2);
numList.add(numLevel1);
return numList;
}
/** /**
* 查询执法预警列表列表 * 查询执法预警列表列表
*/ */
@ -148,9 +179,9 @@ public class LawEnforcementWarningListController extends BaseController
return prefix + "/registrationDetail"; return prefix + "/registrationDetail";
} }
@PostMapping("/exportWarnList") @GetMapping("/exportWarnList")
@ResponseBody @ResponseBody
public void export(HttpServletResponse httpServletResponse, @RequestBody LawEnforcementWarningList lawEnforcementWarningList) throws IOException { public void export(HttpServletResponse httpServletResponse,LawEnforcementWarningList lawEnforcementWarningList) throws IOException {
List<LawEnforcementWarningList> lawEnforcementWarningListList=lawEnforcementWarningListService.selectLawEnforcementWarningListListOrderByNumber(lawEnforcementWarningList); List<LawEnforcementWarningList> lawEnforcementWarningListList=lawEnforcementWarningListService.selectLawEnforcementWarningListListOrderByNumber(lawEnforcementWarningList);
List<DictData>dictDataList=dictDataMapper.selectDictDataByType("warnLevel"); List<DictData>dictDataList=dictDataMapper.selectDictDataByType("warnLevel");
Map<String,DictData> map=dictDataList.stream().collect(Collectors.toMap(DictData::getDictValue, Function.identity())); Map<String,DictData> map=dictDataList.stream().collect(Collectors.toMap(DictData::getDictValue, Function.identity()));
@ -158,6 +189,7 @@ public class LawEnforcementWarningListController extends BaseController
HSSFSheet sheet = workbook.createSheet("预警列表"); HSSFSheet sheet = workbook.createSheet("预警列表");
//设置文件名称 //设置文件名称
String fileName = "预警列表.xls"; String fileName = "预警列表.xls";
fileName = URLEncoder.encode(fileName, "UTF-8");
//自适应列宽 //自适应列宽
sheet.setDefaultColumnWidth(20);//全局 sheet.setDefaultColumnWidth(20);//全局
//表头样式 //表头样式
@ -176,9 +208,36 @@ public class LawEnforcementWarningListController extends BaseController
styleRow2.setBorderBottom(BorderStyle.THIN); styleRow2.setBorderBottom(BorderStyle.THIN);
styleRow2.setBorderLeft(BorderStyle.THIN); styleRow2.setBorderLeft(BorderStyle.THIN);
styleRow2.setFont(font2); styleRow2.setFont(font2);
int top=0;
DateTimeFormatter str=DateTimeFormatter.ofPattern("yyyy-MM-dd");
if(lawEnforcementWarningList != null&&lawEnforcementWarningList.getBeginTime() != null&&!lawEnforcementWarningList.getBeginTime().equals("")&&lawEnforcementWarningList.getEndTime() != null&&!lawEnforcementWarningList.getEndTime().equals("")){
LocalDate beginTime= LocalDate.parse(lawEnforcementWarningList.getBeginTime(),str);
LocalDate endTime=LocalDate.parse(lawEnforcementWarningList.getEndTime(),str);
if(beginTime.getYear()==endTime.getYear()&&beginTime.getMonth()==beginTime.getMonth()){
Map<Integer,List<LawEnforcementWarningList>> listMap=lawEnforcementWarningListList.stream().collect(Collectors.groupingBy(LawEnforcementWarningList::getWarningLevel));
Integer numLevel1=0;
Integer numLevel2=0;
Integer numLevel3=0;
for(Integer i:listMap.keySet()){
if(i==3){
numLevel3+=listMap.get(i).size();
} else if (i==2) {
numLevel2+=listMap.get(i).size();
} else if (i==1) {
numLevel1+=listMap.get(i).size();
}
}
HSSFRow headerRowTips = sheet.createRow(0);
HSSFCell cellTips = headerRowTips.createCell(0);
cellTips.setCellValue("被预警企业数"+lawEnforcementWarningListList.size()+"家 被检査次数:3~4次"+numLevel3+"家、5~6次"+numLevel2+"家、7次以上"+numLevel1+"家");
sheet.addMergedRegion(new CellRangeAddress(0,0,0,3));
cellTips.setCellStyle(styleRow2);
top+=1;
}
}
//设置表头 //设置表头
String[] headerList = {"企业名称","预警原因","预警等级","预警时间"}; String[] headerList = {"企业名称","预警原因","预警等级","预警时间"};
HSSFRow headerRow = sheet.createRow(0); HSSFRow headerRow = sheet.createRow(0+top);
for (int i = 0; i < headerList.length; i++) { for (int i = 0; i < headerList.length; i++) {
HSSFCell cell = headerRow.createCell(i); HSSFCell cell = headerRow.createCell(i);
HSSFRichTextString text = new HSSFRichTextString(headerList[i]); HSSFRichTextString text = new HSSFRichTextString(headerList[i]);
@ -189,7 +248,7 @@ public class LawEnforcementWarningListController extends BaseController
HSSFDataFormat cellDataFormat= workbook.createDataFormat();; HSSFDataFormat cellDataFormat= workbook.createDataFormat();;
dateStyle.setDataFormat(cellDataFormat.getFormat("yyyy\"-\"m\"-\"d")); dateStyle.setDataFormat(cellDataFormat.getFormat("yyyy\"-\"m\"-\"d"));
for(int i=0;i<lawEnforcementWarningListList.size();i++){ for(int i=0;i<lawEnforcementWarningListList.size();i++){
HSSFRow row = sheet.createRow(i+1); HSSFRow row = sheet.createRow(i+1+top);
row.createCell(0).setCellValue(lawEnforcementWarningListList.get(i).getEnterpriseName()); row.createCell(0).setCellValue(lawEnforcementWarningListList.get(i).getEnterpriseName());
row.createCell(1).setCellValue(lawEnforcementWarningListList.get(i).getWarningCause()); row.createCell(1).setCellValue(lawEnforcementWarningListList.get(i).getWarningCause());
if(map.containsKey(lawEnforcementWarningListList.get(i).getWarningLevel()+"")){ if(map.containsKey(lawEnforcementWarningListList.get(i).getWarningLevel()+"")){
@ -205,8 +264,10 @@ public class LawEnforcementWarningListController extends BaseController
httpServletResponse.setCharacterEncoding("UTF-8"); httpServletResponse.setCharacterEncoding("UTF-8");
httpServletResponse.setContentType("application/vnd.ms-excel"); httpServletResponse.setContentType("application/vnd.ms-excel");
httpServletResponse.setHeader("Content-disposition", "attachment;filename=" + fileName); httpServletResponse.setHeader("Content-disposition", "attachment;filename=" + fileName);
httpServletResponse.flushBuffer(); /* httpServletResponse.flushBuffer();
workbook.write(httpServletResponse.getOutputStream()); workbook.write(httpServletResponse.getOutputStream());*/
ServletOutputStream outputStream = httpServletResponse.getOutputStream();
workbook.write(outputStream);
workbook.close(); workbook.close();
} }
} }

6
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LawEnforcementWarningListMapper.xml

@ -177,6 +177,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.endWarningTime != null and params.endWarningTime != ''"> <if test="params.endWarningTime != null and params.endWarningTime != ''">
and x.warning_time <![CDATA[ <= ]]> #{params.endWarningTime} and x.warning_time <![CDATA[ <= ]]> #{params.endWarningTime}
</if> </if>
<if test="beginTime != null and beginTime != ''">
and x.warning_time <![CDATA[ >= ]]> #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
and x.warning_time <![CDATA[ <= ]]> #{endTime}
</if>
<if test="warnType != null">AND x.warn_type = #{warnType}</if> <if test="warnType != null">AND x.warn_type = #{warnType}</if>
<if test=" enforcementDepartmentId != null and enforcementDepartmentId != ''"> <if test=" enforcementDepartmentId != null and enforcementDepartmentId != ''">
x.enforcement_department_id = #{enforcementDepartmentId}, x.enforcement_department_id = #{enforcementDepartmentId},

Loading…
Cancel
Save