...
|
...
|
@@ -112,13 +112,25 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred |
|
|
} else {
|
|
|
dividendsEstimateRepository = value
|
|
|
}
|
|
|
dividendsEstimateIds, _ := utils.SliceAtoi(createCreditAccountCommand.DividendsEstimateIds)
|
|
|
|
|
|
// 批量转换分红预算单号列表
|
|
|
dividendsEstimateIds, err := utils.SliceAtoi(createCreditAccountCommand.DividendsEstimateIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红预算单号错误")
|
|
|
}
|
|
|
// 获取所选分红预算单
|
|
|
if _, dividendsEstimates, err := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
"dividendsEstimateIds": dividendsEstimateIds,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
// 校验共创用户是否一致
|
|
|
for i, _ := range dividendsEstimates {
|
|
|
if dividendsEstimates[i].DividendsUser.UserId != dividendsEstimates[i+1].DividendsUser.UserId {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选同一个共创用户进行结算")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 校验分红预算单是否可以进行预算
|
|
|
for _, dividendsEstimate := range dividendsEstimates {
|
|
|
if dividendsEstimate.DividendsAccountStatus == 2 {
|
...
|
...
|
@@ -128,6 +140,7 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选未取消的分红单结算")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 预算操作
|
|
|
var creditAccounts []*domain.CreditAccount
|
|
|
for _, dividendsEstimate := range dividendsEstimates {
|
...
|
...
|
|