修改签约接口
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 ba072cc..102f45a 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 @@
override fun pay(transaction: TTransactionMain): AgentResponse<DtlStatus> {
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<DtlStatus>().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 d1091d0..c6c5cb2 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 @@
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;
+
+ }
+ if( user.userid.isNullOrEmpty()){
+ user.userid = person.userid
+ user.bindtime = DateUtil.getNow()
+ needupdate=true
+ }
+ if(needupdate){
mobileApiService.saveUser(user)
}
- logger.error { resp.captcha }
- var code = if (resp.captcha.isNullOrEmpty()) {
- RandomUtils.randomNumber(6)
- } else {
- resp.captcha
- }
- logger.error { code }
- redisTemplate.opsForValue().set(phone, code, Duration.ofMinutes(10))
var payseted = false
if (!user.paypwd.isNullOrEmpty()) {
payseted = true
@@ -444,6 +449,42 @@
}
+ /**
+ * 绑卡
+ * */
+ @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 @@
?: 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)