作者 tangxvhui

bug 修复

... ... @@ -89,12 +89,16 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
}
permissions, err = permissionRepository.Find(domain.AdminPermissionFindQuery{
IdsIn: saveUserCmd.PermissionId,
NotCode: []string{domain.PERMINSSION_ADMIN_USER},
})
if err != nil {
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
//.....
for i := range permissions {
if permissions[i].Code == domain.PERMINSSION_ADMIN_USER {
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "操作异常")
}
}
permissionBases := []domain.AdminPermissionBase{}
for i := range permissions {
p := domain.AdminPermissionBase{
... ...
package command
import (
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
)
... ... @@ -25,6 +26,8 @@ type UpdateOrderCommand struct {
PartnerBonusPercent float64 `json:"partnerBonusPercent"`
//业务员分红百分比
SalesmanBonusPercent float64 `json:"salesmanBonusPercent"`
//订单状态
OrderStatus int `json:"orderStatus"`
}
func (command UpdateOrderCommand) ValidateCommand() error {
... ... @@ -43,6 +46,10 @@ func (command UpdateOrderCommand) ValidateCommand() error {
if len(command.OrderRegion) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "订单区域必填")
}
if !(command.OrderStatus == domain.OrderStatusDeliverSome ||
command.OrderStatus == domain.OrderStatusDeliverAll ||
command.OrderStatus == domain.OrderStatusReserve) {
return lib.ThrowError(lib.ARG_ERROR, "订单状态设置错误")
}
return nil
}
... ...
... ... @@ -244,7 +244,7 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman
if orderData.OrderType != domain.OrderIntention {
return lib.ThrowError(lib.BUSINESS_ERROR, "订单不是意向单")
}
err = orderData.Update(map[string]interface{}{
updateMap := map[string]interface{}{
//订单编号
"orderCode": command.OrderCode,
"oderName": command.OrderName,
... ... @@ -262,7 +262,10 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman
},
"partnerBonusPercent": command.PartnerBonusPercent,
"salesmanBonusPercent": command.SalesmanBonusPercent,
})
"orderStatus": command.OrderStatus,
}
err = orderData.Update(updateMap)
if err != nil {
return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -139,6 +139,8 @@ func (c *OrderController) editOrderPurpose(param orderDetail) error {
PartnerBonusPercent: param.PartnerRatio,
//业务员分红百分比
SalesmanBonusPercent: param.SalesmanRatio,
OrderStatus: domain.OrderStatusReserve,
}
orderSrv := orderService.NewOrderService(nil)
err := orderSrv.UpdateOrderPurpose(updateCmd)
... ... @@ -343,12 +345,12 @@ func (c *OrderController) OrderPurposeToReal() {
}
orderSrv := orderService.NewOrderService(nil)
if param.Id > 0 {
err = orderSrv.UpdateOrderReal(orderCmd.UpdateOrderRealCommand{
err = orderSrv.UpdateOrderPurpose(orderCmd.UpdateOrderCommand{
Id: param.Id,
OrderCode: param.OrderId,
OrderName: param.OrderName,
OrderActualCount: param.OrderNum,
OrderActualAmount: param.OrderPrice,
OrderCount: param.OrderNum,
OrderAmount: param.OrderPrice,
BuyerPhone: param.BuyerPhone,
BuyerAddress: param.Address,
OrderRegion: param.OrderDist,
... ...