فهرست منبع

外部报验同步报送平台

wangming 1 سال پیش
والد
کامیت
b466763ea3

+ 22 - 8
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxOutsideInspectionItpDao.java

@@ -30,13 +30,27 @@ public interface ZhcxOutsideInspectionItpDao extends BaseMapper<ZhcxOutsideInspe
     void updateInspectionCount(Map<String, String> map);
 
 
-    @Select("SELECT\n" +
-            "\titp.*,zoiisd.SUPERVISION, zoiisd.INSPECTIONCONCLUSION, zoiisd.REFUSEREASON\n" +
-            "FROM\n" +
-            "\tZHCX_OUTSIDE_INSPECTION_ITP itp\n" +
-            "JOIN ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH zoiisd ON\n" +
-            "\tzoiisd.ITPID = itp.ID\n" +
-            "WHERE INSPECTIONCOMPLATETIME BETWEEN #{startTime} AND #{#{endTime}}\n" +
-            "AND NOT EXISTS (SELECT * FROM ZHCX_OUTSIDE_INSPECTION_SYNC_RECORD r WHERE r.ITPID = itp.ID)")
+    @Select("<script>" +
+            "SELECT  " +
+            " itp.*,zoiisd.SUPERVISION, zoiisd.INSPECTIONCONCLUSION, zoiisd.REFUSEREASON,  " +
+            " zipn.ISSUPP, zsm.\"TYPE\" AS subcontractortype " +
+            "FROM  " +
+            " ZHCX_OUTSIDE_INSPECTION_ITP itp  " +
+            "JOIN ZHCX_OUTSIDE_INSPECTION_ITP_SUPERVISION_DISPATCH zoiisd ON zoiisd.ITPID = itp.ID " +
+            "LEFT JOIN ZHCX_ITP_PROJECT_NODES zipn on zipn.ID = itp.INSPECTIONCONTENTID  " +
+            "LEFT JOIN ZHCX_SUBCONTRACTOR_MANAGE zsm ON zsm.ID = itp.SUBCONTRACTORID " +
+            "<where>" +
+            "<if test='startTime != null and endTime != null'>" +
+            "   AND RESERVATIONINSPECTIONTIME BETWEEN #{startTime} AND #{endTime}  and LIFECYCLE = '10'" +
+            "</if>" +
+            "<if test='outesideIdList != null'>" +
+            "AND itp.ID in " +
+            "<foreach collection=\"outesideIdList\" separator=\",\" open=\"(\" close=\")\" item=\"item\"> " +
+            "   #{item}" +
+            "</foreach>" +
+            "</if>" +
+            "AND NOT EXISTS (SELECT * FROM ZHCX_OUTSIDE_INSPECTION_SYNC_RECORD r WHERE r.ITPID = itp.ID and r.DELETED = '0')" +
+            "</where>" +
+            "</script>")
     List<OutsideInspactionSyncDto> getInspection(OutsideInspactionSyncReqquest req);
 }

+ 22 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/feign/BsPlatformService.java

@@ -0,0 +1,22 @@
+package com.rongwei.bscommon.sys.feign;
+
+import com.rongwei.bsentity.dto.OutsideInspactionSyncDto;
+import com.rongwei.rwcommon.base.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+@FeignClient(name = "bsPlatformService", url = "${bs-provider.url}")
+public interface BsPlatformService {
+
+    /**
+     * 推送外部报验数据
+     *
+     * @param list
+     * @return
+     */
+    @PostMapping("rw-business-server/sync/exterior-inspection")
+    R syncOutsideInpection(@RequestBody List<OutsideInspactionSyncDto> list);
+}

+ 1 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxInsideInspectionServiceImpl.java

@@ -125,7 +125,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
             }
 
             //只有待报验状态才能修改
