1.0.13 合同字段优化

dev
yinq 2 months ago
parent 0729f4ef65
commit 8ee37e6d4a

@ -83,6 +83,7 @@ public class BaseRelationMaterialServiceImpl implements IBaseRelationMaterialSer
.select(CrmCustomerInfo::getCustomerName) .select(CrmCustomerInfo::getCustomerName)
.leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, BaseRelationMaterial::getMaterialId) .leftJoin(BaseMaterialInfo.class, BaseMaterialInfo::getMaterialId, BaseRelationMaterial::getMaterialId)
.leftJoin(CrmCustomerInfo.class, CrmCustomerInfo::getCustomerId, BaseRelationMaterial::getCustomerId) .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.getMaterialId() != null, BaseRelationMaterial::getMaterialId, bo.getMaterialId())
.eq(bo.getCustomerId() != null, BaseRelationMaterial::getCustomerId, bo.getCustomerId()) .eq(bo.getCustomerId() != null, BaseRelationMaterial::getCustomerId, bo.getCustomerId())
.like(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode()) .like(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode())

@ -4,8 +4,8 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial; import java.io.Serial;
import java.util.List; import java.util.List;
@ -14,7 +14,7 @@ import java.util.List;
* erp_contract_info * erp_contract_info
* *
* @author Yinq * @author Yinq
* @date 2025-10-11 * @date 2025-10-16
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @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) * (1 2 3)
@ -135,10 +135,35 @@ public class ErpContractInfo extends TenantEntity {
*/ */
private Long signatureAppendix; 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 * List
*/ */
@TableField(exist = false) @TableField(exist = false)
private List<ErpContractMaterial> contractMaterielList; private List<ErpContractMaterial> contractMaterialList;
} }

@ -7,17 +7,17 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.oa.erp.domain.ErpContractMaterial; import org.dromara.oa.erp.domain.ErpContractMaterial;
/** /**
* erp_contract_info * erp_contract_info
* *
* @author Yinq * @author Yinq
* @date 2025-10-11 * @date 2025-10-16
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @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) * (1 2 3)
@ -135,10 +135,35 @@ public class ErpContractInfoBo extends BaseEntity {
*/ */
private Long signatureAppendix; 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 * List
*/ */
private List<ErpContractMaterial> contractMaterielList; private List<ErpContractMaterial> contractMaterialList;
} }

@ -1,7 +1,7 @@
package org.dromara.oa.erp.domain.vo; package org.dromara.oa.erp.domain.vo;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.ErpContractInfo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty; import cn.idev.excel.annotation.ExcelProperty;
@ -21,7 +21,7 @@ import java.util.List;
* erp_contract_info * erp_contract_info
* *
* @author Yinq * @author Yinq
* @date 2025-10-11 * @date 2025-10-16
*/ */
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
@ -93,43 +93,43 @@ public class ErpContractInfoVo implements Serializable {
* *
*/ */
@ExcelProperty(value = "合同总价") @ExcelProperty(value = "合同总价")
private BigDecimal totalPrice; private Long totalPrice;
/** /**
* *
*/ */
@ExcelProperty(value = "甲方公司") @ExcelProperty(value = "甲方公司")
private Long aCustomerId; private Long oneCustomerId;
/** /**
* *
*/ */
@ExcelProperty(value = "甲方授权代表") @ExcelProperty(value = "甲方授权代表")
private String aRepresent; private String oneRepresent;
/** /**
* *
*/ */
@ExcelProperty(value = "甲方签字日期") @ExcelProperty(value = "甲方签字日期")
private Date aDate; private Date oneDate;
/** /**
* *
*/ */
@ExcelProperty(value = "乙方公司") @ExcelProperty(value = "乙方公司")
private Long bCustomerId; private Long twoCustomerId;
/** /**
* *
*/ */
@ExcelProperty(value = "乙方授权代表") @ExcelProperty(value = "乙方授权代表")
private String bRepresent; private String twoRepresent;
/** /**
* *
*/ */
@ExcelProperty(value = "乙方签字日期") @ExcelProperty(value = "乙方签字日期")
private Date bDate; private Date twoDate;
/** /**
* (1 2 3) * (1 2 3)
@ -168,11 +168,42 @@ public class ErpContractInfoVo implements Serializable {
@ExcelProperty(value = "签字合同附件") @ExcelProperty(value = "签字合同附件")
private Long signatureAppendix; 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 = "合同税率(预留)") @ExcelProperty(value = "合同税率(预留)")
private BigDecimal taxRate; private Long taxRate;
/** /**
* *
@ -187,32 +218,8 @@ public class ErpContractInfoVo implements Serializable {
@ExcelDictFormat(dictType = "active_flag") @ExcelDictFormat(dictType = "active_flag")
private String activeFlag; private String activeFlag;
/**
*
*/
@ExcelProperty(value = "创建人")
private Long createBy;
/**
*
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
*
*/
@ExcelProperty(value = "更新人")
private Long updateBy;
/**
*
*/
@ExcelProperty(value = "更新时间")
private Date updateTime;
/** /**
* List * List
*/ */
private List<ErpContractMaterial> contractMaterielList; private List<ErpContractMaterial> contractMaterialList;
} }

