正在显示
1 个修改的文件
包含
14 行增加
和
1 行删除
| @@ -112,13 +112,25 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred | @@ -112,13 +112,25 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred | ||
| 112 | } else { | 112 | } else { |
| 113 | dividendsEstimateRepository = value | 113 | dividendsEstimateRepository = value |
| 114 | } | 114 | } |
| 115 | - dividendsEstimateIds, _ := utils.SliceAtoi(createCreditAccountCommand.DividendsEstimateIds) | 115 | + |
| 116 | + // 批量转换分红预算单号列表 | ||
| 117 | + dividendsEstimateIds, err := utils.SliceAtoi(createCreditAccountCommand.DividendsEstimateIds) | ||
| 118 | + if err != nil { | ||
| 119 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红预算单号错误") | ||
| 120 | + } | ||
| 116 | // 获取所选分红预算单 | 121 | // 获取所选分红预算单 |
| 117 | if _, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ | 122 | if _, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{ |
| 118 | "dividendsEstimateIds": dividendsEstimateIds, | 123 | "dividendsEstimateIds": dividendsEstimateIds, |
| 119 | }); err != nil { | 124 | }); err != nil { |
| 120 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 125 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 121 | } else { | 126 | } else { |
| 127 | + // 校验共创用户是否一致 | ||
| 128 | + for i, _ := range dividendsEstimates { | ||
| 129 | + if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[i+1].DividendsUser.UserId { | ||
| 130 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算") | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 122 | // 校验分红预算单是否可以进行预算 | 134 | // 校验分红预算单是否可以进行预算 |
| 123 | for _, dividendsEstimate := range dividendsEstimates { | 135 | for _, dividendsEstimate := range dividendsEstimates { |
| 124 | if dividendsEstimate.DividendsAccountStatus == 2 { | 136 | if dividendsEstimate.DividendsAccountStatus == 2 { |
| @@ -128,6 +140,7 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred | @@ -128,6 +140,7 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred | ||
| 128 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选未取消的分红单结算") | 140 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选未取消的分红单结算") |
| 129 | } | 141 | } |
| 130 | } | 142 | } |
| 143 | + | ||
| 131 | // 预算操作 | 144 | // 预算操作 |
| 132 | var creditAccounts []*domain.CreditAccount | 145 | var creditAccounts []*domain.CreditAccount |
| 133 | for _, dividendsEstimate := range dividendsEstimates { | 146 | for _, dividendsEstimate := range dividendsEstimates { |
-
请 注册 或 登录 后发表评论