Browse Source

看板1.1

master
uu 5 months ago
parent
commit
f8636f905b
  1. 16
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java
  2. 11
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouContractinfoMapper.java
  3. 21
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouContractinfoMapper.xml
  4. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouProjectinfoMapper.xml
  5. 3
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java
  6. 81
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

16
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java

@ -4,16 +4,13 @@ package com.easy.admin.modules.huzhou.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.easy.admin.common.core.annotation.ResponseResult; import com.easy.admin.common.core.annotation.ResponseResult;
import com.easy.admin.modules.huzhou.vo.CountOV; import com.easy.admin.modules.huzhou.vo.*;
import com.easy.admin.modules.huzhou.vo.HuzhouProjectinfoOV;
import com.easy.admin.common.api.vo.Result; import com.easy.admin.common.api.vo.Result;
import com.easy.admin.modules.huzhou.entity.*; import com.easy.admin.modules.huzhou.entity.*;
import com.easy.admin.modules.huzhou.service.*; import com.easy.admin.modules.huzhou.service.*;
import com.easy.admin.modules.huzhou.vo.ProjectApproveOV;
import com.easy.admin.modules.huzhou.vo.ProjectProgressOV;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -191,4 +188,15 @@ public class HuzhouProjectController {
return Result.OK(result); return Result.OK(result);
} }
/**
* 状态更新
* @param
* @param
*/
@GetMapping("/acount")
public Result<?> acount(){
NewFundOV result = projectinfoService.getFundByType();
return Result.OK(result);
}
} }

11
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouContractinfoMapper.java

@ -7,9 +7,20 @@ import com.easy.admin.modules.huzhou.vo.HuzhouProjectinfoOV;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.easy.admin.modules.huzhou.entity.HuzhouContractinfo; import com.easy.admin.modules.huzhou.entity.HuzhouContractinfo;
import com.easy.admin.modules.huzhou.vo.HuzhouContractinfoOV; import com.easy.admin.modules.huzhou.vo.HuzhouContractinfoOV;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface HuzhouContractinfoMapper extends BaseMapper<HuzhouContractinfo> { public interface HuzhouContractinfoMapper extends BaseMapper<HuzhouContractinfo> {
Page<HuzhouProjectinfoOV> getContractinfoPageList(Page page, HuzhouProjectinfo info); Page<HuzhouProjectinfoOV> getContractinfoPageList(Page page, HuzhouProjectinfo info);
Page<HuzhouProjectinfoOV> getContractProjectPageList(Page page, HuzhouProjectinfo info); Page<HuzhouProjectinfoOV> getContractProjectPageList(Page page, HuzhouProjectinfo info);
//根据一组项目id返回已支付总金额、已支付总中央资金、已支付总省级资金
Map<String, BigDecimal> getPaymentsByProjectIds(@Param("projectIds") List<String> projectIds);
//根据一组项目id返回总金额、总中央资金、总省级资金
Map<String, BigDecimal> getTotalByProjectIds(@Param("projectIds") List<String> projectIds);
} }

21
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouContractinfoMapper.xml

@ -249,11 +249,30 @@
HAVING COUNT(DISTINCT c.project_id) >0) HAVING COUNT(DISTINCT c.project_id) >0)
</where> </where>
</select> </select>
<select id="getPaymentsByProjectIds" resultType="map">
select sum(a.total_money) as totalPayment,
sum(a.central_money) as centralPayment,
sum(a.provincial_money) as provincialPayment from huzhou_contractinfo a left join huzhou_planinfo b
on (a.project_id = b.project_id AND a.task_name = b.task_name) where a.project_id in
<foreach item="projectId" index="index" collection="projectIds" open="(" separator="," close=")">
#{projectId}
</foreach>
and isfinish = "2"
</select>
<select id="getTotalByProjectIds" resultType="map">
select sum(total_money) as totalAcount,
sum(central_money) as centralAcount,
sum(provincial_money) as provincialAcount from huzhou_contractinfo
where project_id in
<foreach item="projectId" index="index" collection="projectIds" open="(" separator="," close=")">
#{projectId}
</foreach>
</select>
<!-- <select id="getContractProjectPageList1111" resultType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo" parameterType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo">--> <!-- <select id="getContractProjectPageList1111" resultType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo" parameterType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo">-->
<!-- SELECT * from huzhou_projectinfo u--> <!-- SELECT * from huzhou_projectinfo u-->
<!-- <where>--> <!-- <where>-->
<!-- and u.id not in (select distinct project_id from huzhou_contractinfo where status ='1')--> <!-- and u.id not in (select distinct project_id from huzhou_contractinfo where status ='1')-->

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

