Kaynağa Gözat

1.增加查询品类要素定义项接口
2.修改查询履约计划问题
3.查行情大厅增加筛选条件

zou.yingbin 4 yıl önce
ebeveyn
işleme
126e9b420d
6 değiştirilmiş dosya ile 381 ekleme ve 34 silme
  1. 20 2
      controllers/wrTrade2/qryWrTrade.go
  2. 99 9
      docs/docs.go
  3. 99 9
      docs/swagger.json
  4. 68 7
      docs/swagger.yaml
  5. 94 7
      models/wrTrade2.go
  6. 1 0
      routers/router.go

+ 20 - 2
controllers/wrTrade2/qryWrTrade.go

@@ -14,6 +14,7 @@ import (
 
 // QueryOrderQuote
 // @Summary 查询大厅行情列表
+// @Description 仓单交易 wrfactortypeid 唯一确定1条记录, 仓单预售  wrfactortypeid + deliverymonth 唯一确定1条记录
 // @Produce json
 // @Security ApiKeyAuth
 // @Param page query int false "页码"
@@ -21,10 +22,11 @@ import (
 // @Param marketid query int false "仓单贸易市场id"
 // @Param wrpricetype query int true "价格方式 - 1:固定价 2-浮动价"
 // @Param haswr query int true "0:仓单预售 1:仓单贸易"
-// @Param wrstandardname query string false "商品名称(筛选条件)"
-// @Param brandname query string false "品牌名称(筛选条件)"
+// @Param dgitemname query string false "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm"
 // @Param warehouseid query int false "仓库id(筛选条件)"
 // @Param deliverygoodsid query int false "品种id"
+// @Param wrfactortypeid query int false "仓单要素id"
+// @Param deliverymonth query string false "交收月(yyyy-mm) 仓单预售填写"
 // @Success 200 {array} models.WrOrderQuote
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryOrderQuote [get]
@@ -275,3 +277,19 @@ func QueryFtDeliveryGoods(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryWrStandardFactoryItem
+// @Summary 查询品类要素定义项
+// @Produce json
+// @Security ApiKeyAuth
+// @Param wrstandardid query int true "品类id"
+// @Success 200 {array} models.WrStandardFactoryItemEx
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryWrStandardFactoryItem [get]
+// @Tags 仓单贸易v2
+func QueryWrStandardFactoryItem(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrStandardFactoryItemEx{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 99 - 9
docs/docs.go

@@ -11119,6 +11119,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "仓单交易 wrfactortypeid 唯一确定1条记录, 仓单预售  wrfactortypeid + deliverymonth 唯一确定1条记录",
                 "produces": [
                     "application/json"
                 ],
@@ -11161,14 +11162,8 @@ var doc = `{
                     },
                     {
                         "type": "string",
-                        "description": "商品名称(筛选条件)",
-                        "name": "wrstandardname",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "description": "品牌名称(筛选条件)",
-                        "name": "brandname",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
                         "in": "query"
                     },
                     {
@@ -11182,6 +11177,18 @@ var doc = `{
                         "description": "品种id",
                         "name": "deliverygoodsid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "交收月(yyyy-mm) 仓单预售填写",
+                        "name": "deliverymonth",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -11676,6 +11683,48 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryWrStandardFactoryItem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询品类要素定义项",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrStandardFactoryItemEx"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrTradeDetail": {
             "get": {
                 "security": [
@@ -30425,7 +30474,7 @@ var doc = `{
                     "type": "integer"
                 },
                 "createtime": {
-                    "description": "创建时间(开始时间)",
+                    "description": "创建时间",
                     "type": "string"
                 },
                 "creatorid": {
@@ -30556,6 +30605,10 @@ var doc = `{
                     "description": "发货备注[物流单号]",
                     "type": "string"
                 },
+                "starttime": {
+                    "description": "开始时间",
+                    "type": "string"
+                },
                 "userid": {
                     "description": "用户id",
                     "type": "integer"
@@ -30872,6 +30925,43 @@ var doc = `{
                 }
             }
         },
+        "models.WrStandardFactoryItem": {
+            "type": "object",
+            "properties": {
+                "dgfactoryitemid": {
+                    "description": "选择项id",
+                    "type": "integer"
+                },
+                "dgfactoryitemvalue": {
+                    "description": "要素项值",
+                    "type": "string"
+                }
+            }
+        },
+        "models.WrStandardFactoryItemEx": {
+            "type": "object",
+            "properties": {
+                "dgfactoryitemtypeid": {
+                    "description": "要素项类型id(1-999:预留为特殊类型 1:仓库 2:品牌)",
+                    "type": "integer"
+                },
+                "itemlst": {
+                    "description": "要素项列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrStandardFactoryItem"
+                    }
+                },
+                "itemtypename": {
+                    "description": "要素项类型名称",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "品类",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrTradeDetail": {
             "type": "object",
             "properties": {

+ 99 - 9
docs/swagger.json

@@ -11103,6 +11103,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "仓单交易 wrfactortypeid 唯一确定1条记录, 仓单预售  wrfactortypeid + deliverymonth 唯一确定1条记录",
                 "produces": [
                     "application/json"
                 ],
@@ -11145,14 +11146,8 @@
                     },
                     {
                         "type": "string",
-                        "description": "商品名称(筛选条件)",
-                        "name": "wrstandardname",
-                        "in": "query"
-                    },
-                    {
-                        "type": "string",
-                        "description": "品牌名称(筛选条件)",
-                        "name": "brandname",
+                        "description": "商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm",
+                        "name": "dgitemname",
                         "in": "query"
                     },
                     {
@@ -11166,6 +11161,18 @@
                         "description": "品种id",
                         "name": "deliverygoodsid",
                         "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "仓单要素id",
+                        "name": "wrfactortypeid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "交收月(yyyy-mm) 仓单预售填写",
+                        "name": "deliverymonth",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -11660,6 +11667,48 @@
                 }
             }
         },
+        "/WrTrade2/QueryWrStandardFactoryItem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询品类要素定义项",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "品类id",
+                        "name": "wrstandardid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrStandardFactoryItemEx"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryWrTradeDetail": {
             "get": {
                 "security": [
@@ -30409,7 +30458,7 @@
                     "type": "integer"
                 },
                 "createtime": {
-                    "description": "创建时间(开始时间)",
+                    "description": "创建时间",
                     "type": "string"
                 },
                 "creatorid": {
@@ -30540,6 +30589,10 @@
                     "description": "发货备注[物流单号]",
                     "type": "string"
                 },
+                "starttime": {
+                    "description": "开始时间",
+                    "type": "string"
+                },
                 "userid": {
                     "description": "用户id",
                     "type": "integer"
@@ -30856,6 +30909,43 @@
                 }
             }
         },
+        "models.WrStandardFactoryItem": {
+            "type": "object",
+            "properties": {
+                "dgfactoryitemid": {
+                    "description": "选择项id",
+                    "type": "integer"
+                },
+                "dgfactoryitemvalue": {
+                    "description": "要素项值",
+                    "type": "string"
+                }
+            }
+        },
+        "models.WrStandardFactoryItemEx": {
+            "type": "object",
+            "properties": {
+                "dgfactoryitemtypeid": {
+                    "description": "要素项类型id(1-999:预留为特殊类型 1:仓库 2:品牌)",
+                    "type": "integer"
+                },
+                "itemlst": {
+                    "description": "要素项列表",
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.WrStandardFactoryItem"
+                    }
+                },
+                "itemtypename": {
+                    "description": "要素项类型名称",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "品类",
+                    "type": "integer"
+                }
+            }
+        },
         "models.WrTradeDetail": {
             "type": "object",
             "properties": {

+ 68 - 7
docs/swagger.yaml

@@ -13921,7 +13921,7 @@ definitions:
         description: 合同ID
         type: integer
       createtime:
-        description: 创建时间(开始时间)
+        description: 创建时间
         type: string
       creatorid:
         description: 创建人
@@ -14021,6 +14021,9 @@ definitions:
       shipremark:
         description: 发货备注[物流单号]
         type: string
+      starttime:
+        description: 开始时间
+        type: string
       userid:
         description: 用户id
         type: integer
@@ -14259,6 +14262,32 @@ definitions:
         description: 商品
         type: string
     type: object
+  models.WrStandardFactoryItem:
+    properties:
+      dgfactoryitemid:
+        description: 选择项id
+        type: integer
+      dgfactoryitemvalue:
+        description: 要素项值
+        type: string
+    type: object
+  models.WrStandardFactoryItemEx:
+    properties:
+      dgfactoryitemtypeid:
+        description: 要素项类型id(1-999:预留为特殊类型 1:仓库 2:品牌)
+        type: integer
+      itemlst:
+        description: 要素项列表
+        items:
+          $ref: '#/definitions/models.WrStandardFactoryItem'
+        type: array
+      itemtypename:
+        description: 要素项类型名称
+        type: string
+      wrstandardid:
+        description: 品类
+        type: integer
+    type: object
   models.WrTradeDetail:
     properties:
       accountid:
@@ -23330,6 +23359,8 @@ paths:
       - 仓单贸易v2
   /WrTrade2/QueryOrderQuote:
     get:
+      description: 仓单交易 wrfactortypeid 唯一确定1条记录, 仓单预售  wrfactortypeid + deliverymonth
+        唯一确定1条记录
       parameters:
       - description: 页码
         in: query
@@ -23353,13 +23384,9 @@ paths:
         name: haswr
         required: true
         type: integer
-      - description: 商品名称(筛选条件)
-        in: query
-        name: wrstandardname
-        type: string
-      - description: 品牌名称(筛选条件)
+      - description: 商品要素项名称模糊匹配, 逗号隔开, 如 产地1,品牌1,规格12mm
         in: query
-        name: brandname
+        name: dgitemname
         type: string
       - description: 仓库id(筛选条件)
         in: query
@@ -23369,6 +23396,14 @@ paths:
         in: query
         name: deliverygoodsid
         type: integer
+      - description: 仓单要素id
+        in: query
+        name: wrfactortypeid
+        type: integer
+      - description: 交收月(yyyy-mm) 仓单预售填写
+        in: query
+        name: deliverymonth
+        type: string
       produces:
       - application/json
       responses:
@@ -23690,6 +23725,32 @@ paths:
       summary: 查询指定成交
       tags:
       - 仓单贸易v2
+  /WrTrade2/QueryWrStandardFactoryItem:
+    get:
+      parameters:
+      - description: 品类id
+        in: query
+        name: wrstandardid
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrStandardFactoryItemEx'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询品类要素定义项
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryWrTradeDetail:
     get:
       parameters:

+ 94 - 7
models/wrTrade2.go

@@ -125,6 +125,8 @@ func (r *WrOrderQuote) buildSqlFixedPrice() string {
 	param.And("t.haswr", r.HasWr)
 	param.And("t.wrpricetype", r.WrPriceType)
 	param.AndEx("t.marketid", r.MarketId, r.MarketId > 0)
+	param.AndEx("t.wrfactortypeid", r.WRFACTORTYPEID, len(r.WRFACTORTYPEID) > 0)
+	param.AndEx("t.deliverymonth", r.DELIVERYMONTH, len(r.DELIVERYMONTH) > 0)
 
 	param2.AndLike("w.wrfactortypename", r.WRSTANDARDNAME)
 	param2.AndLike("w.wrfactortypename", r.BRANDNAME)
@@ -1075,7 +1077,7 @@ type WrPerformancePlan struct {
 	BUYPAIDAMOUNT            float64 `json:"buypaidamount"  xorm:"BUYPAIDAMOUNT" form:"buypaidamount"`             // 买方已冻/已扣金额 (已付金额)
 	SELLACCOUNTID            int64   `json:"sellaccountid"  xorm:"SELLACCOUNTID" form:"sellaccountid"`             // 卖方账号
 	SELLRECEIVEDAMOUNT       float64 `json:"sellreceivedamount"  xorm:"SELLRECEIVEDAMOUNT"`                        // 卖方已收金额
-	CREATETIME               string  `json:"createtime"  xorm:"CREATETIME" form:"createtime"`                      // 创建时间(开始时间)
+	CREATETIME               string  `json:"createtime"  xorm:"CREATETIME" form:"createtime"`                      // 创建时间
 	CREATORID                int64   `json:"creatorid"  xorm:"CREATORID" form:"creatorid"`                         // 创建人
 	REMARK                   string  `json:"remark"  xorm:"REMARK" form:"remark"`                                  // 备注
 	BUYERFREEZEAMOUNT        float64 `json:"buyerfreezeamount"  xorm:"BUYERFREEZEAMOUNT"`                          // 履约冻结(买履约)
@@ -1094,6 +1096,7 @@ type WrPerformancePlan struct {
 	EXPRESSFEE               float64 `json:"expressfee"  xorm:"EXPRESSFEE" form:"expressfee"`                      // 运费
 	CONTRACTID               int64   `json:"contractid"  xorm:"CONTRACTID" form:"contractid"`                      // 合同ID
 	CURSTEPDEADLINE          string  `json:"curstepdeadline"  xorm:"CURSTEPDEADLINE" form:"curstepdeadline"`       // 当前步骤到期时间
+	STARTTIME                string  `json:"starttime"  xorm:"'STARTTIME'"`                                        // 开始时间
 	QTY                      float64 `json:"qty"  xorm:"QTY" form:"qty"`                                           // 履约数量
 	Wr2FactorType            `xorm:"extends"`
 
@@ -1132,8 +1135,7 @@ func (r *WrPerformancePlan) buildSql() string {
 		"      on t.warehouseid = h.autoid" +
 		"    left join enumdicitem e" +
 		"      on w.unitid = e.enumitemname" +
-		"     and e.enumdiccode = 'goodsunit'" +
-		")" +
+		"     and e.enumdiccode = 'goodsunit')" +
 		"select to_char(t.PERFORMANCEPLANID) PERFORMANCEPLANID," +
 		"       t.PERFORMANCETYPE," +
 		"       to_char(t.RELATEDORDERID) RELATEDORDERID," +
@@ -1173,6 +1175,7 @@ func (r *WrPerformancePlan) buildSql() string {
 		"       u1.accountname buyusername," +
 		"       u2.accountname sellusername," +
 		"       s.steptypename CURSTEPNAME," +
+		"       to_char(k.starttime, 'yyyy-mm-dd hh24:mi:ss') starttime," +
 		"       tmp.*" +
 		"  from performanceplan t" +
 		"  left join taaccount a1" +
@@ -1183,11 +1186,12 @@ func (r *WrPerformancePlan) buildSql() string {
 		"    on t.sellaccountid = a2.accountid" +
 		"  left join useraccount u2" +
 		"    on a2.userid = u2.userid" +
+		"  left join performancestep k on t.curstepid= k.performancestepid" +
 		"  left join performancesteptype s" +
-		"    on t.curstepid = s.steptypeid" +
-		"  left join performanceplanwr p on t.performanceplanid = p.performanceplanid" +
-		"  left join warehousereciept f on p.wrid= f.wrid" +
-		"  left join tmp on f.wrfactortypeid=tmp.wrfactortypeid" +
+		"    on k.steptypeid = s.steptypeid" +
+		"  left join performanceplanwr f on t.performanceplanid = f.performanceplanid" +
+		"  left join tmp" +
+		"    on f.wrfactortypeid = tmp.wrfactortypeid" +
 		" where 1 = 1"
 	if r.BUYORSELL == 0 {
 		sqlId.And("u1.userid", r.USERID)
@@ -1692,3 +1696,86 @@ func (r *WrFtDeliveryGoods) GetDataEx() (interface{}, error) {
 
 	return sData, err
 }
+
+// WrStandardFactoryItem 现货商品要素定义项
+type WrStandardFactoryItem struct {
+	WRSTANDARDID        int64  `json:"-"  xorm:"'WRSTANDARDID'" form:"wrstandardid"`    // 品类
+	DGFACTORYITEMTYPEID int64  `json:"-"  xorm:"'DGFACTORYITEMTYPEID'"`                 // 要素项类型id(1-999:预留为特殊类型 1:仓库 2:品牌)
+	ITEMTYPENAME        string `json:"-"  xorm:"'ITEMTYPENAME'"`                        // 要素项类型名称
+	DGFACTORYITEMID     int64  `json:"dgfactoryitemid"  xorm:"'DGFACTORYITEMID'"`       // 选择项id
+	DGFACTORYITEMVALUE  string `json:"dgfactoryitemvalue"  xorm:"'DGFACTORYITEMVALUE'"` // 要素项值
+}
+
+func (r *WrStandardFactoryItem) calc() {
+
+}
+
+func (r *WrStandardFactoryItem) buildSql() string {
+	var sqlId utils.SQLVal = "select t.wrstandardid," +
+		"       dp.dgfactoryitemtypeid," +
+		"       dp.itemtypename," +
+		"       di.dgfactoryitemid," +
+		"       di.dgfactoryitemvalue" +
+		"  from wrstandardfactoryitem t" +
+		" inner join wrstandard w" +
+		"    on t.wrstandardid = w.wrstandardid" +
+		" inner join dgfactoryitemtype dp" +
+		"    on t.dgfactoryitemtypeid = dp.dgfactoryitemtypeid" +
+		"   and dp.deliverygoodsid = w.deliverygoodsid" +
+		" inner join dgfactoryitem di" +
+		"    on t.dgfactoryitemid = di.dgfactoryitemid" +
+		"   and di.deliverygoodsid = w.deliverygoodsid" +
+		" where dp.isvalid = 1" +
+		"   and di.isvalid = 1"
+	sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
+	sqlId.Join(" order by t.dgfactoryitemtypeid, t.dgfactoryitemid")
+	return sqlId.String()
+}
+
+// GetDataEx 获取现货商品要素定义项
+func (r *WrStandardFactoryItem) GetDataEx() (interface{}, error) {
+	sData := make([]WrStandardFactoryItem, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}
+
+// WrStandardFactoryItemEx 现货商品要素定义项列表
+type WrStandardFactoryItemEx struct {
+	WRSTANDARDID        int64                   `json:"wrstandardid" form:"wrstandardid"` // 品类
+	DGFACTORYITEMTYPEID int64                   `json:"dgfactoryitemtypeid"`              // 要素项类型id(1-999:预留为特殊类型 1:仓库 2:品牌)
+	ITEMTYPENAME        string                  `json:"itemtypename"`                     // 要素项类型名称
+	ItemLst             []WrStandardFactoryItem `json:"itemlst"`                          // 要素项列表
+}
+
+// GetDataEx 获取现货商品要素定义项列表
+func (r *WrStandardFactoryItemEx) GetDataEx() (interface{}, error) {
+	sData := make([]WrStandardFactoryItemEx, 0)
+	m := WrStandardFactoryItem{WRSTANDARDID: r.WRSTANDARDID}
+	if d, err := m.GetDataEx(); err == nil {
+		if lst, ok := d.([]WrStandardFactoryItem); ok {
+			mapLst := map[int64]WrStandardFactoryItemEx{}
+			for _, v := range lst {
+				if a, ok := mapLst[v.DGFACTORYITEMTYPEID]; ok {
+					a.ItemLst = append(a.ItemLst, v)
+					mapLst[v.DGFACTORYITEMTYPEID] = a
+				} else {
+					val := WrStandardFactoryItemEx{
+						WRSTANDARDID:        v.WRSTANDARDID,
+						DGFACTORYITEMTYPEID: v.DGFACTORYITEMTYPEID,
+						ITEMTYPENAME:        v.ITEMTYPENAME,
+						ItemLst:             make([]WrStandardFactoryItem, 0),
+					}
+					val.ItemLst = append(val.ItemLst, v)
+					mapLst[v.DGFACTORYITEMTYPEID] = val
+				}
+			}
+			for _, ex := range mapLst {
+				sData = append(sData, ex)
+			}
+		}
+	}
+	return sData, nil
+}

+ 1 - 0
routers/router.go

@@ -532,6 +532,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrFactorTypeInfo", wrTrade2.QueryWrFactorTypeInfo)
 		wrTrade2R.GET("QueryWrMarketTradeConfig", wrTrade2.QueryWrMarketTradeConfig)
 		wrTrade2R.GET("QueryFtDeliveryGoods", wrTrade2.QueryFtDeliveryGoods)
+		wrTrade2R.GET("QueryWrStandardFactoryItem", wrTrade2.QueryWrStandardFactoryItem)
 	}
 
 	return r