Browse Source

统计接口修复

hotfix/zhy
zhangyuan 4 years ago
parent
commit
fa5bffcee4
  1. 15
      epdc-cloud-analysis-pc/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenGovernanceDao.java
  2. 44
      epdc-cloud-analysis-pc/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenGovernanceServiceImpl.java
  3. 49
      epdc-cloud-analysis-pc/src/main/resources/mapper/screen/ScreenGovernanceDao.xml
  4. 2
      epdc-cloud-client-yushan
  5. 2
      epdc-cloud-commons-yushan
  6. 2
      epdc-cloud-parent-yushan

15
epdc-cloud-analysis-pc/src/main/java/com/elink/esua/epdc/modules/screen/dao/ScreenGovernanceDao.java

@ -2,10 +2,7 @@ package com.elink.esua.epdc.modules.screen.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.SysDeptDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenAgencyGovernDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernRankDataDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernanceResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGridGovernDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.*;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -27,6 +24,16 @@ public interface ScreenGovernanceDao extends BaseDao<ScreenGovernanceResultDTO>
*/
List<SysDeptDTO> getStreetList();
/**
* 获取组织项目数信息
*
* @param
* @return java.util.List<com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernItemInfoResultDTO>
* @author zhy
* @date 2021/11/18 15:34
*/
List<ScreenGovernItemInfoResultDTO> getAgencyItemInfoList();
/**
* 治理能力排行数据(按日统计)数据
* 网格统计

44
epdc-cloud-analysis-pc/src/main/java/com/elink/esua/epdc/modules/screen/service/impl/ScreenGovernanceServiceImpl.java

@ -7,10 +7,7 @@ import com.elink.esua.epdc.commons.tools.utils.DateUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.SysDeptDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.form.ScreenJobFormDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenAgencyGovernDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernRankDataDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernanceResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGridGovernDailyResultDTO;
import com.elink.esua.epdc.dto.analysis.pc.screen.result.*;
import com.elink.esua.epdc.modules.screen.dao.ScreenGovernanceDao;
import com.elink.esua.epdc.modules.screen.service.ScreenGovernanceService;
import com.elink.esua.epdc.utils.EpmetUtils;
@ -50,6 +47,16 @@ public class ScreenGovernanceServiceImpl extends BaseServiceImpl<ScreenGovernanc
List<ScreenGovernRankDataDailyResultDTO> agencyData = baseDao.governrankdatadailyAgency();
List<ScreenGovernRankDataDailyResultDTO> noRespData = baseDao.governrankdatadailyNoResp();
List<SysDeptDTO> streetList = baseDao.getStreetList();
// 保存每个社区和街道的项目总数用于将来的占比统计
List<ScreenGovernItemInfoResultDTO> agencyItemInfoList = baseDao.getAgencyItemInfoList();
int itemTotal = agencyItemInfoList.stream().mapToInt(ScreenGovernItemInfoResultDTO::getItemTotal).sum();
int itemSettleTotal = agencyItemInfoList.stream().mapToInt(ScreenGovernItemInfoResultDTO::getItemSettleTotal).sum();
agencyItemInfoList.forEach(item -> {
if (!"grid_party".equals(item.getTypeKey())) {
item.setItemTotal(itemTotal);
item.setItemSettleTotal(itemSettleTotal);
}
});
// 处理未响应和项目转入次数
noRespHandle(data, noRespData);
@ -62,6 +69,10 @@ public class ScreenGovernanceServiceImpl extends BaseServiceImpl<ScreenGovernanc
ScreenGovernRankDataDailyResultDTO agencyResult = agencyOptional.get();
agencyResult.setResponseCount(agencyResult.getResponseCount() + item.getResponseCount());
agencyResult.setTransferCount(agencyResult.getTransferCount() + item.getTransferCount());
agencyResult.setResolvedCount(agencyResult.getResolvedCount() + item.getResolvedCount());
agencyResult.setClosedCount(agencyResult.getClosedCount() + item.getResolvedCount());
agencyResult.setGovernCount(agencyResult.getGovernCount() + item.getGovernCount());
agencyResult.setSatisfactionCount(agencyResult.getSatisfactionCount() + item.getSatisfactionCount());
}
});
@ -73,8 +84,17 @@ public class ScreenGovernanceServiceImpl extends BaseServiceImpl<ScreenGovernanc
ScreenGovernRankDataDailyResultDTO agencyResult = agencyOptional.get();
Integer responseCount = agencyResult.getResponseCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getResponseCount).sum();
Integer transferCount = agencyResult.getTransferCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getTransferCount).sum();
Integer resolvedCount = agencyResult.getResolvedCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getResolvedCount).sum();
Integer closedCount = agencyResult.getClosedCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getClosedCount).sum();
Integer governCount = agencyResult.getGovernCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getGovernCount).sum();
Integer satisfactionCount = agencyResult.getSatisfactionCount() + agencyData.stream().filter(agency -> agency.getParentId().equals(streetId)).mapToInt(ScreenGovernRankDataDailyResultDTO::getSatisfactionCount).sum();
agencyResult.setResponseCount(responseCount);
agencyResult.setResponseCount(responseCount);
agencyResult.setTransferCount(transferCount);
agencyResult.setResolvedCount(resolvedCount);
agencyResult.setClosedCount(closedCount);
agencyResult.setGovernCount(governCount);
agencyResult.setSatisfactionCount(satisfactionCount);
}
});
// 合并网格社区街道数据
@ -87,6 +107,22 @@ public class ScreenGovernanceServiceImpl extends BaseServiceImpl<ScreenGovernanc
DecimalFormat df = new DecimalFormat("0.0000");
item.setResponseRatio(df.format((float) item.getResponseCount() / item.getTransferCount()));
}
if ("agency".equals(item.getOrgType())) {
int itemTotalNum = agencyItemInfoList.stream().filter(agency -> agency.getOrgId().equals(item.getOrgId())).findFirst().get().getItemTotal();
int itemSettleNum = agencyItemInfoList.stream().filter(agency -> agency.getOrgId().equals(item.getOrgId())).findFirst().get().getItemSettleTotal();
if (itemTotal != 0) {
DecimalFormat df = new DecimalFormat("0.0000");
if (item.getGovernCount() != 0) {
item.setGovernRatio(df.format((float) item.getGovernCount() / itemTotalNum));
}
if (item.getResolvedCount() != 0) {
item.setResolvedRatio(df.format((float) item.getResolvedCount() / itemTotalNum));
}
if (itemSettleNum != 0 && item.getSatisfactionCount() != 0) {
item.setSatisfactionRatio(df.format((float) item.getSatisfactionCount() / itemSettleNum));
}
}
}
});
JSONObject jsonObject = new JSONObject();

49
epdc-cloud-analysis-pc/src/main/resources/mapper/screen/ScreenGovernanceDao.xml

@ -24,6 +24,32 @@
)
</select>
<select id="getAgencyItemInfoList" resultType="com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernItemInfoResultDTO">
SELECT
sd.pid AS orgId,
sd.type_key,
IFNULL(sum(iis.ITEM_TOTAL), 0) AS ITEM_TOTAL,
IFNULL(
sum(iis.ITEM_SETTLE_TOTAL),
0
) AS ITEM_SETTLE_TOTAL
FROM
esua_epdc_admin.sys_dept sd
LEFT JOIN esua_epdc_analysis.epdc_issue_item_statistics iis ON iis.GRID_ID = sd.id
WHERE
sd.pid != 0
AND sd.id NOT IN (
SELECT
t.dept_id
FROM
esua_epdc_admin.sys_dept_config t
WHERE
t.del_flag = '0'
)
GROUP BY
sd.pid
</select>
<select id="governrankdatadaily" resultType="com.elink.esua.epdc.dto.analysis.pc.screen.result.ScreenGovernRankDataDailyResultDTO">
SELECT
DATE_FORMAT(
@ -54,7 +80,11 @@
sd.id AS orgId,
sd.pid AS parentId,
sd. NAME AS orgName,
IFNULL(count(hp.id), 0) AS responseCount,
IF (
(IFNULL(count(hp.id), 0) - 1) &lt; 0,
0,
IFNULL(count(hp.id), 0) - 1
) AS responseCount,
IFNULL(st.ITEM_SETTLE_TOTAL, 0) AS resolvedCount,
IFNULL(st.ITEM_CLOSED_TOTAL, 0) AS closedCount,
IFNULL(st.ITEM_CLOSED_TOTAL, 0) AS closedProjectCount,
@ -76,14 +106,14 @@
0
) AS governRatio,
IFNULL(
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL,
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL + hs.NO_EVA_TOTAL,
0
) AS satisfactionCount,
IFNULL(
ROUND(
(
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL
) / hs.ITEM_TOTAL,
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL + hs.NO_EVA_TOTAL
) / iis.ITEM_SETTLE_TOTAL,
4
),
0
@ -91,6 +121,7 @@
FROM
esua_epdc_admin.sys_dept sd
LEFT JOIN esua_epdc_events.epdc_item_handle_process hp ON hp.HANDLER_DEPT_ID = sd.id
LEFT JOIN esua_epdc_analysis.epdc_issue_item_statistics iis ON iis.GRID_ID = sd.id
AND hp.DEL_FLAG = '0'
AND DATE_FORMAT(hp.CREATED_TIME, '%Y-%m-%d') &lt;= DATE_FORMAT(
date_add(now(), INTERVAL - 1 DAY),
@ -143,7 +174,11 @@
sd.id AS orgId,
sd.pid AS parentId,
sd. NAME AS orgName,
IFNULL(count(hp.id), 0) AS responseCount,
IF (
(IFNULL(count(hp.id), 0) - 1) &lt; 0,
0,
IFNULL(count(hp.id), 0) - 1
) AS responseCount,
IFNULL(st.ITEM_SETTLE_TOTAL, 0) AS resolvedCount,
IFNULL(st.ITEM_CLOSED_TOTAL, 0) AS closedCount,
IFNULL(st.ITEM_CLOSED_TOTAL, 0) AS closedProjectCount,
@ -165,13 +200,13 @@
0
) AS governRatio,
IFNULL(
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL,
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL + hs.NO_EVA_TOTAL,
0
) AS satisfactionCount,
IFNULL(
ROUND(
(
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL
hs.EVA_GOOD_TOTAL + hs.EVA_VERYGOOD_TOTAL + hs.NO_EVA_TOTAL
) / hs.ITEM_TOTAL,
4
),

2
epdc-cloud-client-yushan

@ -1 +1 @@
Subproject commit f7f90605a782e9d227d5cde9f4d64bac840a4d8a
Subproject commit 48965c0cc93cfb5dbaf3f6f649f11ac9856ee8e4

2
epdc-cloud-commons-yushan

@ -1 +1 @@
Subproject commit 128c6a4bfb8087999b492a6febfdde984623fe3a
Subproject commit 235f56d5ea756317efe54c5e0d4be0ac45e09155

2
epdc-cloud-parent-yushan

@ -1 +1 @@
Subproject commit 6c53fd985cbaae46046a44a2d84f1eb9bff86a9d
Subproject commit db9213163f8005cba05ad21334bebb72484174b7
Loading…
Cancel
Save