案件统计需求修改。

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);
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 = "级别")
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 + '\'' +
'}';
}
}

View File

@ -2150,9 +2150,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
}
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"序号", "级别", "数量"};
String[] headers = {"序号", "级别", "已上报数量", "已处理数量", "自处理数量"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
for (String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
@ -2165,7 +2165,9 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
List<Object> 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<CaseCountDTO> dataCountLevel1(Map<String, Object> params) {
List<Map<String, Object>> resultMap = reportCaseDao.countData(params);
CaseCountDTO caseCountDTO = new CaseCountDTO();
caseCountDTO.setName("全区");
caseCountDTO.setCount(resultMap.get(0).get("count").toString());
caseCountDTO.setLevel(1);
List<Map<String, Object>> allCountMap = reportCaseDao.allCountData(params);
params.put("isSelf", "yes");
List<Map<String, Object>> 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<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;
}
@ -2200,15 +2216,18 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
// 获取所有的街道数据
params.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c");
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<CaseCountDTO> caseCountDTOList = new ArrayList<>();
for (DictDTO dictDTO : dictDTOS) {
for (Map<String, Object> 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<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;
}
@ -2229,17 +2273,20 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
// 获取所有的街道数据
List<CommunityDTO> communityDTOS = communityService.listCommunity(params);
params.put("community", "yes");
if(null == params.get("areaId")) {
if (null == params.get("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<>();
for (CommunityDTO communityDTO : communityDTOS) {
for (Map<String, Object> 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<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;
}
@ -2258,15 +2330,19 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
*/
private List<CaseCountDTO> dataCountLevel4(Map<String, Object> params) {
params.put("creator", "yes");
if(null == params.get("communityId")) {
if (null == params.get("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<>();
for (Map<String, Object> 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<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;
}
}

View File

@ -118,12 +118,15 @@
<resultMap id="countMap" type="java.util.Map">
<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="areaName" column="area_name"/>
<result property="communityId" column="community_id"/>
<result property="communityName" column="community_name"/>
<result property="caseReporter" column="case_reporter"/>
<result property="creator" column="creator"/>
<result property="caseId" column="case_id"/>
</resultMap>
<select id="listPageReportDelete" parameterType="map" resultMap="reportCaseDTO">
@ -2225,24 +2228,28 @@
</if>
</select>
<select id="countData" parameterType="map" resultMap="countMap">
<select id="selfCountData" 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>
COUNT(*) count
<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>
COUNT(*) count
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 creator <![CDATA[ <> ]]> '1'
<if test="area != null and area != ''">
GROUP BY area_id
</if>
@ -2254,19 +2261,52 @@
AND community_id = #{communityId}
GROUP BY creator
</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 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>

View File

@ -23,12 +23,16 @@
<table class="layui-table">
<colgroup>
<col width="200">
<col width="150">
<col width="130">
<col width="130">
<col width="130">
</colgroup>
<thead>
<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>
</tr>
</thead>
<tbody id="areaUserCountBox"></tbody>
@ -45,7 +49,13 @@
data-prpeDataId="{{item.prpeDataId}}">{{item.name}}</a>
</td>
<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>
</tr>
{{# } }}
@ -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}';