作者 陈志颖

fix:禁用人员处理i

... ... @@ -67,13 +67,12 @@ func (listIntervalService *ListIntervalService) CreateListInterval(createListInt
startTime := time.Date(createListIntervalCommand.ListIntervalStartTime.Local().Year(), createListIntervalCommand.ListIntervalStartTime.Local().Month(), createListIntervalCommand.ListIntervalStartTime.Local().Day(), 0, 0, 0, 0, time.Local)
endTime := time.Date(createListIntervalCommand.ListIntervalEndTime.Local().Year(), createListIntervalCommand.ListIntervalEndTime.Local().Month(), createListIntervalCommand.ListIntervalEndTime.Local().Day(), 23, 59, 59, 0, time.Local)
startTimeCheck := time.Date(createListIntervalCommand.ListIntervalStartTime.Year(), createListIntervalCommand.ListIntervalStartTime.Month(), createListIntervalCommand.ListIntervalStartTime.Day(), 0, 0, 0, 0, time.UTC)
endTimeCheck := time.Date(createListIntervalCommand.ListIntervalEndTime.Year(), createListIntervalCommand.ListIntervalEndTime.Month(), createListIntervalCommand.ListIntervalEndTime.Day(), 23, 59, 59, 0, time.UTC)
ok := listIntervalDao.RankPeriodCheckTime(startTimeCheck, endTimeCheck, 0, listIntervals[0].CompanyId)
fmt.Print(ok, "\n")
if ok {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠")
if len(listIntervals) > 0 {
ok := listIntervalDao.RankPeriodCheckTime(startTime, endTime, 0, listIntervals[0].CompanyId)
fmt.Print(ok, "\n")
if ok {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠")
}
}
// 创建排行榜时间
... ... @@ -260,10 +259,7 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
updateListIntervalCommand.ListIntervalStartTime = startTime
updateListIntervalCommand.ListIntervalEndTime = endTime
startTimeCheck := time.Date(updateListIntervalCommand.ListIntervalStartTime.Year(), updateListIntervalCommand.ListIntervalStartTime.Month(), updateListIntervalCommand.ListIntervalStartTime.Day(), 0, 0, 0, 0, time.UTC)
endTimeCheck := time.Date(updateListIntervalCommand.ListIntervalEndTime.Year(), updateListIntervalCommand.ListIntervalEndTime.Month(), updateListIntervalCommand.ListIntervalEndTime.Day(), 23, 59, 59, 0, time.UTC)
ok := listIntervalDao.RankPeriodCheckTime(startTimeCheck, endTimeCheck, listIntervalFound.ListIntervalId, listIntervalFound.CompanyId)
ok := listIntervalDao.RankPeriodCheckTime(startTime, endTime, listIntervalFound.ListIntervalId, listIntervalFound.CompanyId)
if ok {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "年榜时间不能重叠")
}
... ...
... ... @@ -1040,8 +1040,6 @@ func (cashPoolService *CashPoolService) UpdateExchangeCashActivity(updateExchang
if err := activityFound.Update(tool_funs.SimpleStructToMap(updateExchangeCashActivityCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 保存兑换活动更新
if activityUpdated, err := exchangeCashActivityRepository.Save(activityFound); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
... ... @@ -2334,14 +2332,12 @@ func (cashPoolService *CashPoolService) CreateExchangeCashPerson(createExchangeC
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
// 操作素币命令
operationSuMoneyCommand := &command.OperationSuMoneyCommand{
Uid: employeeFound.EmployeeInfo.Uid,
Operator: createExchangeCashPersonCommand.Operator,
SuMoney: createExchangeCashPersonCommand.ExchangedSuMoney,
OperationType: 4,
OperationType: 4, // 操作类型->记录类型对应:1->3: 增加 2->4: 扣除 3->1: 兑换物资 4->5: 兑换现金活动 41->6: 撤回兑换现金素币 5->2: 任务奖励
OperationDescription: "参与" + activityFound.ExchangeActivityName,
}
... ...
... ... @@ -154,9 +154,7 @@ func (suMoneyService *SuMoneyService) SearchSuMoneyTransactionRecord(searchSuMon
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var suMoneyTransactionRecordsFormat []interface{}
//loc, _ := time.LoadLocation("Local")
for _, suMoneyTransactionRecord := range suMoneyTransactionRecords {
//dt, _ := ("2006-01-02 15:04:05", suMoneyTransactionRecord.CreateTime, loc)
suMoneyTransactionRecordFormat := map[string]interface{} {
"suMoneyTransactionRecordId": suMoneyTransactionRecord.SuMoneyTransactionRecordId,
"recordType": suMoneyTransactionRecord.RecordType,
... ...
... ... @@ -63,7 +63,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS cash")
queryPeople = queryPeople.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS su_money")
queryPeople = queryPeople.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(exchange_cash_person_list.exchanged_su_money) DESC) AS ranking")
queryPeople = queryPeople.Where("e.status = ?", 1)
//queryPeople = queryPeople.Where("e.status = ?", 1)
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryPeople = queryPeople.Where("e.company_id = ?", companyId)
}
... ... @@ -123,7 +123,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
queryListSuMoney := tx.Model(exchangeCashPersonListModels)
queryListSuMoney = queryListSuMoney.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid")
queryListSuMoney = queryListSuMoney.ColumnExpr("sum(exchange_cash_person_list.exchanged_su_money) AS activity_exchanged_su_money")
queryListSuMoney = queryListSuMoney.Where("e.status = ?", 1)
//queryListSuMoney = queryListSuMoney.Where("e.status = ?", 1)
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryListSuMoney = queryListSuMoney.Where("e.company_id = ?", companyId)
}
... ... @@ -139,7 +139,7 @@ func (dao *CashPoolDao) ExchangeCashListRanking(queryOptions map[string]interfac
queryListCash := tx.Model(exchangeCashPersonListModels)
queryListCash = queryListCash.Join("JOIN employees AS e ON e.uid = exchange_cash_person_list.uid")
queryListCash = queryListCash.ColumnExpr("sum(exchange_cash_person_list.exchanged_cash) AS activity_exchanged_cash")
queryListCash = queryListCash.Where("e.status = ?", 1)
//queryListCash = queryListCash.Where("e.status = ?", 1)
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryListCash = queryListCash.Where("e.company_id = ?", companyId)
}
... ...
... ... @@ -337,7 +337,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
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")
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")
//queryWealth = queryWealth.Where(`e.status = ?`, 1)
queryWealth = queryWealth.Where(`e.status = ?`, 1)
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryWealth = queryWealth.Where("e.company_id = ?", companyId)
}
... ... @@ -399,7 +399,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
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")
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")
queryContributions = queryContributions.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
//queryContributions = queryContributions.Where(`e.status = ?`, 1)
queryContributions = queryContributions.Where(`e.status = ?`, 1)
if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
queryContributions = queryContributions.Where("e.company_id = ?", companyId)
}
... ...
... ... @@ -23,18 +23,19 @@ func (dao *ListIntervalDao) RankPeriodCheckTime(startTime time.Time, endTime tim
AND company_id = ?
AND
(
(list_interval_start_time BETWEEN ? AND ?)
( to_char(list_interval_start_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') BETWEEN ? AND ?)
OR
(list_interval_end_time BETWEEN ? AND ?)
( to_char(list_interval_end_time AT TIME ZONE 'CCT' ,'YYYY-MM-DD HH24:MI:SS') BETWEEN ? AND ?)
OR
(? BETWEEN list_interval_start_time AND list_interval_end_time)
(? 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'))
OR
(? BETWEEN list_interval_start_time AND list_interval_end_time)
(? 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'))
)
LIMIT 1 `,
idNot, companyId, startTime, endTime, startTime, endTime, startTime, endTime)
if err != nil {
fmt.Errorf(err.Error())
fmt.Print(err.Error(), "\n")
return true
}
return false
... ...