作者 唐旭辉

海鲜干货订单 分红详情 完成

... ... @@ -2,6 +2,7 @@ package service
import (
"fmt"
"strings"
"time"
"github.com/astaxie/beego/logs"
... ... @@ -940,6 +941,7 @@ func (service OrderInfoService) buildOrderBestshopInfoData(orderBase *domain.Ord
detail["productCodes"] = v.Sn
detail["commodityCode"] = v.Bn
}
productDetail = append(productDetail, detail)
}
product["detail"] = productDetail
modifyLog := []map[string]interface{}{}
... ... @@ -955,7 +957,10 @@ func (service OrderInfoService) buildOrderBestshopInfoData(orderBase *domain.Ord
d := map[string]string{
"updateTitle": vv.Title,
"id": fmt.Sprint(ii),
"content": fmt.Sprintf("%s:%s;%s", vv.Item, vv.Action, vv.Result),
"content": vv.Item,
}
if len(vv.Action) > 0 {
d["content"] = vv.Item + ":" + strings.Join(vv.Action, ";")
}
detail = append(detail, d)
}
... ...
... ... @@ -63,7 +63,7 @@ type OrderBestshopRepository interface {
type OrderGoodBestShop struct {
Id int64 `json:"id"`
//订单id
OrdeId int64 `json:"orderId"`
OrderId int64 `json:"orderId"`
//货品编号
Sn string `json:"sn"`
//商品编号
... ...
... ... @@ -16,20 +16,9 @@ const (
//OrderLogDescript 描述日志内容
type OrderLogDescript struct {
Title string `json:"title"` //标题
Item string `json:"item"` //修改的项目
Action string `json:"action"` //执行的操作
Result string `json:"result"` //结果
}
//OrderLogContentItem 记录订单的相关属性值的修改
type OrderLogContent struct {
OrderId string `json:"orderId"` //订单id
GoodId string `json:"goodId"` //货品id
Table string `json:"Table"` //名称标题
Item string `json:"item"` //修改的数据字段
FormerValue string `json:"formerValue"` //旧值
NewValue string `json:"newValue"` //新值
Title string `json:"title"` //标题
Item string `json:"item"` //修改的项目
Action []string `json:"action"` //执行的操作
}
//OrderLog 订单修改记录
... ... @@ -42,7 +31,6 @@ type OrderLog struct {
OperatorType string `json:"operatorType"` //操作人员的类型
LogAction string `json:"logAction"` //执行动作
Descript []OrderLogDescript `json:"descript"` //描述日志内容
Content []OrderLogContent `json:"content"` //记录订单的操作动作
DataFrom string `json:"dataFrom"` //修改操作的来源:"web_admin"
}
... ...
... ... @@ -43,4 +43,6 @@ type OrderGood struct {
CompanyId int64
//原因备注
RemarkReason domain.OrderGoodRemarkReason ``
DataFrom domain.OrderDataFrom ``
}
... ...
... ... @@ -4,7 +4,7 @@ type OrderGoodBestshop struct {
tableName struct{} `pg:"order_good_bestshop"`
Id int64
//订单id
OrdeId int64
OrderId int64
//货品编号
Sn string
//商品编号
... ...
... ... @@ -19,7 +19,6 @@ type OrderLog struct {
OperatorType string `` //操作人员的类型
LogAction string `` //执行动作
Descript []domain.OrderLogDescript `` //描述日志内容
Content []domain.OrderLogContent `` //记录订单的操作动作
DataFrom string `` //修改操作的来源:"web_admin"
}
... ...
... ... @@ -42,6 +42,8 @@ func (reponsitory OrderBaseRepository) transformPgModelToDomainModel(orderModel
},
BonusStatus: orderModel.BonusStatus,
CompanyId: orderModel.CompanyId,
DataFrom: orderModel.DataFrom,
Remark: orderModel.Remark,
}
return order, nil
}
... ... @@ -62,7 +64,8 @@ func (repository OrderBaseRepository) Save(orderInfo *domain.OrderBase) error {
PartnerBonusHas: orderInfo.OrderCompute.PartnerBonusHas, PartnerBonusNot: orderInfo.OrderCompute.PartnerBonusNot,
PartnerBonusExpense: orderInfo.OrderCompute.PartnerBonusExpense, IsDisable: orderInfo.IsDisable,
CreateTime: orderInfo.CreateTime, BonusStatus: orderInfo.BonusStatus,
CompanyId: orderInfo.CompanyId,
CompanyId: orderInfo.CompanyId, DataFrom: orderInfo.DataFrom,
Remark: orderInfo.Remark,
}
if m.Id == 0 {
_, err = tx.Model(m).
... ...
... ... @@ -25,28 +25,28 @@ func NewOrderGoodBestshopRepository(transactionContext *transaction.TransactionC
func (respository OrderGoodBestshopRepository) transformPgModelToDomainModel(orderGoodModel *models.OrderGoodBestshop) (orderGood domain.OrderGoodBestShop, err error) {
return domain.OrderGoodBestShop{
Id: orderGoodModel.Id,
OrdeId: orderGoodModel.OrdeId,
Sn: orderGoodModel.Sn,
Bn: orderGoodModel.Bn,
Name: orderGoodModel.Name,
Price: orderGoodModel.Price,
Nums: orderGoodModel.Nums,
Amount: orderGoodModel.Amount,
Id: orderGoodModel.Id,
OrderId: orderGoodModel.OrderId,
Sn: orderGoodModel.Sn,
Bn: orderGoodModel.Bn,
Name: orderGoodModel.Name,
Price: orderGoodModel.Price,
Nums: orderGoodModel.Nums,
Amount: orderGoodModel.Amount,
}, nil
}
func (respository OrderGoodBestshopRepository) Add(good *domain.OrderGoodBestShop) error {
tx := respository.transactionContext.GetDB()
m := models.OrderGoodBestshop{
Id: good.Id,
OrdeId: good.OrdeId,
Sn: good.Sn,
Bn: good.Bn,
Name: good.Name,
Price: good.Price,
Nums: good.Nums,
Amount: good.Amount,
Id: good.Id,
OrderId: good.OrderId,
Sn: good.Sn,
Bn: good.Bn,
Name: good.Name,
Price: good.Price,
Nums: good.Nums,
Amount: good.Amount,
}
_, err := tx.Model(&m).Insert()
good.Id = m.Id
... ...
... ... @@ -39,7 +39,9 @@ func (reponsitory OrderGoodRepository) transformPgModelToDomainModel(orderModel
PartnerBonusNot: orderModel.PartnerBonusNot,
PartnerBonusExpense: orderModel.PartnerBonusExpense,
},
CompanyId: orderModel.CompanyId,
CompanyId: orderModel.CompanyId,
RemarkReason: orderModel.RemarkReason,
DataFrom: orderModel.DataFrom,
}
switch orderModel.BonusStatus {
case domain.OrderGoodWaitPay:
... ... @@ -64,8 +66,9 @@ func (repository OrderGoodRepository) Save(data []domain.OrderGood) error {
PlanPartnerBonus: v.GoodCompute.PlanPartnerBonus, UsePartnerBonus: v.GoodCompute.UsePartnerBonus,
PartnerBonusHas: v.GoodCompute.PartnerBonusHas, PartnerBonusNot: v.GoodCompute.PartnerBonusNot,
PartnerBonusExpense: v.GoodCompute.PartnerBonusExpense, BonusStatus: v.BonusStatus,
Remark: v.Remark,
CompanyId: v.CompanyId,
Remark: v.Remark, CompanyId: v.CompanyId,
RemarkReason: v.RemarkReason,
DataFrom: v.DataFrom,
}
if v.Id == 0 {
_, err = tx.Model(m).
... ...
... ... @@ -33,7 +33,6 @@ func (repository OrderLogRepository) transformPgModelToDomainModel(m *models.Ord
LogAction: m.LogAction,
Descript: m.Descript,
DataFrom: m.DataFrom,
Content: m.Content,
}, nil
}
... ... @@ -46,7 +45,6 @@ func (repository OrderLogRepository) Add(data *domain.OrderLog) error {
OperatorType: data.OperatorType,
LogAction: data.LogAction,
Descript: data.Descript,
Content: data.Content,
DataFrom: data.DataFrom,
}
_, err := db.Model(&m).Insert()
... ...
... ... @@ -278,3 +278,33 @@ func (c *OrderDividendController) EditOrderDividend() {
c.ResponseData(nil)
return
}
//OrderDividendDetailForBestshop 海鲜干货的订单分红详情
func (c *OrderDividendController) OrderDividendDetailForBestshop() {
type Parameter struct {
Id string `json:"id"`
}
var (
param Parameter
err error
)
if err = c.BindJsonData(&param); err != nil {
logs.Error(err)
c.ResponseError(errors.New("json数据解析失败"))
return
}
orderid, _ := strconv.ParseInt(param.Id, 10, 64)
if orderid == 0 {
c.ResponseError(errors.New("参数错误"))
return
}
companyId := c.GetUserCompany()
orderSrv := orderService.NewOrderInfoService(nil)
respData, err := orderSrv.GetOrderBestshopInfoWithBonus(orderid, companyId)
if err != nil {
c.ResponseError(err)
return
}
c.ResponseData(respData)
return
}
... ...
... ... @@ -29,6 +29,7 @@ func init() {
beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"),
beego.NSRouter("/edit", &controllers.OrderDividendController{}, "POST:EditOrderDividend"),
beego.NSRouter("/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetail"),
beego.NSRouter("/mini-program/detail", &controllers.OrderDividendController{}, "POST:OrderDividendDetailForBestshop"),
beego.NSRouter("/business/detail", &controllers.BusinessBonusController{}, "POST:GetBusinessBonus"),
beego.NSRouter("/business/edit", &controllers.BusinessBonusController{}, "POST:UpdateBusinessBonus"),
... ...