CRM:跟进记录 code review

This commit is contained in:
YunaiV 2024-01-18 12:17:12 +08:00
parent ca55282516
commit 6624a93a84
10 changed files with 19 additions and 12 deletions

View File

@ -38,7 +38,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
public class CrmFollowUpRecordController {
@Resource
private CrmFollowUpRecordService crmFollowUpRecordService;
private CrmFollowUpRecordService followUpRecordService;
@Resource
private CrmContactService contactService;
@Resource
@ -48,7 +48,7 @@ public class CrmFollowUpRecordController {
@Operation(summary = "创建跟进记录")
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:create')")
public CommonResult<Long> createFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO createReqVO) {
return success(crmFollowUpRecordService.createFollowUpRecord(createReqVO));
return success(followUpRecordService.createFollowUpRecord(createReqVO));
}
@DeleteMapping("/delete")
@ -56,7 +56,7 @@ public class CrmFollowUpRecordController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:delete')")
public CommonResult<Boolean> deleteFollowUpRecord(@RequestParam("id") Long id) {
crmFollowUpRecordService.deleteFollowUpRecord(id, getLoginUserId());
followUpRecordService.deleteFollowUpRecord(id, getLoginUserId());
return success(true);
}
@ -65,7 +65,7 @@ public class CrmFollowUpRecordController {
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')")
public CommonResult<CrmFollowUpRecordRespVO> getFollowUpRecord(@RequestParam("id") Long id) {
CrmFollowUpRecordDO followUpRecord = crmFollowUpRecordService.getFollowUpRecord(id);
CrmFollowUpRecordDO followUpRecord = followUpRecordService.getFollowUpRecord(id);
return success(BeanUtils.toBean(followUpRecord, CrmFollowUpRecordRespVO.class));
}
@ -73,7 +73,7 @@ public class CrmFollowUpRecordController {
@Operation(summary = "获得跟进记录分页")
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')")
public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) {
PageResult<CrmFollowUpRecordDO> pageResult = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO);
PageResult<CrmFollowUpRecordDO> pageResult = followUpRecordService.getFollowUpRecordPage(pageReqVO);
/// 拼接数据
Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactList(
convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream())), CrmContactDO::getId);

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO @puhui999是不是搞个通用的 ReqBO 就好了
/**
* 商机跟进信息 Update Req BO
*

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO @puhui999是不是搞个通用的 ReqBO 就好了
/**
* 线索跟进信息 Update Req BO
*

View File

@ -65,7 +65,6 @@ public interface CrmContactService {
*/
void updateContactFollowUpBatch(List<CrmContactUpdateFollowUpReqBO> updateFollowUpReqBOList);
/**
* 获得联系人
*

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO @puhui999是不是搞个通用的 ReqBO 就好了
/**
* 联系人跟进信息 Update Req BO
*

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO @puhui999是不是搞个通用的 ReqBO 就好了
/**
* 合同跟进信息 Update Req BO
*

View File

@ -227,15 +227,16 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
// 1.3. 校验客户是否锁定
validateCustomerIsLocked(customer, true);
// 2. 设置负责人为 NULL
// 2.1 设置负责人为 NULL
int updateOwnerUserIncr = customerMapper.updateOwnerUserIdById(customer.getId(), null);
if (updateOwnerUserIncr == 0) {
throw exception(CUSTOMER_UPDATE_OWNER_USER_FAIL);
}
// 3. 删除负责人数据权限
// 2.2 删除负责人数据权限
permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), customer.getId(),
CrmPermissionLevelEnum.OWNER.getLevel());
// 联系人的负责人也要设置为 null这块和领取是对应的因为领取后负责人也要关联过来
// 3. 联系人的负责人也要设置为 null因为因为领取后负责人也要关联过来这块和 receiveCustomer 是对应的
contactService.updateOwnerUserIdByCustomerId(customer.getId(), null);
// 记录操作日志上下文

View File

@ -6,6 +6,7 @@ import lombok.Data;
import java.time.LocalDateTime;
// TODO @puhui999是不是搞个通用的 ReqBO 就好了
/**
* 跟进信息 Update Req BO
*

View File

@ -59,10 +59,11 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
crmFollowUpRecordMapper.insert(followUpRecord);
LocalDateTime now = LocalDateTime.now();
// 更新 bizId 对应的记录
// 2. 更新 bizId 对应的记录
followUpHandlers.forEach(handler -> handler.execute(followUpRecord, now));
// 更新 contactIds 对应的记录
// 3.1 更新 contactIds 对应的记录
if (CollUtil.isNotEmpty(createReqVO.getContactIds())) {
// TODO @puhui999可以用链式设置哈
contactService.updateContactFollowUpBatch(convertList(createReqVO.getContactIds(), contactId -> {
CrmContactUpdateFollowUpReqBO crmContactUpdateFollowUpReqBO = new CrmContactUpdateFollowUpReqBO();
crmContactUpdateFollowUpReqBO.setId(contactId).setContactNextTime(followUpRecord.getNextTime())
@ -70,7 +71,7 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
return crmContactUpdateFollowUpReqBO;
}));
}
// 需要更新 businessIdscontactIds 对应的记录
// 3.2 需要更新 businessIdscontactIds 对应的记录
if (CollUtil.isNotEmpty(createReqVO.getBusinessIds())) {
businessService.updateContactFollowUpBatch(convertList(createReqVO.getBusinessIds(), businessId -> {
CrmBusinessUpdateFollowUpReqBO crmBusinessUpdateFollowUpReqBO = new CrmBusinessUpdateFollowUpReqBO();

View File

@ -11,6 +11,7 @@ import java.time.LocalDateTime;
*/
public interface CrmFollowUpHandler {
// TODO @puhui999需要考虑下次联系时间为空
/**
* 执行更新
*