Commit 5efa0f327f4d65251132db3da66911085f3d2db5
1 parent
73c459f3
crm: 完善一些 TODO
Showing
27 changed files
with
274 additions
and
195 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
| @@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | 9 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | ||
| 10 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | 13 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| @@ -32,6 +35,7 @@ import java.util.List; | @@ -32,6 +35,7 @@ import java.util.List; | ||
| 32 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 35 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 33 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 36 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 34 | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | 37 | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| 38 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 35 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 39 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 36 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 40 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 37 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 41 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| @@ -52,18 +56,17 @@ public class CrmBusinessController { | @@ -52,18 +56,17 @@ public class CrmBusinessController { | ||
| 52 | @Resource | 56 | @Resource |
| 53 | private CrmBusinessStatusService businessStatusService; | 57 | private CrmBusinessStatusService businessStatusService; |
| 54 | 58 | ||
| 55 | - // TODO @商机待定:CrmBusinessCreateReqVO、CrmBusinessUpdateReqVO、CrmBusinessRespVO 按照新的 VO 规范 | ||
| 56 | @PostMapping("/create") | 59 | @PostMapping("/create") |
| 57 | @Operation(summary = "创建商机") | 60 | @Operation(summary = "创建商机") |
| 58 | @PreAuthorize("@ss.hasPermission('crm:business:create')") | 61 | @PreAuthorize("@ss.hasPermission('crm:business:create')") |
| 59 | - public CommonResult<Long> createBusiness(@Valid @RequestBody CrmBusinessCreateReqVO createReqVO) { | 62 | + public CommonResult<Long> createBusiness(@Valid @RequestBody CrmBusinessSaveReqVO createReqVO) { |
| 60 | return success(businessService.createBusiness(createReqVO, getLoginUserId())); | 63 | return success(businessService.createBusiness(createReqVO, getLoginUserId())); |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 63 | @PutMapping("/update") | 66 | @PutMapping("/update") |
| 64 | @Operation(summary = "更新商机") | 67 | @Operation(summary = "更新商机") |
| 65 | @PreAuthorize("@ss.hasPermission('crm:business:update')") | 68 | @PreAuthorize("@ss.hasPermission('crm:business:update')") |
| 66 | - public CommonResult<Boolean> updateBusiness(@Valid @RequestBody CrmBusinessUpdateReqVO updateReqVO) { | 69 | + public CommonResult<Boolean> updateBusiness(@Valid @RequestBody CrmBusinessSaveReqVO updateReqVO) { |
| 67 | businessService.updateBusiness(updateReqVO); | 70 | businessService.updateBusiness(updateReqVO); |
| 68 | return success(true); | 71 | return success(true); |
| 69 | } | 72 | } |
| @@ -83,7 +86,7 @@ public class CrmBusinessController { | @@ -83,7 +86,7 @@ public class CrmBusinessController { | ||
| 83 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 86 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
| 84 | public CommonResult<CrmBusinessRespVO> getBusiness(@RequestParam("id") Long id) { | 87 | public CommonResult<CrmBusinessRespVO> getBusiness(@RequestParam("id") Long id) { |
| 85 | CrmBusinessDO business = businessService.getBusiness(id); | 88 | CrmBusinessDO business = businessService.getBusiness(id); |
| 86 | - return success(CrmBusinessConvert.INSTANCE.convert(business)); | 89 | + return success(BeanUtils.toBean(business, CrmBusinessRespVO.class)); |
| 87 | } | 90 | } |
| 88 | 91 | ||
| 89 | @GetMapping("/list-by-ids") | 92 | @GetMapping("/list-by-ids") |
| @@ -94,6 +97,17 @@ public class CrmBusinessController { | @@ -94,6 +97,17 @@ public class CrmBusinessController { | ||
| 94 | return success(BeanUtils.toBean(businessService.getBusinessList(ids, getLoginUserId()), CrmBusinessRespVO.class)); | 97 | return success(BeanUtils.toBean(businessService.getBusinessList(ids, getLoginUserId()), CrmBusinessRespVO.class)); |
| 95 | } | 98 | } |
| 96 | 99 | ||
| 100 | + @GetMapping("/simple-all-list") | ||
| 101 | + @Operation(summary = "获得联系人的精简列表") | ||
| 102 | + @PreAuthorize("@ss.hasPermission('crm:contact:query')") | ||
| 103 | + public CommonResult<List<CrmBusinessRespVO>> getSimpleContactList() { | ||
| 104 | + CrmBusinessPageReqVO reqVO = new CrmBusinessPageReqVO(); | ||
| 105 | + reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 106 | + PageResult<CrmBusinessDO> pageResult = businessService.getBusinessPage(reqVO, getLoginUserId()); | ||
| 107 | + return success(convertList(pageResult.getList(), business -> // 只返回 id、name 字段 | ||
| 108 | + new CrmBusinessRespVO().setId(business.getId()).setName(business.getName()))); | ||
| 109 | + } | ||
| 110 | + | ||
| 97 | @GetMapping("/page") | 111 | @GetMapping("/page") |
| 98 | @Operation(summary = "获得商机分页") | 112 | @Operation(summary = "获得商机分页") |
| 99 | @PreAuthorize("@ss.hasPermission('crm:business:query')") | 113 | @PreAuthorize("@ss.hasPermission('crm:business:query')") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | - | ||
| 8 | -@Schema(description = "管理后台 - 商机创建 Request VO") | ||
| 9 | -@Data | ||
| 10 | -@EqualsAndHashCode(callSuper = true) | ||
| 11 | -@ToString(callSuper = true) | ||
| 12 | -public class CrmBusinessCreateReqVO extends CrmBusinessBaseVO { | ||
| 13 | - | ||
| 14 | - // TODO @ljileo:新建的时候,应该可以传递添加的产品; | ||
| 15 | - | ||
| 16 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | 4 | +import jakarta.validation.constraints.NotNull; |
| 5 | +import lombok.Data; | ||
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 5 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 6 | 10 | ||
| 11 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 12 | + | ||
| 7 | @Schema(description = "管理后台 - 商机 Response VO") | 13 | @Schema(description = "管理后台 - 商机 Response VO") |
| 8 | @Data | 14 | @Data |
| 9 | -@EqualsAndHashCode(callSuper = true) | ||
| 10 | -@ToString(callSuper = true) | ||
| 11 | -public class CrmBusinessRespVO extends CrmBusinessBaseVO { | 15 | +public class CrmBusinessRespVO { |
| 12 | 16 | ||
| 13 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | 17 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") |
| 14 | private Long id; | 18 | private Long id; |
| 15 | 19 | ||
| 20 | + @Schema(description = "商机名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 21 | + @NotNull(message = "商机名称不能为空") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") | ||
| 25 | + @NotNull(message = "商机状态类型不能为空") | ||
| 26 | + private Long statusTypeId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 29 | + @NotNull(message = "商机状态不能为空") | ||
| 30 | + private Long statusId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "下次联系时间") | ||
| 33 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 34 | + private LocalDateTime contactNextTime; | ||
| 35 | + | ||
| 36 | + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10299") | ||
| 37 | + @NotNull(message = "客户不能为空") | ||
| 38 | + private Long customerId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "预计成交日期") | ||
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 42 | + private LocalDateTime dealTime; | ||
| 43 | + | ||
| 44 | + @Schema(description = "商机金额", example = "12371") | ||
| 45 | + private Integer price; | ||
| 46 | + | ||
| 47 | + // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 | ||
| 48 | + @Schema(description = "整单折扣") | ||
| 49 | + private Integer discountPercent; | ||
| 50 | + | ||
| 51 | + @Schema(description = "产品总金额", example = "12025") | ||
| 52 | + private BigDecimal productPrice; | ||
| 53 | + | ||
| 54 | + @Schema(description = "备注", example = "随便") | ||
| 55 | + private String remark; | ||
| 56 | + | ||
| 16 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 57 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 17 | private LocalDateTime createTime; | 58 | private LocalDateTime createTime; |
| 18 | 59 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction; | ||
| 4 | +import com.mzt.logapi.starter.annotation.DiffLogField; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | import lombok.Data; | 7 | import lombok.Data; |
| 5 | import org.springframework.format.annotation.DateTimeFormat; | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 6 | 9 | ||
| 7 | -import jakarta.validation.constraints.NotNull; | ||
| 8 | import java.math.BigDecimal; | 10 | import java.math.BigDecimal; |
| 9 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
| 10 | 12 | ||
| 11 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 12 | 14 | ||
| 13 | -/** | ||
| 14 | - * 商机 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 15 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 16 | - */ | 15 | +// TODO @ljileo:DiffLogField function 完善一下 |
| 16 | +@Schema(description = "管理后台 - CRM 商机创建/更新 Request VO") | ||
| 17 | @Data | 17 | @Data |
| 18 | -public class CrmBusinessBaseVO { | 18 | +public class CrmBusinessSaveReqVO { |
| 19 | + | ||
| 20 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | ||
| 21 | + private Long id; | ||
| 19 | 22 | ||
| 20 | @Schema(description = "商机名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | 23 | @Schema(description = "商机名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") |
| 24 | + @DiffLogField(name = "商机名称") | ||
| 21 | @NotNull(message = "商机名称不能为空") | 25 | @NotNull(message = "商机名称不能为空") |
| 22 | private String name; | 26 | private String name; |
| 23 | 27 | ||
| 24 | @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") | 28 | @Schema(description = "商机状态类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25714") |
| 29 | + @DiffLogField(name = "商机状态") | ||
| 25 | @NotNull(message = "商机状态类型不能为空") | 30 | @NotNull(message = "商机状态类型不能为空") |
| 26 | private Long statusTypeId; | 31 | private Long statusTypeId; |
| 27 | 32 | ||
| 28 | @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | 33 | @Schema(description = "商机状态编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") |
| 34 | + @DiffLogField(name = "商机状态") | ||
| 29 | @NotNull(message = "商机状态不能为空") | 35 | @NotNull(message = "商机状态不能为空") |
| 30 | private Long statusId; | 36 | private Long statusId; |
| 31 | 37 | ||
| 32 | @Schema(description = "下次联系时间") | 38 | @Schema(description = "下次联系时间") |
| 39 | + @DiffLogField(name = "下次联系时间") | ||
| 33 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 40 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 34 | private LocalDateTime contactNextTime; | 41 | private LocalDateTime contactNextTime; |
| 35 | 42 | ||
| 36 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10299") | 43 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10299") |
| 44 | + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME) | ||
| 37 | @NotNull(message = "客户不能为空") | 45 | @NotNull(message = "客户不能为空") |
| 38 | private Long customerId; | 46 | private Long customerId; |
| 39 | 47 | ||
| 40 | @Schema(description = "预计成交日期") | 48 | @Schema(description = "预计成交日期") |
| 49 | + @DiffLogField(name = "预计成交日期") | ||
| 41 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 50 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 42 | private LocalDateTime dealTime; | 51 | private LocalDateTime dealTime; |
| 43 | 52 | ||
| 44 | @Schema(description = "商机金额", example = "12371") | 53 | @Schema(description = "商机金额", example = "12371") |
| 54 | + @DiffLogField(name = "商机金额") | ||
| 45 | private Integer price; | 55 | private Integer price; |
| 46 | 56 | ||
| 47 | // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 | 57 | // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 |
| 48 | @Schema(description = "整单折扣") | 58 | @Schema(description = "整单折扣") |
| 59 | + @DiffLogField(name = "整单折扣") | ||
| 49 | private Integer discountPercent; | 60 | private Integer discountPercent; |
| 50 | 61 | ||
| 51 | @Schema(description = "产品总金额", example = "12025") | 62 | @Schema(description = "产品总金额", example = "12025") |
| 63 | + @DiffLogField(name = "产品总金额") | ||
| 52 | private BigDecimal productPrice; | 64 | private BigDecimal productPrice; |
| 53 | 65 | ||
| 54 | @Schema(description = "备注", example = "随便") | 66 | @Schema(description = "备注", example = "随便") |
| 67 | + @DiffLogField(name = "备注") | ||
| 55 | private String remark; | 68 | private String remark; |
| 56 | 69 | ||
| 70 | + // TODO @ljileo:修改的时候,应该可以传递添加的产品; | ||
| 71 | + | ||
| 57 | } | 72 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessBaseVO; | ||
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | -import lombok.Data; | ||
| 6 | -import lombok.EqualsAndHashCode; | ||
| 7 | -import lombok.ToString; | ||
| 8 | - | ||
| 9 | -import jakarta.validation.constraints.NotNull; | ||
| 10 | - | ||
| 11 | -@Schema(description = "管理后台 - 商机更新 Request VO") | ||
| 12 | -@Data | ||
| 13 | -@EqualsAndHashCode(callSuper = true) | ||
| 14 | -@ToString(callSuper = true) | ||
| 15 | -public class CrmBusinessUpdateReqVO extends CrmBusinessBaseVO { | ||
| 16 | - | ||
| 17 | - @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | ||
| 18 | - @NotNull(message = "主键不能为空") | ||
| 19 | - private Long id; | ||
| 20 | - | ||
| 21 | - // TODO @ljileo:修改的时候,应该可以传递添加的产品; | ||
| 22 | - | ||
| 23 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| @@ -125,8 +125,10 @@ public class CrmContactController { | @@ -125,8 +125,10 @@ public class CrmContactController { | ||
| 125 | @Operation(summary = "获得联系人的精简列表") | 125 | @Operation(summary = "获得联系人的精简列表") |
| 126 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") | 126 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| 127 | public CommonResult<List<CrmContactRespVO>> getSimpleContactList() { | 127 | public CommonResult<List<CrmContactRespVO>> getSimpleContactList() { |
| 128 | - List<CrmContactDO> list = contactService.getContactList(); | ||
| 129 | - return success(convertList(list, contact -> // 只返回 id、name 字段 | 128 | + CrmContactPageReqVO reqVO = new CrmContactPageReqVO(); |
| 129 | + reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 130 | + PageResult<CrmContactDO> pageResult = contactService.getContactPage(reqVO, getLoginUserId()); | ||
| 131 | + return success(convertList(pageResult.getList(), contact -> // 只返回 id、name 字段 | ||
| 130 | new CrmContactRespVO().setId(contact.getId()).setName(contact.getName()))); | 132 | new CrmContactRespVO().setId(contact.getId()).setName(contact.getName()))); |
| 131 | } | 133 | } |
| 132 | 134 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactSaveReqVO.java
| @@ -28,7 +28,7 @@ public class CrmContactSaveReqVO { | @@ -28,7 +28,7 @@ public class CrmContactSaveReqVO { | ||
| 28 | private String name; | 28 | private String name; |
| 29 | 29 | ||
| 30 | @Schema(description = "客户编号", example = "10795") | 30 | @Schema(description = "客户编号", example = "10795") |
| 31 | - @DiffLogField(name = "姓名", function = CrmCustomerParseFunction.NAME) | 31 | + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME) |
| 32 | private Long customerId; | 32 | private Long customerId; |
| 33 | 33 | ||
| 34 | @Schema(description = "性别") | 34 | @Schema(description = "性别") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/CrmContractController.java
| @@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert; | @@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | 7 | import cn.iocoder.yudao.framework.common.util.number.NumberUtils; |
| 8 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 10 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; | 11 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; |
| @@ -53,14 +54,14 @@ public class CrmContractController { | @@ -53,14 +54,14 @@ public class CrmContractController { | ||
| 53 | @PostMapping("/create") | 54 | @PostMapping("/create") |
| 54 | @Operation(summary = "创建合同") | 55 | @Operation(summary = "创建合同") |
| 55 | @PreAuthorize("@ss.hasPermission('crm:contract:create')") | 56 | @PreAuthorize("@ss.hasPermission('crm:contract:create')") |
| 56 | - public CommonResult<Long> createContract(@Valid @RequestBody CrmContractCreateReqVO createReqVO) { | 57 | + public CommonResult<Long> createContract(@Valid @RequestBody CrmContractSaveReqVO createReqVO) { |
| 57 | return success(contractService.createContract(createReqVO, getLoginUserId())); | 58 | return success(contractService.createContract(createReqVO, getLoginUserId())); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | @PutMapping("/update") | 61 | @PutMapping("/update") |
| 61 | @Operation(summary = "更新合同") | 62 | @Operation(summary = "更新合同") |
| 62 | @PreAuthorize("@ss.hasPermission('crm:contract:update')") | 63 | @PreAuthorize("@ss.hasPermission('crm:contract:update')") |
| 63 | - public CommonResult<Boolean> updateContract(@Valid @RequestBody CrmContractUpdateReqVO updateReqVO) { | 64 | + public CommonResult<Boolean> updateContract(@Valid @RequestBody CrmContractSaveReqVO updateReqVO) { |
| 64 | contractService.updateContract(updateReqVO); | 65 | contractService.updateContract(updateReqVO); |
| 65 | return success(true); | 66 | return success(true); |
| 66 | } | 67 | } |
| @@ -78,22 +79,22 @@ public class CrmContractController { | @@ -78,22 +79,22 @@ public class CrmContractController { | ||
| 78 | @Operation(summary = "获得合同") | 79 | @Operation(summary = "获得合同") |
| 79 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 80 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 80 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") | 81 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 81 | - public CommonResult<ContractRespVO> getContract(@RequestParam("id") Long id) { | 82 | + public CommonResult<CrmContractRespVO> getContract(@RequestParam("id") Long id) { |
| 82 | CrmContractDO contract = contractService.getContract(id); | 83 | CrmContractDO contract = contractService.getContract(id); |
| 83 | - return success(CrmContractConvert.INSTANCE.convert(contract)); | 84 | + return success(BeanUtils.toBean(contract, CrmContractRespVO.class)); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | @GetMapping("/page") | 87 | @GetMapping("/page") |
| 87 | @Operation(summary = "获得合同分页") | 88 | @Operation(summary = "获得合同分页") |
| 88 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") | 89 | @PreAuthorize("@ss.hasPermission('crm:contract:query')") |
| 89 | - public CommonResult<PageResult<ContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) { | 90 | + public CommonResult<PageResult<CrmContractRespVO>> getContractPage(@Valid CrmContractPageReqVO pageVO) { |
| 90 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO, getLoginUserId()); | 91 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(pageVO, getLoginUserId()); |
| 91 | return success(buildContractDetailPage(pageResult)); | 92 | return success(buildContractDetailPage(pageResult)); |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | @GetMapping("/page-by-customer") | 95 | @GetMapping("/page-by-customer") |
| 95 | @Operation(summary = "获得联系人分页,基于指定客户") | 96 | @Operation(summary = "获得联系人分页,基于指定客户") |
| 96 | - public CommonResult<PageResult<ContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { | 97 | + public CommonResult<PageResult<CrmContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { |
| 97 | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); | 98 | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); |
| 98 | PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO); | 99 | PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO); |
| 99 | return success(buildContractDetailPage(pageResult)); | 100 | return success(buildContractDetailPage(pageResult)); |
| @@ -108,7 +109,7 @@ public class CrmContractController { | @@ -108,7 +109,7 @@ public class CrmContractController { | ||
| 108 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId()); | 109 | PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId()); |
| 109 | // 导出 Excel | 110 | // 导出 Excel |
| 110 | ExcelUtils.write(response, "合同.xls", "数据", CrmContractExcelVO.class, | 111 | ExcelUtils.write(response, "合同.xls", "数据", CrmContractExcelVO.class, |
| 111 | - CrmContractConvert.INSTANCE.convertList02(pageResult.getList())); | 112 | + BeanUtils.toBean(pageResult.getList(), CrmContractExcelVO.class)); |
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | /** | 115 | /** |
| @@ -117,7 +118,7 @@ public class CrmContractController { | @@ -117,7 +118,7 @@ public class CrmContractController { | ||
| 117 | * @param pageResult 简单的合同分页结果 | 118 | * @param pageResult 简单的合同分页结果 |
| 118 | * @return 详细的合同分页结果 | 119 | * @return 详细的合同分页结果 |
| 119 | */ | 120 | */ |
| 120 | - private PageResult<ContractRespVO> buildContractDetailPage(PageResult<CrmContractDO> pageResult) { | 121 | + private PageResult<CrmContractRespVO> buildContractDetailPage(PageResult<CrmContractDO> pageResult) { |
| 121 | List<CrmContractDO> contactList = pageResult.getList(); | 122 | List<CrmContractDO> contactList = pageResult.getList(); |
| 122 | if (CollUtil.isEmpty(contactList)) { | 123 | if (CollUtil.isEmpty(contactList)) { |
| 123 | return PageResult.empty(pageResult.getTotal()); | 124 | return PageResult.empty(pageResult.getTotal()); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | - | ||
| 8 | -@Schema(description = "管理后台 - CRM 合同创建 Request VO") | ||
| 9 | -@Data | ||
| 10 | -@EqualsAndHashCode(callSuper = true) | ||
| 11 | -@ToString(callSuper = true) | ||
| 12 | -public class CrmContractCreateReqVO extends CrmContractBaseVO { | ||
| 13 | - | ||
| 14 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/ContractRespVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractRespVO.java
| @@ -2,20 +2,65 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | @@ -2,20 +2,65 @@ package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | ||
| 2 | 2 | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | 5 | ||
| 8 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 9 | 7 | ||
| 10 | @Schema(description = "管理后台 - CRM 合同 Response VO") | 8 | @Schema(description = "管理后台 - CRM 合同 Response VO") |
| 11 | @Data | 9 | @Data |
| 12 | -@EqualsAndHashCode(callSuper = true) | ||
| 13 | -@ToString(callSuper = true) | ||
| 14 | -public class ContractRespVO extends CrmContractBaseVO { | 10 | +public class CrmContractRespVO { |
| 15 | 11 | ||
| 16 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 12 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 17 | private Long id; | 13 | private Long id; |
| 18 | 14 | ||
| 15 | + @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") | ||
| 19 | + private Long customerId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "商机编号", example = "10864") | ||
| 22 | + private Long businessId; | ||
| 23 | + | ||
| 24 | + @Schema(description = "工作流编号", example = "1043") | ||
| 25 | + private Long processInstanceId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 28 | + private LocalDateTime orderDate; | ||
| 29 | + | ||
| 30 | + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144") | ||
| 31 | + private Long ownerUserId; | ||
| 32 | + | ||
| 33 | + // TODO @芋艿:未来应该支持自动生成; | ||
| 34 | + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101") | ||
| 35 | + private String no; | ||
| 36 | + | ||
| 37 | + @Schema(description = "开始时间") | ||
| 38 | + private LocalDateTime startTime; | ||
| 39 | + | ||
| 40 | + @Schema(description = "结束时间") | ||
| 41 | + private LocalDateTime endTime; | ||
| 42 | + | ||
| 43 | + @Schema(description = "合同金额", example = "5617") | ||
| 44 | + private Integer price; | ||
| 45 | + | ||
| 46 | + @Schema(description = "整单折扣") | ||
| 47 | + private Integer discountPercent; | ||
| 48 | + | ||
| 49 | + @Schema(description = "产品总金额", example = "19510") | ||
| 50 | + private Integer productPrice; | ||
| 51 | + | ||
| 52 | + @Schema(description = "联系人编号", example = "18546") | ||
| 53 | + private Long contactId; | ||
| 54 | + | ||
| 55 | + @Schema(description = "公司签约人", example = "14036") | ||
| 56 | + private Long signUserId; | ||
| 57 | + | ||
| 58 | + @Schema(description = "最后跟进时间") | ||
| 59 | + private LocalDateTime contactLastTime; | ||
| 60 | + | ||
| 61 | + @Schema(description = "备注", example = "你猜") | ||
| 62 | + private String remark; | ||
| 63 | + | ||
| 19 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 64 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 20 | private LocalDateTime createTime; | 65 | private LocalDateTime createTime; |
| 21 | 66 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmBusinessParseFunction; | ||
| 4 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmContactParseFunction; | ||
| 5 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction; | ||
| 6 | +import cn.iocoder.yudao.module.crm.framework.operatelog.core.SysAdminUserParseFunction; | ||
| 7 | +import com.mzt.logapi.starter.annotation.DiffLogField; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | +import jakarta.validation.constraints.NotNull; | ||
| 4 | import lombok.Data; | 10 | import lombok.Data; |
| 5 | import org.springframework.format.annotation.DateTimeFormat; | 11 | import org.springframework.format.annotation.DateTimeFormat; |
| 6 | 12 | ||
| 7 | -import jakarta.validation.constraints.NotNull; | ||
| 8 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
| 9 | 14 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 15 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 16 | ||
| 12 | -/** | ||
| 13 | - * 合同 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 14 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 15 | - */ | 17 | +@Schema(description = "管理后台 - CRM 合同创建/更新 Request VO") |
| 16 | @Data | 18 | @Data |
| 17 | -public class CrmContractBaseVO { | 19 | +public class CrmContractSaveReqVO { |
| 18 | 20 | ||
| 19 | - // TODO @dhb52:类似 no 字段的 example 要写xia 哈; | 21 | + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 22 | + private Long id; | ||
| 20 | 23 | ||
| 21 | @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | 24 | @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") |
| 25 | + @DiffLogField(name = "合同名称") | ||
| 22 | @NotNull(message = "合同名称不能为空") | 26 | @NotNull(message = "合同名称不能为空") |
| 23 | private String name; | 27 | private String name; |
| 24 | 28 | ||
| 25 | - // TODO @dhb52:这个必须传递 | ||
| 26 | - @Schema(description = "客户编号", example = "18336") | 29 | + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") |
| 30 | + @DiffLogField(name = "客户", function = CrmCustomerParseFunction.NAME) | ||
| 31 | + @NotNull(message = "客户编号不能为空") | ||
| 27 | private Long customerId; | 32 | private Long customerId; |
| 28 | 33 | ||
| 29 | @Schema(description = "商机编号", example = "10864") | 34 | @Schema(description = "商机编号", example = "10864") |
| 35 | + @DiffLogField(name = "商机", function = CrmBusinessParseFunction.NAME) | ||
| 30 | private Long businessId; | 36 | private Long businessId; |
| 31 | 37 | ||
| 32 | @Schema(description = "工作流编号", example = "1043") | 38 | @Schema(description = "工作流编号", example = "1043") |
| 39 | + @DiffLogField(name = "工作流编号") | ||
| 33 | private Long processInstanceId; | 40 | private Long processInstanceId; |
| 34 | 41 | ||
| 35 | - // TODO @dhb52:这个必须传递 | ||
| 36 | - @Schema(description = "下单日期") | 42 | + @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED) |
| 43 | + @DiffLogField(name = "下单日期") | ||
| 37 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 44 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 45 | + @NotNull(message = "下单日期不能为空") | ||
| 38 | private LocalDateTime orderDate; | 46 | private LocalDateTime orderDate; |
| 39 | 47 | ||
| 40 | - // TODO @dhb52:这个必须传递 | ||
| 41 | - @Schema(description = "负责人的用户编号", example = "17144") | 48 | + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144") |
| 49 | + @DiffLogField(name = "负责人", function = SysAdminUserParseFunction.NAME) | ||
| 50 | + @NotNull(message = "负责人不能为空") | ||
| 42 | private Long ownerUserId; | 51 | private Long ownerUserId; |
| 43 | 52 | ||
| 44 | // TODO @芋艿:未来应该支持自动生成; | 53 | // TODO @芋艿:未来应该支持自动生成; |
| 45 | - // TODO @dhb52:这个必须传递; | ||
| 46 | - @Schema(description = "合同编号") | 54 | + @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101") |
| 55 | + @DiffLogField(name = "合同编号") | ||
| 56 | + @NotNull(message = "合同编号不能为空") | ||
| 47 | private String no; | 57 | private String no; |
| 48 | 58 | ||
| 49 | @Schema(description = "开始时间") | 59 | @Schema(description = "开始时间") |
| 60 | + @DiffLogField(name = "开始时间") | ||
| 50 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 61 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 51 | private LocalDateTime startTime; | 62 | private LocalDateTime startTime; |
| 52 | 63 | ||
| 53 | @Schema(description = "结束时间") | 64 | @Schema(description = "结束时间") |
| 65 | + @DiffLogField(name = "结束时间") | ||
| 54 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 66 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 55 | private LocalDateTime endTime; | 67 | private LocalDateTime endTime; |
| 56 | 68 | ||
| 57 | @Schema(description = "合同金额", example = "5617") | 69 | @Schema(description = "合同金额", example = "5617") |
| 70 | + @DiffLogField(name = "合同金额") | ||
| 58 | private Integer price; | 71 | private Integer price; |
| 59 | 72 | ||
| 60 | @Schema(description = "整单折扣") | 73 | @Schema(description = "整单折扣") |
| 74 | + @DiffLogField(name = "整单折扣") | ||
| 61 | private Integer discountPercent; | 75 | private Integer discountPercent; |
| 62 | 76 | ||
| 63 | @Schema(description = "产品总金额", example = "19510") | 77 | @Schema(description = "产品总金额", example = "19510") |
| 78 | + @DiffLogField(name = "产品总金额") | ||
| 64 | private Integer productPrice; | 79 | private Integer productPrice; |
| 65 | 80 | ||
| 66 | @Schema(description = "联系人编号", example = "18546") | 81 | @Schema(description = "联系人编号", example = "18546") |
| 82 | + @DiffLogField(name = "联系人", function = CrmContactParseFunction.NAME) | ||
| 67 | private Long contactId; | 83 | private Long contactId; |
| 68 | 84 | ||
| 69 | @Schema(description = "公司签约人", example = "14036") | 85 | @Schema(description = "公司签约人", example = "14036") |
| 86 | + @DiffLogField(name = "公司签约人", function = SysAdminUserParseFunction.NAME) | ||
| 70 | private Long signUserId; | 87 | private Long signUserId; |
| 71 | 88 | ||
| 72 | @Schema(description = "最后跟进时间") | 89 | @Schema(description = "最后跟进时间") |
| 90 | + @DiffLogField(name = "最后跟进时间") | ||
| 73 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 91 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 74 | private LocalDateTime contactLastTime; | 92 | private LocalDateTime contactLastTime; |
| 75 | 93 | ||
| 76 | @Schema(description = "备注", example = "你猜") | 94 | @Schema(description = "备注", example = "你猜") |
| 95 | + @DiffLogField(name = "备注") | ||
| 77 | private String remark; | 96 | private String remark; |
| 78 | 97 | ||
| 79 | // TODO @dhb52:增加一个 status 字段:具体有哪些值,你来枚举下;主要页面上有个【草稿】【提交审核】的流程,可以看看。然后要对接工作流,这块也可以看看,不确定的地方问我。 | 98 | // TODO @dhb52:增加一个 status 字段:具体有哪些值,你来枚举下;主要页面上有个【草稿】【提交审核】的流程,可以看看。然后要对接工作流,这块也可以看看,不确定的地方问我。 |
| 80 | 99 | ||
| 100 | + | ||
| 81 | } | 101 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | - | ||
| 8 | -import jakarta.validation.constraints.NotNull; | ||
| 9 | - | ||
| 10 | -@Schema(description = "管理后台 - CRM 合同更新 Request VO") | ||
| 11 | -@Data | ||
| 12 | -@EqualsAndHashCode(callSuper = true) | ||
| 13 | -@ToString(callSuper = true) | ||
| 14 | -public class CrmContractUpdateReqVO extends CrmContractBaseVO { | ||
| 15 | - | ||
| 16 | - @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | ||
| 17 | - @NotNull(message = "合同编号不能为空") | ||
| 18 | - private Long id; | ||
| 19 | - | ||
| 20 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerTransferReqVO.java
| @@ -28,6 +28,4 @@ public class CrmCustomerTransferReqVO { | @@ -28,6 +28,4 @@ public class CrmCustomerTransferReqVO { | ||
| 28 | @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 28 | @Schema(description = "老负责人加入团队后的权限级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 29 | private Integer oldOwnerPermissionLevel; | 29 | private Integer oldOwnerPermissionLevel; |
| 30 | 30 | ||
| 31 | - // TODO @puhui999:联系人、商机、合同的转移 | ||
| 32 | - | ||
| 33 | } | 31 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
| @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.crm.convert.business; | @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.crm.convert.business; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.*; | 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| @@ -27,15 +28,6 @@ public interface CrmBusinessConvert { | @@ -27,15 +28,6 @@ public interface CrmBusinessConvert { | ||
| 27 | 28 | ||
| 28 | CrmBusinessConvert INSTANCE = Mappers.getMapper(CrmBusinessConvert.class); | 29 | CrmBusinessConvert INSTANCE = Mappers.getMapper(CrmBusinessConvert.class); |
| 29 | 30 | ||
| 30 | - CrmBusinessDO convert(CrmBusinessCreateReqVO bean); | ||
| 31 | - | ||
| 32 | - CrmBusinessDO convert(CrmBusinessUpdateReqVO bean); | ||
| 33 | - | ||
| 34 | - CrmBusinessRespVO convert(CrmBusinessDO bean); | ||
| 35 | - List<CrmBusinessRespVO> convert(List<CrmBusinessDO> bean); | ||
| 36 | - | ||
| 37 | - List<CrmBusinessExcelVO> convertList02(List<CrmBusinessDO> list); | ||
| 38 | - | ||
| 39 | @Mapping(target = "bizId", source = "reqVO.id") | 31 | @Mapping(target = "bizId", source = "reqVO.id") |
| 40 | CrmPermissionTransferReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId); | 32 | CrmPermissionTransferReqBO convert(CrmBusinessTransferReqVO reqVO, Long userId); |
| 41 | 33 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatus/CrmBusinessStatusConvert.java
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatus; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatus; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusRespVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusRespVO; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.status.CrmBusinessStatusSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 7 | import org.mapstruct.factory.Mappers; |
| @@ -19,10 +18,6 @@ public interface CrmBusinessStatusConvert { | @@ -19,10 +18,6 @@ public interface CrmBusinessStatusConvert { | ||
| 19 | 18 | ||
| 20 | CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); | 19 | CrmBusinessStatusConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusConvert.class); |
| 21 | 20 | ||
| 22 | - CrmBusinessStatusDO convert(CrmBusinessStatusSaveReqVO bean); | ||
| 23 | - | ||
| 24 | - CrmBusinessStatusRespVO convert(CrmBusinessStatusDO bean); | ||
| 25 | - | ||
| 26 | List<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list); | 21 | List<CrmBusinessStatusRespVO> convertList(List<CrmBusinessStatusDO> list); |
| 27 | 22 | ||
| 28 | PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page); | 23 | PageResult<CrmBusinessStatusRespVO> convertPage(PageResult<CrmBusinessStatusDO> page); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatustype; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.convert.businessstatustype; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeRespVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeRespVO; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.type.CrmBusinessStatusTypeSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 8 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | 7 | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| @@ -25,7 +24,6 @@ public interface CrmBusinessStatusTypeConvert { | @@ -25,7 +24,6 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 25 | 24 | ||
| 26 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); | 25 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); |
| 27 | 26 | ||
| 28 | - CrmBusinessStatusTypeDO convert(CrmBusinessStatusTypeSaveReqVO bean); | ||
| 29 | 27 | ||
| 30 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); | 28 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); |
| 31 | 29 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java
| @@ -4,7 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | @@ -4,7 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 6 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*; | 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactRespVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 11 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| @@ -31,10 +32,6 @@ public interface CrmContactConvert { | @@ -31,10 +32,6 @@ public interface CrmContactConvert { | ||
| 31 | 32 | ||
| 32 | CrmContactRespVO convert(CrmContactDO bean); | 33 | CrmContactRespVO convert(CrmContactDO bean); |
| 33 | 34 | ||
| 34 | - List<CrmContactRespVO> convertList(List<CrmContactDO> list); | ||
| 35 | - | ||
| 36 | - PageResult<CrmContactRespVO> convertPage(PageResult<CrmContactDO> page); | ||
| 37 | - | ||
| 38 | @Mapping(target = "bizId", source = "reqVO.id") | 35 | @Mapping(target = "bizId", source = "reqVO.id") |
| 39 | CrmPermissionTransferReqBO convert(CrmContactTransferReqVO reqVO, Long userId); | 36 | CrmPermissionTransferReqBO convert(CrmContactTransferReqVO reqVO, Long userId); |
| 40 | 37 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contract/CrmContractConvert.java
| @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.crm.convert.contract; | @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.crm.convert.contract; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*; | 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractRespVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 8 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 9 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| @@ -27,24 +28,12 @@ public interface CrmContractConvert { | @@ -27,24 +28,12 @@ public interface CrmContractConvert { | ||
| 27 | 28 | ||
| 28 | CrmContractConvert INSTANCE = Mappers.getMapper(CrmContractConvert.class); | 29 | CrmContractConvert INSTANCE = Mappers.getMapper(CrmContractConvert.class); |
| 29 | 30 | ||
| 30 | - CrmContractDO convert(CrmContractCreateReqVO bean); | ||
| 31 | - | ||
| 32 | - CrmContractDO convert(CrmContractUpdateReqVO bean); | ||
| 33 | - | ||
| 34 | - ContractRespVO convert(CrmContractDO bean); | ||
| 35 | - | ||
| 36 | - List<ContractRespVO> convertList(List<CrmContractDO> list); | ||
| 37 | - | ||
| 38 | - PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> page); | ||
| 39 | - | ||
| 40 | - List<CrmContractExcelVO> convertList02(List<CrmContractDO> list); | ||
| 41 | - | ||
| 42 | @Mapping(target = "bizId", source = "reqVO.id") | 31 | @Mapping(target = "bizId", source = "reqVO.id") |
| 43 | CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId); | 32 | CrmPermissionTransferReqBO convert(CrmContractTransferReqVO reqVO, Long userId); |
| 44 | 33 | ||
| 45 | - default PageResult<ContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap, | ||
| 46 | - List<CrmCustomerDO> customerList) { | ||
| 47 | - PageResult<ContractRespVO> voPageResult = BeanUtils.toBean(pageResult, ContractRespVO.class); | 34 | + default PageResult<CrmContractRespVO> convertPage(PageResult<CrmContractDO> pageResult, Map<Long, AdminUserRespDTO> userMap, |
| 35 | + List<CrmCustomerDO> customerList) { | ||
| 36 | + PageResult<CrmContractRespVO> voPageResult = BeanUtils.toBean(pageResult, CrmContractRespVO.class); | ||
| 48 | // 拼接关联字段 | 37 | // 拼接关联字段 |
| 49 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); | 38 | Map<Long, CrmCustomerDO> customerMap = convertMap(customerList, CrmCustomerDO::getId); |
| 50 | voPageResult.getList().forEach(contract -> { | 39 | voPageResult.getList().forEach(contract -> { |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/followup/CrmFollowUpRecordDO.java
| @@ -15,8 +15,6 @@ import lombok.*; | @@ -15,8 +15,6 @@ import lombok.*; | ||
| 15 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
| 16 | import java.util.List; | 16 | import java.util.List; |
| 17 | 17 | ||
| 18 | -// TODO @puhui999:界面:做成一个 list 列表,字段是 id、跟进人、跟进方式、跟进时间、跟进内容、下次联系时间、关联联系人、关联商机 | ||
| 19 | -// TODO @puhui999:界面:记录时,弹窗,表单字段是跟进方式、跟进内容、下次联系时间、关联联系人、关联商机;其中关联联系人、关联商机,要做成对应的组件列。 | ||
| 20 | /** | 18 | /** |
| 21 | * 跟进记录 DO | 19 | * 跟进记录 DO |
| 22 | * | 20 | * |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/operatelog/core/CrmBusinessParseFunction.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.framework.operatelog.core; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.StrUtil; | ||
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | ||
| 6 | +import com.mzt.logapi.service.IParseFunction; | ||
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | +import lombok.extern.slf4j.Slf4j; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * CRM 商机的 {@link IParseFunction} 实现类 | ||
| 13 | + * | ||
| 14 | + * @author HUIHUI | ||
| 15 | + */ | ||
| 16 | +@Component | ||
| 17 | +@Slf4j | ||
| 18 | +public class CrmBusinessParseFunction implements IParseFunction { | ||
| 19 | + | ||
| 20 | + public static final String NAME = "getBusinessById"; | ||
| 21 | + | ||
| 22 | + @Resource | ||
| 23 | + private CrmBusinessService businessService; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public boolean executeBefore() { | ||
| 27 | + return true; // 先转换值后对比 | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public String functionName() { | ||
| 32 | + return NAME; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public String apply(Object value) { | ||
| 37 | + if (StrUtil.isEmptyIfStr(value)) { | ||
| 38 | + return ""; | ||
| 39 | + } | ||
| 40 | + CrmBusinessDO businessDO = businessService.getBusiness(Long.parseLong(value.toString())); | ||
| 41 | + return businessDO == null ? "" : businessDO.getName(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO; | ||
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| @@ -27,14 +26,14 @@ public interface CrmBusinessService { | @@ -27,14 +26,14 @@ public interface CrmBusinessService { | ||
| 27 | * @param userId 用户编号 | 26 | * @param userId 用户编号 |
| 28 | * @return 编号 | 27 | * @return 编号 |
| 29 | */ | 28 | */ |
| 30 | - Long createBusiness(@Valid CrmBusinessCreateReqVO createReqVO, Long userId); | 29 | + Long createBusiness(@Valid CrmBusinessSaveReqVO createReqVO, Long userId); |
| 31 | 30 | ||
| 32 | /** | 31 | /** |
| 33 | * 更新商机 | 32 | * 更新商机 |
| 34 | * | 33 | * |
| 35 | * @param updateReqVO 更新信息 | 34 | * @param updateReqVO 更新信息 |
| 36 | */ | 35 | */ |
| 37 | - void updateBusiness(@Valid CrmBusinessUpdateReqVO updateReqVO); | 36 | + void updateBusiness(@Valid CrmBusinessSaveReqVO updateReqVO); |
| 38 | 37 | ||
| 39 | /** | 38 | /** |
| 40 | * 删除商机 | 39 | * 删除商机 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -4,10 +4,9 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,10 +4,9 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.collection.ListUtil; | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; | ||
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | 9 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO; | ||
| 11 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | 10 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; |
| @@ -55,9 +54,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -55,9 +54,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 55 | @Transactional(rollbackFor = Exception.class) | 54 | @Transactional(rollbackFor = Exception.class) |
| 56 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_CREATE_SUB_TYPE, bizNo = "{{#business.id}}", | 55 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_CREATE_SUB_TYPE, bizNo = "{{#business.id}}", |
| 57 | success = CRM_BUSINESS_CREATE_SUCCESS) | 56 | success = CRM_BUSINESS_CREATE_SUCCESS) |
| 58 | - public Long createBusiness(CrmBusinessCreateReqVO createReqVO, Long userId) { | 57 | + public Long createBusiness(CrmBusinessSaveReqVO createReqVO, Long userId) { |
| 58 | + createReqVO.setId(null); | ||
| 59 | // 1. 插入商机 | 59 | // 1. 插入商机 |
| 60 | - CrmBusinessDO business = CrmBusinessConvert.INSTANCE.convert(createReqVO); | 60 | + CrmBusinessDO business = BeanUtils.toBean(createReqVO, CrmBusinessDO.class) |
| 61 | + .setOwnerUserId(userId); | ||
| 61 | businessMapper.insert(business); | 62 | businessMapper.insert(business); |
| 62 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 63 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 63 | 64 | ||
| @@ -77,18 +78,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -77,18 +78,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 77 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | 78 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", |
| 78 | success = CRM_BUSINESS_UPDATE_SUCCESS) | 79 | success = CRM_BUSINESS_UPDATE_SUCCESS) |
| 79 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | 80 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 80 | - public void updateBusiness(CrmBusinessUpdateReqVO updateReqVO) { | 81 | + public void updateBusiness(CrmBusinessSaveReqVO updateReqVO) { |
| 81 | // 1. 校验存在 | 82 | // 1. 校验存在 |
| 82 | CrmBusinessDO oldBusiness = validateBusinessExists(updateReqVO.getId()); | 83 | CrmBusinessDO oldBusiness = validateBusinessExists(updateReqVO.getId()); |
| 83 | 84 | ||
| 84 | // 2. 更新商机 | 85 | // 2. 更新商机 |
| 85 | - CrmBusinessDO updateObj = CrmBusinessConvert.INSTANCE.convert(updateReqVO); | 86 | + CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); |
| 86 | businessMapper.updateById(updateObj); | 87 | businessMapper.updateById(updateObj); |
| 87 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 88 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 88 | 89 | ||
| 89 | // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表 | 90 | // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表 |
| 90 | // 3. 记录操作日志上下文 | 91 | // 3. 记录操作日志上下文 |
| 91 | - LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldBusiness, CrmBusinessUpdateReqVO.class)); | 92 | + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldBusiness, CrmBusinessSaveReqVO.class)); |
| 92 | LogRecordContext.putVariable("businessName", oldBusiness.getName()); | 93 | LogRecordContext.putVariable("businessName", oldBusiness.getName()); |
| 93 | } | 94 | } |
| 94 | 95 | ||
| @@ -157,6 +158,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -157,6 +158,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 157 | 158 | ||
| 158 | @Override | 159 | @Override |
| 159 | public List<CrmBusinessDO> getBusinessList(Collection<Long> ids) { | 160 | public List<CrmBusinessDO> getBusinessList(Collection<Long> ids) { |
| 161 | + if (CollUtil.isEmpty(ids)) { | ||
| 162 | + return ListUtil.empty(); | ||
| 163 | + } | ||
| 160 | return businessMapper.selectBatchIds(ids); | 164 | return businessMapper.selectBatchIds(ids); |
| 161 | } | 165 | } |
| 162 | 166 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -68,6 +68,7 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -68,6 +68,7 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 68 | @LogRecord(type = CRM_CONTACT_TYPE, subType = CRM_CONTACT_CREATE_SUB_TYPE, bizNo = "{{#contact.id}}", | 68 | @LogRecord(type = CRM_CONTACT_TYPE, subType = CRM_CONTACT_CREATE_SUB_TYPE, bizNo = "{{#contact.id}}", |
| 69 | success = CRM_CONTACT_CREATE_SUCCESS) | 69 | success = CRM_CONTACT_CREATE_SUCCESS) |
| 70 | public Long createContact(CrmContactSaveReqVO createReqVO, Long userId) { | 70 | public Long createContact(CrmContactSaveReqVO createReqVO, Long userId) { |
| 71 | + createReqVO.setId(null); | ||
| 71 | // 1. 校验 | 72 | // 1. 校验 |
| 72 | validateRelationDataExists(createReqVO); | 73 | validateRelationDataExists(createReqVO); |
| 73 | 74 | ||
| @@ -209,6 +210,9 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -209,6 +210,9 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 209 | 210 | ||
| 210 | @Override | 211 | @Override |
| 211 | public List<CrmContactDO> getContactList(Collection<Long> ids) { | 212 | public List<CrmContactDO> getContactList(Collection<Long> ids) { |
| 213 | + if (CollUtil.isEmpty(ids)) { | ||
| 214 | + return ListUtil.empty(); | ||
| 215 | + } | ||
| 212 | return contactMapper.selectBatchIds(ids); | 216 | return contactMapper.selectBatchIds(ids); |
| 213 | } | 217 | } |
| 214 | 218 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
| 1 | package cn.iocoder.yudao.module.crm.service.contract; | 1 | package cn.iocoder.yudao.module.crm.service.contract; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | ||
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | 4 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | import jakarta.validation.Valid; | 9 | import jakarta.validation.Valid; |
| @@ -26,14 +25,14 @@ public interface CrmContractService { | @@ -26,14 +25,14 @@ public interface CrmContractService { | ||
| 26 | * @param userId 用户编号 | 25 | * @param userId 用户编号 |
| 27 | * @return 编号 | 26 | * @return 编号 |
| 28 | */ | 27 | */ |
| 29 | - Long createContract(@Valid CrmContractCreateReqVO createReqVO, Long userId); | 28 | + Long createContract(@Valid CrmContractSaveReqVO createReqVO, Long userId); |
| 30 | 29 | ||
| 31 | /** | 30 | /** |
| 32 | * 更新合同 | 31 | * 更新合同 |
| 33 | * | 32 | * |
| 34 | * @param updateReqVO 更新信息 | 33 | * @param updateReqVO 更新信息 |
| 35 | */ | 34 | */ |
| 36 | - void updateContract(@Valid CrmContractUpdateReqVO updateReqVO); | 35 | + void updateContract(@Valid CrmContractSaveReqVO updateReqVO); |
| 37 | 36 | ||
| 38 | /** | 37 | /** |
| 39 | * 删除合同 | 38 | * 删除合同 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| @@ -4,10 +4,9 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,10 +4,9 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.collection.ListUtil; | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; | ||
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | 9 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | ||
| 11 | import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; | 10 | import cn.iocoder.yudao.module.crm.convert.contract.CrmContractConvert; |
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 13 | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | 12 | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; |
| @@ -50,10 +49,11 @@ public class CrmContractServiceImpl implements CrmContractService { | @@ -50,10 +49,11 @@ public class CrmContractServiceImpl implements CrmContractService { | ||
| 50 | @Transactional(rollbackFor = Exception.class) | 49 | @Transactional(rollbackFor = Exception.class) |
| 51 | @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_CREATE_SUB_TYPE, bizNo = "{{#contract.id}}", | 50 | @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_CREATE_SUB_TYPE, bizNo = "{{#contract.id}}", |
| 52 | success = CRM_CONTRACT_CREATE_SUCCESS) | 51 | success = CRM_CONTRACT_CREATE_SUCCESS) |
| 53 | - public Long createContract(CrmContractCreateReqVO createReqVO, Long userId) { | 52 | + public Long createContract(CrmContractSaveReqVO createReqVO, Long userId) { |
| 53 | + createReqVO.setId(null); | ||
| 54 | // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO | 54 | // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO |
| 55 | // 插入合同 | 55 | // 插入合同 |
| 56 | - CrmContractDO contract = CrmContractConvert.INSTANCE.convert(createReqVO); | 56 | + CrmContractDO contract = BeanUtils.toBean(createReqVO, CrmContractDO.class); |
| 57 | contractMapper.insert(contract); | 57 | contractMapper.insert(contract); |
| 58 | 58 | ||
| 59 | // 创建数据权限 | 59 | // 创建数据权限 |
| @@ -71,17 +71,17 @@ public class CrmContractServiceImpl implements CrmContractService { | @@ -71,17 +71,17 @@ public class CrmContractServiceImpl implements CrmContractService { | ||
| 71 | @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | 71 | @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", |
| 72 | success = CRM_CONTRACT_UPDATE_SUCCESS) | 72 | success = CRM_CONTRACT_UPDATE_SUCCESS) |
| 73 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | 73 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 74 | - public void updateContract(CrmContractUpdateReqVO updateReqVO) { | 74 | + public void updateContract(CrmContractSaveReqVO updateReqVO) { |
| 75 | // TODO @合同待定:只有草稿、审批中,可以编辑; | 75 | // TODO @合同待定:只有草稿、审批中,可以编辑; |
| 76 | // 校验存在 | 76 | // 校验存在 |
| 77 | CrmContractDO oldContract = validateContractExists(updateReqVO.getId()); | 77 | CrmContractDO oldContract = validateContractExists(updateReqVO.getId()); |
| 78 | // 更新合同 | 78 | // 更新合同 |
| 79 | - CrmContractDO updateObj = CrmContractConvert.INSTANCE.convert(updateReqVO); | 79 | + CrmContractDO updateObj = BeanUtils.toBean(updateReqVO, CrmContractDO.class); |
| 80 | contractMapper.updateById(updateObj); | 80 | contractMapper.updateById(updateObj); |
| 81 | // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO | 81 | // TODO @合同待定:插入合同商品;需要搞个 BusinessProductDO |
| 82 | 82 | ||
| 83 | // 3. 记录操作日志上下文 | 83 | // 3. 记录操作日志上下文 |
| 84 | - LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldContract, CrmContractUpdateReqVO.class)); | 84 | + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldContract, CrmContractSaveReqVO.class)); |
| 85 | LogRecordContext.putVariable("contractName", oldContract.getName()); | 85 | LogRecordContext.putVariable("contractName", oldContract.getName()); |
| 86 | } | 86 | } |
| 87 | 87 |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImplTest.java
| 1 | package cn.iocoder.yudao.module.crm.service.business; | 1 | package cn.iocoder.yudao.module.crm.service.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 3 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 4 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessUpdateReqVO; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; |
| 6 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; | 6 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; |
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | import org.junit.jupiter.api.Disabled; | 8 | import org.junit.jupiter.api.Disabled; |
| 9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
| 10 | import org.springframework.context.annotation.Import; | 10 | import org.springframework.context.annotation.Import; |
| 11 | 11 | ||
| 12 | -import jakarta.annotation.Resource; | ||
| 13 | - | ||
| 14 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 12 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| 15 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 13 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 16 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; | 14 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| @@ -39,7 +37,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -39,7 +37,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 39 | @Test | 37 | @Test |
| 40 | public void testCreateBusiness_success() { | 38 | public void testCreateBusiness_success() { |
| 41 | // 准备参数 | 39 | // 准备参数 |
| 42 | - CrmBusinessCreateReqVO reqVO = randomPojo(CrmBusinessCreateReqVO.class); | 40 | + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class); |
| 43 | 41 | ||
| 44 | // 调用 | 42 | // 调用 |
| 45 | Long businessId = businessService.createBusiness(reqVO, getLoginUserId()); | 43 | Long businessId = businessService.createBusiness(reqVO, getLoginUserId()); |
| @@ -56,7 +54,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -56,7 +54,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 56 | CrmBusinessDO dbBusiness = randomPojo(CrmBusinessDO.class); | 54 | CrmBusinessDO dbBusiness = randomPojo(CrmBusinessDO.class); |
| 57 | businessMapper.insert(dbBusiness);// @Sql: 先插入出一条存在的数据 | 55 | businessMapper.insert(dbBusiness);// @Sql: 先插入出一条存在的数据 |
| 58 | // 准备参数 | 56 | // 准备参数 |
| 59 | - CrmBusinessUpdateReqVO reqVO = randomPojo(CrmBusinessUpdateReqVO.class, o -> { | 57 | + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class, o -> { |
| 60 | o.setId(dbBusiness.getId()); // 设置更新的 ID | 58 | o.setId(dbBusiness.getId()); // 设置更新的 ID |
| 61 | }); | 59 | }); |
| 62 | 60 | ||
| @@ -70,7 +68,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | @@ -70,7 +68,7 @@ public class CrmBusinessServiceImplTest extends BaseDbUnitTest { | ||
| 70 | @Test | 68 | @Test |
| 71 | public void testUpdateBusiness_notExists() { | 69 | public void testUpdateBusiness_notExists() { |
| 72 | // 准备参数 | 70 | // 准备参数 |
| 73 | - CrmBusinessUpdateReqVO reqVO = randomPojo(CrmBusinessUpdateReqVO.class); | 71 | + CrmBusinessSaveReqVO reqVO = randomPojo(CrmBusinessSaveReqVO.class); |
| 74 | 72 | ||
| 75 | // 调用, 并断言异常 | 73 | // 调用, 并断言异常 |
| 76 | assertServiceException(() -> businessService.updateBusiness(reqVO), BUSINESS_NOT_EXISTS); | 74 | assertServiceException(() -> businessService.updateBusiness(reqVO), BUSINESS_NOT_EXISTS); |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/contract/ContractServiceImplTest.java
| @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.crm.service.contract; | @@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.crm.service.contract; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractCreateReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractPageReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractUpdateReqVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | 8 | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; |
| 10 | import jakarta.annotation.Resource; | 9 | import jakarta.annotation.Resource; |
| @@ -38,7 +37,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | @@ -38,7 +37,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | ||
| 38 | @Test | 37 | @Test |
| 39 | public void testCreateContract_success() { | 38 | public void testCreateContract_success() { |
| 40 | // 准备参数 | 39 | // 准备参数 |
| 41 | - CrmContractCreateReqVO reqVO = randomPojo(CrmContractCreateReqVO.class); | 40 | + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class); |
| 42 | 41 | ||
| 43 | // 调用 | 42 | // 调用 |
| 44 | Long contractId = contractService.createContract(reqVO, getLoginUserId()); | 43 | Long contractId = contractService.createContract(reqVO, getLoginUserId()); |
| @@ -55,7 +54,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | @@ -55,7 +54,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | ||
| 55 | CrmContractDO dbContract = randomPojo(CrmContractDO.class); | 54 | CrmContractDO dbContract = randomPojo(CrmContractDO.class); |
| 56 | contractMapper.insert(dbContract);// @Sql: 先插入出一条存在的数据 | 55 | contractMapper.insert(dbContract);// @Sql: 先插入出一条存在的数据 |
| 57 | // 准备参数 | 56 | // 准备参数 |
| 58 | - CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class, o -> { | 57 | + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class, o -> { |
| 59 | o.setId(dbContract.getId()); // 设置更新的 ID | 58 | o.setId(dbContract.getId()); // 设置更新的 ID |
| 60 | }); | 59 | }); |
| 61 | 60 | ||
| @@ -69,7 +68,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | @@ -69,7 +68,7 @@ public class ContractServiceImplTest extends BaseDbUnitTest { | ||
| 69 | @Test | 68 | @Test |
| 70 | public void testUpdateContract_notExists() { | 69 | public void testUpdateContract_notExists() { |
| 71 | // 准备参数 | 70 | // 准备参数 |
| 72 | - CrmContractUpdateReqVO reqVO = randomPojo(CrmContractUpdateReqVO.class); | 71 | + CrmContractSaveReqVO reqVO = randomPojo(CrmContractSaveReqVO.class); |
| 73 | 72 | ||
| 74 | // 调用, 并断言异常 | 73 | // 调用, 并断言异常 |
| 75 | assertServiceException(() -> contractService.updateContract(reqVO), CONTRACT_NOT_EXISTS); | 74 | assertServiceException(() -> contractService.updateContract(reqVO), CONTRACT_NOT_EXISTS); |