18482106067 2 лет назад
Родитель
Сommit
5f495694f9

+ 17 - 67
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractLogisticsService.java

@@ -71,6 +71,8 @@ public class KwcContractLogisticsService {
     @Autowired
     private RemoteContractServiceImpl remoteContractService;
 
+    @Autowired
+    private CommonBusinessService commonBusinessService;
 
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
@@ -352,80 +354,28 @@ public class KwcContractLogisticsService {
         changeToSubmit(id);
 
         if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
-            postToEsign(reqVo, id);
+            commonBusinessService.postToEsign(reqVo.getBaseInfo().getCheckedPhone(),
+                                              reqVo.getBaseInfo().getCarrierPhone(),
+                                              reqVo.getBaseInfo().getCheckedEntId(),
+                                              reqVo.getBaseInfo().getCarrierEntId(),
+                                              reqVo.getContractFile(),
+                                              id,
+                                              reqVo.getBaseInfo().getContractName());
+        }
+
+        //线下签约直接通过
+        if (DictEnum.SIGNING_WAY_2.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
+            ESignCallBackReqVo eSignCallBackReqVo = new ESignCallBackReqVo();
+            eSignCallBackReqVo.setContractId(id);
+            eSignCallBackReqVo.setStatus(ContractStatusEnum.SIGNED.getCode());
+            commonBusinessService.approval(eSignCallBackReqVo);
         }
         return id;
     }
 
-    /**
-     * @param reqVo  发起签约入参 id合同id
-     * @desc: 调e签宝
-     * @author: czh
-     * @date: 2023/8/14
-     */
-    private void postToEsign(ContractLogisticsReqVo reqVo, Long id) {
-        EsignGetFlowReqDto esignGetFlowReqDto = new EsignGetFlowReqDto();
-        JSONArray jsonArray = JSONArray.parseArray(reqVo.getContractFile());
-        JSONObject jsonObject = jsonArray.getJSONObject(0);
-        String fileName = jsonObject.getString("name");
-        String url = jsonObject.getString("url");
-        File file = getFileByHttpURL(url, fileName);
-
-        Long carrierEntId = reqVo.getBaseInfo().getCarrierEntId();
-        Long checkedEntId = reqVo.getBaseInfo().getCheckedEntId();
-        List<Long> entIds = new ArrayList<>(2);
-        entIds.add(carrierEntId);
-        entIds.add(checkedEntId);
-        Map<Long,EntCacheResDto> longListMap = remoteSystemService.queryEntCacheMapByIds(entIds);
-
-
-        esignGetFlowReqDto.setFile(file);
-        esignGetFlowReqDto.setSeqId(String.valueOf(id));
-        esignGetFlowReqDto.setSignFlowTitle(reqVo.getBaseInfo().getContractName());
-        esignGetFlowReqDto.setOrgFirstName(longListMap.get(checkedEntId).getFirmName());
-        esignGetFlowReqDto.setPsnFirstAccount(reqVo.getBaseInfo().getCheckedPhone());
-        esignGetFlowReqDto.setOrgSecondName(longListMap.get(carrierEntId).getFirmName());
-        esignGetFlowReqDto.setPsnSecondAccount(reqVo.getBaseInfo().getCarrierPhone());
-        Map<String, Object> map = BeanUtils.convertToMap(esignGetFlowReqDto);
-        String res = OkHttpUtils.doPostUploadFile("http://10.10.10.224:8840/v1/sign/getFlow", map);
-        //todo 解析返参,返参有流程id返回,表需要新加字段来存储
 
-    }
 
-    public static File getFileByHttpURL(String newUrl, String fileName) {
-        String[] suffix = newUrl.split("/");
-        //得到最后一个分隔符后的名字
-        File file = null;
-        InputStream inputStream = null;
-        OutputStream outputStream = null;
-        try {
-            file = File.createTempFile("", fileName);
-            URL urlFile = new URL(newUrl);
-            inputStream = urlFile.openStream();
-            outputStream = new FileOutputStream(file);
-
-            int bytesRead = 0;
-            byte[] buffer = new byte[8192];
-            while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
-                outputStream.write(buffer, 0, bytesRead);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            try {
-                if (null != outputStream) {
-                    outputStream.close();
-                }
-                if (null != inputStream) {
-                    inputStream.close();
-                }
 
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        return file;
-    }
 
 
     /**

+ 23 - 0
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/KwcContractTradeService.java

@@ -64,6 +64,9 @@ public class KwcContractTradeService {
     @Autowired
     private KwcContractTradeUnitService kwcContractTradeUnitService;
 
+    @Autowired
+    private CommonBusinessService commonBusinessService;
+
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
@@ -399,6 +402,26 @@ public class KwcContractTradeService {
         }
         update(reqVo);
         changeToSubmit(id);
+
+        if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
+            if (DictEnum.SIGNING_WAY_1.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
+                commonBusinessService.postToEsign(reqVo.getBaseInfo().getProvidePhone(),
+                        reqVo.getBaseInfo().getPurchasePhone(),
+                        reqVo.getBaseInfo().getProvideEntId(),
+                        reqVo.getBaseInfo().getPurchaseEntId(),
+                        reqVo.getContractFile(),
+                        id,
+                        reqVo.getBaseInfo().getContractName());
+            }
+        }
+
+        //线下签约直接通过
+        if (DictEnum.SIGNING_WAY_2.getValue().equals(String.valueOf(reqVo.getBaseInfo().getSigningWay()))) {
+            ESignCallBackReqVo eSignCallBackReqVo = new ESignCallBackReqVo();
+            eSignCallBackReqVo.setContractId(id);
+            eSignCallBackReqVo.setStatus(ContractStatusEnum.SIGNED.getCode());
+            commonBusinessService.approval(eSignCallBackReqVo);
+        }
         return id;
     }