This commit is contained in:
苏尹岚
2021-03-17 09:21:57 +08:00
parent 71a11a333e
commit 2b53dbb708
4 changed files with 40 additions and 19 deletions

View File

@@ -5278,11 +5278,11 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
func GetVendorStoreSkus(ctx *jxcontext.Context, storeID, vendorID int) (err error) {
type SpecialtyStoreSkus struct {
Upc int `json:"商品upc码"`
SkuName string `json:"商品名"`
Unit int `json:"单位"`
Weight float64 `json:"重量(g)"`
Price float64 `json:"售价"`
Upc string `json:"商品upc码"`
SkuName string `json:"商品名"`
Unit string `json:"单位"`
Weight int `json:"重量(g)"`
Price int64 `json:"售价"`
}
var (
db = dao.GetDB()
@@ -5309,9 +5309,15 @@ func GetVendorStoreSkus(ctx *jxcontext.Context, storeID, vendorID int) (err erro
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
skuList, _ := handler.GetStoreSkusFullInfo(ctx, nil, storeID, storeDetail.VendorStoreID, nil)
for _, sku := range skuList {
if sku.SkuList[0].IsSpecialty == model.YES {
specialtyStoreSku := &SpecialtyStoreSkus{}
specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku)
if sku.UPC != "" {
skus := &SpecialtyStoreSkus{
Upc: sku.UPC,
SkuName: sku.Name,
Unit: sku.Unit,
Weight: sku.SkuList[0].Weight,
Price: sku.SkuList[0].VendorPrice,
}
specialtyStoreSkus = append(specialtyStoreSkus, skus)
}
}
}

View File

@@ -193,9 +193,9 @@ func Init() {
// cms.OpenRemoteStoreByJxStatus(jxcontext.AdminCtx, nil, nil, false, false, true)
}, openRemoteStoreTimeList)
ScheduleTimerFunc("SaveAndSendAlarmVendorSnapshot", func() {
cms.SaveAndSendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, nil, false)
}, cms.WatchVendorStoreTimeList)
// ScheduleTimerFunc("SaveAndSendAlarmVendorSnapshot", func() {
// cms.SaveAndSendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, nil, false)
// }, cms.WatchVendorStoreTimeList)
ScheduleTimerFunc("RefreshPageActs", func() {
act.RefreshPageActs(jxcontext.AdminCtx, []int{model.VendorIDEBAI}, time.Now().Add(-30*24*time.Hour), false)

View File

@@ -397,7 +397,7 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
db = dao.GetDB()
vendorIDs = []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI}
dayTimeBegin, dayTimeEnd = utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + "00:00:00"), utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + "23:59:59")
coverAreaFlag = time.Now().Hour() == 9 && time.Now().Minute() > 50 && time.Now().Minute() < 59
// coverAreaFlag = time.Now().Hour() == 9 && time.Now().Minute() > 50 && time.Now().Minute() < 59
)
task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
@@ -417,14 +417,14 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
dao.WrapAddIDCULEntity(storeManage, ctx.GetUserName())
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
store, err := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
if coverAreaFlag {
if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)))
} else {
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID)))
}
// if coverAreaFlag {
if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)))
} else {
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID)))
}
// storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", storeManage.CoverArea))
// }
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", storeManage.CoverArea))
//营业状态
storeManage.VendorStatus = store.Status
//营业时长

View File

@@ -923,3 +923,18 @@ func (c *StoreSkuController) GetSpecialtyStoreSkus() {
return retVal, "", err
})
}
// @Title 拉取平台标品
// @Description 拉取平台标品
// @Param token header string true "认证token"
// @Param vendorID formData int true "平台id"
// @Param storeID formData int true "门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetVendorStoreSkus [post]
func (c *StoreSkuController) GetVendorStoreSkus() {
c.callGetVendorStoreSkus(func(params *tStoreSkuGetVendorStoreSkusParams) (retVal interface{}, errCode string, err error) {
err = cms.GetVendorStoreSkus(params.Ctx, params.StoreID, params.VendorID)
return retVal, "", err
})
}