From 87778f7fd96082eefda83354ba93ddf2d9423f8b Mon Sep 17 00:00:00 2001 From: xiaqing Date: Sun, 19 Nov 2023 23:23:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=9A=84=E5=85=AC?= =?UTF-8?q?=E6=B5=B7=E9=A2=86=E5=8F=96=E5=92=8C=E5=88=86=E9=85=8D=EF=BC=8C?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E8=A6=81=E4=BF=AE=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/customer/CrmCustomerController.java | 31 +++++---- .../dal/mysql/customer/CrmCustomerMapper.java | 7 ++ .../service/customer/CrmCustomerService.java | 10 ++- .../customer/CrmCustomerServiceImpl.java | 64 ++++++++++--------- 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java index 8a34b599d..f95f47054 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; @@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.CollectionUtils; @@ -183,28 +185,25 @@ public class CrmCustomerController { @PutMapping("/receive") @Operation(summary = "领取公海客户") - // TODO @xiaqing:1)receiveCustomer 方法名字;2)cIds 改成 ids,要加下 @RequestParam,还有 swagger 注解;3)参数非空,使用 validator 校验;4)返回 true 即可; + @Parameter(name = "ids", description = "批量领取公海的客户id集合", required = true,example = "1,2,3") @PreAuthorize("@ss.hasPermission('crm:customer:receive')") - public CommonResult receiveByIds(List cIds){ - // 判断是否为空 - if(CollectionUtils.isEmpty(cIds)) - return error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(),GlobalErrorCodeConstants.BAD_REQUEST.getMsg()); + public CommonResult receiveCustomer(@RequestParam(value = "ids") List ids){ // 领取公海任务 - // TODO @xiaqing:userid,通过 controller 传递给 service,不要在 service 里面获取,无状态 - customerService.receive(cIds); - return success("领取成功"); + customerService.receiveCustomer(ids, SecurityFrameworkUtils.getLoginUserId()); + return success(true); } - // TODO @xiaqing:1)distributeCustomer 方法名;2)cIds 同上;3)参数校验,同上;4)ownerId 改成 ownerUserId,和别的模块统一;5)返回 true 即可; @PutMapping("/distributeByIds") @Operation(summary = "分配公海给对应负责人") - @PreAuthorize("@ss.hasPermission('crm:customer:distributeByIds')") - public CommonResult distributeByIds(Long ownerId,ListcIds){ - //判断参数不能为空 - if(ownerId==null || CollectionUtils.isEmpty(cIds)) - return error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(),GlobalErrorCodeConstants.BAD_REQUEST.getMsg()); - customerService.distributeByIds(cIds,ownerId); - return success("分配成功"); + @Parameters({ + @Parameter(name = "ownerUserId", description = "分配的负责人id", required = true,example = "12345"), + @Parameter(name = "ids", description = "批量分配的公海的客户id集合", required = true,example = "1,2,3") + }) + @PreAuthorize("@ss.hasPermission('crm:customer:distribute')") + public CommonResult distributeCustomer(@RequestParam(value = "ownerUserId") Long ownerUserId, + @RequestParam(value = "ids") Listids){ + customerService.distributeCustomer(ids,ownerUserId); + return success(true); } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java index 683df3581..0997ea69f 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; @@ -27,4 +28,10 @@ public interface CrmCustomerMapper extends BaseMapperX { .eqIfPresent(CrmCustomerDO::getSource, pageReqVO.getSource())); } + default void updateCustomerOwnerUser(Long id,CrmCustomerDO customerDO){ + update(customerDO,new LambdaUpdateWrapper () + .eq(CrmCustomerDO::getId,id) + .isNull(CrmCustomerDO::getOwnerUserId) + ); + } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java index 6aa21477e..b5f29293c 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java @@ -85,22 +85,20 @@ public interface CrmCustomerService { */ void lockCustomer(@Valid CrmCustomerUpdateReqVO updateReqVO); - // TODO @xiaqing:根据 controller 的建议,改下 /** * 领取公海客户 * * @param ids 要领取的客户 id */ - void receive(Listids); + void receiveCustomer(Listids, Long ownerUserId); - // TODO @xiaqing:根据 controller 的建议,改下 /** * 分配公海客户 * - * @param cIds 要分配的客户 id - * @param ownerId 分配的负责人id + * @param ids 要分配的客户 id + * @param ownerUserId 分配的负责人id * @author xiaqing */ - void distributeByIds(ListcIds,Long ownerId); + void distributeCustomer(Listids,Long ownerUserId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index ebb499128..5560789f7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -83,6 +83,11 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { throw exception(CUSTOMER_NOT_EXISTS); } } + private void validateCustomerExists(CrmCustomerDO customerDO){ + if (customerDO == null) { + throw exception(CUSTOMER_NOT_EXISTS); + } + } @Override @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.READ) @@ -162,53 +167,52 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @Override @Transactional(rollbackFor = Exception.class) - public void receive(List ids) { - transferCustomerOwner(ids,SecurityFrameworkUtils.getLoginUserId()); + public void receiveCustomer(List ids,Long ownerUserId) { + transferCustomerOwner(ids,ownerUserId); } @Override - public void distributeByIds(List cIds, Long ownerId) { - transferCustomerOwner(cIds,ownerId); + public void distributeCustomer(List ids, Long ownerUserId) { + transferCustomerOwner(ids,ownerUserId); } - private void transferCustomerOwner(List cIds, Long ownerId){ - // 先一次性校验完成客户是否可用 - // TODO @xiaqing:批量一次性加载客户列表,然后去逐个校验; - for (Long cId : cIds) { - //校验是否存在 - validateCustomerExists(cId); - //todo 校验是否已有负责人 - validCustomerOwnerExist(cId); - //todo 校验是否锁定 - validCustomerIsLocked(cId); - //todo 校验成交状态 - validCustomerDeal(cId); - } - // TODO @xiaqing:每个客户更新的时候,where 条件,加上 owner_user_id is null,防止并发问题; - List updateDos = new ArrayList <>(); - for (Long cId : cIds){ - CrmCustomerDO customerDO = new CrmCustomerDO(); - customerDO.setId(cId); - customerDO.setOwnerUserId(SecurityFrameworkUtils.getLoginUserId()); + private void transferCustomerOwner(List ids, Long ownerUserId) { + // 先一次性加载所有数据,校验客户是否可用 + List customerDOList = customerMapper.selectBatchIds(ids); + for (CrmCustomerDO customerDO : customerDOList) { + // 校验客户是否存在 + validateCustomerExists(customerDO); + // 校验是否已有负责人 + validCustomerOwnerExist(customerDO); + // 校验是否锁定 + validCustomerIsLocked(customerDO); + // 校验成交状态 + validCustomerDeal(customerDO); } + // 统一修改状态 - customerMapper.updateBatch(updateDos); + CrmCustomerDO updateDo = new CrmCustomerDO(); + updateDo.setOwnerUserId(ownerUserId); + for (Long id : ids) { + customerMapper.updateCustomerOwnerUser(id,updateDo); + } + } - private void validCustomerOwnerExist(Long id) { - if (customerMapper.selectById(id).getOwnerUserId()!=null) { + private void validCustomerOwnerExist(CrmCustomerDO customerDO) { + if (customerDO.getOwnerUserId()!=null) { throw exception(CUSTOMER_OWNER_EXISTS); } } - private void validCustomerIsLocked(Long id) { - if (customerMapper.selectById(id).getLockStatus() ==true) { + private void validCustomerIsLocked(CrmCustomerDO customerDO) { + if (customerDO.getLockStatus() ==true) { throw exception(CUSTOMER_LOCKED); } } - private void validCustomerDeal(Long id) { - if (customerMapper.selectById(id).getDealStatus() ==true) { + private void validCustomerDeal(CrmCustomerDO customerDO) { + if (customerDO.getDealStatus() ==true) { throw exception(CUSTOMER_ALREADY_DEAL); } } From 1842549634911731bfa84d4d02b2dc6055a947cc Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 24 Nov 2023 23:11:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?crm=EF=BC=9Acode=20review=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=9A=84=E5=85=AC=E6=B5=B7=E9=A2=86=E5=8F=96=E5=92=8C?= =?UTF-8?q?=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/customer/CrmCustomerController.java | 19 +++----- .../dal/mysql/customer/CrmCustomerMapper.java | 10 ++-- .../service/customer/CrmCustomerService.java | 8 ++-- .../customer/CrmCustomerServiceImpl.java | 47 ++++++++++--------- 4 files changed, 40 insertions(+), 44 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java index f95f47054..e09999ef2 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java @@ -1,12 +1,10 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; @@ -24,7 +22,6 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -37,7 +34,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; @@ -185,24 +181,23 @@ public class CrmCustomerController { @PutMapping("/receive") @Operation(summary = "领取公海客户") - @Parameter(name = "ids", description = "批量领取公海的客户id集合", required = true,example = "1,2,3") + @Parameter(name = "ids", description = "编号数组", required = true,example = "1,2,3") @PreAuthorize("@ss.hasPermission('crm:customer:receive')") public CommonResult receiveCustomer(@RequestParam(value = "ids") List ids){ - // 领取公海任务 - customerService.receiveCustomer(ids, SecurityFrameworkUtils.getLoginUserId()); + customerService.receiveCustomer(ids, getLoginUserId()); return success(true); } - @PutMapping("/distributeByIds") + @PutMapping("/distribute") @Operation(summary = "分配公海给对应负责人") @Parameters({ - @Parameter(name = "ownerUserId", description = "分配的负责人id", required = true,example = "12345"), - @Parameter(name = "ids", description = "批量分配的公海的客户id集合", required = true,example = "1,2,3") + @Parameter(name = "ownerUserId", description = "分配的负责人编号", required = true, example = "12345"), + @Parameter(name = "ids", description = "客户编号数组", required = true, example = "1,2,3") }) @PreAuthorize("@ss.hasPermission('crm:customer:distribute')") public CommonResult distributeCustomer(@RequestParam(value = "ownerUserId") Long ownerUserId, - @RequestParam(value = "ids") Listids){ - customerService.distributeCustomer(ids,ownerUserId); + @RequestParam(value = "ids") List ids){ + customerService.distributeCustomer(ids, ownerUserId); return success(true); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java index 0997ea69f..80e3c47aa 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java @@ -28,10 +28,10 @@ public interface CrmCustomerMapper extends BaseMapperX { .eqIfPresent(CrmCustomerDO::getSource, pageReqVO.getSource())); } - default void updateCustomerOwnerUser(Long id,CrmCustomerDO customerDO){ - update(customerDO,new LambdaUpdateWrapper () - .eq(CrmCustomerDO::getId,id) - .isNull(CrmCustomerDO::getOwnerUserId) - ); + default void updateCustomerByOwnerUserIdIsNull(Long id, CrmCustomerDO updateObj) { + update(updateObj, new LambdaUpdateWrapper() + .eq(CrmCustomerDO::getId, id) + .isNull(CrmCustomerDO::getOwnerUserId)); } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java index b5f29293c..fee106b8a 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java @@ -88,17 +88,17 @@ public interface CrmCustomerService { /** * 领取公海客户 * - * @param ids 要领取的客户 id + * @param ids 要领取的客户编号数组 */ void receiveCustomer(Listids, Long ownerUserId); /** * 分配公海客户 * - * @param ids 要分配的客户 id - * @param ownerUserId 分配的负责人id + * @param ids 要分配的客户编号数组 + * @param ownerUserId 分配的负责人编号 * @author xiaqing */ - void distributeCustomer(Listids,Long ownerUserId); + void distributeCustomer(Listids, Long ownerUserId); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java index 5560789f7..e161ee409 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java @@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; @@ -83,11 +82,6 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { throw exception(CUSTOMER_NOT_EXISTS); } } - private void validateCustomerExists(CrmCustomerDO customerDO){ - if (customerDO == null) { - throw exception(CUSTOMER_NOT_EXISTS); - } - } @Override @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.READ) @@ -168,51 +162,58 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { @Override @Transactional(rollbackFor = Exception.class) public void receiveCustomer(List ids,Long ownerUserId) { - transferCustomerOwner(ids,ownerUserId); + transferCustomerOwner(ids, ownerUserId); } @Override + @Transactional(rollbackFor = Exception.class) public void distributeCustomer(List ids, Long ownerUserId) { - transferCustomerOwner(ids,ownerUserId); + transferCustomerOwner(ids, ownerUserId); } + /** + * 转移客户负责人 + * + * @param ids 客户编号数组 + * @param ownerUserId 负责人编号 + */ private void transferCustomerOwner(List ids, Long ownerUserId) { // 先一次性加载所有数据,校验客户是否可用 - List customerDOList = customerMapper.selectBatchIds(ids); - for (CrmCustomerDO customerDO : customerDOList) { - // 校验客户是否存在 - validateCustomerExists(customerDO); + List customers = customerMapper.selectBatchIds(ids); + for (CrmCustomerDO customer : customers) { // 校验是否已有负责人 - validCustomerOwnerExist(customerDO); + validateCustomerOwnerExists(customer); // 校验是否锁定 - validCustomerIsLocked(customerDO); + validateCustomerIsLocked(customer); // 校验成交状态 - validCustomerDeal(customerDO); + validateCustomerDeal(customer); } + // TODO @QingX:这里是不是改成一次性更新;不然,如果有 20 个客户,就要执行 20 次 SQL 了; // 统一修改状态 CrmCustomerDO updateDo = new CrmCustomerDO(); updateDo.setOwnerUserId(ownerUserId); + // TODO @QingX:如果更新的数量不对,则应该抛出异常,回滚,并错误提示; for (Long id : ids) { - customerMapper.updateCustomerOwnerUser(id,updateDo); + customerMapper.updateCustomerByOwnerUserIdIsNull(id,updateDo); } - } - private void validCustomerOwnerExist(CrmCustomerDO customerDO) { - if (customerDO.getOwnerUserId()!=null) { + // TODO @QingX:错误提示里面,可以把客户的名字带上哈;不然不知道是谁; + private void validateCustomerOwnerExists(CrmCustomerDO customer) { + if (customer.getOwnerUserId() != null) { throw exception(CUSTOMER_OWNER_EXISTS); } } - private void validCustomerIsLocked(CrmCustomerDO customerDO) { - if (customerDO.getLockStatus() ==true) { + private void validateCustomerIsLocked(CrmCustomerDO customer) { + if (customer.getLockStatus()) { throw exception(CUSTOMER_LOCKED); } } - private void validCustomerDeal(CrmCustomerDO customerDO) { - if (customerDO.getDealStatus() ==true) { + private void validateCustomerDeal(CrmCustomerDO customer) { + if (customer.getDealStatus()) { throw exception(CUSTOMER_ALREADY_DEAL); } }