-            if(!"20".equals(inspection.getInspectionstatus())) {
+            if(!"20".equals(inspection.getInspectionstatus()) && !"10".equals(inspection.getInspectionstatus())) {
                 throw new CustomException("只有待报验状态才能修改");
             }
 

+ 46 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxOutsideInspectionItpServiceImpl.java

@@ -11,6 +11,7 @@ import cn.hutool.core.util.ZipUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.rongwei.bscommon.sys.feign.BsPlatformService;
 import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ZhcxCommon;
 import com.rongwei.bsentity.domain.*;
@@ -97,6 +98,12 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
     @Autowired
     private ZhcxItpProjectNodesService itpProjectNodesService;
 
+    @Autowired
+    private BsPlatformService bsPlatformService;
+
+    @Autowired
+    private ZhcxOutsideInspectionSyncRecordService syncRecordService;
+
     /**
      * 保存外部报验单
      *
@@ -1112,7 +1119,45 @@ public class ZhcxOutsideInspectionItpServiceImpl extends ServiceImpl<ZhcxOutside
      */
     @Override
     public void sync2SubmissionPlatform(OutsideInspactionSyncReqquest req) {
-        List<OutsideInspactionSyncDto> inspection = dao.getInspection(req);
+        List<OutsideInspactionSyncDto> syncDtoList = dao.getInspection(req);
+
+        if(ObjectUtil.isEmpty(syncDtoList)) {
+            return ;
+        }
+
+        List<ZhcxOutsideInspectionSyncRecordDo> recordList = new ArrayList<>(syncDtoList.size());
+        for(OutsideInspactionSyncDto sync : syncDtoList) {
+            //接收,有条件接收
+            if("10".equals(sync.getInspectionconclusion()) || "30".equals(sync.getInspectionconclusion())) {
+                sync.setInspectionconclusion("ACC");
+            }
+            //拒收
+            else if("20".equals(sync.getInspectionconclusion())) {
+                sync.setInspectionconclusion("REJ");
+            }
+            sync.setBase("长兴分公司");
+
+            //itp报验并且是外协点
+            //非itp报验点并且分包商为驻外分包商
+            if(("itp".equals(sync.getLaunchtype()) && "true".equals(sync.getIssupp()))
+                    || ("unitp".equals(sync.getLaunchtype()) && "驻外分包商".equals(sync.getSubcontractortype()))
+            ) {
+                sync.setIssupp("y");
+            } else {
+                sync.setIssupp("n");
+            }
+
+            ZhcxOutsideInspectionSyncRecordDo record = new ZhcxOutsideInspectionSyncRecordDo();
+            record.setId(SecurityUtil.getUUID());
+            record.setSyncstate("3");
+            record.setItpid(sync.getId());
+            record.setDeleted("0");
+            recordList.add(record);
+        }
+
+        bsPlatformService.syncOutsideInpection(syncDtoList);
+        //保存同步记录
+        syncRecordService.saveBatch(recordList);
     }
 
     private void getIds(String files, List<String> fileIds) {

+ 10 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/OutsideInspactionSyncDto.java

@@ -178,4 +178,14 @@ public class OutsideInspactionSyncDto {
     @TableField("REFUSEREASON")
     @JsonProperty(value = "reasonrejection")
     private String refusereason;
+
+    /**
+     * 分包商类型
+     */
+    @JsonIgnoreProperties
+    private String subcontractortype;
+
+    @TableField("LAUNCHTYPE")
+    @JsonIgnoreProperties
+    private String launchtype;
 }

+ 12 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/OutsideInspactionSyncReqquest.java

@@ -1,8 +1,11 @@
 package com.rongwei.bsentity.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.*;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
+import java.util.List;
 
 @Setter
 @Getter
@@ -14,10 +17,19 @@ public class OutsideInspactionSyncReqquest {
     /**
      * 开始时间
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date startTime;
 
     /**
      * 结束时间
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date endTime;
+
+    /**
+     * 外部报验单id
+     */
+    private List<String> outesideIdList;
 }

+ 12 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxOutsideInspectionItpController.java

@@ -3,6 +3,7 @@ package com.rongwei.bsserver.controller;
 
 import com.rongwei.bscommon.sys.service.ZhcxOutsideInspectionItpService;
 import com.rongwei.bscommon.sys.service.ZhcxReprotSameDayRealTimeInspectionStatisticsService;
+import com.rongwei.bsentity.dto.OutsideInspactionSyncReqquest;
 import com.rongwei.bsentity.dto.ReInspectionRequest;
 import com.rongwei.bsentity.dto.outside.OutsideInspectionInsertRequest;
 import com.rongwei.bsentity.dto.outside.OutsideInspectionUpdateRequest;
@@ -92,5 +93,16 @@ public class ZhcxOutsideInspectionItpController {
         return R.ok();
     }
 
+    /**
+     * 推送到报验平台
+     *
+     * @param req
+     * @return
+     */
+    @PostMapping("/syncBsPlatform")
+    public R syncBsPlatform(@RequestBody OutsideInspactionSyncReqquest req){
+        service.sync2SubmissionPlatform(req);
+        return R.ok();
+    }
 }
 

+ 35 - 1
business-server/src/main/resources/bootstrap.yml

@@ -52,4 +52,38 @@ mybatis-plus:
     db-config:
       logic-delete-value: 1
       logic-not-delete-value: 0
-      column-like: true
+      column-like: true
+
+#onlyoffice配置
+onloyoffice:
+  token:
+    secret: 7QbEwl3MpE5mXinkecydGwhre7sJWN
+    expire: 240 # 分钟
+  office:
+    # 本机地址,需要注意【这个ip需要与[api]中的ip能ping通】
+    ip: http://61.177.40.178:4300/mlApi/common
+    # onlyoffice服务器的js文件,ip是服务器地址
+    api: http://61.177.40.178:8888/web-apps/apps/api/documents/api.js
+    # 交互地址
+    callbackUrl: /onlyoffice/callback?fileId=
+    # 文件下载地址
+    downloadUrl: /onlyoffice/downloadFile/
+
+
+    lang: zh
+    #  logo:
+    #    image: https://www.risencn.com/r/cms/www/default/risen/public/img/header-logo1.png
+    #    imageEmbedded: https://www.risencn.com/r/cms/www/default/risen/public/img/header-logo1.png
+    #    url: http://www.baidu.com
+    # 回退地址
+    goBack: ${office.ip}
+    # 可查看类型
+    viewedDocs: [.pdf,.djvu,.xps,.oxps]
+    #  可编辑类型
+    editedDocs: [.docx,.xlsx,.csv,.pptx,.txt,.docxf]
+    # 可类型转换类型
+    convertDocs: [.docm,.dotx,.dotm,.dot,.doc,.odt,.fodt,.ott,.xlsm,.xlsb,.xltx,.xltm,.xlt,.xls,.ods,.fods,.ots,.pptm,.ppt,.ppsx,.ppsm,.pps,.potx,.potm,.pot,.odp,.fodp,.otp,.rtf,.mht,.html,.htm,.xml,.epub,.fb2]
+
+# 报送
+bs-provider:
+  url: http://61.177.40.178:5500/api/

+ 2 - 2
business-server/src/main/resources/logback-spring.xml

@@ -4,7 +4,7 @@
     <!--输出到控制台-->
     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
-            <pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
+            <pattern>%d{HH:mm:ss} [%X{traceId}] [%thread] %-5level %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
 
@@ -18,7 +18,7 @@
         </rollingPolicy>
         <layout class="ch.qos.logback.classic.PatternLayout">
             <Pattern>
-                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level -%msg%n
+                %d{yyyy-MM-dd HH:mm:ss} [%X{traceId}] [%thread] %-5level -%msg%n
             </Pattern>
         </layout>
     </appender>