Kaynağa Gözat

入账通知调整

lfx 1 ay önce
ebeveyn
işleme
59ee35d0ba

+ 6 - 3
mjava-ts/src/main/java/com/malk/taisen/controller/ArNotifyController.java

@@ -5,6 +5,7 @@ import com.malk.taisen.dto.ArNotifyRequest;
 import com.malk.taisen.dto.ArNotifyResponse;
 import com.malk.taisen.service.ArNotifyService;
 import com.malk.utils.UtilList;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
 /**
  * AR automatic posting notification API for SAP middleware.
  */
+@Slf4j
 @RestController
 @RequestMapping("/ar-notify")
 public class ArNotifyController {
@@ -29,12 +31,13 @@ public class ArNotifyController {
      */
     @PostMapping
     public ArNotifyResponse notify(@RequestBody ArNotifyRequest request) {
+        log.info("ar-notify: {}", request);
         if (request == null || UtilList.isEmpty(request.getItems())) {
             return ArNotifyResponse.error("ITEM不能为空");
         }
-        if (request.getItems().size() > 100) {
-            return ArNotifyResponse.error("ITEM单次最多100条");
-        }
+//        if (request.getItems().size() > 100) {
+//            return ArNotifyResponse.error("ITEM单次最多100条");
+//        }
         return arNotifyService.notify(request.getItems()) ? ArNotifyResponse.success()
                 : ArNotifyResponse.error("通知失败");
     }

+ 12 - 1
mjava-ts/src/main/java/com/malk/taisen/service/impl/ArNotifyServiceImpl.java

@@ -1,6 +1,8 @@
 package com.malk.taisen.service.impl;
 
+import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
 import com.malk.server.dingtalk.DDR_New;
@@ -265,7 +267,7 @@ public class ArNotifyServiceImpl implements ArNotifyService {
         return rows;
     }
 
-    private long dateMillis(String date) {
+    private static long dateMillis(String date) {
         try {
             SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
             formatter.setLenient(false);
@@ -285,4 +287,13 @@ public class ArNotifyServiceImpl implements ArNotifyService {
     private interface Action {
         Object execute();
     }
+
+    public static void main(String[] args) {
+        String url = "https://etl-nonprod-tasks.tysondt.com:443/api/1/rest/feed/run/task/TysonNonProd/projects/10-QA-team-cash-to-order/tk_dingtalk_to_sap_otc_inquiry?bearer_token=Rs8eIy614To-g4UAQTsYTt@G9bRMhQrl";
+//        String url2 = "https://etl-nonprod-tasks.tysondt.com:443/api/1/rest/feed/run/task/TysonNonProd/projects/00-STG-team-cash-to-order/tk_dingtalk_to_sap_otc_unlocked_orders_inquiry?bearer_token=i2AZ93FBOD42aPNLyWACGxXRyK0LdY8U";
+        String result= HttpUtil.createPost(url).body(JSONObject.toJSONString(UtilMap.map("CUSTOMER_NUMBER","3000045"))).form(JSONObject.toJSONString(UtilMap.map("requestID, interface_no","12345, OTC002"))).execute().body();
+        System.out.println(result);
+//        String result2= HttpUtil.createPost(url2).body(JSONObject.toJSONString(UtilMap.map("CUSTOMER_NUMBER","1000253"))).form(JSONObject.toJSONString(UtilMap.map("requestID","1234"))).execute().body();
+//        System.out.println(result2);
+    }
 }