mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 微信第三方平台 获取审核状态接口
This commit is contained in:
@@ -6,10 +6,7 @@ import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.domain.AuthorizationEventResult;
|
||||
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
||||
import com.jsowell.pile.dto.agentDev.CommitCodeDTO;
|
||||
import com.jsowell.pile.dto.agentDev.ConcatenateAuthLinkDTO;
|
||||
import com.jsowell.pile.dto.agentDev.GetComponentTokenDTO;
|
||||
import com.jsowell.pile.dto.agentDev.SubmitAuditDTO;
|
||||
import com.jsowell.pile.dto.agentDev.*;
|
||||
import com.jsowell.pile.vo.agentDev.AuthInfoVO;
|
||||
import com.jsowell.service.AgentDevService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -215,4 +212,25 @@ public class AgentDevController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审核状态
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getAuditStatus")
|
||||
public RestApiResponse<?> getAuditStatus(@RequestBody GetAuditStatusDTO dto) {
|
||||
logger.info("获取审核状态 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = agentDevService.getAuditStatus(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取审核状态 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("获取审核状态 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.AgentDev.AuditStatusEnum;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.http.HttpUtils;
|
||||
import com.jsowell.common.util.wxplatform.AesException;
|
||||
@@ -12,13 +13,11 @@ import com.jsowell.common.util.wxplatform.WXBizMsgCrypt;
|
||||
import com.jsowell.common.util.wxplatform.WXXmlToMapUtil;
|
||||
import com.jsowell.pile.domain.agentDev.AuditItem;
|
||||
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
||||
import com.jsowell.pile.dto.agentDev.CommitCodeDTO;
|
||||
import com.jsowell.pile.dto.agentDev.ConcatenateAuthLinkDTO;
|
||||
import com.jsowell.pile.dto.agentDev.GetComponentTokenDTO;
|
||||
import com.jsowell.pile.dto.agentDev.SubmitAuditDTO;
|
||||
import com.jsowell.pile.dto.agentDev.*;
|
||||
import com.jsowell.pile.vo.agentDev.AuthInfoVO;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.aspectj.weaver.ast.Var;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -363,6 +362,45 @@ public class AgentDevService {
|
||||
return String.valueOf(auditId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取审核状态
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public String getAuditStatus(GetAuditStatusDTO dto) {
|
||||
if (StringUtils.isBlank(dto.getAuditId())) {
|
||||
throw new RuntimeException("微信第三方平台 查询审核单状态 error:审核id为空");
|
||||
}
|
||||
// 获取用户接口调用令牌
|
||||
String redisKey = CacheConstants.AUTHORIZER_ACCESS_TOKEN + dto.getAuthorizerAppid();
|
||||
String authAccessToken = redisCache.getCacheObject(redisKey);
|
||||
if (StringUtils.isBlank(authAccessToken)) {
|
||||
throw new RuntimeException("微信第三方平台 查询审核单状态 error: authAccessToken为空");
|
||||
}
|
||||
String url = "https://api.weixin.qq.com/wxa/get_auditstatus?access_token=" + authAccessToken;
|
||||
// 拼接参数
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("auditid", dto.getAuditId());
|
||||
// 发送请求
|
||||
String result = HttpUtils.sendPost(url, JSONObject.toJSONString(jsonObject));
|
||||
// 将返回结果转为json对象
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
int errCode = (int) resultJson.get("errcode");
|
||||
if (errCode != Constants.zero) {
|
||||
String errMsg = resultJson.getString("errmsg");
|
||||
logger.info("微信第三方平台 提交代码审核 error, {}", errMsg);
|
||||
|
||||
return errMsg;
|
||||
}
|
||||
int status = (int) resultJson.get("status");
|
||||
if (status == Constants.one || status == Constants.four) {
|
||||
// 当 status = 1 时,返回的拒绝原因; status = 4 时,返回的延后原因
|
||||
return resultJson.getString("reason");
|
||||
}
|
||||
return AuditStatusEnum.getValueByCode(status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取预授权码
|
||||
*
|
||||
@@ -413,9 +451,10 @@ public class AgentDevService {
|
||||
public String concatenateAuthLinks(ConcatenateAuthLinkDTO dto) {
|
||||
String versionType = dto.getVersionType();
|
||||
String url = "";
|
||||
String platformAppid = dto.getPlatformAppID() == null ? PLATFORM_APP_ID : dto.getPlatformAppID();
|
||||
if (StringUtils.equals(Constants.ONE, versionType)) {
|
||||
// 1-PC版链接
|
||||
url = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=" + dto.getPlatformAppID()
|
||||
url = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=" + platformAppid
|
||||
+ "&pre_auth_code=" + dto.getPreAuthCode() + "&redirect_uri=" + dto.getRedirectUri() + "&auth_type=" + dto.getAuthType();
|
||||
} else {
|
||||
// 2-H5版链接
|
||||
|
||||
Reference in New Issue
Block a user