|
|
|
@ -29,13 +29,14 @@ import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.constant.PingYinConstants; |
|
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; |
|
|
|
import com.epmet.dao.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyDao; |
|
|
|
import com.epmet.dto.pingyin.result.ProjectOrgMonthlyResultDTO; |
|
|
|
import com.epmet.dto.pingyin.result.*; |
|
|
|
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; |
|
|
|
import com.epmet.dto.screen.ScreenProjectQuantityOrgMonthlyDTO; |
|
|
|
import com.epmet.dto.screencoll.ScreenCollFormDTO; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyEntity; |
|
|
|
import com.epmet.entity.org.CustomerAgencyEntity; |
|
|
|
import com.epmet.service.crm.CustomerRelationService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; |
|
|
|
import com.epmet.service.org.CustomerAgencyService; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
@ -51,6 +52,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 项目(事件)数量分析按组织_按月统计 |
|
|
|
@ -69,6 +71,9 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< |
|
|
|
private CustomerRelationService customerRelationService; |
|
|
|
@Autowired |
|
|
|
private CustomerAgencyService customerAgencyService; |
|
|
|
@Autowired |
|
|
|
private FactOriginProjectMainDailyService projectMainDailyService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ScreenProjectQuantityOrgMonthlyDTO> page(Map<String, Object> params) { |
|
|
|
IPage<ScreenProjectQuantityOrgMonthlyEntity> page = baseDao.selectPage( |
|
|
|
@ -213,6 +218,19 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 直接立项处理
|
|
|
|
List<ScreenProjectQuantityOrgMonthlyDTO> agencyCreateProject = agencyCreateProject(agencyInfos, monthId); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
agencyCreateProject.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setProjectIncr(a.getProjectIncr() + p.getProjectIncr()); |
|
|
|
a.setProjectTotal(a.getProjectTotal() + p.getProjectTotal()); |
|
|
|
a.setUnClosedTotal(a.getUnClosedTotal() + p.getUnClosedTotal()); |
|
|
|
a.setClosedTotal(a.getClosedTotal() + p.getClosedTotal()); |
|
|
|
a.setClosedIncr(a.getClosedIncr() + p.getClosedIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
log.info(agencyInfos.toString()); |
|
|
|
del(customerId, monthId); |
|
|
|
insert(agencyInfos,customerId,monthId); |
|
|
|
@ -271,11 +289,89 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
List<ScreenProjectOrgDailyDTO> parentAgency = agencyDao.selectAgencyByCustomer(customerId); |
|
|
|
List<ScreenProjectQuantityOrgMonthlyDTO> parentAgencyInfos = ConvertUtils.sourceToTarget(parentAgency, ScreenProjectQuantityOrgMonthlyDTO.class); |
|
|
|
List<ScreenProjectQuantityOrgMonthlyDTO> agencyCreateProject = agencyCreateProject(parentAgencyInfos, monthId); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
agencyCreateProject.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setProjectIncr(a.getProjectIncr() + p.getProjectIncr()); |
|
|
|
a.setProjectTotal(a.getProjectTotal() + p.getProjectTotal()); |
|
|
|
a.setUnClosedTotal(a.getUnClosedTotal() + p.getUnClosedTotal()); |
|
|
|
a.setClosedTotal(a.getClosedTotal() + p.getClosedTotal()); |
|
|
|
a.setClosedIncr(a.getClosedIncr() + p.getClosedIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
log.info(agencyInfos.toString()); |
|
|
|
del(customerId, monthId); |
|
|
|
insert(agencyInfos,customerId,monthId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 组织直接立项处理 |
|
|
|
* @Param agencyInfos |
|
|
|
* @Param monthId |
|
|
|
* @author zxc |
|
|
|
* @date 2021/4/16 上午10:03 |
|
|
|
*/ |
|
|
|
public List<ScreenProjectQuantityOrgMonthlyDTO> agencyCreateProject(List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos, String monthId){ |
|
|
|
List<String> orgIds = agencyInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); |
|
|
|
// 本月新增的项目数量 转项目日期在当前月份内
|
|
|
|
List<ProjectIncrResultDTO> projectIncr = projectMainDailyService.selectProjectIncrByOrg(orgIds, monthId); |
|
|
|
// 截止到当前月份:累计项目总数
|
|
|
|
List<ProjectTotalResultDTO> projectTotal = projectMainDailyService.selectProjectTotalByOrg(orgIds, null, monthId); |
|
|
|
// 截止到当前月份:累计未结项目总数
|
|
|
|
List<UnClosedTotalResultDTO> projectUnClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.UN_CLOSED); |
|
|
|
// 截止到当前月份:累计已结项目
|
|
|
|
List<UnClosedTotalResultDTO> projectClosed = projectMainDailyService.selectProjectCountByOrg(orgIds, monthId, PingYinConstants.CLOSED); |
|
|
|
// 本月新增结案项目数
|
|
|
|
List<ClosedIncrResultDTO> closedIncr = projectMainDailyService.selectClosedIncrByOrg(orgIds, monthId); |
|
|
|
agencyInfos.forEach(a -> { |
|
|
|
a.setMonthId(monthId); |
|
|
|
if (!CollectionUtils.isEmpty(projectIncr)){ |
|
|
|
projectIncr.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setProjectIncr(p.getProjectIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 截止到当前月份:累计项目总数
|
|
|
|
if (!CollectionUtils.isEmpty(projectTotal)){ |
|
|
|
projectTotal.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setProjectTotal(p.getProjectTotal()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 截止到当前月份:累计未结项目总数
|
|
|
|
if (!CollectionUtils.isEmpty(projectUnClosed)){ |
|
|
|
projectUnClosed.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setUnClosedTotal(p.getProjectCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 截止到当前月份:累计已结项目
|
|
|
|
if (!CollectionUtils.isEmpty(projectClosed)){ |
|
|
|
projectClosed.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setClosedTotal(p.getProjectCount()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 本月新增结案项目数
|
|
|
|
if (!CollectionUtils.isEmpty(closedIncr)){ |
|
|
|
closedIncr.forEach(p -> { |
|
|
|
if (a.getOrgId().equals(p.getOrgId())){ |
|
|
|
a.setClosedIncr(p.getClosedIncr()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
return agencyInfos; |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void del(String customerId,String monthId){ |
|
|
|
Integer flag; |
|
|
|
|