案件统计需求修改。

This commit is contained in:
Renpc-kilig 2024-04-17 17:32:23 +08:00
parent bb0a564ae4
commit 256a073e8a
5 changed files with 242 additions and 57 deletions

View File

@ -385,5 +385,9 @@ public interface IReportCaseDao {
Integer countReportCaseAssign(Map<String, Object> reportCaseAssignMap); Integer countReportCaseAssign(Map<String, Object> reportCaseAssignMap);
List<Map<String, Object>> countData(Map<String, Object> params); List<Map<String, Object>> selfCountData(Map<String, Object> params);
List<Map<String, Object>> allCountData(Map<String, Object> params);
Integer handleCountData(Map<String, Object> params);
} }

View File

@ -11,8 +11,12 @@ public class CaseCountDTO {
@ApiModelProperty(name = "name", value = "级别") @ApiModelProperty(name = "name", value = "级别")
private String name; private String name;
@ApiModelProperty(name = "count", value = "数量") @ApiModelProperty(name = "selfCount", value = "自处理数量")
private String count; private String selfCount;
@ApiModelProperty(name = "allCount", value = "总上报数量")
private String allCount;
@ApiModelProperty(name = "handleCount", value = "已处理数量")
private String handleCount;
@ApiModelProperty(name = "level", value = "级别") @ApiModelProperty(name = "level", value = "级别")
private Integer level; private Integer level;
@ApiModelProperty(name = "dataId", value = "数据ID") @ApiModelProperty(name = "dataId", value = "数据ID")
@ -21,6 +25,8 @@ public class CaseCountDTO {
private String prpeDataId; private String prpeDataId;
@ApiModelProperty(name = "dataId", value = "上一级级别") @ApiModelProperty(name = "dataId", value = "上一级级别")
private Integer prpeLevel; private Integer prpeLevel;
@ApiModelProperty(name = "userId", value = "网格员ID")
private String userId;
public String getName() { public String getName() {
return name; return name;
@ -30,12 +36,28 @@ public class CaseCountDTO {
this.name = name; this.name = name;
} }
public String getCount() { public String getSelfCount() {
return count; return selfCount;
} }
public void setCount(String count) { public void setSelfCount(String selfCount) {
this.count = count; 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() { public Integer getLevel() {
@ -70,11 +92,21 @@ public class CaseCountDTO {
this.prpeLevel = prpeLevel; this.prpeLevel = prpeLevel;
} }
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
@Override @Override
public String toString() { public String toString() {
return "CaseCountDTO{" + return "CaseCountDTO{" +
"name='" + name + '\'' + "name='" + name + '\'' +
", count='" + count + '\'' + ", selfCount='" + selfCount + '\'' +
", allCount='" + allCount + '\'' +
", handleCount='" + handleCount + '\'' +
'}'; '}';
} }
} }

View File

@ -2150,9 +2150,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
} }
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"序号", "级别", "数量"}; String[] headers = {"序号", "级别", "已上报数量", "已处理数量", "自处理数量"};
List<List<String>> listHeader = new ArrayList<>(); List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) { for (String item : headers) {
List<String> title = new ArrayList<>(); List<String> title = new ArrayList<>();
title.add(item); title.add(item);
listHeader.add(title); listHeader.add(title);
@ -2165,7 +2165,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
List<Object> data = new ArrayList<>(); List<Object> data = new ArrayList<>();
data.add(i); data.add(i);
data.add(caseCountDTO.getName()); data.add(caseCountDTO.getName());
data.add(caseCountDTO.getCount()); data.add(caseCountDTO.getAllCount());
data.add(caseCountDTO.getHandleCount());
data.add(caseCountDTO.getSelfCount());
listData.add(data); listData.add(data);
} }
try { try {
@ -2181,13 +2183,27 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
* @param params * @param params
*/ */
private List<CaseCountDTO> dataCountLevel1(Map<String, Object> params) { private List<CaseCountDTO> dataCountLevel1(Map<String, Object> params) {
List<Map<String, Object>> resultMap = reportCaseDao.countData(params); List<Map<String, Object>> allCountMap = reportCaseDao.allCountData(params);
CaseCountDTO caseCountDTO = new CaseCountDTO(); params.put("isSelf", "yes");
caseCountDTO.setName("全区"); List<Map<String, Object>> resultMap = reportCaseDao.selfCountData(params);
caseCountDTO.setCount(resultMap.get(0).get("count").toString()); Integer handleCount = reportCaseDao.handleCountData(params);
caseCountDTO.setLevel(1); 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<CaseCountDTO> caseCountDTOList = new ArrayList<>(); List<CaseCountDTO> caseCountDTOList = new ArrayList<>();
caseCountDTOList.add(caseCountDTO); caseCountDTOList.add(dto);
List<String> caseIdList = new ArrayList<>();
for (Map<String, Object> 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; return caseCountDTOList;
} }
@ -2200,15 +2216,18 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
// 获取所有的街道数据 // 获取所有的街道数据
params.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c"); params.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c");
params.put("area", "yes"); params.put("area", "yes");
List<Map<String, Object>> resultMapList = reportCaseDao.countData(params); List<Map<String, Object>> allCountMap = reportCaseDao.allCountData(params);
params.put("isSelf", "yes");
List<Map<String, Object>> resultMapList = reportCaseDao.selfCountData(params);
List<DictDTO> dictDTOS = dictService.listDict(params); List<DictDTO> dictDTOS = dictService.listDict(params);
List<CaseCountDTO> caseCountDTOList = new ArrayList<>(); List<CaseCountDTO> caseCountDTOList = new ArrayList<>();
for (DictDTO dictDTO : dictDTOS) { for (DictDTO dictDTO : dictDTOS) {
for (Map<String, Object> stringObjectMap : resultMapList) { for (Map<String, Object> stringObjectMap : resultMapList) {
if (dictDTO.getDictId().equals(stringObjectMap.get("areaId").toString())) { if (dictDTO.getDictId().equals(stringObjectMap.get("areaId").toString())) {
CaseCountDTO caseCountDTO = new CaseCountDTO(); CaseCountDTO caseCountDTO = new CaseCountDTO();
caseCountDTO.setName(dictDTO.getDictName()); caseCountDTO.setName(dictDTO.getDictName());
caseCountDTO.setCount(stringObjectMap.get("count").toString()); caseCountDTO.setSelfCount(stringObjectMap.get("count").toString());
caseCountDTO.setDataId(stringObjectMap.get("areaId").toString()); caseCountDTO.setDataId(stringObjectMap.get("areaId").toString());
caseCountDTO.setLevel(2); caseCountDTO.setLevel(2);
caseCountDTO.setPrpeLevel(1); caseCountDTO.setPrpeLevel(1);
@ -2217,6 +2236,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
} }
} }
} }
Map<String, List<String>> caseIdMap = new HashMap<>();
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
List<String> caseIdList = new ArrayList<>();
int allCount = 0;
for (Map<String, Object> 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; return caseCountDTOList;
} }
@ -2229,17 +2273,20 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
// 获取所有的街道数据 // 获取所有的街道数据
List<CommunityDTO> communityDTOS = communityService.listCommunity(params); List<CommunityDTO> communityDTOS = communityService.listCommunity(params);
params.put("community", "yes"); params.put("community", "yes");
if(null == params.get("areaId")) { if (null == params.get("areaId")) {
throw new SearchException("areaId不能为空"); throw new SearchException("areaId不能为空");
} }
List<Map<String, Object>> resultMapList = reportCaseDao.countData(params);
List<Map<String, Object>> allCountMap = reportCaseDao.allCountData(params);
params.put("isSelf", "yes");
List<Map<String, Object>> resultMapList = reportCaseDao.selfCountData(params);
List<CaseCountDTO> caseCountDTOList = new ArrayList<>(); List<CaseCountDTO> caseCountDTOList = new ArrayList<>();
for (CommunityDTO communityDTO : communityDTOS) { for (CommunityDTO communityDTO : communityDTOS) {
for (Map<String, Object> stringObjectMap : resultMapList) { for (Map<String, Object> stringObjectMap : resultMapList) {
if (communityDTO.getCommunityId().equals(stringObjectMap.get("communityId").toString())) { if (communityDTO.getCommunityId().equals(stringObjectMap.get("communityId").toString())) {
CaseCountDTO caseCountDTO = new CaseCountDTO(); CaseCountDTO caseCountDTO = new CaseCountDTO();
caseCountDTO.setName(communityDTO.getCommunityName()); caseCountDTO.setName(communityDTO.getCommunityName());
caseCountDTO.setCount(stringObjectMap.get("count").toString()); caseCountDTO.setSelfCount(stringObjectMap.get("count").toString());
caseCountDTO.setDataId(stringObjectMap.get("communityId").toString()); caseCountDTO.setDataId(stringObjectMap.get("communityId").toString());
caseCountDTO.setLevel(3); caseCountDTO.setLevel(3);
caseCountDTO.setPrpeLevel(2); caseCountDTO.setPrpeLevel(2);
@ -2248,6 +2295,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
} }
} }
} }
Map<String, List<String>> caseIdMap = new HashMap<>();
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
List<String> caseIdList = new ArrayList<>();
int allCount = 0;
for (Map<String, Object> 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; return caseCountDTOList;
} }
@ -2258,15 +2330,19 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
*/ */
private List<CaseCountDTO> dataCountLevel4(Map<String, Object> params) { private List<CaseCountDTO> dataCountLevel4(Map<String, Object> params) {
params.put("creator", "yes"); params.put("creator", "yes");
if(null == params.get("communityId")) { if (null == params.get("communityId")) {
throw new SearchException("communityId不能为空"); throw new SearchException("communityId不能为空");
} }
List<Map<String, Object>> maps = reportCaseDao.countData(params);
List<Map<String, Object>> allCountMap = reportCaseDao.allCountData(params);
params.put("isSelf", "yes");
List<Map<String, Object>> maps = reportCaseDao.selfCountData(params);
List<CaseCountDTO> caseCountDTOList = new ArrayList<>(); List<CaseCountDTO> caseCountDTOList = new ArrayList<>();
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
CaseCountDTO caseCountDTO = new CaseCountDTO(); CaseCountDTO caseCountDTO = new CaseCountDTO();
caseCountDTO.setUserId(map.get("creator").toString());
caseCountDTO.setName(map.get("caseReporter").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.setDataId(map.get("creator").toString());
caseCountDTO.setLevel(4); caseCountDTO.setLevel(4);
caseCountDTO.setPrpeLevel(3); caseCountDTO.setPrpeLevel(3);
@ -2274,6 +2350,31 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
caseCountDTO.setDataId(params.get("communityId").toString()); caseCountDTO.setDataId(params.get("communityId").toString());
caseCountDTOList.add(caseCountDTO); caseCountDTOList.add(caseCountDTO);
} }
Map<String, List<String>> caseIdMap = new HashMap<>();
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
List<String> caseIdList = new ArrayList<>();
int allCount = 0;
for (Map<String, Object> 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; return caseCountDTOList;
} }
} }

