Commit a36fe8c40e815fdc92a07b0efbc00b901646d620
1 parent
21a3870c
📈 CRM:code review 联系人商机功能
Showing
9 changed files
with
98 additions
and
106 deletions
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 3 | 6 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 7 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkRespVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 4 | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 11 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 5 | 12 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 13 | +import cn.iocoder.yudao.module.crm.service.contactbusinesslink.CrmContactBusinessLinkService; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 6 | 18 | import org.springframework.transaction.annotation.Transactional; |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 8 | -import javax.annotation.Resource; | |
| 9 | 19 | import org.springframework.validation.annotation.Validated; |
| 10 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 11 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 12 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | -import io.swagger.v3.oas.annotations.Operation; | |
| 14 | - | |
| 15 | -import javax.validation.constraints.*; | |
| 16 | -import javax.validation.*; | |
| 17 | -import javax.servlet.http.*; | |
| 18 | -import java.util.*; | |
| 19 | -import java.io.IOException; | |
| 20 | +import org.springframework.web.bind.annotation.*; | |
| 20 | 21 | |
| 21 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 22 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 23 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 24 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 22 | +import javax.annotation.Resource; | |
| 23 | +import javax.validation.Valid; | |
| 24 | +import java.util.List; | |
| 25 | 25 | |
| 26 | 26 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 27 | 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 28 | - | |
| 29 | -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | |
| 30 | - | |
| 31 | -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | |
| 32 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 33 | 28 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; |
| 34 | 29 | |
| 35 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; | |
| 36 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 37 | -import cn.iocoder.yudao.module.crm.service.contactbusinesslink.CrmContactBusinessLinkService; | |
| 38 | - | |
| 39 | -@Tag(name = "管理后台 - 联系人商机关联") | |
| 30 | +@Tag(name = "管理后台 - CRM 联系人商机关联") | |
| 40 | 31 | @RestController |
| 41 | 32 | @RequestMapping("/crm/contact-business-link") |
| 42 | 33 | @Validated |
| ... | ... | @@ -47,17 +38,20 @@ public class CrmContactBusinessLinkController { |
| 47 | 38 | @Resource |
| 48 | 39 | private CrmBusinessService crmBusinessService; |
| 49 | 40 | |
| 41 | + // TODO @zyna:createContactBusinessLink 和 createContactBusinessLinkBatch 是不是合并成一个接口?contactId、List<businessId> | |
| 50 | 42 | @PostMapping("/create") |
| 51 | 43 | @Operation(summary = "创建联系人商机关联") |
| 52 | 44 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") |
| 53 | 45 | public CommonResult<Long> createContactBusinessLink(@Valid @RequestBody CrmContactBusinessLinkSaveReqVO createReqVO) { |
| 54 | 46 | return success(contactBusinessLinkService.createContactBusinessLink(createReqVO)); |
| 55 | 47 | } |
| 48 | + | |
| 56 | 49 | @PostMapping("/create-batch") |
| 57 | 50 | @Operation(summary = "创建联系人商机关联") |
| 58 | 51 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") |
| 59 | 52 | @Transactional(rollbackFor = Exception.class) |
| 60 | - public CommonResult<Boolean> createContactBusinessLinkBatch(@Valid @RequestBody List<CrmContactBusinessLinkSaveReqVO> createReqVO) { | |
| 53 | + public CommonResult<Boolean> createContactBusinessLinkBatch( | |
| 54 | + @Valid @RequestBody List<CrmContactBusinessLinkSaveReqVO> createReqVO) { | |
| 61 | 55 | createReqVO.stream().forEach(item -> { |
| 62 | 56 | CrmBusinessDO crmBusinessDO = crmBusinessService.getBusiness(item.getBusinessId()); |
| 63 | 57 | if(crmBusinessDO == null){ |
| ... | ... | @@ -67,6 +61,8 @@ public class CrmContactBusinessLinkController { |
| 67 | 61 | contactBusinessLinkService.createContactBusinessLinkBatch(createReqVO); |
| 68 | 62 | return success(true); |
| 69 | 63 | } |
| 64 | + | |
| 65 | + // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在更新。 | |
| 70 | 66 | @PutMapping("/update") |
| 71 | 67 | @Operation(summary = "更新联系人商机关联") |
| 72 | 68 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:update')") |
| ... | ... | @@ -74,6 +70,8 @@ public class CrmContactBusinessLinkController { |
| 74 | 70 | contactBusinessLinkService.updateContactBusinessLink(updateReqVO); |
| 75 | 71 | return success(true); |
| 76 | 72 | } |
| 73 | + | |
| 74 | + // TODO @zyna:删除,是不是传递 ids? | |
| 77 | 75 | @DeleteMapping("/delete-batch") |
| 78 | 76 | @Operation(summary = "批量删除联系人商机关联") |
| 79 | 77 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:delete')") |
| ... | ... | @@ -81,6 +79,8 @@ public class CrmContactBusinessLinkController { |
| 81 | 79 | contactBusinessLinkService.deleteContactBusinessLink(deleteList); |
| 82 | 80 | return success(true); |
| 83 | 81 | } |
| 82 | + | |
| 83 | + // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在单个读取; | |
| 84 | 84 | @GetMapping("/get") |
| 85 | 85 | @Operation(summary = "获得联系人商机关联") |
| 86 | 86 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| ... | ... | @@ -89,33 +89,27 @@ public class CrmContactBusinessLinkController { |
| 89 | 89 | CrmContactBusinessLinkDO contactBusinessLink = contactBusinessLinkService.getContactBusinessLink(id); |
| 90 | 90 | return success(BeanUtils.toBean(contactBusinessLink, CrmContactBusinessLinkRespVO.class)); |
| 91 | 91 | } |
| 92 | + | |
| 93 | + // TODO @zyna:这个可以转化下,使用客户编号去查询,就是使用 CrmBusinessController 的 getBusinessPageByCustomer 接口;目的是:复用 | |
| 92 | 94 | @GetMapping("/page-by-contact") |
| 93 | 95 | @Operation(summary = "获得联系人商机关联") |
| 94 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 95 | 96 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") |
| 96 | - public CommonResult<PageResult<CrmBusinessRespVO>> getContactBusinessLinkByContact(@Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 97 | + public CommonResult<PageResult<CrmBusinessRespVO>> getContactBusinessLinkByContact( | |
| 98 | + @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 97 | 99 | PageResult<CrmBusinessRespVO> contactBusinessLink = contactBusinessLinkService.getContactBusinessLinkPageByContact(pageReqVO); |
| 98 | 100 | return success(contactBusinessLink); |
| 99 | 101 | } |
| 102 | + | |
| 103 | + // TODO @zyna:这个优化下,搞到 CrmBusinessController 里去,加一个 CrmBusinessController 的 getBusinessPageByContact 接口;目的是: | |
| 100 | 104 | @GetMapping("/page") |
| 101 | 105 | @Operation(summary = "获得联系人商机关联分页") |
| 102 | 106 | @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") |
| 103 | - public CommonResult<PageResult<CrmContactBusinessLinkRespVO>> getContactBusinessLinkPage(@Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 107 | + public CommonResult<PageResult<CrmContactBusinessLinkRespVO>> getContactBusinessLinkPage( | |
| 108 | + @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { | |
| 104 | 109 | PageResult<CrmContactBusinessLinkDO> pageResult = contactBusinessLinkService.getContactBusinessLinkPage(pageReqVO); |
| 105 | 110 | return success(BeanUtils.toBean(pageResult, CrmContactBusinessLinkRespVO.class)); |
| 106 | 111 | } |
| 107 | 112 | |
| 108 | - @GetMapping("/export-excel") | |
| 109 | - @Operation(summary = "导出联系人商机关联 Excel") | |
| 110 | - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:export')") | |
| 111 | - @OperateLog(type = EXPORT) | |
| 112 | - public void exportContactBusinessLinkExcel(@Valid CrmContactBusinessLinkPageReqVO pageReqVO, | |
| 113 | - HttpServletResponse response) throws IOException { | |
| 114 | - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 115 | - List<CrmContactBusinessLinkDO> list = contactBusinessLinkService.getContactBusinessLinkPage(pageReqVO).getList(); | |
| 116 | - // 导出 Excel | |
| 117 | - ExcelUtils.write(response, "联系人商机关联.xls", "数据", CrmContactBusinessLinkRespVO.class, | |
| 118 | - BeanUtils.toBean(list, CrmContactBusinessLinkRespVO.class)); | |
| 119 | - } | |
| 113 | + // TODO @zyna:最终梳理完后,应该就 2 个接口,要不直接合并到 CrmContactController 中,不作为独立模块,就关联、接触关联。其实和 user 设置它有哪些岗位、部门是类似的。 | |
| 120 | 114 | |
| 121 | 115 | } |
| 122 | 116 | \ No newline at end of file | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.EqualsAndHashCode; | |
| 7 | +import lombok.ToString; | |
| 7 | 8 | import org.springframework.format.annotation.DateTimeFormat; |
| 9 | + | |
| 8 | 10 | import java.time.LocalDateTime; |
| 9 | 11 | |
| 10 | 12 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 13 | |
| 12 | -@Schema(description = "管理后台 - 联系人商机关联分页 Request VO") | |
| 14 | +@Schema(description = "管理后台 - CRM 联系人商机关联分页 Request VO") | |
| 13 | 15 | @Data |
| 14 | 16 | @EqualsAndHashCode(callSuper = true) |
| 15 | 17 | @ToString(callSuper = true) |
| 16 | 18 | public class CrmContactBusinessLinkPageReqVO extends PageParam { |
| 17 | 19 | |
| 18 | - @Schema(description = "联系人id", example = "20878") | |
| 20 | + @Schema(description = "联系人编号", example = "20878") | |
| 19 | 21 | private Long contactId; |
| 20 | 22 | |
| 21 | - @Schema(description = "商机id", example = "7638") | |
| 23 | + @Schema(description = "商机编号", example = "7638") | |
| 22 | 24 | private Long businessId; |
| 23 | 25 | |
| 24 | 26 | @Schema(description = "创建时间") | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; |
| 2 | 2 | |
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 3 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import java.util.*; | |
| 7 | -import org.springframework.format.annotation.DateTimeFormat; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 8 | 7 | import java.time.LocalDateTime; |
| 9 | -import com.alibaba.excel.annotation.*; | |
| 10 | 8 | |
| 11 | -@Schema(description = "管理后台 - 联系人商机关联 Response VO") | |
| 9 | +@Schema(description = "管理后台 - CRM 联系人商机关联 Response VO") | |
| 12 | 10 | @Data |
| 13 | -@ExcelIgnoreUnannotated | |
| 14 | 11 | public class CrmContactBusinessLinkRespVO { |
| 15 | 12 | |
| 16 | 13 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17220") |
| 17 | 14 | @ExcelProperty("主键") |
| 18 | 15 | private Long id; |
| 19 | 16 | |
| 20 | - @Schema(description = "联系人id", example = "20878") | |
| 21 | - @ExcelProperty("联系人id") | |
| 17 | + @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20878") | |
| 22 | 18 | private Long contactId; |
| 23 | 19 | |
| 24 | - @Schema(description = "商机id", example = "7638") | |
| 25 | - @ExcelProperty("商机id") | |
| 20 | + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7638") | |
| 26 | 21 | private Long businessId; |
| 27 | 22 | |
| 28 | 23 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 29 | - @ExcelProperty("创建时间") | |
| 30 | 24 | private LocalDateTime createTime; |
| 31 | 25 | |
| 32 | 26 | } |
| 33 | 27 | \ No newline at end of file | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import javax.validation.constraints.*; | |
| 7 | -import java.util.*; | |
| 4 | +import lombok.Data; | |
| 8 | 5 | |
| 9 | -@Schema(description = "管理后台 - 联系人商机关联新增/修改 Request VO") | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - CRM 联系人商机关联新增/修改 Request VO") | |
| 10 | 9 | @Data |
| 11 | 10 | public class CrmContactBusinessLinkSaveReqVO { |
| 12 | 11 | |
| 13 | 12 | @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17220") |
| 14 | 13 | private Long id; |
| 15 | 14 | |
| 16 | - @Schema(description = "联系人id", example = "20878") | |
| 15 | + @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20878") | |
| 17 | 16 | @NotNull(message="联系人不能为空") |
| 18 | 17 | private Long contactId; |
| 19 | 18 | |
| 20 | - @Schema(description = "商机id", example = "7638") | |
| 19 | + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7638") | |
| 21 | 20 | @NotNull(message="商机不能为空") |
| 22 | 21 | private Long businessId; |
| 23 | 22 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contactbusinessslink/CrmContactBusinessLinkConvert.java
| ... | ... | @@ -7,6 +7,7 @@ import org.mapstruct.factory.Mappers; |
| 7 | 7 | |
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | +// TODO @zyna:使用 BeanUtils 慢慢替代现有的 mapstruct 哈 | |
| 10 | 11 | @Mapper |
| 11 | 12 | public interface CrmContactBusinessLinkConvert { |
| 12 | 13 | CrmContactBusinessLinkConvert INSTANCE = Mappers.getMapper(CrmContactBusinessLinkConvert.class); | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink; |
| 2 | 2 | |
| 3 | -import lombok.*; | |
| 4 | -import java.util.*; | |
| 5 | -import java.time.LocalDateTime; | |
| 6 | -import java.time.LocalDateTime; | |
| 7 | -import com.baomidou.mybatisplus.annotation.*; | |
| 8 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | |
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | |
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 9 | +import lombok.*; | |
| 9 | 10 | |
| 11 | +// TODO @zyna:可以放到 contact 包下 | |
| 10 | 12 | /** |
| 11 | - * 联系人商机关联 DO | |
| 13 | + * CRM 联系人商机关联 DO | |
| 12 | 14 | * |
| 13 | 15 | * @author 芋道源码 |
| 14 | 16 | */ |
| ... | ... | @@ -28,11 +30,15 @@ public class CrmContactBusinessLinkDO extends BaseDO { |
| 28 | 30 | @TableId |
| 29 | 31 | private Long id; |
| 30 | 32 | /** |
| 31 | - * 联系人id | |
| 33 | + * 联系人编号 | |
| 34 | + * | |
| 35 | + * 关联 {@link CrmContactDO#getId()} 字段 | |
| 32 | 36 | */ |
| 33 | 37 | private Long contactId; |
| 34 | 38 | /** |
| 35 | - * 商机id | |
| 39 | + * 商机编号 | |
| 40 | + * | |
| 41 | + * 关联 {@link CrmBusinessDO#getId()} 字段 | |
| 36 | 42 | */ |
| 37 | 43 | private Long businessId; |
| 38 | 44 | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; |
| 9 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 10 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; | |
| 11 | 9 | |
| 12 | 10 | /** |
| 13 | - * 联系人商机关联 Mapper | |
| 11 | + * CRM 联系人商机关联 Mapper | |
| 14 | 12 | * |
| 15 | 13 | * @author 芋道源码 |
| 16 | 14 | */ |
| ... | ... | @@ -23,7 +21,7 @@ public interface CrmContactBusinessLinkMapper extends BaseMapperX<CrmContactBusi |
| 23 | 21 | .eqIfPresent(CrmContactBusinessLinkDO::getBusinessId, reqVO.getBusinessId()) |
| 24 | 22 | .betweenIfPresent(CrmContactBusinessLinkDO::getCreateTime, reqVO.getCreateTime()) |
| 25 | 23 | .orderByDesc(CrmContactBusinessLinkDO::getId)); |
| 26 | - } | |
| 24 | + } // TODO @zyna:方法和方法之间要有空行 | |
| 27 | 25 | default PageResult<CrmContactBusinessLinkDO> selectPageByContact(CrmContactBusinessLinkPageReqVO reqVO) { |
| 28 | 26 | return selectPage(reqVO, new LambdaQueryWrapperX<CrmContactBusinessLinkDO>() |
| 29 | 27 | .eqIfPresent(CrmContactBusinessLinkDO::getContactId, reqVO.getContactId()) | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.contactbusinesslink; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | - | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | 4 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 7 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; | |
| 5 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; |
| 9 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 10 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 8 | + | |
| 9 | +import javax.validation.Valid; | |
| 10 | +import java.util.List; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * 联系人商机关联 Service 接口 | |
| 13 | + * CRM 联系人商机关联 Service 接口 | |
| 14 | 14 | * |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| ... | ... | @@ -23,13 +23,14 @@ public interface CrmContactBusinessLinkService { |
| 23 | 23 | * @return 编号 |
| 24 | 24 | */ |
| 25 | 25 | Long createContactBusinessLink(@Valid CrmContactBusinessLinkSaveReqVO createReqVO); |
| 26 | + | |
| 26 | 27 | /** |
| 27 | 28 | * 创建联系人商机关联 |
| 28 | 29 | * |
| 29 | 30 | * @param createReqVO 创建信息 |
| 30 | - * @return 编号 | |
| 31 | 31 | */ |
| 32 | 32 | void createContactBusinessLinkBatch(@Valid List<CrmContactBusinessLinkSaveReqVO> createReqVO); |
| 33 | + | |
| 33 | 34 | /** |
| 34 | 35 | * 更新联系人商机关联 |
| 35 | 36 | * |
| ... | ... | @@ -51,6 +52,7 @@ public interface CrmContactBusinessLinkService { |
| 51 | 52 | * @return 联系人商机关联 |
| 52 | 53 | */ |
| 53 | 54 | CrmContactBusinessLinkDO getContactBusinessLink(Long id); |
| 55 | + | |
| 54 | 56 | /** |
| 55 | 57 | * 获得联系人商机关联分页 |
| 56 | 58 | * |
| ... | ... | @@ -58,6 +60,7 @@ public interface CrmContactBusinessLinkService { |
| 58 | 60 | * @return 联系人商机关联 |
| 59 | 61 | */ |
| 60 | 62 | PageResult<CrmBusinessRespVO> getContactBusinessLinkPageByContact(CrmContactBusinessLinkPageReqVO pageReqVO); |
| 63 | + | |
| 61 | 64 | /** |
| 62 | 65 | * 获得联系人商机关联分页 |
| 63 | 66 | * | ... | ... |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.crm.service.contactbusinesslink; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 5 | 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 8 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; | |
| 6 | 10 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 7 | 11 | import cn.iocoder.yudao.module.crm.convert.contactbusinessslink.CrmContactBusinessLinkConvert; |
| 8 | 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 13 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 14 | +import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; | |
| 9 | 15 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 10 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 11 | 16 | import org.springframework.stereotype.Service; |
| 12 | - | |
| 13 | -import javax.annotation.Resource; | |
| 14 | - | |
| 15 | 17 | import org.springframework.validation.annotation.Validated; |
| 16 | -import org.springframework.transaction.annotation.Transactional; | |
| 17 | - | |
| 18 | -import java.util.*; | |
| 19 | 18 | |
| 20 | -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; | |
| 21 | -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; | |
| 22 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 23 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 24 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 25 | - | |
| 26 | -import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; | |
| 19 | +import javax.annotation.Resource; | |
| 20 | +import java.util.List; | |
| 27 | 21 | |
| 28 | 22 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 29 | -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | |
| 23 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTACT_BUSINESS_LINK_NOT_EXISTS; | |
| 30 | 24 | |
| 25 | +// TODO @puhui999:数据权限的校验;每个操作; | |
| 31 | 26 | /** |
| 32 | 27 | * 联系人商机关联 Service 实现类 |
| 33 | 28 | * |
| ... | ... | @@ -44,16 +39,16 @@ public class CrmContactBusinessLinkServiceImpl implements CrmContactBusinessLink |
| 44 | 39 | |
| 45 | 40 | @Override |
| 46 | 41 | public Long createContactBusinessLink(CrmContactBusinessLinkSaveReqVO createReqVO) { |
| 47 | - // 插入 | |
| 48 | 42 | CrmContactBusinessLinkDO contactBusinessLink = BeanUtils.toBean(createReqVO, CrmContactBusinessLinkDO.class); |
| 49 | 43 | contactBusinessLinkMapper.insert(contactBusinessLink); |
| 50 | - // 返回 | |
| 51 | 44 | return contactBusinessLink.getId(); |
| 52 | 45 | } |
| 53 | 46 | |
| 54 | 47 | @Override |
| 55 | 48 | public void createContactBusinessLinkBatch(List<CrmContactBusinessLinkSaveReqVO> createReqVOList) { |
| 56 | 49 | // 插入 |
| 50 | + // TODO @zyna:如果已经关联过,不用重复插入; | |
| 51 | + // TODO @zyna:contact 和 business 存在校验,挪到这里,Controller 不用 @Transactional 注解,添加到这里哈。尽量业务都在 Service; | |
| 57 | 52 | List<CrmContactBusinessLinkDO> saveDoList = CrmContactBusinessLinkConvert.INSTANCE.convert(createReqVOList); |
| 58 | 53 | contactBusinessLinkMapper.insertBatch(saveDoList); |
| 59 | 54 | } | ... | ... |