Commit f86a4fca authored by 王果's avatar 王果

检验检测结果上传结果到安全追溯表

parent 06293619
package com.yeejoin.amos.boot.module.jyjc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.module.ymt.api.entity.AbstractEquipBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 安全追溯-检验检测信息表
*
* @author cpp
* @date 2023-04-20 16:36:14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("idx_biz_jg_inspection_detection_info")
public class InspectionDetectionInfo extends AbstractEquipBaseEntity {
private static final long serialVersionUID = 1L;
@TableField(value = "INSTANCE_ID")
private String instanceId;
@TableField(value = "STATUS")
private String status;
@TableField(value = "INSPECT_TYPE")
private String inspectType;
/**
* 检验机构名称
*/
@TableField(value = "INSPECT_ORG_NAME")
private String inspectOrgName;
/**
* 检验报告
*/
@TableField(value = "INSPECT_REPORT")
private String inspectReport;
/**
* 检验人员
*/
@TableField(value = "INSPECT_STAFF")
private String inspectStaff;
/**
* 检验日期
*/
@TableField(value = "INSPECT_DATE")
private Date inspectDate;
/**
* 检验结论
*/
@TableField(value = "INSPECT_CONCLUSION")
private String inspectConclusion;
/**
* 安全状况等级
*/
@TableField(value = "SAFETY_LEVEL")
private String safetyLevel;
/**
* 检验问题备注
*/
@TableField(value = "PROBLEM_REMARK")
private String problemRemark;
/**
* 下次检验日期
*/
@TableField(value = "NEXT_INSPECT_DATE")
private Date nextInspectDate;
/**
* 设备唯一标识
*/
@TableField(value = "SEQUENCE_CODE")
private String sequenceCode;
/**
* 检验机构统一信用代码
*/
@TableField(value = "INSPECT_ORG_CODE")
private String inspectOrgCode;
/**
* 检验报告编号
*/
@TableField(value = "INSPECT_REPORT_NO")
private String inspectReportNo;
}
package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jyjc.api.entity.InspectionDetectionInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* 安全追溯-检验检测信息表
*
* @author cpp
* @date 2023-04-06 19:18:21
*/
@Mapper
public interface InspectionDetectionInfoMapper extends BaseMapper<InspectionDetectionInfo> {
InspectionDetectionInfo selectInspection(String superviseCode);
}
package com.yeejoin.amos.boot.module.jyjc.api.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 安全追溯-检验检测信息表
*
* @author cpp
* @date 2023-04-20 16:36:14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="InspectionDetectionInfo", description="检验检测信息")
public class InspectionDetectionInfoModel extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private String instanceId;
@ApiModelProperty(value = "")
private String status;
@ApiModelProperty(value = "检验类型")
private String inspectType;
@ApiModelProperty(value = "检验机构名称")
private String inspectOrgName;
@ApiModelProperty(value = "检验报告附件")
private String inspectReport;
@ApiModelProperty(value = "检验人员")
private String inspectStaff;
@ApiModelProperty(value = "检验日期")
private Date inspectDate;
@ApiModelProperty(value = "检验结论")
private String inspectConclusion;
@ApiModelProperty(value = "安全状况等级")
private String safetyLevel;
@ApiModelProperty(value = "检验问题备注")
private String problemRemark;
@ApiModelProperty(value = "下次检验日期")
private Date nextInspectDate;
@ApiModelProperty(value = "设备唯一标识")
private String sequenceCode;
private String superviseCode;
}
package com.yeejoin.amos.boot.module.jyjc.api.service;
/**
* 安全追溯-检验检测信息表
*
* @author cpp
* @date 2023-04-06 19:18:21
*/
public interface InspectionDetectionInfoService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jyjc.api.mapper.InspectionDetectionInfoMapper">
<select id="selectInspection" resultType="com.yeejoin.amos.boot.module.jyjc.api.entity.InspectionDetectionInfo">
SELECT *
FROM idx_biz_jg_inspection_detection_info
WHERE "RECORD" = (SELECT "RECORD" FROM "idx_biz_jg_other_info" WHERE "SUPERVISORY_CODE" = #{superviseCode})
ORDER BY "INSPECT_DATE" DESC
LIMIT 1
</select>
</mapper>
\ No newline at end of file
package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import com.yeejoin.amos.boot.module.jyjc.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.InspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.jyjc.api.model.InspectionDetectionInfoModel;
import com.yeejoin.amos.boot.module.jyjc.api.service.InspectionDetectionInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
/**
* 安全追溯-检验检测信息表
*
* @author cpp
* @date 2023-04-06 19:18:21
*/
@Service
public class InspectionDetectionInfoServiceImpl extends BaseService<InspectionDetectionInfoModel, InspectionDetectionInfo, InspectionDetectionInfoMapper> implements InspectionDetectionInfoService {
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfo;
public InspectionDetectionInfoModel selectInspect(String superviseCode) {
InspectionDetectionInfoModel inspectionDetectionInfoDto = new InspectionDetectionInfoModel();
if (ValidationUtil.isEmpty(superviseCode)) {
return inspectionDetectionInfoDto;
}
InspectionDetectionInfo inspectionDetectionInfo = this.inspectionDetectionInfo.selectInspection(superviseCode);
BeanUtils.copyProperties(inspectionDetectionInfo, inspectionDetectionInfoDto);
inspectionDetectionInfoDto.setSuperviseCode(superviseCode);
return inspectionDetectionInfoDto;
}
}
\ No newline at end of file
......@@ -2,10 +2,12 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.RedisUtils;
import com.yeejoin.amos.boot.module.jyjc.api.entity.InspectionDetectionInfo;
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.JyjcInspectionResultParam;
......@@ -16,12 +18,15 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttach
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultService;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.CategoryOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -62,6 +67,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
@Autowired
private RedisUtils redisUtils;
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired
InspectionDetectionInfoServiceImpl inspectionDetectionInfoService;
/**
* 检验检测单位分页查询
*/
......@@ -89,6 +99,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
@Transactional
public JyjcInspectionResultModel updateJyjcInspectionResult(JyjcInspectionResultModel model) {
updateWithModel(model);
if (!CollectionUtils.isEmpty(model.getResultAttachmentModelList())){
......@@ -104,9 +115,39 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
resultParam.setParamJson(JSON.toJSONString(model.getResultParamModelMap()));
resultParamService.save(resultParam);
}
InspectionDetectionInfo info = new InspectionDetectionInfo();
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo,model.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoService.list(wrapper);
if(CollectionUtils.isEmpty(list)){
QueryWrapper<CategoryOtherInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CategoryOtherInfo::getSupervisoryCode,model.getEquipUnicode());
List<CategoryOtherInfo> otherInfos = categoryOtherInfoMapper.selectList(queryWrapper);
if(!CollectionUtils.isEmpty(otherInfos)){
info.setRecord(otherInfos.get(0).getRecord());
}
}else{
info = list.get(0);
}
extracted(model, info);
inspectionDetectionInfoService.save(info);
return model;
}
private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info) {
info.setInspectType(model.getInspectionType());
info.setInspectOrgName(model.getInspectionUnitCode());
info.setInspectReport(JSON.toJSONString(model.getResultAttachmentModelList()));
info.setInspectDate(model.getInspectionDate());
info.setInspectConclusion(model.getInspectionConclusion());
info.setProblemRemark(model.getNonConformance());
info.setNextInspectDate(model.getNextInspectionDate());
info.setSequenceCode(model.getEquipUnicode());
info.setInspectOrgCode(model.getUseUnitCreditCode());
info.setInspectReportNo(model.getResultNo());
}
/**
* 列表查询 示例
*/
......
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