作者 陈志颖

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

... ... @@ -439,10 +439,11 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
/***************************************************** 3.单元格类型校验 *********************************************/
typeError := make([]*domain.FailInfo, 0)
for _, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { // 行
var myRow []*domain.FailInfo
for j, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData { // 行
t := reflect.TypeOf(dividendsOrder)
v := reflect.ValueOf(dividendsOrder)
var myRow []*domain.FailInfo
for k := 0; k < t.NumField(); k++ { // 列
//r := strconv.Itoa(i + 1)
switch k {
... ... @@ -454,7 +455,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "订单日期格式错误,请输入正确的订单日期",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -467,7 +468,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "行产品数量格式错误,产品数量必须整数",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -476,7 +477,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "产品数量必须大于0,请重新填写",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -489,7 +490,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "产品价格格式错误,产品价格必须为数字类型",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -499,7 +500,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "产品价格超过最大限制,产品价格小数点前面不能超过十六位数字,并保留两位小数",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -508,7 +509,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "产品价格必须大于0,请重新填写",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ... @@ -522,7 +523,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "费用格式错误,费用必须为数字类型",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
log.Logger.Info("费用类型错误", map[string]interface{}{
"tmpRow": tmpRow,
... ... @@ -534,7 +535,7 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
tmpRow := &domain.FailInfo{
FailReason: "费用超过最大限制,费用小数点前面不能超过十六位数字,并保留两位小数",
}
tmpRow.ImportDividendsOrderData = &dividendsOrder
tmpRow.ImportDividendsOrderData = &importDividendsOrderCommand.DividendsOrderData[j]
myRow = append(myRow, tmpRow)
continue
}
... ...
... ... @@ -478,10 +478,11 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
/***************************************************** 3.单元格类型校验 *********************************************/
typeError := make([]*domain.FailReturnedInfo, 0)
for _, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { // 行
var myRow []*domain.FailReturnedInfo
for j, dividendsReturnedOrder := range importDividendsReturnedOrderCommand.DividendsReturnedOrderData { // 行
t := reflect.TypeOf(dividendsReturnedOrder)
v := reflect.ValueOf(dividendsReturnedOrder)
var myRow []*domain.FailReturnedInfo
for k := 0; k < t.NumField(); k++ { // 列
switch k {
case 3: // 退货日期校验
... ... @@ -491,7 +492,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if !ok {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货日期格式错误,请输入正确的退货日期",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -504,7 +505,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if !ok {
tmpRow := &domain.FailReturnedInfo{
FailReason: "订单日期格式错误,请输入正确的订单日期",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -517,7 +518,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if err != nil {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货数量格式错误,退货数量必须整数",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -526,7 +527,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if orderGoodQuantity < 0 {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货数量必须大于0,请重新填写",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -539,7 +540,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if typeErr != nil {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货价格格式错误,退货价格必须为数字类型",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -549,7 +550,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if univalent >= 1e16 {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货价格超过最大限制,退货价格小数点前面不能超过十六位数字,并保留两位小数",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ... @@ -559,7 +560,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDivide
if univalent < 0 {
tmpRow := &domain.FailReturnedInfo{
FailReason: "退货价格必须大于0,请重新填写",
ImportDividendsReturnedOrderData: &dividendsReturnedOrder,
ImportDividendsReturnedOrderData: &importDividendsReturnedOrderCommand.DividendsReturnedOrderData[j],
}
myRow = append(myRow, tmpRow)
continue
... ...