'提交代码'

dev-discount
胡锐 3 years ago
parent 9fe8503bd0
commit 3cfaa3c234
  1. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 35
      hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java

@ -111,6 +111,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/test/*")
.excludePathPatterns("/cmsContent/*")
.excludePathPatterns("/highGas/*")
.excludePathPatterns("/highUserCard/*")
.excludePathPatterns("/outRechargeOrder/*")
.excludePathPatterns("/wechat/*")
.excludePathPatterns("/tuanyou/*")

@ -88,12 +88,36 @@ public class HighUserCardController {
}
}
@RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据卡号查询汇联通工会卡详情")
public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) {
try {
JSONObject cardInfo = HuiLianTongUnionCardConfig.queryCardInfo(cardNo);
if (!cardInfo.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到卡号信息");
}
JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data"));
if (cardInfoObject.getBoolean("success") == false) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, cardInfoObject.getString("message"));
}
return ResponseMsgUtil.success(cardInfoObject);
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/bindHuiLianTongCard", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "绑定汇联通工会卡")
public ResponseData bindHuiLianTongCard(@RequestBody JSONObject body, HttpServletRequest request) {
try {
if (body == null || StringUtils.isBlank(body.getString("cardNo"))) {
if (body == null
|| StringUtils.isBlank(body.getString("cardNo"))
|| StringUtils.isBlank(body.getString("phone"))
|| StringUtils.isBlank(body.getString("smsCode"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
@ -105,13 +129,22 @@ public class HighUserCardController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定此卡,请勿重复绑定");
}
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get(body.getString("phone"));
// 验证码校验
if (StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,body.getString("smsCode"))) {
// 验证码校验成功
HighUserCard userCard = new HighUserCard();
userCard.setUserId(userInfoModel.getHighUser().getId());
userCard.setCardNo(body.getString("cardNo"));
userCard.setType(UserCardType.type1.getType());
highUserCardService.editCard(userCard);
redisUtil.del(body.getString("phone"));
return ResponseMsgUtil.success("操作成功");
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
} catch (Exception e) {
log.error("HighUserCardController --> bindHuiLianTongCard() error!", e);

Loading…
Cancel
Save