소스 검색

Merge remote-tracking branch 'origin/master' into master

yangyj 2 년 전
부모
커밋
c5182bf280
33개의 변경된 파일1596개의 추가작업 그리고 122개의 파일을 삭제
  1. 3 3
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceInfo.java
  2. 89 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceOverhaul.java
  3. 109 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceUse.java
  4. 1 7
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO.java
  5. 39 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO2.java
  6. 27 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO3.java
  7. 44 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceOverhaulPageVO.java
  8. 44 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceUsePageVO.java
  9. 25 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSampleInfoVO2.java
  10. 23 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/TrialDeviceOverhaulWarpper.java
  11. 21 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/TrialDeviceUseWarpper.java
  12. 3 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceClassificationController.java
  13. 148 24
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceInfoController.java
  14. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialMaterialController.java
  15. 55 0
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceOverhaulExcel.java
  16. 60 0
      blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceUseExcel.java
  17. 2 3
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.xml
  18. 9 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceOverhaulMapper.java
  19. 28 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceOverhaulMapper.xml
  20. 13 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceUseMapper.java
  21. 35 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceUseMapper.xml
  22. 4 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceClassificationService.java
  23. 6 3
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceInfoService.java
  24. 24 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceOverhaulService.java
  25. 24 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDeviceUseService.java
  26. 4 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSampleInfoService.java
  27. 42 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceClassificationServiceImpl.java
  28. 47 33
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java
  29. 264 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java
  30. 289 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  31. 32 30
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java
  32. 21 14
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSampleInfoServiceImpl.java
  33. 59 0
      blade-service/blade-business/src/main/java/org/springblade/business/utils/CustomStringTypeHandler.java

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

@@ -56,11 +56,11 @@ public class TrialDeviceInfo extends BaseEntity {
     private String manufacturer;
 
     /**
-     * 生产日期
+     * 出厂日期
      */
-    @ApiModelProperty(value = "生产日期")
+    @ApiModelProperty(value = "出厂日期")
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date productionDate;
+    private Date factoryDate;
 
     /**
      * 出厂编号

+ 89 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceOverhaul.java

@@ -0,0 +1,89 @@
+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_overhaul")
+@EqualsAndHashCode(callSuper = true)
+public class TrialDeviceOverhaul 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 factoryNumber;
+
+    /**
+     * 维修/鉴定日期
+     */
+    @ApiModelProperty(value = "维修/鉴定日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date overhaulDate;
+
+    /**
+     * 维修/鉴定内容
+     */
+    @ApiModelProperty(value = "维修/鉴定内容")
+    private String overhaulText;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+
+    /**
+     * pdfURL
+     */
+    @ApiModelProperty(value = "pdfURL")
+    private String pdfUrl;
+
+}

+ 109 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/TrialDeviceUse.java

@@ -0,0 +1,109 @@
+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_use")
+@EqualsAndHashCode(callSuper = true)
+public class TrialDeviceUse 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;
+
+    /**
+     * 检测项目-试验树节点id
+     */
+    @ApiModelProperty(value = "检测项目-试验树节点id")
+    private Long nodeId;
+
+    /**
+     * 样品名称
+     */
+    @ApiModelProperty(value = "样品名称")
+    private String materialName;
+
+    /**
+     * 样品编号
+     */
+    @ApiModelProperty(value = "样品编号")
+    private String specificationNumber;
+
+    /**
+     * 出厂编号
+     */
+    @ApiModelProperty(value = "出厂编号")
+    private String factoryNumber;
+
+    /**
+     * 使用日期(起)
+     */
+    @ApiModelProperty(value = "使用日期(起)")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startDate;
+
+    /**
+     * 使用日期(止)
+     */
+    @ApiModelProperty(value = "使用日期(止)")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endDate;
+
+    /**
+     * 备注
+     */
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+    /**
+     * 排序
+     */
+    @ApiModelProperty(value = "排序")
+    private Integer sort;
+
+
+    /**
+     * pdfURL
+     */
+    @ApiModelProperty(value = "pdfURL")
+    private String pdfUrl;
+
+}

+ 1 - 7
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO.java

@@ -1,5 +1,6 @@
 package org.springblade.business.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.business.entity.TrialDeviceInfo;
@@ -45,17 +46,10 @@ public class TrialDeviceInfoVO extends TrialDeviceInfo {
     @ApiModelProperty(value = "购置日期 结束时间")
     private String endTime;
 
-    /**
-     * 试验室管理人员名称
-     */
-    @ApiModelProperty(value = "试验室管理人员名称")
-    private String managerName;
-
     /**
      * 设备分类名称
      */
     @ApiModelProperty(value = "设备分类名称")
     private String deviceClassName;
 
-
 }

+ 39 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO2.java

@@ -0,0 +1,39 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 试验设备VO
+ */
+@Data
+public class TrialDeviceInfoVO2 implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备分类id
+     */
+    @ApiModelProperty(value = "设备分类id")
+    private Long deviceClassId;
+
+    /**
+     * 设备分类名称
+     */
+    @ApiModelProperty(value = "设备分类名称")
+    private String deviceClassName;
+
+    /**
+     * 设备编号
+     */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceNumber;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+}

+ 27 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceInfoVO3.java

@@ -0,0 +1,27 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 试验设备VO
+ */
+@Data
+public class TrialDeviceInfoVO3 implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 设备编号
+     */
+    @ApiModelProperty(value = "设备编号")
+    private String deviceNumber;
+
+    /**
+     * 设备名称
+     */
+    @ApiModelProperty(value = "设备名称")
+    private String deviceName;
+
+}

+ 44 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceOverhaulPageVO.java

@@ -0,0 +1,44 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialDeviceOverhaul;
+
+
+/**
+ * 检修设备分页条件查询VO
+ */
+@Data
+public class TrialDeviceOverhaulPageVO extends TrialDeviceOverhaul {
+
+    /**
+     * 查询输入框 名称、型号
+     */
+    @ApiModelProperty(value = "查询输入框 名称、型号")
+    private String queryValue;
+
+    /**
+     * 检修/鉴定日期(起)
+     */
+    @ApiModelProperty(value = "检修/鉴定日期(起)")
+    private String startTime;
+
+    /**
+     * 检修/鉴定日期(止)
+     */
+    @ApiModelProperty(value = "检修/鉴定日期(止)")
+    private String endTime;
+
+    /**
+     * 检测试验项目名称
+     */
+    @ApiModelProperty(value = "检测试验项目名称")
+    private String nodeName;
+
+    /**
+     * 设备分类名称
+     */
+    @ApiModelProperty(value = "设备分类名称")
+    private String deviceClassName;
+
+}

+ 44 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDeviceUsePageVO.java

@@ -0,0 +1,44 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialDeviceUse;
+
+
+/**
+ * 使用设备分页条件查询VO
+ */
+@Data
+public class TrialDeviceUsePageVO extends TrialDeviceUse {
+
+    /**
+     * 查询输入框 名称、型号
+     */
+    @ApiModelProperty(value = "查询输入框 名称、型号")
+    private String queryValue;
+
+    /**
+     * 使用日期(起)
+     */
+    @ApiModelProperty(value = "使用日期(起)")
+    private String startTime;
+
+    /**
+     * 使用日期(止)
+     */
+    @ApiModelProperty(value = "使用日期(止)")
+    private String endTime;
+
+    /**
+     * 检测试验项目名称
+     */
+    @ApiModelProperty(value = "检测试验项目名称")
+    private String nodeName;
+
+    /**
+     * 设备分类名称
+     */
+    @ApiModelProperty(value = "设备分类名称")
+    private String deviceClassName;
+
+}

+ 25 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSampleInfoVO2.java

@@ -0,0 +1,25 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class TrialSampleInfoVO2 implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 样品名称
+     */
+    @ApiModelProperty(value = "样品名称")
+    private String materialName;
+
+    /**
+     * 样品编号
+     */
+    @ApiModelProperty(value = "样品编号")
+    private String specificationNumber;
+
+}

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

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

