فهرست منبع

质检右键、试验右键、消息推送

liuyc 2 سال پیش
والد
کامیت
a89221e0b4
19فایلهای تغییر یافته به همراه426 افزوده شده و 82 حذف شده
  1. 26 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialFileSubmitDTO.java
  2. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSelfInspectionRecordDTO.java
  3. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/InformationQuery.java
  4. 1 1
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialContainerClassificationPageVO.java
  5. 18 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDetectionDataVO.java
  6. 3 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSelfInspectionRecordVO.java
  7. 2 2
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContract.java
  8. 51 58
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  9. 45 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDataInfoRelationController.java
  10. 14 7
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java
  11. 8 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java
  12. 16 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml
  13. 2 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialDetectionDataService.java
  14. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java
  15. 16 5
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  16. 4 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialContainerClassificationServiceImpl.java
  17. 25 2
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java
  18. 21 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDeviceUseServiceImpl.java
  19. 163 5
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

+ 26 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialFileSubmitDTO.java

@@ -0,0 +1,26 @@
+package org.springblade.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class TrialFileSubmitDTO implements Serializable {
+
+    @ApiModelProperty(value = "type=1试验检测、2=第三方检测、3=外委检测")
+    private Integer type;
+
+    @ApiModelProperty(value = "ids=选择的数据的id逗号字符串拼接")
+    private String ids;
+
+    @ApiModelProperty(value = "当前节点pKeyId,是当前质量检测合同段的节点,不是试验、第三方、委托的树节点")
+    private String nodeId;
+
+    @ApiModelProperty(value = "项目id")
+    private String projectId;
+
+    @ApiModelProperty(value = "合同段id")
+    private String contractId;
+
+}

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TrialSelfInspectionRecordDTO.java

@@ -17,4 +17,7 @@ public class TrialSelfInspectionRecordDTO extends TrialSelfInspectionRecord {
     @ApiModelProperty(value = "表类型 1=记录表 2=报告单")
     private Integer tableType;
 
+    @ApiModelProperty(value = "引用设备仪器ids")
+    private String deviceUseIds;
+
 }

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

@@ -116,4 +116,7 @@ public class InformationQuery extends BaseEntity {
     @ApiModelProperty("排序")
     private Integer sort;
 
+    @ApiModelProperty("pdf路径,引用试验记录后合并的pdf")
+    private String pdfTrialUrl;
+
 }

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

@@ -9,7 +9,7 @@ import java.io.Serializable;
 public class TrialContainerClassificationPageVO implements Serializable {
 
     @ApiModelProperty("容器id")
-    private String id;
+    private String containerId;
 
     @ApiModelProperty("当前页")
     private Integer current;

+ 18 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialDetectionDataVO.java

@@ -0,0 +1,18 @@
+package org.springblade.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.business.entity.TrialDetectionData;
+
+
+/**
+ * 试验检测数据VO
+ */
+@Data
+public class TrialDetectionDataVO extends TrialDetectionData {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "是否关联选择过 0=否 1=是")
+    private Integer isSelectedStatus;
+
+}

+ 3 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSelfInspectionRecordVO.java

@@ -20,4 +20,7 @@ public class TrialSelfInspectionRecordVO extends TrialSelfInspectionRecord {
     @ApiModelProperty(value = "工程部位及用途名称")
     private String projectPositionName;
 
+    @ApiModelProperty(value = "是否关联选择过 0=否 1=是")
+    private Integer isSelectedStatus;
+
 }

+ 2 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/WbsTreeContract.java

@@ -249,7 +249,7 @@ public class WbsTreeContract extends BaseEntity {
     /**
      * 配合试验比ids
      */
-  //  private String mixRatioTestIds;
-
+    @ApiModelProperty(value = "配合比试验ids")
+    private String mixRatioTestIds;
 
 }

