Forráskód Böngészése

增加查询我的订单-采购订单接口

zhou.xiaoning 3 éve
szülő
commit
7075640b83
6 módosított fájl, 930 hozzáadás és 3 törlés
  1. 22 3
      controllers/ferroalloy/trade.go
  2. 252 0
      docs/docs.go
  3. 252 0
      docs/swagger.json
  4. 182 0
      docs/swagger.yaml
  5. 221 0
      models/ferroalloy.go
  6. 1 0
      routers/router.go

+ 22 - 3
controllers/ferroalloy/trade.go

@@ -15,10 +15,10 @@ import (
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    wrstandardname query    string false "现货商品名称(模糊查询)"
-// @Param    page           query    int    false "页码"
-// @Param    pagesize       query    int    false "每页条数"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
 // @Success  200            {array}  models.THJWrstandard
-// @Failure  500            {object} app.Response
+// @Failure  500      {object} app.Response
 // @Router   /Ferroalloy/QueryTHJWrstandard [get]
 // @Tags     铁合金
 func QueryTHJWrstandard(c *gin.Context) {
@@ -52,3 +52,22 @@ func QueryTHJWrstandardDetail(c *gin.Context) {
 		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// QueryTHJPurchaseTradeDetail
+// @Summary  查询我的订单-采购订单
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    userid   query    int true  "用户ID"
+// @Param    type     query    int false "类型 - 0:未完成 1:已完成"
+// @Param    page           query    int    false "页码"
+// @Param    pagesize       query    int    false "每页条数"
+// @Success  200      {array}  models.Thjpurchasetradedetail
+// @Failure  500            {object} app.Response
+// @Router   /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
+// @Tags     铁合金
+func QueryTHJPurchaseTradeDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Thjpurchasetradedetail{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 252 - 0
docs/docs.go

@@ -7687,6 +7687,66 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTradeDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的订单-采购订单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "类型 - 0:未完成 1:已完成",
+                        "name": "type",
+                        "in": "query"
+                    },
+                    {
+                        "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.Thjpurchasetradedetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJWrstandard": {
             "get": {
                 "security": [
@@ -40132,6 +40192,198 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Thjpurchasetradedetail": {
+            "type": "object",
+            "required": [
+                "buyuserid"
+            ],
+            "properties": {
+                "buyaccountid": {
+                    "description": "买方账号ID",
+                    "type": "integer"
+                },
+                "buychargevalue": {
+                    "description": "买方到期手续费",
+                    "type": "number"
+                },
+                "buyconfirmremark": {
+                    "description": "买方确认备注",
+                    "type": "string"
+                },
+                "buyconfirmtime": {
+                    "description": "买方确认时间",
+                    "type": "string"
+                },
+                "buyfreezecharge": {
+                    "description": "买方摘牌冻结手续费",
+                    "type": "number"
+                },
+                "buyuserid": {
+                    "description": "买方用户ID",
+                    "type": "integer"
+                },
+                "contactinfo": {
+                    "description": "联系方式",
+                    "type": "string"
+                },
+                "contactname": {
+                    "description": "联系人姓名",
+                    "type": "string"
+                },
+                "contractaddrbuy": {
+                    "description": "贸易合同地址(买家)",
+                    "type": "string"
+                },
+                "contractaddrsell": {
+                    "description": "贸易合同地址(卖家)",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "desaddress": {
+                    "description": "目的地地址",
+                    "type": "string"
+                },
+                "discountamount": {
+                    "description": "优惠总金额(优惠金额*TradeQty)",
+                    "type": "number"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "lastamount": {
+                    "description": "到期总货款 = 到期价格 * 摘牌数量",
+                    "type": "number"
+                },
+                "lastprice": {
+                    "description": "到期价格",
+                    "type": "number"
+                },
+                "lastpricedate": {
+                    "description": "到期价格日期 - 暂不使用",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "orderstatus": {
+                    "description": "单据状态 - 1:待付尾款 2:支付尾款成功 3:支付尾款失败 4:已违约 5:卖方已确认 6:买方已确认 7:系统自动确认 (枚举:THJOrderStatus)",
+                    "type": "integer"
+                },
+                "payeddeposit": {
+                    "description": "买方已付定金",
+                    "type": "number"
+                },
+                "payedtradedate": {
+                    "description": "支付尾款成功交易日",
+                    "type": "string"
+                },
+                "presaleapplyid": {
+                    "description": "预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "receiptinfo": {
+                    "description": "发票信息",
+                    "type": "string"
+                },
+                "remainamount": {
+                    "description": "剩余货款 = 到期总货款 - 已付定金 - 优惠金额",
+                    "type": "number"
+                },
+                "sellaccountid": {
+                    "description": "卖方账号ID",
+                    "type": "integer"
+                },
+                "sellchargevalue": {
+                    "description": "卖方到期手续费",
+                    "type": "number"
+                },
+                "sellconfirmattach": {
+                    "description": "卖方确认附件",
+                    "type": "string"
+                },
+                "sellconfirmremark": {
+                    "description": "卖方确认备注",
+                    "type": "string"
+                },
+                "sellconfirmtime": {
+                    "description": "卖方确认时间",
+                    "type": "string"
+                },
+                "sellconfirmtradedate": {
+                    "description": "卖方确认交易日",
+                    "type": "string"
+                },
+                "selluserid": {
+                    "description": "卖方用户ID",
+                    "type": "integer"
+                },
+                "thjdeliverymode": {
+                    "description": "交割方式 - 1:平台仓储 2:自提 3:代办运输 (枚举:THJDeliveryMode)",
+                    "type": "integer"
+                },
+                "thjdeliverymodedisplay": {
+                    "description": "提货方式",
+                    "type": "string"
+                },
+                "thjorderstatusdisplay": {
+                    "description": "状态",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "摘牌总货款",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "摘牌价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "摘牌数量",
+                    "type": "integer"
+                },
+                "tradetime": {
+                    "description": "摘牌时间",
+                    "type": "string"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID",
+                    "type": "integer"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                },
+                "wrtradedetailid": {
+                    "description": "采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdHolderDetailTradeInfo": {
             "type": "object",
             "properties": {

+ 252 - 0
docs/swagger.json

@@ -7678,6 +7678,66 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJPurchaseTradeDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的订单-采购订单",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "类型 - 0:未完成 1:已完成",
+                        "name": "type",
+                        "in": "query"
+                    },
+                    {
+                        "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.Thjpurchasetradedetail"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJWrstandard": {
             "get": {
                 "security": [
@@ -40123,6 +40183,198 @@
                 }
             }
         },
+        "models.Thjpurchasetradedetail": {
+            "type": "object",
+            "required": [
+                "buyuserid"
+            ],
+            "properties": {
+                "buyaccountid": {
+                    "description": "买方账号ID",
+                    "type": "integer"
+                },
+                "buychargevalue": {
+                    "description": "买方到期手续费",
+                    "type": "number"
+                },
+                "buyconfirmremark": {
+                    "description": "买方确认备注",
+                    "type": "string"
+                },
+                "buyconfirmtime": {
+                    "description": "买方确认时间",
+                    "type": "string"
+                },
+                "buyfreezecharge": {
+                    "description": "买方摘牌冻结手续费",
+                    "type": "number"
+                },
+                "buyuserid": {
+                    "description": "买方用户ID",
+                    "type": "integer"
+                },
+                "contactinfo": {
+                    "description": "联系方式",
+                    "type": "string"
+                },
+                "contactname": {
+                    "description": "联系人姓名",
+                    "type": "string"
+                },
+                "contractaddrbuy": {
+                    "description": "贸易合同地址(买家)",
+                    "type": "string"
+                },
+                "contractaddrsell": {
+                    "description": "贸易合同地址(卖家)",
+                    "type": "string"
+                },
+                "deliverygoodsid": {
+                    "description": "现货品种ID",
+                    "type": "integer"
+                },
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "desaddress": {
+                    "description": "目的地地址",
+                    "type": "string"
+                },
+                "discountamount": {
+                    "description": "优惠总金额(优惠金额*TradeQty)",
+                    "type": "number"
+                },
+                "handlestatus": {
+                    "description": "处理状态",
+                    "type": "integer"
+                },
+                "lastamount": {
+                    "description": "到期总货款 = 到期价格 * 摘牌数量",
+                    "type": "number"
+                },
+                "lastprice": {
+                    "description": "到期价格",
+                    "type": "number"
+                },
+                "lastpricedate": {
+                    "description": "到期价格日期 - 暂不使用",
+                    "type": "string"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "orderstatus": {
+                    "description": "单据状态 - 1:待付尾款 2:支付尾款成功 3:支付尾款失败 4:已违约 5:卖方已确认 6:买方已确认 7:系统自动确认 (枚举:THJOrderStatus)",
+                    "type": "integer"
+                },
+                "payeddeposit": {
+                    "description": "买方已付定金",
+                    "type": "number"
+                },
+                "payedtradedate": {
+                    "description": "支付尾款成功交易日",
+                    "type": "string"
+                },
+                "presaleapplyid": {
+                    "description": "预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "receiptinfo": {
+                    "description": "发票信息",
+                    "type": "string"
+                },
+                "remainamount": {
+                    "description": "剩余货款 = 到期总货款 - 已付定金 - 优惠金额",
+                    "type": "number"
+                },
+                "sellaccountid": {
+                    "description": "卖方账号ID",
+                    "type": "integer"
+                },
+                "sellchargevalue": {
+                    "description": "卖方到期手续费",
+                    "type": "number"
+                },
+                "sellconfirmattach": {
+                    "description": "卖方确认附件",
+                    "type": "string"
+                },
+                "sellconfirmremark": {
+                    "description": "卖方确认备注",
+                    "type": "string"
+                },
+                "sellconfirmtime": {
+                    "description": "卖方确认时间",
+                    "type": "string"
+                },
+                "sellconfirmtradedate": {
+                    "description": "卖方确认交易日",
+                    "type": "string"
+                },
+                "selluserid": {
+                    "description": "卖方用户ID",
+                    "type": "integer"
+                },
+                "thjdeliverymode": {
+                    "description": "交割方式 - 1:平台仓储 2:自提 3:代办运输 (枚举:THJDeliveryMode)",
+                    "type": "integer"
+                },
+                "thjdeliverymodedisplay": {
+                    "description": "提货方式",
+                    "type": "string"
+                },
+                "thjorderstatusdisplay": {
+                    "description": "状态",
+                    "type": "string"
+                },
+                "tradeamount": {
+                    "description": "摘牌总货款",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "tradeprice": {
+                    "description": "摘牌价格",
+                    "type": "number"
+                },
+                "tradeqty": {
+                    "description": "摘牌数量",
+                    "type": "integer"
+                },
+                "tradetime": {
+                    "description": "摘牌时间",
+                    "type": "string"
+                },
+                "warehouseid": {
+                    "description": "仓库ID",
+                    "type": "integer"
+                },
+                "warehousename": {
+                    "description": "仓库名称",
+                    "type": "string"
+                },
+                "wrfactortypeid": {
+                    "description": "仓单要素类型ID",
+                    "type": "integer"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                },
+                "wrtradedetailid": {
+                    "description": "采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdHolderDetailTradeInfo": {
             "type": "object",
             "properties": {

+ 182 - 0
docs/swagger.yaml

@@ -17064,6 +17064,150 @@ definitions:
     required:
     - autoid
     type: object
+  models.Thjpurchasetradedetail:
+    properties:
+      buyaccountid:
+        description: 买方账号ID
+        type: integer
+      buychargevalue:
+        description: 买方到期手续费
+        type: number
+      buyconfirmremark:
+        description: 买方确认备注
+        type: string
+      buyconfirmtime:
+        description: 买方确认时间
+        type: string
+      buyfreezecharge:
+        description: 买方摘牌冻结手续费
+        type: number
+      buyuserid:
+        description: 买方用户ID
+        type: integer
+      contactinfo:
+        description: 联系方式
+        type: string
+      contactname:
+        description: 联系人姓名
+        type: string
+      contractaddrbuy:
+        description: 贸易合同地址(买家)
+        type: string
+      contractaddrsell:
+        description: 贸易合同地址(卖家)
+        type: string
+      deliverygoodsid:
+        description: 现货品种ID
+        type: integer
+      depositrate:
+        description: 定金比例
+        type: number
+      desaddress:
+        description: 目的地地址
+        type: string
+      discountamount:
+        description: 优惠总金额(优惠金额*TradeQty)
+        type: number
+      handlestatus:
+        description: 处理状态
+        type: integer
+      lastamount:
+        description: 到期总货款 = 到期价格 * 摘牌数量
+        type: number
+      lastprice:
+        description: 到期价格
+        type: number
+      lastpricedate:
+        description: 到期价格日期 - 暂不使用
+        type: string
+      marketid:
+        description: 市场ID
+        type: integer
+      orderstatus:
+        description: 单据状态 - 1:待付尾款 2:支付尾款成功 3:支付尾款失败 4:已违约 5:卖方已确认 6:买方已确认 7:系统自动确认
+          (枚举:THJOrderStatus)
+        type: integer
+      payeddeposit:
+        description: 买方已付定金
+        type: number
+      payedtradedate:
+        description: 支付尾款成功交易日
+        type: string
+      presaleapplyid:
+        description: 预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      receiptinfo:
+        description: 发票信息
+        type: string
+      remainamount:
+        description: 剩余货款 = 到期总货款 - 已付定金 - 优惠金额
+        type: number
+      sellaccountid:
+        description: 卖方账号ID
+        type: integer
+      sellchargevalue:
+        description: 卖方到期手续费
+        type: number
+      sellconfirmattach:
+        description: 卖方确认附件
+        type: string
+      sellconfirmremark:
+        description: 卖方确认备注
+        type: string
+      sellconfirmtime:
+        description: 卖方确认时间
+        type: string
+      sellconfirmtradedate:
+        description: 卖方确认交易日
+        type: string
+      selluserid:
+        description: 卖方用户ID
+        type: integer
+      thjdeliverymode:
+        description: 交割方式 - 1:平台仓储 2:自提 3:代办运输 (枚举:THJDeliveryMode)
+        type: integer
+      thjdeliverymodedisplay:
+        description: 提货方式
+        type: string
+      thjorderstatusdisplay:
+        description: 状态
+        type: string
+      tradeamount:
+        description: 摘牌总货款
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      tradeprice:
+        description: 摘牌价格
+        type: number
+      tradeqty:
+        description: 摘牌数量
+        type: integer
+      tradetime:
+        description: 摘牌时间
+        type: string
+      warehouseid:
+        description: 仓库ID
+        type: integer
+      warehousename:
+        description: 仓库名称
+        type: string
+      wrfactortypeid:
+        description: 仓单要素类型ID
+        type: integer
+      wrstandardid:
+        description: 现货商品ID
+        type: integer
+      wrstandardname:
+        description: 现货商品名称
+        type: string
+      wrtradedetailid:
+        description: 采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+    required:
+    - buyuserid
+    type: object
   models.TjmdHolderDetailTradeInfo:
     properties:
       agreeunit:
@@ -28420,6 +28564,44 @@ paths:
       summary: 查询我的注册红包
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJPurchaseTradeDetail:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 类型 - 0:未完成 1:已完成
+        in: query
+        name: type
+        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.Thjpurchasetradedetail'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询我的订单-采购订单
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJWrstandard:
     get:
       parameters:

+ 221 - 0
models/ferroalloy.go

@@ -597,3 +597,224 @@ func (r *THJWrstandardDetailReq) GetTHJWrstandardDetail() (rsp *THJWrstandardDet
 
 	return
 }
+
+// Thjpurchasetradedetail 铁合金采购成交扩展表
+type Thjpurchasetradedetail struct {
+	WRTRADEDETAILID      int64     `json:"wrtradedetailid" xorm:"WRTRADEDETAILID"`                      // 采购成交单ID(321+Unix秒时间戳(10位)+xxxxxx)
+	PRESALEAPPLYID       int64     `json:"presaleapplyid" xorm:"PRESALEAPPLYID"`                        // 预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)
+	TRADEDATE            string    `json:"tradedate" xorm:"TRADEDATE"`                                  // 交易日(yyyyMMdd)
+	MARKETID             int32     `json:"marketid" xorm:"MARKETID"`                                    // 市场ID
+	WRFACTORTYPEID       int64     `json:"wrfactortypeid" xorm:"WRFACTORTYPEID"`                        // 仓单要素类型ID
+	DELIVERYGOODSID      int32     `json:"deliverygoodsid" xorm:"DELIVERYGOODSID"`                      // 现货品种ID
+	WRSTANDARDID         int32     `json:"wrstandardid" xorm:"WRSTANDARDID"`                            // 现货商品ID
+	WAREHOUSEID          int64     `json:"warehouseid" xorm:"WAREHOUSEID"`                              // 仓库ID
+	BUYUSERID            int64     `json:"buyuserid" xorm:"BUYUSERID" form:"userid" binding:"required"` // 买方用户ID
+	BUYACCOUNTID         int64     `json:"buyaccountid" xorm:"BUYACCOUNTID"`                            // 买方账号ID
+	SELLUSERID           int64     `json:"selluserid" xorm:"SELLUSERID"`                                // 卖方用户ID
+	SELLACCOUNTID        int64     `json:"sellaccountid" xorm:"SELLACCOUNTID"`                          // 卖方账号ID
+	TRADETIME            time.Time `json:"tradetime" xorm:"TRADETIME"`                                  // 摘牌时间
+	TRADEPRICE           float64   `json:"tradeprice" xorm:"TRADEPRICE"`                                // 摘牌价格
+	TRADEQTY             int64     `json:"tradeqty" xorm:"TRADEQTY"`                                    // 摘牌数量
+	TRADEAMOUNT          float64   `json:"tradeamount" xorm:"TRADEAMOUNT"`                              // 摘牌总货款
+	DEPOSITRATE          float64   `json:"depositrate" xorm:"DEPOSITRATE"`                              // 定金比例
+	DISCOUNTAMOUNT       float64   `json:"discountamount" xorm:"DISCOUNTAMOUNT"`                        // 优惠总金额(优惠金额*TradeQty)
+	PAYEDDEPOSIT         float64   `json:"payeddeposit" xorm:"PAYEDDEPOSIT"`                            // 买方已付定金
+	THJDELIVERYMODE      int32     `json:"thjdeliverymode" xorm:"THJDELIVERYMODE"`                      // 交割方式 - 1:平台仓储 2:自提 3:代办运输 (枚举:THJDeliveryMode)
+	CONTACTNAME          string    `json:"contactname" xorm:"CONTACTNAME"`                              // 联系人姓名
+	CONTACTINFO          string    `json:"contactinfo" xorm:"CONTACTINFO"`                              // 联系方式
+	DESADDRESS           string    `json:"desaddress" xorm:"DESADDRESS"`                                // 目的地地址
+	RECEIPTINFO          string    `json:"receiptinfo" xorm:"RECEIPTINFO"`                              // 发票信息
+	ORDERSTATUS          int32     `json:"orderstatus" xorm:"ORDERSTATUS"`                              // 单据状态 - 1:待付尾款 2:支付尾款成功 3:支付尾款失败 4:已违约 5:卖方已确认 6:买方已确认 7:系统自动确认 (枚举:THJOrderStatus)
+	LASTPRICE            float64   `json:"lastprice" xorm:"LASTPRICE"`                                  // 到期价格
+	LASTAMOUNT           float64   `json:"lastamount" xorm:"LASTAMOUNT"`                                // 到期总货款 = 到期价格 * 摘牌数量
+	BUYCHARGEVALUE       float64   `json:"buychargevalue" xorm:"BUYCHARGEVALUE"`                        // 买方到期手续费
+	SELLCHARGEVALUE      float64   `json:"sellchargevalue" xorm:"SELLCHARGEVALUE"`                      // 卖方到期手续费
+	REMAINAMOUNT         float64   `json:"remainamount" xorm:"REMAINAMOUNT"`                            // 剩余货款 = 到期总货款 - 已付定金 - 优惠金额
+	SELLCONFIRMREMARK    string    `json:"sellconfirmremark" xorm:"SELLCONFIRMREMARK"`                  // 卖方确认备注
+	SELLCONFIRMATTACH    string    `json:"sellconfirmattach" xorm:"SELLCONFIRMATTACH"`                  // 卖方确认附件
+	SELLCONFIRMTIME      time.Time `json:"sellconfirmtime" xorm:"SELLCONFIRMTIME"`                      // 卖方确认时间
+	SELLCONFIRMTRADEDATE string    `json:"sellconfirmtradedate" xorm:"SELLCONFIRMTRADEDATE"`            // 卖方确认交易日
+	BUYCONFIRMREMARK     string    `json:"buyconfirmremark" xorm:"BUYCONFIRMREMARK"`                    // 买方确认备注
+	BUYCONFIRMTIME       time.Time `json:"buyconfirmtime" xorm:"BUYCONFIRMTIME"`                        // 买方确认时间
+	HANDLESTATUS         int32     `json:"handlestatus" xorm:"HANDLESTATUS"`                            // 处理状态
+	CONTRACTADDRBUY      string    `json:"contractaddrbuy" xorm:"CONTRACTADDRBUY"`                      // 贸易合同地址(买家)
+	CONTRACTADDRSELL     string    `json:"contractaddrsell" xorm:"CONTRACTADDRSELL"`                    // 贸易合同地址(卖家)
+	PAYEDTRADEDATE       string    `json:"payedtradedate" xorm:"PAYEDTRADEDATE"`                        // 支付尾款成功交易日
+	BUYFREEZECHARGE      float64   `json:"buyfreezecharge" xorm:"BUYFREEZECHARGE"`                      // 买方摘牌冻结手续费
+	LASTPRICEDATE        time.Time `json:"lastpricedate" xorm:"LASTPRICEDATE"`                          // 到期价格日期 - 暂不使用
+
+	WRSTANDARDNAME string `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
+	WAREHOUSENAME  string `json:"warehousename" xorm:"WAREHOUSENAME"`   // 仓库名称
+
+	THJDELIVERYMODEDISPLAY string `json:"thjdeliverymodedisplay" xorm:"THJDELIVERYMODEDISPLAY"` // 提货方式
+	THJORDERSTATUSDISPLAY  string `json:"thjorderstatusdisplay" xorm:"THJORDERSTATUSDISPLAY"`   // 状态
+
+	TYPE int `json:"-" xorm:"-" form:"type"` // 类型 - 0:未完成 1:已完成
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *Thjpurchasetradedetail) calc() {
+
+}
+
+func (r *Thjpurchasetradedetail) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		wr.WRSTANDARDNAME,
+		wh.WAREHOUSENAME,
+		en1.enumdicname THJDELIVERYMODEDISPLAY,
+		en2.enumdicname THJORDERSTATUSDISPLAY,
+		t.WRTRADEDETAILID,
+		t.PRESALEAPPLYID,
+		t.TRADEDATE,
+		t.MARKETID,
+		t.WRFACTORTYPEID,
+		t.DELIVERYGOODSID,
+		t.WRSTANDARDID,
+		t.WAREHOUSEID,
+		t.BUYUSERID,
+		t.BUYACCOUNTID,
+		t.SELLUSERID,
+		t.SELLACCOUNTID,
+		to_char(t.TRADETIME,'yyyy-mm-dd hh24:mi:ss') TRADETIME,
+		t.TRADEPRICE,
+		t.TRADEQTY,
+		t.TRADEAMOUNT,
+		t.DEPOSITRATE,
+		t.DISCOUNTAMOUNT,
+		t.PAYEDDEPOSIT,
+		t.THJDELIVERYMODE,
+		t.CONTACTNAME,
+		t.CONTACTINFO,
+		t.DESADDRESS,
+		t.RECEIPTINFO,
+		t.ORDERSTATUS,
+		t.LASTPRICE,
+		t.LASTAMOUNT,
+		t.BUYCHARGEVALUE,
+		t.SELLCHARGEVALUE,
+		t.REMAINAMOUNT,
+		t.SELLCONFIRMREMARK,
+		t.SELLCONFIRMATTACH,
+		t.SELLCONFIRMTIME,
+		t.SELLCONFIRMTRADEDATE,
+		t.BUYCONFIRMREMARK,
+		t.BUYCONFIRMTIME,
+		t.HANDLESTATUS,
+		t.CONTRACTADDRBUY,
+		t.CONTRACTADDRSELL,
+		t.PAYEDTRADEDATE,
+		t.BUYFREEZECHARGE,
+		t.LASTPRICEDATE
+	from THJ_PurchaseTradeDetail t
+	left join wrstandard wr
+		on t.wrstandardid = wr.wrstandardid
+	left join warehouseinfo wh
+		on t.warehouseid = wh.autoid
+	left join enumdicitem en1
+		on en1.enumdiccode = 'THJDeliveryMode'
+	and t.thjdeliverymode = en1.enumitemname
+	left join enumdicitem en2
+		on en2.enumdiccode = 'THJOrderStatus'
+	and t.orderstatus = en2.enumitemname
+	where t.buyuserid = %v
+	and t.orderstatus in (4,6,7)
+	order by t.tradetime desc
+	`
+	sqlId.FormatParam(r.BUYUSERID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *Thjpurchasetradedetail) buildSql2() string {
+	var sqlId utils.SQLVal = `select aa.* from (
+	select 
+		wr.WRSTANDARDNAME,
+		wh.WAREHOUSENAME,
+		en1.enumdicname THJDELIVERYMODEDISPLAY,
+		en2.enumdicname THJORDERSTATUSDISPLAY,
+		case t.orderstatus
+			when 3 then 1
+			when 5 then 2
+			when 1 then 3
+			when 2 then 4
+		else 10 end OrderIndex,
+		t.WRTRADEDETAILID,
+		t.PRESALEAPPLYID,
+		t.TRADEDATE,
+		t.MARKETID,
+		t.WRFACTORTYPEID,
+		t.DELIVERYGOODSID,
+		t.WRSTANDARDID,
+		t.WAREHOUSEID,
+		t.BUYUSERID,
+		t.BUYACCOUNTID,
+		t.SELLUSERID,
+		t.SELLACCOUNTID,
+		to_char(t.TRADETIME,'yyyy-mm-dd hh24:mi:ss') TRADETIME,
+		t.TRADEPRICE,
+		t.TRADEQTY,
+		t.TRADEAMOUNT,
+		t.DEPOSITRATE,
+		t.DISCOUNTAMOUNT,
+		t.PAYEDDEPOSIT,
+		t.THJDELIVERYMODE,
+		t.CONTACTNAME,
+		t.CONTACTINFO,
+		t.DESADDRESS,
+		t.RECEIPTINFO,
+		t.ORDERSTATUS,
+		t.LASTPRICE,
+		t.LASTAMOUNT,
+		t.BUYCHARGEVALUE,
+		t.SELLCHARGEVALUE,
+		t.REMAINAMOUNT,
+		t.SELLCONFIRMREMARK,
+		t.SELLCONFIRMATTACH,
+		t.SELLCONFIRMTIME,
+		t.SELLCONFIRMTRADEDATE,
+		t.BUYCONFIRMREMARK,
+		t.BUYCONFIRMTIME,
+		t.HANDLESTATUS,
+		t.CONTRACTADDRBUY,
+		t.CONTRACTADDRSELL,
+		t.PAYEDTRADEDATE,
+		t.BUYFREEZECHARGE,
+		t.LASTPRICEDATE
+	from THJ_PurchaseTradeDetail t
+	left join wrstandard wr
+		on t.wrstandardid = wr.wrstandardid
+	left join warehouseinfo wh
+		on t.warehouseid = wh.autoid
+	left join enumdicitem en1
+		on en1.enumdiccode = 'THJDeliveryMode'
+	and t.thjdeliverymode = en1.enumitemname
+	left join enumdicitem en2
+		on en2.enumdiccode = 'THJOrderStatus'
+	and t.orderstatus = en2.enumitemname
+	where t.buyuserid = %v
+	and t.orderstatus in (1,2,3,5)) aa
+	order by aa.orderindex, aa.tradetime desc
+	`
+	sqlId.FormatParam(r.BUYUSERID)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *Thjpurchasetradedetail) GetDataByPage() (interface{}, error, int, int, int) {
+	sql := r.buildSql()
+	if r.TYPE == 1 {
+		sql = r.buildSql2()
+	}
+	sData := make([]Thjpurchasetradedetail, 0)
+	err := db.GetEngine().SQL(sql).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 1 - 0
routers/router.go

@@ -696,6 +696,7 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryUserScoreLog", ferroalloy.QueryUserScoreLog)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandard", ferroalloy.QueryTHJWrstandard)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandardDetail", ferroalloy.QueryTHJWrstandardDetail)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTradeDetail", ferroalloy.QueryTHJPurchaseTradeDetail)
 	}
 
 	return r