📖 CRM:【客户】完善列表、新增、修改接口的 todo

This commit is contained in:
YunaiV 2024-01-02 21:45:02 +08:00
parent 9e3055ee1e
commit 1da8006af3
2 changed files with 10 additions and 3 deletions

View File

@ -58,6 +58,7 @@ public class CrmCustomerController {
@Resource
private OperateLogApi operateLogApi;
// TODO @puhui999 CrmCustomerCreateReqVOCrmCustomerUpdateReqVOCrmCustomerRespVO 按照新的规范搞一下哈
@PostMapping("/create")
@Operation(summary = "创建客户")
@OperateLog(enable = false) // TODO 关闭原有日志记录@puhui999注解都先删除先记录没关系我们下个迭代就都删除掉操作日志了
@ -114,6 +115,7 @@ public class CrmCustomerController {
}
// 2. 拼接数据
// TODO @puhui999距离进入公海的时间
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
convertSetByFlatMap(pageResult.getList(), user -> Stream.of(Long.parseLong(user.getCreator()), user.getOwnerUserId())));
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));

View File

@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -52,10 +53,13 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
@Override
@Transactional(rollbackFor = Exception.class)
@LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户")
@LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户") // TODO @puhui999客户名字要记录进去不然在展示操作日志的全列表看不清楚是哪个客户哈
public Long createCustomer(CrmCustomerCreateReqVO createReqVO, Long userId) {
// 插入
CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO);
// 插入客户
CrmCustomerDO customer = CrmCustomerConvert.INSTANCE.convert(createReqVO)
.setLockStatus(false).setDealStatus(false)
.setContactLastTime(LocalDateTime.now());
// TODO @puhui999可能要加个 receiveTime 字段记录最后接收时间
customerMapper.insert(customer);
// 创建数据权限
@ -72,6 +76,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
@LogRecord(type = CRM_CUSTOMER, subType = "更新客户", bizNo = "{{#updateReqVO.id}}", success = "更新了客户{_DIFF{#updateReqVO}}", extra = "{{#extra}}")
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) {
// TODO @puhui999更新的时候要把 updateReqVO 负责人设置为空避免修改
// 校验存在
CrmCustomerDO oldCustomer = validateCustomerExists(updateReqVO.getId());