Переглянути джерело

增加接口:/Tencent/InitMdUserSwapProtocol 按用户ID和机构ID创建机构交易协议申请信息

zhou.xiaoning 2 роки тому
батько
коміт
7e9e49e676

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 27 - 0
controllers/tencent/qian.go

@@ -145,6 +145,33 @@ func InitTencentESS(c *gin.Context) {
 	}
 }
 
+// InitMdUserSwapProtocol 按用户ID和机构ID创建机构交易协议申请信息
+// @Summary  按用户ID和机构ID创建机构交易协议申请信息
+// @Produce  json
+// @Security ApiKeyAuth
+// @accept   application/json
+// @Param    data body     InitTencentESSReq true "入参"
+// @Failure  500  {object} app.Response
+// @Router   /Tencent/InitMdUserSwapProtocol [post]
+// @Tags     腾讯电子签
+func InitMdUserSwapProtocol(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req InitTencentESSReq
+	if err := appG.C.ShouldBindJSON(&req); err != nil {
+		logger.GetLogger().Errorf("InitTencentESS failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if err := tencent.InitMdUserSwapProtocol(req.UserId, req.MemberUserId); err == nil {
+		appG.Response(http.StatusOK, e.SUCCESS, "ok")
+	} else {
+		appG.Response(http.StatusBadRequest, e.ERROR, nil)
+	}
+}
+
 // PersonInfo  签署人信息
 type PersonInfo struct {
 	Name         string `json:"name"`         // 姓名

+ 38 - 0
docs/docs.go

@@ -18120,6 +18120,44 @@ const docTemplate = `{
                 }
             }
         },
+        "/Tencent/InitMdUserSwapProtocol": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "腾讯电子签"
+                ],
+                "summary": "按用户ID和机构ID创建机构交易协议申请信息",
+                "parameters": [
+                    {
+                        "description": "入参",
+                        "name": "data",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/tencent.InitTencentESSReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Tencent/InitTencentESS": {
             "post": {
                 "security": [

+ 38 - 0
docs/swagger.json

@@ -18111,6 +18111,44 @@
                 }
             }
         },
+        "/Tencent/InitMdUserSwapProtocol": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "腾讯电子签"
+                ],
+                "summary": "按用户ID和机构ID创建机构交易协议申请信息",
+                "parameters": [
+                    {
+                        "description": "入参",
+                        "name": "data",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/tencent.InitTencentESSReq"
+                        }
+                    }
+                ],
+                "responses": {
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Tencent/InitTencentESS": {
             "post": {
                 "security": [

+ 23 - 0
docs/swagger.yaml

@@ -41760,6 +41760,29 @@ paths:
       summary: 获取合同状态
       tags:
       - 腾讯电子签
+  /Tencent/InitMdUserSwapProtocol:
+    post:
+      consumes:
+      - application/json
+      parameters:
+      - description: 入参
+        in: body
+        name: data
+        required: true
+        schema:
+          $ref: '#/definitions/tencent.InitTencentESSReq'
+      produces:
+      - application/json
+      responses:
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 按用户ID和机构ID创建机构交易协议申请信息
+      tags:
+      - 腾讯电子签
   /Tencent/InitTencentESS:
     post:
       consumes:

+ 3 - 3
models/esign.go

@@ -79,13 +79,13 @@ func QueryEsignTemplateConfigs(esignType, templateType int) (datas []Esigntempla
 	return
 }
 
-func InsertMdUserSwapProtocol(userId, areaUserId int, session *xorm.Session) (err error) {
+func InsertMdUserSwapProtocol(userId, areaUserId, protocolStatus int, session *xorm.Session) (err error) {
 	sql := fmt.Sprintf(`
 	INSERT INTO MD_USERSWAPPROTOCOL 
 	(USERID,AREAUSERID,PROTOCOLSTATUS,AUDITTIME,UPDATETIME) 
 	VALUES
-	(%v,%v,1,sysdate,sysdate)
-	`, userId, areaUserId)
+	(%v,%v,%v,sysdate,sysdate)
+	`, userId, areaUserId, protocolStatus)
 	_, err = session.Exec(sql)
 
 	return

+ 1 - 0
routers/router.go

@@ -834,6 +834,7 @@ func InitRouter() *gin.Engine {
 		tencentR.Use(token.Auth()).POST("CreateFlowByTemplateDirectly", tencent.CreateFlowByTemplateDirectly)
 		tencentR.Use(token.Auth()).GET("GetFlowStatus", tencent.GetFlowStatus)
 		tencentR.Use(token.Auth()).POST("InitTencentESS", tencent.InitTencentESS)
+		tencentR.Use(token.Auth()).POST("InitMdUserSwapProtocol", tencent.InitMdUserSwapProtocol)
 	}
 
 	return r

+ 11 - 1
services/tencent/ess.go

@@ -40,7 +40,7 @@ func InitTencentESS(userId, areaUserId int) (err error) {
 	session.Begin()
 
 	// 新增 MdUserSwapProtocol
-	err = models.InsertMdUserSwapProtocol(userId, areaUserId, session)
+	err = models.InsertMdUserSwapProtocol(userId, areaUserId, 1, session)
 	if err != nil {
 		session.Rollback()
 		return
@@ -58,6 +58,16 @@ func InitTencentESS(userId, areaUserId int) (err error) {
 	return session.Commit()
 }
 
+func InitMdUserSwapProtocol(userId, areaUserId int) (err error) {
+	// 新增 MdUserSwapProtocol
+	err = models.InsertMdUserSwapProtocol(userId, areaUserId, 3, db.GetEngine().NewSession())
+	if err != nil {
+		return
+	}
+
+	return
+}
+
 // CreateFlowByTemplateDirectly 通过合同模板创建合同签署流程
 func CreateFlowByTemplateDirectly(tmplateName string, userType int,
 	personName, personMobile, personIdCardNumber string,