View File

@ -118,12 +118,15 @@
<resultMap id="countMap" type="java.util.Map"> <resultMap id="countMap" type="java.util.Map">
<result property="count" column="count"/> <result property="count" column="count"/>
<!--<result property="allCount" column="all_count"/>
<result property="handleCount" column="handle_count"/>-->
<result property="areaId" column="area_id"/> <result property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/> <result property="areaName" column="area_name"/>
<result property="communityId" column="community_id"/> <result property="communityId" column="community_id"/>
<result property="communityName" column="community_name"/> <result property="communityName" column="community_name"/>
<result property="caseReporter" column="case_reporter"/> <result property="caseReporter" column="case_reporter"/>
<result property="creator" column="creator"/> <result property="creator" column="creator"/>
<result property="caseId" column="case_id"/>
</resultMap> </resultMap>
<select id="listPageReportDelete" parameterType="map" resultMap="reportCaseDTO"> <select id="listPageReportDelete" parameterType="map" resultMap="reportCaseDTO">
@ -2225,24 +2228,28 @@
</if> </if>
</select> </select>
<select id="countData" parameterType="map" resultMap="countMap"> <select id="selfCountData" parameterType="map" resultMap="countMap">
SELECT SELECT
<if test="area != null and area != ''"> <if test="area != null and area != ''">
area_id, area_id,
area_name, area_name,
</if> </if>
<if test="community != null and community != ''"> <if test="community != null and community != ''">
community_id, community_id,
community_name, community_name,
</if> </if>
<if test="creator != null and creator != ''"> <if test="creator != null and creator != ''">
case_reporter, case_reporter,
creator, creator,
</if> </if>
COUNT(*) count COUNT(*) count
FROM city_report_case FROM city_report_case
WHERE is_self = 1 WHERE 1 = 1
<if test="isSelf != null and isSelf != ''">
AND is_self = 1
</if>
AND is_delete = 0 AND is_delete = 0
AND creator <![CDATA[ <> ]]> '1'
<if test="area != null and area != ''"> <if test="area != null and area != ''">
GROUP BY area_id GROUP BY area_id
</if> </if>
@ -2254,19 +2261,52 @@
AND community_id = #{communityId} AND community_id = #{communityId}
GROUP BY creator GROUP BY creator
</if> </if>
<!--<if test="areaList != null and areaList.size > 0">
AND area_id IN
<foreach collection="areaList" index="index" open="(" separator="," close=")">
#{areaList[${index}]}
</foreach>
</if>
<if test="communityList != null and communityList.size > 0">
AND community_id IN
<foreach collection="communityList" index="index" open="(" separator="," close=")">
#{communityList[${index}]}
</foreach>
</if>-->
</select> </select>
<select id="allCountData" parameterType="map" resultMap="countMap">
SELECT
<if test="area != null and area != ''">
area_id,
area_name,
</if>
<if test="community != null and community != ''">
community_id,
community_name,
</if>
<if test="creator != null and creator != ''">
case_reporter,
creator,
</if>
report_case_id case_id
FROM city_report_case
WHERE 1 = 1
<if test="isSelf != null and isSelf != ''">
AND is_self = 1
</if>
AND is_delete = 0
AND creator <![CDATA[ <> ]]> '1'
<if test="community != null and community != ''">
AND area_id = #{areaId}
</if>
<if test="creator != null and creator != ''">
AND community_id = #{communityId}
</if>
</select>
<select id="handleCountData" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
city_report_case_handle
WHERE
creator <![CDATA[ <> ]]> '1'
AND is_delete = 0
<if test="caseIds != null and caseIds.size > 0">
AND case_id IN
<foreach collection="caseIds" index="index" open="(" separator="," close=")">
#{caseIds[${index}]}
</foreach>
</if>
</select>
</mapper> </mapper>

