作者 陈志颖

feat:账期结算增加校验

... ... @@ -308,39 +308,10 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
if count, cooperationProjects, err := cooperationProjectRepository.Find(tool_funs.SimpleStructToMap(listCooperationProjectQuery)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
//var cooperationModeRepository domain.CooperationModeRepository
//if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
// "transactionContext": transactionContext,
//}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//} else {
// cooperationProjectRepository = value
//}
//var modeMap = make(map[string]*domain.CooperationMode)
//if _, cooperationProjects, err := cooperationModeRepository.Find(map[string]interface{}{"companyId":listCooperationProjectQuery.CompanyId,"orgId":listCooperationProjectQuery.OrgId}); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
//}else{
// for i:=range cooperationProjects{
// p :=cooperationProjects[i]
// modeMap[p.CooperationModeNumber]=p
// }
//}
//
//var res []*dto.CooperationProjectsDto
//for i := range cooperationProjects {
// p := cooperationProjects[i]
// tp := &dto.CooperationProjectsDto{}
// tp.LoadDto(p, &domain.CooperationMode{})
// res = append(res, tp)
//}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
//"grid": map[string]interface{}{
//"total": count,
//"list": res,
//},
"list": cooperationProjects,
"total": count,
}, nil
... ...
... ... @@ -119,6 +119,16 @@ func (creditAccountService *CreditAccountService) CreateCreditAccount(createCred
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
// 校验分红预算单是否可以进行预算
for _, dividendsEstimate := range dividendsEstimates {
if dividendsEstimate.DividendsAccountStatus == 2 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选“待结算”的分红单结算")
}
if dividendsEstimate.IsCanceled {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "请勾选未取消的分红单结算")
}
}
// 预算操作
var creditAccounts []*domain.CreditAccount
for _, dividendsEstimate := range dividendsEstimates {
// 生成账期结算单号
... ...
... ... @@ -140,6 +140,8 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEst
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
// TODO 判断承接人是否已分红
// 数据传输对象
var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto
for _, cooperationContract := range cooperationContracts {
moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{}
... ...
... ... @@ -45,3 +45,11 @@ func CreateConfirmMoneyIncentivesEstimateService(options map[string]interface{})
}
return domain_service.NewConfirmMoneyIncentivesEstimateService(transactionContext)
}
func CreateCancelDividendsEstimateService(options map[string]interface{}) (*domain_service.CancelDividendsEstimateService, error) {
var transactionContext *pgTransaction.TransactionContext
if value, ok := options["transactionContext"]; ok {
transactionContext = value.(*pgTransaction.TransactionContext)
}
return domain_service.NewCancelDividendsEstimateService(transactionContext)
}
... ...
package service
import (
coreDomain "github.com/linmadan/egglib-go/core/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
)
type CancelDividendsEstimate interface {
CancelEstimate()
coreDomain.DomainEventPublisher
CancelEstimate(dividendsEstimateId int64, operatorId int64) ([]*domain.DividendsEstimate, error)
}
... ...
... ... @@ -4,6 +4,7 @@ import (
"fmt"
coreDomain "github.com/linmadan/egglib-go/core/domain"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
)
type CancelDividendsEstimateService struct {
... ... @@ -11,8 +12,8 @@ type CancelDividendsEstimateService struct {
transactionContext *pgTransaction.TransactionContext
}
func (c *CancelDividendsEstimateService) CancelEstimate() {
panic("implement me")
func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEstimateId int64, operatorId int64) ([]*domain.DividendsEstimate, error) {
return nil, nil
}
func NewCancelDividendsEstimateService(transactionContext *pgTransaction.TransactionContext) (*CancelDividendsEstimateService, error) {
... ...