lvy 1 hónapja
szülő
commit
8a08f03361

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialMaterialMobilization.java

@@ -11,6 +11,7 @@ import org.springblade.core.mp.base.BaseEntity;
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -27,6 +28,7 @@ public class TrialMaterialMobilization extends BaseEntity {
      * 合同段id
      */
     @ApiModelProperty(value = "合同段id")
+    @NotNull
     private Long contractId;
 
     /**
@@ -40,12 +42,14 @@ public class TrialMaterialMobilization extends BaseEntity {
      */
     @ApiModelProperty(value = "材料名称")
     @Length(max = 100, message = "材料名称最大长度100个字符")
+    @NotNull
     private String materialName;
 
     /**
      * 材料类型
      */
     @ApiModelProperty(value = "材料类型")
+    @NotNull
     private Integer materialType;
 
     /**
@@ -53,6 +57,7 @@ public class TrialMaterialMobilization extends BaseEntity {
      */
     @ApiModelProperty(value = "规格型号")
     @Length(max = 100, message = "规格型号最大长度100个字符")
+    @NotNull
     private String specificationModel;
 
     /**

+ 74 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSeleInspectionRecordBaseInfoVO.java

@@ -0,0 +1,74 @@
+/*
+ *      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.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.EntrustInfo;
+import org.springblade.business.entity.TrialSampleInfo;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+@Data
+public class TrialSeleInspectionRecordBaseInfoVO implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 项目名称
+	 */
+	@ApiModelProperty("项目名称")
+	private String projectName;
+
+	/**
+	 * 施工单位
+	 */
+	@ApiModelProperty("施工单位")
+	private String constructionUnit;
+
+	/**
+	 * 监理单位
+	 */
+	@ApiModelProperty("监理单位")
+	private String supervisionUnit;
+
+    @ApiModelProperty("实验室名称")
+    private String labName;
+
+	@ApiModelProperty("合同段/工区")
+	private String contractName;
+
+	@ApiModelProperty("工程部位/用途")
+	private String projectPosition;
+
+	@ApiModelProperty("委托单编号")
+	private String entrustNo;
+
+	@ApiModelProperty("记录编号")
+	private String recordNo;
+
+	@ApiModelProperty("报告编号")
+	private String reportNo;
+
+	@ApiModelProperty("判定依据")
+	private Integer basis;
+
+	@ApiModelProperty("样品信息")
+	private List<TrialSampleInfo> trialSampleInfoList;
+}

+ 55 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -14,6 +14,7 @@ import lombok.SneakyThrows;
 import org.springblade.business.dto.*;
 import org.springblade.business.entity.EntrustInfo;
 import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.service.ITrialSampleInfoService;
@@ -26,14 +27,19 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.entity.TrialSelfDataRecord;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.CheckRemoveBussTabInfoVo;
+import org.springblade.manager.vo.ContractInfoVO;
 import org.springblade.manager.vo.TableFileVO;
 import org.springblade.manager.vo.WbsTreePrivateVO;
+import org.springblade.meter.entity.MeterContractInfo;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -530,4 +536,53 @@ public class TrialDetectionController extends BladeController {
         jdbcTemplate.execute("delete from m_wbs_tree_private where p_key_id = " + pKeyId);
         return R.success("删除成功");
     }
