feat:分账门店映射

This commit is contained in:
suzhuhong
2026-04-17 16:03:56 +08:00
parent edfda87f92
commit 2caabe3fe1
2 changed files with 29 additions and 1 deletions

View File

@@ -418,4 +418,6 @@ public class RedisConstant {
* 新管家缴费回调完成 标识
*/
public static final String XGJ_CALLBACK_SHOP = "xgj_callback_shop:{0}";
public static final String STORE_ID_MAPPING = "store_id_mapping";
}

View File

@@ -1,22 +1,32 @@
package com.cool.store.http;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dao.StoreDao;
import com.cool.store.entity.StoreDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.RsaSignUtil;
import com.cool.store.utils.StringUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.apache.catalina.Store;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @Author suzhuhong
@@ -33,6 +43,11 @@ public class WalletHttpClientRest {
@Autowired
private ObjectMapper objectMapper;
@Resource
RedisUtilPool redisUtilPool;
private static final String STORE_ID = "storeId";
@Value("${cool.api.rsa.private.key}")
private String coolPrivateKey;
@Value("${wallet.api.rsa.public.key}")
@@ -238,7 +253,18 @@ public class WalletHttpClientRest {
if (obj instanceof Map) {
return (Map<String, Object>) obj;
}
return objectMapper.convertValue(obj, new TypeReference<Map<String, Object>>() {});
Map<String, Object> map = objectMapper.convertValue(obj, new TypeReference<Map<String, Object>>() {
});
//门店映射
if (map.containsKey(STORE_ID)){
String key = RedisConstant.STORE_ID_MAPPING;
String storeId = (String) map.get(STORE_ID);
String storeIdMapping = redisUtilPool.hashGet(key, storeId);
if (StringUtil.isNotEmpty(storeIdMapping)){
map.put(STORE_ID,storeIdMapping);
}
}
return map;
}
}