From 256a073e8a026b412aa9786415efb533eec92410 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Wed, 17 Apr 2024 17:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E7=BB=9F=E8=AE=A1=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/reportcase/IReportCaseDao.java | 6 +- .../pojo/dtos/reportcase/CaseCountDTO.java | 46 +++++- .../impl/ReportCaseServiceImpl.java | 135 +++++++++++++++--- .../mapper/reportcase/reportcase-mapper.xml | 94 ++++++++---- .../route/reportcase/list-area-case.html | 18 ++- 5 files changed, 242 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/cm/systemcity/dao/reportcase/IReportCaseDao.java b/src/main/java/com/cm/systemcity/dao/reportcase/IReportCaseDao.java index 99bba36..27409d0 100755 --- a/src/main/java/com/cm/systemcity/dao/reportcase/IReportCaseDao.java +++ b/src/main/java/com/cm/systemcity/dao/reportcase/IReportCaseDao.java @@ -385,5 +385,9 @@ public interface IReportCaseDao { Integer countReportCaseAssign(Map reportCaseAssignMap); - List> countData(Map params); + List> selfCountData(Map params); + + List> allCountData(Map params); + + Integer handleCountData(Map params); } diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/reportcase/CaseCountDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/reportcase/CaseCountDTO.java index 7737c59..dd6f6c7 100644 --- a/src/main/java/com/cm/systemcity/pojo/dtos/reportcase/CaseCountDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/reportcase/CaseCountDTO.java @@ -11,8 +11,12 @@ public class CaseCountDTO { @ApiModelProperty(name = "name", value = "级别") private String name; - @ApiModelProperty(name = "count", value = "数量") - private String count; + @ApiModelProperty(name = "selfCount", value = "自处理数量") + private String selfCount; + @ApiModelProperty(name = "allCount", value = "总上报数量") + private String allCount; + @ApiModelProperty(name = "handleCount", value = "已处理数量") + private String handleCount; @ApiModelProperty(name = "level", value = "级别") private Integer level; @ApiModelProperty(name = "dataId", value = "数据ID") @@ -21,6 +25,8 @@ public class CaseCountDTO { private String prpeDataId; @ApiModelProperty(name = "dataId", value = "上一级级别") private Integer prpeLevel; + @ApiModelProperty(name = "userId", value = "网格员ID") + private String userId; public String getName() { return name; @@ -30,12 +36,28 @@ public class CaseCountDTO { this.name = name; } - public String getCount() { - return count; + public String getSelfCount() { + return selfCount; } - public void setCount(String count) { - this.count = count; + public void setSelfCount(String selfCount) { + this.selfCount = selfCount; + } + + public String getAllCount() { + return allCount; + } + + public void setAllCount(String allCount) { + this.allCount = allCount; + } + + public String getHandleCount() { + return handleCount; + } + + public void setHandleCount(String handleCount) { + this.handleCount = handleCount; } public Integer getLevel() { @@ -70,11 +92,21 @@ public class CaseCountDTO { this.prpeLevel = prpeLevel; } + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + @Override public String toString() { return "CaseCountDTO{" + "name='" + name + '\'' + - ", count='" + count + '\'' + + ", selfCount='" + selfCount + '\'' + + ", allCount='" + allCount + '\'' + + ", handleCount='" + handleCount + '\'' + '}'; } } diff --git a/src/main/java/com/cm/systemcity/service/reportcase/impl/ReportCaseServiceImpl.java b/src/main/java/com/cm/systemcity/service/reportcase/impl/ReportCaseServiceImpl.java index 01b049c..41f7f5f 100755 --- a/src/main/java/com/cm/systemcity/service/reportcase/impl/ReportCaseServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/reportcase/impl/ReportCaseServiceImpl.java @@ -2150,9 +2150,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer } response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); - String [] headers = {"序号", "级别", "数量"}; + String[] headers = {"序号", "级别", "已上报数量", "已处理数量", "自处理数量"}; List> listHeader = new ArrayList<>(); - for(String item : headers) { + for (String item : headers) { List title = new ArrayList<>(); title.add(item); listHeader.add(title); @@ -2165,7 +2165,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer List data = new ArrayList<>(); data.add(i); data.add(caseCountDTO.getName()); - data.add(caseCountDTO.getCount()); + data.add(caseCountDTO.getAllCount()); + data.add(caseCountDTO.getHandleCount()); + data.add(caseCountDTO.getSelfCount()); listData.add(data); } try { @@ -2181,13 +2183,27 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer * @param params */ private List dataCountLevel1(Map params) { - List> resultMap = reportCaseDao.countData(params); - CaseCountDTO caseCountDTO = new CaseCountDTO(); - caseCountDTO.setName("全区"); - caseCountDTO.setCount(resultMap.get(0).get("count").toString()); - caseCountDTO.setLevel(1); + List> allCountMap = reportCaseDao.allCountData(params); + params.put("isSelf", "yes"); + List> resultMap = reportCaseDao.selfCountData(params); + Integer handleCount = reportCaseDao.handleCountData(params); + CaseCountDTO dto = new CaseCountDTO(); + dto.setName("全区"); + dto.setSelfCount(resultMap.get(0).get("count").toString()); + dto.setAllCount(String.valueOf(allCountMap.size())); + dto.setHandleCount(handleCount.toString()); + dto.setLevel(1); List caseCountDTOList = new ArrayList<>(); - caseCountDTOList.add(caseCountDTO); + caseCountDTOList.add(dto); + + List caseIdList = new ArrayList<>(); + for (Map stringObjectMap : allCountMap) { + caseIdList.add(stringObjectMap.get("caseId").toString()); + } + + params.put("caseIds", caseIdList); + Integer i = reportCaseDao.handleCountData(params); + caseCountDTOList.get(0).setHandleCount(i.toString()); return caseCountDTOList; } @@ -2200,15 +2216,18 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer // 获取所有的街道数据 params.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c"); params.put("area", "yes"); - List> resultMapList = reportCaseDao.countData(params); + List> allCountMap = reportCaseDao.allCountData(params); + params.put("isSelf", "yes"); + List> resultMapList = reportCaseDao.selfCountData(params); List dictDTOS = dictService.listDict(params); List caseCountDTOList = new ArrayList<>(); + for (DictDTO dictDTO : dictDTOS) { for (Map stringObjectMap : resultMapList) { if (dictDTO.getDictId().equals(stringObjectMap.get("areaId").toString())) { CaseCountDTO caseCountDTO = new CaseCountDTO(); caseCountDTO.setName(dictDTO.getDictName()); - caseCountDTO.setCount(stringObjectMap.get("count").toString()); + caseCountDTO.setSelfCount(stringObjectMap.get("count").toString()); caseCountDTO.setDataId(stringObjectMap.get("areaId").toString()); caseCountDTO.setLevel(2); caseCountDTO.setPrpeLevel(1); @@ -2217,6 +2236,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer } } } + + Map> caseIdMap = new HashMap<>(); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + List caseIdList = new ArrayList<>(); + int allCount = 0; + for (Map stringObjectMap : allCountMap) { + if (caseCountDTO.getDataId().equals(stringObjectMap.get("areaId").toString())) { + caseIdList.add(stringObjectMap.get("caseId").toString()); + allCount++; + caseCountDTO.setAllCount(Integer.toString(allCount)); + } + } + caseIdMap.put(caseCountDTO.getDataId(), caseIdList); + } + + for (String key : caseIdMap.keySet()) { + params.put("caseIds", caseIdMap.get(key)); + Integer i = reportCaseDao.handleCountData(params); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + if (key.equals(caseCountDTO.getDataId())) { + caseCountDTO.setHandleCount(i.toString()); + } + } + } + return caseCountDTOList; } @@ -2229,17 +2273,20 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer // 获取所有的街道数据 List communityDTOS = communityService.listCommunity(params); params.put("community", "yes"); - if(null == params.get("areaId")) { + if (null == params.get("areaId")) { throw new SearchException("areaId不能为空"); } - List> resultMapList = reportCaseDao.countData(params); + + List> allCountMap = reportCaseDao.allCountData(params); + params.put("isSelf", "yes"); + List> resultMapList = reportCaseDao.selfCountData(params); List caseCountDTOList = new ArrayList<>(); for (CommunityDTO communityDTO : communityDTOS) { for (Map stringObjectMap : resultMapList) { if (communityDTO.getCommunityId().equals(stringObjectMap.get("communityId").toString())) { CaseCountDTO caseCountDTO = new CaseCountDTO(); caseCountDTO.setName(communityDTO.getCommunityName()); - caseCountDTO.setCount(stringObjectMap.get("count").toString()); + caseCountDTO.setSelfCount(stringObjectMap.get("count").toString()); caseCountDTO.setDataId(stringObjectMap.get("communityId").toString()); caseCountDTO.setLevel(3); caseCountDTO.setPrpeLevel(2); @@ -2248,6 +2295,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer } } } + + Map> caseIdMap = new HashMap<>(); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + List caseIdList = new ArrayList<>(); + int allCount = 0; + for (Map stringObjectMap : allCountMap) { + if (caseCountDTO.getDataId().equals(stringObjectMap.get("communityId").toString())) { + caseIdList.add(stringObjectMap.get("caseId").toString()); + allCount++; + caseCountDTO.setAllCount(Integer.toString(allCount)); + } + } + caseIdMap.put(caseCountDTO.getDataId(), caseIdList); + } + + for (String key : caseIdMap.keySet()) { + params.put("caseIds", caseIdMap.get(key)); + Integer i = reportCaseDao.handleCountData(params); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + if (key.equals(caseCountDTO.getDataId())) { + caseCountDTO.setHandleCount(i.toString()); + } + } + } + return caseCountDTOList; } @@ -2258,15 +2330,19 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer */ private List dataCountLevel4(Map params) { params.put("creator", "yes"); - if(null == params.get("communityId")) { + if (null == params.get("communityId")) { throw new SearchException("communityId不能为空"); } - List> maps = reportCaseDao.countData(params); + + List> allCountMap = reportCaseDao.allCountData(params); + params.put("isSelf", "yes"); + List> maps = reportCaseDao.selfCountData(params); List caseCountDTOList = new ArrayList<>(); for (Map map : maps) { CaseCountDTO caseCountDTO = new CaseCountDTO(); + caseCountDTO.setUserId(map.get("creator").toString()); caseCountDTO.setName(map.get("caseReporter").toString()); - caseCountDTO.setCount(map.get("count").toString()); + caseCountDTO.setSelfCount(map.get("count").toString()); caseCountDTO.setDataId(map.get("creator").toString()); caseCountDTO.setLevel(4); caseCountDTO.setPrpeLevel(3); @@ -2274,6 +2350,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer caseCountDTO.setDataId(params.get("communityId").toString()); caseCountDTOList.add(caseCountDTO); } + + Map> caseIdMap = new HashMap<>(); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + List caseIdList = new ArrayList<>(); + int allCount = 0; + for (Map stringObjectMap : allCountMap) { + if (caseCountDTO.getUserId().equals(stringObjectMap.get("creator").toString())) { + caseIdList.add(stringObjectMap.get("caseId").toString()); + allCount++; + caseCountDTO.setAllCount(Integer.toString(allCount)); + } + } + caseIdMap.put(caseCountDTO.getDataId(), caseIdList); + } + + for (String key : caseIdMap.keySet()) { + params.put("caseIds", caseIdMap.get(key)); + Integer i = reportCaseDao.handleCountData(params); + for (CaseCountDTO caseCountDTO : caseCountDTOList) { + if (key.equals(caseCountDTO.getDataId())) { + caseCountDTO.setHandleCount(i.toString()); + } + } + } + return caseCountDTOList; } } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/reportcase/reportcase-mapper.xml b/src/main/resources/mybatis/mapper/reportcase/reportcase-mapper.xml index 3122bbe..3fa96c8 100755 --- a/src/main/resources/mybatis/mapper/reportcase/reportcase-mapper.xml +++ b/src/main/resources/mybatis/mapper/reportcase/reportcase-mapper.xml @@ -118,12 +118,15 @@ + + - SELECT - - area_id, - area_name, - - - community_id, - community_name, - - - case_reporter, - creator, - - COUNT(*) count + + area_id, + area_name, + + + community_id, + community_name, + + + case_reporter, + creator, + + COUNT(*) count FROM city_report_case - WHERE is_self = 1 + WHERE 1 = 1 + + AND is_self = 1 + AND is_delete = 0 + AND creator ]]> '1' GROUP BY area_id @@ -2254,19 +2261,52 @@ AND community_id = #{communityId} GROUP BY creator - + + + \ No newline at end of file diff --git a/src/main/resources/static/route/reportcase/list-area-case.html b/src/main/resources/static/route/reportcase/list-area-case.html index 2abbc64..9b6a969 100644 --- a/src/main/resources/static/route/reportcase/list-area-case.html +++ b/src/main/resources/static/route/reportcase/list-area-case.html @@ -23,12 +23,16 @@ - + + + - + + + @@ -45,7 +49,13 @@ data-prpeDataId="{{item.prpeDataId}}">{{item.name}} + + {{# } }} @@ -97,7 +107,6 @@ var loadIndex = layer.load(0, {shade: 0.3}); top.restAjax.get(top.restAjax.path(url, [level, searchData, prpeDataId]), {}, null, function (code, data) { - debugger dataMsg.nowLevel = data[0].level; dataMsg.nowDataId = data[0].dataId; dataMsg.level = data[0].prpeLevel; @@ -141,7 +150,6 @@ var level = dataMsg.level; var dataId = dataMsg.dataId; var url; - debugger if(level == 1) { url = 'api/reportcase/data-counts/{level}';
级别数量已上报数量已处理数量自处理数量
- {{item.count}} + {{item.allCount}} + + {{item.handleCount}} + + {{item.selfCount}}