From 8ee37e6d4af6ddaf6a02b8500ab95c77fea0c898 Mon Sep 17 00:00:00 2001 From: yinq Date: Mon, 20 Oct 2025 09:00:10 +0800 Subject: [PATCH] =?UTF-8?q?1.0.13=20=E5=90=88=E5=90=8C=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BaseRelationMaterialServiceImpl.java | 1 + .../oa/erp/domain/ErpContractInfo.java | 47 ++++++++--- .../oa/erp/domain/bo/ErpContractInfoBo.java | 48 +++++++++--- .../oa/erp/domain/vo/ErpContractInfoVo.java | 77 ++++++++++--------- .../impl/ErpContractInfoServiceImpl.java | 43 +++++------ .../mapper/oa/erp/ErpContractInfoMapper.xml | 39 +++++++++- .../oa/erp/ErpContractMaterialMapper.xml | 24 +++++- 7 files changed, 195 insertions(+), 84 deletions(-) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/base/service/impl/BaseRelationMaterialServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/base/service/impl/BaseRelationMaterialServiceImpl.java index 38f63df5..314f5387 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/base/service/impl/BaseRelationMaterialServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/base/service/impl/BaseRelationMaterialServiceImpl.java @@ -83,6 +83,7 @@ public class BaseRelationMaterialServiceImpl implements IBaseRelationMaterialSer .select(CrmCustomerInfo::getCustomerName) .leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, BaseRelationMaterial::getMaterialId) .leftJoin(CrmCustomerInfo.class, CrmCustomerInfo::getCustomerId, BaseRelationMaterial::getCustomerId) + .eq(bo.getRelationMaterialId() != null, BaseRelationMaterial::getRelationMaterialId, bo.getRelationMaterialId()) .eq(bo.getMaterialId() != null, BaseRelationMaterial::getMaterialId, bo.getMaterialId()) .eq(bo.getCustomerId() != null, BaseRelationMaterial::getCustomerId, bo.getCustomerId()) .like(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode()) diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/ErpContractInfo.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/ErpContractInfo.java index 50f25329..90700129 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/ErpContractInfo.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/ErpContractInfo.java @@ -4,8 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; -import java.math.BigDecimal; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serial; import java.util.List; @@ -14,7 +14,7 @@ import java.util.List; * 合同信息对象 erp_contract_info * * @author Yinq - * @date 2025-10-11 + * @date 2025-10-16 */ @Data @EqualsAndHashCode(callSuper = true) @@ -73,37 +73,37 @@ public class ErpContractInfo extends TenantEntity { /** * 合同总价 */ - private BigDecimal totalPrice; + private Long totalPrice; /** * 甲方公司 */ - private Long aCustomerId; + private Long oneCustomerId; /** * 甲方授权代表 */ - private String aRepresent; + private String oneRepresent; /** * 甲方签字日期 */ - private Date aDate; + private Date oneDate; /** * 乙方公司 */ - private Long bCustomerId; + private Long twoCustomerId; /** * 乙方授权代表 */ - private String bRepresent; + private String twoRepresent; /** * 乙方签字日期 */ - private Date bDate; + private Date twoDate; /** * 合同状态(1暂存 2审批中 3可用) @@ -135,10 +135,35 @@ public class ErpContractInfo extends TenantEntity { */ private Long signatureAppendix; + /** + * 内部合同号 + */ + private String internalContractCode; + + /** + * 外部合同号 + */ + private String externalContractCode; + + /** + * 订单号 + */ + private String orderContractCode; + + /** + * 项目号 + */ + private String projectContractCode; + + /** + * 质保期(天) + */ + private Long warrantyPeriod; + /** * 合同税率(预留) */ - private BigDecimal taxRate; + private Long taxRate; /** * 备注 @@ -160,5 +185,5 @@ public class ErpContractInfo extends TenantEntity { * 合同物料List */ @TableField(exist = false) - private List contractMaterielList; + private List contractMaterialList; } diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/bo/ErpContractInfoBo.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/bo/ErpContractInfoBo.java index a260c1c8..ad456559 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/bo/ErpContractInfoBo.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/bo/ErpContractInfoBo.java @@ -7,17 +7,17 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; -import java.math.BigDecimal; import java.util.Date; import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.oa.erp.domain.ErpContractMaterial; /** * 合同信息业务对象 erp_contract_info * * @author Yinq - * @date 2025-10-11 + * @date 2025-10-16 */ @Data @EqualsAndHashCode(callSuper = true) @@ -73,37 +73,37 @@ public class ErpContractInfoBo extends BaseEntity { /** * 合同总价 */ - private BigDecimal totalPrice; + private Long totalPrice; /** * 甲方公司 */ - private Long aCustomerId; + private Long oneCustomerId; /** * 甲方授权代表 */ - private String aRepresent; + private String oneRepresent; /** * 甲方签字日期 */ - private Date aDate; + private Date oneDate; /** * 乙方公司 */ - private Long bCustomerId; + private Long twoCustomerId; /** * 乙方授权代表 */ - private String bRepresent; + private String twoRepresent; /** * 乙方签字日期 */ - private Date bDate; + private Date twoDate; /** * 合同状态(1暂存 2审批中 3可用) @@ -135,10 +135,35 @@ public class ErpContractInfoBo extends BaseEntity { */ private Long signatureAppendix; + /** + * 内部合同号 + */ + private String internalContractCode; + + /** + * 外部合同号 + */ + private String externalContractCode; + + /** + * 订单号 + */ + private String orderContractCode; + + /** + * 项目号 + */ + private String projectContractCode; + + /** + * 质保期(天) + */ + private Long warrantyPeriod; + /** * 合同税率(预留) */ - private BigDecimal taxRate; + private Long taxRate; /** * 备注 @@ -153,7 +178,6 @@ public class ErpContractInfoBo extends BaseEntity { /** * 合同物料List */ - private List contractMaterielList; - + private List contractMaterialList; } diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ErpContractInfoVo.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ErpContractInfoVo.java index add657e8..f2ee7f49 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ErpContractInfoVo.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/domain/vo/ErpContractInfoVo.java @@ -1,7 +1,7 @@ package org.dromara.oa.erp.domain.vo; -import java.math.BigDecimal; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import org.dromara.oa.erp.domain.ErpContractInfo; import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelProperty; @@ -21,7 +21,7 @@ import java.util.List; * 合同信息视图对象 erp_contract_info * * @author Yinq - * @date 2025-10-11 + * @date 2025-10-16 */ @Data @ExcelIgnoreUnannotated @@ -93,43 +93,43 @@ public class ErpContractInfoVo implements Serializable { * 合同总价 */ @ExcelProperty(value = "合同总价") - private BigDecimal totalPrice; + private Long totalPrice; /** * 甲方公司 */ @ExcelProperty(value = "甲方公司") - private Long aCustomerId; + private Long oneCustomerId; /** * 甲方授权代表 */ @ExcelProperty(value = "甲方授权代表") - private String aRepresent; + private String oneRepresent; /** * 甲方签字日期 */ @ExcelProperty(value = "甲方签字日期") - private Date aDate; + private Date oneDate; /** * 乙方公司 */ @ExcelProperty(value = "乙方公司") - private Long bCustomerId; + private Long twoCustomerId; /** * 乙方授权代表 */ @ExcelProperty(value = "乙方授权代表") - private String bRepresent; + private String twoRepresent; /** * 乙方签字日期 */ @ExcelProperty(value = "乙方签字日期") - private Date bDate; + private Date twoDate; /** * 合同状态(1暂存 2审批中 3可用) @@ -168,11 +168,42 @@ public class ErpContractInfoVo implements Serializable { @ExcelProperty(value = "签字合同附件") private Long signatureAppendix; + /** + * 内部合同号 + */ + @ExcelProperty(value = "内部合同号") + private String internalContractCode; + + /** + * 外部合同号 + */ + @ExcelProperty(value = "外部合同号") + private String externalContractCode; + + /** + * 订单号 + */ + @ExcelProperty(value = "订单号") + private String orderContractCode; + + /** + * 项目号 + */ + @ExcelProperty(value = "项目号") + private String projectContractCode; + + /** + * 质保期(天) + */ + @ExcelProperty(value = "质保期", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "天=") + private Long warrantyPeriod; + /** * 合同税率(预留) */ @ExcelProperty(value = "合同税率(预留)") - private BigDecimal taxRate; + private Long taxRate; /** * 备注 @@ -187,32 +218,8 @@ public class ErpContractInfoVo implements Serializable { @ExcelDictFormat(dictType = "active_flag") private String activeFlag; - /** - * 创建人 - */ - @ExcelProperty(value = "创建人") - private Long createBy; - - /** - * 创建时间 - */ - @ExcelProperty(value = "创建时间") - private Date createTime; - - /** - * 更新人 - */ - @ExcelProperty(value = "更新人") - private Long updateBy; - - /** - * 更新时间 - */ - @ExcelProperty(value = "更新时间") - private Date updateTime; - /** * 合同物料List */ - private List contractMaterielList; + private List contractMaterialList; } diff --git a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java index c514207c..f006421a 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java +++ b/ruoyi-modules/ruoyi-oa/src/main/java/org/dromara/oa/erp/service/impl/ErpContractInfoServiceImpl.java @@ -89,12 +89,6 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { .eq(bo.getContractDeptId() != null, ErpContractInfo::getContractDeptId, bo.getContractDeptId()) .eq(bo.getContractDate() != null, ErpContractInfo::getContractDate, bo.getContractDate()) .eq(bo.getTotalPrice() != null, ErpContractInfo::getTotalPrice, bo.getTotalPrice()) - .eq(bo.getACustomerId() != null, ErpContractInfo::getACustomerId, bo.getACustomerId()) - .eq(StringUtils.isNotBlank(bo.getARepresent()), ErpContractInfo::getARepresent, bo.getARepresent()) - .eq(bo.getADate() != null, ErpContractInfo::getADate, bo.getADate()) - .eq(bo.getBCustomerId() != null, ErpContractInfo::getBCustomerId, bo.getBCustomerId()) - .eq(StringUtils.isNotBlank(bo.getBRepresent()), ErpContractInfo::getBRepresent, bo.getBRepresent()) - .eq(bo.getBDate() != null, ErpContractInfo::getBDate, bo.getBDate()) .eq(StringUtils.isNotBlank(bo.getContractStatus()), ErpContractInfo::getContractStatus, bo.getContractStatus()) .eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpContractInfo::getFlowStatus, bo.getFlowStatus()) .eq(bo.getTemplateId() != null, ErpContractInfo::getTemplateId, bo.getTemplateId()) @@ -117,13 +111,13 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { public Boolean insertByBo(ErpContractInfoBo bo) { ErpContractInfo add = MapstructUtils.convert(bo, ErpContractInfo.class); validEntityBeforeSave(add); - List contractMaterielList = bo.getContractMaterielList(); + List contractMaterialList = bo.getContractMaterialList(); boolean flag = baseMapper.insert(add) > 0; - if (flag) { + if (flag && contractMaterialList != null && !contractMaterialList.isEmpty()) { bo.setContractId(add.getContractId()); - for (ErpContractMaterial erpContractMateriel : contractMaterielList) { - erpContractMateriel.setContractId(add.getContractId()); - contractMaterialMapper.insert(erpContractMateriel); + for (ErpContractMaterial erpContractMaterial : contractMaterialList) { + erpContractMaterial.setContractId(add.getContractId()); + contractMaterialMapper.insert(erpContractMaterial); } } return flag; @@ -140,22 +134,22 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { public Boolean updateByBo(ErpContractInfoBo bo) { ErpContractInfo update = MapstructUtils.convert(bo, ErpContractInfo.class); validEntityBeforeSave(update); - List contractMaterielList = bo.getContractMaterielList(); + List contractMaterialList = bo.getContractMaterialList(); MPJLambdaWrapper lqwRecord = JoinWrappers.lambda(ErpContractMaterial.class); lqwRecord.eq(ErpContractMaterial::getContractId, bo.getContractId()); - List contractMaterielOldList = contractMaterialMapper.selectList(lqwRecord); - if (!contractMaterielList.isEmpty()) { - for (ErpContractMaterial contractMateriel : contractMaterielList) { - contractMaterialMapper.insertOrUpdate(contractMateriel); + List contractMaterialOldList = contractMaterialMapper.selectList(lqwRecord); + if (contractMaterialList != null && !contractMaterialList.isEmpty()) { + for (ErpContractMaterial contractMaterial : contractMaterialList) { + contractMaterialMapper.insertOrUpdate(contractMaterial); } - Set existingContractMaterielIds = contractMaterielList.stream() + Set existingContractMaterialIds = contractMaterialList.stream() .map(ErpContractMaterial::getContractMaterialId) .collect(Collectors.toSet()); - List filterContractMaterielIds = contractMaterielOldList.stream() - .filter(materiel -> !existingContractMaterielIds.contains(materiel.getContractMaterialId())) + List filterContractMaterialIds = contractMaterialOldList.stream() + .filter(material -> !existingContractMaterialIds.contains(material.getContractMaterialId())) .toList(); - for (ErpContractMaterial filterContractMaterielId : filterContractMaterielIds) { - contractMaterialMapper.deleteById(filterContractMaterielId.getContractMaterialId()); + for (ErpContractMaterial filterContractMaterialId : filterContractMaterialIds) { + contractMaterialMapper.deleteById(filterContractMaterialId.getContractMaterialId()); } } return baseMapper.updateById(update) > 0; @@ -165,9 +159,10 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService { * 保存前的数据校验 */ private void validEntityBeforeSave(ErpContractInfo entity) { - if (entity.getContractMaterielList() == null || entity.getContractMaterielList().isEmpty()) { - throw new ServiceException("请填写合同物料!"); - } + // 注释掉物料列表的强制校验,允许空物料列表 + // if (entity.getContractMaterialList() == null || entity.getContractMaterialList().isEmpty()) { + // throw new ServiceException("请填写合同物料!"); + // } } /** diff --git a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractInfoMapper.xml b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractInfoMapper.xml index 471cf6a2..98b7f813 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractInfoMapper.xml +++ b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractInfoMapper.xml @@ -7,7 +7,44 @@ diff --git a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractMaterialMapper.xml b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractMaterialMapper.xml index 38f6b9d7..2590d653 100644 --- a/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractMaterialMapper.xml +++ b/ruoyi-modules/ruoyi-oa/src/main/resources/mapper/oa/erp/ErpContractMaterialMapper.xml @@ -7,7 +7,29 @@