装修接口
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package com.cool.store.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: WangShuo
|
||||||
|
* @Date: 2025/07/24/17:19
|
||||||
|
* @Version 1.0
|
||||||
|
* @注释:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HqtTokenDTO {
|
||||||
|
|
||||||
|
private String access_token;
|
||||||
|
private String token_type;
|
||||||
|
private Long expires_in;
|
||||||
|
private String scope;
|
||||||
|
private String endPoint;
|
||||||
|
private String client_id;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
import com.cool.store.dto.GetAccessTokenDTO;
|
import com.cool.store.dto.GetAccessTokenDTO;
|
||||||
|
import com.cool.store.dto.HqtTokenDTO;
|
||||||
import com.cool.store.dto.ModifyPasswordDTO;
|
import com.cool.store.dto.ModifyPasswordDTO;
|
||||||
import com.cool.store.dto.XgjOrganizationDTO;
|
import com.cool.store.dto.XgjOrganizationDTO;
|
||||||
import com.cool.store.request.AuditRequest;
|
import com.cool.store.request.AuditRequest;
|
||||||
@@ -86,6 +87,12 @@ public interface PushService {
|
|||||||
XgjAccessTokenDTO getXgjAccessToken();
|
XgjAccessTokenDTO getXgjAccessToken();
|
||||||
|
|
||||||
Integer getUnReadMessageNum(String partnerId);
|
Integer getUnReadMessageNum(String partnerId);
|
||||||
|
/**
|
||||||
|
* @Auther: wangshuo
|
||||||
|
* @Date: 2025/7/24
|
||||||
|
* @description:获取红圈通token
|
||||||
|
*/
|
||||||
|
HqtTokenDTO getHqtToken();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.dto.GetAccessTokenDTO;
|
import com.cool.store.dto.GetAccessTokenDTO;
|
||||||
|
import com.cool.store.dto.HqtTokenDTO;
|
||||||
import com.cool.store.dto.ModifyPasswordDTO;
|
import com.cool.store.dto.ModifyPasswordDTO;
|
||||||
import com.cool.store.dto.XgjOrganizationDTO;
|
import com.cool.store.dto.XgjOrganizationDTO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
@@ -86,6 +87,20 @@ public class PushServiceImpl implements PushService {
|
|||||||
@Value("${ask.bot.url}")
|
@Value("${ask.bot.url}")
|
||||||
private String askBotUrl;
|
private String askBotUrl;
|
||||||
|
|
||||||
|
@Value("${hqt.token.url}")
|
||||||
|
private String hqtTokenUrl;
|
||||||
|
|
||||||
|
@Value("${hqt.token.username}")
|
||||||
|
private String hqtUsername;
|
||||||
|
|
||||||
|
@Value("${hqt.token.grant_type}")
|
||||||
|
private String hqtGrantType;
|
||||||
|
|
||||||
|
@Value("${hqt.token.client.id}")
|
||||||
|
private String hqtClientId;
|
||||||
|
@Value("${hqt.token.client.secret}")
|
||||||
|
private String hqtClientSecret;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
OkHttpClient okHttpClient;
|
OkHttpClient okHttpClient;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -248,6 +263,39 @@ public class PushServiceImpl implements PushService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HqtTokenDTO getHqtToken() {
|
||||||
|
String url = hqtTokenUrl + "/hecom-tenancy/oauth/token";
|
||||||
|
String auth = hqtClientId + ":" + hqtClientSecret;
|
||||||
|
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
|
||||||
|
Map<String,String> requestBody = new HashMap<>();
|
||||||
|
requestBody.put("grant_type",hqtGrantType);
|
||||||
|
requestBody.put("username",hqtUsername);
|
||||||
|
String jsonString = JSONObject.toJSONString(requestBody);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.post(RequestBody.create(MediaType.parse("application/json"),jsonString))
|
||||||
|
.header("Authorization", "Basic " + encodedAuth)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.addHeader("Host", "tc.cloud.hecom.cn")
|
||||||
|
.build();
|
||||||
|
try (Response response = okHttpClient.newCall(request).execute()) {
|
||||||
|
if (!response.isSuccessful()) {
|
||||||
|
log.info("HTTP请求失败,msg: " + response.message());
|
||||||
|
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||||
|
"HTTP请求失败,状态码: " + response.code());
|
||||||
|
}
|
||||||
|
String responseBody = response.body().string();
|
||||||
|
HqtTokenDTO hqtTokenDTO = objectMapper.readValue(responseBody, HqtTokenDTO.class);
|
||||||
|
return hqtTokenDTO;
|
||||||
|
} catch (ServiceException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("API调用异常 - URL: {}, 错误: {}", url, e.getMessage(), e);
|
||||||
|
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType, String username, String secret){
|
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType, String username, String secret){
|
||||||
return executePostApiCall(url,requestBody,responseType,username,secret,null);
|
return executePostApiCall(url,requestBody,responseType,username,secret,null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
|||||||
}
|
}
|
||||||
addSignFranchiseResponse.setPayName(new ArrayList<>(payNameSet));
|
addSignFranchiseResponse.setPayName(new ArrayList<>(payNameSet));
|
||||||
addSignFranchiseResponse.setPartnerPayData(partnerPayData);
|
addSignFranchiseResponse.setPartnerPayData(partnerPayData);
|
||||||
Date earliestPayTime = payTimeList.stream()
|
Date earliestPayTime = payTimeList.stream().filter(Objects::nonNull)
|
||||||
.min(Comparator.naturalOrder())
|
.min(Comparator.naturalOrder())
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
addSignFranchiseResponse.setPayDate(earliestPayTime);
|
addSignFranchiseResponse.setPayDate(earliestPayTime);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.cool.store.constants.RedisConstant;
|
|||||||
import com.cool.store.dao.*;
|
import com.cool.store.dao.*;
|
||||||
import com.cool.store.dto.FoodTokenDTO;
|
import com.cool.store.dto.FoodTokenDTO;
|
||||||
import com.cool.store.dto.GetAccessTokenDTO;
|
import com.cool.store.dto.GetAccessTokenDTO;
|
||||||
|
import com.cool.store.dto.HqtTokenDTO;
|
||||||
import com.cool.store.dto.ModifyPasswordDTO;
|
import com.cool.store.dto.ModifyPasswordDTO;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
import com.cool.store.enums.DownSystemTypeEnum;
|
import com.cool.store.enums.DownSystemTypeEnum;
|
||||||
@@ -419,4 +420,9 @@ public class PCTestController {
|
|||||||
return ResponseResult.success(Boolean.TRUE);
|
return ResponseResult.success(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getHqtToken")
|
||||||
|
public ResponseResult<HqtTokenDTO> getHqtToken() {
|
||||||
|
return ResponseResult.success(pushService.getHqtToken());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,4 +128,10 @@ cool.api.secret=wP4sN6dL8zK2xM9c
|
|||||||
|
|
||||||
special.user.id=wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g_woayJeDAAAtwLSAPVMWbpGi9q4caSujg
|
special.user.id=wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g_woayJeDAAAtwLSAPVMWbpGi9q4caSujg
|
||||||
|
|
||||||
ask.bot.url=https://auth.wx.askbot.cn
|
ask.bot.url=https://auth.wx.askbot.cn
|
||||||
|
|
||||||
|
hqt.token.url=https://tc.cloud.hecom.cn
|
||||||
|
hqt.token.username=18820154831
|
||||||
|
hqt.token.grant_type=client_credentials
|
||||||
|
hqt.token.client.id=WrPffdGpcWkcPsbN
|
||||||
|
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||||
@@ -5,7 +5,7 @@ default.datasource.username=coolstore
|
|||||||
default.datasource.password=CSCErYcXniNYm7bT
|
default.datasource.password=CSCErYcXniNYm7bT
|
||||||
|
|
||||||
#redis
|
#redis
|
||||||
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege.redis.rds.aliyuncs.com:6379/0
|
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege-open.redis.rds.aliyuncs.com:6379/0
|
||||||
|
|
||||||
#pagehelper
|
#pagehelper
|
||||||
pagehelper.helper-dialect=mysql
|
pagehelper.helper-dialect=mysql
|
||||||
@@ -134,3 +134,10 @@ special.user.id=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg_woayJeDAAA0TC8mkCJeXouw94hYA-D3
|
|||||||
|
|
||||||
ask.bot.url=https://test.auth.wx.askbot.cn
|
ask.bot.url=https://test.auth.wx.askbot.cn
|
||||||
|
|
||||||
|
|
||||||
|
hqt.token.url=https://tc.cloud.hecom.cn
|
||||||
|
hqt.token.username=18820154831
|
||||||
|
hqt.token.grant_type=client_credentials
|
||||||
|
hqt.token.client.id=WrPffdGpcWkcPsbN
|
||||||
|
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user