feat:平台账号
This commit is contained in:
@@ -4,6 +4,8 @@ import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.utils.OpenSignatureUtil;
|
||||
import com.cool.store.utils.UUIDUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -12,8 +14,11 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -50,7 +55,7 @@ public class OpenApiValidateFilter implements Filter {
|
||||
|
||||
// 1. 验证时间戳
|
||||
try {
|
||||
String timestampStr = request.getParameter("timestamp");
|
||||
String timestampStr = request.getHeader("timestamp");
|
||||
if (timestampStr == null) {
|
||||
log.info("timestampStr is null {}","缺少timestamp参数");
|
||||
throw new ServiceException(ErrorCodeEnum.SIGN_FAIL);
|
||||
@@ -71,22 +76,33 @@ public class OpenApiValidateFilter implements Filter {
|
||||
}
|
||||
|
||||
// 2. 验证签名
|
||||
String appKey = request.getParameter("appKey");
|
||||
String appKey = request.getHeader("appkey");
|
||||
if (appKey == null || !coolAppKey.equals(appKey)) {
|
||||
log.info("OpenApiValidateFilter==>{}","无效的appKey");
|
||||
throw new ServiceException(ErrorCodeEnum.SIGN_FAIL);
|
||||
}
|
||||
|
||||
String clientSign = request.getParameter("sign");
|
||||
String clientSign = request.getHeader("sign");
|
||||
if (clientSign == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.SIGN_FAIL);
|
||||
}
|
||||
// 1. 读取请求体
|
||||
StringBuilder requestBody = new StringBuilder();
|
||||
try (BufferedReader reader = request.getReader()) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
requestBody.append(line);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取所有请求参数
|
||||
Map<String, String> params = request.getParameterMap().entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
e -> String.join(",", e.getValue())));
|
||||
String jsonBody = requestBody.toString();
|
||||
|
||||
// 2. 使用 Jackson 解析 JSON 并转为 TreeMap(自动按键排序)
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
SortedMap<String, String> params = objectMapper.readValue(
|
||||
jsonBody,
|
||||
new TypeReference<TreeMap<String, String>>() {}
|
||||
);
|
||||
|
||||
String serverSign = OpenSignatureUtil.generateSign(params, coolAppSecret);
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import com.cool.store.dto.StatusRefreshDTO;
|
||||
import com.cool.store.response.bigdata.ApiResponse;
|
||||
import com.cool.store.service.OpenApiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -23,9 +21,10 @@ public class OpenApiController {
|
||||
@Resource
|
||||
OpenApiService openApiService;
|
||||
|
||||
@GetMapping("/statusRefresh")
|
||||
public ApiResponse<Boolean> statusRefresh(StatusRefreshDTO statusRefreshDTO){
|
||||
return ApiResponse.success(openApiService.statusRefresh(statusRefreshDTO));
|
||||
@PostMapping("/statusRefresh")
|
||||
public ApiResponse<Boolean> statusRefresh(@RequestBody StatusRefreshDTO statusRefreshDTO){
|
||||
//openApiService.statusRefresh(statusRefreshDTO)
|
||||
return ApiResponse.success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.cool.store.controller.webb;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.DownSystemTypeEnum;
|
||||
import com.cool.store.enums.MessageEnum;
|
||||
@@ -258,4 +259,12 @@ public class PCTestController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
ShopAccountService accountService;
|
||||
@ApiOperation("修改密码")
|
||||
@GetMapping("/modifyPassword")
|
||||
public ResponseResult<Boolean> modifyPassword(@RequestBody ModifyPasswordDTO request) {
|
||||
return ResponseResult.success(accountService.modifyPassword(request));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,3 +80,13 @@ mybatis.configuration.variables.enterpriseId=214ac5a3a517472a87268e02a2e6410a
|
||||
enterprise.dingCorpId=wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g
|
||||
|
||||
qywx.task.notice.url2=https://store-h5.coolstore.cn/?corpId=%s&appType=%s#/notice?target=%s¬iceType=zx&corpId=%s&appType=%s&eid=%s
|
||||
|
||||
|
||||
|
||||
api.auth.url=https://api.zhengxindzg.cn
|
||||
api.auth.username=GkqgAhUJ7p9swJo
|
||||
api.auth.secret=NzVrnS3OWiupdDY
|
||||
|
||||
xgj.api.auth.url=https://masterdata.zhengxinfood.com/dmp/one-id/
|
||||
xgj.api.auth.username=2677a58dd9e24fc6b20e835ef5f19e63
|
||||
xgj.api.auth.secret=3fe724f9607448728ee3393eff75718a
|
||||
|
||||
@@ -94,14 +94,14 @@ zx.big.data.appKey=ff203b5567744feaaae49fb86f58c5bf
|
||||
zx.big.data.appSecret=35b8b9a400b4430fa022190be0913cd6
|
||||
|
||||
#火吗POS
|
||||
api.auth.url=https://api.zhengxindzg.cn
|
||||
api.auth.username=GkqgAhUJ7p9swJo
|
||||
api.auth.secret=NzVrnS3OWiupdDY
|
||||
api.auth.url=https://api.hmdzg.top
|
||||
api.auth.username=VA59C0ubfcpcVpl
|
||||
api.auth.secret=H9YKHF6R7N16Fvy
|
||||
|
||||
#新管家账号
|
||||
xgj.api.auth.url=****
|
||||
xgj.api.auth.username=****
|
||||
xgj.api.auth.secret=****
|
||||
xgj.api.auth.url=http://117.139.13.24:11180/dmp/one-id/
|
||||
xgj.api.auth.username=2677a58dd9e24fc6b20e835ef5f19e63
|
||||
xgj.api.auth.secret=3fe724f9607448728ee3393eff75718a
|
||||
|
||||
#云流水账号
|
||||
yls.api.auth.url=****
|
||||
@@ -113,5 +113,5 @@ xzg.api.auth.url=****
|
||||
xzg.api.auth.username=****
|
||||
xzg.api.auth.secret=****
|
||||
|
||||
cool.api.appKey=123
|
||||
cool.api.secret=123
|
||||
cool.api.appKey=k8J7fG2qR5tY9vX3
|
||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
||||
|
||||
Reference in New Issue
Block a user