CRM:完善合同的跟进记录实现

This commit is contained in:
YunaiV 2024-02-23 09:31:41 +08:00
parent b0def8b586
commit d604e76d16
6 changed files with 21 additions and 49 deletions

View File

@ -95,7 +95,6 @@ public interface LogRecordConstants {
String CRM_BUSINESS_FOLLOW_UP_SUCCESS = "商机跟进【{{#businessName}}】";
String CRM_BUSINESS_UPDATE_STATUS_SUB_TYPE = "更新商机状态";
String CRM_BUSINESS_UPDATE_STATUS_SUCCESS = "更新了商机【{{#businessName}}】的状态从【{{#oldStatusName}}】变更为了【{{#newStatusName}}】";
// String CRM_BUSINESS_UPDATE_STATUS_SUCCESS = "阿巴阿巴";
// ======================= CRM_CONTRACT 合同 =======================
@ -110,6 +109,8 @@ public interface LogRecordConstants {
String CRM_CONTRACT_TRANSFER_SUCCESS = "将合同【{{#contract.name}}】的负责人从【{getAdminUserById{#contract.ownerUserId}}】变更为了【{getAdminUserById{#reqVO.newOwnerUserId}}】";
String CRM_CONTRACT_SUBMIT_SUB_TYPE = "提交合同审批";
String CRM_CONTRACT_SUBMIT_SUCCESS = "提交合同【{{#contractName}}】审批成功";
String CRM_CONTRACT_FOLLOW_UP_SUB_TYPE = "合同跟进";
String CRM_CONTRACT_FOLLOW_UP_SUCCESS = "合同跟进【{{#contractName}}】";
// ======================= CRM_PRODUCT 产品 =======================

View File

@ -19,7 +19,6 @@ import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.crm.service.customer.bo.CrmCustomerCreateReqBO;
import cn.iocoder.yudao.module.crm.service.followup.CrmFollowUpRecordService;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmFollowUpCreateReqBO;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO;
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO;
@ -133,7 +132,6 @@ public class CrmClueServiceImpl implements CrmClueService {
.setContactLastTime(LocalDateTime.now()).setContactLastContent(contactLastContent));
// 3. 记录操作日志上下文
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldClue, CrmUpdateFollowUpReqBO.class));
LogRecordContext.putVariable("clueName", oldClue.getName());
}

View File

@ -8,9 +8,9 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTrans
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
import jakarta.validation.Valid;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@ -55,9 +55,11 @@ public interface CrmContractService {
/**
* 更新合同相关的更进信息
*
* @param contractUpdateFollowUpReqBO 信息
* @param id 合同编号
* @param contactNextTime 下次联系时间
* @param contactLastContent 最后联系内容
*/
void updateContractFollowUp(CrmUpdateFollowUpReqBO contractUpdateFollowUpReqBO);
void updateContractFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent);
/**
* 发起合同审批流程

View File

@ -26,7 +26,6 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPerm
import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService;
import cn.iocoder.yudao.module.crm.service.contact.CrmContactService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO;
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO;
@ -41,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@ -253,8 +253,18 @@ public class CrmContractServiceImpl implements CrmContractService {
}
@Override
public void updateContractFollowUp(CrmUpdateFollowUpReqBO contractUpdateFollowUpReqBO) {
contractMapper.updateById(BeanUtils.toBean(contractUpdateFollowUpReqBO, CrmContractDO.class).setId(contractUpdateFollowUpReqBO.getBizId()));
@LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_FOLLOW_UP_SUB_TYPE, bizNo = "{{#id}",
success = CRM_CONTRACT_FOLLOW_UP_SUCCESS)
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#id", level = CrmPermissionLevelEnum.WRITE)
public void updateContractFollowUp(Long id, LocalDateTime contactNextTime, String contactLastContent) {
// 1. 校验存在
CrmContractDO contract = validateContractExists(id);
// 2. 更新联系人的跟进信息
contractMapper.updateById(new CrmContractDO().setId(id).setContactLastTime(LocalDateTime.now()));
// 3. 记录操作日志上下文
LogRecordContext.putVariable("contractName", contract.getName());
}
@Override

View File

@ -17,14 +17,12 @@ import cn.iocoder.yudao.module.crm.service.contact.CrmContactService;
import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmFollowUpCreateReqBO;
import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO;
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@ -71,9 +69,6 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
crmFollowUpRecordMapper.insert(record);
// 2. 更新 bizId 对应的记录
CrmUpdateFollowUpReqBO updateFollowUpReqBO = new CrmUpdateFollowUpReqBO().setBizId(record.getBizId())
.setContactLastTime(LocalDateTime.now())
.setContactNextTime(record.getNextTime()).setContactLastContent(record.getContent());
if (ObjUtil.equal(CrmBizTypeEnum.CRM_BUSINESS.getType(), record.getBizType())) { // 更新商机跟进信息
businessService.updateBusinessFollowUp(record.getBizId(), record.getNextTime(), record.getContent());
}
@ -84,7 +79,7 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
contactService.updateContactFollowUp(record.getBizId(), record.getNextTime(), record.getContent());
}
if (ObjUtil.equal(CrmBizTypeEnum.CRM_CONTRACT.getType(), record.getBizType())) { // 更新合同跟进信息
contractService.updateContractFollowUp(updateFollowUpReqBO);
contractService.updateContractFollowUp(record.getBizId(), record.getNextTime(), record.getContent());
}
if (ObjUtil.equal(CrmBizTypeEnum.CRM_CUSTOMER.getType(), record.getBizType())) { // 更新客户跟进信息
customerService.updateCustomerFollowUp(record.getBizId(), record.getNextTime(), record.getContent());

View File

@ -1,34 +0,0 @@
package cn.iocoder.yudao.module.crm.service.followup.bo;
import com.mzt.logapi.starter.annotation.DiffLogField;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 跟进信息 Update Req BO
*
* @author HUIHUI
*/
@Data
public class CrmUpdateFollowUpReqBO {
@Schema(description = "数据编号", example = "3167")
@NotNull(message = "数据编号不能为空")
private Long bizId;
@Schema(description = "最后跟进时间")
@DiffLogField(name = "最后跟进时间")
private LocalDateTime contactLastTime;
@Schema(description = "下次联系时间")
@DiffLogField(name = "下次联系时间")
private LocalDateTime contactNextTime;
@Schema(description = "最后更进内容")
@DiffLogField(name = "最后更进内容")
private String contactLastContent;
}