作者 陈志颖

fix:重复取消分红预算单

@@ -231,6 +231,11 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat @@ -231,6 +231,11 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
231 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cancelDividendsEstimateCommand.DividendsEstimateId, 10))) 231 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cancelDividendsEstimateCommand.DividendsEstimateId, 10)))
232 } 232 }
233 233
  234 + // 校验重复取消
  235 + if dividendsEstimate.IsCanceled {
  236 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已取消的分红单不能重复取消")
  237 + }
  238 +
234 // 校验是否能够取消 239 // 校验是否能够取消
235 if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销 240 if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销
236 if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil { 241 if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil {
@@ -336,6 +341,11 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs @@ -336,6 +341,11 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
336 if count > 0 { 341 if count > 0 {
337 // 校验分红预算是否可以取消,已有相关分红预算单已结算,无法取消 342 // 校验分红预算是否可以取消,已有相关分红预算单已结算,无法取消
338 for _, dividendsEstimate := range dividendsEstimates { 343 for _, dividendsEstimate := range dividendsEstimates {
  344 + // 校验重复取消
  345 + if dividendsEstimate.IsCanceled {
  346 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已取消的分红单不能重复取消")
  347 + }
  348 +
339 // 校验是否能够取消 349 // 校验是否能够取消
340 if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销 350 if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销
341 if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil { 351 if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil {