mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	📖 code review:操作日志的实现
This commit is contained in:
		| @@ -8,6 +8,7 @@ import org.springframework.stereotype.Component; | ||||
|  | ||||
| import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; | ||||
|  | ||||
| // TODO @puhui999:还是放在 core 包下哈; | ||||
| /** | ||||
|  * 自定义函数-通过行业编号获取行业信息 | ||||
|  * | ||||
| @@ -29,6 +30,7 @@ public class CrmIndustryParseFunction implements IParseFunction { | ||||
|  | ||||
|     @Override | ||||
|     public String apply(Object value) { | ||||
| //        if (ObjUtil.isEmpty(value)) TODO @puhui999 可以直接替代哈; | ||||
|         if (value == null) { | ||||
|             return ""; | ||||
|         } | ||||
| @@ -37,10 +39,12 @@ public class CrmIndustryParseFunction implements IParseFunction { | ||||
|         } | ||||
|  | ||||
|         // 获取行业信息 | ||||
|         // TODO @puhui999:这里可以不用 try catch 哇? | ||||
|         try { | ||||
|             return DictFrameworkUtils.getDictDataLabel(CRM_CUSTOMER_INDUSTRY, value.toString()); | ||||
|         } catch (Exception ignored) { | ||||
|         } | ||||
|         return ""; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | ||||
|  */ | ||||
| public class CrmPermissionUtils { | ||||
|  | ||||
|     // TODO @puhui999:isCrmAdmin。换成这个名字;因为 validate 一般是参数校验,不符合抛出异常;一般是 isXXXValid 才会返回 true false | ||||
|     /** | ||||
|      * 校验用户是否是 CRM 管理员 | ||||
|      * | ||||
| @@ -21,6 +22,7 @@ public class CrmPermissionUtils { | ||||
|         return SingletonManager.getPermissionApi().hasAnyRoles(getUserId(), CrmPermissionRoleCodeEnum.CRM_ADMIN.getCode()); | ||||
|     } | ||||
|  | ||||
|     // TODO @puhui999:这个不需要哈,直接用原本的 SecuriyUtils 去拿更方便一些; | ||||
|     /** | ||||
|      * 获得用户编号 | ||||
|      * | ||||
|   | ||||
| @@ -68,6 +68,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||||
|         return customer.getId(); | ||||
|     } | ||||
|  | ||||
|     // TODO @puhui999:测试下,能不能打出用户数据的变更。啊哈,可以打完微信发我下; | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     @LogRecord(type = CRM_CUSTOMER, bizNo = "{{#updateReqVO.id}}", success = "更新了客户{_DIFF{#updateReqVO}}") | ||||
|   | ||||
| @@ -90,6 +90,7 @@ public class CrmPermissionServiceImpl implements CrmPermissionService { | ||||
|         CrmPermissionDO oldPermission = crmPermissionMapper.selectByBizTypeAndBizIdByUserId( | ||||
|                 transferReqBO.getBizType(), transferReqBO.getBizId(), transferReqBO.getUserId()); | ||||
|         String bizTypeName = CrmBizTypeEnum.getNameByType(transferReqBO.getBizType()); | ||||
|         // TODO @puhui999:是不是并且? 不是拥有者,并且不是超管 | ||||
|         if (oldPermission == null || !isOwner(oldPermission.getLevel()) || !CrmPermissionUtils.validateAdminUser()) { | ||||
|             throw exception(CRM_PERMISSION_DENIED, bizTypeName); | ||||
|         } | ||||
|   | ||||
| @@ -98,6 +98,7 @@ public class CrmQueryWrapperUtils { | ||||
|     private static class SingletonManager { | ||||
|  | ||||
|         private static final AdminUserApi ADMIN_USER_API = SpringUtil.getBean(AdminUserApi.class); | ||||
|  | ||||
|         private static final MybatisPlusJoinProperties MYBATIS_PLUS_JOIN_PROPERTIES = SpringUtil.getBean(MybatisPlusJoinProperties.class); | ||||
|  | ||||
|         public static AdminUserApi getAdminUserApi() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV