作者 陈志颖

fix:分红订单产品显示

... ... @@ -16,11 +16,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
OrderGoodName: good.OrderGoodName,
OrderGoodPrice: good.OrderGoodPrice,
OrderGoodQuantity: good.OrderGoodQuantity,
DividendsOrderNumber: good.DividendsReturnedOrderNumber,
DividendsReturnedOrderNumber: good.DividendsOrderNumber,
DividendsOrderNumber: good.DividendsOrderNumber,
DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
CooperationContractNumber: good.CooperationContractNumber,
OrderGoodDividendsStatus: good.OrderGoodDividendsStatus,
OrderGoodExpense: good.OrderGoodExpense,
OrgId: good.OrgId,
CompanyId: good.CompanyId,
CreatedAt: good.CreatedAt,
DeletedAt: good.DeletedAt,
UpdatedAt: good.UpdatedAt,
... ... @@ -42,7 +44,6 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
Region: dividendsOrderModel.Region,
CustomerName: dividendsOrderModel.CustomerName,
Org: dividendsOrderModel.Org,
Goods: make([]*domain.OrderGood, 0),
Company: dividendsOrderModel.Company,
CreatedAt: dividendsOrderModel.CreatedAt,
DeletedAt: dividendsOrderModel.DeletedAt,
... ... @@ -51,11 +52,13 @@ func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModels []*mo
Operator: dividendsOrderModel.Operator,
Remarks: dividendsOrderModel.Remarks,
}
var newOrderGoods []*domain.OrderGood
for _, orderGood := range orderGoods {
if orderGood.CompanyId == dividendsOrder.Company.CompanyId && orderGood.DividendsOrderNumber == dividendsOrder.DividendsOrderNumber {
dividendsOrder.Goods = append(dividendsOrder.Goods, orderGood)
newOrderGoods = append(newOrderGoods, orderGood)
}
}
dividendsOrder.Goods = newOrderGoods
dividendsOrders = append(dividendsOrders, dividendsOrder)
}
... ...
... ... @@ -498,7 +498,7 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
if err := orderGoodQuery.
Where("company_id = ?", dividendsOrders[0].Company.CompanyId).
Where("org_id = ?", dividendsOrders[0].Org.OrgId).
Where("dividends_order_number in (?)", dividendsOrderNumbers).
Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
Select(); err != nil {
return nil, err
} else {
... ... @@ -607,7 +607,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsOrderModels[0].Company.CompanyId).
//Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number in (?)", dividendsOrderNumbers).
Where("dividends_order_number in (?)", pg.In(dividendsOrderNumbers)).
Select(); err != nil {
//log.Logger.Error("分红订单关联的产品不存在", map[string]interface{}{
// "dividendsOrderModel": dividendsOrderModel,
... ...