Przeglądaj źródła

/Bank/QueryAmtInByPaid 增加接口

zhouxnsz 1 rok temu
rodzic
commit
144839b828
7 zmienionych plików z 509 dodań i 0 usunięć
  1. 49 0
      controllers/bank/bank.go
  2. 151 0
      docs/docs.go
  3. 151 0
      docs/swagger.json
  4. 108 0
      docs/swagger.yaml
  5. 15 0
      models/bank.go
  6. 34 0
      models/ori.go
  7. 1 0
      routers/router.go

+ 49 - 0
controllers/bank/bank.go

@@ -1,8 +1,12 @@
 package bank
 
 import (
+	"errors"
 	"mtp2_if/global/app"
+	"mtp2_if/global/e"
+	"mtp2_if/logger"
 	"mtp2_if/models"
+	"net/http"
 
 	"github.com/gin-gonic/gin"
 )
@@ -41,3 +45,48 @@ func QueryBankBranChnumInfo(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+type QueryAmtInByPaidReq struct {
+	AccountId  int    `form:"accountid" binding:"required"`  // 资金账户
+	Exchticket string `form:"exchticket" binding:"required"` // 银行服务流水号
+}
+
+// QueryAmtInByPaid 获取银行待支付地址
+// @Summary  获取银行待支付地址
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    accountid  query    int    true "资金账户"
+// @Param    exchticket query    string true "银行服务流水号"
+// @Success  200        {object} models.Chillpayamtinrec
+// @Failure  500        {object} app.Response
+// @Router   /Bank/QueryAmtInByPaid [get]
+// @Tags     银行
+func QueryAmtInByPaid(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryAmtInByPaidReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryAmtInByPaid failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	rec, err := models.GetAmtInByPaid(req.AccountId, req.Exchticket)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryAmtInByPaid failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	if rec == nil {
+		// 查询失败
+		err = errors.New("获取记录失败")
+		logger.GetLogger().Errorf("QueryAmtInByPaid failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	appG.Response(http.StatusOK, e.SUCCESS, rec)
+}

+ 151 - 0
docs/docs.go

@@ -707,6 +707,52 @@ const docTemplate = `{
                 }
             }
         },
+        "/Bank/QueryAmtInByPaid": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "银行"
+                ],
+                "summary": "获取银行待支付地址",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "银行服务流水号",
+                        "name": "exchticket",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Chillpayamtinrec"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Bank/QueryBankBranChnumInfo": {
             "get": {
                 "security": [
@@ -30164,6 +30210,111 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Chillpayamtinrec": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "amount": {
+                    "description": "入金金额,需要X100才能给接口调用",
+                    "type": "number"
+                },
+                "channelcode": {
+                    "description": "Reference code for the bank that received payment.",
+                    "type": "string"
+                },
+                "chillpay_desc": {
+                    "description": "Payment information.",
+                    "type": "string"
+                },
+                "created_at": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "currency": {
+                    "description": "Currency data code such as \"764\".",
+                    "type": "string"
+                },
+                "customerid": {
+                    "description": "End User’s reference code (accountid)",
+                    "type": "string"
+                },
+                "customername": {
+                    "description": "Payer Name(For QR Payment only)",
+                    "type": "string"
+                },
+                "deal_desc": {
+                    "description": "状态描述",
+                    "type": "string"
+                },
+                "deal_status": {
+                    "description": "入金状态 0-成功 1-失败 2-已发送 3-初始化",
+                    "type": "integer"
+                },
+                "exch_date": {
+                    "description": "交易日",
+                    "type": "string"
+                },
+                "exch_no": {
+                    "description": "交易所编号",
+                    "type": "string"
+                },
+                "exch_seq": {
+                    "description": "交易所流水号",
+                    "type": "string"
+                },
+                "id": {
+                    "description": "自增ID",
+                    "type": "integer"
+                },
+                "ipaddress": {
+                    "description": "End user’s IP Address.",
+                    "type": "string"
+                },
+                "langcode": {
+                    "description": "Language code to be displayed on the payment website of the bank.",
+                    "type": "string"
+                },
+                "merchantcode": {
+                    "description": "Merchant ID.",
+                    "type": "string"
+                },
+                "orderno": {
+                    "description": "Order number",
+                    "type": "string"
+                },
+                "paymentstatus": {
+                    "description": "Payment result code from the bank.",
+                    "type": "integer"
+                },
+                "paymenturl": {
+                    "description": "URL to be redirected to the bank's payment page.",
+                    "type": "string"
+                },
+                "rec_version": {
+                    "description": "乐观锁",
+                    "type": "integer"
+                },
+                "returnurl": {
+                    "description": "The URL that will be displayed when the End user completes the transaction.",
+                    "type": "string"
+                },
+                "token": {
+                    "description": "Token code for reference list.",
+                    "type": "string"
+                },
+                "transactionid": {
+                    "description": "Transaction Reference number for merchant.",
+                    "type": "integer"
+                },
+                "updated_at": {
+                    "description": "修改时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Clientfixedadconfig": {
             "type": "object",
             "required": [

+ 151 - 0
docs/swagger.json

@@ -698,6 +698,52 @@
                 }
             }
         },
+        "/Bank/QueryAmtInByPaid": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "银行"
+                ],
+                "summary": "获取银行待支付地址",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "银行服务流水号",
+                        "name": "exchticket",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Chillpayamtinrec"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Bank/QueryBankBranChnumInfo": {
             "get": {
                 "security": [
@@ -30155,6 +30201,111 @@
                 }
             }
         },
+        "models.Chillpayamtinrec": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账户ID",
+                    "type": "integer"
+                },
+                "amount": {
+                    "description": "入金金额,需要X100才能给接口调用",
+                    "type": "number"
+                },
+                "channelcode": {
+                    "description": "Reference code for the bank that received payment.",
+                    "type": "string"
+                },
+                "chillpay_desc": {
+                    "description": "Payment information.",
+                    "type": "string"
+                },
+                "created_at": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "currency": {
+                    "description": "Currency data code such as \"764\".",
+                    "type": "string"
+                },
+                "customerid": {
+                    "description": "End User’s reference code (accountid)",
+                    "type": "string"
+                },
+                "customername": {
+                    "description": "Payer Name(For QR Payment only)",
+                    "type": "string"
+                },
+                "deal_desc": {
+                    "description": "状态描述",
+                    "type": "string"
+                },
+                "deal_status": {
+                    "description": "入金状态 0-成功 1-失败 2-已发送 3-初始化",
+                    "type": "integer"
+                },
+                "exch_date": {
+                    "description": "交易日",
+                    "type": "string"
+                },
+                "exch_no": {
+                    "description": "交易所编号",
+                    "type": "string"
+                },
+                "exch_seq": {
+                    "description": "交易所流水号",
+                    "type": "string"
+                },
+                "id": {
+                    "description": "自增ID",
+                    "type": "integer"
+                },
+                "ipaddress": {
+                    "description": "End user’s IP Address.",
+                    "type": "string"
+                },
+                "langcode": {
+                    "description": "Language code to be displayed on the payment website of the bank.",
+                    "type": "string"
+                },
+                "merchantcode": {
+                    "description": "Merchant ID.",
+                    "type": "string"
+                },
+                "orderno": {
+                    "description": "Order number",
+                    "type": "string"
+                },
+                "paymentstatus": {
+                    "description": "Payment result code from the bank.",
+                    "type": "integer"
+                },
+                "paymenturl": {
+                    "description": "URL to be redirected to the bank's payment page.",
+                    "type": "string"
+                },
+                "rec_version": {
+                    "description": "乐观锁",
+                    "type": "integer"
+                },
+                "returnurl": {
+                    "description": "The URL that will be displayed when the End user completes the transaction.",
+                    "type": "string"
+                },
+                "token": {
+                    "description": "Token code for reference list.",
+                    "type": "string"
+                },
+                "transactionid": {
+                    "description": "Transaction Reference number for merchant.",
+                    "type": "integer"
+                },
+                "updated_at": {
+                    "description": "修改时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Clientfixedadconfig": {
             "type": "object",
             "required": [

+ 108 - 0
docs/swagger.yaml

@@ -4787,6 +4787,85 @@ definitions:
         description: 求购信息
         type: string
     type: object
+  models.Chillpayamtinrec:
+    properties:
+      accountid:
+        description: 账户ID
+        type: integer
+      amount:
+        description: 入金金额,需要X100才能给接口调用
+        type: number
+      channelcode:
+        description: Reference code for the bank that received payment.
+        type: string
+      chillpay_desc:
+        description: Payment information.
+        type: string
+      created_at:
+        description: 创建时间
+        type: string
+      currency:
+        description: Currency data code such as "764".
+        type: string
+      customerid:
+        description: End User’s reference code (accountid)
+        type: string
+      customername:
+        description: Payer Name(For QR Payment only)
+        type: string
+      deal_desc:
+        description: 状态描述
+        type: string
+      deal_status:
+        description: 入金状态 0-成功 1-失败 2-已发送 3-初始化
+        type: integer
+      exch_date:
+        description: 交易日
+        type: string
+      exch_no:
+        description: 交易所编号
+        type: string
+      exch_seq:
+        description: 交易所流水号
+        type: string
+      id:
+        description: 自增ID
+        type: integer
+      ipaddress:
+        description: End user’s IP Address.
+        type: string
+      langcode:
+        description: Language code to be displayed on the payment website of the bank.
+        type: string
+      merchantcode:
+        description: Merchant ID.
+        type: string
+      orderno:
+        description: Order number
+        type: string
+      paymentstatus:
+        description: Payment result code from the bank.
+        type: integer
+      paymenturl:
+        description: URL to be redirected to the bank's payment page.
+        type: string
+      rec_version:
+        description: 乐观锁
+        type: integer
+      returnurl:
+        description: The URL that will be displayed when the End user completes the
+          transaction.
+        type: string
+      token:
+        description: Token code for reference list.
+        type: string
+      transactionid:
+        description: Transaction Reference number for merchant.
+        type: integer
+      updated_at:
+        description: 修改时间
+        type: string
+    type: object
   models.Clientfixedadconfig:
     properties:
       adsort:
@@ -32081,6 +32160,35 @@ paths:
       summary: 个人意愿核身认证(双录)
       tags:
       - 爱签
+  /Bank/QueryAmtInByPaid:
+    get:
+      parameters:
+      - description: 资金账户
+        in: query
+        name: accountid
+        required: true
+        type: integer
+      - description: 银行服务流水号
+        in: query
+        name: exchticket
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Chillpayamtinrec'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 获取银行待支付地址
+      tags:
+      - 银行
   /Bank/QueryBankBranChnumInfo:
     get:
       parameters:

+ 15 - 0
models/bank.go

@@ -95,3 +95,18 @@ func (r *Bankbranchnuminfo) GetDataByPage() (interface{}, error, int, int, int)
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+func GetAmtInByPaid(accountId int, exchticket string) (*Chillpayamtinrec, error) {
+	engine := db.GetEngine()
+
+	var rec Chillpayamtinrec
+	has, err := engine.Where("account = ? and exch_seq = ? and deal_status = 2", accountId, exchticket).Get(&rec)
+	if err != nil {
+		return nil, err
+	}
+	if has {
+		return &rec, nil
+	}
+
+	return nil, nil
+}

+ 34 - 0
models/ori.go

@@ -1061,3 +1061,37 @@ type I18nConfig struct {
 func (r *I18nConfig) TableName() string {
 	return "I18NCONFIG"
 }
+
+// Chillpayamtinrec ChillPay入金记录表
+type Chillpayamtinrec struct {
+	ID            int64     `json:"id" xorm:"ID"`                       // 自增ID
+	REC_VERSION   int64     `json:"rec_version" xorm:"REC_VERSION"`     // 乐观锁
+	EXCH_NO       string    `json:"exch_no" xorm:"EXCH_NO"`             // 交易所编号
+	EXCH_DATE     string    `json:"exch_date" xorm:"EXCH_DATE"`         // 交易日
+	EXCH_SEQ      string    `json:"exch_seq" xorm:"EXCH_SEQ"`           // 交易所流水号
+	DEAL_STATUS   int32     `json:"deal_status" xorm:"DEAL_STATUS"`     // 入金状态 0-成功 1-失败 2-已发送 3-初始化
+	DEAL_DESC     string    `json:"deal_desc" xorm:"DEAL_DESC"`         // 状态描述
+	CREATED_AT    time.Time `json:"created_at" xorm:"CREATED_AT"`       // 创建时间
+	UPDATED_AT    time.Time `json:"updated_at" xorm:"UPDATED_AT"`       // 修改时间
+	ACCOUNTID     int64     `json:"accountid" xorm:"ACCOUNTID"`         // 账户ID
+	AMOUNT        float64   `json:"amount" xorm:"AMOUNT"`               // 入金金额,需要X100才能给接口调用
+	TRANSACTIONID int64     `json:"transactionid" xorm:"TRANSACTIONID"` // Transaction Reference number for merchant.
+	MERCHANTCODE  string    `json:"merchantcode" xorm:"MERCHANTCODE"`   // Merchant ID.
+	ORDERNO       string    `json:"orderno" xorm:"ORDERNO"`             // Order number
+	CUSTOMERID    string    `json:"customerid" xorm:"CUSTOMERID"`       // End User’s reference code (accountid)
+	CHILLPAY_DESC string    `json:"chillpay_desc" xorm:"CHILLPAY_DESC"` // Payment information.
+	CHANNELCODE   string    `json:"channelcode" xorm:"CHANNELCODE"`     // Reference code for the bank that received payment.
+	CURRENCY      string    `json:"currency" xorm:"CURRENCY"`           // Currency data code such as "764".
+	LANGCODE      string    `json:"langcode" xorm:"LANGCODE"`           // Language code to be displayed on the payment website of the bank.
+	IPADDRESS     string    `json:"ipaddress" xorm:"IPADDRESS"`         // End user’s IP Address.
+	PAYMENTSTATUS int32     `json:"paymentstatus" xorm:"PAYMENTSTATUS"` // Payment result code from the bank.
+	RETURNURL     string    `json:"returnurl" xorm:"RETURNURL"`         // The URL that will be displayed when the End user completes the transaction.
+	PAYMENTURL    string    `json:"paymenturl" xorm:"PAYMENTURL"`       // URL to be redirected to the bank's payment page.
+	TOKEN         string    `json:"token" xorm:"TOKEN"`                 // Token code for reference list.
+	CUSTOMERNAME  string    `json:"customername" xorm:"CUSTOMERNAME"`   // Payer Name(For QR Payment only)
+}
+
+// TableName is CHILLPAY_AMT_IN_REC
+func (r *Chillpayamtinrec) TableName() string {
+	return "CHILLPAY_AMT_IN_REC"
+}

+ 1 - 0
routers/router.go

@@ -816,6 +816,7 @@ func InitRouter() *gin.Engine {
 	{
 		bankR.Use(token.Auth()).GET("QueryBankCusBankExtendConfigs", bank.QueryBankCusBankExtendConfigs)
 		bankR.Use(token.Auth()).GET("QueryBankBranChnumInfo", bank.QueryBankBranChnumInfo)
+		bankR.Use(token.Auth()).GET("QueryAmtInByPaid", bank.QueryAmtInByPaid)
 	}
 
 	// ************************* 报表 *************************