From 4342e164db5d87890817fd43965d033691a52d8e Mon Sep 17 00:00:00 2001 From: zouyx <1798599149@qq.com> Date: Fri, 15 Nov 2024 15:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../code/complaintStatic/complaintStatic.html | 111 +++++--------- .../code/registration/staticRegistration.html | 87 +++-------- .../code/statistical/staticProgram.html | 24 +++ .../statisticsEnterprise.html | 2 +- .../statisticsWarning/statisticsWarning.html | 25 +++- .../controller/ComplaintStaticController.java | 118 ++++++++------- ...nforcementInspectionProgramController.java | 42 +++++- .../EnforcementRegistrationController.java | 59 +++++++- .../StatisticsEnterpriseController.java | 23 ++- .../StatisticsWarningController.java | 45 +++++- .../mapper/EnterpriseInformationMapper.java | 3 + .../service/ComplaintStatisticsService.java | 6 + .../service/StatisticsEnterpriseService.java | 5 + .../service/impl/ComplaintStatisticsImpl.java | 89 +++++++---- .../impl/EnforcementCheckStatisticsImpl.java | 2 +- .../impl/StatisticsEnterpriseServiceImpl.java | 141 ++++++++++++++++++ .../mapper/EnterpriseInformationMapper.xml | 16 ++ 17 files changed, 559 insertions(+), 239 deletions(-) diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/complaintStatic/complaintStatic.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/complaintStatic/complaintStatic.html index 95c8acbd..4c549c0e 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/complaintStatic/complaintStatic.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/complaintStatic/complaintStatic.html @@ -95,7 +95,7 @@
  •  搜索  重置 - 导出 + 导出
  • @@ -617,81 +617,50 @@ $('#bootstrap-table').hide(); } } - /*function complaintDownload1(){ - let table=document.getElementById('bootstrap-table1'); - let html=table.outerHTML; - let downloadLink=document.createElement("a"); - document.body.append(downloadLink); - downloadLink.href='data:application/vnd.ms-excel,'+ encodeURIComponent(html); - downloadLink.download='执法投诉统计.xls'; - downloadLink.click(); - }*/ - function complaintDownload(){ - var currentId=$('form').eq(1).attr('id') + function downloadC1(){ + var currentId=$('form').eq(0).attr('id'); var params = $.common.formToJSON(currentId); $.ajax({ - url:ctx+"/enforcementCheckStatistics/queryAllList/2024-11-14/2024-11-14", - type:'GET', - success: function (response) { + type: "POST", + data: JSON.stringify(params), + contentType: 'application/json', + //设置响应类型 + xhrFields: {responseType: "blob"}, + url: prefix+"/export1", + success: function (result) { + const link = document.createElement('a'); + let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', "执法投诉统计.xls"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) + } + }) + } + function downloadC2(){ + var currentId=$('form').eq(1).attr('id'); + var params = $.common.formToJSON(currentId); + $.ajax({ + type: "POST", + data: JSON.stringify(params), + contentType: 'application/json', + //设置响应类型 + xhrFields: {responseType: "blob"}, + url: prefix+"/export2", + success: function (result) { + const link = document.createElement('a'); + let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', "投诉类型统计.xls"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) } }) } - - /*******echarts:投诉类型/占比*********/ - - /*const ecsh = echarts.init(document.getElementById("echartComplaint")); - const optionsh = { - tooltip: { - trigger: 'item', - formatter: '{b}: {c} ({d}%)' - }, - /!*legend: { - x : 'left', - y : 'center', - itemGap: 20, - orient: 'vercital' - },*!/ - color: ['#1f74f1', '#79e24a', '#41d5d3', '#f59036', '#fed100', '#ababac'], - series: [{ - top: '5%', - left: '20%', - type: 'pie', - name: '名称', - radius: ['20%', '28%'], - center: ['50%', '30%'], - label: { - formatter: '{b}: {c} ({d}%)', - borderWidth: 1, - borderRadius: 4, - color: '#4F4F4F', - fontFamily: 'PingFangSC-Regular', - fontSize: '14', - rich: { - a: { - color: '#4F4F4F', - lineHeight: 18, - align: 'center' - } - } - }, - data: [ - {value: 18, name: '违法执法'}, - {value: 28, name: '违规执法'}, - {value: 22, name: '执法不文明'}, - {value: 12, name: '选择性执法'}, - {value: 10, name: '其他'}, - {value: 10, name: '入企不扫码'}, - ], - }] - }; - ecsh.clear(); - ecsh.setOption(optionsh); - - // 使用刚指定的配置项和数据显示图表。 - myChart.setOption(option); - window.addEventListener("resize",function(){ - myChart.resize(); - });*/ diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/registration/staticRegistration.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/registration/staticRegistration.html index 81b73fa8..b7bb2386 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/registration/staticRegistration.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/registration/staticRegistration.html @@ -89,7 +89,7 @@
  •  搜索  重置 - 导出 + 导出
  • @@ -395,73 +395,28 @@ }) }*/ $(document).ready(); - function download1(){ - /*startTime=searchType.beginTime; - endTime=searchType.endTime;*/ - /*$.ajax({ - url:ctx+"enforcementCheckStatistics/queryAllList/"+startTime+"/"+endTime, - type:'GET', - success: function (data) { - console.log('329'+data) - } - })*/ - /*this.download('/export',{ - ...this.queryParameters - },`registration.xlsx`)*/ - //$.operate.get(ctx+"enforcementCheckStatistics/queryAllList", { "startTime": searchType.beginTime, "endTime": searchType.endTime }); - let table=document.getElementById('bootstrap-table'); - //let html=table.outerHTML; - let newTableHtml=''; - let headers = table.querySelectorAll('thead tr th'); - headers.forEach((header, index) => { - console.log(header,index); - console.log(index !== 9); - if (index !== 9) { - newTableHtml += ``; + function downloadR(){ + var currentId=$('form').eq(0).attr('id'); + var params = $.common.formToJSON(currentId); + $.ajax({ + type: "POST", + data: JSON.stringify(params), + contentType: 'application/json', + //设置响应类型 + xhrFields: {responseType: "blob"}, + url: prefix+"/export", + success: function (result) { + const link = document.createElement('a'); + let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', "执法分析.xls"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) } - }); - newTableHtml += ''; - let rows = table.querySelectorAll('tbody tr'); - rows.forEach(row => { - newTableHtml += ''; - let cells = row.querySelectorAll('td'); - cells.forEach((cell, index) => { - if (index !== 9) { - newTableHtml += ``; - } - }); - newTableHtml += ''; - }); - newTableHtml += '
    ${header.innerText}
    ${cell.innerText}
    '; - let downloadLink=document.createElement("a"); - //document.body.append(downloadLink); - downloadLink.href='data:application/vnd.ms-excel,'+ encodeURIComponent(newTableHtml); - document.body.appendChild(downloadLink); - downloadLink.download='执法检查统计.xls'; - downloadLink.click(); - document.body.removeChild(downloadLink); - } - /*var table=document.getElementById('bootstrap-table'); - var rows=table.rows; - var data1=[]; - for(var i=0;i  搜索  重置 + 导出
    @@ -493,6 +494,29 @@ withMonth(); } + function downloadP(){ + var currentId=$('form').eq(0).attr('id'); + var params = $.common.formToJSON(currentId); + $.ajax({ + type: "POST", + data: JSON.stringify(params), + contentType: 'application/json', + //设置响应类型 + xhrFields: {responseType: "blob"}, + url: prefix+"/export1", + success: function (result) { + const link = document.createElement('a'); + let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', "检查计划统计.xls"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) + } + }) + } + /** * 年度计划排行 */ diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsEnterprise/statisticsEnterprise.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsEnterprise/statisticsEnterprise.html index e4ddf886..e48a9050 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsEnterprise/statisticsEnterprise.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsEnterprise/statisticsEnterprise.html @@ -521,7 +521,7 @@ let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); link.style.display = 'none'; link.href = URL.createObjectURL(blob); - link.setAttribute('download', "执法检查统计.xls"); + link.setAttribute('download', "企业数量统计.xls"); document.body.appendChild(link); link.click(); document.body.removeChild(link) diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsWarning/statisticsWarning.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsWarning/statisticsWarning.html index 1d024b71..b19cafab 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsWarning/statisticsWarning.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/code/statisticsWarning/statisticsWarning.html @@ -58,7 +58,7 @@
  •  搜索  重置 - 导出 + 导出
  • @@ -178,6 +178,29 @@ document.getElementById("month").value=""; } } + function downloadW(){ + var currentId=$('form').eq(0).attr('id'); + var params = $.common.formToJSON(currentId); + delete params.dateSearch; + $.ajax({ + type: "POST", + data: JSON.stringify(params), + contentType: 'application/json', + //设置响应类型 + xhrFields: {responseType: "blob"}, + url: prefix+"/export", + success: function (result) { + const link = document.createElement('a'); + let blob = new Blob([result], {type: 'application/vnd.ms-excel'}); + link.style.display = 'none'; + link.href = URL.createObjectURL(blob); + link.setAttribute('download', "执法预警统计.xls"); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link) + } + }) + } \ No newline at end of file diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/ComplaintStaticController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/ComplaintStaticController.java index 5cad8485..b4e7256e 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/ComplaintStaticController.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/ComplaintStaticController.java @@ -4,10 +4,7 @@ import com.zdxt.auth.feign.ZdxtFileCommonApi; import com.zdxt.auth.framework.web.domain.AjaxResult; import com.zdxt.auth.project.system.dept.service.IDeptService; import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; -import com.zdxt.code.domain.ComplaintStatistics; -import com.zdxt.code.domain.EnterpriseComplaint; -import com.zdxt.code.domain.SearchType; -import com.zdxt.code.domain.StatisticsIndicator; +import com.zdxt.code.domain.*; import com.zdxt.code.service.ComplaintStatisticsService; import com.zdxt.code.service.IEnterpriseComplaintService; import com.zdxt.common.controller.BaseController; @@ -15,16 +12,15 @@ import com.zdxt.common.util.TableDataInfo; import com.zdxt.common.zdxtFile.ZdxtFileCommon; import com.zdxt.domain.auth.Dept; import com.zdxt.domain.auth.DictData; +import org.apache.poi.hssf.usermodel.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.lang.reflect.Array; import java.text.ParseException; import java.time.LocalDate; @@ -100,26 +96,8 @@ public class ComplaintStaticController extends BaseController { @ResponseBody public TableDataInfo complaint1(SearchType searchType) { ComplaintStatistics complaintStatistics=dateMake(searchType); - if(searchType.getCType()!=null&&!"".equals(searchType.getCType())) { - complaintStatistics.setComplaintType(Integer.parseInt(searchType.getCType())); - } - Map deptMap=new HashMap<>(); - if(searchType.getName()!=null&&!"".equals(searchType.getName())){//搜索条件内有投诉对象时 - List deptList=iDeptService.selectDeptByDeptName(searchType.getName()); - deptMap=deptList.stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); - complaintStatistics.setComplaintDepartmentIdList(new ArrayList<>(deptMap.keySet())); - }else { - deptMap=iDeptService.selectDeptAll().stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); - } - startPage(); - List complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsGroup(complaintStatistics); - for (int i=0;i complaintStatisticsList=complaintStatisticsService.list1(searchType,complaintStatistics); return getDataTable(complaintStatisticsList); } @RequiresPermissions("code:complaintStatic:list") @@ -153,28 +131,7 @@ public class ComplaintStaticController extends BaseController { public TableDataInfo complaint2(SearchType searchType) { ComplaintStatistics complaintStatistics=dateMake(searchType); List complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsList(complaintStatistics);//权限 - int number=complaintStatisticsList.size(); - Map map=complaintStatisticsList.stream().collect(Collectors.groupingBy(item->item.getComplaintType()==null?100:item.getComplaintType(),Collectors.counting())); - Map dictDataMap=dictDataMapper.selectDictDataByType("caseType").stream().collect(Collectors.toMap(DictData::getDictValue,DictData::getDictLabel)); - List list=new ArrayList<>(); - for(int i:map.keySet()){ - StatisticsIndicator s=new StatisticsIndicator(); - if(i==100){ - s.setName(""); - s.setNumInt(Integer.parseInt(map.get(100)+"")); - s.setPercentage((double)map.get(100)/number); - }else { - if(dictDataMap.containsKey(i+"")){ - s.setName(dictDataMap.get(i+"")); - }else { - s.setName(i+""); - } - s.setNumInt(Integer.parseInt(map.get(i)+"")); - s.setPercentage((double)map.get(i)/number); - } - list.add(s); - } - return getDataTable(list); + return getDataTable(complaintStatisticsService.type(complaintStatisticsList)); } @RequiresPermissions("code:complaintStatic:list") @PostMapping("/eType") @@ -184,6 +141,67 @@ public class ComplaintStaticController extends BaseController { complaintStatistics.setComplaintDepartmentId(iDeptService.selectDeptByDeptName2(searchType.getName()).getDeptId()); return complaintStatisticsService.selectComplaintStatisticsGroupByType(complaintStatistics); } + @PostMapping("/export1") + @ResponseBody + public void export1(HttpServletResponse httpServletResponse,@RequestBody SearchType searchType) throws IOException { + ComplaintStatistics complaintStatistics=dateMake(searchType); + List complaintStatisticsList=complaintStatisticsService.list1(searchType,complaintStatistics); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("执法投诉统计"); + //设置文件名称 + String fileName = "执法投诉统计.xls"; + //设置表头 + String[] headerList = {"被投诉对象", "投诉数量"}; + HSSFRow headerRow = sheet.createRow(0); + for (int i = 0; i < headerList.length; i++) { + HSSFCell cell = headerRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(headerList[i]); + cell.setCellValue(text); + } + for(int i=0;i complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsList(complaintStatistics);//权限 + List statisticsIndicatorList=complaintStatisticsService.type(complaintStatisticsList); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("投诉类型统计"); + //设置文件名称 + String fileName = "投诉类型统计.xls"; + //设置表头 + String[] headerList = {"企业类型", "企业数量", "占比"}; + HSSFRow headerRow = sheet.createRow(0); + for (int i = 0; i < headerList.length; i++) { + HSSFCell cell = headerRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(headerList[i]); + cell.setCellValue(text); + } + for(int i=0;i enforcementInspectionProgramDtos = + enforcementInspectionProgramService.staticProgram(enforcementInspectionProgramDto); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("检查计划统计"); + //设置文件名称 + String fileName = "检查计划统计.xls"; + //设置表头 + String[] headerList = {"执法部门", "年度计划", "季度计划", "月度计划"}; + HSSFRow headerRow = sheet.createRow(0); + for (int i = 0; i < headerList.length; i++) { + HSSFCell cell = headerRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(headerList[i]); + cell.setCellValue(text); + } + for(int i=0;i enforcementRegistrationDtos = enforcementRegistrationService. + staticEnforcementRegistrationLI(enforcementRegistrationDto); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("执法分析"); + //设置文件名称 + String fileName = "执法分析.xls"; + //设置表头 + String[] headerList = {"区域", "街道", "企业名称","执法部门", "执法人员", "检查事项","检查次数", "2次及以下", "3至4次(黄色)", "5至6次(橙色)" ,"7次及以上(红色)"}; + HSSFRow headerRow = sheet.createRow(0); + for (int i = 0; i < headerList.length; i++) { + HSSFCell cell = headerRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(headerList[i]); + cell.setCellValue(text); + } + for(int i=0;i=7) { + row.createCell(10).setCellValue(enforcementRegistrationDtos.get(i).getTotal()); + } + } + httpServletResponse.setCharacterEncoding("UTF-8"); + httpServletResponse.setContentType("application/vnd.ms-excel"); + httpServletResponse.setHeader("Content-disposition", "attachment;filename=" + fileName); + httpServletResponse.flushBuffer(); + workbook.write(httpServletResponse.getOutputStream()); + workbook.close(); + } } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticsEnterpriseController.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticsEnterpriseController.java index 200ab279..7f526dd2 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticsEnterpriseController.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/controller/StatisticsEnterpriseController.java @@ -317,9 +317,21 @@ public class StatisticsEnterpriseController extends BaseController { return false; } + @PostMapping("/export1") + @ResponseBody + public void export1(HttpServletResponse httpServletResponse,@RequestBody SearchType searchType) throws IOException { + if(searchType.getJd()!=null&&!"".equals(searchType.getJd())){ + searchType.setJd(iDictDataService.selectDictLabel(searchType.getQy(), searchType.getJd())); + } + if(searchType.getQy()!=null&&!"".equals(searchType.getQy())){ + searchType.setQy(iDictDataService.selectDictLabel("address_type", searchType.getQy())); + } + statisticsEnterpriseService.qyAllList(httpServletResponse,searchType); + } + @PostMapping("/export2") @ResponseBody - public void exportDept(HttpServletResponse httpServletResponse) throws IOException { + public void export2(HttpServletResponse httpServletResponse) throws IOException { List enterpriseInformationList=iEnterpriseInformationService.selectEnterpriseInformationList1(new EnterpriseInformation()); List statisticsIndicatorList=statisticsEnterpriseService.type(enterpriseInformationList); HSSFWorkbook workbook = new HSSFWorkbook(); @@ -336,12 +348,9 @@ public class StatisticsEnterpriseController extends BaseController { } for(int i=0;i lawEnforcementWarningListList=iLawEnforcementWarningListService.selectLawEnforcementWarningListList1(lawEnforcementWarningList); + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("执法预警统计"); + //设置文件名称 + String fileName = "执法预警统计.xls"; + //设置表头 + String[] headerList = {"执法部门", "预警时段", "预警次数"}; + HSSFRow headerRow = sheet.createRow(0); + for (int i = 0; i < headerList.length; i++) { + HSSFCell cell = headerRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(headerList[i]); + cell.setCellValue(text); + } + for(int i=0;i selectEnterpriseInformationList(EnterpriseInformation enterpriseInformation); List selectEnterpriseInformationList1(EnterpriseInformation enterpriseInformation); + List selectEnterpriseInformationByAddress(SearchType searchType); /** * 查询企业信息以及二维码信息 * @param enterpriseInformation diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComplaintStatisticsService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComplaintStatisticsService.java index 581c4836..8e1dc667 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComplaintStatisticsService.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ComplaintStatisticsService.java @@ -2,6 +2,8 @@ package com.zdxt.code.service; import com.zdxt.code.domain.ComplaintStatistics; import com.zdxt.code.domain.EnterpriseComplaint; +import com.zdxt.code.domain.SearchType; +import com.zdxt.code.domain.StatisticsIndicator; import java.util.List; @@ -14,4 +16,8 @@ public interface ComplaintStatisticsService { List selectComplaintStatisticsGroupByType(ComplaintStatistics complaintStatistics); void insertComplaintStatistics(EnterpriseComplaint enterpriseComplaint); + + List type(List complaintStatisticsList); + + List list1(SearchType searchType, ComplaintStatistics complaintStatistics); } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticsEnterpriseService.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticsEnterpriseService.java index ee9011f2..121afcb0 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticsEnterpriseService.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/StatisticsEnterpriseService.java @@ -1,10 +1,15 @@ package com.zdxt.code.service; import com.zdxt.code.domain.EnterpriseInformation; +import com.zdxt.code.domain.SearchType; import com.zdxt.code.domain.StatisticsIndicator; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; public interface StatisticsEnterpriseService { + void qyAllList(HttpServletResponse response, SearchType searchType) throws IOException; + List type(List enterpriseInformationList); } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java index 2d5f3d24..1621e96d 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/ComplaintStatisticsImpl.java @@ -1,19 +1,22 @@ package com.zdxt.code.service.impl; import com.zdxt.auth.project.system.dept.service.IDeptService; +import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; import com.zdxt.code.domain.ComplaintStatistics; import com.zdxt.code.domain.EnterpriseComplaint; +import com.zdxt.code.domain.SearchType; +import com.zdxt.code.domain.StatisticsIndicator; import com.zdxt.code.mapper.ComplaintStatisticsMapper; import com.zdxt.code.service.ComplaintStatisticsService; import com.zdxt.domain.auth.Dept; +import com.zdxt.domain.auth.DictData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.xml.crypto.Data; import java.text.SimpleDateFormat; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.List; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; @Service public class ComplaintStatisticsImpl implements ComplaintStatisticsService { @@ -21,6 +24,8 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { private ComplaintStatisticsMapper complaintStatisticsMapper; @Autowired private IDeptService iDeptService; + @Autowired + private DictDataMapper dictDataMapper; @Override public List selectComplaintStatisticsList(ComplaintStatistics complaintStatistics){ return complaintStatisticsMapper.selectComplaintStatisticsList(complaintStatistics); @@ -37,34 +42,6 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { @Override public void insertComplaintStatistics(EnterpriseComplaint enterpriseComplaint) { SimpleDateFormat str = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - /*if (enterpriseComplaint.getComplaintDepartmentIds() != null && !"".equals(enterpriseComplaint.getComplaintDepartmentIds())) { - List departmentIdList = Arrays.asList(enterpriseComplaint.getComplaintDepartmentIds().split(",")); - if (!departmentIdList.isEmpty()) { - for (String s : departmentIdList) { - ComplaintStatistics complaintStatistics = new ComplaintStatistics(); - complaintStatistics.setCid(enterpriseComplaint.getId()); - if (enterpriseComplaint.getRelId() != null && !"".equals(enterpriseComplaint.getRelId())) { - complaintStatistics.setRid(enterpriseComplaint.getRelId()); - } - complaintStatistics.setComplaintTime(str.format(enterpriseComplaint.getCreateTime()));//同步投诉创建时间 - if (enterpriseComplaint.getComplaintType() != null) { - complaintStatistics.setComplaintType(enterpriseComplaint.getComplaintType()); - } - if (enterpriseComplaint.getEnterpriseName() != null && !"".equals(enterpriseComplaint.getEnterpriseName())) { - complaintStatistics.setEnterpriseName(enterpriseComplaint.getEnterpriseName()); - } - if (enterpriseComplaint.getEnterpriseNumber() != null && !"".equals(enterpriseComplaint.getEnterpriseNumber())) { - complaintStatistics.setEnterpriseNumber(enterpriseComplaint.getEnterpriseNumber()); - } - complaintStatistics.setComplaintDepartmentId(s); - String sName = iDeptService.selectDeptById(s).getDeptName(); - if (sName != null && !"".equals(sName)) { - complaintStatistics.setComplaintDepartment(sName); - } - complaintStatisticsMapper.insertComplaintStatistics(complaintStatistics); - } - } - }*/ if(enterpriseComplaint.getRelId()==null||"".equals(enterpriseComplaint.getRelId())){//入企不扫码 List departmentIdList = Arrays.asList(enterpriseComplaint.getComplaintItemCodes().split(",")); if (!departmentIdList.isEmpty()) { @@ -152,4 +129,52 @@ public class ComplaintStatisticsImpl implements ComplaintStatisticsService { } System.out.println("同步到投诉统计表"); } + @Override + public List type(List complaintStatisticsList){ + int number=complaintStatisticsList.size(); + Map map=complaintStatisticsList.stream().collect(Collectors.groupingBy(item->item.getComplaintType()==null?100:item.getComplaintType(),Collectors.counting())); + Map dictDataMap=dictDataMapper.selectDictDataByType("caseType").stream().collect(Collectors.toMap(DictData::getDictValue,DictData::getDictLabel)); + List list=new ArrayList<>(); + for(int i:map.keySet()){ + StatisticsIndicator s=new StatisticsIndicator(); + if(i==100){ + s.setName(""); + s.setNumInt(Integer.parseInt(map.get(100)+"")); + s.setPercentage((double)map.get(100)/number); + }else { + if(dictDataMap.containsKey(i+"")){ + s.setName(dictDataMap.get(i+"")); + }else { + s.setName(i+""); + } + s.setNumInt(Integer.parseInt(map.get(i)+"")); + s.setPercentage((double)map.get(i)/number); + } + list.add(s); + } + return list; + } + @Override + public List list1(SearchType searchType,ComplaintStatistics complaintStatistics){ + if(searchType.getCType()!=null&&!"".equals(searchType.getCType())) { + complaintStatistics.setComplaintType(Integer.parseInt(searchType.getCType())); + } + Map deptMap=new HashMap<>(); + if(searchType.getName()!=null&&!"".equals(searchType.getName())){//搜索条件内有投诉对象时 + List deptList=iDeptService.selectDeptByDeptName(searchType.getName()); + deptMap=deptList.stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); + complaintStatistics.setComplaintDepartmentIdList(new ArrayList<>(deptMap.keySet())); + }else { + deptMap=iDeptService.selectDeptAll().stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); + } + List complaintStatisticsList=complaintStatisticsMapper.selectComplaintStatisticsGroup(complaintStatistics); + for (int i=0;idictDataList=iDictDataService.selectDictDataByType("address_type");//有序->区 + Map dictDataMap=dictDataList.stream().collect(Collectors.toMap(DictData::getDictValue,DictData::getDictLabel)); + List enterpriseInformationList=enterpriseInformationMapper.selectEnterpriseInformationByAddress(searchType); + for(DictData dictData:dictDataList){ + String qyName=dictData.getDictLabel(); + List qyList=new ArrayList<>(); + if(qyName.equals("光明区")){ + qyList=enterpriseInformationList.stream().filter(item->item.getEnterpriseAddress().startsWith("深圳市光明区")||item.getEnterpriseAddress().startsWith("深圳市光明新区")).collect(Collectors.toList()); + }else { + qyList = enterpriseInformationList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + qyName)).collect(Collectors.toList()); + } + if(qyList.size()>0){ + List existList = qyList.stream().filter(item -> item.getIsDelete() == 0).collect(Collectors.toList()); + List logoutList = qyList.stream().filter(item -> item.getIsDelete() == 1).collect(Collectors.toList()); + HSSFRow s1row= sheet1.createRow(qyRowNum); + s1row.createCell(0).setCellValue(qyName); + s1row.createCell(1).setCellValue(qyList.size()); + s1row.createCell(2).setCellValue(existList.size()); + s1row.createCell(3).setCellValue(logoutList.size()); + qyRowNum++; + //街道页 + HSSFSheet sheet = workbook.createSheet(qyName); + //设置表头 + String[] hList = {"区域", "街道", "企业数量", "续存企业数量","注销企业数量"}; + int jdRowNum=0; + HSSFRow hRow = sheet.createRow(jdRowNum); + jdRowNum++; + for (int i = 0; i < hList.length; i++) { + HSSFCell hCell = hRow.createCell(i); + HSSFRichTextString text = new HSSFRichTextString(hList[i]); + hCell.setCellValue(text); + } + ListjdDictDataList=iDictDataService.selectDictDataByType(dictData.getDictValue());//有序->街道 + for(DictData jd:jdDictDataList){ + String jdName=jd.getDictLabel(); + List jdList=new ArrayList<>(); + if(qyName.equals("光明区")){ + jdList=enterpriseInformationList.stream().filter(item->item.getEnterpriseAddress().startsWith("深圳市光明区"+jdName)||item.getEnterpriseAddress().startsWith("深圳市光明新区"+jdName)).collect(Collectors.toList()); + }else { + jdList = enterpriseInformationList.stream().filter(item -> item.getEnterpriseAddress().startsWith("深圳市" + qyName+jdName)).collect(Collectors.toList()); + } + if(jdList.size()>0){ + List jdExistList = jdList.stream().filter(item -> item.getIsDelete() == 0).collect(Collectors.toList()); + List jdEogoutList = jdList.stream().filter(item -> item.getIsDelete() == 1).collect(Collectors.toList()); + HSSFRow row= sheet.createRow(jdRowNum); + row.createCell(0).setCellValue(qyName); + row.createCell(1).setCellValue(jdName); + row.createCell(2).setCellValue(jdList.size()); + row.createCell(3).setCellValue(jdExistList.size()); + row.createCell(4).setCellValue(jdEogoutList.size()); + jdRowNum++; + } + } + List jdqtList=qyList.stream().filter(item->!jdMake(qyName,jdDictDataList,item.getEnterpriseAddress())).collect(Collectors.toList()); + if(jdqtList.size()>0){ + List jdqtExistList = jdqtList.stream().filter(item -> item.getIsDelete() == 0).collect(Collectors.toList()); + List jdqtLogoutList = jdqtList.stream().filter(item -> item.getIsDelete() == 1).collect(Collectors.toList()); + HSSFRow row= sheet.createRow(jdRowNum); + row.createCell(0).setCellValue(qyName); + row.createCell(1).setCellValue("其他"); + row.createCell(2).setCellValue(jdqtList.size()); + row.createCell(3).setCellValue(jdqtExistList.size()); + row.createCell(4).setCellValue(jdqtLogoutList.size()); + } + } + } + List qyqtList=enterpriseInformationList.stream().filter(item->!qyMake(dictDataList,item.getEnterpriseAddress())).collect(Collectors.toList()); + if(qyqtList.size()>0){ + List qyqtExistList = qyqtList.stream().filter(item -> item.getIsDelete() == 0).collect(Collectors.toList()); + List qyqtLogoutList = qyqtList.stream().filter(item -> item.getIsDelete() == 1).collect(Collectors.toList()); + HSSFRow s1row= sheet1.createRow(qyRowNum); + s1row.createCell(0).setCellValue("其他"); + s1row.createCell(1).setCellValue(qyqtList.size()); + s1row.createCell(2).setCellValue(qyqtExistList.size()); + s1row.createCell(3).setCellValue(qyqtLogoutList.size()); + } + //设置流格式 + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName); + response.flushBuffer(); + workbook.write(response.getOutputStream()); + workbook.close(); + } + public Boolean qyMake(List stringList,String s){ + for (DictData dictData : stringList) { + if(dictData.getDictLabel().equals("光明区")){ + if (s.startsWith("深圳市" + dictData.getDictLabel())||s.startsWith("深圳市光明新区")) { + return true; + } + }else { + if (s.startsWith("深圳市" + dictData.getDictLabel())) { + return true; + } + } + } + return false; + } + public Boolean jdMake(String qy,List stringList,String s){ + if(qy.equals("光明区")){ + for(DictData d:stringList){ + if(s.startsWith("深圳市"+qy+d.getDictLabel())||s.startsWith("深圳市光明新区"+d.getDictLabel())){ + return true; + } + } + }else { + for (DictData d : stringList) { + if (s.startsWith("深圳市"+qy+d.getDictLabel())) { + return true; + } + } + } + return false; + } @Override public List type(List enterpriseInformationList){ Listlist=iDictDataService.selectDictDataByType("enterpriseType"); diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml index 18643a1b..7fbb5a72 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml @@ -81,6 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and enterprise_address is not null +