正在显示
6 个修改的文件
包含
18 行增加
和
27 行删除
@@ -67,13 +67,12 @@ func (listIntervalService *ListIntervalService) CreateListInterval(createListInt | @@ -67,13 +67,12 @@ func (listIntervalService *ListIntervalService) CreateListInterval(createListInt | ||
67 | startTime := time.Date(createListIntervalCommand.ListIntervalStartTime.Local().Year(), createListIntervalCommand.ListIntervalStartTime.Local().Month(), createListIntervalCommand.ListIntervalStartTime.Local().Day(), 0, 0, 0, 0, time.Local) | 67 | startTime := time.Date(createListIntervalCommand.ListIntervalStartTime.Local().Year(), createListIntervalCommand.ListIntervalStartTime.Local().Month(), createListIntervalCommand.ListIntervalStartTime.Local().Day(), 0, 0, 0, 0, time.Local) |
68 | endTime := time.Date(createListIntervalCommand.ListIntervalEndTime.Local().Year(), createListIntervalCommand.ListIntervalEndTime.Local().Month(), createListIntervalCommand.ListIntervalEndTime.Local().Day(), 23, 59, 59, 0, time.Local) | 68 | endTime := time.Date(createListIntervalCommand.ListIntervalEndTime.Local().Year(), createListIntervalCommand.ListIntervalEndTime.Local().Month(), createListIntervalCommand.ListIntervalEndTime.Local().Day(), 23, 59, 59, 0, time.Local) |
69 | 69 | ||
70 | - startTimeCheck := time.Date(createListIntervalCommand.ListIntervalStartTime.Year(), createListIntervalCommand.ListIntervalStartTime.Month(), createListIntervalCommand.ListIntervalStartTime.Day(), 0, 0, 0, 0, time.UTC) | ||
71 | - endTimeCheck := time.Date(createListIntervalCommand.ListIntervalEndTime.Year(), createListIntervalCommand.ListIntervalEndTime.Month(), createListIntervalCommand.ListIntervalEndTime.Day(), 23, 59, 59, 0, time.UTC) | ||
72 | - | ||
73 | - ok := listIntervalDao.RankPeriodCheckTime(startTimeCheck, endTimeCheck, 0, listIntervals[0].CompanyId) | ||
74 | - fmt.Print(ok, "\n") | ||
75 | - if ok { | ||
76 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠") | 70 | + if len(listIntervals) > 0 { |
71 | + ok := listIntervalDao.RankPeriodCheckTime(startTime, endTime, 0, listIntervals[0].CompanyId) | ||
72 | + fmt.Print(ok, "\n") | ||
73 | + if ok { | ||
74 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠") | ||
75 | + } | ||
77 | } | 76 | } |
78 | 77 | ||
79 | // 创建排行榜时间 | 78 | // 创建排行榜时间 |
@@ -260,10 +259,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt | @@ -260,10 +259,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt | ||
260 | updateListIntervalCommand.ListIntervalStartTime = startTime | 259 | updateListIntervalCommand.ListIntervalStartTime = startTime |
261 | updateListIntervalCommand.ListIntervalEndTime = endTime | 260 | updateListIntervalCommand.ListIntervalEndTime = endTime |
262 | 261 | ||
263 | - startTimeCheck := time.Date(updateListIntervalCommand.ListIntervalStartTime.Year(), updateListIntervalCommand.ListIntervalStartTime.Month(), updateListIntervalCommand.ListIntervalStartTime.Day(), 0, 0, 0, 0, time.UTC) | ||
264 | - endTimeCheck := time.Date(updateListIntervalCommand.ListIntervalEndTime.Year(), updateListIntervalCommand.ListIntervalEndTime.Month(), updateListIntervalCommand.ListIntervalEndTime.Day(), 23, 59, 59, 0, time.UTC) | ||
265 | - | ||
266 | - ok := listIntervalDao.RankPeriodCheckTime(startTimeCheck, endTimeCheck, listIntervalFound.ListIntervalId, listIntervalFound.CompanyId) | 262 | + ok := listIntervalDao.RankPeriodCheckTime(startTime, endTime, listIntervalFound.ListIntervalId, listIntervalFound.CompanyId) |
267 | if ok { | 263 | if ok { |
268 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠") | 264 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠") |
269 | } | 265 | } |
@@ -1040,8 +1040,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | @@ -1040,8 +1040,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang | ||
1040 | if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil { | 1040 | if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil { |
1041 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 1041 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
1042 | } | 1042 | } |
1043 | - | ||
1044 | - // 保存兑换活动更新 | ||
1045 | if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil { | 1043 | if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil { |
1046 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1044 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1047 | } else { | 1045 | } else { |
@@ -2334,14 +2332,12 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | @@ -2334,14 +2332,12 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC | ||
2334 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 2332 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
2335 | } | 2333 | } |
2336 | 2334 | ||
2337 | - // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励 | ||
2338 | - | ||
2339 | // 操作素币命令 | 2335 | // 操作素币命令 |
2340 | operationSuMoneyCommand := &command.OperationSuMoneyCommand{ | 2336 | operationSuMoneyCommand := &command.OperationSuMoneyCommand{ |
2341 | Uid: employeeFound.EmployeeInfo.Uid, | 2337 | Uid: employeeFound.EmployeeInfo.Uid, |
2342 | Operator: createExchangeCashPersonCommand.Operator, | 2338 | Operator: createExchangeCashPersonCommand.Operator, |
2343 | SuMoney: createExchangeCashPersonCommand.ExchangedSuMoney, | 2339 | SuMoney: createExchangeCashPersonCommand.ExchangedSuMoney, |
2344 | - OperationType: 4, | 2340 | + OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励 |
2345 | OperationDescription: "参与" + activityFound.ExchangeActivityName, | 2341 | OperationDescription: "参与" + activityFound.ExchangeActivityName, |
2346 | } | 2342 | } |
2347 | 2343 |
@@ -154,9 +154,7 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon | @@ -154,9 +154,7 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon | ||
154 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 154 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
155 | } | 155 | } |
156 | var suMoneyTransactionRecordsFormat []interface{} | 156 | var suMoneyTransactionRecordsFormat []interface{} |
157 | - //loc, _ := time.LoadLocation("Local") | ||
158 | for _, suMoneyTransactionRecord := range suMoneyTransactionRecords { | 157 | for _, suMoneyTransactionRecord := range suMoneyTransactionRecords { |
159 | - //dt, _ := ("2006-01-02 15:04:05", suMoneyTransactionRecord.CreateTime, loc) | ||
160 | suMoneyTransactionRecordFormat := map[string]interface{} { | 158 | suMoneyTransactionRecordFormat := map[string]interface{} { |
161 | "suMoneyTransactionRecordId": suMoneyTransactionRecord.SuMoneyTransactionRecordId, | 159 | "suMoneyTransactionRecordId": suMoneyTransactionRecord.SuMoneyTransactionRecordId, |
162 | "recordType": suMoneyTransactionRecord.RecordType, | 160 | "recordType": suMoneyTransactionRecord.RecordType, |
@@ -63,7 +63,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | @@ -63,7 +63,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | ||
63 | queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS cash") | 63 | queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS cash") |
64 | queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS su_money") | 64 | queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS su_money") |
65 | queryPeople = queryPeople.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(exchange_cash_person_list.exchanged_su_money) DESC) AS ranking") | 65 | queryPeople = queryPeople.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(exchange_cash_person_list.exchanged_su_money) DESC) AS ranking") |
66 | - queryPeople = queryPeople.Where("e.status = ?", 1) | 66 | + //queryPeople = queryPeople.Where("e.status = ?", 1) |
67 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 67 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
68 | queryPeople = queryPeople.Where("e.company_id = ?", companyId) | 68 | queryPeople = queryPeople.Where("e.company_id = ?", companyId) |
69 | } | 69 | } |
@@ -123,7 +123,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | @@ -123,7 +123,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | ||
123 | queryListSuMoney := tx.Model(exchangeCashPersonListModels) | 123 | queryListSuMoney := tx.Model(exchangeCashPersonListModels) |
124 | queryListSuMoney = queryListSuMoney.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid") | 124 | queryListSuMoney = queryListSuMoney.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid") |
125 | queryListSuMoney = queryListSuMoney.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS activity_exchanged_su_money") | 125 | queryListSuMoney = queryListSuMoney.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS activity_exchanged_su_money") |
126 | - queryListSuMoney = queryListSuMoney.Where("e.status = ?", 1) | 126 | + //queryListSuMoney = queryListSuMoney.Where("e.status = ?", 1) |
127 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 127 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
128 | queryListSuMoney = queryListSuMoney.Where("e.company_id = ?", companyId) | 128 | queryListSuMoney = queryListSuMoney.Where("e.company_id = ?", companyId) |
129 | } | 129 | } |
@@ -139,7 +139,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | @@ -139,7 +139,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac | ||
139 | queryListCash := tx.Model(exchangeCashPersonListModels) | 139 | queryListCash := tx.Model(exchangeCashPersonListModels) |
140 | queryListCash = queryListCash.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid") | 140 | queryListCash = queryListCash.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid") |
141 | queryListCash = queryListCash.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS activity_exchanged_cash") | 141 | queryListCash = queryListCash.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS activity_exchanged_cash") |
142 | - queryListCash = queryListCash.Where("e.status = ?", 1) | 142 | + //queryListCash = queryListCash.Where("e.status = ?", 1) |
143 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 143 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
144 | queryListCash = queryListCash.Where("e.company_id = ?", companyId) | 144 | queryListCash = queryListCash.Where("e.company_id = ?", companyId) |
145 | } | 145 | } |
@@ -337,7 +337,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -337,7 +337,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
337 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") | 337 | queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") |
338 | queryWealth = queryWealth.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money") | 338 | queryWealth = queryWealth.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) AS employee_su_money") |
339 | queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking") | 339 | queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3, 6) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type IN (4, 1, 5) THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking") |
340 | - //queryWealth = queryWealth.Where(`e.status = ?`, 1) | 340 | + queryWealth = queryWealth.Where(`e.status = ?`, 1) |
341 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 341 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
342 | queryWealth = queryWealth.Where("e.company_id = ?", companyId) | 342 | queryWealth = queryWealth.Where("e.company_id = ?", companyId) |
343 | } | 343 | } |
@@ -399,7 +399,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | @@ -399,7 +399,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter | ||
399 | queryContributions = queryContributions.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions") | 399 | queryContributions = queryContributions.ColumnExpr("sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) AS employees_contributions") |
400 | queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking") | 400 | queryContributions = queryContributions.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(case WHEN su_money_transaction_record.record_type IN (2, 3) THEN su_money_transaction_record.su_money ELSE 0 end) - sum(case WHEN su_money_transaction_record.record_type = 4 THEN su_money_transaction_record.su_money ELSE 0 end) DESC) AS ranking") |
401 | queryContributions = queryContributions.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) | 401 | queryContributions = queryContributions.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})) |
402 | - //queryContributions = queryContributions.Where(`e.status = ?`, 1) | 402 | + queryContributions = queryContributions.Where(`e.status = ?`, 1) |
403 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { | 403 | if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { |
404 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) | 404 | queryContributions = queryContributions.Where("e.company_id = ?", companyId) |
405 | } | 405 | } |
@@ -23,18 +23,19 @@ func (dao *ListIntervalDao) RankPeriodCheckTime(startTime time.Time, endTime tim | @@ -23,18 +23,19 @@ func (dao *ListIntervalDao) RankPeriodCheckTime(startTime time.Time, endTime tim | ||
23 | AND company_id = ? | 23 | AND company_id = ? |
24 | AND | 24 | AND |
25 | ( | 25 | ( |
26 | - (list_interval_start_time BETWEEN ? AND ?) | 26 | + ( to_char(list_interval_start_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') BETWEEN ? AND ?) |
27 | OR | 27 | OR |
28 | - (list_interval_end_time BETWEEN ? AND ?) | 28 | + ( to_char(list_interval_end_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') BETWEEN ? AND ?) |
29 | OR | 29 | OR |
30 | - (? BETWEEN list_interval_start_time AND list_interval_end_time) | 30 | + (? BETWEEN to_char(list_interval_start_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') AND to_char(list_interval_end_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS')) |
31 | OR | 31 | OR |
32 | - (? BETWEEN list_interval_start_time AND list_interval_end_time) | 32 | + (? BETWEEN to_char(list_interval_start_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') AND to_char(list_interval_end_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS')) |
33 | ) | 33 | ) |
34 | LIMIT 1 `, | 34 | LIMIT 1 `, |
35 | idNot, companyId, startTime, endTime, startTime, endTime, startTime, endTime) | 35 | idNot, companyId, startTime, endTime, startTime, endTime, startTime, endTime) |
36 | if err != nil { | 36 | if err != nil { |
37 | fmt.Errorf(err.Error()) | 37 | fmt.Errorf(err.Error()) |
38 | + fmt.Print(err.Error(), "\n") | ||
38 | return true | 39 | return true |
39 | } | 40 | } |
40 | return false | 41 | return false |
-
请 注册 或 登录 后发表评论