+ 21 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/TrialDeviceUseWarpper.java

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

+ 3 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceClassificationController.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.business.entity.TrialDeviceClassification;
 import org.springblade.business.service.ITrialDeviceClassificationService;
+import org.springblade.business.vo.TrialDeviceInfoVO2;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @AllArgsConstructor
@@ -44,12 +46,11 @@ public class TrialDeviceClassificationController extends BladeController {
     }
 
     @GetMapping("/class-remove")
-    @ApiOperationSupport(order = 3)
+    @ApiOperationSupport(order = 4)
     @ApiOperation(value = "分类删除", notes = "传入id")
     public R<Object> classRemove(@Valid @RequestParam String id) {
         return R.status(iTrialDeviceClassificationService.deleteLogic(Func.toLongList(id)));
     }
 
 
-
 }

+ 148 - 24
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDeviceInfoController.java

@@ -5,10 +5,17 @@ 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.TrialDeviceOverhaul;
+import org.springblade.business.excel.TrialDeviceOverhaulExcel;
+import org.springblade.business.excel.TrialDeviceUseExcel;
+import org.springblade.business.service.ITrialDeviceOverhaulService;
+import org.springblade.business.vo.*;
 import org.springblade.business.entity.TrialDeviceInfo;
+import org.springblade.business.entity.TrialDeviceUse;
 import org.springblade.business.excel.TrialDeviceInfoExcel;
 import org.springblade.business.service.ITrialDeviceInfoService;
-import org.springblade.business.vo.TrialDeviceInfoVO;
+import org.springblade.business.service.ITrialDeviceUseService;
+import org.springblade.business.service.ITrialSampleInfoService;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
@@ -23,61 +30,178 @@ import javax.validation.Valid;
 import java.util.List;
 
 @RestController
-@RequestMapping("/device/info")
+@RequestMapping("/device")
 @AllArgsConstructor
-@Api(value = "设备详情", tags = "设备详情接口")
+@Api(value = "设备管理", tags = "设备管理接口")
 public class TrialDeviceInfoController extends BladeController {
 
+    private final ITrialSampleInfoService iTrialSampleInfoService;
     private final ITrialDeviceInfoService iTrialDeviceInfoService;
+    private final ITrialDeviceUseService iTrialDeviceUseService;
+    private final ITrialDeviceOverhaulService iTrialDeviceOverhaulService;
 
-    @PostMapping("/submit")
+    @PostMapping("/mobilization/submit")
     @ApiOperationSupport(order = 1)
-    @ApiOperation(value = "新增或修改", notes = "传入TrialDeviceInfo对象")
+    @ApiOperation(value = "进场新增或修改", notes = "传入TrialDeviceInfo对象")
     public R<Object> submit(@Valid @RequestBody TrialDeviceInfo obj) {
         return R.status(iTrialDeviceInfoService.submit(obj));
     }
 
-    @GetMapping("/detail")
+    @GetMapping("/mobilization/detail")
     @ApiOperationSupport(order = 2)
-    @ApiOperation(value = "详情", notes = "传入id")
+    @ApiOperation(value = "进场详情", notes = "传入id")
     public R<TrialDeviceInfo> detail(@Valid @RequestBody Long id) {
         return R.data(iTrialDeviceInfoService.detail(id));
     }
 
-    @GetMapping("/remove")
+    @GetMapping("/mobilization/remove")
     @ApiOperationSupport(order = 3)
-    @ApiOperation(value = "批量删除", notes = "传入ids")
-    public R<Object> remove(@Valid @RequestBody String ids) {
+    @ApiOperation(value = "进场批量删除", notes = "传入ids")
+    public R<Object> remove(@Valid @RequestParam String ids) {
         return R.status(iTrialDeviceInfoService.deleteLogic(Func.toLongList(ids)));
     }
 
-    @GetMapping("/page")
+    @GetMapping("/mobilization/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));
+    @ApiOperation(value = "进场分页条件查询", notes = "传入Query、TrialDeviceInfoVO、合同段contractId")
+    public R<IPage<TrialDeviceInfoVO>> mobilizationPage(Query query, TrialDeviceInfoVO obj, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceInfoService.mobilizationPage(Condition.getPage(query), obj, contractId));
     }
 
-    @PostMapping("/print-pdf")
+    @PostMapping("/mobilization/print-pdf")
     @ApiOperationSupport(order = 5)
-    @ApiOperation(value = "打印PDF", notes = "传入ids")
-    public R printPdf(String ids, HttpServletResponse response) {
-        return R.data(iTrialDeviceInfoService.printPdf(ids, response));
+    @ApiOperation(value = "进场打印PDF", notes = "传入ids")
+    public R mobilizationPrintPdf(@RequestParam String ids, HttpServletResponse response, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceInfoService.mobilizationPrintPdf(ids, response, contractId));
     }
 
-    @PostMapping("/read-excel")
+    @PostMapping("/mobilization/read-excel")
     @ApiOperationSupport(order = 6)
-    @ApiOperation(value = "读取excel数据", notes = "传入excel")
+    @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")
+    @PostMapping("/mobilization/import-batch")
     @ApiOperationSupport(order = 7)
-    @ApiOperation(value = "导入设备数据保存", notes = "传入List<TrialDeviceInfoExcel>")
-    public R<Object> saveBatchDeviceInfo(@RequestBody List<TrialDeviceInfoExcel> list) {
-        return R.status(iTrialDeviceInfoService.saveBatchDeviceInfo(list));
+    @ApiOperation(value = "进场设备导入数据保存", notes = "传入List<TrialDeviceInfoExcel>、合同段contractId")
+    public R<Object> importBatchDeviceInfo(@RequestBody List<TrialDeviceInfoExcel> list, @RequestParam Long contractId) {
+        return R.status(iTrialDeviceInfoService.saveBatchDeviceInfo(list, contractId));
+    }
+
+    @GetMapping("/use/device-list")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "使用/检修-根据设备分类id查询设备编号名称", notes = "传入deviceClassId")
+    public R<List<TrialDeviceInfoVO3>> useDeviceList(@Valid @RequestParam Long deviceClassId) {
+        return R.data(iTrialDeviceInfoService.useDeviceList(deviceClassId));
+    }
+
+    @GetMapping("/use/sample-list")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "使用-根据节点id查询样品编号名称", notes = "传入节点id")
+    public R<List<TrialSampleInfoVO2>> useSampleList(@Valid @RequestParam Long nodeId) {
+        return R.data(iTrialSampleInfoService.useDeviceList(nodeId));
+    }
+
+    @GetMapping("/use/detail")
+    @ApiOperationSupport(order = 10)
+    @ApiOperation(value = "使用设备详情", notes = "传入id")
+    public R<TrialDeviceUse> useDetail(@Valid @RequestParam Long id) {
+        return R.data(iTrialDeviceUseService.useDetail(id));
+    }
+
+    @GetMapping("/use/submit")
+    @ApiOperationSupport(order = 11)
+    @ApiOperation(value = "使用设备新增或修改", notes = "传入id")
+    public R<Object> useSubmit(@RequestBody TrialDeviceUse obj) {
+        return R.status(iTrialDeviceUseService.useSubmit(obj));
+    }
+
+    @GetMapping("/use/remove")
+    @ApiOperationSupport(order = 12)
+    @ApiOperation(value = "使用设备批量删除", notes = "传入ids")
+    public R<Object> useRemove(@Valid @RequestParam String ids) {
+        return R.status(iTrialDeviceUseService.deleteLogic(Func.toLongList(ids)));
+    }
+
+    @GetMapping("/use/page")
+    @ApiOperationSupport(order = 13)
+    @ApiOperation(value = "使用设备分页条件查询", notes = "传入Query,TrialDeviceUsePageVO、项目projectId、合同段contractId")
+    public R<IPage<TrialDeviceUsePageVO>> usePage(Query query, TrialDeviceUsePageVO vo, @RequestParam Long projectId, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceUseService.usePage(Condition.getPage(query), vo, projectId, contractId));
+    }
+
+    @GetMapping("/use/print-pdf")
+    @ApiOperationSupport(order = 14)
+    @ApiOperation(value = "使用设备打印PDF", notes = "传入ids、项目projectId、合同段contractId")
+    public R<Object> usePrintPdf(@RequestParam String ids, @RequestParam String projectId, HttpServletResponse response, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceUseService.usePrintPdf(ids, projectId, response, contractId));
+    }
+
+    @PostMapping("/use/read-excel")
+    @ApiOperationSupport(order = 15)
+    @ApiOperation(value = "使用设备读取excel数据", notes = "传入excel")
+    public R<List<TrialDeviceUseExcel>> readUseExcel(MultipartFile file) {
+        List<TrialDeviceUseExcel> list = ExcelUtil.read(file, TrialDeviceUseExcel.class);
+        return R.data(list);
+    }
+
+    @PostMapping("/use/import-batch")
+    @ApiOperationSupport(order = 16)
+    @ApiOperation(value = "使用设备导入数据保存", notes = "传入List<TrialDeviceUseExcel>、项目id、合同段id")
+    public R<Object> importBatchDeviceUse(@RequestBody List<TrialDeviceUseExcel> list, @RequestParam Long projectId, @RequestParam Long contractId) {
+        return R.status(iTrialDeviceUseService.importBatchDeviceUse(list, projectId, contractId));
+    }
+
+    @GetMapping("/overhaul/detail")
+    @ApiOperationSupport(order = 17)
+    @ApiOperation(value = "检修设备详情", notes = "传入id")
+    public R<TrialDeviceOverhaul> overhaulDetail(@Valid @RequestParam Long id) {
+        return R.data(iTrialDeviceOverhaulService.overhaulDetail(id));
+    }
+
+    @GetMapping("/overhaul/submit")
+    @ApiOperationSupport(order = 18)
+    @ApiOperation(value = "检修设备新增或修改", notes = "传入TrialDeviceOverhaul对象")
+    public R<Object> overhaulSubmit(@RequestBody TrialDeviceOverhaul obj) {
+        return R.status(iTrialDeviceOverhaulService.overhaulSubmit(obj));
+    }
+
+    @GetMapping("/overhaul/remove")
+    @ApiOperationSupport(order = 19)
+    @ApiOperation(value = "检修设备批量删除", notes = "传入ids")
+    public R<Object> overhaulRemove(@Valid @RequestParam String ids) {
+        return R.status(iTrialDeviceOverhaulService.deleteLogic(Func.toLongList(ids)));
+    }
+
+    @GetMapping("/overhaul/page")
+    @ApiOperationSupport(order = 20)
+    @ApiOperation(value = "检修设备分页条件查询", notes = "传入Query、TrialDeviceOverhaulPageVO、合同段contractId")
+    public R<IPage<TrialDeviceOverhaulPageVO>> overhaulPage(Query query, TrialDeviceOverhaulPageVO vo, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceOverhaulService.overhaulPage(Condition.getPage(query), vo, contractId));
+    }
+
+    @GetMapping("/overhaul/print-pdf")
+    @ApiOperationSupport(order = 21)
+    @ApiOperation(value = "检修设备打印PDF", notes = "传入ids、合同段contractId")
+    public R<Object> overhaulPrintPdf(@RequestParam String ids, HttpServletResponse response, @RequestParam Long contractId) {
+        return R.data(iTrialDeviceOverhaulService.overhaulPrintPdf(ids, response, contractId));
+    }
+
+    @PostMapping("/overhaul/read-excel")
+    @ApiOperationSupport(order = 22)
+    @ApiOperation(value = "检修设备读取excel数据", notes = "传入excel")
+    public R<List<TrialDeviceOverhaulExcel>> readOverhaulExcel(MultipartFile file) {
+        List<TrialDeviceOverhaulExcel> list = ExcelUtil.read(file, TrialDeviceOverhaulExcel.class);
+        return R.data(list);
+    }
+
+    @PostMapping("/overhaul/import-batch")
+    @ApiOperationSupport(order = 23)
+    @ApiOperation(value = "检修设备导入数据保存", notes = "传入List<TrialDeviceOverhaulExcel>、合同段contractId")
+    public R<Object> importBatchDeviceOverhaul(@RequestBody List<TrialDeviceOverhaulExcel> list, @RequestParam Long contractId) {
+        return R.status(iTrialDeviceOverhaulService.importBatchDeviceUse(list, contractId));
     }
 
 

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

