切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
唐旭辉
4 years ago
提交
e04ce1fe8a5e0825c4b65a100329690754408aa6
1 个父辈
c91d907f
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
108 行增加
和
117 行删除
pkg/application/orderinfo/service/order_info.go
pkg/domain/order_with_bestshop.go
pkg/infrastructure/dao/pg_order_base_dao.go
pkg/infrastructure/domainService/pg_order_bonus_service.go
pkg/port/beego/controllers/order_dividend_controller.go
pkg/port/beego/routers/router.go
pkg/application/orderinfo/service/order_info.go
查看文件 @
e04ce1f
...
...
@@ -901,8 +901,8 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
return
resp
,
cnt
,
nil
}
//PayPartnerBonusWithOrderBestshop 支付分红,海鲜干货的订单 (orderType=domain.OrderTypeBestShop)
func
(
service
OrderInfoService
)
PayPartnerBonusWithOrderBestshop
(
orderId
int64
,
goodId
int64
,
adminId
int64
)
error
{
//PayPartnerBonusWithOrderBestshop 支付分红
func
(
service
OrderInfoService
)
PayPartnerBonus
(
orderId
int64
,
goodId
int64
,
adminId
int64
)
error
{
var
(
transactionContext
,
_
=
factory
.
CreateTransactionContext
(
nil
)
err
error
...
...
pkg/domain/order_with_bestshop.go
查看文件 @
e04ce1f
package
domain
import
(
"errors"
"fmt"
)
//类型为(orderType=OrderTypeBestShop) 海鲜干货的订单分红
//因页面上的对于该类型的订单分红状态处理方式 有别于原有的其他类型(OrderReal),所以单独提取出来
// OrderGoodWithBestshopBonusStatus 支付状态
type
OrderGoodWithBestshopBonusStatus
interface
{
OrderGoodBonusStatus
UpdateOrderGoodNumber
(
good
*
OrderGood
,
number
int
)
error
UpdatePertnerBonusPercent
(
good
*
OrderGood
,
percent
float64
)
error
}
//OrderGoodWithBestshop 处理订单中商品的分红相关数据
type
OrderGoodWithBestshop
struct
{
currentBonusStatus
OrderGoodWithBestshopBonusStatus
}
func
(
o
*
OrderGoodWithBestshop
)
UpdateBonusByGoodNumber
(
good
*
OrderGood
,
number
int
)
error
{
o
.
reset
(
good
)
if
good
.
PlanGoodNumber
<
number
{
return
fmt
.
Errorf
(
"修改商品数量的值不能大于初始值%d"
,
good
.
PlanGoodNumber
)
}
err
:=
o
.
currentBonusStatus
.
UpdateOrderGoodNumber
(
good
,
number
)
return
err
}
func
(
o
*
OrderGoodWithBestshop
)
UpdateBonusByPertnerBonusPercent
(
good
*
OrderGood
,
percent
float64
)
error
{
o
.
reset
(
good
)
err
:=
o
.
currentBonusStatus
.
UpdatePertnerBonusPercent
(
good
,
percent
)
return
err
}
func
(
o
*
OrderGoodWithBestshop
)
PayPartnerBonus
(
good
*
OrderGood
)
error
{
o
.
currentBonusStatus
=
OrderGoodBonusBestshopHasPay
{}
err
:=
good
.
Compute
()
if
err
!=
nil
{
return
errors
.
New
(
"核算商品数据失败"
+
err
.
Error
())
}
err
=
good
.
CurrentBonusStatus
.
PayPartnerBonus
(
good
)
return
err
}
func
(
o
*
OrderGoodWithBestshop
)
reset
(
good
*
OrderGood
)
{
switch
good
.
BonusStatus
{
case
OrderGoodWaitPay
:
o
.
currentBonusStatus
=
OrderGoodBonusBestshopWaitPay
{}
case
OrderGoodHasPay
:
o
.
currentBonusStatus
=
OrderGoodBonusBestshopHasPay
{}
}
return
}
//OrderGoodBonusBestshopWaitPay 货品支付状态:待支付
type
OrderGoodBonusBestshopWaitPay
struct
{
OrderGoodBonusWaitPay
}
var
_
OrderGoodWithBestshopBonusStatus
=
(
*
OrderGoodBonusBestshopWaitPay
)(
nil
)
func
(
waitPay
OrderGoodBonusBestshopWaitPay
)
UpdateOrderGoodNumber
(
good
*
OrderGood
,
number
int
)
error
{
good
.
UseGoodNumber
=
number
//待支付状态计算
err
:=
good
.
Compute
()
if
err
!=
nil
{
return
errors
.
New
(
"核算商品数据失败"
+
err
.
Error
())
}
err
=
good
.
CurrentBonusStatus
.
WartPayPartnerBonus
(
good
)
return
err
}
func
(
waitPay
OrderGoodBonusBestshopWaitPay
)
UpdatePertnerBonusPercent
(
good
*
OrderGood
,
percent
float64
)
error
{
good
.
PartnerBonusPercent
=
percent
//待支付状态计算
err
:=
good
.
Compute
()
if
err
!=
nil
{
return
errors
.
New
(
"核算商品数据失败"
+
err
.
Error
())
}
err
=
good
.
CurrentBonusStatus
.
WartPayPartnerBonus
(
good
)
return
err
}
//OrderGoodBonusBestshopHasPay 货品支付状态:已支付
type
OrderGoodBonusBestshopHasPay
struct
{
OrderGoodBonusHasPay
}
var
_
OrderGoodWithBestshopBonusStatus
=
(
*
OrderGoodBonusBestshopHasPay
)(
nil
)
func
(
hasPay
OrderGoodBonusBestshopHasPay
)
UpdateOrderGoodNumber
(
good
*
OrderGood
,
number
int
)
error
{
return
errors
.
New
(
"已支付分红的货品订单,不能修改货品数量"
)
}
func
(
hasPay
OrderGoodBonusBestshopHasPay
)
UpdatePertnerBonusPercent
(
good
*
OrderGood
,
percent
float64
)
error
{
return
errors
.
New
(
"已支付分红的货品订单,不能修改合伙人分红比例"
)
}
// type OrderGoodWithBestshopBonusStatus interface {
// OrderGoodBonusStatus
// UpdateOrderGoodNumber(good *OrderGood, number int) error
// UpdatePertnerBonusPercent(good *OrderGood, percent float64) error
// }
// //OrderGoodWithBestshop 处理订单中商品的分红相关数据
// type OrderGoodWithBestshop struct {
// currentBonusStatus OrderGoodWithBestshopBonusStatus
// }
// func (o *OrderGoodWithBestshop) UpdateBonusByGoodNumber(good *OrderGood, number int) error {
// o.reset(good)
// if good.PlanGoodNumber < number {
// return fmt.Errorf("修改商品数量的值不能大于初始值%d", good.PlanGoodNumber)
// }
// err := o.currentBonusStatus.UpdateOrderGoodNumber(good, number)
// return err
// }
// func (o *OrderGoodWithBestshop) UpdateBonusByPertnerBonusPercent(good *OrderGood, percent float64) error {
// o.reset(good)
// err := o.currentBonusStatus.UpdatePertnerBonusPercent(good, percent)
// return err
// }
// func (o *OrderGoodWithBestshop) PayPartnerBonus(good *OrderGood) error {
// o.currentBonusStatus = OrderGoodBonusBestshopHasPay{}
// err := good.Compute()
// if err != nil {
// return errors.New("核算商品数据失败" + err.Error())
// }
// err = good.CurrentBonusStatus.PayPartnerBonus(good)
// return err
// }
// func (o *OrderGoodWithBestshop) reset(good *OrderGood) {
// switch good.BonusStatus {
// case OrderGoodWaitPay:
// o.currentBonusStatus = OrderGoodBonusBestshopWaitPay{}
// case OrderGoodHasPay:
// o.currentBonusStatus = OrderGoodBonusBestshopHasPay{}
// }
// return
// }
// //OrderGoodBonusBestshopWaitPay 货品支付状态:待支付
// type OrderGoodBonusBestshopWaitPay struct {
// OrderGoodBonusWaitPay
// }
// var _ OrderGoodWithBestshopBonusStatus = (*OrderGoodBonusBestshopWaitPay)(nil)
// func (waitPay OrderGoodBonusBestshopWaitPay) UpdateOrderGoodNumber(good *OrderGood, number int) error {
// good.UseGoodNumber = number
// //待支付状态计算
// err := good.Compute()
// if err != nil {
// return errors.New("核算商品数据失败" + err.Error())
// }
// err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
// return err
// }
// func (waitPay OrderGoodBonusBestshopWaitPay) UpdatePertnerBonusPercent(good *OrderGood, percent float64) error {
// good.PartnerBonusPercent = percent
// //待支付状态计算
// err := good.Compute()
// if err != nil {
// return errors.New("核算商品数据失败" + err.Error())
// }
// err = good.CurrentBonusStatus.WartPayPartnerBonus(good)
// return err
// }
// //OrderGoodBonusBestshopHasPay 货品支付状态:已支付
// type OrderGoodBonusBestshopHasPay struct {
// OrderGoodBonusHasPay
// }
// var _ OrderGoodWithBestshopBonusStatus = (*OrderGoodBonusBestshopHasPay)(nil)
// func (hasPay OrderGoodBonusBestshopHasPay) UpdateOrderGoodNumber(good *OrderGood, number int) error {
// return errors.New("已支付分红的货品订单,不能修改货品数量")
// }
// func (hasPay OrderGoodBonusBestshopHasPay) UpdatePertnerBonusPercent(good *OrderGood, percent float64) error {
// return errors.New("已支付分红的货品订单,不能修改合伙人分红比例")
// }
...
...
pkg/infrastructure/dao/pg_order_base_dao.go
查看文件 @
e04ce1f
...
...
@@ -230,18 +230,18 @@ func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, par
//CustomOrderListForExcel 导出实际订单列表所用的结构
type
CustomOrderListForExcel
struct
{
OrderCode
string
//订单编号
DeliveryCode
string
//发货编号
UpdateTime
string
//更新时间
CreateTime
string
//创建时间
PlanOrderCount
int64
//货品总数
UseOrderCount
int64
//货品总数调整
RegionName
string
//订单区域
PlanOrderAmount
int64
//订单金额
UseOrderAmount
int64
//订单金额调整
PartnerCategory
string
//合伙人类型
BuyerName
string
//买家
PartnerName
string
//合伙人
OrderCode
string
//订单编号
DeliveryCode
string
//发货编号
UpdateTime
string
//更新时间
CreateTime
string
//创建时间
PlanOrderCount
int64
//货品总数
UseOrderCount
int64
//货品总数调整
RegionName
string
//订单区域
PlanOrderAmount
float64
//订单金额
UseOrderAmount
float64
//订单金额调整
PartnerCategory
string
//合伙人类型
BuyerName
string
//买家
PartnerName
string
//合伙人
}
//OrderListForExcel 获取实际订单列表用于excel导出
...
...
pkg/infrastructure/domainService/pg_order_bonus_service.go
查看文件 @
e04ce1f
...
...
@@ -230,7 +230,6 @@ func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64,
}
//PayOrderGoodBonus 支付订单中货品的分红
//目前只处理 海鲜干货的订单 即 order_type = OrderTypeBestShop (3)
func
(
serve
*
OrderBonusService
)
PayOrderGoodBonus
(
orderId
int64
,
goodId
int64
,
adminId
int64
)
error
{
var
(
userRepository
domain
.
UsersRepository
...
...
@@ -254,9 +253,6 @@ func (serve *OrderBonusService) PayOrderGoodBonus(orderId int64, goodId int64, a
e
:=
fmt
.
Sprintf
(
"获取订单(id=%d)数据失败,%s"
,
orderId
,
err
)
return
lib
.
ThrowError
(
lib
.
INTERNAL_SERVER_ERROR
,
e
)
}
if
oldOrder
.
OrderType
!=
domain
.
OrderTypeBestShop
{
return
lib
.
ThrowError
(
lib
.
BUSINESS_ERROR
,
"订单类型错误"
)
}
oldOrder
.
Goods
,
_
,
err
=
orderGoodRepository
.
Find
(
domain
.
OrderGoodFindQuery
{
OrderId
:
orderId
})
if
err
!=
nil
{
e
:=
fmt
.
Sprintf
(
"获取订单中(id=%d)的货品数据失败,%s"
,
orderId
,
err
)
...
...
@@ -279,7 +275,7 @@ func (serve *OrderBonusService) PayOrderGoodBonus(orderId int64, goodId int64, a
continue
}
updateGood
=
oldOrder
.
Goods
[
i
]
err
:=
new
(
domain
.
OrderGoodWithBestshop
)
.
PayPartnerBonus
(
&
updateGood
)
err
=
updateGood
.
CurrentBonusStatus
.
PayPartnerBonus
(
&
updateGood
)
if
err
!=
nil
{
return
lib
.
ThrowError
(
lib
.
BUSINESS_ERROR
,
err
.
Error
())
}
...
...
pkg/port/beego/controllers/order_dividend_controller.go
查看文件 @
e04ce1f
...
...
@@ -395,8 +395,8 @@ func (c *OrderDividendController) EditOrderDividend() {
return
}
//PayOrderGoodBonusForBestshop 支付海鲜干货订单中的分红
func
(
c
*
OrderDividendController
)
PayOrderGoodBonusForBestshop
()
{
//PayOrderGoodBonus 支付订单中的分红
func
(
c
*
OrderDividendController
)
PayOrderGoodBonus
()
{
type
Parameter
struct
{
OrderId
string
`json:"orderId"`
ProductId
string
`json:"productId"`
...
...
@@ -422,7 +422,7 @@ func (c *OrderDividendController) PayOrderGoodBonusForBestshop() {
}
adminId
:=
c
.
GetUserId
()
orderSrv
:=
orderService
.
NewOrderInfoService
(
nil
)
err
=
orderSrv
.
PayPartnerBonus
WithOrderBestshop
(
orderid
,
productId
,
adminId
)
err
=
orderSrv
.
PayPartnerBonus
(
orderid
,
productId
,
adminId
)
if
err
!=
nil
{
c
.
ResponseError
(
err
)
return
...
...
pkg/port/beego/routers/router.go
查看文件 @
e04ce1f
...
...
@@ -31,7 +31,7 @@ func init() {
beego
.
NSRouter
(
"/detail"
,
&
controllers
.
OrderDividendController
{},
"POST:OrderDividendDetail"
),
// beego.NSRouter("/mini-program/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetailForBestshop"),
//beego.NSRouter("/mini-program/modify", &controllers.OrderDividendController{}, "POST:EditOrderDividendForBestshop"),
beego
.
NSRouter
(
"/
mini-program/payDividends"
,
&
controllers
.
OrderDividendController
{},
"POST:PayOrderGoodBonusForBestshop
"
),
beego
.
NSRouter
(
"/
payDividends"
,
&
controllers
.
OrderDividendController
{},
"POST:PayOrderGoodBonus
"
),
beego
.
NSRouter
(
"/remarks"
,
&
controllers
.
OrderDividendController
{},
"POST:EditOrderRemarkBonus"
),
beego
.
NSRouter
(
"/list/excel"
,
&
controllers
.
OrderDividendController
{},
"POST:ListOrderBonusForExcel"
),
// beego.NSRouter("/business/detail", &controllers.BusinessBonusController{}, "POST:GetBusinessBonus"),
...
...
请
注册
或
登录
后发表评论