Ver Fonte

查履约模板增加市场id参数

zou.yingbin há 4 anos atrás
pai
commit
558a02baaa
5 ficheiros alterados com 93 adições e 4 exclusões
  1. 3 0
      controllers/wrTrade2/qryWrTrade.go
  2. 23 1
      docs/docs.go
  3. 23 1
      docs/swagger.json
  4. 19 1
      docs/swagger.yaml
  5. 25 1
      models/wrTrade2.go

+ 3 - 0
controllers/wrTrade2/qryWrTrade.go

@@ -577,11 +577,13 @@ func QueryWrFriendApply(c *gin.Context) {
 // QueryPermancePlanTmp
 // @Summary 查询履约模板
 // @Description 返回指定用户的模板和公共模板(用户id为空)
+// @Description 注意:天津麦顿客户 填写marketid参数,其它参数不用填;其它客户不用填marketid字段
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int false "用户id"
 // @Param tmptype query string false "模板类型(逗号隔开), 0:通用 1:交割 2:仓单贸易 3:预售集采 7:竞拍-竞价式 8:竞拍-大宗式 9:荷兰式--失效枚举:4:竞拍-降价式 (无仓单) 5:挂牌期权  6:竞拍-降价式"
 // @Param includepub query int false "是否包含公共模板(用户id为空的) 1-包含"
+// @Param marketid query int false "市场id(天津麦顿指定此参数,其它不用)"
 // @Success 200 {array} models.WrPerformanceTemplateEx
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryPermancePlanTmp [get]
@@ -589,6 +591,7 @@ func QueryWrFriendApply(c *gin.Context) {
 func QueryPermancePlanTmp(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	m := models.WrPerformanceTemplateEx{}
+	m.MARKETID = -1
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }

+ 23 - 1
docs/docs.go

@@ -12586,7 +12586,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "返回指定用户的模板和公共模板(用户id为空)",
+                "description": "返回指定用户的模板和公共模板(用户id为空)\n注意:天津麦顿客户 填写marketid参数,其它参数不用填;其它客户不用填marketid字段",
                 "produces": [
                     "application/json"
                 ],
@@ -12612,6 +12612,12 @@ var doc = `{
                         "description": "是否包含公共模板(用户id为空的) 1-包含",
                         "name": "includepub",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "市场id(天津麦顿指定此参数,其它不用)",
+                        "name": "marketid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -32553,6 +32559,10 @@ var doc = `{
                     "description": "排序",
                     "type": "integer"
                 },
+                "pictureurl": {
+                    "description": "图片url, 规格(90*90)",
+                    "type": "string"
+                },
                 "remark": {
                     "description": "备注",
                     "type": "string"
@@ -35148,6 +35158,14 @@ var doc = `{
                     "description": "履约计划模板ID(无仓单) - 根据交货模式:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行",
                     "type": "integer"
                 },
+                "performancetempid2s": {
+                    "description": "履约计划模板IDs(无仓单) - 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行",
+                    "type": "string"
+                },
+                "performancetempids": {
+                    "description": "履约计划模板IDs(有仓单)- 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行(-1)",
+                    "type": "string"
+                },
                 "performanceway": {
                     "description": "交货模式 - 1:履约计划 2:分步履约 3:分步提货[文昌]",
                     "type": "integer"
@@ -35361,6 +35379,10 @@ var doc = `{
                     "description": "挂牌有效期",
                     "type": "string"
                 },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效",
+                    "type": "integer"
+                },
                 "warehouseid": {
                     "description": "仓库ID",
                     "type": "integer"

+ 23 - 1
docs/swagger.json

@@ -12570,7 +12570,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "返回指定用户的模板和公共模板(用户id为空)",
+                "description": "返回指定用户的模板和公共模板(用户id为空)\n注意:天津麦顿客户 填写marketid参数,其它参数不用填;其它客户不用填marketid字段",
                 "produces": [
                     "application/json"
                 ],
@@ -12596,6 +12596,12 @@
                         "description": "是否包含公共模板(用户id为空的) 1-包含",
                         "name": "includepub",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "市场id(天津麦顿指定此参数,其它不用)",
+                        "name": "marketid",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -32537,6 +32543,10 @@
                     "description": "排序",
                     "type": "integer"
                 },
+                "pictureurl": {
+                    "description": "图片url, 规格(90*90)",
+                    "type": "string"
+                },
                 "remark": {
                     "description": "备注",
                     "type": "string"
@@ -35132,6 +35142,14 @@
                     "description": "履约计划模板ID(无仓单) - 根据交货模式:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行",
                     "type": "integer"
                 },
+                "performancetempid2s": {
+                    "description": "履约计划模板IDs(无仓单) - 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行",
+                    "type": "string"
+                },
+                "performancetempids": {
+                    "description": "履约计划模板IDs(有仓单)- 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行(-1)",
+                    "type": "string"
+                },
                 "performanceway": {
                     "description": "交货模式 - 1:履约计划 2:分步履约 3:分步提货[文昌]",
                     "type": "integer"
@@ -35345,6 +35363,10 @@
                     "description": "挂牌有效期",
                     "type": "string"
                 },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效",
+                    "type": "integer"
+                },
                 "warehouseid": {
                     "description": "仓库ID",
                     "type": "integer"

+ 19 - 1
docs/swagger.yaml

@@ -13653,6 +13653,9 @@ definitions:
       orderindex:
         description: 排序
         type: integer
+      pictureurl:
+        description: 图片url, 规格(90*90)
+        type: string
       remark:
         description: 备注
         type: string
@@ -15572,6 +15575,12 @@ definitions:
       performancetempid2:
         description: 履约计划模板ID(无仓单) - 根据交货模式:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行
         type: integer
+      performancetempid2s:
+        description: 履约计划模板IDs(无仓单) - 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行
+        type: string
+      performancetempids:
+        description: 履约计划模板IDs(有仓单)- 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行(-1)
+        type: string
       performanceway:
         description: 交货模式 - 1:履约计划 2:分步履约 3:分步提货[文昌]
         type: integer
@@ -15731,6 +15740,9 @@ definitions:
       validtime:
         description: 挂牌有效期
         type: string
+      validtype:
+        description: 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效
+        type: integer
       warehouseid:
         description: 仓库ID
         type: integer
@@ -27089,7 +27101,9 @@ paths:
       - 仓单贸易v2
   /WrTrade2/QueryPermancePlanTmp:
     get:
-      description: 返回指定用户的模板和公共模板(用户id为空)
+      description: |-
+        返回指定用户的模板和公共模板(用户id为空)
+        注意:天津麦顿客户 填写marketid参数,其它参数不用填;其它客户不用填marketid字段
       parameters:
       - description: 用户id
         in: query
@@ -27103,6 +27117,10 @@ paths:
         in: query
         name: includepub
         type: integer
+      - description: 市场id(天津麦顿指定此参数,其它不用)
+        in: query
+        name: marketid
+        type: integer
       produces:
       - application/json
       responses:

+ 25 - 1
models/wrTrade2.go

@@ -2044,10 +2044,13 @@ type WrMarketTradeConfig struct {
 	SELLCHARGEALGORITHMVALUE4 float64 `json:"sellchargealgorithmvalue4"  xorm:"SELLCHARGEALGORITHMVALUE4" form:"sellchargealgorithmvalue4"` // 回购卖方手续费设置值(会员部分) --77:现货商城
 	BASISUPRATIO              float64 `json:"basisupratio"  xorm:"'BASISUPRATIO'"`                                                          // 浮动价基差上限比例(仓单贸易)
 	BASISDOWNRATIO            float64 `json:"basisdownratio"  xorm:"'BASISDOWNRATIO'"`                                                      // 浮动价基差下限比例(仓单贸易)
+	PERFORMANCETEMPIDS        string  `json:"performancetempids"  xorm:"PERFORMANCETEMPIDS"`                                                // 履约计划模板IDs(有仓单)- 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行(-1)
+	PERFORMANCETEMPID2S       string  `json:"performancetempid2s"  xorm:"PERFORMANCETEMPID2S"`                                              // 履约计划模板IDs(无仓单) - 根据交货模式, 多个逗号分隔:1:履约 - 履约计划模板2:分步履约 - 履约计划模板3:分步提货 - 履约方式: 立即执行
 }
 
 func (r *WrMarketTradeConfig) calc() {
-
+	r.PERFORMANCETEMPIDS = strings.Trim(r.PERFORMANCETEMPIDS, ",")
+	r.PERFORMANCETEMPID2S = strings.Trim(r.PERFORMANCETEMPID2S, ",")
 }
 
 func (r *WrMarketTradeConfig) buildSql() string {
@@ -3575,6 +3578,7 @@ type WrPerformanceTemplate struct {
 
 	FTTMPTYPE  string `json:"-" form:"tmptype"`    // 模板类型筛选
 	INCLUDEPUB int32  `json:"-" form:"includepub"` // 是否包含公共模板
+	MARKETID   int32  `json:"-" form:"marketid"`   // 市场ID-从市场配置表中指定的模板id查
 }
 
 func (r *WrPerformanceTemplate) calc() {
@@ -3604,6 +3608,26 @@ func (r *WrPerformanceTemplate) buildSql() string {
 	if r.FTTMPTYPE != "" {
 		sqlId.JoinFormat(" and t.TEMPLATETYPE in(%v)", r.FTTMPTYPE)
 	}
+	if r.MARKETID > 0 {
+		// 指定了市场, 从市场交易配置表中取履约模板id
+		m := WrMarketTradeConfig{MARKETID: r.MARKETID}
+		if d, err := m.GetDataEx(); err == nil {
+			if v, ok := d.([]WrMarketTradeConfig); ok {
+				a := v[0]
+				var inStr string
+				// 有仓单用 PERFORMANCETEMPIDS, 无仓单用PERFORMANCETEMPID2S,
+				// 这2个只会有一个有值, 所以只需取其中一个有值的即可
+				if len(a.PERFORMANCETEMPIDS) > 0 {
+					inStr = a.PERFORMANCETEMPIDS
+				} else if len(a.PERFORMANCETEMPID2S) > 0 {
+					inStr = a.PERFORMANCETEMPID2S
+				}
+				if len(v) > 0 {
+					sqlId.JoinFormat(" and t.autoid in(%v)", inStr)
+				}
+			}
+		}
+	}
 	sqlId.Join(" order by t.AUTOID")
 	return sqlId.String()
 }