Commit c364e077 authored by xixinzhao's avatar xixinzhao

fix(jyjc): 检验结果技术参数修改

parent 2fb30a20
...@@ -39,4 +39,12 @@ public class JyjcInspectionResultParam extends BaseEntity { ...@@ -39,4 +39,12 @@ public class JyjcInspectionResultParam extends BaseEntity {
@TableField("remark") @TableField("remark")
private String remark; private String remark;
/**
* 备注
*/
@TableField("param_type")
private String paramType;
} }
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
...@@ -115,7 +117,14 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -115,7 +117,14 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) { public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) {
Map<String, Object> map = tableModel.get(JYJC_SUBMIT_KEY); Map<String, Object> map = tableModel.get(JYJC_SUBMIT_KEY);
JyjcInspectionResultModel model = BeanUtil.mapToBean(map, JyjcInspectionResultModel.class, true); JyjcInspectionResultModel model = BeanUtil.mapToBean(map, JyjcInspectionResultModel.class, true);
String inspector = model.getInspector();
if (StringUtil.isNotEmpty(inspector)) {
List jsonArray = JSONArray.parseArray(inspector);
Object inspectors = jsonArray.stream().map(String::valueOf).collect(Collectors.joining(","));
model.setInspector(String.valueOf(inspectors));
}
// 更新结果主表 // 更新结果主表
updateWithModel(model); updateWithModel(model);
...@@ -123,15 +132,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -123,15 +132,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// 更新附件表 // 更新附件表
List<JyjcInspectionResultAttachment> attachmentList = new ArrayList<>(); List<JyjcInspectionResultAttachment> attachmentList = new ArrayList<>();
LambdaQueryWrapper<JyjcInspectionResultAttachment> fileWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JyjcInspectionResultAttachment> fileWrapper = new LambdaQueryWrapper<>();
Map<String, Object> fileMap = new HashMap<>(); fileWrapper.eq(JyjcInspectionResultAttachment::getResultSeq, model.getSequenceNbr());
map.forEach((k, v) -> {
if (k.contains(JYJC_SUBMIT_FILE_PREFIX) && !ObjectUtils.isEmpty(map.get(k))) {
fileWrapper.or(wrapper ->wrapper.eq(JyjcInspectionResultAttachment::getAttachmentType, k).eq(JyjcInspectionResultAttachment::getResultSeq, model.getSequenceNbr()));
fileMap.put(k, map.get(k));
}
});
List<JyjcInspectionResultAttachment> fileList = attachmentService.list(fileWrapper); List<JyjcInspectionResultAttachment> fileList = attachmentService.list(fileWrapper);
fileMap.forEach((k, v) -> {
map.forEach((k, v) -> {
if (k.contains(JYJC_SUBMIT_FILE_PREFIX)) {
JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment(); JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment();
attachment.setResultSeq(model.getSequenceNbr()); attachment.setResultSeq(model.getSequenceNbr());
attachment.setAttachmentUrl(JSON.toJSONString(map.get(k))); attachment.setAttachmentUrl(JSON.toJSONString(map.get(k)));
...@@ -145,24 +150,31 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -145,24 +150,31 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
} }
} }
attachmentList.add(attachment); attachmentList.add(attachment);
}
}); });
if (!CollectionUtils.isEmpty(attachmentList)) { if (!CollectionUtils.isEmpty(attachmentList)) {
attachmentService.saveOrUpdateBatch(attachmentList); attachmentService.saveOrUpdateBatch(attachmentList);
} }
// 更新参数表 // 更新参数表
if (!CollectionUtils.isEmpty(model.getResultParamModelMap())){
LambdaQueryWrapper<JyjcInspectionResultParam> paramWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JyjcInspectionResultParam> paramWrapper = new LambdaQueryWrapper<>();
paramWrapper.eq(JyjcInspectionResultParam::getResultSeq, model.getSequenceNbr()); paramWrapper.eq(JyjcInspectionResultParam::getResultSeq, model.getSequenceNbr());
List<JyjcInspectionResultParam> params = resultParamService.list(paramWrapper); List<JyjcInspectionResultParam> params = resultParamService.list(paramWrapper);
List<JyjcInspectionResultParam> paramList = new ArrayList<>();
tableModel.forEach((k, v) -> {
if (!JYJC_SUBMIT_KEY.equals(k) && !ObjectUtils.isEmpty(tableModel.get(k))) {
List<JyjcInspectionResultParam> collect = params.stream().filter(p -> k.equals(p.getParamType())).collect(Collectors.toList());
JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam(); JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam();
if (!CollectionUtils.isEmpty(collect)) {
resultParam.setSequenceNbr(collect.get(0).getSequenceNbr());
}
resultParam.setResultSeq(model.getSequenceNbr()); resultParam.setResultSeq(model.getSequenceNbr());
resultParam.setParamJson(JSON.toJSONString(model.getResultParamModelMap())); resultParam.setParamJson(JSON.toJSONString(tableModel.get(k)));
if (!CollectionUtils.isEmpty(params)) { paramList.add(resultParam);
JyjcInspectionResultParam jyjcInspectionResultParam = params.get(0);
resultParam.setSequenceNbr(jyjcInspectionResultParam.getSequenceNbr());
} }
resultParamService.saveOrUpdate(resultParam); });
if (!CollectionUtils.isEmpty(paramList)){
resultParamService.saveOrUpdateBatch(paramList);
} }
//插入操作历史记录 //插入操作历史记录
...@@ -211,6 +223,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -211,6 +223,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
@Override @Override
public Map<String, Object> queryDetailBySeq(Long sequenceNbr) { public Map<String, Object> queryDetailBySeq(Long sequenceNbr) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String, Object> resultMap = new HashMap<>(9);
JyjcInspectionResultModel jyjcInspectionResultModel = this.queryBySeq(sequenceNbr); JyjcInspectionResultModel jyjcInspectionResultModel = this.queryBySeq(sequenceNbr);
if (!ObjectUtils.isEmpty(jyjcInspectionResultModel)) { if (!ObjectUtils.isEmpty(jyjcInspectionResultModel)) {
...@@ -231,17 +244,18 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -231,17 +244,18 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// 获取技术参数 // 获取技术参数
List<JyjcInspectionResultParam> paramList = iJyjcInspectionResultParamService.getParamByResultSeq(sequenceNbr); List<JyjcInspectionResultParam> paramList = iJyjcInspectionResultParamService.getParamByResultSeq(sequenceNbr);
Map<String, Object> mapParam = new HashMap<>();
if (!CollectionUtils.isEmpty(paramList)) { if (!CollectionUtils.isEmpty(paramList)) {
Map<String, Object> finalMap = map;
paramList.forEach(param -> { paramList.forEach(param -> {
if (!ObjectUtils.isEmpty(param.getParamJson())) { if (!ObjectUtils.isEmpty(param.getParamJson())) {
mapParam.putAll(JSON.parseObject(param.getParamJson())); JSONObject paramObj = JSON.parseObject(String.valueOf(param.getParamJson()));
paramObj.put("equList", finalMap.get("equList"));
paramObj.put("equCategory", finalMap.get("equCategory"));
resultMap.put(param.getParamType(), paramObj);
} }
}); });
map.put("paramJson", mapParam);
} }
} }
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(JYJC_SUBMIT_KEY, map); resultMap.put(JYJC_SUBMIT_KEY, map);
return resultMap; return resultMap;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment