Prechádzať zdrojové kódy

增加“查询交易系统转换设置”接口

Simon Zhou 5 rokov pred
rodič
commit
bb2baf474e
6 zmenil súbory, kde vykonal 378 pridanie a 0 odobranie
  1. 53 0
      controllers/szdz/szdz.go
  2. 112 0
      docs/docs.go
  3. 112 0
      docs/swagger.json
  4. 77 0
      docs/swagger.yaml
  5. 22 0
      models/szdzModels.go
  6. 2 0
      routers/router.go

+ 53 - 0
controllers/szdz/szdz.go

@@ -316,3 +316,56 @@ func SearchWhite(c *gin.Context) {
 	logger.GetLogger().Infof("SearchWhite successed: %v", datas)
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+// QueryConvertConfigReq 查询交易系统转换设置请求参数
+type QueryConvertConfigReq struct {
+	ConvertType    int    `form:"convertType"`    // 转换类型 - 1:金点赞转交易 2:金点拍转交易
+	OuterGoodsCode string `form:"outerGoodsCode"` // 外部商品代码[JD\PD]
+	InnerGoodsIDs  string `form:"innerGoodsIDs"`  // 内部商品ID列表[交易]
+}
+
+// QueryConvertConfig 查询交易系统转换设置
+// @Summary 查询交易系统转换设置
+// @Produce json
+// @Security ApiKeyAuth
+// @Param convertType query int false "转换类型 - 1:金点赞转交易 2:金点拍转交易"
+// @Param outerGoodsCode query string false "外部商品代码[JD\PD]"
+// @Param innerGoodsIDs query string false "内部商品ID列表[交易],格式:1,2,3"
+// @Success 200 {object} models.Szdz3convertconfig
+// @Failure 500 {object} app.Response
+// @Router /SZDZ/QueryConvertConfig [get]
+// @Tags 定制【尚志大宗】
+func QueryConvertConfig(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryConvertConfigReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryConvertConfigReq failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	datas := make([]models.Szdz3convertconfig, 0)
+	engine := db.GetEngine()
+	s := engine.Table("SZDZ3_CONVERTCONFIG")
+	if req.ConvertType > 0 {
+		s = s.And("CONVERTTYPE = ?", req.ConvertType)
+	}
+	if len(req.OuterGoodsCode) > 0 {
+		s = s.And("OUTERGOODSCODE = ?", req.OuterGoodsCode)
+	}
+	if len(req.InnerGoodsIDs) > 0 {
+		s = s.And(fmt.Sprintf("INNERGOODSID in (%s)", req.InnerGoodsIDs))
+	}
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryConvertConfigReq failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Infof("QueryConvertConfigReq successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 112 - 0
docs/docs.go

@@ -786,6 +786,56 @@ var doc = `{
                 }
             }
         },
+        "/SZDZ/QueryConvertConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "定制【尚志大宗】"
+                ],
+                "summary": "查询交易系统转换设置",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                        "name": "convertType",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "外部商品代码[JD\\PD]",
+                        "name": "outerGoodsCode",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "内部商品ID列表[交易],格式:1,2,3",
+                        "name": "innerGoodsIDs",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Szdz3convertconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/SZDZ/QueryConvertLog": {
             "get": {
                 "security": [
@@ -2688,6 +2738,68 @@ var doc = `{
                 }
             }
         },
+        "models.Szdz3convertconfig": {
+            "type": "object",
+            "required": [
+                "converttype",
+                "innergoodsid",
+                "outergoodscode"
+            ],
+            "properties": {
+                "converttype": {
+                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "daymaxvalue": {
+                    "description": "当日最大转入限制",
+                    "type": "number"
+                },
+                "innergoodsid": {
+                    "description": "内部商品ID[交易]",
+                    "type": "integer"
+                },
+                "inratio": {
+                    "description": "目标值",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "outergoodscode": {
+                    "description": "外部商品代码[JD\\PD]",
+                    "type": "string"
+                },
+                "outratio": {
+                    "description": "源值",
+                    "type": "integer"
+                },
+                "pddecimalplace": {
+                    "description": "PD小数位",
+                    "type": "integer"
+                },
+                "timemaxvalue": {
+                    "description": "单次最大转入限制",
+                    "type": "number"
+                },
+                "timeminvalue": {
+                    "description": "单次最小转入限制",
+                    "type": "number"
+                }
+            }
+        },
         "models.Szdz3searchwhitelist": {
             "type": "object",
             "required": [

+ 112 - 0
docs/swagger.json

@@ -770,6 +770,56 @@
                 }
             }
         },
+        "/SZDZ/QueryConvertConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "定制【尚志大宗】"
+                ],
+                "summary": "查询交易系统转换设置",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                        "name": "convertType",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "外部商品代码[JD\\PD]",
+                        "name": "outerGoodsCode",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "内部商品ID列表[交易],格式:1,2,3",
+                        "name": "innerGoodsIDs",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/models.Szdz3convertconfig"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/SZDZ/QueryConvertLog": {
             "get": {
                 "security": [
@@ -2672,6 +2722,68 @@
                 }
             }
         },
+        "models.Szdz3convertconfig": {
+            "type": "object",
+            "required": [
+                "converttype",
+                "innergoodsid",
+                "outergoodscode"
+            ],
+            "properties": {
+                "converttype": {
+                    "description": "转换类型 - 1:金点赞转交易 2:金点拍转交易",
+                    "type": "integer"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人",
+                    "type": "integer"
+                },
+                "daymaxvalue": {
+                    "description": "当日最大转入限制",
+                    "type": "number"
+                },
+                "innergoodsid": {
+                    "description": "内部商品ID[交易]",
+                    "type": "integer"
+                },
+                "inratio": {
+                    "description": "目标值",
+                    "type": "integer"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "outergoodscode": {
+                    "description": "外部商品代码[JD\\PD]",
+                    "type": "string"
+                },
+                "outratio": {
+                    "description": "源值",
+                    "type": "integer"
+                },
+                "pddecimalplace": {
+                    "description": "PD小数位",
+                    "type": "integer"
+                },
+                "timemaxvalue": {
+                    "description": "单次最大转入限制",
+                    "type": "number"
+                },
+                "timeminvalue": {
+                    "description": "单次最小转入限制",
+                    "type": "number"
+                }
+            }
+        },
         "models.Szdz3searchwhitelist": {
             "type": "object",
             "required": [

+ 77 - 0
docs/swagger.yaml

@@ -1188,6 +1188,52 @@ definitions:
     required:
     - spotcontractid
     type: object
+  models.Szdz3convertconfig:
+    properties:
+      converttype:
+        description: 转换类型 - 1:金点赞转交易 2:金点拍转交易
+        type: integer
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人
+        type: integer
+      daymaxvalue:
+        description: 当日最大转入限制
+        type: number
+      innergoodsid:
+        description: 内部商品ID[交易]
+        type: integer
+      inratio:
+        description: 目标值
+        type: integer
+      modifierid:
+        description: 修改人
+        type: integer
+      modifytime:
+        description: 修改时间
+        type: string
+      outergoodscode:
+        description: 外部商品代码[JD\PD]
+        type: string
+      outratio:
+        description: 源值
+        type: integer
+      pddecimalplace:
+        description: PD小数位
+        type: integer
+      timemaxvalue:
+        description: 单次最大转入限制
+        type: number
+      timeminvalue:
+        description: 单次最小转入限制
+        type: number
+    required:
+    - converttype
+    - innergoodsid
+    - outergoodscode
+    type: object
   models.Szdz3searchwhitelist:
     properties:
       createtime:
@@ -2316,6 +2362,37 @@ paths:
       summary: 持仓汇总查询(合约市场)
       tags:
       - 通用单据
+  /SZDZ/QueryConvertConfig:
+    get:
+      parameters:
+      - description: 转换类型 - 1:金点赞转交易 2:金点拍转交易
+        in: query
+        name: convertType
+        type: integer
+      - description: 外部商品代码[JD\PD]
+        in: query
+        name: outerGoodsCode
+        type: string
+      - description: 内部商品ID列表[交易],格式:1,2,3
+        in: query
+        name: innerGoodsIDs
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/models.Szdz3convertconfig'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询交易系统转换设置
+      tags:
+      - 定制【尚志大宗】
   /SZDZ/QueryConvertLog:
     get:
       parameters:

+ 22 - 0
models/szdzModels.go

@@ -77,3 +77,25 @@ type Szdz3searchwhitelist struct {
 func (Szdz3searchwhitelist) TableName() string {
 	return "SZDZ3_SEARCHWHITELIST"
 }
+
+// Szdz3convertconfig 交易系统转换设置表
+type Szdz3convertconfig struct {
+	Converttype    uint32    `json:"converttype"  xorm:"'CONVERTTYPE'" binding:"required"`       // 转换类型 - 1:金点赞转交易 2:金点拍转交易
+	Outergoodscode string    `json:"outergoodscode"  xorm:"'OUTERGOODSCODE'" binding:"required"` // 外部商品代码[JD\PD]
+	Innergoodsid   uint64    `json:"innergoodsid"  xorm:"'INNERGOODSID'" binding:"required"`     // 内部商品ID[交易]
+	Outratio       uint64    `json:"outratio"  xorm:"'OUTRATIO'"`                                // 源值
+	Inratio        uint64    `json:"inratio"  xorm:"'INRATIO'"`                                  // 目标值
+	Daymaxvalue    float64   `json:"daymaxvalue"  xorm:"'DAYMAXVALUE'"`                          // 当日最大转入限制
+	Timemaxvalue   float64   `json:"timemaxvalue"  xorm:"'TIMEMAXVALUE'"`                        // 单次最大转入限制
+	Timeminvalue   float64   `json:"timeminvalue"  xorm:"'TIMEMINVALUE'"`                        // 单次最小转入限制
+	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`                            // 创建时间
+	Creatorid      uint64    `json:"creatorid"  xorm:"'CREATORID'"`                              // 创建人
+	Modifierid     uint64    `json:"modifierid"  xorm:"'MODIFIERID'"`                            // 修改人
+	Modifytime     time.Time `json:"modifytime"  xorm:"'MODIFYTIME'"`                            // 修改时间
+	Pddecimalplace uint32    `json:"pddecimalplace"  xorm:"'PDDECIMALPLACE'"`                    // PD小数位
+}
+
+// TableName is SZDZ3_CONVERTCONFIG
+func (Szdz3convertconfig) TableName() string {
+	return "SZDZ3_CONVERTCONFIG"
+}

+ 2 - 0
routers/router.go

@@ -125,6 +125,8 @@ func InitRouter() *gin.Engine {
 		szdzR.GET("/QueryConvertLog", szdz.QueryConvertLog)
 		// 搜索白名单
 		szdzR.GET("/SearchWhite", szdz.SearchWhite)
+		// 查询交易系统转换设置
+		szdzR.GET("/QueryConvertConfig", szdz.QueryConvertConfig)
 	}
 
 	return r