Merge branch 'develop_3' into 'develop_master'

Develop 3

See merge request LiuChao/foton-slrs-system-rest!169
This commit is contained in:
super_liu
2021-09-14 10:32:19 +08:00
5 changed files with 396 additions and 341 deletions
@@ -129,10 +129,15 @@ public class ScheduledJob {
.setMark("3")
.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);
@@ -150,9 +155,13 @@ public class ScheduledJob {
.setMark("4")
.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);
@@ -2,25 +2,23 @@ package com.adc.da.slrs.ImportExcelDatas.service.impl;
import com.adc.da.att.service.IAttFileEOService;
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.entity.ImportDto;
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.service.impl.SarBussionessStandServiceImpl;
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.sarBussionessStand.service.ISarBussionessStandService;
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.utils.util.InitStandAttrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -34,7 +32,6 @@ 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;
@@ -45,32 +42,17 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private CreateStandMQService createStandMQService;
// @Autowired
// 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" +
@@ -82,12 +64,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
@Override
public Map<String, List<ImportDto>> getExcelData(MultipartFile file, MultipartFile file2) {
List<String> dates=new ArrayList<>();
for(int i=1669;i<2023;i++){
dates.add("-"+i);
dates.add(""+i);
dates.add("- "+i);
dates.add(""+i);
List<String> dates = new ArrayList<>();
for (int i = 1669; i < 2023; i++) {
dates.add("-" + i);
dates.add("" + i);
dates.add("- " + i);
dates.add("" + i);
}
if (file == null || file.getSize() == 0) {
@@ -138,10 +120,10 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
datas.forEach(items -> {
//判断是否是正确的数据
String[] as = items.split(",");
if (!inDate(as[0],dates)) {
if (!inDate(as[0], dates)) {
ImportDto importDto = getImportDto(as);
error.add(importDto);
middle.put(as[0].trim(), "error-"+error.size());
middle.put(as[0].trim(), "error-" + error.size());
} else {
//数据二次拆解 针对标准进行拆解
String[] step2 = as[0].trim().split(" ");
@@ -149,15 +131,15 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
if (isCheck(GNS, step2[0].trim())) {
ImportDto importDto = getImportDto(as);
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())) {
ImportDto importDto = getImportDto(as);
QiBiao.add(importDto);
middle.put(as[0].trim(), "QYBZ-"+QiBiao.size());
middle.put(as[0].trim(), "QYBZ-" + QiBiao.size());
} else {
ImportDto importDto = getImportDto(as);
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("HWBZ", OutCountry);
fujian.forEach(items2 ->{
String[] fj=items2.split(",");
if (fj.length>2) {
fujian.forEach(items2 -> {
String[] fj = items2.split(",");
if (fj.length > 2) {
if (null != middle.get(null != fj[2] ? fj[2].trim() : "")) {
//对应数据位置
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;
}
private boolean inDate(String as,List<String> dates) {
private boolean inDate(String as, List<String> dates) {
if (null != as && !"".equals(as)) {
for (String s : dates) {
if (s.equals(as.trim())) {
@@ -282,136 +264,145 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
}
@Value("file.importPath")
@Value("${file.importFilePath}")
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
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
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();
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID);
//
//
if (sarStandardsInfo!=null)
{
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
//使用初始化的属性字段映射 获得key值,value为""
Map<String, String> mapField = standAttrMap;
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item,mapField, 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());
if (ForeignEO != null) {
ForeignEO.setValidFlag("0");
ForeignEO.setStandType("FOREIGN");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT", ForeignEO.getStandSort())
.eq("STAND_NUMBER", ForeignEO.getStandNumber())
.eq("STAND_YEAR", ForeignEO.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);
SarStandardsInfo one = sarStandardsInfoService.getOne(standSaveWrapper);
}
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("标准号无法解析");
error.add(item);
importListMap.replace("error",error);
}
});
/**
* 国内标准
*/
importListMap.get("GNBZ").forEach(item->{
importListMap.get("GNBZ").forEach(item -> {
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");
sarStandardsInfo.setStandType("INLAND");
InlandEO.setValidFlag("0");
InlandEO.setStandType("INLAND");
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
standSaveWrapper
.eq("STAND_SORT",sarStandardsInfo.getStandSort())
.eq("STAND_NUMBER",sarStandardsInfo.getStandNumber())
.eq("STAND_YEAR",sarStandardsInfo.getStandYear());
.eq("STAND_SORT", InlandEO.getStandSort())
.eq("STAND_NUMBER", InlandEO.getStandNumber())
.eq("STAND_YEAR", InlandEO.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 {
if (one != null) {
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()+"\'";
InlandEO.setId(one.getId());
try {
sarStandardsInfoService.updateSarStandardsInfo(InlandEO);
} catch (Exception e) {
item.setErrorStr("国内标准更新失败");
error.add(item);
e.printStackTrace();
}
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("标准号无法解析");
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) {
SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, standId);
/**
* 初始化企业标准属性字段
*/
List<String> listStandBussField = InitStandAttrUtil.queryFieldListBuss;
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 {
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());
BussEO.setId(one.getId());
sarBussionessStandService.updateSarBussionessStand(BussEO);
} else {
sarBussionessStandService.save(sarBussionessStand);
sarBussStandAttrInfoService.save(sarBussStandAttrInfo);
sarBussStandAttrInfoDao.updateStandInfo(sarBussStandAttrInfo.getStandId(), "GLWJBUSS", sarBussStandAttrInfo.getGlwj());
sarBussionessStandService.createSarBussionessStand(BussEO);
}
@@ -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);
return error;
}
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,String standId){
/**
* 整理为标准信息实体
* @param importDto
* @param fieldMap 属性字段
* @param standId
* @return
*/
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto,Map<String,String> fieldMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){
if (analysis == 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);
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)
{
/**
* 文件
*/
if (importDto.getPath() != null) {
String path[] = importDto.getPath().split("/");
String realPath="";
String realPath = "";
for (int i = 4; i < path.length; i++) {
realPath=realPath+"/"+path[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()){
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("GLWJ",fileInfo.getAttId());
try {
sarStandardsInfoService.createStandFile(standId,fileMap);
} catch (Exception e) {
importDto.setErrorStr("创建标准文件异常");
fileError.add(importDto);
e.printStackTrace();
System.out.println("创建标准文件异常");
if (importDto.getImplementedTime() != null) {
fieldMap.put("FBGJBD", fileInfo.getAttId());
} else {
fieldMap.put("GLWJ", fileInfo.getAttId());
}
sarStandAttrInfo.setGlwj(fileInfo.getAttId());
}else {
} else {
importDto.setErrorStr("文件不存在");
fileError.add(importDto);
}
}catch (Exception e){
} catch (Exception e) {
importDto.setErrorStr("文件打开失败");
fileError.add(importDto);
e.printStackTrace();
}
}
// attrInfoMap.put("")
Gson gson = new Gson();
String attrInfoJson = gson.toJson(fieldMap);
sarStandardsInfoEO.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
return sarStandAttrInfo;
return sarStandardsInfoEO;
}
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,String standId){
/**
* 整理为企业标准实体
* @param importDto
* @param standId
* @return
*/
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto,Map<String,String> fieldMap, String standId) {
HashMap<String, String> analysis = analysisStandId(importDto);
if (analysis==null){
if (analysis == null) {
return null;
}else {
} else {
SarBussionessStand sarBussionessStand = new SarBussionessStand();
sarBussionessStand.setId(standId);
sarBussionessStand.setStandSort(analysis.get("sort"));
@@ -606,115 +574,133 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
sarBussionessStand.setPutTime(importDto.getImplementedTime());
sarBussionessStand.setReplacedStandNum(importDto.getReplaceId());
sarBussionessStand.setValidFlag(0);
if ("有效".equals(importDto.getStandStatus())){
if ("有效".equals(importDto.getStandStatus())) {
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;
}
}
public SarBussStandAttrInfo parseImportDtoToSarBussStandAttrInfo(ImportDto importDto,String standId){
SarBussStandAttrInfo sarBussStandAttrInfo = new SarBussStandAttrInfo();
sarBussStandAttrInfo.setId(UUIDUtils.randomUUID20());
sarBussStandAttrInfo.setStandId(standId);
sarBussStandAttrInfo.setValidFlag("0");
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){
/**
* 解析标准号,标准类别不存在则新增
* @param importDto
* @return
*/
public HashMap<String, String> analysisStandId(ImportDto importDto) {
HashMap<String, String> result = new HashMap<>();
if(importDto.getStandId()==null){
if (importDto.getStandId() == null) {
importDto.setErrorStr("标准号为空");
error.add(importDto);
return null;
}else {
} 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()){
if (!pattern.matcher(standId).matches()) {
importDto.setErrorStr("标准号无法解析");
error.add(importDto);
return null;
}
String sort="";
String number="";
String year="";
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];
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);
result.put("sort", sort);
result.put("number", number);
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;
}
}
}
@@ -57,16 +57,19 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
QueryWrapper<SarLawsAttrDetailedList> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stand_id",lawsDto.getId())
.eq("detailed_list_id",sarFindDto.getId());
List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists = sarLawsAttrDetailedListDao.selectList(queryWrapper);
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getSsrq())){
lawsDto.setSSRQ(sarLawsAttrDetailedLists.get(0).getSsrq());
}
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getXcxssrq())){
lawsDto.setXCXSSRQGJ(sarLawsAttrDetailedLists.get(0).getXcxssrq());
}
if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getZccssrq())){
lawsDto.setZCCSSRQGJ(sarLawsAttrDetailedLists.get(0).getZccssrq());
}
/**
*2021/9/13 摒弃使用清单实施日期,改用标准实施日期
*/
// List<SarLawsAttrDetailedList> sarLawsAttrDetailedLists = sarLawsAttrDetailedListDao.selectList(queryWrapper);/
// if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getSsrq())){
// lawsDto.setSSRQ(sarLawsAttrDetailedLists.get(0).getSsrq());
// }
// if (StringUtils.isNoneEmpty(sarLawsAttrDetailedLists.get(0).getXcxssrq())){
// 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 ("FOREIGN".equals(lawsDto.getStandType()))lawsDto.setStandType("FOREIGN_STAND");
}
@@ -281,20 +284,25 @@ public class SarLawsAttrDetailedListServiceImpl extends ServiceImpl<SarLawsAttrD
xcx = mapList.get("新车型实施日期("+s.getCountry()+")");
zcc = mapList.get("在产车实施日期("+s.getCountry()+")");
}else {
dateTime(mapList,s);
}
dateTime(mapList, putTime, xcx, zcc, s);
}
return mapList;
}
private void dateTime(LinkedHashMap<String, List<String>> mapList, List<String> putTime, List<String> xcx, List<String> zcc, StandRegionalTimeDto s) {
//临时
putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime()));
xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq()));
zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq()));
mapList.put("实施日期("+s.getCountry()+")",putTime);
mapList.put("新车型实施日期("+s.getCountry()+")",xcx);
mapList.put("在产车实施日期("+s.getCountry()+")",zcc);
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());
String zcc = new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq());
// putTime.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getPutTime());
// xcx.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getXcxssrq()));
// zcc.add(new SimpleDateFormat("yyyy-MM-dd").format(s.getZccssrq()));
mapList.put("实施日期("+s.getCountry()+")", Collections.singletonList(putTime));
mapList.put("新车型实施日期("+s.getCountry()+")", Collections.singletonList(xcx));
mapList.put("在产车实施日期("+s.getCountry()+")", Collections.singletonList(zcc));
}
}
@@ -460,6 +460,9 @@
<if test="standStatus != null" >
and SAR_BUSSIONESS_STAND.STAND_STATUS = #{standStatus}
</if>
<if test="standEnName != null">
and SAR_BUSSIONESS_STAND.STAND_EN_NAME like concat('%', #{standEnName},'%')
</if>
<if test="advanceSearchStr != null">
and (${advanceSearchStr})
</if>
@@ -122,6 +122,31 @@
#{item}
</foreach>
</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}
</select>
@@ -149,6 +174,30 @@
#{item}
</foreach>
</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 id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto">