Browse Source

试验材料管理相关

liuyc 2 years ago
parent
commit
9f9321ff4d
50 changed files with 1461 additions and 125 deletions
  1. 4 3
      blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/NewIOSSClient.java
  2. 13 6
      blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/NewIOSSClientImpl.java
  3. 29 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialMaterialMobilizationDTO.java
  4. 9 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSampleInfoDTO.java
  5. 39 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceClassification.java
  6. 135 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceInfo.java
  7. 35 1
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialMaterialMobilization.java
  8. 41 1
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSampleInfo.java
  9. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSamplingRecord.java
  10. 61 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO.java
  11. 19 2
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialMaterialMobilizationVO.java
  12. 17 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSampleInfoVO.java
  13. 5 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSamplingRecordVO.java
  14. 23 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/TrialDeviceInfoWarpper.java
  15. 8 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
  16. 21 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserContractInfoVO.java
  17. 55 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceClassificationController.java
  18. 84 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceInfoController.java
  19. 37 23
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialMaterialController.java
  20. 70 0
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceInfoExcel.java
  21. 4 2
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationExcel.java
  22. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationImporter.java
  23. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialSampleInfoExcel.java
  24. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialSampleInfoImporter.java
  25. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceClassificationMapper.java
  26. 20 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceClassificationMapper.xml
  27. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.java
  28. 35 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.xml
  29. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialMaterialMobilizationMapper.xml
  30. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSampleInfoMapper.xml
  31. 2 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSamplingRecordMapper.java
  32. 4 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSamplingRecordMapper.xml
  33. 16 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceClassificationService.java
  34. 24 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceInfoService.java
  35. 6 3
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialMaterialMobilizationService.java
  36. 5 3
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSampleInfoService.java
  37. 33 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceClassificationServiceImpl.java
  38. 273 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java
  39. 125 33
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
  40. 121 33
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java
  41. 13 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java
  42. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java
  43. 10 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  44. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml
  45. 3 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java
  46. 11 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  47. 6 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java
  48. 1 1
      blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java
  49. 3 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java
  50. 7 6
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

+ 4 - 3
blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/NewIOSSClient.java

