Merge remote-tracking branch 'origin/develop_1' into develop_1

This commit is contained in:
yanyizhou
2021-09-14 15:50:38 +08:00
5 changed files with 395 additions and 340 deletions
@@ -129,10 +129,15 @@ public class ScheduledJob {
.setMark("3") .setMark("3")
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear()); .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
//实施日期达到预警时间,但新车型实施日期不在时间内
if (term.isTerm(warningEO.getXCXSSRQ())){ //实施日期达到预警时间,但在产车实施日期不在时间内
warningEO.setPutTime(warningEO.getXCXSSRQ()); /**
} * 2021/9/9取消限制
*/
// if (term.isTerm(warningEO.getXCXSSRQ())){
// warningEO.setPutTime(warningEO.getXCXSSRQ());
// }
warningEO.setPutTime(warningEO.getXCXSSRQ());
} }
warningList.addAll(standInfoXCXSSRQ); warningList.addAll(standInfoXCXSSRQ);
@@ -150,9 +155,13 @@ public class ScheduledJob {
.setMark("4") .setMark("4")
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear()); .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
//实施日期达到预警时间,但在产车实施日期不在时间内 //实施日期达到预警时间,但在产车实施日期不在时间内
if (term.isTerm(warningEO.getZCCSSRQ())){ /**
warningEO.setPutTime(warningEO.getZCCSSRQ()); * 2021/9/9取消限制
} */
// if (term.isTerm(warningEO.getZCCSSRQ())){
// warningEO.setPutTime(warningEO.getZCCSSRQ());
// }
warningEO.setPutTime(warningEO.getZCCSSRQ());
} }
warningList.addAll(standInfoZCCSSRQ); warningList.addAll(standInfoZCCSSRQ);
@@ -2,25 +2,23 @@ package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService; import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo; import com.adc.da.att.vo.AttFileVo;
import com.adc.da.mq.CreateStandMQService; import com.adc.da.http.Result;
import com.adc.da.slrs.ImportExcelDatas.dao.ImportExcelDao; import com.adc.da.slrs.ImportExcelDatas.dao.ImportExcelDao;
import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto; import com.adc.da.slrs.ImportExcelDatas.entity.ImportDto;
import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService; import com.adc.da.slrs.ImportExcelDatas.service.ImportExcelService;
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
import com.adc.da.slrs.sarBussStandAttrInfo.entity.SarBussStandAttrInfo;
import com.adc.da.slrs.sarBussStandAttrInfo.service.impl.SarBussStandAttrInfoServiceImpl;
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
import com.adc.da.slrs.sarBussionessStand.service.impl.SarBussionessStandServiceImpl; import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
import com.adc.da.slrs.sarStandAttrInfo.service.impl.SarStandAttrInfoServiceImpl;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.slrs.sarStandardsInfo.service.impl.SarStandardsInfoServiceImpl; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.sys.entity.DictionaryEO;
import com.adc.da.sys.service.impl.DicTypeEOServiceImpl;
import com.adc.da.util.UUIDUtils; import com.adc.da.util.UUIDUtils;
import com.adc.da.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -34,7 +32,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -45,32 +42,17 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
@Autowired @Autowired
private IAttFileEOService attFileEOService; private IAttFileEOService attFileEOService;
@Autowired // @Autowired
private CreateStandMQService createStandMQService; // private CreateStandMQService createStandMQService;
//
// @Autowired
// private SarStandardsInfoServiceImpl sarStandardsInfoService;
//
//
//
// @Autowired
// private SarBussionessStandServiceImpl sarBussionessStandService;
@Autowired
private SarStandardsInfoServiceImpl sarStandardsInfoService;
@Autowired
private SarStandardsInfoDao sarStandardInfoDao;
@Autowired
private SarStandAttrInfoDao sarStandAttrInfoDao;
@Autowired
private SarBussionessStandDao sarBussionessStandDao;
@Autowired
private SarBussStandAttrInfoDao sarBussStandAttrInfoDao;
@Autowired
private SarBussionessStandServiceImpl sarBussionessStandService;
@Autowired
private SarBussStandAttrInfoServiceImpl sarBussStandAttrInfoService;
@Autowired
private SarStandAttrInfoServiceImpl sarStandAttrInfoService;
private final static String GN = "GB,GB/T,QC/T,GJB,JB,JT,HG,YV,SY,SH,GA,HJ,QB,JG,NB,JC,YS/T,FZ/T,TB/T,JJG,SJ/T,T/TBPS" + private final static String GN = "GB,GB/T,QC/T,GJB,JB,JT,HG,YV,SY,SH,GA,HJ,QB,JG,NB,JC,YS/T,FZ/T,TB/T,JJG,SJ/T,T/TBPS" +
@@ -82,12 +64,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
@Override @Override
public Map<String, List<ImportDto>> getExcelData(MultipartFile file, MultipartFile file2) { public Map<String, List<ImportDto>> getExcelData(MultipartFile file, MultipartFile file2) {
List<String> dates=new ArrayList<>(); List<String> dates = new ArrayList<>();
for(int i=1669;i<2023;i++){ for (int i = 1669; i < 2023; i++) {
dates.add("-"+i); dates.add("-" + i);
dates.add("—"+i); dates.add("—" + i);
dates.add("- "+i); dates.add("- " + i);
dates.add("— "+i); dates.add("— " + i);
} }
if (file == null || file.getSize() == 0) { if (file == null || file.getSize() == 0) {
@@ -138,10 +120,10 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
datas.forEach(items -> { datas.forEach(items -> {
//判断是否是正确的数据 //判断是否是正确的数据
String[] as = items.split(","); String[] as = items.split(",");
if (!inDate(as[0],dates)) { if (!inDate(as[0], dates)) {
ImportDto importDto = getImportDto(as); ImportDto importDto = getImportDto(as);
error.add(importDto); error.add(importDto);
middle.put(as[0].trim(), "error-"+error.size()); middle.put(as[0].trim(), "error-" + error.size());
} else { } else {
//数据二次拆解 针对标准进行拆解 //数据二次拆解 针对标准进行拆解
String[] step2 = as[0].trim().split(" "); String[] step2 = as[0].trim().split(" ");
@@ -149,15 +131,15 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (isCheck(GNS, step2[0].trim())) { if (isCheck(GNS, step2[0].trim())) {
ImportDto importDto = getImportDto(as); ImportDto importDto = getImportDto(as);
InCountry.add(importDto); InCountry.add(importDto);
middle.put(as[0].trim(), "GNBZ-"+InCountry.size()); middle.put(as[0].trim(), "GNBZ-" + InCountry.size());
} else if (isCheck(QBS, step2[0].trim())) { } else if (isCheck(QBS, step2[0].trim())) {
ImportDto importDto = getImportDto(as); ImportDto importDto = getImportDto(as);
QiBiao.add(importDto); QiBiao.add(importDto);
middle.put(as[0].trim(), "QYBZ-"+QiBiao.size()); middle.put(as[0].trim(), "QYBZ-" + QiBiao.size());
} else { } else {
ImportDto importDto = getImportDto(as); ImportDto importDto = getImportDto(as);
OutCountry.add(importDto); OutCountry.add(importDto);
middle.put(as[0].trim(), "HWBZ-"+OutCountry.size()); middle.put(as[0].trim(), "HWBZ-" + OutCountry.size());
} }
} }
}); });
@@ -166,22 +148,22 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
res.put("QYBZ", QiBiao); res.put("QYBZ", QiBiao);
res.put("HWBZ", OutCountry); res.put("HWBZ", OutCountry);
fujian.forEach(items2 ->{ fujian.forEach(items2 -> {
String[] fj=items2.split(","); String[] fj = items2.split(",");
if (fj.length>2) { if (fj.length > 2) {
if (null != middle.get(null != fj[2] ? fj[2].trim() : "")) { if (null != middle.get(null != fj[2] ? fj[2].trim() : "")) {
//对应数据位置 //对应数据位置
String[] location = middle.get(fj[2].trim()).split("-"); String[] location = middle.get(fj[2].trim()).split("-");
res.get(location[0]).get(Integer.parseInt(location[1])-1).setPath(fj[3]); res.get(location[0]).get(Integer.parseInt(location[1]) - 1).setPath(fj[3]);
} }
} }
} ); });
return res; return res;
} }
private boolean inDate(String as,List<String> dates) { private boolean inDate(String as, List<String> dates) {
if (null != as && !"".equals(as)) { if (null != as && !"".equals(as)) {
for (String s : dates) { for (String s : dates) {
if (s.equals(as.trim())) { if (s.equals(as.trim())) {
@@ -282,136 +264,145 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
} }
@Value("${file.importFilePath}")
@Value("file.importPath")
private String importPath; private String importPath;
private List<ImportDto> error=new ArrayList<>(); private List<ImportDto> error = new ArrayList<>();
private List<ImportDto> fileError=new ArrayList<>(); private List<ImportDto> fileError = new ArrayList<>();
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@Autowired
private DicTypeEOServiceImpl dicTypeEOService;
@Autowired
private ISarBussionessStandService sarBussionessStandService;
@Override @Override
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) { public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
error = importListMap.get("error"); error = importListMap.get("error");
/**
* 初始化国内外标准属性字段
*/
List<String> listStandField = InitStandAttrUtil.queryFieldList;
Map<String,String> standAttrMap = new TreeMap<>();
listStandField.forEach(item ->{
standAttrMap.put(item,"");
});
/** /**
* 海外标准 * 海外标准
*/ */
importListMap.get("HWBZ").forEach(item->{ importListMap.get("HWBZ").forEach(item -> {
String standID = UUIDUtils.randomUUID20(); String standID = UUIDUtils.randomUUID20();
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID); //使用初始化的属性字段映射 获得key值,value为""
// Map<String, String> mapField = standAttrMap;
// SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item,mapField, standID);
if (sarStandardsInfo!=null)
{
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
sarStandardsInfo.setValidFlag("0"); if (ForeignEO != null) {
sarStandardsInfo.setStandType("FOREIGN"); ForeignEO.setValidFlag("0");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>(); ForeignEO.setStandType("FOREIGN");
standSaveWrapper QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
.eq("STAND_SORT",sarStandardsInfo.getStandSort()) standSaveWrapper
.eq("STAND_NUMBER",sarStandardsInfo.getStandNumber()) .eq("STAND_SORT", ForeignEO.getStandSort())
.eq("STAND_YEAR",sarStandardsInfo.getStandYear()); .eq("STAND_NUMBER", ForeignEO.getStandNumber())
.eq("STAND_YEAR", ForeignEO.getStandYear());
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper); 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);
} if (one != null) {
ForeignEO.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(ForeignEO);
} catch (Exception e) {
item.setErrorStr("标准更新失败");
error.add(item);
e.printStackTrace();
}
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(ForeignEO);
} catch (Exception e) {
item.setErrorStr("标准新增失败");
error.add(item);
e.printStackTrace();
}
}
}else{ } else {
item.setErrorStr("标准号无法解析"); item.setErrorStr("标准号无法解析");
error.add(item); error.add(item);
importListMap.replace("error",error);
} }
}); });
/** /**
* 国内标准 * 国内标准
*/ */
importListMap.get("GNBZ").forEach(item->{
importListMap.get("GNBZ").forEach(item -> {
String standID = UUIDUtils.randomUUID20(); String standID = UUIDUtils.randomUUID20();
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapStandField = standAttrMap;
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, mapStandField,standID);
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID); if (InlandEO != null) {
if (sarStandardsInfo!=null){
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
sarStandardsInfo.setValidFlag("0"); InlandEO.setValidFlag("0");
sarStandardsInfo.setStandType("INLAND"); InlandEO.setStandType("INLAND");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>(); QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper standSaveWrapper
.eq("STAND_SORT",sarStandardsInfo.getStandSort()) .eq("STAND_SORT", InlandEO.getStandSort())
.eq("STAND_NUMBER",sarStandardsInfo.getStandNumber()) .eq("STAND_NUMBER", InlandEO.getStandNumber())
.eq("STAND_YEAR",sarStandardsInfo.getStandYear()); .eq("STAND_YEAR", InlandEO.getStandYear());
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper); SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
if (one!=null){ 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); InlandEO.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(InlandEO);
String field="ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ"; } catch (Exception e) {
String value="\'"+sarStandAttrInfo.getId()+"\'"+","+"\'"+sarStandAttrInfo.getStandId()+"\'"+","+"\'"+"0"+"\'"; item.setErrorStr("国内标准更新失败");
error.add(item);
e.printStackTrace();
if (sarStandAttrInfo.getDtbjh()!=null){
value+=","+"\'"+sarStandAttrInfo.getDtbjh()+"\'";
} }
if (sarStandAttrInfo.getSsrq()!=null){
value+=","+"\'"+sarStandAttrInfo.getSsrq()+"\'";
}
sarStandAttrInfoDao.insertStandAttr(field,value);
} else {
try {
sarStandardsInfoService.createSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准新增失败");
error.add(item);
e.printStackTrace();
}
} }
}else { } else {
item.setErrorStr("标准号无法解析"); item.setErrorStr("标准号无法解析");
error.add(item); error.add(item);
importListMap.replace("error",error); importListMap.replace("error", error);
} }
@@ -421,35 +412,30 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
/** /**
* 企业标准 * 企业标准
*/ */
importListMap.get("QYBZ").forEach(item->{
String standId=UUIDUtils.randomUUID20();
SarBussionessStand sarBussionessStand = parseImportDtoToSarBussionessStand(item, standId); /**
* 初始化企业标准属性字段
if (sarBussionessStand!=null) { */
List<String> listStandBussField = InitStandAttrUtil.queryFieldListBuss;
SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId); Map<String,String> bussAttrMap = new TreeMap<>();
listStandBussField.forEach(item->{
bussAttrMap.put(item,"");
});
importListMap.get("QYBZ").forEach(item -> {
String standId = UUIDUtils.randomUUID20();
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, bussAttrMap,standId);
if (BussEO != null) {
try { try {
QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>(); QueryWrapper<SarBussionessStand> saveWrapper = new QueryWrapper<>();
saveWrapper.eq("STAND_CODE", item.getStandId()); saveWrapper.eq("STAND_CODE", item.getStandId());
SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper); SarBussionessStand one = sarBussionessStandService.getOne(saveWrapper);
if (one != null) { if (one != null) {
sarBussionessStand.setId(one.getId()); BussEO.setId(one.getId());
sarBussionessStandService.update(sarBussionessStand, saveWrapper); sarBussionessStandService.updateSarBussionessStand(BussEO);
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 { } else {
sarBussionessStandService.save(sarBussionessStand); sarBussionessStandService.createSarBussionessStand(BussEO);
sarBussStandAttrInfoService.save(sarBussStandAttrInfo);
sarBussStandAttrInfoDao.updateStandInfo(sarBussStandAttrInfo.getStandId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
} }
@@ -466,135 +452,117 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}); });
//
// String head="standId,standName,standNameEN,publishTime,implementedTime" +
// ",standStatus,replaceId,path";
// String headStr="标准号,标准名称,英文名称,发布时间,实施时间,标准状态,代替标准号,附件路径";
error.addAll(fileError); error.addAll(fileError);
return error; return error;
} }
/**
* 整理为标准信息实体
* @param importDto
* @param fieldMap 属性字段
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,String standId){ * @param standId
* @return
*/
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,Map<String,String> fieldMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto); HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){ if (analysis == null) {
return null; return null;
}else {
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 sarStandardsInfoEO = new SarStandardsInfo();
sarStandardsInfoEO.setId(standId);
sarStandardsInfoEO.setStandSort(analysis.get("sort"));
sarStandardsInfoEO.setStandNumber(analysis.get("number"));
sarStandardsInfoEO.setStandYear(analysis.get("year"));
public SarStandAttrInfo parseImportDtoToStandAttrInfo(ImportDto importDto,String standId) { sarStandardsInfoEO.setStandName(importDto.getStandName());
sarStandardsInfoEO.setStandEnName(importDto.getStandNameEN());
/**
* 截取发布日期 年月日
*/
String issueDate = importDto.getPublishTime().substring(0, 19);
sarStandardsInfoEO.setIssueTime(issueDate);//标准发布日期
String standStatus = importDto.getStandStatus();
if ("有效".equals(standStatus)) {
sarStandardsInfoEO.setTextStatus("vsaga7nwub");//现行有效
}
/**
* 标准属性字段
*/
fieldMap.put("DTBJH", importDto.getReplaceId());
fieldMap.put("SSRQ", importDto.getImplementedTime().substring(0, 19));
/**
SarStandAttrInfo sarStandAttrInfo = new SarStandAttrInfo(); * 文件
sarStandAttrInfo.setId(UUIDUtils.randomUUID20()); */
sarStandAttrInfo.setStandId(standId); if (importDto.getPath() != null) {
sarStandAttrInfo.setDtbjh(importDto.getReplaceId());
String ssrqDate = importDto.getImplementedTime().substring(0, 9);
sarStandAttrInfo.setSsrq(ssrqDate);
sarStandAttrInfo.setValidFlag("0");
// Arrays.stream(path).limit(2,path.length);
if (importDto.getPath()!=null)
{
String path[] = importDto.getPath().split("/"); String path[] = importDto.getPath().split("/");
String realPath=""; String realPath = "";
for (int i = 4; i < path.length; i++) { for (int i = 4; i < path.length; i++) {
realPath=realPath+"/"+path[i]; realPath = realPath + "/" + path[i];
} }
try { try {
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath); // File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath);
// File file = new File(importPath + realPath); // File file = new File(importPath + realPath);
File file = new File("/home/file/2021/" + realPath); File file = new File("/home/file/2021/" + realPath);
if (file.exists()){ if (file.exists()) {
AttFileVo fileInfo = attFileEOService.saveFileInfo(file); AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
HashMap<String, String> fileMap = new HashMap<>();
if (importDto.getImplementedTime() != null) {
fieldMap.put("FBGJBD", fileInfo.getAttId());
/** } else {
* * @Param: [standId, fileMap] fileMap<field,fileIds> fieldMap.put("GLWJ", fileInfo.getAttId());
*/
fileMap.put("GLWJ",fileInfo.getAttId());
try {
sarStandardsInfoService.createStandFile(standId,fileMap);
} catch (Exception e) {
importDto.setErrorStr("创建标准文件异常");
fileError.add(importDto);
e.printStackTrace();
System.out.println("创建标准文件异常");
} }
sarStandAttrInfo.setGlwj(fileInfo.getAttId()); } else {
}else {
importDto.setErrorStr("文件不存在"); importDto.setErrorStr("文件不存在");
fileError.add(importDto); fileError.add(importDto);
} }
}catch (Exception e){ } catch (Exception e) {
importDto.setErrorStr("文件打开失败"); importDto.setErrorStr("文件打开失败");
fileError.add(importDto); fileError.add(importDto);
e.printStackTrace(); e.printStackTrace();
} }
} }
// attrInfoMap.put("")
Gson gson = new Gson();
String attrInfoJson = gson.toJson(fieldMap);
sarStandardsInfoEO.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarStandAttrInfo; return sarStandardsInfoEO;
} }
/**
* 整理为企业标准实体
* @param importDto
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,String standId){ * @param standId
* @return
*/
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,Map<String,String> fieldMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto); HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){ if (analysis == null) {
return null; return null;
}else { } else {
SarBussionessStand sarBussionessStand = new SarBussionessStand(); SarBussionessStand sarBussionessStand = new SarBussionessStand();
sarBussionessStand.setId(standId); sarBussionessStand.setId(standId);
sarBussionessStand.setStandSort(analysis.get("sort")); sarBussionessStand.setStandSort(analysis.get("sort"));
@@ -606,115 +574,133 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarBussionessStand.setPutTime(importDto.getImplementedTime()); sarBussionessStand.setPutTime(importDto.getImplementedTime());
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId()); sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
sarBussionessStand.setValidFlag(0); sarBussionessStand.setValidFlag(0);
if ("有效".equals(importDto.getStandStatus())){ if ("有效".equals(importDto.getStandStatus())) {
sarBussionessStand.setTextStatusBuss("vsaga7nwub"); sarBussionessStand.setTextStatusBuss("vsaga7nwub");
} }
/**
* 企业标准属性字段
*/
if (importDto.getPath() != null) {
String path[] = importDto.getPath().split("/");
String realPath = "";
for (int i = 4; i < path.length; i++) {
realPath = realPath + "/" + path[i];
}
try {
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath);
// File file = new File(importPath + realPath);
File file = new File("/home/file/2021/" + realPath);
if (file.exists()) {
AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
if (importDto.getImplementedTime()!=null && importDto.getImplementedTime()!=""){
fieldMap.put("FBGBUSS",fileInfo.getAttId());
}else {
fieldMap.put("GLWJBUSS",fileInfo.getAttId());
}
} else {
importDto.setErrorStr("文件不存在");
fileError.add(importDto);
}
} catch (Exception e) {
importDto.setErrorStr("路径错误!");
fileError.add(importDto);
e.printStackTrace();
}
}
String attrInfoJson = new Gson().toJson(fieldMap);
sarBussionessStand.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarBussionessStand; return sarBussionessStand;
} }
} }
public SarBussStandAttrInfo parseImportDtoToSarBussStandAttrInfo(ImportDto importDto,String standId){ /**
SarBussStandAttrInfo sarBussStandAttrInfo = new SarBussStandAttrInfo(); * 解析标准号,标准类别不存在则新增
sarBussStandAttrInfo.setId(UUIDUtils.randomUUID20()); * @param importDto
sarBussStandAttrInfo.setStandId(standId); * @return
sarBussStandAttrInfo.setValidFlag("0"); */
public HashMap<String, String> analysisStandId(ImportDto importDto) {
if (importDto.getPath()!=null)
{
String path[] = importDto.getPath().split("/");
String realPath="";
for (int i = 4; i < path.length; i++) {
realPath=realPath+"/"+path[i];
}
try {
// File file = new File("C:\\Users\\22501\\Desktop\\foton\\2021\\" + realPath);
// File file = new File(importPath + realPath);
File file = new File("/home/file/2021/" + realPath);
if (file.exists()){
AttFileVo fileInfo = attFileEOService.saveFileInfo(file);
HashMap<String, String> fileMap = new HashMap<>();
/**
* * @Param: [standId, fileMap] fileMap<field,fileIds>
*/
fileMap.put("GLWJBUSS",fileInfo.getAttId());
try {
sarBussionessStandService.createStandFile(standId,fileMap);
} catch (Exception e) {
importDto.setErrorStr("创建标准文件异常");
fileError.add(importDto);
e.printStackTrace();
System.out.println("创建标准文件异常");
}
sarBussStandAttrInfo.setGlwj(fileInfo.getAttId());
}else {
importDto.setErrorStr("文件不存在");
fileError.add(importDto);
}
}catch (Exception e){
importDto.setErrorStr("路径错误!");
fileError.add(importDto);
e.printStackTrace();
}
}
return sarBussStandAttrInfo;
}
public HashMap<String,String> analysisStandId(ImportDto importDto){
HashMap<String, String> result = new HashMap<>(); HashMap<String, String> result = new HashMap<>();
if(importDto.getStandId()==null){ if (importDto.getStandId() == null) {
importDto.setErrorStr("标准号为空"); importDto.setErrorStr("标准号为空");
error.add(importDto); error.add(importDto);
return null; return null;
}else { } else {
String standId = importDto.getStandId(); String standId = importDto.getStandId();
//格式 非空格字符+空格+非空格字符+‘-’或‘—’或空格+年份 如Q/FT F003—2001 //格式 非空格字符+空格+非空格字符+‘-’或‘—’或空格+年份 如Q/FT F003—2001
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$"); Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
if (!pattern.matcher(standId).matches()){ if (!pattern.matcher(standId).matches()) {
importDto.setErrorStr("标准号无法解析"); importDto.setErrorStr("标准号无法解析");
error.add(importDto); error.add(importDto);
return null; return null;
} }
String sort=""; String sort = "";
String number=""; String number = "";
String year=""; String year = "";
String[] split = importDto.getStandId().split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割 String[] split = importDto.getStandId().split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
// 多种格式(╯‵□′)╯︵┻━┻ Q-FL T015-2021 Q/ FL T015-2021 Q/FL T015-2021 // 多种格式(╯‵□′)╯︵┻━┻ Q-FL T015-2021 Q/ FL T015-2021 Q/FL T015-2021
int length = split.length; int length = split.length;
number=split[length-2]; number = split[length - 2];
year=split[length-1]; year = split[length - 1];
for (int i = 0; i < length-2; i++) { for (int i = 0; i < length - 2; i++) {
sort+=split[i]; sort += split[i];
} }
result.put("sort",sort); result.put("sort", sort);
result.put("number",number); result.put("number", number);
result.put("year",year); result.put("year", year);
//标准类别不存在,新增标准类别
List<DicTypeEO> isExist = dicTypeEOService.getTypeIdByDicIdAndTypeName("JKSADFH564S", null, sort, null);
if (isExist == null || isExist.isEmpty() || isExist.size()==0){
DicTypeEO dicTypeVO = new DicTypeEO();
dicTypeVO.setId(null);
dicTypeVO.setDicId("JKSADFH564S");
dicTypeVO.setDicTypeCode(sort);
dicTypeVO.setDicTypeName(sort);
dicTypeVO.setShowIndex(1);
Integer dicTypeEO = dicTypeEOService.saveDictype(dicTypeVO);
if (dicTypeEO>0){
importDto.setErrorStr("标准类别不存在,已新增");
}else {
importDto.setErrorStr("标准类别不存在,新增失败");
}
error.add(importDto);
}
return result; return result;
} }
} }
} }
@@ -57,16 +57,19 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>(); QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stand_id",lawsDto.getId()) queryWrapper.eq("stand_id",lawsDto.getId())
.eq("detailed_list_id",sarFindDto.getId()); .eq("detailed_list_id",sarFindDto.getId());
List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists = sarLawsAttrDetailedListDao.selectList(queryWrapper); /**
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getSsrq())){ *2021/9/13 摒弃使用清单实施日期,改用标准实施日期
lawsDto.setSSRQ(sarLawsAttrDetailedLists.get(0).getSsrq()); */
} // List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists = sarLawsAttrDetailedListDao.selectList(queryWrapper);/
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getXcxssrq())){ // if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getSsrq())){
lawsDto.setXCXSSRQGJ(sarLawsAttrDetailedLists.get(0).getXcxssrq()); // lawsDto.setSSRQ(sarLawsAttrDetailedLists.get(0).getSsrq());
} // }
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getZccssrq())){ // if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getXcxssrq())){
lawsDto.setZCCSSRQGJ(sarLawsAttrDetailedLists.get(0).getZccssrq()); // lawsDto.setXCXSSRQGJ(sarLawsAttrDetailedLists.get(0).getXcxssrq());
} // }
// if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getZccssrq())){
// lawsDto.setZCCSSRQGJ(sarLawsAttrDetailedLists.get(0).getZccssrq());
// }
if ("INLAND".equals(lawsDto.getStandType()))lawsDto.setStandType("INLAND_STAND"); if ("INLAND".equals(lawsDto.getStandType()))lawsDto.setStandType("INLAND_STAND");
if ("FOREIGN".equals(lawsDto.getStandType()))lawsDto.setStandType("FOREIGN_STAND"); if ("FOREIGN".equals(lawsDto.getStandType()))lawsDto.setStandType("FOREIGN_STAND");
} }
@@ -281,20 +284,25 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
xcx = mapList.get("新车型实施日期("+s.getCountry()+")"); xcx = mapList.get("新车型实施日期("+s.getCountry()+")");
zcc = mapList.get("在产车实施日期("+s.getCountry()+")"); zcc = mapList.get("在产车实施日期("+s.getCountry()+")");
}else {
dateTime(mapList,s);
} }
dateTime(mapList, putTime, xcx, zcc, s);
} }
return mapList; return mapList;
} }
private void dateTime(LinkedHashMap<String, List<String>> mapList, List<String> putTime, List<String> xcx, List<String> zcc, StandRegionalTimeDto s) { private void dateTime(LinkedHashMap<String, List<String>> mapList, StandRegionalTimeDto s) {
//临时 String putTime = new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime());
String xcx = new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq());
putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime())); String zcc = new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq());
xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq())); // putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime());
zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq())); // xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq()));
mapList.put("实施日期("+s.getCountry()+")",putTime); // zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq()));
mapList.put("新车型实施日期("+s.getCountry()+")",xcx); mapList.put("实施日期("+s.getCountry()+")", Collections.singletonList(putTime));
mapList.put("在产车实施日期("+s.getCountry()+")",zcc); mapList.put("新车型实施日期("+s.getCountry()+")", Collections.singletonList(xcx));
mapList.put("在产车实施日期("+s.getCountry()+")", Collections.singletonList(zcc));
} }
} }
@@ -460,6 +460,9 @@
<if test="standStatus != null" > <if test="standStatus != null" >
and SAR_BUSSIONESS_STAND.STAND_STATUS = #{standStatus} and SAR_BUSSIONESS_STAND.STAND_STATUS = #{standStatus}
</if> </if>
<if test="standEnName != null">
and SAR_BUSSIONESS_STAND.STAND_EN_NAME like concat('%', #{standEnName},'%')
</if>
<if test="advanceSearchStr != null"> <if test="advanceSearchStr != null">
and (${advanceSearchStr}) and (${advanceSearchStr})
</if> </if>
@@ -122,6 +122,31 @@
#{item} #{item}
</foreach> </foreach>
</where> </where>
UNION
SELECT a.ID,a.STAND_NUMBER as standNumber,a.STAND_NAME as standName,a.STAND_EN_NAME,b.NYLX,b.SSRQ as SSRQ,b.XCXSSRQ as XCXSSRQGJ,b.ZCCSSRQ as ZCCSSRQGJ,
b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,b.CLLX as typeApplicable,a.STAND_SORT as standSortShow,
a.STAND_YEAR as standYear,ISSUE_TIME as issueTime,a.STAND_TYPE as standType,a.TEXT_STATUS as textStatus
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
a.ID = b.STAND_ID
left join sar_stand_items ssi on ssi.stand_id = a.id
<where>
<if test="standName != null">
(a.STAND_NUMBER LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%')
or a.STAND_NAME LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%'))
and
</if>
<if test="fileType !=null">
ssi.FILE_TYPE = #{fileType} and
</if>
<if test="standType !=null">
a.STAND_TYPE = #{standType} and
</if>
a.ID IN
<foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</where>
limit #{start},#{end} limit #{start},#{end}
</select> </select>
@@ -149,6 +174,30 @@
#{item} #{item}
</foreach> </foreach>
</where> </where>
UNION
SELECT a.ID,a.STAND_NUMBER as standNumber,a.STAND_NAME as standName,a.STAND_EN_NAME,b.NYLX,b.SSRQ as SSRQ,b.XCXSSRQ as XCXSSRQGJ,b.ZCCSSRQ as ZCCSSRQGJ,
b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,b.CLLX as typeApplicable,a.STAND_SORT as standSortShow,
a.STAND_YEAR as standYear,ISSUE_TIME as issueTime,a.STAND_TYPE as standType,a.TEXT_STATUS as textStatus
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
a.ID = b.STAND_ID
left join sar_stand_items ssi on ssi.stand_id = a.id
<where>
<if test="standName != null">
(a.STAND_NUMBER LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%')
or a.STAND_NAME LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%'))
and
</if>
<if test="fileType !=null">
ssi.FILE_TYPE = #{fileType} and
</if>
<if test="standType !=null">
a.STAND_TYPE = #{standType} and
</if>
a.ID IN
<foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select> </select>
<select id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto"> <select id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto">