|
@ -7,6 +7,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
import com.epmet.constant.ModuleConstant; |
|
|
import com.epmet.constant.ModuleConstant; |
|
|
|
|
|
import com.epmet.constant.ThirdRedisKeyConstant; |
|
|
import com.epmet.constant.ThirdRunTimeInfoConstant; |
|
|
import com.epmet.constant.ThirdRunTimeInfoConstant; |
|
|
import com.epmet.dao.*; |
|
|
import com.epmet.dao.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
@ -328,7 +329,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
//第三方平台AppId
|
|
|
//第三方平台AppId
|
|
|
jsonObject.put(ModuleConstant.COMPONENT_APPID,componentAppId); |
|
|
jsonObject.put(ModuleConstant.COMPONENT_APPID,componentAppId); |
|
|
jsonObject.put(ModuleConstant.AUTHORIZER_REFRESH_TOKEN,willOverDueDTO.getAuthorizerRefreshToken()); |
|
|
jsonObject.put(ModuleConstant.AUTHORIZER_REFRESH_TOKEN,willOverDueDTO.getAuthorizerRefreshToken()); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_AUTHORIZER_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); |
|
|
String componentAccessToken = redisThird.getComponentAccessToken(); |
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_AUTHORIZER_TOKEN_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
Map map = JSON.parseObject(data, HashMap.class); |
|
|
Map map = JSON.parseObject(data, HashMap.class); |
|
|
//authorizer_access_token
|
|
|
//authorizer_access_token
|
|
|
String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); |
|
|
String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); |
|
@ -499,12 +501,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
log.info("开始创建开放平台账号并绑定"); |
|
|
log.info("开始创建开放平台账号并绑定"); |
|
|
Integer authCount = customerMpDao.selectAuthCount(customerId); |
|
|
Integer authCount = customerMpDao.selectAuthCount(customerId); |
|
|
String openPlatformId = null; |
|
|
String openPlatformId = null; |
|
|
|
|
|
String authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); |
|
|
if (authCount==NumConstant.ZERO){ |
|
|
if (authCount==NumConstant.ZERO){ |
|
|
log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); |
|
|
log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); |
|
|
//没有任何一个小程序/公众号授权,【先创建,再绑定】
|
|
|
//没有任何一个小程序/公众号授权,【先创建,再绑定】
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
jsonObject.put(ModuleConstant.APP_ID,authAppId); |
|
|
jsonObject.put(ModuleConstant.APP_ID,authAppId); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN, JSON.toJSONString(jsonObject)).getData(); |
|
|
// 此处的 access_token 为 【authorizer_access_token】
|
|
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerRefreshToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
Map<String,String> map = JSON.parseObject(data, Map.class); |
|
|
Map<String,String> map = JSON.parseObject(data, Map.class); |
|
|
CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); |
|
|
CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); |
|
|
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); |
|
|
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); |
|
@ -533,7 +537,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId); |
|
|
jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId); |
|
|
jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); |
|
|
jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN, JSON.toJSONString(jsonObject)).getData(); |
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerRefreshToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
Map<String,String> map = JSON.parseObject(data, Map.class); |
|
|
Map<String,String> map = JSON.parseObject(data, Map.class); |
|
|
CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); |
|
|
CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); |
|
|
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); |
|
|
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); |
|
|