diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java index 9824ec0052..52234369cd 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/CrmContactBusinessLinkController.java @@ -1,42 +1,33 @@ package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink; -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; -import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; -import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; -import org.springframework.security.access.prepost.PreAuthorize; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Operation; - -import javax.validation.constraints.*; -import javax.validation.*; -import javax.servlet.http.*; -import java.util.*; -import java.io.IOException; - -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkRespVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; +import cn.iocoder.yudao.module.crm.service.contactbusinesslink.CrmContactBusinessLinkService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; - -import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; -import cn.iocoder.yudao.module.crm.service.contactbusinesslink.CrmContactBusinessLinkService; - -@Tag(name = "管理后台 - 联系人商机关联") +@Tag(name = "管理后台 - CRM 联系人商机关联") @RestController @RequestMapping("/crm/contact-business-link") @Validated @@ -47,17 +38,20 @@ public class CrmContactBusinessLinkController { @Resource private CrmBusinessService crmBusinessService; + // TODO @zyna:createContactBusinessLink 和 createContactBusinessLinkBatch 是不是合并成一个接口?contactId、List @PostMapping("/create") @Operation(summary = "创建联系人商机关联") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") public CommonResult createContactBusinessLink(@Valid @RequestBody CrmContactBusinessLinkSaveReqVO createReqVO) { return success(contactBusinessLinkService.createContactBusinessLink(createReqVO)); } + @PostMapping("/create-batch") @Operation(summary = "创建联系人商机关联") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:create')") @Transactional(rollbackFor = Exception.class) - public CommonResult createContactBusinessLinkBatch(@Valid @RequestBody List createReqVO) { + public CommonResult createContactBusinessLinkBatch( + @Valid @RequestBody List createReqVO) { createReqVO.stream().forEach(item -> { CrmBusinessDO crmBusinessDO = crmBusinessService.getBusiness(item.getBusinessId()); if(crmBusinessDO == null){ @@ -67,6 +61,8 @@ public class CrmContactBusinessLinkController { contactBusinessLinkService.createContactBusinessLinkBatch(createReqVO); return success(true); } + + // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在更新。 @PutMapping("/update") @Operation(summary = "更新联系人商机关联") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:update')") @@ -74,6 +70,8 @@ public class CrmContactBusinessLinkController { contactBusinessLinkService.updateContactBusinessLink(updateReqVO); return success(true); } + + // TODO @zyna:删除,是不是传递 ids? @DeleteMapping("/delete-batch") @Operation(summary = "批量删除联系人商机关联") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:delete')") @@ -81,6 +79,8 @@ public class CrmContactBusinessLinkController { contactBusinessLinkService.deleteContactBusinessLink(deleteList); return success(true); } + + // TODO @zyna:这个接口是不是可以删除掉了哈?应该不存在单个读取; @GetMapping("/get") @Operation(summary = "获得联系人商机关联") @Parameter(name = "id", description = "编号", required = true, example = "1024") @@ -89,33 +89,27 @@ public class CrmContactBusinessLinkController { CrmContactBusinessLinkDO contactBusinessLink = contactBusinessLinkService.getContactBusinessLink(id); return success(BeanUtils.toBean(contactBusinessLink, CrmContactBusinessLinkRespVO.class)); } + + // TODO @zyna:这个可以转化下,使用客户编号去查询,就是使用 CrmBusinessController 的 getBusinessPageByCustomer 接口;目的是:复用 @GetMapping("/page-by-contact") @Operation(summary = "获得联系人商机关联") - @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") - public CommonResult> getContactBusinessLinkByContact(@Valid CrmContactBusinessLinkPageReqVO pageReqVO) { + public CommonResult> getContactBusinessLinkByContact( + @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { PageResult contactBusinessLink = contactBusinessLinkService.getContactBusinessLinkPageByContact(pageReqVO); return success(contactBusinessLink); } + + // TODO @zyna:这个优化下,搞到 CrmBusinessController 里去,加一个 CrmBusinessController 的 getBusinessPageByContact 接口;目的是: @GetMapping("/page") @Operation(summary = "获得联系人商机关联分页") @PreAuthorize("@ss.hasPermission('crm:contact-business-link:query')") - public CommonResult> getContactBusinessLinkPage(@Valid CrmContactBusinessLinkPageReqVO pageReqVO) { + public CommonResult> getContactBusinessLinkPage( + @Valid CrmContactBusinessLinkPageReqVO pageReqVO) { PageResult pageResult = contactBusinessLinkService.getContactBusinessLinkPage(pageReqVO); return success(BeanUtils.toBean(pageResult, CrmContactBusinessLinkRespVO.class)); } - @GetMapping("/export-excel") - @Operation(summary = "导出联系人商机关联 Excel") - @PreAuthorize("@ss.hasPermission('crm:contact-business-link:export')") - @OperateLog(type = EXPORT) - public void exportContactBusinessLinkExcel(@Valid CrmContactBusinessLinkPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = contactBusinessLinkService.getContactBusinessLinkPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "联系人商机关联.xls", "数据", CrmContactBusinessLinkRespVO.class, - BeanUtils.toBean(list, CrmContactBusinessLinkRespVO.class)); - } + // TODO @zyna:最终梳理完后,应该就 2 个接口,要不直接合并到 CrmContactController 中,不作为独立模块,就关联、接触关联。其实和 user 设置它有哪些岗位、部门是类似的。 } \ No newline at end of file diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java index 20a90279e8..c8e98c15a7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkPageReqVO.java @@ -1,24 +1,26 @@ package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; -import lombok.*; -import java.util.*; -import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@Schema(description = "管理后台 - 联系人商机关联分页 Request VO") +@Schema(description = "管理后台 - CRM 联系人商机关联分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class CrmContactBusinessLinkPageReqVO extends PageParam { - @Schema(description = "联系人id", example = "20878") + @Schema(description = "联系人编号", example = "20878") private Long contactId; - @Schema(description = "商机id", example = "7638") + @Schema(description = "商机编号", example = "7638") private Long businessId; @Schema(description = "创建时间") diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java index a31adb4d64..17aadf667e 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkRespVO.java @@ -1,32 +1,26 @@ package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; +import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; -import java.time.LocalDateTime; -import com.alibaba.excel.annotation.*; +import lombok.Data; -@Schema(description = "管理后台 - 联系人商机关联 Response VO") +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - CRM 联系人商机关联 Response VO") @Data -@ExcelIgnoreUnannotated public class CrmContactBusinessLinkRespVO { @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17220") @ExcelProperty("主键") private Long id; - @Schema(description = "联系人id", example = "20878") - @ExcelProperty("联系人id") + @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20878") private Long contactId; - @Schema(description = "商机id", example = "7638") - @ExcelProperty("商机id") + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7638") private Long businessId; @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("创建时间") private LocalDateTime createTime; } \ No newline at end of file diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java index 507924b7b0..1db4d27177 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contactbusinesslink/vo/CrmContactBusinessLinkSaveReqVO.java @@ -1,23 +1,22 @@ package cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import java.util.*; -import javax.validation.constraints.*; -import java.util.*; +import lombok.Data; -@Schema(description = "管理后台 - 联系人商机关联新增/修改 Request VO") +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - CRM 联系人商机关联新增/修改 Request VO") @Data public class CrmContactBusinessLinkSaveReqVO { @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17220") private Long id; - @Schema(description = "联系人id", example = "20878") + @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20878") @NotNull(message="联系人不能为空") private Long contactId; - @Schema(description = "商机id", example = "7638") + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7638") @NotNull(message="商机不能为空") private Long businessId; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contactbusinessslink/CrmContactBusinessLinkConvert.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contactbusinessslink/CrmContactBusinessLinkConvert.java index 6ffc3584ab..dfb71bad56 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contactbusinessslink/CrmContactBusinessLinkConvert.java +++ b/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; import java.util.List; +// TODO @zyna:使用 BeanUtils 慢慢替代现有的 mapstruct 哈 @Mapper public interface CrmContactBusinessLinkConvert { CrmContactBusinessLinkConvert INSTANCE = Mappers.getMapper(CrmContactBusinessLinkConvert.class); diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java index 4b3a5988a6..ad6c898d7a 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/contactbusinesslink/CrmContactBusinessLinkDO.java @@ -1,14 +1,16 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink; -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +// TODO @zyna:可以放到 contact 包下 /** - * 联系人商机关联 DO + * CRM 联系人商机关联 DO * * @author 芋道源码 */ @@ -28,11 +30,15 @@ public class CrmContactBusinessLinkDO extends BaseDO { @TableId private Long id; /** - * 联系人id + * 联系人编号 + * + * 关联 {@link CrmContactDO#getId()} 字段 */ private Long contactId; /** - * 商机id + * 商机编号 + * + * 关联 {@link CrmBusinessDO#getId()} 字段 */ private Long businessId; diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java index 6bcdd723b3..1692def86d 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contactbusinesslink/CrmContactBusinessLinkMapper.java @@ -1,16 +1,14 @@ package cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink; -import java.util.*; - import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; /** - * 联系人商机关联 Mapper + * CRM 联系人商机关联 Mapper * * @author 芋道源码 */ @@ -23,7 +21,7 @@ public interface CrmContactBusinessLinkMapper extends BaseMapperX selectPageByContact(CrmContactBusinessLinkPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(CrmContactBusinessLinkDO::getContactId, reqVO.getContactId()) diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java index c212a61006..34a62b3415 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkService.java @@ -1,16 +1,16 @@ package cn.iocoder.yudao.module.crm.service.contactbusinesslink; -import java.util.*; -import javax.validation.*; - -import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; +import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; + +import javax.validation.Valid; +import java.util.List; /** - * 联系人商机关联 Service 接口 + * CRM 联系人商机关联 Service 接口 * * @author 芋道源码 */ @@ -23,13 +23,14 @@ public interface CrmContactBusinessLinkService { * @return 编号 */ Long createContactBusinessLink(@Valid CrmContactBusinessLinkSaveReqVO createReqVO); + /** * 创建联系人商机关联 * * @param createReqVO 创建信息 - * @return 编号 */ void createContactBusinessLinkBatch(@Valid List createReqVO); + /** * 更新联系人商机关联 * @@ -51,6 +52,7 @@ public interface CrmContactBusinessLinkService { * @return 联系人商机关联 */ CrmContactBusinessLinkDO getContactBusinessLink(Long id); + /** * 获得联系人商机关联分页 * @@ -58,6 +60,7 @@ public interface CrmContactBusinessLinkService { * @return 联系人商机关联 */ PageResult getContactBusinessLinkPageByContact(CrmContactBusinessLinkPageReqVO pageReqVO); + /** * 获得联系人商机关联分页 * diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java index 879f8126ed..1ad91e6ec7 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contactbusinesslink/CrmContactBusinessLinkServiceImpl.java @@ -1,33 +1,28 @@ package cn.iocoder.yudao.module.crm.service.contactbusinesslink; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkPageReqVO; +import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.CrmContactBusinessLinkSaveReqVO; import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; import cn.iocoder.yudao.module.crm.convert.contactbusinessslink.CrmContactBusinessLinkConvert; import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; +import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; +import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; - -import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -import cn.iocoder.yudao.module.crm.controller.admin.contactbusinesslink.vo.*; -import cn.iocoder.yudao.module.crm.dal.dataobject.contactbusinesslink.CrmContactBusinessLinkDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; - -import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessLinkMapper; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTACT_BUSINESS_LINK_NOT_EXISTS; +// TODO @puhui999:数据权限的校验;每个操作; /** * 联系人商机关联 Service 实现类 * @@ -44,16 +39,16 @@ public class CrmContactBusinessLinkServiceImpl implements CrmContactBusinessLink @Override public Long createContactBusinessLink(CrmContactBusinessLinkSaveReqVO createReqVO) { - // 插入 CrmContactBusinessLinkDO contactBusinessLink = BeanUtils.toBean(createReqVO, CrmContactBusinessLinkDO.class); contactBusinessLinkMapper.insert(contactBusinessLink); - // 返回 return contactBusinessLink.getId(); } @Override public void createContactBusinessLinkBatch(List createReqVOList) { // 插入 + // TODO @zyna:如果已经关联过,不用重复插入; + // TODO @zyna:contact 和 business 存在校验,挪到这里,Controller 不用 @Transactional 注解,添加到这里哈。尽量业务都在 Service; List saveDoList = CrmContactBusinessLinkConvert.INSTANCE.convert(createReqVOList); contactBusinessLinkMapper.insertBatch(saveDoList); }