aa
This commit is contained in:
@@ -138,7 +138,7 @@ func (c *OrderManager) OnOrderAdjust(order *model.GoodsOrder, orderStatus *model
|
|||||||
// }, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
// }, "OnAdjustOrder delete order_sku, orderID:%s", order.VendorOrderID)
|
||||||
order.AdjustCount = adjustCount + 1
|
order.AdjustCount = adjustCount + 1
|
||||||
//扣点的订单需要修改订单的totalshopmoney
|
//扣点的订单需要修改订单的totalshopmoney
|
||||||
if err == nil && order.OrderPayPercentage < 100 {
|
if err == nil && order.OrderPayPercentage < 50 && order.OrderPayPercentage > 0 {
|
||||||
order2, _ := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).GetOrder(order.VendorOrgCode, order.VendorOrderID, order.VendorStoreID)
|
order2, _ := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).GetOrder(order.VendorOrgCode, order.VendorOrderID, order.VendorStoreID)
|
||||||
order.TotalShopMoney = order2.TotalShopMoney
|
order.TotalShopMoney = order2.TotalShopMoney
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5275,3 +5275,63 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
|
|||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
return originSyncStatus, err
|
return originSyncStatus, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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:"售价"`
|
||||||
|
}
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
specialtyStoreSkus []*SpecialtyStoreSkus
|
||||||
|
excelTitle = []string{
|
||||||
|
"商品upc码",
|
||||||
|
"商品名",
|
||||||
|
"单位",
|
||||||
|
"重量(g)",
|
||||||
|
"售价",
|
||||||
|
}
|
||||||
|
sheetList []*excel.Obj2ExcelSheetConfig
|
||||||
|
downloadURL, fileName string
|
||||||
|
)
|
||||||
|
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
|
||||||
|
if err != nil || storeDetail == nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if partner.IsMultiStore(vendorID) {
|
||||||
|
// handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||||
|
// skuBareInfoList, _ := handler.GetStoreSkusBareInfo(ctx, storeDetail.VendorOrgCode, nil, storeID, storeDetail.VendorStoreID, nil)
|
||||||
|
return fmt.Errorf("暂不支持京东!")
|
||||||
|
} else {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
excelConf := &excel.Obj2ExcelSheetConfig{
|
||||||
|
Title: "sheet1",
|
||||||
|
Data: specialtyStoreSkus,
|
||||||
|
CaptionList: excelTitle,
|
||||||
|
}
|
||||||
|
sheetList = append(sheetList, excelConf)
|
||||||
|
if excelConf != nil {
|
||||||
|
downloadURL, fileName, err = jxutils.UploadExeclAndPushMsg(sheetList, "平台门店标品")
|
||||||
|
} else {
|
||||||
|
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName, err)
|
||||||
|
} else {
|
||||||
|
noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
|
||||||
|
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, ctx.GetUserID(), "异步任务完成", noticeMsg)
|
||||||
|
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
|
|||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
vendorIDs = []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI}
|
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")
|
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,
|
task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx,
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
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())
|
dao.WrapAddIDCULEntity(storeManage, ctx.GetUserName())
|
||||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
||||||
store, err := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
|
store, err := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
|
||||||
// if coverAreaFlag {
|
if coverAreaFlag {
|
||||||
if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
|
if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
|
||||||
storeManage.CoverArea = math.Pi * utils.Str2Float64WithDefault(store.DeliveryRange, 0) / float64(1000) * utils.Str2Float64WithDefault(store.DeliveryRange, 0) / float64(1000)
|
storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)))
|
||||||
} else {
|
} else {
|
||||||
storeManage.CoverArea = CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID)
|
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
|
storeManage.VendorStatus = store.Status
|
||||||
//营业时长
|
//营业时长
|
||||||
@@ -472,7 +472,7 @@ func RefreshStoreManageState(ctx *jxcontext.Context) {
|
|||||||
task.GetID()
|
task.GetID()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID, sortType, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
|
func GetStoreManageState(ctx *jxcontext.Context, storeIDs, brandIDs []int, vendorID, sortType, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
@@ -498,7 +498,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID, sortT
|
|||||||
storeIDs = storeIDs2
|
storeIDs = storeIDs2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dao.GetStoreManageState(db, storeIDs, vendorID, sortType, offset, pageSize)
|
return dao.GetStoreManageState(db, storeIDs, brandIDs, vendorID, sortType, offset, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
||||||
|
|||||||
@@ -1175,7 +1175,7 @@ type GetStoreManageStateResult struct {
|
|||||||
model.StoreManageState
|
model.StoreManageState
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
func GetStoreManageState(db *DaoDB, storeIDs, brandIDs []int, vendorID, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||||
var (
|
var (
|
||||||
requestList []*GetStoreManageStateResult
|
requestList []*GetStoreManageStateResult
|
||||||
GetStoreManageStateSortTypeMap = map[int]string{
|
GetStoreManageStateSortTypeMap = map[int]string{
|
||||||
@@ -1195,13 +1195,19 @@ func GetStoreManageState(db *DaoDB, storeIDs []int, vendorID, sortType, offset,
|
|||||||
FROM store_manage_state a
|
FROM store_manage_state a
|
||||||
LEFT JOIN store b ON b.id = a.store_id
|
LEFT JOIN store b ON b.id = a.store_id
|
||||||
LEFT JOIN store_map c ON c.store_id = a.store_id AND c.vendor_id = a.vendor_id
|
LEFT JOIN store_map c ON c.store_id = a.store_id AND c.vendor_id = a.vendor_id
|
||||||
WHERE 1 = 1
|
WHERE a.vendor_status <> ?
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{}
|
sqlParams := []interface{}{
|
||||||
|
model.StoreStatusDisabled,
|
||||||
|
}
|
||||||
if len(storeIDs) > 0 {
|
if len(storeIDs) > 0 {
|
||||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, storeIDs)
|
sqlParams = append(sqlParams, storeIDs)
|
||||||
}
|
}
|
||||||
|
if len(brandIDs) > 0 {
|
||||||
|
sql += " AND b.barnd_id IN (" + GenQuestionMarks(len(brandIDs)) + ")"
|
||||||
|
sqlParams = append(sqlParams, brandIDs)
|
||||||
|
}
|
||||||
if vendorID != -1 {
|
if vendorID != -1 {
|
||||||
sql += " AND a.vendor_id = ?"
|
sql += " AND a.vendor_id = ?"
|
||||||
sqlParams = append(sqlParams, vendorID)
|
sqlParams = append(sqlParams, vendorID)
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ type SkuNameInfo struct {
|
|||||||
Unit string
|
Unit string
|
||||||
VendorCatIDList []string
|
VendorCatIDList []string
|
||||||
PictureList []string
|
PictureList []string
|
||||||
|
UPC string
|
||||||
Status int `json:"status,omitempty"`
|
Status int `json:"status,omitempty"`
|
||||||
YbBarCode string
|
YbBarCode string
|
||||||
SkuList []*SkuInfo
|
SkuList []*SkuInfo
|
||||||
|
|||||||
@@ -554,10 +554,10 @@ func vendorSku2Jx(appFood *mtwmapi.AppFood) (skuName *partner.SkuNameInfo) {
|
|||||||
skuName = &partner.SkuNameInfo{
|
skuName = &partner.SkuNameInfo{
|
||||||
NameID: int(utils.Str2Int64WithDefault(appFood.AppFoodCode, 0)),
|
NameID: int(utils.Str2Int64WithDefault(appFood.AppFoodCode, 0)),
|
||||||
VendorNameID: appFood.AppFoodCode,
|
VendorNameID: appFood.AppFoodCode,
|
||||||
|
UPC: appFood.SkuList[0].Upc,
|
||||||
Prefix: prefix,
|
Prefix: prefix,
|
||||||
Name: name,
|
Name: name,
|
||||||
Unit: unit,
|
Unit: unit,
|
||||||
SkuList: []*partner.SkuInfo{
|
SkuList: []*partner.SkuInfo{
|
||||||
&partner.SkuInfo{
|
&partner.SkuInfo{
|
||||||
StoreSkuInfo: partner.StoreSkuInfo{
|
StoreSkuInfo: partner.StoreSkuInfo{
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ func (c *ReportController) GetManageState() {
|
|||||||
// @Description 查询门店经营数据
|
// @Description 查询门店经营数据
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeIDs query string false "门店ID列表[1,2,3]"
|
// @Param storeIDs query string false "门店ID列表[1,2,3]"
|
||||||
|
// @Param brandIDs query string false "品牌ID列表[1,2,3]"
|
||||||
// @Param vendorID query int true "平台ID"
|
// @Param vendorID query int true "平台ID"
|
||||||
// @Param sortType query int false "排序类型,1 覆盖范围,2市场规模,3营业时长,4商品数,5虚高商品数,6活动丰富度,7无效订单数,8拒绝订单数,9门店评分,正升序,负倒序"
|
// @Param sortType query int false "排序类型,1 覆盖范围,2市场规模,3营业时长,4商品数,5虚高商品数,6活动丰富度,7无效订单数,8拒绝订单数,9门店评分,正升序,负倒序"
|
||||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||||
@@ -128,9 +129,9 @@ func (c *ReportController) GetManageState() {
|
|||||||
// @router /GetStoreManageState [get]
|
// @router /GetStoreManageState [get]
|
||||||
func (c *ReportController) GetStoreManageState() {
|
func (c *ReportController) GetStoreManageState() {
|
||||||
c.callGetStoreManageState(func(params *tReportGetStoreManageStateParams) (retVal interface{}, errCode string, err error) {
|
c.callGetStoreManageState(func(params *tReportGetStoreManageStateParams) (retVal interface{}, errCode string, err error) {
|
||||||
var storeIDs []int
|
var storeIDs, brandIDs []int
|
||||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.BrandIDs, brandIDs); err == nil {
|
||||||
retVal, err = report.GetStoreManageState(params.Ctx, storeIDs, params.VendorID, params.SortType, params.Offset, params.PageSize)
|
retVal, err = report.GetStoreManageState(params.Ctx, storeIDs, brandIDs, params.VendorID, params.SortType, params.Offset, params.PageSize)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user