Kaynağa Gözat

大连千海金:
增加定投管理、定投触发记录查询接口

zou.yingbin 4 yıl önce
ebeveyn
işleme
679674fb09
6 değiştirilmiş dosya ile 1100 ekleme ve 4 silme
  1. 42 0
      controllers/qhj/qryQhj.go
  2. 327 1
      docs/docs.go
  3. 327 1
      docs/swagger.json
  4. 232 1
      docs/swagger.yaml
  5. 170 1
      models/qhj.go
  6. 2 0
      routers/router.go

+ 42 - 0
controllers/qhj/qryQhj.go

@@ -53,3 +53,45 @@ func QueryContractLog(c *gin.Context) {
 	m := models.QhjContractLog{SCFCONTRACTID: req.SCFCONTRACTID, FilterType: req.AMOUNTTYPE}
 	a.DoGetDataI(&m)
 }
+
+// QueryRStrategy
+// @Summary 查询定投设置(我的定投/历史定投[状态=已终止])
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param status query string false "策略状态(可多选,逗号隔开) - 1:正常 2:暂停 3:终止"
+// @Success 200 {array} models.QhjRStrategy
+// @Failure 500 {object} app.Response
+// @Router /Qhj/QueryRStrategy [get]
+// @Tags 大连千海金
+func QueryRStrategy(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		USERID int64  `form:"userid" binding:"required"` // 用户id
+		STATUS string `form:"status"`                    // 状态
+	}{}
+	a.DoBindReq(&req)
+	m := models.QhjRStrategy{USERID: req.USERID, FilterStatus: req.STATUS}
+	a.DoGetDataI(&m)
+}
+
+// QueryRSTriggerLog
+// @Summary 查询定投记录(定投管理/详情/定投记录)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userid query int true "用户ID"
+// @Param regularlystrategyid query int false "定投策略id"
+// @Success 200 {array} models.QhjRSTriggerLog
+// @Failure 500 {object} app.Response
+// @Router /Qhj/QueryRSTriggerLog [get]
+// @Tags 大连千海金
+func QueryRSTriggerLog(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	req := struct {
+		USERID              int64 `form:"userid" binding:"required"` // 用户id
+		REGULARLYSTRATEGYID int64 `form:"regularlystrategyid"`       // 策略id
+	}{}
+	a.DoBindReq(&req)
+	m := models.QhjRSTriggerLog{USERID: req.USERID, REGULARLYSTRATEGYID: req.REGULARLYSTRATEGYID}
+	a.DoGetDataI(&m)
+}

+ 327 - 1
docs/docs.go

