作者 陈志颖

fix:根据ID查询共创项目详情

... ... @@ -283,7 +283,14 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
var getCooperationProjectQuerySpecific *query.GetCooperationProjectQuery
if getCooperationProjectQuery.CooperationProjectId != 0 { // 根据ID查询
getCooperationProjectQuerySpecific.CooperationProjectId = getCooperationProjectQuery.CooperationProjectId
getCooperationProjectQuerySpecific = &query.GetCooperationProjectQuery{
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
CooperationProjectNumber: "",
CompanyId: 0,
OrgId: 0,
UserId: 0,
UserBaseId: 0,
}
} else if getCooperationProjectQuery.CooperationProjectNumber != "" { // 根据编号查询
getCooperationProjectQuerySpecific = getCooperationProjectQuery
}
... ...
... ... @@ -60,11 +60,13 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
var dividendsEstimatesCanceled []*domain.DividendsEstimate
var orderOrReturnOrderNums []string
for _, dividendsEstimate := range dividendsEstimates {
if dividendsEstimate.DividendsType != 3 { // 非金额激励分红预算单处理
// 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
"companyId": dividendsEstimate.Company.CompanyId,
"orgId": dividendsEstimate.Org.OrgId,
"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
"offsetLimit": false,
}); err2 != nil {
return nil, err2
} else {
... ... @@ -83,11 +85,13 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
}
}
}
}
// 分红订单或分红退货单状态变更
var orderNums []string
var returnedOrderNums []string
if len(orderOrReturnOrderNums) > 0 {
// 订单/退货单号数组去重
orderOrReturnOrderNumsWithoutDup := utils.RemoveDuplication(orderOrReturnOrderNums)
for _, orderNullNum := range orderOrReturnOrderNumsWithoutDup {
... ... @@ -99,6 +103,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
}
// 获取分红订单
if len(orderNums) > 0 {
if countDividendsOrder, orders, err4 := dividendsOrderRepository.Find(map[string]interface{}{
"companyId": dividendsEstimates[0].Company.CompanyId,
"orgId": dividendsEstimates[0].Org.OrgId,
... ... @@ -120,6 +125,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
ordersNumbers = append(ordersNumbers, order.DividendsOrderNumber)
}
// 获取分红订单产品并更新产品状态
if len(ordersNumbers) > 0 {
if countOrderGood, orderGoodsFound, err := orderGoodRepository.Find(map[string]interface{}{
"orderNumbers": ordersNumbers,
"companyId": dividendsEstimates[0].Company.CompanyId,
... ... @@ -138,8 +144,11 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
}
}
}
}
}
// 获取分红退货单
if len(returnedOrderNums) > 0 {
if countDividendsReturnedOrder, returnedOrders, err5 := dividendsReturnedOrderRepository.Find(map[string]interface{}{
"companyId": dividendsEstimates[0].Company.CompanyId,
"orgId": dividendsEstimates[0].Org.OrgId,
... ... @@ -161,6 +170,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
returnedOrdersNumbers = append(returnedOrdersNumbers, returnedOrder.DividendsReturnedOrderNumber)
}
// 获取退货单产品并更新产品状态
if len(returnedOrdersNumbers) > 0 {
if countOrderGood, orderGoodsFound, err := orderGoodRepository.Find(map[string]interface{}{
"returnedOrderNumbers": returnedOrdersNumbers,
"companyId": dividendsEstimates[0].Company.CompanyId,
... ... @@ -179,7 +189,9 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
}
}
}
}
}
}
return dividendsEstimatesCanceled, nil
}
}
... ...