Commit 792c9b7d authored by xixinzhao's avatar xixinzhao

检验检测提交查看编辑修改

parent f8f3c3d4
...@@ -7,6 +7,9 @@ import lombok.Data; ...@@ -7,6 +7,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
/** /**
* *
* *
...@@ -45,4 +48,10 @@ public class JyjcInspectionResultAttachment extends BaseEntity { ...@@ -45,4 +48,10 @@ public class JyjcInspectionResultAttachment extends BaseEntity {
@TableField("remark") @TableField("remark")
private String remark; private String remark;
/**
* 附件地址
*/
@TableField(exist = false)
private List<Object> attachmentUrlList;
} }
...@@ -128,9 +128,6 @@ public class JyjcInspectionResultModel extends BaseModel { ...@@ -128,9 +128,6 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "检验结果技术参数") @ApiModelProperty(value = "检验结果技术参数")
private Map<String,Object> resultParamModelMap; private Map<String,Object> resultParamModelMap;
@ApiModelProperty(value = "检验结果附件")
private List<Map<String,Object>> resultAttachmentModelList;
@ApiModelProperty(value = "附件类型(特种设备检验报告:1,监检证书:2)") @ApiModelProperty(value = "附件类型(特种设备检验报告:1,监检证书:2)")
private String attachmentType; private String attachmentType;
} }
...@@ -144,10 +144,11 @@ public class JyjcInspectionResultController extends BaseController { ...@@ -144,10 +144,11 @@ public class JyjcInspectionResultController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateResult") @PutMapping(value = "/updateResult")
@ApiOperation(httpMethod = "PUT", value = "检验结果-上传结果和编辑结果", notes = "检验结果-上传结果和编辑结果") @ApiOperation(httpMethod = "PUT", value = "检验结果-上传结果和编辑结果", notes = "检验结果-上传结果和编辑结果")
public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody JyjcInspectionResultModel model) { public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody Map<String, Map<String, Object>> model) {
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.updateJyjcInspectionResult(model)); return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.updateJyjcInspectionResult(model));
} }
/** /**
* 获取设备种类列表 * 获取设备种类列表
* *
......
...@@ -2,10 +2,12 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl; ...@@ -2,10 +2,12 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
...@@ -18,6 +20,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultServic ...@@ -18,6 +20,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultServic
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -25,6 +28,7 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -89,15 +93,26 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -89,15 +93,26 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
} }
public JyjcInspectionResultModel updateJyjcInspectionResult(JyjcInspectionResultModel model) { public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) {
Map<String, Object> map = tableModel.get("inspectResult");
JyjcInspectionResultModel model = BeanUtil.mapToBean(map, JyjcInspectionResultModel.class, true);
updateWithModel(model); updateWithModel(model);
if (!CollectionUtils.isEmpty(model.getResultAttachmentModelList())){
JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment(); List<JyjcInspectionResultAttachment> attachmentList = new ArrayList<>();
attachment.setResultSeq(model.getSequenceNbr()); map.forEach((k, v) -> {
attachment.setAttachmentUrl(JSON.toJSONString(model.getResultAttachmentModelList())); if (k.contains("JYJC_") && !ObjectUtils.isEmpty(map.get(k))) {
attachment.setAttachmentType(model.getAttachmentType()); JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment();
attachmentService.save(attachment); attachment.setResultSeq(model.getSequenceNbr());
attachment.setAttachmentUrl(JSON.toJSONString(map.get(k)));
attachment.setAttachmentType(k);
attachmentList.add(attachment);
}
});
if (!CollectionUtils.isEmpty(attachmentList)) {
attachmentService.saveBatch(attachmentList);
} }
if (!CollectionUtils.isEmpty(model.getResultParamModelMap())){ if (!CollectionUtils.isEmpty(model.getResultParamModelMap())){
JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam(); JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam();
resultParam.setResultSeq(model.getSequenceNbr()); resultParam.setResultSeq(model.getSequenceNbr());
...@@ -126,7 +141,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -126,7 +141,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// 获取附件 // 获取附件
List<JyjcInspectionResultAttachment> attachmentList = iJyjcInspectionResultAttachmentService.getObjByResultSeq(sequenceNbr); List<JyjcInspectionResultAttachment> attachmentList = iJyjcInspectionResultAttachmentService.getObjByResultSeq(sequenceNbr);
if (!CollectionUtils.isEmpty(attachmentList)) { if (!CollectionUtils.isEmpty(attachmentList)) {
Map<String, Object> attachmentMap = attachmentList.stream().collect(Collectors.toMap(JyjcInspectionResultAttachment::getAttachmentType, JyjcInspectionResultAttachment::getAttachmentUrl)); Map<String, Object> attachmentMap = attachmentList.stream().map(obj -> {
if (StringUtil.isNotEmpty(obj.getAttachmentUrl())) {
obj.setAttachmentUrlList(JSONArray.parseArray(obj.getAttachmentUrl()));
}
return obj;
}).collect(Collectors.toMap(JyjcInspectionResultAttachment::getAttachmentType, JyjcInspectionResultAttachment::getAttachmentUrlList));
map.putAll(attachmentMap); map.putAll(attachmentMap);
} }
......
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