|
@@ -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)
|