diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 6080c5bc4..ab88ab3eb 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -6,6 +6,10 @@ import ( "sync" "time" + "git.rosy.net.cn/jx-callback/business/jxstore/cms" + + "git.rosy.net.cn/jx-callback/business/authz" + "git.rosy.net.cn/jx-callback/business/authz/autils" "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/partner/purchase/jdshop" @@ -1443,17 +1447,40 @@ func OrderProfitWarning(order *model.GoodsOrder) { if storeDetail != nil && err == nil { payPercentage := storeDetail.PayPercentage if payPercentage >= 50 { - profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.EarningPrice)) / 100 + profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney-order.ShopPrice)) / 100 } else { profit = utils.Str2Float64(utils.Int64ToStr(order.TotalShopMoney*int64(payPercentage)/200)) / 100 } if profit < 0 { operatorPhone, operatorName := getOrderOperatorInfo(order, storeDetail) + operatorRole := getOrderOperatorRoleInfo(order, storeDetail) if operatorPhone != "" { + var ( + roleList []*authz.RoleInfo + userIDs []string + flag = false + ) + roleList = append(roleList, autils.NewRole(operatorRole, 0)) + userIDMap, err := cms.GetRolesUserList(jxcontext.AdminCtx, roleList) noticeMsg := fmt.Sprintf("利润 :[%v],运营负责人:[%v],门店ID:[%v],平台门店ID[%v],门店名:[%v],订单序号:[%v],订单号(点击进入详情):%v", profit, operatorName, order.StoreID, order.VendorStoreID, order.StoreName, order.OrderSeq, globals.BackstageHost+"/#/ordermanager/"+order.VendorOrderID) user, err := dao.GetUserByID(db, "mobile", operatorPhone) if user != nil && err == nil { - ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "警告!此订单利润低于0", noticeMsg) + for _, v := range userIDMap { + for _, vv := range v { + userIDs = append(userIDs, vv) + } + } + for _, v := range userIDs { + if v == user.UserID { + flag = true + } + } + if !flag { + userIDs = append(userIDs, user.UserID) + } + for _, v := range userIDs { + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, v, "警告!此订单利润低于0", noticeMsg) + } } } } @@ -1502,3 +1529,15 @@ func getOrderOperatorInfo(order *model.GoodsOrder, storeDetail *dao.StoreDetail) } return operatorPhone, operatorName } + +func getOrderOperatorRoleInfo(order *model.GoodsOrder, storeDetail *dao.StoreDetail) (roleName string) { + switch order.VendorID { + case model.VendorIDJD: + roleName = storeDetail.OperatorRole + case model.VendorIDMTWM: + roleName = storeDetail.OperatorRole2 + case model.VendorIDEBAI: + roleName = storeDetail.OperatorRole3 + } + return roleName +} diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index d4c168b3c..00e809004 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -589,6 +589,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.img, t1.img2, t1.img3, + t1.img_watermark, + t1.img_mix, t1.status, t1.is_spu, t1.desc_img, @@ -626,6 +628,8 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric t1.img, t1.img2, t1.img3, + t1.img_watermark, + t1.img_mix, t1.status, t1.is_spu, t1.desc_img, @@ -905,7 +909,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf } } globals.SugarLogger.Debugf("UpdateSkuName valid:%s", utils.Format4Output(valid, false)) - for _, imgName := range []string{"img", "img2", "img3"} { + for _, imgName := range []string{"img", "img2", "img3", "img_watermark", "img_mix"} { if valid[imgName] != nil { if imgStr := utils.Interface2String(valid[imgName]); imgStr != "" { _, err2 := datares.TryRegisterDataResource(ctx, skuName.Name, valid[imgName].(string), model.ImgTypeMain, true) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 497e114f9..aa2268c5c 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1107,7 +1107,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.Status = tmpStatus } if globals.IsAddEvent { - err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", "") + err = AddEventDetail(db, ctx, model.OperateAdd, v.RealSkuID, model.ThingTypeSku, storeID, "", utils.Int2Str(skuBind.UnitPrice)) } setStoreSkuBindStatus(skuBind, model.SyncFlagNewMask) dao.WrapAddIDCULDEntity(skuBind, userName) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index b58bf9e50..5468ea5f1 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1558,6 +1558,7 @@ type tStoreSkuAudit struct { MidUnitPrice int `json:"midUnitPrice"` CityName string `json:"cityName"` PayPercentage int `json:"payPercentage"` + StoreLevel string `json:"storeLevel"` } func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int, name, remark, keyword, marketManPhone, cityName string, applyTimeStart, applyTimeEnd, auditTimeStart, auditTimeEnd time.Time, pageSize, offset int) (pagedInfo *model.PagedInfo, err error) { @@ -1565,7 +1566,7 @@ func GetStoreSkuAudit(db *DaoDB, storeIDs, nameIDs, skuIDs, statuss, types []int sql := ` SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, c.name sku_name, c.prefix, c.unit, c.spec_quality, c.spec_unit, c.img, - d.name store_name, b.name, e.mid_unit_price, f.name city_name, d.pay_percentage + d.name store_name, b.name, e.mid_unit_price, f.name city_name, d.pay_percentage, d.store_level FROM store_sku_audit a LEFT JOIN user b ON a.user_id = b.user_id LEFT JOIN sku_name c ON c.id = a.name_id AND c.deleted_at = ? diff --git a/business/model/sku.go b/business/model/sku.go index 82598d7fe..b736e0b9c 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -168,9 +168,11 @@ type SkuName struct { SpecUnit string `orm:"size(8)" json:"-"` // 为份必然为克,这个主要作用只是用于确保SkuName的唯一性 Price int `json:"price"` // 单位为分,标准价,不为份的就为实际标准价,为份的为每市斤价,实际还要乘质量。todo 为份的确定必须有质量 - Img string `orm:"size(512)" json:"img"` - Img2 string `orm:"size(512)" json:"img2"` // 第二张图片 - Img3 string `orm:"size(512)" json:"img3"` //第三张图片 + Img string `orm:"size(512)" json:"img"` + Img2 string `orm:"size(512)" json:"img2"` // 第二张图片 + Img3 string `orm:"size(512)" json:"img3"` //第三张图片 + ImgWatermark string `orm:"size(512)" json:"imgWatermark"` //图片水印 + ImgMix string `orm:"size(512)" json:"imgMix"` //图片混合水印的图片 // ImgEbai string `orm:"size(255)" json:"imgEbai"` // 饿百图片地址 // ImgHashCode string `orm:"size(255);index" json:"img_hash_code"` @@ -185,8 +187,9 @@ type SkuName struct { // JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"` // LinkID int `orm:"column(link_id);null;index" json:"linkID"` - YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 - JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` + YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀 + JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` + PreparationTime int `orm:"default(1)" json:"preparationTime"` } func (*SkuName) TableUnique() [][]string { diff --git a/business/partner/purchase/jdshop/store_sku.go b/business/partner/purchase/jdshop/store_sku.go index ec850a914..d860cb8e6 100644 --- a/business/partner/purchase/jdshop/store_sku.go +++ b/business/partner/purchase/jdshop/store_sku.go @@ -777,7 +777,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf OuterID: utils.Int2Str(v.SkuID), } //库存设置 - if v.Status == model.SkuStatusNormal { + if v.StoreSkuStatus == model.SkuStatusNormal { sku.StockNum = "9999" } else { sku.StockNum = "0"