@@ -166,8 +166,8 @@ public class TrialMaterialController extends BladeController {
     @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));
+    public R<Object> sampleVerification(@Valid @RequestParam String specificationNumber, @RequestParam String id) {
+        return R.data(iTrialSampleInfoService.sampleVerification(specificationNumber, id));
     }
 
 }

+ 55 - 0
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceOverhaulExcel.java

@@ -0,0 +1,55 @@
+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.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.io.Serializable;
+import java.util.Date;
+
+
+@Data
+@ColumnWidth(16)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class TrialDeviceOverhaulExcel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ExcelProperty("设备名称")
+    private String deviceName;
+
+    @ExcelProperty("设备分类名称")
+    private String deviceClassName;
+
+    @ExcelProperty("设备编号")
+    private String deviceNumber;
+
+    @ExcelProperty("设备型号")
+    private String deviceModel;
+
+    @ExcelProperty("出厂编号")
+    private String factoryNumber;
+
+    @ExcelProperty("维修/鉴定日期")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date overhaulDate;
+
+    @ExcelProperty("维修/鉴定内容")
+    private String overhaulText;
+
+    @ExcelProperty("维修/鉴定人")
+    private String managerName;
+
+    @ExcelProperty("备注")
+    private String remarks;
+
+}

+ 60 - 0
blade-service/blade-business/src/main/java/org/springblade/business/excel/TrialDeviceUseExcel.java

@@ -0,0 +1,60 @@
+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 io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@ColumnWidth(16)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class TrialDeviceUseExcel implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ExcelProperty("使用人员名称")
+    private String managerName;
+
+    @ExcelProperty("设备名称")
+    private String deviceName;
+
+    @ExcelProperty("设备分类名称")
+    private String deviceClassName;
+
+    @ExcelProperty("设备编号")
+    private String deviceNumber;
+
+    @ExcelProperty("设备型号")
+    private String deviceModel;
+
+    @ExcelProperty("出厂编号")
+    private String factoryNumber;
+
+    @ExcelProperty("使用日期(起")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startDate;
+
+    @ExcelProperty("使用日期(止)")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endDate;
+
+    @ExcelProperty("检测试验项目")
+    private String nodeName;
+
+    @ExcelProperty("样品名称")
+    private String materialName;
+
+    @ExcelProperty("样品编号")
+    private String specificationNumber;
+
+    @ExcelProperty("备注")
+    private String remarks;
+
+}

+ 2 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceInfoMapper.xml

@@ -5,14 +5,13 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialDeviceInfo">
         <result column="id" property="id"/>
-        <result column="manager_id" property="managerId"/>
+        <result column="manager_name" property="managerName"/>
         <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_date" property="factoryDate"/>
         <result column="factory_number" property="factoryNumber"/>
         <result column="equipment_acquisition_number" property="equipmentAcquisitionNumber"/>
         <result column="mobilization_date" property="mobilizationDate"/>

+ 9 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceOverhaulMapper.java

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

+ 28 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceOverhaulMapper.xml

