소스 검색

增加查询采购详情接口

zhou.xiaoning 3 년 전
부모
커밋
fa406142e5
6개의 변경된 파일661개의 추가작업 그리고 0개의 파일을 삭제
  1. 28 0
      controllers/ferroalloy/trade.go
  2. 172 0
      docs/docs.go
  3. 172 0
      docs/swagger.json
  4. 118 0
      docs/swagger.yaml
  5. 170 0
      models/ferroalloy.go
  6. 1 0
      routers/router.go

+ 28 - 0
controllers/ferroalloy/trade.go

@@ -2,7 +2,10 @@ package ferroalloy
 
 import (
 	"mtp2_if/global/app"
+	"mtp2_if/global/e"
+	"mtp2_if/logger"
 	"mtp2_if/models"
+	"net/http"
 
 	"github.com/gin-gonic/gin"
 )
@@ -24,3 +27,28 @@ func QueryTHJWrstandard(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryTHJWrstandardDetail
+// @Summary  查询采购详情
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardid query    int true "现货商品ID"
+// @Success  200          {array}  models.THJWrstandardDetailRsp
+// @Failure  500          {object} app.Response
+// @Router   /Ferroalloy/QueryTHJWrstandardDetail [get]
+// @Tags     铁合金
+func QueryTHJWrstandardDetail(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJWrstandardDetailReq{}
+	if err := a.C.ShouldBind(&m); err != nil {
+		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if rsp, err := m.GetTHJWrstandardDetail(); 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)
+	}
+}

+ 172 - 0
docs/docs.go

