diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/EvaluateTotalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/EvaluateTotalResultDTO.java index 3eb30a3887..769bd064aa 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/EvaluateTotalResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/EvaluateTotalResultDTO.java @@ -17,4 +17,6 @@ public class EvaluateTotalResultDTO implements Serializable { private String orgId; private Integer evaluateCount = NumConstant.ZERO; + + private String areaCode; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectOrgDailyResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectOrgDailyResultDTO.java index a19749c5e0..22c614e83d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectOrgDailyResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectOrgDailyResultDTO.java @@ -44,6 +44,8 @@ public class ProjectOrgDailyResultDTO implements Serializable { */ private Integer badTotal; + private String orgId; + public ProjectOrgDailyResultDTO() { this.projectTotal = NumConstant.ZERO; this.resolvedNum = NumConstant.ZERO; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectTotalResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectTotalResultDTO.java index a356c0ccdb..a493851432 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectTotalResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ProjectTotalResultDTO.java @@ -13,6 +13,15 @@ public class ProjectTotalResultDTO implements Serializable { private static final long serialVersionUID = 6071988402600005617L; - private String gridId; + private String orgId; + + /** + * 项目总数 + */ private Integer projectTotal; + + /** + * 行政区域编码 + */ + private String areaCode; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ResolvedNumResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ResolvedNumResultDTO.java index 6710de4469..2cc99e92f2 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ResolvedNumResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/pingyin/result/ResolvedNumResultDTO.java @@ -13,6 +13,12 @@ public class ResolvedNumResultDTO implements Serializable { private static final long serialVersionUID = 607198840261205617L; - private String gridId; + private String orgId; + + /** + * 已解决的项目总数 + */ private Integer resolvedNum; + + private String areaCode; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index b5a192caa3..8db5ef9bae 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -229,6 +229,16 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectProjectTotal(@Param("customerId")String customerId, @Param("dateId")String dateId, @Param("monthId")String monthId); + /** + * @Description 组织查询项目总数 + * @Param orgIds + * @Param dateId + * @Param monthId + * @author zxc + * @date 2021/4/13 上午9:31 + */ + List selectProjectTotalByOrg(@Param("orgIds")List orgIds, @Param("dateId")String dateId, @Param("monthId")String monthId); + /** * @Description 查询已解决项目数 * @Param customerId @@ -238,6 +248,15 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectResolvedNum(@Param("customerId")String customerId, @Param("dateId")String dateId); + /** + * @Description 组织查询已解决项目数 + * @Param orgIds + * @Param dateId + * @author zxc + * @date 2021/4/13 上午9:41 + */ + List selectResolvedNumByOrg(@Param("orgIds")List orgIds, @Param("dateId")String dateId); + /** * @Description 查询 满意度评价次数 * @Param customerId @@ -247,6 +266,16 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectEvaluateCount(@Param("customerId")String customerId, @Param("dateId")String dateId, @Param("activeCodes") List activeCodes); + /** + * @Description 组织 查询 满意度评价次数 + * @Param orgIds + * @Param dateId + * @Param activeCodes + * @author zxc + * @date 2021/4/13 上午9:56 + */ + List selectEvaluateCountByOrg(@Param("orgIds")List orgIds, @Param("dateId")String dateId, @Param("activeCodes")List activeCodes); + /** * @Description 查询本月新增项目数 * @Param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 5185b0a07d..e9bca2843f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -275,6 +275,16 @@ public interface FactOriginProjectMainDailyService extends BaseService selectProjectTotal(String customerId,String dateId,String monthId); + /** + * @Description 组织查询项目总数 + * @Param orgIds + * @Param dateId + * @Param monthId + * @author zxc + * @date 2021/4/12 下午5:12 + */ + List selectProjectTotalByOrg(List orgIds,String dateId,String monthId); + /** * @Description 查询已解决项目数 * @Param customerId @@ -284,6 +294,15 @@ public interface FactOriginProjectMainDailyService extends BaseService selectResolvedNum(String customerId, String dateId); + /** + * @Description 组织查询已解决项目数 + * @Param orgIds + * @Param dateId + * @author zxc + * @date 2021/4/13 上午9:28 + */ + List selectResolvedNumByOrg(List orgIds, String dateId); + /** * @Description 查询 满意度评价次数 * @Param customerId @@ -293,6 +312,16 @@ public interface FactOriginProjectMainDailyService extends BaseService selectEvaluateCount(String customerId, String dateId,List activeCodes); + /** + * @Description 组织 查询 满意度评价次数 + * @Param customerId + * @Param dateId + * @Param activeCodes + * @author zxc + * @date 2021/4/13 上午9:52 + */ + List selectEvaluateCountByOrg(List orgIds, String dateId,List activeCodes); + /** * @Description 查询本月新增项目数 * @Param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index c2fb24eafb..95dffc461a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -291,6 +291,15 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + @Override + public List selectProjectTotalByOrg(List orgIds, String dateId, String monthId) { + if (!CollectionUtils.isEmpty(orgIds)){ + List projectTotalResultDTOS = baseDao.selectProjectTotalByOrg(orgIds, dateId, monthId); + return projectTotalResultDTOS; + } + return new ArrayList<>(); + } + /** * @Description 查询已解决项目数 * @Param customerId @@ -307,6 +316,22 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + /** + * @Description 组织查询已解决项目数 + * @Param orgIds + * @Param dateId + * @author zxc + * @date 2021/4/13 上午9:29 + */ + @Override + public List selectResolvedNumByOrg(List orgIds, String dateId) { + if (!CollectionUtils.isEmpty(orgIds)){ + List resolvedNumResultDTOS = baseDao.selectResolvedNumByOrg(orgIds, dateId); + return resolvedNumResultDTOS; + } + return new ArrayList<>(); + } + /** * @Description 查询 满意度评价次数 * @Param customerId @@ -323,6 +348,23 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } + /** + * @Description 组织 查询 满意度评价次数 + * @Param customerId + * @Param dateId + * @Param activeCodes + * @author zxc + * @date 2021/4/13 上午9:54 + */ + @Override + public List selectEvaluateCountByOrg(List orgIds, String dateId, List activeCodes) { + if (!CollectionUtils.isEmpty(orgIds)){ + List evaluateTotalResultDTOS = baseDao.selectEvaluateCountByOrg(orgIds, dateId, activeCodes); + return evaluateTotalResultDTOS; + } + return new ArrayList<>(); + } + /** * @Description 查询本月新增项目数 * @Param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java index 64cb66e04c..5ac44463e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java @@ -172,7 +172,7 @@ public class ScreenProjectGridDailyServiceImpl extends BaseServiceImpl { - if (g.getGridId().equals(pt.getGridId())){ + if (g.getGridId().equals(pt.getOrgId())){ g.setProjectTotal(pt.getProjectTotal()); } }); @@ -180,7 +180,7 @@ public class ScreenProjectGridDailyServiceImpl extends BaseServiceImpl { - if (g.getGridId().equals(rn.getGridId())){ + if (g.getGridId().equals(rn.getOrgId())){ g.setResolvedNum(rn.getResolvedNum()); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java index 98fc2f38f7..c5818bd6fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java @@ -29,12 +29,16 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.PingYinConstants; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectOrgDailyDao; +import com.epmet.dto.pingyin.result.EvaluateTotalResultDTO; import com.epmet.dto.pingyin.result.ProjectOrgDailyResultDTO; +import com.epmet.dto.pingyin.result.ProjectTotalResultDTO; +import com.epmet.dto.pingyin.result.ResolvedNumResultDTO; import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.service.crm.CustomerRelationService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; import com.epmet.service.org.CustomerAgencyService; import com.google.common.collect.Lists; @@ -51,6 +55,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目(事件)分析按组织_按天统计 @@ -69,6 +74,8 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl page(Map params) { @@ -172,12 +179,52 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); + // 查询 项目总数 + List projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, dateId, null); + // 查询 项目解决数 + List resolvedNum = projectMainDailyService.selectResolvedNumByOrg(orgIds, dateId); + //查询 参与满意度评价的总次数 + String[] activeCodesAll = {PingYinConstants.EVALUATE_BAD,PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; + List evaluateTotal = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesAll)); + //查询 满意+非常满意的总次数 + String[] activeCodesGood = {PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; + List evaluateGood = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesGood)); projectOrgDaily.forEach(p -> { - p.setBadTotal(null == p.getBadTotal() ? NumConstant.ZERO : p.getBadTotal()); - p.setEvaluateTotal(null == p.getEvaluateTotal() ? NumConstant.ZERO : p.getEvaluateTotal()); - p.setGoodTotal(null == p.getGoodTotal() ? NumConstant.ZERO : p.getGoodTotal()); - p.setProjectTotal(null == p.getProjectTotal() ? NumConstant.ZERO : p.getProjectTotal()); - p.setResolvedNum(null == p.getResolvedNum() ? NumConstant.ZERO : p.getResolvedNum()); + // 参与满意度评价的总次数 + if (!CollectionUtils.isEmpty(evaluateTotal)){ + evaluateTotal.forEach(e -> { + if (p.getOrgId().equals(e.getOrgId())){ + p.setEvaluateTotal(p.getEvaluateTotal() + e.getEvaluateCount()); + } + }); + } + // 满意+非常满意的总次数 + if (!CollectionUtils.isEmpty(evaluateGood)){ + evaluateGood.forEach(e -> { + if (p.getOrgId().equals(e.getOrgId())){ + p.setGoodTotal(p.getGoodTotal() + e.getEvaluateCount()); + } + }); + } + // 项目总数 + if (!CollectionUtils.isEmpty(projectTotal)) { + projectTotal.forEach(t -> { + if (p.getOrgId().equals(t.getOrgId())){ + p.setProjectTotal(p.getProjectTotal() + t.getProjectTotal()); + } + }); + } + // 已解决的项目总数 + if (!CollectionUtils.isEmpty(resolvedNum)){ + resolvedNum.forEach(r -> { + if (p.getOrgId().equals(r.getOrgId())){ + p.setResolvedNum(p.getResolvedNum() + r.getResolvedNum()); + } + }); + } + // 不满意总次数 + p.setBadTotal(p.getEvaluateTotal() - p.getGoodTotal()); }); log.info(projectOrgDaily.toString()); agencyInfos.forEach(a -> { @@ -200,6 +247,17 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl getActiveCode(String[] actCode){ + List activeCodes = Arrays.asList(actCode); + return activeCodes; + } + /** * @Description * @Param a diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java index ea99b5148a..3ca6164c62 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java @@ -183,7 +183,7 @@ public class ScreenProjectQuantityGridMonthlyServiceImpl extends BaseServiceImpl // 截止到当前月份:累计项目总数 if (!CollectionUtils.isEmpty(projectTotal)){ projectTotal.forEach(p -> { - if (g.getGridId().equals(p.getGridId())){ + if (g.getGridId().equals(p.getOrgId())){ g.setProjectTotal(p.getProjectTotal()); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index aaa632d657..9d10a564f6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -589,4 +589,63 @@ + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml index ace5879e53..3ec91a496a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml @@ -112,11 +112,12 @@ SELECT #{a.areaCode} AS areaCode, - SUM(PROJECT_TOTAL) AS projectTotal, - SUM(RESOLVED_NUM) AS resolvedNum, - SUM(EVALUATE_TOTAL) AS evaluateTotal , - SUM(GOOD_TOTAL) AS goodTotal, - SUM(BAD_TOTAL) AS badTotal + #{a.orgId} AS orgId, + IFNULL(SUM(PROJECT_TOTAL),0) AS projectTotal, + IFNULL(SUM(RESOLVED_NUM),0) AS resolvedNum, + IFNULL(SUM(EVALUATE_TOTAL),0) AS evaluateTotal , + IFNULL(SUM(GOOD_TOTAL),0) AS goodTotal, + IFNULL(SUM(BAD_TOTAL),0) AS badTotal FROM screen_project_grid_daily g LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID WHERE g.DEL_FLAG = 0