|
|
@ -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 |
|
|
|