|
|
@@ -81,7 +81,7 @@ type ErmcpGoods struct {
|
|
|
}
|
|
|
|
|
|
// GetErmcpGoodses 企业风管专用获取商品信息的方法
|
|
|
-func GetErmcpGoodses(lastUpdateTime string) ([]ErmcpGoods, error) {
|
|
|
+func GetErmcpGoodses(userid int64, lastUpdateTime string) ([]ErmcpGoods, error) {
|
|
|
engine := db.GetEngine()
|
|
|
|
|
|
// 对比数据库与终端的更新时间戳
|
|
|
@@ -98,16 +98,54 @@ func GetErmcpGoodses(lastUpdateTime string) ([]ErmcpGoods, error) {
|
|
|
Select("G.*, M.TRADEMODE").
|
|
|
Join("LEFT", "MARKET M", "M.MARKETID = G.MARKETID").
|
|
|
Where("G.GOODSSTATUS in (3, 7)")
|
|
|
- // if lastID != 0 {
|
|
|
- // session = session.And("GOODSID > ?", lastID)
|
|
|
- // }
|
|
|
- // session = session.Asc("GOODSID")
|
|
|
- // if len(lastUpdateTime) != 0 {
|
|
|
- // session = session.And(fmt.Sprintf("G.MODIFYTIME > to_date('%s','yyyy-MM-dd hh24:mi:ss')", lastUpdateTime))
|
|
|
- // }
|
|
|
+
|
|
|
if err := session.Find(&goodses); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+
|
|
|
+ // 错误 #3068
|
|
|
+ //【企业风管-WebPC】期货市场商品应根据已设置的套保品种来显示,未设置套保品种的商品都不要显示出来
|
|
|
+ if userid > 0 && len(goodses) > 0 {
|
|
|
+ areaUserId := mtpcache.GetAreaUserId(userid, 0)
|
|
|
+ sqlId := `
|
|
|
+ select t.goodsgroupid
|
|
|
+ from goodsgroup t
|
|
|
+ where t.groupcategroyid in (
|
|
|
+ select g.groupcategroyid
|
|
|
+ from erms_middlegoods t
|
|
|
+ left join goodsgroup g
|
|
|
+ on t.goodsgroupid = g.goodsgroupid
|
|
|
+ where t.areauserid = %v
|
|
|
+ and t.isvalid = 1)
|
|
|
+ `
|
|
|
+ sqlId = fmt.Sprintf(sqlId, areaUserId)
|
|
|
+ type GoodsGroupId struct {
|
|
|
+ GoodsGroupId int64 `json:"goodsgroupid" xorm:"'GoodsGroupId'"`
|
|
|
+ }
|
|
|
+ sGroupId := make([]GoodsGroupId, 0)
|
|
|
+ err := engine.SQL(sqlId).Find(&sGroupId)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ fIn := func(goodsgroupid int64) bool {
|
|
|
+ for i := range sGroupId {
|
|
|
+ if sGroupId[i].GoodsGroupId == goodsgroupid {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ sGoods := make([]ErmcpGoods, 0)
|
|
|
+ for _, v := range goodses {
|
|
|
+ if fIn(v.Goodsgroupid) {
|
|
|
+ sGoods = append(sGoods, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goodses = sGoods[:]
|
|
|
+ }
|
|
|
+
|
|
|
for i := range goodses {
|
|
|
goodses[i].ENUMDICNAME = mtpcache.GetEnumDicitemName(int32(goodses[i].Goodunitid))
|
|
|
}
|