lvy 1 місяць тому
батько
коміт
23d75fac55

+ 5 - 47
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordBaseInfoDTO.java

@@ -29,18 +29,21 @@ import java.util.List;
 public class TrialSeleInspectionRecordBaseInfoDTO implements Serializable {
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty("委托单id")
+	private Long entrustId;
+
+	@ApiModelProperty("委托单编号")
+	private String entrustNo;
 	/**
 	 * 项目名称
 	 */
 	@ApiModelProperty("项目名称")
 	private String projectName;
-
 	/**
 	 * 施工单位
 	 */
 	@ApiModelProperty("施工单位")
 	private String constructionUnit;
-
 	/**
 	 * 监理单位
 	 */
@@ -56,51 +59,6 @@ public class TrialSeleInspectionRecordBaseInfoDTO implements Serializable {
 	@ApiModelProperty("工程部位/用途")
 	private String projectPosition;
 
-	@ApiModelProperty("委托单id")
-	private Long entrustId;
-
-	@ApiModelProperty("委托单编号")
-	private String entrustNo;
-
-	@ApiModelProperty("记录编号")
-	private String recordNo;
-
-	@ApiModelProperty("报告编号")
-	private String reportNo;
-
-	@ApiModelProperty(value = "记录表自增流水号")
-	private String recordAutoNumber;
-
-	@ApiModelProperty(value = "报告单自增流水号")
-	private String reportAutoNumber;
-
-	@ApiModelProperty("判断依据列表")
-	private List<StandardVo> standardVos;
-
-	@ApiModelProperty("判断依据:规范id")
-	private Long standardId;
-
-	@ApiModelProperty("规范信息ids")
-	private String standardInfoIds;
-
-
-	@ApiModelProperty("规范信息")
-	private List<StandardVo> standardInfos;
-
 	@ApiModelProperty("样品信息")
 	private TrialSampleInfo trialSampleInfo;
-
-	@ApiModelProperty("样品信息列表")
-	private List<TrialSampleInfo> trialSampleInfoList;
-
-	@ApiModelProperty("设备信息和使用信息")
-	private List<TrailDeviceUseInfoDTO> trailDeviceUseInfoDTOS;
-
-	@Data
-	public static class StandardVo {
-		@ApiModelProperty("id")
-		private Long id;
-		@ApiModelProperty("name")
-		private String name;
-	}
 }

+ 75 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSeleInspectionRecordInfoDTO.java

@@ -0,0 +1,75 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialSampleInfo;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class TrialSeleInspectionRecordInfoDTO extends TrialSeleInspectionRecordBaseInfoDTO {
+	private static final long serialVersionUID = 1L;
+
+	@ApiModelProperty("id")
+	private Long id;
+
+	@ApiModelProperty(value = "节点ID")
+	private Long nodeId;
+
+	@ApiModelProperty(value = "合同段id")
+	private Long contractId;
+
+	@ApiModelProperty("记录编号")
+	private String recordNo;
+
+	@ApiModelProperty("报告编号")
+	private String reportNo;
+
+	@ApiModelProperty(value = "记录表自增流水号")
+	private String recordAutoNumber;
+
+	@ApiModelProperty(value = "报告单自增流水号")
+	private String reportAutoNumber;
+
+	@ApiModelProperty("判断依据列表")
+	private List<StandardVo> standardVos;
+
+	@ApiModelProperty("判断依据:规范id")
+	private Long standardId;
+
+	@ApiModelProperty("规范信息ids")
+	private String standardInfoIds;
+
+	@ApiModelProperty("规范信息")
+	private List<StandardVo> standardInfos;
+
+
+	@ApiModelProperty("设备信息和使用信息")
+	private List<TrailDeviceUseInfoDTO> trailDeviceUseInfoDTOS;
+
+	@Data
+	public static class StandardVo {
+		@ApiModelProperty("id")
+		private Long id;
+		@ApiModelProperty("name")
+		private String name;
+	}
+}

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSelfInspectionRecord.java

@@ -86,4 +86,7 @@ public class TrialSelfInspectionRecord extends BaseEntity {
     @ApiModelProperty("规范信息")
     private String standardInfoIds;
 
+    @ApiModelProperty("基础信息")
+    private String baseInfo;
+
 }

+ 27 - 13
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -1,5 +1,6 @@
 package org.springblade.business.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -540,7 +541,7 @@ public class TrialDetectionController extends BladeController {
     @GetMapping("/self/getBaseInfo")
     @ApiOperationSupport(order = 30)
     @ApiOperation(value = "获取试验自检基础信息", notes = "传入节点pKeyId")
-    public R<TrialSeleInspectionRecordBaseInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
+    public R<TrialSeleInspectionRecordInfoDTO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @RequestParam Long nodeId, @RequestParam(required = false) Long id) {
         ProjectInfo projectInfo = jdbcTemplate.query("select * from m_project_info where id = " + projectId, new BeanPropertyRowMapper<>(ProjectInfo.class)).stream().findAny().orElse(null);
         if (projectInfo == null) {
             return R.fail("未获取到项目信息");
@@ -549,7 +550,7 @@ public class TrialDetectionController extends BladeController {
         if (contractInfo == null) {
             return R.fail("未获取到合同信息");
         }
-        TrialSeleInspectionRecordBaseInfoDTO vo = new TrialSeleInspectionRecordBaseInfoDTO();
+        TrialSeleInspectionRecordInfoDTO vo = new TrialSeleInspectionRecordInfoDTO();
         vo.setProjectName(projectInfo.getProjectName());
         vo.setConstructionUnit(contractInfo.getConstructionUnitName());
         if (contractInfo.getContractType().equals(2)) {
@@ -567,21 +568,27 @@ public class TrialDetectionController extends BladeController {
         if (id != null) {
             TrialSelfInspectionRecord record = jdbcTemplate.query("select * from u_trial_self_inspection_record where id = " + id, new BeanPropertyRowMapper<>(TrialSelfInspectionRecord.class)).stream().findAny().orElse(null);
             if (record != null) {
+                String baseInfo = record.getBaseInfo();
+                if (baseInfo != null) {
+                    TrialSeleInspectionRecordInfoDTO info = JSON.parseObject(baseInfo, TrialSeleInspectionRecordInfoDTO.class);
+                    BeanUtil.copyProperties(info, vo);
+                }
                 // 取样
                 Long entrustId = record.getEntrustId();
-                if (entrustId != null) {
+                if (vo.getEntrustNo() == null && entrustId != null) {
                     EntrustInfo entrustInfo = jdbcTemplate.query("select * from u_entrust_info where id = " + entrustId, new BeanPropertyRowMapper<>(EntrustInfo.class)).stream().findAny().orElse(null);
                     if (entrustInfo != null) {
                         vo.setEntrustNo(entrustInfo.getEntrustNo());
                         vo.setEntrustId(entrustInfo.getId());
                     }
                 }
-                List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
-                if (!selfSampleList.isEmpty()) {
-                    String samplingIds = selfSampleList.stream().map(TrialSelfSample::getSamplingId).map(String::valueOf).collect(Collectors.joining(","));
-                    List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
-                    vo.setTrialSampleInfoList(trialSampleInfoList);
-                    vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                if (vo.getTrialSampleInfo() == null) {
+                    List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
+                    if (!selfSampleList.isEmpty()) {
+                        String samplingIds = selfSampleList.stream().map(TrialSelfSample::getSamplingId).map(String::valueOf).collect(Collectors.joining(","));
+                        List<TrialSampleInfo> trialSampleInfoList = jdbcTemplate.query("select * from u_trial_sample_info where id in (" + samplingIds + ")", new BeanPropertyRowMapper<>(TrialSampleInfo.class));
+                        vo.setTrialSampleInfo(trialSampleInfoList.isEmpty() ? new TrialSampleInfo() : trialSampleInfoList.get(0));
+                    }
                 }
                 if (vo.getProjectPosition() == null) {
                     vo.setProjectPosition(record.getProjectPosition());
@@ -594,9 +601,9 @@ public class TrialDetectionController extends BladeController {
                         Set<Long> ids = standardInfoList.stream().map(StandardInfo::getParentId).collect(Collectors.toSet());
                         List<StandardInfo> parentStandardInfoList = jdbcTemplate.query("select * from u_standard_info where id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")", new BeanPropertyRowMapper<>(StandardInfo.class));
                         Map<Long, List<StandardInfo>> map = standardInfoList.stream().collect(Collectors.groupingBy(StandardInfo::getParentId));
-                        List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> standardVos = new ArrayList<>();
+                        List<TrialSeleInspectionRecordInfoDTO.StandardVo> standardVos = new ArrayList<>();
                         parentStandardInfoList.forEach(standardInfo -> {
-                            TrialSeleInspectionRecordBaseInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordBaseInfoDTO.StandardVo();
+                            TrialSeleInspectionRecordInfoDTO.StandardVo standardVo = new TrialSeleInspectionRecordInfoDTO.StandardVo();
                             List<StandardInfo> list = map.get(standardInfo.getId());
                             if (list != null && !list.isEmpty()) {
                                 standardVo.setId(list.get(0).getId());
@@ -642,13 +649,20 @@ public class TrialDetectionController extends BladeController {
             vo.setReportNo(map.get("trialNumber"));
             vo.setReportAutoNumber(map.get("trialAutoNumber"));
         }
-        List<TrialSeleInspectionRecordBaseInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
-                new BeanPropertyRowMapper<>(TrialSeleInspectionRecordBaseInfoDTO.StandardVo.class));
+        List<TrialSeleInspectionRecordInfoDTO.StandardVo> mapList = jdbcTemplate.query("SELECT id,name from u_wbs_private_standard WHERE type = 2 and is_deleted = 0 and status = 1 and private_id = " + nodeId,
+                new BeanPropertyRowMapper<>(TrialSeleInspectionRecordInfoDTO.StandardVo.class));
         vo.setStandardVos(mapList);
         return R.data(vo);
     }
 
 
+    @PostMapping("/self/saveBaseInfo")
+    @ApiOperationSupport(order = 30)
+    @ApiOperation(value = "保存试验自检基础信息")
+    public R<Boolean> saveBaseInfo(@RequestBody TrialSeleInspectionRecordInfoDTO vo) {
+        return R.status(iTrialSelfInspectionRecordService.saveBaseInfo(vo));
+    }
+
     /**
      * 获取最近一次使用的设备信息
      */

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java

@@ -45,4 +45,6 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
 
     R getSamplePdfUrl(String id,String contrctId);
+
+    Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO vo);
 }

+ 39 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1,9 +1,11 @@
 package org.springblade.business.service.impl;
 
 import cn.hutool.core.date.LocalDateTimeUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -2100,5 +2102,42 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         }
     }
 
+    @Override
+    public Boolean saveBaseInfo(TrialSeleInspectionRecordInfoDTO dto) {
+        TrialSelfInspectionRecord record = new TrialSelfInspectionRecord();
+        BeanUtil.copyProperties(dto, record);
+        TrialSeleInspectionRecordBaseInfoDTO baseInfo = new TrialSeleInspectionRecordBaseInfoDTO();
+        BeanUtil.copyProperties(dto, baseInfo);
+        record.setBaseInfo(JSON.toJSONString(baseInfo));
+        this.saveOrUpdate(record);
+        TrialSampleInfo trialSampleInfo = dto.getTrialSampleInfo();
+        if (trialSampleInfo != null) {
+            TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(trialSampleInfo.getId());
+            if (sampleInfo != null) {
+                //------关联取样信息------
+                RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
+                sampleSubmitDTO.setId(record.getId());
+                sampleSubmitDTO.setSampleIds(trialSampleInfo.getId() + "");
+                //删除关联
+                baseMapper.delSelfSample(record.getId());
+                baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), trialSampleInfo.getId() + "");
+                //更新
+                this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
+                        .set(sampleInfo.getSamplingLocation() != null && !sampleInfo.getSamplingLocation().isEmpty(),TrialSelfInspectionRecord::getSamplingLocation, sampleInfo.getSamplingLocation())
+                        .set(sampleInfo.getCalculationUnit() != null && !sampleInfo.getCalculationUnit().isEmpty(), TrialSelfInspectionRecord::getCompany, sampleInfo.getCalculationUnit())
+                        .set(trialSampleInfo.getSpecificationNumber() != null && !trialSampleInfo.getSpecificationNumber().isEmpty(), TrialSelfInspectionRecord::getSpecificationNumber, trialSampleInfo.getSpecificationNumber())
+                        .set(sampleInfo.getSpecificationModel() != null && !sampleInfo.getSpecificationModel().isEmpty(), TrialSelfInspectionRecord::getSpecificationModel, sampleInfo.getSpecificationModel())
+                        .eq(TrialSelfInspectionRecord::getId, sampleSubmitDTO.getId())
+                );
+            }
+        }
+        // ---- 修改样品单号信息 --------
+        if(Func.isNotEmpty(dto.getEntrustId())){
+            //修改项目节点基础信息
+            jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+dto.getEntrustId()+"'");
+        }
+        return true;
+    }
+
 
 }