新增合同收发货规则

This commit is contained in:
潘荣晟
2026-01-07 16:10:45 +08:00
parent 960c5b5b25
commit cb554f35f3
17 changed files with 720 additions and 30 deletions

View File

@@ -450,4 +450,9 @@ public class ContractMainDO extends BusinessBaseDO {
*/
@TableField("SALE_TAX_NUM")
private String salesTaxNumber;
/**
* 否启用授信
*/
@TableField("HS_CRDT")
private String hasCredit;
}

View File

@@ -0,0 +1,88 @@
package com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 收发货规则 DO
*
* @author 后台管理-1
*/
@TableName("bse_ctrt_rcv_snd")
@KeySequence("bse_ctrt_rcv_snd_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ContractReceiveSendDO extends BusinessBaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 物料名称
*/
@TableField("MTRL_NAME")
private String materialName;
/**
* 物料编码
*/
@TableField("MTRL_NUM")
private String materialNumber;
/**
* 元素缩写
*/
@TableField("ELEM_ABBR")
private String elementAbbreviation;
/**
* 元素名称
*/
@TableField("ELEM_NAME")
private String elementName;
/**
* 元素编码
*/
@TableField("ELEM_NUM")
private String elementNumber;
/**
* 类型
*/
@TableField("TP")
private String type;
/**
* 规则
*/
@TableField("RUL")
private String rule;
/**
* 区间方式
*/
@TableField("RNG_WY")
private String rangeWay;
/**
* 区间下限
*/
@TableField("GRD_DOWN")
private String gradeDown;
/**
* 区间上限
*/
@TableField("GRD_UP")
private String gradeUp;
/**
* 合同id
*/
@TableField("CTRT_ID")
private Long contractId;
}

View File

@@ -0,0 +1,36 @@
package com.zt.plat.module.contractorder.dal.mysql.contractreceivesend;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 收发货规则 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ContractReceiveSendMapper extends BaseMapperX<ContractReceiveSendDO> {
default PageResult<ContractReceiveSendDO> selectPage(ContractReceiveSendPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ContractReceiveSendDO>()
.likeIfPresent(ContractReceiveSendDO::getMaterialName, reqVO.getMaterialName())
.eqIfPresent(ContractReceiveSendDO::getMaterialNumber, reqVO.getMaterialNumber())
.eqIfPresent(ContractReceiveSendDO::getElementAbbreviation, reqVO.getElementAbbreviation())
.likeIfPresent(ContractReceiveSendDO::getElementName, reqVO.getElementName())
.eqIfPresent(ContractReceiveSendDO::getElementNumber, reqVO.getElementNumber())
.eqIfPresent(ContractReceiveSendDO::getType, reqVO.getType())
.eqIfPresent(ContractReceiveSendDO::getRule, reqVO.getRule())
.eqIfPresent(ContractReceiveSendDO::getRangeWay, reqVO.getRangeWay())
.eqIfPresent(ContractReceiveSendDO::getGradeDown, reqVO.getGradeDown())
.eqIfPresent(ContractReceiveSendDO::getGradeUp, reqVO.getGradeUp())
.eqIfPresent(ContractReceiveSendDO::getContractId, reqVO.getContractId())
.betweenIfPresent(ContractReceiveSendDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ContractReceiveSendDO::getId));
}
}

View File

@@ -0,0 +1,73 @@
package com.zt.plat.module.contractorder.service.contractreceivesend;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 收发货规则 Service 接口
*
* @author 后台管理-1
*/
public interface ContractReceiveSendService {
/**
* 创建收发货规则
*
* @param createReqVO 创建信息
* @return 编号
*/
ContractReceiveSendRespVO createContractReceiveSend(@Valid ContractReceiveSendSaveReqVO createReqVO);
/**
* 更新收发货规则
*
* @param updateReqVO 更新信息
*/
void updateContractReceiveSend(@Valid ContractReceiveSendSaveReqVO updateReqVO);
/**
* 删除收发货规则
*
* @param id 编号
*/
void deleteContractReceiveSend(Long id);
/**
* 批量删除收发货规则
*
* @param ids 编号
*/
void deleteContractReceiveSendListByIds(List<Long> ids);
/**
* 获得收发货规则
*
* @param id 编号
* @return 收发货规则
*/
ContractReceiveSendDO getContractReceiveSend(Long id);
/**
* 获得收发货规则分页
*
* @param pageReqVO 分页查询
* @return 收发货规则分页
*/
PageResult<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO);
/**
* 通过合同ID获得收发货规则
*
* @param contractId 合同号
* @return 收发货规则
*/
List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId);
}

View File

@@ -0,0 +1,96 @@
package com.zt.plat.module.contractorder.service.contractreceivesend;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO;
import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO;
import com.zt.plat.module.contractorder.dal.mysql.contractreceivesend.ContractReceiveSendMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import java.util.List;
import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.CONTRACT_RECEIVE_SEND_NOT_EXISTS;
/**
* 收发货规则 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class ContractReceiveSendServiceImpl implements ContractReceiveSendService {
@Resource
private ContractReceiveSendMapper contractReceiveSendMapper;
@Override
public ContractReceiveSendRespVO createContractReceiveSend(ContractReceiveSendSaveReqVO createReqVO) {
// 插入
ContractReceiveSendDO contractReceiveSend = BeanUtils.toBean(createReqVO, ContractReceiveSendDO.class);
contractReceiveSendMapper.insert(contractReceiveSend);
// 返回
return BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class);
}
@Override
public void updateContractReceiveSend(ContractReceiveSendSaveReqVO updateReqVO) {
// 校验存在
validateContractReceiveSendExists(updateReqVO.getId());
// 更新
ContractReceiveSendDO updateObj = BeanUtils.toBean(updateReqVO, ContractReceiveSendDO.class);
contractReceiveSendMapper.updateById(updateObj);
}
@Override
public void deleteContractReceiveSend(Long id) {
// 校验存在
validateContractReceiveSendExists(id);
// 删除
contractReceiveSendMapper.deleteById(id);
}
@Override
public void deleteContractReceiveSendListByIds(List<Long> ids) {
// 校验存在
validateContractReceiveSendExists(ids);
// 删除
contractReceiveSendMapper.deleteByIds(ids);
}
private void validateContractReceiveSendExists(List<Long> ids) {
List<ContractReceiveSendDO> list = contractReceiveSendMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS);
}
}
private void validateContractReceiveSendExists(Long id) {
if (contractReceiveSendMapper.selectById(id) == null) {
throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS);
}
}
@Override
public ContractReceiveSendDO getContractReceiveSend(Long id) {
return contractReceiveSendMapper.selectById(id);
}
@Override
public PageResult<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO) {
return contractReceiveSendMapper.selectPage(pageReqVO);
}
@Override
public List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId) {
return BeanUtils.toBean(contractReceiveSendMapper.selectList(ContractReceiveSendDO::getContractId, contractId), ContractReceiveSendRespVO.class);
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zt.plat.module.bse.dal.dao.contractreceivesend.ContractReceiveSendMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>