1.0.91 校验合同编号不能重复

dev
yinq 15 hours ago
parent 7b52d2c3d3
commit a121afb545

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.NumberChineseFormatter;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.deepoove.poi.data.RowRenderData;
import com.deepoove.poi.data.Rows;
@ -389,6 +390,18 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
*
*/
private void validEntityBeforeSave(ErpContractInfo entity) {
// 校验合同编号不能重复(编辑时排除自身)
if (entity != null && StringUtils.isNotBlank(entity.getContractCode())) {
LambdaQueryWrapper<ErpContractInfo> lqw = new LambdaQueryWrapper<ErpContractInfo>()
.eq(ErpContractInfo::getContractCode, entity.getContractCode())
.eq(ErpContractInfo::getDelFlag, "0")
.ne(entity.getContractId() != null, ErpContractInfo::getContractId, entity.getContractId());
Long cnt = baseMapper.selectCount(lqw);
if (cnt != null && cnt > 0) {
throw new ServiceException("合同编号【" + entity.getContractCode() + "】已存在,请勿重复");
}
}
// 校验客户基础信息是否已完善(附件、税号、开户银行、银行账号不能为空)
Long oneCustomerId = entity.getOneCustomerId();
if (oneCustomerId != null) {

Loading…
Cancel
Save