提交代码

dev-discount
胡锐 3 years ago
parent cf36751ddc
commit b4e31c13cc
  1. 40
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java

@ -177,40 +177,30 @@ public class HighUserCardController {
@ResponseBody
@ApiOperation(value = "根据手机号获取汇联通工会卡列表")
public ResponseData getHuiLianTongCardByPhone(@RequestParam(name = "phone", required = true) String phone,
@RequestParam(name = "smsCode", required = true) String smsCode,
HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get(phone);
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,smsCode)) {
// 验证码校验成功
// 根据手机号查询卡号
JSONObject jsonObject = HuiLianTongUnionCardConfig.queryCardByMobile(phone);
if(jsonObject.getString("respCode").equals("0000") && jsonObject.getString("respMessage").equals("ok")) {
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
JSONArray cards = dataObject.getJSONArray("cards");
for (Object cardObject : cards) {
JSONObject card = (JSONObject)cardObject;
if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), card.getString("cardNo")) != null) {
card.put("bindStatus", true);
} else {
card.put("bindStatus", false);
}
// 验证码校验成功
// 根据手机号查询卡号
JSONObject jsonObject = HuiLianTongUnionCardConfig.queryCardByMobile(phone);
if(jsonObject.getString("respCode").equals("0000") && jsonObject.getString("respMessage").equals("ok")) {
JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
JSONArray cards = dataObject.getJSONArray("cards");
for (Object cardObject : cards) {
JSONObject card = (JSONObject)cardObject;
if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), card.getString("cardNo")) != null) {
card.put("bindStatus", true);
} else {
card.put("bindStatus", false);
}
redisUtil.del(phone);
return ResponseMsgUtil.success(cards);
} else {
System.out.println(jsonObject);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败");
}
return ResponseMsgUtil.success(cards);
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
System.out.println(jsonObject);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败");
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardByPhone() error!", e);
return ResponseMsgUtil.exception(e);

Loading…
Cancel
Save