...
|
...
|
@@ -3,15 +3,16 @@ package service |
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
|
|
|
)
|
|
|
|
|
|
// CompanyCreditAccountService 企业端账期结算
|
|
|
// CompanyCreditAccountService 企业端账期结算 【50%】
|
|
|
type CompanyCreditAccountService struct {
|
|
|
}
|
|
|
|
|
|
// CreditAccountSearch 企业的账期结算列表
|
|
|
func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (interface{}, error) {
|
|
|
func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (int64, interface{}, error) {
|
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
|
...
|
...
|
@@ -20,9 +21,13 @@ func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAc |
|
|
PaymentStatus: cmd.PaymentStatus,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return resultMenu, nil
|
|
|
var items []*dto.CreditAccountItem
|
|
|
for i := 0; i < len(resultMenu.Grid.List); i++ {
|
|
|
items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
|
|
|
}
|
|
|
return int64(len(items)), items, nil
|
|
|
}
|
|
|
|
|
|
// CreditAccountGet 企业的账期结算明细
|
...
|
...
|
@@ -35,7 +40,12 @@ func (srv CompanyCreditAccountService) CreditAccountGet(cmd *command.CreditAccou |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return resultMenu, nil
|
|
|
result := map[string]interface{}{
|
|
|
"creditAccount": dto.ToCreditAccountItem(&resultMenu.CreditAccount),
|
|
|
//TODO:dividendsEstimate 结算明细
|
|
|
"dividendsEstimate": []struct{}{},
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// CreditAccountDelete 企业的账期结算删除
|
...
|
...
|
@@ -56,7 +66,10 @@ func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccou |
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
|
|
|
CreditAccountId: cmd.CreditAccountId,
|
|
|
CreditAccountId: cmd.CreditAccountId,
|
|
|
ActuallyPaidAmount: cmd.ActuallyPaidAmount,
|
|
|
Remarks: cmd.Remarks,
|
|
|
Attachment: cmd.Attachment,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
...
|
...
|
@@ -72,14 +85,20 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi |
|
|
PageNumber: cmd.PageNumber,
|
|
|
PageSize: cmd.PageSize,
|
|
|
PaymentStatus: 2,
|
|
|
//TODO:时间段过滤
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var items []*dto.CreditAccountItem
|
|
|
for i := 0; i < len(resultMenu.Grid.List); i++ {
|
|
|
items = append(items, dto.ToCreditAccountItem(&resultMenu.Grid.List[i]))
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"grid": map[string]interface{}{
|
|
|
"list": resultMenu.Grid.List,
|
|
|
"sum": 6000,
|
|
|
"list": items,
|
|
|
//TODO:sum 时间段支付金额
|
|
|
"sum": 6000,
|
|
|
},
|
|
|
}, nil
|
|
|
}
|
...
|
...
|
|