mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-02-17 09:40:34 +08:00
CRM: 新增跟进记录
This commit is contained in:
parent
ba103d6e86
commit
19fa65b0c3
@ -79,4 +79,7 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 客户公海规则设置 1_020_012_000 ==========
|
// ========== 客户公海规则设置 1_020_012_000 ==========
|
||||||
ErrorCode CUSTOMER_LIMIT_CONFIG_NOT_EXISTS = new ErrorCode(1_020_012_000, "客户限制配置不存在");
|
ErrorCode CUSTOMER_LIMIT_CONFIG_NOT_EXISTS = new ErrorCode(1_020_012_000, "客户限制配置不存在");
|
||||||
|
|
||||||
|
// ========== 跟进记录 1_020_013_000 ==========
|
||||||
|
ErrorCode FOLLOW_UP_RECORD_NOT_EXISTS = new ErrorCode(1_020_013_000, "跟进记录不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.followup;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordRespVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.followup.CrmFollowUpRecordService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 跟进记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/crm/follow-up-record")
|
||||||
|
@Validated
|
||||||
|
public class CrmFollowUpRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmFollowUpRecordService crmFollowUpRecordService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建跟进记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:create')")
|
||||||
|
public CommonResult<Long> createFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO createReqVO) {
|
||||||
|
return success(crmFollowUpRecordService.createFollowUpRecord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新跟进记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:update')")
|
||||||
|
public CommonResult<Boolean> updateFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO updateReqVO) {
|
||||||
|
crmFollowUpRecordService.updateFollowUpRecord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除跟进记录")
|
||||||
|
@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);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得跟进记录")
|
||||||
|
@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);
|
||||||
|
return success(BeanUtils.toBean(followUpRecord, CrmFollowUpRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得跟进记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')")
|
||||||
|
public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) {
|
||||||
|
PageResult<CrmFollowUpRecordDO> pageResult = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, CrmFollowUpRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出跟进记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:follow-up-record:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportFollowUpRecordExcel(@Valid CrmFollowUpRecordPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<CrmFollowUpRecordDO> list = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "跟进记录.xls", "数据", CrmFollowUpRecordRespVO.class,
|
||||||
|
BeanUtils.toBean(list, CrmFollowUpRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.followup.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 跟进记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class CrmFollowUpRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", example = "2")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "数据编号", example = "5564")
|
||||||
|
private Long bizId;
|
||||||
|
|
||||||
|
@Schema(description = "跟进类型", example = "2")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "下次联系时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] nextTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.followup.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 跟进记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class CrmFollowUpRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28800")
|
||||||
|
@ExcelProperty("编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("数据类型")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5564")
|
||||||
|
@ExcelProperty("数据编号")
|
||||||
|
private Long bizId;
|
||||||
|
|
||||||
|
@Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty(value = "跟进类型", converter = DictConvert.class)
|
||||||
|
@DictFormat("crm_follow_up_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "跟进内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("跟进内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "下次联系时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("下次联系时间")
|
||||||
|
private LocalDateTime nextTime;
|
||||||
|
|
||||||
|
@Schema(description = "关联的商机编号数组")
|
||||||
|
@ExcelProperty("关联的商机编号数组")
|
||||||
|
private String businessIds;
|
||||||
|
|
||||||
|
@Schema(description = "关联的联系人编号数组")
|
||||||
|
@ExcelProperty("关联的联系人编号数组")
|
||||||
|
private String contactIds;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.followup.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 跟进记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class CrmFollowUpRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28800")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "数据类型不能为空")
|
||||||
|
private Integer bizType;
|
||||||
|
|
||||||
|
@Schema(description = "数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5564")
|
||||||
|
@NotNull(message = "数据编号不能为空")
|
||||||
|
private Long bizId;
|
||||||
|
|
||||||
|
@Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "跟进类型不能为空")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "跟进内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "跟进内容不能为空")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "下次联系时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "下次联系时间不能为空")
|
||||||
|
private LocalDateTime nextTime;
|
||||||
|
|
||||||
|
@Schema(description = "关联的商机编号数组")
|
||||||
|
private String businessIds;
|
||||||
|
|
||||||
|
@Schema(description = "关联的联系人编号数组")
|
||||||
|
private String contactIds;
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.crm.dal.dataobject.followup;
|
package cn.iocoder.yudao.module.crm.dal.dataobject.followup;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
|
||||||
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@ -21,7 +23,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@TableName(value = "crm_follow_up_record")
|
@TableName(value = "crm_follow_up_record", autoResultMap = true)
|
||||||
@KeySequence("crm_follow_up_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
@KeySequence("crm_follow_up_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ -70,12 +72,14 @@ public class CrmFollowUpRecordDO extends BaseDO {
|
|||||||
*
|
*
|
||||||
* 关联 {@link CrmBusinessDO#getId()}
|
* 关联 {@link CrmBusinessDO#getId()}
|
||||||
*/
|
*/
|
||||||
|
@TableField(typeHandler = LongListTypeHandler.class)
|
||||||
private List<Long> businessIds;
|
private List<Long> businessIds;
|
||||||
/**
|
/**
|
||||||
* 关联的联系人编号数组
|
* 关联的联系人编号数组
|
||||||
*
|
*
|
||||||
* 关联 {@link CrmContactDO#getId()}
|
* 关联 {@link CrmContactDO#getId()}
|
||||||
*/
|
*/
|
||||||
|
@TableField(typeHandler = LongListTypeHandler.class)
|
||||||
private List<Long> contactIds;
|
private List<Long> contactIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.dal.mysql.followup;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CrmFollowUpRecordMapper extends BaseMapperX<CrmFollowUpRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<CrmFollowUpRecordDO> selectPage(CrmFollowUpRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<CrmFollowUpRecordDO>()
|
||||||
|
.eqIfPresent(CrmFollowUpRecordDO::getBizType, reqVO.getBizType())
|
||||||
|
.eqIfPresent(CrmFollowUpRecordDO::getBizId, reqVO.getBizId())
|
||||||
|
.eqIfPresent(CrmFollowUpRecordDO::getType, reqVO.getType())
|
||||||
|
.betweenIfPresent(CrmFollowUpRecordDO::getNextTime, reqVO.getNextTime())
|
||||||
|
.betweenIfPresent(CrmFollowUpRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(CrmFollowUpRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -29,6 +29,7 @@ import com.mzt.logapi.context.LogRecordContext;
|
|||||||
import com.mzt.logapi.service.impl.DiffParseFunction;
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
||||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -63,10 +64,13 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CrmCustomerLimitConfigService customerLimitConfigService;
|
private CrmCustomerLimitConfigService customerLimitConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@Lazy
|
||||||
private CrmContactService contactService;
|
private CrmContactService contactService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@Lazy
|
||||||
private CrmBusinessService businessService;
|
private CrmBusinessService businessService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@Lazy
|
||||||
private CrmContractService contractService;
|
private CrmContractService contractService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.followup;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface CrmFollowUpRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建跟进记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新跟进记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除跟进记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteFollowUpRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得跟进记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 跟进记录
|
||||||
|
*/
|
||||||
|
CrmFollowUpRecordDO getFollowUpRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得跟进记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 跟进记录分页
|
||||||
|
*/
|
||||||
|
PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.service.followup;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.mysql.followup.CrmFollowUpRecordMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.FOLLOW_UP_RECORD_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟进记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CrmFollowUpRecordMapper crmFollowUpRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createFollowUpRecord(CrmFollowUpRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
CrmFollowUpRecordDO followUpRecord = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class);
|
||||||
|
crmFollowUpRecordMapper.insert(followUpRecord);
|
||||||
|
// 返回
|
||||||
|
return followUpRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFollowUpRecord(CrmFollowUpRecordSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateFollowUpRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
CrmFollowUpRecordDO updateObj = BeanUtils.toBean(updateReqVO, CrmFollowUpRecordDO.class);
|
||||||
|
crmFollowUpRecordMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteFollowUpRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateFollowUpRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
crmFollowUpRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateFollowUpRecordExists(Long id) {
|
||||||
|
if (crmFollowUpRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(FOLLOW_UP_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CrmFollowUpRecordDO getFollowUpRecord(Long id) {
|
||||||
|
return crmFollowUpRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) {
|
||||||
|
return crmFollowUpRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user