feat:askbot
This commit is contained in:
@@ -85,7 +85,7 @@ public interface PushService {
|
|||||||
*/
|
*/
|
||||||
XgjAccessTokenDTO getXgjAccessToken();
|
XgjAccessTokenDTO getXgjAccessToken();
|
||||||
|
|
||||||
|
Integer getUnReadMessageNum(String partnerId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class PushServiceImpl implements PushService {
|
public class PushServiceImpl implements PushService {
|
||||||
|
|
||||||
// TODO: 2025/4/9 suzhuhong_
|
|
||||||
|
|
||||||
@Value("${spring.profiles.active}")
|
@Value("${spring.profiles.active}")
|
||||||
private String active;
|
private String active;
|
||||||
|
|
||||||
@@ -85,6 +83,9 @@ public class PushServiceImpl implements PushService {
|
|||||||
@Value("${xzg.api.auth.url}")
|
@Value("${xzg.api.auth.url}")
|
||||||
private String xzgUrl;
|
private String xzgUrl;
|
||||||
|
|
||||||
|
@Value("${ask.bot.url}")
|
||||||
|
private String askBotUrl;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
OkHttpClient okHttpClient;
|
OkHttpClient okHttpClient;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -225,6 +226,28 @@ public class PushServiceImpl implements PushService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getUnReadMessageNum(String partnerId) {
|
||||||
|
String apiUrl =askBotUrl + "/api-pluto/session/getUnReadMessageNum?userId="+partnerId;
|
||||||
|
log.info("获取小正AI消息数据开始 url:{}", apiUrl);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(apiUrl)
|
||||||
|
.get()
|
||||||
|
.build();
|
||||||
|
try (Response response = okHttpClient.newCall(request).execute()) {
|
||||||
|
if (!response.isSuccessful()) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||||
|
"HTTP请求失败,状态码: " + response.code());
|
||||||
|
}
|
||||||
|
String responseBody = response.body().string();
|
||||||
|
log.info("getUnReadMessageNum response num:{}", responseBody);
|
||||||
|
return Integer.valueOf(responseBody);
|
||||||
|
} 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ public class PCTestController {
|
|||||||
return ResponseResult.success(pushService.getXgjAccessToken());
|
return ResponseResult.success(pushService.getXgjAccessToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUnReadMessageNum")
|
||||||
|
@ApiOperation("getUnReadMessageNum")
|
||||||
|
public ResponseResult<Object> getUnReadMessageNum(@RequestParam(value = "partnerId", required = true,defaultValue = "0") String partnerId) {
|
||||||
|
return ResponseResult.success(pushService.getUnReadMessageNum(partnerId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
ShopAccountService accountService;
|
ShopAccountService accountService;
|
||||||
|
|||||||
@@ -125,3 +125,5 @@ cool.api.appKey=k8J7fG2qR5tY9vX3
|
|||||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
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
|
||||||
@@ -130,3 +130,5 @@ cool.api.secret=wP4sN6dL8zK2xM9c
|
|||||||
#maozhejun userID
|
#maozhejun userID
|
||||||
special.user.id=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg_woayJeDAAA0TC8mkCJeXouw94hYA-D3Q
|
special.user.id=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg_woayJeDAAA0TC8mkCJeXouw94hYA-D3Q
|
||||||
|
|
||||||
|
ask.bot.url=https://test.auth.wx.askbot.cn
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user