|
|
|
@@ -7,12 +7,15 @@ import com.iformall.annotation.TenantIgnore; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.common.SysConfigConstant; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.vo.WxMerchantBuInfoVo; |
|
|
|
import com.iformall.enums.EnumCreditLockedStatus; |
|
|
|
import com.iformall.enums.EnumEnableType; |
|
|
|
import com.iformall.enums.EnumMerchantBUserStatus; |
|
|
|
import com.iformall.enums.EnumMerchantStatus; |
|
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.HashUtil; |
|
|
|
@@ -62,6 +65,9 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxAppinfoService wxAppinfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private SysConfigService sysConfigService; |
|
|
|
|
|
|
|
|
|
|
|
@RedisCache |
|
|
|
@ApiOperation("查寻当bUser详情接口") |
|
|
|
@@ -129,6 +135,7 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
@ApiOperation(value = "用户登录", notes = "{" + |
|
|
|
"\"appId\":\"string\"," + |
|
|
|
"\"phone\":\"string\",\"password\":\"string\"," + |
|
|
|
"\"up\":\"string\","+ |
|
|
|
"\"latitude\":\"string\",\"longitude\":\"string\"}") |
|
|
|
public ResultData userLogin(@RequestBody Map<String, String> map) { |
|
|
|
logger.debug(map.toString()); |
|
|
|
@@ -138,6 +145,8 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
String password = map.get("password"); |
|
|
|
String latitude = map.get("latitude"); |
|
|
|
String longitude = map.get("longitude"); |
|
|
|
//当前登陆人的授权手机号 |
|
|
|
String userPhone = map.get("up"); |
|
|
|
//登录凭证不能为空 |
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "手机号不能为空"); |
|
|
|
@@ -176,12 +185,12 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
ResultData merchantStatus = checkMerchantStatus(orgUser); |
|
|
|
if (merchantStatus != null) return merchantStatus; |
|
|
|
|
|
|
|
// try { |
|
|
|
// wxMerchantBUserService.saveOrUpdate(orgUser); |
|
|
|
// } catch (Exception e) { |
|
|
|
// logger.error("B端用户更新用户信息失败, e:" + e.getMessage()); |
|
|
|
// return new ResultData(ErrorCode.DB_FAIL.getCode(), "数据库保存失败,e:" + e.getMessage()); |
|
|
|
// } |
|
|
|
try { |
|
|
|
checkLoginUserPhone(orgUser, userPhone); |
|
|
|
}catch(Exception e) { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
resultMap.put("bUserId", orgUser.getId()); |
|
|
|
resultMap.put("logined", true); |
|
|
|
@@ -221,17 +230,38 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void checkLoginUserPhone(WxMerchantBUser orgUser,String userPhone) throws Exception { |
|
|
|
if (StringUtils.isBlank(userPhone) || "undefined".equals(userPhone.toLowerCase())) { |
|
|
|
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 (!userPhone.equals(orgUser.getPhone())) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"当前用户授权手机号非登录账号,不允许登录"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@AuthIgnore |
|
|
|
@PostMapping("/selectMerchant") |
|
|
|
@ApiOperation(value = "选择商户", notes = "{" + |
|
|
|
"\"buUserId\":\"string\"," + |
|
|
|
"\"up\":\"string\","+ |
|
|
|
"\"merchantId\":\"string\"}") |
|
|
|
public ResultData selectMerchant(@RequestBody Map<String, String> map) { |
|
|
|
String buUserIdStr = map.get("buUserId"); |
|
|
|
String merchantIdStr = map.get("merchantId"); |
|
|
|
|
|
|
|
//当前登陆人的授权手机号 |
|
|
|
String userPhone = map.get("up"); |
|
|
|
if (StringUtils.isBlank(buUserIdStr)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "buUserId不能为空"); |
|
|
|
} |
|
|
|
@@ -248,12 +278,11 @@ public class WxMerchantBUserController extends BaseController { |
|
|
|
if (orgUser != null) { |
|
|
|
ResultData merchantStatus = checkMerchantStatus(orgUser); |
|
|
|
if (merchantStatus != null) return merchantStatus; |
|
|
|
// try { |
|
|
|
// wxMerchantBUserService.saveOrUpdate(orgUser); |
|
|
|
// } catch (Exception e) { |
|
|
|
// logger.error("B端用户更新用户信息失败, e:" + e.getMessage()); |
|
|
|
// return new ResultData(ErrorCode.DB_FAIL.getCode(), "数据库保存失败,e:" + e.getMessage()); |
|
|
|
// } |
|
|
|
try { |
|
|
|
checkLoginUserPhone(orgUser, userPhone); |
|
|
|
}catch(Exception e) { |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
} |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
resultMap.put("bUserId", orgUser.getId()); |
|
|
|
resultMap.put("logined", true); |
|
|
|
|