|
|
@@ -53,6 +53,80 @@ public class PosServiceImpl implements PosService { |
|
|
private final WxCouponMerchantMapper couponMerchantMapper; |
|
|
private final WxCouponMerchantMapper couponMerchantMapper; |
|
|
private final WxCouponMapper couponMapper; |
|
|
private final WxCouponMapper couponMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 门店用户登录检查 |
|
|
|
|
|
* @param params |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public Map<String, String> checkUserPassword(Map<String, String> params) throws MallinkException { |
|
|
|
|
|
Map<String, String> retMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID |
|
|
|
|
|
String phone = params.get(WxPayConstant.PHONE); // buUser's Phone |
|
|
|
|
|
String password = params.get(WxPayConstant.PASSWORD); // buUser's password |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(tenantId)) { |
|
|
|
|
|
String errMessage = "request params[tenant_id] error."; |
|
|
|
|
|
logger.error(errMessage); |
|
|
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(phone)) { |
|
|
|
|
|
String errMessage = "request params[phone] error."; |
|
|
|
|
|
logger.error(errMessage); |
|
|
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(password)) { |
|
|
|
|
|
String errMessage = "request params[password] error."; |
|
|
|
|
|
logger.error(errMessage); |
|
|
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
WxMerchantBUser user = new WxMerchantBUser(); |
|
|
|
|
|
user.setTenantId(tenantId); |
|
|
|
|
|
user.setPhone(phone); |
|
|
|
|
|
user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); |
|
|
|
|
|
WxMerchantBUser user1 = null; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
user1 = merchantBUserService.getBUserByAppId(user); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
String errMessage = "B端用户不存在或者已被禁用, phone: " + phone + ", " +e.getMessage(); |
|
|
|
|
|
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
if (user1 != null) { |
|
|
|
|
|
// check merchant 状态 |
|
|
|
|
|
WxMerchant merchant = null; |
|
|
|
|
|
try { |
|
|
|
|
|
merchant = merchantService.getById(user1.getMerchantId()); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
String errMessage = ErrorCode.DB_FAIL.getMessage() + ": " + user1.getMerchantId() + e.getMessage(); |
|
|
|
|
|
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
if (merchant == null) { |
|
|
|
|
|
logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + user1.getMerchantId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); |
|
|
|
|
|
} |
|
|
|
|
|
if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) { |
|
|
|
|
|
logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + user1.getMerchantId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_VALID); |
|
|
|
|
|
} |
|
|
|
|
|
// check password |
|
|
|
|
|
if (user1.getUserPwd().equalsIgnoreCase(password)) { |
|
|
|
|
|
retMap.put(WxPayConstant.TENANT_ID, user1.getTenantId()); |
|
|
|
|
|
retMap.put(WxPayConstant.MERCHANT_ID, String.valueOf(user1.getMerchantId())); |
|
|
|
|
|
retMap.put(WxPayConstant.BUSER_ID, String.valueOf(user1.getId())); |
|
|
|
|
|
retMap.put(WxPayConstant.MEM_ID, String.valueOf(user1.getId())); |
|
|
|
|
|
return retMap; |
|
|
|
|
|
} else { |
|
|
|
|
|
logger.error(ErrorCode.PASSWORD_ERROR.getMessage()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.PASSWORD_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
String errMessage = "B端用户不存在, phone: " + phone; |
|
|
|
|
|
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), errMessage); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取商城会员设置状态 |
|
|
* 获取商城会员设置状态 |
|
|
* @param params |
|
|
* @param params |
|
|
|