@@ -0,0 +1,28 @@
+<?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.TrialDeviceOverhaulMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialDeviceOverhaul">
+        <result column="id" property="id"/>
+        <result column="manager_name" property="managerName"/>
+        <result column="device_class_id" property="deviceClassId"/>
+        <result column="device_name" property="deviceName"/>
+        <result column="device_number" property="deviceNumber"/>
+        <result column="device_model" property="deviceModel"/>
+        <result column="factory_number" property="factoryNumber"/>
+        <result column="overhaul_date" property="overhaulDate"/>
+        <result column="overhaul_text" property="overhaulText"/>
+        <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"/>
+        <result column="pdf_url" property="pdfUrl"/>
+    </resultMap>
+
+</mapper>

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceUseMapper.java

@@ -0,0 +1,13 @@
+package org.springblade.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.business.entity.TrialDeviceUse;
+import org.springblade.manager.entity.WbsTreePrivate;
+
+import java.util.List;
+
+public interface TrialDeviceUseMapper extends BaseMapper<TrialDeviceUse> {
+
+    List<WbsTreePrivate> selectTrialTreeAll(String projectId, Integer wbsType);
+
+}

+ 35 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialDeviceUseMapper.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.TrialDeviceUseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="ResultEntityMap" type="org.springblade.business.entity.TrialDeviceUse">
+        <result column="id" property="id"/>
+        <result column="manager_name" property="managerName"/>
+        <result column="device_class_id" property="deviceClassId"/>
+        <result column="device_name" property="deviceName"/>
+        <result column="device_number" property="deviceNumber"/>
+        <result column="device_model" property="deviceModel"/>
+        <result column="node_id" property="nodeId"/>
+        <result column="material_name" property="materialName"/>
+        <result column="specification_number" property="specificationNumber"/>
+        <result column="factory_number" property="factoryNumber"/>
+        <result column="start_date" property="startDate"/>
+        <result column="end_date" property="endDate"/>
+        <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"/>
+        <result column="pdf_url" property="pdfUrl"/>
+    </resultMap>
+
+    <select id="selectTrialTreeAll" resultType="org.springblade.manager.entity.WbsTreePrivate">
+        select * from m_wbs_tree_private where project_id = #{projectId} and wbs_type = 2 and status = 1 and is_deleted = 0
+    </select>
+
+</mapper>

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

@@ -1,9 +1,11 @@
 package org.springblade.business.service;
 
 import org.springblade.business.entity.TrialDeviceClassification;
+import org.springblade.business.vo.TrialSampleInfoVO2;
 import org.springblade.core.mp.base.BaseService;
 
 import java.util.List;
+import java.util.Map;
 
 public interface ITrialDeviceClassificationService extends BaseService<TrialDeviceClassification> {
 
@@ -13,4 +15,6 @@ public interface ITrialDeviceClassificationService extends BaseService<TrialDevi
 
     List<TrialDeviceClassification> classList(Long contractId);
 
+    List<Map<String, Object>> classDeviceInfoAll(Long contractId);
+
 }

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

@@ -4,6 +4,7 @@ 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.business.vo.TrialDeviceInfoVO3;
 import org.springblade.core.mp.base.BaseService;
 
 import javax.servlet.http.HttpServletResponse;
@@ -15,10 +16,12 @@ public interface ITrialDeviceInfoService extends BaseService<TrialDeviceInfo> {
 
     TrialDeviceInfo detail(Long id);
 
-    IPage<TrialDeviceInfoVO> selectPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj);
+    IPage<TrialDeviceInfoVO> mobilizationPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj, Long contractId);
 
-    String printPdf(String ids, HttpServletResponse response);
+    String mobilizationPrintPdf(String ids, HttpServletResponse response, Long contractId);
 
-    boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list);
+    boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list, Long contractId);
+
+    List<TrialDeviceInfoVO3> useDeviceList(Long deviceClassId);
 
 }

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

@@ -0,0 +1,24 @@
+package org.springblade.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.entity.TrialDeviceOverhaul;
+import org.springblade.business.excel.TrialDeviceOverhaulExcel;
+import org.springblade.business.vo.TrialDeviceOverhaulPageVO;
+import org.springblade.core.mp.base.BaseService;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface ITrialDeviceOverhaulService extends BaseService<TrialDeviceOverhaul> {
+
+    TrialDeviceOverhaul overhaulDetail(Long id);
+
+    boolean overhaulSubmit(TrialDeviceOverhaul obj);
+
+    IPage<TrialDeviceOverhaulPageVO> overhaulPage(IPage<TrialDeviceOverhaul> page, TrialDeviceOverhaulPageVO vo, Long contractId);
+
+    String overhaulPrintPdf(String ids, HttpServletResponse response, Long contractId);
+
+    boolean importBatchDeviceUse(List<TrialDeviceOverhaulExcel> list, Long contractId);
+    
+}

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

@@ -0,0 +1,24 @@
+package org.springblade.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.excel.TrialDeviceUseExcel;
+import org.springblade.business.vo.TrialDeviceUsePageVO;
+import org.springblade.business.entity.TrialDeviceUse;
+import org.springblade.core.mp.base.BaseService;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface ITrialDeviceUseService extends BaseService<TrialDeviceUse> {
+
+    TrialDeviceUse useDetail(Long id);
+
+    boolean useSubmit(TrialDeviceUse obj);
+
+    IPage<TrialDeviceUsePageVO> usePage(IPage<TrialDeviceUse> page, TrialDeviceUsePageVO dto, Long projectId, Long contractId);
+
+    String usePrintPdf(String ids, String projectId, HttpServletResponse response, Long contractId);
+
+    boolean importBatchDeviceUse(List<TrialDeviceUseExcel> list, Long projectId, Long contractId);
+
+}

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSampleInfoService.java

@@ -5,6 +5,7 @@ import org.springblade.business.dto.TrialSampleInfoDTO;
 import org.springblade.business.entity.TrialSampleInfo;
 import org.springblade.business.excel.TrialSampleInfoExcel;
 import org.springblade.business.vo.TrialSampleInfoVO;
+import org.springblade.business.vo.TrialSampleInfoVO2;
 import org.springblade.core.mp.base.BaseService;
 
 import javax.servlet.http.HttpServletResponse;
@@ -24,6 +25,8 @@ public interface ITrialSampleInfoService extends BaseService<TrialSampleInfo> {
 
     String sampleExportPdf(String ids, HttpServletResponse response);
 
-    boolean sampleVerification(String specificationNumber,String id);
+    boolean sampleVerification(String specificationNumber, String id);
+
+    List<TrialSampleInfoVO2> useDeviceList(Long nodeId);
 
 }

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

@@ -3,16 +3,26 @@ 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.entity.TrialDeviceInfo;
 import org.springblade.business.mapper.TrialDeviceClassificationMapper;
+import org.springblade.business.mapper.TrialDeviceInfoMapper;
 import org.springblade.business.service.ITrialDeviceClassificationService;
+import org.springblade.business.vo.TrialDeviceInfoVO2;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 @AllArgsConstructor
 public class TrialDeviceClassificationServiceImpl extends BaseServiceImpl<TrialDeviceClassificationMapper, TrialDeviceClassification> implements ITrialDeviceClassificationService {
+
+    private final TrialDeviceInfoMapper trialDeviceInfoMapper;
+
     @Override
     public boolean classSubmit(TrialDeviceClassification obj) {
         return this.saveOrUpdate(obj);
@@ -30,4 +40,36 @@ public class TrialDeviceClassificationServiceImpl extends BaseServiceImpl<TrialD
                 .eq(TrialDeviceClassification::getStatus, 1).orderBy(true, true, TrialDeviceClassification::getCreateTime));
     }
 
