|
@@ -5,16 +5,19 @@ import com.ruoyi.auth.form.LoginBody;
|
|
|
import com.ruoyi.auth.form.RegisterBody;
|
|
|
import com.ruoyi.auth.service.SysLoginService;
|
|
|
import com.ruoyi.common.core.constant.CacheConstants;
|
|
|
+import com.ruoyi.common.core.constant.SecurityConstants;
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.common.core.exception.ServiceException;
|
|
|
import com.ruoyi.common.core.utils.JwtUtils;
|
|
|
import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
+import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.redis.service.RedisService;
|
|
|
import com.ruoyi.common.security.auth.AuthUtil;
|
|
|
import com.ruoyi.common.security.service.TokenService;
|
|
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
import com.ruoyi.lnst.domain.InLnstLrxx;
|
|
|
+import com.ruoyi.system.api.RemoteGljtService;
|
|
|
import com.ruoyi.system.api.model.LoginUser;
|
|
|
import com.ruoyi.system.utils.Encryption;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -45,6 +48,9 @@ public class TokenController
|
|
|
@Autowired
|
|
|
private SysLoginService sysLoginService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteGljtService remoteGljtService;
|
|
|
+
|
|
|
@PostMapping("login")
|
|
|
public R<?> login(@RequestBody LoginBody form)
|
|
|
{
|
|
@@ -237,8 +243,25 @@ public class TokenController
|
|
|
|
|
|
@PostMapping("getProgramOpenId")
|
|
|
public R<String> getProgramOpenId(@RequestBody LoginBody form) {
|
|
|
+ String appId = null;
|
|
|
+ String secret = null;
|
|
|
+ AjaxResult res = remoteGljtService.getQxpz(form.getUsername(), SecurityConstants.INNER);
|
|
|
+ if (ObjectUtils.isNotEmpty(res)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(res.get("data"))) {
|
|
|
+ Map<String, String> data = (Map<String, String>) res.get("data");
|
|
|
+ if (ObjectUtils.isNotEmpty(data)) {
|
|
|
+ if (data.containsKey("kz6") && data.containsKey("kz7")) {
|
|
|
+ appId = data.get("kz6");
|
|
|
+ secret = data.get("kz7");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isAnyEmpty(appId, secret)) {
|
|
|
+ return R.fail("行政区划有误");
|
|
|
+ }
|
|
|
System.out.println(form.getCode());
|
|
|
- String requestUrl = getProgramWebAccess(form.getCode());
|
|
|
+ String requestUrl = getProgramWebAccess(form.getCode(), appId, secret);
|
|
|
System.out.println(requestUrl);
|
|
|
com.alibaba.fastjson.JSONObject sessionData = httpsRequest(requestUrl, "GET", null);
|
|
|
System.out.println(sessionData);
|
|
@@ -303,15 +326,15 @@ public class TokenController
|
|
|
return String.format(a, b, c, CODE);
|
|
|
}
|
|
|
|
|
|
- public static String getProgramWebAccess(String CODE) {
|
|
|
+ public static String getProgramWebAccess(String CODE, String appId, String secret) {
|
|
|
String a = ResourceUtil.getConfigByName("wx.webAccessTokenhttps");
|
|
|
- String b = ResourceUtil.getConfigByName("wx.appId");
|
|
|
- String c = ResourceUtil.getConfigByName("wx.secret");
|
|
|
+ String b = appId;
|
|
|
+ String c = secret;
|
|
|
return String.format(a, b, c, CODE);
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String requestUrl = getProgramWebAccess("0a3Ssx1004RWwT17Il000usZ5c4Ssx1j");
|
|
|
+ String requestUrl = getProgramWebAccess("0a3Ssx1004RWwT17Il000usZ5c4Ssx1j", "", "");
|
|
|
System.out.println(requestUrl);
|
|
|
com.alibaba.fastjson.JSONObject sessionData = httpsRequest(requestUrl, "GET", null);
|
|
|
System.out.println(sessionData);
|