|
|
@ -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; |
|
|
@ -161,70 +162,39 @@ 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.selectOrgProject(agencyInfos, dateId); |
|
|
|
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; |
|
|
|
} |
|
|
|
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)); |
|
|
|
projectOrgDaily.forEach(p -> { |
|
|
|
// 参与满意度评价的总次数
|
|
|
|
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()); |
|
|
|
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 -> { |
|
|
@ -247,6 +217,45 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj |
|
|
|
insert(agencyInfos,customerId,dateId); |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
List<ProjectOrgDailyResultDTO> projectOrgDaily = baseDao.selectOrgProject(agencyInfos, dateId); |
|
|
|
if (CollectionUtils.isEmpty(projectOrgDaily)){ |
|
|
|
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); |
|
|
|
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()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
log.info(agencyInfos.toString()); |
|
|
|
del(customerId, dateId); |
|
|
|
insert(agencyInfos,customerId,dateId); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @Description activeCode处理 |
|
|
|
* @Param actCode |
|
|
|