+    @Override
+    public List<Map<String, Object>> classDeviceInfoAll(Long contractId) {
+        //查询当前合同段下的设备分类信息
+        List<TrialDeviceClassification> deviceClassificationAllList = baseMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda()
+                .eq(TrialDeviceClassification::getContractId, contractId));
+
+        //查询所有设备信息
+        List<TrialDeviceInfo> deviceInfoAllList = trialDeviceInfoMapper.selectList(Wrappers.<TrialDeviceInfo>query().lambda());
+
+        //构造
+        List<TrialDeviceInfoVO2> list = new ArrayList<>();
+        for (TrialDeviceClassification classification : deviceClassificationAllList) {
+            for (TrialDeviceInfo trialDeviceInfo : deviceInfoAllList) {
+                if (trialDeviceInfo.getDeviceClassId().equals(classification.getId())) {
+                    TrialDeviceInfoVO2 obj = new TrialDeviceInfoVO2();
+                    obj.setDeviceClassId(classification.getId());
+                    obj.setDeviceClassName(classification.getClassName());
+                    obj.setDeviceNumber(trialDeviceInfo.getDeviceNumber());
+                    obj.setDeviceName(trialDeviceInfo.getDeviceName());
+                    list.add(obj);
+                }
+            }
+        }
+        Map<String, List<TrialDeviceInfoVO2>> collect = list.stream().collect(Collectors.groupingBy(TrialDeviceInfoVO2::getDeviceClassName));
+        return collect.entrySet().stream().map(entity -> {
+            Map<String, Object> resultMap = new HashMap<>();
+            resultMap.put("deviceClassName", entity.getKey());
+            resultMap.put("deviceInfos", entity.getValue());
+            return resultMap;
+        }).collect(Collectors.toList());
+    }
+
 }

+ 47 - 33
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceInfoServiceImpl.java

@@ -15,8 +15,6 @@ 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;
@@ -24,6 +22,7 @@ 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.vo.TrialDeviceInfoVO3;
 import org.springblade.business.wrapper.TrialDeviceInfoWarpper;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
@@ -33,12 +32,9 @@ 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;
@@ -57,7 +53,8 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
     public boolean submit(TrialDeviceInfo obj) {
         if (ObjectUtil.isNotEmpty(obj.getId())) {
             TrialDeviceInfo trialDeviceInfo = baseMapper.selectById(obj.getId());
-            if (!trialDeviceInfo.getLastCalibrationTime().equals(obj.getLastCalibrationTime())) {
+            if (ObjectUtil.isNotEmpty(trialDeviceInfo.getLastCalibrationTime()) && ObjectUtil.isNotEmpty(obj.getLastCalibrationTime())
+                    && !trialDeviceInfo.getLastCalibrationTime().equals(obj.getLastCalibrationTime())) {
                 //如果修改了最近校验时间,那么每次编辑默认修改校验为0=否
                 obj.setIsCalibration(0);
             }
@@ -71,7 +68,10 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
     }
 
     @Override
-    public IPage<TrialDeviceInfoVO> selectPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj) {
+    public IPage<TrialDeviceInfoVO> mobilizationPage(IPage<TrialDeviceInfo> page, TrialDeviceInfoVO obj, Long contractId) {
+        //获取设备分类信息
+        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+
         QueryWrapper<TrialDeviceInfo> queryWrapper = Condition.getQueryWrapper(obj);
         if (ObjectUtil.isNotEmpty(obj.getDeviceClassId())) {
             queryWrapper.lambda().eq(TrialDeviceInfo::getDeviceClassId, obj.getDeviceClassId());
@@ -88,17 +88,24 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
         }
         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");
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
             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();
+        for (TrialDeviceInfoVO record : records) {
+            for (TrialDeviceClassification deviceClassification : deviceClassifications) {
+                if (record.getDeviceClassId().equals(deviceClassification.getId())) {
+                    record.setDeviceClassName(deviceClassification.getClassName());
+                }
+            }
+        }
         return trialDeviceInfoVOIPage.setRecords(records);
     }
 
     @Override
-    public String printPdf(String ids, HttpServletResponse response) {
+    public String mobilizationPrintPdf(String ids, HttpServletResponse response, Long contractId) {
         try {
             String fileName = java.net.URLEncoder.encode(DateUtil.time() + ".pdf", "UTF-8");
             response.reset();
@@ -107,14 +114,16 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
             //构造数据
             List<TrialDeviceInfo> pdfData = baseMapper.selectBatchIds(Func.toLongList(ids));
             //获取设备分类数据
-            List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda());
+            List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
 
             //删除旧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);
+                if (StringUtils.isNotEmpty(pdfUrl)) {
+                    String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                    newIOSSClient.removeFile(pdfName);
+                }
             }
 
             //创建文档,设置页面大小、左右上下边距
@@ -156,7 +165,7 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
 
             //标题
             PdfPTable tableTitle = new PdfPTable(3);
-            //生成一个9列的表格
+            //生成一个18列的表格
             PdfPTable table = new PdfPTable(18);
 
             //定义每个单元格的宽度
@@ -191,27 +200,27 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
                 PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
             }
             for (TrialDeviceInfo pdfDatum : pdfData) {
+                PDFUtil.createTableCell(String.valueOf(pdfDatum.getId()), textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(pdfDatum.getDeviceName(), textFont, table, lineHeight, colSpan);
                 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);
                 }
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceNumber()) ? pdfDatum.getDeviceNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceModel()) ? pdfDatum.getDeviceModel() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManufacturer()) ? pdfDatum.getManufacturer() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getFactoryDate()) ? pdfDatum.getFactoryDate().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getFactoryNumber()) ? pdfDatum.getFactoryNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getEquipmentAcquisitionNumber()) ? pdfDatum.getEquipmentAcquisitionNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getAccuracy()) ? pdfDatum.getAccuracy() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMeasuringRange()) ? pdfDatum.getMeasuringRange() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getLastCalibrationTime()) ? 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(ObjectUtil.isNotEmpty(pdfDatum.getEquipmentAcquisitionNumber()) ? pdfDatum.getEquipmentAcquisitionNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManagerName()) ? pdfDatum.getManagerName() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRemarks()) ? pdfDatum.getRemarks() : "", textFont, table, lineHeight, colSpan);
             }
 
             document.add(table);
@@ -251,8 +260,8 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
     }
 
     @Override
-    public boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list) {
-        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda());
+    public boolean saveBatchDeviceInfo(List<TrialDeviceInfoExcel> list, Long contractId) {
+        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
         List<TrialDeviceInfo> listData = new ArrayList<>();
         for (TrialDeviceInfoExcel trialDeviceInfoExcel : list) {
             for (TrialDeviceClassification deviceClassification : deviceClassifications) {
@@ -265,8 +274,13 @@ public class TrialDeviceInfoServiceImpl extends BaseServiceImpl<TrialDeviceInfoM
                 }
             }
         }
-        this.saveBatch(listData);
-        return true;
+        return this.saveBatch(listData, 1000);
+    }
+
+    @Override
+    public List<TrialDeviceInfoVO3> useDeviceList(Long deviceClassId) {
+        List<TrialDeviceInfo> deviceInfos = baseMapper.selectList(Wrappers.<TrialDeviceInfo>query().lambda().eq(TrialDeviceInfo::getDeviceClassId, deviceClassId));
+        return BeanUtil.copyProperties(deviceInfos, TrialDeviceInfoVO3.class);
     }
 
 

+ 264 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceOverhaulServiceImpl.java