@@ -9,9 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
 @FeignClient(value = AppConstant.APPLICATION_RESOURCE_NAME)
 public interface NewIOSSClient {
 
@@ -19,6 +16,7 @@ public interface NewIOSSClient {
     String UPLOAD_FILE_INFO = API_PREFIX + "/uploadFileInfo";
     String UPLOAD_FILE_INFO_BYTE = API_PREFIX + "/uploadFileInfoByte";
     String UPLOAD_FILE_INFO_INPUT_STREAM = API_PREFIX + "/uploadFileInfoInputStream";
+    String REMOVE_PDF_FILE = API_PREFIX + "/remove-file";
 
     @PostMapping(value = UPLOAD_FILE_INFO_INPUT_STREAM, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     BladeFile uploadFileByInputStream(MultipartFile file);
@@ -29,4 +27,7 @@ public interface NewIOSSClient {
     @PostMapping(UPLOAD_FILE_INFO_BYTE)
     BladeFile updateFile(@RequestBody byte[] fileByte, @RequestParam String fileName);
 
+    @PostMapping(REMOVE_PDF_FILE)
+    void removeFile(@RequestParam String fileName);
+
 }

+ 13 - 6
blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/NewIOSSClientImpl.java

@@ -3,7 +3,9 @@ package org.springblade.resource.feign;
 import lombok.AllArgsConstructor;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.core.tool.api.R;
 import org.springblade.resource.builder.oss.OssBuilder;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -24,9 +26,9 @@ public class NewIOSSClientImpl implements NewIOSSClient {
 
     @Override
     public BladeFile uploadFileByInputStream(MultipartFile file) {
-        try{
+        try {
             return this.ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
@@ -34,23 +36,28 @@ public class NewIOSSClientImpl implements NewIOSSClient {
 
     @Override
     public BladeFile updateFile(byte[] fileByte, String fileName) {
-        try{
+        try {
             //获取文件流
             InputStream inputStream = new ByteArrayInputStream(fileByte);
             return this.ossBuilder.template().putFile(fileName, inputStream);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
     }
 
+    @Override
+    public void removeFile(String fileName) {
+        ossBuilder.template().removeFile(fileName);
+    }
+
     @Override
     public BladeFile uploadFile(String fileName, String localFileUrl) {
-        try{
+        try {
             //获取文件流
             InputStream inputStream = new FileInputStream(new File(localFileUrl));
             return this.ossBuilder.template().putFile(fileName, inputStream);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;

+ 29 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialMaterialMobilizationDTO.java

@@ -0,0 +1,29 @@
+package org.springblade.business.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.business.entity.TrialMaterialMobilization;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 试验进场材料实体
+ */
+@Data
+@TableName("u_trial_material_mobilization")
+@EqualsAndHashCode(callSuper = true)
+public class TrialMaterialMobilizationDTO extends TrialMaterialMobilization {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 数据序号
+     */
+    @ApiModelProperty("数据序号")
+    private Integer dataNumber;
+
+}

+ 9 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSampleInfoDTO.java

@@ -1,5 +1,6 @@
 package org.springblade.business.dto;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.business.entity.TrialSampleInfo;
 
@@ -11,6 +12,14 @@ public class TrialSampleInfoDTO extends TrialSampleInfo {
     /**
      * 进场材料id
      */
+    @ApiModelProperty("进场材料id")
     private Long mobilizationId;
 
+    /**
+     * 数据序号
+     */
+    @ApiModelProperty("数据序号")
+    private Integer dataNumber;
+
+
 }

+ 39 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceClassification.java

@@ -0,0 +1,39 @@
+package org.springblade.business.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * 试验设备分类实体
+ */
+@Data
+@TableName("u_trial_device_classification")
+@EqualsAndHashCode(callSuper = true)
+public class TrialDeviceClassification extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 合同段id
+     */
+    @ApiModelProperty(value = "合同段id")
+    private Long contractId;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty(value = "设备分类名称")
+    private String className;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+
+}

+ 135 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceInfo.java

@@ -0,0 +1,135 @@
+package org.springblade.business.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * 试验设备信息实体
+ */
+@Data
+@TableName("u_trial_device_info")
+@EqualsAndHashCode(callSuper = true)
+public class TrialDeviceInfo extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 试验室管理人员名称
+     */
+    @ApiModelProperty(value = "试验室管理人员名称")
+    private String managerName;
+
+    /**
+     * 设备分类id
+     */
+    @ApiModelProperty(value = "设备分类id")
+    private Long deviceClassId;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+    /**
+     * 设备编号
+     */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceNumber;
+
+    /**
+     * 设备型号
+     */
+    @ApiModelProperty(value = "设备型号")
+    private String deviceModel;
+
+    /**
+     * 生产厂家
+     */
+    @ApiModelProperty(value = "生产厂家")
+    private String manufacturer;
+
+    /**
+     * 生产日期
+     */
+    @ApiModelProperty(value = "生产日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date productionDate;
+
+    /**
+     * 出厂编号
+     */
+    @ApiModelProperty(value = "出厂编号")
+    private String factoryNumber;
+
+    /**
+     * 设备采集编号
+     */
+    @ApiModelProperty(value = "设备采集编号")
+    private String equipmentAcquisitionNumber;
+
+    /**
+     * 进场日期
+     */
+    @ApiModelProperty(value = "进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date mobilizationDate;
+
+    /**
+     * 测量范围
+     */
+    @ApiModelProperty(value = "测量范围")
+    private String measuringRange;
+
+    /**
+     * 精准度
+     */
+    @ApiModelProperty(value = "精准度")
+    private String accuracy;
+
+    /**
+     * 校验周期
+     */
+    @ApiModelProperty(value = "校验周期")
+    private Integer calibrationCycle;
+
+    /**
+     * 最近校验时间
+     */
+    @ApiModelProperty(value = "最近校验时间")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date lastCalibrationTime;
+
+    /**
+     * 是否需要校验 '0'否 '1'是
+     */
+    @ApiModelProperty(value = "是否需要校验 '0'否 '1'是")
+    private Integer isCalibration;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+
+    /**
+     * pdfURL
+     */
+    @ApiModelProperty(value = "pdfURL")
+    private String pdfUrl;
+
+
+
+}

+ 35 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialMaterialMobilization.java

@@ -1,6 +1,8 @@
 package org.springblade.business.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
@@ -8,96 +10,128 @@ import org.springblade.core.mp.base.BaseEntity;
 import java.math.BigDecimal;
 import java.util.Date;
 
+/**
+ * 试验进场材料实体
+ */
 @Data
 @TableName("u_trial_material_mobilization")
 @EqualsAndHashCode(callSuper = true)
 public class TrialMaterialMobilization extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 合同段id
+     */
+    @ApiModelProperty(value = "合同段id")
+    private Long contractId;
+
     /**
      * 记录人id
      */
+    @ApiModelProperty(value = "记录人id")
     private Long userId;
 
     /**
      * 材料名称
      */
+    @ApiModelProperty(value = "材料名称")
     private String materialName;
 
     /**
      * 材料类型
      */
+    @ApiModelProperty(value = "材料类型")
     private Integer materialType;
 
     /**
      * 规格型号
      */
+    @ApiModelProperty(value = "规格型号")
     private String specificationModel;
 
     /**
      * 规格编号
      */
-    private String specificationNumber;
+    @ApiModelProperty(value = "材料编号")
+    private String materialNumber;
 
     /**
      * 材料单价
      */
+    @ApiModelProperty(value = "材料单价")
     private BigDecimal materialPrice;
 
     /**
      * 材料数量
      */
+    @ApiModelProperty(value = "材料数量")
     private Integer materialCount;
 
     /**
      * 计算单位
      */
+    @ApiModelProperty(value = "计算单位")
     private String calculationUnit;
 
     /**
      * 生产批号
      */
+    @ApiModelProperty(value = "生产批号")
     private Integer batchNumber;
 
     /**
      * 进场日期
      */
+    @ApiModelProperty(value = "进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date mobilizationDate;
 
     /**
      * 拟定部位
      */
+    @ApiModelProperty(value = "拟定部位")
     private String proposedPosition;
 
     /**
      * 供应商单位
      */
+    @ApiModelProperty(value = "供应商单位")
     private String supplierUnit;
 
     /**
      * 生产地/厂家
      */
+    @ApiModelProperty(value = "生产地/厂家")
     private String placeOfProduction;
 
     /**
      * 生产合格证
      */
+    @ApiModelProperty(value = "生产合格证")
     private String productionCertificate;
 
     /**
      * 厂家质检报告
      */
+    @ApiModelProperty(value = "厂家质检报告")
     private String qualityInspectionReport;
 
     /**
      * 其他附件
      */
+    @ApiModelProperty(value = "其他附件")
     private String otherAccessories;
 
     /**
      * 排序
      */
+    @ApiModelProperty(value = "排序")
     private Integer sort;
 
+    /**
+     * pdfURL
+     */
+    @ApiModelProperty(value = "pdfURL")
+    private String pdfUrl;
 
 }

+ 41 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialSampleInfo.java

@@ -2,12 +2,17 @@ package org.springblade.business.entity;
 
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
 
 import java.util.Date;
 
+/**
+ * 试验样品信息实体
+ */
 @Data
 @TableName("u_trial_sample_info")
 @EqualsAndHashCode(callSuper = true)
@@ -15,84 +20,119 @@ public class TrialSampleInfo extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 取样人
+     * 试验树节点id
      */
+    @ApiModelProperty(value = "试验树节点id")
+    private Long nodeId;
+
+    /**
+     * 合同段id
+     */
+    @ApiModelProperty(value = "合同段id")
+    private Long contractId;
+
+    /**
+     * 取样人id
+     */
+    @ApiModelProperty(value = "取样人id")
     private Long userId;
 
     /**
      * 样品名称
      */
+    @ApiModelProperty(value = "样品名称")
     private String materialName;
 
     /**
      * 规格型号
      */
+    @ApiModelProperty(value = "规格型号")
     private String specificationModel;
 
     /**
      * 样品编号
      */
+    @ApiModelProperty(value = "样品编号")
     private String specificationNumber;
 
     /**
      * 试样数量
      */
+    @ApiModelProperty(value = "试样数量")
     private Integer materialCount;
 
     /**
      * 代表数量
      */
+    @ApiModelProperty(value = "代表数量")
     private Integer representativeCount;
 
     /**
      * 计算单位
      */
+    @ApiModelProperty(value = "计算单位")
     private String calculationUnit;
 
     /**
      * 生产批号
      */
+    @ApiModelProperty(value = "生产批号")
     private Integer batchNumber;
 
     /**
      * 拟定部位
      */
+    @ApiModelProperty(value = "拟定部位")
     private String proposedPosition;
 
     /**
      * 供应商单位
      */
+    @ApiModelProperty(value = "供应商单位")
     private String supplierUnit;
 
     /**
      * 取样地点
      */
+    @ApiModelProperty(value = "取样地点")
     private String samplingLocation;
 
     /**
      * 样品描述
      */
+    @ApiModelProperty(value = "样品描述")
     private String sampleDescription;
 
     /**
      * 进场日期
      */
+    @ApiModelProperty(value = "进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date mobilizationDate;
 
     /**
      * 取样日期
      */
+    @ApiModelProperty(value = "取样日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date samplingDate;
 
     /**
      * 是否委外 '0'=否 '1'=是
      */
+    @ApiModelProperty(value = "是否委外 '0'=否 '1'=是")
     private Integer isOutsourcing;
 
     /**
      * 排序
      */
+    @ApiModelProperty(value = "排序")
     private Integer sort;
 
+    /**
+     * pdfURL
+     */
+    @ApiModelProperty(value = "pdfURL")
+    private String pdfUrl;
 
 }

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

@@ -2,6 +2,7 @@ package org.springblade.business.entity;
 
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
@@ -16,11 +17,13 @@ public class TrialSamplingRecord extends BaseEntity {
     /**
      * 进场材料id
      */
+    @ApiModelProperty(value = "进场材料id")
     private Long mobilizationId;
 
     /**
      * 样品材料id
      */
+    @ApiModelProperty(value = "样品材料id")
     private Long sampleInfoId;
 
 }

+ 61 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO.java

@@ -0,0 +1,61 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialDeviceInfo;
+
+
+@Data
+public class TrialDeviceInfoVO extends TrialDeviceInfo {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备分类类型id
+     */
+    @ApiModelProperty(value = "设备分类类型id")
+    private Long deviceClassId;
+
+    /**
+     * 是否需要校验 '0'否 '1'是
+     */
+    @ApiModelProperty(value = "是否需要校验 '0'否 '1'是")
+    private Integer isCalibration;
+
+    /**
+     * 状态
+     */
+    @ApiModelProperty(value = "状态")
+    private Integer status;
+
+    /**
+     * 查询输入框 设备名称、设备型号
+     */
+    @ApiModelProperty(value = "查询输入框 设备名称、设备型号")
+    private String queryValue;
+
+    /**
+     * 购置日期 开始时间
+     */
+    @ApiModelProperty(value = "购置日期 开始时间")
+    private String startTime;
+
+    /**
+     * 购置日期 结束时间
+     */
+    @ApiModelProperty(value = "购置日期 结束时间")
+    private String endTime;
+
+    /**
+     * 试验室管理人员名称
+     */
+    @ApiModelProperty(value = "试验室管理人员名称")
+    private String managerName;
+
+    /**
+     * 设备分类名称
+     */
+    @ApiModelProperty(value = "设备分类名称")
+    private String deviceClassName;
+
+
+}

+ 19 - 2
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialMaterialMobilizationVO.java

@@ -1,5 +1,6 @@
 package org.springblade.business.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.business.entity.TrialMaterialMobilization;
 
@@ -8,23 +9,39 @@ public class TrialMaterialMobilizationVO extends TrialMaterialMobilization {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 材料类型 名称、规格、编号
+     * 材料类型
      */
+    @ApiModelProperty(value = "材料类型")
     private Integer materialType;
 
     /**
-     * 查询输入框
+     * 查询输入框 名称、规格、编号
      */
+    @ApiModelProperty(value = "材料类型 名称、规格、编号")
     private String queryValue;
 
     /**
      * 开始时间
      */
+    @ApiModelProperty(value = "开始时间")
     private String startTime;
 
     /**
      * 结束时间
      */
+    @ApiModelProperty(value = "结束时间")
     private String endTime;
 
+    /**
+     * 记录人
+     */
+    @ApiModelProperty(value = "记录人")
+    private String userName;
+
+    /**
+     * 材料类型名称
+     */
+    @ApiModelProperty(value = "材料类型名称")
+    private String materialName;
+
 }

+ 17 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSampleInfoVO.java

@@ -1,5 +1,6 @@
 package org.springblade.business.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.business.entity.TrialSampleInfo;
 
@@ -11,17 +12,33 @@ public class TrialSampleInfoVO extends TrialSampleInfo {
     /**
      * 查询输入框 名称、规格、编号
      */
+    @ApiModelProperty(value = "查询输入框 名称、规格、编号")
     private String queryValue;
 
     /**
      * 开始时间
      */
+    @ApiModelProperty(value = "开始时间")
     private String startTime;
 
     /**
      * 结束时间
      */
+    @ApiModelProperty(value = "结束时间")
     private String endTime;
 
+    /**
+     * 取样人
+     */
+    @ApiModelProperty(value = "取样人")
+    private String userName;
+
+
+    /**
+     * 进场材料id
+     */
+    @ApiModelProperty("进场材料id")
+    private Long mobilizationId;
+
 
 }

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSamplingRecordVO.java

@@ -13,6 +13,11 @@ public class TrialSamplingRecordVO extends TrialSamplingRecord {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 合同段id
+     */
+    private Long contractId;
+
     /**
      * 样品编号
      */

+ 23 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/TrialDeviceInfoWarpper.java

@@ -0,0 +1,23 @@
+package org.springblade.business.wrapper;
+
+import org.springblade.business.entity.TrialDeviceInfo;
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.vo.TrialDeviceInfoVO;
+import org.springblade.business.vo.TrialSampleInfoVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+
+import java.util.Objects;
+
+public class TrialDeviceInfoWarpper extends BaseEntityWrapper<TrialDeviceInfo, TrialDeviceInfoVO> {
+
+    public static TrialDeviceInfoWarpper build() {
+        return new TrialDeviceInfoWarpper();
+    }
+
+    @Override
+    public TrialDeviceInfoVO entityVO(TrialDeviceInfo entity) {
+        return Objects.requireNonNull(BeanUtil.copy(entity, TrialDeviceInfoVO.class));
+    }
+
+}

+ 8 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java

@@ -26,6 +26,7 @@ import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.UserInfo;
 import org.springblade.system.user.entity.UserOauth;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -58,6 +59,7 @@ public interface IUserClient {
     String UPDATE_USER_ROLE_ID = API_PREFIX + "/user-roleId-update-two";
     String UPDATE_USERS_ROLE_ID = API_PREFIX + "/user-roleId-update-three";
     String USER_INFO_LIST = API_PREFIX + "/find-user-info-list";
+    String USER_INFO_ALL = API_PREFIX + "/get-users-all";
 
     /**
      * 获取所有有效用户
@@ -163,4 +165,10 @@ public interface IUserClient {
     @GetMapping(UPDATE_USERS_ROLE_ID)
     boolean updateUserRoleIdThree(@RequestParam("userIds") List<String> userIds, @RequestParam("roleIds") String roleIds);
 
+    /**
+     * 获取全部userList
+     */
+    @GetMapping(USER_INFO_ALL)
+    List<User> selectUserAll();
+
 }

+ 21 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserContractInfoVO.java

@@ -0,0 +1,21 @@
+package org.springblade.system.user.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tenant.mp.TenantEntity;
+
+
+/**
+ * 合同段管理人员VO
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class UserContractInfoVO extends TenantEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    private Long userId;
+
+    private String userName;
+
+}

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

@@ -0,0 +1,55 @@
+package org.springblade.business.controller;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.TrialDeviceClassification;
+import org.springblade.business.service.ITrialDeviceClassificationService;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/device")
+@Api(value = "设备分类", tags = "设备分类接口")
+public class TrialDeviceClassificationController extends BladeController {
+
+    private final ITrialDeviceClassificationService iTrialDeviceClassificationService;
+
+    @PostMapping("/class-submit")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "分类新增或修改", notes = "传入TrialDeviceClassification对象")
+    public R<Object> classSubmit(@Valid @RequestBody TrialDeviceClassification obj) {
+        return R.status(iTrialDeviceClassificationService.classSubmit(obj));
+    }
+
+    @GetMapping("/class-detail")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分类详情", notes = "传入id")
+    public R<TrialDeviceClassification> classDetail(@Valid @RequestParam Long id) {
+        return R.data(iTrialDeviceClassificationService.classDetail(id));
+    }
+
+    @GetMapping("/class-list")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分类列表", notes = "当前合同段id")
+    public R<List<TrialDeviceClassification>> classList(@Valid @RequestParam Long contractId) {
+        return R.data(iTrialDeviceClassificationService.classList(contractId));
+    }
+
+    @GetMapping("/class-remove")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分类删除", notes = "传入id")
+    public R<Object> classRemove(@Valid @RequestParam String id) {
+        return R.status(iTrialDeviceClassificationService.deleteLogic(Func.toLongList(id)));
+    }
+
+
+
+}

+ 84 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceInfoController.java

@@ -0,0 +1,84 @@
+package org.springblade.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.TrialDeviceInfo;
+import org.springblade.business.excel.TrialDeviceInfoExcel;
+import org.springblade.business.service.ITrialDeviceInfoService;
+import org.springblade.business.vo.TrialDeviceInfoVO;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.List;
+
+@RestController
+@RequestMapping("/device/info")
+@AllArgsConstructor
+@Api(value = "设备详情", tags = "设备详情接口")
+public class TrialDeviceInfoController extends BladeController {
+
+    private final ITrialDeviceInfoService iTrialDeviceInfoService;
+
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "新增或修改", notes = "传入TrialDeviceInfo对象")
+    public R<Object> submit(@Valid @RequestBody TrialDeviceInfo obj) {
+        return R.status(iTrialDeviceInfoService.submit(obj));
+    }
+
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "详情", notes = "传入id")
+    public R<TrialDeviceInfo> detail(@Valid @RequestBody Long id) {
+        return R.data(iTrialDeviceInfoService.detail(id));
+    }
+
+    @GetMapping("/remove")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "批量删除", notes = "传入ids")
+    public R<Object> remove(@Valid @RequestBody String ids) {
+        return R.status(iTrialDeviceInfoService.deleteLogic(Func.toLongList(ids)));
+    }
+
+    @GetMapping("/page")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "分页条件查询", notes = "传入Query,TrialDeviceInfoVO")
+    public R<IPage<TrialDeviceInfoVO>> page(Query query, TrialDeviceInfoVO obj) {
+        return R.data(iTrialDeviceInfoService.selectPage(Condition.getPage(query), obj));
+    }
+
+    @PostMapping("/print-pdf")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "打印PDF", notes = "传入ids")
+    public R printPdf(String ids, HttpServletResponse response) {
+        return R.data(iTrialDeviceInfoService.printPdf(ids, response));
+    }
+
+    @PostMapping("/read-excel")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "读取excel数据", notes = "传入excel")
+    public R<List<TrialDeviceInfoExcel>> readExcel(MultipartFile file) {
+        List<TrialDeviceInfoExcel> list = ExcelUtil.read(file, TrialDeviceInfoExcel.class);
+        return R.data(list);
+    }
+
+    @PostMapping("/save-batch")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "导入设备数据保存", notes = "传入List<TrialDeviceInfoExcel>")
+    public R<Object> saveBatchDeviceInfo(@RequestBody List<TrialDeviceInfoExcel> list) {
+        return R.status(iTrialDeviceInfoService.saveBatchDeviceInfo(list));
+    }
+
+
+}

+ 37 - 23
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialMaterialController.java

@@ -5,6 +5,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springblade.business.dto.TrialMaterialMobilizationDTO;
 import org.springblade.business.dto.TrialSampleInfoDTO;
 import org.springblade.business.entity.TrialMaterialMobilization;
 import org.springblade.business.entity.TrialSampleInfo;
@@ -39,6 +40,13 @@ public class TrialMaterialController extends BladeController {
     private final ITrialMaterialMobilizationService iTrialMaterialMobilizationService;
     private final ITrialSampleInfoService iTrialSampleInfoService;
 
+    @GetMapping("/mobilization/verification")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "进场材料校验编号唯一", notes = "传入materialNumber")
+    public R<Object> mobilizationVerification(@Valid @RequestParam String materialNumber, @RequestParam String id) {
+        return R.data(iTrialMaterialMobilizationService.mobilizationVerification(materialNumber, id));
+    }
+
     @GetMapping("/mobilization/sampling-record")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "材料取样记录", notes = "传入材料id")
@@ -55,7 +63,7 @@ public class TrialMaterialController extends BladeController {
 
     @GetMapping("/mobilization/page")
     @ApiOperationSupport(order = 3)
-    @ApiOperation(value = "进场材料分页条件查询", notes = "传入page、TrialMaterialMobilizationVO")
+    @ApiOperation(value = "进场材料分页条件查询", notes = "传入Query、TrialMaterialMobilizationVO")
     public R<IPage<TrialMaterialMobilizationVO>> mobilizationPage(Query query, TrialMaterialMobilizationVO obj) {
         return R.data(iTrialMaterialMobilizationService.selectPage(Condition.getPage(query), obj));
     }
@@ -83,77 +91,83 @@ public class TrialMaterialController extends BladeController {
 
     @PostMapping("/mobilization/copy")
     @ApiOperationSupport(order = 7)
-    @ApiOperation(value = "进场材料批量复制", notes = "传入ids")
-    public R<Object> mobilizationCopy(@Valid @RequestParam String ids) {
-        return R.status(iTrialMaterialMobilizationService.mobilizationCopy(ids));
+    @ApiOperation(value = "进场材料批量复制", notes = "传入TrialMaterialMobilizationDTO集合")
+    public R<Object> mobilizationCopy(@Valid @RequestBody List<TrialMaterialMobilizationDTO> dto) {
+        return R.status(iTrialMaterialMobilizationService.mobilizationCopy(dto));
     }
 
     @PostMapping("/mobilization/import")
     @ApiOperationSupport(order = 8)
-    @ApiOperation(value = "导入进场材料", notes = "传入excel")
-    public R mobilizationImport(MultipartFile file, Integer isCovered) {
-        TrialMaterialMobilizationImporter trialMaterialMobilizationImporter = new TrialMaterialMobilizationImporter(iTrialMaterialMobilizationService, isCovered == 1);
+    @ApiOperation(value = "进场材料导入", notes = "传入excel,合同段contractId")
+    public R mobilizationImport(MultipartFile file, Integer isCovered, Long contractId) {
+        TrialMaterialMobilizationImporter trialMaterialMobilizationImporter = new TrialMaterialMobilizationImporter(iTrialMaterialMobilizationService, isCovered == 1, contractId);
         ExcelUtil.save(file, trialMaterialMobilizationImporter, TrialMaterialMobilizationExcel.class);
         return R.success("操作成功");
     }
 
     @PostMapping("/mobilization/export-pdf")
     @ApiOperationSupport(order = 9)
-    @ApiOperation(value = "批量打印进场材料Pdf", notes = "传入ids")
-    public void mobilizationExportPdf(@Valid @RequestParam String ids, HttpServletResponse response) {
-        iTrialMaterialMobilizationService.mobilizationExportPdf(ids, response);
+    @ApiOperation(value = "进场材料批量打印PDF", notes = "传入ids")
+    public R mobilizationExportPdf(@Valid @RequestParam String ids, HttpServletResponse response) {
+        return R.data(iTrialMaterialMobilizationService.mobilizationExportPdf(ids, response));
     }
 
     @GetMapping("/sample/detail")
     @ApiOperationSupport(order = 10)
-    @ApiOperation(value = "样材料详情", notes = "传入id")
+    @ApiOperation(value = "样材料详情", notes = "传入id")
     public R<TrialSampleInfo> sampleDetail(@Valid @RequestParam Long id) {
         return R.data(iTrialSampleInfoService.sampleDetail(id));
     }
 
     @GetMapping("/sample/page")
     @ApiOperationSupport(order = 11)
-    @ApiOperation(value = "取样材料分页条件查询", notes = "传入page、TrialSampleInfoVO")
+    @ApiOperation(value = "样品材料分页条件查询", notes = "传入Query、TrialSampleInfoVO")
     public R<IPage<TrialSampleInfoVO>> mobilizationPage(Query query, TrialSampleInfoVO obj) {
         return R.data(iTrialSampleInfoService.selectPage(Condition.getPage(query), obj));
     }
 
     @PostMapping("/sample/submit")
     @ApiOperationSupport(order = 12)
-    @ApiOperation(value = "样材料新增或修改", notes = "传入TrialSampleInfoDTO对象、关联材料信息传材料的mobilizationId")
+    @ApiOperation(value = "样材料新增或修改", notes = "传入TrialSampleInfoDTO对象、关联材料信息传材料的mobilizationId")
     public R<Object> sampleSubmit(@Valid @RequestBody TrialSampleInfoDTO obj) {
         return R.status(iTrialSampleInfoService.sampleSubmit(obj));
     }
 
     @PostMapping("/sample/remove")
     @ApiOperationSupport(order = 13)
-    @ApiOperation(value = "样材料批量删除", notes = "传入ids")
+    @ApiOperation(value = "样材料批量删除", notes = "传入ids")
     public R<Object> sampleRemove(@Valid @RequestParam String ids) {
         return R.status(iTrialSampleInfoService.deleteLogic(Func.toLongList(ids)));
     }
 
     @PostMapping("/sample/copy")
     @ApiOperationSupport(order = 14)
-    @ApiOperation(value = "取样材料批量复制", notes = "传入ids")
-    public R<Object> sampleCopy(@Valid @RequestParam String ids) {
-        return R.status(iTrialSampleInfoService.sampleCopy(ids));
+    @ApiOperation(value = "样品材料批量复制", notes = "传入TrialSampleInfoDTO集合")
+    public R<Object> sampleCopy(@Valid @RequestBody List<TrialSampleInfoDTO> dto) {
+        return R.status(iTrialSampleInfoService.sampleCopy(dto));
     }
 
     @PostMapping("/sample/import")
     @ApiOperationSupport(order = 15)
-    @ApiOperation(value = "导入取样材料", notes = "传入excel")
-    public R sampleImport(MultipartFile file, Integer isCovered) {
-        TrialSampleInfoImporter trialSampleInfoImporter = new TrialSampleInfoImporter(iTrialSampleInfoService, isCovered == 1);
+    @ApiOperation(value = "样材料导入", notes = "传入excel,合同段contractId")
+    public R sampleImport(MultipartFile file, Integer isCovered, Long contractId) {
+        TrialSampleInfoImporter trialSampleInfoImporter = new TrialSampleInfoImporter(iTrialSampleInfoService, isCovered == 1, contractId);
         ExcelUtil.save(file, trialSampleInfoImporter, TrialSampleInfoExcel.class);
         return R.success("操作成功");
     }
 
     @PostMapping("/sample/export-pdf")
     @ApiOperationSupport(order = 16)
-    @ApiOperation(value = "批量打印取样材料Pdf", notes = "传入ids")
-    public void sampleExportPdf(@Valid @RequestParam String ids, HttpServletResponse response) {
-        iTrialSampleInfoService.sampleExportPdf(ids, response);
+    @ApiOperation(value = "样品材料批量打印PDF", notes = "传入ids")
+    public R sampleExportPdf(@Valid @RequestParam String ids, HttpServletResponse response) {
+        return R.data(iTrialSampleInfoService.sampleExportPdf(ids, response));
     }
 
+    @GetMapping("/sample/verification")
+    @ApiOperationSupport(order = 17)
+    @ApiOperation(value = "样品材料校验编号唯一", notes = "传入specificationNumber,id")
+    public R<Object> sampleVerification(@Valid @RequestParam String specificationNumber,@RequestParam String id) {
+        return R.data(iTrialSampleInfoService.sampleVerification(specificationNumber,id));
+    }
 
 }

+ 70 - 0
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceInfoExcel.java

@@ -0,0 +1,70 @@
+package org.springblade.business.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@ColumnWidth(16)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class TrialDeviceInfoExcel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ExcelProperty("设备名称")
+    private String deviceName;
+
+    @ExcelProperty("设备分类名称")
+    private String deviceClassName;
+
+    @ExcelProperty("试验室管理人员名称")
+    private String managerName;
+
+    @ExcelProperty("设备型号")
+    private String deviceModel;
+
+    @ExcelProperty("生产厂家")
+    private String manufacturer;
+
+    @ExcelProperty("生产日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date productionDate;
+
+    @ExcelProperty("出厂编号")
+    private String factoryNumber;
+
+    @ExcelProperty("设备采集编号")
+    private String equipmentAcquisitionNumber;
+
+    @ExcelProperty("进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date mobilizationDate;
+
+    @ExcelProperty("测量范围")
+    private String measuringRange;
+
+    @ExcelProperty("精准度")
+    private String accuracy;
+
+    @ExcelProperty("校验周期(月)")
+    private Integer calibrationCycle;
+
+    @ExcelProperty("最近校验时间")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date lastCalibrationTime;
+
+    @ExcelProperty("是否需要校验 否/是")
+    private String isCalibration;
+
+    @ExcelProperty("备注")
+    private String remarks;
+
+
+}

+ 4 - 2
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationExcel.java

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -34,8 +35,8 @@ public class TrialMaterialMobilizationExcel implements Serializable {
     @ExcelProperty(value = "规格型号")
     private String specificationModel;
 
-    @ExcelProperty(value = "规格编号")
-    private String specificationNumber;
+    @ExcelProperty(value = "材料编号")
+    private String materialNumber;
 
     @ExcelProperty(value = "材料单价")
     private BigDecimal materialPrice;
@@ -50,6 +51,7 @@ public class TrialMaterialMobilizationExcel implements Serializable {
     private Integer batchNumber;
 
     @ExcelProperty(value = "进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date mobilizationDate;
 
     @ExcelProperty(value = "拟定部位")

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialMaterialMobilizationImporter.java

@@ -11,10 +11,11 @@ public class TrialMaterialMobilizationImporter implements ExcelImporter<TrialMat
 
     private final ITrialMaterialMobilizationService service;
     private final Boolean isCovered;
+    private final Long contractId;
 
     @Override
     public void save(List<TrialMaterialMobilizationExcel> data) {
-        service.importMobilization(data, isCovered);
+        service.importMobilization(data, isCovered, contractId);
     }
 
 }

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialSampleInfoExcel.java

@@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import javax.validation.Valid;
@@ -61,9 +62,11 @@ public class TrialSampleInfoExcel implements Serializable {
     private String sampleDescription;
 
     @ExcelProperty(value = "进场日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date mobilizationDate;
 
     @ExcelProperty(value = "取样日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date samplingDate;
 
     @ExcelProperty(value = "是否委外")

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialSampleInfoImporter.java

@@ -11,10 +11,11 @@ public class TrialSampleInfoImporter implements ExcelImporter<TrialSampleInfoExc
 
     private final ITrialSampleInfoService service;
     private final Boolean isCovered;
+    private final Long contractId;
 
     @Override
     public void save(List<TrialSampleInfoExcel> data) {
-        service.importSample(data, isCovered);
+        service.importSample(data, isCovered, contractId);
     }
 
 }

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceClassificationMapper.java

@@ -0,0 +1,7 @@
+package org.springblade.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.business.entity.TrialDeviceClassification;
+
+public interface TrialDeviceClassificationMapper extends BaseMapper<TrialDeviceClassification> {
+}

+ 20 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceClassificationMapper.xml

@@ -0,0 +1,20 @@
+<?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="org.springblade.business.mapper.TrialDeviceClassificationMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialDeviceClassification">
+        <result column="id" property="id"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="class_name" property="className"/>
+        <result column="sort" property="sort"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+</mapper>

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.java

@@ -0,0 +1,7 @@
+package org.springblade.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.business.entity.TrialDeviceInfo;
+
+public interface TrialDeviceInfoMapper extends BaseMapper<TrialDeviceInfo> {
+}

+ 35 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.xml

@@ -0,0 +1,35 @@
+<?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="org.springblade.business.mapper.TrialDeviceInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialDeviceInfo">
+        <result column="id" property="id"/>
+        <result column="manager_id" property="managerId"/>
+        <result column="device_class_id" property="deviceClassId"/>
+        <result column="device_name" property="deviceName"/>
+        <result column="device_type" property="deviceType"/>
+        <result column="device_number" property="deviceNumber"/>
+        <result column="device_model" property="deviceModel"/>
+        <result column="manufacturer" property="manufacturer"/>
+        <result column="production_date" property="productionDate"/>
+        <result column="factory_number" property="factoryNumber"/>
+        <result column="equipment_acquisition_number" property="equipmentAcquisitionNumber"/>
+        <result column="mobilization_date" property="mobilizationDate"/>
+        <result column="measuring_range" property="measuringRange"/>
+        <result column="accuracy" property="accuracy"/>
+        <result column="calibration_cycle" property="calibrationCycle"/>
+        <result column="lastCalibration_time" property="lastCalibrationTime"/>
+        <result column="is_calibration" property="isCalibration"/>
+        <result column="remarks" property="remarks"/>
+        <result column="sort" property="sort"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+</mapper>

+ 2 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialMaterialMobilizationMapper.xml

@@ -5,11 +5,12 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialMaterialMobilization">
         <result column="id" property="id"/>
+        <result column="contract_id" property="contractId"/>
         <result column="user_id" property="userId"/>
         <result column="material_name" property="materialName"/>
         <result column="material_type" property="materialType"/>
         <result column="specification_model" property="specificationModel"/>
-        <result column="specification_number" property="specificationNumber"/>
+        <result column="material_number" property="materialNumber"/>
         <result column="material_price" property="materialPrice"/>
         <result column="material_count" property="materialCount"/>
         <result column="calculation_unit" property="calculationUnit"/>

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSampleInfoMapper.xml

@@ -5,6 +5,8 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialSampleInfo">
         <result column="id" property="id"/>
+        <result column="node_id" property="nodeId"/>
+        <result column="contract_id" property="contractId"/>
         <result column="user_id" property="userId"/>
         <result column="material_name" property="materialName"/>
         <result column="specification_model" property="specificationModel"/>

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

@@ -15,4 +15,6 @@ public interface TrialSamplingRecordMapper extends BaseMapper<TrialSamplingRecor
 
     List<TrialSamplingRecord> selectListByMobilizationId(Long mobilizationId);
 
+    List<TrialSamplingRecord> selectAll();
+
 }

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

@@ -24,4 +24,8 @@
         select * from u_trial_sampling_record where mobilization_id = #{mobilizationId}
     </select>
 
+    <select id="selectAll" resultType="org.springblade.business.entity.TrialSamplingRecord">
+        select * from u_trial_sampling_record
+    </select>
+
 </mapper>

+ 16 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceClassificationService.java

@@ -0,0 +1,16 @@
+package org.springblade.business.service;
+
+import org.springblade.business.entity.TrialDeviceClassification;
+import org.springblade.core.mp.base.BaseService;
+
+import java.util.List;
+
+public interface ITrialDeviceClassificationService extends BaseService<TrialDeviceClassification> {
+
+    boolean classSubmit(TrialDeviceClassification obj);
+
+    TrialDeviceClassification classDetail(Long id);
+
+    List<TrialDeviceClassification> classList(Long contractId);
+
+}

+ 24 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceInfoService.java

@@ -0,0 +1,24 @@
+package org.springblade.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.entity.TrialDeviceInfo;
+import org.springblade.business.excel.TrialDeviceInfoExcel;
+import org.springblade.business.vo.TrialDeviceInfoVO;
+import org.springblade.core.mp.base.BaseService;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface ITrialDeviceInfoService extends BaseService<TrialDeviceInfo> {
+
+    boolean submit(TrialDeviceInfo obj);
+
+    TrialDeviceInfo detail(Long id);
+
+    IPage<TrialDeviceInfoVO> selectPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj);
+
+    String printPdf(String ids, HttpServletResponse response);
+
+    boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list);
+
+}

+ 6 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialMaterialMobilizationService.java

@@ -1,6 +1,7 @@
 package org.springblade.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.dto.TrialMaterialMobilizationDTO;
 import org.springblade.business.entity.TrialMaterialMobilization;
 import org.springblade.business.excel.TrialMaterialMobilizationExcel;
 import org.springblade.business.vo.TrialMaterialMobilizationVO;
@@ -13,19 +14,21 @@ import java.util.List;
 
 public interface ITrialMaterialMobilizationService extends BaseService<TrialMaterialMobilization> {
 
+    boolean mobilizationVerification(String number, String id);
+
     boolean mobilizationSubmit(TrialMaterialMobilization obj);
 
     TrialMaterialMobilization mobilizationDetail(Long id);
 
-    boolean mobilizationCopy(String ids);
+    boolean mobilizationCopy(List<TrialMaterialMobilizationDTO> dto);
 
     IPage<TrialMaterialMobilizationVO> selectPage(IPage<TrialMaterialMobilization> page, TrialMaterialMobilizationVO obj);
 
     List<TrialMaterialMobilization> selectList();
 
-    void importMobilization(List<TrialMaterialMobilizationExcel> data, Boolean isCovered);
+    void importMobilization(List<TrialMaterialMobilizationExcel> data, Boolean isCovered, Long contractId);
 
-    void mobilizationExportPdf(String ids, HttpServletResponse response);
+    String mobilizationExportPdf(String ids, HttpServletResponse response);
 
     List<TrialSamplingRecordVO> samplingRecordList(Long id);
 

+ 5 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSampleInfoService.java

@@ -18,10 +18,12 @@ public interface ITrialSampleInfoService extends BaseService<TrialSampleInfo> {
 
     boolean sampleSubmit(TrialSampleInfoDTO obj);
 
-    boolean sampleCopy(String ids);
+    boolean sampleCopy(List<TrialSampleInfoDTO> dto);
 
-    void importSample(List<TrialSampleInfoExcel> data, Boolean isCovered);
+    void importSample(List<TrialSampleInfoExcel> data, Boolean isCovered, Long contractId);
 
-    void sampleExportPdf(String ids, HttpServletResponse response);
+    String sampleExportPdf(String ids, HttpServletResponse response);
+
+    boolean sampleVerification(String specificationNumber,String id);
 
 }

+ 33 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceClassificationServiceImpl.java

@@ -0,0 +1,33 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.AllArgsConstructor;
+import org.springblade.business.entity.TrialDeviceClassification;
+import org.springblade.business.mapper.TrialDeviceClassificationMapper;
+import org.springblade.business.service.ITrialDeviceClassificationService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+public class TrialDeviceClassificationServiceImpl extends BaseServiceImpl<TrialDeviceClassificationMapper, TrialDeviceClassification> implements ITrialDeviceClassificationService {
+    @Override
+    public boolean classSubmit(TrialDeviceClassification obj) {
+        return this.saveOrUpdate(obj);
+    }
+
+    @Override
+    public TrialDeviceClassification classDetail(Long id) {
+        return baseMapper.selectById(id);
+    }
+
+    @Override
+    public List<TrialDeviceClassification> classList(Long contractId) {
+        return baseMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda()
+                .eq(TrialDeviceClassification::getContractId, contractId)
+                .eq(TrialDeviceClassification::getStatus, 1).orderBy(true, true, TrialDeviceClassification::getCreateTime));
+    }
+
+}

+ 273 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java

@@ -0,0 +1,273 @@
+package org.springblade.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Font;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+import lombok.AllArgsConstructor;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.springblade.business.entity.TrialDeviceClassification;
+import org.springblade.business.entity.TrialDeviceInfo;
+import org.springblade.business.entity.TrialMaterialMobilization;
+import org.springblade.business.entity.TrialSampleInfo;
+import org.springblade.business.excel.TrialDeviceInfoExcel;
+import org.springblade.business.mapper.TrialDeviceClassificationMapper;
+import org.springblade.business.mapper.TrialDeviceInfoMapper;
+import org.springblade.business.service.ITrialDeviceInfoService;
+import org.springblade.business.utils.PDFUtil;
+import org.springblade.business.utils.SystemUtils;
+import org.springblade.business.vo.TrialDeviceInfoVO;
+import org.springblade.business.wrapper.TrialDeviceInfoWarpper;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.user.entity.User;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@AllArgsConstructor
+public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoMapper, TrialDeviceInfo> implements ITrialDeviceInfoService {
+
+    private final NewIOSSClient newIOSSClient;
+    private final TrialDeviceClassificationMapper trialDeviceClassificationMapper;
+
+    @Override
+    public boolean submit(TrialDeviceInfo obj) {
+        if (ObjectUtil.isNotEmpty(obj.getId())) {
+            TrialDeviceInfo trialDeviceInfo = baseMapper.selectById(obj.getId());
+            if (!trialDeviceInfo.getLastCalibrationTime().equals(obj.getLastCalibrationTime())) {
+                //如果修改了最近校验时间,那么每次编辑默认修改校验为0=否
+                obj.setIsCalibration(0);
+            }
+        }
+        return this.saveOrUpdate(obj);
+    }
+
+    @Override
+    public TrialDeviceInfo detail(Long id) {
+        return baseMapper.selectById(id);
+    }
+
+    @Override
+    public IPage<TrialDeviceInfoVO> selectPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj) {
+        QueryWrapper<TrialDeviceInfo> queryWrapper = Condition.getQueryWrapper(obj);
+        if (ObjectUtil.isNotEmpty(obj.getDeviceClassId())) {
+            queryWrapper.lambda().eq(TrialDeviceInfo::getDeviceClassId, obj.getDeviceClassId());
+        }
+        if (ObjectUtil.isNotEmpty(obj.getIsCalibration())) {
+            queryWrapper.lambda().eq(TrialDeviceInfo::getIsCalibration, obj.getIsCalibration());
+        }
+        if (ObjectUtil.isNotEmpty(obj.getStatus())) {
+            queryWrapper.lambda().eq(TrialDeviceInfo::getStatus, obj.getStatus());
+        }
+        if (ObjectUtil.isNotEmpty(obj.getQueryValue())) {
+            queryWrapper.lambda().like(TrialDeviceInfo::getDeviceName, obj.getQueryValue());
+            queryWrapper.lambda().or().like(TrialDeviceInfo::getDeviceNumber, obj.getQueryValue());
+        }
+        if (StringUtils.isNotEmpty(obj.getStartTime()) && StringUtils.isNotEmpty(obj.getEndTime())) {
+            String endTime = obj.getEndTime();
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd HH:mm:ss"), 1), "yyyy-MM-dd HH:mm:ss");
+            queryWrapper.lambda().between(TrialDeviceInfo::getCreateTime, obj.getStartTime(), endTime);
+        }
+        IPage<TrialDeviceInfo> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialDeviceInfo::getCreateTime));
+        IPage<TrialDeviceInfoVO> trialDeviceInfoVOIPage = TrialDeviceInfoWarpper.build().pageVO(pages);
+        List<TrialDeviceInfoVO> records = trialDeviceInfoVOIPage.getRecords();
+        return trialDeviceInfoVOIPage.setRecords(records);
+    }
+
+    @Override
+    public String printPdf(String ids, HttpServletResponse response) {
+        try {
+            String fileName = java.net.URLEncoder.encode(DateUtil.time() + ".pdf", "UTF-8");
+            response.reset();
+            response.setHeader("Content-Disposition", "inline; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
+
+            //构造数据
+            List<TrialDeviceInfo> pdfData = baseMapper.selectBatchIds(Func.toLongList(ids));
+            //获取设备分类数据
+            List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda());
+
+            //删除旧PDF
+            List<String> pdfUrls = pdfData.stream().map(TrialDeviceInfo::getPdfUrl).distinct().collect(Collectors.toList());
+            for (String pdfUrl : pdfUrls) {
+                //格式 https: //xxx.com//upload/20221101/xxx.pdf
+                String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                newIOSSClient.removeFile(pdfName);
+            }
+
+            //创建文档,设置页面大小、左右上下边距
+            Document document = new Document();
+
+            BaseFont bfChinese = null;
+            String pdfUrl = null;
+            //处理中文显示问题,使用资源字体
+            if (SystemUtils.isWindows()) {
+                //windows
+                pdfUrl = "C:\\pdfFiles\\";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+                bfChinese = BaseFont.createFont("C:/WINDOWS/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
+            }
+            if (SystemUtils.isLinux()) {
+                //linux
+                pdfUrl = "/home/pdfFiles";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
+                bfChinese = BaseFont.createFont("/usr/share/fonts/my-fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
+            }
+
+            FileOutputStream fileOutputStream = new FileOutputStream(pdfUrl + fileName);
+
+            //Font dateTitle = new Font(bfChinese, 7, Font.NORMAL);
+            //Font title = new Font(bfChinese, 12, Font.BOLD);//文字加粗
+            Font textFont = new Font(bfChinese, 7, Font.NORMAL);//文字正常
+
+            //设置分页
+            PdfWriter.getInstance(document, fileOutputStream);
+
+            //打开文档
+            document.open();
+
+            //标题
+            PdfPTable tableTitle = new PdfPTable(3);
+            //生成一个9列的表格
+            PdfPTable table = new PdfPTable(18);
+
+            //定义每个单元格的宽度
+            float[] widthsHeaderTitle = {1f, 1f, 1f};
+            float[] widthsHeader = {1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f};
+
+            float lineHeight = (float) 20.0;
+
+            //设置表格每一格的宽度
+            tableTitle.setWidths(widthsHeaderTitle);
+            table.setWidths(widthsHeader);
+
+            //设置表格总体宽度
+            tableTitle.setWidthPercentage(100);
+            table.setWidthPercentage(100);
+
+            int colSpan = 1;
+
+            /*SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date date = new Date(System.currentTimeMillis());
+            //添加标题
+            PDFUtil.createTableCellLeft("导出人:XXX", textFont, tableTitle, lineHeight, colSpan);
+            PDFUtil.createTableCellCenter("XXX表", title, tableTitle, lineHeight, colSpan);
+            PDFUtil.createTableCellRight(formatter.format(date), dateTitle, tableTitle, lineHeight, colSpan);*/
+
+            document.add(tableTitle);
+            document.add(new Paragraph("\n"));
+
+            String[] array = {"ID", "设备名称", "设备分类", "设备编号", "设备型号", "生产厂家", "出厂日期", "出厂编号", "进场日期", "测量范围",
+                    "精准度", "校准周期(月)", "最近校验时间", "状态", "是否需要校验", "设备采集编号", "设备管理人员", "备注"};
+            for (String s : array) {
+                PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
+            }
+            for (TrialDeviceInfo pdfDatum : pdfData) {
+                for (TrialDeviceClassification classification : deviceClassificationList) {
+                    PDFUtil.createTableCell(String.valueOf(pdfDatum.getId()), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getDeviceName(), textFont, table, lineHeight, colSpan);
+                    if (classification.getId().equals(pdfDatum.getDeviceClassId())) {
+                        PDFUtil.createTableCell(classification.getClassName(), textFont, table, lineHeight, colSpan);
+                    }
+                    PDFUtil.createTableCell(pdfDatum.getDeviceNumber(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getDeviceModel(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getManufacturer(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getProductionDate().toString(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getFactoryNumber(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getEquipmentAcquisitionNumber(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getAccuracy(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getMeasuringRange(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getLastCalibrationTime().toString(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getStatus().equals(0) ? "已停用" : "启用中", textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getIsCalibration().equals(0) ? "否" : "是", textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getEquipmentAcquisitionNumber(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getManagerName(), textFont, table, lineHeight, colSpan);
+                    PDFUtil.createTableCell(pdfDatum.getRemarks(), textFont, table, lineHeight, colSpan);
+                }
+            }
+
+            document.add(table);
+            document.close();
+            BladeFile bladeFile;
+            try {
+                document.close();
+                fileOutputStream.close();
+
+                //存储OSS
+                File file = new File(pdfUrl + fileName);
+                String canonicalPath = file.getCanonicalPath();
+                String name = file.getName();
+                bladeFile = newIOSSClient.uploadFile(name, canonicalPath);
+
+                //修改URL
+                for (TrialDeviceInfo trialDeviceInfo : pdfData) {
+                    trialDeviceInfo.setPdfUrl(bladeFile.getLink());
+                }
+                this.updateBatchById(pdfData);
+
+                //删除本地缓存
+                if (file.exists()) {
+                    file.delete();
+                }
+
+                return bladeFile.getLink();
+
+            } catch (ClassCastException e) {
+                e.printStackTrace();
+            }
+
+        } catch (DocumentException | IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Override
+    public boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list) {
+        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda());
+        List<TrialDeviceInfo> listData = new ArrayList<>();
+        for (TrialDeviceInfoExcel trialDeviceInfoExcel : list) {
+            for (TrialDeviceClassification deviceClassification : deviceClassifications) {
+                if (trialDeviceInfoExcel.getManagerName().equals(deviceClassification.getClassName())) {
+                    TrialDeviceInfo trialDeviceInfo = BeanUtil.copyProperties(trialDeviceInfoExcel, TrialDeviceInfo.class);
+                    if (trialDeviceInfo != null) {
+                        trialDeviceInfo.setDeviceClassId(deviceClassification.getId());
+                        listData.add(trialDeviceInfo);
+                    }
+                }
+            }
+        }
+        this.saveBatch(listData);
+        return true;
+    }
+
+
+}

+ 125 - 33
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -13,6 +13,7 @@ import com.lowagie.text.pdf.PdfWriter;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
+import org.springblade.business.dto.TrialMaterialMobilizationDTO;
 import org.springblade.business.entity.TrialMaterialMobilization;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSamplingRecord;
@@ -26,33 +27,58 @@ import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialMaterialMobilizationVO;
 import org.springblade.business.vo.TrialSamplingRecordVO;
 import org.springblade.business.wrapper.TrialMaterialMobilizationWarpper;
+import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
+import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.DateUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.*;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springblade.system.entity.Dict;
+import org.springblade.system.feign.IDictClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 @AllArgsConstructor
 public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialMaterialMobilizationMapper, TrialMaterialMobilization> implements ITrialMaterialMobilizationService {
 
     private final IUserClient iUserClient;
+    private final IDictClient iDictClient;
     private final TrialSampleInfoMapper trialSampleInfoMapper;
     private final TrialSamplingRecordMapper trialSamplingRecordMapper;
+    private final NewIOSSClient newIOSSClient;
+
+    @Override
+    public boolean mobilizationVerification(String number, String id) {
+        List<TrialMaterialMobilization> list = baseMapper.selectList(Wrappers.<TrialMaterialMobilization>query().lambda());
+        if (StringUtils.isEmpty(id)) {
+            TrialMaterialMobilization trialMaterialMobilization1 = list.stream().filter(f -> f.getMaterialNumber().equals(number)).findAny().orElse(null);
+            return trialMaterialMobilization1 != null;
+        } else {
+            TrialMaterialMobilization trialMaterialMobilization = list.stream().filter(f -> f.getId().equals(Long.parseLong(id))).findAny().orElse(null);
+            assert trialMaterialMobilization != null;
+            if (!trialMaterialMobilization.getMaterialNumber().equals(number)) {
+                TrialMaterialMobilization trialMaterialMobilization1 = list.stream().filter(f -> f.getMaterialNumber().equals(number)).findAny().orElse(null);
+                return trialMaterialMobilization1 != null;
+            }
+            return false;
+        }
+    }
 
     @Override
     public boolean mobilizationSubmit(TrialMaterialMobilization obj) {
@@ -69,12 +95,17 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
     }
 
     @Override
-    public boolean mobilizationCopy(String ids) {
-        List<TrialMaterialMobilization> trialMaterialMobilizations = baseMapper.selectBatchIds(Func.toLongList(ids));
-        for (TrialMaterialMobilization obj : trialMaterialMobilizations) {
-            obj.setId(SnowFlakeUtil.getId());
+    public boolean mobilizationCopy(List<TrialMaterialMobilizationDTO> dto) throws ServiceException {
+        long count = dto.stream().map(TrialMaterialMobilizationDTO::getMaterialNumber).distinct().count();
+        if (count < dto.size()) {
+            throw new ServiceException("当前有数据的编号重复,请重新填写");
+        }
+        List<TrialMaterialMobilization> list = new ArrayList<>();
+        for (TrialMaterialMobilizationDTO trialMaterialMobilizationDTO : dto) {
+            trialMaterialMobilizationDTO.setId(SnowFlakeUtil.getId());
+            list.add(trialMaterialMobilizationDTO);
         }
-        return this.saveBatch(trialMaterialMobilizations);
+        return this.saveBatch(list);
     }
 
     @Override
@@ -91,11 +122,16 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
         if (ObjectUtil.isNotEmpty(obj.getQueryValue())) {
             queryWrapper.lambda().like(TrialMaterialMobilization::getMaterialName, obj.getQueryValue());
             queryWrapper.lambda().or().like(TrialMaterialMobilization::getSpecificationModel, obj.getQueryValue());
-            queryWrapper.lambda().or().like(TrialMaterialMobilization::getSpecificationNumber, obj.getQueryValue());
+            queryWrapper.lambda().or().like(TrialMaterialMobilization::getMaterialNumber, obj.getQueryValue());
         }
         IPage<TrialMaterialMobilization> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialMaterialMobilization::getCreateTime));
+
         IPage<TrialMaterialMobilizationVO> trialMaterialMobilizationVOIPage = TrialMaterialMobilizationWarpper.build().pageVO(pages);
         List<TrialMaterialMobilizationVO> records = trialMaterialMobilizationVOIPage.getRecords();
+        for (TrialMaterialMobilizationVO record : records) {
+            R<User> userR = iUserClient.userInfoById(record.getUserId());
+            record.setUserName(userR.getData().getName());
+        }
         return trialMaterialMobilizationVOIPage.setRecords(records);
     }
 
@@ -105,7 +141,7 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
     }
 
     @Override
-    public void importMobilization(List<TrialMaterialMobilizationExcel> data, Boolean isCovered) {
+    public void importMobilization(List<TrialMaterialMobilizationExcel> data, Boolean isCovered, Long contractId) {
         List<TrialMaterialMobilization> list = new ArrayList<>();
         if (ObjectUtil.isEmpty(SecureUtil.getUserId())) {
             throw new ServiceException("获取用户信息失败");
@@ -114,6 +150,7 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
             TrialMaterialMobilization trialMaterialMobilization = BeanUtil.copyProperties(excel, TrialMaterialMobilization.class);
             assert trialMaterialMobilization != null;
             trialMaterialMobilization.setUserId(SecureUtil.getUserId());
+            trialMaterialMobilization.setContractId(contractId);
             list.add(trialMaterialMobilization);
         });
         if (isCovered) {
@@ -124,45 +161,74 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
     }
 
     @Override
-    public void mobilizationExportPdf(String ids, HttpServletResponse response) {
+    public String mobilizationExportPdf(String ids, HttpServletResponse response) {
         try {
             String fileName = java.net.URLEncoder.encode(DateUtil.time() + ".pdf", "UTF-8");
             response.reset();
-            response.setContentType("application/pdf; name=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
             response.setHeader("Content-Disposition", "inline; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
-            //构建字节输出流
-            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
 
             //构造数据
             List<TrialMaterialMobilization> list = baseMapper.selectBatchIds(Func.toLongList(ids));
-            List<TrialMaterialMobilizationExcel> pdfData = new ArrayList<>();
+
+            //材料类型
+            R<List<Dict>> typeList = iDictClient.getList("material_type");
+
+            //获取所有用户信息
+            List<User> userList = iUserClient.selectUserAll();
+
+            //删除旧PDF
+            List<String> pdfUrls = list.stream().map(TrialMaterialMobilization::getPdfUrl).distinct().collect(Collectors.toList());
+            for (String pdfUrl : pdfUrls) {
+                //格式 https: //xxx.com//upload/20221101/xxx.pdf
+                String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                newIOSSClient.removeFile(pdfName);
+            }
+
+            List<TrialMaterialMobilizationVO> pdfData = new ArrayList<>();
             for (TrialMaterialMobilization trialMaterialMobilization : list) {
-                R<User> userR = iUserClient.userInfoById(trialMaterialMobilization.getUserId());
-                TrialMaterialMobilizationExcel trialMaterialMobilizationExcel = BeanUtil.copyProperties(trialMaterialMobilization, TrialMaterialMobilizationExcel.class);
-                assert trialMaterialMobilizationExcel != null;
-                trialMaterialMobilizationExcel.setUserName(userR.getData().getName());
-                pdfData.add(trialMaterialMobilizationExcel);
+
+                for (User user : userList) {
+                    if (trialMaterialMobilization.getUserId().equals(user.getId())) {
+                        TrialMaterialMobilizationVO trialMaterialMobilizationVO = BeanUtil.copyProperties(trialMaterialMobilization, TrialMaterialMobilizationVO.class);
+                        assert trialMaterialMobilizationVO != null;
+                        trialMaterialMobilizationVO.setUserName(user.getName());
+                        pdfData.add(trialMaterialMobilizationVO);
+                    }
+                }
             }
 
             //创建文档,设置页面大小、左右上下边距
             Document document = new Document();
             BaseFont bfChinese = null;
+            String pdfUrl = null;
             //处理中文显示问题,使用资源字体
             if (SystemUtils.isWindows()) {
                 //windows
+                pdfUrl = "C:\\pdfFiles\\";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
                 bfChinese = BaseFont.createFont("C:/WINDOWS/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
             }
             if (SystemUtils.isLinux()) {
                 //linux
+                pdfUrl = "/home/pdfFiles";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
                 bfChinese = BaseFont.createFont("/usr/share/fonts/my-fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
             }
 
+            FileOutputStream fileOutputStream = new FileOutputStream(pdfUrl + fileName);
+
             //Font dateTitle = new Font(bfChinese, 7, Font.NORMAL);
             //Font title = new Font(bfChinese, 12, Font.BOLD);//文字加粗
             Font textFont = new Font(bfChinese, 7, Font.NORMAL);//文字正常
 
             //设置分页
-            PdfWriter.getInstance(document, byteArrayOutputStream);
+            PdfWriter.getInstance(document, fileOutputStream);
 
             //打开文档
             document.open();
@@ -198,15 +264,22 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
             document.add(tableTitle);
             document.add(new Paragraph("\n"));
 
-            String[] array = {"材料编号", "进场日期", "材料名称", "材料类型", "规格型号", "供应商单位", "材料单价", "材料数量", "计算单位", "生产批号", "上产地/厂家", "拟用部位", "记录人"};
+            String[] array = {"材料编号", "进场日期", "材料名称", "材料类型", "规格型号", "供应商单位", "材料单价", "材料数量",
+                    "计算单位", "生产批号", "上产地/厂家", "拟用部位", "记录人"};
             for (String s : array) {
                 PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
             }
-            for (TrialMaterialMobilizationExcel pdfDatum : pdfData) {
-                PDFUtil.createTableCell(pdfDatum.getId().toString(), textFont, table, lineHeight, colSpan);
+            for (TrialMaterialMobilizationVO pdfDatum : pdfData) {
+                PDFUtil.createTableCell(pdfDatum.getMaterialNumber(), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(DateUtil.formatDate(pdfDatum.getMobilizationDate()), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(pdfDatum.getMaterialName(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getMaterialType().toString(), textFont, table, lineHeight, colSpan);
+
+                for (Dict type : typeList.getData()) {
+                    if (type.getDictKey().equals(pdfDatum.getMaterialType().toString())) {
+                        PDFUtil.createTableCell(type.getDictValue(), textFont, table, lineHeight, colSpan);
+                    }
+                }
+
                 PDFUtil.createTableCell(pdfDatum.getSpecificationModel(), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(pdfDatum.getSupplierUnit(), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(pdfDatum.getMaterialPrice().toString(), textFont, table, lineHeight, colSpan);
@@ -218,20 +291,39 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 PDFUtil.createTableCell(pdfDatum.getUserName(), textFont, table, lineHeight, colSpan);
             }
             document.add(table);
-            document.close();
+
+            BladeFile bladeFile;
             try {
-                byteArrayOutputStream.close();
-            } catch (IOException e) {
+                document.close();
+                fileOutputStream.close();
+
+                //存储OSS
+                File file = new File(pdfUrl + fileName);
+                String canonicalPath = file.getCanonicalPath();
+                String name = file.getName();
+                bladeFile = newIOSSClient.uploadFile(name, canonicalPath);
+
+                //修改URL
+                for (TrialMaterialMobilization trialMaterialMobilization : list) {
+                    trialMaterialMobilization.setPdfUrl(bladeFile.getLink());
+                }
+                this.updateBatchById(list);
+
+                //删除本地缓存
+                if (file.exists()) {
+                    file.delete();
+                }
+
+                return bladeFile.getLink();
+
+            } catch (ClassCastException e) {
                 e.printStackTrace();
             }
 
-            //输出
-            ServletOutputStream os = response.getOutputStream();
-            os.write(byteArrayOutputStream.toByteArray());
-
         } catch (DocumentException | IOException e) {
             e.printStackTrace();
         }
+        return null;
     }
 
     @Override

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

@@ -2,6 +2,7 @@ package org.springblade.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.Font;
@@ -13,6 +14,7 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.dto.TrialSampleInfoDTO;
+import org.springblade.business.entity.TrialMaterialMobilization;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.entity.TrialSamplingRecord;
 import org.springblade.business.excel.TrialSampleInfoExcel;
@@ -27,31 +29,49 @@ import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
+import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.DateUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.*;
+import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
-import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 @AllArgsConstructor
 public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoMapper, TrialSampleInfo> implements ITrialSampleInfoService {
 
     private final IUserClient iUserClient;
+    private final NewIOSSClient newIOSSClient;
     private final TrialSamplingRecordMapper trialSamplingRecordMapper;
 
+    @Override
+    public boolean sampleVerification(String specificationNumber, String id) {
+        List<TrialSampleInfo> list = baseMapper.selectList(Wrappers.<TrialSampleInfo>query().lambda());
+        if (StringUtils.isEmpty(id)) {
+            TrialSampleInfo trialSampleInfo = list.stream().filter(f -> f.getSpecificationNumber().equals(specificationNumber)).findAny().orElse(null);
+            return trialSampleInfo != null;
+        } else {
+            TrialSampleInfo trialSampleInfo = list.stream().filter(f -> f.getId().equals(Long.parseLong(id))).findAny().orElse(null);
+            assert trialSampleInfo != null;
+            if (!trialSampleInfo.getSpecificationNumber().equals(specificationNumber)) {
+                TrialSampleInfo trialSampleInfo1 = list.stream().filter(f -> f.getSpecificationNumber().equals(specificationNumber)).findAny().orElse(null);
+                return trialSampleInfo1 != null;
+            }
+            return false;
+        }
+    }
+
     @Override
     public TrialSampleInfo sampleDetail(Long id) {
         return baseMapper.selectById(id);
@@ -60,6 +80,9 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
     @Override
     public IPage<TrialSampleInfoVO> selectPage(IPage<TrialSampleInfo> page, TrialSampleInfoVO obj) {
         QueryWrapper<TrialSampleInfo> queryWrapper = Condition.getQueryWrapper(obj);
+        if (StringUtils.isNotEmpty(String.valueOf(obj.getNodeId()))) {
+            queryWrapper.lambda().eq(TrialSampleInfo::getNodeId, obj.getNodeId());
+        }
         if (StringUtils.isNotEmpty(obj.getStartTime()) && StringUtils.isNotEmpty(obj.getEndTime())) {
             String endTime = obj.getEndTime();
             endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd HH:mm:ss"), 1), "yyyy-MM-dd HH:mm:ss");
@@ -73,6 +96,20 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         IPage<TrialSampleInfo> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialSampleInfo::getCreateTime));
         IPage<TrialSampleInfoVO> trialMaterialMobilizationVOIPage = TrialSampleInfoWarpper.build().pageVO(pages);
         List<TrialSampleInfoVO> records = trialMaterialMobilizationVOIPage.getRecords();
+        List<TrialSamplingRecord> list = trialSamplingRecordMapper.selectAll();
+        List<User> userList = iUserClient.selectUserAll();
+        for (TrialSampleInfoVO record : records) {
+            for (User user : userList) {
+                if (record.getUserId().equals(user.getId())) {
+                    record.setUserName(user.getName());
+                }
+            }
+            for (TrialSamplingRecord trialSamplingRecord : list) {
+                if (record.getId().equals(trialSamplingRecord.getSampleInfoId())) {
+                    record.setMobilizationId(trialSamplingRecord.getMobilizationId());
+                }
+            }
+        }
         return trialMaterialMobilizationVOIPage.setRecords(records);
     }
 
@@ -97,23 +134,28 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
                 //删除旧记录
                 trialSamplingRecordMapper.deleteBySampleInfoId(obj.getId());
                 //新增记录
-                trialSamplingRecordMapper.insertRecord(SnowFlakeUtil.getId(),obj.getMobilizationId(),obj.getId());
+                trialSamplingRecordMapper.insertRecord(SnowFlakeUtil.getId(), obj.getMobilizationId(), obj.getId());
             }
         }
         return true;
     }
 
     @Override
-    public boolean sampleCopy(String ids) {
-        List<TrialSampleInfo> trialSampleInfos = baseMapper.selectBatchIds(Func.toLongList(ids));
-        for (TrialSampleInfo obj : trialSampleInfos) {
-            obj.setId(SnowFlakeUtil.getId());
+    public boolean sampleCopy(List<TrialSampleInfoDTO> dto) {
+        long count = dto.stream().map(TrialSampleInfoDTO::getSpecificationNumber).distinct().count();
+        if (count < dto.size()) {
+            throw new ServiceException("当前有数据的编号重复,请重新填写");
         }
-        return this.saveBatch(trialSampleInfos);
+        List<TrialSampleInfo> list = new ArrayList<>();
+        for (TrialSampleInfoDTO trialSampleInfoDTO : dto) {
+            trialSampleInfoDTO.setId(SnowFlakeUtil.getId());
+            list.add(trialSampleInfoDTO);
+        }
+        return this.saveBatch(list);
     }
 
     @Override
-    public void importSample(List<TrialSampleInfoExcel> data, Boolean isCovered) {
+    public void importSample(List<TrialSampleInfoExcel> data, Boolean isCovered, Long contractId) {
         List<TrialSampleInfo> list = new ArrayList<>();
         if (ObjectUtil.isEmpty(SecureUtil.getUserId())) {
             throw new ServiceException("获取用户信息失败");
@@ -122,6 +164,7 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
             TrialSampleInfo trialSampleInfo = BeanUtil.copyProperties(excel, TrialSampleInfo.class);
             assert trialSampleInfo != null;
             trialSampleInfo.setUserId(SecureUtil.getUserId());
+            trialSampleInfo.setContractId(contractId);
             list.add(trialSampleInfo);
         });
         if (isCovered) {
@@ -132,46 +175,70 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
     }
 
     @Override
-    public void sampleExportPdf(String ids, HttpServletResponse response) {
+    public String sampleExportPdf(String ids, HttpServletResponse response) {
         try {
             String fileName = java.net.URLEncoder.encode(DateUtil.time() + ".pdf", "UTF-8");
             response.reset();
-            response.setContentType("application/pdf; name=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
             response.setHeader("Content-Disposition", "inline; filename=" + java.net.URLEncoder.encode(fileName, "UTF-8"));
-            //构建字节输出流
-            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
 
             //构造数据
             List<TrialSampleInfo> list = baseMapper.selectBatchIds(Func.toLongList(ids));
-            List<TrialSampleInfoExcel> pdfData = new ArrayList<>();
+
+            //获取所有用户信息
+            List<User> userList = iUserClient.selectUserAll();
+
+            //删除旧PDF
+            List<String> pdfUrls = list.stream().map(TrialSampleInfo::getPdfUrl).distinct().collect(Collectors.toList());
+            for (String pdfUrl : pdfUrls) {
+                //格式 https: //xxx.com//upload/20221101/xxx.pdf
+                String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                newIOSSClient.removeFile(pdfName);
+            }
+
+            List<TrialSampleInfoVO> pdfData = new ArrayList<>();
             for (TrialSampleInfo trialSampleInfo : list) {
-                R<User> userR = iUserClient.userInfoById(trialSampleInfo.getUserId());
-                TrialSampleInfoExcel trialSampleInfoExcel = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoExcel.class);
-                assert trialSampleInfoExcel != null;
-                trialSampleInfoExcel.setUserName(userR.getData().getName());
-                pdfData.add(trialSampleInfoExcel);
+                for (User user : userList) {
+                    if (trialSampleInfo.getUserId().equals(user.getId())) {
+                        TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
+                        assert trialSampleInfoVO != null;
+                        trialSampleInfoVO.setUserName(user.getName());
+                        pdfData.add(trialSampleInfoVO);
+                    }
+                }
             }
 
             //创建文档,设置页面大小、左右上下边距
             Document document = new Document();
-
             BaseFont bfChinese = null;
+            String pdfUrl = null;
             //处理中文显示问题,使用资源字体
             if (SystemUtils.isWindows()) {
                 //windows
+                pdfUrl = "C:\\pdfFiles\\";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
                 bfChinese = BaseFont.createFont("C:/WINDOWS/Fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
             }
             if (SystemUtils.isLinux()) {
                 //linux
+                pdfUrl = "/home/pdfFiles";
+                File file = new File(pdfUrl);
+                if (!file.exists()) {
+                    file.mkdirs();
+                }
                 bfChinese = BaseFont.createFont("/usr/share/fonts/my-fonts/SIMYOU.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
             }
 
+            FileOutputStream fileOutputStream = new FileOutputStream(pdfUrl + fileName);
+
             //Font dateTitle = new Font(bfChinese, 7, Font.NORMAL);
             //Font title = new Font(bfChinese, 12, Font.BOLD);//文字加粗
             Font textFont = new Font(bfChinese, 7, Font.NORMAL);//文字正常
 
             //设置分页
-            PdfWriter.getInstance(document, byteArrayOutputStream);
+            PdfWriter.getInstance(document, fileOutputStream);
 
             //打开文档
             document.open();
@@ -207,11 +274,11 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
             document.add(tableTitle);
             document.add(new Paragraph("\n"));
 
-            String[] array = {"样名称", "取样日期", "样编号", "规格型号", "试样数量", "计算单位", "拟用部位", "代表数量", "取样人"};
+            String[] array = {"样名称", "取样日期", "样编号", "规格型号", "试样数量", "计算单位", "拟用部位", "代表数量", "取样人"};
             for (String s : array) {
                 PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
             }
-            for (TrialSampleInfoExcel pdfDatum : pdfData) {
+            for (TrialSampleInfoVO pdfDatum : pdfData) {
                 PDFUtil.createTableCell(pdfDatum.getMaterialName(), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(DateUtil.formatDate(pdfDatum.getSamplingDate()), textFont, table, lineHeight, colSpan);
                 PDFUtil.createTableCell(String.valueOf(pdfDatum.getId()), textFont, table, lineHeight, colSpan);
@@ -224,19 +291,40 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
             }
             document.add(table);
             document.close();
+
+            BladeFile bladeFile;
             try {
-                byteArrayOutputStream.close();
-            } catch (IOException e) {
+                document.close();
+                fileOutputStream.close();
+
+                //存储OSS
+                File file = new File(pdfUrl + fileName);
+                String canonicalPath = file.getCanonicalPath();
+                String name = file.getName();
+                bladeFile = newIOSSClient.uploadFile(name, canonicalPath);
+
+                //修改URL
+                for (TrialSampleInfo trialSampleInfo : list) {
+                    trialSampleInfo.setPdfUrl(bladeFile.getLink());
+                }
+                this.updateBatchById(list);
+
+                //删除本地缓存
+                if (file.exists()) {
+                    file.delete();
+                }
+
+                return bladeFile.getLink();
+
+            } catch (ClassCastException e) {
                 e.printStackTrace();
             }
 
-            //输出
-            ServletOutputStream os = response.getOutputStream();
-            os.write(byteArrayOutputStream.toByteArray());
-
         } catch (DocumentException | IOException e) {
             e.printStackTrace();
         }
+        return null;
     }
 
+
 }

+ 13 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -26,6 +26,7 @@ import org.springblade.manager.service.SaveUserInfoByProjectService;
 import org.springblade.manager.vo.*;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -507,5 +508,17 @@ public class ContractInfoController extends BladeController {
         return R.data(list);
     }
 
+    /**
+     * 获取当前合同段所有管理人员信息
+     */
+    @GetMapping("/get-contract-userList")
+    @ApiOperationSupport(order = 22)
+    @ApiOperation(value = "获取当前合同段所有管理人员信息", notes = "传入合同段id")
+    public R<List<UserContractInfoVO>> getContractUserInfo(@RequestParam String contractId) {
+        List<UserContractInfoVO> list = contractInfoService.getContractUserInfo(contractId);
+        return R.data(list);
+    }
+
+
 
 }

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java

@@ -4,11 +4,13 @@ import org.apache.ibatis.annotations.Param;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractRelationJlyz;
+import org.springblade.manager.entity.SaveUserInfoByProject;
 import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.vo.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.system.user.entity.User;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 
 import java.util.List;
@@ -74,5 +76,8 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     List<ContractInfo> selectContractIdByProjectId(String projectId);
 
+    List<SaveUserInfoByProject> selectContractUserInfo(String contractId);
+
+    List<UserContractInfoVO> userListByIds(@Param("ids") List<String> ids);
 
 }

+ 10 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -395,5 +395,15 @@
         ORDER BY d.create_time,d.sort
     </select>
 
+    <select id="selectContractUserInfo" resultType="org.springblade.manager.entity.SaveUserInfoByProject">
+        select * from m_project_assignment_user where contract_id = #{contractId} and is_deleted = 0 and status = 1
+    </select>
+
+    <select id="userListByIds" resultType="org.springblade.system.user.vo.UserContractInfoVO">
+        select id as userId,`name` as userName from blade_user where id in
+        <foreach collection="ids" item="ids" index="ids" open="(" separator="," close=")">
+            #{ids}
+        </foreach>
+    </select>
 
 </mapper>

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml

@@ -80,7 +80,7 @@
     </select>
 
     <select id="selectProjectList" resultMap="projectInfoResultMap">
-        select id, project_name, project_alias, project_number,is_open_random_number from m_project_info where is_deleted = 0 and id in
+        select * from m_project_info where is_deleted = 0 and id in
         <foreach collection="projectIds" item="projectId" open="(" separator="," close=")">
             #{projectId}
         </foreach>

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java

@@ -8,6 +8,7 @@ import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.vo.*;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.system.user.entity.User;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 
 
@@ -59,4 +60,6 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
 
     List<ContractRelationJlyz> searchContractRelationInfo(String contractId);
 
+    List<UserContractInfoVO> getContractUserInfo(String contractId);
+
 }

+ 11 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -14,10 +14,7 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
-import org.springblade.manager.entity.ContractInfo;
-import org.springblade.manager.entity.ContractRelationJlyz;
-import org.springblade.manager.entity.ProjectContractArea;
-import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.manager.entity.*;
 import org.springblade.manager.mapper.ProjectContractAreaMapper;
 import org.springblade.manager.mapper.SaveUserInfoByProjectMapper;
 import org.springblade.manager.mapper.WbsTreeContractMapper;
@@ -26,6 +23,8 @@ import org.springblade.manager.mapper.ContractInfoMapper;
 import org.springblade.manager.service.IContractInfoService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -40,6 +39,7 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper, ContractInfo> implements IContractInfoService {
 
+    private final IUserClient iUserClient;
     private final ContractInfoMapper contractInfoMapper;
     private final ProjectContractAreaMapper projectContractAreaMapper;
     private final SaveUserInfoByProjectMapper saveUserInfoByProjectMapper;
@@ -292,6 +292,13 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         return baseMapper.selectByContractRelationJlyz(Long.valueOf(contractId));
     }
 
+    @Override
+    public List<UserContractInfoVO> getContractUserInfo(String contractId) {
+        List<SaveUserInfoByProject> list = baseMapper.selectContractUserInfo(contractId);
+        List<String> userIds = list.stream().map(SaveUserInfoByProject::getUserId).distinct().collect(Collectors.toList());
+        return baseMapper.userListByIds(userIds);
+    }
+
     @Override
     public List<WbsTreeContractVO> tree2(String wbsId, String projectId, String contractId) {
         List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree3(wbsId, projectId, contractId, null, null);

+ 6 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

@@ -27,6 +27,7 @@ import org.springblade.system.user.entity.UserInfo;
 import org.springblade.system.user.entity.UserOauth;
 import org.springblade.system.user.enums.UserEnum;
 import org.springblade.system.user.service.IUserService;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -119,4 +120,9 @@ public class UserClient implements IUserClient {
         return service.updateUserRoleIdThree(userIds, roleIds);
     }
 
+    @Override
+    public List<User> selectUserAll() {
+        return service.selectUserAll();
+    }
+
 }

+ 1 - 1
blade-service/blade-user/src/main/java/org/springblade/system/user/mapper/UserMapper.java

@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.excel.UserExcel;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO;
 
 import java.util.List;
@@ -69,5 +70,4 @@ public interface UserMapper extends BaseMapper<User> {
 
     List<UserVO> selectUserListByCondition();
 
-
 }

+ 3 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/service/IUserService.java

@@ -29,6 +29,7 @@ import org.springblade.system.user.entity.UserInfo;
 import org.springblade.system.user.entity.UserOauth;
 import org.springblade.system.user.enums.UserEnum;
 import org.springblade.system.user.excel.UserExcel;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO;
 
 import java.util.List;
@@ -238,4 +239,6 @@ public interface IUserService extends BaseService<User> {
 
     List<UserVO> selectUserListByCondition();
 
+    List<User> selectUserAll();
+
 }

+ 7 - 6
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -58,6 +58,7 @@ import org.springblade.system.user.mapper.UserMapper;
 import org.springblade.system.user.service.IUserDeptService;
 import org.springblade.system.user.service.IUserOauthService;
 import org.springblade.system.user.service.IUserService;
+import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO;
 import org.springblade.system.user.wrapper.UserWrapper;
 import org.springframework.stereotype.Service;
@@ -645,7 +646,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
     public boolean updateUserRoleIdThree(List<String> userIds, String roleIds) {
         //获取userList
         List<User> userList = baseMapper.selectBatchIds(userIds);
-        userList.stream().forEach(user -> {
+        userList.forEach(user -> {
             if ((user.getRoleId() != null) && (!user.getRoleId().equals(""))) {
                 if (user.getRoleId().contains(roleIds)) {
                     String[] split = user.getRoleId().split(",");
@@ -655,11 +656,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                     } else {
                         replace = user.getRoleId().replace("," + roleIds, "");
                     }
-                        /*
-                        如果当前用户不同合同段引用相同角色,还存在至少一个正在使用的项目合同段角色,那么就保留User对应的RoleId
-                        例如:一个用户项目合同1、合同2下都使用administrator角色,那么删除合同2的administrator角色,对应UserRoleId字段保留administrator角色
-                        */
-                    //查询当前项目不同合同段中删除的角色是否存在多条引用同种角色,RoleId相同
                     List<SaveUserInfoByProjectDTO> list = saveUserInfoByProjectClient.searchUserInfoAndProject(String.valueOf(user.getId()), roleIds);
                     if (list.size() >= 2) {
                         //不删除,还有合同段引用中
@@ -681,4 +677,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
     public List<UserVO> selectUserListByCondition() {
         return baseMapper.selectUserListByCondition();
     }
+
+    @Override
+    public List<User> selectUserAll() {
+        return baseMapper.selectList(Wrappers.<User>query().lambda());
+    }
 }