Merge branch 'develop_3' into 'develop_master'
Develop 3 See merge request LiuChao/foton-slrs-system-rest!166
This commit is contained in:
@@ -24,8 +24,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@EnableScheduling
|
||||
@Component
|
||||
@@ -215,56 +215,50 @@ public class ScheduledJob {
|
||||
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表
|
||||
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
|
||||
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
|
||||
|
||||
|
||||
// 格式为 T/CSAE 175-2021
|
||||
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
|
||||
replaceStandIdMaps.forEach(item->{
|
||||
if (item!=null){
|
||||
//此标准代替的标准的标准号的数组
|
||||
String DTBJHStr = item.get("DTBJH").toString();
|
||||
|
||||
//数据格式: (GB 123-2000,GB 4233434-2021,GB 423423423-2021)
|
||||
if (!DTBJHStr.equals("")){
|
||||
try{
|
||||
String[] DTBJHArray = DTBJHStr.split(",");
|
||||
for (String DTBJH : DTBJHArray) {
|
||||
String[] sortAndNumberAndYear = DTBJH.split("\\s+");
|
||||
String sort = sortAndNumberAndYear[0];
|
||||
|
||||
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
|
||||
String number=numberAndYear[0];
|
||||
String year=numberAndYear[1];
|
||||
|
||||
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
|
||||
infoWrapper.select("ID")
|
||||
.eq("STAND_SORT",sort)
|
||||
.eq("STAND_NUMBER",number)
|
||||
.eq("STAND_YEAR",year);
|
||||
|
||||
|
||||
List<Map<String, Object>> idMaps = sarStandardsInfoDao.selectMaps(infoWrapper);
|
||||
if (idMaps.size()>0){
|
||||
String standId = idMaps.get(0).get("ID").toString();
|
||||
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
||||
if (replaceIdCountMap.containsKey(standId)) {
|
||||
replaceIdCountMap.replace(standId,2);
|
||||
}else {
|
||||
replaceIdCountMap.put(standId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!DTBJHStr.equals("")) {
|
||||
String[] DTBJHArray = DTBJHStr.split(",");
|
||||
for (String DTBJH : DTBJHArray) {
|
||||
|
||||
if (!pattern.matcher(DTBJH).matches()){
|
||||
continue;
|
||||
}
|
||||
}catch (Exception e){
|
||||
System.out.println("=====错误===="+item+"=====错误=====");
|
||||
|
||||
String[] split = DTBJH.split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
|
||||
String sort = split[0];
|
||||
String number = split[1];
|
||||
String year = split[2];
|
||||
|
||||
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
|
||||
infoWrapper.select("ID")
|
||||
.eq("STAND_SORT", sort)
|
||||
.eq("STAND_NUMBER", number)
|
||||
.eq("STAND_YEAR", year);
|
||||
|
||||
|
||||
List<Map<String, Object>> idMaps = sarStandardsInfoDao.selectMaps(infoWrapper);
|
||||
if (idMaps.size() > 0) {
|
||||
String standId = idMaps.get(0).get("ID").toString();
|
||||
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
||||
if (replaceIdCountMap.containsKey(standId)) {
|
||||
replaceIdCountMap.replace(standId, 2);
|
||||
} else {
|
||||
replaceIdCountMap.put(standId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+197
-178
@@ -34,7 +34,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Service
|
||||
public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDto> implements ImportExcelService {
|
||||
@@ -285,6 +287,8 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
private String importPath;
|
||||
|
||||
private List<ImportDto> error=new ArrayList<>();
|
||||
|
||||
private List<ImportDto> fileError=new ArrayList<>();
|
||||
@Override
|
||||
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
|
||||
|
||||
@@ -302,44 +306,44 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
//
|
||||
if (sarStandardsInfo!=null)
|
||||
{
|
||||
// SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
||||
//
|
||||
// sarStandardsInfo.setValidFlag("0");
|
||||
// sarStandardsInfo.setStandType("FOREIGN");
|
||||
// QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
||||
// standSaveWrapper
|
||||
// .eq("STAND_SORT",sarStandardsInfo.getStandSort())
|
||||
// .eq("STAND_NUMBER",sarStandardsInfo.getStandNumber())
|
||||
// .eq("STAND_YEAR",sarStandardsInfo.getStandYear());
|
||||
//
|
||||
// SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
|
||||
// if (one!=null){
|
||||
// sarStandardsInfo.setId(one.getId());
|
||||
//
|
||||
// sarStandardsInfoService.update(sarStandardsInfo,standSaveWrapper);
|
||||
// QueryWrapper<SarStandAttrInfo> standAttrWrapper = new QueryWrapper<>();
|
||||
// standAttrWrapper.eq("STAND_ID",one.getId());
|
||||
//
|
||||
// sarStandAttrInfo.setStandId(one.getId());
|
||||
// sarStandAttrInfoService.update(sarStandAttrInfo,standAttrWrapper);
|
||||
// }else {
|
||||
// sarStandardsInfoService.save(sarStandardsInfo);
|
||||
// String field="ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ";
|
||||
// String value="\'"+sarStandAttrInfo.getId()+"\'"+","+ "\'"+sarStandAttrInfo.getStandId()+"\'"+","+"\'"+"0"+"\'";
|
||||
//
|
||||
//
|
||||
// if (sarStandAttrInfo.getDtbjh()!=null){
|
||||
// value+=","+"\'"+sarStandAttrInfo.getDtbjh()+"\'";
|
||||
// }
|
||||
//
|
||||
// if (sarStandAttrInfo.getSsrq()!=null){
|
||||
// value+=","+"\'"+sarStandAttrInfo.getSsrq()+"\'";
|
||||
// }
|
||||
// sarStandAttrInfoDao.insertStandAttr(field,value);
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
||||
|
||||
sarStandardsInfo.setValidFlag("0");
|
||||
sarStandardsInfo.setStandType("FOREIGN");
|
||||
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
||||
standSaveWrapper
|
||||
.eq("STAND_SORT",sarStandardsInfo.getStandSort())
|
||||
.eq("STAND_NUMBER",sarStandardsInfo.getStandNumber())
|
||||
.eq("STAND_YEAR",sarStandardsInfo.getStandYear());
|
||||
|
||||
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
|
||||
if (one!=null){
|
||||
sarStandardsInfo.setId(one.getId());
|
||||
|
||||
sarStandardsInfoService.update(sarStandardsInfo,standSaveWrapper);
|
||||
QueryWrapper<SarStandAttrInfo> standAttrWrapper = new QueryWrapper<>();
|
||||
standAttrWrapper.eq("STAND_ID",one.getId());
|
||||
|
||||
sarStandAttrInfo.setStandId(one.getId());
|
||||
sarStandAttrInfoService.update(sarStandAttrInfo,standAttrWrapper);
|
||||
}else {
|
||||
sarStandardsInfoService.save(sarStandardsInfo);
|
||||
String field="ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ";
|
||||
String value="\'"+sarStandAttrInfo.getId()+"\'"+","+ "\'"+sarStandAttrInfo.getStandId()+"\'"+","+"\'"+"0"+"\'";
|
||||
|
||||
|
||||
if (sarStandAttrInfo.getDtbjh()!=null){
|
||||
value+=","+"\'"+sarStandAttrInfo.getDtbjh()+"\'";
|
||||
}
|
||||
|
||||
if (sarStandAttrInfo.getSsrq()!=null){
|
||||
value+=","+"\'"+sarStandAttrInfo.getSsrq()+"\'";
|
||||
}
|
||||
sarStandAttrInfoDao.insertStandAttr(field,value);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
@@ -362,48 +366,48 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID);
|
||||
|
||||
if (sarStandardsInfo!=null){
|
||||
// SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
||||
//
|
||||
// sarStandardsInfo.setValidFlag("0");
|
||||
// sarStandardsInfo.setStandType("INLAND");
|
||||
//
|
||||
//
|
||||
// QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
||||
// standSaveWrapper
|
||||
// .eq("STAND_SORT",sarStandardsInfo.getStandSort())
|
||||
// .eq("STAND_NUMBER",sarStandardsInfo.getStandNumber())
|
||||
// .eq("STAND_YEAR",sarStandardsInfo.getStandYear());
|
||||
//
|
||||
//
|
||||
// SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
|
||||
// if (one!=null){
|
||||
// sarStandardsInfo.setId(one.getId());
|
||||
// sarStandardsInfoService.update(sarStandardsInfo,standSaveWrapper);
|
||||
//
|
||||
// QueryWrapper<SarStandAttrInfo> standAttrWrapper = new QueryWrapper<>();
|
||||
// standAttrWrapper.eq("STAND_ID",one.getId());
|
||||
// sarStandAttrInfo.setStandId(one.getId());
|
||||
// sarStandAttrInfoService.update(sarStandAttrInfo,standAttrWrapper);
|
||||
// }else {
|
||||
//
|
||||
//
|
||||
// sarStandardsInfoService.save(sarStandardsInfo);
|
||||
//
|
||||
//
|
||||
// String field="ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ";
|
||||
// String value="\'"+sarStandAttrInfo.getId()+"\'"+","+"\'"+sarStandAttrInfo.getStandId()+"\'"+","+"\'"+"0"+"\'";
|
||||
//
|
||||
//
|
||||
// if (sarStandAttrInfo.getDtbjh()!=null){
|
||||
// value+=","+"\'"+sarStandAttrInfo.getDtbjh()+"\'";
|
||||
// }
|
||||
//
|
||||
// if (sarStandAttrInfo.getSsrq()!=null){
|
||||
// value+=","+"\'"+sarStandAttrInfo.getSsrq()+"\'";
|
||||
// }
|
||||
// sarStandAttrInfoDao.insertStandAttr(field,value);
|
||||
//
|
||||
// }
|
||||
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
||||
|
||||
sarStandardsInfo.setValidFlag("0");
|
||||
sarStandardsInfo.setStandType("INLAND");
|
||||
|
||||
|
||||
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
||||
standSaveWrapper
|
||||
.eq("STAND_SORT",sarStandardsInfo.getStandSort())
|
||||
.eq("STAND_NUMBER",sarStandardsInfo.getStandNumber())
|
||||
.eq("STAND_YEAR",sarStandardsInfo.getStandYear());
|
||||
|
||||
|
||||
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
|
||||
if (one!=null){
|
||||
sarStandardsInfo.setId(one.getId());
|
||||
sarStandardsInfoService.update(sarStandardsInfo,standSaveWrapper);
|
||||
|
||||
QueryWrapper<SarStandAttrInfo> standAttrWrapper = new QueryWrapper<>();
|
||||
standAttrWrapper.eq("STAND_ID",one.getId());
|
||||
sarStandAttrInfo.setStandId(one.getId());
|
||||
sarStandAttrInfoService.update(sarStandAttrInfo,standAttrWrapper);
|
||||
}else {
|
||||
|
||||
|
||||
sarStandardsInfoService.save(sarStandardsInfo);
|
||||
|
||||
|
||||
String field="ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ";
|
||||
String value="\'"+sarStandAttrInfo.getId()+"\'"+","+"\'"+sarStandAttrInfo.getStandId()+"\'"+","+"\'"+"0"+"\'";
|
||||
|
||||
|
||||
if (sarStandAttrInfo.getDtbjh()!=null){
|
||||
value+=","+"\'"+sarStandAttrInfo.getDtbjh()+"\'";
|
||||
}
|
||||
|
||||
if (sarStandAttrInfo.getSsrq()!=null){
|
||||
value+=","+"\'"+sarStandAttrInfo.getSsrq()+"\'";
|
||||
}
|
||||
sarStandAttrInfoDao.insertStandAttr(field,value);
|
||||
|
||||
}
|
||||
}else {
|
||||
item.setErrorStr("标准号无法解析");
|
||||
error.add(item);
|
||||
@@ -424,45 +428,39 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
|
||||
if (sarBussionessStand!=null) {
|
||||
|
||||
SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId);
|
||||
|
||||
|
||||
// SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId);
|
||||
//
|
||||
//
|
||||
try {
|
||||
// QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>();
|
||||
// saveWrapper.eq("STAND_CODE", item.getStandId());
|
||||
// SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper);
|
||||
// if (one != null) {
|
||||
// sarBussionessStand.setId(one.getId());
|
||||
// sarBussionessStandService.update(sarBussionessStand, saveWrapper);
|
||||
//
|
||||
// QueryWrapper<SarBussStandAttrInfo> bussAttrWrapper = new QueryWrapper<>();
|
||||
// bussAttrWrapper.eq("STAND_ID", one.getId());
|
||||
// sarBussStandAttrInfo.setStandId(one.getId());
|
||||
// sarBussStandAttrInfoService.update(sarBussStandAttrInfo, bussAttrWrapper);
|
||||
// sarBussStandAttrInfoDao.updateStandInfo(one.getId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
|
||||
//
|
||||
// } else {
|
||||
// sarBussionessStandService.save(sarBussionessStand);
|
||||
// sarBussStandAttrInfoService.save(sarBussStandAttrInfo);
|
||||
//
|
||||
// sarBussStandAttrInfoDao.updateStandInfo(sarBussStandAttrInfo.getStandId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
|
||||
// }
|
||||
QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>();
|
||||
saveWrapper.eq("STAND_CODE", item.getStandId());
|
||||
SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper);
|
||||
if (one != null) {
|
||||
sarBussionessStand.setId(one.getId());
|
||||
sarBussionessStandService.update(sarBussionessStand, saveWrapper);
|
||||
|
||||
QueryWrapper<SarBussStandAttrInfo> bussAttrWrapper = new QueryWrapper<>();
|
||||
bussAttrWrapper.eq("STAND_ID", one.getId());
|
||||
sarBussStandAttrInfo.setStandId(one.getId());
|
||||
sarBussStandAttrInfoService.update(sarBussStandAttrInfo, bussAttrWrapper);
|
||||
sarBussStandAttrInfoDao.updateStandInfo(one.getId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
|
||||
|
||||
} else {
|
||||
sarBussionessStandService.save(sarBussionessStand);
|
||||
sarBussStandAttrInfoService.save(sarBussStandAttrInfo);
|
||||
|
||||
sarBussStandAttrInfoDao.updateStandInfo(sarBussStandAttrInfo.getStandId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
item.setErrorStr("数据格式错误");
|
||||
error.add(item);
|
||||
importListMap.replace("error",error);
|
||||
System.out.println("issueTime====Hello======" + sarBussionessStand.getIssueTime() + "===hello=====" + item);
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
item.setErrorStr("标准号无法解析");
|
||||
error.add(item);
|
||||
importListMap.replace("error",error);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -472,8 +470,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
// String head="standId,standName,standNameEN,publishTime,implementedTime" +
|
||||
// ",standStatus,replaceId,path";
|
||||
// String headStr="标准号,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,附件路径";
|
||||
|
||||
|
||||
error.addAll(fileError);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -484,41 +481,34 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
|
||||
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,String standId){
|
||||
|
||||
String sort="";
|
||||
String number="";
|
||||
String year="";
|
||||
try {
|
||||
String[] sortAndNumberAndYear = importDto.getStandId().split("\\s+");
|
||||
sort = sortAndNumberAndYear[0];
|
||||
|
||||
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
|
||||
number=numberAndYear[0];
|
||||
year=numberAndYear[1];
|
||||
|
||||
}catch (Exception e){
|
||||
HashMap<String, String> analysis = analysisStandId(importDto);
|
||||
if (analysis==null){
|
||||
return null;
|
||||
}else {
|
||||
|
||||
System.out.println("id为"+importDto.getStandId()+"格式无法解析");
|
||||
// return null;
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(standId);
|
||||
|
||||
|
||||
sarStandardsInfo.setStandSort(analysis.get("sort"));
|
||||
sarStandardsInfo.setStandNumber(analysis.get("number"));
|
||||
sarStandardsInfo.setStandYear(analysis.get("year"));
|
||||
|
||||
sarStandardsInfo.setStandName(importDto.getStandName());
|
||||
sarStandardsInfo.setStandEnName(importDto.getStandNameEN());
|
||||
|
||||
String issueDate = importDto.getPublishTime().substring(0, 9);
|
||||
sarStandardsInfo.setIssueTime(issueDate);//标准发布日期
|
||||
|
||||
String standStatus = importDto.getStandStatus();
|
||||
if ("有效".equals(standStatus)) {
|
||||
sarStandardsInfo.setTextStatus("vsaga7nwub");//现行有效
|
||||
}
|
||||
|
||||
return sarStandardsInfo;
|
||||
}
|
||||
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(standId);
|
||||
|
||||
|
||||
sarStandardsInfo.setStandSort(sort);
|
||||
sarStandardsInfo.setStandNumber(number);
|
||||
sarStandardsInfo.setStandYear(year);
|
||||
|
||||
sarStandardsInfo.setStandName(importDto.getStandName());
|
||||
sarStandardsInfo.setStandEnName(importDto.getStandNameEN());
|
||||
sarStandardsInfo.setIssueTime(importDto.getPublishTime());//标准发布日期
|
||||
|
||||
String standStatus = importDto.getStandStatus();
|
||||
if ("有效".equals(standStatus)){
|
||||
sarStandardsInfo.setTextStatus("vsaga7nwub");//现行有效
|
||||
}
|
||||
|
||||
return sarStandardsInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -531,7 +521,9 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
sarStandAttrInfo.setId(UUIDUtils.randomUUID20());
|
||||
sarStandAttrInfo.setStandId(standId);
|
||||
sarStandAttrInfo.setDtbjh(importDto.getReplaceId());
|
||||
sarStandAttrInfo.setSsrq(importDto.getImplementedTime());
|
||||
|
||||
String ssrqDate = importDto.getImplementedTime().substring(0, 9);
|
||||
sarStandAttrInfo.setSsrq(ssrqDate);
|
||||
sarStandAttrInfo.setValidFlag("0");
|
||||
|
||||
|
||||
@@ -566,7 +558,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
sarStandardsInfoService.createStandFile(standId,fileMap);
|
||||
} catch (Exception e) {
|
||||
importDto.setErrorStr("创建标准文件异常");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
e.printStackTrace();
|
||||
System.out.println("创建标准文件异常");
|
||||
}
|
||||
@@ -574,12 +566,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
sarStandAttrInfo.setGlwj(fileInfo.getAttId());
|
||||
}else {
|
||||
importDto.setErrorStr("文件不存在");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
importDto.setErrorStr("文件打开失败");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -599,41 +591,29 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,String standId){
|
||||
|
||||
|
||||
if(importDto.getStandId()==null){
|
||||
HashMap<String, String> analysis = analysisStandId(importDto);
|
||||
if (analysis==null){
|
||||
return null;
|
||||
}else {
|
||||
SarBussionessStand sarBussionessStand = new SarBussionessStand();
|
||||
sarBussionessStand.setId(standId);
|
||||
sarBussionessStand.setStandSort(analysis.get("sort"));
|
||||
sarBussionessStand.setStandYear(analysis.get("year"));
|
||||
sarBussionessStand.setStandCode(importDto.getStandId());
|
||||
sarBussionessStand.setStandName(importDto.getStandName());
|
||||
sarBussionessStand.setStandEnName(importDto.getStandNameEN());
|
||||
sarBussionessStand.setIssueTime(importDto.getPublishTime());
|
||||
sarBussionessStand.setPutTime(importDto.getImplementedTime());
|
||||
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
|
||||
sarBussionessStand.setValidFlag(0);
|
||||
if ("有效".equals(importDto.getStandStatus())){
|
||||
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
|
||||
}
|
||||
return sarBussionessStand;
|
||||
}
|
||||
|
||||
|
||||
String sort="";
|
||||
String number="";
|
||||
String year="";
|
||||
try {
|
||||
String[] sortAndNumberAndYear = importDto.getStandId().split("\\s+");
|
||||
sort = sortAndNumberAndYear[0];
|
||||
String[] numberAndYear = sortAndNumberAndYear[1].split("\\-");
|
||||
number=numberAndYear[0];
|
||||
year=numberAndYear[1];
|
||||
|
||||
}catch (Exception e){
|
||||
System.out.println("id为"+importDto.getStandId()+"格式无法解析");
|
||||
// return null;
|
||||
}
|
||||
|
||||
SarBussionessStand sarBussionessStand = new SarBussionessStand();
|
||||
sarBussionessStand.setId(standId);
|
||||
sarBussionessStand.setStandSort(sort);
|
||||
sarBussionessStand.setStandYear(year);
|
||||
sarBussionessStand.setStandCode(importDto.getStandId());
|
||||
sarBussionessStand.setStandName(importDto.getStandName());
|
||||
sarBussionessStand.setStandEnName(importDto.getStandNameEN());
|
||||
sarBussionessStand.setIssueTime(importDto.getPublishTime());
|
||||
sarBussionessStand.setPutTime(importDto.getImplementedTime());
|
||||
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
|
||||
sarBussionessStand.setValidFlag(0);
|
||||
if ("有效".equals(importDto.getStandStatus())){
|
||||
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
|
||||
}
|
||||
return sarBussionessStand;
|
||||
}
|
||||
|
||||
|
||||
@@ -674,7 +654,7 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
sarBussionessStandService.createStandFile(standId,fileMap);
|
||||
} catch (Exception e) {
|
||||
importDto.setErrorStr("创建标准文件异常");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
e.printStackTrace();
|
||||
System.out.println("创建标准文件异常");
|
||||
}
|
||||
@@ -683,12 +663,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
|
||||
}else {
|
||||
importDto.setErrorStr("文件不存在");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
importDto.setErrorStr("路径错误!");
|
||||
error.add(importDto);
|
||||
fileError.add(importDto);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -698,4 +678,43 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
||||
return sarBussStandAttrInfo;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String,String> analysisStandId(ImportDto importDto){
|
||||
HashMap<String, String> result = new HashMap<>();
|
||||
if(importDto.getStandId()==null){
|
||||
importDto.setErrorStr("标准号为空");
|
||||
error.add(importDto);
|
||||
return null;
|
||||
}else {
|
||||
String standId = importDto.getStandId();
|
||||
//格式 非空格字符+空格+非空格字符+‘-’或‘—’或空格+年份 如Q/FT F003—2001
|
||||
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
|
||||
if (!pattern.matcher(standId).matches()){
|
||||
importDto.setErrorStr("标准号无法解析");
|
||||
error.add(importDto);
|
||||
return null;
|
||||
}
|
||||
|
||||
String sort="";
|
||||
String number="";
|
||||
String year="";
|
||||
String[] split = importDto.getStandId().split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
|
||||
|
||||
// 多种格式(╯‵□′)╯︵┻━┻ Q-FL T015-2021 Q/ FL T015-2021 Q/FL T015-2021
|
||||
int length = split.length;
|
||||
number=split[length-2];
|
||||
year=split[length-1];
|
||||
for (int i = 0; i < length-2; i++) {
|
||||
sort+=split[i];
|
||||
}
|
||||
|
||||
result.put("sort",sort);
|
||||
result.put("number",number);
|
||||
result.put("year",year);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
@@ -599,6 +599,11 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
|
||||
@Override
|
||||
public void standardToLaws(String countryArea,TimeDto timeDto) {
|
||||
|
||||
if (countryArea==null){
|
||||
countryArea="";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加入对应"国家/地区"的清单列表
|
||||
*/
|
||||
|
||||
+1
@@ -291,6 +291,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
QueryWrapper<TsResource> TsResourceQueryWrapper=new QueryWrapper<>();
|
||||
TsResourceQueryWrapper.eq("PARENT_ID",parent.getId());
|
||||
TsResourceQueryWrapper.in("ID",getMenuIdList);
|
||||
TsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||
List<TsResource> children=dao.selectList(TsResourceQueryWrapper);
|
||||
for(TsResource TsResource:children){
|
||||
TsResource.setChildren(recursionGetListChildren((TsResource),(getMenuIdList)));
|
||||
|
||||
Reference in New Issue
Block a user