java110 před 5 roky
rodič
revize
cf328abb19

+ 29 - 6
java110-core/src/main/java/com/java110/core/base/smo/BaseServiceSMO.java

@@ -2,15 +2,15 @@ package com.java110.core.base.smo;
 
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.util.ProtocolUtil;
-import com.java110.utils.util.StringUtil;
 import com.java110.core.base.AppBase;
 import com.java110.core.context.AppContext;
 import com.java110.intf.code.IPrimaryKeyInnerServiceSMO;
-
+import com.java110.utils.util.ProtocolUtil;
+import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -53,8 +53,6 @@ public class BaseServiceSMO extends AppBase {
     }
 
 
-
-
     /**
      * 创建上下文对象
      *
@@ -80,7 +78,7 @@ public class BaseServiceSMO extends AppBase {
         urlParam += "?";
 
         for (Object key : info.keySet()) {
-            if (StringUtil.isNullOrNone(info.get(key) )) {
+            if (StringUtil.isNullOrNone(info.get(key))) {
                 continue;
             }
 
@@ -91,4 +89,29 @@ public class BaseServiceSMO extends AppBase {
 
         return urlParam;
     }
+
+    /**
+     * @param urlparam 带分隔的url参数
+     * @return
+     */
+    public static Map<String, String> urlToMap(String urlparam) {
+        if (urlparam.indexOf("?") < 0) {
+            return new HashMap<>();
+        }
+        urlparam = urlparam.substring(urlparam.indexOf("?")+1);
+        Map<String, String> map = new HashMap<String, String>();
+        String[] param = urlparam.split("&");
+        for (String keyvalue : param) {
+            String[] pair = keyvalue.split("=");
+            if (pair.length == 2) {
+                map.put(pair[0], pair[1]);
+            }
+        }
+        return map;
+    }
+
+    public static void main(String[] args) {
+        String url = "https://www.xx.com";
+        System.out.println(url.substring(0,url.indexOf("?")));
+    }
 }

+ 22 - 14
service-front/src/main/java/com/java110/front/smo/login/impl/OwnerAppLoginSMOImpl.java

@@ -214,10 +214,10 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
             //将openId放到redis 缓存,给前段下发临时票据
             String code = UUID.randomUUID().toString();
             CommonCache.setValue(code, openId, expireTime);
-            if(errorUrl.indexOf("?")> 0){
-                errorUrl +=("&code=" + code);
-            }else{
-                errorUrl +=("?code=" + code);
+            if (errorUrl.indexOf("?") > 0) {
+                errorUrl += ("&code=" + code);
+            } else {
+                errorUrl += ("?code=" + code);
             }
             return ResultVo.redirectPage(errorUrl);
         }
@@ -234,12 +234,12 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
             //将openId放到redis 缓存,给前段下发临时票据
             String code = UUID.randomUUID().toString();
             CommonCache.setValue(code, openId, expireTime);
-            if(errorUrl.indexOf("?")> 0){
-                errorUrl +=("&code=" + code);
-            }else{
-                errorUrl +=("?code=" + code);
+            if (errorUrl.indexOf("?") > 0) {
+                errorUrl += ("&code=" + code);
+            } else {
+                errorUrl += ("?code=" + code);
             }
-            return ResultVo.redirectPage(errorUrl );
+            return ResultVo.redirectPage(errorUrl);
         }
 
         // String accessToken = paramObj.getString("access_token");//暂时不用
@@ -261,14 +261,22 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
         if (StringUtil.isEmpty(tmpUserDto.getKey())) {
             String code = UUID.randomUUID().toString();
             CommonCache.setValue(code, openId, expireTime);
-            if(errorUrl.indexOf("?")> 0){
-                errorUrl +=("&code=" + code);
-            }else{
-                errorUrl +=("?code=" + code);
+            if (errorUrl.indexOf("?") > 0) {
+                errorUrl += ("&code=" + code);
+            } else {
+                errorUrl += ("?code=" + code);
             }
             return ResultVo.redirectPage(errorUrl);
         }
-        redirectUrl = redirectUrl + (redirectUrl.indexOf("?") > 0 ? "&key=" + tmpUserDto.getKey() : "?key=" + tmpUserDto.getKey());
+        //如果参数中有key 直接用新的覆盖
+        Map tempRedirectParam = super.urlToMap(redirectUrl);
+        tempRedirectParam.put("key", tmpUserDto.getKey());
+        if (redirectUrl.indexOf("?") > -1) {
+            redirectUrl = redirectUrl.substring(0, redirectUrl.indexOf("?")) + super.mapToUrlParam(tempRedirectParam);
+        } else {
+            redirectUrl = redirectUrl + super.mapToUrlParam(tempRedirectParam);
+        }
+        //redirectUrl = redirectUrl + (redirectUrl.indexOf("?") > 0 ? "&key=" + tmpUserDto.getKey() : "?key=" + tmpUserDto.getKey());
         return ResultVo.redirectPage(redirectUrl);
 
     }

+ 1 - 1
service-job/src/main/resources/application-dev.yml

@@ -117,7 +117,7 @@ quartz:
         jobStore:
           class: org.quartz.impl.jdbcjobstore.JobStoreTX
           driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
-          tablePrefix: HC_
+          tablePrefix: qrtz_
           isClustered: false
           clusterCheckinInterval: 10000
           useProperties: false

+ 1 - 1
service-job/src/main/resources/quartzdelete.properties

@@ -30,7 +30,7 @@ org.quartz.jobStore.useProperties = false
 #数据库别名 随便取
 #org.quartz.jobStore.dataSource = myDS
 #表的前缀,默认QRTZ
-org.quartz.jobStore.tablePrefix = HC
+org.quartz.jobStore.tablePrefix = qrtz_
 #是否加入集群
 org.quartz.jobStore.isClustered = true
 #调度实例失效的检查时间间隔