@@ -7740,6 +7740,48 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJWrstandardDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询采购详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJWrstandardDetailRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryUserScoreLog": {
             "get": {
                 "security": [
@@ -39625,6 +39667,61 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJDeliveryMode": {
+            "type": "object",
+            "properties": {
+                "enumdicname": {
+                    "description": "枚举项名称",
+                    "type": "string"
+                },
+                "enumitemname": {
+                    "description": "枚举项值",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.THJDeliveryMonth": {
+            "type": "object",
+            "properties": {
+                "enddate": {
+                    "description": "预售结束日期(yyyy-mm-dd)",
+                    "type": "string"
+                },
+                "endmonth": {
+                    "description": "预售结束月份(yyyy-mm)",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "presaleapplyid": {
+                    "description": "预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "remainqty": {
+                    "description": "可用数量",
+                    "type": "integer"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.THJPresaleApplyDeposit": {
+            "type": "object",
+            "properties": {
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "discountamount": {
+                    "description": "优惠金额(每吨)",
+                    "type": "number"
+                }
+            }
+        },
         "models.THJSigninReq": {
             "type": "object",
             "required": [
@@ -39646,6 +39743,19 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJSpotGoodsPriceLog": {
+            "type": "object",
+            "properties": {
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJWrstandard": {
             "type": "object",
             "properties": {
@@ -39667,6 +39777,68 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJWrstandardDetailRsp": {
+            "type": "object",
+            "properties": {
+                "deliveryModes": {
+                    "description": "交割方式",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJDeliveryMode"
+                    }
+                },
+                "deliveryMonth": {
+                    "description": "交割月份",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJDeliveryMonth"
+                    }
+                },
+                "goodsInfo": {
+                    "description": "商品信息",
+                    "$ref": "#/definitions/models.THJWrstandardDetail_GoodsInfo"
+                },
+                "presaleApplyDeposits": {
+                    "description": "支付方式",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJPresaleApplyDeposit"
+                    }
+                },
+                "spotGoodsPriceLogs": {
+                    "description": "历史价格走势",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJSpotGoodsPriceLog"
+                    }
+                }
+            }
+        },
+        "models.THJWrstandardDetail_GoodsInfo": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Taaccount": {
             "type": "object",
             "required": [

+ 172 - 0
docs/swagger.json

@@ -7731,6 +7731,48 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJWrstandardDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询采购详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "现货商品ID",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJWrstandardDetailRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryUserScoreLog": {
             "get": {
                 "security": [
@@ -39616,6 +39658,61 @@
                 }
             }
         },
+        "models.THJDeliveryMode": {
+            "type": "object",
+            "properties": {
+                "enumdicname": {
+                    "description": "枚举项名称",
+                    "type": "string"
+                },
+                "enumitemname": {
+                    "description": "枚举项值",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.THJDeliveryMonth": {
+            "type": "object",
+            "properties": {
+                "enddate": {
+                    "description": "预售结束日期(yyyy-mm-dd)",
+                    "type": "string"
+                },
+                "endmonth": {
+                    "description": "预售结束月份(yyyy-mm)",
+                    "type": "string"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "presaleapplyid": {
+                    "description": "预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)",
+                    "type": "integer"
+                },
+                "remainqty": {
+                    "description": "可用数量",
+                    "type": "integer"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                }
+            }
+        },
+        "models.THJPresaleApplyDeposit": {
+            "type": "object",
+            "properties": {
+                "depositrate": {
+                    "description": "定金比例",
+                    "type": "number"
+                },
+                "discountamount": {
+                    "description": "优惠金额(每吨)",
+                    "type": "number"
+                }
+            }
+        },
         "models.THJSigninReq": {
             "type": "object",
             "required": [
@@ -39637,6 +39734,19 @@
                 }
             }
         },
+        "models.THJSpotGoodsPriceLog": {
+            "type": "object",
+            "properties": {
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJWrstandard": {
             "type": "object",
             "properties": {
@@ -39658,6 +39768,68 @@
                 }
             }
         },
+        "models.THJWrstandardDetailRsp": {
+            "type": "object",
+            "properties": {
+                "deliveryModes": {
+                    "description": "交割方式",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJDeliveryMode"
+                    }
+                },
+                "deliveryMonth": {
+                    "description": "交割月份",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJDeliveryMonth"
+                    }
+                },
+                "goodsInfo": {
+                    "description": "商品信息",
+                    "$ref": "#/definitions/models.THJWrstandardDetail_GoodsInfo"
+                },
+                "presaleApplyDeposits": {
+                    "description": "支付方式",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJPresaleApplyDeposit"
+                    }
+                },
+                "spotGoodsPriceLogs": {
+                    "description": "历史价格走势",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.THJSpotGoodsPriceLog"
+                    }
+                }
+            }
+        },
+        "models.THJWrstandardDetail_GoodsInfo": {
+            "type": "object",
+            "properties": {
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)",
+                    "type": "string"
+                },
+                "spotgoodsprice": {
+                    "description": "现货价格",
+                    "type": "number"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称",
+                    "type": "string"
+                }
+            }
+        },
         "models.Taaccount": {
             "type": "object",
             "required": [

+ 118 - 0
docs/swagger.yaml

@@ -16725,6 +16725,45 @@ definitions:
         description: 现货商品名称
         type: string
     type: object
+  models.THJDeliveryMode:
+    properties:
+      enumdicname:
+        description: 枚举项名称
+        type: string
+      enumitemname:
+        description: 枚举项值
+        type: integer
+    type: object
+  models.THJDeliveryMonth:
+    properties:
+      enddate:
+        description: 预售结束日期(yyyy-mm-dd)
+        type: string
+      endmonth:
+        description: 预售结束月份(yyyy-mm)
+        type: string
+      orderqty:
+        description: 委托数量
+        type: integer
+      presaleapplyid:
+        description: 预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)
+        type: integer
+      remainqty:
+        description: 可用数量
+        type: integer
+      tradeqty:
+        description: 成交数量
+        type: integer
+    type: object
+  models.THJPresaleApplyDeposit:
+    properties:
+      depositrate:
+        description: 定金比例
+        type: number
+      discountamount:
+        description: 优惠金额(每吨)
+        type: number
+    type: object
   models.THJSigninReq:
     properties:
       userid:
@@ -16739,6 +16778,15 @@ definitions:
         description: 状态操作标志 1-签到成功 2-当日已签到,不能重复签到
         type: integer
     type: object
+  models.THJSpotGoodsPriceLog:
+    properties:
+      spotgoodsprice:
+        description: 现货价格
+        type: number
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+    type: object
   models.THJWrstandard:
     properties:
       thumurls:
@@ -16754,6 +16802,50 @@ definitions:
         description: 现货商品名称(模糊查询)
         type: string
     type: object
+  models.THJWrstandardDetail_GoodsInfo:
+    properties:
+      pictureurls:
+        description: 详情图片(逗号分隔)
+        type: string
+      spotgoodsprice:
+        description: 现货价格
+        type: number
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID(自增 SEQ_GOODS 确保不重复)
+        type: integer
+      wrstandardname:
+        description: 现货商品名称
+        type: string
+    type: object
+  models.THJWrstandardDetailRsp:
+    properties:
+      deliveryModes:
+        description: 交割方式
+        items:
+          $ref: '#/definitions/models.THJDeliveryMode'
+        type: array
+      deliveryMonth:
+        description: 交割月份
+        items:
+          $ref: '#/definitions/models.THJDeliveryMonth'
+        type: array
+      goodsInfo:
+        $ref: '#/definitions/models.THJWrstandardDetail_GoodsInfo'
+        description: 商品信息
+      presaleApplyDeposits:
+        description: 支付方式
+        items:
+          $ref: '#/definitions/models.THJPresaleApplyDeposit'
+        type: array
+      spotGoodsPriceLogs:
+        description: 历史价格走势
+        items:
+          $ref: '#/definitions/models.THJSpotGoodsPriceLog'
+        type: array
+    type: object
   models.Taaccount:
     properties:
       accountflag:
@@ -28358,6 +28450,32 @@ paths:
       summary: 查询采购列表
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJWrstandardDetail:
+    get:
+      parameters:
+      - description: 现货商品ID
+        in: query
+        name: wrstandardid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.THJWrstandardDetailRsp'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询采购详情
+      tags:
+      - 铁合金
   /Ferroalloy/QueryUserScoreLog:
     get:
       parameters:

+ 170 - 0
models/ferroalloy.go

@@ -7,6 +7,7 @@ import (
 	"mtp2_if/logger"
 	"mtp2_if/utils"
 	"strconv"
+	"strings"
 	"sync"
 	"time"
 )
@@ -427,3 +428,172 @@ func (r *RegisterMoney) GetDataEx() (interface{}, error) {
 	}
 	return sData, nil
 }
+
+// THJWrstandardDetail_GoodsInfo 采购商品信息
+type THJWrstandardDetail_GoodsInfo struct {
+	WRSTANDARDID      int64     `json:"wrstandardid" xorm:"WRSTANDARDID"`     // 现货商品ID(自增 SEQ_GOODS 确保不重复)
+	WRSTANDARDCODE    string    `json:"wrstandardcode" xorm:"WRSTANDARDCODE"` // 现货商品代码
+	WRSTANDARDNAME    string    `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
+	DELIVERYGOODSID   int32     `json:"-" xorm:"DELIVERYGOODSID"`             // 现货品种ID
+	UNITID            int32     `json:"-" xorm:"UNITID"`                      // 现货商品单位ID
+	MINIVALUE         int64     `json:"-" xorm:"MINIVALUE"`                   // 最小变动值
+	MINIVALUEDP       int64     `json:"-" xorm:"MINIVALUEDP"`                 // 最小变动值小数位
+	REALMINIVALUE     int64     `json:"-" xorm:"REALMINIVALUE"`               // 实际最小变动值
+	REALMINIVALUEDP   int64     `json:"-" xorm:"REALMINIVALUEDP"`             // 实际最小变动值小数位
+	WRSSTATUS         int32     `json:"-" xorm:"WRSSTATUS"`                   // 状态 - 作废 - 0:未激活 1:正常
+	CREATORID         int64     `json:"-" xorm:"CREATORID"`                   // 创建人
+	CREATETIME        time.Time `json:"-" xorm:"CREATETIME"`                  // 创建时间
+	UPDATORID         int64     `json:"-" xorm:"UPDATORID"`                   // 更新人
+	UPDATETIME        time.Time `json:"-" xorm:"UPDATETIME"`                  // 更新时间
+	FACTORYITEMJSON   string    `json:"-" xorm:"FACTORYITEMJSON"`             // 要素项定义Json[{"DGFactoryItemTypeID": ,"ItemTypeMode": ,"FactoryItemIDs": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem->DGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem->ItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem->DGFactoryItemID, 逗号分隔
+	ISVALID           int32     `json:"-" xorm:"ISVALID"`                     // 是否有效 - 0:无效 1:有效
+	AREAUSERID        int64     `json:"-" xorm:"AREAUSERID"`                  // 所属机构
+	REMARK            string    `json:"-" xorm:"REMARK"`                      // 备注
+	CONVERTFACTOR     float64   `json:"-" xorm:"CONVERTFACTOR"`               // 标仓系数
+	VATRATE           float64   `json:"-" xorm:"VATRATE"`                     // 现货增值税率
+	STORAGEFEE        float64   `json:"-" xorm:"STORAGEFEE"`                  // 仓储费(固定: 111)
+	THUMURLS          string    `json:"-" xorm:"THUMURLS"`                    // 缩略图片(1:1)(逗号分隔)
+	PICTUREURLS       string    `json:"pictureurls" xorm:"PICTUREURLS"`       // 详情图片(逗号分隔)
+	BANNERPICURL      string    `json:"-" xorm:"BANNERPICURL"`                // Banner图(逗号分隔)
+	PROVIDERUSERID    int64     `json:"-" xorm:"PROVIDERUSERID"`              // 供应链提供商
+	PROVIDERACCOUNTID int64     `json:"-" xorm:"PROVIDERACCOUNTID"`           // 供应链提供商资金账户 ID
+
+	SPOTGOODSPRICE float64 `json:"spotgoodsprice" xorm:"SPOTGOODSPRICE"` // 现货价格
+}
+
+// THJDeliveryMode 交割方式
+type THJDeliveryMode struct {
+	ENUMDICNAME  string `json:"enumdicname" xorm:"ENUMDICNAME"`   // 枚举项名称
+	ENUMITEMNAME int64  `json:"enumitemname" xorm:"ENUMITEMNAME"` // 枚举项值
+}
+
+// THJDeliveryMonth 交割月份
+type THJDeliveryMonth struct {
+	PRESALEAPPLYID int64  `json:"presaleapplyid" xorm:"PRESALEAPPLYID"` // 预售申请ID(184+Unix秒时间戳(10位)+xxxxxx)
+	ENDMONTH       string `json:"endmonth" xorm:"ENDMONTH"`             // 预售结束月份(yyyy-mm)
+	ENDDATE        string `json:"enddate" xorm:"ENDDATE"`               // 预售结束日期(yyyy-mm-dd)
+	ORDERQTY       int64  `json:"orderqty" xorm:"ORDERQTY"`             // 委托数量
+	TRADEQTY       int64  `json:"tradeqty" xorm:"TRADEQTY"`             // 成交数量
+	REMAINQTY      int64  `json:"remainqty" xorm:"REMAINQTY"`           // 可用数量
+}
+
+// THJPresaleApplyDeposit 支付方式
+type THJPresaleApplyDeposit struct {
+	DEPOSITRATE    float64 `json:"depositrate" xorm:"DEPOSITRATE"`       // 定金比例
+	DISCOUNTAMOUNT float64 `json:"discountamount" xorm:"DISCOUNTAMOUNT"` // 优惠金额(每吨)
+}
+
+// THJSpotGoodsPriceLog 历史价格走势
+type THJSpotGoodsPriceLog struct {
+	SPOTGOODSPRICE float64 `json:"spotgoodsprice" xorm:"SPOTGOODSPRICE"` // 现货价格
+	TRADEDATE      string  `json:"tradedate" xorm:"TRADEDATE"`           // 交易日(yyyyMMdd)
+}
+
+type THJWrstandardDetailReq struct {
+	WRSTANDARDID int64 `form:"wrstandardid" binding:"required"` // 现货商品ID
+}
+
+// THJWrstandardDetailRsp 采购商品详情
+type THJWrstandardDetailRsp struct {
+	GoodsInfo            THJWrstandardDetail_GoodsInfo // 商品信息
+	DeliveryModes        []THJDeliveryMode             // 交割方式
+	DeliveryMonth        []THJDeliveryMonth            // 交割月份
+	PresaleApplyDeposits []THJPresaleApplyDeposit      // 支付方式
+	SpotGoodsPriceLogs   []THJSpotGoodsPriceLog        // 历史价格走势
+}
+
+// GetTHJWrstandardDetail 获取采购商品详情
+func (r *THJWrstandardDetailReq) GetTHJWrstandardDetail() (rsp *THJWrstandardDetailRsp, err error) {
+	engine := db.GetEngine()
+
+	// 采购商品信息
+	goodsInfo := new(THJWrstandardDetail_GoodsInfo)
+	sql := fmt.Sprintf(`
+		select
+			t.WRSTANDARDID,
+			t.WRSTANDARDCODE,
+			t.WRSTANDARDNAME,
+			t.PICTUREURLS,
+			p.SPOTGOODSPRICE
+		from wrstandard t
+		left join ERMCP_SpotGoodsPrice p on t.WRSTANDARDID = p.WRSTANDARDID and p.spotgoodsbrandid=0 and p.currencyid = 1 
+		where t.WRSTANDARDID = %v
+	`, r.WRSTANDARDID)
+	if _, err = engine.SQL(sql).Get(goodsInfo); err != nil {
+		return
+	}
+	rsp.GoodsInfo = *goodsInfo
+
+	// 交割方式
+	deliveryModes := make([]THJDeliveryMode, 0)
+	sql = `
+		select 
+			t.ENUMDICNAME,
+			t.ENUMITEMNAME
+		from enumdicitem t 
+		where t.enumdiccode = 'THJDeliveryMode';
+	`
+	if err = engine.SQL(sql).Find(&deliveryModes); err != nil {
+		return
+	}
+	rsp.DeliveryModes = deliveryModes
+
+	// 交割月份
+	deliveryMonths := make([]THJDeliveryMonth, 0)
+	sql = fmt.Sprintf(`
+		select
+			t.PRESALEAPPLYID,  
+			to_char(t.ENDDATE, 'yyyy-mm') ENDMONTH, 
+			to_char(t.ENDDATE, 'yyyy-mm-dd') ENDDATE, 
+			t.ORDERQTY,
+			t.TRADEQTY,
+			(od.orderqty - od.tradeqty) REMAINQTY
+		from WR_PresaleInfo t
+		inner join wrtrade_orderdetail od on t.sellwrtradeorderid = od.wrtradeorderid
+		where t.wrstandardid = %v
+			and t.presalestatus = 2
+			and od.wrtradeorderstatus in (3, 7)
+			and (od.orderqty - od.tradeqty) > 0
+	`, r.WRSTANDARDID)
+	if err = engine.SQL(sql).Find(&deliveryMonths); err != nil {
+		return
+	}
+	rsp.DeliveryMonth = deliveryMonths
+
+	// 支付方式
+	ids := make([]string, 0)
+	for _, item := range deliveryMonths {
+		ids = append(ids, strconv.Itoa(int(item.PRESALEAPPLYID)))
+	}
+	if len(ids) > 0 {
+		presaleApplyDeposits := make([]THJPresaleApplyDeposit, 0)
+		sql = fmt.Sprintf(`
+			select 
+				t.DEPOSITRATE, 
+				t.DISCOUNTAMOUNT 
+			from THJ_PresaleApplyDeposit t
+			where t.presaleapplyid in (%v)
+		`, strings.Join(ids, ","))
+		if err = engine.SQL(sql).Find(&presaleApplyDeposits); err != nil {
+			return
+		}
+		rsp.PresaleApplyDeposits = presaleApplyDeposits
+	}
+
+	// 历史价格走势
+	spotGoodsPriceLogs := make([]THJSpotGoodsPriceLog, 0)
+	sql = fmt.Sprintf(`
+		select 
+			t.SPOTGOODSPRICE, 
+			t.TRADEDATE 
+		from ERMCP_SpotGoodsPriceLog t
+		where t.wrstandardid = %v
+		order by t.operatetime
+	`, r.WRSTANDARDID)
+	if err = engine.SQL(sql).Find(&spotGoodsPriceLogs); err != nil {
+		return
+	}
+	rsp.SpotGoodsPriceLogs = spotGoodsPriceLogs
+
+	return
+}

+ 1 - 0
routers/router.go

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