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.common.response.RestApiResponse;
|
||||||
import com.jsowell.pile.domain.AuthorizationEventResult;
|
import com.jsowell.pile.domain.AuthorizationEventResult;
|
||||||
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
||||||
import com.jsowell.pile.dto.agentDev.CommitCodeDTO;
|
import com.jsowell.pile.dto.agentDev.*;
|
||||||
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.vo.agentDev.AuthInfoVO;
|
import com.jsowell.pile.vo.agentDev.AuthInfoVO;
|
||||||
import com.jsowell.service.AgentDevService;
|
import com.jsowell.service.AgentDevService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -215,4 +212,25 @@ public class AgentDevController extends BaseController {
|
|||||||
return response;
|
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.CacheConstants;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
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.StringUtils;
|
||||||
import com.jsowell.common.util.http.HttpUtils;
|
import com.jsowell.common.util.http.HttpUtils;
|
||||||
import com.jsowell.common.util.wxplatform.AesException;
|
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.common.util.wxplatform.WXXmlToMapUtil;
|
||||||
import com.jsowell.pile.domain.agentDev.AuditItem;
|
import com.jsowell.pile.domain.agentDev.AuditItem;
|
||||||
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
||||||
import com.jsowell.pile.dto.agentDev.CommitCodeDTO;
|
import com.jsowell.pile.dto.agentDev.*;
|
||||||
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.vo.agentDev.AuthInfoVO;
|
import com.jsowell.pile.vo.agentDev.AuthInfoVO;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
import org.aspectj.weaver.ast.Var;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -363,6 +362,45 @@ public class AgentDevService {
|
|||||||
return String.valueOf(auditId);
|
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) {
|
public String concatenateAuthLinks(ConcatenateAuthLinkDTO dto) {
|
||||||
String versionType = dto.getVersionType();
|
String versionType = dto.getVersionType();
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String platformAppid = dto.getPlatformAppID() == null ? PLATFORM_APP_ID : dto.getPlatformAppID();
|
||||||
if (StringUtils.equals(Constants.ONE, versionType)) {
|
if (StringUtils.equals(Constants.ONE, versionType)) {
|
||||||
// 1-PC版链接
|
// 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();
|
+ "&pre_auth_code=" + dto.getPreAuthCode() + "&redirect_uri=" + dto.getRedirectUri() + "&auth_type=" + dto.getAuthType();
|
||||||
} else {
|
} else {
|
||||||
// 2-H5版链接
|
// 2-H5版链接
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class Constants {
|
|||||||
|
|
||||||
public static final int one = 1;
|
public static final int one = 1;
|
||||||
|
|
||||||
|
public static final int four = 4;
|
||||||
|
|
||||||
public static final byte zeroByte = 0x00;
|
public static final byte zeroByte = 0x00;
|
||||||
|
|
||||||
public static final byte[] zeroByteArray = new byte[]{zeroByte};
|
public static final byte[] zeroByteArray = new byte[]{zeroByte};
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.jsowell.common.enums.AgentDev;
|
||||||
|
|
||||||
|
import com.jsowell.common.enums.uniapp.BalanceChangesEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态enum
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2023/8/1 9:43
|
||||||
|
*/
|
||||||
|
public enum AuditStatusEnum {
|
||||||
|
AUDIT_SUCCESS(0, "审核成功"),
|
||||||
|
AUDIT_REFUSE(1, "审核被拒绝"),
|
||||||
|
AUDIT_IN_PROGRESS(2, "审核中"),
|
||||||
|
AUDIT_REVOCATION(3, "已撤回"),
|
||||||
|
AUDIT_DELAYED(4, "审核延后"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuditStatusEnum(int value, String label) {
|
||||||
|
this.code = value;
|
||||||
|
this.value = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取value
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getValueByCode(int code) {
|
||||||
|
for (AuditStatusEnum item : AuditStatusEnum.values()) {
|
||||||
|
if (item.getCode() == code) {
|
||||||
|
return item.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.jsowell.pile.dto.agentDev;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2023/8/1 9:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GetAuditStatusDTO {
|
||||||
|
/**
|
||||||
|
* 审核id
|
||||||
|
*/
|
||||||
|
private String auditId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户授权appid
|
||||||
|
*/
|
||||||
|
private String authorizerAppid;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user