|
@@ -43,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.locks.ReentrantLock;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -69,14 +70,24 @@ public class ManageInfoService implements IManageInfoService {
|
|
|
@Autowired
|
|
|
private IOrgInfoFacade orgInfoFacade;
|
|
|
|
|
|
- private final ICodeListResourceFacade codeListResourceFacade;
|
|
|
+ @Autowired
|
|
|
+ private ICodeListResourceFacade codeListResourceFacade;
|
|
|
+
|
|
|
+ private volatile boolean isEmpty = true;
|
|
|
|
|
|
- private final Map<String, String> POLICE_CATEGORY_MAP;
|
|
|
+ private final Map<String, String> POLICE_CATEGORY_MAP = new HashMap<>();
|
|
|
|
|
|
- public ManageInfoService(ICodeListResourceFacade codeListResourceFacade) {
|
|
|
- this.codeListResourceFacade = codeListResourceFacade;
|
|
|
- this.POLICE_CATEGORY_MAP = codeListResourceFacade.listCode("code", "T_MD_POLICE_TYPE").stream()
|
|
|
- .collect(Collectors.toMap(CodeRecord::getValue,CodeRecord::getLabel));
|
|
|
+ private void checkPoliceTypeMap(){
|
|
|
+ if (!this.isEmpty){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ synchronized (this.POLICE_CATEGORY_MAP){
|
|
|
+ if (this.isEmpty){
|
|
|
+ this.POLICE_CATEGORY_MAP.putAll(codeListResourceFacade.listCode("code", "T_MD_POLICE_TYPE").stream()
|
|
|
+ .collect(Collectors.toMap(CodeRecord::getValue,CodeRecord::getLabel)));
|
|
|
+ this.isEmpty = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -87,6 +98,7 @@ public class ManageInfoService implements IManageInfoService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Page<AuthUserDTO> getUserNotInManage(SearchDTO searchDTO) {
|
|
|
+ checkPoliceTypeMap();
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
Condition orgIdEq = searchable.getSearchFilter("orgId", SearchOperator.eq);
|
|
|
//机构id不为空,从带有管理范围的机构树选择某一个机构查询
|
|
@@ -111,14 +123,10 @@ public class ManageInfoService implements IManageInfoService {
|
|
|
AuthUserDTO dto = new AuthUserDTO();
|
|
|
BeanUtils.copyProperties(e, dto);
|
|
|
final String code;
|
|
|
- String value;
|
|
|
if (null == (code = e.getPoliceCategory())) {
|
|
|
return dto;
|
|
|
}
|
|
|
- if (null == (value = POLICE_CATEGORY_MAP.get(code))) {
|
|
|
- value = policeTypeRepository.getPoliceTypeByCode(code);
|
|
|
- POLICE_CATEGORY_MAP.put(code, value);
|
|
|
- }
|
|
|
+ final String value = POLICE_CATEGORY_MAP.get(code);
|
|
|
dto.setPoliceCategory(value);
|
|
|
return dto;
|
|
|
}).collect(Collectors.toList());
|
|
@@ -281,6 +289,7 @@ public class ManageInfoService implements IManageInfoService {
|
|
|
|
|
|
@Override
|
|
|
public Page<AuthUserDTO> rightRangeManagerList(SearchDTO searchDTO) {
|
|
|
+ checkPoliceTypeMap();
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
Condition orgIdEq = searchable.getSearchFilter("orgId", SearchOperator.eq);
|
|
|
//机构id不为空,从带有管理范围的机构树选择某一个机构查询
|