作者 陈志颖

合并分支 'dev' 到 'test'

Dev



查看合并请求 !75
@@ -521,7 +521,6 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat @@ -521,7 +521,6 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat
521 521
522 // ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算 522 // ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算
523 func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncentivesEstimate(confirmDividendsIncentivesEstimateCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) { 523 func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncentivesEstimate(confirmDividendsIncentivesEstimateCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) {
524 - start := time.Now() // 获取当前时间  
525 if err := confirmDividendsIncentivesEstimateCommand.ValidateCommand(); err != nil { 524 if err := confirmDividendsIncentivesEstimateCommand.ValidateCommand(); err != nil {
526 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 525 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
527 } 526 }
@@ -715,10 +714,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -715,10 +714,12 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
715 cooperationContractNumbers = append(cooperationContractNumbers, orderGood.CooperationContractNumber) 714 cooperationContractNumbers = append(cooperationContractNumbers, orderGood.CooperationContractNumber)
716 } 715 }
717 716
  717 + newCooperationContractNumbers := utils.RemoveDuplicationString(cooperationContractNumbers)
  718 +
718 // 查询共创合约 719 // 查询共创合约
719 cooperationContractsMap := make(map[string]*domain.CooperationContract, 0) 720 cooperationContractsMap := make(map[string]*domain.CooperationContract, 0)
720 if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{ 721 if count, cooperationContractsFound, err := cooperationContractRepository.Find(map[string]interface{}{
721 - "cooperationContractNumbers": cooperationContractNumbers, 722 + "cooperationContractNumbers": newCooperationContractNumbers,
722 "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId, 723 "companyId": confirmDividendsIncentivesEstimateCommand.CompanyId,
723 "orgId": confirmDividendsIncentivesEstimateCommand.OrgId, 724 "orgId": confirmDividendsIncentivesEstimateCommand.OrgId,
724 "offsetLimit": false, 725 "offsetLimit": false,
@@ -1028,9 +1029,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent @@ -1028,9 +1029,6 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent
1028 failedReasonStr = "无" 1029 failedReasonStr = "无"
1029 } 1030 }
1030 1031
1031 - elapsed := time.Since(start)  
1032 - fmt.Println("该函数执行完成耗时:", elapsed)  
1033 -  
1034 return map[string]interface{}{ 1032 return map[string]interface{}{
1035 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr), 1033 "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr),
1036 }, nil 1034 }, nil
@@ -164,6 +164,21 @@ func RemoveDuplicationInt64(arr []int64) []int64 { @@ -164,6 +164,21 @@ func RemoveDuplicationInt64(arr []int64) []int64 {
164 return arr[:j] 164 return arr[:j]
165 } 165 }
166 166
  167 +func RemoveDuplicationString(arr []string) []string {
  168 + set := make(map[string]struct{}, len(arr))
  169 + j := 0
  170 + for _, v := range arr {
  171 + _, ok := set[v]
  172 + if ok {
  173 + continue
  174 + }
  175 + set[v] = struct{}{}
  176 + arr[j] = v
  177 + j++
  178 + }
  179 + return arr[:j]
  180 +}
  181 +
167 func RemoveDuplicationInt32(arr []int32) []int32 { 182 func RemoveDuplicationInt32(arr []int32) []int32 {
168 set := make(map[int32]struct{}, len(arr)) 183 set := make(map[int32]struct{}, len(arr))
169 j := 0 184 j := 0