...
|
...
|
@@ -558,19 +558,21 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD |
|
|
var dividendsOrderCommands = make(map[string]*command.CreateDividendsOrderCommand)
|
|
|
|
|
|
for i, dividendsOrder := range importDividendsOrderCommand.DividendsOrderData {
|
|
|
hashValue := md5.Sum([]byte(dividendsOrder.OriginalOrderNum + dividendsOrder.OrderTime))
|
|
|
hashValue := md5.Sum([]byte(dividendsOrder.OriginalOrderNum))
|
|
|
hashString := hex.EncodeToString(hashValue[:])
|
|
|
if _, ok := dividendsOrderCommands[hashString]; !ok {
|
|
|
// 订单日期时间格式转换
|
|
|
timeValue, err := time.ParseInLocation("2006/01/02", dividendsOrder.OrderTime, time.Local)
|
|
|
if err != nil {
|
|
|
tmpRow := &domain.FailInfo{
|
|
|
FailReason: "无效的订单日期",
|
|
|
}
|
|
|
tmpRow.ImportDividendsOrderData = ÷ndsOrder
|
|
|
aggregateErrorList = append(aggregateErrorList, tmpRow)
|
|
|
continue
|
|
|
|
|
|
// 订单日期时间格式转换
|
|
|
timeValue, err := time.ParseInLocation("2006/01/02", dividendsOrder.OrderTime, time.Local)
|
|
|
if err != nil {
|
|
|
tmpRow := &domain.FailInfo{
|
|
|
FailReason: "无效的订单日期",
|
|
|
}
|
|
|
tmpRow.ImportDividendsOrderData = ÷ndsOrder
|
|
|
aggregateErrorList = append(aggregateErrorList, tmpRow)
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
if _, ok := dividendsOrderCommands[hashString]; !ok {
|
|
|
|
|
|
// 产品相关:产品名称,产品数量、产品价格、费用
|
|
|
quantity, err := strconv.ParseFloat(dividendsOrder.OrderGoodQuantity, 64)
|
...
|
...
|
@@ -670,6 +672,29 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD |
|
|
}
|
|
|
}
|
|
|
|
|
|
log.Logger.Info("订单时间1:", map[string]interface{}{
|
|
|
"timeValue": strconv.FormatInt(timeValue.Local().UnixNano()/1e6, 10),
|
|
|
})
|
|
|
|
|
|
log.Logger.Info("订单时间2:", map[string]interface{}{
|
|
|
"timeValue": dividendsOrderCommands[hashString].OrderTime,
|
|
|
})
|
|
|
|
|
|
if strconv.FormatInt(timeValue.Local().UnixNano()/1e6, 10) != dividendsOrderCommands[hashString].OrderTime {
|
|
|
log.Logger.Info("订单:", map[string]interface{}{
|
|
|
"order": dividendsOrder,
|
|
|
})
|
|
|
tmpRow := &domain.FailInfo{
|
|
|
FailReason: "同一笔订单的订单时间必须相同",
|
|
|
ImportDividendsOrderData: ÷ndsOrder,
|
|
|
}
|
|
|
aggregateErrorList = append(aggregateErrorList, tmpRow)
|
|
|
log.Logger.Info("聚合订单错误:", map[string]interface{}{
|
|
|
"aggregateErrorList": aggregateErrorList,
|
|
|
})
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
dividendsOrderCommands[hashString].OrderGoods = append(dividendsOrderCommands[hashString].OrderGoods, command.OrderGoods{
|
|
|
OrderGoodId: "0",
|
|
|
OrderGoodAmount: 0,
|
...
|
...
|
@@ -1127,6 +1152,7 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
}
|
|
|
if count, dividendsOrders, err := dividendsOrderRepository.Find(map[string]interface{}{
|
|
|
"dividendsOrderIds": dividendsOrderIds,
|
|
|
"offsetLimit": false,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
|