@@ -6835,6 +6835,102 @@ var doc = `{
                 }
             }
         },
+        "/Qhj/QueryRSTriggerLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询定投记录(定投管理/详情/定投记录)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "定投策略id",
+                        "name": "regularlystrategyid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjRSTriggerLog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Qhj/QueryRStrategy": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询定投设置(我的定投/历史定投[状态=已终止])",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "策略状态(可多选,逗号隔开) - 1:正常 2:暂停 3:终止",
+                        "name": "status",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjRStrategy"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Quote/QueryHistoryDatas": {
             "get": {
                 "security": [
@@ -19932,7 +20028,7 @@ var doc = `{
                     "type": "number"
                 },
                 "amounttype": {
-                    "description": "资金类型 - 1:首付款2:尾款 3:利息  4:追加款",
+                    "description": "资金类型 - 1:首付款 2:尾款 3:利息  4:追加款",
                     "type": "integer"
                 },
                 "logid": {
@@ -19953,6 +20049,236 @@ var doc = `{
                 }
             }
         },
+        "models.QhjRSTriggerLog": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "用户资金账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "账号名称(ACCOUNTID对应的名称)",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "定投商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "定投商品ID",
+                    "type": "string"
+                },
+                "goodsname": {
+                    "description": "定投商品名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "定投商品单位id",
+                    "type": "integer"
+                },
+                "logid": {
+                    "description": "LogID(SEQ_QHJ_RSTRIGGERLOG)",
+                    "type": "string"
+                },
+                "regularlycycle": {
+                    "description": "定投频率 - 1:每周 2:每月",
+                    "type": "integer"
+                },
+                "regularlycyclevalue": {
+                    "description": "定投频率值 - 每周几(0-6)  或 每月几号(\u003c=28)",
+                    "type": "string"
+                },
+                "regularlymode": {
+                    "description": "定投方式 - 1:按数量 2:按金额",
+                    "type": "integer"
+                },
+                "regularlymodevalue": {
+                    "description": "定投方式值 - 数量或金额",
+                    "type": "number"
+                },
+                "regularlystrategyid": {
+                    "description": "定投策略ID",
+                    "type": "integer"
+                },
+                "retcode": {
+                    "description": "错误码",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单ID",
+                    "type": "string"
+                },
+                "triggeramount": {
+                    "description": "触发金额",
+                    "type": "number"
+                },
+                "triggerqty": {
+                    "description": "触发数量",
+                    "type": "number"
+                },
+                "triggerstatus": {
+                    "description": "触发状态 - 1:成功 2:失败",
+                    "type": "integer"
+                },
+                "triggertime": {
+                    "description": "触发时间",
+                    "type": "string"
+                },
+                "triggertradedate": {
+                    "description": "触发交易日",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "所属用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称(userid对应的名称)",
+                    "type": "string"
+                }
+            }
+        },
+        "models.QhjRStrategy": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "用户资金账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "账号名称(ACCOUNTID对应的名称)",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "定投商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "定投商品ID",
+                    "type": "string"
+                },
+                "goodsname": {
+                    "description": "定投商品名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "定投商品单位id",
+                    "type": "integer"
+                },
+                "lasteffecttradedate": {
+                    "description": "最新生效交易日",
+                    "type": "string"
+                },
+                "laststoptradedate": {
+                    "description": "最新暂停交易日",
+                    "type": "string"
+                },
+                "lasttriggertradedate": {
+                    "description": "最新触发交易日",
+                    "type": "string"
+                },
+                "nexttriggeramount": {
+                    "description": "下次触发金额",
+                    "type": "number"
+                },
+                "nexttriggerdate": {
+                    "description": "下次触发日期",
+                    "type": "string"
+                },
+                "nexttriggerqty": {
+                    "description": "下次触发数量 [按小数位放大值]",
+                    "type": "number"
+                },
+                "regularlycycle": {
+                    "description": "定投频率 - 1:每周 2:每月",
+                    "type": "integer"
+                },
+                "regularlycyclevalue": {
+                    "description": "定投频率值 - 每周几(0-6)  或 每月几号(\u003c=28)",
+                    "type": "string"
+                },
+                "regularlymode": {
+                    "description": "定投方式 - 1:按数量 2:按金额",
+                    "type": "integer"
+                },
+                "regularlymodevalue": {
+                    "description": "定投方式值 - 数量或金额",
+                    "type": "number"
+                },
+                "regularlystrategyid": {
+                    "description": "定投策略ID (SEQ_QHJ_REGULARLYSTRATEGY)",
+                    "type": "integer"
+                },
+                "regularlystrategystatus": {
+                    "description": "策略状态 - 1:正常 2:暂停 3:终止",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "triggersuccesstimes": {
+                    "description": "累计定投成功次数",
+                    "type": "string"
+                },
+                "triggertotalamount": {
+                    "description": "累计定投金额(成功)",
+                    "type": "number"
+                },
+                "triggertotalqty": {
+                    "description": "累计定投数量(成功) [按小数位放大值]",
+                    "type": "number"
+                },
+                "triggertotaltimes": {
+                    "description": "累计定投总次数",
+                    "type": "string"
+                },
+                "updatesrc": {
+                    "description": "更新来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "所属用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称(userid对应的名称)",
+                    "type": "string"
+                }
+            }
+        },
         "models.QueryErrorInfosRsp": {
             "type": "object",
             "required": [

+ 327 - 1
docs/swagger.json

@@ -6819,6 +6819,102 @@
                 }
             }
         },
+        "/Qhj/QueryRSTriggerLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询定投记录(定投管理/详情/定投记录)",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "定投策略id",
+                        "name": "regularlystrategyid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjRSTriggerLog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Qhj/QueryRStrategy": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "大连千海金"
+                ],
+                "summary": "查询定投设置(我的定投/历史定投[状态=已终止])",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "策略状态(可多选,逗号隔开) - 1:正常 2:暂停 3:终止",
+                        "name": "status",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.QhjRStrategy"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Quote/QueryHistoryDatas": {
             "get": {
                 "security": [
@@ -19916,7 +20012,7 @@
                     "type": "number"
                 },
                 "amounttype": {
-                    "description": "资金类型 - 1:首付款2:尾款 3:利息  4:追加款",
+                    "description": "资金类型 - 1:首付款 2:尾款 3:利息  4:追加款",
                     "type": "integer"
                 },
                 "logid": {
@@ -19937,6 +20033,236 @@
                 }
             }
         },
+        "models.QhjRSTriggerLog": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "用户资金账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "账号名称(ACCOUNTID对应的名称)",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "定投商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "定投商品ID",
+                    "type": "string"
+                },
+                "goodsname": {
+                    "description": "定投商品名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "定投商品单位id",
+                    "type": "integer"
+                },
+                "logid": {
+                    "description": "LogID(SEQ_QHJ_RSTRIGGERLOG)",
+                    "type": "string"
+                },
+                "regularlycycle": {
+                    "description": "定投频率 - 1:每周 2:每月",
+                    "type": "integer"
+                },
+                "regularlycyclevalue": {
+                    "description": "定投频率值 - 每周几(0-6)  或 每月几号(\u003c=28)",
+                    "type": "string"
+                },
+                "regularlymode": {
+                    "description": "定投方式 - 1:按数量 2:按金额",
+                    "type": "integer"
+                },
+                "regularlymodevalue": {
+                    "description": "定投方式值 - 数量或金额",
+                    "type": "number"
+                },
+                "regularlystrategyid": {
+                    "description": "定投策略ID",
+                    "type": "integer"
+                },
+                "retcode": {
+                    "description": "错误码",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单ID",
+                    "type": "string"
+                },
+                "triggeramount": {
+                    "description": "触发金额",
+                    "type": "number"
+                },
+                "triggerqty": {
+                    "description": "触发数量",
+                    "type": "number"
+                },
+                "triggerstatus": {
+                    "description": "触发状态 - 1:成功 2:失败",
+                    "type": "integer"
+                },
+                "triggertime": {
+                    "description": "触发时间",
+                    "type": "string"
+                },
+                "triggertradedate": {
+                    "description": "触发交易日",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "所属用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称(userid对应的名称)",
+                    "type": "string"
+                }
+            }
+        },
+        "models.QhjRStrategy": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "用户资金账户",
+                    "type": "integer"
+                },
+                "accountname": {
+                    "description": "账号名称(ACCOUNTID对应的名称)",
+                    "type": "string"
+                },
+                "currencyid": {
+                    "description": "币种id",
+                    "type": "integer"
+                },
+                "currencyname": {
+                    "description": "币种名称",
+                    "type": "string"
+                },
+                "enumdicname": {
+                    "description": "单位名称",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "定投商品代码",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "定投商品ID",
+                    "type": "string"
+                },
+                "goodsname": {
+                    "description": "定投商品名称",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "定投商品单位id",
+                    "type": "integer"
+                },
+                "lasteffecttradedate": {
+                    "description": "最新生效交易日",
+                    "type": "string"
+                },
+                "laststoptradedate": {
+                    "description": "最新暂停交易日",
+                    "type": "string"
+                },
+                "lasttriggertradedate": {
+                    "description": "最新触发交易日",
+                    "type": "string"
+                },
+                "nexttriggeramount": {
+                    "description": "下次触发金额",
+                    "type": "number"
+                },
+                "nexttriggerdate": {
+                    "description": "下次触发日期",
+                    "type": "string"
+                },
+                "nexttriggerqty": {
+                    "description": "下次触发数量 [按小数位放大值]",
+                    "type": "number"
+                },
+                "regularlycycle": {
+                    "description": "定投频率 - 1:每周 2:每月",
+                    "type": "integer"
+                },
+                "regularlycyclevalue": {
+                    "description": "定投频率值 - 每周几(0-6)  或 每月几号(\u003c=28)",
+                    "type": "string"
+                },
+                "regularlymode": {
+                    "description": "定投方式 - 1:按数量 2:按金额",
+                    "type": "integer"
+                },
+                "regularlymodevalue": {
+                    "description": "定投方式值 - 数量或金额",
+                    "type": "number"
+                },
+                "regularlystrategyid": {
+                    "description": "定投策略ID (SEQ_QHJ_REGULARLYSTRATEGY)",
+                    "type": "integer"
+                },
+                "regularlystrategystatus": {
+                    "description": "策略状态 - 1:正常 2:暂停 3:终止",
+                    "type": "integer"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                },
+                "triggersuccesstimes": {
+                    "description": "累计定投成功次数",
+                    "type": "string"
+                },
+                "triggertotalamount": {
+                    "description": "累计定投金额(成功)",
+                    "type": "number"
+                },
+                "triggertotalqty": {
+                    "description": "累计定投数量(成功) [按小数位放大值]",
+                    "type": "number"
+                },
+                "triggertotaltimes": {
+                    "description": "累计定投总次数",
+                    "type": "string"
+                },
+                "updatesrc": {
+                    "description": "更新来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "所属用户ID",
+                    "type": "integer"
+                },
+                "username": {
+                    "description": "用户名称(userid对应的名称)",
+                    "type": "string"
+                }
+            }
+        },
         "models.QueryErrorInfosRsp": {
             "type": "object",
             "required": [

+ 232 - 1
docs/swagger.yaml

@@ -8774,7 +8774,7 @@ definitions:
         description: 支付金额
         type: number
       amounttype:
-        description: 资金类型 - 1:首付款2:尾款 3:利息  4:追加款
+        description: 资金类型 - 1:首付款 2:尾款 3:利息  4:追加款
         type: integer
       logid:
         description: LogID(315+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
@@ -8789,6 +8789,177 @@ definitions:
         description: 更新时间
         type: string
     type: object
+  models.QhjRSTriggerLog:
+    properties:
+      accountid:
+        description: 用户资金账户
+        type: integer
+      accountname:
+        description: 账号名称(ACCOUNTID对应的名称)
+        type: string
+      currencyid:
+        description: 币种id
+        type: integer
+      currencyname:
+        description: 币种名称
+        type: string
+      enumdicname:
+        description: 单位名称
+        type: string
+      goodscode:
+        description: 定投商品代码
+        type: string
+      goodsid:
+        description: 定投商品ID
+        type: string
+      goodsname:
+        description: 定投商品名称
+        type: string
+      goodunitid:
+        description: 定投商品单位id
+        type: integer
+      logid:
+        description: LogID(SEQ_QHJ_RSTRIGGERLOG)
+        type: string
+      regularlycycle:
+        description: 定投频率 - 1:每周 2:每月
+        type: integer
+      regularlycyclevalue:
+        description: 定投频率值 - 每周几(0-6)  或 每月几号(<=28)
+        type: string
+      regularlymode:
+        description: 定投方式 - 1:按数量 2:按金额
+        type: integer
+      regularlymodevalue:
+        description: 定投方式值 - 数量或金额
+        type: number
+      regularlystrategyid:
+        description: 定投策略ID
+        type: integer
+      retcode:
+        description: 错误码
+        type: string
+      tradeid:
+        description: 成交单ID
+        type: string
+      triggeramount:
+        description: 触发金额
+        type: number
+      triggerqty:
+        description: 触发数量
+        type: number
+      triggerstatus:
+        description: 触发状态 - 1:成功 2:失败
+        type: integer
+      triggertime:
+        description: 触发时间
+        type: string
+      triggertradedate:
+        description: 触发交易日
+        type: string
+      userid:
+        description: 所属用户ID
+        type: integer
+      username:
+        description: 用户名称(userid对应的名称)
+        type: string
+    type: object
+  models.QhjRStrategy:
+    properties:
+      accountid:
+        description: 用户资金账户
+        type: integer
+      accountname:
+        description: 账号名称(ACCOUNTID对应的名称)
+        type: string
+      currencyid:
+        description: 币种id
+        type: integer
+      currencyname:
+        description: 币种名称
+        type: string
+      enumdicname:
+        description: 单位名称
+        type: string
+      goodscode:
+        description: 定投商品代码
+        type: string
+      goodsid:
+        description: 定投商品ID
+        type: string
+      goodsname:
+        description: 定投商品名称
+        type: string
+      goodunitid:
+        description: 定投商品单位id
+        type: integer
+      lasteffecttradedate:
+        description: 最新生效交易日
+        type: string
+      laststoptradedate:
+        description: 最新暂停交易日
+        type: string
+      lasttriggertradedate:
+        description: 最新触发交易日
+        type: string
+      nexttriggeramount:
+        description: 下次触发金额
+        type: number
+      nexttriggerdate:
+        description: 下次触发日期
+        type: string
+      nexttriggerqty:
+        description: 下次触发数量 [按小数位放大值]
+        type: number
+      regularlycycle:
+        description: 定投频率 - 1:每周 2:每月
+        type: integer
+      regularlycyclevalue:
+        description: 定投频率值 - 每周几(0-6)  或 每月几号(<=28)
+        type: string
+      regularlymode:
+        description: 定投方式 - 1:按数量 2:按金额
+        type: integer
+      regularlymodevalue:
+        description: 定投方式值 - 数量或金额
+        type: number
+      regularlystrategyid:
+        description: 定投策略ID (SEQ_QHJ_REGULARLYSTRATEGY)
+        type: integer
+      regularlystrategystatus:
+        description: 策略状态 - 1:正常 2:暂停 3:终止
+        type: integer
+      remark:
+        description: 备注
+        type: string
+      triggersuccesstimes:
+        description: 累计定投成功次数
+        type: string
+      triggertotalamount:
+        description: 累计定投金额(成功)
+        type: number
+      triggertotalqty:
+        description: 累计定投数量(成功) [按小数位放大值]
+        type: number
+      triggertotaltimes:
+        description: 累计定投总次数
+        type: string
+      updatesrc:
+        description: 更新来源 - 1:管理端 2:终端
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+      updatorid:
+        description: 更新人
+        type: string
+      userid:
+        description: 所属用户ID
+        type: integer
+      username:
+        description: 用户名称(userid对应的名称)
+        type: string
+    type: object
   models.QueryErrorInfosRsp:
     properties:
       description:
@@ -15964,6 +16135,66 @@ paths:
       summary: 查询融资明细流水(融资明细详情页中的流水)
       tags:
       - 大连千海金
+  /Qhj/QueryRSTriggerLog:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 定投策略id
+        in: query
+        name: regularlystrategyid
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.QhjRSTriggerLog'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询定投记录(定投管理/详情/定投记录)
+      tags:
+      - 大连千海金
+  /Qhj/QueryRStrategy:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 策略状态(可多选,逗号隔开) - 1:正常 2:暂停 3:终止
+        in: query
+        name: status
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.QhjRStrategy'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询定投设置(我的定投/历史定投[状态=已终止])
+      tags:
+      - 大连千海金
   /Quote/QueryHistoryDatas:
     get:
       parameters:

+ 170 - 1
models/qhj.go

@@ -88,7 +88,7 @@ func (r *QhjContract) GetDataEx() (interface{}, error) {
 type QhjContractLog struct {
 	LOGID         string  `json:"logid"  xorm:"LOGID"`                 // LogID(315+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
 	SCFCONTRACTID int64   `json:"scfcontractid"  xorm:"SCFCONTRACTID"` // SCF合同ID(310+Unix秒时间戳(10位)+xxxxxx)
-	AMOUNTTYPE    int32   `json:"amounttype"  xorm:"AMOUNTTYPE"`       // 资金类型 - 1:首付款2:尾款 3:利息  4:追加款
+	AMOUNTTYPE    int32   `json:"amounttype"  xorm:"AMOUNTTYPE"`       // 资金类型 - 1:首付款 2:尾款 3:利息  4:追加款
 	AMOUNT        float64 `json:"amount"  xorm:"AMOUNT"`               // 支付金额
 	REMAINAMOUNT  float64 `json:"remainamount"  xorm:"REMAINAMOUNT"`   // 剩余货款
 	UPDATETIME    string  `json:"updatetime"  xorm:"UPDATETIME"`       // 更新时间
@@ -122,3 +122,172 @@ func (r *QhjContractLog) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// QhjRStrategy 定投规则策略
+type QhjRStrategy struct {
+	REGULARLYCYCLE          int32   `json:"regularlycycle"  xorm:"REGULARLYCYCLE"`                   // 定投频率 - 1:每周 2:每月
+	REGULARLYCYCLEVALUE     string  `json:"regularlycyclevalue"  xorm:"REGULARLYCYCLEVALUE"`         // 定投频率值 - 每周几(0-6)  或 每月几号(<=28)
+	REGULARLYMODE           int32   `json:"regularlymode"  xorm:"REGULARLYMODE"`                     // 定投方式 - 1:按数量 2:按金额
+	REGULARLYMODEVALUE      float64 `json:"regularlymodevalue"  xorm:"REGULARLYMODEVALUE"`           // 定投方式值 - 数量或金额
+	REMARK                  string  `json:"remark"  xorm:"REMARK"`                                   // 备注
+	REGULARLYSTRATEGYSTATUS int32   `json:"regularlystrategystatus"  xorm:"REGULARLYSTRATEGYSTATUS"` // 策略状态 - 1:正常 2:暂停 3:终止
+	TRIGGERTOTALTIMES       string  `json:"triggertotaltimes"  xorm:"TRIGGERTOTALTIMES"`             // 累计定投总次数
+	TRIGGERSUCCESSTIMES     string  `json:"triggersuccesstimes"  xorm:"TRIGGERSUCCESSTIMES"`         // 累计定投成功次数
+	TRIGGERTOTALQTY         float64 `json:"triggertotalqty"  xorm:"TRIGGERTOTALQTY"`                 // 累计定投数量(成功) [按小数位放大值]
+	TRIGGERTOTALAMOUNT      float64 `json:"triggertotalamount"  xorm:"TRIGGERTOTALAMOUNT"`           // 累计定投金额(成功)
+	LASTEFFECTTRADEDATE     string  `json:"lasteffecttradedate"  xorm:"LASTEFFECTTRADEDATE"`         // 最新生效交易日
+	LASTSTOPTRADEDATE       string  `json:"laststoptradedate"  xorm:"LASTSTOPTRADEDATE"`             // 最新暂停交易日
+	LASTTRIGGERTRADEDATE    string  `json:"lasttriggertradedate"  xorm:"LASTTRIGGERTRADEDATE"`       // 最新触发交易日
+	NEXTTRIGGERDATE         string  `json:"nexttriggerdate"  xorm:"NEXTTRIGGERDATE"`                 // 下次触发日期
+	NEXTTRIGGERQTY          float64 `json:"nexttriggerqty"  xorm:"NEXTTRIGGERQTY"`                   // 下次触发数量 [按小数位放大值]
+	NEXTTRIGGERAMOUNT       float64 `json:"nexttriggeramount"  xorm:"NEXTTRIGGERAMOUNT"`             // 下次触发金额
+	UPDATORID               string  `json:"updatorid"  xorm:"UPDATORID"`                             // 更新人
+	UPDATESRC               int32   `json:"updatesrc"  xorm:"UPDATESRC"`                             // 更新来源 - 1:管理端 2:终端
+	UPDATETIME              string  `json:"updatetime"  xorm:"UPDATETIME"`                           // 更新时间
+	REGULARLYSTRATEGYID     int64   `json:"regularlystrategyid"  xorm:"REGULARLYSTRATEGYID"`         // 定投策略ID (SEQ_QHJ_REGULARLYSTRATEGY)
+	USERID                  int64   `json:"userid"  xorm:"USERID"`                                   // 所属用户ID
+	ACCOUNTID               int64   `json:"accountid"  xorm:"ACCOUNTID"`                             // 用户资金账户
+	GOODSID                 string  `json:"goodsid"  xorm:"GOODSID"`                                 // 定投商品ID
+	GOODSCODE               string  `json:"goodscode"  xorm:"'GOODSCODE'"`                           // 定投商品代码
+	GOODSNAME               string  `json:"goodsname"  xorm:"'GOODSNAME'"`                           // 定投商品名称
+	GOODUNITID              int32   `json:"goodunitid"  xorm:"'GOODUNITID'"`                         // 定投商品单位id
+	CURRENCYID              int32   `json:"currencyid"  xorm:"'CURRENCYID'"`                         // 币种id
+
+	USERNAME     string `json:"username"`     // 用户名称(userid对应的名称)
+	ACCOUNTNAME  string `json:"accountname"`  // 账号名称(ACCOUNTID对应的名称)
+	ENUMDICNAME  string `json:"enumdicname"`  // 单位名称
+	CURRENCYNAME string `json:"currencyname"` // 币种名称
+
+	FilterStatus string `json:"-"` // 状态过滤条件
+}
+
+func (r *QhjRStrategy) calc() {
+	r.USERNAME = mtpcache.GetUserNameByUserId(r.USERID)
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODUNITID)
+	r.CURRENCYNAME = mtpcache.GetCurrencyName(r.CURRENCYID)
+}
+
+func (r *QhjRStrategy) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.REGULARLYCYCLE," +
+		"       t.REGULARLYCYCLEVALUE," +
+		"       t.REGULARLYMODE," +
+		"       t.REGULARLYMODEVALUE," +
+		"       t.REMARK," +
+		"       t.REGULARLYSTRATEGYSTATUS," +
+		"       t.TRIGGERTOTALTIMES," +
+		"       t.TRIGGERSUCCESSTIMES," +
+		"       t.TRIGGERTOTALQTY," +
+		"       t.TRIGGERTOTALAMOUNT," +
+		"       t.LASTEFFECTTRADEDATE," +
+		"       t.LASTSTOPTRADEDATE," +
+		"       t.LASTTRIGGERTRADEDATE," +
+		"       to_char(t.NEXTTRIGGERDATE, 'yyyy-mm-dd hh24:mi:ss') NEXTTRIGGERDATE," +
+		"       t.NEXTTRIGGERQTY," +
+		"       t.NEXTTRIGGERAMOUNT," +
+		"       t.UPDATORID," +
+		"       t.UPDATESRC," +
+		"       to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
+		"       t.REGULARLYSTRATEGYID," +
+		"       t.USERID," +
+		"       t.ACCOUNTID," +
+		"       t.GOODSID," +
+		"       g.goodscode," +
+		"       g.goodsname," +
+		"       g.goodunitid," +
+		"       ta.accountname" +
+		"  FROM QHJ_REGULARLYSTRATEGY t" +
+		"  LEFT JOIN GOODS g on t.goodsid=g.goodsid" +
+		"  LEFT JOIN TAACCOUNT ta on t.accountid=ta.accountid" +
+		" WHERE 1 = 1"
+	sqlId.And("t.USERID", r.USERID)
+	sqlId.JoinEx(len(r.FilterStatus) > 0, fmt.Sprintf(" and t.REGULARLYSTRATEGYSTATUS in(%v)", r.FilterStatus))
+	return sqlId.String()
+}
+
+// GetDataEx 获取定投规则策略
+func (r *QhjRStrategy) GetDataEx() (interface{}, error) {
+	sData := make([]QhjRStrategy, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}
+
+// QhjRSTriggerLog 定投规则策略触发记录
+type QhjRSTriggerLog struct {
+	TRADEID             string  `json:"tradeid"  xorm:"TRADEID"`                         // 成交单ID
+	LOGID               string  `json:"logid"  xorm:"LOGID"`                             // LogID(SEQ_QHJ_RSTRIGGERLOG)
+	REGULARLYSTRATEGYID int64   `json:"regularlystrategyid"  xorm:"REGULARLYSTRATEGYID"` // 定投策略ID
+	USERID              int64   `json:"userid"  xorm:"USERID"`                           // 所属用户ID
+	ACCOUNTID           int64   `json:"accountid"  xorm:"ACCOUNTID"`                     // 用户资金账户
+	GOODSID             string  `json:"goodsid"  xorm:"GOODSID"`                         // 定投商品ID
+	REGULARLYCYCLE      int32   `json:"regularlycycle"  xorm:"REGULARLYCYCLE"`           // 定投频率 - 1:每周 2:每月
+	REGULARLYCYCLEVALUE string  `json:"regularlycyclevalue"  xorm:"REGULARLYCYCLEVALUE"` // 定投频率值 - 每周几(0-6)  或 每月几号(<=28)
+	REGULARLYMODE       int32   `json:"regularlymode"  xorm:"REGULARLYMODE"`             // 定投方式 - 1:按数量 2:按金额
+	REGULARLYMODEVALUE  float64 `json:"regularlymodevalue"  xorm:"REGULARLYMODEVALUE"`   // 定投方式值 - 数量或金额
+	TRIGGERTIME         string  `json:"triggertime"  xorm:"TRIGGERTIME"`                 // 触发时间
+	TRIGGERTRADEDATE    string  `json:"triggertradedate"  xorm:"TRIGGERTRADEDATE"`       // 触发交易日
+	TRIGGERQTY          float64 `json:"triggerqty"  xorm:"TRIGGERQTY"`                   // 触发数量
+	TRIGGERAMOUNT       float64 `json:"triggeramount"  xorm:"TRIGGERAMOUNT"`             // 触发金额
+	TRIGGERSTATUS       int32   `json:"triggerstatus"  xorm:"TRIGGERSTATUS"`             // 触发状态 - 1:成功 2:失败
+	RETCODE             string  `json:"retcode"  xorm:"RETCODE"`                         // 错误码
+	GOODSCODE           string  `json:"goodscode"  xorm:"'GOODSCODE'"`                   // 定投商品代码
+	GOODSNAME           string  `json:"goodsname"  xorm:"'GOODSNAME'"`                   // 定投商品名称
+	GOODUNITID          int32   `json:"goodunitid"  xorm:"'GOODUNITID'"`                 // 定投商品单位id
+	CURRENCYID          int32   `json:"currencyid"  xorm:"'CURRENCYID'"`                 // 币种id
+
+	USERNAME     string `json:"username"`     // 用户名称(userid对应的名称)
+	ACCOUNTNAME  string `json:"accountname"`  // 账号名称(ACCOUNTID对应的名称)
+	ENUMDICNAME  string `json:"enumdicname"`  // 单位名称
+	CURRENCYNAME string `json:"currencyname"` // 币种名称
+}
+
+func (r *QhjRSTriggerLog) calc() {
+	r.USERNAME = mtpcache.GetUserNameByUserId(r.USERID)
+	r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.GOODUNITID)
+	r.CURRENCYNAME = mtpcache.GetCurrencyName(r.CURRENCYID)
+}
+
+func (r *QhjRSTriggerLog) buildSql() string {
+	var sqlId utils.SQLVal = "SELECT t.TRADEID," +
+		"        t.LOGID," +
+		"        t.REGULARLYSTRATEGYID," +
+		"        t.USERID," +
+		"        t.ACCOUNTID," +
+		"        t.GOODSID," +
+		"        t.REGULARLYCYCLE," +
+		"        t.REGULARLYCYCLEVALUE," +
+		"        t.REGULARLYMODE," +
+		"        t.REGULARLYMODEVALUE," +
+		"        to_char(t.TRIGGERTIME, 'yyyy-mm-dd hh24:mi:ss') TRIGGERTIME," +
+		"        t.TRIGGERTRADEDATE," +
+		"        t.TRIGGERQTY," +
+		"        t.TRIGGERAMOUNT," +
+		"        t.TRIGGERSTATUS," +
+		"        t.RETCODE," +
+		"        g.goodscode," +
+		"        g.goodsname," +
+		"        g.goodunitid," +
+		"        ta.accountname," +
+		"        ta.currencyid" +
+		"   FROM QHJ_RSTRIGGERLOG t" +
+		"   LEFT JOIN GOODS g" +
+		"     on t.goodsid = g.goodsid" +
+		"   LEFT JOIN TAACCOUNT ta" +
+		"     on t.accountid = ta.accountid" +
+		"  WHERE 1 = 1"
+	sqlId.And("t.USERID", r.USERID)
+	sqlId.AndEx("t.REGULARLYSTRATEGYID", r.REGULARLYSTRATEGYID, r.REGULARLYSTRATEGYID > 0)
+	return sqlId.String()
+}
+
+// GetDataEx 获取定投规则策略触发记录
+func (r *QhjRSTriggerLog) GetDataEx() (interface{}, error) {
+	sData := make([]QhjRSTriggerLog, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 2 - 0
routers/router.go

@@ -450,6 +450,8 @@ func InitRouter() *gin.Engine {
 	{
 		qhjR.GET("QueryContract", qhj.QueryContract)
 		qhjR.GET("QueryContractLog", qhj.QueryContractLog)
+		qhjR.GET("QueryRStrategy", qhj.QueryRStrategy)
+		qhjR.GET("QueryRSTriggerLog", qhj.QueryRSTriggerLog)
 	}
 
 	return r