Browse Source

项目分析 统计直接立项查询 gridId修改 = ''

master
zxc 4 years ago
parent
commit
ddafed7302
  1. 11
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java
  2. 104
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java
  3. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

11
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectOrgDailyDTO.java

@ -17,6 +17,7 @@
package com.epmet.dto.screen;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
@ -144,4 +145,14 @@ public class ScreenProjectOrgDailyDTO implements Serializable {
*/
private String areaCode;
public ScreenProjectOrgDailyDTO() {
this.projectTotal = NumConstant.ZERO;
this.resolvedNum = NumConstant.ZERO;
this.resolvedRatio = NumConstant.ZERO_DECIMAL;
this.evaluateTotal = NumConstant.ZERO;
this.goodTotal = NumConstant.ZERO;
this.badTotal = NumConstant.ZERO;
this.goodRatio = NumConstant.ZERO_DECIMAL;
this.badRatio = NumConstant.ZERO_DECIMAL;
}
}

104
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java

@ -179,7 +179,7 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
* @date 2021/4/15 上午9:09
*/
public void extractionProjectOrgDailyOneCustomer(String customerId, String dateId){
List<ScreenProjectOrgDailyDTO> agencyInfos=agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByCustomer(customerId);
if (CollectionUtils.isEmpty(agencyInfos)){
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
@ -189,14 +189,8 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId));
return;
}
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());
});
log.info(projectOrgDaily.toString());
List<ScreenProjectOrgDailyDTO> createProjects = disposeCreateProject(agencyInfos, dateId);
agencyInfos.forEach(a -> {
a.setDateId(dateId);
projectOrgDaily.forEach(p -> {
@ -212,6 +206,20 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
}
});
});
agencyInfos.forEach(a -> {
createProjects.forEach(p -> {
if (a.getOrgId().equals(p.getOrgId())){
a.setBadTotal(p.getBadTotal() + a.getBadTotal());
a.setEvaluateTotal(p.getEvaluateTotal() + a.getEvaluateTotal());
a.setGoodTotal(p.getGoodTotal() + a.getGoodTotal());
a.setProjectTotal(p.getProjectTotal() + a.getProjectTotal());
a.setResolvedNum(p.getResolvedNum() + a.getResolvedNum());
a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal()));
a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal()));
a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal()));
}
});
});
log.info(agencyInfos.toString());
del(customerId, dateId);
insert(agencyInfos,customerId,dateId);
@ -229,13 +237,6 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId));
return;
}
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());
});
log.info(projectOrgDaily.toString());
agencyInfos.forEach(a -> {
a.setDateId(dateId);
@ -252,10 +253,83 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
}
});
});
List<ScreenProjectOrgDailyDTO> parentAgencyInfos = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> createProjects = disposeCreateProject(parentAgencyInfos, dateId);
agencyInfos.forEach(a -> {
createProjects.forEach(p -> {
if (a.getOrgId().equals(p.getOrgId())){
a.setBadTotal(p.getBadTotal() + a.getBadTotal());
a.setEvaluateTotal(p.getEvaluateTotal() + a.getEvaluateTotal());
a.setGoodTotal(p.getGoodTotal() + a.getGoodTotal());
a.setProjectTotal(p.getProjectTotal() + a.getProjectTotal());
a.setResolvedNum(p.getResolvedNum() + a.getResolvedNum());
a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal()));
a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal()));
a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal()));
}
});
});
log.info(agencyInfos.toString());
del(customerId, dateId);
insert(agencyInfos,customerId,dateId);
}
public List<ScreenProjectOrgDailyDTO> disposeCreateProject(List<ScreenProjectOrgDailyDTO> agencyInfos,String dateId){
List<String> orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList());
List<ProjectTotalResultDTO> projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, dateId, null);
List<ResolvedNumResultDTO> resolvedNum = projectMainDailyService.selectResolvedNumByOrg(orgIds, dateId);
//查询 参与满意度评价的总次数
String[] activeCodesAll = {PingYinConstants.EVALUATE_BAD,PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT};
List<EvaluateTotalResultDTO> evaluateTotal = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesAll));
//查询 满意+非常满意的总次数
String[] activeCodesGood = {PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT};
List<EvaluateTotalResultDTO> evaluateGood = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesGood));
agencyInfos.forEach(a -> {
// 项目总数
if (!CollectionUtils.isEmpty(projectTotal)){
projectTotal.forEach(p -> {
if (a.getOrgId().equals(p.getOrgId())){
a.setProjectTotal(p.getProjectTotal());
}
});
}
// 未解决项目数
if (!CollectionUtils.isEmpty(resolvedNum)){
resolvedNum.forEach(r -> {
if (a.getOrgId().equals(r.getOrgId())){
a.setResolvedNum(r.getResolvedNum());
}
});
}
// 参与满意度评价的总次数
if (!CollectionUtils.isEmpty(evaluateTotal)){
evaluateTotal.forEach(e -> {
if (a.getOrgId().equals(e.getOrgId())){
a.setEvaluateTotal(e.getEvaluateCount());
}
});
}
// 满意+非常满意的总次数
if (!CollectionUtils.isEmpty(evaluateGood)){
evaluateGood.forEach(e -> {
if (a.getOrgId().equals(e.getOrgId())){
a.setGoodTotal(e.getEvaluateCount());
}
});
}
// 解决率
a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal()));
// 不满意总次数
a.setBadTotal(a.getEvaluateTotal()==NumConstant.ZERO ? NumConstant.ZERO : a.getEvaluateTotal() - a.getGoodTotal());
// 满意率
a.setGoodRatio(getRatio(a.getGoodTotal(),a.getEvaluateTotal()));
// 不满意率
a.setBadRatio(getRatio(a.getBadTotal(),a.getEvaluateTotal()));
});
return agencyInfos;
}
/**
* @Description activeCode处理
* @Param actCode

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -459,7 +459,7 @@
<!-- 查询项目总数 -->
<select id="selectProjectTotal" resultType="com.epmet.dto.pingyin.result.ProjectTotalResultDTO">
SELECT
GRID_ID,
GRID_ID AS orgId,
COUNT(ID) AS projectTotal
FROM fact_origin_project_main_daily
WHERE DEL_FLAG = 0
@ -477,7 +477,7 @@
<!-- 查询已解决项目数 -->
<select id="selectResolvedNum" resultType="com.epmet.dto.pingyin.result.ResolvedNumResultDTO">
SELECT
GRID_ID,
GRID_ID AS orgId,
COUNT(ID) AS resolvedNum
FROM fact_origin_project_main_daily
WHERE DEL_FLAG = 0
@ -614,7 +614,7 @@
IFNULL(COUNT(m.ID),0) AS projectTotal
FROM fact_origin_project_main_daily m
WHERE m.DEL_FLAG = 0
AND m.GRID_ID IS NULL
AND m.GRID_ID = ''
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
m.AGENCY_ID = #{orgId}
@ -639,7 +639,12 @@
AND DATE_ID <![CDATA[ <= ]]> #{dateId}
AND PROJECT_STATUS = 'closed'
AND IS_RESOLVED = 'resolved'
AND GRID_ID IS NULL
AND (
<foreach collection="orgIds" item="orgId" separator=" OR ">
AGENCY_ID = #{orgId}
</foreach>
)
AND GRID_ID = ''
GROUP BY AGENCY_ID
</select>

Loading…
Cancel
Save