Browse Source

fix(sys): 完善参数及用户持有上限等字段校验

- 在SysParamService.adminUpdate中增加持有上限、日退上限及退回公海天数字段非空及正数校验
- 在SysUserService新增及编辑方法中增加上述字段的相同校验逻辑
- 在SysCustomerOperLogService及相关调用处添加memberSelectStatus参数支持,完善操作日志查询逻辑
- 修改SysCustomerDataFollowService、SysCustomerDataPrivateService及SysCustomerDataPublicService中调用调整,传递memberSelectStatus参数
- 统一AdminParamController接口格式修正,优化代码规范和格式一致性
zhangxf 1 day ago
parent
commit
eb6f4fb195

+ 5 - 6
src/main/java/com/jtzx/crm/module/api/web/sys/AdminParamController.java

@@ -53,10 +53,9 @@ public class AdminParamController {
         return ApiResult.data(sysParamBO);
         return ApiResult.data(sysParamBO);
     }
     }
 
 
-
     @Operation(summary = "修改参数配置", description = "公海设置的三个框")
     @Operation(summary = "修改参数配置", description = "公海设置的三个框")
     @PostMapping(value = "/updateParams")
     @PostMapping(value = "/updateParams")
-    public ApiResult<Void> updateParams(@RequestBody AdminSysParamInsertOrUpdateDTO dto) throws BusinessException{
+    public ApiResult<Void> updateParams(@RequestBody AdminSysParamInsertOrUpdateDTO dto) throws BusinessException {
         sysCustomerDataPermissionService.adminPermission();
         sysCustomerDataPermissionService.adminPermission();
         sysParamService.adminUpdate(dto);
         sysParamService.adminUpdate(dto);
         return ApiResult.success();
         return ApiResult.success();
@@ -73,7 +72,7 @@ public class AdminParamController {
 
 
     @Operation(summary = "新增学段,产品,职务,跟进状态数据")
     @Operation(summary = "新增学段,产品,职务,跟进状态数据")
     @PostMapping(value = "/addParams")
     @PostMapping(value = "/addParams")
-    public ApiResult<Void> addParams(@RequestBody @Valid AdminSysParamBaseDataInsertOrUpdateDTO dto) throws BusinessException{
+    public ApiResult<Void> addParams(@RequestBody @Valid AdminSysParamBaseDataInsertOrUpdateDTO dto) throws BusinessException {
         sysCustomerDataPermissionService.adminPermission();
         sysCustomerDataPermissionService.adminPermission();
         sysParamBaseDataService.adminInsert(dto);
         sysParamBaseDataService.adminInsert(dto);
         return ApiResult.success();
         return ApiResult.success();
@@ -81,7 +80,7 @@ public class AdminParamController {
 
 
     @Operation(summary = "修改学段,产品,职务,跟进状态数据")
     @Operation(summary = "修改学段,产品,职务,跟进状态数据")
     @PostMapping(value = "/modifyParams")
     @PostMapping(value = "/modifyParams")
-    public ApiResult<Void> modifyParams(@RequestBody @Valid AdminSysParamBaseDataInsertOrUpdateDTO dto) throws BusinessException{
+    public ApiResult<Void> modifyParams(@RequestBody @Valid AdminSysParamBaseDataInsertOrUpdateDTO dto) throws BusinessException {
         sysCustomerDataPermissionService.adminPermission();
         sysCustomerDataPermissionService.adminPermission();
         sysParamBaseDataService.update(dto);
         sysParamBaseDataService.update(dto);
         return ApiResult.success();
         return ApiResult.success();
@@ -90,7 +89,7 @@ public class AdminParamController {
 
 
     @Operation(summary = "学段,产品,职务,跟进状态排序")
     @Operation(summary = "学段,产品,职务,跟进状态排序")
     @PostMapping(value = "/paramSort")
     @PostMapping(value = "/paramSort")
-    public ApiResult<Void> paramSort(@RequestBody @Valid List<AdminSysParamBaseDataInsertOrUpdateDTO> dtoList) throws BusinessException{
+    public ApiResult<Void> paramSort(@RequestBody @Valid List<AdminSysParamBaseDataInsertOrUpdateDTO> dtoList) throws BusinessException {
         sysCustomerDataPermissionService.adminPermission();
         sysCustomerDataPermissionService.adminPermission();
         if (CollUtil.isEmpty(dtoList)) {
         if (CollUtil.isEmpty(dtoList)) {
             throw new BusinessException(400, "参数不能为空");
             throw new BusinessException(400, "参数不能为空");
@@ -102,7 +101,7 @@ public class AdminParamController {
 
 
     @Operation(summary = "删除学段,产品,职务,跟进状态")
     @Operation(summary = "删除学段,产品,职务,跟进状态")
     @GetMapping("/deleteParams/{id}")
     @GetMapping("/deleteParams/{id}")
-    public ApiResult<Void> deleteParams(@PathVariable Long id) throws BusinessException{
+    public ApiResult<Void> deleteParams(@PathVariable Long id) throws BusinessException {
         sysCustomerDataPermissionService.adminPermission();
         sysCustomerDataPermissionService.adminPermission();
         sysParamBaseDataService.delete(id);
         sysParamBaseDataService.delete(id);
         return ApiResult.success();
         return ApiResult.success();

+ 1 - 1
src/main/java/com/jtzx/crm/module/sys/service/SysCustomerDataFollowService.java

@@ -168,7 +168,7 @@ public class SysCustomerDataFollowService {
         if (dto.getGroupId() != null) {
         if (dto.getGroupId() != null) {
             groupIds.add(dto.getGroupId());
             groupIds.add(dto.getGroupId());
         }
         }
-        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, true, true);
+        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, true, true,true);
     }
     }
 
 
 
 

+ 5 - 1
src/main/java/com/jtzx/crm/module/sys/service/SysCustomerDataPrivateService.java

@@ -318,11 +318,15 @@ public class SysCustomerDataPrivateService {
         if (!UserContextHolder.getUserContext().getRoles().contains("Admin")) {
         if (!UserContextHolder.getUserContext().getRoles().contains("Admin")) {
             userIds.add(UserContextHolder.getUserId());
             userIds.add(UserContextHolder.getUserId());
         }
         }
+        if(dto.getOperUserId() != null){
+            userIds.clear();
+            userIds.add(dto.getOperUserId());
+        }
         List<Long> groupIds = Lists.newArrayList();
         List<Long> groupIds = Lists.newArrayList();
         if (dto.getGroupId() != null) {
         if (dto.getGroupId() != null) {
             groupIds.add(dto.getGroupId());
             groupIds.add(dto.getGroupId());
         }
         }
-        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, true, false);
+        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, true, false,true);
     }
     }
 
 
 
 

+ 1 - 1
src/main/java/com/jtzx/crm/module/sys/service/SysCustomerDataPublicService.java

@@ -316,7 +316,7 @@ public class SysCustomerDataPublicService {
         if (dto.getGroupId() != null) {
         if (dto.getGroupId() != null) {
             groupIds.add(dto.getGroupId());
             groupIds.add(dto.getGroupId());
         }
         }
-        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, false, false);
+        return sysCustomerOperLogService.adminList(dto, userIds, groupIds, false, false, false);
     }
     }
 
 
 
 

+ 4 - 2
src/main/java/com/jtzx/crm/module/sys/service/SysCustomerOperLogService.java

@@ -45,7 +45,9 @@ public class SysCustomerOperLogService {
     /**
     /**
      * 操作日志列表查询
      * 操作日志列表查询
      */
      */
-    public SysCustomerOperLogDataBO adminList(AdminSysCustomerOperLogListDTO dto, List<Long> userIds, List<Long> groupIds, Boolean dateSelectStatus, Boolean groupSelectStatus) {
+    public SysCustomerOperLogDataBO adminList(AdminSysCustomerOperLogListDTO dto,
+                                              List<Long> userIds, List<Long> groupIds,
+                                              Boolean dateSelectStatus, Boolean groupSelectStatus, Boolean memberSelectStatus) {
 
 
         Page<SysCustomerOperLogEntity> entityPage = sysCustomerOperLogMapper.selectPage(
         Page<SysCustomerOperLogEntity> entityPage = sysCustomerOperLogMapper.selectPage(
                 new Page<>(dto.getPageNum(), dto.getPageSize()),
                 new Page<>(dto.getPageNum(), dto.getPageSize()),
@@ -95,7 +97,7 @@ public class SysCustomerOperLogService {
         if (CollUtil.isNotEmpty(logEntityList)) {
         if (CollUtil.isNotEmpty(logEntityList)) {
 
 
             // 操作人
             // 操作人
-            if(Boolean.TRUE.equals(dateSelectStatus) && Boolean.TRUE.equals(groupSelectStatus)){
+            if(Boolean.TRUE.equals(memberSelectStatus)){
                 List<BindUserBO> memberData = Lists.newArrayList();
                 List<BindUserBO> memberData = Lists.newArrayList();
                 logEntityList.forEach(
                 logEntityList.forEach(
                         entity -> {
                         entity -> {

+ 18 - 1
src/main/java/com/jtzx/crm/module/sys/service/SysParamService.java

@@ -103,7 +103,24 @@ public class SysParamService {
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public void adminUpdate(AdminSysParamInsertOrUpdateDTO dto) {
     public void adminUpdate(AdminSysParamInsertOrUpdateDTO dto) {
         log.info("[后台管理-参数设置-编辑] >> DTO={}", dto);
         log.info("[后台管理-参数设置-编辑] >> DTO={}", dto);
-
+        if(dto.getHoldTopCount()==null){
+            throw new BusinessException(400, "持有上限不能为空");
+        }
+        if(dto.getHoldTopCount()<=0){
+            throw new BusinessException(400, "持有上限数量必须大于0");
+        }
+        if(dto.getDayBackTopCount()==null){
+            throw new BusinessException(400, "日退上限不能为空");
+        }
+        if(dto.getDayBackTopCount()<=0){
+            throw new BusinessException(400, "日退上限数量必须大于0");
+        }
+        if(dto.getBackPublicDayCount()==null){
+            throw new BusinessException(400, "退回公海天数不能为空");
+        }
+        if(dto.getBackPublicDayCount()<=0){
+            throw new BusinessException(400, "退回公海天数数量必须大于0");
+        }
         SysParamEntity entity = new SysParamEntity();
         SysParamEntity entity = new SysParamEntity();
         BeanUtil.copyProperties(dto, entity);
         BeanUtil.copyProperties(dto, entity);
 
 

+ 36 - 0
src/main/java/com/jtzx/crm/module/sys/service/SysUserService.java

@@ -99,6 +99,24 @@ public class SysUserService {
         log.info("[后台管理-新增后台用户] >> 入参={}", dto);
         log.info("[后台管理-新增后台用户] >> 入参={}", dto);
         this.checkExistence(dto);
         this.checkExistence(dto);
         dto.setId(null);
         dto.setId(null);
+        if(dto.getHoldTopCount()==null){
+            throw new BusinessException(400, "持有上限不能为空");
+        }
+        if(dto.getHoldTopCount()<=0){
+            throw new BusinessException(400, "持有上限数量必须大于0");
+        }
+        if(dto.getDayBackTopCount()==null){
+            throw new BusinessException(400, "日退上限不能为空");
+        }
+        if(dto.getDayBackTopCount()<=0){
+            throw new BusinessException(400, "日退上限数量必须大于0");
+        }
+        if(dto.getBackPublicDayCount()==null){
+            throw new BusinessException(400, "退回公海天数不能为空");
+        }
+        if(dto.getBackPublicDayCount()<=0){
+            throw new BusinessException(400, "退回公海天数数量必须大于0");
+        }
         SysUserEntity entity = new SysUserEntity();
         SysUserEntity entity = new SysUserEntity();
         BeanUtil.copyProperties(dto, entity);
         BeanUtil.copyProperties(dto, entity);
         entity.setStatus(1);
         entity.setStatus(1);
@@ -118,6 +136,24 @@ public class SysUserService {
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public void adminUpdate(InsertOrUpdateSysUserDTO dto) throws BusinessException{
     public void adminUpdate(InsertOrUpdateSysUserDTO dto) throws BusinessException{
         log.info("[后台管理-编辑后台用户] >> 入参={}", dto);
         log.info("[后台管理-编辑后台用户] >> 入参={}", dto);
+        if(dto.getHoldTopCount()==null){
+            throw new BusinessException(400, "持有上限不能为空");
+        }
+        if(dto.getHoldTopCount()<=0){
+            throw new BusinessException(400, "持有上限数量必须大于0");
+        }
+        if(dto.getDayBackTopCount()==null){
+            throw new BusinessException(400, "日退上限不能为空");
+        }
+        if(dto.getDayBackTopCount()<=0){
+            throw new BusinessException(400, "日退上限数量必须大于0");
+        }
+        if(dto.getBackPublicDayCount()==null){
+            throw new BusinessException(400, "退回公海天数不能为空");
+        }
+        if(dto.getBackPublicDayCount()<=0){
+            throw new BusinessException(400, "退回公海天数数量必须大于0");
+        }
         SysUserEntity entity = sysUserMapper.selectById(dto.getId());
         SysUserEntity entity = sysUserMapper.selectById(dto.getId());
         if (!entity.getUserName().equals(dto.getUsername())) {
         if (!entity.getUserName().equals(dto.getUsername())) {
             long count =
             long count =