|
|
@ -58,14 +58,17 @@ public class CustomerServiceImpl implements CustomerService { |
|
|
|
validateCustomerExists(updateReqVO.getId()); |
|
|
|
// 校验存在
|
|
|
|
validateCurrencyexchangeForUpdate(updateReqVO.getName(),updateReqVO.getAvailable()); |
|
|
|
CustomerDO customerDO = customerMapper.selectOne("name", updateReqVO.getName(), "id", updateReqVO.getId()); |
|
|
|
if(customerDO != null && updateReqVO.getId() == customerDO.getId()){ |
|
|
|
QueryWrapper<CustomerDO> customerDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
customerDOQueryWrapper.eq("name", updateReqVO.getName()); |
|
|
|
customerDOQueryWrapper.ne("id", updateReqVO.getId()); |
|
|
|
Long count = customerMapper.selectCount(customerDOQueryWrapper); |
|
|
|
if(count >0){ |
|
|
|
throw exception(CUSTOMER_NAME_REPEAT); |
|
|
|
} |
|
|
|
// 更新
|
|
|
|
CustomerDO updateObj = CustomerConvert.INSTANCE.convert(updateReqVO); |
|
|
|
customerMapper.updateById(updateObj); |
|
|
|
trendsApi.createTrends(updateObj.getId(), "basic_customer", JSONUtil.toJsonStr(customerDO) , "修改了客户",JSONUtil.toJsonStr(updateObj), TrendsTypeEnum.UPDATE,String.valueOf(getLoginUserId())); |
|
|
|
trendsApi.createTrends(updateObj.getId(), "basic_customer", JSONUtil.toJsonStr(updateReqVO) , "修改了客户",JSONUtil.toJsonStr(updateObj), TrendsTypeEnum.UPDATE,String.valueOf(getLoginUserId())); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|