...
|
...
|
@@ -2,10 +2,11 @@ package service |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/event/subscriber"
|
...
|
...
|
@@ -20,7 +21,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
|
|
|
)
|
|
|
|
|
|
//OrderService 自建订单,意向单,实发订单
|
|
|
// OrderService 自建订单,意向单,实发订单
|
|
|
type OrderInfoService struct {
|
|
|
}
|
|
|
|
...
|
...
|
@@ -125,7 +126,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder |
|
|
return orderDataReturn, cnt, nil
|
|
|
}
|
|
|
|
|
|
//GetOrderDetail 获取订单详情
|
|
|
// GetOrderDetail 获取订单详情
|
|
|
func (service OrderInfoService) GetOrderDetail(getOrderQuery query.GetOrderQuery) (*domain.OrderBase, error) {
|
|
|
//实际业务
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -352,7 +353,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
|
|
return newOrder, nil
|
|
|
}
|
|
|
|
|
|
//DeleteOrder 删除订单
|
|
|
// DeleteOrder 删除订单
|
|
|
func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -393,7 +394,7 @@ func (service OrderInfoService) DeleteOrder(orderId int64, companyId int64) erro |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//UpdateOrderData 编辑订单
|
|
|
// UpdateOrderData 编辑订单
|
|
|
func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) (*domain.OrderBase, error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -581,7 +582,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
|
|
return oldOrderData, nil
|
|
|
}
|
|
|
|
|
|
//deleteOldOrderGoods 新旧商品列表对比
|
|
|
// deleteOldOrderGoods 新旧商品列表对比
|
|
|
func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, oldGoods []domain.OrderGood) (goodIds []int64) {
|
|
|
for _, old := range oldGoods {
|
|
|
var hasIn bool
|
...
|
...
|
@@ -598,7 +599,7 @@ func (service OrderInfoService) deleteOldOrderGoods(newGoods []domain.OrderGood, |
|
|
return
|
|
|
}
|
|
|
|
|
|
//DisableOrEnable 开启关闭订单
|
|
|
// DisableOrEnable 开启关闭订单
|
|
|
func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -642,7 +643,7 @@ func (service OrderInfoService) DisableOrEnable(cmd command.DisableOrderCommand) |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//PageListOrderBouns 获取订单的分红列表
|
|
|
// PageListOrderBouns 获取订单的分红列表
|
|
|
func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrderBonusQuery) ([]map[string]interface{}, int, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -726,10 +727,11 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
goods []domain.OrderGood
|
|
|
hasBonusPercent bool
|
|
|
)
|
|
|
goods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
|
|
|
goods, _, _ = orderGoodRepository.Find(domain.OrderGoodFindQuery{OrderId: orders[i].Id})
|
|
|
for ii := range goods {
|
|
|
if goods[ii].PartnerBonusPercent >= 0 {
|
|
|
hasBonusPercent = true
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
listIndex := listOrderQuery.Offset + (1 + i)
|
...
|
...
|
@@ -738,6 +740,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
"createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"id": fmt.Sprint(orders[i].Id),
|
|
|
"saleDate": orders[i].SaleDate.Local().Format("2006-01-02"),
|
|
|
"shipmentsId": orders[i].DeliveryCode,
|
|
|
"partner": orders[i].PartnerInfo.PartnerName,
|
|
|
"dividendsReceivable": fmt.Sprint(orders[i].GetCurrentPartnerBonus()),
|
...
|
...
|
@@ -764,7 +767,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
return resp, cnt, nil
|
|
|
}
|
|
|
|
|
|
//PayPartnerBonusWithOrderBestshop 支付分红
|
|
|
// PayPartnerBonusWithOrderBestshop 支付分红
|
|
|
func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adminId int64) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -799,7 +802,7 @@ func (service OrderInfoService) PayPartnerBonus(orderId int64, goodId int64, adm |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//UpdateOrderRemarkBonus 订单分红详情,更新备注
|
|
|
// UpdateOrderRemarkBonus 订单分红详情,更新备注
|
|
|
func (service OrderInfoService) UpdateOrderRemarkBonus(orderId int64, adminId int64, remark string) error {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
...
|
...
|
|