excl批量导入标准
This commit is contained in:
+136
-247
@@ -2,24 +2,14 @@ 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.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.util.UUIDUtils;
|
import com.adc.da.util.UUIDUtils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
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 com.google.gson.Gson;
|
||||||
@@ -46,32 +36,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" +
|
||||||
@@ -290,6 +265,10 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
|
|
||||||
private List<ImportDto> fileError = new ArrayList<>();
|
private List<ImportDto> fileError = new ArrayList<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarStandardsInfoService sarStandardsInfoService;
|
||||||
|
|
||||||
|
private ISarBussionessStandService sarBussionessStandService;
|
||||||
@Override
|
@Override
|
||||||
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
|
public List<ImportDto> storageExclData(Map<String, List<ImportDto>> importListMap) {
|
||||||
|
|
||||||
@@ -302,53 +281,50 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
|
|
||||||
String standID = UUIDUtils.randomUUID20();
|
String standID = UUIDUtils.randomUUID20();
|
||||||
|
|
||||||
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID);
|
SarStandardsInfo ForeignEO = parseImportDtoToStandardsInfo(item, standID);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
if (sarStandardsInfo != null) {
|
if (ForeignEO != null) {
|
||||||
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
|
||||||
|
|
||||||
sarStandardsInfo.setValidFlag("0");
|
|
||||||
sarStandardsInfo.setStandType("FOREIGN");
|
ForeignEO.setValidFlag("0");
|
||||||
|
ForeignEO.setStandType("FOREIGN");
|
||||||
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
QueryWrapper<SarStandardsInfo> standSaveWrapper = new QueryWrapper<>();
|
||||||
standSaveWrapper
|
standSaveWrapper
|
||||||
.eq("STAND_SORT", sarStandardsInfo.getStandSort())
|
.eq("STAND_SORT", ForeignEO.getStandSort())
|
||||||
.eq("STAND_NUMBER", sarStandardsInfo.getStandNumber())
|
.eq("STAND_NUMBER", ForeignEO.getStandNumber())
|
||||||
.eq("STAND_YEAR", sarStandardsInfo.getStandYear());
|
.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 (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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sarStandAttrInfo.getSsrq() != null) {
|
|
||||||
value += "," + "\'" + sarStandAttrInfo.getSsrq() + "\'";
|
|
||||||
}
|
|
||||||
sarStandAttrInfoDao.insertStandAttr(field, value);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
item.setErrorStr("标准号无法解析");
|
item.setErrorStr("标准号无法解析");
|
||||||
error.add(item);
|
error.add(item);
|
||||||
importListMap.replace("error", error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -361,50 +337,46 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
importListMap.get("GNBZ").forEach(item -> {
|
importListMap.get("GNBZ").forEach(item -> {
|
||||||
String standID = UUIDUtils.randomUUID20();
|
String standID = UUIDUtils.randomUUID20();
|
||||||
|
|
||||||
SarStandardsInfo sarStandardsInfo = parseImportDtoToStandardsInfo(item, standID);
|
SarStandardsInfo InlandEO = parseImportDtoToStandardsInfo(item, standID);
|
||||||
|
|
||||||
if (sarStandardsInfo != null) {
|
if (InlandEO != null) {
|
||||||
SarStandAttrInfo sarStandAttrInfo = parseImportDtoToStandAttrInfo(item, standID);
|
|
||||||
|
|
||||||
sarStandardsInfo.setValidFlag("0");
|
|
||||||
sarStandardsInfo.setStandType("INLAND");
|
InlandEO.setValidFlag("0");
|
||||||
|
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());
|
InlandEO.setId(one.getId());
|
||||||
sarStandAttrInfo.setStandId(one.getId());
|
try {
|
||||||
sarStandAttrInfoService.update(sarStandAttrInfo, standAttrWrapper);
|
sarStandardsInfoService.updateSarStandardsInfo(InlandEO);
|
||||||
|
} catch (Exception e) {
|
||||||
|
item.setErrorStr("国内标准更新失败");
|
||||||
|
error.add(item);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
sarStandardsInfoService.save(sarStandardsInfo);
|
try {
|
||||||
|
sarStandardsInfoService.createSarStandardsInfo(InlandEO);
|
||||||
|
} catch (Exception e) {
|
||||||
String field = "ID,STAND_ID,VALID_FLAG,DTBJH,SSRQ";
|
item.setErrorStr("国内标准新增失败");
|
||||||
String value = "\'" + sarStandAttrInfo.getId() + "\'" + "," + "\'" + sarStandAttrInfo.getStandId() + "\'" + "," + "\'" + "0" + "\'";
|
error.add(item);
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
if (sarStandAttrInfo.getDtbjh() != null) {
|
|
||||||
value += "," + "\'" + sarStandAttrInfo.getDtbjh() + "\'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sarStandAttrInfo.getSsrq() != null) {
|
|
||||||
value += "," + "\'" + sarStandAttrInfo.getSsrq() + "\'";
|
|
||||||
}
|
|
||||||
sarStandAttrInfoDao.insertStandAttr(field, value);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.setErrorStr("标准号无法解析");
|
item.setErrorStr("标准号无法解析");
|
||||||
@@ -422,32 +394,19 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
importListMap.get("QYBZ").forEach(item -> {
|
importListMap.get("QYBZ").forEach(item -> {
|
||||||
String standId = UUIDUtils.randomUUID20();
|
String standId = UUIDUtils.randomUUID20();
|
||||||
|
|
||||||
SarBussionessStand sarBussionessStand = parseImportDtoToSarBussionessStand(item, standId);
|
SarBussionessStand BussEO = parseImportDtoToSarBussionessStand(item, standId);
|
||||||
|
|
||||||
if (sarBussionessStand != null) {
|
|
||||||
|
|
||||||
SarBussStandAttrInfo sarBussStandAttrInfo = parseImportDtoToSarBussStandAttrInfo(item, 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -464,15 +423,17 @@ 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 standId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto, String standId) {
|
public SarStandardsInfo parseImportDtoToStandardsInfo(ImportDto importDto, String standId) {
|
||||||
|
|
||||||
|
|
||||||
@@ -549,9 +510,8 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
}
|
}
|
||||||
// attrInfoMap.put("")
|
// attrInfoMap.put("")
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
String attrInfoJson = gson.toJson(attrInfoMap);
|
String attrInfoJson = gson.toJson(attrInfoMap);
|
||||||
sarStandardsInfoEO.setSarStandAttrEOStr(attrInfoJson);
|
sarStandardsInfoEO.setSarStandAttrEOStr(attrInfoJson);//新增修改时属性表信息
|
||||||
|
|
||||||
|
|
||||||
return sarStandardsInfoEO;
|
return sarStandardsInfoEO;
|
||||||
@@ -559,74 +519,12 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
public SarStandAttrInfo parseImportDtoToStandAttrInfo(ImportDto importDto, String standId) {
|
* 整理为企业标准实体
|
||||||
|
* @param importDto
|
||||||
|
* @param standId
|
||||||
SarStandAttrInfo sarStandAttrInfo = new SarStandAttrInfo();
|
* @return
|
||||||
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) {
|
|
||||||
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("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 {
|
|
||||||
importDto.setErrorStr("文件不存在");
|
|
||||||
fileError.add(importDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
importDto.setErrorStr("文件打开失败");
|
|
||||||
fileError.add(importDto);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return sarStandAttrInfo;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto, String standId) {
|
public SarBussionessStand parseImportDtoToSarBussionessStand(ImportDto importDto, String standId) {
|
||||||
|
|
||||||
|
|
||||||
@@ -648,6 +546,54 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
if ("有效".equals(importDto.getStandStatus())) {
|
if ("有效".equals(importDto.getStandStatus())) {
|
||||||
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
|
sarBussionessStand.setTextStatusBuss("vsaga7nwub");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业标准属性字段
|
||||||
|
*/
|
||||||
|
|
||||||
|
HashMap<String, String> attrInfoMap = new HashMap<>();
|
||||||
|
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()!=""){
|
||||||
|
attrInfoMap.put("FBGBUSS",fileInfo.getAttId());
|
||||||
|
|
||||||
|
}else {
|
||||||
|
attrInfoMap.put("GLWJBUSS",fileInfo.getAttId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
importDto.setErrorStr("文件不存在");
|
||||||
|
fileError.add(importDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
importDto.setErrorStr("路径错误!");
|
||||||
|
fileError.add(importDto);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return sarBussionessStand;
|
return sarBussionessStand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,63 +601,6 @@ public class ImportExcelServiceImpl extends ServiceImpl<ImportExcelDao, ImportDt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
public HashMap<String, String> analysisStandId(ImportDto importDto) {
|
||||||
HashMap<String, String> result = new HashMap<>();
|
HashMap<String, String> result = new HashMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user