|
|
@@ -7,6 +7,7 @@ import com.java110.core.context.IPageData;
|
|
|
import com.java110.core.context.PageData;
|
|
|
import com.java110.core.factory.AuthenticationFactory;
|
|
|
import com.java110.dto.owner.OwnerAppUserDto;
|
|
|
+import com.java110.dto.smallWeChat.SmallWeChatDto;
|
|
|
import com.java110.dto.user.UserDto;
|
|
|
import com.java110.front.properties.WechatAuthProperties;
|
|
|
import com.java110.front.smo.ownerLogin.IOwnerAppLoginSMO;
|
|
|
@@ -18,6 +19,7 @@ import com.java110.utils.constant.ServiceConstant;
|
|
|
import com.java110.utils.constant.WechatConstant;
|
|
|
import com.java110.utils.exception.SMOException;
|
|
|
import com.java110.utils.util.Assert;
|
|
|
+import com.java110.utils.util.BeanConvertUtil;
|
|
|
import com.java110.utils.util.StringUtil;
|
|
|
import com.java110.vo.ResultVo;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -177,6 +179,15 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
|
|
|
JSONObject param = JSONObject.parseObject(paramStr);
|
|
|
String redirectUrl = param.getString("redirectUrl");
|
|
|
String errorUrl = param.getString("errorUrl");
|
|
|
+ SmallWeChatDto smallWeChatDto = getSmallWechat(pd, paramIn);
|
|
|
+
|
|
|
+ if (smallWeChatDto == null) { //从配置文件中获取 小程序配置信息
|
|
|
+ smallWeChatDto = new SmallWeChatDto();
|
|
|
+ smallWeChatDto.setAppId(wechatAuthProperties.getAppId());
|
|
|
+ smallWeChatDto.setAppSecret(wechatAuthProperties.getSecret());
|
|
|
+ smallWeChatDto.setMchId(wechatAuthProperties.getMchId());
|
|
|
+ smallWeChatDto.setPayPassword(wechatAuthProperties.getKey());
|
|
|
+ }
|
|
|
|
|
|
|
|
|
String url = WechatConstant.APP_GET_ACCESS_TOKEN_URL.replace("APPID", wechatAuthProperties.getWechatAppId())
|
|
|
@@ -449,6 +460,30 @@ public class OwnerAppLoginSMOImpl extends AbstractFrontServiceSMO implements IOw
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ private SmallWeChatDto getSmallWechat(IPageData pd, JSONObject paramIn) {
|
|
|
+
|
|
|
+ ResponseEntity responseEntity = null;
|
|
|
+
|
|
|
+ pd = PageData.newInstance().builder(pd.getUserId(), "", "", pd.getReqData(),
|
|
|
+ "", "", "", "",
|
|
|
+ pd.getAppId());
|
|
|
+ responseEntity = this.callCenterService(restTemplate, pd, "",
|
|
|
+ ServiceConstant.SERVICE_API_URL + "/api/smallWeChat.listSmallWeChats?appId="
|
|
|
+ + paramIn.getString("appId") + "&page=1&row=1", HttpMethod.GET);
|
|
|
+
|
|
|
+ if (responseEntity.getStatusCode() != HttpStatus.OK) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ JSONObject smallWechatObj = JSONObject.parseObject(responseEntity.getBody().toString());
|
|
|
+ JSONArray smallWeChats = smallWechatObj.getJSONArray("smallWeChats");
|
|
|
+
|
|
|
+ if (smallWeChats == null || smallWeChats.size() < 1) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return BeanConvertUtil.covertBean(smallWeChats.get(0), SmallWeChatDto.class);
|
|
|
+ }
|
|
|
+
|
|
|
public RestTemplate getRestTemplate() {
|
|
|
return restTemplate;
|
|
|
}
|