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
@@ -194,6 +194,16 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
return Result.success(result);
}
@ApiOperation(value = "|SarBussionessStandEO|详情")
@GetMapping("/getStandInfoUpdateById")
//@RequiresPermissions("lawss:sarStandardsInfo:get")
public ResponseMessage<SarBussionessStand> getStandInfoUpdateById(String id) throws Exception {
SarBussionessStand result = sarBussionessStandEOService.selectStandardsInfoUpdateByKey(id);
String collectId = personCollectEOService.queryCollectByUserAndId(id);
result.setCollectId(collectId);
return Result.success(result);
}
/**
* 给指定标准配置目录
* @param standardsInfoEO
@@ -30,6 +30,8 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
SarBussionessStand selectStandardsInfoByKey(String id) throws Exception;
SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception;
SarBussionessStandEOPage updateStandardsMenu(SarBussionessStandEOPage standardsInfoEO);
List<SarBussionessStand> queryByList(SarBussionessStandEOPage sarBussionessStandEOPage);
@@ -35,6 +35,7 @@ import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
import com.adc.da.slrs.sarUser.service.ITsUserService;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
@@ -60,6 +61,7 @@ import org.springframework.stereotype.Service;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -708,6 +710,19 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
return sarBussionessStandEO;
}
@Override
public SarBussionessStand selectStandardsInfoUpdateByKey(String id) throws Exception{
List<SarBussionessStand> sarBussionessStandlist = this.baseMapper.selectStandardsInfoByKey(id);
SarBussionessStand sarBussionessStandEO = new SarBussionessStand();
if(!sarBussionessStandlist.isEmpty()) {
List<SarBussionessStand> newStandList = new ArrayList<>();
newStandList.add(sarBussionessStandlist.get(0));
attrInfo(newStandList);
sarBussionessStandEO = newStandList.get(0);
}
return sarBussionessStandEO;
}
public void attrInfoShowDetails(List<SarBussionessStand> sarlist) throws Exception {
for (SarBussionessStand row : sarlist) {
attrInfoDetails(row);
@@ -802,7 +817,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page);
attrInfo(sarlist);
attrInfoCollect(sarlist);
return sarlist;
}
@@ -817,6 +832,17 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
public void attrInfoCollect (List<SarBussionessStand> sarlist) throws Exception {
List<String> collectResIds = sarlist.stream().map(SarBussionessStand::getId).collect(Collectors.toList());
Map<String,String> collectMap = personCollectEOService.queryCollectByUserAndIds(collectResIds);
for (SarBussionessStand row : sarlist) {
if(collectMap != null && collectMap.get(row.getId()) != null){
row.setCollectId(collectMap.get(row.getId()));
}
}
}
public void attrInfo1 (SarBussionessStand row) throws Exception {
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
@@ -939,13 +965,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (value1 != null && value1.toString().equals("\"null\"")){
entry.setValue("");
}
if ("SVPPS".equals(name)) {
Object value = entry.getValue();
if (value != null && StringUtils.isNotBlank(value.toString())) {
value = sysInfoEOService.getSvppsNamesByIds(value.toString());
}
newMap.put(name + "Name",value);
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
String value = entry.getValue().toString();
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
@@ -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();