Commit 430d40d5 authored by 韩桐桐's avatar 韩桐桐

人员BUGFIX

parent a121681f
......@@ -238,7 +238,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
LambdaQueryWrapper<DataDictionary> lambda = new QueryWrapper<DataDictionary>().lambda();
lambda.in(DataDictionary::getSequenceNbr, dictIds);
List<DataDictionary> dataDictionaries = iDataDictionaryService.getByTypeAndDesc(QYRYGW, QYRYGW_NAME);
List<DataDictionary> postDataList = dataDictionaries.stream().filter(d -> dictIds.stream().anyMatch(id -> id.toString().equals(d.getSequenceNbr().toString()))).collect(Collectors.toList());
List<DataDictionary> postDataList = dataDictionaries.stream().filter(d -> dictIds.stream().anyMatch(id -> id.toString().equals(d.getCode()))).collect(Collectors.toList());
return postDataList.stream().map(DataDictionary::getName).collect(Collectors.joining(","));
}
......@@ -316,12 +316,19 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
// 企业自查询 + 监管单位查看 都用到该接口
@Override
public Map<String, Object> getDetail(Long id, ReginParams reginParams) {
// 为了处理以下场景
// 1:没有单位限制的时候添加了所有类型的人员,现在有了单位类型限制的情况下更新不了原先人员
// 2:多种单位类型的企业编辑另一种单位类型下的人员
List<String> unitTypeAllPostCode = this.postByUnitType(reginParams.getCompany()).stream().map(DataDictionary::getCode).collect(Collectors.toList());
// 监管机构查看所有
List<String> unitTypeAllPostCode;
if (!reginParams.getCompany().getCompanyType().equals("监管机构")){
unitTypeAllPostCode = this.postByUnitType(reginParams.getCompany()).stream().map(DataDictionary::getCode).collect(Collectors.toList());
}else {
unitTypeAllPostCode = this.getAllUserType().stream().map(DataDictionary::getCode).collect(Collectors.toList());
}
Map<String, Object> maps = new HashMap<>();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(id);
TzsUserInfoVo tzsUserInfoVo = new TzsUserInfoVo();
......@@ -1014,7 +1021,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
case "qt":
return Arrays.asList("6549", "6548", "6547", "6546", "6551", "6550", "6616", "6553", "6617");
default:
return Arrays.asList("6549", "6548", "6547", "6546", "6551", "6550", "6616", "6553", "6617", "66151", "66152", "6552");
return this.getAllUserType().stream().map(DataDictionary::getCode).collect(Collectors.toList());
}
}
......@@ -1691,10 +1698,13 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
// 接口用于人员详情界面 企业 + 监管单位 都会看到
@Override
public List<DataDictionary> postByUnitType(CompanyBo company) {
ArrayList<String> postDictCodeList = new ArrayList<>();
if (company.getCompanyType().equals("监管机构")){
return this.getAllUserType();
}
TzBaseEnterpriseInfo enterpriseInfo = baseEnterpriseInfoService.lambdaQuery()
.eq(TzBaseEnterpriseInfo::getUseCode, company.getCompanyCode())
.one();
......@@ -1717,6 +1727,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
/**
* 根据单位类型和父类型查询对应的人员类型子类型
* * 接口用于人员详情界面 企业 + 监管单位 都会看到
* @param company 登录人公司信息
* @param parentCode 父人员类型code
* @return result
......@@ -1726,19 +1737,38 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
ArrayList<String> parentCodeList = new ArrayList<>(Arrays.asList(parentCode.split(",")));
List<DataDictionary> result = new ArrayList<>();
if (company.getCompanyType().equals("监管机构")) {
return iDataDictionaryService.lambdaQuery()
.in(DataDictionary::getParent, parentCodeList)
.like(DataDictionary::getType, "QYRYGW")
.orderByAsc(DataDictionary::getSortNum)
.list();
}
JsonNode companyTypeNode = postData.get(company.getCompanyType());
List<DataDictionary> result = new ArrayList<>();
// 该注册单位所具有的所有的单位类型下的人员类型
Map<String, JsonNode> allPostUnderTheUnit = new HashMap<>();
TzBaseEnterpriseInfo enterpriseInfo = baseEnterpriseInfoService.lambdaQuery()
.eq(TzBaseEnterpriseInfo::getUseCode, company.getCompanyCode())
.one();
List<String> unitTypes = Arrays.asList(enterpriseInfo.getUnitType().split("#"));
unitTypes.forEach(unitType -> {
JsonNode companyTypeNode = postData.get(unitType);
if (companyTypeNode != null && companyTypeNode.isObject()) {
Iterator<Map.Entry<String, JsonNode>> fields = companyTypeNode.fields();
while (fields.hasNext()) {
Map.Entry<String, JsonNode> entry = fields.next();
String postCode = entry.getKey();
String postCode = entry.getKey();// 主岗位
JsonNode subPostCode = entry.getValue();// 子岗位
allPostUnderTheUnit.put(postCode, subPostCode);
}
}
});
allPostUnderTheUnit.forEach((postCode, subPostCode) -> {
if (parentCodeList.contains(postCode)) {
ArrayList<String> subPostDictCodeList = new ArrayList<>();
JsonNode subPosts = entry.getValue(); // 子岗位数组
if (subPosts.isArray()) {
for (JsonNode subPost : subPosts) {
if (subPostCode.isArray()) {
for (JsonNode subPost : subPostCode) {
if (!subPost.isNull()) {
subPostDictCodeList.add(subPost.asText()); // 子岗位
}
......@@ -1759,8 +1789,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
.list());
}
}
}
}
});
return result;
}
}
......@@ -38,7 +38,7 @@
"6548": [],
"6616": [],
"6763": [],
"": []
"6549": []
},
"安装改造维修单位": {
"6660": [],
......@@ -63,6 +63,7 @@
"6550": [],
"6548": [],
"6616": [],
"6617": []
"6617": [],
"6549": []
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment