Просмотр исходного кода

[POS][修改]:B用户登录检查

release_toaliyun_real
Stormeye Wu 6 лет назад
Родитель
Сommit
56593d894a
4 измененных файлов: 116 добавлений и 0 удалений
  1. +34
    -0
      mallinkPosApi/src/main/java/com/iformall/controller/PosController.java
  2. +6
    -0
      mallinkPosApi/src/main/java/com/iformall/service/PosService.java
  3. +74
    -0
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java

+ 34
- 0
mallinkPosApi/src/main/java/com/iformall/controller/PosController.java Просмотреть файл

@@ -34,6 +34,40 @@ public class PosController extends BaseController {
private final ThDevInfoService thDevInfoService;
private final WxCouponOrderService couponOrderService;

@ApiOperation(value = "门店用户登录检查", notes = "{" +
"\"dev_id\":\"string(必填)\"," +
"\"nonce_str\":\"string(必填)," +
"\"tenant_id\":\"string(必填)\"," +
"\"phone\":\"string(必填)\"," +
"\"password\":\"string(必填)\"}")
@PostMapping("/checkUserPassword")
@SystemControllerLog(description = "门店用户登录检查")
public Map<String, String> checkUserPassword(@RequestBody Map<String, String> params) {
JSONObject payContent = new JSONObject();

// 1. check sign
Map<String, String> retMap = checkSign(params, payContent);
if (retMap != null) {
// 签名相关异常返回
return retMap;
}
String resKey = payContent.getString("resKey");
logger.info("resKey: " + resKey);

try {
retMap = posService.checkUserPassword(params);
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", WxPayConstant.RET_SUCCESS, null);
} catch (MallinkException e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", WxPayConstant.RET_FAIL,
e.getErrorCode(),
e.getMessage());
} catch (Exception e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", WxPayConstant.RET_FAIL,
500,
e.getMessage());
}
}

@ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用", notes = "{" +
"\"dev_id\":\"string(必填)\"," +
"\"tenant_id\":\"string(必填)\"," +


+ 6
- 0
mallinkPosApi/src/main/java/com/iformall/service/PosService.java Просмотреть файл

@@ -9,6 +9,12 @@ import java.util.Map;

public interface PosService {

/**
* 获取商城会员设置状态
* @param params
* @return
*/
Map<String, String> checkUserPassword(Map<String, String> params) throws MallinkException;
/**
* 获取商城会员设置状态
* @param params


+ 74
- 0
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Просмотреть файл

@@ -53,6 +53,80 @@ public class PosServiceImpl implements PosService {
private final WxCouponMerchantMapper couponMerchantMapper;
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


+ 2
- 0
mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java Просмотреть файл

@@ -29,6 +29,8 @@ public class WxPayConstant {
public final static String MEM_PHONE = "mem_phone";
public final static String CARD_ID = "card_id";
public final static String CARD_SPEND_ID = "card_spend_id";
public final static String PHONE = "phone";
public final static String PASSWORD = "password";

public final static String VERIFY_TYPE = "verify_type";
public final static String VERIFY_TYPE_INDEPENT = "independent";


Загрузка…
Отмена
Сохранить