Commit a37f2347 authored by 杨阳's avatar 杨阳

1. 登录方式更换成 平台的微信登录

2. 认证字段返回bug fixed 3. 登录权限 bug修复 4. 农户信息入库问题测试
parent 23d6dfe7
......@@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -143,7 +144,7 @@ public class PeasantHouseholdWxController extends BaseController {
}
}
model.setProjectAddressName(area.length() > 2 ? area.substring(0, area.length() - 2) : area);
if ("1".equals(model.getIsPermanent())) {
if ("1".equals(model.getIsPermanent()) || "true".equals(model.getIsPermanent())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
model.setPermanentAddressName(area.length() > 2 ? area.substring(0, area.length() - 2) : area);
......@@ -203,6 +204,7 @@ public class PeasantHouseholdWxController extends BaseController {
@RequestParam (value = "width", required = false, defaultValue = "350") String width,
HttpServletResponse response) {
AgencyUserModel userInfo = getUserInfo();
log.info("获取区域经销商二维码, userId:{}", userInfo.getUserId());
String accessToken = wxService.getAccessToken();
// 生成二维码
String page = miniprogramLoginPage;
......
......@@ -93,14 +93,16 @@ public class WxServiceImpl implements IWxService {
StringBuffer buildUrl = new StringBuffer();
buildUrl.append(url).append("grant_type=" + grant_type).append("&appid=" + appid).append("&secret=" + secret);
try {
log.info("获取access_token入参 => {}", buildUrl);
String resultStr = HttpUtils.doGet(buildUrl.toString());
log.info("获取access_token返回值 => {}", resultStr);
AccessTokenDto accessToken = JSON.parseObject(resultStr, AccessTokenDto.class);
if (accessToken.getErrcode() != null && 0 != accessToken.getErrcode()) {
throw new RuntimeException(accessToken.getErrmsg());
}
return accessToken;
} catch (Exception e) {
log.error("getSmallPro token is error url:{}", buildUrl.toString());
log.error("获取access_token is error url:{}", buildUrl.toString());
throw new RuntimeException(e.getMessage());
}
}
......@@ -121,6 +123,7 @@ public class WxServiceImpl implements IWxService {
*/
private WechatQrCodeDTO buildQrParam(String url, String access_token, String scene, String page, Long width,
Boolean auto_color, JSONObject line_color, Boolean is_hyaline) {
log.info("生成二维码入参, url=>{}, access_token=>{}, scene=>{}, page=>{},", url, access_token, scene, page);
WechatQrCodeDTO smallProQrCodeVo = new WechatQrCodeDTO();
StringBuffer buildUrl = new StringBuffer();
buildUrl.append(url).append("access_token=" + access_token);
......@@ -223,7 +226,7 @@ public class WxServiceImpl implements IWxService {
log.info("微信 Code2Session, code =>{}, 结果 => {}", code, resultStr);
JSONObject jsonObject = JSONObject.parseObject(resultStr);
if (jsonObject == null || jsonObject.getIntValue("errcode") != 0) {
throw new BadRequest(jsonObject.getString("errmsg"));
throw new BadRequest("微信授权失败, 请重新授权");
}
return jsonObject;
}
......
......@@ -138,9 +138,11 @@ hygfProgram.secret=3bfd098cfdac002126e728d2dbf83c0d
farmer.orgCode=86
farmer.sequenceNbr=1620981815542046722
farmer.orgNamesWithoutRole=
farmer.roleId=1678211468450885633
farmer.roleId=1693559312426758146
# 配置接口授权用户
platform.access.loginId=hygf_platform
platform.access.password=AC286A35E74D2DD281EB979789DECF3A
# 测试用的经销商userid
dealer.userId=
\ No newline at end of file
dealer.userId=
# 测试的时候默认密码
farmer.registerPassword=a123456
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment