java110 4 年 前
コミット
06a6314765

+ 1 - 1
service-api/src/main/java/com/java110/api/controller/app/OwnerController.java

@@ -175,7 +175,7 @@ public class OwnerController extends BaseController {
      */
     @RequestMapping(path = "/refreshOpenId")
     public ResponseEntity<String> refreshOpenId(@RequestParam String redirectUrl,
-                                                @RequestParam String wAppId,
+                                                @RequestParam(required = false) String wAppId,
                                                 HttpServletRequest request,
                                                 HttpServletResponse response) {
         IPageData pd = PageData.newInstance().builder("", "", "", "",

+ 10 - 5
service-api/src/main/java/com/java110/api/smo/login/impl/OwnerAppLoginSMOImpl.java

@@ -381,11 +381,7 @@ public class OwnerAppLoginSMOImpl extends DefaultAbstractComponentSMO implements
 
     @Override
     public ResponseEntity<String> refreshOpenId(IPageData pd, String redirectUrl, String wAppId, HttpServletRequest request, HttpServletResponse response) {
-        //分配urlCode
-        String urlCode = UUID.randomUUID().toString();
-        JSONObject param = new JSONObject();
-        param.put("redirectUrl", redirectUrl);
-        CommonCache.setValue(urlCode, param.toJSONString(), expireTime);
+
         SmallWeChatDto smallWeChatDto = null;
         if (!StringUtil.isEmpty(wAppId)) {
             JSONObject paramIn = new JSONObject();
@@ -400,6 +396,15 @@ public class OwnerAppLoginSMOImpl extends DefaultAbstractComponentSMO implements
             smallWeChatDto.setPayPassword(wechatAuthProperties.getKey());
         }
 
+        //分配urlCode
+        String urlCode = UUID.randomUUID().toString();
+        JSONObject param = new JSONObject();
+        if (redirectUrl.indexOf("appId") < 0) {
+            redirectUrl += ("&appId=" + smallWeChatDto.getAppId());
+        }
+        param.put("redirectUrl", redirectUrl);
+        CommonCache.setValue(urlCode, param.toJSONString(), expireTime);
+
         URL url = null;
         String openUrl = "";
         try {

+ 7 - 5
service-api/src/main/java/com/java110/api/smo/payment/impl/ToPayTempCarInoutSMOImpl.java

@@ -2,15 +2,14 @@ package com.java110.api.smo.payment.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.java110.core.context.IPageData;
-import com.java110.core.context.PageData;
-import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.api.properties.WechatAuthProperties;
 import com.java110.api.smo.AppAbstractComponentSMO;
 import com.java110.api.smo.payment.IToPayTempCarInoutSMO;
 import com.java110.api.smo.payment.adapt.IPayAdapt;
+import com.java110.core.context.IPageData;
+import com.java110.core.context.PageData;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.utils.cache.MappingCache;
-import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.factory.ApplicationContextFactory;
 import com.java110.utils.util.Assert;
@@ -112,12 +111,15 @@ public class ToPayTempCarInoutSMOImpl extends AppAbstractComponentSMO implements
 
         ResponseEntity responseEntity = null;
 
+        if (!paramIn.containsKey("appId") || StringUtil.isEmpty(paramIn.getString("appId"))) {
+            return null;
+        }
         pd = PageData.newInstance().builder(pd.getUserId(), "", "", pd.getReqData(),
                 "", "", "", "",
                 pd.getAppId());
         responseEntity = this.callCenterService(restTemplate, pd, "",
                 "smallWeChat.listSmallWeChats?appId="
-                        + paramIn.getString("appId") + "&page=1&row=1&communityId="+paramIn.getString("communityId"), HttpMethod.GET);
+                        + paramIn.getString("appId") + "&page=1&row=1&communityId=" + paramIn.getString("communityId"), HttpMethod.GET);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
             return null;