Prechádzať zdrojové kódy

'调用金蝶接口'

HUJIANGUO 4 rokov pred
rodič
commit
b244f43399

+ 9 - 0
src/main/java/com/steerinfo/dil/feign/JoinApiFeign.java

@@ -2,6 +2,7 @@ package com.steerinfo.dil.feign;
 
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
@@ -39,4 +40,12 @@ public interface JoinApiFeign {
     @PostMapping("api/v1/join/bmsporthandlingfee/getPortFee")
     Map<String,Object> getPortFee(@RequestParam("feeId") Integer feeId);
 
+    /**
+     * 推送结算信息给金蝶的接口
+     * @param map
+     * @return
+     */
+    @PostMapping("api/v1/join/wsface/pushBmsSettlement")
+    String WSFaceWay(@RequestBody Map<String, Object> map);
+
 }

+ 10 - 1
src/main/java/com/steerinfo/dil/service/impl/BmsportHandlingFeeServiceImpl.java

@@ -4,6 +4,7 @@ import com.steerinfo.dil.feign.JoinApiFeign;
 import com.steerinfo.dil.mapper.BmsportHandlingFeeMapper;
 import com.steerinfo.dil.model.BmsportHandlingFee;
 import com.steerinfo.dil.service.IBmsportHandlingFeeService;
+import com.steerinfo.dil.util.EASUtil;
 import com.steerinfo.dil.util.NoUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,6 +33,8 @@ public class BmsportHandlingFeeServiceImpl implements IBmsportHandlingFeeService
     JoinApiFeign joinApiFeign;
     @Autowired
     NoUtil noUtil;
+    @Autowired
+    EASUtil easUtil;
 
     /**
      * 修改港口装卸费结算
@@ -95,7 +98,13 @@ public class BmsportHandlingFeeServiceImpl implements IBmsportHandlingFeeService
         bmsportHandlingFee.setInsertUpdateRemark("无");
         int code = bmsportHandlingFeeMapper.insertSelective(bmsportHandlingFee);
         // 调用金蝶接口
-        Map<String, Object> mapValue = joinApiFeign.getPortFee(feeId.intValue());
+        Map<String, Object> input = joinApiFeign.getPortFee(feeId.intValue());
+        Map<String, Object> totalMap = easUtil.getTotalMap();
+        totalMap.put("input",input);
+        joinApiFeign.WSFaceWay(totalMap);
+//        if (result.equals()) {
+//
+//        }
         return code;
     }
 

+ 21 - 3
src/main/java/com/steerinfo/dil/service/impl/BmsshipStatementServiceImpl.java

@@ -6,6 +6,7 @@ import com.steerinfo.dil.model.BmsshipDetailsOrder;
 import com.steerinfo.dil.model.BmsshipDetailsStatement;
 import com.steerinfo.dil.model.BmsshipStatement;
 import com.steerinfo.dil.service.IBmsshipStatementService;
+import com.steerinfo.dil.util.EASUtil;
 import com.steerinfo.dil.util.NoUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -36,6 +37,8 @@ public class BmsshipStatementServiceImpl implements IBmsshipStatementService {
     NoUtil noUtil;
     @Autowired
     JoinApiFeign joinApiFeign;
+    @Autowired
+    EASUtil easUtil;
 
     /**
      * 生成水运费账单
@@ -91,9 +94,14 @@ public class BmsshipStatementServiceImpl implements IBmsshipStatementService {
         bmsshipStatement.setStatementType("水运费");
         int code = bmsshipStatementMapper.insertSelective(bmsshipStatement);
         // 调用金蝶接口
-        List<Map<String,Object>> mapList = joinApiFeign.getPurchaseShipDetails(statementId.intValue());
-        Map<String,Object> mapValue = joinApiFeign.getShipStatement(statementId.intValue());
-        mapValue.put("mapList",mapList);
+        List<Map<String,Object>> entries = joinApiFeign.getPurchaseShipDetails(statementId.intValue());
+        Map<String,Object> head = joinApiFeign.getShipStatement(statementId.intValue());
+        Map<String,Object> input = new HashMap<>();
+        input.put("head",head);
+        input.put("entries",entries);
+        Map<String, Object> totalMap = easUtil.getTotalMap();
+        totalMap.put("input",input);
+        joinApiFeign.WSFaceWay(totalMap);
         return code;
     }
 
@@ -127,6 +135,11 @@ public class BmsshipStatementServiceImpl implements IBmsshipStatementService {
         bmsshipStatement.setInsertUpdateRemark("无");
         bmsshipStatement.setStatementShipperId(new BigDecimal(1));
         int code = bmsshipStatementMapper.insertSelective(bmsshipStatement);
+        // 调用金蝶接口
+        Map<String, Object> totalMap = easUtil.getTotalMap();
+        Map<String, Object> input = joinApiFeign.getShipStatement(statementId.intValue());
+        totalMap.put("input",input);
+        joinApiFeign.WSFaceWay(totalMap);
         return code;
     }
 
@@ -159,6 +172,11 @@ public class BmsshipStatementServiceImpl implements IBmsshipStatementService {
         bmsshipStatement.setUpdateUsername("admin");
         bmsshipStatement.setInsertUpdateRemark("无");
         int code = bmsshipStatementMapper.insertSelective(bmsshipStatement);
+        // 调用金蝶接口
+        Map<String, Object> totalMap = easUtil.getTotalMap();
+        Map<String, Object> input = joinApiFeign.getShipStatement(statementId.intValue());
+        totalMap.put("input",input);
+        joinApiFeign.WSFaceWay(totalMap);
         return code;
     }
 

+ 69 - 0
src/main/java/com/steerinfo/dil/util/EASUtil.java

@@ -0,0 +1,69 @@
+package com.steerinfo.dil.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 配置金蝶连接常量Map
+ * @Description:
+ * @Author:HuJianGuo
+ * @GreateTime:2021/11/15 19:44
+ * @Version:V2.0
+ */
+public class EASUtil {
+    // totalMap
+    public final Map<String,Object> totalMap = new HashMap<>();
+    // context
+    public final Map<String,Object> context = new HashMap<>();
+    public final boolean logError = true;
+    public final boolean logData = true;
+    // context
+    public final Map<String,Object> login = new HashMap<>();
+    public final String password = "kduser";
+    public final String dcName = "D001";
+    public final String dbType = "0";
+    public final String userName = "user";
+    // context
+    public final String command = "savePayOtherBill";
+
+    /**
+     * 得到context的map
+     * @return
+     */
+    public Map<String,Object> getContext(){
+        this.context.put("logError",logError);
+        this.context.put("logData",logData);
+        return this.context;
+    }
+
+    /**
+     * 得到login的map
+     * @return
+     */
+    public Map<String,Object> getLogin(){
+        this.login.put("password",password);
+        this.login.put("dcName",dcName);
+        this.login.put("dbType",dbType);
+        this.login.put("userName",userName);
+        return this.login;
+    }
+
+    /**
+     * 得到command字符串
+     * @return
+     */
+    public String getCommand(){
+        return this.command;
+    }
+
+    /**
+     * 将所有的配置放入到totalMap的map里面
+     * @return
+     */
+    public Map<String,Object> getTotalMap() {
+        totalMap.put("context",getContext());
+        totalMap.put("login",getLogin());
+        totalMap.put("command",getCommand());
+        return this.totalMap;
+    }
+}