@@ -0,0 +1,264 @@
+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.TrialDeviceOverhaul;
+import org.springblade.business.entity.TrialDeviceUse;
+import org.springblade.business.excel.TrialDeviceOverhaulExcel;
+import org.springblade.business.excel.TrialDeviceUseExcel;
+import org.springblade.business.mapper.TrialDeviceClassificationMapper;
+import org.springblade.business.mapper.TrialDeviceOverhaulMapper;
+import org.springblade.business.service.ITrialDeviceOverhaulService;
+import org.springblade.business.utils.PDFUtil;
+import org.springblade.business.utils.SystemUtils;
+import org.springblade.business.vo.TrialDeviceOverhaulPageVO;
+import org.springblade.business.wrapper.TrialDeviceOverhaulWarpper;
+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.manager.entity.WbsTreePrivate;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletResponse;
+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 TrialDeviceOverhaulServiceImpl extends BaseServiceImpl<TrialDeviceOverhaulMapper, TrialDeviceOverhaul> implements ITrialDeviceOverhaulService {
+
+    private final TrialDeviceClassificationMapper trialDeviceClassificationMapper;
+    private final NewIOSSClient newIOSSClient;
+
+    @Override
+    public TrialDeviceOverhaul overhaulDetail(Long id) {
+        return baseMapper.selectById(id);
+    }
+
+    @Override
+    public boolean overhaulSubmit(TrialDeviceOverhaul obj) {
+        return this.saveOrUpdate(obj);
+    }
+
+    @Override
+    public IPage<TrialDeviceOverhaulPageVO> overhaulPage(IPage<TrialDeviceOverhaul> page, TrialDeviceOverhaulPageVO dto, Long contractId) {
+        //获取设备分类数据
+        List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+
+        QueryWrapper<TrialDeviceOverhaul> queryWrapper = Condition.getQueryWrapper(dto);
+        if (ObjectUtil.isNotEmpty(dto.getDeviceClassId())) {
+            queryWrapper.lambda().eq(TrialDeviceOverhaul::getDeviceClassId, dto.getDeviceClassId());
+        }
+        if (ObjectUtil.isNotEmpty(dto.getQueryValue())) {
+            queryWrapper.lambda().like(TrialDeviceOverhaul::getDeviceName, dto.getDeviceName());
+            queryWrapper.lambda().or().like(TrialDeviceOverhaul::getDeviceModel, dto.getDeviceModel());
+        }
+        if (StringUtils.isNotEmpty(dto.getStartTime()) && StringUtils.isNotEmpty(dto.getEndTime())) {
+            String endTime = dto.getEndTime();
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
+            queryWrapper.lambda().between(TrialDeviceOverhaul::getOverhaulDate, dto.getStartTime(), endTime);
+        }
+        IPage<TrialDeviceOverhaul> resultPage = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialDeviceOverhaul::getCreateTime));
+        IPage<TrialDeviceOverhaulPageVO> trialDeviceOverhaulPageVOIPage = TrialDeviceOverhaulWarpper.build().pageVO(resultPage);
+        List<TrialDeviceOverhaulPageVO> records = trialDeviceOverhaulPageVOIPage.getRecords();
+        for (TrialDeviceOverhaulPageVO record : records) {
+            for (TrialDeviceClassification classification : deviceClassificationList) {
+                if (record.getDeviceClassId().equals(classification.getId())) {
+                    record.setDeviceClassName(classification.getClassName());
+                }
+            }
+        }
+        return trialDeviceOverhaulPageVOIPage.setRecords(records);
+    }
+
+    @Override
+    public String overhaulPrintPdf(String ids, HttpServletResponse response, Long contractId) {
+        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<TrialDeviceOverhaul> pdfData = baseMapper.selectBatchIds(Func.toLongList(ids));
+            //获取设备分类数据
+            List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+
+            //删除旧PDF
+            List<String> pdfUrls = pdfData.stream().map(TrialDeviceOverhaul::getPdfUrl).distinct().collect(Collectors.toList());
+            for (String pdfUrl : pdfUrls) {
+                //格式 https: //xxx.com//upload/20221101/xxx.pdf
+                if (StringUtils.isNotEmpty(pdfUrl)) {
+                    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);
+            //生成一个10列的表格
+            PdfPTable table = new PdfPTable(10);
+
+            //定义每个单元格的宽度
+            float[] widthsHeaderTitle = {1f, 1f, 1f};
+            float[] widthsHeader = {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 = {"序号", "设备名称", "设备分类", "设备编号", "设备型号", "出厂编号", "维修/鉴定日期", "维修/鉴定内容", "维修/鉴定人", "备注"};
+            for (String s : array) {
+                PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
+            }
+            for (TrialDeviceOverhaul pdfDatum : pdfData) {
+                PDFUtil.createTableCell(String.valueOf(pdfDatum.getId()), textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(pdfDatum.getDeviceName(), textFont, table, lineHeight, colSpan);
+                for (TrialDeviceClassification classification : deviceClassificationList) {
+                    if (classification.getId().equals(pdfDatum.getDeviceClassId())) {
+                        PDFUtil.createTableCell(classification.getClassName(), textFont, table, lineHeight, colSpan);
+                    }
+                }
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceNumber()) ? pdfDatum.getDeviceNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceModel()) ? pdfDatum.getDeviceModel() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getFactoryNumber()) ? pdfDatum.getFactoryNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getOverhaulDate()) ? pdfDatum.getOverhaulDate().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getOverhaulText()) ? pdfDatum.getOverhaulText() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManagerName()) ? pdfDatum.getManagerName() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRemarks()) ? 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 (TrialDeviceOverhaul trialDeviceOverhaul : pdfData) {
+                    trialDeviceOverhaul.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 importBatchDeviceUse(List<TrialDeviceOverhaulExcel> list, Long contractId) {
+        //获取当前合同段的设备分类
+        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+
+        List<TrialDeviceOverhaul> listData = new ArrayList<>();
+        for (TrialDeviceOverhaulExcel trialDeviceOverhaulExcel : list) {
+            TrialDeviceOverhaul trialDeviceOverhaul = BeanUtil.copyProperties(trialDeviceOverhaulExcel, TrialDeviceOverhaul.class);
+            //设备分类id
+            for (TrialDeviceClassification classification : deviceClassifications) {
+                if (trialDeviceOverhaulExcel.getDeviceClassName().equals(classification.getClassName())) {
+                    if (trialDeviceOverhaul != null) {
+                        trialDeviceOverhaul.setDeviceClassId(classification.getId());
+                        break;
+                    }
+                }
+            }
+            listData.add(trialDeviceOverhaul);
+        }
+        return this.saveBatch(listData, 1000);
+    }
+
+}

+ 289 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java