+ 51 - 58
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -981,24 +981,7 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperationSupport(order = 16)
     @ApiOperation(value = "自定义排序")
     public R<Boolean> diySort(@RequestBody DiySortVO vo) {
-        //获取排序集合 自定义当前同级排序
-        List<String> sortList = vo.getSortList();
-        if (sortList.size() > 0) {
-            for (int i = 0, l = sortList.size(); i < l; i++) {
-                try {
-                    WbsTreeContract newData = new WbsTreeContract();
-                    newData.setPKeyId(Long.parseLong(sortList.get(i)));
-                    newData.setSort(i);
-                    //修改排序
-                    this.wbsTreeContractClient.updateContractNodeParameter(newData);
-
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-
-        //对整棵树进行排序(资料查询需要同步显示排序,所以如此设计逻辑) ,采用自增
+        //对整棵树进行排序(资料查询需要同步显示排序)采用自增
         List<String> sortLists = vo.getSortList();
         String id = sortLists.stream().map(String::valueOf).findAny().orElse(null);
         WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
@@ -1015,57 +998,67 @@ public class InformationWriteQueryController extends BladeController {
             list = informationQueryService.getContractWbsTreeAll(wbsTreeContract);
         }
 
-        List<WbsTreeContract> result = new ArrayList<>();
-        List<InformationQuery> infos = new ArrayList<>();
-
         if (Objects.requireNonNull(list).size() > 0) {
+            //获取根节点
+            List<WbsTreeContract> rootNodes = list.stream().filter(f -> ObjectUtil.isNotEmpty(f.getParentId()) && f.getParentId() == 0).collect(Collectors.toList());
+            List<InformationQuery> infos = new ArrayList<>();
+            int sort = 2;
+            this.diySortRecursion(list, rootNodes, sort, informationQueries, infos);
 
-            //删除当前自定义排序节点
-            Iterator<WbsTreeContract> iterator = list.iterator();
-            while (iterator.hasNext()) {
-                WbsTreeContract next = iterator.next();
-                for (String pId : sortList) {
-                    if (next.getPKeyId().toString().equals(pId)) {
-                        iterator.remove();
-                    }
-                }
+            //修改资料查询sort、节点sort
+            for (InformationQuery info : infos) {
+                informationQueryService.updateById(info);
             }
+            informationQueryService.updateBatchByPKeyId(list);
 
-            //Map<Long, List<WbsTreeContract>> collect = list.parallelStream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
-
-            int sort = 1;
-
-            //for (Map.Entry<Long, List<WbsTreeContract>> longListEntry : collect.entrySet()) {
-            //for (WbsTreeContract treeContract : longListEntry.getValue()) {
-            for (WbsTreeContract treeContract : list) {
-                if (ObjectUtil.isNotEmpty(treeContract.getParentId()) && treeContract.getParentId() == 0) {
-                    //根节点
-                    treeContract.setSort(sort++);
-                    result.add(treeContract);
-                } else if (ObjectUtil.isNotEmpty(treeContract.getParentId()) && treeContract.getParentId() != 0) {
-                    //填报资料排序
-                    InformationQuery informationQuery = informationQueries.stream().filter(f -> f.getWbsId().equals(treeContract.getPKeyId())).findAny().orElse(null);
-                    if (informationQuery != null) {
-                        informationQuery.setSort(sort);
-                        infos.add(informationQuery);
-                    }
+            //获取排序集合 自定义当前同级排序
+            List<String> sortList = vo.getSortList();
+            if (sortList.size() > 0) {
+                for (int i = 1, l = sortList.size(); i < l; i++) {
+                    try {
+                        WbsTreeContract newData = new WbsTreeContract();
+                        newData.setPKeyId(Long.parseLong(sortList.get(i)));
+                        newData.setSort(i);
+                        //修改排序
+                        this.wbsTreeContractClient.updateContractNodeParameter(newData);
 
-                    //其他节点
-                    treeContract.setSort(sort++);
-                    result.add(treeContract);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
                 }
             }
+            return R.data(true);
+        }
+        return R.data(false);
+    }
 
-            for (InformationQuery info : infos) {
-                informationQueryService.updateById(info);
-            }
+    //递归排序
+    private void diySortRecursion(List<WbsTreeContract> list, List<WbsTreeContract> rootNodes, int sort, List<InformationQuery> informationQueries, List<InformationQuery> infos) {
+        if (ObjectUtil.isNotEmpty(rootNodes)) {
+            List<WbsTreeContract> parentNodes = new ArrayList<>();
+            for (WbsTreeContract wbsTreeContract : list) {
+                for (WbsTreeContract rootNode : rootNodes) {
+                    //获取子节点并排序
+                    if (wbsTreeContract.getParentId().equals(rootNode.getId())) {
+                        //资料填报数据排序
+                        InformationQuery informationQuery = informationQueries.stream().filter(f -> f.getWbsId().equals(wbsTreeContract.getPKeyId())).findAny().orElse(null);
+                        if (informationQuery != null) {
+                            informationQuery.setSort(sort);
+                            infos.add(informationQuery);
+                        }
 
-            informationQueryService.updateBatchByPKeyId(result);
+                        wbsTreeContract.setSort(sort++);
 
-            return R.data(true);
+                        //重构父级
+                        parentNodes.add(wbsTreeContract);
+                    }
+                }
+            }
+            //递归
+            if (parentNodes.size() > 0) {
+                this.diySortRecursion(list, parentNodes, sort, informationQueries, infos);
+            }
         }
-
-        return R.data(false);
     }
 
     /**

+ 45 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDataInfoRelationController.java

@@ -0,0 +1,45 @@
+package org.springblade.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.business.dto.TrialFileSubmitDTO;
+import org.springblade.business.dto.TrialSelfInspectionRecordPageDTO;
+import org.springblade.business.service.ITrialSelfInspectionRecordService;
+import org.springblade.business.vo.TrialSelfInspectionRecordVO;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.FileNotFoundException;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/trial")
+@Api(value = "质检关联试验数据与文件", tags = "质检关联试验数据与文件接口")
+public class TrialDataInfoRelationController extends BladeController {
+
+    private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
+
+    @PostMapping("/data/page")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "自检记录分页查询", notes = "传入TrialSelfInspectionRecordPageDTO")
+    public R<IPage<TrialSelfInspectionRecordVO>> selfPage(@RequestBody Query query, @RequestBody TrialSelfInspectionRecordPageDTO dto) {
+        return R.data(iTrialSelfInspectionRecordService.trialDataPage(Condition.getPage(query), dto));
+    }
+
+    @PostMapping("/file/submit")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "质检关联试验文件提交保存", notes = "传入TrialFileSubmitDTO")
+    public R<Object> fileSubmit(@RequestBody TrialFileSubmitDTO dto) throws FileNotFoundException {
+        return R.data(iTrialSelfInspectionRecordService.fileSubmit(dto));
+    }
+
+}

+ 14 - 7
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -8,7 +8,9 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
+import org.apache.commons.lang.StringUtils;
 import org.springblade.business.dto.*;
+import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialDetectionData;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.service.ITrialSampleInfoService;
@@ -19,9 +21,11 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.WbsTreePrivateVO;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -68,7 +72,7 @@ public class TrialDetectionController extends BladeController {
     @PostMapping("/data/page")
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "外委或三方数据分页条件查询", notes = "传入Query,contractId、nodeId、TrialDetectionDataPageDTO")
-    public R<IPage<TrialDetectionData>> dataPage(@RequestBody Query query, @RequestBody TrialDetectionDataPageDTO dto) {
+    public R<IPage<TrialDetectionDataVO>> dataPage(@RequestBody Query query, @RequestBody TrialDetectionDataPageDTO dto) {
         return R.data(iTrialDetectionDataService.dataPage(Condition.getPage(query), dto));
     }
 
@@ -171,15 +175,18 @@ public class TrialDetectionController extends BladeController {
     @ApiOperation(value = "自检多表PDF预览", notes = "传入nodeId、classify、contractId、projectId")
     public R<Object> getPDFs(String nodeId, String classify, String contractId, String projectId) {
         String sql = "select pdf_url, e_visa_pdf_url from u_information_query  where project_id ='" + projectId + "' and classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
-        Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(sql);
+        List<InformationQuery> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<InformationQuery>(InformationQuery.class));
         Object pdfUrl = "";
-        if (stringObjectMap.size() > 0) {
-            pdfUrl = stringObjectMap.get("pdf_url");
-            if (stringObjectMap.get("e_visa_pdf_url") != null) {
-                pdfUrl = stringObjectMap.get("e_visa_pdf_url"); //优先使用电签的PDF
+        if (list.size() > 0) {
+            for (InformationQuery informationQuery : list) {
+                pdfUrl = informationQuery.getPdfUrl();
+                if (informationQuery.getEVisaPdfUrl() != null) {
+                    pdfUrl = informationQuery.getEVisaPdfUrl(); //优先使用电签的PDF
+                }
+                break;
             }
         }
-        return R.data(pdfUrl);
+        return R.data(ObjectUtil.isNotEmpty(pdfUrl) ? pdfUrl : null);
     }
 
     @GetMapping("/self/raw-material/tree")

+ 8 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.java

@@ -30,4 +30,12 @@ public interface TrialSelfInspectionRecordMapper extends BaseMapper<TrialSelfIns
 
     void updateInformationQuery(String id, String contractId, String classify, String link);
 
+    void deleteSeletedStatusByNodeId(String nodeId, Integer type);
+
+    void insertSeletedStatus(Long id, String nodeId, Integer type, String recordId);
+
+    int selectCountSeletedStatus(String nodeId, Integer type);
+
+    List<String> selectSelectedStatusList(Long nodeId, String type);
+
 }

+ 16 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/TrialSelfInspectionRecordMapper.xml

@@ -40,6 +40,10 @@
         insert into u_trial_self_quality_project(id,self_id,quality_node_id) values(#{id},#{selfId},#{qualityNodeId})
     </insert>
 
+    <insert id="insertSeletedStatus">
+        insert into u_trial_file_pdf_record(id,node_id,type,record_id) values ( #{id} , #{nodeId} , #{type} , #{recordId} )
+    </insert>
+
     <update id="updateInformationQuery">
         update u_information_query set pdf_url = #{link} where wbs_id = #{id} and classify = #{classify} and contract_id = #{contractId} and is_deleted = 0
     </update>
@@ -52,6 +56,10 @@
         delete from u_trial_self_quality_project where self_id = #{id}
     </delete>
 
+    <delete id="deleteSeletedStatusByNodeId">
+        delete from u_trial_file_pdf_record where `type` = #{type} and node_id = #{nodeId}
+    </delete>
+
     <select id="selectAll" resultType="org.springblade.business.entity.TrialSelfInspectionRecord">
         select * from u_trial_self_inspection_record where node_id = #{nodeId}
     </select>
@@ -76,4 +84,12 @@
         select pdf_url from u_information_query where wbs_id = #{id} and classify = #{classify} and contract_id = #{contractId} and is_deleted = 0
     </select>
 
+    <select id="selectCountSeletedStatus" resultType="java.lang.Integer">
+        select count(1) from u_trial_file_pdf_record where node_id = #{nodeId} and `type` != #{type}
+    </select>
+
+    <select id="selectSelectedStatusList" resultType="java.lang.String">
+        select record_id from u_trial_file_pdf_record where node_id = #{nodeId} and `type` in ( ${type} )
+    </select>
+
 </mapper>

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.business.dto.TrialDetectionDataDTO;
 import org.springblade.business.dto.TrialDetectionDataPageDTO;
 import org.springblade.business.entity.TrialDetectionData;
+import org.springblade.business.vo.TrialDetectionDataVO;
 import org.springblade.core.mp.base.BaseService;
 
 public interface ITrialDetectionDataService extends BaseService<TrialDetectionData> {
@@ -12,7 +13,7 @@ public interface ITrialDetectionDataService extends BaseService<TrialDetectionDa
 
     boolean dataSubmit(TrialDetectionData obj);
 
-    IPage<TrialDetectionData> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto);
+    IPage<TrialDetectionDataVO> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto);
 
     boolean dataCopy(TrialDetectionDataDTO dto);
 

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

@@ -2,6 +2,7 @@ package org.springblade.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.business.dto.RawMaterialSubmitRelationDTO;
+import org.springblade.business.dto.TrialFileSubmitDTO;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.dto.TrialSelfInspectionRecordPageDTO;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
@@ -38,4 +39,8 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception;
 
+    IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto);
+
+    boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException;
+
 }

+ 16 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -309,17 +309,28 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             }
         }
 
-        long aLong1 = messageWarningService.getBaseMapper().selectCount(Wrappers.<MessageWarning>lambdaQuery()
+        List<MessageWarning> messageWarnings = messageWarningService.getBaseMapper().selectList(Wrappers.<MessageWarning>lambdaQuery()
                 .eq(MessageWarning::getProjectId, projectId)
                 .eq(MessageWarning::getContractId, contractId)
                 .eq(MessageWarning::getPushUser, userId)
                 .eq(MessageWarning::getIsRead, 0)
         );
 
+        long messageCount1 = messageWarnings.stream().filter(f -> f.getType().equals(1)).count();
+        long messageCount2 = messageWarnings.stream().filter(f -> f.getType().equals(2)).count();
+        long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
+        long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
+        long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
+
         Map<String, String> map = new HashMap<>();
-        map.put("taskCount", String.valueOf(aLong));
-        map.put("messageCount", String.valueOf(aLong1));
-        map.put("allCount", String.valueOf(aLong + aLong1));
+        map.put("allCount", String.valueOf(aLong + messageWarnings.size()));//任务管理
+        map.put("taskCount", String.valueOf(aLong));//任务查看
+        map.put("messageCount", String.valueOf(messageWarnings.size()));//消息提醒
+        map.put("messageCount_1", String.valueOf(messageCount1));//任务催办
+        map.put("messageCount_2", String.valueOf(messageCount2));//监测预警
+        map.put("messageCount_3", String.valueOf(messageCount3));//废除通知
+        map.put("messageCount_4", String.valueOf(messageCount4));//工单反馈
+        map.put("messageCount_5", String.valueOf(messageCount5));//系统消息
         map.put("userId", userId);
         return map;
     }
@@ -331,7 +342,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
 
     //@Async
     @Override
-    public void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS,Long userId) throws FileNotFoundException {
+    public void batchCompleteApprovalTask(List<TaskApprovalVO> taskApprovalVOS, Long userId) throws FileNotFoundException {
         List<String> taskIds = taskApprovalVOS.stream().map(TaskApprovalVO::getParallelProcessInstanceId).distinct().collect(Collectors.toList());
         long batch = this.taskBatchService.count(Wrappers.<TaskBatch>lambdaQuery().eq(TaskBatch::getCreateUser, userId));
         if (batch > 0) {

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

@@ -205,7 +205,10 @@ public class TrialContainerClassificationServiceImpl
 
     @Override
     public Page<HashMap<Object, Object>> dataPage(TrialContainerClassificationPageVO obj) {
-        TrialContainerClassification trialContainerClassification = baseMapper.selectById(obj.getId());
+        if (StringUtils.isEmpty(obj.getContainerId())) {
+            throw new ServiceException("未获取到容器分类id");
+        }
+        TrialContainerClassification trialContainerClassification = baseMapper.selectById(obj.getContainerId());
         List<HashMap<Object, Object>> hashMaps = baseMapper.selectTabDataAll(trialContainerClassification.getContainerInitTabName());
         Page<HashMap<Object, Object>> page = new Page<>(obj.getCurrent(), obj.getSize(), hashMaps.size());
         long size = page.getSize();

+ 25 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialDetectionDataServiceImpl.java

@@ -2,6 +2,7 @@ package org.springblade.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
@@ -9,10 +10,14 @@ import org.springblade.business.dto.TrialDetectionDataDTO;
 import org.springblade.business.dto.TrialDetectionDataPageDTO;
 import org.springblade.business.entity.TrialDetectionData;
 import org.springblade.business.mapper.TrialDetectionDataMapper;
+import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
 import org.springblade.business.service.ITrialDetectionDataService;
+import org.springblade.business.vo.TrialDetectionDataVO;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.utils.PageUtil;
+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;
@@ -24,6 +29,9 @@ import java.util.List;
 @AllArgsConstructor
 public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectionDataMapper, TrialDetectionData> implements ITrialDetectionDataService {
 
+    private final TrialSelfInspectionRecordMapper inspectionRecordMapper;
+
+
     @Override
     public TrialDetectionData dataDetail(Long id) {
         return baseMapper.selectById(id);
@@ -35,7 +43,7 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
     }
 
     @Override
-    public IPage<TrialDetectionData> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto) {
+    public IPage<TrialDetectionDataVO> dataPage(IPage<TrialDetectionData> page, TrialDetectionDataPageDTO dto) {
         QueryWrapper<TrialDetectionData> queryWrapper = Condition.getQueryWrapper(dto);
         if (StringUtils.isNotEmpty(dto.getQueryStatus())) {
             queryWrapper.lambda().eq(TrialDetectionData::getStatus, dto.getQueryStatus());
@@ -51,7 +59,22 @@ public class TrialDetectionDataServiceImpl extends BaseServiceImpl<TrialDetectio
         if (StringUtils.isNotEmpty(dto.getQueryValue())) {
             queryWrapper.lambda().and(wrapper -> wrapper.like(TrialDetectionData::getEntrustNo, dto.getQueryValue()).or().like(TrialDetectionData::getReportNo, dto.getQueryValue()));
         }
-        return this.page(page, queryWrapper.lambda().orderBy(true, true, TrialDetectionData::getCreateTime));
+        IPage<TrialDetectionData> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialDetectionData::getCreateTime));
+        List<TrialDetectionDataVO> trialDetectionDataVOS = BeanUtil.copyProperties(pages.getRecords(), TrialDetectionDataVO.class);
+
+        List<String> list = inspectionRecordMapper.selectSelectedStatusList(dto.getNodeId(), "2,3");
+
+        //是否关联过
+        for (TrialDetectionDataVO trialDetectionDataVO : trialDetectionDataVOS) {
+            for (String recordId : list) {
+                trialDetectionDataVO.setIsSelectedStatus(trialDetectionDataVO.getId().toString().equals(recordId) ? 1 : 0);
+            }
+            if (list.size() == 0) {
+                trialDetectionDataVO.setIsSelectedStatus(0);
+            }
+        }
+
+        return PageUtil.toPage(pages, trialDetectionDataVOS);
     }
 
     @Override

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

@@ -14,6 +14,7 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.dto.TrialDeviceUseDTO;
+import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.TrialDeviceClassification;
 import org.springblade.business.entity.TrialDeviceInfo;
 import org.springblade.business.excel.TrialDeviceUseExcel;
@@ -26,6 +27,7 @@ import org.springblade.business.mapper.TrialDeviceUseMapper;
 import org.springblade.business.service.ITrialDeviceUseService;
 import org.springblade.business.wrapper.TrialDeviceUseWarpper;
 import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SystemUtils;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.mp.support.Condition;
@@ -302,4 +304,23 @@ public class TrialDeviceUseServiceImpl extends BaseServiceImpl<TrialDeviceUseMap
         }
         return this.saveBatch(listData, 1000);
     }
+
+    public void addDeviceUseInfo(TrialSelfInspectionRecordDTO dto) {
+        //获取进场记录
+        List<TrialDeviceInfo> deviceInfos = trialDeviceInfoMapper.selectList(Wrappers.<TrialDeviceInfo>lambdaQuery().in(TrialDeviceInfo::getId, dto.getDeviceUseIds()));
+
+        //构造使用记录
+        List<TrialDeviceUse> list = new ArrayList<>();
+        for (TrialDeviceInfo deviceInfo : deviceInfos) {
+            TrialDeviceUse trialDeviceUses = BeanUtil.copyProperties(deviceInfo, TrialDeviceUse.class);
+            if (trialDeviceUses != null) {
+                trialDeviceUses.setNodeId(dto.getNodeId());
+                trialDeviceUses.setDeviceInfoId(deviceInfo.getId());
+                trialDeviceUses.setId(SnowFlakeUtil.getId());
+                list.add(trialDeviceUses);
+            }
+        }
+        this.saveBatch(list, 1000);
+    }
+
 }

+ 163 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -11,11 +11,10 @@ import com.spire.xls.*;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.dto.RawMaterialSubmitRelationDTO;
+import org.springblade.business.dto.TrialFileSubmitDTO;
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.dto.TrialSelfInspectionRecordPageDTO;
-import org.springblade.business.entity.TrialMaterialMobilization;
-import org.springblade.business.entity.TrialSampleInfo;
-import org.springblade.business.entity.TrialSelfInspectionRecord;
+import org.springblade.business.entity.*;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.mapper.TrialMaterialMobilizationMapper;
 import org.springblade.business.mapper.TrialSampleInfoMapper;
@@ -77,6 +76,9 @@ public class TrialSelfInspectionRecordServiceImpl
     private final IOSSClient iossClient;
     private final CommonFileClient commonFileClient;
     private final TableFileClient tableFileClient;
+    private final TrialDeviceUseServiceImpl trialDeviceUseService;
+    private final InformationQueryServiceImpl informationQueryService;
+    private final TrialDetectionDataServiceImpl trialDetectionDataService;
 
     @Override
     public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
@@ -579,6 +581,12 @@ public class TrialSelfInspectionRecordServiceImpl
             updateWrapper.eq(TrialSelfInspectionRecord::getId, dto.getId());
             this.update(null, updateWrapper);
         }
+
+        //新增设备使用记录信息
+        if (StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
+            trialDeviceUseService.addDeviceUseInfo(dto);
+        }
+
         return true;
     }
 
@@ -593,7 +601,7 @@ public class TrialSelfInspectionRecordServiceImpl
         } else {
             List<String> numberRecordNos = new ArrayList<>();
             for (String recordNo : recordNos) {
-                String number = recordNo.split("-")[4];
+                String number = recordNo.split("-")[recordNo.split("-").length - 1];
                 numberRecordNos.add(number);
             }
             int maxRecordNo1 = Integer.parseInt(Collections.max(numberRecordNos)) + 1;
@@ -612,7 +620,7 @@ public class TrialSelfInspectionRecordServiceImpl
         } else {
             List<String> numberReportNo = new ArrayList<>();
             for (String reportNo : reportNos) {
-                String number = reportNo.split("-")[4];
+                String number = reportNo.split("-")[reportNo.split("-").length - 1];
                 numberReportNo.add(number);
             }
             int maxReportNo1 = Integer.parseInt(Collections.max(numberReportNo)) + 1;
@@ -648,4 +656,154 @@ public class TrialSelfInspectionRecordServiceImpl
         }
     }
 
+    public IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
+        QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
+
+        if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.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(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
+        }
+
+        queryWrapper.lambda().eq(TrialSelfInspectionRecord::getTaskStatus, "已审批");
+        queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, 1); //合格
+        queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionCategory, 1); //自检
+
+        IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialSelfInspectionRecord::getCreateTime));
+        IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
+        List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
+
+        List<WbsTreeContract> contractTreeList = wbsTreeContractClient.getContractWbsTreeByContractId(dto.getContractId());
+
+        //查询是否关联过
+        List<String> selectedIds = baseMapper.selectSelectedStatusList(dto.getNodeId(), "1");
+
+        for (TrialSelfInspectionRecordVO record : records) {
+            record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
+
+            //是否关联过
+            for (String id : selectedIds) {
+                record.setIsSelectedStatus(record.getId().toString().equals(id) ? 1 : 0);
+            }
+            if (selectedIds.size() == 0) {
+                record.setIsSelectedStatus(0);
+            }
+
+            //工程部位及用途名称
+            if (contractTreeList.size() > 0 && ObjectUtil.isNotEmpty(record.getProjectPosition())) {
+                List<String> projectPositionNames = new ArrayList<>();
+                for (WbsTreeContract wbsTreeContract : contractTreeList) {
+                    if ((record.getProjectPosition()).contains(String.valueOf(wbsTreeContract.getPKeyId()))) {
+                        projectPositionNames.add(wbsTreeContract.getNodeName());
+                    }
+                }
+                String name = projectPositionNames.stream().findAny().orElse(null);
+                if (projectPositionNames.size() > 1) {
+                    record.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
+                } else {
+                    record.setProjectPositionName(name);
+                }
+            }
+
+        }
+        return trialSelfInspectionRecordVOIPage.setRecords(records);
+    }
+
+    @Override
+    public boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException {
+        if (ObjectUtil.isEmpty(dto.getType())) {
+            throw new ServiceException("请选择一个类型");
+        }
+        if (ObjectUtil.isEmpty(dto.getNodeId())) {
+            throw new ServiceException("未获取到当前节点的pKeyId");
+        }
+
+        //获取当前节点的合并的pdfURL
+        InformationQuery informationQuery = informationQueryService.getBaseMapper().selectOne(Wrappers.<InformationQuery>lambdaQuery()
+                .eq(InformationQuery::getWbsId, dto.getNodeId())
+                .eq(InformationQuery::getProjectId, dto.getProjectId())
+                .eq(InformationQuery::getContractId, dto.getContractId())
+                .eq(InformationQuery::getType, 1) //质检
+        );
+
+         if (StringUtils.isNotEmpty(dto.getIds())) {
+            if (ObjectUtil.isNotEmpty(informationQuery) && StringUtils.isNotEmpty(informationQuery.getPdfUrl())) {
+
+                List<String> pdfList = new ArrayList<>();
+
+                if (StringUtils.isEmpty(informationQuery.getPdfTrialUrl())) {
+                    //如果PdfTrialUrl == null 说明是第一次关联
+                    pdfList.add(informationQuery.getPdfUrl());
+                } else {
+                    //如果PdfTrialUrl != null 说明是第二次以上操作关联,那么就在之前的上面做增量,主要解决不同类型提交时的问题
+                    pdfList.add(informationQuery.getPdfTrialUrl());
+                }
+
+                if (dto.getType().equals(1)) { //自检
+                    //获取自检的对应的数据pdf
+                    List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, dto.getIds()));
+                    List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
+                    pdfList.addAll(pdfURLs);
+
+                } else if (dto.getType().equals(2) || dto.getType().equals(3)) { //第三方、外委
+                    //获取第三方、外委的对应的数据pdf
+                    List<TrialDetectionData> trialDetectionData = trialDetectionDataService.getBaseMapper().selectList(Wrappers.<TrialDetectionData>lambdaQuery().in(TrialDetectionData::getId, dto.getIds()));
+                    List<String> pdfURLs = new ArrayList<>();
+                    for (TrialDetectionData trialDetectionDatum : trialDetectionData) {
+                        if (StringUtils.isNotEmpty(trialDetectionDatum.getRecordTableUrl())) {
+                            pdfURLs.add(trialDetectionDatum.getRecordTableUrl());
+                        }
+                        if (StringUtils.isNotEmpty(trialDetectionDatum.getReportAttachmentUrl())) {
+                            pdfURLs.add(trialDetectionDatum.getReportAttachmentUrl());
+                        }
+                    }
+                    pdfList.addAll(pdfURLs);
+
+                }
+
+                if (pdfList.size() > 0) {
+                    //合并pdf把试验自检记录、第三方、外委的pdf追加到当前质检合同段树节点下的pdf后显示
+                    List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
+                    String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                    String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
+                    File tabPDF = ResourceUtil.getFile(listPdf);
+                    if (tabPDF.exists()) {
+                        tabPDF.delete();
+                    }
+                    FileUtils.mergePdfPublicMethods(collect, listPdf);
+                    BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
+                    if (bladeFile != null) {
+                        //修改当前节点的pdfTrialURL地址
+                        if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
+                            //修改选中状态记录信息(选中为勾选绿色)
+                            baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType()); //先删除该类型的所有记录信息
+
+                            for (String recordId : Func.toStrList(dto.getIds())) {
+                                baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
+                            }
+                            return true;
+                        }
+                    }
+                }
+            } else {
+                throw new ServiceException("当前节点还未上报,获取pdf信息失败,请先上报后再进行关联");
+            }
+
+        } else { //删除
+            //如果没有关联信息ids=null,那么删除当前类型对应的记录
+            //删除前判断当前节点下关联的信息是否还有其他类型的,如果有就不修改pdfTrialUrl=null,如果当前记录为null,那就修改pdfTrialUrl=null
+            int row = baseMapper.selectCountSeletedStatus(dto.getNodeId(), dto.getType());
+            if (row == 0) {
+                //修改pdfTrialUrl=null
+                informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, null).eq(InformationQuery::getId, informationQuery.getId()));
+            }
+            //删除该类型的所有记录信息
+            baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType());
+            return true;
+        }
+
+        return false;
+    }
+
+
 }