Commit 19fa65b0c31cfba0ff4710baa7913e258e0fe3b6
1 parent
ba103d6e
CRM: 新增跟进记录
Showing
10 changed files
with
392 additions
and
1 deletions
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| @@ -79,4 +79,7 @@ public interface ErrorCodeConstants { | @@ -79,4 +79,7 @@ public interface ErrorCodeConstants { | ||
| 79 | // ========== 客户公海规则设置 1_020_012_000 ========== | 79 | // ========== 客户公海规则设置 1_020_012_000 ========== |
| 80 | ErrorCode CUSTOMER_LIMIT_CONFIG_NOT_EXISTS = new ErrorCode(1_020_012_000, "客户限制配置不存在"); | 80 | ErrorCode CUSTOMER_LIMIT_CONFIG_NOT_EXISTS = new ErrorCode(1_020_012_000, "客户限制配置不存在"); |
| 81 | 81 | ||
| 82 | + // ========== 跟进记录 1_020_013_000 ========== | ||
| 83 | + ErrorCode FOLLOW_UP_RECORD_NOT_EXISTS = new ErrorCode(1_020_013_000, "跟进记录不存在"); | ||
| 84 | + | ||
| 82 | } | 85 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.followup; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 8 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | ||
| 13 | +import cn.iocoder.yudao.module.crm.service.followup.CrmFollowUpRecordService; | ||
| 14 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 17 | +import jakarta.annotation.Resource; | ||
| 18 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 19 | +import jakarta.validation.Valid; | ||
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 21 | +import org.springframework.validation.annotation.Validated; | ||
| 22 | +import org.springframework.web.bind.annotation.*; | ||
| 23 | + | ||
| 24 | +import java.io.IOException; | ||
| 25 | +import java.util.List; | ||
| 26 | + | ||
| 27 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 28 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 29 | + | ||
| 30 | + | ||
| 31 | +@Tag(name = "管理后台 - 跟进记录") | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("/crm/follow-up-record") | ||
| 34 | +@Validated | ||
| 35 | +public class CrmFollowUpRecordController { | ||
| 36 | + | ||
| 37 | + @Resource | ||
| 38 | + private CrmFollowUpRecordService crmFollowUpRecordService; | ||
| 39 | + | ||
| 40 | + @PostMapping("/create") | ||
| 41 | + @Operation(summary = "创建跟进记录") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:create')") | ||
| 43 | + public CommonResult<Long> createFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO createReqVO) { | ||
| 44 | + return success(crmFollowUpRecordService.createFollowUpRecord(createReqVO)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @PutMapping("/update") | ||
| 48 | + @Operation(summary = "更新跟进记录") | ||
| 49 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:update')") | ||
| 50 | + public CommonResult<Boolean> updateFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO updateReqVO) { | ||
| 51 | + crmFollowUpRecordService.updateFollowUpRecord(updateReqVO); | ||
| 52 | + return success(true); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @DeleteMapping("/delete") | ||
| 56 | + @Operation(summary = "删除跟进记录") | ||
| 57 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 58 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:delete')") | ||
| 59 | + public CommonResult<Boolean> deleteFollowUpRecord(@RequestParam("id") Long id) { | ||
| 60 | + crmFollowUpRecordService.deleteFollowUpRecord(id); | ||
| 61 | + return success(true); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @GetMapping("/get") | ||
| 65 | + @Operation(summary = "获得跟进记录") | ||
| 66 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 67 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") | ||
| 68 | + public CommonResult<CrmFollowUpRecordRespVO> getFollowUpRecord(@RequestParam("id") Long id) { | ||
| 69 | + CrmFollowUpRecordDO followUpRecord = crmFollowUpRecordService.getFollowUpRecord(id); | ||
| 70 | + return success(BeanUtils.toBean(followUpRecord, CrmFollowUpRecordRespVO.class)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @GetMapping("/page") | ||
| 74 | + @Operation(summary = "获得跟进记录分页") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") | ||
| 76 | + public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) { | ||
| 77 | + PageResult<CrmFollowUpRecordDO> pageResult = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO); | ||
| 78 | + return success(BeanUtils.toBean(pageResult, CrmFollowUpRecordRespVO.class)); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/export-excel") | ||
| 82 | + @Operation(summary = "导出跟进记录 Excel") | ||
| 83 | + @PreAuthorize("@ss.hasPermission('crm:follow-up-record:export')") | ||
| 84 | + @OperateLog(type = EXPORT) | ||
| 85 | + public void exportFollowUpRecordExcel(@Valid CrmFollowUpRecordPageReqVO pageReqVO, | ||
| 86 | + HttpServletResponse response) throws IOException { | ||
| 87 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 88 | + List<CrmFollowUpRecordDO> list = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO).getList(); | ||
| 89 | + // 导出 Excel | ||
| 90 | + ExcelUtils.write(response, "跟进记录.xls", "数据", CrmFollowUpRecordRespVO.class, | ||
| 91 | + BeanUtils.toBean(list, CrmFollowUpRecordRespVO.class)); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | +} | ||
| 0 | \ No newline at end of file | 95 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.followup.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - 跟进记录分页 Request VO") | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +public class CrmFollowUpRecordPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "数据类型", example = "2") | ||
| 21 | + private Integer bizType; | ||
| 22 | + | ||
| 23 | + @Schema(description = "数据编号", example = "5564") | ||
| 24 | + private Long bizId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "跟进类型", example = "2") | ||
| 27 | + private Integer type; | ||
| 28 | + | ||
| 29 | + @Schema(description = "下次联系时间") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime[] nextTime; | ||
| 32 | + | ||
| 33 | + @Schema(description = "创建时间") | ||
| 34 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 35 | + private LocalDateTime[] createTime; | ||
| 36 | + | ||
| 37 | +} | ||
| 0 | \ No newline at end of file | 38 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.followup.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - 跟进记录 Response VO") | ||
| 13 | +@Data | ||
| 14 | +@ExcelIgnoreUnannotated | ||
| 15 | +public class CrmFollowUpRecordRespVO { | ||
| 16 | + | ||
| 17 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28800") | ||
| 18 | + @ExcelProperty("编号") | ||
| 19 | + private Long id; | ||
| 20 | + | ||
| 21 | + @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 22 | + @ExcelProperty("数据类型") | ||
| 23 | + private Integer bizType; | ||
| 24 | + | ||
| 25 | + @Schema(description = "数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5564") | ||
| 26 | + @ExcelProperty("数据编号") | ||
| 27 | + private Long bizId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 30 | + @ExcelProperty(value = "跟进类型", converter = DictConvert.class) | ||
| 31 | + @DictFormat("crm_follow_up_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 | ||
| 32 | + private Integer type; | ||
| 33 | + | ||
| 34 | + @Schema(description = "跟进内容", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 35 | + @ExcelProperty("跟进内容") | ||
| 36 | + private String content; | ||
| 37 | + | ||
| 38 | + @Schema(description = "下次联系时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 39 | + @ExcelProperty("下次联系时间") | ||
| 40 | + private LocalDateTime nextTime; | ||
| 41 | + | ||
| 42 | + @Schema(description = "关联的商机编号数组") | ||
| 43 | + @ExcelProperty("关联的商机编号数组") | ||
| 44 | + private String businessIds; | ||
| 45 | + | ||
| 46 | + @Schema(description = "关联的联系人编号数组") | ||
| 47 | + @ExcelProperty("关联的联系人编号数组") | ||
| 48 | + private String contactIds; | ||
| 49 | + | ||
| 50 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 51 | + @ExcelProperty("创建时间") | ||
| 52 | + private LocalDateTime createTime; | ||
| 53 | + | ||
| 54 | +} | ||
| 0 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.followup.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - 跟进记录新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class CrmFollowUpRecordSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "28800") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 18 | + @NotNull(message = "数据类型不能为空") | ||
| 19 | + private Integer bizType; | ||
| 20 | + | ||
| 21 | + @Schema(description = "数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5564") | ||
| 22 | + @NotNull(message = "数据编号不能为空") | ||
| 23 | + private Long bizId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "跟进类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 26 | + @NotNull(message = "跟进类型不能为空") | ||
| 27 | + private Integer type; | ||
| 28 | + | ||
| 29 | + @Schema(description = "跟进内容", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 30 | + @NotEmpty(message = "跟进内容不能为空") | ||
| 31 | + private String content; | ||
| 32 | + | ||
| 33 | + @Schema(description = "下次联系时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 34 | + @NotNull(message = "下次联系时间不能为空") | ||
| 35 | + private LocalDateTime nextTime; | ||
| 36 | + | ||
| 37 | + @Schema(description = "关联的商机编号数组") | ||
| 38 | + private String businessIds; | ||
| 39 | + | ||
| 40 | + @Schema(description = "关联的联系人编号数组") | ||
| 41 | + private String contactIds; | ||
| 42 | + | ||
| 43 | +} | ||
| 0 | \ No newline at end of file | 44 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java
| 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.followup; | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.followup; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | ||
| 4 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 6 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | 7 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 7 | import com.baomidou.mybatisplus.annotation.KeySequence; | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 8 | import com.baomidou.mybatisplus.annotation.TableId; | 10 | import com.baomidou.mybatisplus.annotation.TableId; |
| 9 | import com.baomidou.mybatisplus.annotation.TableName; | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | import lombok.*; | 12 | import lombok.*; |
| @@ -21,7 +23,7 @@ import java.util.List; | @@ -21,7 +23,7 @@ import java.util.List; | ||
| 21 | * | 23 | * |
| 22 | * @author 芋道源码 | 24 | * @author 芋道源码 |
| 23 | */ | 25 | */ |
| 24 | -@TableName(value = "crm_follow_up_record") | 26 | +@TableName(value = "crm_follow_up_record", autoResultMap = true) |
| 25 | @KeySequence("crm_follow_up_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | 27 | @KeySequence("crm_follow_up_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 26 | @Data | 28 | @Data |
| 27 | @EqualsAndHashCode(callSuper = true) | 29 | @EqualsAndHashCode(callSuper = true) |
| @@ -70,12 +72,14 @@ public class CrmFollowUpRecordDO extends BaseDO { | @@ -70,12 +72,14 @@ public class CrmFollowUpRecordDO extends BaseDO { | ||
| 70 | * | 72 | * |
| 71 | * 关联 {@link CrmBusinessDO#getId()} | 73 | * 关联 {@link CrmBusinessDO#getId()} |
| 72 | */ | 74 | */ |
| 75 | + @TableField(typeHandler = LongListTypeHandler.class) | ||
| 73 | private List<Long> businessIds; | 76 | private List<Long> businessIds; |
| 74 | /** | 77 | /** |
| 75 | * 关联的联系人编号数组 | 78 | * 关联的联系人编号数组 |
| 76 | * | 79 | * |
| 77 | * 关联 {@link CrmContactDO#getId()} | 80 | * 关联 {@link CrmContactDO#getId()} |
| 78 | */ | 81 | */ |
| 82 | + @TableField(typeHandler = LongListTypeHandler.class) | ||
| 79 | private List<Long> contactIds; | 83 | private List<Long> contactIds; |
| 80 | 84 | ||
| 81 | } | 85 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/followup/CrmFollowUpRecordMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.followup; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 跟进记录 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface CrmFollowUpRecordMapper extends BaseMapperX<CrmFollowUpRecordDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<CrmFollowUpRecordDO> selectPage(CrmFollowUpRecordPageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<CrmFollowUpRecordDO>() | ||
| 20 | + .eqIfPresent(CrmFollowUpRecordDO::getBizType, reqVO.getBizType()) | ||
| 21 | + .eqIfPresent(CrmFollowUpRecordDO::getBizId, reqVO.getBizId()) | ||
| 22 | + .eqIfPresent(CrmFollowUpRecordDO::getType, reqVO.getType()) | ||
| 23 | + .betweenIfPresent(CrmFollowUpRecordDO::getNextTime, reqVO.getNextTime()) | ||
| 24 | + .betweenIfPresent(CrmFollowUpRecordDO::getCreateTime, reqVO.getCreateTime()) | ||
| 25 | + .orderByDesc(CrmFollowUpRecordDO::getId)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | +} | ||
| 0 | \ No newline at end of file | 29 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| @@ -29,6 +29,7 @@ import com.mzt.logapi.context.LogRecordContext; | @@ -29,6 +29,7 @@ import com.mzt.logapi.context.LogRecordContext; | ||
| 29 | import com.mzt.logapi.service.impl.DiffParseFunction; | 29 | import com.mzt.logapi.service.impl.DiffParseFunction; |
| 30 | import com.mzt.logapi.starter.annotation.LogRecord; | 30 | import com.mzt.logapi.starter.annotation.LogRecord; |
| 31 | import jakarta.annotation.Resource; | 31 | import jakarta.annotation.Resource; |
| 32 | +import org.springframework.context.annotation.Lazy; | ||
| 32 | import org.springframework.stereotype.Service; | 33 | import org.springframework.stereotype.Service; |
| 33 | import org.springframework.transaction.annotation.Transactional; | 34 | import org.springframework.transaction.annotation.Transactional; |
| 34 | import org.springframework.validation.annotation.Validated; | 35 | import org.springframework.validation.annotation.Validated; |
| @@ -63,10 +64,13 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -63,10 +64,13 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 63 | @Resource | 64 | @Resource |
| 64 | private CrmCustomerLimitConfigService customerLimitConfigService; | 65 | private CrmCustomerLimitConfigService customerLimitConfigService; |
| 65 | @Resource | 66 | @Resource |
| 67 | + @Lazy | ||
| 66 | private CrmContactService contactService; | 68 | private CrmContactService contactService; |
| 67 | @Resource | 69 | @Resource |
| 70 | + @Lazy | ||
| 68 | private CrmBusinessService businessService; | 71 | private CrmBusinessService businessService; |
| 69 | @Resource | 72 | @Resource |
| 73 | + @Lazy | ||
| 70 | private CrmContractService contractService; | 74 | private CrmContractService contractService; |
| 71 | 75 | ||
| 72 | @Resource | 76 | @Resource |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.followup; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 跟进记录 Service 接口 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +public interface CrmFollowUpRecordService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建跟进记录 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 更新跟进记录 | ||
| 26 | + * | ||
| 27 | + * @param updateReqVO 更新信息 | ||
| 28 | + */ | ||
| 29 | + void updateFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO updateReqVO); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 删除跟进记录 | ||
| 33 | + * | ||
| 34 | + * @param id 编号 | ||
| 35 | + */ | ||
| 36 | + void deleteFollowUpRecord(Long id); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 获得跟进记录 | ||
| 40 | + * | ||
| 41 | + * @param id 编号 | ||
| 42 | + * @return 跟进记录 | ||
| 43 | + */ | ||
| 44 | + CrmFollowUpRecordDO getFollowUpRecord(Long id); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得跟进记录分页 | ||
| 48 | + * | ||
| 49 | + * @param pageReqVO 分页查询 | ||
| 50 | + * @return 跟进记录分页 | ||
| 51 | + */ | ||
| 52 | + PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO); | ||
| 53 | + | ||
| 54 | +} | ||
| 0 | \ No newline at end of file | 55 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.followup; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | ||
| 8 | +import cn.iocoder.yudao.module.crm.dal.mysql.followup.CrmFollowUpRecordMapper; | ||
| 9 | +import jakarta.annotation.Resource; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | +import org.springframework.validation.annotation.Validated; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 14 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.FOLLOW_UP_RECORD_NOT_EXISTS; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 跟进记录 Service 实现类 | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 21 | +@Service | ||
| 22 | +@Validated | ||
| 23 | +public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | ||
| 24 | + | ||
| 25 | + @Resource | ||
| 26 | + private CrmFollowUpRecordMapper crmFollowUpRecordMapper; | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public Long createFollowUpRecord(CrmFollowUpRecordSaveReqVO createReqVO) { | ||
| 30 | + // 插入 | ||
| 31 | + CrmFollowUpRecordDO followUpRecord = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class); | ||
| 32 | + crmFollowUpRecordMapper.insert(followUpRecord); | ||
| 33 | + // 返回 | ||
| 34 | + return followUpRecord.getId(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public void updateFollowUpRecord(CrmFollowUpRecordSaveReqVO updateReqVO) { | ||
| 39 | + // 校验存在 | ||
| 40 | + validateFollowUpRecordExists(updateReqVO.getId()); | ||
| 41 | + // 更新 | ||
| 42 | + CrmFollowUpRecordDO updateObj = BeanUtils.toBean(updateReqVO, CrmFollowUpRecordDO.class); | ||
| 43 | + crmFollowUpRecordMapper.updateById(updateObj); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public void deleteFollowUpRecord(Long id) { | ||
| 48 | + // 校验存在 | ||
| 49 | + validateFollowUpRecordExists(id); | ||
| 50 | + // 删除 | ||
| 51 | + crmFollowUpRecordMapper.deleteById(id); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + private void validateFollowUpRecordExists(Long id) { | ||
| 55 | + if (crmFollowUpRecordMapper.selectById(id) == null) { | ||
| 56 | + throw exception(FOLLOW_UP_RECORD_NOT_EXISTS); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public CrmFollowUpRecordDO getFollowUpRecord(Long id) { | ||
| 62 | + return crmFollowUpRecordMapper.selectById(id); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) { | ||
| 67 | + return crmFollowUpRecordMapper.selectPage(pageReqVO); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | +} | ||
| 0 | \ No newline at end of file | 71 | \ No newline at end of file |