@@ -0,0 +1,289 @@
+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.excel.TrialDeviceUseExcel;
+import org.springblade.business.mapper.TrialDeviceClassificationMapper;
+import org.springblade.business.utils.PDFUtil;
+import org.springblade.business.utils.SystemUtils;
+import org.springblade.business.vo.TrialDeviceUsePageVO;
+import org.springblade.business.entity.TrialDeviceUse;
+import org.springblade.business.mapper.TrialDeviceUseMapper;
+import org.springblade.business.service.ITrialDeviceUseService;
+import org.springblade.business.wrapper.TrialDeviceUseWarpper;
+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.manager.entity.WbsTreePrivate;
+import org.springblade.resource.feign.NewIOSSClient;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletResponse;
+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 TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMapper, TrialDeviceUse> implements ITrialDeviceUseService {
+
+    private final NewIOSSClient newIOSSClient;
+    private final TrialDeviceClassificationMapper trialDeviceClassificationMapper;
+
+    @Override
+    public TrialDeviceUse useDetail(Long id) {
+        return baseMapper.selectById(id);
+    }
+
+    @Override
+    public boolean useSubmit(TrialDeviceUse obj) {
+        return this.saveOrUpdate(obj);
+    }
+
+    @Override
+    public IPage<TrialDeviceUsePageVO> usePage(IPage<TrialDeviceUse> page, TrialDeviceUsePageVO dto, Long projectId, Long contractId) {
+        //获取设备分类数据
+        List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+        //获取当前试验树
+        List<WbsTreePrivate> wbsTreePrivates = baseMapper.selectTrialTreeAll(String.valueOf(projectId), 2);
+
+        QueryWrapper<TrialDeviceUse> queryWrapper = Condition.getQueryWrapper(dto);
+        if (ObjectUtil.isNotEmpty(dto.getDeviceClassId())) {
+            queryWrapper.lambda().eq(TrialDeviceUse::getDeviceClassId, dto.getDeviceClassId());
+        }
+        if (ObjectUtil.isNotEmpty(dto.getQueryValue())) {
+            queryWrapper.lambda().like(TrialDeviceUse::getDeviceName, dto.getDeviceName());
+            queryWrapper.lambda().or().like(TrialDeviceUse::getDeviceModel, dto.getDeviceModel());
+        }
+        if (StringUtils.isNotEmpty(dto.getStartTime()) && StringUtils.isNotEmpty(dto.getEndTime())) {
+            String endTime = dto.getEndTime();
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
+            queryWrapper.lambda().between(TrialDeviceUse::getStartDate, dto.getStartTime(), endTime);
+        }
+        IPage<TrialDeviceUse> resultPages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialDeviceUse::getCreateTime));
+        IPage<TrialDeviceUsePageVO> trialDeviceUsePageDTOIPage = TrialDeviceUseWarpper.build().pageVO(resultPages);
+        List<TrialDeviceUsePageVO> records = trialDeviceUsePageDTOIPage.getRecords();
+        for (TrialDeviceUsePageVO record : records) {
+            for (TrialDeviceClassification classification : deviceClassificationList) {
+                if (record.getDeviceClassId().equals(classification.getId())) {
+                    record.setDeviceClassName(classification.getClassName());
+                }
+            }
+            for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
+                if (record.getNodeId().equals(wbsTreePrivate.getPKeyId())) {
+                    record.setNodeName(wbsTreePrivate.getNodeName());
+                }
+            }
+        }
+        return trialDeviceUsePageDTOIPage.setRecords(records);
+    }
+
+    @Override
+    public String usePrintPdf(String ids, String projectId, HttpServletResponse response, Long contractId) {
+        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<TrialDeviceUse> pdfData = baseMapper.selectBatchIds(Func.toLongList(ids));
+            //获取设备分类数据
+            List<TrialDeviceClassification> deviceClassificationList = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+            //获取当前试验树
+            List<WbsTreePrivate> wbsTreePrivates = baseMapper.selectTrialTreeAll(projectId, 2);
+
+            //删除旧PDF
+            List<String> pdfUrls = pdfData.stream().map(TrialDeviceUse::getPdfUrl).distinct().collect(Collectors.toList());
+            for (String pdfUrl : pdfUrls) {
+                //格式 https: //xxx.com//upload/20221101/xxx.pdf
+                if (StringUtils.isNotEmpty(pdfUrl)) {
+                    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);
+            //生成一个13列的表格
+            PdfPTable table = new PdfPTable(13);
+
+            //定义每个单元格的宽度
+            float[] widthsHeaderTitle = {1f, 1f, 1f};
+            float[] widthsHeader = {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 = {"序号", "设备名称", "设备分类", "设备编号", "设备型号", "出厂编号", "使用日期(起)", "使用日期(止)",
+                    "检测试验项目", "样品编号", "样品名称", "使用人", "备注"};
+            for (String s : array) {
+                PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
+            }
+            for (TrialDeviceUse pdfDatum : pdfData) {
+                PDFUtil.createTableCell(String.valueOf(pdfDatum.getId()), textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(pdfDatum.getDeviceName(), textFont, table, lineHeight, colSpan);
+                for (TrialDeviceClassification classification : deviceClassificationList) {
+                    if (classification.getId().equals(pdfDatum.getDeviceClassId())) {
+                        PDFUtil.createTableCell(classification.getClassName(), textFont, table, lineHeight, colSpan);
+                    }
+                }
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceNumber()) ? pdfDatum.getDeviceNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getDeviceModel()) ? pdfDatum.getDeviceModel() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getFactoryNumber()) ? pdfDatum.getFactoryNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getStartDate()) ? pdfDatum.getStartDate().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getEndDate()) ? pdfDatum.getEndDate().toString() : "", textFont, table, lineHeight, colSpan);
+                for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
+                    if (pdfDatum.getNodeId().equals(wbsTreePrivate.getPKeyId())) {
+                        PDFUtil.createTableCell(wbsTreePrivate.getNodeName(), textFont, table, lineHeight, colSpan);
+                    }
+                }
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationNumber()) ? pdfDatum.getSpecificationNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialName()) ? pdfDatum.getMaterialName() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getManagerName()) ? pdfDatum.getManagerName() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRemarks()) ? 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 (TrialDeviceUse 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 importBatchDeviceUse(List<TrialDeviceUseExcel> list, Long projectId, Long contractId) {
+        //获取当前合同段的设备分类
+        List<TrialDeviceClassification> deviceClassifications = trialDeviceClassificationMapper.selectList(Wrappers.<TrialDeviceClassification>query().lambda().eq(TrialDeviceClassification::getContractId, contractId));
+        //获取当前项目试验树
+        List<WbsTreePrivate> wbsTreePrivates = baseMapper.selectTrialTreeAll(String.valueOf(projectId), 2);
+
+        List<TrialDeviceUse> listData = new ArrayList<>();
+        for (TrialDeviceUseExcel trialDeviceUseExcel : list) {
+            TrialDeviceUse trialDeviceUse = BeanUtil.copyProperties(trialDeviceUseExcel, TrialDeviceUse.class);
+            //设备分类id
+            for (TrialDeviceClassification classification : deviceClassifications) {
+                if (trialDeviceUseExcel.getDeviceClassName().equals(classification.getClassName())) {
+                    if (trialDeviceUse != null) {
+                        trialDeviceUse.setDeviceClassId(classification.getId());
+                        break;
+                    }
+                }
+            }
+            //检测试验项目id
+            for (WbsTreePrivate wbsTreePrivate : wbsTreePrivates) {
+                if (trialDeviceUseExcel.getNodeName().equals(wbsTreePrivate.getNodeName())) {
+                    if (trialDeviceUse != null) {
+                        trialDeviceUse.setNodeId(wbsTreePrivate.getId());
+                        break;
+                    }
+                }
+            }
+            listData.add(trialDeviceUse);
+        }
+        return this.saveBatch(listData, 1000);
+    }
+}

+ 32 - 30
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialMaterialMobilizationServiceImpl.java

@@ -27,9 +27,7 @@ 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;
@@ -42,11 +40,8 @@ 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;
@@ -110,13 +105,14 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
 
     @Override
     public IPage<TrialMaterialMobilizationVO> selectPage(IPage<TrialMaterialMobilization> page, TrialMaterialMobilizationVO obj) {
+        List<User> userList = iUserClient.selectUserAll();
         QueryWrapper<TrialMaterialMobilization> queryWrapper = Condition.getQueryWrapper(obj);
         if (ObjectUtil.isNotEmpty(obj.getMaterialType())) {
             queryWrapper.lambda().eq(TrialMaterialMobilization::getMaterialType, obj.getMaterialType());
         }
         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");
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
             queryWrapper.lambda().between(TrialMaterialMobilization::getCreateTime, obj.getStartTime(), endTime);
         }
         if (ObjectUtil.isNotEmpty(obj.getQueryValue())) {
@@ -129,8 +125,11 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
         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());
+            for (User user : userList) {
+                if (user.getId().equals(record.getUserId())) {
+                    record.setUserName(user.getName());
+                }
+            }
         }
         return trialMaterialMobilizationVOIPage.setRecords(records);
     }
@@ -180,13 +179,14 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
             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);
