Browse Source

数值统一

master
Jinyuanyuan 2 months ago
parent
commit
0b13c3e72c
  1. 3
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java
  2. 12
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml
  3. 125
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

3
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouProjectinfoMapper.java

@ -79,7 +79,8 @@ public interface HuzhouProjectinfoMapper extends BaseMapper<HuzhouProjectinfo> {
List<HuzhouProjectinfoOV> getListByConditions(@Param("info") HuzhouProjectinfo info); List<HuzhouProjectinfoOV> getListByConditions(@Param("info") HuzhouProjectinfo info);
Page<HuzhouProjectinfoOV>getUnitedTechnicalReviewList(Page page, @Param("info") ProjectInfoAuthSelect info); Page<HuzhouProjectinfoOV>getUnitedTechnicalReviewList(Page page, @Param("info") ProjectInfoAuthSelect info);
List<ProjectSummaryOV> getProjectSummaryPageList(@Param("projectIds") List<String> projectIds); List<ProjectSummaryOV> getProjectSummaryPageListByDuty(@Param("projectIds") List<String> projectIds);
List<ProjectSummaryOV> getProjectSummaryPageListByTask(@Param("projectIds") List<String> projectIds);
List<String> listIdsByDutyWorkplace(@Param("dutyWorkplace") String dutyWorkplace); List<String> listIdsByDutyWorkplace(@Param("dutyWorkplace") String dutyWorkplace);

12
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml

@ -513,7 +513,17 @@ order by create_date desc
select contract_total_money as contractMoney,contract_central_money as contractCentralMoney select contract_total_money as contractMoney,contract_central_money as contractCentralMoney
from huzhou_projectinfo_money where id=#{projectId} from huzhou_projectinfo_money where id=#{projectId}
</select> </select>
<select id="getProjectSummaryPageList" resultMap="ProjectSummaryPageMap" parameterType="com.easy.admin.modules.huzhou.vo.ProjectSummaryOV"> <select id="getProjectSummaryPageListByDuty" resultMap="ProjectSummaryPageMap" parameterType="com.easy.admin.modules.huzhou.vo.ProjectSummaryOV">
select u.duty_workplace as dutyWorkplace,count(*) as projectNum,
sum(u.total_money) as totalMoney, sum(u.urt_estimated_amount) as estimateMoney,sum(central_money) as centralMoney,
sum(m.contract_total_money) as contractMoney,sum(m.contract_central_money) as contractCentralMoney
from huzhou_projectinfo u left join huzhou_projectinfo_money m on u.id=m.id where u.id in
<foreach item="projectId" index="index" collection="projectIds" open="(" separator="," close=")">
#{projectId}
</foreach>
group by u.duty_workplace
</select>
<select id="getProjectSummaryPageListByTask" resultMap="ProjectSummaryPageMap" parameterType="com.easy.admin.modules.huzhou.vo.ProjectSummaryOV">
select u.reform_name as reformName,u.super_leader as superLeader,count(*) as projectNum, select u.reform_name as reformName,u.super_leader as superLeader,count(*) as projectNum,
sum(u.total_money) as totalMoney, sum(u.urt_estimated_amount) as estimateMoney,sum(central_money) as centralMoney, sum(u.total_money) as totalMoney, sum(u.urt_estimated_amount) as estimateMoney,sum(central_money) as centralMoney,
sum(m.contract_total_money) as contractMoney,sum(m.contract_central_money) as contractCentralMoney sum(m.contract_total_money) as contractMoney,sum(m.contract_central_money) as contractCentralMoney

125
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

@ -1330,55 +1330,77 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
return result; return result;
} }
public IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){ // public IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
IPage<ProjectSummaryOV> result = new Page<>(); // IPage<ProjectSummaryOV> result = new Page<>();
List<ProjectSummaryOV> records=new ArrayList<>(); // List<ProjectSummaryOV> records=new ArrayList<>();
//只要入库项目 // //只要入库项目
projectInfo.setType("1"); // projectInfo.setType("1");
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo); // ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
Page page = new Page(1, 10000); // Page page = new Page(1, 10000);
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect); // Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect);
Map<String, List<HuzhouProjectinfoOV>> projectsMap = projectAndChildInfoPageList.getRecords().stream().collect(Collectors.groupingBy(x -> x.getDutyWorkplace())); // Map<String, List<HuzhouProjectinfoOV>> projectsMap = projectAndChildInfoPageList.getRecords().stream().collect(Collectors.groupingBy(x -> x.getDutyWorkplace()));
for(Map.Entry<String, List<HuzhouProjectinfoOV>> entry : projectsMap.entrySet()){ // for(Map.Entry<String, List<HuzhouProjectinfoOV>> entry : projectsMap.entrySet()){
ProjectSummaryOV projectSummary=new ProjectSummaryOV(); // ProjectSummaryOV projectSummary=new ProjectSummaryOV();
projectSummary.setDutyWorkplace(entry.getKey()); // projectSummary.setDutyWorkplace(entry.getKey());
projectSummary.setProjectNum(entry.getValue().size()); // projectSummary.setProjectNum(entry.getValue().size());
List<Double> totalList = entry.getValue().stream().map(x->Optional.ofNullable(x.getTotalMoney()).orElse(0.00)).collect(Collectors.toList()); // List<Double> totalList = entry.getValue().stream().map(x->Optional.ofNullable(x.getTotalMoney()).orElse(0.00)).collect(Collectors.toList());
double total = totalList.isEmpty()? 0.00 : totalList.stream().reduce(0.00, Double::sum); // double total = totalList.isEmpty()? 0.00 : totalList.stream().reduce(0.00, Double::sum);
BigDecimal totalMoney = new BigDecimal(String.valueOf(total)); // BigDecimal totalMoney = new BigDecimal(String.valueOf(total));
projectSummary.setTotalMoney(totalMoney); // projectSummary.setTotalMoney(totalMoney);
List<Double> estimatedList = entry.getValue().stream().map(x->Optional.ofNullable(x.getUrtEstimatedAmount()).orElse(0.00)).collect(Collectors.toList()); // List<Double> estimatedList = entry.getValue().stream().map(x->Optional.ofNullable(x.getUrtEstimatedAmount()).orElse(0.00)).collect(Collectors.toList());
Double estimate = estimatedList.isEmpty()? 0.00 : estimatedList.stream().reduce(0.00, Double::sum); // Double estimate = estimatedList.isEmpty()? 0.00 : estimatedList.stream().reduce(0.00, Double::sum);
BigDecimal estimateMoney = new BigDecimal(String.valueOf(estimate)); // BigDecimal estimateMoney = new BigDecimal(String.valueOf(estimate));
projectSummary.setEstimateMoney(estimateMoney); // projectSummary.setEstimateMoney(estimateMoney);
List<Double> centralList = entry.getValue().stream().map(x->Optional.ofNullable(x.getCentralMoney()).orElse(0.00)).collect(Collectors.toList()); // List<Double> centralList = entry.getValue().stream().map(x->Optional.ofNullable(x.getCentralMoney()).orElse(0.00)).collect(Collectors.toList());
double central = centralList.isEmpty()? 0.00 : centralList.stream().reduce(0.00, Double::sum); // double central = centralList.isEmpty()? 0.00 : centralList.stream().reduce(0.00, Double::sum);
BigDecimal centralMoney = new BigDecimal(String.valueOf(central)); // BigDecimal centralMoney = new BigDecimal(String.valueOf(central));
projectSummary.setCentralMoney(centralMoney); // projectSummary.setCentralMoney(centralMoney);
List<String> ids = entry.getValue().stream().map(x -> x.getId()).collect(Collectors.toList()); // List<String> ids = entry.getValue().stream().map(x -> x.getId()).collect(Collectors.toList());
BigDecimal contractMoney=new BigDecimal("0"); // BigDecimal contractMoney=new BigDecimal("0");
BigDecimal contractCentralMoney=new BigDecimal("0"); // BigDecimal contractCentralMoney=new BigDecimal("0");
if(!ids.isEmpty()){ // if(!ids.isEmpty()){
Map<String, BigDecimal> moneyMap = projectinfoMapper.countMoneyByIds(ids); // Map<String, BigDecimal> moneyMap = projectinfoMapper.countMoneyByIds(ids);
if(moneyMap != null && moneyMap.isEmpty()){ // if(moneyMap != null && moneyMap.isEmpty()){
contractMoney=Optional.ofNullable(moneyMap.get("contractMoney")).orElse(new BigDecimal("0")); // contractMoney=Optional.ofNullable(moneyMap.get("contractMoney")).orElse(new BigDecimal("0"));
contractCentralMoney=Optional.ofNullable(moneyMap.get("contractCentralMoney")).orElse(new BigDecimal("0")); // contractCentralMoney=Optional.ofNullable(moneyMap.get("contractCentralMoney")).orElse(new BigDecimal("0"));
} // }
projectSummary.setContractMoney(contractMoney); // projectSummary.setContractMoney(contractMoney);
projectSummary.setContractCentralMoney(contractCentralMoney); // projectSummary.setContractCentralMoney(contractCentralMoney);
} // }
ProjectProgressOV progress = this.getProgress(ids); // ProjectProgressOV progress = this.getProgress(ids);
projectSummary.setProjectProgress(progress.getProjectProgress()); // projectSummary.setProjectProgress(progress.getProjectProgress());
records.add(projectSummary); // records.add(projectSummary);
} // }
//手动分页 // //手动分页
int fromIndex = (pageNo - 1) * pageSize; // int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = records.subList(fromIndex, Math.min(fromIndex + pageSize, records.size())); // List<ProjectSummaryOV> currentPageData = records.subList(fromIndex, Math.min(fromIndex + pageSize, records.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(records.size()); // result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(records.size());
return result; // return result;
//
//
} // }
public IPage<ProjectSummaryOV> getProjectSummaryPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
IPage<ProjectSummaryOV> result = new Page<>();
//只要入库项目
projectInfo.setType("1");
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
Page page = new Page(1, 10000);
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect);
List<String> ids = projectAndChildInfoPageList.getRecords().stream().map(x -> x.getId()).collect(Collectors.toList());
List<ProjectSummaryOV> projectSummaryPageList = projectinfoMapper.getProjectSummaryPageListByDuty(ids);
for(ProjectSummaryOV p:projectSummaryPageList){
List<HuzhouProjectinfoOV> groupByDuty = projectAndChildInfoPageList.getRecords().stream().filter(x -> x.getDutyWorkplace().equals(p.getDutyWorkplace())).collect(Collectors.toList());
List<String> projectIds = groupByDuty.stream().map(x -> x.getId()).collect(Collectors.toList());
ProjectProgressOV progress = this.getProgress(projectIds);
p.setProjectProgress(progress.getProjectProgress());
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectSummaryOV> currentPageData = projectSummaryPageList.subList(fromIndex, Math.min(fromIndex + pageSize, projectSummaryPageList.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
return result;
}
public IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){ public IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
IPage<ProjectSummaryOV> result = new Page<>(); IPage<ProjectSummaryOV> result = new Page<>();
//只要入库项目 //只要入库项目
@ -1387,9 +1409,10 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
Page page = new Page(1, 10000); Page page = new Page(1, 10000);
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect); Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect);
List<String> ids = projectAndChildInfoPageList.getRecords().stream().map(x -> x.getId()).collect(Collectors.toList()); List<String> ids = projectAndChildInfoPageList.getRecords().stream().map(x -> x.getId()).collect(Collectors.toList());
List<ProjectSummaryOV> projectSummaryPageList = projectinfoMapper.getProjectSummaryPageList(ids); List<ProjectSummaryOV> projectSummaryPageList = projectinfoMapper.getProjectSummaryPageListByTask(ids);
for(ProjectSummaryOV p:projectSummaryPageList){ for(ProjectSummaryOV p:projectSummaryPageList){
List<String> projectIds = projectinfoMapper.getIds(p.getReformName(), p.getSuperLeader()); List<HuzhouProjectinfoOV> groupByTask = projectAndChildInfoPageList.getRecords().stream().filter(x -> x.getReformName().equals(p.getReformName()) && x.getSuperLeader().equals(p.getSuperLeader())).collect(Collectors.toList());
List<String> projectIds = groupByTask.stream().map(x -> x.getId()).collect(Collectors.toList());
ProjectProgressOV progress = this.getProgress(projectIds); ProjectProgressOV progress = this.getProgress(projectIds);
p.setProjectProgress(progress.getProjectProgress()); p.setProjectProgress(progress.getProjectProgress());
} }

Loading…
Cancel
Save