code review:客户锁定的逻辑

This commit is contained in:
YunaiV 2023-11-03 23:43:04 +08:00
parent 9a007de947
commit acdfc28ee6
3 changed files with 6 additions and 2 deletions

View File

@ -95,8 +95,9 @@ public class CrmCustomerController {
return success(true); return success(true);
} }
// TODO @Joey单独建一个属于自己业务的 ReqVO因为前端如果模拟请求是不是可以更新其它字段了
@PutMapping("/lock") @PutMapping("/lock")
@Operation(summary = "锁定/解锁") @Operation(summary = "锁定/解锁客户")
@PreAuthorize("@ss.hasPermission('crm:customer:update')") @PreAuthorize("@ss.hasPermission('crm:customer:update')")
public CommonResult<Boolean> lockCustomer(@Valid @RequestBody CrmCustomerUpdateReqVO updateReqVO) { public CommonResult<Boolean> lockCustomer(@Valid @RequestBody CrmCustomerUpdateReqVO updateReqVO) {
customerService.lockCustomer(updateReqVO); customerService.lockCustomer(updateReqVO);

View File

@ -87,7 +87,7 @@ public interface CrmCustomerService {
void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId); void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId);
/** /**
* 锁定客户 解锁客户 * 锁定/解锁客户
* *
* @param updateReqVO 更新信息 * @param updateReqVO 更新信息
*/ */

View File

@ -146,6 +146,9 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
public void lockCustomer(CrmCustomerUpdateReqVO updateReqVO) { public void lockCustomer(CrmCustomerUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateCustomerExists(updateReqVO.getId()); validateCustomerExists(updateReqVO.getId());
// TODO @Joey可以校验下如果已经对应的锁定状态报个业务异常原因是后续这个业务会记录操作日志会记录多了
// TODO @芋艿业务完善增加锁定上限
// 更新 // 更新
CrmCustomerDO updateObj = CrmCustomerConvert.INSTANCE.convert(updateReqVO); CrmCustomerDO updateObj = CrmCustomerConvert.INSTANCE.convert(updateReqVO);
customerMapper.updateById(updateObj); customerMapper.updateById(updateObj);