aa
This commit is contained in:
@@ -409,11 +409,13 @@ type GetStoreManageStateResult struct {
|
|||||||
RepurchaseRate int `json:"repurchaseRate"` //复购率(转化率)
|
RepurchaseRate int `json:"repurchaseRate"` //复购率(转化率)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, fromTime, toTime string) (getStoreManageStateResult []*GetStoreManageStateResult, err error) {
|
func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, fromTime, toTime string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
fromTimeT, toTimeT = utils.Str2Time(fromTime), utils.Str2Time(toTime)
|
fromTimeT, toTimeT = utils.Str2Time(fromTime), utils.Str2Time(toTime)
|
||||||
dayCount = int(fromTimeT.Sub(toTimeT).Hours())/24 + 1 //查的几天
|
dayCount = int(fromTimeT.Sub(toTimeT).Hours())/24 + 1 //查的几天
|
||||||
|
getStoreManageStateResult []*GetStoreManageStateResult
|
||||||
|
storeIDsPage []int
|
||||||
)
|
)
|
||||||
//权限
|
//权限
|
||||||
if permission.IsRoled(ctx) {
|
if permission.IsRoled(ctx) {
|
||||||
@@ -426,17 +428,19 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("storeIDs1111111111111111111111111111111111", storeIDsMap, ctx.GetUserID())
|
|
||||||
for k, _ := range storeIDsMap {
|
for k, _ := range storeIDsMap {
|
||||||
storeIDs2 = append(storeIDs2, k)
|
storeIDs2 = append(storeIDs2, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("storeIDs1111111111111111111111111111111111", storeIDs2)
|
|
||||||
storeIDs = nil
|
storeIDs = nil
|
||||||
storeIDs = storeIDs2
|
storeIDs = storeIDs2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("storeIDs1111111111111111111111111111111111", storeIDs)
|
index2 := (offset+1)*pageSize - 1
|
||||||
|
if index2 > len(storeIDs) {
|
||||||
|
index2 = len(storeIDs) - 1
|
||||||
|
}
|
||||||
|
storeIDsPage = storeIDs[offset*pageSize : index2]
|
||||||
task := tasksch.NewParallelTask("GetStoreManageState", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
task := tasksch.NewParallelTask("GetStoreManageState", tasksch.NewParallelConfig().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) {
|
||||||
v := batchItemList[0].(int)
|
v := batchItemList[0].(int)
|
||||||
@@ -514,13 +518,16 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
|||||||
retVal = []*GetStoreManageStateResult{result}
|
retVal = []*GetStoreManageStateResult{result}
|
||||||
// getStoreManageStateResult = append(getStoreManageStateResult, result)
|
// getStoreManageStateResult = append(getStoreManageStateResult, result)
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, storeIDs)
|
}, storeIDsPage)
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
result, _ := task.GetResult(0)
|
result, _ := task.GetResult(0)
|
||||||
for _, v := range result {
|
for _, v := range result {
|
||||||
getStoreManageStateResult = append(getStoreManageStateResult, v.(*GetStoreManageStateResult))
|
getStoreManageStateResult = append(getStoreManageStateResult, v.(*GetStoreManageStateResult))
|
||||||
}
|
}
|
||||||
return getStoreManageStateResult, err
|
return &model.PagedInfo{
|
||||||
|
TotalCount: len(storeIDs),
|
||||||
|
Data: getStoreManageStateResult,
|
||||||
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ func (c *ReportController) GetManageState() {
|
|||||||
// @Param vendorID query int true "平台ID"
|
// @Param vendorID query int true "平台ID"
|
||||||
// @Param fromTime query string true "开始日期(包含),格式(2006-01-02 00:00:00)"
|
// @Param fromTime query string true "开始日期(包含),格式(2006-01-02 00:00:00)"
|
||||||
// @Param toTime query string true "结束日期(包含),格式(2006-01-02 00:00:00)"
|
// @Param toTime query string true "结束日期(包含),格式(2006-01-02 00:00:00)"
|
||||||
|
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||||
|
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetStoreManageState [get]
|
// @router /GetStoreManageState [get]
|
||||||
@@ -129,7 +131,7 @@ 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 []int
|
||||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||||||
retVal, err = report.GetStoreManageState(params.Ctx, storeIDs, params.VendorID, params.FromTime, params.ToTime)
|
retVal, err = report.GetStoreManageState(params.Ctx, storeIDs, params.VendorID, params.FromTime, params.ToTime, params.Offset, params.PageSize)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user