|
|
@ -144,7 +144,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 数据抽取【组织-月】 |
|
|
|
* @Description 数据抽取【组织-月】,目前单客户和多客户处理是一样的,只是查询sql不一样,现在分开为了以后修改方便 |
|
|
|
* @Param customerId |
|
|
|
* @Param monthId |
|
|
|
* @author zxc |
|
|
@ -152,14 +152,82 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void extractionProjectOrgMonthly(String customerId, String monthId) { |
|
|
|
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS = new ArrayList<>(); |
|
|
|
//如果有子客户要按照跟组织的area_code查询组织列表
|
|
|
|
if(customerRelationService.haveSubCustomer(customerId)){ |
|
|
|
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); |
|
|
|
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); |
|
|
|
// 多客户处理
|
|
|
|
extractionProjectOrgMonthlyMoreCustomer(customerId, monthId); |
|
|
|
}else{ |
|
|
|
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId); |
|
|
|
// 单客户处理
|
|
|
|
extractionProjectOrgMonthlyOneCustomer(customerId, monthId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 单客户处理 |
|
|
|
* @Param customerId |
|
|
|
* @Param monthId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/15 下午2:18 |
|
|
|
*/ |
|
|
|
public void extractionProjectOrgMonthlyOneCustomer(String customerId,String monthId){ |
|
|
|
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId); |
|
|
|
if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){ |
|
|
|
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class); |
|
|
|
List<ProjectOrgMonthlyResultDTO> projectOrg = baseDao.selectQuantityOrgMonthlyByAgency(agencyInfos, monthId); |
|
|
|
if (!CollectionUtils.isEmpty(projectOrg)){ |
|
|
|
projectOrg.forEach(p -> { |
|
|
|
p.setClosedIncr(p.getClosedIncr()); |
|
|
|
p.setProjectIncr(p.getProjectIncr()); |
|
|
|
}); |
|
|
|
} |
|
|
|
List<ProjectOrgMonthlyResultDTO> projectGrandOrg = baseDao.selectQuantityGrandOrgMonthly(agencyInfos, monthId); |
|
|
|
if (!CollectionUtils.isEmpty(projectGrandOrg)){ |
|
|
|
projectGrandOrg.forEach(p -> { |
|
|
|
p.setClosedTotal(p.getClosedTotal()); |
|
|
|
p.setProjectTotal(p.getProjectTotal()); |
|
|
|
p.setUnClosedTotal(p.getUnClosedTotal()); |
|
|
|
}); |
|
|
|
} |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
a.setMonthId(monthId); |
|
|
|
if (!CollectionUtils.isEmpty(projectOrg)){ |
|
|
|
projectOrg.forEach(p -> { |
|
|
|
if (a.getAreaCode().equals(p.getAreaCode())){ |
|
|
|
a.setClosedIncr(null == p.getClosedIncr() ? NumConstant.ZERO : p.getClosedIncr()); |
|
|
|
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr()); |
|
|
|
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(projectGrandOrg)){ |
|
|
|
projectGrandOrg.forEach(p -> { |
|
|
|
if (a.getAreaCode().equals(p.getAreaCode())){ |
|
|
|
a.setClosedTotal(null == p.getClosedTotal() ? NumConstant.ZERO : p.getClosedTotal()); |
|
|
|
a.setProjectTotal(null == p.getProjectTotal() ? NumConstant.ZERO : p.getProjectTotal()); |
|
|
|
a.setUnClosedTotal(null == p.getUnClosedTotal() ? NumConstant.ZERO : p.getUnClosedTotal()); |
|
|
|
a.setProjectIncr(null == p.getProjectIncr() ? NumConstant.ZERO : p.getProjectIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
log.info(agencyInfos.toString()); |
|
|
|
del(customerId, monthId); |
|
|
|
insert(agencyInfos,customerId,monthId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 多客户处理 |
|
|
|
* @Param customerId |
|
|
|
* @Param monthId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/15 下午2:18 |
|
|
|
*/ |
|
|
|
public void extractionProjectOrgMonthlyMoreCustomer(String customerId,String monthId){ |
|
|
|
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); |
|
|
|
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){ |
|
|
|
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId)); |
|
|
|
return; |
|
|
|