+                if (StringUtils.isNotEmpty(pdfUrl)) {
+                    String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                    newIOSSClient.removeFile(pdfName);
+                }
             }
 
             List<TrialMaterialMobilizationVO> pdfData = new ArrayList<>();
             for (TrialMaterialMobilization trialMaterialMobilization : list) {
-
                 for (User user : userList) {
                     if (trialMaterialMobilization.getUserId().equals(user.getId())) {
                         TrialMaterialMobilizationVO trialMaterialMobilizationVO = BeanUtil.copyProperties(trialMaterialMobilization, TrialMaterialMobilizationVO.class);
@@ -270,25 +270,23 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
                 PDFUtil.createTableCell(s, 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(ObjectUtil.isNotEmpty(pdfDatum.getMaterialNumber()) ? pdfDatum.getMaterialNumber() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMobilizationDate()) ? DateUtil.formatDate(pdfDatum.getMobilizationDate()) : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialName()) ? pdfDatum.getMaterialName() : "", 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);
-                PDFUtil.createTableCell(pdfDatum.getMaterialCount().toString(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getCalculationUnit(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getBatchNumber().toString(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getPlaceOfProduction(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getProposedPosition(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getUserName(), textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationModel()) ? pdfDatum.getSpecificationModel() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSupplierUnit()) ? pdfDatum.getSupplierUnit() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialPrice()) ? pdfDatum.getMaterialPrice().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialCount()) ? pdfDatum.getMaterialCount().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getCalculationUnit()) ? pdfDatum.getCalculationUnit() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getBatchNumber()) ? pdfDatum.getBatchNumber().toString() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getPlaceOfProduction()) ? pdfDatum.getPlaceOfProduction() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getProposedPosition()) ? pdfDatum.getProposedPosition() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getUserName()) ? pdfDatum.getUserName() : "", textFont, table, lineHeight, colSpan);
             }
             document.add(table);
 
@@ -328,6 +326,8 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
 
     @Override
     public List<TrialSamplingRecordVO> samplingRecordList(Long id) {
+        //获取用户信息
+        List<User> userList = iUserClient.selectUserAll();
         //获取关联信息
         List<TrialSamplingRecord> trialSamplingRecords = trialSamplingRecordMapper.selectListByMobilizationId(id);
         //获取样品信息
@@ -336,11 +336,13 @@ public class TrialMaterialMobilizationServiceImpl extends BaseServiceImpl<TrialM
         for (TrialSamplingRecord trialSamplingRecord : trialSamplingRecords) {
             for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
                 if (trialSampleInfo.getId().equals(trialSamplingRecord.getSampleInfoId())) {
-                    R<User> userR = iUserClient.userInfoById(trialSampleInfo.getUserId());
-                    TrialSamplingRecordVO trialSamplingRecordVO = BeanUtil.copyProperties(trialSampleInfo, TrialSamplingRecordVO.class);
-                    if (trialSamplingRecordVO != null) {
-                        trialSamplingRecordVO.setUserName(userR.getData().getName());
-                        list.add(trialSamplingRecordVO);
+                    User user = userList.stream().filter(f -> f.getId().equals(trialSampleInfo.getUserId())).findAny().orElse(null);
+                    if (user != null) {
+                        TrialSamplingRecordVO trialSamplingRecordVO = BeanUtil.copyProperties(trialSampleInfo, TrialSamplingRecordVO.class);
+                        if (trialSamplingRecordVO != null) {
+                            trialSamplingRecordVO.setUserName(user.getName());
+                            list.add(trialSamplingRecordVO);
+                        }
                     }
                 }
             }

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

@@ -14,7 +14,6 @@ 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;
@@ -24,6 +23,7 @@ import org.springblade.business.service.ITrialSampleInfoService;
 import org.springblade.business.utils.PDFUtil;
 import org.springblade.business.utils.SystemUtils;
 import org.springblade.business.vo.TrialSampleInfoVO;
+import org.springblade.business.vo.TrialSampleInfoVO2;
 import org.springblade.business.wrapper.TrialSampleInfoWarpper;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
@@ -31,7 +31,6 @@ 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.*;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.user.entity.User;
@@ -72,6 +71,12 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         }
     }
 
+    @Override
+    public List<TrialSampleInfoVO2> useDeviceList(Long nodeId) {
+        List<TrialSampleInfo> trialSampleInfos = baseMapper.selectList(Wrappers.<TrialSampleInfo>query().lambda().eq(TrialSampleInfo::getNodeId, nodeId));
+        return BeanUtil.copyProperties(trialSampleInfos, TrialSampleInfoVO2.class);
+    }
+
     @Override
     public TrialSampleInfo sampleDetail(Long id) {
         return baseMapper.selectById(id);
@@ -85,7 +90,7 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
         }
         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");
+            endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
             queryWrapper.lambda().between(TrialSampleInfo::getCreateTime, obj.getStartTime(), endTime);
         }
         if (ObjectUtil.isNotEmpty(obj.getQueryValue())) {
@@ -191,8 +196,10 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
             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);
+                if (StringUtils.isNotEmpty(pdfUrl)) {
+                    String pdfName = pdfUrl.split("//")[2].split("/")[2];
+                    newIOSSClient.removeFile(pdfName);
+                }
             }
 
             List<TrialSampleInfoVO> pdfData = new ArrayList<>();
@@ -279,15 +286,15 @@ public class TrialSampleInfoServiceImpl extends BaseServiceImpl<TrialSampleInfoM
                 PDFUtil.createTableCell(s, textFont, table, lineHeight, colSpan);
             }
             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);
-                PDFUtil.createTableCell(pdfDatum.getSpecificationModel(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(String.valueOf(pdfDatum.getMaterialCount()), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getCalculationUnit(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getProposedPosition(), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(String.valueOf(pdfDatum.getRepresentativeCount()), textFont, table, lineHeight, colSpan);
-                PDFUtil.createTableCell(pdfDatum.getUserName(), textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialName()) ? pdfDatum.getMaterialName() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSamplingDate()) ? DateUtil.formatDate(pdfDatum.getSamplingDate()) : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationNumber()) ? String.valueOf(pdfDatum.getSpecificationNumber()) : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getSpecificationModel()) ? pdfDatum.getSpecificationModel() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getMaterialCount()) ? String.valueOf(pdfDatum.getMaterialCount()) : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getCalculationUnit()) ? pdfDatum.getCalculationUnit() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getProposedPosition()) ? pdfDatum.getProposedPosition() : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getRepresentativeCount()) ? String.valueOf(pdfDatum.getRepresentativeCount()) : "", textFont, table, lineHeight, colSpan);
+                PDFUtil.createTableCell(ObjectUtil.isNotEmpty(pdfDatum.getUserName()) ? pdfDatum.getUserName() : "", textFont, table, lineHeight, colSpan);
             }
             document.add(table);
             document.close();

+ 59 - 0
blade-service/blade-business/src/main/java/org/springblade/business/utils/CustomStringTypeHandler.java

@@ -0,0 +1,59 @@
+package org.springblade.business.utils;
+
+import org.apache.ibatis.executor.result.ResultMapException;
+import org.apache.ibatis.type.BaseTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.MappedJdbcTypes;
+import org.apache.ibatis.type.MappedTypes;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * @Name: CustomStringTypeHandler
+ * @Desc: 自定义mybatis处理类,将null返回为空串(‘’)
+ * @Author: Administrator
+ * @Date: 2019-09-03 18:20
+ */
+@MappedTypes({String.class})
+@MappedJdbcTypes(JdbcType.VARCHAR)
+public class CustomStringTypeHandler extends BaseTypeHandler<String> {
+
+
+    @Override
+    public String getResult(ResultSet rs, String columnName) {
+        String result;
+        try {
+            result = getNullableResult(rs, columnName);
+        } catch (Exception e) {
+            throw new ResultMapException("Error attempting to get column '" + columnName + "' from result set.  Cause: " + e, e);
+        }
+        return result;
+    }
+
+    @Override
+    public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType)
+            throws SQLException {
+        ps.setString(i, parameter);
+    }
+
+    @Override
+    public String getNullableResult(ResultSet rs, String columnName)
+            throws SQLException {
+        return rs.getString(columnName) == null? "" : rs.getString(columnName);
+    }
+
+    @Override
+    public String getNullableResult(ResultSet rs, int columnIndex)
+            throws SQLException {
+        return rs.getString(columnIndex) == null? "" : rs.getString(columnIndex);
+    }
+
+    @Override
+    public String getNullableResult(CallableStatement cs, int columnIndex)
+            throws SQLException {
+        return cs.getString(columnIndex) == null? "" : cs.getString(columnIndex);
+    }
+}