if (exsitUser != null) {
return JsonResult.error("该银行卡号已被绑定,若您本人绑定,请先解除绑定,若非本人,请联系客服")
}
+ var signed = ""
//call api
var resp = citizencardPayService.bindCard(cardno, name, idtype, idno, phone)
if (resp.code != "0000") {
return JsonResult.error(resp.message)
}
- var signed = ""
+ var needupdate = false
if (resp.sinstatus == "1") {
signed = TradeDict.STATUS_YES
- card.signed = true
+ if(!card.signed){
+ card.signed = true
+ mobileApiService.saveCard(card)
+ }
user.signedtime = DateUtil.getNow();
- mobileApiService.saveCard(card)
mobileApiService.saveUser(user)
+ needupdate = true;
+
}
- logger.error { resp.captcha }
- var code = if (resp.captcha.isNullOrEmpty()) {
- RandomUtils.randomNumber(6)
- } else {
- resp.captcha
+ if( user.userid.isNullOrEmpty()){
+ user.userid = person.userid
+ user.bindtime = DateUtil.getNow()
+ needupdate=true
+ }
+ if(needupdate){
+ mobileApiService.saveUser(user)
}
- logger.error { code }
- redisTemplate.opsForValue().set(phone, code, Duration.ofMinutes(10))
var payseted = false
if (!user.paypwd.isNullOrEmpty()) {
payseted = true
?.put("signed", signed)!!
+ }
+ /**
+ * 绑卡
+ * */
+ @RequestMapping("/bindcardcode")
+ fun bindcardcode(): JsonResult {
+ val p = SecurityContextHolder.getContext().authentication
+ val user = mobileApiService.findUserById(p.name)
+ ?: return JsonResult.error("用户不存在,请注册")
+ if (user.phone.isNullOrEmpty()) {
+ return JsonResult.error("手机号不存在,请注册")
+ }
+ var card = mobileApiService.findCardByUserid(user.userid!!)
+ ?: return JsonResult.error("卡片不存在,请重新绑定")
+ //call sign api
+ val person = userService.findOnePersonByUserid(card.userid)
+ var signed=""
+ //call api
+ var resp = citizencardPayService.bindCard(card.cardno, person.name, person.idtype, person.idno, user.phone!!)
+ if (resp.code != "0000") {
+ return JsonResult.error(resp.message)
+ }
+
+ if (resp.sinstatus == "1") {
+ signed = TradeDict.STATUS_YES
+ if(!card.signed){
+ card.signed = true
+ mobileApiService.saveCard(card)
+ }
+ user.signedtime = DateUtil.getNow();
+ mobileApiService.saveUser(user)
+ }
+
+ return JsonResult.ok("OK")
+ ?.put("signed", signed)!!
+
}
/**
?: return JsonResult.error("卡片不存在,请重新绑定")
//call sign api
val person = userService.findOnePersonByUserid(card.userid)
- val captcha = ""//此处为验证码,暂由此参数代替
+ val captcha = agree//此处为验证码,暂由此参数代替
var resp = citizencardPayService.signCard(card.cardno, person.name, person.idtype, person.idno, user.phone!!, YnrccUtil.TRANSTYPE_SIGNCARD,captcha)
if (resp.code != "0000") {
return JsonResult.error(resp.message)