法规清单人名回显问题

This commit is contained in:
yuezhihang
2021-12-21 10:12:55 +08:00
parent e8b84b3088
commit d05f5eb388
@@ -13,6 +13,7 @@ import com.adc.da.slrs.sarLawsDetailedList.entity.TimeDto;
import com.adc.da.slrs.sarLawsDetailedList.service.ISarLawsDetailedListService; import com.adc.da.slrs.sarLawsDetailedList.service.ISarLawsDetailedListService;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.service.impl.SarStandardsInfoServiceImpl; import com.adc.da.slrs.sarStandardsInfo.service.impl.SarStandardsInfoServiceImpl;
import com.adc.da.slrs.sarUser.entity.UpDTO;
import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.sys.service.IDicTypeEOService; import com.adc.da.sys.service.IDicTypeEOService;
import com.adc.da.util.UUIDUtils; import com.adc.da.util.UUIDUtils;
@@ -103,7 +104,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
//就判断页面的值和数据库里的值是否相等 //就判断页面的值和数据库里的值是否相等
for (int i = 0; i < sarLawsDetailedLists.size(); i++) { for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//判断数据库里的数据的车型类别字段是否为空 //判断数据库里的数据的车型类别字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCarType()){ if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCarType()) {
System.out.println("数据库里第" + (i + 1) + "条的车型类别字段长度为空,不重复,目前可以添加"); System.out.println("数据库里第" + (i + 1) + "条的车型类别字段长度为空,不重复,目前可以添加");
} }
//相等就不许添加 //相等就不许添加
@@ -190,7 +191,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
newListMethod(addDetailedDto); newListMethod(addDetailedDto);
return "车型类别清单添加成功"; return "车型类别清单添加成功";
//添加方法结束 //添加方法结束
} else if (carAddFlag == false){ } else if (carAddFlag == false) {
//0表示添加成功,1表示添加失败 //0表示添加成功,1表示添加失败
return "车型类别清单添加失败"; return "车型类别清单添加失败";
} }
@@ -260,7 +261,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
TimeDto dto = new TimeDto(); TimeDto dto = new TimeDto();
dto.setStandId(id[a]); dto.setStandId(id[a]);
//putTiem即ssrq可能为空 '' //putTiem即ssrq可能为空 ''
if (putTime.length>0){ if (putTime.length > 0) {
if ("-".equals(putTime[a]) || null == putTime[a]) { if ("-".equals(putTime[a]) || null == putTime[a]) {
dto.setSsrq(null); dto.setSsrq(null);
} else { } else {
@@ -301,7 +302,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override @Override
public IPage<SarLawsDetailedList> AllSelectD(Integer page, Integer pageSize, String sortKey, public IPage<SarLawsDetailedList> AllSelectD(Integer page, Integer pageSize, String sortKey,
String countryArea, String projectName, String countryArea, String projectName,
String detailedList, String detailedListName,String carType) { String detailedList, String detailedListName, String carType) {
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>(); QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
if ("1".equals(sortKey)) { if ("1".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(countryArea), "country_area", countryArea). wrapper.like(StringUtils.isNotEmpty(countryArea), "country_area", countryArea).
@@ -335,7 +336,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
} }
} }
String completedString = ""; String completedString = "";
if (builder.length()>0) { if (builder.length() > 0) {
completedString = builder.delete(builder.length() - 1, builder.length()).toString(); completedString = builder.delete(builder.length() - 1, builder.length()).toString();
} }
list1.setCountryArea(completedString); list1.setCountryArea(completedString);
@@ -348,11 +349,22 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
} }
} }
} }
/////asdfghjkl
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()));
}
});
System.out.println("总条数" + userIPage.getTotal()); System.out.println("总条数" + userIPage.getTotal());
System.out.println("总页数" + userIPage.getPages()); System.out.println("总页数" + userIPage.getPages());
return userIPage; return userIPage;
@@ -367,8 +379,8 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
//list是数据库里根据id查出来的数据;detailedUpDto是页面传回来的数据 //list是数据库里根据id查出来的数据;detailedUpDto是页面传回来的数据
SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId()); SarLawsDetailedList list = sarLawsDetailedListDao.selectById(detailedUpDto.getId());
System.out.println("数据库里存的当前数据"+list.getCountryArea()); System.out.println("数据库里存的当前数据" + list.getCountryArea());
System.out.println("页面现在的数据"+detailedUpDto.getCountryArea()); System.out.println("页面现在的数据" + detailedUpDto.getCountryArea());
//国家/地区清单 多选是否可以添加的标识,true表示可以添加,false表示不许添加 //国家/地区清单 多选是否可以添加的标识,true表示可以添加,false表示不许添加
boolean multiEditFlag = true; boolean multiEditFlag = true;
@@ -389,10 +401,9 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
//就判断页面的值和数据库里的值是否相等 //就判断页面的值和数据库里的值是否相等
for (int i = 0; i < sarLawsDetailedLists.size(); i++) { for (int i = 0; i < sarLawsDetailedLists.size(); i++) {
//判断数据库里的数据的车型类别字段是否为空 //判断数据库里的数据的车型类别字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCarType()){ if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCarType()) {
System.out.println("数据库里第" + (i + 1) + "条的车型类别字段长度为空,不重复,目前可以添加"); System.out.println("数据库里第" + (i + 1) + "条的车型类别字段长度为空,不重复,目前可以添加");
} } else if (Objects.equals(detailedUpDto.getCarType(), list.getCarType())) {
else if (Objects.equals(detailedUpDto.getCarType(), list.getCarType())){
System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交"); System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交");
} }
//相等就不许添加 //相等就不许添加
@@ -408,8 +419,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
//就先判断数据库里的数据的国家/地区字段是否为空 //就先判断数据库里的数据的国家/地区字段是否为空
if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCountryArea()) { if (null == sarLawsDetailedLists.get(i) || null == sarLawsDetailedLists.get(i).getCountryArea()) {
System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度为空,不重复,目前可以添加"); System.out.println("数据库里第" + (i + 1) + "条的国家地区字段长度为空,不重复,目前可以添加");
} } else if (Objects.equals(detailedUpDto.getCountryArea(), list.getCountryArea())) {
else if (Objects.equals(detailedUpDto.getCountryArea(), list.getCountryArea())){
System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交"); System.out.println("页面的数据和数据库里存的当前数据相同,说明没有做更改,允许提交");
} }
//再判断页面字段长度是否与数据库里的长度一样,如果长度不一样,允许新增 //再判断页面字段长度是否与数据库里的长度一样,如果长度不一样,允许新增
@@ -483,7 +493,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
updateListMethod(detailedUpDto); updateListMethod(detailedUpDto);
return "车型类别清单修改成功"; return "车型类别清单修改成功";
//添加方法结束 //添加方法结束
} else if (carEditFlag == false){ } else if (carEditFlag == false) {
//0表示添加成功,1表示添加失败 //0表示添加成功,1表示添加失败
return "车型类别清单修改失败"; return "车型类别清单修改失败";
} }
@@ -503,7 +513,6 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
} }
} }
private void updateListMethod(DetailedUpDto detailedUpDto) { private void updateListMethod(DetailedUpDto detailedUpDto) {
@@ -595,7 +604,7 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
service.updateDetailedLaws(detailedUpDto.getId(), timeDto); service.updateDetailedLaws(detailedUpDto.getId(), timeDto);
//更新标准是否纳入认证清单 //更新标准是否纳入认证清单
sarStandardsInfoDao.updateISRELATEACCESSById("1",Arrays.asList(detailedUpDto.getInforlist().split(",")) ); sarStandardsInfoDao.updateISRELATEACCESSById("1", Arrays.asList(detailedUpDto.getInforlist().split(",")));
} }
} }
@@ -612,10 +621,10 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override @Override
public void standardToLaws(String countryArea,TimeDto timeDto) { public void standardToLaws(String countryArea, TimeDto timeDto) {
if (countryArea==null){ if (countryArea == null) {
countryArea=""; countryArea = "";
} }
@@ -627,39 +636,38 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
//1.获取标准清单的"国家/地区" //1.获取标准清单的"国家/地区"
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>(); QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
wrapper.select("country_area","id"); wrapper.select("country_area", "id");
//查询清单中的国家地区和清单id //查询清单中的国家地区和清单id
List<SarLawsDetailedList> sarLawsDetailedLists = sarLawsDetailedListDao.selectList(wrapper); List<SarLawsDetailedList> sarLawsDetailedLists = sarLawsDetailedListDao.selectList(wrapper);
//2.判断修改的标准的"国家/地区"与清单中的是否一致,一致则添加到清单中,不一致不作处理 //2.判断修改的标准的"国家/地区"与清单中的是否一致,一致则添加到清单中,不一致不作处理
String[] split = countryArea.split(","); //拆分标准中的国家地区 String[] split = countryArea.split(","); //拆分标准中的国家地区
//遍历清单 对比国家地区 //遍历清单 对比国家地区
for (SarLawsDetailedList lawsDetailed : sarLawsDetailedLists) { for (SarLawsDetailedList lawsDetailed : sarLawsDetailedLists) {
if (lawsDetailed.getCountryArea()==null){ if (lawsDetailed.getCountryArea() == null) {
continue; continue;
} }
String[] sarLawsCounties = lawsDetailed.getCountryArea().split(",");//拆分清单中的国家地区 String[] sarLawsCounties = lawsDetailed.getCountryArea().split(",");//拆分清单中的国家地区
// 对比清单列表中的国家地区,是否一致 // 对比清单列表中的国家地区,是否一致
Arrays.sort(split); Arrays.sort(split);
Arrays.sort(sarLawsCounties); Arrays.sort(sarLawsCounties);
if ( Arrays.equals(split,sarLawsCounties)){ if (Arrays.equals(split, sarLawsCounties)) {
//一致时插入表并关联detailedListId和standId //一致时插入表并关联detailedListId和standId
ArrayList<TimeDto> timeDtos = new ArrayList<>(); ArrayList<TimeDto> timeDtos = new ArrayList<>();
timeDtos.add(timeDto); timeDtos.add(timeDto);
QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>(); QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stand_id",timeDto.getStandId()); queryWrapper.eq("stand_id", timeDto.getStandId());
//如果目标清单中已存标准在则更新 懒得写更新(⓿_⓿) 直接删掉,再重新插入 //如果目标清单中已存标准在则更新 懒得写更新(⓿_⓿) 直接删掉,再重新插入
if (sarLawsAttrDetailedListDao.selectCount(queryWrapper)>0) { if (sarLawsAttrDetailedListDao.selectCount(queryWrapper) > 0) {
sarLawsAttrDetailedListDao.delete(queryWrapper); sarLawsAttrDetailedListDao.delete(queryWrapper);
} }
sarLawsAttrDetailedListService.insertDetailedList(lawsDetailed.getId(),timeDtos); sarLawsAttrDetailedListService.insertDetailedList(lawsDetailed.getId(), timeDtos);
break; break;
} }
} }