@ -89,12 +89,6 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
.eq(bo.getContractDeptId() != null, ErpContractInfo::getContractDeptId, bo.getContractDeptId()) .eq(bo.getContractDeptId() != null, ErpContractInfo::getContractDeptId, bo.getContractDeptId())
.eq(bo.getContractDate() != null, ErpContractInfo::getContractDate, bo.getContractDate()) .eq(bo.getContractDate() != null, ErpContractInfo::getContractDate, bo.getContractDate())
.eq(bo.getTotalPrice() != null, ErpContractInfo::getTotalPrice, bo.getTotalPrice()) .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.getContractStatus()), ErpContractInfo::getContractStatus, bo.getContractStatus())
.eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpContractInfo::getFlowStatus, bo.getFlowStatus()) .eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpContractInfo::getFlowStatus, bo.getFlowStatus())
.eq(bo.getTemplateId() != null, ErpContractInfo::getTemplateId, bo.getTemplateId()) .eq(bo.getTemplateId() != null, ErpContractInfo::getTemplateId, bo.getTemplateId())
@ -117,13 +111,13 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
public Boolean insertByBo(ErpContractInfoBo bo) { public Boolean insertByBo(ErpContractInfoBo bo) {
ErpContractInfo add = MapstructUtils.convert(bo, ErpContractInfo.class); ErpContractInfo add = MapstructUtils.convert(bo, ErpContractInfo.class);
validEntityBeforeSave(add); validEntityBeforeSave(add);
List<ErpContractMaterial> contractMaterielList = bo.getContractMaterielList(); List<ErpContractMaterial> contractMaterialList = bo.getContractMaterialList();
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
if (flag) { if (flag && contractMaterialList != null && !contractMaterialList.isEmpty()) {
bo.setContractId(add.getContractId()); bo.setContractId(add.getContractId());
for (ErpContractMaterial erpContractMateriel : contractMaterielList) { for (ErpContractMaterial erpContractMaterial : contractMaterialList) {
erpContractMateriel.setContractId(add.getContractId()); erpContractMaterial.setContractId(add.getContractId());
contractMaterialMapper.insert(erpContractMateriel); contractMaterialMapper.insert(erpContractMaterial);
} }
} }
return flag; return flag;
@ -140,22 +134,22 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
public Boolean updateByBo(ErpContractInfoBo bo) { public Boolean updateByBo(ErpContractInfoBo bo) {
ErpContractInfo update = MapstructUtils.convert(bo, ErpContractInfo.class); ErpContractInfo update = MapstructUtils.convert(bo, ErpContractInfo.class);
validEntityBeforeSave(update); validEntityBeforeSave(update);
List<ErpContractMaterial> contractMaterielList = bo.getContractMaterielList(); List<ErpContractMaterial> contractMaterialList = bo.getContractMaterialList();
MPJLambdaWrapper<ErpContractMaterial> lqwRecord = JoinWrappers.lambda(ErpContractMaterial.class); MPJLambdaWrapper<ErpContractMaterial> lqwRecord = JoinWrappers.lambda(ErpContractMaterial.class);
lqwRecord.eq(ErpContractMaterial::getContractId, bo.getContractId()); lqwRecord.eq(ErpContractMaterial::getContractId, bo.getContractId());
List<ErpContractMaterial> contractMaterielOldList = contractMaterialMapper.selectList(lqwRecord); List<ErpContractMaterial> contractMaterialOldList = contractMaterialMapper.selectList(lqwRecord);
if (!contractMaterielList.isEmpty()) { if (contractMaterialList != null && !contractMaterialList.isEmpty()) {
for (ErpContractMaterial contractMateriel : contractMaterielList) { for (ErpContractMaterial contractMaterial : contractMaterialList) {
contractMaterialMapper.insertOrUpdate(contractMateriel); contractMaterialMapper.insertOrUpdate(contractMaterial);
} }
Set<Long> existingContractMaterielIds = contractMaterielList.stream() Set<Long> existingContractMaterialIds = contractMaterialList.stream()
.map(ErpContractMaterial::getContractMaterialId) .map(ErpContractMaterial::getContractMaterialId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
List<ErpContractMaterial> filterContractMaterielIds = contractMaterielOldList.stream() List<ErpContractMaterial> filterContractMaterialIds = contractMaterialOldList.stream()
.filter(materiel -> !existingContractMaterielIds.contains(materiel.getContractMaterialId())) .filter(material -> !existingContractMaterialIds.contains(material.getContractMaterialId()))
.toList(); .toList();
for (ErpContractMaterial filterContractMaterielId : filterContractMaterielIds) { for (ErpContractMaterial filterContractMaterialId : filterContractMaterialIds) {
contractMaterialMapper.deleteById(filterContractMaterielId.getContractMaterialId()); contractMaterialMapper.deleteById(filterContractMaterialId.getContractMaterialId());
} }
} }
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;
@ -165,9 +159,10 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
* *
*/ */
private void validEntityBeforeSave(ErpContractInfo entity) { 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("请填写合同物料!");
// }
} }
/** /**

@ -7,7 +7,44 @@
</resultMap> </resultMap>
<select id="selectCustomErpContractInfoVoList" resultMap="ErpContractInfoResult"> <select id="selectCustomErpContractInfoVoList" resultMap="ErpContractInfoResult">
select contract_id, tenant_id, contract_flag, contract_code, contract_name, contract_category, contract_type, business_direction, contract_dept_id, contract_date, total_price, a_customer_id, a_represent, a_date, b_customer_id, b_represent, b_date, contract_status, flow_status, template_id, oss_id, payment_method, signature_appendix, tax_rate, remark, active_flag, del_flag, create_dept, create_by, create_time, update_by, update_time from erp_contract_info t select contract_id,
tenant_id,
contract_flag,
contract_code,
contract_name,
contract_category,
contract_type,
business_direction,
contract_dept_id,
contract_date,
total_price,
one_customer_id,
one_represent,
one_date,
two_customer_id,
two_represent,
two_date,
contract_status,
flow_status,
template_id,
oss_id,
payment_method,
signature_appendix,
internal_contract_code,
external_contract_code,
order_contract_code,
project_contract_code,
warranty_period,
tax_rate,
remark,
active_flag,
del_flag,
create_dept,
create_by,
create_time,
update_by,
update_time
from erp_contract_info t
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>

@ -7,7 +7,29 @@
</resultMap> </resultMap>
<select id="selectCustomErpContractMaterialVoList" resultMap="ErpContractMaterialResult"> <select id="selectCustomErpContractMaterialVoList" resultMap="ErpContractMaterialResult">
select contract_material_id, tenant_id, plan_flag, contract_id, product_name, specification_description, material_id, relation_material_id, amount, unit_id, before_price, tax_rate, including_price, subtotal, remark, active_flag, del_flag, create_dept, create_by, create_time, update_by, update_time from erp_contract_material t select contract_material_id,
tenant_id,
plan_flag,
contract_id,
product_name,
specification_description,
material_id,
relation_material_id,
amount,
unit_id,
before_price,
tax_rate,
including_price,
subtotal,
remark,
active_flag,
del_flag,
create_dept,
create_by,
create_time,
update_by,
update_time
from erp_contract_material t
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>

Loading…
Cancel
Save