diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java index 9523967a..da8037da 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/controller/SltAgreementInfoController.java @@ -290,11 +290,7 @@ public class SltAgreementInfoController extends BaseController { /** * 导出结算单 - * @param response - * @param list - * @param filename - - * @throws Exception + * @throws Exception 异常 */ private void expOutExcel(HttpServletResponse response, List list, String filename,String projectName,String unitName,BigDecimal totalCost,int type) throws Exception { if (list != null) { @@ -332,7 +328,7 @@ public class SltAgreementInfoController extends BaseController { /** * 导出结算单--all - * @throws Exception + * @throws Exception 异常信息 */ private void expOutExcelAll(HttpServletResponse response, List lease,List lose,List repair,List scrap,List reduction, String filename,String projectName,String unitName,BigDecimal totalCostLease,BigDecimal totalCostLose,BigDecimal totalCostRepair,BigDecimal totalCostScrap,BigDecimal totalCostReduction) @@ -388,7 +384,6 @@ public class SltAgreementInfoController extends BaseController { workbook.write(out); out.flush(); out.close(); - } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java index 74944ecc..d6952df5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/domain/SltAgreementInfo.java @@ -8,21 +8,21 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.ToString; import com.bonus.common.core.web.domain.BaseEntity; import lombok.experimental.Accessors; /** * 结算信息对象 slt_agreement_info - * - * @author xsheng - * @date 2024-10-16 */ +@EqualsAndHashCode(callSuper = false) @Data @ToString @Accessors(chain = true) public class SltAgreementInfo extends BaseEntity { - private static final long serialVersionUID = 1L; + + private static final long serialVersionUID = -3531370525106104195L; /** ID */ private Long id; @@ -159,7 +159,6 @@ public class SltAgreementInfo extends BaseEntity { @ApiModelProperty(value = "租赁费用") private BigDecimal costs; - /** * 项目名称 */ @@ -253,5 +252,10 @@ public class SltAgreementInfo extends BaseEntity { private String unitValue; + /** + * 是否查询已结算的费用 + */ + private Boolean enableQuerySltData = false; + } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java index 68cbc4cc..c32a643c 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/mapper/SltAgreementInfoMapper.java @@ -93,6 +93,9 @@ public interface SltAgreementInfoMapper { int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma); + // 查询一个协议号的已结算领料详情 + List getLeaseSltDetails(SltAgreementInfo record); + // 查询一个协议号的领料详情 List getLeaseList(SltAgreementInfo bean); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java index 96c49ac4..829a0d96 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/settlement/service/impl/SltAgreementInfoServiceImpl.java @@ -381,7 +381,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { * 获取单个协议的领料明细 */ public List getLeaseList(SltAgreementInfo info) { - List oneOfList = sltAgreementInfoMapper.getLeaseList(info); + List oneOfList; + // 如果开启了查询已结算数据,那么就从结算记录📝里面查询已结算的租赁费用明细 + if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) { + oneOfList = sltAgreementInfoMapper.getLeaseSltDetails(info); + } else { + oneOfList = sltAgreementInfoMapper.getLeaseList(info); + } List leaseList = new ArrayList<>(oneOfList); for (SltAgreementInfo bean : leaseList) { @@ -402,8 +408,11 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService { if (leaseDays.compareTo(BigDecimal.ZERO) < 0) { leaseDays = BigDecimal.ZERO; } - BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.DOWN); - bean.setCosts(costs); + // 如果费用是空的、null、0 那么就根据数量和单价计算 + if (bean.getCosts() == null || bean.getCosts().compareTo(BigDecimal.ZERO) < 0 || bean.getCosts().equals(BigDecimal.ZERO)) { + BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays).setScale(GlobalConstants.INT_2, RoundingMode.DOWN); + bean.setCosts(costs); + } } return leaseList; } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml index 784c9548..f862fd5e 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/settlement/SltAgreementInfoMapper.xml @@ -1393,4 +1393,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +