|
|
@ -35,6 +35,7 @@ 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.crm.CustomerRelationEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity; |
|
|
|
import com.epmet.entity.org.CustomerAgencyEntity; |
|
|
|
import com.epmet.service.crm.CustomerRelationService; |
|
|
@ -153,7 +154,7 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 数据抽取【机关-日】 |
|
|
|
* @Description 数据抽取【机关-日】,目前单客户和多客户处理是一样的,只是查询sql不一样,现在分开为了以后修改方便 |
|
|
|
* @Param customerId |
|
|
|
* @Param dateId |
|
|
|
* @author zxc |
|
|
@ -161,15 +162,79 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void extractionProjectOrgDaily(String customerId, String dateId) { |
|
|
|
List<ScreenProjectOrgDailyDTO> agencyInfos = new ArrayList<>(); |
|
|
|
//如果有子客户要按照跟组织的area_code查询组织列表
|
|
|
|
if(customerRelationService.haveSubCustomer(customerId)){ |
|
|
|
//
|
|
|
|
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); |
|
|
|
agencyInfos=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); |
|
|
|
// 多客户处理
|
|
|
|
extractionProjectOrgDailyMoreCustomer(customerId,dateId); |
|
|
|
}else{ |
|
|
|
agencyInfos=agencyDao.selectAgencyByCustomer(customerId); |
|
|
|
// 单客户处理
|
|
|
|
extractionProjectOrgDailyOneCustomer(customerId, dateId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 单客户处理 |
|
|
|
* @Param customerId |
|
|
|
* @Param dateId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/15 上午9:09 |
|
|
|
*/ |
|
|
|
public void extractionProjectOrgDailyOneCustomer(String customerId, String dateId){ |
|
|
|
List<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByCustomer(customerId); |
|
|
|
if (CollectionUtils.isEmpty(agencyInfos)){ |
|
|
|
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); |
|
|
|
return; |
|
|
|
} |
|
|
|
List<ProjectOrgDailyResultDTO> projectOrgDaily = baseDao.selectOrgProjectByAgency(agencyInfos, dateId); |
|
|
|
if (CollectionUtils.isEmpty(projectOrgDaily)){ |
|
|
|
log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId)); |
|
|
|
return; |
|
|
|
} |
|
|
|
log.info(projectOrgDaily.toString()); |
|
|
|
List<ScreenProjectOrgDailyDTO> createProjects = disposeCreateProject(agencyInfos, dateId); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
a.setDateId(dateId); |
|
|
|
projectOrgDaily.forEach(p -> { |
|
|
|
if (a.getAreaCode().equals(p.getAreaCode())){ |
|
|
|
a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); |
|
|
|
a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); |
|
|
|
a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); |
|
|
|
a.setBadTotal(p.getBadTotal()); |
|
|
|
a.setEvaluateTotal(p.getEvaluateTotal()); |
|
|
|
a.setGoodTotal(p.getGoodTotal()); |
|
|
|
a.setProjectTotal(p.getProjectTotal()); |
|
|
|
a.setResolvedNum(p.getResolvedNum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 有子客户处理 |
|
|
|
* @Param customerId |
|
|
|
* @Param dateId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/16 上午9:15 |
|
|
|
*/ |
|
|
|
public void extractionProjectOrgDailyMoreCustomer(String customerId, String dateId){ |
|
|
|
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); |
|
|
|
List<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(agencyInfos)){ |
|
|
|
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); |
|
|
|
return; |
|
|
@ -179,10 +244,54 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj |
|
|
|
log.info(String.format(PingYinConstants.SELECT_GRID_INFO_BY_ORG_IS_NULL,customerId)); |
|
|
|
return; |
|
|
|
} |
|
|
|
log.info(projectOrgDaily.toString()); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
a.setDateId(dateId); |
|
|
|
projectOrgDaily.forEach(p -> { |
|
|
|
if (a.getAreaCode().equals(p.getAreaCode())){ |
|
|
|
a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); |
|
|
|
a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); |
|
|
|
a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); |
|
|
|
a.setBadTotal(p.getBadTotal()); |
|
|
|
a.setEvaluateTotal(p.getEvaluateTotal()); |
|
|
|
a.setGoodTotal(p.getGoodTotal()); |
|
|
|
a.setProjectTotal(p.getProjectTotal()); |
|
|
|
a.setResolvedNum(p.getResolvedNum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 父子客户只需处理父客户数据,暂时不管子客户
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 组织直接立项处理 |
|
|
|
* @Param agencyInfos |
|
|
|
* @Param dateId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/16 上午9:15 |
|
|
|
*/ |
|
|
|
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}; |
|
|
@ -190,61 +299,50 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj |
|
|
|
//查询 满意+非常满意的总次数
|
|
|
|
String[] activeCodesGood = {PingYinConstants.EVALUATE_GOOD,PingYinConstants.EVALUATE_PERFECT}; |
|
|
|
List<EvaluateTotalResultDTO> evaluateGood = projectMainDailyService.selectEvaluateCountByOrg(orgIds, dateId, getActiveCode(activeCodesGood)); |
|
|
|
projectOrgDaily.forEach(p -> { |
|
|
|
// 参与满意度评价的总次数
|
|
|
|
if (!CollectionUtils.isEmpty(evaluateTotal)){ |
|
|
|
evaluateTotal.forEach(e -> { |
|
|
|
if (p.getOrgId().equals(e.getOrgId())){ |
|
|
|
p.setEvaluateTotal(p.getEvaluateTotal() + e.getEvaluateCount()); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
// 项目总数
|
|
|
|
if (!CollectionUtils.isEmpty(projectTotal)){ |
|
|
|
projectTotal.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setProjectTotal(p.getProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 满意+非常满意的总次数
|
|
|
|
if (!CollectionUtils.isEmpty(evaluateGood)){ |
|
|
|
evaluateGood.forEach(e -> { |
|
|
|
if (p.getOrgId().equals(e.getOrgId())){ |
|
|
|
p.setGoodTotal(p.getGoodTotal() + e.getEvaluateCount()); |
|
|
|
// 未解决项目数
|
|
|
|
if (!CollectionUtils.isEmpty(resolvedNum)){ |
|
|
|
resolvedNum.forEach(r -> { |
|
|
|
if (a.getOrgId().equals(r.getOrgId())){ |
|
|
|
a.setResolvedNum(r.getResolvedNum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 项目总数
|
|
|
|
if (!CollectionUtils.isEmpty(projectTotal)) { |
|
|
|
projectTotal.forEach(t -> { |
|
|
|
if (p.getOrgId().equals(t.getOrgId())){ |
|
|
|
p.setProjectTotal(p.getProjectTotal() + t.getProjectTotal()); |
|
|
|
// 参与满意度评价的总次数
|
|
|
|
if (!CollectionUtils.isEmpty(evaluateTotal)){ |
|
|
|
evaluateTotal.forEach(e -> { |
|
|
|
if (a.getOrgId().equals(e.getOrgId())){ |
|
|
|
a.setEvaluateTotal(e.getEvaluateCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 已解决的项目总数
|
|
|
|
if (!CollectionUtils.isEmpty(resolvedNum)){ |
|
|
|
resolvedNum.forEach(r -> { |
|
|
|
if (p.getOrgId().equals(r.getOrgId())){ |
|
|
|
p.setResolvedNum(p.getResolvedNum() + r.getResolvedNum()); |
|
|
|
|
|
|
|
// 满意+非常满意的总次数
|
|
|
|
if (!CollectionUtils.isEmpty(evaluateGood)){ |
|
|
|
evaluateGood.forEach(e -> { |
|
|
|
if (a.getOrgId().equals(e.getOrgId())){ |
|
|
|
a.setGoodTotal(e.getEvaluateCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 解决率
|
|
|
|
a.setResolvedRatio(getRatio(a.getResolvedNum(),a.getProjectTotal())); |
|
|
|
// 不满意总次数
|
|
|
|
p.setBadTotal(p.getEvaluateTotal() - p.getGoodTotal()); |
|
|
|
}); |
|
|
|
log.info(projectOrgDaily.toString()); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
a.setDateId(dateId); |
|
|
|
projectOrgDaily.forEach(p -> { |
|
|
|
if (a.getAreaCode().equals(p.getAreaCode())){ |
|
|
|
a.setResolvedRatio(getRatio(p.getResolvedNum(),p.getProjectTotal())); |
|
|
|
a.setBadRatio(getRatio(p.getBadTotal(),p.getEvaluateTotal())); |
|
|
|
a.setGoodRatio(getRatio(p.getGoodTotal(),p.getEvaluateTotal())); |
|
|
|
a.setBadTotal(p.getBadTotal()); |
|
|
|
a.setEvaluateTotal(p.getEvaluateTotal()); |
|
|
|
a.setGoodTotal(p.getGoodTotal()); |
|
|
|
a.setProjectTotal(p.getProjectTotal()); |
|
|
|
a.setResolvedNum(p.getResolvedNum()); |
|
|
|
} |
|
|
|
}); |
|
|
|
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())); |
|
|
|
}); |
|
|
|
log.info(agencyInfos.toString()); |
|
|
|
del(customerId, dateId); |
|
|
|
insert(agencyInfos,customerId,dateId); |
|
|
|
return agencyInfos; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|