Explorar o código

接口增加出参

zhouxnsz hai 11 meses
pai
achega
b07d0f505d

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

+ 2 - 2
controllers/sbyj/goods-inventory.go

@@ -19,7 +19,7 @@ type QueryUserGoodsInventoryReq struct {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    userId query    int true "用户ID"
-// @Success  200    {array}  models.Usergoodsinventory
+// @Success  200    {array}  models.UserGoodsInventoryRsp
 // @Failure  500    {object} app.Response
 // @Router   /sbyj/QueryUserGoodsInventory [get]
 // @Tags     订单系统
@@ -56,7 +56,7 @@ type QueryUserGoodsInventoryLogReq struct {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    userId query    int true "用户ID"
-// @Success  200    {array}  models.Usergoodsinventorylog
+// @Success  200    {array}  models.UsergoodsinventorylogRsp
 // @Failure  500    {object} app.Response
 // @Router   /sbyj/QueryUserGoodsInventoryLog [get]
 // @Tags     订单系统

+ 4 - 4
controllers/sbyj/order.go

@@ -73,7 +73,7 @@ func QueryMyTradegoodsdeliveryoffline(c *gin.Context) {
 // @Param    page      query    int    false "页码"
 // @Param    pagesize  query    int    false "每页条数"
 // @Success  200             {array}  models.MyDeliveryofflinedetail
-// @Failure  500       {object} app.Response
+// @Failure  500    {object} app.Response
 // @Router   /sbyj/QueryMyDeliveryofflinedetail [get]
 // @Tags     订单系统
 func QueryMyDeliveryofflinedetail(c *gin.Context) {
@@ -94,7 +94,7 @@ func QueryMyDeliveryofflinedetail(c *gin.Context) {
 // @Param    page      query    int false "页码"
 // @Param    pagesize  query    int false "每页条数"
 // @Success  200             {array}  models.MyDeliveryofflineoperatelog
-// @Failure  500       {object} app.Response
+// @Failure  500    {object} app.Response
 // @Router   /sbyj/QueryMyDeliveryofflineoperatelog [get]
 // @Tags     订单系统
 func QueryMyDeliveryofflineoperatelog(c *gin.Context) {
@@ -116,7 +116,7 @@ func QueryMyDeliveryofflineoperatelog(c *gin.Context) {
 // @Param    page            query    int    false "页码"
 // @Param    pagesize        query    int    false "每页条数"
 // @Success  200       {array}  models.Tradeholderdetailex
-// @Failure  500    {object} app.Response
+// @Failure  500       {object} app.Response
 // @Router   /sbyj/QueryTradeHolderDetailEx [get]
 // @Tags     订单系统
 func QueryTradeHolderDetailEx(c *gin.Context) {
@@ -134,7 +134,7 @@ func QueryTradeHolderDetailEx(c *gin.Context) {
 // @Param    page            query    int    false "页码"
 // @Param    pagesize        query    int    false "每页条数"
 // @Success  200       {array}  models.TradeCloseDetail
-// @Failure  500    {object} app.Response
+// @Failure  500       {object} app.Response
 // @Router   /sbyj/QueryTradeCloseDetails [get]
 // @Tags     订单系统
 func QueryTradeCloseDetails(c *gin.Context) {

+ 56 - 24
docs/docs.go

@@ -23963,7 +23963,7 @@ const docTemplate = `{
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Usergoodsinventory"
+                                "$ref": "#/definitions/models.UserGoodsInventoryRsp"
                             }
                         }
                     },
@@ -24005,7 +24005,7 @@ const docTemplate = `{
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Usergoodsinventorylog"
+                                "$ref": "#/definitions/models.UsergoodsinventorylogRsp"
                             }
                         }
                     },
@@ -58551,6 +58551,43 @@ const docTemplate = `{
                 }
             }
         },
+        "models.UserGoodsInventoryRsp": {
+            "type": "object",
+            "properties": {
+                "curqty": {
+                    "description": "期末库存量",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.UserReceiveInfo": {
             "type": "object",
             "properties": {
@@ -58897,28 +58934,7 @@ const docTemplate = `{
                 }
             }
         },
-        "models.Usergoodsinventory": {
-            "type": "object",
-            "properties": {
-                "curqty": {
-                    "description": "期末库存量",
-                    "type": "number"
-                },
-                "goodsid": {
-                    "description": "商品ID",
-                    "type": "integer"
-                },
-                "updatetime": {
-                    "description": "更新时间",
-                    "type": "string"
-                },
-                "userid": {
-                    "description": "用户ID",
-                    "type": "integer"
-                }
-            }
-        },
-        "models.Usergoodsinventorylog": {
+        "models.UsergoodsinventorylogRsp": {
             "type": "object",
             "properties": {
                 "applyid": {
@@ -58949,10 +58965,26 @@ const docTemplate = `{
                     "description": "客户端流水号",
                     "type": "string"
                 },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "商品ID",
                     "type": "integer"
                 },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
                 "inoutmodel": {
                     "description": "出入库方式 - 1:邮寄 3:自提 4:配送(enum:appointmentModelOut)",
                     "type": "integer"

+ 56 - 24
docs/swagger.json

@@ -23954,7 +23954,7 @@
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Usergoodsinventory"
+                                "$ref": "#/definitions/models.UserGoodsInventoryRsp"
                             }
                         }
                     },
@@ -23996,7 +23996,7 @@
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Usergoodsinventorylog"
+                                "$ref": "#/definitions/models.UsergoodsinventorylogRsp"
                             }
                         }
                     },
@@ -58542,6 +58542,43 @@
                 }
             }
         },
+        "models.UserGoodsInventoryRsp": {
+            "type": "object",
+            "properties": {
+                "curqty": {
+                    "description": "期末库存量",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.UserReceiveInfo": {
             "type": "object",
             "properties": {
@@ -58888,28 +58925,7 @@
                 }
             }
         },
-        "models.Usergoodsinventory": {
-            "type": "object",
-            "properties": {
-                "curqty": {
-                    "description": "期末库存量",
-                    "type": "number"
-                },
-                "goodsid": {
-                    "description": "商品ID",
-                    "type": "integer"
-                },
-                "updatetime": {
-                    "description": "更新时间",
-                    "type": "string"
-                },
-                "userid": {
-                    "description": "用户ID",
-                    "type": "integer"
-                }
-            }
-        },
-        "models.Usergoodsinventorylog": {
+        "models.UsergoodsinventorylogRsp": {
             "type": "object",
             "properties": {
                 "applyid": {
@@ -58940,10 +58956,26 @@
                     "description": "客户端流水号",
                     "type": "string"
                 },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
                 "goodsid": {
                     "description": "商品ID",
                     "type": "integer"
                 },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "goodunit": {
+                    "description": "报价单位",
+                    "type": "string"
+                },
+                "goodunitid": {
+                    "description": "报价单位ID",
+                    "type": "integer"
+                },
                 "inoutmodel": {
                     "description": "出入库方式 - 1:邮寄 3:自提 4:配送(enum:appointmentModelOut)",
                     "type": "integer"

+ 42 - 18
docs/swagger.yaml

@@ -25602,6 +25602,33 @@ definitions:
         description: 收款人用户ID
         type: integer
     type: object
+  models.UserGoodsInventoryRsp:
+    properties:
+      curqty:
+        description: 期末库存量
+        type: number
+      goodscode:
+        description: 期货合约代码(内部)
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 期货合约名称
+        type: string
+      goodunit:
+        description: 报价单位
+        type: string
+      goodunitid:
+        description: 报价单位ID
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+      userid:
+        description: 用户ID
+        type: integer
+    type: object
   models.UserReceiveInfo:
     properties:
       address:
@@ -25857,22 +25884,7 @@ definitions:
     required:
     - goodsid
     type: object
-  models.Usergoodsinventory:
-    properties:
-      curqty:
-        description: 期末库存量
-        type: number
-      goodsid:
-        description: 商品ID
-        type: integer
-      updatetime:
-        description: 更新时间
-        type: string
-      userid:
-        description: 用户ID
-        type: integer
-    type: object
-  models.Usergoodsinventorylog:
+  models.UsergoodsinventorylogRsp:
     properties:
       applyid:
         description: 申请ID(SEQ_USERGOODSINVENTORYLOG)
@@ -25895,9 +25907,21 @@ definitions:
       clientticket:
         description: 客户端流水号
         type: string
+      goodscode:
+        description: 期货合约代码(内部)
+        type: string
       goodsid:
         description: 商品ID
         type: integer
+      goodsname:
+        description: 期货合约名称
+        type: string
+      goodunit:
+        description: 报价单位
+        type: string
+      goodunitid:
+        description: 报价单位ID
+        type: integer
       inoutmodel:
         description: 出入库方式 - 1:邮寄 3:自提 4:配送(enum:appointmentModelOut)
         type: integer
@@ -47145,7 +47169,7 @@ paths:
           description: OK
           schema:
             items:
-              $ref: '#/definitions/models.Usergoodsinventory'
+              $ref: '#/definitions/models.UserGoodsInventoryRsp'
             type: array
         "500":
           description: Internal Server Error
@@ -47171,7 +47195,7 @@ paths:
           description: OK
           schema:
             items:
-              $ref: '#/definitions/models.Usergoodsinventorylog'
+              $ref: '#/definitions/models.UsergoodsinventorylogRsp'
             type: array
         "500":
           description: Internal Server Error

+ 55 - 6
models/sbyj.go

@@ -860,16 +860,65 @@ func (r *UserTradeSetting) GetDataEx() (interface{}, error) {
 	return sData, err
 }
 
-func FindUserGoodsInventory(userId int) (datas []Usergoodsinventory, err error) {
-	datas = make([]Usergoodsinventory, 0)
-	err = db.GetEngine().Where("USERID = ?", userId).Find(&datas)
+type UserGoodsInventoryRsp struct {
+	USERID     int64     `json:"userid" xorm:"USERID"`         // 用户ID
+	GOODSID    int64     `json:"goodsid" xorm:"GOODSID"`       // 商品ID
+	CURQTY     float64   `json:"curqty" xorm:"CURQTY"`         // 期末库存量
+	UPDATETIME time.Time `json:"updatetime" xorm:"UPDATETIME"` // 更新时间
+
+	GOODSCODE  string `json:"goodscode" xorm:"GOODSCODE"`   // 期货合约代码(内部)
+	GOODSNAME  string `json:"goodsname" xorm:"GOODSNAME"`   // 期货合约名称
+	GOODUNITID int32  `json:"goodunitid" xorm:"GOODUNITID"` // 报价单位ID
+	Goodunit   string `json:"goodunit" xorm:"'GOODUNIT'"`   // 报价单位
+}
+
+func FindUserGoodsInventory(userId int) (datas []UserGoodsInventoryRsp, err error) {
+	datas = make([]UserGoodsInventoryRsp, 0)
+	err = db.GetEngine().
+		Table("USERGOODSINVENTORY T").
+		Join("LEFT", "GOODS G", "G.GOODSID = T.GOODSID").
+		Join("LEFT", "ENUMDICITEM E", "G.GOODUNITID = E.ENUMITEMNAME AND E.ENUMDICCODE = 'goodsunit'").
+		Select(`T.*, 
+				G.GOODSCODE, G.GOODSNAME, G.GOODUNITID, 
+				E.ENUMDICNAME GOODUNIT`).
+		Where("T.USERID = ?", userId).Find(&datas)
 
 	return
 }
 
-func FindUserGoodsInventoryLog(userId int) (datas []Usergoodsinventorylog, err error) {
-	datas = make([]Usergoodsinventorylog, 0)
-	err = db.GetEngine().Where("USERID = ?", userId).OrderBy("ApplyTime DESC").Find(&datas)
+type UsergoodsinventorylogRsp struct {
+	APPLYID      int64     `json:"applyid" xorm:"APPLYID"`           // 申请ID(SEQ_USERGOODSINVENTORYLOG)
+	INOUTTYPE    int32     `json:"inouttype" xorm:"INOUTTYPE"`       // 申请类型 - 1:入库 2:出库 (enum:inouttype)
+	USERID       int64     `json:"userid" xorm:"USERID"`             // 申请人ID
+	GOODSID      int64     `json:"goodsid" xorm:"GOODSID"`           // 商品ID
+	QTY          float64   `json:"qty" xorm:"QTY"`                   // 数量
+	INREALQTY    float64   `json:"inrealqty" xorm:"INREALQTY"`       // 实际数量
+	INOUTMODEL   int32     `json:"inoutmodel" xorm:"INOUTMODEL"`     // 出入库方式 - 1:邮寄 3:自提 4:配送(enum:appointmentModelOut)
+	REMARK       string    `json:"remark" xorm:"REMARK"`             // 备注
+	APPLYSTATUS  int32     `json:"applystatus" xorm:"APPLYSTATUS"`   // 申请状态(enum:inoutapplystatus) - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败
+	APPLYTIME    time.Time `json:"applytime" xorm:"APPLYTIME"`       // 申请时间
+	AUDITID      int64     `json:"auditid" xorm:"AUDITID"`           // 审核人
+	AUDITTIME    time.Time `json:"audittime" xorm:"AUDITTIME"`       // 审核时间
+	AUDITREMARK  string    `json:"auditremark" xorm:"AUDITREMARK"`   // 审核备注
+	TRADEDATE    string    `json:"tradedate" xorm:"TRADEDATE"`       // 交易日(yyyyMMdd)
+	CLIENTTICKET string    `json:"clientticket" xorm:"CLIENTTICKET"` // 客户端流水号
+
+	GOODSCODE  string `json:"goodscode" xorm:"GOODSCODE"`   // 期货合约代码(内部)
+	GOODSNAME  string `json:"goodsname" xorm:"GOODSNAME"`   // 期货合约名称
+	GOODUNITID int32  `json:"goodunitid" xorm:"GOODUNITID"` // 报价单位ID
+	Goodunit   string `json:"goodunit" xorm:"'GOODUNIT'"`   // 报价单位
+}
+
+func FindUserGoodsInventoryLog(userId int) (datas []UsergoodsinventorylogRsp, err error) {
+	datas = make([]UsergoodsinventorylogRsp, 0)
+	err = db.GetEngine().
+		Table("USERGOODSINVENTORYLOG T").
+		Join("LEFT", "GOODS G", "G.GOODSID = T.GOODSID").
+		Join("LEFT", "ENUMDICITEM E", "G.GOODUNITID = E.ENUMITEMNAME AND E.ENUMDICCODE = 'goodsunit'").
+		Select(`T.*, 
+				G.GOODSCODE, G.GOODSNAME, G.GOODUNITID, 
+				E.ENUMDICNAME GOODUNIT`).
+		Where("T.USERID = ?", userId).OrderBy("ApplyTime DESC").Find(&datas)
 
 	return
 }