Przeglądaj źródła

1、增加接口 “/Presale/QueryPresaleDefault 查询转让详情”;
2、修改接口 /Mine/QueryMineTradePositionExs BUG

zhou.xiaoning 2 lat temu
rodzic
commit
0159895d8d
8 zmienionych plików z 300 dodań i 13 usunięć
  1. 6 6
      config/config.xml
  2. 16 0
      controllers/presale/presale.go
  3. 81 2
      docs/docs.go
  4. 81 2
      docs/swagger.json
  5. 55 2
      docs/swagger.yaml
  6. 0 1
      models/mine.go
  7. 60 0
      models/presale.go
  8. 1 0
      routers/router.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.88"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test167"/>
+    <DbUser value="mtp2_test204"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.167"/>
+    <Address value="192.168.31.204"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.167:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.204:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.167"/>
+    <HostName value="192.168.31.204"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.72"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test167"/>
-    <Username value="quote_test167"/>
+    <DBName value="historyquote_test204"/>
+    <Username value="quote_test204"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 16 - 0
controllers/presale/presale.go

@@ -25,3 +25,19 @@ func QueryPresaleAuctions(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryPresaleDefault
+// @Summary  查询转让详情
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    goodsid query    int true "商品ID"
+// @Success  200     {object} models.PresaleDefault
+// @Failure  500     {object} app.Response
+// @Router   /Presale/QueryPresaleDefault [get]
+// @Tags     预售
+func QueryPresaleDefault(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.PresaleDefault{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}

+ 81 - 2
docs/docs.go

@@ -14158,6 +14158,45 @@ const docTemplate = `{
                 }
             }
         },
+        "/Presale/QueryPresaleDefault": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "预售"
+                ],
+                "summary": "查询转让详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.PresaleDefault"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Qhj/QueryAccountInOutApply": {
             "get": {
                 "security": [
@@ -40318,7 +40357,7 @@ const docTemplate = `{
                 },
                 "relatedid": {
                     "description": "关联单号(交割单)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "retcode": {
                     "description": "错误代码",
@@ -42867,7 +42906,7 @@ const docTemplate = `{
                 },
                 "applyid": {
                     "description": "关联申请ID",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "attachmenturl": {
                     "description": "缩略图片(1:1)",
@@ -42999,6 +43038,46 @@ const docTemplate = `{
                 }
             }
         },
+        "models.PresaleDefault": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "SELLNAME": {
+                    "description": "客户名称(企业名称)",
+                    "type": "string"
+                },
+                "bannerpicurl": {
+                    "description": "Banner图(逗号分隔)(2:1)",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "期货合约ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)(宽:1125)",
+                    "type": "string"
+                },
+                "presaleprice": {
+                    "description": "发售价\\订货价(49)",
+                    "type": "number"
+                },
+                "transferdepositratio": {
+                    "description": "转让定金比例(49)",
+                    "type": "number"
+                }
+            }
+        },
         "models.PresaleGoods": {
             "type": "object",
             "properties": {

+ 81 - 2
docs/swagger.json

@@ -14149,6 +14149,45 @@
                 }
             }
         },
