Merge remote-tracking branch 'origin/dev_20230216' into dev_20230216
This commit is contained in:
+84
@@ -0,0 +1,84 @@
|
||||
package com.adc.da.slrs.sarBussStandAttrInfo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BusProcessEvaluationHis对象", description="流程评分历史表")
|
||||
public class BusProcessEvaluationHis implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId(value = "ID", type = IdType.UUID)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准id")
|
||||
@TableField("STAND_ID")
|
||||
private String standId;
|
||||
|
||||
@ApiModelProperty(value = "处理人")
|
||||
@TableField("USER_ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "信息")
|
||||
@TableField("MESG")
|
||||
private String mesg;
|
||||
|
||||
@ApiModelProperty(value = "节点信息")
|
||||
@TableField("TASK_INFO")
|
||||
private String taskInfo;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
@TableField("TASK_ID")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "流程实例id")
|
||||
@TableField("P_ID")
|
||||
private String pId;
|
||||
|
||||
@ApiModelProperty(value = "流程名称")
|
||||
@TableField("PRC_NAME")
|
||||
private String prcName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATE_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@TableField("UPDATE_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "onlyOffice 是否编辑 0 未编辑 1 已编辑")
|
||||
@TableField("EDIT_STATUS")
|
||||
private String editStatus;
|
||||
|
||||
@ApiModelProperty(value = "onlyOffice 编辑文件存储路径")
|
||||
@TableField("EDIT_FILE_PATH")
|
||||
private String editFilePath;
|
||||
|
||||
@ApiModelProperty(value = "逻辑状态")
|
||||
@TableField("FLAG")
|
||||
private String flag;
|
||||
|
||||
@ApiModelProperty(value = "onlyOffice 访问编辑文件全路径")
|
||||
@TableField(exist = false)
|
||||
private String downLoadUrl;
|
||||
|
||||
@ApiModelProperty(value = "处理人姓名")
|
||||
@TableField(exist = false)
|
||||
private String userName;
|
||||
}
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
package com.adc.da.slrs.sarBussStandAttrInfo.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.scheduling.support.SimpleTriggerContext;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-02-28
|
||||
*/
|
||||
@Data
|
||||
public class SarBussStandAttrInfoExecl extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准基础表主键")
|
||||
private String standId;
|
||||
|
||||
private String creationUser;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
private String validFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date creationTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "体系类别")
|
||||
private String txlbbuss;
|
||||
|
||||
private String glwj;
|
||||
|
||||
private String svpps;
|
||||
|
||||
private String gfxyywj;
|
||||
|
||||
private String zrbm;
|
||||
|
||||
private Date fzrq;
|
||||
|
||||
private Date fsrq;
|
||||
|
||||
private String qbmj;
|
||||
|
||||
private String qbsq;
|
||||
|
||||
private String qbwb;
|
||||
|
||||
private String gcwb;
|
||||
|
||||
private String zyqcr;
|
||||
|
||||
private String qcfbw;
|
||||
|
||||
private String xglc;
|
||||
|
||||
private String xgbm;
|
||||
|
||||
private String xhqbm;
|
||||
|
||||
private String zqcbm;
|
||||
|
||||
private String qtqcr;
|
||||
|
||||
private String wfspjs;
|
||||
|
||||
private String xgjh;
|
||||
|
||||
//附件
|
||||
private String fbgBuss;
|
||||
|
||||
//标准中文名称
|
||||
private String standName;
|
||||
|
||||
//企标类型
|
||||
private String standSort;
|
||||
|
||||
//标准年份
|
||||
private String standYear;
|
||||
|
||||
//文本状态
|
||||
private String textStatusBuss;
|
||||
|
||||
//起草部门
|
||||
private String qcdw;
|
||||
|
||||
//起草人
|
||||
private String qcrbuss;
|
||||
|
||||
//发布日期
|
||||
private Date issueTime;
|
||||
|
||||
//标准编号
|
||||
private String standCode;
|
||||
|
||||
//标准英文名称
|
||||
private String standEnName;
|
||||
|
||||
//实施日期
|
||||
private Date putTime;
|
||||
|
||||
//企标制修订状态
|
||||
private String revisionStatus;
|
||||
|
||||
//废止日期
|
||||
private String fzrqbuss;
|
||||
|
||||
//代替企标编号
|
||||
private String dtqbbhbuss;
|
||||
|
||||
//复审日期
|
||||
private String fsrqbuss;
|
||||
|
||||
//被代替企标编号
|
||||
private String bdtqbbhbuss;
|
||||
|
||||
//文件上传人员
|
||||
private String wjscrybuss;
|
||||
|
||||
//适用车型
|
||||
private String sycxclass;
|
||||
|
||||
//能源类型
|
||||
private String nylxclass;
|
||||
|
||||
//适用产品线
|
||||
private String sycpxclass;
|
||||
|
||||
//上传时间
|
||||
private String xcsjbuss;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> attrInfoMap = new LinkedHashMap<>();
|
||||
|
||||
}
|
||||
+9
-152
@@ -404,160 +404,17 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入功能")
|
||||
@PostMapping("/importSarBussionessStandFile")
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(@RequestParam(value = "file",required = false)MultipartFile file) throws Exception{
|
||||
|
||||
@ApiOperation(value = "|SarBussionessStand|导入")
|
||||
@PostMapping("/importSarBussionessStand")
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(@RequestParam(value = "file",required = false) MultipartFile file)throws Exception {
|
||||
//截取后缀名
|
||||
int pos = file.getOriginalFilename().lastIndexOf(".");
|
||||
String str = file.getOriginalFilename().substring(pos + 1).toLowerCase();
|
||||
String filenameorg = file.getOriginalFilename().substring(0, pos);
|
||||
//判断上传文件必须是zip
|
||||
if (!str.equals("zip")) {
|
||||
return Result.error("fail", "请上传zip文件");
|
||||
}
|
||||
String path = filePath + "/modal/" + filenameorg;
|
||||
File saveDirectory = new File(path);
|
||||
if (!saveDirectory.isDirectory()) {
|
||||
saveDirectory.mkdir();
|
||||
}
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(path + "/" + file.getOriginalFilename()));
|
||||
try {
|
||||
//解压缩
|
||||
String zipEntryName = FileUnZip.unZipFiles(path + "/" + file.getOriginalFilename(), path);
|
||||
// 数据相关处理,
|
||||
// 1.获取其中的Excel,
|
||||
List<File> excelfilelist = FileUnZip.readImpExcelFile(zipEntryName);
|
||||
System.gc();
|
||||
if (excelfilelist.size() < 1) {
|
||||
int i = 0;
|
||||
for (File file1 : excelfilelist) {
|
||||
if (file1.getName().indexOf("导入模板") > -1) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i == 0) {
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "压缩包内没有上传导入模板Excel");
|
||||
}
|
||||
} else if (excelfilelist.size() > 1) {
|
||||
int i = 0;
|
||||
for (File file1 : excelfilelist) {
|
||||
if (file1.getName().indexOf("导入模板") > -1) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i > 1) {
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "压缩包内有多个导入模板Excel");
|
||||
}
|
||||
ResponseMessage<SarBussionessStand> message = sarBussionessStandEOService.importSarBussionessStandFile(file);
|
||||
if (message != null && ! message.equals("")){
|
||||
return Result.success();
|
||||
}else {
|
||||
return Result.error("导入失败,导入的文件为空");
|
||||
}
|
||||
File excelfile = excelfilelist.get(0);
|
||||
for (File file1 : excelfilelist) {
|
||||
if (file1.getName().indexOf("导入模板") > -1) {
|
||||
excelfile = file1;
|
||||
}
|
||||
}
|
||||
// 导入参数设置,默认即可
|
||||
Workbook workbook = null;
|
||||
try {
|
||||
workbook = WorkbookFactory.create(excelfile);
|
||||
List<Map<String, String>> dataList = new ArrayList<>();
|
||||
if (workbook != null) {
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
if (sheet != null) {
|
||||
StringBuilder headerSb = new StringBuilder();
|
||||
int rowNos = sheet.getLastRowNum();// 得到excel的总记录条数
|
||||
for (int i = 0; i <= rowNos; i++) {// 遍历行
|
||||
Row row = sheet.getRow(i);
|
||||
Row headerRow = sheet.getRow(0);
|
||||
boolean isBlank = sarLawsInfoEOService.isRowEmpty(row);
|
||||
if (row != null && !isBlank) {
|
||||
int columNos = headerRow.getLastCellNum();// 表头总共的列数
|
||||
Map<String, String> rowList = new LinkedHashMap<>();
|
||||
for (int j = 0; j < columNos; j++) {
|
||||
Cell cell = row.getCell(j);
|
||||
Cell headerCell = headerRow.getCell(j);
|
||||
if (cell != null) {
|
||||
if (i == 0) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
headerSb.append(cell.getStringCellValue() + ",");
|
||||
} else {
|
||||
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
Date d = cell.getDateCellValue();
|
||||
rowList.put(headerCell.getStringCellValue(), df.format(d));
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
rowList.put(headerCell.getStringCellValue(), cell.getStringCellValue());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i != 0) {
|
||||
rowList.put(headerCell.getStringCellValue(), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != 0) {
|
||||
dataList.add(rowList);
|
||||
}
|
||||
}
|
||||
}
|
||||
String fields = FieldConvertUtil.exportBaseFieldNamesBuss + "," + FieldConvertUtil.exportBaseFieldNamesBussCode + ",";
|
||||
String excelHeader = headerSb.toString();
|
||||
if (!fields.equals(excelHeader)) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
//导入
|
||||
if(dataList!=null &&!dataList.isEmpty()){
|
||||
try {
|
||||
String unzipfilepath = zipEntryName;
|
||||
ResponseMessage<SarBussionessStand> message = sarBussionessStandEOService.importSarBussionessStand(dataList,unzipfilepath);
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return message;
|
||||
} catch (Exception e) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", e.getMessage());
|
||||
}
|
||||
}else{
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "没有可导入的数据,请检查!");
|
||||
}
|
||||
} catch (NoSuchElementException e){
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "没有可导入的数据,请检查!");
|
||||
} catch (Exception e) {
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
|
||||
|
||||
void checkFileByEncrypt();
|
||||
|
||||
ResponseMessage<SarBussionessStand> importSarBussionessStand(List<Map<String, String>> dataList, String filepath)throws Exception;
|
||||
|
||||
//导入
|
||||
ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
||||
|
||||
+742
-23
@@ -3,12 +3,12 @@ package com.adc.da.slrs.sarBussionessStand.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.common.ConvertMqEO;
|
||||
import com.adc.da.common.SarTypeEnum;
|
||||
import com.adc.da.common.SelectionTypeEnum;
|
||||
import com.adc.da.common.UseModuleEnum;
|
||||
import com.adc.da.att.vo.AttFileVo;
|
||||
import com.adc.da.common.*;
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.mq.CreateMQService;
|
||||
import com.adc.da.mq.CreateStandMQService;
|
||||
import com.adc.da.person.dao.PersonCollectEODao;
|
||||
@@ -20,10 +20,18 @@ import com.adc.da.search.entity.StandLawsEO;
|
||||
import com.adc.da.search.service.StandLawsSearchService;
|
||||
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
|
||||
import com.adc.da.slrs.NewsFeed.service.INewsFeedService;
|
||||
import com.adc.da.slrs.esRevisePlan.dao.EsRevisePlanDao;
|
||||
import com.adc.da.slrs.esRevisePlan.dao.EsRevisePlanLogDao;
|
||||
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlan;
|
||||
import com.adc.da.slrs.esRevisePlan.entity.EsRevisePlanLog;
|
||||
import com.adc.da.slrs.esRevisePlan.service.IEsRevisePlanService;
|
||||
import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao;
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.entity.BusProcessEvaluationHis;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.entity.SarBussStandAttrInfo;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.entity.SarBussStandAttrInfoExecl;
|
||||
import com.adc.da.slrs.sarBussStandAttrInfo.service.ISarBussStandAttrInfoService;
|
||||
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
||||
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
||||
import com.adc.da.slrs.sarBussStandItems.dao.SarBussStandItemsDao;
|
||||
@@ -37,12 +45,18 @@ import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport;
|
||||
import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService;
|
||||
import com.adc.da.slrs.sarBussionessStandState.entity.SarBussionessStandState;
|
||||
import com.adc.da.slrs.sarBussionessStandState.service.ISarBussionessStandStateService;
|
||||
import com.adc.da.slrs.sarEnterpriseStandardEvaluation.entity.QualityEvaluation;
|
||||
import com.adc.da.slrs.sarEnterpriseStandardEvaluation.service.IQualityEvaluationService;
|
||||
import com.adc.da.slrs.sarLawsInfo.service.ISarLawsInfoService;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
|
||||
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
||||
import com.adc.da.slrs.sarStandItems.entity.SarStandItems;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
|
||||
@@ -58,23 +72,27 @@ import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
|
||||
import com.adc.da.sys.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.utils.util.*;
|
||||
import com.adc.da.utils.util.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -84,6 +102,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Clob;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -185,6 +204,30 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
@Autowired
|
||||
private EncryptFileUtils encryptFileUtils;
|
||||
|
||||
@Autowired
|
||||
private ISarLawsInfoService sarLawsInfoEOService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISarBussionessStandService iSarBussionessStandService;
|
||||
|
||||
@Autowired
|
||||
private IQualityEvaluationService qualityEvaluationService;
|
||||
|
||||
@Autowired
|
||||
IEsRevisePlanService iEsRevisePlanService;
|
||||
|
||||
@Autowired
|
||||
private EsRevisePlanDao esRevisePlanDao;
|
||||
|
||||
@Autowired
|
||||
private ISarBussionessStandStateService bussionessStandStateService;
|
||||
|
||||
@Autowired
|
||||
private EsRevisePlanLogDao esRevisePlanLogDao;
|
||||
|
||||
@Autowired
|
||||
private ISarBussStandAttrInfoService sarBussStandAttrInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -1953,27 +1996,703 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
logger.info("================================文件检查完毕==================================================");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导入
|
||||
* @param dataList
|
||||
* @param filepath
|
||||
* @return
|
||||
* @param file
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStand(List<Map<String, String>> dataList, String filepath)throws Exception {
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file) throws Exception {
|
||||
//给出头部信息
|
||||
String[] headerExcel = {"企标编号,中文名称,英文名称,文本状态,发布日期,企标实施日期,企标制修订状态,起草部门,废止日期,代替企标编号,复审日期,起草人,被代替企标编号,采用标准,文件上传人员,采标程度,引用标准,适用车型,能源类型,适用产品线,上传时间,体系类别,备案日期,关联模块-乘用车VPPS编码,关联模块--乘用车vpps中文名称,关联模块--卡车VPPS编码,关联模块--卡车vpps中文名称,附件,企标类型,标准年份,"};
|
||||
|
||||
//获取文件全称
|
||||
String fileNameStr = file.getOriginalFilename();
|
||||
//获取最后.的位置
|
||||
int pos = fileNameStr.lastIndexOf(".");
|
||||
//获取压缩文件名称并以小写显示
|
||||
String fileStr = fileNameStr.substring(pos + 1).toLowerCase();
|
||||
//校验是否是zip文件
|
||||
if (!fileStr.equals("zip")){
|
||||
return Result.error("请上传zip格式的文件");
|
||||
}
|
||||
//进行拼接获取文件名称
|
||||
String fileName = fileNameStr.substring(0,pos);
|
||||
//获取路径和文件名称
|
||||
String path = filePath + "/" + fileName;
|
||||
|
||||
File saveDirectory = new File(path);
|
||||
//判断saveDirectory中是否是文件夹
|
||||
if (!saveDirectory.isDirectory()){
|
||||
saveDirectory.mkdir();
|
||||
}
|
||||
//将文件写入到指定路径中
|
||||
FileUtils.copyInputStreamToFile(file.getInputStream(),new File(path + "/" + fileNameStr));
|
||||
try {
|
||||
//将导入数据循环新增至相应表
|
||||
List<SarBussionessStand> list = new ArrayList<>();
|
||||
int countSuccess = 0;
|
||||
for (SarBussionessStand sarBussionessStand : list) {
|
||||
sarBussionessStandEODao.importSarBussionessStand(sarBussionessStand);
|
||||
countSuccess++;
|
||||
//解压缩
|
||||
String zipEntryName = FileUnZip.unZipFiles(path + "/" + fileNameStr, path);
|
||||
//获取文件信息
|
||||
List<File> fileList = readImpExcelFile(zipEntryName);
|
||||
//判断获取到的文件数量
|
||||
if (fileList.size() < 1){
|
||||
return Result.error("上传的文件是空文件");
|
||||
}
|
||||
String msg = "成功导入" + countSuccess + "条";
|
||||
return Result.success("0", msg, null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return Result.error("导入失败");
|
||||
//File excelfile = fileList.get(0);
|
||||
int excel = 0;
|
||||
for (File fileInfo:fileList){
|
||||
if (fileInfo.getName().contains(".xls") || fileInfo.getName().contains(".xlsx")) {
|
||||
excel =excel+1;
|
||||
if (excel > 1){
|
||||
return Result.error("导入了多个Excel文件");
|
||||
}
|
||||
Workbook workbook = null;
|
||||
try {
|
||||
workbook = WorkbookFactory.create(fileInfo);
|
||||
if (workbook != null){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
if (sheet != null){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//获取总条数
|
||||
int rowNum = sheet.getLastRowNum();
|
||||
//循环遍历
|
||||
for (int i = 0;i < rowNum;i++){
|
||||
Row row = sheet.getRow(i);
|
||||
Row headerRow = sheet.getRow(0);
|
||||
boolean isBlank = sarLawsInfoEOService.isRowEmpty(row);
|
||||
if (row != null && !isBlank) {
|
||||
int columNos = headerRow.getLastCellNum();// 表头总共的列数
|
||||
Map<String, String> rowList = new LinkedHashMap<>();
|
||||
for (int j = 0; j < columNos; j++) {
|
||||
Cell cell = row.getCell(j);
|
||||
Cell headerCell = headerRow.getCell(j);
|
||||
if (cell != null) {
|
||||
if (i == 0) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
sb.append(cell.getStringCellValue() + ",");
|
||||
} else {
|
||||
if (CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
Date d = cell.getDateCellValue();
|
||||
rowList.put(headerCell.getStringCellValue(), sdf.format(d));
|
||||
} else {
|
||||
cell.setCellType(CellType.STRING);
|
||||
rowList.put(headerCell.getStringCellValue(), cell.getStringCellValue());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i != 0) {
|
||||
rowList.put(headerCell.getStringCellValue(), "");
|
||||
}
|
||||
}
|
||||
}
|
||||
SarBussStandAttrInfoExecl sarBussStandAttrInfo = new SarBussStandAttrInfoExecl();
|
||||
if (i != 0) {
|
||||
|
||||
String standCode = rowList.get("企标编号");
|
||||
sarBussStandAttrInfo.setStandCode(standCode);
|
||||
|
||||
String standName = rowList.get("中文名称");
|
||||
if(StringUtils.isNotBlank(standName)){
|
||||
if(standName.length()>100){
|
||||
return Result.error("输入的标准名称过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setStandName(standName);
|
||||
}else {
|
||||
return Result.error("标准名称不能为空");
|
||||
}
|
||||
|
||||
String standEnName = rowList.get("英文名称");
|
||||
sarBussStandAttrInfo.setStandEnName(standEnName);
|
||||
|
||||
String textStatusBuss = rowList.get("文本状态");
|
||||
if (StringUtils.isNotBlank(textStatusBuss)){
|
||||
if (textStatusBuss.length() > 200){
|
||||
return Result.error("输入的文本状态过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setTextStatusBuss(textStatusBuss);
|
||||
}else {
|
||||
return Result.error("文本状态不能为空");
|
||||
}
|
||||
|
||||
SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
Date issueTime = sdfs.parse( rowList.get("发布日期"));
|
||||
String issueTimeStr = sdfs.format(issueTime);
|
||||
if (StringUtils.isNotBlank(issueTimeStr)){
|
||||
sarBussStandAttrInfo.setIssueTime(issueTime);
|
||||
}else {
|
||||
return Result.error("发布日期不能为空");
|
||||
}
|
||||
|
||||
|
||||
Date putTime = sdfs.parse(rowList.get("企标实施日期"));
|
||||
String putTimeStr = sdfs.format(putTime);
|
||||
if (StringUtils.isNotBlank(putTimeStr)){
|
||||
sarBussStandAttrInfo.setPutTime(putTime);
|
||||
}else {
|
||||
return Result.error("企标实施日期不能为空");
|
||||
}
|
||||
|
||||
|
||||
String revisionStatus = rowList.get("企标制修订状态");
|
||||
sarBussStandAttrInfo.setRevisionStatus(revisionStatus);
|
||||
|
||||
String qcdw = rowList.get("起草部门");
|
||||
if (StringUtils.isNotBlank(qcdw)){
|
||||
if (qcdw.length() > 100){
|
||||
return Result.error("输入的起草部门过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setQcdw(qcdw);
|
||||
}else {
|
||||
return Result.error("起草部门不能为空");
|
||||
}
|
||||
|
||||
String fzrqbuss = rowList.get("废止日期");
|
||||
if (StringUtils.isNotBlank(fzrqbuss)){
|
||||
sarBussStandAttrInfo.setFzrqbuss(fzrqbuss);
|
||||
}else {
|
||||
return Result.error("废止日期不能为空");
|
||||
}
|
||||
|
||||
|
||||
String dtqbbhbuss = rowList.get("代替企标编号");
|
||||
sarBussStandAttrInfo.setDtqbbhbuss(dtqbbhbuss);
|
||||
|
||||
String fsrqbuss = rowList.get("复审日期");
|
||||
if (StringUtils.isNotBlank(fsrqbuss)){
|
||||
sarBussStandAttrInfo.setFsrqbuss(fsrqbuss);
|
||||
}else {
|
||||
return Result.error("复审日期不能为空");
|
||||
}
|
||||
|
||||
|
||||
String qcrbuss = rowList.get("起草人");
|
||||
if (StringUtils.isNotBlank(qcrbuss)){
|
||||
if (qcrbuss.length() > 100){
|
||||
return Result.error("输入的起草人过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setQcrbuss(qcrbuss);
|
||||
}else {
|
||||
return Result.error("起草人不能为空");
|
||||
}
|
||||
|
||||
String bdtqbbhbuss = rowList.get("被代替企标编号");
|
||||
sarBussStandAttrInfo.setBdtqbbhbuss(bdtqbbhbuss);
|
||||
|
||||
//// //采用标准 13
|
||||
|
||||
String wjscrybuss = rowList.get("文件上传人员");
|
||||
sarBussStandAttrInfo.setWjscrybuss(wjscrybuss);
|
||||
|
||||
//// //采标程度 15
|
||||
//// //引用标准 16
|
||||
|
||||
String sycxclass = rowList.get("适用车型");
|
||||
sarBussStandAttrInfo.setSycxclass(sycxclass);
|
||||
|
||||
String nylxclass = rowList.get("能源类型");
|
||||
sarBussStandAttrInfo.setNylxclass(nylxclass);
|
||||
|
||||
String sycpxclass = rowList.get("适用产品线");
|
||||
sarBussStandAttrInfo.setSycpxclass(sycpxclass);
|
||||
|
||||
String xcsjbuss = rowList.get("上传时间");
|
||||
if (StringUtils.isNotBlank(xcsjbuss)){
|
||||
sarBussStandAttrInfo.setXcsjbuss(xcsjbuss);
|
||||
}else {
|
||||
return Result.error("上传时间不能为空");
|
||||
}
|
||||
|
||||
|
||||
String txlbbuss = rowList.get("体系类别");
|
||||
sarBussStandAttrInfo.setTxlbbuss(txlbbuss);
|
||||
|
||||
//// //备案日期 22
|
||||
//// //关联模块-乘用车VPPS编码 23
|
||||
//// //关联模块--乘用车vpps中文名称 24
|
||||
//// //关联模块--卡车VPPS编码 25
|
||||
//// //关联模块--卡车vpps中文名称 26
|
||||
|
||||
String fbgBuss = rowList.get("附件");
|
||||
String[] split = fbgBuss.split(",");
|
||||
String s = "";
|
||||
if (split.length != 0){
|
||||
for (int j = 0;j < split.length;j++){
|
||||
String name = fileInfo.getName();
|
||||
String[] split1 = fileInfo.toString().split(name);
|
||||
File files = new File(split1[0]+split[j]);
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(files);
|
||||
if (StringUtils.isNotBlank(attFileVo.getId())){
|
||||
s = "," + attFileVo.getAttId();
|
||||
}else {
|
||||
s = attFileVo.getAttId();
|
||||
}
|
||||
sarBussStandAttrInfo.setFbgBuss(s);
|
||||
}
|
||||
}else {
|
||||
sarBussStandAttrInfo.setFbgBuss(StringUtils.join(split));
|
||||
}
|
||||
|
||||
String standSort = rowList.get("企标类型");
|
||||
if (StringUtils.isNotBlank(standSort)){
|
||||
if (standSort.length() > 100){
|
||||
return Result.error("企标类型输入过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setStandSort(standSort);
|
||||
}else {
|
||||
return Result.error("企标类型不能为空");
|
||||
}
|
||||
|
||||
String standYear = rowList.get("标准年份");
|
||||
if (StringUtils.isNotBlank(standYear)){
|
||||
if (standYear.length() > 100){
|
||||
return Result.error("标准年份输入过长");
|
||||
}
|
||||
sarBussStandAttrInfo.setStandYear(standYear);
|
||||
}else {
|
||||
return Result.error("标准年份不能为空");
|
||||
}
|
||||
|
||||
List<SarBussStandAttrInfoExecl> list = new ArrayList<>();
|
||||
list.add(sarBussStandAttrInfo);
|
||||
|
||||
//进行转义
|
||||
attrInfoShowImport(list);
|
||||
|
||||
com.alibaba.fastjson.JSONArray json = com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(list));
|
||||
com.alibaba.fastjson.JSONObject jsonObjects = null;
|
||||
for (int j = 0; j < json.size(); j++) {
|
||||
jsonObjects = json.getJSONObject(j);
|
||||
}
|
||||
String infoJson = String.valueOf(jsonObjects);
|
||||
//入库
|
||||
processCreateBuss(infoJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
String fields = StringUtils.join(headerExcel);
|
||||
String excelHeader = sb.toString();
|
||||
if (!fields.equals(excelHeader)) {
|
||||
workbook.close();
|
||||
//删除原上传文件
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("fail", "读取失败,请严格按照模板文件导入数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入失败,没有可导入的数据,请检查!");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<File> readImpExcelFile(String path) {
|
||||
File file = new File(path);
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
for (File fi : files) {
|
||||
// 对文件进行过滤,读取所有文件
|
||||
String name = fi.getName();
|
||||
//文件不为空 添加
|
||||
if (name != null){
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
public String processCreateBuss(String standJson) throws Exception{
|
||||
Map<String,Object> standMap = new HashMap();
|
||||
standMap = com.alibaba.fastjson.JSONObject.parseObject(standJson);
|
||||
String bussId = "";
|
||||
if (standMap != null && !standMap.isEmpty()) {
|
||||
String prcNum = String.valueOf(standMap.get("prcNum"));
|
||||
String pid = String.valueOf(standMap.get("topId"));
|
||||
String prcName = String.valueOf(standMap.get("prcName"));
|
||||
String prcCreateUser = String.valueOf(standMap.get("prcCreateUser"));
|
||||
String standType = String.valueOf(standMap.get("standType"));
|
||||
// String isJudge = String.valueOf(standMap.get("ifIn")); //是否经过技术评估
|
||||
SarBussionessStand sarBussionessStand = new SarBussionessStand();
|
||||
// if(standMap.containsKey("standId")) {
|
||||
// if (standMap.get("standId") != null && !standMap.get("standId").toString().equals("")) {
|
||||
// String resId = standMap.get("standId").toString();
|
||||
// //此处说明是带入的形式
|
||||
// sarStandardsInfoEO.setId(resId);
|
||||
// SarCompResAssess assessInfoByResId = sarCompResAssessEOService.ssessInfoByResId(resId);
|
||||
// if (assessInfoByResId != null) {
|
||||
// assessInfoByResId.setProcessState("2");
|
||||
// sarCompResAssessEOService.updateByPrimaryKeySelective(assessInfoByResId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Map<String,Object> attInfoMap = new HashMap<>();
|
||||
List<String> jsonArray = new ArrayList<>();
|
||||
Object breakVal = null;
|
||||
Object itemList = null;
|
||||
for (Map.Entry<String,Object> entry : standMap.entrySet()) {
|
||||
String field = entry.getKey().toUpperCase();
|
||||
Object value = entry.getValue();
|
||||
if (InitStandAttrUtil.queryFieldListBuss.contains(field)) {
|
||||
if (value instanceof com.alibaba.fastjson.JSONArray) {
|
||||
String valStr = String.valueOf(value);
|
||||
List<String> valueArr = com.alibaba.fastjson.JSONArray.parseArray(valStr,String.class);
|
||||
if (valueArr != null && !valueArr.isEmpty()) {
|
||||
String newValue = "";
|
||||
for (String val : valueArr) {
|
||||
newValue += val + ",";
|
||||
}
|
||||
newValue = newValue.substring(0,newValue.length()-1);
|
||||
value = newValue;
|
||||
}else {
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
attInfoMap.put(field,value);
|
||||
} else {
|
||||
createStandBaseField(sarBussionessStand,entry.getKey(),value);
|
||||
}
|
||||
}
|
||||
//处理文件
|
||||
//此处需要处理之前的文件信息,防止文件丢失
|
||||
// attInfoMap = saveFileMsg(attInfoMap,sarStandardsInfoEO.getFileIds(),sarStandardsInfoEO.getTextStatus());
|
||||
String resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
|
||||
sarBussionessStand.setSarStandAttrEOStr(resData);
|
||||
// 根据标准号判断数据是否已存在
|
||||
//2021年4月9日 此处检查当前是否存在standId
|
||||
QueryWrapper<SarBussionessStand>queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(sarBussionessStand.getStandCode() != null,"STAND_CODE",sarBussionessStand.getStandCode())
|
||||
.eq(sarBussionessStand.getStandName() != null,"STAND_NAME",sarBussionessStand.getStandName());
|
||||
Integer count = iSarBussionessStandService.count(queryWrapper);
|
||||
if (count > 0){
|
||||
throw new AdcDaBaseException("当前企标标准号和企标名称已存在");
|
||||
}
|
||||
String standCode = "";
|
||||
if(StringUtils.isNotBlank(sarBussionessStand.getStandCode()) && !"null".equals(sarBussionessStand.getStandCode())){
|
||||
standCode = sarBussionessStand.getStandCode();
|
||||
}
|
||||
List<SarBussionessStand> lawsList = iSarBussionessStandService.selectStandardsByStandNumber(standCode);
|
||||
// if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "INLAND".equals(sarStandardsInfoEO.getStandType())) {
|
||||
// sarStandardsInfoEO.setMenuId("64df1d5522bb49c09af2");
|
||||
// sarStandardsInfoEO.setCountry("CN");
|
||||
// } else if (StringUtils.isBlank(sarStandardsInfoEO.getMenuId()) && "FOREIGN".equals(sarStandardsInfoEO.getStandType())) {
|
||||
// sarStandardsInfoEO.setMenuId("22179d54d4e640098e29");
|
||||
// }
|
||||
//此处判断是否是带入的标准
|
||||
if(StringUtils.isNotBlank(sarBussionessStand.getId())) {
|
||||
bussId = sarBussionessStand.getId();
|
||||
SarBussionessStand query = new SarBussionessStand();
|
||||
query.setId(sarBussionessStand.getId());
|
||||
iSarBussionessStandService.attrInfoDetails(query);
|
||||
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
|
||||
if(attInfoMap!=null && !attInfoMap.isEmpty()){
|
||||
// updateStandFileFieldData(attInfoMap,attrInfoMap);
|
||||
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
|
||||
sarBussionessStand.setSarStandAttrEOStr(resData);
|
||||
}
|
||||
// 查询原相关流程
|
||||
String relatePro = sarBussStandAttrInfoService.selectFieldValByStandId("XGLC",sarBussionessStand.getId());
|
||||
if (StringUtils.isNotBlank(relatePro)) {
|
||||
String[] processSplit = relatePro.split(",");
|
||||
Set<String> processSet = new HashSet<>();
|
||||
for(String sData:processSplit){
|
||||
processSet.add(sData);
|
||||
}
|
||||
processSet.add(prcNum);
|
||||
relatePro = StringUtils.join(processSet.toArray(), ",");
|
||||
} else {
|
||||
relatePro = prcNum;
|
||||
}
|
||||
// 编辑标准
|
||||
iSarBussionessStandService.updateSarBussionessStand(sarBussionessStand);
|
||||
// 编辑相关流程
|
||||
sarBussStandAttrInfoService.updateStandInfo(sarBussionessStand.getId(),"XGLC",relatePro);
|
||||
String content = "新增一条相关流程:" +prcName+" "+prcNum;
|
||||
sarUpdLogEOService.createBaseProcessLog(sarBussionessStand.getId(),"BUSINESS",content,prcCreateUser);
|
||||
}else if (lawsList != null && !lawsList.isEmpty()) {//Id不存在,但是标准号存在的情况
|
||||
String standId = lawsList.get(0).getId();
|
||||
bussId = lawsList.get(0).getId();
|
||||
SarBussionessStand query = new SarBussionessStand();
|
||||
query.setId(standId);
|
||||
iSarBussionessStandService.attrInfoDetails(query);
|
||||
Map<String, Object> attrInfoMap = query.getAttrInfoMap();
|
||||
if(attInfoMap!=null && !attInfoMap.isEmpty()){
|
||||
// updateStandFileFieldData(attInfoMap,attrInfoMap);
|
||||
resData = JSON.toJSONString(attInfoMap, SerializerFeature.WriteMapNullValue);
|
||||
sarBussionessStand.setSarStandAttrEOStr(resData);
|
||||
}
|
||||
// 查询原相关流程
|
||||
String relatePro = sarBussStandAttrInfoService.selectFieldValByStandId("XGLC",standId);
|
||||
if (StringUtils.isNotBlank(relatePro)) {
|
||||
String[] processSplit = relatePro.split(",");
|
||||
Set<String> processSet = new HashSet<>();
|
||||
for(String sData:processSplit){
|
||||
processSet.add(sData);
|
||||
}
|
||||
processSet.add(prcNum);
|
||||
relatePro = StringUtils.join(processSet.toArray(), ",");
|
||||
} else {
|
||||
relatePro = prcNum;
|
||||
}
|
||||
// 编辑标准
|
||||
sarBussionessStand.setId(standId);
|
||||
iSarBussionessStandService.updateSarBussionessStand(sarBussionessStand);
|
||||
// 编辑相关流程
|
||||
sarBussStandAttrInfoService.updateStandInfo(standId,"XGLC",relatePro);
|
||||
String content = "新增一条相关流程:" +prcName+" "+prcNum;
|
||||
sarUpdLogEOService.createBaseProcessLog(standId,"BUSINESS",content,prcCreateUser);
|
||||
} else {//标准号、ID都不存在的情况
|
||||
// 新增方法
|
||||
sarBussionessStand.setPrcCreateUser(prcCreateUser);
|
||||
ResponseMessage<SarBussionessStand> responseMessage = iSarBussionessStandService.createSarBussionessStand(sarBussionessStand);
|
||||
if(responseMessage.isOk()){
|
||||
SarBussionessStand bussionessStand = responseMessage.getData();
|
||||
bussId = bussionessStand.getId() == null ? "":bussionessStand.getId();
|
||||
}
|
||||
|
||||
// 编辑相关流程
|
||||
sarBussStandAttrInfoService.updateStandInfo(sarBussionessStand.getId(),"XGLC",prcNum);
|
||||
}
|
||||
List<SarStandItems> allItems = new ArrayList<>();
|
||||
//开始处理条款数据,从去重后的结果中直接处理即可
|
||||
// if(itemData!=null && !itemData.isEmpty()){
|
||||
// // allItems =
|
||||
// saveStandItemsData(itemData, sarStandardsInfoEO);
|
||||
// }
|
||||
//技术评估结果入库 重构技术评估结果入库内容
|
||||
// if ("0".equals(isJudge)) {
|
||||
// saveCompStatusInfo(sarStandardsInfoEO,breakVal,allItems,prcNum);
|
||||
// }
|
||||
|
||||
// List<BusProcessEvaluationHis> evaluationHisFilter = workFlowFeignClient.evaluationHisList(pid);
|
||||
List<BusProcessEvaluationHis> evaluationHis = new ArrayList<>();
|
||||
Map<String, List<BusProcessEvaluationHis>> listMap = new TreeMap<>();
|
||||
|
||||
// 按 相同数据分组
|
||||
// listMap = evaluationHisFilter.stream().collect(
|
||||
// Collectors.groupingBy(a -> Utils.format("{0}#{1}#{2}", a.getPId(),a.getTaskInfo(),a.getUserId())));
|
||||
|
||||
List<QualityEvaluation> evaluations = new ArrayList<>();
|
||||
if(!listMap.isEmpty()){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
listMap.forEach((key, value) -> {
|
||||
if(!value.isEmpty()){
|
||||
evaluationHis.add(value.get(0));
|
||||
}
|
||||
});
|
||||
String finalBussId = bussId;
|
||||
Date date = new Date();
|
||||
evaluationHis.forEach(busProcessEvaluationHis -> {
|
||||
List<com.alibaba.fastjson.JSONObject> valueArr = com.alibaba.fastjson.JSONArray.parseArray(busProcessEvaluationHis.getMesg(), com.alibaba.fastjson.JSONObject.class);
|
||||
if(!valueArr.isEmpty()){
|
||||
valueArr.forEach(object -> {
|
||||
QualityEvaluation evaluation = new QualityEvaluation();
|
||||
evaluation.setId(UUIDUtils.randomUUID20());
|
||||
evaluation.setLawId(finalBussId);
|
||||
evaluation.setUserId(object.getString("userId"));
|
||||
evaluation.setScore(object.getString("score"));
|
||||
evaluation.setReason(object.getString("reason"));
|
||||
evaluation.setEvaluationIndex(object.getString("code"));
|
||||
evaluation.setProcessNode(object.getString("processNode"));
|
||||
evaluation.setEvaluationType(object.getString("indexType"));
|
||||
evaluation.setCreateTime(date);
|
||||
evaluation.setModifyTime(date);
|
||||
evaluations.add(evaluation);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
qualityEvaluationService.saveBatch(evaluations);
|
||||
}
|
||||
}
|
||||
return bussId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理标准基础库字段
|
||||
* @param sarBussionessStand
|
||||
* @param field
|
||||
* @param value
|
||||
* @throws Exception
|
||||
*/
|
||||
public void createStandBaseField (SarBussionessStand sarBussionessStand,String field,Object value) throws Exception{
|
||||
String valueStr = "";
|
||||
if (value != null) {
|
||||
valueStr = String.valueOf(value);
|
||||
}
|
||||
switch (field) {
|
||||
case "id": sarBussionessStand.setId(valueStr); break;
|
||||
case "standSort": sarBussionessStand.setStandSort(valueStr); break;
|
||||
case "standNumber": sarBussionessStand.setStandNumber(valueStr); break;
|
||||
case "standYear": sarBussionessStand.setStandYear(valueStr); break;
|
||||
case "standCode": sarBussionessStand.setStandCode(valueStr); break;
|
||||
case "standName": sarBussionessStand.setStandName(valueStr); break;
|
||||
case "standEnName": sarBussionessStand.setStandEnName(valueStr); break;
|
||||
case "textStatusBuss": sarBussionessStand.setTextStatusBuss(valueStr); break;
|
||||
case "reviseStatus": sarBussionessStand.setReviseStatus(valueStr); break;
|
||||
case "standSn": sarBussionessStand.setStandSn(valueStr); break;
|
||||
case "issueTime":
|
||||
if (StringUtils.isNotBlank(valueStr)) {
|
||||
sarBussionessStand.setIssueTime(tTo(valueStr));
|
||||
}
|
||||
break;
|
||||
case "putTime":
|
||||
if (StringUtils.isNotBlank(valueStr)) {
|
||||
sarBussionessStand.setPutTime(tTo(valueStr));
|
||||
}
|
||||
break;
|
||||
case "prcNum": sarBussionessStand.setProcessNum(valueStr); break;
|
||||
case "menuId": sarBussionessStand.setMenuId(valueStr); break;
|
||||
case "fileWord":
|
||||
if (StringUtils.isNotBlank(sarBussionessStand.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
|
||||
valueStr = sarBussionessStand.getFileIds() + "," + valueStr;
|
||||
}
|
||||
sarBussionessStand.setFileIds(valueStr); break;
|
||||
case "filePdf":
|
||||
if (StringUtils.isNotBlank(sarBussionessStand.getFileIds()) && StringUtils.isNotBlank(valueStr)) {
|
||||
valueStr = sarBussionessStand.getFileIds() + "," + valueStr;
|
||||
}
|
||||
sarBussionessStand.setFileIds(valueStr);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
private String tTo(String dateStr){
|
||||
return dateStr.contains("T") ? dateStr.split("T")[0] : dateStr;
|
||||
}
|
||||
|
||||
public void attrInfoShowImport(List<SarBussStandAttrInfoExecl> sarlist) throws Exception {
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_type_code", "dic_type_name");
|
||||
Map<String, String> dicMap = dicInfo.stream()
|
||||
.filter(item-> !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getDicTypeName,(value1, value2 )->value2));
|
||||
|
||||
for(SarBussStandAttrInfoExecl row : sarlist){
|
||||
attrInfoDetailsImport(row);
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoMap();
|
||||
Map<String, Object> getNewMap = new LinkedHashMap<>();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
String svppsTip = "";
|
||||
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String value = "";
|
||||
if ("SVPPS".equals(name)) {
|
||||
Object svpps = entry.getValue();
|
||||
if (svpps != null && StringUtils.isNotBlank(svpps.toString())) {
|
||||
svppsTip = svpps.toString();
|
||||
}
|
||||
if (StringUtils.isNotBlank(svppsTip)) {
|
||||
svppsTip = sysInfoEOService.getSvppsNamesTipByIds(svppsTip);
|
||||
}
|
||||
value = String.valueOf(getAttrMap.get("SVPPSName"));
|
||||
entry.setValue(value);
|
||||
} else if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && InitStandAttrUtil.fileFieldListBuss.size() > 0 && InitStandAttrUtil.fileFieldListBuss.contains(name)) {
|
||||
// value = entry.getValue().toString();
|
||||
// if (StringUtils.isNotBlank(value)) {
|
||||
// List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
|
||||
// entry.setValue(fileObj);
|
||||
// }
|
||||
} else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
value = entry.getValue().toString();
|
||||
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
|
||||
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal) || SelectionTypeEnum.USERLIST.getValue().equals(selVal) || SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
|
||||
if("ZYQCR".equals(name)||"QTQCR".equals(name)){
|
||||
|
||||
if(getAttrMap.get(name + "Name")!=null && !getAttrMap.get(name + "Name").equals("")){
|
||||
value = String.valueOf(getAttrMap.get(name + "Name"));
|
||||
}
|
||||
}else{
|
||||
value = String.valueOf(getAttrMap.get(name + "Name"));
|
||||
}
|
||||
} else {
|
||||
List<String> valArr = Arrays.asList(value.split(","));
|
||||
if(entry.getValue()!=null) {
|
||||
StringBuilder builder = new StringBuilder("");
|
||||
for (String s : valArr) {
|
||||
if (dicMap.containsKey(s) && !"ZRBM".equals(name)){
|
||||
builder.append(dicMap.get(s)+",");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (builder.toString().isEmpty()){
|
||||
value = entry.getValue().toString();
|
||||
}else {
|
||||
value = builder.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
getAttrMap.put("SVPPSTips",svppsTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attrInfoDetailsImport (SarBussStandAttrInfoExecl row) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
|
||||
// 查询属性表数据
|
||||
if (StringUtils.isNotBlank(fieldInfo)) {
|
||||
List<String> list = Arrays.asList(fieldInfo.split(",")).stream().map(s -> String.format(s.trim())).collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> getAttrMap = BeanUtils.describe(row);
|
||||
|
||||
if (InitStandAttrUtil.clobFieldListBuss != null && !InitStandAttrUtil.clobFieldListBuss.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldListBuss) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField,fieldValue);
|
||||
}
|
||||
}
|
||||
// 组织机构和人员
|
||||
Map<String,Object> newMap = new HashMap<>();
|
||||
if(getAttrMap != null){
|
||||
for (Map.Entry<String,Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
List<String> filterList = list.stream().filter(a -> name.equals(a)).collect(Collectors.toList());
|
||||
if(filterList.isEmpty()){
|
||||
newMap.remove(name);
|
||||
continue;
|
||||
}
|
||||
Object value1 = entry.getValue();
|
||||
if (value1 != null && value1.toString().equals("\"null\"")){
|
||||
entry.setValue("");
|
||||
}
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
String value = entry.getValue().toString();
|
||||
String selVal = InitStandAttrUtil.selectFieldMapBuss.get(name);
|
||||
if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal)) {
|
||||
value = sysInfoEOService.getOrgNamesByIds(value);
|
||||
newMap.put(name + "Name",value);
|
||||
} else if (SelectionTypeEnum.USERLIST.getValue().equals(selVal)) {
|
||||
value = sysInfoEOService.getUserNamesByIds(value);
|
||||
newMap.put(name + "Name",value);
|
||||
} else if (SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) {
|
||||
value = sysInfoEOService.getRoleNamesByIds(value);
|
||||
newMap.put(name + "Name",value);
|
||||
}
|
||||
}
|
||||
}
|
||||
getAttrMap.putAll(newMap);
|
||||
}
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user