diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java index e7bc01e18..5a5a423cd 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java @@ -50,6 +50,7 @@ public class CrmBusinessController { @Resource private CrmBusinessStatusService businessStatusService; + // TODO @商机待定:CrmBusinessCreateReqVO、CrmBusinessUpdateReqVO、CrmBusinessRespVO 按照新的 VO 规范 @PostMapping("/create") @Operation(summary = "创建商机") @PreAuthorize("@ss.hasPermission('crm:business:create')") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/package-info.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/package-info.java deleted file mode 100644 index df6e44536..000000000 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * 商机(销售机会) - */ -package cn.iocoder.yudao.module.crm.dal.dataobject.business; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java index d2d45ba99..58c2bccfe 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java @@ -15,7 +15,6 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessService; -import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; import jakarta.annotation.Resource; @@ -45,22 +44,22 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { @Resource private CrmPermissionService permissionService; @Resource - private CrmContactService contactService; - @Resource private CrmContactBusinessService contactBusinessService; @Override @Transactional(rollbackFor = Exception.class) + // TODO @商机待定:操作日志; public Long createBusiness(CrmBusinessCreateReqVO createReqVO, Long userId) { - // 插入 + // 1. 插入商机 CrmBusinessDO business = CrmBusinessConvert.INSTANCE.convert(createReqVO); businessMapper.insert(business); + // TODO 商机待定:插入商机与产品的关联表;校验商品存在 - // 创建数据权限 + // TODO 商机待定:在联系人的详情页,如果直接【新建商机】,则需要关联下。这里要搞个 CrmContactBusinessDO 表 + + // 2. 创建数据权限 permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_BUSINESS.getType()) .setBizId(business.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 - - // 返回 return business.getId(); } @@ -68,12 +67,17 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { @Transactional(rollbackFor = Exception.class) @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) + // TODO @商机待定:操作日志; public void updateBusiness(CrmBusinessUpdateReqVO updateReqVO) { - // 校验存在 + // 1. 校验存在 validateBusinessExists(updateReqVO.getId()); - // 更新 + + // 2. 更新商机 CrmBusinessDO updateObj = CrmBusinessConvert.INSTANCE.convert(updateReqVO); businessMapper.updateById(updateObj); + // TODO 商机待定:插入商机与产品的关联表;校验商品存在 + + // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表 } @Override @@ -82,6 +86,8 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { public void deleteBusiness(Long id) { // 校验存在 validateBusinessExists(id); + // TODO @商机待定:需要校验有没关联合同。CrmContractDO 的 businessId 字段 + // 删除 businessMapper.deleteById(id); // 删除数据权限 @@ -137,6 +143,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { @Override @Transactional(rollbackFor = Exception.class) + // TODO @puhui999:操作日志 public void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId) { // 1 校验商机是否存在 validateBusinessExists(reqVO.getId()); @@ -146,8 +153,6 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { CrmBusinessConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_BUSINESS.getType())); // 2.2 设置新的负责人 businessMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); - - // 3. TODO 记录转移日志 } } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java index 388f6133b..23fab65e4 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductCategoryServiceImpl.java @@ -40,7 +40,7 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService validateParentProductCategory(createReqVO.getParentId()); // 1.2 分类名称是否存在 validateProductNameExists(null, createReqVO.getParentId(), createReqVO.getName()); - // 2. 插入 + // 2. 插入分类 CrmProductCategoryDO category = BeanUtils.toBean(createReqVO, CrmProductCategoryDO.class); productCategoryMapper.insert(category); return category.getId(); @@ -54,7 +54,7 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService validateParentProductCategory(updateReqVO.getParentId()); // 1.3 分类名称是否存在 validateProductNameExists(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); - // 2. 更新 + // 2. 更新分类 CrmProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, CrmProductCategoryDO.class); productCategoryMapper.updateById(updateObj); } @@ -92,18 +92,17 @@ public class CrmProductCategoryServiceImpl implements CrmProductCategoryService @Override public void deleteProductCategory(Long id) { - // TODO zange:参考 mall: ProductCategoryServiceImpl 补充下必要的参数校验; - // 校验存在 + // 1.1 校验存在 validateProductCategoryExists(id); - // 校验是否还有子分类 + // 1.2 校验是否还有子分类 if (productCategoryMapper.selectCountByParentId(id) > 0) { throw exception(product_CATEGORY_EXISTS_CHILDREN); } - // 校验是否被产品使用 + // 1.3 校验是否被产品使用 if (crmProductService.getProductByCategoryId(id) !=null) { throw exception(PRODUCT_CATEGORY_USED); } - // 删除 + // 2. 删除 productCategoryMapper.deleteById(id); }