+        "/Presale/QueryPresaleDefault": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "预售"
+                ],
+                "summary": "查询转让详情",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.PresaleDefault"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Qhj/QueryAccountInOutApply": {
             "get": {
                 "security": [
@@ -40309,7 +40348,7 @@
                 },
                 "relatedid": {
                     "description": "关联单号(交割单)",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "retcode": {
                     "description": "错误代码",
@@ -42858,7 +42897,7 @@
                 },
                 "applyid": {
                     "description": "关联申请ID",
-                    "type": "integer"
+                    "type": "string"
                 },
                 "attachmenturl": {
                     "description": "缩略图片(1:1)",
@@ -42990,6 +43029,46 @@
                 }
             }
         },
+        "models.PresaleDefault": {
+            "type": "object",
+            "required": [
+                "goodsid"
+            ],
+            "properties": {
+                "SELLNAME": {
+                    "description": "客户名称(企业名称)",
+                    "type": "string"
+                },
+                "bannerpicurl": {
+                    "description": "Banner图(逗号分隔)(2:1)",
+                    "type": "string"
+                },
+                "goodscode": {
+                    "description": "期货合约代码(内部)",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "期货合约ID(自增ID SEQ_GOODS)",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "期货合约名称",
+                    "type": "string"
+                },
+                "pictureurls": {
+                    "description": "详情图片(逗号分隔)(宽:1125)",
+                    "type": "string"
+                },
+                "presaleprice": {
+                    "description": "发售价\\订货价(49)",
+                    "type": "number"
+                },
+                "transferdepositratio": {
+                    "description": "转让定金比例(49)",
+                    "type": "number"
+                }
+            }
+        },
         "models.PresaleGoods": {
             "type": "object",
             "properties": {

+ 55 - 2
docs/swagger.yaml

@@ -14341,7 +14341,7 @@ definitions:
         type: integer
       relatedid:
         description: 关联单号(交割单)
-        type: integer
+        type: string
       retcode:
         description: 错误代码
         type: integer
@@ -16194,7 +16194,7 @@ definitions:
         type: integer
       applyid:
         description: 关联申请ID
-        type: integer
+        type: string
       attachmenturl:
         description: 缩略图片(1:1)
         type: string
@@ -16294,6 +16294,35 @@ definitions:
     required:
     - presalemode
     type: object
+  models.PresaleDefault:
+    properties:
+      SELLNAME:
+        description: 客户名称(企业名称)
+        type: string
+      bannerpicurl:
+        description: Banner图(逗号分隔)(2:1)
+        type: string
+      goodscode:
+        description: 期货合约代码(内部)
+        type: string
+      goodsid:
+        description: 期货合约ID(自增ID SEQ_GOODS)
+        type: integer
+      goodsname:
+        description: 期货合约名称
+        type: string
+      pictureurls:
+        description: 详情图片(逗号分隔)(宽:1125)
+        type: string
+      presaleprice:
+        description: 发售价\订货价(49)
+        type: number
+      transferdepositratio:
+        description: 转让定金比例(49)
+        type: number
+    required:
+    - goodsid
+    type: object
   models.PresaleGoods:
     properties:
       accountid:
@@ -37430,6 +37459,30 @@ paths:
       summary: 查询预售竞拍列表
       tags:
       - 预售
+  /Presale/QueryPresaleDefault:
+    get:
+      parameters:
+      - description: 商品ID
+        in: query
+        name: goodsid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.PresaleDefault'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询转让详情
+      tags:
+      - 预售
   /Qhj/QueryAccountInOutApply:
     get:
       parameters:

+ 0 - 1
models/mine.go

@@ -151,7 +151,6 @@ func (r *MineTradePositionEx) buildSql() string {
 		tp.buyfrozenqty,
 		ui.customername        "SELLNAME",
 		g.presaleprice,
-		g.transferdepositratio,
 		to_char(g.lasttradedate, 'yyyy-mm-dd') LASTTRADEDATE,
 		tpe.accountid,
 		tpe.transferdepositratio,

+ 60 - 0
models/presale.go

@@ -1,6 +1,7 @@
 package models
 
 import (
+	"errors"
 	"mtp2_if/db"
 	"mtp2_if/utils"
 	"time"
@@ -121,3 +122,62 @@ func (r *PresaleAuction) GetDataByPage() (interface{}, error, int, int, int) {
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+// PresaleDefault 转让详情
+type PresaleDefault struct {
+	GOODSID              int32   `json:"goodsid" xorm:"GOODSID" form:"goodsid" binding:"required"` // 期货合约ID(自增ID SEQ_GOODS)
+	GOODSCODE            string  `json:"goodscode" xorm:"GOODSCODE"`                               // 期货合约代码(内部)
+	GOODSNAME            string  `json:"goodsname" xorm:"GOODSNAME"`                               // 期货合约名称
+	PRESALEPRICE         float64 `json:"presaleprice" xorm:"PRESALEPRICE"`                         // 发售价\订货价(49)
+	TRANSFERDEPOSITRATIO float64 `json:"transferdepositratio" xorm:"TRANSFERDEPOSITRATIO"`         // 转让定金比例(49)
+
+	BANNERPICURL string `json:"bannerpicurl" xorm:"BANNERPICURL"` // Banner图(逗号分隔)(2:1)
+	PICTUREURLS  string `json:"pictureurls" xorm:"PICTUREURLS"`   // 详情图片(逗号分隔)(宽:1125)
+
+	CUSTOMERNAME string `json:"SELLNAME" xorm:"CUSTOMERNAME"` // 客户名称(企业名称)
+}
+
+func (r *PresaleDefault) calc() {
+
+}
+
+func (r *PresaleDefault) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+       g.GOODSID,
+       g.GOODSCODE,
+       g.PRESALEPRICE,
+       g.TRANSFERDEPOSITRATIO,
+       cp.BANNERPICURL,
+       cp.PICTUREURLS,
+       ui.customername "SELLNAME"
+  from goods g
+  left join CPTrade_PresaleGoodsEx cp
+    on g.goodsid = cp.relatedgoodsid
+   and cp.presalestatus = 2
+ inner join userinfo ui
+    on g.provideruserid = ui.userid
+ where g.goodsid = %v
+	`
+	sqlId.FormatParam(r.GOODSID)
+
+	return sqlId.String()
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *PresaleDefault) GetDataEx() (interface{}, error) {
+	e := db.GetEngine()
+	s := e.SQL(r.buildSql())
+	sData := make([]PresaleDefault, 0)
+	if err := s.Find(&sData); err != nil {
+		return nil, err
+	}
+	// for i := range sData {
+	// 	sData[i].calc()
+	// }
+	if len(sData) > 0 {
+		return sData[0], nil
+	} else {
+		return nil, errors.New("无数据")
+	}
+}

+ 1 - 0
routers/router.go

@@ -761,6 +761,7 @@ func InitRouter() *gin.Engine {
 	presaleR.Use()
 	{
 		presaleR.Use(token.Auth()).GET("QueryPresaleAuctions", presale.QueryPresaleAuctions)
+		presaleR.Use(token.Auth()).GET("QueryPresaleDefault", presale.QueryPresaleDefault)
 	}
 
 	mineR := apiR.Group("Mine")