|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.contract.service.customercontract;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.common.enums.GeneralStatusEnum;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
@@ -24,6 +25,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ConcurrentModificationException;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -68,6 +70,10 @@ public class CustomerContractServiceImpl implements CustomerContractService {
|
|
|
if (Objects.isNull(loginEmployee)) {
|
|
|
throw exception(new ErrorCode(EMPLOYEE_INFO_NOT_EXISTS.getCode(), "登录用户员工信息不存在"));
|
|
|
}
|
|
|
+ String customerContractCode = createReqVO.getCustomerContractCode();
|
|
|
+ if (StrUtil.isNotBlank(customerContractCode)) {
|
|
|
+ validateCustomerContractCode(customerContractCode);
|
|
|
+ }
|
|
|
// 插入
|
|
|
CustomerContractDO customerContract = BeanUtils.toBean(createReqVO, CustomerContractDO.class);
|
|
|
// uuid
|
|
@@ -105,6 +111,13 @@ public class CustomerContractServiceImpl implements CustomerContractService {
|
|
|
return customerContract.getId();
|
|
|
}
|
|
|
|
|
|
+ private void validateCustomerContractCode(String customerContractCode) {
|
|
|
+ Long aLong = customerContractMapper.selectCount(CustomerContractDO::getCustomerContractCode, customerContractCode);
|
|
|
+ if (aLong > 0) {
|
|
|
+ throw exception(CUSTOMER_CONTRACT_CODE_EXISTS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void updateCustomerContract(CustomerContractSaveReqVO updateReqVO) {
|
|
|
// 校验存在
|