...
|
...
|
@@ -356,43 +356,54 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs |
|
|
|
|
|
// 校验是否能够取消
|
|
|
if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红/退货冲销
|
|
|
// 自定义查询
|
|
|
queryOptions := make(map[string]interface{})
|
|
|
|
|
|
//参与分红类型,1承接人,2推荐人,3关联业务员
|
|
|
if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
"dividendsParticipateTypes": []int32{2, 3},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsTypes": []int32{1, 2},
|
|
|
}
|
|
|
} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
"dividendsParticipateTypes": []int32{1, 3},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsTypes": []int32{1, 2},
|
|
|
}
|
|
|
} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
"dividendsParticipateTypes": []int32{1, 2},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsTypes": []int32{1, 2},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if countRelativeDividendsEstimates, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(queryOptions); err2 != nil {
|
|
|
//// 自定义查询
|
|
|
//queryOptions := make(map[string]interface{})
|
|
|
//
|
|
|
////参与分红类型,1承接人,2推荐人,3关联业务员
|
|
|
//if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
// "dividendsParticipateTypes": []int32{2, 3},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsTypes": []int32{1, 2},
|
|
|
// }
|
|
|
//} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
// "dividendsParticipateTypes": []int32{1, 3},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsTypes": []int32{1, 2},
|
|
|
// }
|
|
|
//} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
// "dividendsParticipateTypes": []int32{1, 2},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsTypes": []int32{1, 2},
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if countRelativeDividendsEstimates, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
|
|
|
"dividendsParticipateTypes": []int32{1, 2, 3},
|
|
|
"cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsTypes": []int32{1, 2},
|
|
|
"orderGoodId": dividendsEstimate.OrderGoodId,
|
|
|
}); err2 != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error())
|
|
|
} else {
|
|
|
if countRelativeDividendsEstimates > 0 {
|
...
|
...
|
@@ -404,43 +415,53 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs |
|
|
}
|
|
|
}
|
|
|
} else if dividendsEstimate.DividendsType == domain.MONEY_INCENTIVES { // 金额激励分红
|
|
|
// 自定义查询
|
|
|
queryOptions := make(map[string]interface{})
|
|
|
|
|
|
//参与分红类型,1承接人,2推荐人,3关联业务员
|
|
|
if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
"dividendsParticipateTypes": []int32{2, 3},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsType": int32(3),
|
|
|
}
|
|
|
} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
"dividendsParticipateTypes": []int32{1, 3},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsType": int32(3),
|
|
|
}
|
|
|
} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
|
|
|
queryOptions = map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
"dividendsParticipateTypes": []int32{1, 2},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsType": int32(3),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if countRelativeDividendsEstimates, dividendsEstimatesRelative, err3 := dividendsEstimateRepository.Find(queryOptions); err3 != nil {
|
|
|
//// 自定义查询
|
|
|
//queryOptions := make(map[string]interface{})
|
|
|
//
|
|
|
////参与分红类型,1承接人,2推荐人,3关联业务员
|
|
|
//if dividendsEstimate.DividendsParticipateType == 1 { // 当前取消的是承接人的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
// "dividendsParticipateTypes": []int32{2, 3},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsType": int32(3),
|
|
|
// }
|
|
|
//} else if dividendsEstimate.DividendsParticipateType == 2 { // 当前取消的是推荐人的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
// "dividendsParticipateTypes": []int32{1, 3},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsType": int32(3),
|
|
|
// }
|
|
|
//} else if dividendsEstimate.DividendsParticipateType == 3 { // 当前取消的是关联业务员的分红预算单
|
|
|
// queryOptions = map[string]interface{}{
|
|
|
// "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
// "orgId": dividendsEstimate.Org.OrgId,
|
|
|
// "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
// "dividendsParticipateTypes": []int32{1, 2},
|
|
|
// "offsetLimit": false,
|
|
|
// "dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
// "dividendsType": int32(3),
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if countRelativeDividendsEstimates, dividendsEstimatesRelative, err3 := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
"companyId": dividendsEstimate.Company.CompanyId,
|
|
|
"orgId": dividendsEstimate.Org.OrgId,
|
|
|
"cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
"cooperationContractUndertakerId": dividendsEstimate.CooperationContractUndertakerId,
|
|
|
"dividendsParticipateTypes": []int32{1, 2, 3},
|
|
|
"offsetLimit": false,
|
|
|
"dividendsStage": dividendsEstimate.DividendsStage,
|
|
|
"dividendsType": int32(3),
|
|
|
}); err3 != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
|
|
|
} else {
|
|
|
if countRelativeDividendsEstimates > 0 {
|
...
|
...
|
@@ -1393,7 +1414,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti |
|
|
}
|
|
|
|
|
|
// 获取订单产品
|
|
|
searchDividendsIncentivesEstimateQuery.OrderGoodDividendsStatus = int32(1) // 查询带分红的产品
|
|
|
searchDividendsIncentivesEstimateQuery.OrderGoodDividendsStatus = int32(1) // 查询待分红的产品
|
|
|
if count, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(searchDividendsIncentivesEstimateQuery)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
|