|
|
|
@@ -67,12 +67,6 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxAppinfoService wxAppinfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysConfigService sysConfigService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CUserServiceFactory cuserFactory; |
|
|
|
|
|
|
|
|
|
|
|
@RedisCache |
|
|
|
@ApiOperation("查寻当bUser详情接口") |
|
|
|
@@ -194,11 +188,6 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
resultMap.put("bUserId", orgUser.getId()); |
|
|
|
resultMap.put("logined", true); |
|
|
|
try { |
|
|
|
checkLoginUserPhone(orgUser, orgUser.getId(),appPlat); |
|
|
|
}catch(Exception e) { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
// request.setAttribute(Constant.LOGIN_B_USER_KEY, orgUser.getId()); |
|
|
|
return new ResultData(resultMap); |
|
|
|
} else { |
|
|
|
@@ -236,47 +225,26 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void checkLoginUserPhone(WxMerchantBUser orgUser,Long bUserId,EnumAppPlat appPlat) throws Exception { |
|
|
|
if (null == bUserId) { |
|
|
|
return; |
|
|
|
} |
|
|
|
CUser user = cuserFactory.getBUserService(appPlat).getById(bUserId, orgUser.getTenantId()); |
|
|
|
if (null == user) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(user.getPhone())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
SysConfig config = sysConfigService.getByKey(SysConfigConstant.merchant_Login_CheckPhone, orgUser); |
|
|
|
if (null != config ) { |
|
|
|
String v = config.getConfigItemValue(); |
|
|
|
if (!StringUtils.isBlank(v)) { |
|
|
|
Integer iv = Integer.parseInt(v); |
|
|
|
if (iv.intValue() == EnumYesOrNo.YES.getCode().intValue()) { |
|
|
|
//校验当前登陆人的授权手机号和账号手机号是否一致 |
|
|
|
if (!user.getPhone().equals(orgUser.getPhone())) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"当前用户授权手机号非登录账号,不允许登录"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@AuthIgnore |
|
|
|
@PostMapping("/selectMerchant") |
|
|
|
@ApiOperation(value = "选择商户", notes = "{" + |
|
|
|
"\"appId\":\"string\"," + |
|
|
|
"\"buUserId\":\"string\"," + |
|
|
|
"\"merchantId\":\"string\"}") |
|
|
|
public ResultData selectMerchant(@RequestBody Map<String, String> map) { |
|
|
|
String buUserIdStr = map.get("buUserId"); |
|
|
|
String merchantIdStr = map.get("merchantId"); |
|
|
|
String appId = map.get("appId"); |
|
|
|
if (StringUtils.isBlank(buUserIdStr)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "buUserId不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(merchantIdStr)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(appId)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
WxMerchantBUser userQ = new WxMerchantBUser(); |
|
|
|
userQ.setId(Long.valueOf(buUserIdStr)); |
|
|
|
@@ -291,7 +259,19 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
resultMap.put("bUserId", orgUser.getId()); |
|
|
|
resultMap.put("logined", true); |
|
|
|
try { |
|
|
|
checkLoginUserPhone(orgUser, orgUser.getId(),this.getCUser().getAppPlat()); |
|
|
|
WxAppinfo wxAppinfo = getAppInfo(appId); |
|
|
|
if(wxAppinfo == null){ |
|
|
|
return new ResultData(ErrorCode.APP_ID_NOT_FOUND); |
|
|
|
} |
|
|
|
if(!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())){ |
|
|
|
return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); |
|
|
|
} |
|
|
|
|
|
|
|
EnumAppPlat appPlat = EnumAppPlat.getByCode(wxAppinfo.getPlat()); |
|
|
|
if(appPlat == null){ |
|
|
|
return new ResultData(ErrorCode.APP_PLAT_ERROR); |
|
|
|
} |
|
|
|
checkLoginUserPhone(orgUser, orgUser.getId(),appPlat); |
|
|
|
}catch(Exception e) { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
|