fix: 修复线上报错的BUG
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
|
||||
+25
-15
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user