...
|
...
|
@@ -2,6 +2,7 @@ package service |
|
|
|
|
|
import (
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/command"
|
...
|
...
|
@@ -16,13 +17,24 @@ type DividendsReturnedOrderService struct { |
|
|
|
|
|
// 创建分红退货单服务
|
|
|
func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) {
|
|
|
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator)
|
|
|
_, err := creationCooperationGateway.DividendsReturnedOrderAdd(createDividendsReturnedOrderCommand.ReqDividendsReturnedOrderAdd)
|
|
|
dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
|
|
|
orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate, 0)
|
|
|
result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
|
|
|
DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
|
|
|
DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
|
|
|
OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum,
|
|
|
OrderGoods: createDividendsReturnedOrderCommand.OrderGoods,
|
|
|
DividendsReturnedDate: dividendsReturnedDate,
|
|
|
OrderData: orderDate,
|
|
|
OrgId: int(createDividendsReturnedOrderCommand.Operator.OrgId),
|
|
|
Remarks: createDividendsReturnedOrderCommand.Remarks,
|
|
|
RegionName: createDividendsReturnedOrderCommand.RegionName,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return createDividendsReturnedOrderCommand, nil
|
|
|
return dto.ToDividendsReturnedOrderInfo(&result.DividendsReturnedOrder), nil
|
|
|
}
|
|
|
|
|
|
// 返回分红退货单服务
|
...
|
...
|
@@ -77,7 +89,20 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide |
|
|
// 更新分红退货单服务
|
|
|
func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) {
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator)
|
|
|
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(updateDividendsReturnedOrderCommand.ReqDividendsReturnedOrderUpdate)
|
|
|
dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate, 0)
|
|
|
orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate, 0)
|
|
|
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{
|
|
|
DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID,
|
|
|
DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
|
|
|
DividendsOrderNumber: updateDividendsReturnedOrderCommand.DividendsOrderNumber,
|
|
|
OriginalOrderNum: updateDividendsReturnedOrderCommand.OriginalOrderNum,
|
|
|
OrderGoods: updateDividendsReturnedOrderCommand.OrderGoods,
|
|
|
DividendsReturnedDate: dividendsReturnedDate,
|
|
|
OrderData: orderDate,
|
|
|
OrgId: int(updateDividendsReturnedOrderCommand.Operator.OrgId),
|
|
|
Remarks: updateDividendsReturnedOrderCommand.Remarks,
|
|
|
RegionName: updateDividendsReturnedOrderCommand.RegionName,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -97,7 +122,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi |
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
listData := []map[string]interface{}{}
|
|
|
for _, v := range result.Gride.List {
|
|
|
for _, v := range result.Grid.List {
|
|
|
m := map[string]interface{}{
|
|
|
"dividendsOrderNumber": v.DividendsOrderNumber,
|
|
|
"dividendsOriginalOrderNum": v.DividendsOriginalOrderNum,
|
...
|
...
|
@@ -106,7 +131,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDivi |
|
|
}
|
|
|
listData = append(listData, m)
|
|
|
}
|
|
|
return result.Gride.Total, listData, nil
|
|
|
return result.Grid.Total, listData, nil
|
|
|
}
|
|
|
|
|
|
func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService {
|
...
|
...
|
|