mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 微信第三方平台获取令牌接口
This commit is contained in:
@@ -68,7 +68,7 @@ public class AgentDevController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getComponentToken")
|
||||
public RestApiResponse<?> getComponentToken(GetComponentTokenDTO dto) {
|
||||
public RestApiResponse<?> getComponentToken(@RequestBody GetComponentTokenDTO dto) {
|
||||
logger.info("获取第三方平台令牌 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class AgentDevService {
|
||||
*/
|
||||
public String getComponentToken(GetComponentTokenDTO dto) {
|
||||
String verifyTicket = dto.getVerifyTicket();
|
||||
String redisKey = CacheConstants.COMPONENT_ACCESS_TOKEN + PLATFORM_APP_ID;
|
||||
String redisKey = CacheConstants.COMPONENT_ACCESS_TOKEN + dto.getAppId();
|
||||
// 先判断缓存中是否有 token
|
||||
String token = redisCache.getCacheObject(redisKey);
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
@@ -133,9 +133,10 @@ public class AgentDevService {
|
||||
}
|
||||
// 为空再去请求获取新令牌
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/component/api_component_token";
|
||||
if (verifyTicket == null) {
|
||||
if (StringUtils.isBlank(verifyTicket)) {
|
||||
// 获取缓存中的票据
|
||||
verifyTicket = redisCache.getCacheObject(CacheConstants.COMPONENT_VERIFY_TICKET + PLATFORM_APP_ID);
|
||||
verifyTicket = redisCache.getCacheObject(CacheConstants.COMPONENT_VERIFY_TICKET + dto.getAppId());
|
||||
logger.info("获取第三方平台缓存中票据:{}", verifyTicket);
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("component_appid", dto.getAppId());
|
||||
@@ -146,7 +147,7 @@ public class AgentDevService {
|
||||
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||
logger.info("获取第三方平台 token 请求结果:{}", JSONObject.toJSONString(jsonResult));
|
||||
// 获取返回值中的 token
|
||||
token = jsonObject.getString("component_access_token");
|
||||
token = jsonResult.getString("component_access_token");
|
||||
if (token == null) {
|
||||
throw new RuntimeException("获取第三方平台 token 异常!");
|
||||
}
|
||||
|
||||
@@ -325,7 +325,11 @@ public class MemberService {
|
||||
// PageHelper.startPage(pageNum, pageSize);
|
||||
List<MemberWalletLogVO> list = memberBasicInfoService.getMemberWalletDetail(dto);
|
||||
// 总支出
|
||||
BigDecimal totalConsumption = list.stream().map(MemberWalletLogVO::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal totalConsumption = list.stream()
|
||||
.map(MemberWalletLogVO::getOrderAmount)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
vo.setTotalConsumption(totalConsumption);
|
||||
|
||||
// PageInfo<MemberWalletLogVO> pageInfo = new PageInfo<>(list);
|
||||
|
||||
Reference in New Issue
Block a user