查询不存在清单 导致清单报错问题修复

This commit is contained in:
yuezhihang
2022-01-06 14:14:50 +08:00
parent 043c3e8929
commit 7f2d7b6454
@@ -318,53 +318,55 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
wrapper.eq("sort_key", sortKey); wrapper.eq("sort_key", sortKey);
Page<SarLawsDetailedList> pageRes = new Page<>(page, pageSize); Page<SarLawsDetailedList> pageRes = new Page<>(page, pageSize);
IPage<SarLawsDetailedList> userIPage = sarLawsDetailedListDao.selectPage(pageRes, wrapper); IPage<SarLawsDetailedList> userIPage = sarLawsDetailedListDao.selectPage(pageRes, wrapper);
if ("1".equals(sortKey)) { if ( userIPage.getRecords().size()>0){
Map<String, Object> map = iDicTypeEOService.getDicTypeListCode(); if ("1".equals(sortKey)) {
List<SarLawsDetailedList> list = userIPage.getRecords(); Map<String, Object> map = iDicTypeEOService.getDicTypeListCode();
List<Map<String, String>> arr = (List<Map<String, String>>) map.get("COUNTRY"); List<SarLawsDetailedList> list = userIPage.getRecords();
for (SarLawsDetailedList list1 : list) { List<Map<String, String>> arr = (List<Map<String, String>>) map.get("COUNTRY");
if (StringUtils.isNotBlank(list1.getCountryArea()) && list1.getCountryArea().contains(",")) { for (SarLawsDetailedList list1 : list) {
String[] split = list1.getCountryArea().split(","); if (StringUtils.isNotBlank(list1.getCountryArea()) && list1.getCountryArea().contains(",")) {
StringBuilder builder = new StringBuilder(); String[] split = list1.getCountryArea().split(",");
for (String s : split) { StringBuilder builder = new StringBuilder();
for (String s : split) {
for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(s)) {
s = map1.get("value");
builder.append(s + ",");
break;
}
}
}
String completedString = "";
if (builder.length() > 0) {
completedString = builder.delete(builder.length() - 1, builder.length()).toString();
}
list1.setCountryArea(completedString);
} else {
for (Map<String, String> map1 : arr) { for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(s)) { if (map1.get("value").equals(list1.getCountryArea())) {
s = map1.get("value"); list1.setCountryArea(map1.get("value"));
builder.append(s + ",");
break; break;
} }
} }
} }
String completedString = "";
if (builder.length() > 0) {
completedString = builder.delete(builder.length() - 1, builder.length()).toString();
}
list1.setCountryArea(completedString);
} else {
for (Map<String, String> map1 : arr) {
if (map1.get("value").equals(list1.getCountryArea())) {
list1.setCountryArea(map1.get("value"));
break;
}
}
} }
userIPage.setRecords(list);
} }
userIPage.setRecords(list); List<String> names = new ArrayList<>();
userIPage.getRecords().forEach(sarLawsDetailedList -> {
names.add(sarLawsDetailedList.getUpdatePeople());
});
List<UpDTO> upDTOS = iTsUserService.selectNameById(names, "0");
Map<String, String> stringMap = new HashMap<>();
upDTOS.forEach(upDTO -> {
stringMap.put(upDTO.getId(), upDTO.getValue());
});
userIPage.getRecords().forEach(sarLawsDetailedList -> {
if (null != stringMap.get(sarLawsDetailedList.getUpdatePeople())) {
sarLawsDetailedList.setUpdatePeople(stringMap.get(sarLawsDetailedList.getUpdatePeople()));
}
});
} }
List<String> names = new ArrayList<>();
userIPage.getRecords().forEach(sarLawsDetailedList -> {
names.add(sarLawsDetailedList.getUpdatePeople());
});
List<UpDTO> upDTOS = iTsUserService.selectNameById(names, "0");
Map<String, String> stringMap = new HashMap<>();
upDTOS.forEach(upDTO -> {
stringMap.put(upDTO.getId(), upDTO.getValue());
});
userIPage.getRecords().forEach(sarLawsDetailedList -> {
if (null != stringMap.get(sarLawsDetailedList.getUpdatePeople())) {
sarLawsDetailedList.setUpdatePeople(stringMap.get(sarLawsDetailedList.getUpdatePeople()));
}
});
System.out.println("总条数" + userIPage.getTotal()); System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数" + userIPage.getPages()); System.out.println("总页数" + userIPage.getPages());
return userIPage; return userIPage;