...
|
...
|
@@ -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 {
|
...
|
...
|
@@ -692,6 +693,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
PartnerInfo: domain.Partner{
|
|
|
Id: orderModel.PartnerId,
|
|
|
},
|
|
|
SaleDate: orderModel.SaleDate,
|
|
|
BonusStatus: orderModel.BonusStatus,
|
|
|
CompanyId: orderModel.CompanyId,
|
|
|
}
|
...
|
...
|
@@ -726,10 +728,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 +741,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 +768,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 +803,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)
|
...
|
...
|
@@ -878,6 +882,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List |
|
|
"delivery_code": result[i].DeliveryCode,
|
|
|
"partner_name": result[i].PartnerName,
|
|
|
"bonus_status": "",
|
|
|
"sale_date": result[i].SaleDate,
|
|
|
"update_time": result[i].UpdateTime,
|
|
|
"create_time": result[i].CreateTime,
|
|
|
"partner_bonus": fmt.Sprintf("%10.2f", result[i].PartnerBonus),
|
...
|
...
|
@@ -910,6 +915,7 @@ func (service OrderInfoService) ListOrderBonusForExcel(listOrderQuery query.List |
|
|
[2]string{"partner_name", "合伙人"},
|
|
|
[2]string{"bonus_status", "支付状态"},
|
|
|
[2]string{"create_time", "创建时间"},
|
|
|
[2]string{"sale_date", "销售时间"},
|
|
|
[2]string{"partner_bonus", "应收分红"},
|
|
|
[2]string{"partner_bonus_has", "已收分红"},
|
|
|
[2]string{"partner_bonus_not", "未收分红"},
|
...
|
...
|
|