作者 tangxvhui

bug 修复

... ... @@ -39,6 +39,7 @@ func (service OrderService) PageListOrder(listOrderQuery query.ListOrderQuery) (
OrderCode: listOrderQuery.OrderCode,
Offset: listOrderQuery.Offset,
Limit: listOrderQuery.Limit,
OrderType: listOrderQuery.OrderType,
}
orders, err = orderRepository.Find(query)
if err != nil {
... ... @@ -282,6 +283,9 @@ func (service OrderService) RemoveOrder(id int64) error {
if err != nil {
return lib.ThrowError(lib.RES_NO_FIND_ERROR, err.Error())
}
if order.OrderType != domain.OrderIntention {
return lib.ThrowError(lib.BUSINESS_ERROR, "订单不是意向单")
}
err = orderRepository.Remove(order.Id)
if err != nil {
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -289,7 +293,7 @@ func (service OrderService) RemoveOrder(id int64) error {
return nil
}
//UpdateOrderReal 更新实发单
//UpdateOrderReal 更新实发单
func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealCommand) error {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
... ...
... ... @@ -88,13 +88,13 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom
orderModels := []models.Order{}
query := db.Model(&orderModels)
if queryOption.PartnerId > 0 {
query = query.Where("order.partner_id=?", queryOption.PartnerId)
query = query.Where("partner_id=?", queryOption.PartnerId)
}
if len(queryOption.OrderCode) > 0 {
query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%")
query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%")
}
if queryOption.OrderType > 0 {
query = query.Where("order.order_type=?", queryOption.OrderType)
query = query.Where("order_type=?", queryOption.OrderType)
}
if queryOption.Offset > -1 {
query = query.Offset(queryOption.Offset)
... ... @@ -108,7 +108,7 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom
err error
ordersReturn = make([]domain.Order, 0)
)
query = query.Order("order.id DESC ")
query = query.Order("order.id DESC")
err = query.Select()
if err != nil {
return ordersReturn, err
... ... @@ -128,10 +128,13 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i
orderModels := []models.Order{}
query := db.Model(&orderModels)
if queryOption.PartnerId > 0 {
query = query.Where("order.partner_id=?", queryOption.PartnerId)
query = query.Where("partner_id=?", queryOption.PartnerId)
}
if len(queryOption.OrderCode) > 0 {
query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%")
query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%")
}
if queryOption.OrderType > 0 {
query = query.Where("order_type=?", queryOption.OrderType)
}
var (
err error
... ... @@ -140,7 +143,7 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i
if err != nil {
return cnt, err
}
return 0, nil
return cnt, nil
}
func (repository OrderRepository) FindOne(qureyOptions domain.OrderFindOneQuery) (*domain.Order, error) {
... ...
package controllers
import (
partnerQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/partnerInfo/query"
partnerInfoService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/partnerInfo/service"
)
type CommonController struct {
BaseController
}
////Prepare 重写 BaseController 的Prepare方法
func (c *CommonController) Prepare() {
c.BaseController.Prepare()
if ok := c.ValidJWTToken(); !ok {
return
}
}
// GetPartnerList 下拉选项数据通用接口,获取合伙人列表
func (c *CommonController) GetPartnerList() {
query := partnerQuery.ListPartnerInfoQuery{
Limit: 2000,
Offset: 0,
}
newPartnerService := partnerInfoService.NewPartnerInfoService(nil)
_, partners, err := newPartnerService.ListPartnerInfo(&query)
if err != nil {
c.ResponseError(err)
return
}
resp := []map[string]interface{}{}
for i := range partners {
m := map[string]interface{}{
"id": partners[i].Partner.Id,
"account": partners[i].Partner.Account,
"partnerName": partners[i].Partner.PartnerName,
}
resp = append(resp, m)
}
c.ResponseData(resp)
}
... ...
... ... @@ -229,7 +229,7 @@ func (c *OrderController) PageListOrderPurpose() {
"partner": orderinfo.PartnerInfo.PartnerName,
"partnerRatio": orderinfo.PartnerBonusPercent,
"orderName": orderinfo.OrderName,
"OrderNum": orderinfo.OrderCount,
"orderNum": orderinfo.OrderCount,
"orderPrice": orderinfo.OrderAmount,
"orderDist": orderinfo.OrderRegionInfo.RegionName,
"orderStatue": orderinfo.OrderStatus,
... ... @@ -310,7 +310,7 @@ func (c *OrderController) PageListOrderReal() {
"partner": orderinfo.PartnerInfo.PartnerName,
"partnerRatio": orderinfo.PartnerBonusPercent,
"orderName": orderinfo.OrderName,
"OrderNum": orderinfo.OrderCount,
"orderNum": orderinfo.OrderCount,
"orderPrice": orderinfo.OrderAmount,
"orderActualNum": orderinfo.OrderActualCount,
"orderActualPrice": orderinfo.OrderActualAmount,
... ...
... ... @@ -42,8 +42,9 @@ func init() {
beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"),
),
beego.NSNamespace("/common"), // beego.NSRouter("/partner", &controllers.OrderController{}, "POST:PageListOrderPurpose"),
beego.NSNamespace("/common",
beego.NSRouter("/partner", &controllers.CommonController{}, "POST:GetPartnerList"),
),
)
beego.AddNamespace(adminRouter)
}
... ...