feat: There is no way the, TO optimize the query

This commit is contained in:
super_liu
2021-10-22 15:50:07 +08:00
parent d8053efe8e
commit 9eff2340a2
16 changed files with 503 additions and 101 deletions
@@ -466,6 +466,14 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(result);
}
@ApiOperation(value = "|SarStandardsInfoEO|修改详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarStandardsInfo> findUpdateById(String id) throws Exception {
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoUpdateByKey(id);
return Result.success(result);
}
@ApiOperation(value = "|SarStandardsInfoEO|确认配置标准")
@PostMapping("/saveStandardsMenu")
//@RequiresPermissions("lawss:sarStandardsInfo:saveStandardsMenu")
@@ -37,6 +37,8 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
SarStandardsInfo selectStandardsInfoByKey(String id) throws Exception;
SarStandardsInfo selectStandardsInfoUpdateByKey(String id) throws Exception;
public void attrInfoDetails (SarStandardsInfo row) throws Exception;
boolean updateStandardsMenu(SarStandardsInfoEOPage standardsInfoEO);
@@ -307,10 +307,16 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
Integer rowCount = dao.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarStandardsInfo> sarlist = dao.getSarStandardsInfoPage(page);
attrInfo(sarlist);
attrInfoCollect(sarlist);
return sarlist;
}
public void attrInfo(List<SarStandardsInfo> sarlist) throws Exception {
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);
}
}
/***
* @Description: 处理属性表数据
* @Author: super_liu
@@ -318,9 +324,13 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Param: [sarlist]
* @Return: void
*/
public void attrInfo(List<SarStandardsInfo> sarlist) throws Exception {
public void attrInfoCollect(List<SarStandardsInfo> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarStandardsInfo::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarStandardsInfo row : sarlist) {
attrInfoDetails(row);
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
@@ -344,44 +354,11 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
Map<String, Object> newMap = new HashMap<>();
if (getAttrMap != null) {
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
if ("EOPSSRQ".equals(entry.getKey())) {
if (entry.getValue() != null && entry.getValue().toString().length() > 10) {
String time = DateUtil.formatStrUTCToDateStr(entry.getValue().toString());
entry.setValue(time);
}
}
String name = entry.getKey();
if ("\"null\"".equals(entry.getValue())) {
entry.setValue("");
}
if ("SVPPS".equals(name)) {
Set<String> set = new HashSet();
// 查询条款svpps
Set<String> itemSvpps = sarStandItemsEODao.selectSvppsByStandId(row.getId(), null, null);
if (itemSvpps != null && !itemSvpps.isEmpty()) {
set.addAll(itemSvpps);
}
Object value = entry.getValue();
if (value != null && StringUtils.isNotBlank(value.toString())) {
set.addAll(Arrays.asList(value.toString().split(",")));
}
String allVal = ConcatStringUtil.concatSet(set);
if (StringUtils.isNotBlank(allVal)) {
entry.setValue(allVal);
value = sysInfoEOService.getSvppsNamesByIds(allVal);
}
newMap.put(name + "Name", value);
} else if ("YQLX".equals(name)) {
//要求类型来源于条款
SarStandItems sarStandItemsEO = new SarStandItems();
sarStandItemsEO.setStandId(row.getId());
Set<String> itemClaimType = sarStandItemsEODao.selectClaimTypesByStandId(row.getId(), null, null);
if (itemClaimType != null && itemClaimType.size() > 1) {
entry.setValue("RENVECPFGT");
} else if (itemClaimType != null && itemClaimType.size() == 1) {
entry.setValue(itemClaimType.toArray()[0]);
}
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMap.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
@@ -2156,6 +2133,30 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return sarStandardsInfoEO;
}
public SarStandardsInfo selectStandardsInfoUpdateByKey(String id) throws Exception {
//查询出详情信息
List<SarStandardsInfo> resultlist = dao.selectStandardsInfoByKey(id);
SarStandardsInfo sarStandardsInfoEO = new SarStandardsInfo();
if (resultlist.size() > 0) {
List<SarStandardsInfo> sarStandardsInfoEOList = new ArrayList<>();
sarStandardsInfoEOList.add(resultlist.get(0));
attrInfo(sarStandardsInfoEOList);
sarStandardsInfoEO = sarStandardsInfoEOList.get(0);
}
// 查询纳入清单的国家地区
if (sarStandardsInfoEO != null) {
if(sarStandardsInfoEO.getStandSystem() != null){
SarMenuStandard menu = sarMenuStandardService.selectMenuById(sarStandardsInfoEO.getStandSystem());
if(menu != null){
sarStandardsInfoEO.setStandSystemName(menu.getMenuName() == null ? "" : menu.getMenuName());
}
}
String accessCountry = sarSarAccessEOService.getCountryByRes(sarStandardsInfoEO.getId(), sarStandardsInfoEO.getStandType() + "_STAND");
sarStandardsInfoEO.setAccessCountry(accessCountry);
}
return sarStandardsInfoEO;
}
public boolean updateStandardsMenu(SarStandardsInfoEOPage standardsInfoEO) {
SarStandMenu sarStandMenuEO = new SarStandMenu();
String nowMenuId = standardsInfoEO.getMenuId();