作者 陈志颖

fix:订单产品查询条件修复

... ... @@ -592,7 +592,6 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
for _, errorData := range errorDataList {
if len(errorData.GoodLine) == 0 { // 订单错误
for _, line := range errorData.LineNumbers {
//s := strconv.Itoa(line + 1)
tmpRow := &domain.FailInfo{
FailReason: "数据校验错误:" + errorData.Error.Error(),
}
... ... @@ -601,7 +600,6 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
}
} else if len(errorData.GoodLine) > 0 { // 订单产品错误
for line := range errorData.GoodLine {
//s := strconv.Itoa(line + 1)
tmpRow := &domain.FailInfo{
FailReason: "订单产品信息错误:" + errorData.Error.Error(),
}
... ...
... ... @@ -110,8 +110,8 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
OrderGoodName: good.OrderGoodName,
OrderGoodPrice: good.OrderGoodPrice,
OrderGoodQuantity: good.OrderGoodQuantity,
DividendsOrderNumber: good.DividendsOrderNumber,
DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
DividendsOrderNumber: dividendsOrder.DividendsOrderNumber,
DividendsReturnedOrderNumber: "",
CooperationContractNumber: good.CooperationContractNumber,
CompanyId: good.CompanyId,
OrgId: good.OrgId,
... ... @@ -334,7 +334,10 @@ func (repository *DividendsOrderRepository) Remove(dividendsOrder *domain.Divide
} else {
// 删除订单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
if _, err := tx.Model(&orderGoodModels).
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
return nil, err
}
}
... ... @@ -385,7 +388,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
// 获取订单产品
var orderGoodModels []*models.OrderGood
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
return nil, err
}
// 聚合分红订单
... ... @@ -434,8 +440,8 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
var orderGoodModels []*models.OrderGood
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.
Where("company->>'companyId' = '?'", dividendsOrderModel.Company.CompanyId).
Where("org->>'orgId' = '?'", dividendsOrderModel.Org.OrgId).
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).
Select(); err != nil {
return 0, nil, err
... ...
... ... @@ -339,7 +339,10 @@ func (repository *DividendsReturnedOrderRepository) Remove(dividendsReturnedOrde
} else {
// 删除分红退货单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
if _, err := tx.Model(&orderGoodModels).
Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
Where("org_id' = ?", dividendsReturnedOrder.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
return nil, err
}
}
... ... @@ -360,7 +363,10 @@ func (repository *DividendsReturnedOrderRepository) BatchRemove(dividendsReturne
for _, dividendsReturnedOrder := range dividendsReturnedOrders {
// 删除退货单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
if _, err := tx.Model(&orderGoodModels).
Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
Where("org_id' = ?", dividendsReturnedOrder.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
return nil, err
}
}
... ... @@ -387,7 +393,10 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str
// 获取订单产品
var orderGoodModels []*models.OrderGood
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).Select(); err != nil {
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsReturnedOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsReturnedOrderModel.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).Select(); err != nil {
return nil, err
}
// 聚合分红退货单
... ... @@ -436,8 +445,8 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
var orderGoodModels []*models.OrderGood
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.
Where("company->>'companyId' = '?'", dividendsReturnedOrderModel.Company.CompanyId).
Where("org->>'orgId' = '?'", dividendsReturnedOrderModel.Org.OrgId).
Where("company_id = ?", dividendsReturnedOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsReturnedOrderModel.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrderModel.DividendsReturnedOrderNumber).
Select(); err != nil {
return 0, nil, err
... ...