Merge remote-tracking branch 'origin/dev_20230216' into dev_20230216
This commit is contained in:
+20
-13
@@ -2,6 +2,7 @@ package com.adc.da.slrs.standardSplit.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.adc.da.att.controller.AttFileEOController;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
@@ -41,10 +42,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.adc.da.utils.util.ExcelUtil.checkObjAllFieldsIsNull;
|
||||
@@ -547,10 +547,10 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
// 导入参数设置,默认即可
|
||||
ImportParams params = new ImportParams();
|
||||
try {
|
||||
String fields[] = {"条款号", "条款名称","条款内容","条款附件"};
|
||||
String fields[] = {"条款号", "条款名称","条款内容"};
|
||||
params.setImportFields(fields);
|
||||
// params.setReadSingleCell(false);
|
||||
List<SarFileSplitItemsImportDto> result = new ArrayList<>();
|
||||
// 解析excel,并返回校验信息
|
||||
result = ExcelImportUtil.importExcel(excelfile, SarFileSplitItemsImportDto.class, params);
|
||||
Long getExcelInfo = System.currentTimeMillis();
|
||||
//excel读取到的数据
|
||||
@@ -584,12 +584,21 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
continue;
|
||||
}
|
||||
//判断此行数据是否全部为空
|
||||
if(sarStandImportDto.getItemsNum().contains("模板说明")){
|
||||
i++;
|
||||
//是则不读取
|
||||
continue;
|
||||
if(StringUtils.isNotBlank(sarStandImportDto.getItemsNum())) {
|
||||
if (sarStandImportDto.getItemsNum().contains("模板说明")) {
|
||||
i++;
|
||||
//是则不读取
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//添加换行
|
||||
// if(StringUtils.isBlank(sarStandImportDto.getItemsNum()) && StringUtils.isBlank(sarStandImportDto.getItemsName())) {
|
||||
// if(StringUtils.isNotBlank(sarStandImportDto.getItermsConditions())){
|
||||
// sarStandImportDto.setItermsConditions("<p>"+sarStandImportDto.getItermsConditions());
|
||||
// }
|
||||
// }
|
||||
i = 0;
|
||||
|
||||
datasUpdate.add(sarStandImportDto);
|
||||
}
|
||||
String unzipfilepath = zipEntryName;
|
||||
@@ -668,7 +677,7 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
@ApiOperation(value = "拆分导入模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
public void exportTemplate(HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
String[] headers = { "条款号","条款名称","条款内容","条款附件"};
|
||||
String[] headers = { "条款号","条款名称","条款内容"};
|
||||
try{
|
||||
String fileName = "拆分导入模板下载/导入模板";
|
||||
StringBuilder descBuilder = new StringBuilder()
|
||||
@@ -677,8 +686,6 @@ public class SarFileSplitItemsEOController extends BaseController<SarFileSplitIt
|
||||
.append("1:条款号,条款名称,条款内容不能为空")
|
||||
.append("\n")
|
||||
.append("2:将附件存放在zip格式的文件夹中,名称与后缀输入于附件中即可")
|
||||
.append("\n")
|
||||
.append("3:图片格式格式为jpg")
|
||||
.append("\n");
|
||||
//生成模板
|
||||
CommonExportUtil.exportTemplate(fileName,headers,descBuilder.toString(), response,request);
|
||||
|
||||
+3
-3
@@ -16,14 +16,14 @@ public class SarFileSplitItemsImportDto {
|
||||
@Excel(name = "条款名称", orderNum = "1")
|
||||
private String itemsName;
|
||||
|
||||
@Excel(name = "条款附件", orderNum = "1")
|
||||
@Excel(name = "条款内容", orderNum = "1")
|
||||
private String itermsConditions;
|
||||
|
||||
// @Excel(name = "责任部门", orderNum = "1")
|
||||
// private String responsibleUnit;
|
||||
|
||||
@Excel(name = "条款内容", orderNum = "1")
|
||||
private String mag;
|
||||
// @Excel(name = "条款内容", orderNum = "1")
|
||||
// private String mag;
|
||||
|
||||
// @Excel(name = "责任部门", orderNum = "1")
|
||||
// private String newcarPutTime;
|
||||
|
||||
+3
-3
@@ -171,8 +171,8 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
try {
|
||||
AttFileEO attFileEO = attFileEOService.getFileInfo(sarFileSplitInfoEO.getAttId());
|
||||
//String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
String readFilePath = filePath + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
|
||||
// String readFilePath = filePath + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
String readFilePath = "C:/Users/syxy/Desktop/GB 1589-2016 汽车、挂车及汽车列车外廓尺寸、轴荷及质量限值.docx";
|
||||
InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
||||
XWPFDocument doc = new XWPFDocument(is);
|
||||
|
||||
@@ -746,7 +746,7 @@ public class SarFileSplitInfoEOServiceImpl implements SarFileSplitInfoEOService
|
||||
for (SarFileSplitInfoEO data : rows){
|
||||
List<DicTypeEO> dicTypeEO = dicTypeEODao.selectPidByCode(data.getFileType());
|
||||
if(dicTypeEO!=null){
|
||||
data.setFileTypeShow(dicTypeEO.get(0).getDicTypeName());
|
||||
//data.setFileTypeShow(dicTypeEO.get(0).getDicTypeName());
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
|
||||
+11
-143
@@ -35,6 +35,8 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.adc.da.utils.util.ExcelUtil.checkObjAllFieldsIsNull;
|
||||
@@ -538,7 +540,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
valEO.setItemContent("<p>"+imgCon+"<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -573,7 +575,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
valEO.setItemContent("<p>"+imgCon+"<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -610,7 +612,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId();
|
||||
String imgCon = "<img class=\'wordImg\' src=\'" + pathSrc + "\'>";
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(imgCon + "<p>" + importDto.getMag() + "<p>");
|
||||
valEO.setItemContent("<p>"+imgCon+"<p>");
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -739,8 +741,10 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
//循环验证数据
|
||||
for (SarFileSplitItemsImportDto dto : datas) {
|
||||
|
||||
if(dto.getItemsNum().contains("模板说明")){
|
||||
continue;
|
||||
if(StringUtils.isNotBlank(dto.getItemsNum())){
|
||||
if(dto.getItemsNum().contains("模板说明")){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -774,151 +778,15 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
// String saveApplyCode = "";
|
||||
// if (StringUtils.isNotEmpty(dto.getApplyArctic())) {
|
||||
// dto.setApplyArctic(dto.getApplyArctic().replace(",", ","));
|
||||
// String applys[] = dto.getApplyArctic().split(",");
|
||||
// if(applys.length>20){
|
||||
// errorMsg += "适用车型选项不能超过20个;";
|
||||
// countError++;
|
||||
// } else if (dto.getApplyArctic().length() > 500) {
|
||||
// errorMsg += "适用车型不能超过500个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// Set set = new HashSet();
|
||||
// for (int a = 0; a < applys.length; a++) {
|
||||
// dic.setDicTypeName(applys[a]);
|
||||
// dic.setDicTypeCode("ENERGYTYPES");
|
||||
// getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
// if (getDic.size() == 1) {
|
||||
// saveApplyCode += getDic.get(0).getDicTypeCode() + ",";
|
||||
// } else if (getDic.size() > 0) {
|
||||
// errorMsg += "适用车型" + applys[a] + "不明确;";
|
||||
// countError++;
|
||||
// break;
|
||||
// } else {
|
||||
// errorMsg += "适用车型" + applys[a] + "不存在;";
|
||||
// countError++;
|
||||
// break;
|
||||
// }
|
||||
// set.add(applys[a]);
|
||||
// if (a==applys.length-1 && applys.length != set.size()){
|
||||
// errorMsg += "适用车型存在重复数据;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// if (!saveApplyCode.equals("")){
|
||||
// dto.setApplyArctic(saveApplyCode.substring(0,saveApplyCode.length()-1));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!claimStypelist.contains(dto.getClaimType())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getClaimType())) {
|
||||
// dic.setDicTypeName(dto.getClaimType());
|
||||
// dic.setDicTypeCode("REQUESTTYPE");
|
||||
// if (dto.getClaimType().length() > 500) {
|
||||
// errorMsg += "要求类型不能超过500个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// getDic = dicTypeEODao.getDicTypeByDicTypeName(dic);
|
||||
// Set set = new HashSet();
|
||||
// if (getDic != null) {
|
||||
// if (getDic.size() == 1) {
|
||||
// dto.setClaimType(getDic.get(0).getDicTypeCode());
|
||||
// claimStypelist.add(getDic.get(0).getDicTypeCode());
|
||||
// } else if (getDic.size() > 0) {
|
||||
// errorMsg += "要求类型不明确;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// errorMsg += "要求类型不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// } else {
|
||||
// errorMsg += "要求类型不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (StringUtils.isEmpty(dto.getMag())) {
|
||||
if (StringUtils.isEmpty(dto.getItermsConditions())) {
|
||||
errorMsg += "条款内容不能为空;";
|
||||
countError++;
|
||||
} else {
|
||||
if(dto.getMag().length() > 50000){
|
||||
if(dto.getItermsConditions().length() > 50000){
|
||||
errorMsg += "条款内容不能超过50000个字符;";
|
||||
countError++;
|
||||
}
|
||||
}
|
||||
// if(!foList.contains(dto.getFo())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getFo())) {
|
||||
// if (dto.getFo().length() > 200) {
|
||||
// errorMsg += "FO不能超过200个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// String uname = roleEODao.getIdsByNames(dto.getFo().split(","));
|
||||
// if (StringUtils.isNotBlank(uname)) {
|
||||
// dto.setFo(uname);
|
||||
// foList.addAll(Arrays.asList(uname.split(",")));
|
||||
// } else {
|
||||
// errorMsg += "FO不存在;";
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!dutyEngineerList.contains(dto.getDutyEngineer())) {
|
||||
// if (StringUtils.isNotEmpty(dto.getDutyEngineer())) {
|
||||
// if (dto.getDutyEngineer().length() > 100) {
|
||||
// errorMsg += "责任工程师不能超过100个字符;";
|
||||
// countError++;
|
||||
// } else {
|
||||
// String emList = roleEODao.getIdsByNames(dto.getDutyEngineer().split(","));
|
||||
// if (StringUtils.isNotBlank(emList)) {
|
||||
// dto.setDutyEngineer(emList);
|
||||
// dutyEngineerList.addAll(Arrays.asList(dto.getDutyEngineer().split(",")));
|
||||
// } else {
|
||||
// errorMsg += "系统中没有用户:" + dto.getDutyEngineer();
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(dto.getSvpps())){
|
||||
// if(dto.getSvpps().length() > 200){
|
||||
// errorMsg += "SVPPS不能超过200个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// String svppsShow = sysInfoEOService.getSvppsIdByName(dto.getSvpps());
|
||||
// dto.setSvpps(svppsShow);
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotEmpty(dto.getBusStandCover())){
|
||||
// if(dto.getBusStandCover().length() > 200){
|
||||
// errorMsg += "企标覆盖关系不能超过200个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// List<DicTypeEO> getDicType = dicTypeEODao.getDicTypeByDicCode("BZFGGXOUIUJ");
|
||||
// for (DicTypeEO dicTypeEO:getDicType) {
|
||||
// if (dicTypeEO.getDicTypeName().equals(dto.getBusStandCover())){
|
||||
// dto.setBusStandCover(dicTypeEO.getDicTypeCode());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(StringUtils.isNotBlank(dto.getResponsibleUnit())){
|
||||
// if(dto.getResponsibleUnit().length() > 100){
|
||||
// errorMsg += "责任部门不能超过100个字符;";
|
||||
// countError++;
|
||||
// }else {
|
||||
// String id = sysInfoEOService.getOrgIdByName(dto.getResponsibleUnit(),"DEPART");
|
||||
// if(StringUtils.isNotBlank(id)){
|
||||
// dto.setResponsibleUnit(id);
|
||||
// } else {
|
||||
// errorMsg += "系统中没有部门"+dto.getResponsibleUnit();
|
||||
// countError++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (countError > 0) {
|
||||
stringMessage.add(errorMsg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user