作者 陈志颖

fix:分红订单产品显示

@@ -16,11 +16,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo @@ -16,11 +16,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
16 OrderGoodName: good.OrderGoodName, 16 OrderGoodName: good.OrderGoodName,
17 OrderGoodPrice: good.OrderGoodPrice, 17 OrderGoodPrice: good.OrderGoodPrice,
18 OrderGoodQuantity: good.OrderGoodQuantity, 18 OrderGoodQuantity: good.OrderGoodQuantity,
19 - DividendsOrderNumber: good.DividendsReturnedOrderNumber,  
20 - DividendsReturnedOrderNumber: good.DividendsOrderNumber, 19 + DividendsOrderNumber: good.DividendsOrderNumber,
  20 + DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
21 CooperationContractNumber: good.CooperationContractNumber, 21 CooperationContractNumber: good.CooperationContractNumber,
22 OrderGoodDividendsStatus: good.OrderGoodDividendsStatus, 22 OrderGoodDividendsStatus: good.OrderGoodDividendsStatus,
23 OrderGoodExpense: good.OrderGoodExpense, 23 OrderGoodExpense: good.OrderGoodExpense,
  24 + OrgId: good.OrgId,
  25 + CompanyId: good.CompanyId,
24 CreatedAt: good.CreatedAt, 26 CreatedAt: good.CreatedAt,
25 DeletedAt: good.DeletedAt, 27 DeletedAt: good.DeletedAt,
26 UpdatedAt: good.UpdatedAt, 28 UpdatedAt: good.UpdatedAt,
@@ -42,7 +44,6 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo @@ -42,7 +44,6 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
42 Region: dividendsOrderModel.Region, 44 Region: dividendsOrderModel.Region,
43 CustomerName: dividendsOrderModel.CustomerName, 45 CustomerName: dividendsOrderModel.CustomerName,
44 Org: dividendsOrderModel.Org, 46 Org: dividendsOrderModel.Org,
45 - Goods: make([]*domain.OrderGood, 0),  
46 Company: dividendsOrderModel.Company, 47 Company: dividendsOrderModel.Company,
47 CreatedAt: dividendsOrderModel.CreatedAt, 48 CreatedAt: dividendsOrderModel.CreatedAt,
48 DeletedAt: dividendsOrderModel.DeletedAt, 49 DeletedAt: dividendsOrderModel.DeletedAt,
@@ -51,11 +52,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo @@ -51,11 +52,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
51 Operator: dividendsOrderModel.Operator, 52 Operator: dividendsOrderModel.Operator,
52 Remarks: dividendsOrderModel.Remarks, 53 Remarks: dividendsOrderModel.Remarks,
53 } 54 }
  55 + var newOrderGoods []*domain.OrderGood
54 for _, orderGood := range orderGoods { 56 for _, orderGood := range orderGoods {
55 if orderGood.CompanyId == dividendsOrder.Company.CompanyId && orderGood.DividendsOrderNumber == dividendsOrder.DividendsOrderNumber { 57 if orderGood.CompanyId == dividendsOrder.Company.CompanyId && orderGood.DividendsOrderNumber == dividendsOrder.DividendsOrderNumber {
56 - dividendsOrder.Goods = append(dividendsOrder.Goods, orderGood) 58 + newOrderGoods = append(newOrderGoods, orderGood)
57 } 59 }
58 } 60 }
  61 + dividendsOrder.Goods = newOrderGoods
59 dividendsOrders = append(dividendsOrders, dividendsOrder) 62 dividendsOrders = append(dividendsOrders, dividendsOrder)
60 } 63 }
61 64
@@ -498,7 +498,7 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai @@ -498,7 +498,7 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
498 if err := orderGoodQuery. 498 if err := orderGoodQuery.
499 Where("company_id = ?", dividendsOrders[0].Company.CompanyId). 499 Where("company_id = ?", dividendsOrders[0].Company.CompanyId).
500 Where("org_id = ?", dividendsOrders[0].Org.OrgId). 500 Where("org_id = ?", dividendsOrders[0].Org.OrgId).
501 - Where("dividends_order_number in (?)", dividendsOrderNumbers). 501 + Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
502 Select(); err != nil { 502 Select(); err != nil {
503 return nil, err 503 return nil, err
504 } else { 504 } else {
@@ -607,7 +607,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa @@ -607,7 +607,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
607 if err := orderGoodModelQuery. 607 if err := orderGoodModelQuery.
608 Where("company_id = ?", dividendsOrderModels[0].Company.CompanyId). 608 Where("company_id = ?", dividendsOrderModels[0].Company.CompanyId).
609 //Where("org_id = ?", dividendsOrderModel.Org.OrgId). 609 //Where("org_id = ?", dividendsOrderModel.Org.OrgId).
610 - Where("dividends_order_number in (?)", dividendsOrderNumbers). 610 + Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
611 Select(); err != nil { 611 Select(); err != nil {
612 //log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{ 612 //log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{
613 // "dividendsOrderModel": dividendsOrderModel, 613 // "dividendsOrderModel": dividendsOrderModel,