瀏覽代碼

增加接口
/Ferroalloy/QueryMyDeposit 查询本人定金比例
/Ferroalloy/QueryTHJInvesotrDepositLog 定金比例个性化查询

zhou.xiaoning 2 年之前
父節點
當前提交
483c17ab93
共有 9 個文件被更改,包括 581 次插入9 次删除
  1. 26 0
      controllers/ferroalloy/mine.go
  2. 23 5
      controllers/ferroalloy/trade.go
  3. 4 4
      controllers/guangzuan/tradeService.go
  4. 166 0
      docs/docs.go
  5. 166 0
      docs/swagger.json
  6. 111 0
      docs/swagger.yaml
  7. 64 0
      models/ferroalloy.go
  8. 19 0
      models/ori.go
  9. 2 0
      routers/router.go

+ 26 - 0
controllers/ferroalloy/mine.go

@@ -124,3 +124,29 @@ func QueryTHJProfits(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryMyDeposit
+// @Summary  查询本人定金比例
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    userid query    int true "用户ID"
+// @Success  200    {array}  models.Thjinvesotrdeposit
+// @Failure  500    {object} app.Response
+// @Router   /Ferroalloy/QueryMyDeposit [get]
+// @Tags     铁合金
+func QueryMyDeposit(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.QueryMyDepositReq{}
+	if err := a.C.ShouldBind(&m); err != nil {
+		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	var r models.Thjinvesotrdeposit
+	if rsp, err := r.GetAll(m); err == nil {
+		a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
+	} else {
+		logger.GetLogger().Errorf("query fail, %v", err)
+		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+	}
+}

+ 23 - 5
controllers/ferroalloy/trade.go

@@ -11,12 +11,12 @@ import (
 // @Summary  查询我的订单-采购订单
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid       query    int true  "用户ID"
+// @Param    userid   query    int true  "用户ID"
 // @Param    type     query    int false "类型 - 0:未完成 1:已完成"
-// @Param    page         query    int false "页码"
-// @Param    pagesize     query    int false "每页条数"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
 // @Success  200      {array}  models.Thjpurchasetradedetail
-// @Failure  500        {object} app.Response
+// @Failure  500          {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
 // @Tags     铁合金
 func QueryTHJPurchaseTradeDetail(c *gin.Context) {
@@ -70,7 +70,7 @@ func QueryTHJPurchaseTransferOrder(c *gin.Context) {
 // @Security ApiKeyAuth
 // @Param    transferid query    string true "转让单号"
 // @Success  200        {array}  models.ThjpurchasetransferDetail
-// @Failure  500          {object} app.Response
+// @Failure  500        {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPurchaseTransferOrderDetail [get]
 // @Tags     铁合金
 func QueryTHJPurchaseTransferOrderDetail(c *gin.Context) {
@@ -136,3 +136,21 @@ func QueryTHJinvesotrdeposit(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryTHJInvesotrDepositLog
+// @Summary  定金比例个性化查询
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    userid       query    int true  "用户ID"
+// @Param    page         query    int false "页码"
+// @Param    pagesize     query    int false "每页条数"
+// @Success  200      {array}  models.GThjinvesotrdepositlog
+// @Failure  500      {object} app.Response
+// @Router   /Ferroalloy/QueryTHJInvesotrDepositLog [get]
+// @Tags     铁合金
+func QueryTHJInvesotrDepositLog(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.GThjinvesotrdepositlog{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 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]

+ 166 - 0
docs/docs.go

@@ -7630,6 +7630,48 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryMyDeposit": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询本人定金比例",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Thjinvesotrdeposit"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryMyRefer": {
             "get": {
                 "security": [
@@ -7882,6 +7924,60 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJInvesotrDepositLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "定金比例个性化查询",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.GThjinvesotrdepositlog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJListing": {
             "get": {
                 "security": [
@@ -32755,6 +32851,59 @@ const docTemplate = `{
                 }
             }
         },
+        "models.GThjinvesotrdepositlog": {
+            "type": "object",
+            "required": [
+                "depositrate",
+                "userid"
+            ],
+            "properties": {
+                "accountname": {
+                    "description": "用户名",
+                    "type": "string"
+                },
+                "buyuserid": {
+                    "description": "采购用户ID",
+                    "type": "integer"
+                },
+                "changeqty": {
+                    "description": "变更量",
+                    "type": "integer"
+                },
+                "curdepositqty": {
+                    "description": "可用量(变更后)",
+                    "type": "string"
+                },
+                "depositrate": {
+                    "description": "定金比例(选中比例)",
+                    "type": "number"
+                },
+                "logid": {
+                    "description": "流水ID(336+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "oridepositqty": {
+                    "description": "可用量(变更前)",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "integer"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "wrtradedetailid": {
+                    "description": "采购成交单ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.GThjuserscorelog": {
             "type": "object",
             "properties": {
@@ -45189,6 +45338,23 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Thjinvesotrdeposit": {
+            "type": "object",
+            "properties": {
+                "depositqty": {
+                    "description": "可用量",
+                    "type": "integer"
+                },
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Thjinvestorlevelgroup": {
             "type": "object",
             "properties": {

+ 166 - 0
docs/swagger.json

@@ -7621,6 +7621,48 @@
                 }
             }
         },
+        "/Ferroalloy/QueryMyDeposit": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询本人定金比例",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Thjinvesotrdeposit"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryMyRefer": {
             "get": {
                 "security": [
@@ -7873,6 +7915,60 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJInvesotrDepositLog": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "定金比例个性化查询",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.GThjinvesotrdepositlog"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJListing": {
             "get": {
                 "security": [
@@ -32746,6 +32842,59 @@
                 }
             }
         },
+        "models.GThjinvesotrdepositlog": {
+            "type": "object",
+            "required": [
+                "depositrate",
+                "userid"
+            ],
+            "properties": {
+                "accountname": {
+                    "description": "用户名",
+                    "type": "string"
+                },
+                "buyuserid": {
+                    "description": "采购用户ID",
+                    "type": "integer"
+                },
+                "changeqty": {
+                    "description": "变更量",
+                    "type": "integer"
+                },
+                "curdepositqty": {
+                    "description": "可用量(变更后)",
+                    "type": "string"
+                },
+                "depositrate": {
+                    "description": "定金比例(选中比例)",
+                    "type": "number"
+                },
+                "logid": {
+                    "description": "流水ID(336+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "string"
+                },
+                "oridepositqty": {
+                    "description": "可用量(变更前)",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "updatorid": {
+                    "description": "更新人",
+                    "type": "integer"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                },
+                "wrtradedetailid": {
+                    "description": "采购成交单ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.GThjuserscorelog": {
             "type": "object",
             "properties": {
@@ -45180,6 +45329,23 @@
                 }
             }
         },
+        "models.Thjinvesotrdeposit": {
+            "type": "object",
+            "properties": {
+                "depositqty": {
+                    "description": "可用量",
+                    "type": "integer"
+                },
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Thjinvestorlevelgroup": {
             "type": "object",
             "properties": {

+ 111 - 0
docs/swagger.yaml

@@ -9848,6 +9848,45 @@ definitions:
     required:
     - userid
     type: object
+  models.GThjinvesotrdepositlog:
+    properties:
+      accountname:
+        description: 用户名
+        type: string
+      buyuserid:
+        description: 采购用户ID
+        type: integer
+      changeqty:
+        description: 变更量
+        type: integer
+      curdepositqty:
+        description: 可用量(变更后)
+        type: string
+      depositrate:
+        description: 定金比例(选中比例)
+        type: number
+      logid:
+        description: 流水ID(336+Unix秒时间戳(10位)+xxxxxx)
+        type: string
+      oridepositqty:
+        description: 可用量(变更前)
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+      updatorid:
+        description: 更新人
+        type: integer
+      userid:
+        description: 用户ID
+        type: integer
+      wrtradedetailid:
+        description: 采购成交单ID
+        type: integer
+    required:
+    - depositrate
+    - userid
+    type: object
   models.GThjuserscorelog:
     properties:
       createtime:
@@ -19073,6 +19112,18 @@ definitions:
     required:
     - autoid
     type: object
+  models.Thjinvesotrdeposit:
+    properties:
+      depositqty:
+        description: 可用量
+        type: integer
+      depositrate:
+        description: 定金比例
+        type: number
+      userid:
+        description: 用户ID
+        type: integer
+    type: object
   models.Thjinvestorlevelgroup:
     properties:
       grouplevel:
@@ -30898,6 +30949,32 @@ paths:
       summary: 查询查询我推荐的好友等级
       tags:
       - 铁合金
+  /Ferroalloy/QueryMyDeposit:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Thjinvesotrdeposit'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询本人定金比例
+      tags:
+      - 铁合金
   /Ferroalloy/QueryMyRefer:
     get:
       parameters:
@@ -31057,6 +31134,40 @@ paths:
       summary: 查询商品详情
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJInvesotrDepositLog:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.GThjinvesotrdepositlog'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 定金比例个性化查询
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJListing:
     get:
       parameters:

+ 64 - 0
models/ferroalloy.go

@@ -2082,3 +2082,67 @@ func (r *GThjinvesotrdeposit) GetDataByPage() (interface{}, error, int, int, int
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+type QueryMyDepositReq struct {
+	UserId int64 `form:"userId" binding:"required"` // 用户ID
+}
+
+func (r *Thjinvesotrdeposit) GetAll(req QueryMyDepositReq) (rsp []Thjinvesotrdeposit, err error) {
+	rsp = make([]Thjinvesotrdeposit, 0)
+	err = db.GetEngine().Where("userid = ?", req.UserId).Find(&rsp)
+
+	return
+}
+
+// 比例变更流水
+type GThjinvesotrdepositlog struct {
+	LOGID           string  `json:"logid" xorm:"LOGID"`                                                   // 流水ID(336+Unix秒时间戳(10位)+xxxxxx)
+	USERID          int64   `json:"userid" xorm:"USERID" form:"userid" binding:"required"`                // 用户ID
+	DEPOSITRATE     float64 `json:"depositrate" xorm:"DEPOSITRATE" form:"depositrate" binding:"required"` // 定金比例(选中比例)
+	ORIDEPOSITQTY   int64   `json:"oridepositqty" xorm:"ORIDEPOSITQTY"`                                   // 可用量(变更前)
+	CHANGEQTY       int64   `json:"changeqty" xorm:"CHANGEQTY"`                                           // 变更量
+	CURDEPOSITQTY   string  `json:"curdepositqty" xorm:"CURDEPOSITQTY"`                                   // 可用量(变更后)
+	BUYUSERID       int64   `json:"buyuserid" xorm:"BUYUSERID"`                                           // 采购用户ID
+	WRTRADEDETAILID int64   `json:"wrtradedetailid" xorm:"WRTRADEDETAILID"`                               // 采购成交单ID
+	UPDATORID       int64   `json:"updatorid" xorm:"UPDATORID"`                                           // 更新人
+	UPDATETIME      string  `json:"updatetime" xorm:"UPDATETIME"`                                         // 更新时间
+
+	Accountname string `json:"accountname" xorm:"ACCOUNTNAME"` // 用户名
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *GThjinvesotrdepositlog) calc() {
+
+}
+
+func (r *GThjinvesotrdepositlog) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.UPDATETIME,
+		t.ORIDEPOSITQTY, 
+		t.CHANGEQTY, 
+		t.CURDEPOSITQTY,
+		ua.ACCOUNTNAME, 
+		t.WRTRADEDETAILID 
+	from THJ_InvesotrDepositLog t
+	left join useraccount ua on t.buyuserid = ua.userid
+	where t.userid = %v and t.depositrate = %v 
+	order by t.logid desc
+	`
+	sqlId.FormatParam(r.USERID, r.DEPOSITRATE)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *GThjinvesotrdepositlog) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]GThjinvesotrdepositlog, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 19 - 0
models/ori.go

@@ -325,3 +325,22 @@ type Thjinvesotrdeposit struct {
 func (r *Thjinvesotrdeposit) TableName() string {
 	return "THJ_INVESOTRDEPOSIT"
 }
+
+// Thjinvesotrdepositlog 交易商定金比例流水表
+type Thjinvesotrdepositlog struct {
+	LOGID           int64     `json:"logid" xorm:"LOGID"`                     // 流水ID(336+Unix秒时间戳(10位)+xxxxxx)
+	USERID          int64     `json:"userid" xorm:"USERID"`                   // 用户ID
+	DEPOSITRATE     float64   `json:"depositrate" xorm:"DEPOSITRATE"`         // 定金比例
+	ORIDEPOSITQTY   int64     `json:"oridepositqty" xorm:"ORIDEPOSITQTY"`     // 可用量(变更前)
+	CHANGEQTY       int64     `json:"changeqty" xorm:"CHANGEQTY"`             // 变更量
+	CURDEPOSITQTY   string    `json:"curdepositqty" xorm:"CURDEPOSITQTY"`     // 可用量(变更后)
+	BUYUSERID       int64     `json:"buyuserid" xorm:"BUYUSERID"`             // 采购用户ID
+	WRTRADEDETAILID int64     `json:"wrtradedetailid" xorm:"WRTRADEDETAILID"` // 采购成交单ID
+	UPDATORID       int64     `json:"updatorid" xorm:"UPDATORID"`             // 更新人
+	UPDATETIME      time.Time `json:"updatetime" xorm:"UPDATETIME"`           // 更新时间
+}
+
+// TableName is THJ_INVESOTRDEPOSITLOG
+func (r *Thjinvesotrdepositlog) TableName() string {
+	return "THJ_INVESOTRDEPOSITLOG"
+}

+ 2 - 0
routers/router.go

@@ -720,6 +720,8 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJFriends", ferroalloy.QueryTHJFriends)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJProfits", ferroalloy.QueryTHJProfits)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJinvesotrdeposit", ferroalloy.QueryTHJinvesotrdeposit)
+		ferroalloyR.Use(token.Auth()).GET("QueryMyDeposit", ferroalloy.QueryMyDeposit)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJInvesotrDepositLog", ferroalloy.QueryTHJInvesotrDepositLog)
 	}
 
 	return r