|
@@ -7,20 +7,19 @@ import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class RedisLikeService {
|
|
|
- private final static Map<String, String> employeeNameMap = new HashMap<>();
|
|
|
- private final static Map<String, String> deptNameMap = new HashMap<>();
|
|
|
- private final static Map<String, String> deptAndEmployeeName = new HashMap<>();
|
|
|
- private final static Map<String, String> regionMap = new HashMap<>();
|
|
|
- private final static Map<String, String> wjwAnaesthesiaMap = new HashMap<>();
|
|
|
- private final static Map<String, String> wjwDepartmentMap = new HashMap<>();
|
|
|
- private final static Map<String, String> wjwNationMap = new HashMap<>();
|
|
|
- private final static Map<String, String> countryMap = new HashMap<>();
|
|
|
- private final static Map<String, UserInfo> userMap = new HashMap<>();
|
|
|
+ private final static Map<String, String> EMPLOYEE_NAME_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> DEPT_NAME_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> DEPT_AND_EMPLOYEE_NAME = new HashMap<>();
|
|
|
+ private final static Map<String, String> REGION_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> WJW_ANAESTHESIA_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> WJW_DEPARTMENT_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> WJW_NATION_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, String> COUNTRY_MAP = new HashMap<>();
|
|
|
+ private final static Map<String, UserInfo> USER_MAP = new HashMap<>();
|
|
|
private final RedisLikeDao dao;
|
|
|
|
|
|
public RedisLikeService(RedisLikeDao dao) {
|
|
@@ -31,10 +30,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String username = employeeNameMap.get(code);
|
|
|
+ String username = EMPLOYEE_NAME_MAP.get(code);
|
|
|
if (null == username) {
|
|
|
username = dao.selectEmployeeName(code);
|
|
|
- employeeNameMap.put(code, username);
|
|
|
+ EMPLOYEE_NAME_MAP.put(code, username);
|
|
|
}
|
|
|
return username;
|
|
|
}
|
|
@@ -43,10 +42,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String result = deptAndEmployeeName.get(code);
|
|
|
+ String result = DEPT_AND_EMPLOYEE_NAME.get(code);
|
|
|
if (null == result) {
|
|
|
result = dao.selectDeptAndUser(code);
|
|
|
- deptAndEmployeeName.put(code, result);
|
|
|
+ DEPT_AND_EMPLOYEE_NAME.put(code, result);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -55,10 +54,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String deptName = deptNameMap.get(code);
|
|
|
+ String deptName = DEPT_NAME_MAP.get(code);
|
|
|
if (null == deptName) {
|
|
|
deptName = dao.selectDeptName(code);
|
|
|
- deptNameMap.put(code, deptName);
|
|
|
+ DEPT_NAME_MAP.put(code, deptName);
|
|
|
}
|
|
|
return deptName;
|
|
|
}
|
|
@@ -67,7 +66,7 @@ public class RedisLikeService {
|
|
|
if (StringUtil.isBlank(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String regionName = regionMap.get(code);
|
|
|
+ String regionName = REGION_MAP.get(code);
|
|
|
if (null == regionName) {
|
|
|
PureCodeName region = dao.selectAdmdvsNameAndParentName(code);
|
|
|
if (null == region) {
|
|
@@ -84,7 +83,7 @@ public class RedisLikeService {
|
|
|
} else {
|
|
|
regionName = region.getCode() + region.getName();
|
|
|
}
|
|
|
- regionMap.put(code, regionName);
|
|
|
+ REGION_MAP.put(code, regionName);
|
|
|
}
|
|
|
return regionName;
|
|
|
}
|
|
@@ -93,10 +92,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String wjwCode = wjwAnaesthesiaMap.get(code);
|
|
|
+ String wjwCode = WJW_ANAESTHESIA_MAP.get(code);
|
|
|
if (null == wjwCode) {
|
|
|
wjwCode = dao.selectWjwAnaesthesia(code);
|
|
|
- wjwAnaesthesiaMap.put(code, wjwCode);
|
|
|
+ WJW_ANAESTHESIA_MAP.put(code, wjwCode);
|
|
|
}
|
|
|
return wjwCode;
|
|
|
}
|
|
@@ -105,10 +104,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String wjwCode = wjwDepartmentMap.get(code);
|
|
|
+ String wjwCode = WJW_DEPARTMENT_MAP.get(code);
|
|
|
if (null == wjwCode) {
|
|
|
wjwCode = dao.selectWjwDepartment(code);
|
|
|
- wjwDepartmentMap.put(code, wjwCode);
|
|
|
+ WJW_DEPARTMENT_MAP.put(code, wjwCode);
|
|
|
}
|
|
|
return wjwCode;
|
|
|
}
|
|
@@ -117,10 +116,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String wjwCode = wjwNationMap.get(code);
|
|
|
+ String wjwCode = WJW_NATION_MAP.get(code);
|
|
|
if (null == wjwCode) {
|
|
|
wjwCode = dao.selectWjwNation(code);
|
|
|
- wjwNationMap.put(code, wjwCode);
|
|
|
+ WJW_NATION_MAP.put(code, wjwCode);
|
|
|
}
|
|
|
return wjwCode;
|
|
|
}
|
|
@@ -129,10 +128,10 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String name = countryMap.get(code);
|
|
|
+ String name = COUNTRY_MAP.get(code);
|
|
|
if (null == name) {
|
|
|
name = dao.selectCountryName(code);
|
|
|
- countryMap.put(code, name);
|
|
|
+ COUNTRY_MAP.put(code, name);
|
|
|
}
|
|
|
return name;
|
|
|
}
|
|
@@ -141,12 +140,12 @@ public class RedisLikeService {
|
|
|
if (StringUtil.invalidValue(code)) {
|
|
|
return null;
|
|
|
}
|
|
|
- UserInfo userInfo = userMap.get(code);
|
|
|
+ UserInfo userInfo = USER_MAP.get(code);
|
|
|
if (null == userInfo) {
|
|
|
userInfo = dao.selectUserInfo(code);
|
|
|
userInfo.setDeptName(getDeptName(userInfo.getDeptCode()));
|
|
|
userInfo.setRoles(dao.selectUserRoles(code));
|
|
|
- userMap.put(code, userInfo);
|
|
|
+ USER_MAP.put(code, userInfo);
|
|
|
}
|
|
|
return userInfo;
|
|
|
}
|
|
@@ -154,12 +153,12 @@ public class RedisLikeService {
|
|
|
public void handleUserRoleChanged(String code) {
|
|
|
UserInfo userInfo = getUserInfo(code);
|
|
|
userInfo.setRoles(dao.selectUserRoles(code));
|
|
|
- userMap.replace(code, userInfo);
|
|
|
+ USER_MAP.replace(code, userInfo);
|
|
|
}
|
|
|
|
|
|
public void handleUserPwdChanged(String code, String pwd) {
|
|
|
UserInfo userInfo = getUserInfo(code);
|
|
|
userInfo.setPassword(pwd);
|
|
|
- userMap.replace(code, userInfo);
|
|
|
+ USER_MAP.replace(code, userInfo);
|
|
|
}
|
|
|
}
|