zhou.xiaoning 2 năm trước cách đây
mục cha
commit
88e0fdc8b6
6 tập tin đã thay đổi với 117 bổ sung168 xóa
  1. 26 1
      api/v1/account/certification.go
  2. 25 61
      docs/docs.go
  3. 25 61
      docs/swagger.json
  4. 21 45
      docs/swagger.yaml
  5. 1 0
      router/account.go
  6. 19 0
      service/sign/sign.go

+ 26 - 1
api/v1/account/certification.go

@@ -72,7 +72,7 @@ func AddUser(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept   application/json
 // @Produce  application/json
-// @Param    data body     request.CreateContractAndAddSignerReq      true "入参"
+// @Param    data body     request.CreateContractAndAddSignerReq     true "入参"
 // @Success  200  {object} response.Response{data=string,msg=string} "出参"
 // @Router   /Account/CreateContractAndAddSigner [post]
 // @Tags     账户服务
@@ -98,6 +98,31 @@ func CreateContractAndAddSigner(c *gin.Context) {
 	}
 }
 
+// SignCompleted 提交实名认证
+// @Summary  提交实名认证
+// @Security ApiKeyAuth
+// @accept   application/json
+// @Produce  application/json
+// @Success  200 {object} response.Response{msg=string} "出参"
+// @Router   /Account/SignCompleted [post]
+// @Tags     账户服务
+func SignCompleted(c *gin.Context) {
+	g := utils.GinUtils{C: c}
+
+	// 获取请求账号信息
+	claims := g.GetClaims()
+	if g.Err != nil {
+		return
+	}
+
+	if err := signService.SignCompleted(claims.UserID); err == nil {
+		response.OkWithMessage("操作成功", g.C)
+	} else {
+		global.M2A_LOG.Error(err.Error(), zap.Error(err))
+		response.FailWithMessage(err.Error(), c)
+	}
+}
+
 // POST
 // func HandleASignCompleted(c *gin.Context) {
 // 	g := utils.GinUtils{C: c}

+ 25 - 61
docs/docs.go

