Bläddra i källkod

增加接口:
1、查询我的订单-转让/受让订单;
2、查询我的订单-转让/受让订单-详情

zhou.xiaoning 3 år sedan
förälder
incheckning
865ea96e7c
6 ändrade filer med 393 tillägg och 14 borttagningar
  1. 27 11
      controllers/ferroalloy/trade.go
  2. 111 1
      docs/docs.go
  3. 111 1
      docs/swagger.json
  4. 77 1
      docs/swagger.yaml
  5. 66 0
      models/ferroalloy.go
  6. 1 0
      routers/router.go

+ 27 - 11
controllers/ferroalloy/trade.go

@@ -11,10 +11,10 @@ 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
 // @Router   /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
@@ -30,12 +30,12 @@ func QueryTHJPurchaseTradeDetail(c *gin.Context) {
 // @Summary  获取我的推广-交易数据
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid       query    int true  "用户ID"
+// @Param    userid   query    int    true  "用户ID"
 // @Param    marketid query    int true  "市场ID 采购-64201 供求-65201"
-// @Param    page         query    int false "页码"
-// @Param    pagesize     query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200      {array}  models.THJTradeData
-// @Failure  500          {object} app.Response
+// @Failure  500             {object} app.Response
 // @Router   /Ferroalloy/QueryTHJTradeData [get]
 // @Tags     铁合金
 func QueryTHJTradeData(c *gin.Context) {
@@ -49,12 +49,12 @@ func QueryTHJTradeData(c *gin.Context) {
 // @Summary  查询我的订单-转让/受让订单
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid   query    int    true  "用户ID"
+// @Param    userid    query    int true  "用户ID"
 // @Param    ordertype query    int true  "类型 - 1:转让 2:受让"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page      query    int false "页码"
+// @Param    pagesize  query    int false "每页条数"
 // @Success  200       {array}  models.Thjpurchasetransfer
-// @Failure  500      {object} app.Response
+// @Failure  500          {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPurchaseTransferOrder [get]
 // @Tags     铁合金
 func QueryTHJPurchaseTransferOrder(c *gin.Context) {
@@ -64,6 +64,22 @@ func QueryTHJPurchaseTransferOrder(c *gin.Context) {
 	a.DoGetDataByPage(&m)
 }
 
+// QueryTHJPurchaseTransferOrderDetail
+// @Summary  查询我的订单-转让/受让订单-详情
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrtradedetailid query    string true "采购成交单ID"
+// @Success  200             {array}  models.ThjpurchasetransferDetail
+// @Failure  500      {object} app.Response
+// @Router   /Ferroalloy/QueryTHJPurchaseTransferOrderDetail [get]
+// @Tags     铁合金
+func QueryTHJPurchaseTransferOrderDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.ThjpurchasetransferDetail{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}
+
 // QueryTHJPromotionIncome
 // @Summary  查询我的推广-推广收益
 // @Produce  json

+ 111 - 1
docs/docs.go

@@ -8084,7 +8084,7 @@ const docTemplate = `{
                 "tags": [
                     "铁合金"
                 ],
-                "summary": "查询我的订单-转让订单",
+                "summary": "查询我的订单-转让/受让订单",
                 "parameters": [
                     {
                         "type": "integer",
@@ -8095,6 +8095,13 @@ const docTemplate = `{
                     },
                     {
                         "type": "integer",
+                        "description": "类型 - 1:转让 2:受让",
+                        "name": "ordertype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"
@@ -8125,6 +8132,48 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTransferOrderDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的订单-转让/受让订单-详情",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "采购成交单ID",
+                        "name": "wrtradedetailid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ThjpurchasetransferDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJScoreConfig": {
             "get": {
                 "security": [
@@ -41436,6 +41485,67 @@ const docTemplate = `{
                 }
             }
         },
+        "models.ThjpurchasetransferDetail": {
+            "type": "object",
+            "properties": {
+                "buyusername": {
+                    "description": "受让人",
+                    "type": "string"
+                },
+                "contractaddrbuy": {
+                    "description": "贸易合同地址(买家)",
+                    "type": "string"
+                },
+                "contractaddrsell": {
+                    "description": "贸易合同地址(卖家)",
+                    "type": "string"
+                },
+                "payeddeposit": {
+                    "description": "买方已付定金",
+                    "type": "number"
+                },
+                "sellusername": {
+                    "description": "转让人",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "预售价格",
+                    "type": "number"
+                },
+                "transferamount": {
+                    "description": "转让金额",
+                    "type": "number"
+                },
+                "transferid": {
+                    "description": "转让单号",
+                    "type": "integer"
+                },
+                "transferprice": {
+                    "description": "转让价格",
+                    "type": "number"
+                },
+                "transferstatus": {
+                    "description": "转让状态 - 1:挂牌中 2:已撤销 3:处理中 4:已转让",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Thjscoreconfig": {
             "type": "object",
             "properties": {

+ 111 - 1
docs/swagger.json

@@ -8075,7 +8075,7 @@
                 "tags": [
                     "铁合金"
                 ],
-                "summary": "查询我的订单-转让订单",
+                "summary": "查询我的订单-转让/受让订单",
                 "parameters": [
                     {
                         "type": "integer",
@@ -8086,6 +8086,13 @@
                     },
                     {
                         "type": "integer",
+                        "description": "类型 - 1:转让 2:受让",
+                        "name": "ordertype",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"
@@ -8116,6 +8123,48 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTransferOrderDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的订单-转让/受让订单-详情",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "采购成交单ID",
+                        "name": "wrtradedetailid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.ThjpurchasetransferDetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJScoreConfig": {
             "get": {
                 "security": [
@@ -41427,6 +41476,67 @@
                 }
             }
         },
+        "models.ThjpurchasetransferDetail": {
+            "type": "object",
+            "properties": {
+                "buyusername": {
+                    "description": "受让人",
+                    "type": "string"
+                },
+                "contractaddrbuy": {
+                    "description": "贸易合同地址(买家)",
+                    "type": "string"
+                },
+                "contractaddrsell": {
+                    "description": "贸易合同地址(卖家)",
+                    "type": "string"
+                },
+                "payeddeposit": {
+                    "description": "买方已付定金",
+                    "type": "number"
+                },
+                "sellusername": {
+                    "description": "转让人",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "预售价格",
+                    "type": "number"
+                },
+                "transferamount": {
+                    "description": "转让金额",
+                    "type": "number"
+                },
+                "transferid": {
+                    "description": "转让单号",
+                    "type": "integer"
+                },
+                "transferprice": {
+                    "description": "转让价格",
+                    "type": "number"
+                },
+                "transferstatus": {
+                    "description": "转让状态 - 1:挂牌中 2:已撤销 3:处理中 4:已转让",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Thjscoreconfig": {
             "type": "object",
             "properties": {

+ 77 - 1
docs/swagger.yaml

@@ -17575,6 +17575,51 @@ definitions:
         description: 采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)
         type: integer
     type: object
+  models.ThjpurchasetransferDetail:
+    properties:
+      buyusername:
+        description: 受让人
+        type: string
+      contractaddrbuy:
+        description: 贸易合同地址(买家)
+        type: string
+      contractaddrsell:
+        description: 贸易合同地址(卖家)
+        type: string
+      payeddeposit:
+        description: 买方已付定金
+        type: number
+      sellusername:
+        description: 转让人
+        type: string
+      tradeprice:
+        description: 预售价格
+        type: number
+      transferamount:
+        description: 转让金额
+        type: number
+      transferid:
+        description: 转让单号
+        type: integer
+      transferprice:
+        description: 转让价格
+        type: number
+      transferstatus:
+        description: 转让状态 - 1:挂牌中 2:已撤销 3:处理中 4:已转让
+        type: integer
+      warehousename:
+        description: 仓库名称
+        type: string
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 现货商品名称
+        type: string
+    type: object
   models.Thjscoreconfig:
     properties:
       parma1:
@@ -29212,6 +29257,11 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 类型 - 1:转让 2:受让
+        in: query
+        name: ordertype
+        required: true
+        type: integer
       - description: 页码
         in: query
         name: page
@@ -29235,7 +29285,33 @@ paths:
             $ref: '#/definitions/app.Response'
       security:
       - ApiKeyAuth: []
-      summary: 查询我的订单-转让订单
+      summary: 查询我的订单-转让/受让订单
+      tags:
+      - 铁合金
+  /Ferroalloy/QueryTHJPurchaseTransferOrderDetail:
+    get:
+      parameters:
+      - description: 采购成交单ID
+        in: query
+        name: wrtradedetailid
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.ThjpurchasetransferDetail'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询我的订单-转让/受让订单-详情
       tags:
       - 铁合金
   /Ferroalloy/QueryTHJScoreConfig:

+ 66 - 0
models/ferroalloy.go

@@ -1297,6 +1297,72 @@ func (r *Thjpurchasetransfer) GetDataByPage() (interface{}, error, int, int, int
 	return sData, err, r.Page, r.PageSize, total
 }
 
+type ThjpurchasetransferDetail struct {
+	WRTRADEDETAILID  int64   `json:"-" xorm:"WRTRADEDETAILID" form:"wrtradedetailid"` // 采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)
+	TRANSFERID       int64   `json:"transferid" xorm:"TRANSFERID"`                    // 转让单号
+	WRSTANDARDID     int32   `json:"wrstandardid" xorm:"WRSTANDARDID"`                // 现货商品ID
+	TRANSFERPRICE    float64 `json:"transferprice" xorm:"TRANSFERPRICE"`              // 转让价格
+	TRANSFERAMOUNT   float64 `json:"transferamount" xorm:"TRANSFERAMOUNT"`            // 转让金额
+	TRANSFERSTATUS   int32   `json:"transferstatus" xorm:"TRANSFERSTATUS"`            // 转让状态 - 1:挂牌中 2:已撤销 3:处理中 4:已转让
+	TRADEPRICE       float64 `json:"tradeprice" xorm:"TRADEPRICE"`                    // 预售价格
+	PAYEDDEPOSIT     float64 `json:"payeddeposit" xorm:"PAYEDDEPOSIT"`                // 买方已付定金
+	CONTRACTADDRBUY  string  `json:"contractaddrbuy" xorm:"CONTRACTADDRBUY"`          // 贸易合同地址(买家)
+	CONTRACTADDRSELL string  `json:"contractaddrsell" xorm:"CONTRACTADDRSELL"`        // 贸易合同地址(卖家)
+	WRSTANDARDCODE   string  `json:"wrstandardcode" xorm:"WRSTANDARDCODE"`            // 现货商品代码
+	WRSTANDARDNAME   string  `json:"wrstandardname" xorm:"WRSTANDARDNAME"`            // 现货商品名称
+	WAREHOUSENAME    string  `json:"warehousename" xorm:"WAREHOUSENAME"`              // 仓库名称
+	BUYUSERNAME      string  `json:"buyusername" xorm:"BUYUSERNAME"`                  // 受让人
+	SELLUSERNAME     string  `json:"sellusername" xorm:"SELLUSERNAME"`                // 转让人
+}
+
+func (r *ThjpurchasetransferDetail) calc() {
+
+}
+
+func (r *ThjpurchasetransferDetail) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.TRANSFERID,
+		t.WRSTANDARDID,
+		t.TRANSFERPRICE,
+		t.TRANSFERAMOUNT,
+		t.TRANSFERSTATUS,
+		d.TRADEPRICE,
+		d.PAYEDDEPOSIT,
+		d.CONTRACTADDRBUY,
+		d.CONTRACTADDRSELL,
+		wr.WRSTANDARDCODE,
+		wr.WRSTANDARDNAME,
+		wh.WAREHOUSENAME,
+		u1.accountname BUYUSERNAME,
+		u2.accountname SELLUSERNAME
+	from THJ_PurchaseTransfer t 
+	inner join THJ_PurchaseTradeDetail d on d.WRTRADEDETAILID = t.WRTRADEDETAILID 
+	left join wrstandard wr on wr.wrstandardid = t.wrtradedetailid
+	left join WAREHOUSEINFO wh on wh.autoid = t.warehouseid
+	left join useraccount u1 on u1.userid = t.buyuserid
+	left join useraccount u2 on u2.userid = t.selluserid
+	where t.WRTRADEDETAILID = %v
+	`
+	sqlId.FormatParam(r.WRTRADEDETAILID)
+
+	return sqlId.String()
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *ThjpurchasetransferDetail) GetDataEx() (interface{}, error) {
+	e := db.GetEngine()
+	s := e.SQL(r.buildSql())
+	sData := make([]ThjpurchasetransferDetail, 0)
+	if err := s.Find(&sData); err != nil {
+		return nil, err
+	}
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, nil
+}
+
 type PromotionIncome struct {
 	PROFITMONTH    string  `json:"profitmonth" xorm:"PROFITMONTH"`                       // 时间
 	WRSTANDARDID   int32   `json:"wrstandardid" xorm:"WRSTANDARDID"`                     // 现货商品ID

+ 1 - 0
routers/router.go

@@ -707,6 +707,7 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTransferOrder", ferroalloy.QueryTHJPurchaseTransferOrder)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJPromotionIncome", ferroalloy.QueryTHJPromotionIncome)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJPromotionIncomeDetail", ferroalloy.QueryTHJPromotionIncomeDetail)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTransferOrderDetail", ferroalloy.QueryTHJPurchaseTransferOrderDetail)
 	}
 
 	return r