+
+    /**
+     * 获取试验自检基础信息
+     */
+    @GetMapping("/self/getBaseInfo")
+    @ApiOperationSupport(order = 30)
+    @ApiOperation(value = "获取试验自检基础信息", notes = "传入节点pKeyId")
+    public R<TrialSeleInspectionRecordBaseInfoVO> getBaseInfo(@RequestParam Long projectId, @RequestParam Long contractId, @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("未获取到项目信息");
+        }
+        ContractInfo contractInfo = jdbcTemplate.query("select * from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
+        if (contractInfo == null) {
+            return R.fail("未获取到合同信息");
+        }
+        TrialSeleInspectionRecordBaseInfoVO vo = new TrialSeleInspectionRecordBaseInfoVO();
+        vo.setProjectName(projectInfo.getProjectName());
+        vo.setConstructionUnit(contractInfo.getConstructionUnitName());
+        if (contractInfo.getContractType().equals(2)) {
+            // todo 获取该监理下的所有施工单位
+        } else if (contractInfo.getContractType().equals(3)) {
+            // todo 获取该业主下的所有监理单位
+        }
+        vo.setSupervisionUnit(contractInfo.getSupervisionUnitName());
+        vo.setLabName(contractInfo.getLaboratoryName());
+        vo.setContractName(contractInfo.getContractNumber());
+        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) {
+                // 取样
+                Long entrustId = record.getEntrustId();
+                if (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());
+                    }
+                }
+                List<TrialSelfSample> selfSampleList = jdbcTemplate.query("select * from u_trial_self_sample where self_id = " + id, new BeanPropertyRowMapper<>(TrialSelfSample.class));
+                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);
+                if (vo.getProjectPosition() == null) {
+                    vo.setProjectPosition(record.getProjectPosition());
+                }
+            }
+        }
+        return R.data(vo);
+    }
 }

+ 4 - 4
blade-service/blade-business/src/main/java/org/springblade/business/mapper/EntrustInfoMapper.xml

@@ -69,7 +69,7 @@
             and a.status = #{param2.status}
         </if>
         <if test="param2.entrustName != null and param2.entrustName != ''">
-            AND ( a.entrust_name like CONCAT(CONCAT('%', #{param2.entrustName}), '%') or a.entrust_no like CONCAT(CONCAT('%', #{param2.entrustName}), '%') )
+            AND ( a.entrust_name like CONCAT(CONCAT('%', #{param2.entrustName}), '%') or a.entrust_no like CONCAT(CONCAT('%', #{param2.entrustName}), '%') or b.material_name like CONCAT(CONCAT('%', #{param2.entrustName}), '%'))
         </if>
     </select>
 
@@ -105,7 +105,7 @@
         where  a.sample_id=b.id and a.is_deleted = 0 and b.is_deleted=0
           and a.sample_status=#{param2.status}
         <if test="param2.materialName != null and param2.materialName != ''">
-            AND b.material_name like CONCAT(CONCAT('%', #{param2.materialName}), '%')
+            AND (b.material_name like CONCAT('%', #{param2.materialName}, '%') or b.specification_model like CONCAT('%', #{param2.materialName}, '%'))
         </if>
         <if test="param2.nodeId != null and param2.nodeId != ''">
             AND b.node_id = #{param2.nodeId}
@@ -168,7 +168,7 @@
                 #{id}
             </foreach>
             )
-        and (status = 2
+        and (status > 1
         or id  in (select entrust_id from u_trial_self_inspection_record where is_deleted=0))
     </select>
     <select id="getRfiList" resultType="org.springblade.business.entity.EntrustInfo">
@@ -184,7 +184,7 @@
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}
         </foreach>
-        and status !=2
+        and status > 1
         and id not in(SELECT entrust_id from u_trial_self_inspection_record where is_deleted=0 and  LENGTH(entrust_id)>=5)
     </delete>
 

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/EntrustInfoServiceImpl.java

@@ -253,9 +253,10 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
 			return R.fail("ids不能为null");
 		}
 		List<Long> longList = Func.toLongList(ids);
+		//只有未上报的委托单才可以删除
 		List<EntrustInfo> entrustInfos = baseMapper.checkDelete(longList);
 		if (entrustInfos.size()>0){
-			return R.fail("删除失败");
+			return R.fail("只有未上报的委托单才可以删除");
 		}
 		int delete = baseMapper.delEntrustInfo(longList);
         if(delete!=longList.size()){

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java

@@ -258,7 +258,7 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         }
         data.forEach(excel -> {
             TrialSampleInfo trialSampleInfo = BeanUtil.copyProperties(excel, TrialSampleInfo.class);
-            if (trialSampleInfo != null) {
+            if (trialSampleInfo != null && StringUtils.isNotEmpty(excel.getMaterialName())) {
                 if (StringUtils.isNotEmpty(excel.getMaterialCount())) {
                     trialSampleInfo.setMaterialCount(excel.getMaterialCount());
                 }