Commit 77f98c4d129307a1128af4ba6e88d8bfb52d8737
1 parent
f76a7cd9
✨ CRM:完善商机的新增、修改逻辑
Showing
7 changed files
with
84 additions
and
11 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusController.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| @@ -29,6 +30,7 @@ import java.util.Map; | @@ -29,6 +30,7 @@ import java.util.Map; | ||
| 29 | 30 | ||
| 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | 32 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 33 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 32 | 34 | ||
| 33 | @Tag(name = "管理后台 - CRM 商机状态") | 35 | @Tag(name = "管理后台 - CRM 商机状态") |
| 34 | @RestController | 36 | @RestController |
| @@ -62,7 +64,7 @@ public class CrmBusinessStatusController { | @@ -62,7 +64,7 @@ public class CrmBusinessStatusController { | ||
| 62 | @DeleteMapping("/delete") | 64 | @DeleteMapping("/delete") |
| 63 | @Operation(summary = "删除商机状态") | 65 | @Operation(summary = "删除商机状态") |
| 64 | @Parameter(name = "id", description = "编号", required = true) | 66 | @Parameter(name = "id", description = "编号", required = true) |
| 65 | - @PreAuthorize("@ss.hasPermission('crm:business-status-type:delete')") | 67 | + @PreAuthorize("@ss.hasPermission('crm:business-status:delete')") |
| 66 | public CommonResult<Boolean> deleteBusinessStatusType(@RequestParam("id") Long id) { | 68 | public CommonResult<Boolean> deleteBusinessStatusType(@RequestParam("id") Long id) { |
| 67 | businessStatusTypeService.deleteBusinessStatusType(id); | 69 | businessStatusTypeService.deleteBusinessStatusType(id); |
| 68 | return success(true); | 70 | return success(true); |
| @@ -71,7 +73,7 @@ public class CrmBusinessStatusController { | @@ -71,7 +73,7 @@ public class CrmBusinessStatusController { | ||
| 71 | @GetMapping("/get") | 73 | @GetMapping("/get") |
| 72 | @Operation(summary = "获得商机状态") | 74 | @Operation(summary = "获得商机状态") |
| 73 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 75 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 74 | - @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | 76 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") |
| 75 | public CommonResult<CrmBusinessStatusRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | 77 | public CommonResult<CrmBusinessStatusRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 76 | CrmBusinessStatusTypeDO statusType = businessStatusTypeService.getBusinessStatusType(id); | 78 | CrmBusinessStatusTypeDO statusType = businessStatusTypeService.getBusinessStatusType(id); |
| 77 | if (statusType == null) { | 79 | if (statusType == null) { |
| @@ -84,10 +86,13 @@ public class CrmBusinessStatusController { | @@ -84,10 +86,13 @@ public class CrmBusinessStatusController { | ||
| 84 | 86 | ||
| 85 | @GetMapping("/page") | 87 | @GetMapping("/page") |
| 86 | @Operation(summary = "获得商机状态分页") | 88 | @Operation(summary = "获得商机状态分页") |
| 87 | - @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | ||
| 88 | - public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusTypePage(@Valid PageParam pageReqVO) { | 89 | + @PreAuthorize("@ss.hasPermission('crm:business-status:query')") |
| 90 | + public CommonResult<PageResult<CrmBusinessStatusRespVO>> getBusinessStatusPage(@Valid PageParam pageReqVO) { | ||
| 89 | // 1. 查询数据 | 91 | // 1. 查询数据 |
| 90 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); | 92 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); |
| 93 | + if (CollUtil.isEmpty(pageResult.getList())) { | ||
| 94 | + return success(PageResult.empty(pageResult.getTotal())); | ||
| 95 | + } | ||
| 91 | // 2. 拼接数据 | 96 | // 2. 拼接数据 |
| 92 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | 97 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| 93 | convertSet(pageResult.getList(), statusType -> Long.parseLong(statusType.getCreator()))); | 98 | convertSet(pageResult.getList(), statusType -> Long.parseLong(statusType.getCreator()))); |
| @@ -101,9 +106,12 @@ public class CrmBusinessStatusController { | @@ -101,9 +106,12 @@ public class CrmBusinessStatusController { | ||
| 101 | } | 106 | } |
| 102 | 107 | ||
| 103 | @GetMapping("/type-simple-list") | 108 | @GetMapping("/type-simple-list") |
| 104 | - @Operation(summary = "获得商机状态列表") | 109 | + @Operation(summary = "获得商机状态组列表") |
| 105 | public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusTypeSimpleList() { | 110 | public CommonResult<List<CrmBusinessStatusRespVO>> getBusinessStatusTypeSimpleList() { |
| 106 | List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(); | 111 | List<CrmBusinessStatusTypeDO> list = businessStatusTypeService.getBusinessStatusTypeList(); |
| 112 | + // 过滤掉部门不匹配的 | ||
| 113 | + Long deptId = adminUserApi.getUser(getLoginUserId()).getDeptId(); | ||
| 114 | + list.removeIf(statusType -> CollUtil.isNotEmpty(statusType.getDeptIds()) && !statusType.getDeptIds().contains(deptId)); | ||
| 107 | return success(BeanUtils.toBean(list, CrmBusinessStatusRespVO.class)); | 115 | return success(BeanUtils.toBean(list, CrmBusinessStatusRespVO.class)); |
| 108 | } | 116 | } |
| 109 | 117 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.status; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.status; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | +import jakarta.validation.Valid; | ||
| 4 | import jakarta.validation.constraints.NotEmpty; | 5 | import jakarta.validation.constraints.NotEmpty; |
| 5 | import jakarta.validation.constraints.NotNull; | 6 | import jakarta.validation.constraints.NotNull; |
| 6 | import lombok.Data; | 7 | import lombok.Data; |
| @@ -24,6 +25,7 @@ public class CrmBusinessStatusSaveReqVO { | @@ -24,6 +25,7 @@ public class CrmBusinessStatusSaveReqVO { | ||
| 24 | 25 | ||
| 25 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 26 | @NotEmpty(message = "商机状态集合不能为空") | 27 | @NotEmpty(message = "商机状态集合不能为空") |
| 28 | + @Valid | ||
| 27 | private List<Status> statuses; | 29 | private List<Status> statuses; |
| 28 | 30 | ||
| 29 | @Data | 31 | @Data |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -19,11 +19,14 @@ import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | @@ -19,11 +19,14 @@ import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | ||
| 19 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; | 19 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| 20 | import cn.iocoder.yudao.module.crm.service.business.bo.CrmBusinessUpdateProductReqBO; | 20 | import cn.iocoder.yudao.module.crm.service.business.bo.CrmBusinessUpdateProductReqBO; |
| 21 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessService; | 21 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessService; |
| 22 | +import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; | ||
| 22 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | 23 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 24 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | ||
| 23 | import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | 25 | import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; |
| 24 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 26 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 25 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 27 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 26 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; | 28 | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; |
| 29 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 27 | import com.mzt.logapi.context.LogRecordContext; | 30 | import com.mzt.logapi.context.LogRecordContext; |
| 28 | import com.mzt.logapi.service.impl.DiffParseFunction; | 31 | import com.mzt.logapi.service.impl.DiffParseFunction; |
| 29 | import com.mzt.logapi.starter.annotation.LogRecord; | 32 | import com.mzt.logapi.starter.annotation.LogRecord; |
| @@ -58,15 +61,25 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -58,15 +61,25 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 58 | private CrmBusinessProductMapper businessProductMapper; | 61 | private CrmBusinessProductMapper businessProductMapper; |
| 59 | 62 | ||
| 60 | @Resource | 63 | @Resource |
| 64 | + private CrmBusinessStatusService businessStatusService; | ||
| 65 | + @Resource | ||
| 61 | @Lazy // 延迟加载,避免循环依赖 | 66 | @Lazy // 延迟加载,避免循环依赖 |
| 62 | private CrmContractService contractService; | 67 | private CrmContractService contractService; |
| 63 | @Resource | 68 | @Resource |
| 69 | + private CrmCustomerService customerService; | ||
| 70 | + @Resource | ||
| 71 | + @Lazy // 延迟加载,避免循环依赖 | ||
| 72 | + private CrmContactService contactService; | ||
| 73 | + @Resource | ||
| 64 | private CrmPermissionService permissionService; | 74 | private CrmPermissionService permissionService; |
| 65 | @Resource | 75 | @Resource |
| 66 | private CrmContactBusinessService contactBusinessService; | 76 | private CrmContactBusinessService contactBusinessService; |
| 67 | @Resource | 77 | @Resource |
| 68 | private CrmProductService productService; | 78 | private CrmProductService productService; |
| 69 | 79 | ||
| 80 | + @Resource | ||
| 81 | + private AdminUserApi adminUserApi; | ||
| 82 | + | ||
| 70 | @Override | 83 | @Override |
| 71 | @Transactional(rollbackFor = Exception.class) | 84 | @Transactional(rollbackFor = Exception.class) |
| 72 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_CREATE_SUB_TYPE, bizNo = "{{#business.id}}", | 85 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_CREATE_SUB_TYPE, bizNo = "{{#business.id}}", |
| @@ -74,10 +87,12 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -74,10 +87,12 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 74 | public Long createBusiness(CrmBusinessSaveReqVO createReqVO, Long userId) { | 87 | public Long createBusiness(CrmBusinessSaveReqVO createReqVO, Long userId) { |
| 75 | // 1.1 校验产品项的有效性 | 88 | // 1.1 校验产品项的有效性 |
| 76 | List<CrmBusinessProductDO> businessProducts = validateBusinessProducts(createReqVO.getProducts()); | 89 | List<CrmBusinessProductDO> businessProducts = validateBusinessProducts(createReqVO.getProducts()); |
| 77 | - // 1.2 TODO 芋艿:校验关联字 | 90 | + // 1.2 校验关联字段 |
| 91 | + validateBusinessForCreate(createReqVO); | ||
| 78 | 92 | ||
| 79 | // 2.1 插入商机 | 93 | // 2.1 插入商机 |
| 80 | CrmBusinessDO business = BeanUtils.toBean(createReqVO, CrmBusinessDO.class).setOwnerUserId(userId); | 94 | CrmBusinessDO business = BeanUtils.toBean(createReqVO, CrmBusinessDO.class).setOwnerUserId(userId); |
| 95 | + business.setStatusId(businessStatusService.getBusinessStatusListByTypeId(createReqVO.getStatusTypeId()).get(0).getId()); // 默认状态 | ||
| 81 | calculateTotalPrice(business, businessProducts); | 96 | calculateTotalPrice(business, businessProducts); |
| 82 | businessMapper.insert(business); | 97 | businessMapper.insert(business); |
| 83 | // 2.2 插入商机关联商品 | 98 | // 2.2 插入商机关联商品 |
| @@ -101,6 +116,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -101,6 +116,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 101 | 116 | ||
| 102 | // TODO @lzxhqs:CrmContactBusinessService 调用这个;这样逻辑才能收敛哈; | 117 | // TODO @lzxhqs:CrmContactBusinessService 调用这个;这样逻辑才能收敛哈; |
| 103 | private void createContactBusiness(Long businessId, Long contactId) { | 118 | private void createContactBusiness(Long businessId, Long contactId) { |
| 119 | + if (contactId == null) { | ||
| 120 | + return; | ||
| 121 | + } | ||
| 104 | CrmContactBusinessDO contactBusiness = new CrmContactBusinessDO(); | 122 | CrmContactBusinessDO contactBusiness = new CrmContactBusinessDO(); |
| 105 | contactBusiness.setBusinessId(businessId); | 123 | contactBusiness.setBusinessId(businessId); |
| 106 | contactBusiness.setContactId(contactId); | 124 | contactBusiness.setContactId(contactId); |
| @@ -113,11 +131,13 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -113,11 +131,13 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 113 | success = CRM_BUSINESS_UPDATE_SUCCESS) | 131 | success = CRM_BUSINESS_UPDATE_SUCCESS) |
| 114 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | 132 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 115 | public void updateBusiness(CrmBusinessSaveReqVO updateReqVO) { | 133 | public void updateBusiness(CrmBusinessSaveReqVO updateReqVO) { |
| 134 | + updateReqVO.setOwnerUserId(null).setStatusTypeId(null); // 不允许更新的字段 | ||
| 116 | // 1.1 校验存在 | 135 | // 1.1 校验存在 |
| 117 | CrmBusinessDO oldBusiness = validateBusinessExists(updateReqVO.getId()); | 136 | CrmBusinessDO oldBusiness = validateBusinessExists(updateReqVO.getId()); |
| 118 | // 1.2 校验产品项的有效性 | 137 | // 1.2 校验产品项的有效性 |
| 119 | List<CrmBusinessProductDO> businessProducts = validateBusinessProducts(updateReqVO.getProducts()); | 138 | List<CrmBusinessProductDO> businessProducts = validateBusinessProducts(updateReqVO.getProducts()); |
| 120 | - // 1.3 TODO 芋艿:校验关联字 | 139 | + // 1.3 校验关联字段 |
| 140 | + validateBusinessForCreate(updateReqVO); | ||
| 121 | 141 | ||
| 122 | // 2.1 更新商机 | 142 | // 2.1 更新商机 |
| 123 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); | 143 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); |
| @@ -148,6 +168,25 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -148,6 +168,25 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 148 | } | 168 | } |
| 149 | } | 169 | } |
| 150 | 170 | ||
| 171 | + private void validateBusinessForCreate(CrmBusinessSaveReqVO saveReqVO) { | ||
| 172 | + // 校验商机状态 | ||
| 173 | + if (saveReqVO.getStatusTypeId() != null) { | ||
| 174 | + businessStatusService.validateBusinessStatusType(saveReqVO.getStatusTypeId()); | ||
| 175 | + } | ||
| 176 | + // 校验客户 | ||
| 177 | + if (saveReqVO.getCustomerId() != null) { | ||
| 178 | + customerService.validateCustomer(saveReqVO.getCustomerId()); | ||
| 179 | + } | ||
| 180 | + // 校验联系人 | ||
| 181 | + if (saveReqVO.getContactId() != null) { | ||
| 182 | + contactService.validateContact(saveReqVO.getContactId()); | ||
| 183 | + } | ||
| 184 | + // 校验负责人 | ||
| 185 | + if (saveReqVO.getOwnerUserId() != null) { | ||
| 186 | + adminUserApi.validateUser(saveReqVO.getOwnerUserId()); | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + | ||
| 151 | private List<CrmBusinessProductDO> validateBusinessProducts(List<CrmBusinessSaveReqVO.Product> list) { | 190 | private List<CrmBusinessProductDO> validateBusinessProducts(List<CrmBusinessSaveReqVO.Product> list) { |
| 152 | // 1. 校验产品存在 | 191 | // 1. 校验产品存在 |
| 153 | productService.validProductList(convertSet(list, CrmBusinessSaveReqVO.Product::getProductId)); | 192 | productService.validProductList(convertSet(list, CrmBusinessSaveReqVO.Product::getProductId)); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusService.java
| @@ -51,6 +51,13 @@ public interface CrmBusinessStatusService { | @@ -51,6 +51,13 @@ public interface CrmBusinessStatusService { | ||
| 51 | CrmBusinessStatusTypeDO getBusinessStatusType(Long id); | 51 | CrmBusinessStatusTypeDO getBusinessStatusType(Long id); |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| 54 | + * 校验商机状态组 | ||
| 55 | + * | ||
| 56 | + * @param id 编号 | ||
| 57 | + */ | ||
| 58 | + void validateBusinessStatusType(Long id); | ||
| 59 | + | ||
| 60 | + /** | ||
| 54 | * 获得商机状态组列表 | 61 | * 获得商机状态组列表 |
| 55 | * | 62 | * |
| 56 | * @return 商机状态组列表 | 63 | * @return 商机状态组列表 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusServiceImpl.java
| @@ -68,7 +68,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | @@ -68,7 +68,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 68 | @Transactional(rollbackFor = Exception.class) | 68 | @Transactional(rollbackFor = Exception.class) |
| 69 | public void updateBusinessStatus(CrmBusinessStatusSaveReqVO updateReqVO) { | 69 | public void updateBusinessStatus(CrmBusinessStatusSaveReqVO updateReqVO) { |
| 70 | // 1.1 校验存在 | 70 | // 1.1 校验存在 |
| 71 | - validateBusinessStatusTypeNameUnique(updateReqVO.getId()); | 71 | + validateBusinessStatusTypeExists(updateReqVO.getId()); |
| 72 | // 1.2 校验名称是否存在 | 72 | // 1.2 校验名称是否存在 |
| 73 | validateBusinessStatusTypeNameUnique(updateReqVO.getName(), updateReqVO.getId()); | 73 | validateBusinessStatusTypeNameUnique(updateReqVO.getName(), updateReqVO.getId()); |
| 74 | // 1.3 设置状态的排序 | 74 | // 1.3 设置状态的排序 |
| @@ -104,7 +104,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | @@ -104,7 +104,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - private void validateBusinessStatusTypeNameUnique(Long id) { | 107 | + private void validateBusinessStatusTypeExists(Long id) { |
| 108 | if (businessStatusTypeMapper.selectById(id) == null) { | 108 | if (businessStatusTypeMapper.selectById(id) == null) { |
| 109 | throw exception(BUSINESS_STATUS_TYPE_NOT_EXISTS); | 109 | throw exception(BUSINESS_STATUS_TYPE_NOT_EXISTS); |
| 110 | } | 110 | } |
| @@ -123,7 +123,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | @@ -123,7 +123,7 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 123 | @Transactional(rollbackFor = Exception.class) | 123 | @Transactional(rollbackFor = Exception.class) |
| 124 | public void deleteBusinessStatusType(Long id) { | 124 | public void deleteBusinessStatusType(Long id) { |
| 125 | // 1.1 校验存在 | 125 | // 1.1 校验存在 |
| 126 | - validateBusinessStatusTypeNameUnique(id); | 126 | + validateBusinessStatusTypeExists(id); |
| 127 | // 1.2 已经使用,无法更新 | 127 | // 1.2 已经使用,无法更新 |
| 128 | if (businessService.getBusinessCountByStatusTypeId(id) > 0) { | 128 | if (businessService.getBusinessCountByStatusTypeId(id) > 0) { |
| 129 | throw exception(BUSINESS_STATUS_DELETE_FAIL_USED); | 129 | throw exception(BUSINESS_STATUS_DELETE_FAIL_USED); |
| @@ -141,13 +141,18 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | @@ -141,13 +141,18 @@ public class CrmBusinessStatusServiceImpl implements CrmBusinessStatusService { | ||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | @Override | 143 | @Override |
| 144 | + public void validateBusinessStatusType(Long id) { | ||
| 145 | + validateBusinessStatusTypeExists(id); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + @Override | ||
| 144 | public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList() { | 149 | public List<CrmBusinessStatusTypeDO> getBusinessStatusTypeList() { |
| 145 | return businessStatusTypeMapper.selectList(); | 150 | return businessStatusTypeMapper.selectList(); |
| 146 | } | 151 | } |
| 147 | 152 | ||
| 148 | @Override | 153 | @Override |
| 149 | public PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(PageParam pageReqVO) { | 154 | public PageResult<CrmBusinessStatusTypeDO> getBusinessStatusTypePage(PageParam pageReqVO) { |
| 150 | - return null; | 155 | + return businessStatusTypeMapper.selectPage(pageReqVO); |
| 151 | } | 156 | } |
| 152 | 157 | ||
| 153 | @Override | 158 | @Override |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| @@ -88,6 +88,13 @@ public interface CrmContactService { | @@ -88,6 +88,13 @@ public interface CrmContactService { | ||
| 88 | CrmContactDO getContact(Long id); | 88 | CrmContactDO getContact(Long id); |
| 89 | 89 | ||
| 90 | /** | 90 | /** |
| 91 | + * 校验联系人 | ||
| 92 | + * | ||
| 93 | + * @param id 编号 | ||
| 94 | + */ | ||
| 95 | + void validateContact(Long id); | ||
| 96 | + | ||
| 97 | + /** | ||
| 91 | * 获得联系人列表 | 98 | * 获得联系人列表 |
| 92 | * | 99 | * |
| 93 | * @param ids 编号 | 100 | * @param ids 编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -230,6 +230,11 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -230,6 +230,11 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | @Override | 232 | @Override |
| 233 | + public void validateContact(Long id) { | ||
| 234 | + validateContactExists(id); | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + @Override | ||
| 233 | public List<CrmContactDO> getContactListByIds(Collection<Long> ids, Long userId) { | 238 | public List<CrmContactDO> getContactListByIds(Collection<Long> ids, Long userId) { |
| 234 | if (CollUtil.isEmpty(ids)) { | 239 | if (CollUtil.isEmpty(ids)) { |
| 235 | return ListUtil.empty(); | 240 | return ListUtil.empty(); |