|
|
@ -77,6 +77,13 @@ public class RohsServiceImpl extends ServiceImpl<RohsMapper, RohsEntity> impleme |
|
|
new Query<RohsEntity>().getPage(params), |
|
|
new Query<RohsEntity>().getPage(params), |
|
|
params |
|
|
params |
|
|
); |
|
|
); |
|
|
|
|
|
List<RohsEntity> records = page.getRecords(); |
|
|
|
|
|
if (records != null && !records.isEmpty()) { |
|
|
|
|
|
Map<String, String> userDisplayCache = new HashMap<>(); |
|
|
|
|
|
for (RohsEntity rohs : records) { |
|
|
|
|
|
fillUserDisplayFields(rohs, userDisplayCache); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return new PageUtils(page); |
|
|
return new PageUtils(page); |
|
|
} |
|
|
} |
|
|
@ -85,6 +92,7 @@ public class RohsServiceImpl extends ServiceImpl<RohsMapper, RohsEntity> impleme |
|
|
public RohsEntity getDetail(String site, String referenceNo) { |
|
|
public RohsEntity getDetail(String site, String referenceNo) { |
|
|
RohsEntity rohs = this.baseMapper.getDetailWithNames(site, referenceNo); |
|
|
RohsEntity rohs = this.baseMapper.getDetailWithNames(site, referenceNo); |
|
|
if (rohs != null) { |
|
|
if (rohs != null) { |
|
|
|
|
|
fillUserDisplayFields(rohs, new HashMap<>()); |
|
|
rohs.setMaterialList(this.getMaterialList(site, referenceNo)); |
|
|
rohs.setMaterialList(this.getMaterialList(site, referenceNo)); |
|
|
} |
|
|
} |
|
|
return rohs; |
|
|
return rohs; |
|
|
@ -529,6 +537,47 @@ public class RohsServiceImpl extends ServiceImpl<RohsMapper, RohsEntity> impleme |
|
|
return String.valueOf(valueObj); |
|
|
return String.valueOf(valueObj); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fillUserDisplayFields(RohsEntity rohs, Map<String, String> userDisplayCache) { |
|
|
|
|
|
if (rohs == null) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
rohs.setHsfApproverName(convertUserCodeListToDisplay(rohs.getHsfApprover(), userDisplayCache)); |
|
|
|
|
|
rohs.setRelatedPeopleName(convertUserCodeListToDisplay(rohs.getRelatedPeople(), userDisplayCache)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String convertUserCodeListToDisplay(String userCodeList, Map<String, String> userDisplayCache) { |
|
|
|
|
|
if (StringUtils.isBlank(userCodeList)) { |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
String[] users = userCodeList.replace(";", ",").split(","); |
|
|
|
|
|
List<String> userDisplayList = new ArrayList<>(); |
|
|
|
|
|
for (String userCode : users) { |
|
|
|
|
|
String normalizedCode = StringUtils.trim(userCode); |
|
|
|
|
|
if (StringUtils.isBlank(normalizedCode)) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
userDisplayList.add(resolveUserDisplay(normalizedCode, userDisplayCache)); |
|
|
|
|
|
} |
|
|
|
|
|
return String.join(";", userDisplayList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String resolveUserDisplay(String userCode, Map<String, String> userDisplayCache) { |
|
|
|
|
|
if (StringUtils.isBlank(userCode)) { |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
String normalizedCode = userCode.trim(); |
|
|
|
|
|
if (userDisplayCache.containsKey(normalizedCode)) { |
|
|
|
|
|
return userDisplayCache.get(normalizedCode); |
|
|
|
|
|
} |
|
|
|
|
|
String userDisplay = normalizedCode; |
|
|
|
|
|
SysUserEntity sysUser = sysUserDao.queryByUserName(normalizedCode); |
|
|
|
|
|
if (sysUser != null && StringUtils.isNotBlank(sysUser.getUserDisplay())) { |
|
|
|
|
|
userDisplay = sysUser.getUserDisplay().trim(); |
|
|
|
|
|
} |
|
|
|
|
|
userDisplayCache.put(normalizedCode, userDisplay); |
|
|
|
|
|
return userDisplay; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void sanitizeHsfStandard(RohsEntity rohs) { |
|
|
private void sanitizeHsfStandard(RohsEntity rohs) { |
|
|
if (rohs == null) { |
|
|
if (rohs == null) { |
|
|
return; |
|
|
return; |
|
|
|