Browse Source

feature 代码提交

xiahan 3 weeks ago
parent
commit
fe95036c9a

+ 1 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/config/ZHSWQuerySqlAdaptationInterceptor.java

@@ -144,7 +144,6 @@ public class ZHSWQuerySqlAdaptationInterceptor implements Interceptor {
         if(StringUtils.isNotBlank(schema)) {
             return schema;
         }
-
         String token = request.getHeader("token");
         logger.info("token:"+token);
 //        if(StringUtils.isBlank(token)){
@@ -173,6 +172,7 @@ public class ZHSWQuerySqlAdaptationInterceptor implements Interceptor {
         Object tokenDskey = request.getAttribute(Constants.SAAS_LOGIN_TOKEN);
         if(tokenDskey != null && StringUtils.isNotBlank(tokenDskey.toString())){
             schema = (String) tokenDskey;
+            logger.info("通过请求属性获取到的schema:" + schema);
         }else {
             schema = getSchemaByToken(token);
         }

+ 15 - 14
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/RefundServiceImpl.java

@@ -188,17 +188,21 @@ public class RefundServiceImpl implements RefundService {
     @Override
     public ResponseEntity<String> refundNotice(PrepayNoticeVo prepayNoticeVo, String dsKey) {
         log.info("微信退款申请成功回调函数: {},: {}", prepayNoticeVo, dsKey);
-        List<String> dsKeys;
-        if (StringUtils.isBlank(dsKey)) {
-            List<TenantDo> tenantList = (List<TenantDo>) redisService.getRedisCatchObj("allTenants");
-            // 获取 所有的主库信息
-            dsKeys = tenantList.stream().map(TenantDo::getDskey).collect(Collectors.toList());
-        } else {
-            dsKeys = Collections.singletonList(dsKey);
-        }
-        dsKeys.remove("incontrol");
+        // List<String> dsKeys;
+        // if (StringUtils.isBlank(dsKey)) {
+        //     List<TenantDo> tenantList = (List<TenantDo>) redisService.getRedisCatchObj("allTenants");
+        //     // 获取 所有的主库信息
+        //     dsKeys = tenantList.stream().map(TenantDo::getDskey).collect(Collectors.toList());
+        // } else {
+        //     dsKeys = Collections.singletonList(dsKey);
+        // }
+        // dsKeys.remove("incontrol");
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+        // 设置租户信息 自动切库
+        request.setAttribute(Constants.SAAS_LOGIN_TOKEN, dsKey);
         // 获取所有商户的密钥
-        List<SwEnterpriseConfigInfoDo> secretKeyList = commonBusinessDao.getSecretKey(dsKeys);
+        List<SwEnterpriseConfigInfoDo> secretKeyList = commonBusinessDao.getSecretKey(Collections.singletonList(dsKey));
         String analysisStr = null;
         String deKey = null;
         R error = R.error("失败");
@@ -237,10 +241,7 @@ public class RefundServiceImpl implements RefundService {
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error.toString());
         }
         log.debug("json解析正常:{}",weChatRefundNoticeVo);
-        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-        HttpServletRequest request = attributes.getRequest();
-        // 设置租户信息 自动切库
-        request.setAttribute(Constants.SAAS_LOGIN_TOKEN, deKey);
+
 
         String refundId = weChatRefundNoticeVo.getRefundId();
         String outRefundNo = weChatRefundNoticeVo.getOutRefundNo();