From c4535f9b12858168611ef02c2f838b08c1a52f99 Mon Sep 17 00:00:00 2001 From: gaojiabao Date: Tue, 4 Apr 2023 21:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=8B=86=E5=88=86=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SarFileSplitItemsEOController.java | 33 ++-- .../dto/SarFileSplitItemsImportDto.java | 6 +- .../impl/SarFileSplitInfoEOServiceImpl.java | 6 +- .../impl/SarFileSplitItemsEOServiceImpl.java | 154 ++---------------- 4 files changed, 37 insertions(+), 162 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/controller/SarFileSplitItemsEOController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/controller/SarFileSplitItemsEOController.java index 4a18ffbb..0cd70218 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/controller/SarFileSplitItemsEOController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/controller/SarFileSplitItemsEOController.java @@ -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 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"+sarStandImportDto.getItermsConditions()); +// } +// } i = 0; + datasUpdate.add(sarStandImportDto); } String unzipfilepath = zipEntryName; @@ -668,7 +677,7 @@ public class SarFileSplitItemsEOController extends BaseController dicTypeEO = dicTypeEODao.selectPidByCode(data.getFileType()); if(dicTypeEO!=null){ - data.setFileTypeShow(dicTypeEO.get(0).getDicTypeName()); + //data.setFileTypeShow(dicTypeEO.get(0).getDicTypeName()); } } return rows; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/service/impl/SarFileSplitItemsEOServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/service/impl/SarFileSplitItemsEOServiceImpl.java index 5874079f..927607e5 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/service/impl/SarFileSplitItemsEOServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/standardSplit/service/impl/SarFileSplitItemsEOServiceImpl.java @@ -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 = ""; valEO.setType("IMG"); - valEO.setItemContent(imgCon + "

" + importDto.getMag() + "

"); + valEO.setItemContent("

"+imgCon+"

"); } } if (isText) { @@ -573,7 +575,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId(); String imgCon = ""; valEO.setType("IMG"); - valEO.setItemContent(imgCon + "

" + importDto.getMag() + "

"); + valEO.setItemContent("

"+imgCon+"

"); } } if (isText) { @@ -610,7 +612,7 @@ public class SarFileSplitItemsEOServiceImpl implements SarFileSplitItemsEOServic String pathSrc = elasticsearchImg + "/api/att/attFile/getFileInfo?fileId=" + attFileVo.getId(); String imgCon = ""; valEO.setType("IMG"); - valEO.setItemContent(imgCon + "

" + importDto.getMag() + "

"); + valEO.setItemContent("

"+imgCon+"

"); } } 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 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); }