@ -211,6 +211,6 @@ order by create_date desc
<update id="updateType" parameterType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo"> <update id="updateType" parameterType="com.easy.admin.modules.huzhou.entity.HuzhouProjectinfo">
UPDATE huzhou_projectinfo UPDATE huzhou_projectinfo
SET type = "0" SET type = "0"
WHERE type = "2" and (central_money='' or provincial_money='') WHERE type = "2" and (central_money!='' or provincial_money!='')
</update> </update>
</mapper> </mapper>

3
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java

@ -144,7 +144,8 @@ public interface IHuzhouProjectinfoService extends IService<HuzhouProjectinfo> {
* *
* @param * @param
*/ */
NewFundOV getFundByType(List<String> ids); NewFundOV getFundByType();
} }

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

@ -12,6 +12,7 @@ import com.easy.admin.common.core.exception.EasyException;
import com.easy.admin.common.util.CommonUtils; import com.easy.admin.common.util.CommonUtils;
import com.easy.admin.modules.huzhou.common.HuzhouCommonUtils; import com.easy.admin.modules.huzhou.common.HuzhouCommonUtils;
import com.easy.admin.modules.huzhou.common.TemplateExcelUtils; import com.easy.admin.modules.huzhou.common.TemplateExcelUtils;
import com.easy.admin.modules.huzhou.dao.HuzhouContractinfoMapper;
import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoHistoryMapper; import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoHistoryMapper;
import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoMapper; import com.easy.admin.modules.huzhou.dao.HuzhouProjectinfoMapper;
import com.easy.admin.modules.huzhou.dao.HuzhouSubProjectinfoMapper; import com.easy.admin.modules.huzhou.dao.HuzhouSubProjectinfoMapper;
@ -86,6 +87,9 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
@Lazy @Lazy
IHuzhouContractinfoService contractinfoService; IHuzhouContractinfoService contractinfoService;
@Autowired
HuzhouContractinfoMapper contractinfoMapper;
@Override @Override
public void submitProject(MultipartFile[] multipartFile,HuzhouProjectinfo info) throws IOException { public void submitProject(MultipartFile[] multipartFile,HuzhouProjectinfo info) throws IOException {
@ -540,7 +544,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo); ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
List<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(projectInfoAuthSelect); List<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(projectInfoAuthSelect);
List<String> zIds = projectAndChildInfoPageList.stream().map(x -> x.getId()).collect(Collectors.toList()); List<String> zIds = projectAndChildInfoPageList.stream().map(x -> x.getId()).collect(Collectors.toList());
// List<List<String>> cIds0 = projectAndChildInfoPageList.stream().filter(x -> x.getChildren().size() > 0).map(x -> x.getChildren().stream().map(o -> o.getId()).collect(Collectors.toList())).collect(Collectors.toList());
List<String> cIds = new ArrayList<>(); List<String> cIds = new ArrayList<>();
for(HuzhouProjectinfoOV info:projectAndChildInfoPageList){ for(HuzhouProjectinfoOV info:projectAndChildInfoPageList){
if(info.getChildren()!=null){ if(info.getChildren()!=null){
@ -711,10 +714,15 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo); ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
List<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(projectInfoAuthSelect); List<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(projectInfoAuthSelect);
Map<String, List<HuzhouProjectinfoOV>> zxmMap = projectAndChildInfoPageList.stream().collect(Collectors.groupingBy(HuzhouProjectinfo::getType)); Map<String, List<HuzhouProjectinfoOV>> zxmMap = projectAndChildInfoPageList.stream().collect(Collectors.groupingBy(HuzhouProjectinfo::getType));
List<List<HuzhouSubProjectinfo>> cxm = projectAndChildInfoPageList.stream().map(HuzhouProjectinfoOV::getChildren) List<HuzhouSubProjectinfo> cxm = new ArrayList<>();
.filter(children -> children.size() > 0).collect(Collectors.toList()); for(HuzhouProjectinfoOV info:projectAndChildInfoPageList){
Map<String, List<HuzhouSubProjectinfo>> cxmMap = cxm.stream().flatMap(x -> x.stream()) if(info.getChildren()!=null){
.collect(Collectors.groupingBy(HuzhouProjectinfo::getType)); for(HuzhouSubProjectinfo child:info.getChildren()){
cxm.add(child);
}
}
}
Map<String, List<HuzhouSubProjectinfo>> cxmMap = cxm.stream().collect(Collectors.groupingBy(HuzhouProjectinfo::getType));
int zxmNum=0; int zxmNum=0;
int cxmNum=0; int cxmNum=0;
for (String key:zxmMap.keySet()) { for (String key:zxmMap.keySet()) {
@ -724,6 +732,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
cxmNum= zxmMap.get(key).size()+cxmNum; cxmNum= zxmMap.get(key).size()+cxmNum;
} }
int total = zxmNum + cxmNum; int total = zxmNum + cxmNum;
List<String> rkIds = zxmMap.get("1").stream().map(x -> x.getId()).collect(Collectors.toList()); List<String> rkIds = zxmMap.get("1").stream().map(x -> x.getId()).collect(Collectors.toList());
List<String> crkIds = cxmMap.get("1").stream().map(x->x.getId()).collect(Collectors.toList()); List<String> crkIds = cxmMap.get("1").stream().map(x->x.getId()).collect(Collectors.toList());
List<String> ptIds= zxmMap.get("2").stream().map(x -> x.getId()).collect(Collectors.toList()); List<String> ptIds= zxmMap.get("2").stream().map(x -> x.getId()).collect(Collectors.toList());
@ -753,62 +762,20 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
} }
@Override @Override
public NewFundOV getFundByType(List<String> ids) { public NewFundOV getFundByType() {
List<String> projectIds = this.getIdsByType().getRkIdsList(); List<String> projectIds = this.getIdsByType().getRkIdsList();
List<String> zprojectIds = new ArrayList<>(projectIds);
List<String> cprojectIds = this.getIdsByType().getCrkIdsList(); List<String> cprojectIds = this.getIdsByType().getCrkIdsList();
projectIds.addAll(cprojectIds); projectIds.addAll(cprojectIds);
BigDecimal totalAmount = new BigDecimal("0.00");
BigDecimal payAmount = new BigDecimal("0.00");
BigDecimal payCentral = new BigDecimal("0.00");
BigDecimal payProvincial = new BigDecimal("0.00");
NewFundOV result = null; NewFundOV result = null;
if(projectIds.size()!=0){ if(projectIds.size()!=0){
List<HuzhouContractinfo> contractInfoList = contractinfoService.ListByProjectIds(projectIds); Map<String, BigDecimal> totalMap = contractinfoMapper.getTotalByProjectIds(projectIds);
List<HuzhouPlaninfo> planInfoList = planinfoService.listByProjectIds(projectIds); Map<String, BigDecimal> paymentMap = contractinfoMapper.getPaymentsByProjectIds(projectIds);
Map<String,HuzhouContractinfo> contractMoneyMap; BigDecimal totalAmount = totalMap.get("totalAcount");
List<String> finishPlanTaskList; BigDecimal totalCentral = totalMap.get("centralAcount");
for(String projectId:projectIds){ BigDecimal totalProvincial = totalMap.get("provincialAcount");
contractMoneyMap = contractInfoList.stream().filter(x -> x.getProjectId().equals(projectId)) BigDecimal payAmount = paymentMap.get("totalPayment");
.collect(Collectors.toMap(HuzhouContractinfo::getTaskName,o->o)); BigDecimal payCentral = paymentMap.get("centralPayment");
finishPlanTaskList = planInfoList.stream().filter(x->x.getProjectId().equals(projectId)) BigDecimal payProvincial = paymentMap.get("provincialPayment");
.filter(x->x.getIsfinish().equals("2")).map(x->x.getTaskName()).collect(Collectors.toList());
for(String key:contractMoneyMap.keySet()){
if(finishPlanTaskList.contains(key)){
payAmount=payAmount.add(new BigDecimal(Double.toString(contractMoneyMap.get(key).getTotalMoney())));
payCentral=payCentral.add(new BigDecimal(Double.toString(contractMoneyMap.get(key).getCentralMoney())));
payProvincial=payProvincial.add(new BigDecimal(Double.toString(contractMoneyMap.get(key).getProvincialMoney())));
}
}
}
BigDecimal zxmTotal = new BigDecimal("0.00");
BigDecimal cxmTotal = new BigDecimal("0.00");
BigDecimal zxmCentral = new BigDecimal("0.00");
BigDecimal cxmCentral = new BigDecimal("0.00");
BigDecimal zxmProvincial = new BigDecimal("0.00");
BigDecimal cxmProvincial = new BigDecimal("0.00");
if(zprojectIds.size()!=0) {
LambdaQueryWrapper<HuzhouProjectinfo> query = new LambdaQueryWrapper<>(new HuzhouProjectinfo())
.in(HuzhouProjectinfo::getId, zprojectIds)
.select(HuzhouProjectinfo::getId, HuzhouProjectinfo::getTotalMoney);
List<HuzhouProjectinfo> projectInfoList = projectinfoMapper.selectList(query);
zxmTotal = new BigDecimal(Double.toString(projectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum()));
zxmCentral = new BigDecimal(Double.toString(projectInfoList.stream().mapToDouble(x -> x.getCentralMoney()).sum()));
zxmProvincial = new BigDecimal(Double.toString(projectInfoList.stream().mapToDouble(x -> x.getProvincialMoney()).sum()));
}
if(cprojectIds.size()!=0){
LambdaQueryWrapper<HuzhouSubProjectinfo> cquery = new LambdaQueryWrapper<>(new HuzhouSubProjectinfo())
.in(HuzhouSubProjectinfo::getId,cprojectIds)
.select(HuzhouSubProjectinfo::getId,HuzhouSubProjectinfo::getTotalMoney);
List<HuzhouSubProjectinfo> subProjectInfoList=subProjectinfoMapper.selectList(cquery);
cxmTotal = new BigDecimal(Double.toString(subProjectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum()));
cxmCentral = new BigDecimal(Double.toString(subProjectInfoList.stream().mapToDouble(x -> x.getCentralMoney()).sum()));
cxmProvincial = new BigDecimal(Double.toString(subProjectInfoList.stream().mapToDouble(x -> x.getProvincialMoney()).sum()));
}
BigDecimal totalMoney = zxmTotal.add(cxmTotal);
BigDecimal totalCentral = zxmCentral.add(cxmCentral);
BigDecimal totalProvincial = zxmProvincial.add(cxmProvincial);
result=NewFundOV.builder().totalMoney(String.valueOf(totalAmount)).payAmount(String.valueOf(payAmount)) result=NewFundOV.builder().totalMoney(String.valueOf(totalAmount)).payAmount(String.valueOf(payAmount))
.totalCentral(String.valueOf(totalCentral)).payCentral(String.valueOf(payCentral)) .totalCentral(String.valueOf(totalCentral)).payCentral(String.valueOf(payCentral))
.totalProvincial(String.valueOf(totalProvincial)).payProvincial(String.valueOf(payProvincial)).build(); .totalProvincial(String.valueOf(totalProvincial)).payProvincial(String.valueOf(payProvincial)).build();
@ -816,4 +783,6 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
return result; return result;
} }
} }

Loading…
Cancel
Save