| | |
| | | package com.highdatas.mdm.util; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.google.common.collect.Maps; |
| | | import com.highdatas.mdm.entity.Character; |
| | |
| | | |
| | | public static ISysDispenseLogsService dispenseLogsService; |
| | | public static DispenseService dispenseService; |
| | | |
| | | public static AntianaphylaxisClient antianaphylaxisClient; |
| | | |
| | | |
| | | @Autowired |
| | | public void setAntianaphylaxisClient(AntianaphylaxisClient antianaphylaxisClient){ |
| | | DbUtils.antianaphylaxisClient = antianaphylaxisClient; |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | |
| | | return map; |
| | | } |
| | | |
| | | public static HashMap<String, Object> JsonObjectToHashMap(JSONObject jsonObj){ |
| | | HashMap<String, Object> data = new HashMap<String, Object>(); |
| | | |
| | | Set<String> keySet = jsonObj.keySet(); |
| | | for (String key : keySet) { |
| | | data.put(key, jsonObj.get(key)); |
| | | } |
| | | return data; |
| | | } |
| | | public static Integer getSubVersion(String baseVersion) { |
| | | if (StringUtils.isEmpty(baseVersion)) { |
| | | return null; |
| | |
| | | } |
| | | String[] split = redisVal.split(Constant.SEMICOLON); |
| | | List<String> strings = Arrays.asList(split); |
| | | return new ArrayList<String>(strings); |
| | | } |
| | | |
| | | public static List<String> split(String redisVal, String spilt) { |
| | | if (StringUtils.isEmpty(redisVal)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | String[] split = redisVal.split(spilt); |
| | | List<String> strings = Arrays.asList(split); |
| | | return strings; |
| | | } |
| | | |
| | |
| | | } |
| | | public static TUser getUserById(String userId) { |
| | | TUser tUserById = userRoleClient.getTUserById(userId); |
| | | |
| | | return tUserById; |
| | | } |
| | | |
| | |
| | | |
| | | public static Set<TUser> getAllUser() { |
| | | List<TUser> tRoleListByUserId = userRoleClient.listUserRoleGroup(); |
| | | if (tRoleListByUserId == null) { |
| | | return new HashSet<>(); |
| | | } |
| | | return new HashSet<TUser>(tRoleListByUserId); |
| | | } |
| | | |
| | | |
| | | public static Set<String> getUserByRole(String roleId) { |
| | | List<String> userListByRole = userRoleClient.getUserListByRole(roleId); |
| | | |
| | | if (userListByRole == null) { |
| | | return new HashSet<>(); |
| | | } |
| | | HashSet<String> result = new HashSet<>(userListByRole); |
| | | return result; |
| | | } |
| | |
| | | String time = format.format(new Date()); |
| | | return time; |
| | | } |
| | | |
| | | public static Set<String> getRoleByUser(String userId, String uuid) { |
| | | |
| | | Date start = new Date(); |
| | | List<TRole> tRoleListByUserId = userRoleClient.getTRoleListByUserId(userId); |
| | | Date end = new Date(); |
| | | log.info(MessageFormat.format("master tag:{0} form userId select role :{1} ms",uuid, (end.getTime() - start.getTime()))); |
| | | |
| | | |
| | | if (tRoleListByUserId == null || tRoleListByUserId.isEmpty()){ |
| | | return new HashSet<>(); |
| | | } |
| | | Set<String> collect = tRoleListByUserId.stream() |
| | | .filter(tRole -> tRole != null).map(tRole -> tRole.getRoleId()).collect(Collectors.toSet()); |
| | | |
| | | |
| | | return collect; |
| | | |
| | | } |
| | | |
| | | public static Set<String> getGroupByUser(String userId, String uuid) { |
| | | |
| | | Date start = new Date(); |
| | | List<TUserGroup> tRoleListByUserId = userRoleClient.getUserGroupByUserId(userId); |
| | | Date end = new Date(); |
| | | log.info(MessageFormat.format("master tag:{0} form userId select group :{1} ms",uuid, (end.getTime() - start.getTime()))); |
| | | |
| | | if (tRoleListByUserId == null || tRoleListByUserId.isEmpty()){ |
| | | return new HashSet<>(); |
| | | } |
| | | Set<String> collect = tRoleListByUserId.stream().map(tRole -> tRole.getGroupId()).collect(Collectors.toSet()); |
| | | |
| | | |
| | | return collect; |
| | | } |
| | | |
| | | public static Set<String> getRoleByGroup(String groupId, String uuid) { |
| | | |
| | | Date start = new Date(); |
| | | List<TRole> tRoleListByUserId = userRoleClient.getRoleListByGroupId(groupId); |
| | | Date end = new Date(); |
| | | log.info(MessageFormat.format("master tag:{0} form groupId select role :{1} ms",uuid, (end.getTime() - start.getTime()))); |
| | | |
| | | if (tRoleListByUserId == null || tRoleListByUserId.isEmpty()){ |
| | | return new HashSet<>(); |
| | | } |
| | | Set<String> collect = tRoleListByUserId.stream().map(tRole -> tRole.getRoleId()).collect(Collectors.toSet()); |
| | | |
| | | |
| | | return collect; |
| | | } |
| | | } |