From: qiaowei Date: Thu, 26 Mar 2020 07:41:20 +0000 (+0800) Subject: 修改签约接口 X-Git-Tag: 1.0.12^2~4 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=529e0e87f2a4face47faa194590ddf60b1d21162;p=epayment%2Ffood_payapi.git 修改签约接口 --- diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt index ba072cc6..102f45a8 100644 --- a/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/agent/service/citizencard_service.kt @@ -53,7 +53,7 @@ class CitizenCardPayAgent : AgentPayService { override fun pay(transaction: TTransactionMain): AgentResponse { val resp = citizencardPayService.cardPay(transaction.shopDtl.shopaccno, transaction.personDtl.userid, transaction.accdate, - Math.abs(MoneyUtil.YuanToFen(transaction.personDtl.amount)), transaction.refno) + Math.abs(MoneyUtil.YuanToFen(transaction.personDtl.amount)),"", transaction.refno) return AgentResponse().also { val code = agentCode(resp.code, resp.message) diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt index d1091d0e..c6c5cb28 100644 --- a/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt +++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/mobile/MobileApi.kt @@ -411,27 +411,32 @@ class ApiV1 { 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 @@ -443,6 +448,42 @@ class ApiV1 { ?.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)!! + } /** @@ -558,7 +599,7 @@ class ApiV1 { ?: 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)