企标导入功能优化
This commit is contained in:
+2
-2
@@ -416,9 +416,9 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
||||
|
||||
@ApiOperation(value = "导入功能")
|
||||
@PostMapping("/importSarBussionessStandFile")
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(@RequestParam(value = "file",required = false)MultipartFile file) throws Exception{
|
||||
public ResponseMessage<String> importSarBussionessStandFile(@RequestParam(value = "file",required = false)MultipartFile file) throws Exception{
|
||||
|
||||
return sarBussionessStandEOService.importSarBussionessStandFile(file);
|
||||
return sarBussionessStandEOService.importSarBussionessStandFile(file);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|SarBussionessStand|判断原文译文")
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public interface ISarBussionessStandService extends IService<SarBussionessStand>
|
||||
|
||||
ResponseMessage emptyFileAnewStorage(String type);
|
||||
|
||||
ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file)throws Exception;
|
||||
ResponseMessage<String> importSarBussionessStandFile(MultipartFile file)throws Exception;
|
||||
|
||||
ResponseMessage repetitionFile();
|
||||
}
|
||||
|
||||
+7
-51
@@ -2017,7 +2017,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public ResponseMessage<SarBussionessStand> importSarBussionessStandFile(MultipartFile file)throws Exception {
|
||||
public ResponseMessage<String> importSarBussionessStandFile(MultipartFile file)throws Exception {
|
||||
//给出头部信息
|
||||
String[] headerExcel = {"企标编号,中文名称,英文名称,文本状态,发布日期,企标实施日期,企标制修订状态,起草部门,废止日期,代替企标编号,复审日期,起草人,被代替企标编号,采用标准,文件上传人员,采标程度,引用标准,适用车型,能源类型,适用产品线,上传时间,体系类别,备案日期,关联模块-乘用车VPPS编码,关联模块--乘用车vpps中文名称,关联模块--卡车VPPS编码,关联模块--卡车vpps中文名称,附件,企标类型,标准年份,"};
|
||||
|
||||
@@ -2072,7 +2072,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
//获取总条数
|
||||
int rowNum = sheet.getLastRowNum();
|
||||
//循环遍历
|
||||
for (int i = 0;i < rowNum;i++){
|
||||
for (int i = 0;i <= rowNum;i++){
|
||||
Row row = sheet.getRow(i);
|
||||
Row headerRow = sheet.getRow(0);
|
||||
boolean isBlank = sarLawsInfoEOService.isRowEmpty(row);
|
||||
@@ -2269,9 +2269,6 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
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++) {
|
||||
@@ -2296,7 +2293,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
}
|
||||
}catch (Exception e){
|
||||
FileUnZip.deleteDir(saveDirectory);
|
||||
return Result.error("导入失败");
|
||||
return Result.error("导入失败,请查看需要导入的企标标准号和企标名称是否已存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2368,7 +2365,8 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
.eq(sarBussionessStand.getStandName() != null,"STAND_NAME",sarBussionessStand.getStandName());
|
||||
Integer count = iSarBussionessStandService.count(queryWrapper);
|
||||
if (count > 0){
|
||||
throw new AdcDaBaseException("当前企标标准号和企标名称已存在");
|
||||
//return Result.error("当前企标标准号和企标名称已存在");
|
||||
throw new AdcDaBaseException("企标标准号"+ sarBussionessStand.getStandCode() +"或企标名称"+ sarBussionessStand.getStandName() +"已存在");
|
||||
}
|
||||
|
||||
String standCode = "";
|
||||
@@ -2412,52 +2410,10 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
} else {//标准号、ID都不存在的情况
|
||||
// 新增方法
|
||||
sarBussionessStand.setStandCode(standCode);
|
||||
// sarBussionessStand.setStandNumber("");
|
||||
// sarBussionessStand.setStandSn("");
|
||||
// sarBussionessStand.setReviseStatus("");
|
||||
ResponseMessage<SarBussionessStand> responseMessage = iSarBussionessStandService.createSarBussionessStand(sarBussionessStand);
|
||||
if(responseMessage.isOk()){
|
||||
SarBussionessStand bussionessStand = responseMessage.getData();
|
||||
bussId = bussionessStand.getId() == null ? "":bussionessStand.getId();
|
||||
}
|
||||
}
|
||||
List<BusProcessEvaluationHis> evaluationHis = new ArrayList<>();
|
||||
Map<String, List<BusProcessEvaluationHis>> listMap = new TreeMap<>();
|
||||
|
||||
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);
|
||||
iSarBussionessStandService.createSarBussionessStand(sarBussionessStand);
|
||||
}
|
||||
}
|
||||
return bussId;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user