View File

@ -23,12 +23,16 @@
<table class="layui-table"> <table class="layui-table">
<colgroup> <colgroup>
<col width="200"> <col width="200">
<col width="150"> <col width="130">
<col width="130">
<col width="130">
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
<th style="text-align: center;">级别</th> <th style="text-align: center;">级别</th>
<th style="text-align: center;">数量</th> <th style="text-align: center;">已上报数量</th>
<th style="text-align: center;">已处理数量</th>
<th style="text-align: center;">自处理数量</th>
</tr> </tr>
</thead> </thead>
<tbody id="areaUserCountBox"></tbody> <tbody id="areaUserCountBox"></tbody>
@ -45,7 +49,13 @@
data-prpeDataId="{{item.prpeDataId}}">{{item.name}}</a> data-prpeDataId="{{item.prpeDataId}}">{{item.name}}</a>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
<a href="javascript:void(0)">{{item.count}}</a> <a href="javascript:void(0)">{{item.allCount}}</a>
</td>
<td style="text-align: center;">
<a href="javascript:void(0)">{{item.handleCount}}</a>
</td>
<td style="text-align: center;">
<a href="javascript:void(0)">{{item.selfCount}}</a>
</td> </td>
</tr> </tr>
{{# } }} {{# } }}
@ -97,7 +107,6 @@
var loadIndex = layer.load(0, {shade: 0.3}); var loadIndex = layer.load(0, {shade: 0.3});
top.restAjax.get(top.restAjax.path(url, [level, searchData, prpeDataId]), top.restAjax.get(top.restAjax.path(url, [level, searchData, prpeDataId]),
{}, null, function (code, data) { {}, null, function (code, data) {
debugger
dataMsg.nowLevel = data[0].level; dataMsg.nowLevel = data[0].level;
dataMsg.nowDataId = data[0].dataId; dataMsg.nowDataId = data[0].dataId;
dataMsg.level = data[0].prpeLevel; dataMsg.level = data[0].prpeLevel;
@ -141,7 +150,6 @@
var level = dataMsg.level; var level = dataMsg.level;
var dataId = dataMsg.dataId; var dataId = dataMsg.dataId;
var url; var url;
debugger
if(level == 1) { if(level == 1) {
url = 'api/reportcase/data-counts/{level}'; url = 'api/reportcase/data-counts/{level}';