正在显示
4 个修改的文件
包含
46 行增加
和
21 行删除
@@ -433,28 +433,29 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut | @@ -433,28 +433,29 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut | ||
433 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 433 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
434 | } else { | 434 | } else { |
435 | if len(listIntervals) == 0 { // 未配置年榜 | 435 | if len(listIntervals) == 0 { // 未配置年榜 |
436 | - contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | ||
437 | - contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | 436 | + timeNow := time.Now().Local() |
437 | + contributionsWealthRankingQuery.StartTime = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local) | ||
438 | + contributionsWealthRankingQuery.EndTime = time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, time.Local) | ||
438 | } else if len(listIntervals) == 1 { // 只配置了一个年榜 | 439 | } else if len(listIntervals) == 1 { // 只配置了一个年榜 |
439 | - currentTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | ||
440 | - if currentTime.Before(listIntervals[0].IntervalStartTime) && currentTime.After(listIntervals[0].IntervalEndTime) || currentTime.Equal(listIntervals[0].IntervalStartTime) || currentTime.Equal(listIntervals[0].IntervalEndTime) { // 当前时间在榜单内 | ||
441 | - contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime | ||
442 | - contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime | 440 | + currentTime := time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) |
441 | + if currentTime.Before(listIntervals[0].IntervalStartTime.Local()) && currentTime.After(listIntervals[0].IntervalEndTime.Local()) || currentTime.Equal(listIntervals[0].IntervalStartTime.Local()) || currentTime.Equal(listIntervals[0].IntervalEndTime.Local()) { // 当前时间在榜单内 | ||
442 | + contributionsWealthRankingQuery.StartTime = listIntervals[0].IntervalStartTime.Local() | ||
443 | + contributionsWealthRankingQuery.EndTime = listIntervals[0].IntervalEndTime.Local() | ||
443 | } else { // 当前时间处于空档期 | 444 | } else { // 当前时间处于空档期 |
444 | - contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | ||
445 | - contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | 445 | + contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) |
446 | + contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) | ||
446 | } | 447 | } |
447 | } else { // 配置了多个年榜 | 448 | } else { // 配置了多个年榜 |
448 | // 判断当前时间是否在榜单里 | 449 | // 判断当前时间是否在榜单里 |
449 | - currentTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | 450 | + currentTime := time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) |
450 | for _, listInterval := range listIntervals { | 451 | for _, listInterval := range listIntervals { |
451 | - if currentTime.Before(listInterval.IntervalStartTime) && currentTime.After(listInterval.IntervalEndTime) || currentTime.Equal(listInterval.IntervalStartTime) || currentTime.Equal(listInterval.IntervalEndTime) { // 当前时间在榜单内 | ||
452 | - contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime | ||
453 | - contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime | 452 | + if currentTime.Before(listInterval.IntervalStartTime.Local()) && currentTime.After(listInterval.IntervalEndTime.Local()) || currentTime.Equal(listInterval.IntervalStartTime.Local()) || currentTime.Equal(listInterval.IntervalEndTime.Local()) { // 当前时间在榜单内 |
453 | + contributionsWealthRankingQuery.StartTime = listInterval.IntervalStartTime.Local() | ||
454 | + contributionsWealthRankingQuery.EndTime = listInterval.IntervalEndTime.Local() | ||
454 | break | 455 | break |
455 | } else { // 当前时间处于空档期 | 456 | } else { // 当前时间处于空档期 |
456 | - contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | ||
457 | - contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC) | 457 | + contributionsWealthRankingQuery.StartTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) |
458 | + contributionsWealthRankingQuery.EndTime = time.Date(time.Now().Local().Year(), time.Now().Local().Month(), time.Now().Local().Day(), 0, 0, 0, 0, time.Local) | ||
458 | break | 459 | break |
459 | } | 460 | } |
460 | } | 461 | } |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/astaxie/beego/validation" | ||
6 | +) | ||
7 | + | ||
8 | +type ImportExchangeCashListCommand struct { | ||
9 | + Where map[string]interface{} `json:"where"` | ||
10 | +} | ||
11 | + | ||
12 | +func (importExchangeCashListCommand *ImportExchangeCashListCommand) ValidateCommand() error { | ||
13 | + valid := validation.Validation{} | ||
14 | + b, err := valid.Valid(importExchangeCashListCommand) | ||
15 | + if err != nil { | ||
16 | + return err | ||
17 | + } | ||
18 | + if !b { | ||
19 | + for _, validErr := range valid.Errors { | ||
20 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
21 | + } | ||
22 | + } | ||
23 | + return nil | ||
24 | +} |
@@ -407,7 +407,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -407,7 +407,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
407 | queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking") | 407 | queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_records.su_money) - t.employee_contributions_decrease DESC) AS ranking") |
408 | queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3})) | 408 | queryContributions = queryContributions.Where(`su_money_transaction_records.record_type IN (?)`, pg.In([]int{2, 3})) |
409 | queryContributions = queryContributions.Where(`e.status = ?`, 1) | 409 | queryContributions = queryContributions.Where(`e.status = ?`, 1) |
410 | - //queryContributions = queryContributions.Where("e.uid = t.uid::bigint") | 410 | + queryContributions = queryContributions.Where("e.uid = t.uid::bigint") |
411 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 411 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
412 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) | 412 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) |
413 | } | 413 | } |
@@ -6,7 +6,6 @@ import ( | @@ -6,7 +6,6 @@ import ( | ||
6 | "github.com/360EntSecGroup-Skylar/excelize/v2" | 6 | "github.com/360EntSecGroup-Skylar/excelize/v2" |
7 | "github.com/astaxie/beego" | 7 | "github.com/astaxie/beego" |
8 | "github.com/linmadan/egglib-go/web/beego/utils" | 8 | "github.com/linmadan/egglib-go/web/beego/utils" |
9 | - utils_tool "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/utils" | ||
10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" | 9 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command" |
11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query" | 10 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query" |
12 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" | 11 | "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service" |
@@ -395,9 +394,9 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { | @@ -395,9 +394,9 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { | ||
395 | // 导入兑换素币清单 | 394 | // 导入兑换素币清单 |
396 | func (controller *SuMoneyController) ImportExchangeList () { | 395 | func (controller *SuMoneyController) ImportExchangeList () { |
397 | cashPoolService := service.NewCashPoolService(nil) | 396 | cashPoolService := service.NewCashPoolService(nil) |
398 | - createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{} | ||
399 | - whereStr := controller.GetString("where") | ||
400 | - where, err := utils_tool.JsonToMap(whereStr) | 397 | + importExchangeCashListCommand := &command.ImportExchangeCashListCommand{} |
398 | + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand) | ||
399 | + //fmt.Printf("命令:%+v\n", importExchangeCashListCommand) | ||
401 | file, h, _ := controller.GetFile("file") | 400 | file, h, _ := controller.GetFile("file") |
402 | 401 | ||
403 | // 错误信息返回 | 402 | // 错误信息返回 |
@@ -478,8 +477,9 @@ func (controller *SuMoneyController) ImportExchangeList () { | @@ -478,8 +477,9 @@ func (controller *SuMoneyController) ImportExchangeList () { | ||
478 | //fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row)) | 477 | //fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row)) |
479 | if i > 2 && len(row) > 1 { | 478 | if i > 2 && len(row) > 1 { |
480 | // 创建兑换清单命令 | 479 | // 创建兑换清单命令 |
481 | - createExchangeCashPersonCommand.ExchangeCashActivityId ,err = strconv.ParseInt(where["activityId"], 10, 64) | ||
482 | - createExchangeCashPersonCommand.Operator, err = strconv.ParseInt(where["uid"], 10, 64) | 480 | + createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{} |
481 | + createExchangeCashPersonCommand.ExchangeCashActivityId ,err = strconv.ParseInt(importExchangeCashListCommand.Where["activityId"].(string), 10, 64) | ||
482 | + createExchangeCashPersonCommand.Operator = importExchangeCashListCommand.Where["uid"].(int64) | ||
483 | createExchangeCashPersonCommand.PersonName = row[0] | 483 | createExchangeCashPersonCommand.PersonName = row[0] |
484 | createExchangeCashPersonCommand.PersonAccount = row[1] | 484 | createExchangeCashPersonCommand.PersonAccount = row[1] |
485 | r2, _ := strconv.ParseFloat(row[2], 64) | 485 | r2, _ := strconv.ParseFloat(row[2], 64) |
-
请 注册 或 登录 后发表评论