fix: 修复线上报错的BUG

This commit is contained in:
zyd
2022-07-13 22:51:31 +08:00
parent fb8d1d62ec
commit e2ce4daf7d
6 changed files with 54 additions and 25 deletions
@@ -47,7 +47,9 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
if(sarMenuStandardNew.getDicId()!=null){
queryWrapper.eq("DIC_ID", sarMenuStandardNew.getDicId());
}
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
if(access!=null && !access.isEmpty()){
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
}
queryWrapper.isNull("PARENT_ID");
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper);
@@ -56,7 +58,9 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
resource.setTreeType("sarMs");
QueryWrapper<SarMenuStandard> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS",resource.getId());
TsResourceQueryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
if(access!=null && !access.isEmpty()){
TsResourceQueryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
}
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<SarMenuStandard> children=dao.selectList(TsResourceQueryWrapper);
resource.setChildren(recursionGetListChildrenStand((resource),(children)));
@@ -268,7 +268,9 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
}
queryWrapper.isNull("PARENT_ID");
queryWrapper.eq("VALID_FLAG","0");
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
if(access!=null && !access.isEmpty()){
queryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
}
queryWrapper.orderByAsc("DISPLAY_SEQ");
TsResources=dao.selectList(queryWrapper);
@@ -276,7 +278,9 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
resource.setTreeType("tsr");
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
TsResourceQueryWrapper.like("PARENT_IDS",","+resource.getId()+",");
TsResourceQueryWrapper.in(null!=access,"ID",access);
if(access!=null && !access.isEmpty()){
TsResourceQueryWrapper.in(null!=access && !access.isEmpty(),"ID",access);
}
TsResourceQueryWrapper.eq("VALID_FLAG","0");
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
@@ -29,7 +29,7 @@ public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLib
Integer selectCountWorkFlow(@Param("qu") SarStandProjectLibrary sar,@Param("flag")int flag);
List<String> getAllStands();
List<String> getAllStand();
List<SarStandProjectLibrary> updateByProjectId(@Param("id")String id, @Param("version")String version);
void updateByProjectId(@Param("id")String id, @Param("version")String version);
List<SarStandProjectLibrary> updateByProjectIdBath(@Param("id")List<String> id, @Param("version")String version);
void deleteByProjectId(@Param("projectId")String projectId);
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -491,30 +492,39 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
@Override
public void batchInsert(List<StandProjectRelationDto> list) {
sarStandProjectLibraryDao.updateFlag(list.get(0).getProjectId());
sarStandProjectLibraryDao.deleteByProjectId(list.get(0).getProjectId());
if(list!=null && !list.isEmpty()){
StandProjectRelationDto standProjectRelationDto = list.get(0);
if(standProjectRelationDto!=null && StringUtils.isNotBlank(standProjectRelationDto.getProjectId())){
sarStandProjectLibraryDao.updateFlag(standProjectRelationDto.getProjectId());
sarStandProjectLibraryDao.deleteByProjectId(standProjectRelationDto.getProjectId());
}
sarStandProjectLibraryDao.batchInsert(list);
sarStandProjectLibraryDao.updateByProjectId(list.get(0).getProjectId(), TimeVersion());
if(standProjectRelationDto!=null && StringUtils.isNotBlank(standProjectRelationDto.getProjectId())){
sarStandProjectLibraryDao.updateByProjectId(standProjectRelationDto.getProjectId(), TimeVersion());
}
}
}
@Override
public void batchInsertAdd(List<StandProjectRelationDto> list) {
List<String> ids=new ArrayList<>();
List<String> projectIds=new ArrayList<>();
list.forEach(standProjectRelationDto -> {
if (!ids.contains(standProjectRelationDto.getStandId())) {
ids.add(standProjectRelationDto.getStandId());
}});
if(list!=null && !list.isEmpty()){
list.forEach(standProjectRelationDto -> {
if (!ids.contains(standProjectRelationDto.getStandId())) {
ids.add(standProjectRelationDto.getStandId());
}});
}
List<String> standProjectRelationDtos=sarStandProjectLibraryDao.selectListByids(ids);
List<StandProjectRelationDto> ins=new ArrayList<>();
list.forEach(standProjectRelationDto -> {
if (!standProjectRelationDtos.contains(standProjectRelationDto.getProjectId())){
ins.add(standProjectRelationDto);
projectIds.add(standProjectRelationDto.getProjectId());
}
});
if(list!=null && !list.isEmpty()){
list.forEach(standProjectRelationDto -> {
if (!standProjectRelationDtos.contains(standProjectRelationDto.getProjectId())){
ins.add(standProjectRelationDto);
projectIds.add(standProjectRelationDto.getProjectId());
}
});
}
sarStandProjectLibraryDao.batchInsert(ins);
sarStandProjectLibraryDao.updateByProjectIdBath(projectIds, TimeVersion());
}
@@ -567,8 +567,13 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
@GetMapping("/getStandInfoById")
@EpcLog(description = "国内或国外详情查询",businessType = BusinessType.查询,speclaiFlag = "1",speclaiValue = "查询详情")
public ResponseMessage<SarStandardsInfo> find(String id) throws Exception {
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoByKey(id);
return Result.success(result);
if(StringUtils.isNotBlank(id)){
SarStandardsInfo result = sarStandardsInfoEOService.selectStandardsInfoByKey(id);
return Result.success(result);
}else{
return Result.error("-1","数据传参错误",null);
}
}
@ApiOperation(value = "|SarStandardsInfoEO|修改详情")
@@ -1979,14 +1979,20 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// 发布稿
List<String> fbgNew = new ArrayList<>();
if(newMap!=null && newMap.containsKey("FBGBJBD")){
fbgNew = Arrays.stream(newMap.getOrDefault("FBGBJBD", "").toString().split(","))
.map(String::trim).collect(Collectors.toList());
String fbgbjbd = String.valueOf(newMap.getOrDefault("FBGBJBD", ""));
if(StringUtils.isNotBlank(fbgbjbd)){
fbgNew = Arrays.stream(fbgbjbd.split(","))
.map(String::trim).collect(Collectors.toList());
}
}
List<String> fbgOld = new ArrayList<>();
if(oldMap!=null && oldMap.containsKey("FBGBJBD")){
fbgOld = Arrays.stream(oldMap.getOrDefault("FBGBJBD", "").toString().split(","))
String fbgbjbd = String.valueOf(oldMap.getOrDefault("FBGBJBD", ""));
if(StringUtils.isNotBlank(fbgbjbd)){
fbgOld = Arrays.stream(fbgbjbd.split(","))
.map(String::trim).collect(Collectors.toList());
}
}
// 取差集 判断是否有新的发布稿