Merge branch 'master' into cc_20251028_decoration
This commit is contained in:
@@ -42,6 +42,11 @@ public class OpenApiValidateFilter implements Filter {
|
||||
private String coolAppKey;
|
||||
@Value("${cool.api.secret}")
|
||||
private String coolAppSecret;
|
||||
private static final Set<String> WHITELIST_URIS = new HashSet<>(Arrays.asList(
|
||||
"/zxjp/open/v1/statusRefresh",
|
||||
"/zxjp/open/v1/getStoreUser",
|
||||
"/zxjp/open/v1/callback"
|
||||
));
|
||||
private static final List<String> oldUrlMapping = new ArrayList<>(Arrays.asList(
|
||||
"/zxjp/open/v1/statusRefresh","/zxjp/open/v1/changePaymentStatus",
|
||||
"/zxjp/open/v1/getYlsToken", "/zxjp/open/v1/getStoreList",
|
||||
@@ -61,7 +66,7 @@ public class OpenApiValidateFilter implements Filter {
|
||||
}
|
||||
MDC.put(CommonConstants.REQUEST_ID, UUIDUtils.get32UUID());
|
||||
//statusRefresh 放开不需要验签
|
||||
if (uri.startsWith("/zxjp/open/v1/statusRefresh") || uri.startsWith("/zxjp/open/v1/getStoreUser")) {
|
||||
if (isWhitelistUri(uri)) {
|
||||
filterChain.doFilter(servletRequest, response);
|
||||
return;
|
||||
}
|
||||
@@ -174,6 +179,9 @@ public class OpenApiValidateFilter implements Filter {
|
||||
return OpenSignatureUtil.generateOldSign(params, coolAppSecret);
|
||||
}
|
||||
|
||||
private boolean isWhitelistUri(String uri) {
|
||||
return WHITELIST_URIS.stream().anyMatch(uri::startsWith);
|
||||
}
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.dto.*;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.wx.MiniProgramFreeLoginDTO;
|
||||
import com.cool.store.handler.WeChatHandler;
|
||||
import com.cool.store.request.OpenApiStoreRequest;
|
||||
import com.cool.store.request.StoreCodeDTO;
|
||||
import com.cool.store.request.*;
|
||||
@@ -15,10 +16,12 @@ import com.cool.store.request.xgj.ReceiptCallBackRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.response.bigdata.ApiResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -52,6 +55,8 @@ public class OpenApiController {
|
||||
MessageTemplateService messageTemplateService;
|
||||
@Resource
|
||||
WechatMiniAppService wechatMiniAppService;
|
||||
@Autowired
|
||||
WeChatHandler weChatHandler;
|
||||
|
||||
@PostMapping("/statusRefresh")
|
||||
public ApiResponse<Boolean> statusRefresh(@RequestBody StatusRefreshDTO statusRefreshDTO){
|
||||
@@ -185,4 +190,28 @@ public class OpenApiController {
|
||||
public ApiResponse<String> getTokenByMobile(@RequestBody @Validated MiniProgramFreeLoginDTO param) {
|
||||
return ApiResponse.success(wechatMiniAppService.getShortTermTokenByMobile(param));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/callback", produces = "application/xml;charset=UTF-8")
|
||||
@ApiOperation("callback")
|
||||
public String handleWechatMessage(
|
||||
@RequestParam("signature") String signature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam(value = "echostr", required = false) String echostr,
|
||||
@RequestBody(required = false) String requestBody) {
|
||||
|
||||
log.info("url:{}","/open/v1/");
|
||||
log.info("callback_signature:{},timestamp:{},nonce:{}",signature,timestamp,nonce);
|
||||
log.info("requestBody:{}",requestBody);
|
||||
|
||||
if (StringUtils.isNotEmpty(requestBody)) {
|
||||
try {
|
||||
return weChatHandler.processMessage(weChatHandler.parseXmlToMap(requestBody));
|
||||
} catch (Exception e) {
|
||||
log.info("回调处理失败 e:{}",e);
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
return echostr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,15 @@ import com.cool.store.dto.FoodTokenDTO;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.HqtTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.dto.wechat.CallbackMessageDTO;
|
||||
import com.cool.store.dto.wechat.WechatTemplateMessageDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.DownSystemTypeEnum;
|
||||
import com.cool.store.enums.MessageEnum;
|
||||
import com.cool.store.enums.SMSMsgEnum;
|
||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||
import com.cool.store.enums.wechat.WechatTemplateEnum;
|
||||
import com.cool.store.handler.WeChatHandler;
|
||||
import com.cool.store.job.XxlJobHandler;
|
||||
import com.cool.store.mapper.FranchiseFeeMapper;
|
||||
import com.cool.store.mapper.LineInfoMapper;
|
||||
@@ -36,10 +40,12 @@ import com.cool.store.service.*;
|
||||
import com.cool.store.service.impl.CommonService;
|
||||
import com.cool.store.service.impl.OrderSysInfoServiceImpl;
|
||||
import com.cool.store.service.impl.UserAuthMappingServiceImpl;
|
||||
import com.cool.store.service.wechat.WechatTemplateService;
|
||||
import com.cool.store.utils.CoolDateUtils;
|
||||
import com.cool.store.utils.RedisConstantUtil;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -92,14 +98,16 @@ public class PCTestController {
|
||||
private HttpRestTemplateService httpRestTemplateService;
|
||||
@Resource
|
||||
FranchiseFeeMapper franchiseFeeMapper;
|
||||
|
||||
@Resource
|
||||
WechatTemplateService wechatTemplateService;
|
||||
@Resource
|
||||
ShopInfoMapper shopInfoMapper;
|
||||
@Resource
|
||||
LinePayService linePayService;
|
||||
@Resource
|
||||
LinePayDAO linePayDAO;
|
||||
|
||||
@Autowired
|
||||
WeChatHandler weChatHandler;
|
||||
@GetMapping("/syncStore")
|
||||
public ResponseResult<Boolean> syncStore(@RequestParam("shopId")Long shopId){
|
||||
syncMainSysServer.syncStore(shopId);
|
||||
@@ -556,4 +564,46 @@ public class PCTestController {
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/testWxNotice", produces = "application/xml;charset=UTF-8")
|
||||
@ApiOperation("testWxNotice")
|
||||
public String handleWechatMessage(
|
||||
@RequestParam("signature") String signature,
|
||||
@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam(value = "echostr", required = false) String echostr,
|
||||
@RequestBody(required = false) String requestBody) {
|
||||
|
||||
System.out.println("收到微信消息:");
|
||||
System.out.println("signature: " + signature);
|
||||
System.out.println("timestamp: " + timestamp);
|
||||
System.out.println("nonce: " + nonce);
|
||||
System.out.println("echostr: " + echostr);
|
||||
System.out.println("requestBody: " + requestBody);
|
||||
|
||||
if (StringUtils.isNotEmpty(requestBody)) {
|
||||
try {
|
||||
return weChatHandler.processMessage(weChatHandler.parseXmlToMap(requestBody));
|
||||
} catch (Exception e) {
|
||||
log.info("回调处理失败 e:{}",e.getMessage());
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
return nonce;
|
||||
}
|
||||
|
||||
@ApiOperation("测试小程序模板消息")
|
||||
@PostMapping("/testMiniAppTemplate")
|
||||
public ApiResponse<Boolean> testMiniAppTemplate() {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("character_string2", "ceshi002");
|
||||
data.put("thing10", "测试通知功能");
|
||||
data.put("time14", "2025-10-01 12:00:00");
|
||||
data.put("thing25", "正新管理有限公司");
|
||||
data.put("thing60", "上海市-松江区");
|
||||
wechatTemplateService.sendNormalTemplate("o9_unvpJy1SGdnkeun7igRBSLuB0", WechatTemplateEnum.QUESTION_NOTICE, data);
|
||||
return ApiResponse.success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -137,3 +137,8 @@ hqt.token.grant_type=client_credentials
|
||||
hqt.token.client.id=WrPffdGpcWkcPsbN
|
||||
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||
|
||||
#fuwuhao appId
|
||||
wechat.mp.appId=wx4a18ef8bb41aa55c
|
||||
wechat.mp.appSecret=793904b58f4ecdead3bbe4312c5f5c45
|
||||
#xiaochengxu appid
|
||||
wechat.miniapp.appId=wxd77a2761c1911ee1
|
||||
@@ -138,4 +138,10 @@ hqt.token.url=https://tc.cloud.hecom.cn
|
||||
hqt.token.username=18161486722
|
||||
hqt.token.grant_type=client_credentials
|
||||
hqt.token.client.id=WrPffdGpcWkcPsbN
|
||||
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||
|
||||
#fuwuhao appId
|
||||
wechat.mp.appId=wx4a18ef8bb41aa55c
|
||||
wechat.mp.appSecret=793904b58f4ecdead3bbe4312c5f5c45
|
||||
#xiaochengxu appid
|
||||
wechat.miniapp.appId=wxd77a2761c1911ee1
|
||||
@@ -145,3 +145,12 @@ hqt.token.grant_type=client_credentials
|
||||
hqt.token.client.id=WrPffdGpcWkcPsbN
|
||||
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||
|
||||
|
||||
#fuwuhao appId
|
||||
wechat.mp.appId=wx4a18ef8bb41aa55c
|
||||
wechat.mp.appSecret=793904b58f4ecdead3bbe4312c5f5c45
|
||||
#xiaochengxu appid
|
||||
wechat.miniapp.appId=wxd77a2761c1911ee1
|
||||
|
||||
zx.iot.appId=p-ts3PhNyf
|
||||
zx.iot.appSecret=X4cVmfxM+
|
||||
|
||||
Reference in New Issue
Block a user