Commit af5fbb6ff426c07f5ed02ef60f537c26a7d211f1
1 parent
47a69886
CRM: TransferReqVO bizId -> id、修复商机转移错误
Showing
13 changed files
with
42 additions
and
76 deletions
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/handler/SelectSheetWriteHandler.java
| @@ -60,32 +60,17 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | @@ -60,32 +60,17 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | // 解析下拉数据 | 62 | // 解析下拉数据 |
| 63 | - Map<String, Field> excelPropertyFields = getFieldsWithAnnotation(head, ExcelProperty.class); | ||
| 64 | - Map<String, Field> excelColumnSelectFields = getFieldsWithAnnotation(head, ExcelColumnSelect.class); | ||
| 65 | int colIndex = 0; | 63 | int colIndex = 0; |
| 66 | - for (String fieldName : excelPropertyFields.keySet()) { | ||
| 67 | - Field field = excelColumnSelectFields.get(fieldName); | ||
| 68 | - if (field != null) { | ||
| 69 | - // ExcelProperty 有一个自定义列索引的属性 index 兼容这个字段 | ||
| 70 | - int index = field.getAnnotation(ExcelProperty.class).index(); | ||
| 71 | - if (index != -1) { | ||
| 72 | - colIndex = index; | 64 | + for (Field field : head.getDeclaredFields()) { |
| 65 | + if (field.isAnnotationPresent(ExcelColumnSelect.class)) { | ||
| 66 | + ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class); | ||
| 67 | + if (excelProperty != null && excelProperty.index() != -1) { | ||
| 68 | + colIndex = excelProperty.index(); | ||
| 73 | } | 69 | } |
| 74 | - buildSelectDataList(colIndex, field); | 70 | + getSelectDataList(colIndex, field); |
| 75 | } | 71 | } |
| 76 | colIndex++; | 72 | colIndex++; |
| 77 | } | 73 | } |
| 78 | - // TODO @puhui999:感觉可以 head 循环 field,如果有 ExcelColumnSelect 则进行处理;而 ExcelProperty 可能是非必须的。回答:主要是用于定位到列索引;补充:可以看看下面这样写? | ||
| 79 | -// for (Field field : head.getDeclaredFields()) { | ||
| 80 | -// if (field.isAnnotationPresent(ExcelColumnSelect.class)) { | ||
| 81 | -// ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class); | ||
| 82 | -// if (excelProperty != null) { | ||
| 83 | -// colIndex = excelProperty.index(); | ||
| 84 | -// } | ||
| 85 | -// getSelectDataList(colIndex, field); | ||
| 86 | -// } | ||
| 87 | -// colIndex++; | ||
| 88 | -// } | ||
| 89 | } | 74 | } |
| 90 | 75 | ||
| 91 | /** | 76 | /** |
| @@ -94,7 +79,7 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | @@ -94,7 +79,7 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | ||
| 94 | * @param colIndex 列索引 | 79 | * @param colIndex 列索引 |
| 95 | * @param field 字段 | 80 | * @param field 字段 |
| 96 | */ | 81 | */ |
| 97 | - private void buildSelectDataList(int colIndex, Field field) { | 82 | + private void getSelectDataList(int colIndex, Field field) { |
| 98 | ExcelColumnSelect columnSelect = field.getAnnotation(ExcelColumnSelect.class); | 83 | ExcelColumnSelect columnSelect = field.getAnnotation(ExcelColumnSelect.class); |
| 99 | String dictType = columnSelect.dictType(); | 84 | String dictType = columnSelect.dictType(); |
| 100 | String functionName = columnSelect.functionName(); | 85 | String functionName = columnSelect.functionName(); |
| @@ -174,15 +159,4 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | @@ -174,15 +159,4 @@ public class SelectSheetWriteHandler implements SheetWriteHandler { | ||
| 174 | writeSheetHolder.getSheet().addValidationData(validation); | 159 | writeSheetHolder.getSheet().addValidationData(validation); |
| 175 | } | 160 | } |
| 176 | 161 | ||
| 177 | - public static Map<String, Field> getFieldsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotationClass) { | ||
| 178 | - Map<String, Field> annotatedFields = new LinkedHashMap<>(); | ||
| 179 | - Field[] fields = clazz.getDeclaredFields(); | ||
| 180 | - for (Field field : fields) { | ||
| 181 | - if (field.isAnnotationPresent(annotationClass)) { | ||
| 182 | - annotatedFields.put(field.getName(), field); | ||
| 183 | - } | ||
| 184 | - } | ||
| 185 | - return annotatedFields; | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | } | 162 | } |
| 189 | \ No newline at end of file | 163 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessTransferReqVO.java
| @@ -13,10 +13,9 @@ import lombok.NoArgsConstructor; | @@ -13,10 +13,9 @@ import lombok.NoArgsConstructor; | ||
| 13 | @AllArgsConstructor | 13 | @AllArgsConstructor |
| 14 | public class CrmBusinessTransferReqVO { | 14 | public class CrmBusinessTransferReqVO { |
| 15 | 15 | ||
| 16 | - // TODO @puhui999:这里最好还是用 id 哈,主要还是在 Business 业务里 | ||
| 17 | @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 16 | @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 18 | @NotNull(message = "商机编号不能为空") | 17 | @NotNull(message = "商机编号不能为空") |
| 19 | - private Long bizId; | 18 | + private Long id; |
| 20 | 19 | ||
| 21 | /** | 20 | /** |
| 22 | * 新负责人的用户编号 | 21 | * 新负责人的用户编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/clue/vo/CrmClueTransferReqVO.java
| @@ -12,7 +12,7 @@ public class CrmClueTransferReqVO { | @@ -12,7 +12,7 @@ public class CrmClueTransferReqVO { | ||
| 12 | 12 | ||
| 13 | @Schema(description = "线索编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 13 | @Schema(description = "线索编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 14 | @NotNull(message = "线索编号不能为空") | 14 | @NotNull(message = "线索编号不能为空") |
| 15 | - private Long bizId; | 15 | + private Long id; |
| 16 | 16 | ||
| 17 | @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 17 | @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 18 | @NotNull(message = "新负责人的用户编号不能为空") | 18 | @NotNull(message = "新负责人的用户编号不能为空") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/vo/CrmContactTransferReqVO.java
| @@ -16,7 +16,7 @@ public class CrmContactTransferReqVO { | @@ -16,7 +16,7 @@ public class CrmContactTransferReqVO { | ||
| 16 | 16 | ||
| 17 | @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 17 | @Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 18 | @NotNull(message = "联系人编号不能为空") | 18 | @NotNull(message = "联系人编号不能为空") |
| 19 | - private Long bizId; | 19 | + private Long id; |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * 新负责人的用户编号 | 22 | * 新负责人的用户编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/contract/CrmContractTransferReqVO.java
| @@ -17,7 +17,7 @@ public class CrmContractTransferReqVO { | @@ -17,7 +17,7 @@ public class CrmContractTransferReqVO { | ||
| 17 | 17 | ||
| 18 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 18 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 19 | @NotNull(message = "联系人编号不能为空") | 19 | @NotNull(message = "联系人编号不能为空") |
| 20 | - private Long bizId; | 20 | + private Long id; |
| 21 | 21 | ||
| 22 | @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 22 | @Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 23 | @NotNull(message = "新负责人的用户编号不能为空") | 23 | @NotNull(message = "新负责人的用户编号不能为空") |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/vo/customer/CrmCustomerTransferReqVO.java
| @@ -13,7 +13,7 @@ public class CrmCustomerTransferReqVO { | @@ -13,7 +13,7 @@ public class CrmCustomerTransferReqVO { | ||
| 13 | 13 | ||
| 14 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 14 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 15 | @NotNull(message = "客户编号不能为空") | 15 | @NotNull(message = "客户编号不能为空") |
| 16 | - private Long bizId; | 16 | + private Long id; |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * 新负责人的用户编号 | 19 | * 新负责人的用户编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contact/CrmContactMapper.java
| @@ -74,10 +74,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> { | @@ -74,10 +74,7 @@ public interface CrmContactMapper extends BaseMapperX<CrmContactDO> { | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | default List<CrmContactDO> selectListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId) { | 76 | default List<CrmContactDO> selectListByCustomerIdOwnerUserId(Long customerId, Long ownerUserId) { |
| 77 | - // TODO @puhui999:父类有 selectList,查询 2 个字段的简化方法哈,可以用下 | ||
| 78 | - return selectList(new LambdaQueryWrapperX<CrmContactDO>() | ||
| 79 | - .eq(CrmContactDO::getCustomerId, customerId) | ||
| 80 | - .eq(CrmContactDO::getOwnerUserId, ownerUserId)); | 77 | + return selectList(CrmContactDO::getCustomerId, customerId, CrmContactDO::getOwnerUserId, ownerUserId); |
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | } | 80 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/framework/excel/core/AreaExcelColumnSelectFunction.java
| @@ -8,9 +8,7 @@ import org.springframework.stereotype.Service; | @@ -8,9 +8,7 @@ import org.springframework.stereotype.Service; | ||
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| 11 | - * Excel 所属地区列下拉数据源获取接口实现类 | ||
| 12 | - * | ||
| 13 | - * // TODO @puhui999:类名叫:地区下拉框数据源的 {@link ExcelColumnSelectFunction} 实现类,这样看起来会更简洁一点哈 | 11 | + * 地区下拉框数据源的 {@link ExcelColumnSelectFunction} 实现类 |
| 14 | * | 12 | * |
| 15 | * @author HUIHUI | 13 | * @author HUIHUI |
| 16 | */ | 14 | */ |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -292,18 +292,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -292,18 +292,18 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 292 | 292 | ||
| 293 | @Override | 293 | @Override |
| 294 | @Transactional(rollbackFor = Exception.class) | 294 | @Transactional(rollbackFor = Exception.class) |
| 295 | - @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.bizId}}", | 295 | + @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.id}}", |
| 296 | success = CRM_BUSINESS_TRANSFER_SUCCESS) | 296 | success = CRM_BUSINESS_TRANSFER_SUCCESS) |
| 297 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#reqVO.bizId", level = CrmPermissionLevelEnum.OWNER) | 297 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_BUSINESS, bizId = "#reqVO.id", level = CrmPermissionLevelEnum.OWNER) |
| 298 | public void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId) { | 298 | public void transferBusiness(CrmBusinessTransferReqVO reqVO, Long userId) { |
| 299 | // 1 校验商机是否存在 | 299 | // 1 校验商机是否存在 |
| 300 | - CrmBusinessDO business = validateBusinessExists(reqVO.getBizId()); | 300 | + CrmBusinessDO business = validateBusinessExists(reqVO.getId()); |
| 301 | 301 | ||
| 302 | // 2.1 数据权限转移 | 302 | // 2.1 数据权限转移 |
| 303 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_BUSINESS.getType(), | 303 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_BUSINESS.getType(), |
| 304 | - reqVO.getBizId(), reqVO.getNewOwnerUserId(), CrmPermissionLevelEnum.OWNER.getLevel())); | 304 | + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); |
| 305 | // 2.2 设置新的负责人 | 305 | // 2.2 设置新的负责人 |
| 306 | - businessMapper.updateOwnerUserIdById(reqVO.getBizId(), reqVO.getNewOwnerUserId()); | 306 | + businessMapper.updateOwnerUserIdById(reqVO.getId(), reqVO.getNewOwnerUserId()); |
| 307 | 307 | ||
| 308 | // 记录操作日志上下文 | 308 | // 记录操作日志上下文 |
| 309 | LogRecordContext.putVariable("business", business); | 309 | LogRecordContext.putVariable("business", business); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| @@ -159,18 +159,18 @@ public class CrmClueServiceImpl implements CrmClueService { | @@ -159,18 +159,18 @@ public class CrmClueServiceImpl implements CrmClueService { | ||
| 159 | 159 | ||
| 160 | @Override | 160 | @Override |
| 161 | @Transactional(rollbackFor = Exception.class) | 161 | @Transactional(rollbackFor = Exception.class) |
| 162 | - @LogRecord(type = CRM_CLUE_TYPE, subType = CRM_CLUE_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.bizId}}", | 162 | + @LogRecord(type = CRM_CLUE_TYPE, subType = CRM_CLUE_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.id}}", |
| 163 | success = CRM_CLUE_TRANSFER_SUCCESS) | 163 | success = CRM_CLUE_TRANSFER_SUCCESS) |
| 164 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CLUE, bizId = "#reqVO.bizId", level = CrmPermissionLevelEnum.OWNER) | 164 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CLUE, bizId = "#reqVO.id", level = CrmPermissionLevelEnum.OWNER) |
| 165 | public void transferClue(CrmClueTransferReqVO reqVO, Long userId) { | 165 | public void transferClue(CrmClueTransferReqVO reqVO, Long userId) { |
| 166 | // 1 校验线索是否存在 | 166 | // 1 校验线索是否存在 |
| 167 | - CrmClueDO clue = validateClueExists(reqVO.getBizId()); | 167 | + CrmClueDO clue = validateClueExists(reqVO.getId()); |
| 168 | 168 | ||
| 169 | // 2.1 数据权限转移 | 169 | // 2.1 数据权限转移 |
| 170 | crmPermissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CLUE.getType(), | 170 | crmPermissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CLUE.getType(), |
| 171 | - reqVO.getBizId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); | 171 | + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); |
| 172 | // 2.2 设置新的负责人 | 172 | // 2.2 设置新的负责人 |
| 173 | - clueMapper.updateById(new CrmClueDO().setId(reqVO.getBizId()).setOwnerUserId(reqVO.getNewOwnerUserId())); | 173 | + clueMapper.updateById(new CrmClueDO().setId(reqVO.getId()).setOwnerUserId(reqVO.getNewOwnerUserId())); |
| 174 | 174 | ||
| 175 | // 3. 记录转移日志 | 175 | // 3. 记录转移日志 |
| 176 | LogRecordContext.putVariable("clue", clue); | 176 | LogRecordContext.putVariable("clue", clue); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.service.contact; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.crm.service.contact; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.collection.ListUtil; | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | -import cn.hutool.extra.spring.SpringUtil; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactBusinessReqVO; |
| @@ -18,7 +17,6 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPerm | @@ -18,7 +17,6 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPerm | ||
| 18 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 19 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | 18 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 20 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 21 | -import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerServiceImpl; | ||
| 22 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 20 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 23 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 21 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 24 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 22 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| @@ -179,18 +177,18 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -179,18 +177,18 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 179 | 177 | ||
| 180 | @Override | 178 | @Override |
| 181 | @Transactional(rollbackFor = Exception.class) | 179 | @Transactional(rollbackFor = Exception.class) |
| 182 | - @LogRecord(type = CRM_CONTACT_TYPE, subType = CRM_CONTACT_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.bizId}}", | 180 | + @LogRecord(type = CRM_CONTACT_TYPE, subType = CRM_CONTACT_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.id}}", |
| 183 | success = CRM_CONTACT_TRANSFER_SUCCESS) | 181 | success = CRM_CONTACT_TRANSFER_SUCCESS) |
| 184 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#reqVO.bizId", level = CrmPermissionLevelEnum.OWNER) | 182 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACT, bizId = "#reqVO.id", level = CrmPermissionLevelEnum.OWNER) |
| 185 | public void transferContact(CrmContactTransferReqVO reqVO, Long userId) { | 183 | public void transferContact(CrmContactTransferReqVO reqVO, Long userId) { |
| 186 | // 1 校验联系人是否存在 | 184 | // 1 校验联系人是否存在 |
| 187 | - CrmContactDO contact = validateContactExists(reqVO.getBizId()); | 185 | + CrmContactDO contact = validateContactExists(reqVO.getId()); |
| 188 | 186 | ||
| 189 | // 2.1 数据权限转移 | 187 | // 2.1 数据权限转移 |
| 190 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CONTACT.getType(), | 188 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CONTACT.getType(), |
| 191 | - reqVO.getBizId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); | 189 | + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); |
| 192 | // 2.2 设置新的负责人 | 190 | // 2.2 设置新的负责人 |
| 193 | - contactMapper.updateById(new CrmContactDO().setId(reqVO.getBizId()).setOwnerUserId(reqVO.getNewOwnerUserId())); | 191 | + contactMapper.updateById(new CrmContactDO().setId(reqVO.getId()).setOwnerUserId(reqVO.getNewOwnerUserId())); |
| 194 | 192 | ||
| 195 | // 3. 记录转移日志 | 193 | // 3. 记录转移日志 |
| 196 | LogRecordContext.putVariable("contact", contact); | 194 | LogRecordContext.putVariable("contact", contact); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| @@ -252,18 +252,18 @@ public class CrmContractServiceImpl implements CrmContractService { | @@ -252,18 +252,18 @@ public class CrmContractServiceImpl implements CrmContractService { | ||
| 252 | 252 | ||
| 253 | @Override | 253 | @Override |
| 254 | @Transactional(rollbackFor = Exception.class) | 254 | @Transactional(rollbackFor = Exception.class) |
| 255 | - @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.bizId}}", | 255 | + @LogRecord(type = CRM_CONTRACT_TYPE, subType = CRM_CONTRACT_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.id}}", |
| 256 | success = CRM_CONTRACT_TRANSFER_SUCCESS) | 256 | success = CRM_CONTRACT_TRANSFER_SUCCESS) |
| 257 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#reqVO.bizId", level = CrmPermissionLevelEnum.OWNER) | 257 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTRACT, bizId = "#reqVO.id", level = CrmPermissionLevelEnum.OWNER) |
| 258 | public void transferContract(CrmContractTransferReqVO reqVO, Long userId) { | 258 | public void transferContract(CrmContractTransferReqVO reqVO, Long userId) { |
| 259 | // 1. 校验合同是否存在 | 259 | // 1. 校验合同是否存在 |
| 260 | - CrmContractDO contract = validateContractExists(reqVO.getBizId()); | 260 | + CrmContractDO contract = validateContractExists(reqVO.getId()); |
| 261 | 261 | ||
| 262 | // 2.1 数据权限转移 | 262 | // 2.1 数据权限转移 |
| 263 | crmPermissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CONTRACT.getType(), | 263 | crmPermissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CONTRACT.getType(), |
| 264 | - reqVO.getBizId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); | 264 | + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); |
| 265 | // 2.2 设置负责人 | 265 | // 2.2 设置负责人 |
| 266 | - contractMapper.updateById(new CrmContractDO().setId(reqVO.getBizId()).setOwnerUserId(reqVO.getNewOwnerUserId())); | 266 | + contractMapper.updateById(new CrmContractDO().setId(reqVO.getId()).setOwnerUserId(reqVO.getNewOwnerUserId())); |
| 267 | 267 | ||
| 268 | // 3. 记录转移日志 | 268 | // 3. 记录转移日志 |
| 269 | LogRecordContext.putVariable("contract", contract); | 269 | LogRecordContext.putVariable("contract", contract); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| @@ -199,19 +199,19 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -199,19 +199,19 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 199 | 199 | ||
| 200 | @Override | 200 | @Override |
| 201 | @Transactional(rollbackFor = Exception.class) | 201 | @Transactional(rollbackFor = Exception.class) |
| 202 | - @LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.bizId}}", | 202 | + @LogRecord(type = CRM_CUSTOMER_TYPE, subType = CRM_CUSTOMER_TRANSFER_SUB_TYPE, bizNo = "{{#reqVO.id}}", |
| 203 | success = CRM_CUSTOMER_TRANSFER_SUCCESS) | 203 | success = CRM_CUSTOMER_TRANSFER_SUCCESS) |
| 204 | - @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#reqVO.bizId", level = CrmPermissionLevelEnum.OWNER) | 204 | + @CrmPermission(bizType = CrmBizTypeEnum.CRM_CUSTOMER, bizId = "#reqVO.id", level = CrmPermissionLevelEnum.OWNER) |
| 205 | public void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId) { | 205 | public void transferCustomer(CrmCustomerTransferReqVO reqVO, Long userId) { |
| 206 | // 1.1 校验客户是否存在 | 206 | // 1.1 校验客户是否存在 |
| 207 | - CrmCustomerDO customer = validateCustomerExists(reqVO.getBizId()); | 207 | + CrmCustomerDO customer = validateCustomerExists(reqVO.getId()); |
| 208 | // 1.2 校验拥有客户是否到达上限 | 208 | // 1.2 校验拥有客户是否到达上限 |
| 209 | validateCustomerExceedOwnerLimit(reqVO.getNewOwnerUserId(), 1); | 209 | validateCustomerExceedOwnerLimit(reqVO.getNewOwnerUserId(), 1); |
| 210 | // 2.1 数据权限转移 | 210 | // 2.1 数据权限转移 |
| 211 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CUSTOMER.getType(), | 211 | permissionService.transferPermission(new CrmPermissionTransferReqBO(userId, CrmBizTypeEnum.CRM_CUSTOMER.getType(), |
| 212 | - reqVO.getBizId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); | 212 | + reqVO.getId(), reqVO.getNewOwnerUserId(), reqVO.getOldOwnerPermissionLevel())); |
| 213 | // 2.2 转移后重新设置负责人 | 213 | // 2.2 转移后重新设置负责人 |
| 214 | - customerMapper.updateById(new CrmCustomerDO().setId(reqVO.getBizId()) | 214 | + customerMapper.updateById(new CrmCustomerDO().setId(reqVO.getId()) |
| 215 | .setOwnerUserId(reqVO.getNewOwnerUserId()).setOwnerTime(LocalDateTime.now())); | 215 | .setOwnerUserId(reqVO.getNewOwnerUserId()).setOwnerTime(LocalDateTime.now())); |
| 216 | 216 | ||
| 217 | // 2.3 同时转移 | 217 | // 2.3 同时转移 |
| @@ -231,21 +231,21 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -231,21 +231,21 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 231 | */ | 231 | */ |
| 232 | private void transfer(CrmCustomerTransferReqVO reqVO, Long userId) { | 232 | private void transfer(CrmCustomerTransferReqVO reqVO, Long userId) { |
| 233 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTACT.getType())) { | 233 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTACT.getType())) { |
| 234 | - List<CrmContactDO> contactList = contactService.getContactListByCustomerIdOwnerUserId(reqVO.getBizId(), userId); | 234 | + List<CrmContactDO> contactList = contactService.getContactListByCustomerIdOwnerUserId(reqVO.getId(), userId); |
| 235 | contactList.forEach(item -> { | 235 | contactList.forEach(item -> { |
| 236 | contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), | 236 | contactService.transferContact(new CrmContactTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), |
| 237 | reqVO.getOldOwnerPermissionLevel()), userId); | 237 | reqVO.getOldOwnerPermissionLevel()), userId); |
| 238 | }); | 238 | }); |
| 239 | } | 239 | } |
| 240 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_BUSINESS.getType())) { | 240 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_BUSINESS.getType())) { |
| 241 | - List<CrmBusinessDO> businessList = businessService.getBusinessListByCustomerIdOwnerUserId(reqVO.getBizId(), userId); | 241 | + List<CrmBusinessDO> businessList = businessService.getBusinessListByCustomerIdOwnerUserId(reqVO.getId(), userId); |
| 242 | businessList.forEach(item -> { | 242 | businessList.forEach(item -> { |
| 243 | businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), | 243 | businessService.transferBusiness(new CrmBusinessTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), |
| 244 | reqVO.getOldOwnerPermissionLevel()), userId); | 244 | reqVO.getOldOwnerPermissionLevel()), userId); |
| 245 | }); | 245 | }); |
| 246 | } | 246 | } |
| 247 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTRACT.getType())) { | 247 | if (reqVO.getToBizTypes().contains(CrmBizTypeEnum.CRM_CONTRACT.getType())) { |
| 248 | - List<CrmContractDO> contractList = contractService.getContractListByCustomerIdOwnerUserId(reqVO.getBizId(), userId); | 248 | + List<CrmContractDO> contractList = contractService.getContractListByCustomerIdOwnerUserId(reqVO.getId(), userId); |
| 249 | contractList.forEach(item -> { | 249 | contractList.forEach(item -> { |
| 250 | contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), | 250 | contractService.transferContract(new CrmContractTransferReqVO(item.getId(), reqVO.getNewOwnerUserId(), |
| 251 | reqVO.getOldOwnerPermissionLevel()), userId); | 251 | reqVO.getOldOwnerPermissionLevel()), userId); |