فهرست منبع

工具类修改

9060 1 سال پیش
والد
کامیت
1392b5f2dc

+ 60 - 3
src/com/kingdee/eas/custom/shuiyou/uitls/SYUtilsFacadeControllerBean.java

@@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Maps;
 import com.kingdee.bos.dao.IObjectPK;
 import com.kingdee.bos.util.BOSUuid;
 import com.kingdee.eas.base.permission.UserInfo;
@@ -107,18 +109,24 @@ public class SYUtilsFacadeControllerBean extends AbstractSYUtilsFacadeController
             logInfo.setBizDate(timestamp);
 
             JSONObject paramMap = JSONUtil.parseObj(param);
+
             //获取配置文件
             Map<String,String> propt = this._getConfig(ctx);
+            Map signaMap = Maps.newHashMap();
             if(StrUtil.isBlank(paramMap.getStr("timestamp"))){
 
-                paramMap.set("timestamp",String.valueOf(timestampLong));
+                signaMap.put("timestamp",String.valueOf(timestampLong));
+            }else {
+                signaMap.put("timestamp",paramMap.getStr("timestamp"));
             }
             if(StrUtil.isBlank(paramMap.getStr("xReqNonce"))){
                 String xReqNonce = UUID.randomUUID().toString().replace("-", "");//调用者生成的 UUID(32位),结合时间戳timestamp 防重放
-                paramMap.set("xReqNonce",xReqNonce);
+                signaMap.put("xReqNonce",xReqNonce);
+            }else {
+                signaMap.put("xReqNonce",paramMap.getStr("xReqNonce"));
             }
             param=JSONUtil.toJsonStr(paramMap);
-            String signature = this._getSignature(ctx,propt,paramMap);
+            String signature = this._getSignature(ctx,propt,signaMap);
             Map<String,String> headers = new HashMap<String,String>();
             headers.put("appKey",propt.get("appKey"));
             headers.put("timestamp",paramMap.getStr("timestamp"));
@@ -338,4 +346,53 @@ public class SYUtilsFacadeControllerBean extends AbstractSYUtilsFacadeController
         Map map = SYUConfigUtil.getInstance().getConfig();
         return map;
     }
+//
+//    public static void main(String[] args) throws BOSException, IOException {
+//        SYUtilsFacadeControllerBean bean = new SYUtilsFacadeControllerBean();
+//        bean._initConfig(null,"D:\\jingdie\\yss\\8.6v2jar\\Project_86v2\\jiuzhoutong\\config\\server\\properties\\sy\\syConfig.properties");
+//        Map propt = bean.getConfig(null);
+//
+//        OkHttpClient client = new OkHttpClient();
+//        Long timestampLong = System.currentTimeMillis();
+//        Map<String,String> postBody = new HashMap<>();
+//        postBody.put("qymc","荆州九州通医药有限公司00");
+//        postBody.put("nsrsbh","91310124834931897I");
+//        postBody.put("areaid","310101");
+////        postBody.put("xReqNonce","c1fe0ae4344444979139360ad5fe5ee9");
+////        postBody.put("timestamp","1724899304337");
+//        Map signaMap = Maps.newHashMap();
+//        if(StrUtil.isBlank(postBody.get("timestamp"))){
+//
+//            signaMap.put("timestamp",String.valueOf(timestampLong));
+//        }
+//        if(StrUtil.isBlank(postBody.get("xReqNonce"))){
+//            String xReqNonce = UUID.randomUUID().toString().replace("-", "");//调用者生成的 UUID(32位),结合时间戳timestamp 防重放
+//            signaMap.put("xReqNonce",xReqNonce);
+//        }
+//
+//
+//        String signature = bean._getSignature(null,propt,signaMap);
+//        Map<String,String> headers = new HashMap<String,String>();
+//        headers.put("appKey", (String) propt.get("appKey"));
+//        headers.put("timestamp", (String) signaMap.get("timestamp"));
+//        headers.put("version", (String) propt.get("version"));
+//        headers.put("xReqNonce", (String) signaMap.get("xReqNonce"));
+//        headers.put("signature",signature);
+//
+//
+//        RequestBody body = RequestBody.create(MediaType.parse("application/json"), JSON.toJSONString(postBody));
+//
+//        Request sYRequest = new Request.Builder()
+//                .url(propt.get("ip")+"/gateway/iit/declare/getCompanyRegisterInfo")
+//                .post(body).headers(Headers.of(headers))
+//                .build();
+//
+//        System.out.println("headers:"+JSON.toJSONString(headers));
+//        Response sYResponse = client.newCall(sYRequest).execute();
+//        if (sYResponse.body() != null) {
+//            System.out.println(sYResponse.body().string());
+//        }
+//
+//    }
+
 }

