Bläddra i källkod

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zhou.xiaoning 4 år sedan
förälder
incheckning
2095341b13

+ 12 - 7
controllers/ermcp3/qryErmcp3.go

@@ -91,12 +91,14 @@ func QueryMiddleGoodsDetail(c *gin.Context) {
 
 // QryContractReq 查询合同请求
 type QryContractReq struct {
-	AreadUserId  int64  `form:"userid"`       // 所属机构Id
-	CONTRACTTYPE int32  `form:"contracttype"` // 合同类型 1-采购, -1-销售
-	QUERYTYPE    int32  `form:"querytype"`    // 查询类型
-	USERID       int64  `form:"userid"`       // 用户Id
-	USERTYPE     int32  `form:"usertype"`     // 用户类型
-	CONTRACTID   string `form:"contractid"`   // 合同ID(SpotContractId)
+	AreadUserId    int64  `form:"userid"`         // 所属机构Id
+	CONTRACTTYPE   int32  `form:"contracttype"`   // 合同类型 1-采购, -1-销售
+	QUERYTYPE      int32  `form:"querytype"`      // 查询类型
+	USERID         int64  `form:"userid"`         // 用户Id
+	USERTYPE       int32  `form:"usertype"`       // 用户类型
+	CONTRACTID     string `form:"contractid"`     // 合同ID(SpotContractId)
+	CONTRACTNO     string `form:"contractno"`     // 现货合同编号
+	WRSTANDARDNAME string `form:"wrstandardname"` // 品类名称
 }
 
 // QuerySpotContract
@@ -108,6 +110,8 @@ type QryContractReq struct {
 // @Param contracttype query int false "合同类型 1-采购, -1-销售"
 // @Param querytype query int true "查询类型 1-未提交 2-待审核 3-履约中 4-已完成 (当指定contractid, querytype可不填)"
 // @Param contractid query string false "合同ID(SpotContractId)"
+// @Param contractno query string false "合同编号(模糊匹配)"
+// @Param wrstandardname query string false "商品名称(模糊匹配)"
 // @Success 200 {array} models.Ermcp3Contract
 // @Failure 500 {object} app.Response
 // @Router /Ermcp3/QuerySpotContract [get]
@@ -118,7 +122,8 @@ func QuerySpotContract(c *gin.Context) {
 	a.DoBindReq(&req)
 	m := models.Ermcp3Contract{USERID: mtpcache.GetAreaUserId(req.USERID, req.USERTYPE),
 		QryType: req.QUERYTYPE, CONTRACTTYPE: req.CONTRACTTYPE,
-		OwnUserId: req.USERID, UserType: req.USERTYPE, SPOTCONTRACTID: req.CONTRACTID}
+		OwnUserId: req.USERID, UserType: req.USERTYPE, SPOTCONTRACTID: req.CONTRACTID,
+		CONTRACTNO: req.CONTRACTNO, WRSTANDARDNAME: req.WRSTANDARDNAME}
 	a.DoGetDataI(&m)
 }
 

+ 2 - 0
controllers/other/update.go

@@ -9,6 +9,7 @@ package other
 
 import (
 	"github.com/gin-gonic/gin"
+	"mtp2_if/logger"
 	"net/http"
 	"os"
 	"os/exec"
@@ -30,6 +31,7 @@ func MakeUpdateScript(c *gin.Context) {
 		c.String(http.StatusOK, "windows不支持, 仅支持linux下执行")
 		return
 	}
+	logger.GetLogger().Debug("*********************auto update*******************************")
 	IsUpdateing = true
 	defer func() {
 		IsUpdateing = false

+ 3 - 3
controllers/quote/history.go

@@ -121,7 +121,7 @@ func QueryHistoryDatas(c *gin.Context) {
 	}
 
 	// 查询成功
-	logger.GetLogger().Debugln("QueryHistoryDatas successed: %v", rst)
+	logger.GetLogger().Debugln("QueryHistoryDatas successed, rows:%v", len(rst))
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
 
@@ -236,7 +236,7 @@ func QueryHistoryTikDatas(c *gin.Context) {
 	}
 
 	// 查询成功
-	logger.GetLogger().Debugln("QueryHistoryTikDatas successed: %v", rst)
+	logger.GetLogger().Debugln("QueryHistoryTikDatas successed, rows: %v", len(rst))
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
 
@@ -693,7 +693,7 @@ func QueryTSData(c *gin.Context) {
 	}
 
 	// 查询成功
-	logger.GetLogger().Debugln("QueryTSData successed: %v", queryTSDataRsp)
+	logger.GetLogger().Debugln("QueryTSData successed.")
 	appG.Response(http.StatusOK, e.SUCCESS, queryTSDataRsp)
 }
 

+ 38 - 37
controllers/quote/quote.go

@@ -6,6 +6,7 @@ import (
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
 	"mtp2_if/models"
+	"mtp2_if/mtpcache"
 	"mtp2_if/utils"
 	"net/http"
 	"strings"
@@ -178,54 +179,54 @@ func QueryQuoteDay(c *gin.Context) {
 	}
 	for _, v := range quoteDays {
 		// 获取对应的商品信息
-		goods, _ := models.GetGoodsByGoodsCode(v.Goodscode)
-		if goods != nil {
+		goods, bFind := mtpcache.GetGoods(v.Goodscode)
+		if bFind {
 			rsp = append(rsp, QueryQuoteDayRsp{
 				Exchangedate:         v.Exchangedate,
 				Goodscode:            v.Goodscode,
 				Exchangecode:         v.Exchangecode,
-				Preclose:             utils.IntToFloat64(int(v.Preclose), int(goods.Decimalplace)),
+				Preclose:             utils.IntToFloat64(int(v.Preclose), int(goods.DECIMALPLACE)),
 				Opentime:             time.Unix(int64(v.Opentime), 0),
-				Opened:               utils.IntToFloat64(int(v.Opened), int(goods.Decimalplace)),
-				Highest:              utils.IntToFloat64(int(v.Highest), int(goods.Decimalplace)),
-				Lowest:               utils.IntToFloat64(int(v.Lowest), int(goods.Decimalplace)),
+				Opened:               utils.IntToFloat64(int(v.Opened), int(goods.DECIMALPLACE)),
+				Highest:              utils.IntToFloat64(int(v.Highest), int(goods.DECIMALPLACE)),
+				Lowest:               utils.IntToFloat64(int(v.Lowest), int(goods.DECIMALPLACE)),
 				Lasttime:             v.Lasttime,
 				Utclasttime:          time.Unix(int64(v.Utclasttime), 0),
-				Last:                 utils.IntToFloat64(int(v.Last), int(goods.Decimalplace)),
+				Last:                 utils.IntToFloat64(int(v.Last), int(goods.DECIMALPLACE)),
 				Lastvolume:           v.Lastvolume,
 				Lastturnover:         float64(v.Lastturnover),
 				Totalbidvolume:       v.Totalbidvolume,
 				Totalaskvolume:       v.Totalaskvolume,
 				Totalvolume:          v.Totalvolume,
 				Totalturnover:        float64(v.Totalturnover),
-				Bid:                  utils.IntToFloat64(int(v.Bid), int(goods.Decimalplace)),
-				Bid2:                 utils.IntToFloat64(int(v.Bid2), int(goods.Decimalplace)),
-				Bid3:                 utils.IntToFloat64(int(v.Bid3), int(goods.Decimalplace)),
-				Bid4:                 utils.IntToFloat64(int(v.Bid4), int(goods.Decimalplace)),
-				Bid5:                 utils.IntToFloat64(int(v.Bid5), int(goods.Decimalplace)),
+				Bid:                  utils.IntToFloat64(int(v.Bid), int(goods.DECIMALPLACE)),
+				Bid2:                 utils.IntToFloat64(int(v.Bid2), int(goods.DECIMALPLACE)),
+				Bid3:                 utils.IntToFloat64(int(v.Bid3), int(goods.DECIMALPLACE)),
+				Bid4:                 utils.IntToFloat64(int(v.Bid4), int(goods.DECIMALPLACE)),
+				Bid5:                 utils.IntToFloat64(int(v.Bid5), int(goods.DECIMALPLACE)),
 				Bidvolume:            v.Bidvolume,
 				Bidvolume2:           v.Bidvolume2,
 				Bidvolume3:           v.Bidvolume3,
 				Bidvolume4:           v.Bidvolume4,
 				Bidvolume5:           v.Bidvolume5,
-				Ask:                  utils.IntToFloat64(int(v.Ask), int(goods.Decimalplace)),
-				Ask2:                 utils.IntToFloat64(int(v.Ask2), int(goods.Decimalplace)),
-				Ask3:                 utils.IntToFloat64(int(v.Ask3), int(goods.Decimalplace)),
-				Ask4:                 utils.IntToFloat64(int(v.Ask4), int(goods.Decimalplace)),
-				Ask5:                 utils.IntToFloat64(int(v.Ask5), int(goods.Decimalplace)),
+				Ask:                  utils.IntToFloat64(int(v.Ask), int(goods.DECIMALPLACE)),
+				Ask2:                 utils.IntToFloat64(int(v.Ask2), int(goods.DECIMALPLACE)),
+				Ask3:                 utils.IntToFloat64(int(v.Ask3), int(goods.DECIMALPLACE)),
+				Ask4:                 utils.IntToFloat64(int(v.Ask4), int(goods.DECIMALPLACE)),
+				Ask5:                 utils.IntToFloat64(int(v.Ask5), int(goods.DECIMALPLACE)),
 				Askvolume:            v.Askvolume,
 				Askvolume2:           v.Askvolume2,
 				Askvolume3:           v.Askvolume3,
 				Askvolume4:           v.Askvolume4,
 				Askvolume5:           v.Askvolume5,
-				Presettle:            utils.IntToFloat64(int(v.Presettle), int(goods.Decimalplace)),
-				Settle:               utils.IntToFloat64(int(v.Settle), int(goods.Decimalplace)),
+				Presettle:            utils.IntToFloat64(int(v.Presettle), int(goods.DECIMALPLACE)),
+				Settle:               utils.IntToFloat64(int(v.Settle), int(goods.DECIMALPLACE)),
 				Preholdvolume:        v.Preholdvolume,
 				Holdvolume:           v.Holdvolume,
-				Averageprice:         utils.IntToFloat64(int(v.Averageprice), int(goods.Decimalplace)),
+				Averageprice:         utils.IntToFloat64(int(v.Averageprice), int(goods.DECIMALPLACE)),
 				Orderid:              v.Orderid,
-				Limitup:              utils.IntToFloat64(int(v.Limitup), int(goods.Decimalplace)),
-				Limitdown:            utils.IntToFloat64(int(v.Limitdown), int(goods.Decimalplace)),
+				Limitup:              utils.IntToFloat64(int(v.Limitup), int(goods.DECIMALPLACE)),
+				Limitdown:            utils.IntToFloat64(int(v.Limitdown), int(goods.DECIMALPLACE)),
 				Inventory:            v.Inventory,
 				Holdincrement:        v.Holdincrement,
 				Iscleared:            v.Iscleared,
@@ -244,7 +245,7 @@ func QueryQuoteDay(c *gin.Context) {
 				Askorderid5:          v.Askorderid5,
 				Lastlot:              v.Lastlot,
 				Totallot:             v.Totallot,
-				Strikeprice:          utils.IntToFloat64(int(v.Strikeprice), int(goods.Decimalplace)),
+				Strikeprice:          utils.IntToFloat64(int(v.Strikeprice), int(goods.DECIMALPLACE)),
 				Cleartime:            v.Cleartime,
 				Calloptionpremiums:   v.Calloptionpremiums,
 				Calloptionpremiums2:  v.Calloptionpremiums2,
@@ -261,24 +262,24 @@ func QueryQuoteDay(c *gin.Context) {
 				Nontotalturnover:     v.Nontotalturnover,
 				Nontotallot:          v.Nontotallot,
 				Publictradetype:      v.Publictradetype,
-				Iep:                  utils.IntToFloat64(int(v.Iep), int(goods.Decimalplace)),
-				Iev:                  utils.IntToFloat64(int(v.Iev), int(goods.Decimalplace)),
-				Grepmarketprice:      utils.IntToFloat64(int(v.Grepmarketprice), int(goods.Decimalplace)),
-				Bid6:                 utils.IntToFloat64(int(v.Bid6), int(goods.Decimalplace)),
-				Bid7:                 utils.IntToFloat64(int(v.Bid7), int(goods.Decimalplace)),
-				Bid8:                 utils.IntToFloat64(int(v.Bid8), int(goods.Decimalplace)),
-				Bid9:                 utils.IntToFloat64(int(v.Bid9), int(goods.Decimalplace)),
-				Bid10:                utils.IntToFloat64(int(v.Bid10), int(goods.Decimalplace)),
+				Iep:                  utils.IntToFloat64(int(v.Iep), int(goods.DECIMALPLACE)),
+				Iev:                  utils.IntToFloat64(int(v.Iev), int(goods.DECIMALPLACE)),
+				Grepmarketprice:      utils.IntToFloat64(int(v.Grepmarketprice), int(goods.DECIMALPLACE)),
+				Bid6:                 utils.IntToFloat64(int(v.Bid6), int(goods.DECIMALPLACE)),
+				Bid7:                 utils.IntToFloat64(int(v.Bid7), int(goods.DECIMALPLACE)),
+				Bid8:                 utils.IntToFloat64(int(v.Bid8), int(goods.DECIMALPLACE)),
+				Bid9:                 utils.IntToFloat64(int(v.Bid9), int(goods.DECIMALPLACE)),
+				Bid10:                utils.IntToFloat64(int(v.Bid10), int(goods.DECIMALPLACE)),
 				Bidvolume6:           v.Bidvolume6,
 				Bidvolume7:           v.Bidvolume7,
 				Bidvolume8:           v.Bidvolume8,
 				Bidvolume9:           v.Bidvolume9,
 				Bidvolume10:          v.Bidvolume10,
-				Ask6:                 utils.IntToFloat64(int(v.Ask6), int(goods.Decimalplace)),
-				Ask7:                 utils.IntToFloat64(int(v.Ask7), int(goods.Decimalplace)),
-				Ask8:                 utils.IntToFloat64(int(v.Ask8), int(goods.Decimalplace)),
-				Ask9:                 utils.IntToFloat64(int(v.Ask9), int(goods.Decimalplace)),
-				Ask10:                utils.IntToFloat64(int(v.Ask10), int(goods.Decimalplace)),
+				Ask6:                 utils.IntToFloat64(int(v.Ask6), int(goods.DECIMALPLACE)),
+				Ask7:                 utils.IntToFloat64(int(v.Ask7), int(goods.DECIMALPLACE)),
+				Ask8:                 utils.IntToFloat64(int(v.Ask8), int(goods.DECIMALPLACE)),
+				Ask9:                 utils.IntToFloat64(int(v.Ask9), int(goods.DECIMALPLACE)),
+				Ask10:                utils.IntToFloat64(int(v.Ask10), int(goods.DECIMALPLACE)),
 				Askvolume6:           v.Askvolume6,
 				Askvolume7:           v.Askvolume7,
 				Askvolume8:           v.Askvolume8,
@@ -309,6 +310,6 @@ func QueryQuoteDay(c *gin.Context) {
 	}
 
 	// 查询成功
-	logger.GetLogger().Debugln("QueryQuoteDay successed: %v", rsp)
+	logger.GetLogger().Debugln("QueryQuoteDay successed, rows: %v", len(rsp))
 	appG.Response(http.StatusOK, e.SUCCESS, rsp)
 }

+ 12 - 0
docs/docs.go

@@ -5164,6 +5164,18 @@ var doc = `{
                         "description": "合同ID(SpotContractId)",
                         "name": "contractid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "合同编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品名称(模糊匹配)",
+                        "name": "wrstandardname",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 12 - 0
docs/swagger.json

@@ -5148,6 +5148,18 @@
                         "description": "合同ID(SpotContractId)",
                         "name": "contractid",
                         "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "合同编号(模糊匹配)",
+                        "name": "contractno",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品名称(模糊匹配)",
+                        "name": "wrstandardname",
+                        "in": "query"
                     }
                 ],
                 "responses": {

+ 8 - 0
docs/swagger.yaml

@@ -22029,6 +22029,14 @@ paths:
         in: query
         name: contractid
         type: string
+      - description: 合同编号(模糊匹配)
+        in: query
+        name: contractno
+        type: string
+      - description: 商品名称(模糊匹配)
+        in: query
+        name: wrstandardname
+        type: string
       produces:
       - application/json
       responses:

+ 58 - 52
models/ermcp3.go

@@ -599,57 +599,57 @@ func (r *Ermcp3GoodsEx) GetDataEx() (interface{}, error) {
 
 // Ermcp3Contract 现货合同
 type Ermcp3Contract struct {
-	SPOTCONTRACTID    string  `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'"`       // 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
-	CONTRACTNO        string  `json:"contractno"  xorm:"'CONTRACTNO'"`               // 现货合同编号
-	CONTRACTTYPE      int32   `json:"contracttype"  xorm:"'CONTRACTTYPE'"`           // 现货合同类型 - 1:采购 -1:销售
-	USERID            int64   `json:"userid"  xorm:"'USERID'"`                       // 所属机构ID
-	BUYUSERID         int64   `json:"buyuserid"  xorm:"'BUYUSERID'"`                 // 采购方ID
-	BUYUSERName       string  `json:"buyusername"  xorm:"'BUYUSERName'"`             // 采购方名称
-	SELLUSERID        int64   `json:"selluserid"  xorm:"'SELLUSERID'"`               // 销售方ID
-	SELLUSERNAME      string  `json:"sellusername"  xorm:"'SELLUSERNAME'"`           // 销售方名称
-	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`     // 现货品种ID
-	WRSTANDARDID      int32   `json:"wrstandardid"  xorm:"'wrstandardid'"`           // 品类ID
-	WRSTANDARDNAME    string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'"`       // 品类名称
-	WRSTANDARDCODE    string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`       // 品类代码
-	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"` // 现货品种代码
-	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"` // 现货品种名称
-	PRODUCTTYPE       int32   `json:"producttype"  xorm:"'PRODUCTTYPE'"`             // 产品类型 - 1:标准仓单 2:等标 3:非标
-	CONVERTFACTOR     float64 `json:"convertfactor"  xorm:"'CONVERTFACTOR'"`         // 标仓系数(品类)
-	SPOTGOODSDESC     string  `json:"spotgoodsdesc"  xorm:"'SPOTGOODSDESC'"`         // 商品型号
-	PRICETYPE         int32   `json:"pricetype"  xorm:"'PRICETYPE'"`                 // 定价类型 - 1:一口价 2:点价 3:暂定价
-	QTY               float64 `json:"qty"  xorm:"'QTY'"`                             // 数量
-	PRICE             float64 `json:"price"  xorm:"'PRICE'"`                         // 价格\暂定价 [1:一口价、3:暂定价]
-	AMOUNT            float64 `json:"amount"  xorm:"'AMOUNT'"`                       // 金额 [1:一口价、3:暂定价]
-	DELIVERYSTARTDATE string  `json:"deliverystartdate"  xorm:"'DELIVERYSTARTDATE'"` // 交收期(开始)
-	DELIVERYENDDATE   string  `json:"deliveryenddate"  xorm:"'DELIVERYENDDATE'"`     // 交收期(结束)
-	GOODSID           int32   `json:"goodsid"  xorm:"'GOODSID'"`                     // 点价合约ID - 0:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
-	GOODSCODE         string  `json:"goodscode"  xorm:"'GOODSCODE'"`                 // 点价合约代码
-	GOODSNAME         string  `json:"goodsname"  xorm:"'GOODSNAME'"`                 // 点价商品名称
-	PRICEMOVE         float64 `json:"pricemove"  xorm:"'PRICEMOVE'"`                 // 升贴水 [2:点价 3:暂定价]
-	STARTDATE         string  `json:"startdate"  xorm:"'STARTDATE'"`                 // 点价开始日期 [2:点价 3:暂定价]
-	ENDDATE           string  `json:"enddate"  xorm:"'ENDDATE'"`                     // 点价结束日期 [2:点价 3:暂定价]
-	MARGIN            float64 `json:"margin"  xorm:"'MARGIN'"`                       // 当前保证金
-	CONTRACTMARGIN    float64 `json:"contractmargin"  xorm:"'CONTRACTMARGIN'"`       // 合同保证金
-	EnumdicName       string  `json:"enumdicname"  xorm:"'ENUMDICNAME'"`             // 单位名称
-	CONTRACCTSTATUS   int32   `json:"contracctstatus"  xorm:"'CONTRACTSTATUS'"`      // 合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
-	Remark            string  `json:"remark"  xorm:"'Remark'"`                       // 备注
-	AUDITREMARK       string  `json:"auditremark"  xorm:"'AUDITREMARK'"`             // 审核意见
-	AUDITTIME         string  `json:"audittime"  xorm:"'AUDITTIME'"`                 // 审核时间
-	CREATETIME        string  `json:"createtime"  xorm:"'CREATETIME'"`               // 创建时间
-	UPDATETIME        string  `json:"updatetime"  xorm:"'UPDATETIME'"`               // 更新时间
-	SPOTGOODSBRANDID  int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`   // 现货品牌ID(DGFactoryItem表的ID)
-	BRANDNAME         string  `json:"brandname"  xorm:"'brandname'"`                 // 品牌名称
-	ATTACHMENT        string  `json:"attachment"  xorm:"'ATTACHMENT'"`               // 附件
-	UNITID            int32   `json:"unitid"  xorm:"'UNITID'"`                       // 单位id(取品类上的单位id)
-	TRADEUSERID       int64   `json:"tradeuserid"  xorm:"'TRADEUSERID'"`             // 交易员id
-	SALEUSERID        int64   `json:"saleuserid"  xorm:"'SALEUSERID'"`               // 业务员id
-	MERUSERID         int64   `json:"meruserid"  xorm:"'MERUSERID'"`                 // 跟单员id
-	ACCOUNTID         string  `json:"accountid"  xorm:"'ACCOUNTID'"`                 // 期货账户id
-	BIZTYPE           int32   `json:"biztype"  xorm:"'BIZTYPE'"`                     // 业务类型 1-套保 2-套利
-	CURRENCYID        int32   `json:"currencyid"  xorm:"'CURRENCYID'"`               // 币种id
-	SUBJECTID         string  `json:"subjectid"  xorm:"'SUBJECTID'"`                 // 交易主体ID
-	SUBJECTNAME       string  `json:"subjectname"  xorm:"'SUBJECTNAME'"`             // 交易主体名称
-	VATRATE           float64 `json:"vatrate"  xorm:"'VATRATE'"`                     // 增值税率
+	SPOTCONTRACTID    string  `json:"spotcontractid"  xorm:"'SPOTCONTRACTID'"`                       // 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
+	CONTRACTNO        string  `json:"contractno"  xorm:"'CONTRACTNO'" form:"contractno"`             // 现货合同编号
+	CONTRACTTYPE      int32   `json:"contracttype"  xorm:"'CONTRACTTYPE'"`                           // 现货合同类型 - 1:采购 -1:销售
+	USERID            int64   `json:"userid"  xorm:"'USERID'"`                                       // 所属机构ID
+	BUYUSERID         int64   `json:"buyuserid"  xorm:"'BUYUSERID'"`                                 // 采购方ID
+	BUYUSERName       string  `json:"buyusername"  xorm:"'BUYUSERName'"`                             // 采购方名称
+	SELLUSERID        int64   `json:"selluserid"  xorm:"'SELLUSERID'"`                               // 销售方ID
+	SELLUSERNAME      string  `json:"sellusername"  xorm:"'SELLUSERNAME'"`                           // 销售方名称
+	DELIVERYGOODSID   int32   `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`                     // 现货品种ID
+	WRSTANDARDID      int32   `json:"wrstandardid"  xorm:"'wrstandardid'"`                           // 品类ID
+	WRSTANDARDNAME    string  `json:"wrstandardname"  xorm:"'WRSTANDARDNAME'" form:"wrstandardname"` // 品类名称
+	WRSTANDARDCODE    string  `json:"wrstandardcode"  xorm:"'WRSTANDARDCODE'"`                       // 品类代码
+	DELIVERYGOODSCODE string  `json:"deliverygoodscode"  xorm:"'DELIVERYGOODSCODE'"`                 // 现货品种代码
+	DELIVERYGOODSNAME string  `json:"deliverygoodsname"  xorm:"'DELIVERYGOODSNAME'"`                 // 现货品种名称
+	PRODUCTTYPE       int32   `json:"producttype"  xorm:"'PRODUCTTYPE'"`                             // 产品类型 - 1:标准仓单 2:等标 3:非标
+	CONVERTFACTOR     float64 `json:"convertfactor"  xorm:"'CONVERTFACTOR'"`                         // 标仓系数(品类)
+	SPOTGOODSDESC     string  `json:"spotgoodsdesc"  xorm:"'SPOTGOODSDESC'"`                         // 商品型号
+	PRICETYPE         int32   `json:"pricetype"  xorm:"'PRICETYPE'"`                                 // 定价类型 - 1:一口价 2:点价 3:暂定价
+	QTY               float64 `json:"qty"  xorm:"'QTY'"`                                             // 数量
+	PRICE             float64 `json:"price"  xorm:"'PRICE'"`                                         // 价格\暂定价 [1:一口价、3:暂定价]
+	AMOUNT            float64 `json:"amount"  xorm:"'AMOUNT'"`                                       // 金额 [1:一口价、3:暂定价]
+	DELIVERYSTARTDATE string  `json:"deliverystartdate"  xorm:"'DELIVERYSTARTDATE'"`                 // 交收期(开始)
+	DELIVERYENDDATE   string  `json:"deliveryenddate"  xorm:"'DELIVERYENDDATE'"`                     // 交收期(结束)
+	GOODSID           int32   `json:"goodsid"  xorm:"'GOODSID'"`                                     // 点价合约ID - 0:为现货,其它为期货商品合约ID [2:点价 3:暂定价]
+	GOODSCODE         string  `json:"goodscode"  xorm:"'GOODSCODE'"`                                 // 点价合约代码
+	GOODSNAME         string  `json:"goodsname"  xorm:"'GOODSNAME'"`                                 // 点价商品名称
+	PRICEMOVE         float64 `json:"pricemove"  xorm:"'PRICEMOVE'"`                                 // 升贴水 [2:点价 3:暂定价]
+	STARTDATE         string  `json:"startdate"  xorm:"'STARTDATE'"`                                 // 点价开始日期 [2:点价 3:暂定价]
+	ENDDATE           string  `json:"enddate"  xorm:"'ENDDATE'"`                                     // 点价结束日期 [2:点价 3:暂定价]
+	MARGIN            float64 `json:"margin"  xorm:"'MARGIN'"`                                       // 当前保证金
+	CONTRACTMARGIN    float64 `json:"contractmargin"  xorm:"'CONTRACTMARGIN'"`                       // 合同保证金
+	EnumdicName       string  `json:"enumdicname"  xorm:"'ENUMDICNAME'"`                             // 单位名称
+	CONTRACCTSTATUS   int32   `json:"contracctstatus"  xorm:"'CONTRACTSTATUS'"`                      // 合同状态 - 0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
+	Remark            string  `json:"remark"  xorm:"'Remark'"`                                       // 备注
+	AUDITREMARK       string  `json:"auditremark"  xorm:"'AUDITREMARK'"`                             // 审核意见
+	AUDITTIME         string  `json:"audittime"  xorm:"'AUDITTIME'"`                                 // 审核时间
+	CREATETIME        string  `json:"createtime"  xorm:"'CREATETIME'"`                               // 创建时间
+	UPDATETIME        string  `json:"updatetime"  xorm:"'UPDATETIME'"`                               // 更新时间
+	SPOTGOODSBRANDID  int32   `json:"spotgoodsbrandid"  xorm:"'SPOTGOODSBRANDID'"`                   // 现货品牌ID(DGFactoryItem表的ID)
+	BRANDNAME         string  `json:"brandname"  xorm:"'brandname'"`                                 // 品牌名称
+	ATTACHMENT        string  `json:"attachment"  xorm:"'ATTACHMENT'"`                               // 附件
+	UNITID            int32   `json:"unitid"  xorm:"'UNITID'"`                                       // 单位id(取品类上的单位id)
+	TRADEUSERID       int64   `json:"tradeuserid"  xorm:"'TRADEUSERID'"`                             // 交易员id
+	SALEUSERID        int64   `json:"saleuserid"  xorm:"'SALEUSERID'"`                               // 业务员id
+	MERUSERID         int64   `json:"meruserid"  xorm:"'MERUSERID'"`                                 // 跟单员id
+	ACCOUNTID         string  `json:"accountid"  xorm:"'ACCOUNTID'"`                                 // 期货账户id
+	BIZTYPE           int32   `json:"biztype"  xorm:"'BIZTYPE'"`                                     // 业务类型 1-套保 2-套利
+	CURRENCYID        int32   `json:"currencyid"  xorm:"'CURRENCYID'"`                               // 币种id
+	SUBJECTID         string  `json:"subjectid"  xorm:"'SUBJECTID'"`                                 // 交易主体ID
+	SUBJECTNAME       string  `json:"subjectname"  xorm:"'SUBJECTNAME'"`                             // 交易主体名称
+	VATRATE           float64 `json:"vatrate"  xorm:"'VATRATE'"`                                     // 增值税率
 
 	SELLNICKNAME       string `json:"sellnickname"`       // 采购方昵称
 	BUYNICKNAME        string `json:"buynickname"`        // 销售方昵称
@@ -771,6 +771,12 @@ SELECT to_char(t.SPOTCONTRACTID) SPOTCONTRACTID,
 			sqlId.Join(fmt.Sprintf(" and t.contractstatus in (%v)", status))
 		}
 	}
+	if r.CONTRACTNO != "" {
+		sqlId.AndLike("t.contractno", r.CONTRACTNO)
+	}
+	if r.WRSTANDARDNAME != "" {
+		sqlId.AndLike("w.wrstandardname", r.WRSTANDARDNAME)
+	}
 
 	return sqlId.String()
 }
@@ -3090,7 +3096,7 @@ select s.userid,
   left join useraccount u1
     on s.customeruserid = u1.userid
   left join enumdicitem e on w.unitid=e.enumitemname and e.enumdiccode='goodsunit'
- where 1 = 1 and t.middlegoodspricedqty3 > t.relatedmiddlegoodsqty
+ where 1 = 1 and t.middlegoodspricedqty3 > t.relatedmiddlegoodsqty and s.contractstatus = 2
    and t.middlegoodsid in
        (select middlegoodsid from tmp where tmp.srcgoodsgroupid = %v)
 `

+ 3 - 1
mtpcache/goods.go

@@ -44,7 +44,7 @@ func loadData() {
 	m := Goods{}
 	if d, err := m.GetData(); err == nil {
 		for _, v := range d {
-			goodsCache.Add(v.Key(), 0, &v)
+			goodsCache.Add(v.Key(), 0, v)
 		}
 	}
 }
@@ -120,6 +120,8 @@ func GetGoods(goodsCode string) (Goods, bool) {
 		d := item.Data()
 		if v, ok := d.(Goods); ok {
 			return v, true
+		} else if v2, ok2 := d.(*Goods); ok2 {
+			return *v2, true
 		}
 	}
 	return Goods{}, false