作者 tangxvhui

bug 修复

@@ -88,13 +88,17 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi @@ -88,13 +88,17 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
88 permissionRepository = value 88 permissionRepository = value
89 } 89 }
90 permissions, err = permissionRepository.Find(domain.AdminPermissionFindQuery{ 90 permissions, err = permissionRepository.Find(domain.AdminPermissionFindQuery{
91 - IdsIn: saveUserCmd.PermissionId,  
92 - NotCode: []string{domain.PERMINSSION_ADMIN_USER}, 91 + IdsIn: saveUserCmd.PermissionId,
93 }) 92 })
94 if err != nil { 93 if err != nil {
95 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 94 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
96 } 95 }
97 - 96 + //.....
  97 + for i := range permissions {
  98 + if permissions[i].Code == domain.PERMINSSION_ADMIN_USER {
  99 + return nil, lib.ThrowError(lib.BUSINESS_ERROR, "操作异常")
  100 + }
  101 + }
98 permissionBases := []domain.AdminPermissionBase{} 102 permissionBases := []domain.AdminPermissionBase{}
99 for i := range permissions { 103 for i := range permissions {
100 p := domain.AdminPermissionBase{ 104 p := domain.AdminPermissionBase{
1 package command 1 package command
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
4 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib" 5 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
5 ) 6 )
6 7
@@ -25,6 +26,8 @@ type UpdateOrderCommand struct { @@ -25,6 +26,8 @@ type UpdateOrderCommand struct {
25 PartnerBonusPercent float64 `json:"partnerBonusPercent"` 26 PartnerBonusPercent float64 `json:"partnerBonusPercent"`
26 //业务员分红百分比 27 //业务员分红百分比
27 SalesmanBonusPercent float64 `json:"salesmanBonusPercent"` 28 SalesmanBonusPercent float64 `json:"salesmanBonusPercent"`
  29 + //订单状态
  30 + OrderStatus int `json:"orderStatus"`
28 } 31 }
29 32
30 func (command UpdateOrderCommand) ValidateCommand() error { 33 func (command UpdateOrderCommand) ValidateCommand() error {
@@ -43,6 +46,10 @@ func (command UpdateOrderCommand) ValidateCommand() error { @@ -43,6 +46,10 @@ func (command UpdateOrderCommand) ValidateCommand() error {
43 if len(command.OrderRegion) == 0 { 46 if len(command.OrderRegion) == 0 {
44 return lib.ThrowError(lib.ARG_ERROR, "订单区域必填") 47 return lib.ThrowError(lib.ARG_ERROR, "订单区域必填")
45 } 48 }
46 - 49 + if !(command.OrderStatus == domain.OrderStatusDeliverSome ||
  50 + command.OrderStatus == domain.OrderStatusDeliverAll ||
  51 + command.OrderStatus == domain.OrderStatusReserve) {
  52 + return lib.ThrowError(lib.ARG_ERROR, "订单状态设置错误")
  53 + }
47 return nil 54 return nil
48 } 55 }
@@ -244,7 +244,7 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman @@ -244,7 +244,7 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman
244 if orderData.OrderType != domain.OrderIntention { 244 if orderData.OrderType != domain.OrderIntention {
245 return lib.ThrowError(lib.BUSINESS_ERROR, "订单不是意向单") 245 return lib.ThrowError(lib.BUSINESS_ERROR, "订单不是意向单")
246 } 246 }
247 - err = orderData.Update(map[string]interface{}{ 247 + updateMap := map[string]interface{}{
248 //订单编号 248 //订单编号
249 "orderCode": command.OrderCode, 249 "orderCode": command.OrderCode,
250 "oderName": command.OrderName, 250 "oderName": command.OrderName,
@@ -262,7 +262,10 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman @@ -262,7 +262,10 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman
262 }, 262 },
263 "partnerBonusPercent": command.PartnerBonusPercent, 263 "partnerBonusPercent": command.PartnerBonusPercent,
264 "salesmanBonusPercent": command.SalesmanBonusPercent, 264 "salesmanBonusPercent": command.SalesmanBonusPercent,
265 - }) 265 + "orderStatus": command.OrderStatus,
  266 + }
  267 +
  268 + err = orderData.Update(updateMap)
266 if err != nil { 269 if err != nil {
267 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) 270 return lib.ThrowError(lib.BUSINESS_ERROR, err.Error())
268 } 271 }
@@ -139,6 +139,8 @@ func (c *OrderController) editOrderPurpose(param orderDetail) error { @@ -139,6 +139,8 @@ func (c *OrderController) editOrderPurpose(param orderDetail) error {
139 PartnerBonusPercent: param.PartnerRatio, 139 PartnerBonusPercent: param.PartnerRatio,
140 //业务员分红百分比 140 //业务员分红百分比
141 SalesmanBonusPercent: param.SalesmanRatio, 141 SalesmanBonusPercent: param.SalesmanRatio,
  142 +
  143 + OrderStatus: domain.OrderStatusReserve,
142 } 144 }
143 orderSrv := orderService.NewOrderService(nil) 145 orderSrv := orderService.NewOrderService(nil)
144 err := orderSrv.UpdateOrderPurpose(updateCmd) 146 err := orderSrv.UpdateOrderPurpose(updateCmd)
@@ -343,12 +345,12 @@ func (c *OrderController) OrderPurposeToReal() { @@ -343,12 +345,12 @@ func (c *OrderController) OrderPurposeToReal() {
343 } 345 }
344 orderSrv := orderService.NewOrderService(nil) 346 orderSrv := orderService.NewOrderService(nil)
345 if param.Id > 0 { 347 if param.Id > 0 {
346 - err = orderSrv.UpdateOrderReal(orderCmd.UpdateOrderRealCommand{ 348 + err = orderSrv.UpdateOrderPurpose(orderCmd.UpdateOrderCommand{
347 Id: param.Id, 349 Id: param.Id,
348 OrderCode: param.OrderId, 350 OrderCode: param.OrderId,
349 OrderName: param.OrderName, 351 OrderName: param.OrderName,
350 - OrderActualCount: param.OrderNum,  
351 - OrderActualAmount: param.OrderPrice, 352 + OrderCount: param.OrderNum,
  353 + OrderAmount: param.OrderPrice,
352 BuyerPhone: param.BuyerPhone, 354 BuyerPhone: param.BuyerPhone,
353 BuyerAddress: param.Address, 355 BuyerAddress: param.Address,
354 OrderRegion: param.OrderDist, 356 OrderRegion: param.OrderDist,