正在显示
8 个修改的文件
包含
18 行增加
和
12 行删除
| @@ -28,6 +28,8 @@ type UpdateOrderCommand struct { | @@ -28,6 +28,8 @@ type UpdateOrderCommand struct { | ||
| 28 | SalesmanBonusPercent float64 `json:"salesmanBonusPercent"` | 28 | SalesmanBonusPercent float64 `json:"salesmanBonusPercent"` |
| 29 | //订单状态 | 29 | //订单状态 |
| 30 | OrderStatus int `json:"orderStatus"` | 30 | OrderStatus int `json:"orderStatus"` |
| 31 | + //订单类型 | ||
| 32 | + OrderType int `json:"orderType"` | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | func (command UpdateOrderCommand) ValidateCommand() error { | 35 | func (command UpdateOrderCommand) ValidateCommand() error { |
| @@ -46,6 +48,10 @@ func (command UpdateOrderCommand) ValidateCommand() error { | @@ -46,6 +48,10 @@ func (command UpdateOrderCommand) ValidateCommand() error { | ||
| 46 | if len(command.OrderRegion) == 0 { | 48 | if len(command.OrderRegion) == 0 { |
| 47 | return lib.ThrowError(lib.ARG_ERROR, "订单区域必填") | 49 | return lib.ThrowError(lib.ARG_ERROR, "订单区域必填") |
| 48 | } | 50 | } |
| 51 | + if !(command.OrderType == domain.OrderReal || | ||
| 52 | + command.OrderType == domain.OrderIntention) { | ||
| 53 | + return lib.ThrowError(lib.ARG_ERROR, "订单类型错误") | ||
| 54 | + } | ||
| 49 | if !(command.OrderStatus == domain.OrderStatusDeliverSome || | 55 | if !(command.OrderStatus == domain.OrderStatusDeliverSome || |
| 50 | command.OrderStatus == domain.OrderStatusDeliverAll || | 56 | command.OrderStatus == domain.OrderStatusDeliverAll || |
| 51 | command.OrderStatus == domain.OrderStatusReserve) { | 57 | command.OrderStatus == domain.OrderStatusReserve) { |
| @@ -157,7 +157,7 @@ func (service OrderService) CreateOrder(command command.CreateOrderCommand) erro | @@ -157,7 +157,7 @@ func (service OrderService) CreateOrder(command command.CreateOrderCommand) erro | ||
| 157 | }); err != nil { | 157 | }); err != nil { |
| 158 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 158 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 159 | } | 159 | } |
| 160 | - newOrder := &domain.Order{ | 160 | + newOrder := domain.Order{ |
| 161 | //订单类型 | 161 | //订单类型 |
| 162 | OrderType: command.OrderType, | 162 | OrderType: command.OrderType, |
| 163 | //订单编号 | 163 | //订单编号 |
| @@ -269,7 +269,7 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman | @@ -269,7 +269,7 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman | ||
| 269 | if err != nil { | 269 | if err != nil { |
| 270 | return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) | 270 | return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) |
| 271 | } | 271 | } |
| 272 | - err = orderRepository.Save(orderData) | 272 | + err = orderRepository.Save(*orderData) |
| 273 | if err != nil { | 273 | if err != nil { |
| 274 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 274 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 275 | } | 275 | } |
| @@ -385,7 +385,7 @@ func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealComma | @@ -385,7 +385,7 @@ func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealComma | ||
| 385 | if err != nil { | 385 | if err != nil { |
| 386 | return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) | 386 | return lib.ThrowError(lib.BUSINESS_ERROR, err.Error()) |
| 387 | } | 387 | } |
| 388 | - err = orderRepository.Save(orderData) | 388 | + err = orderRepository.Save(*orderData) |
| 389 | if err != nil { | 389 | if err != nil { |
| 390 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 390 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 391 | } | 391 | } |
| @@ -58,7 +58,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(command *command | @@ -58,7 +58,7 @@ func (PartnerInfoService *PartnerInfoService) CreatePartnerInfo(command *command | ||
| 58 | }); err != nil { | 58 | }); err != nil { |
| 59 | return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 59 | return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 60 | } | 60 | } |
| 61 | - newPartnerInfo := &domain.PartnerInfo{ | 61 | + newPartnerInfo := domain.PartnerInfo{ |
| 62 | Partner: domain.Partner{ | 62 | Partner: domain.Partner{ |
| 63 | Account: command.Account, | 63 | Account: command.Account, |
| 64 | PartnerName: command.PartnerName, | 64 | PartnerName: command.PartnerName, |
| @@ -136,7 +136,7 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(updatePartnerInf | @@ -136,7 +136,7 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(updatePartnerInf | ||
| 136 | partnerInfo.Status = updatePartnerInfoCommand.Status | 136 | partnerInfo.Status = updatePartnerInfoCommand.Status |
| 137 | partnerInfo.RegionInfo = updatePartnerInfoCommand.RegionInfo | 137 | partnerInfo.RegionInfo = updatePartnerInfoCommand.RegionInfo |
| 138 | partnerInfo.CooperateTime = updatePartnerInfoCommand.CooperateTime | 138 | partnerInfo.CooperateTime = updatePartnerInfoCommand.CooperateTime |
| 139 | - if _, err = partnerInfoRepository.Save(partnerInfo); err != nil { | 139 | + if _, err = partnerInfoRepository.Save(*partnerInfo); err != nil { |
| 140 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 140 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 141 | } | 141 | } |
| 142 | transactionContext.CommitTransaction() | 142 | transactionContext.CommitTransaction() |
| @@ -219,7 +219,7 @@ func (PartnerInfoService *PartnerInfoService) UpdateStatus(command command.Statu | @@ -219,7 +219,7 @@ func (PartnerInfoService *PartnerInfoService) UpdateStatus(command command.Statu | ||
| 219 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 219 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 220 | } | 220 | } |
| 221 | partnerInfo.Status = command.Status | 221 | partnerInfo.Status = command.Status |
| 222 | - if _, err = partnerInfoRepository.Save(partnerInfo); err != nil { | 222 | + if _, err = partnerInfoRepository.Save(*partnerInfo); err != nil { |
| 223 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 223 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
| 224 | } | 224 | } |
| 225 | transactionContext.CommitTransaction() | 225 | transactionContext.CommitTransaction() |
| @@ -165,7 +165,7 @@ type OrderFindQuery struct { | @@ -165,7 +165,7 @@ type OrderFindQuery struct { | ||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | type OrderRepository interface { | 167 | type OrderRepository interface { |
| 168 | - Save(order *Order) error | 168 | + Save(order Order) error |
| 169 | FindOne(qureyOptions OrderFindOneQuery) (*Order, error) | 169 | FindOne(qureyOptions OrderFindOneQuery) (*Order, error) |
| 170 | Find(queryOptions OrderFindQuery) ([]Order, error) | 170 | Find(queryOptions OrderFindQuery) ([]Order, error) |
| 171 | CountAll(queryOption OrderFindQuery) (int, error) | 171 | CountAll(queryOption OrderFindQuery) (int, error) |
| @@ -50,7 +50,7 @@ type PartnerFindQuery struct { | @@ -50,7 +50,7 @@ type PartnerFindQuery struct { | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | type PartnerInfoRepository interface { | 52 | type PartnerInfoRepository interface { |
| 53 | - Save(dm *PartnerInfo) (*PartnerInfo, error) | 53 | + Save(dm PartnerInfo) (*PartnerInfo, error) |
| 54 | FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error) | 54 | FindOne(queryOptions PartnerFindOneQuery) (*PartnerInfo, error) |
| 55 | Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error) | 55 | Find(queryOptions PartnerFindQuery) ([]PartnerInfo, error) |
| 56 | CountAll(queryOptions PartnerFindQuery) (int, error) | 56 | CountAll(queryOptions PartnerFindQuery) (int, error) |
| @@ -19,7 +19,7 @@ type PartnerInfo struct { | @@ -19,7 +19,7 @@ type PartnerInfo struct { | ||
| 19 | // 登录密码 | 19 | // 登录密码 |
| 20 | Password string | 20 | Password string |
| 21 | // 状态(1:启用或者0:禁用) | 21 | // 状态(1:启用或者0:禁用) |
| 22 | - Status int `pg:",use_zero` | 22 | + Status int `pg:",use_zero"` |
| 23 | // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) | 23 | // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) |
| 24 | PartnerCategory int `pg:",default:1"` //partner_category | 24 | PartnerCategory int `pg:",default:1"` //partner_category |
| 25 | //所属区域信息 | 25 | //所属区域信息 |
| @@ -50,7 +50,7 @@ func (reponsitory OrderRepository) transformPgModelToDomainModel(orderModel *mod | @@ -50,7 +50,7 @@ func (reponsitory OrderRepository) transformPgModelToDomainModel(orderModel *mod | ||
| 50 | return result, nil | 50 | return result, nil |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | -func (repository OrderRepository) Save(orderInfo *domain.Order) error { | 53 | +func (repository OrderRepository) Save(orderInfo domain.Order) error { |
| 54 | var ( | 54 | var ( |
| 55 | err error | 55 | err error |
| 56 | tx = repository.transactionContext.PgTx | 56 | tx = repository.transactionContext.PgTx |
| @@ -41,7 +41,7 @@ func NewPartnerInfoRepository(transactionContext *transaction.TransactionContext | @@ -41,7 +41,7 @@ func NewPartnerInfoRepository(transactionContext *transaction.TransactionContext | ||
| 41 | return &PartnerInfoRepository{transactionContext: transactionContext}, nil | 41 | return &PartnerInfoRepository{transactionContext: transactionContext}, nil |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | -func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.PartnerInfo, error) { | 44 | +func (repository *PartnerInfoRepository) Save(dm domain.PartnerInfo) (*domain.PartnerInfo, error) { |
| 45 | var ( | 45 | var ( |
| 46 | err error | 46 | err error |
| 47 | tx = repository.transactionContext.PgTx | 47 | tx = repository.transactionContext.PgTx |
| @@ -72,7 +72,7 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.P | @@ -72,7 +72,7 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.P | ||
| 72 | return nil, err | 72 | return nil, err |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | - return dm, nil | 75 | + return &dm, nil |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFindOneQuery) (*domain.PartnerInfo, error) { | 78 | func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFindOneQuery) (*domain.PartnerInfo, error) { |
-
请 注册 或 登录 后发表评论