Ver código fonte

feat: 调整查询top用户信息接口提示信息,sql添加排序

weijianghai 2 anos atrás
pai
commit
a0ae2d299a

+ 1 - 1
src/main/java/com/nokia/controller/web/WebUserController.java

@@ -33,7 +33,7 @@ public class WebUserController {
     @Operation(summary = "查询top用户信息")
     @ApiResponses(value = {
             @ApiResponse(),
-            @ApiResponse(responseCode = "没有查询到top用户信息", description = "{\"success\":false,\"code\":0,\"message\":\"没有查询到top用户信息\",\"data\":null}", content = @Content),
+            @ApiResponse(responseCode = "新增用户必须是top已有账号,用户正常使用需要top增加移网投诉权限。", description = "{\"success\":false,\"code\":0,\"message\":\"没有查询到top用户信息\",\"data\":null}", content = @Content),
             @ApiResponse(responseCode = "非本地市用户", description = "{\"success\":false,\"code\":0,\"message\":\"非本地市用户\",\"data\":null}", content = @Content),
             @ApiResponse(responseCode = "用户已存在系统中", description = "{\"success\":false,\"code\":0,\"message\":\"用户已存在系统中\",\"data\":null}", content = @Content)
     })

+ 1 - 1
src/main/java/com/nokia/dao/RoleDao.java

@@ -42,7 +42,7 @@ public interface RoleDao extends BaseMapper<Role> {
             + " from sqmdb_rpt.acl_role ar"
             + " left join sqmdb_rpt.acl_system as2 on ar.\"system\" = as2.\"system\""
             + " left join sqmdb_rpt.acl_function af on af.id = ar.function_id"
-            + " order by ar.\"system\"")
+            + " order by af.web_priority desc")
     List<AllRoleBo> all();
 
     /**

+ 4 - 2
src/main/java/com/nokia/dao/UserDao.java

@@ -222,7 +222,8 @@ public interface UserDao extends BaseMapper<User> {
             + " inner join sqmdb_rpt.acl_area aa on aurc.city_id = aa.area_id"
             + " inner join sqmdb_rpt.acl_system as2 on ar.\"system\" = as2.\"system\""
             + " inner join sqmdb_rpt.acl_function af on af.id = ar.function_id"
-            + " where aurc.user_id = #{userId}")
+            + " where aurc.user_id = #{userId}"
+            + " order by af.web_priority desc")
     List<GetUserDetailRoleVo> getUserDetailRole(Integer userId);
 
     /**
@@ -239,7 +240,8 @@ public interface UserDao extends BaseMapper<User> {
             + " inner join sqmdb_rpt.acl_system as2 on ar.\"system\" = as2.\"system\""
             + " inner join sqmdb_rpt.acl_area aa on aurc.city_id = aa.area_id"
             + " inner join sqmdb_rpt.acl_function af on af.id = ar.function_id"
-            + " where au.login_name = #{loginName}")
+            + " where au.login_name = #{loginName}"
+            + " order by af.web_priority desc")
     List<GetRoleByLoginNameVo> getRoleByLoginName(String loginName);
 
     /**

+ 2 - 2
src/main/java/com/nokia/service/LogService.java

@@ -50,8 +50,8 @@ public class LogService {
     public R<PageVo<ListOperationLogVo>> listOperationLog(ListOperationLogDto dto) {
         PageVo<ListOperationLogVo> vo = new PageVo<>();
         Page<ListOperationLogVo> page = new Page<>(dto.getCurrent(), dto.getPageSize());
-        List<ListOperationLogVo> list = operationLogDao.listOperationLog(new Page<>(dto.getCurrent(), dto.getPageSize()),
-                dto.getOperatorId(), dto.getOperatorAccount(), dto.getOperatorName(), dto.getOperationName(),
+        List<ListOperationLogVo> list = operationLogDao.listOperationLog(page, dto.getOperatorId(),
+                dto.getOperatorAccount(), dto.getOperatorName(), dto.getOperationName(),
                 dto.getStartTime(), dto.getEndTime());
         vo.setList(list);
         vo.setTotal(page.getTotal());

+ 3 - 6
src/main/java/com/nokia/service/RoleService.java

@@ -7,10 +7,7 @@ import com.nokia.dao.RoleDao;
 import com.nokia.vo.*;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class RoleService {
@@ -33,9 +30,9 @@ public class RoleService {
 
     public R<List<AllRoleVo>> all() {
         List<AllRoleBo> list = roleDao.all();
-        Map<Object, Map<Object, List<AllRoleBo>>> map = new HashMap<>();
+        Map<Object, Map<Object, List<AllRoleBo>>> map = new LinkedHashMap<>();
         for (AllRoleBo t : list) {
-            map.putIfAbsent(t.getSystem(), new HashMap<>());
+            map.putIfAbsent(t.getSystem(), new LinkedHashMap<>());
             map.get(t.getSystem()).putIfAbsent(t.getFunctionId(), new ArrayList<>());
             map.get(t.getSystem()).get(t.getFunctionId()).add(t);
         }

+ 3 - 3
src/main/java/com/nokia/service/UserService.java

@@ -50,7 +50,7 @@ public class UserService {
         }
         TopUserVo vo = userDao.getTopUserByLoginName(dto.getLoginName());
         if (vo == null) {
-            return R.error("没有查询到top用户信息");
+            return R.error("新增用户必须是top已有账号,用户正常使用需要top增加移网投诉权限。");
         }
         UserRoleCity role = getUserRoleCity(session);
         if (role.getCityId() != -1 && !role.getCityId().equals(vo.getCityId())) {
@@ -307,7 +307,7 @@ public class UserService {
         String loginNames = users.stream().map(User::getLoginName).collect(Collectors.joining("、"));
         sb.append("批量复制权限给 ").append(loginNames).append(";权限:");
         List<UserRoleCity> userRoleCities = new ArrayList<>();
-        List<UserFunction> userFunctions = new ArrayList<>();
+        Set<UserFunction> userFunctions = new HashSet<>();
         for (AddUserRoleDto t : dto.getRoles()) {
             sb.append(t.getRoleName()).append("-").append(t.getCityName()).append(",");
             for (Integer userId : dto.getUserIds()) {
@@ -328,7 +328,7 @@ public class UserService {
         userRoleCityDao.insertBatch(userRoleCities);
         if (!CollectionUtils.isEmpty(userFunctions)) {
             deleteUserFunctionByUserIds(dto.getUserIds());
-            userFunctionDao.insertBatch(userFunctions);
+            userFunctionDao.insertBatch(new ArrayList<>(userFunctions));
         }
         // 记录日志
         operationLogService.logOperation(session, "批量复制权限", sb.toString());