Commit ea4b4b8956757a6c60d8e440d7c2c24a59110cf8
1 parent
e6f4c1f0
CRM-客户:精简 VO
Showing
15 changed files
with
189 additions
and
259 deletions
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/config/YudaoOperateLogV2Configuration.java
| 1 | package cn.iocoder.yudao.framework.operatelog.config; | 1 | package cn.iocoder.yudao.framework.operatelog.config; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.operatelog.core.service.ILogRecordServiceImpl; | 3 | +import cn.iocoder.yudao.framework.operatelog.core.service.LogRecordServiceImpl; |
| 4 | import com.mzt.logapi.service.ILogRecordService; | 4 | import com.mzt.logapi.service.ILogRecordService; |
| 5 | import com.mzt.logapi.starter.annotation.EnableLogRecord; | 5 | import com.mzt.logapi.starter.annotation.EnableLogRecord; |
| 6 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| @@ -21,7 +21,7 @@ public class YudaoOperateLogV2Configuration { | @@ -21,7 +21,7 @@ public class YudaoOperateLogV2Configuration { | ||
| 21 | @Bean | 21 | @Bean |
| 22 | @Primary | 22 | @Primary |
| 23 | public ILogRecordService iLogRecordServiceImpl() { | 23 | public ILogRecordService iLogRecordServiceImpl() { |
| 24 | - return new ILogRecordServiceImpl(); | 24 | + return new LogRecordServiceImpl(); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | } | 27 | } |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/ILogRecordServiceImpl.java renamed to yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/LogRecordServiceImpl.java
| @@ -2,7 +2,8 @@ package cn.iocoder.yudao.framework.operatelog.core.service; | @@ -2,7 +2,8 @@ package cn.iocoder.yudao.framework.operatelog.core.service; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | 3 | import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; |
| 4 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | 4 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 5 | -import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; | 5 | +import cn.iocoder.yudao.framework.security.core.LoginUser; |
| 6 | +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; | ||
| 6 | import cn.iocoder.yudao.module.system.api.logger.OperateLogApi; | 7 | import cn.iocoder.yudao.module.system.api.logger.OperateLogApi; |
| 7 | import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2CreateReqDTO; | 8 | import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogV2CreateReqDTO; |
| 8 | import com.mzt.logapi.beans.LogRecord; | 9 | import com.mzt.logapi.beans.LogRecord; |
| @@ -13,7 +14,6 @@ import lombok.extern.slf4j.Slf4j; | @@ -13,7 +14,6 @@ import lombok.extern.slf4j.Slf4j; | ||
| 13 | 14 | ||
| 14 | import java.util.List; | 15 | import java.util.List; |
| 15 | 16 | ||
| 16 | -// TODO @puhui999:LogRecordServiceImpl 改成这个名字哈 | ||
| 17 | /** | 17 | /** |
| 18 | * 操作日志 ILogRecordService 实现类 | 18 | * 操作日志 ILogRecordService 实现类 |
| 19 | * | 19 | * |
| @@ -22,7 +22,7 @@ import java.util.List; | @@ -22,7 +22,7 @@ import java.util.List; | ||
| 22 | * @author HUIHUI | 22 | * @author HUIHUI |
| 23 | */ | 23 | */ |
| 24 | @Slf4j | 24 | @Slf4j |
| 25 | -public class ILogRecordServiceImpl implements ILogRecordService { | 25 | +public class LogRecordServiceImpl implements ILogRecordService { |
| 26 | 26 | ||
| 27 | @Resource | 27 | @Resource |
| 28 | private OperateLogApi operateLogApi; | 28 | private OperateLogApi operateLogApi; |
| @@ -46,9 +46,13 @@ public class ILogRecordServiceImpl implements ILogRecordService { | @@ -46,9 +46,13 @@ public class ILogRecordServiceImpl implements ILogRecordService { | ||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | private static void fillUserFields(OperateLogV2CreateReqDTO reqDTO) { | 48 | private static void fillUserFields(OperateLogV2CreateReqDTO reqDTO) { |
| 49 | - // TODO @puhui999:使用 SecurityFrameworkUtils。因为要考虑,rpc、mq、job,它其实不是 web; | ||
| 50 | - reqDTO.setUserId(WebFrameworkUtils.getLoginUserId()); | ||
| 51 | - reqDTO.setUserType(WebFrameworkUtils.getLoginUserType()); | 49 | + // 使用 SecurityFrameworkUtils。因为要考虑,rpc、mq、job,它其实不是 web; |
| 50 | + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); | ||
| 51 | + if (loginUser == null) { | ||
| 52 | + return; | ||
| 53 | + } | ||
| 54 | + reqDTO.setUserId(loginUser.getId()); | ||
| 55 | + reqDTO.setUserType(loginUser.getUserType()); | ||
| 52 | } | 56 | } |
| 53 | 57 | ||
| 54 | public static void fillModuleFields(OperateLogV2CreateReqDTO reqDTO, LogRecord logRecord) { | 58 | public static void fillModuleFields(OperateLogV2CreateReqDTO reqDTO, LogRecord logRecord) { |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
| @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer; | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 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; | ||
| 7 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 6 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 8 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 7 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | 8 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; |
| @@ -19,7 +18,6 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | @@ -19,7 +18,6 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 19 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 18 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 20 | import io.swagger.v3.oas.annotations.Operation; | 19 | import io.swagger.v3.oas.annotations.Operation; |
| 21 | import io.swagger.v3.oas.annotations.Parameter; | 20 | import io.swagger.v3.oas.annotations.Parameter; |
| 22 | -import io.swagger.v3.oas.annotations.Parameters; | ||
| 23 | import io.swagger.v3.oas.annotations.tags.Tag; | 21 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 24 | import jakarta.annotation.Resource; | 22 | import jakarta.annotation.Resource; |
| 25 | import jakarta.servlet.http.HttpServletResponse; | 23 | import jakarta.servlet.http.HttpServletResponse; |
| @@ -58,28 +56,24 @@ public class CrmCustomerController { | @@ -58,28 +56,24 @@ public class CrmCustomerController { | ||
| 58 | @Resource | 56 | @Resource |
| 59 | private OperateLogApi operateLogApi; | 57 | private OperateLogApi operateLogApi; |
| 60 | 58 | ||
| 61 | - // TODO @puhui999:把 CrmCustomerCreateReqVO、CrmCustomerUpdateReqVO、CrmCustomerRespVO 按照新的规范,搞一下哈; | ||
| 62 | @PostMapping("/create") | 59 | @PostMapping("/create") |
| 63 | @Operation(summary = "创建客户") | 60 | @Operation(summary = "创建客户") |
| 64 | - @OperateLog(enable = false) // TODO 关闭原有日志记录;@puhui999:注解都先删除。先记录,没关系。我们下个迭代,就都删除掉操作日志了; | ||
| 65 | @PreAuthorize("@ss.hasPermission('crm:customer:create')") | 61 | @PreAuthorize("@ss.hasPermission('crm:customer:create')") |
| 66 | - public CommonResult<Long> createCustomer(@Valid @RequestBody CrmCustomerCreateReqVO createReqVO) { | 62 | + public CommonResult<Long> createCustomer(@Valid @RequestBody CrmCustomerSaveReqVO createReqVO) { |
| 67 | return success(customerService.createCustomer(createReqVO, getLoginUserId())); | 63 | return success(customerService.createCustomer(createReqVO, getLoginUserId())); |
| 68 | } | 64 | } |
| 69 | 65 | ||
| 70 | @PutMapping("/update") | 66 | @PutMapping("/update") |
| 71 | @Operation(summary = "更新客户") | 67 | @Operation(summary = "更新客户") |
| 72 | - @OperateLog(enable = false) // TODO 关闭原有日志记录 | ||
| 73 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") | 68 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") |
| 74 | - public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CrmCustomerUpdateReqVO updateReqVO) { | 69 | + public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CrmCustomerSaveReqVO updateReqVO) { |
| 75 | customerService.updateCustomer(updateReqVO); | 70 | customerService.updateCustomer(updateReqVO); |
| 76 | return success(true); | 71 | return success(true); |
| 77 | } | 72 | } |
| 78 | 73 | ||
| 79 | @DeleteMapping("/delete") | 74 | @DeleteMapping("/delete") |
| 80 | @Operation(summary = "删除客户") | 75 | @Operation(summary = "删除客户") |
| 81 | - @OperateLog(enable = false) // TODO 关闭原有日志记录 | ||
| 82 | - @Parameter(name = "id", description = "编号", required = true) | 76 | + @Parameter(name = "id", description = "客户编号", required = true) |
| 83 | @PreAuthorize("@ss.hasPermission('crm:customer:delete')") | 77 | @PreAuthorize("@ss.hasPermission('crm:customer:delete')") |
| 84 | public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) { | 78 | public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Long id) { |
| 85 | customerService.deleteCustomer(id); | 79 | customerService.deleteCustomer(id); |
| @@ -103,7 +97,6 @@ public class CrmCustomerController { | @@ -103,7 +97,6 @@ public class CrmCustomerController { | ||
| 103 | return success(CrmCustomerConvert.INSTANCE.convert(customer, userMap, deptMap)); | 97 | return success(CrmCustomerConvert.INSTANCE.convert(customer, userMap, deptMap)); |
| 104 | } | 98 | } |
| 105 | 99 | ||
| 106 | - // TODO @puhui999:这个查询会查出多个;微信发你图了 | ||
| 107 | @GetMapping("/page") | 100 | @GetMapping("/page") |
| 108 | @Operation(summary = "获得客户分页") | 101 | @Operation(summary = "获得客户分页") |
| 109 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") | 102 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") |
| @@ -131,32 +124,32 @@ public class CrmCustomerController { | @@ -131,32 +124,32 @@ public class CrmCustomerController { | ||
| 131 | pageVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | 124 | pageVO.setPageSize(PAGE_SIZE_NONE); // 不分页 |
| 132 | List<CrmCustomerDO> list = customerService.getCustomerPage(pageVO, getLoginUserId()).getList(); | 125 | List<CrmCustomerDO> list = customerService.getCustomerPage(pageVO, getLoginUserId()).getList(); |
| 133 | // 导出 Excel | 126 | // 导出 Excel |
| 134 | - List<CrmCustomerExcelVO> datas = CrmCustomerConvert.INSTANCE.convertList02(list); | ||
| 135 | - ExcelUtils.write(response, "客户.xls", "数据", CrmCustomerExcelVO.class, datas); | 127 | + List<CrmCustomerRespVO> datas = CrmCustomerConvert.INSTANCE.convertList02(list); |
| 128 | + ExcelUtils.write(response, "客户.xls", "数据", CrmCustomerRespVO.class, datas); | ||
| 136 | } | 129 | } |
| 137 | 130 | ||
| 138 | @PutMapping("/transfer") | 131 | @PutMapping("/transfer") |
| 139 | @Operation(summary = "转移客户") | 132 | @Operation(summary = "转移客户") |
| 140 | - @OperateLog(enable = false) // TODO 关闭原有日志记录 | ||
| 141 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") | 133 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") |
| 142 | public CommonResult<Boolean> transfer(@Valid @RequestBody CrmCustomerTransferReqVO reqVO) { | 134 | public CommonResult<Boolean> transfer(@Valid @RequestBody CrmCustomerTransferReqVO reqVO) { |
| 143 | customerService.transferCustomer(reqVO, getLoginUserId()); | 135 | customerService.transferCustomer(reqVO, getLoginUserId()); |
| 144 | return success(true); | 136 | return success(true); |
| 145 | } | 137 | } |
| 146 | 138 | ||
| 147 | - // TODO @puhui999:是不是接口只要传递 bizId,由 Controller 自己组装出 OperateLogV2PageReqDTO | ||
| 148 | @GetMapping("/operate-log-page") | 139 | @GetMapping("/operate-log-page") |
| 149 | @Operation(summary = "获得客户操作日志") | 140 | @Operation(summary = "获得客户操作日志") |
| 141 | + @Parameter(name = "id", description = "客户编号", required = true) | ||
| 150 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") | 142 | @PreAuthorize("@ss.hasPermission('crm:customer:query')") |
| 151 | - public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(CrmCustomerOperateLogPageReqVO reqVO) { | ||
| 152 | - reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 153 | - reqVO.setBizType(CRM_CUSTOMER); | ||
| 154 | - return success(operateLogApi.getOperateLogPage(BeanUtils.toBean(reqVO, OperateLogV2PageReqDTO.class))); | 143 | + public CommonResult<PageResult<OperateLogV2RespDTO>> getCustomerOperateLog(@RequestParam("id") Long id) { |
| 144 | + OperateLogV2PageReqDTO reqDTO = new OperateLogV2PageReqDTO(); | ||
| 145 | + reqDTO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 146 | + reqDTO.setBizType(CRM_CUSTOMER); | ||
| 147 | + reqDTO.setBizId(id); | ||
| 148 | + return success(operateLogApi.getOperateLogPage(reqDTO)); | ||
| 155 | } | 149 | } |
| 156 | 150 | ||
| 157 | @PutMapping("/lock") | 151 | @PutMapping("/lock") |
| 158 | @Operation(summary = "锁定/解锁客户") | 152 | @Operation(summary = "锁定/解锁客户") |
| 159 | - @OperateLog(enable = false) // TODO 关闭原有日志记录 | ||
| 160 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") | 153 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") |
| 161 | public CommonResult<Boolean> lockCustomer(@Valid @RequestBody CrmCustomerLockReqVO lockReqVO) { | 154 | public CommonResult<Boolean> lockCustomer(@Valid @RequestBody CrmCustomerLockReqVO lockReqVO) { |
| 162 | customerService.lockCustomer(lockReqVO, getLoginUserId()); | 155 | customerService.lockCustomer(lockReqVO, getLoginUserId()); |
| @@ -167,7 +160,6 @@ public class CrmCustomerController { | @@ -167,7 +160,6 @@ public class CrmCustomerController { | ||
| 167 | 160 | ||
| 168 | @PutMapping("/put-pool") | 161 | @PutMapping("/put-pool") |
| 169 | @Operation(summary = "数据放入公海") | 162 | @Operation(summary = "数据放入公海") |
| 170 | - @OperateLog(enable = false) // TODO 关闭原有日志记录 | ||
| 171 | @Parameter(name = "id", description = "客户编号", required = true, example = "1024") | 163 | @Parameter(name = "id", description = "客户编号", required = true, example = "1024") |
| 172 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") | 164 | @PreAuthorize("@ss.hasPermission('crm:customer:update')") |
| 173 | public CommonResult<Boolean> putCustomerPool(@RequestParam("id") Long id) { | 165 | public CommonResult<Boolean> putCustomerPool(@RequestParam("id") Long id) { |
| @@ -184,28 +176,22 @@ public class CrmCustomerController { | @@ -184,28 +176,22 @@ public class CrmCustomerController { | ||
| 184 | return success(true); | 176 | return success(true); |
| 185 | } | 177 | } |
| 186 | 178 | ||
| 187 | - // TODO @puhui999:需要搞个 VO 类 | ||
| 188 | @PutMapping("/distribute") | 179 | @PutMapping("/distribute") |
| 189 | @Operation(summary = "分配公海给对应负责人") | 180 | @Operation(summary = "分配公海给对应负责人") |
| 190 | - @Parameters({ | ||
| 191 | - @Parameter(name = "ids", description = "客户编号数组", required = true, example = "1,2,3"), | ||
| 192 | - @Parameter(name = "ownerUserId", description = "分配的负责人编号", required = true, example = "12345") | ||
| 193 | - }) | ||
| 194 | @PreAuthorize("@ss.hasPermission('crm:customer:distribute')") | 181 | @PreAuthorize("@ss.hasPermission('crm:customer:distribute')") |
| 195 | - public CommonResult<Boolean> distributeCustomer(@RequestParam(value = "ids") List<Long> ids, | ||
| 196 | - @RequestParam(value = "ownerUserId") Long ownerUserId) { | ||
| 197 | - customerService.receiveCustomer(ids, ownerUserId); | 182 | + public CommonResult<Boolean> distributeCustomer(@Valid @RequestBody CrmCustomerDistributeReqVO distributeReqVO) { |
| 183 | + customerService.receiveCustomer(distributeReqVO.getIds(), distributeReqVO.getOwnerUserId()); | ||
| 198 | return success(true); | 184 | return success(true); |
| 199 | } | 185 | } |
| 200 | 186 | ||
| 201 | // TODO 芋艿:这个接口要调整下 | 187 | // TODO 芋艿:这个接口要调整下 |
| 202 | - @GetMapping("/query-all-list") | ||
| 203 | - @Operation(summary = "查询客户列表") | ||
| 204 | - @PreAuthorize("@ss.hasPermission('crm:customer:all')") | ||
| 205 | - public CommonResult<List<CrmCustomerQueryAllRespVO>> queryAll() { | ||
| 206 | - List<CrmCustomerDO> crmCustomerDOList = customerService.getCustomerList(); | ||
| 207 | - List<CrmCustomerQueryAllRespVO> data = CrmCustomerConvert.INSTANCE.convertQueryAll(crmCustomerDOList); | ||
| 208 | - return success(data); | ||
| 209 | - } | 188 | + //@GetMapping("/query-all-list") |
| 189 | + //@Operation(summary = "查询客户列表") | ||
| 190 | + //@PreAuthorize("@ss.hasPermission('crm:customer:all')") | ||
| 191 | + //public CommonResult<List<CrmCustomerQueryAllRespVO>> queryAll() { | ||
| 192 | + // List<CrmCustomerDO> crmCustomerDOList = customerService.getCustomerList(); | ||
| 193 | + // List<CrmCustomerQueryAllRespVO> data = CrmCustomerConvert.INSTANCE.convertQueryAll(crmCustomerDOList); | ||
| 194 | + // return success(data); | ||
| 195 | + //} | ||
| 210 | 196 | ||
| 211 | } | 197 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerCreateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.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 CrmCustomerCreateReqVO extends CrmCustomerBaseVO { | ||
| 15 | - | ||
| 16 | - @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 17 | - @NotNull(message = "负责人不能为空") | ||
| 18 | - private Long ownerUserId; | ||
| 19 | - | ||
| 20 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerDistributeReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - CRM 客户分配公海给对应负责人 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class CrmCustomerDistributeReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1024]") | ||
| 14 | + @NotNull(message = "客户编号不能为空") | ||
| 15 | + private List<Long> ids; | ||
| 16 | + | ||
| 17 | + @Schema(description = "负责人", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 18 | + @NotNull(message = "负责人不能为空") | ||
| 19 | + private Long ownerUserId; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerExcelVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | -import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | ||
| 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 | -// TODO 芋艿:导出最后做,等基本确认的差不多之后; | ||
| 13 | -/** | ||
| 14 | - * CRM 客户 Excel VO | ||
| 15 | - * | ||
| 16 | - * @author Wanwan | ||
| 17 | - */ | ||
| 18 | -@Data | ||
| 19 | -public class CrmCustomerExcelVO { | ||
| 20 | - | ||
| 21 | - @ExcelProperty("编号") | ||
| 22 | - private Long id; | ||
| 23 | - | ||
| 24 | - @ExcelProperty("客户名称") | ||
| 25 | - private String name; | ||
| 26 | - | ||
| 27 | - @ExcelProperty(value = "跟进状态", converter = DictConvert.class) | ||
| 28 | - @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 29 | - private Boolean followUpStatus; | ||
| 30 | - | ||
| 31 | - @ExcelProperty(value = "锁定状态", converter = DictConvert.class) | ||
| 32 | - @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 33 | - private Boolean lockStatus; | ||
| 34 | - | ||
| 35 | - @ExcelProperty(value = "成交状态", converter = DictConvert.class) | ||
| 36 | - @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 37 | - private Boolean dealStatus; | ||
| 38 | - | ||
| 39 | - @ExcelProperty(value = "所属行业", converter = DictConvert.class) | ||
| 40 | - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY) | ||
| 41 | - private Integer industryId; | ||
| 42 | - | ||
| 43 | - @ExcelProperty(value = "客户等级", converter = DictConvert.class) | ||
| 44 | - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL) | ||
| 45 | - private Integer level; | ||
| 46 | - | ||
| 47 | - @ExcelProperty(value = "客户来源", converter = DictConvert.class) | ||
| 48 | - @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE) | ||
| 49 | - private Integer source; | ||
| 50 | - | ||
| 51 | - @ExcelProperty("手机") | ||
| 52 | - private String mobile; | ||
| 53 | - | ||
| 54 | - @ExcelProperty("电话") | ||
| 55 | - private String telephone; | ||
| 56 | - | ||
| 57 | - @ExcelProperty("网址") | ||
| 58 | - private String website; | ||
| 59 | - | ||
| 60 | - @ExcelProperty("QQ") | ||
| 61 | - private String qq; | ||
| 62 | - | ||
| 63 | - @ExcelProperty("wechat") | ||
| 64 | - private String wechat; | ||
| 65 | - | ||
| 66 | - @ExcelProperty("email") | ||
| 67 | - private String email; | ||
| 68 | - | ||
| 69 | - @ExcelProperty("客户描述") | ||
| 70 | - private String description; | ||
| 71 | - | ||
| 72 | - @ExcelProperty("备注") | ||
| 73 | - private String remark; | ||
| 74 | - | ||
| 75 | - @ExcelProperty("负责人的用户编号") | ||
| 76 | - private Long ownerUserId; | ||
| 77 | - | ||
| 78 | - @ExcelProperty("地区编号") | ||
| 79 | - private Integer areaId; | ||
| 80 | - | ||
| 81 | - @ExcelProperty("详细地址") | ||
| 82 | - private String detailAddress; | ||
| 83 | - | ||
| 84 | - @ExcelProperty("最后跟进时间") | ||
| 85 | - private LocalDateTime contactLastTime; | ||
| 86 | - | ||
| 87 | - @ExcelProperty("下次联系时间") | ||
| 88 | - private LocalDateTime contactNextTime; | ||
| 89 | - | ||
| 90 | - @ExcelProperty("创建时间") | ||
| 91 | - private LocalDateTime createTime; | ||
| 92 | - | ||
| 93 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerOperateLogPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.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 | - | ||
| 7 | -@Schema(description = "管理后台 - crm 客户操作日志分页 Request VO") | ||
| 8 | -@Data | ||
| 9 | -public class CrmCustomerOperateLogPageReqVO extends PageParam { | ||
| 10 | - | ||
| 11 | - @Schema(description = "模块数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 12 | - private Long bizId; | ||
| 13 | - | ||
| 14 | - @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 15 | - private Long userId; | ||
| 16 | - | ||
| 17 | - @Schema(description = "模块类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | - private String bizType; | ||
| 19 | - | ||
| 20 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerQueryAllRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | -// TODO 芋艿:这块要统一下; | ||
| 7 | -@Schema(description = "管理后台 - CRM 全部客户 Response VO") | ||
| 8 | -@Data | ||
| 9 | -public class CrmCustomerQueryAllRespVO{ | ||
| 10 | - | ||
| 11 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 12 | - private Long id; | ||
| 13 | - | ||
| 14 | - @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | ||
| 15 | - private String name; | ||
| 16 | - | ||
| 17 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.customer.vo; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; | ||
| 6 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 9 | import lombok.Data; |
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | -import lombok.ToString; | ||
| 7 | import org.springframework.format.annotation.DateTimeFormat; | 10 | import org.springframework.format.annotation.DateTimeFormat; |
| 8 | 11 | ||
| 9 | import java.time.LocalDateTime; | 12 | import java.time.LocalDateTime; |
| @@ -12,45 +15,121 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -12,45 +15,121 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 12 | 15 | ||
| 13 | @Schema(description = "管理后台 - CRM 客户 Response VO") | 16 | @Schema(description = "管理后台 - CRM 客户 Response VO") |
| 14 | @Data | 17 | @Data |
| 15 | -@EqualsAndHashCode(callSuper = true) | ||
| 16 | -@ToString(callSuper = true) | ||
| 17 | -public class CrmCustomerRespVO extends CrmCustomerBaseVO { | 18 | +@ExcelIgnoreUnannotated |
| 19 | +public class CrmCustomerRespVO { | ||
| 18 | 20 | ||
| 19 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | 21 | @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") |
| 22 | + @ExcelProperty("编号") | ||
| 20 | private Long id; | 23 | private Long id; |
| 21 | 24 | ||
| 22 | - @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | 25 | + @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") |
| 26 | + @ExcelProperty("客户名称") | ||
| 27 | + private String name; | ||
| 28 | + | ||
| 29 | + @Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 30 | + @ExcelProperty(value = "跟进状态", converter = DictConvert.class) | ||
| 31 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 23 | private Boolean followUpStatus; | 32 | private Boolean followUpStatus; |
| 24 | 33 | ||
| 25 | - @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | 34 | + @Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") |
| 35 | + @ExcelProperty(value = "锁定状态", converter = DictConvert.class) | ||
| 36 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 26 | private Boolean lockStatus; | 37 | private Boolean lockStatus; |
| 27 | 38 | ||
| 28 | - @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | 39 | + @Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") |
| 40 | + @ExcelProperty(value = "成交状态", converter = DictConvert.class) | ||
| 41 | + @DictFormat(DictTypeConstants.BOOLEAN_STRING) | ||
| 29 | private Boolean dealStatus; | 42 | private Boolean dealStatus; |
| 30 | 43 | ||
| 44 | + @Schema(description = "所属行业", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 45 | + @ExcelProperty(value = "所属行业", converter = DictConvert.class) | ||
| 46 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY) | ||
| 47 | + private Integer industryId; | ||
| 48 | + | ||
| 49 | + @Schema(description = "客户等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 50 | + @ExcelProperty(value = "客户等级", converter = DictConvert.class) | ||
| 51 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL) | ||
| 52 | + private Integer level; | ||
| 53 | + | ||
| 54 | + @Schema(description = "客户来源", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 55 | + @ExcelProperty(value = "客户来源", converter = DictConvert.class) | ||
| 56 | + @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE) | ||
| 57 | + private Integer source; | ||
| 58 | + | ||
| 59 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 60 | + @ExcelProperty("手机") | ||
| 61 | + private String mobile; | ||
| 62 | + | ||
| 31 | @Schema(description = "负责人的用户编号", example = "25682") | 63 | @Schema(description = "负责人的用户编号", example = "25682") |
| 64 | + @ExcelProperty("电话") | ||
| 65 | + private String telephone; | ||
| 66 | + | ||
| 67 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 68 | + @ExcelProperty("网址") | ||
| 69 | + private String website; | ||
| 70 | + | ||
| 71 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 72 | + @ExcelProperty("QQ") | ||
| 73 | + private String qq; | ||
| 74 | + | ||
| 75 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 76 | + @ExcelProperty("wechat") | ||
| 77 | + private String wechat; | ||
| 78 | + | ||
| 79 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 80 | + @ExcelProperty("email") | ||
| 81 | + private String email; | ||
| 82 | + | ||
| 83 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 84 | + @ExcelProperty("客户描述") | ||
| 85 | + private String description; | ||
| 86 | + | ||
| 87 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 88 | + @ExcelProperty("备注") | ||
| 89 | + private String remark; | ||
| 90 | + | ||
| 91 | + @Schema(description = "负责人的用户编号", example = "25682") | ||
| 92 | + @ExcelProperty("负责人的用户编号") | ||
| 32 | private Long ownerUserId; | 93 | private Long ownerUserId; |
| 33 | @Schema(description = "负责人名字", example = "25682") | 94 | @Schema(description = "负责人名字", example = "25682") |
| 95 | + @ExcelProperty("负责人名字") | ||
| 34 | private String ownerUserName; | 96 | private String ownerUserName; |
| 35 | @Schema(description = "负责人部门") | 97 | @Schema(description = "负责人部门") |
| 98 | + @ExcelProperty("负责人部门") | ||
| 36 | private String ownerUserDeptName; | 99 | private String ownerUserDeptName; |
| 37 | 100 | ||
| 101 | + @Schema(description = "地区编号", example = "1024") | ||
| 102 | + @ExcelProperty("地区编号") | ||
| 103 | + private Integer areaId; | ||
| 38 | @Schema(description = "地区名称", example = "北京市") | 104 | @Schema(description = "地区名称", example = "北京市") |
| 105 | + @ExcelProperty("地区名称") | ||
| 39 | private String areaName; | 106 | private String areaName; |
| 107 | + @Schema(description = "详细地址", example = "北京市成华大道") | ||
| 108 | + @ExcelProperty("详细地址") | ||
| 109 | + private String detailAddress; | ||
| 40 | 110 | ||
| 41 | @Schema(description = "最后跟进时间") | 111 | @Schema(description = "最后跟进时间") |
| 112 | + @ExcelProperty("最后跟进时间") | ||
| 42 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 113 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 43 | private LocalDateTime contactLastTime; | 114 | private LocalDateTime contactLastTime; |
| 44 | 115 | ||
| 116 | + @Schema(description = "下次联系时间") | ||
| 117 | + @ExcelProperty("下次联系时间") | ||
| 118 | + private LocalDateTime contactNextTime; | ||
| 119 | + | ||
| 45 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 120 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 121 | + @ExcelProperty("创建时间") | ||
| 46 | private LocalDateTime createTime; | 122 | private LocalDateTime createTime; |
| 47 | 123 | ||
| 48 | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | 124 | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 125 | + @ExcelProperty("更新时间") | ||
| 49 | private LocalDateTime updateTime; | 126 | private LocalDateTime updateTime; |
| 50 | 127 | ||
| 51 | - @Schema(description = "创建人") | 128 | + @Schema(description = "创建人", example = "1024") |
| 129 | + @ExcelProperty("创建人") | ||
| 52 | private String creator; | 130 | private String creator; |
| 53 | - @Schema(description = "创建人名字") | 131 | + @Schema(description = "创建人名字", example = "芋道源码") |
| 132 | + @ExcelProperty("创建人名字") | ||
| 54 | private String creatorName; | 133 | private String creatorName; |
| 55 | 134 | ||
| 56 | } | 135 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerBaseVO.java renamed to yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerSaveReqVO.java
| @@ -18,12 +18,12 @@ import java.time.LocalDateTime; | @@ -18,12 +18,12 @@ import java.time.LocalDateTime; | ||
| 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 19 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; | 19 | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; |
| 20 | 20 | ||
| 21 | -/** | ||
| 22 | - * 客户 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 23 | - * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 24 | - */ | 21 | +@Schema(description = "管理后台 - CRM 客户新增/修改 Request VO") |
| 25 | @Data | 22 | @Data |
| 26 | -public class CrmCustomerBaseVO { | 23 | +public class CrmCustomerSaveReqVO { |
| 24 | + | ||
| 25 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 26 | + private Long id; | ||
| 27 | 27 | ||
| 28 | @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | 28 | @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") |
| 29 | @DiffLogField(name = "客户名称") | 29 | @DiffLogField(name = "客户名称") |
| @@ -96,4 +96,7 @@ public class CrmCustomerBaseVO { | @@ -96,4 +96,7 @@ public class CrmCustomerBaseVO { | ||
| 96 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 96 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 97 | private LocalDateTime contactNextTime; | 97 | private LocalDateTime contactNextTime; |
| 98 | 98 | ||
| 99 | + @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 100 | + private Long ownerUserId; | ||
| 101 | + | ||
| 99 | } | 102 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/CrmCustomerUpdateReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.crm.controller.admin.customer.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 CrmCustomerUpdateReqVO extends CrmCustomerBaseVO { | ||
| 15 | - | ||
| 16 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563") | ||
| 17 | - @NotNull(message = "编号不能为空") | ||
| 18 | - private Long id; | ||
| 19 | - | ||
| 20 | -} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/customer/CrmCustomerConvert.java
| @@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.crm.convert.customer; | @@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.crm.convert.customer; | ||
| 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.ip.core.utils.AreaUtils; | 4 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 5 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerRespVO; |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigRespVO; | 8 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigRespVO; |
| 7 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; | 9 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.poolconfig.CrmCustomerPoolConfigSaveReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| @@ -29,9 +31,7 @@ public interface CrmCustomerConvert { | @@ -29,9 +31,7 @@ public interface CrmCustomerConvert { | ||
| 29 | 31 | ||
| 30 | CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); | 32 | CrmCustomerConvert INSTANCE = Mappers.getMapper(CrmCustomerConvert.class); |
| 31 | 33 | ||
| 32 | - CrmCustomerDO convert(CrmCustomerCreateReqVO bean); | ||
| 33 | - | ||
| 34 | - CrmCustomerDO convert(CrmCustomerUpdateReqVO bean); | 34 | + CrmCustomerDO convert(CrmCustomerSaveReqVO bean); |
| 35 | 35 | ||
| 36 | CrmCustomerRespVO convert(CrmCustomerDO bean); | 36 | CrmCustomerRespVO convert(CrmCustomerDO bean); |
| 37 | 37 | ||
| @@ -51,7 +51,7 @@ public interface CrmCustomerConvert { | @@ -51,7 +51,7 @@ public interface CrmCustomerConvert { | ||
| 51 | findAndThen(userMap, Long.parseLong(customer.getCreator()), user -> customer.setCreatorName(user.getNickname())); | 51 | findAndThen(userMap, Long.parseLong(customer.getCreator()), user -> customer.setCreatorName(user.getNickname())); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | - List<CrmCustomerExcelVO> convertList02(List<CrmCustomerDO> list); | 54 | + List<CrmCustomerRespVO> convertList02(List<CrmCustomerDO> list); |
| 55 | 55 | ||
| 56 | @Mapping(target = "bizId", source = "reqVO.id") | 56 | @Mapping(target = "bizId", source = "reqVO.id") |
| 57 | CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); | 57 | CrmPermissionTransferReqBO convert(CrmCustomerTransferReqVO reqVO, Long userId); |
| @@ -76,6 +76,4 @@ public interface CrmCustomerConvert { | @@ -76,6 +76,4 @@ public interface CrmCustomerConvert { | ||
| 76 | 76 | ||
| 77 | CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigSaveReqVO updateReqVO); | 77 | CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigSaveReqVO updateReqVO); |
| 78 | 78 | ||
| 79 | - List<CrmCustomerQueryAllRespVO> convertQueryAll(List<CrmCustomerDO> crmCustomerDO); | ||
| 80 | - | ||
| 81 | } | 79 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
| 1 | package cn.iocoder.yudao.module.crm.service.customer; | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 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.customer.vo.*; | 4 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLockReqVO; |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; | ||
| 5 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 6 | import jakarta.validation.Valid; | 9 | import jakarta.validation.Valid; |
| 7 | 10 | ||
| @@ -22,14 +25,14 @@ public interface CrmCustomerService { | @@ -22,14 +25,14 @@ public interface CrmCustomerService { | ||
| 22 | * @param userId 用户编号 | 25 | * @param userId 用户编号 |
| 23 | * @return 编号 | 26 | * @return 编号 |
| 24 | */ | 27 | */ |
| 25 | - Long createCustomer(@Valid CrmCustomerCreateReqVO createReqVO, Long userId); | 28 | + Long createCustomer(@Valid CrmCustomerSaveReqVO createReqVO, Long userId); |
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| 28 | * 更新客户 | 31 | * 更新客户 |
| 29 | * | 32 | * |
| 30 | * @param updateReqVO 更新信息 | 33 | * @param updateReqVO 更新信息 |
| 31 | */ | 34 | */ |
| 32 | - void updateCustomer(@Valid CrmCustomerUpdateReqVO updateReqVO); | 35 | + void updateCustomer(@Valid CrmCustomerSaveReqVO updateReqVO); |
| 33 | 36 | ||
| 34 | /** | 37 | /** |
| 35 | * 删除客户 | 38 | * 删除客户 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| 1 | package cn.iocoder.yudao.module.crm.service.customer; | 1 | package cn.iocoder.yudao.module.crm.service.customer; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.hutool.core.lang.Assert; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.*; | 8 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerLockReqVO; |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; | 12 | import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; | 14 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerLimitConfigDO; |
| @@ -24,7 +28,10 @@ import org.springframework.transaction.annotation.Transactional; | @@ -24,7 +28,10 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 24 | import org.springframework.validation.annotation.Validated; | 28 | import org.springframework.validation.annotation.Validated; |
| 25 | 29 | ||
| 26 | import java.time.LocalDateTime; | 30 | import java.time.LocalDateTime; |
| 27 | -import java.util.*; | 31 | +import java.util.ArrayList; |
| 32 | +import java.util.Collection; | ||
| 33 | +import java.util.Collections; | ||
| 34 | +import java.util.List; | ||
| 28 | 35 | ||
| 29 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 36 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 30 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | 37 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; |
| @@ -56,8 +63,10 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -56,8 +63,10 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 56 | 63 | ||
| 57 | @Override | 64 | @Override |
| 58 | @Transactional(rollbackFor = Exception.class) | 65 | @Transactional(rollbackFor = Exception.class) |
| 59 | - @LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户") // TODO @puhui999:创建了客户【客户名】,要记录进去;不然在展示操作日志的全列表,看不清楚是哪个客户哈; | ||
| 60 | - public Long createCustomer(CrmCustomerCreateReqVO createReqVO, Long userId) { | 66 | + @LogRecord(type = CRM_CUSTOMER, subType = "创建客户", bizNo = "{{#customerId}}", success = "创建了客户") |
| 67 | + // TODO @puhui999:创建了客户【客户名】,要记录进去;不然在展示操作日志的全列表,看不清楚是哪个客户哈; | ||
| 68 | + public Long createCustomer(CrmCustomerSaveReqVO createReqVO, Long userId) { | ||
| 69 | + createReqVO.setId(null); | ||
| 61 | // 1. 校验拥有客户是否到达上限 | 70 | // 1. 校验拥有客户是否到达上限 |
| 62 | validateCustomerExceedOwnerLimit(createReqVO.getOwnerUserId(), 1); | 71 | validateCustomerExceedOwnerLimit(createReqVO.getOwnerUserId(), 1); |
| 63 | 72 | ||
| @@ -81,8 +90,10 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -81,8 +90,10 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 81 | @Transactional(rollbackFor = Exception.class) | 90 | @Transactional(rollbackFor = Exception.class) |
| 82 | @LogRecord(type = CRM_CUSTOMER, subType = "更新客户", bizNo = "{{#updateReqVO.id}}", success = "更新了客户{_DIFF{#updateReqVO}}", extra = "{{#extra}}") | 91 | @LogRecord(type = CRM_CUSTOMER, subType = "更新客户", bizNo = "{{#updateReqVO.id}}", success = "更新了客户{_DIFF{#updateReqVO}}", extra = "{{#extra}}") |
| 83 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | 92 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 84 | - public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) { | ||
| 85 | - // TODO @puhui999:更新的时候,要把 updateReqVO 负责人设置为空,避免修改。 | 93 | + public void updateCustomer(CrmCustomerSaveReqVO updateReqVO) { |
| 94 | + Assert.notNull(updateReqVO.getId(), "客户编号不能为空"); | ||
| 95 | + // 更新的时候,要把 updateReqVO 负责人设置为空,避免修改。 | ||
| 96 | + updateReqVO.setOwnerUserId(null); | ||
| 86 | // 1. 校验存在 | 97 | // 1. 校验存在 |
| 87 | CrmCustomerDO oldCustomer = validateCustomerExists(updateReqVO.getId()); | 98 | CrmCustomerDO oldCustomer = validateCustomerExists(updateReqVO.getId()); |
| 88 | 99 | ||
| @@ -91,11 +102,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -91,11 +102,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 91 | customerMapper.updateById(updateObj); | 102 | customerMapper.updateById(updateObj); |
| 92 | 103 | ||
| 93 | // 3. 记录操作日志 | 104 | // 3. 记录操作日志 |
| 94 | - LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldCustomer, CrmCustomerUpdateReqVO.class)); | ||
| 95 | - // TODO 扩展信息测试 @puhui999:看着没啥问题,可以删除啦; | ||
| 96 | - HashMap<String, Object> extra = new HashMap<>(); | ||
| 97 | - extra.put("tips", "随便记录一点啦"); | ||
| 98 | - LogRecordContext.putVariable("extra", extra); | 105 | + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldCustomer, CrmCustomerSaveReqVO.class)); |
| 99 | } | 106 | } |
| 100 | 107 | ||
| 101 | @Override | 108 | @Override |
| @@ -197,7 +204,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -197,7 +204,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 197 | /** | 204 | /** |
| 198 | * 校验用户拥有的客户数量,是否到达上限 | 205 | * 校验用户拥有的客户数量,是否到达上限 |
| 199 | * | 206 | * |
| 200 | - * @param userId 用户编号 | 207 | + * @param userId 用户编号 |
| 201 | * @param newCount 附加数量 | 208 | * @param newCount 附加数量 |
| 202 | */ | 209 | */ |
| 203 | private void validateCustomerExceedOwnerLimit(Long userId, int newCount) { | 210 | private void validateCustomerExceedOwnerLimit(Long userId, int newCount) { |
| @@ -237,7 +244,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -237,7 +244,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 237 | 244 | ||
| 238 | @Override | 245 | @Override |
| 239 | @Transactional(rollbackFor = Exception.class) | 246 | @Transactional(rollbackFor = Exception.class) |
| 240 | - @LogRecord(type = CRM_CUSTOMER, subType = "客户放入公海", bizNo = "{{#id}}", success = "将客户放入了公海") // TODO @puhui999:将客户【】放入了公海 | 247 | + @LogRecord(type = CRM_CUSTOMER, subType = "客户放入公海", bizNo = "{{#id}}", success = "将客户放入了公海") |
| 248 | + // TODO @puhui999:将客户【】放入了公海 | ||
| 241 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) | 249 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) |
| 242 | public void putCustomerPool(Long id) { | 250 | public void putCustomerPool(Long id) { |
| 243 | // 1. 校验存在 | 251 | // 1. 校验存在 |
yudao-module-crm/yudao-module-crm-biz/src/test/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImplTest.java
| @@ -2,19 +2,17 @@ package cn.iocoder.yudao.module.crm.service.customer; | @@ -2,19 +2,17 @@ package cn.iocoder.yudao.module.crm.service.customer; | ||
| 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.customer.vo.CrmCustomerCreateReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; | 5 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO; | 6 | +import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; | 8 | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; |
| 10 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 9 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 10 | +import jakarta.annotation.Resource; | ||
| 11 | import org.junit.jupiter.api.Disabled; | 11 | import org.junit.jupiter.api.Disabled; |
| 12 | import org.junit.jupiter.api.Test; | 12 | import org.junit.jupiter.api.Test; |
| 13 | import org.springframework.boot.test.mock.mockito.MockBean; | 13 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 14 | import org.springframework.context.annotation.Import; | 14 | import org.springframework.context.annotation.Import; |
| 15 | 15 | ||
| 16 | -import jakarta.annotation.Resource; | ||
| 17 | - | ||
| 18 | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | 16 | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| 19 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 17 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| 20 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 18 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| @@ -47,7 +45,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | @@ -47,7 +45,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | ||
| 47 | @Test | 45 | @Test |
| 48 | public void testCreateCustomer_success() { | 46 | public void testCreateCustomer_success() { |
| 49 | // 准备参数 | 47 | // 准备参数 |
| 50 | - CrmCustomerCreateReqVO reqVO = randomPojo(CrmCustomerCreateReqVO.class); | 48 | + CrmCustomerSaveReqVO reqVO = randomPojo(CrmCustomerSaveReqVO.class); |
| 51 | 49 | ||
| 52 | // 调用 | 50 | // 调用 |
| 53 | Long customerId = customerService.createCustomer(reqVO, getLoginUserId()); | 51 | Long customerId = customerService.createCustomer(reqVO, getLoginUserId()); |
| @@ -64,7 +62,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | @@ -64,7 +62,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | ||
| 64 | CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class); | 62 | CrmCustomerDO dbCustomer = randomPojo(CrmCustomerDO.class); |
| 65 | customerMapper.insert(dbCustomer);// @Sql: 先插入出一条存在的数据 | 63 | customerMapper.insert(dbCustomer);// @Sql: 先插入出一条存在的数据 |
| 66 | // 准备参数 | 64 | // 准备参数 |
| 67 | - CrmCustomerUpdateReqVO reqVO = randomPojo(CrmCustomerUpdateReqVO.class, o -> { | 65 | + CrmCustomerSaveReqVO reqVO = randomPojo(CrmCustomerSaveReqVO.class, o -> { |
| 68 | o.setId(dbCustomer.getId()); // 设置更新的 ID | 66 | o.setId(dbCustomer.getId()); // 设置更新的 ID |
| 69 | }); | 67 | }); |
| 70 | 68 | ||
| @@ -78,7 +76,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | @@ -78,7 +76,7 @@ public class CrmCustomerServiceImplTest extends BaseDbUnitTest { | ||
| 78 | @Test | 76 | @Test |
| 79 | public void testUpdateCustomer_notExists() { | 77 | public void testUpdateCustomer_notExists() { |
| 80 | // 准备参数 | 78 | // 准备参数 |
| 81 | - CrmCustomerUpdateReqVO reqVO = randomPojo(CrmCustomerUpdateReqVO.class); | 79 | + CrmCustomerSaveReqVO reqVO = randomPojo(CrmCustomerSaveReqVO.class); |
| 82 | 80 | ||
| 83 | // 调用, 并断言异常 | 81 | // 调用, 并断言异常 |
| 84 | assertServiceException(() -> customerService.updateCustomer(reqVO), CUSTOMER_NOT_EXISTS); | 82 | assertServiceException(() -> customerService.updateCustomer(reqVO), CUSTOMER_NOT_EXISTS); |