From 419ec25e37746c9ba805a28757fd5b175f0cd597 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Sun, 29 Sep 2024 15:37:48 +0800 Subject: [PATCH] =?UTF-8?q?springboot=E6=9C=AA=E6=8E=88=E6=9D=83=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=BC=8F=E6=B4=9E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/mapper/AgreementInfoMapper.java | 10 ++++++++ .../remind/service/CalcMonthlyServiceImp.java | 14 ++++++++++- .../service/AgreementInfoService.java | 10 ++++++++ .../impl/AgreementInfoServiceImpl.java | 23 +++++++++++++++++++ .../impl/PurchaseMacodeInfoServiceImpl.java | 1 + .../mapper/material/AgreementInfoMapper.xml | 17 ++++++++++++++ .../material/PurchaseMacodeInfoMapper.xml | 1 + 7 files changed, 75 insertions(+), 1 deletion(-) diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/AgreementInfoMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/AgreementInfoMapper.java index 34a2f6f..3d4666e 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/AgreementInfoMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/AgreementInfoMapper.java @@ -1,8 +1,10 @@ package com.bonus.sgzb.material.mapper; +import com.bonus.sgzb.base.domain.BmProjectLot; import com.bonus.sgzb.material.domain.AgreementInfo; import org.apache.ibatis.annotations.Mapper; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -83,4 +85,12 @@ public interface AgreementInfoMapper { int selectByagreementId(Long agreementId); List getAllAgreementId(); + + BigDecimal getCostByLotId(BmProjectLot agreementInfo); + + List getAllprojectId(); + + BigDecimal getCostIndicatorsByLotId(BmProjectLot bmProjectLot); + + List getprojectIdByLotId(BmProjectLot bmProjectLot); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java index 29e3097..3767413 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/remind/service/CalcMonthlyServiceImp.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.material.remind.service; import com.bonus.sgzb.base.api.domain.SltAgreementInfo; +import com.bonus.sgzb.base.domain.BmProjectLot; import com.bonus.sgzb.common.core.utils.DateTimeHelper; import com.bonus.sgzb.material.domain.AgreementInfo; import com.bonus.sgzb.material.domain.CalMonthlyBean; @@ -50,6 +51,17 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService { record.setMonth(month); cleanSameMonthOldRecords(record); List list = agreementInfoService.getAllAgreementId(); + List projectLots = agreementInfoService.getAllprojectId(); + // 如果该工程费用指标已超过,则不需要记录月结记录 + for (BmProjectLot bmProjectLot : projectLots) { + BigDecimal costIndicatorsByLotId = agreementInfoService.getCostIndicatorsByLotId(bmProjectLot); + BigDecimal costByLotId = agreementInfoService.getCostByLotId(bmProjectLot); + if (costByLotId.compareTo(costIndicatorsByLotId) > 0) { + // 通过lotId找agreementId + List agreementIds = agreementInfoService.getprojectIdByLotId(bmProjectLot); + agreementIds.forEach(t -> list.remove(t)); + } + } list.forEach(t -> { t.setStartTime(startTime); t.setEndTime(endTime); @@ -150,7 +162,7 @@ public class CalcMonthlyServiceImp implements CalcMonthlyService { ProjectMonthDetail projectMonthDetail = new ProjectMonthDetail(); projectMonthDetail.setTypeId(Integer.valueOf(bean.getTypeId())); - if (bean.getMaId() != null){ + if (bean.getMaId() != null) { projectMonthDetail.setMaId(Integer.valueOf(bean.getMaId())); } projectMonthDetail.setUnit(bean.getNuitName()); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/AgreementInfoService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/AgreementInfoService.java index 216aed9..d375b3c 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/AgreementInfoService.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/AgreementInfoService.java @@ -1,8 +1,10 @@ package com.bonus.sgzb.material.service; +import com.bonus.sgzb.base.domain.BmProjectLot; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.material.domain.AgreementInfo; +import java.math.BigDecimal; import java.util.List; /** @@ -66,4 +68,12 @@ public interface AgreementInfoService { List exportList(AgreementInfo agreementInfo); List getAllAgreementId(); + + BigDecimal getCostByLotId(BmProjectLot agreementInfo); + + List getAllprojectId(); + + BigDecimal getCostIndicatorsByLotId(BmProjectLot bmProjectLot); + + List getprojectIdByLotId(BmProjectLot bmProjectLot); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/AgreementInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/AgreementInfoServiceImpl.java index bacca9b..40fa64f 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/AgreementInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/AgreementInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.material.service.impl; +import com.bonus.sgzb.base.domain.BmProjectLot; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; @@ -9,6 +10,8 @@ import com.bonus.sgzb.material.service.AgreementInfoService; import com.bonus.sgzb.material.vo.GlobalContants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -101,6 +104,26 @@ public class AgreementInfoServiceImpl implements AgreementInfoService { return agreementInfoMapper.getAllAgreementId(); } + @Override + public BigDecimal getCostByLotId(BmProjectLot bmProjectLot) { + return agreementInfoMapper.getCostByLotId(bmProjectLot); + } + + @Override + public List getAllprojectId() { + return agreementInfoMapper.getAllprojectId(); + } + + @Override + public BigDecimal getCostIndicatorsByLotId(BmProjectLot bmProjectLot) { + return agreementInfoMapper.getCostIndicatorsByLotId(bmProjectLot); + } + + @Override + public List getprojectIdByLotId(BmProjectLot bmProjectLot) { + return agreementInfoMapper.getprojectIdByLotId(bmProjectLot); + } + private String purchaseCodeRule() { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java index 43cc763..20fd12f 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java @@ -117,6 +117,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService int i = purchaseMacodeInfoMapper.selectMaCode(purchaseMacodeInfo.getMaCode()); if (i > 0) { purchaseMacodeInfo.setStatusFlag(1); + purchaseMacodeInfo.setMaCode(null); b = false; } else { purchaseMacodeInfo.setStatusFlag(0); diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml index 40d96ab..8b486c0 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml @@ -172,5 +172,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE status = '1' + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml index 3113b39..d00953d 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml @@ -532,6 +532,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_name specificationType, mt1.type_name typeName, pmi.ma_code maCode, + pmi.fix_code fixCode, mm.assets_code assetsCode FROM purchase_check_details pcd