正在显示
2 个修改的文件
包含
50 行增加
和
3 行删除
@@ -558,9 +558,9 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | @@ -558,9 +558,9 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | ||
558 | var dividendsOrderCommands = make(map[string]*command.CreateDividendsOrderCommand) | 558 | var dividendsOrderCommands = make(map[string]*command.CreateDividendsOrderCommand) |
559 | 559 | ||
560 | for i, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { | 560 | for i, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { |
561 | - hashValue := md5.Sum([]byte(dividendsOrder.OriginalOrderNum + dividendsOrder.OrderTime)) | 561 | + hashValue := md5.Sum([]byte(dividendsOrder.OriginalOrderNum)) |
562 | hashString := hex.EncodeToString(hashValue[:]) | 562 | hashString := hex.EncodeToString(hashValue[:]) |
563 | - if _, ok := dividendsOrderCommands[hashString]; !ok { | 563 | + |
564 | // 订单日期时间格式转换 | 564 | // 订单日期时间格式转换 |
565 | timeValue, err := time.ParseInLocation("2006/01/02", dividendsOrder.OrderTime, time.Local) | 565 | timeValue, err := time.ParseInLocation("2006/01/02", dividendsOrder.OrderTime, time.Local) |
566 | if err != nil { | 566 | if err != nil { |
@@ -572,6 +572,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | @@ -572,6 +572,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | ||
572 | continue | 572 | continue |
573 | } | 573 | } |
574 | 574 | ||
575 | + if _, ok := dividendsOrderCommands[hashString]; !ok { | ||
576 | + | ||
575 | // 产品相关:产品名称,产品数量、产品价格、费用 | 577 | // 产品相关:产品名称,产品数量、产品价格、费用 |
576 | quantity, err := strconv.ParseFloat(dividendsOrder.OrderGoodQuantity, 64) | 578 | quantity, err := strconv.ParseFloat(dividendsOrder.OrderGoodQuantity, 64) |
577 | if err != nil { | 579 | if err != nil { |
@@ -670,6 +672,29 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | @@ -670,6 +672,29 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD | ||
670 | } | 672 | } |
671 | } | 673 | } |
672 | 674 | ||
675 | + log.Logger.Info("订单时间1:", map[string]interface{}{ | ||
676 | + "timeValue": strconv.FormatInt(timeValue.Local().UnixNano()/1e6, 10), | ||
677 | + }) | ||
678 | + | ||
679 | + log.Logger.Info("订单时间2:", map[string]interface{}{ | ||
680 | + "timeValue": dividendsOrderCommands[hashString].OrderTime, | ||
681 | + }) | ||
682 | + | ||
683 | + if strconv.FormatInt(timeValue.Local().UnixNano()/1e6, 10) != dividendsOrderCommands[hashString].OrderTime { | ||
684 | + log.Logger.Info("订单:", map[string]interface{}{ | ||
685 | + "order": dividendsOrder, | ||
686 | + }) | ||
687 | + tmpRow := &domain.FailInfo{ | ||
688 | + FailReason: "同一笔订单的订单时间必须相同", | ||
689 | + ImportDividendsOrderData: ÷ndsOrder, | ||
690 | + } | ||
691 | + aggregateErrorList = append(aggregateErrorList, tmpRow) | ||
692 | + log.Logger.Info("聚合订单错误:", map[string]interface{}{ | ||
693 | + "aggregateErrorList": aggregateErrorList, | ||
694 | + }) | ||
695 | + continue | ||
696 | + } | ||
697 | + | ||
673 | dividendsOrderCommands[hashString].OrderGoods = append(dividendsOrderCommands[hashString].OrderGoods, command.OrderGoods{ | 698 | dividendsOrderCommands[hashString].OrderGoods = append(dividendsOrderCommands[hashString].OrderGoods, command.OrderGoods{ |
674 | OrderGoodId: "0", | 699 | OrderGoodId: "0", |
675 | OrderGoodAmount: 0, | 700 | OrderGoodAmount: 0, |
@@ -1127,6 +1152,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | @@ -1127,6 +1152,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba | ||
1127 | } | 1152 | } |
1128 | if count, dividendsOrders, err := dividendsOrderRepository.Find(map[string]interface{}{ | 1153 | if count, dividendsOrders, err := dividendsOrderRepository.Find(map[string]interface{}{ |
1129 | "dividendsOrderIds": dividendsOrderIds, | 1154 | "dividendsOrderIds": dividendsOrderIds, |
1155 | + "offsetLimit": false, | ||
1130 | }); err != nil { | 1156 | }); err != nil { |
1131 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1157 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1132 | } else { | 1158 | } else { |
@@ -581,7 +581,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | @@ -581,7 +581,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | ||
581 | var dividendsReturnedOrderCommands = make(map[string]*command.CreateDividendsReturnedOrderCommand) | 581 | var dividendsReturnedOrderCommands = make(map[string]*command.CreateDividendsReturnedOrderCommand) |
582 | 582 | ||
583 | for i, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { | 583 | for i, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { |
584 | - hashValue := md5.Sum([]byte(dividendsReturnedOrder.OriginalOrderNum + dividendsReturnedOrder.OrderTime)) | 584 | + hashValue := md5.Sum([]byte(dividendsReturnedOrder.OriginalOrderNum)) |
585 | hashString := hex.EncodeToString(hashValue[:]) | 585 | hashString := hex.EncodeToString(hashValue[:]) |
586 | if _, ok := dividendsReturnedOrderCommands[hashString]; !ok { | 586 | if _, ok := dividendsReturnedOrderCommands[hashString]; !ok { |
587 | // 订单日期时间格式转换 | 587 | // 订单日期时间格式转换 |
@@ -656,6 +656,17 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | @@ -656,6 +656,17 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | ||
656 | LineNumbers: []int{i}, // 记录行号 | 656 | LineNumbers: []int{i}, // 记录行号 |
657 | } | 657 | } |
658 | } else { // 聚合同一笔订单产品 | 658 | } else { // 聚合同一笔订单产品 |
659 | + // 订单日期时间格式转换 | ||
660 | + timeValue, err := time.ParseInLocation("2006/01/02", dividendsReturnedOrder.OrderTime, time.Local) | ||
661 | + if err != nil { | ||
662 | + tmpRow := &domain.FailReturnedInfo{ | ||
663 | + FailReason: "无效的订单日期", | ||
664 | + ImportDividendsReturnedOrderData: ÷ndsReturnedOrder, | ||
665 | + } | ||
666 | + aggregateErrorList = append(aggregateErrorList, tmpRow) | ||
667 | + continue | ||
668 | + } | ||
669 | + | ||
659 | // 产品相关:产品名称,退货数量、退货价格 | 670 | // 产品相关:产品名称,退货数量、退货价格 |
660 | quantity, err := strconv.ParseFloat(dividendsReturnedOrder.OrderGoodQuantity, 64) | 671 | quantity, err := strconv.ParseFloat(dividendsReturnedOrder.OrderGoodQuantity, 64) |
661 | if err != nil { | 672 | if err != nil { |
@@ -677,6 +688,15 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | @@ -677,6 +688,15 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide | ||
677 | continue | 688 | continue |
678 | } | 689 | } |
679 | 690 | ||
691 | + if strconv.FormatInt(timeValue.Local().UnixNano()/1e6, 10) != dividendsReturnedOrderCommands[hashString].OrderTime { | ||
692 | + tmpRow := &domain.FailReturnedInfo{ | ||
693 | + FailReason: "同一笔退货单的订单时间必须相同", | ||
694 | + ImportDividendsReturnedOrderData: ÷ndsReturnedOrder, | ||
695 | + } | ||
696 | + aggregateErrorList = append(aggregateErrorList, tmpRow) | ||
697 | + continue | ||
698 | + } | ||
699 | + | ||
680 | dividendsReturnedOrderCommands[hashString].OrderGoods = append(dividendsReturnedOrderCommands[hashString].OrderGoods, command.OrderGoods{ | 700 | dividendsReturnedOrderCommands[hashString].OrderGoods = append(dividendsReturnedOrderCommands[hashString].OrderGoods, command.OrderGoods{ |
681 | OrderGoodId: "0", | 701 | OrderGoodId: "0", |
682 | OrderGoodAmount: 0, | 702 | OrderGoodAmount: 0, |
@@ -1113,6 +1133,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) BatchRemoveD | @@ -1113,6 +1133,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) BatchRemoveD | ||
1113 | } | 1133 | } |
1114 | if count, dividendsReturnedOrders, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{ | 1134 | if count, dividendsReturnedOrders, err := dividendsReturnedOrderRepository.Find(map[string]interface{}{ |
1115 | "dividendsReturnedOrderIds": dividendsReturnedOrderIds, | 1135 | "dividendsReturnedOrderIds": dividendsReturnedOrderIds, |
1136 | + "offsetLimit": false, | ||
1116 | }); err != nil { | 1137 | }); err != nil { |
1117 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1138 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1118 | } else { | 1139 | } else { |
-
请 注册 或 登录 后发表评论