作者 陈志颖

test:导入

@@ -410,8 +410,8 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut @@ -410,8 +410,8 @@ func (statisticsService *StatisticsService) ContributionsWealthRanking(contribut
410 } 410 }
411 411
412 if contributionsWealthRankingQuery.RankingType == 1 { // 返回总榜 412 if contributionsWealthRankingQuery.RankingType == 1 { // 返回总榜
413 - contributionsWealthRankingQuery.StartTime = time.Date(1971, time.Month(1), 1, 0, 0, 0, 0, time.Now().Location())  
414 - contributionsWealthRankingQuery.EndTime = time.Now() 413 + contributionsWealthRankingQuery.StartTime = time.Date(1971, time.Month(1), 1, 0, 0, 0, 0, time.Local)
  414 + contributionsWealthRankingQuery.EndTime = time.Now().Local()
415 } else if contributionsWealthRankingQuery.RankingType == 2 { // 返回年榜 415 } else if contributionsWealthRankingQuery.RankingType == 2 { // 返回年榜
416 // 获取公司最新年榜 416 // 获取公司最新年榜
417 var listIntervalRepository domain.ListIntervalRepository 417 var listIntervalRepository domain.ListIntervalRepository
@@ -319,7 +319,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter @@ -319,7 +319,7 @@ func (dao *EmployeeDao) ContributionsWealthRanking(queryOptions map[string]inter
319 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name") 319 queryWealth = queryWealth.ColumnExpr("su_money_transaction_record.employee->>'employeeName' AS employee_name")
320 queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money") 320 queryWealth = queryWealth.ColumnExpr("sum(su_money_transaction_record.su_money) AS employee_su_money")
321 queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking") 321 queryWealth = queryWealth.ColumnExpr("ROW_NUMBER() OVER (ORDER BY sum(su_money_transaction_record.su_money) DESC) AS ranking")
322 - queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6})) 322 + queryWealth = queryWealth.Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3}))
323 queryWealth = queryWealth.Where(`e.status = ?`, 1) // 离职员工过滤 323 queryWealth = queryWealth.Where(`e.status = ?`, 1) // 离职员工过滤
324 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) { 324 if companyId, ok := queryOptions["companyId"]; ok && (companyId.(int64) != 0) {
325 queryWealth = queryWealth.Where("e.company_id = ?", companyId) 325 queryWealth = queryWealth.Where("e.company_id = ?", companyId)
@@ -394,26 +394,28 @@ func (controller *SuMoneyController) ExchangeCashListRanking() { @@ -394,26 +394,28 @@ func (controller *SuMoneyController) ExchangeCashListRanking() {
394 // 导入兑换素币清单 394 // 导入兑换素币清单
395 func (controller *SuMoneyController) ImportExchangeList () { 395 func (controller *SuMoneyController) ImportExchangeList () {
396 cashPoolService := service.NewCashPoolService(nil) 396 cashPoolService := service.NewCashPoolService(nil)
397 - //importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}  
398 - //json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)  
399 - //fmt.Printf("命令:%+v\n", importExchangeCashListCommand.Where)  
400 - //fmt.Print(controller.GetString("where"), "\n")  
401 - where := controller.GetString("where")  
402 - //typeOf := reflect.TypeOf(where)  
403 - //if reflect.TypeOf(where) == Type.String() {  
404 - // jsonMap := make(map[string]interface{})  
405 - // _ := json.Unmarshal([]byte(where), &jsonMap)  
406 - // fmt.Printf("%+v\n", jsonMap)  
407 - //}  
408 - //fmt.Print(reflect.TypeOf(where), "\n") 397 + importExchangeCashListCommand := &command.ImportExchangeCashListCommand{}
  398 +
  399 + json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), importExchangeCashListCommand)
  400 +
  401 + //where := controller.GetString("where")
  402 +
409 file, h, _ := controller.GetFile("file") 403 file, h, _ := controller.GetFile("file")
410 404
411 jsonMap := make(map[string]interface{}) 405 jsonMap := make(map[string]interface{})
412 - err := json.Unmarshal([]byte(where), &jsonMap) 406 +
  407 + //if reflect.TypeOf(where).Kind() == reflect.TypeOf(jsonMap).Kind() { // 传入json
  408 + // jsonMap = map[string]interface{}{
  409 + // "activityId": where.(map[string]interface{})["activityId"],
  410 + // "uid": where["uid"],
  411 + // }
  412 + //} else { // 传入json string
  413 + // _ := json.Unmarshal([]byte(where), &jsonMap)
  414 + //}
  415 +
413 fmt.Printf("%+v\n", jsonMap) 416 fmt.Printf("%+v\n", jsonMap)
414 417
415 tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 ) 418 tmp, _ := strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
416 -  
417 fmt.Print(tmp, "\n") 419 fmt.Print(tmp, "\n")
418 420
419 // 错误信息返回 421 // 错误信息返回
@@ -490,13 +492,23 @@ func (controller *SuMoneyController) ImportExchangeList () { @@ -490,13 +492,23 @@ func (controller *SuMoneyController) ImportExchangeList () {
490 492
491 //fmt.Print(len(rows), "\n") 493 //fmt.Print(len(rows), "\n")
492 494
  495 + //if personNameMatch, ok := where.(map[string]interface{})["personNameMatch"]; ok && (personNameMatch != "") {
  496 + // query = query.Where(`exchange_cash_person_list.employee_name LIKE ?`, fmt.Sprintf("%%%s%%", personNameMatch.(string)))
  497 + //}
  498 + //if activityId, ok := where.(map[string]interface{})["activityId"]; ok && activityId != "" {
  499 + // float, _ := strconv.ParseFloat(activityId.(string),64)
  500 + // query = query.Where("exchange_cash_person_list.activity_id = ?", float)
  501 + //}
  502 +
493 for i, row := range rows { 503 for i, row := range rows {
494 //fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row)) 504 //fmt.Printf("Row Number:%d, Row: %+v\n, Row Length: %d\n", i, row, len(row))
495 if i > 2 && len(row) > 1 { 505 if i > 2 && len(row) > 1 {
496 // 创建兑换清单命令 506 // 创建兑换清单命令
497 createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{} 507 createExchangeCashPersonCommand := &command.CreateExchangeCashPersonCommand{}
498 - createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )  
499 - createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64)) 508 + //createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(jsonMap["activityId"].(string), 10, 64 )
  509 + createExchangeCashPersonCommand.ExchangeCashActivityId, _ = strconv.ParseInt(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["activityId"].(string), 10, 64)
  510 + //createExchangeCashPersonCommand.Operator = int64(jsonMap["uid"].(float64))
  511 + createExchangeCashPersonCommand.Operator = int64(interface{}(importExchangeCashListCommand.Where).(map[string]interface{})["uid"].(float64))
500 createExchangeCashPersonCommand.PersonName = row[0] 512 createExchangeCashPersonCommand.PersonName = row[0]
501 createExchangeCashPersonCommand.PersonAccount = row[1] 513 createExchangeCashPersonCommand.PersonAccount = row[1]
502 r2, _ := strconv.ParseFloat(row[2], 64) 514 r2, _ := strconv.ParseFloat(row[2], 64)