@@ -251,8 +251,8 @@ const docTemplate = `{
                 }
             }
         },
-        "/Account/TokenCheck": {
-            "get": {
+        "/Account/SignCompleted": {
+            "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -267,10 +267,10 @@ const docTemplate = `{
                 "tags": [
                     "账户服务"
                 ],
-                "summary": "Token校验",
+                "summary": "提交实名认证",
                 "responses": {
                     "200": {
-                        "description": "操作成功",
+                        "description": "出参",
                         "schema": {
                             "allOf": [
                                 {
@@ -290,8 +290,8 @@ const docTemplate = `{
                 }
             }
         },
-        "/MQ/SendMsgToMQ": {
-            "post": {
+        "/Account/TokenCheck": {
+            "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -304,23 +304,12 @@ const docTemplate = `{
                     "application/json"
                 ],
                 "tags": [
-                    "总线业务"
-                ],
-                "summary": "总线业务",
-                "parameters": [
-                    {
-                        "description": "入参",
-                        "name": "data",
-                        "in": "body",
-                        "required": true,
-                        "schema": {
-                            "$ref": "#/definitions/request.MQBodyReq"
-                        }
-                    }
+                    "账户服务"
                 ],
+                "summary": "Token校验",
                 "responses": {
                     "200": {
-                        "description": "出参",
+                        "description": "操作成功",
                         "schema": {
                             "allOf": [
                                 {
@@ -329,9 +318,6 @@ const docTemplate = `{
                                 {
                                     "type": "object",
                                     "properties": {
-                                        "data": {
-                                            "$ref": "#/definitions/response.MQBodyRsp"
-                                        },
                                         "msg": {
                                             "type": "string"
                                         }
@@ -343,8 +329,13 @@ const docTemplate = `{
                 }
             }
         },
-        "/MQ/SendNtfToMQ": {
+        "/MQ/SendMsgToMQ": {
             "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
                 "consumes": [
                     "application/json"
                 ],
@@ -354,7 +345,7 @@ const docTemplate = `{
                 "tags": [
                     "总线业务"
                 ],
-                "summary": "总线通知",
+                "summary": "总线业务",
                 "parameters": [
                     {
                         "description": "入参",
@@ -362,7 +353,7 @@ const docTemplate = `{
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/request.MQNtfReq"
+                            "$ref": "#/definitions/request.MQBodyReq"
                         }
                     }
                 ],
@@ -377,6 +368,9 @@ const docTemplate = `{
                                 {
                                     "type": "object",
                                     "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/response.MQBodyRsp"
+                                        },
                                         "msg": {
                                             "type": "string"
                                         }
@@ -388,13 +382,8 @@ const docTemplate = `{
                 }
             }
         },
-        "/Quote/QuoteSubscribe": {
+        "/MQ/SendNtfToMQ": {
             "post": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "consumes": [
                     "application/json"
                 ],
@@ -402,17 +391,17 @@ const docTemplate = `{
                     "application/json"
                 ],
                 "tags": [
-                    "实时行情"
+                    "总线业务"
                 ],
-                "summary": "订阅商品实时行情请求",
+                "summary": "总线通知",
                 "parameters": [
                     {
-                        "description": "入参1",
+                        "description": "入参",
                         "name": "data",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/request.QuoteSubscribeReq"
+                            "$ref": "#/definitions/request.MQNtfReq"
                         }
                     }
                 ],
@@ -623,31 +612,6 @@ const docTemplate = `{
                 }
             }
         },
-        "request.QuoteGoods": {
-            "type": "object",
-            "properties": {
-                "exchangeId": {
-                    "description": "交易所代码,一般写死250",
-                    "type": "integer"
-                },
-                "goodsCode": {
-                    "description": "商品代码,全大写",
-                    "type": "string"
-                }
-            }
-        },
-        "request.QuoteSubscribeReq": {
-            "type": "object",
-            "properties": {
-                "quoteGoodses": {
-                    "description": "待订阅商品信息",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/request.QuoteGoods"
-                    }
-                }
-            }
-        },
         "response.LoginRsp": {
             "type": "object",
             "properties": {

+ 25 - 61
docs/swagger.json

@@ -242,8 +242,8 @@
                 }
             }
         },
-        "/Account/TokenCheck": {
-            "get": {
+        "/Account/SignCompleted": {
+            "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -258,10 +258,10 @@
                 "tags": [
                     "账户服务"
                 ],
-                "summary": "Token校验",
+                "summary": "提交实名认证",
                 "responses": {
                     "200": {
-                        "description": "操作成功",
+                        "description": "出参",
                         "schema": {
                             "allOf": [
                                 {
@@ -281,8 +281,8 @@
                 }
             }
         },
-        "/MQ/SendMsgToMQ": {
-            "post": {
+        "/Account/TokenCheck": {
+            "get": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -295,23 +295,12 @@
                     "application/json"
                 ],
                 "tags": [
-                    "总线业务"
-                ],
-                "summary": "总线业务",
-                "parameters": [
-                    {
-                        "description": "入参",
-                        "name": "data",
-                        "in": "body",
-                        "required": true,
-                        "schema": {
-                            "$ref": "#/definitions/request.MQBodyReq"
-                        }
-                    }
+                    "账户服务"
                 ],
+                "summary": "Token校验",
                 "responses": {
                     "200": {
-                        "description": "出参",
+                        "description": "操作成功",
                         "schema": {
                             "allOf": [
                                 {
@@ -320,9 +309,6 @@
                                 {
                                     "type": "object",
                                     "properties": {
-                                        "data": {
-                                            "$ref": "#/definitions/response.MQBodyRsp"
-                                        },
                                         "msg": {
                                             "type": "string"
                                         }
@@ -334,8 +320,13 @@
                 }
             }
         },
-        "/MQ/SendNtfToMQ": {
+        "/MQ/SendMsgToMQ": {
             "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
                 "consumes": [
                     "application/json"
                 ],
@@ -345,7 +336,7 @@
                 "tags": [
                     "总线业务"
                 ],
-                "summary": "总线通知",
+                "summary": "总线业务",
                 "parameters": [
                     {
                         "description": "入参",
@@ -353,7 +344,7 @@
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/request.MQNtfReq"
+                            "$ref": "#/definitions/request.MQBodyReq"
                         }
                     }
                 ],
@@ -368,6 +359,9 @@
                                 {
                                     "type": "object",
                                     "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/response.MQBodyRsp"
+                                        },
                                         "msg": {
                                             "type": "string"
                                         }
@@ -379,13 +373,8 @@
                 }
             }
         },
-        "/Quote/QuoteSubscribe": {
+        "/MQ/SendNtfToMQ": {
             "post": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "consumes": [
                     "application/json"
                 ],
@@ -393,17 +382,17 @@
                     "application/json"
                 ],
                 "tags": [
-                    "实时行情"
+                    "总线业务"
                 ],
-                "summary": "订阅商品实时行情请求",
+                "summary": "总线通知",
                 "parameters": [
                     {
-                        "description": "入参1",
+                        "description": "入参",
                         "name": "data",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/request.QuoteSubscribeReq"
+                            "$ref": "#/definitions/request.MQNtfReq"
                         }
                     }
                 ],
@@ -614,31 +603,6 @@
                 }
             }
         },
-        "request.QuoteGoods": {
-            "type": "object",
-            "properties": {
-                "exchangeId": {
-                    "description": "交易所代码,一般写死250",
-                    "type": "integer"
-                },
-                "goodsCode": {
-                    "description": "商品代码,全大写",
-                    "type": "string"
-                }
-            }
-        },
-        "request.QuoteSubscribeReq": {
-            "type": "object",
-            "properties": {
-                "quoteGoodses": {
-                    "description": "待订阅商品信息",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/request.QuoteGoods"
-                    }
-                }
-            }
-        },
         "response.LoginRsp": {
             "type": "object",
             "properties": {

+ 21 - 45
docs/swagger.yaml

@@ -133,23 +133,6 @@ definitions:
     - data
     - funCode
     type: object
-  request.QuoteGoods:
-    properties:
-      exchangeId:
-        description: 交易所代码,一般写死250
-        type: integer
-      goodsCode:
-        description: 商品代码,全大写
-        type: string
-    type: object
-  request.QuoteSubscribeReq:
-    properties:
-      quoteGoodses:
-        description: 待订阅商品信息
-        items:
-          $ref: '#/definitions/request.QuoteGoods'
-        type: array
-    type: object
   response.LoginRsp:
     properties:
       expiresAt:
@@ -323,15 +306,15 @@ paths:
       summary: 查询用户电子签记录表
       tags:
       - 账户服务
-  /Account/TokenCheck:
-    get:
+  /Account/SignCompleted:
+    post:
       consumes:
       - application/json
       produces:
       - application/json
       responses:
         "200":
-          description: 操作成功
+          description: 出参
           schema:
             allOf:
             - $ref: '#/definitions/response.Response'
@@ -341,40 +324,31 @@ paths:
               type: object
       security:
       - ApiKeyAuth: []
-      summary: Token校验
+      summary: 提交实名认证
       tags:
       - 账户服务
-  /MQ/SendMsgToMQ:
-    post:
+  /Account/TokenCheck:
+    get:
       consumes:
       - application/json
-      parameters:
-      - description: 入参
-        in: body
-        name: data
-        required: true
-        schema:
-          $ref: '#/definitions/request.MQBodyReq'
       produces:
       - application/json
       responses:
         "200":
-          description: 出参
+          description: 操作成功
           schema:
             allOf:
             - $ref: '#/definitions/response.Response'
             - properties:
-                data:
-                  $ref: '#/definitions/response.MQBodyRsp'
                 msg:
                   type: string
               type: object
       security:
       - ApiKeyAuth: []
-      summary: 总线业务
+      summary: Token校验
       tags:
-      - 总线业
-  /MQ/SendNtfToMQ:
+      - 账户服
+  /MQ/SendMsgToMQ:
     post:
       consumes:
       - application/json
@@ -384,7 +358,7 @@ paths:
         name: data
         required: true
         schema:
-          $ref: '#/definitions/request.MQNtfReq'
+          $ref: '#/definitions/request.MQBodyReq'
       produces:
       - application/json
       responses:
@@ -394,23 +368,27 @@ paths:
             allOf:
             - $ref: '#/definitions/response.Response'
             - properties:
+                data:
+                  $ref: '#/definitions/response.MQBodyRsp'
                 msg:
                   type: string
               type: object
-      summary: 总线通知
+      security:
+      - ApiKeyAuth: []
+      summary: 总线业务
       tags:
       - 总线业务
-  /Quote/QuoteSubscribe:
+  /MQ/SendNtfToMQ:
     post:
       consumes:
       - application/json
       parameters:
-      - description: 入参1
+      - description: 入参
         in: body
         name: data
         required: true
         schema:
-          $ref: '#/definitions/request.QuoteSubscribeReq'
+          $ref: '#/definitions/request.MQNtfReq'
       produces:
       - application/json
       responses:
@@ -423,11 +401,9 @@ paths:
                 msg:
                   type: string
               type: object
-      security:
-      - ApiKeyAuth: []
-      summary: 订阅商品实时行情请求
+      summary: 总线通知
       tags:
-      - 实时行情
+      - 总线业务
 securityDefinitions:
   ApiKeyAuth:
     in: header

+ 1 - 0
router/account.go

@@ -21,5 +21,6 @@ func InitAccountPrivateRouter(r *gin.RouterGroup) {
 		accountR.GET("QueryUserESignRecord", account.QueryUserESignRecord)
 		accountR.POST("AddUser", account.AddUser)
 		accountR.POST("CreateContractAndAddSigner", account.CreateContractAndAddSigner)
+		accountR.POST("SignCompleted", account.SignCompleted)
 	}
 }

+ 19 - 0
service/sign/sign.go

@@ -156,6 +156,25 @@ func CreateContractAndAddSigner(req request.CreateContractAndAddSignerReq, userI
 	return
 }
 
+// SignCompleted
+func SignCompleted(userId int) (err error) {
+	// 获取用户电子签记录
+	datas := make([]account.Useresignrecord, 0)
+	err = global.M2A_DB.Where("USERID = ?", userId).Find(&datas)
+	if err != nil {
+		global.M2A_LOG.Error("SignCompleted 获取用户电子签记录失败", zap.Error(err))
+		return
+	}
+	for _, item := range datas {
+		if item.RECORDSTATUS != 3 {
+			err = errors.New("未完成所有合同签署")
+			return
+		}
+	}
+
+	return
+}
+
 /*
 handleASignCompleted 处理爱签合同签署完成后回调通知