Commit 1da8006af35f2ab6a7aeb3636260df21e650b7f5
1 parent
9e3055ee
📖 CRM:【客户】完善列表、新增、修改接口的 todo
Showing
2 changed files
with
10 additions
and
3 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| ... | ... | @@ -58,6 +58,7 @@ public class CrmCustomerController { |
| 58 | 58 | @Resource |
| 59 | 59 | private OperateLogApi operateLogApi; |
| 60 | 60 | |
| 61 | + // TODO @puhui999:把 CrmCustomerCreateReqVO、CrmCustomerUpdateReqVO、CrmCustomerRespVO 按照新的规范,搞一下哈; | |
| 61 | 62 | @PostMapping("/create") |
| 62 | 63 | @Operation(summary = "创建客户") |
| 63 | 64 | @OperateLog(enable = false) // TODO 关闭原有日志记录;@puhui999:注解都先删除。先记录,没关系。我们下个迭代,就都删除掉操作日志了; |
| ... | ... | @@ -114,6 +115,7 @@ public class CrmCustomerController { |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | // 2. 拼接数据 |
| 118 | + // TODO @puhui999:距离进入公海的时间 | |
| 117 | 119 | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| 118 | 120 | convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId()))); |
| 119 | 121 | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| ... | ... | @@ -24,6 +24,7 @@ import org.springframework.stereotype.Service; |
| 24 | 24 | import org.springframework.transaction.annotation.Transactional; |
| 25 | 25 | import org.springframework.validation.annotation.Validated; |
| 26 | 26 | |
| 27 | +import java.time.LocalDateTime; | |
| 27 | 28 | import java.util.*; |
| 28 | 29 | |
| 29 | 30 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| ... | ... | @@ -52,10 +53,13 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { |
| 52 | 53 | |
| 53 | 54 | @Override |
| 54 | 55 | @Transactional(rollbackFor = Exception.class) |
| 55 | - @LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户") | |
| 56 | + @LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户") // TODO @puhui999:客户名字,要记录进去;不然在展示操作日志的全列表,看不清楚是哪个客户哈; | |
| 56 | 57 | public Long createCustomer(CrmCustomerCreateReqVO createReqVO, Long userId) { |
| 57 | - // 插入 | |
| 58 | - CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO); | |
| 58 | + // 插入客户 | |
| 59 | + CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO) | |
| 60 | + .setLockStatus(false).setDealStatus(false) | |
| 61 | + .setContactLastTime(LocalDateTime.now()); | |
| 62 | + // TODO @puhui999:可能要加个 receiveTime 字段,记录最后接收时间 | |
| 59 | 63 | customerMapper.insert(customer); |
| 60 | 64 | |
| 61 | 65 | // 创建数据权限 |
| ... | ... | @@ -72,6 +76,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { |
| 72 | 76 | @LogRecord(type = CRM_CUSTOMER, subType = "更新客户", bizNo = "{{#updateReqVO.id}}", success = "更新了客户{_DIFF{#updateReqVO}}", extra = "{{#extra}}") |
| 73 | 77 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 74 | 78 | public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) { |
| 79 | + // TODO @puhui999:更新的时候,要把 updateReqVO 负责人设置为空,避免修改。 | |
| 75 | 80 | // 校验存在 |
| 76 | 81 | CrmCustomerDO oldCustomer = validateCustomerExists(updateReqVO.getId()); |
| 77 | 82 | ... | ... |