+ 63 - 0
src/com/kingdee/eas/custom/shuiyou/uitls/URLConfigEnum.java

@@ -0,0 +1,63 @@
+/**
+ * output package name
+ */
+package com.kingdee.eas.custom.shuiyou.uitls;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import com.kingdee.util.enums.StringEnum;
+
+/**
+ * output class name
+ */
+public class URLConfigEnum extends StringEnum
+{
+    public static final String CONFIRMPREDEDUCT_VALUE = "/gateway/iit/deductionAmount/confirmPreDeduct";//alias=왱뇜츰데횅훰
+    public static final String GETPREDEDUCTCONFIRMFEEDBACK_VALUE = "/gateway/iit/deductionAmount/getPreDeductConfirmFeedback";//alias=왱뇜츰데횅훰럽웩
+
+    public static final URLConfigEnum confirmPreDeduct = new URLConfigEnum("confirmPreDeduct", CONFIRMPREDEDUCT_VALUE);
+    public static final URLConfigEnum getPreDeductConfirmFeedback = new URLConfigEnum("getPreDeductConfirmFeedback", GETPREDEDUCTCONFIRMFEEDBACK_VALUE);
+
+    /**
+     * construct function
+     * @param String uRLConfigEnum
+     */
+    private URLConfigEnum(String name, String uRLConfigEnum)
+    {
+        super(name, uRLConfigEnum);
+    }
+    
+    /**
+     * getEnum function
+     * @param String arguments
+     */
+    public static URLConfigEnum getEnum(String uRLConfigEnum)
+    {
+        return (URLConfigEnum)getEnum(URLConfigEnum.class, uRLConfigEnum);
+    }
+
+    /**
+     * getEnumMap function
+     */
+    public static Map getEnumMap()
+    {
+        return getEnumMap(URLConfigEnum.class);
+    }
+
+    /**
+     * getEnumList function
+     */
+    public static List getEnumList()
+    {
+         return getEnumList(URLConfigEnum.class);
+    }
+    
+    /**
+     * getIterator function
+     */
+    public static Iterator iterator()
+    {
+         return iterator(URLConfigEnum.class);
+    }
+}

+ 2 - 0
src/com/kingdee/eas/custom/shuiyou/uitls/URLConfigEnum.properties

@@ -0,0 +1,2 @@
+confirmPreDeduct=\u6263\u9664\u540D\u5355\u786E\u8BA4
+getPreDeductConfirmFeedback=\u6263\u9664\u540D\u5355\u786E\u8BA4\u53CD\u9988

+ 2 - 0
src/com/kingdee/eas/custom/shuiyou/uitls/URLConfigEnum_l1.properties

@@ -0,0 +1,2 @@
+confirmPreDeduct=
+getPreDeductConfirmFeedback=

+ 2 - 0
src/com/kingdee/eas/custom/shuiyou/uitls/URLConfigEnum_l2.properties

@@ -0,0 +1,2 @@
+confirmPreDeduct=\u6263\u9664\u540D\u5355\u786E\u8BA4
+getPreDeductConfirmFeedback=\u6263\u9664\u540D\u5355\u786E\u8BA4\u53CD\u9988

+ 2 - 0
src/com/kingdee/eas/custom/shuiyou/uitls/URLConfigEnum_l3.properties

@@ -0,0 +1,2 @@
+confirmPreDeduct=\u6263\u9664\u540D\u55AE\u78BA\u8A8D
+getPreDeductConfirmFeedback=\u6263\u9664\u540D\u55AE\u78BA\u8A8D\u53CD\u994B