作者 陈志颖

fix:导入订单、退货单错误信息被覆盖问题

@@ -439,10 +439,11 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -439,10 +439,11 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
439 439
440 /***************************************************** 3.单元格类型校验 *********************************************/ 440 /***************************************************** 3.单元格类型校验 *********************************************/
441 typeError := make([]*domain.FailInfo, 0) 441 typeError := make([]*domain.FailInfo, 0)
442 - for _, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { // 行  
443 - var myRow []*domain.FailInfo 442 +
  443 + for j, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { // 行
444 t := reflect.TypeOf(dividendsOrder) 444 t := reflect.TypeOf(dividendsOrder)
445 v := reflect.ValueOf(dividendsOrder) 445 v := reflect.ValueOf(dividendsOrder)
  446 + var myRow []*domain.FailInfo
446 for k := 0; k < t.NumField(); k++ { // 列 447 for k := 0; k < t.NumField(); k++ { // 列
447 //r := strconv.Itoa(i + 1) 448 //r := strconv.Itoa(i + 1)
448 switch k { 449 switch k {
@@ -454,7 +455,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -454,7 +455,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
454 tmpRow := &domain.FailInfo{ 455 tmpRow := &domain.FailInfo{
455 FailReason: "订单日期格式错误,请输入正确的订单日期", 456 FailReason: "订单日期格式错误,请输入正确的订单日期",
456 } 457 }
457 - tmpRow.ImportDividendsOrderData = &dividendsOrder 458 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
458 myRow = append(myRow, tmpRow) 459 myRow = append(myRow, tmpRow)
459 continue 460 continue
460 } 461 }
@@ -467,7 +468,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -467,7 +468,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
467 tmpRow := &domain.FailInfo{ 468 tmpRow := &domain.FailInfo{
468 FailReason: "行产品数量格式错误,产品数量必须整数", 469 FailReason: "行产品数量格式错误,产品数量必须整数",
469 } 470 }
470 - tmpRow.ImportDividendsOrderData = &dividendsOrder 471 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
471 myRow = append(myRow, tmpRow) 472 myRow = append(myRow, tmpRow)
472 continue 473 continue
473 } 474 }
@@ -476,7 +477,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -476,7 +477,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
476 tmpRow := &domain.FailInfo{ 477 tmpRow := &domain.FailInfo{
477 FailReason: "产品数量必须大于0,请重新填写", 478 FailReason: "产品数量必须大于0,请重新填写",
478 } 479 }
479 - tmpRow.ImportDividendsOrderData = &dividendsOrder 480 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
480 myRow = append(myRow, tmpRow) 481 myRow = append(myRow, tmpRow)
481 continue 482 continue
482 } 483 }
@@ -489,7 +490,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -489,7 +490,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
489 tmpRow := &domain.FailInfo{ 490 tmpRow := &domain.FailInfo{
490 FailReason: "产品价格格式错误,产品价格必须为数字类型", 491 FailReason: "产品价格格式错误,产品价格必须为数字类型",
491 } 492 }
492 - tmpRow.ImportDividendsOrderData = &dividendsOrder 493 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
493 myRow = append(myRow, tmpRow) 494 myRow = append(myRow, tmpRow)
494 continue 495 continue
495 } 496 }
@@ -499,7 +500,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -499,7 +500,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
499 tmpRow := &domain.FailInfo{ 500 tmpRow := &domain.FailInfo{
500 FailReason: "产品价格超过最大限制,产品价格小数点前面不能超过十六位数字,并保留两位小数", 501 FailReason: "产品价格超过最大限制,产品价格小数点前面不能超过十六位数字,并保留两位小数",
501 } 502 }
502 - tmpRow.ImportDividendsOrderData = &dividendsOrder 503 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
503 myRow = append(myRow, tmpRow) 504 myRow = append(myRow, tmpRow)
504 continue 505 continue
505 } 506 }
@@ -508,7 +509,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -508,7 +509,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
508 tmpRow := &domain.FailInfo{ 509 tmpRow := &domain.FailInfo{
509 FailReason: "产品价格必须大于0,请重新填写", 510 FailReason: "产品价格必须大于0,请重新填写",
510 } 511 }
511 - tmpRow.ImportDividendsOrderData = &dividendsOrder 512 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
512 myRow = append(myRow, tmpRow) 513 myRow = append(myRow, tmpRow)
513 continue 514 continue
514 } 515 }
@@ -522,7 +523,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -522,7 +523,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
522 tmpRow := &domain.FailInfo{ 523 tmpRow := &domain.FailInfo{
523 FailReason: "费用格式错误,费用必须为数字类型", 524 FailReason: "费用格式错误,费用必须为数字类型",
524 } 525 }
525 - tmpRow.ImportDividendsOrderData = &dividendsOrder 526 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
526 myRow = append(myRow, tmpRow) 527 myRow = append(myRow, tmpRow)
527 log.Logger.Info("费用类型错误", map[string]interface{}{ 528 log.Logger.Info("费用类型错误", map[string]interface{}{
528 "tmpRow": tmpRow, 529 "tmpRow": tmpRow,
@@ -534,7 +535,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD @@ -534,7 +535,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
534 tmpRow := &domain.FailInfo{ 535 tmpRow := &domain.FailInfo{
535 FailReason: "费用超过最大限制,费用小数点前面不能超过十六位数字,并保留两位小数", 536 FailReason: "费用超过最大限制,费用小数点前面不能超过十六位数字,并保留两位小数",
536 } 537 }
537 - tmpRow.ImportDividendsOrderData = &dividendsOrder 538 + tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
538 myRow = append(myRow, tmpRow) 539 myRow = append(myRow, tmpRow)
539 continue 540 continue
540 } 541 }
@@ -478,10 +478,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -478,10 +478,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
478 478
479 /***************************************************** 3.单元格类型校验 *********************************************/ 479 /***************************************************** 3.单元格类型校验 *********************************************/
480 typeError := make([]*domain.FailReturnedInfo, 0) 480 typeError := make([]*domain.FailReturnedInfo, 0)
481 - for _, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { // 行  
482 - var myRow []*domain.FailReturnedInfo 481 +
  482 + for j, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { // 行
483 t := reflect.TypeOf(dividendsReturnedOrder) 483 t := reflect.TypeOf(dividendsReturnedOrder)
484 v := reflect.ValueOf(dividendsReturnedOrder) 484 v := reflect.ValueOf(dividendsReturnedOrder)
  485 + var myRow []*domain.FailReturnedInfo
485 for k := 0; k < t.NumField(); k++ { // 列 486 for k := 0; k < t.NumField(); k++ { // 列
486 switch k { 487 switch k {
487 case 3: // 退货日期校验 488 case 3: // 退货日期校验
@@ -491,7 +492,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -491,7 +492,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
491 if !ok { 492 if !ok {
492 tmpRow := &domain.FailReturnedInfo{ 493 tmpRow := &domain.FailReturnedInfo{
493 FailReason: "退货日期格式错误,请输入正确的退货日期", 494 FailReason: "退货日期格式错误,请输入正确的退货日期",
494 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 495 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
495 } 496 }
496 myRow = append(myRow, tmpRow) 497 myRow = append(myRow, tmpRow)
497 continue 498 continue
@@ -504,7 +505,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -504,7 +505,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
504 if !ok { 505 if !ok {
505 tmpRow := &domain.FailReturnedInfo{ 506 tmpRow := &domain.FailReturnedInfo{
506 FailReason: "订单日期格式错误,请输入正确的订单日期", 507 FailReason: "订单日期格式错误,请输入正确的订单日期",
507 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 508 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
508 } 509 }
509 myRow = append(myRow, tmpRow) 510 myRow = append(myRow, tmpRow)
510 continue 511 continue
@@ -517,7 +518,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -517,7 +518,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
517 if err != nil { 518 if err != nil {
518 tmpRow := &domain.FailReturnedInfo{ 519 tmpRow := &domain.FailReturnedInfo{
519 FailReason: "退货数量格式错误,退货数量必须整数", 520 FailReason: "退货数量格式错误,退货数量必须整数",
520 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 521 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
521 } 522 }
522 myRow = append(myRow, tmpRow) 523 myRow = append(myRow, tmpRow)
523 continue 524 continue
@@ -526,7 +527,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -526,7 +527,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
526 if orderGoodQuantity < 0 { 527 if orderGoodQuantity < 0 {
527 tmpRow := &domain.FailReturnedInfo{ 528 tmpRow := &domain.FailReturnedInfo{
528 FailReason: "退货数量必须大于0,请重新填写", 529 FailReason: "退货数量必须大于0,请重新填写",
529 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 530 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
530 } 531 }
531 myRow = append(myRow, tmpRow) 532 myRow = append(myRow, tmpRow)
532 continue 533 continue
@@ -539,7 +540,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -539,7 +540,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
539 if typeErr != nil { 540 if typeErr != nil {
540 tmpRow := &domain.FailReturnedInfo{ 541 tmpRow := &domain.FailReturnedInfo{
541 FailReason: "退货价格格式错误,退货价格必须为数字类型", 542 FailReason: "退货价格格式错误,退货价格必须为数字类型",
542 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 543 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
543 } 544 }
544 myRow = append(myRow, tmpRow) 545 myRow = append(myRow, tmpRow)
545 continue 546 continue
@@ -549,7 +550,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -549,7 +550,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
549 if univalent >= 1e16 { 550 if univalent >= 1e16 {
550 tmpRow := &domain.FailReturnedInfo{ 551 tmpRow := &domain.FailReturnedInfo{
551 FailReason: "退货价格超过最大限制,退货价格小数点前面不能超过十六位数字,并保留两位小数", 552 FailReason: "退货价格超过最大限制,退货价格小数点前面不能超过十六位数字,并保留两位小数",
552 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 553 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
553 } 554 }
554 myRow = append(myRow, tmpRow) 555 myRow = append(myRow, tmpRow)
555 continue 556 continue
@@ -559,7 +560,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide @@ -559,7 +560,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
559 if univalent < 0 { 560 if univalent < 0 {
560 tmpRow := &domain.FailReturnedInfo{ 561 tmpRow := &domain.FailReturnedInfo{
561 FailReason: "退货价格必须大于0,请重新填写", 562 FailReason: "退货价格必须大于0,请重新填写",
562 - ImportDividendsReturnedOrderData: &dividendsReturnedOrder, 563 + ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
563 } 564 }
564 myRow = append(myRow, tmpRow) 565 myRow = append(myRow, tmpRow)
565 continue 566 continue