作者 yangfu

账期结算记录

... ... @@ -9,7 +9,8 @@ import (
// Command
type CreditAccountGetCommand struct {
//操作人
Operator domain.Operator `json:"-"`
Operator domain.Operator `json:"-"`
CreditAccountId int
}
func (cmd *CreditAccountGetCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -9,7 +9,12 @@ import (
// Command
type CreditAccountPayCommand struct {
//操作人
Operator domain.Operator `json:"-"`
Operator domain.Operator `json:"-"`
CreditAccountId int
// 账期结算实付金额
ActuallyPaidAmount float64 `cname:"账期结算实付金额" json:"actuallyPaidAmount" valid:"Required"`
// 备注
Remarks string `cname:"备注" json:"remarks" valid:"Required"`
}
func (cmd *CreditAccountPayCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -10,6 +10,12 @@ import (
type CreditAccountPaySearchCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int64 `json:"pageNumber"`
// 查询限制
PageSize int64 `json:"pageSize" valid:"Required"`
// 账期结算支付状态,1待支付,2已支付 0全部
PaymentStatus int32 `json:"paymentStatus"`
}
func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) {
... ...
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/infrastructure/service_gateway/allied_creation_cooperation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
// CompanyCreditAccountService 企业端账期结算
type CompanyCreditAccountService struct {
}
// IndexStatistics TODO:企业的账期结算列表(分红信息按合约划分)
func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
PageNumber: cmd.PageNumber,
PageSize: cmd.PageSize,
PaymentStatus: cmd.PaymentStatus,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
// IndexStatistics TODO:企业的账期结算明细
func (srv CompanyCreditAccountService) CreditAccountGet(userMenusCommand *command.CreditAccountGetCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, nil
}
// IndexStatistics TODO:企业的账期结算支付
func (srv CompanyCreditAccountService) CreditAccountPay(userMenusCommand *command.CreditAccountPayCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, nil
}
// IndexStatistics TODO:企业分红结算支付记录
func (srv CompanyCreditAccountService) CreditAccountPaySearch(userMenusCommand *command.CreditAccountPaySearchCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, nil
}
... ... @@ -9,7 +9,7 @@ import (
type CompanyDividendsService struct {
}
// IndexStatistics TODO:企业的合约列表(分红信息按合约划分)
// GetDividendContracts 企业的合约列表(分红信息按合约划分)
func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *command.GetDividendContractsCommand) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
... ... @@ -30,7 +30,7 @@ func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *comma
}, nil
}
// IndexStatistics TODO:企业的合约统计(分红统计)
// DividendsStatistics TODO:企业的合约统计(分红统计)
func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
... ... @@ -48,7 +48,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *comman
}, nil
}
// IndexStatistics 企业的合约明细列表(分红预算信息)
// SearchDividendsEstimates 企业的合约明细列表(分红预算信息)
func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
... ...
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/infrastructure/service_gateway/allied_creation_cooperation"
)
// CompanyCreditAccountService 企业端账期结算
type CompanyCreditAccountService struct {
}
// CreditAccountSearch 企业的账期结算列表
func (srv CompanyCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
PageNumber: cmd.PageNumber,
PageSize: cmd.PageSize,
PaymentStatus: cmd.PaymentStatus,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
// CreditAccountGet 企业的账期结算明细
func (srv CompanyCreditAccountService) CreditAccountGet(cmd *command.CreditAccountGetCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountGet(allied_creation_cooperation.ReqCreditAccountGet{
CreditAccountId: cmd.CreditAccountId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
// CreditAccountDelete 企业的账期结算删除
func (srv CompanyCreditAccountService) CreditAccountDelete(cmd *command.CreditAccountGetCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountRemove(allied_creation_cooperation.ReqCreditAccountRemove{
CreditAccountId: cmd.CreditAccountId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
// CreditAccountPay 企业的账期结算支付
func (srv CompanyCreditAccountService) CreditAccountPay(cmd *command.CreditAccountPayCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
CreditAccountId: cmd.CreditAccountId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
// CreditAccountPaySearch 企业分红结算支付记录
func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
PageNumber: cmd.PageNumber,
PageSize: cmd.PageSize,
PaymentStatus: 2,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"list": resultMenu,
"sum": 6000,
}, nil
}
// PaymentHistoryStatistics 支付历史统计
func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
// PageNumber: cmd.PageNumber,
// PageSize: cmd.PageSize,
// PaymentStatus: 2,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return map[string]interface{}{
"rankItems": []struct{}{},
"totalPaymentAmount": 6000,
}, nil
}
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
// PageNumber: cmd.PageNumber,
// PageSize: cmd.PageSize,
// PaymentStatus: 2,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return map[string]interface{}{
"xAxis": map[string]interface{}{
"data": []string{"7-5", "7-15", "7-25"},
},
"yAxis": struct{}{},
"source": map[string]interface{}{
"value": []float64{60, 80, 90},
},
}, nil
}
... ...
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/infrastructure/service_gateway/allied_creation_cooperation"
)
// PersonCreditAccountService 企业端账期结算
type PersonCreditAccountService struct {
}
//// CreditAccountSearch 企业的账期结算列表
//func (srv PersonCreditAccountService) CreditAccountSearch(cmd *command.CreditAccountSearchCommand) (interface{}, error) {
// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
// resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
// PageNumber: cmd.PageNumber,
// PageSize: cmd.PageSize,
// PaymentStatus: cmd.PaymentStatus,
// })
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
// return resultMenu, nil
//}
// CreditAccountGet 企业的账期结算明细
func (srv PersonCreditAccountService) CreditAccountGet(cmd *command.CreditAccountGetCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountGet(allied_creation_cooperation.ReqCreditAccountGet{
CreditAccountId: cmd.CreditAccountId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return resultMenu, nil
}
//// CreditAccountDelete 企业的账期结算删除
//func (srv PersonCreditAccountService) CreditAccountDelete(cmd *command.CreditAccountGetCommand) (interface{}, error) {
// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
// resultMenu, err := gateway.CreditAccountRemove(allied_creation_cooperation.ReqCreditAccountRemove{
// CreditAccountId: cmd.CreditAccountId,
// })
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
// return resultMenu, nil
//}
//
//// CreditAccountPay 企业的账期结算支付
//func (srv PersonCreditAccountService) CreditAccountPay(cmd *command.CreditAccountPayCommand) (interface{}, error) {
// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
// resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
// CreditAccountId: cmd.CreditAccountId,
// })
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
// return resultMenu, nil
//}
// CreditAccountPaySearch 企业分红结算支付记录
func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
PageNumber: cmd.PageNumber,
PageSize: cmd.PageSize,
PaymentStatus: 2,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"list": resultMenu,
"sum": 6000,
}, nil
}
// PaymentHistoryStatistics 支付历史统计
func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
// PageNumber: cmd.PageNumber,
// PageSize: cmd.PageSize,
// PaymentStatus: 2,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return map[string]interface{}{
"rankItems": []struct{}{},
"totalPaymentAmount": 6000,
}, nil
}
// PaymentHistoryHistogramStatistics 支付历史统计-直方图
func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
// PageNumber: cmd.PageNumber,
// PageSize: cmd.PageSize,
// PaymentStatus: 2,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return map[string]interface{}{
"xAxis": map[string]interface{}{
"data": []string{"7-5", "7-15", "7-25"},
},
"yAxis": struct{}{},
"source": map[string]interface{}{
"value": []float64{60, 80, 90},
},
}, nil
}
... ...
... ... @@ -14,6 +14,11 @@ type (
//支付账期结算
type (
ReqCreditAccountsPay struct {
// 账期结算实付金额
ActuallyPaidAmount float64 `cname:"账期结算实付金额" json:"actuallyPaidAmount" valid:"Required"`
// 备注
Remarks string `cname:"备注" json:"remarks" valid:"Required"`
CreditAccountId int
}
DataCreditAccountsPay struct {
... ...
... ... @@ -247,6 +247,7 @@ func (controller *CooperationController) CreditAccountGet() {
if err != nil {
log.Logger.Error(err.Error())
}
cmd.CreditAccountId, _ = controller.GetInt(":creditAccountId")
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountGet(cmd)
controller.Response(data, err)
... ... @@ -276,6 +277,79 @@ func (controller *CooperationController) CreditAccountPaySearch() {
controller.Response(data, err)
}
func (controller *CooperationController) DeleteAccountPaySearch() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountGetCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.CreditAccountId, _ = controller.GetInt(":creditAccountId")
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountDelete(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PaymentHistoryStatistics() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.Operator = controller.GetOperator()
data, err := svr.PaymentHistoryStatistics(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PaymentHistoryHistogramStatistics() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.Operator = controller.GetOperator()
data, err := svr.PaymentHistoryHistogramStatistics(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonCreditAccountPaySearch() {
svr := service.PersonCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountPaySearch(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonPaymentHistoryStatistics() {
svr := service.PersonCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.Operator = controller.GetOperator()
data, err := svr.PaymentHistoryStatistics(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonPaymentHistoryHistogramStatistics() {
svr := service.PersonCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
log.Logger.Error(err.Error())
}
cmd.Operator = controller.GetOperator()
data, err := svr.PaymentHistoryHistogramStatistics(cmd)
controller.Response(data, err)
}
/***** CompanyDividends 企业端分红 *****/
func (controller *CooperationController) GetDividendContracts() {
svr := service.CompanyStatisticsService{}
... ...
... ... @@ -38,10 +38,17 @@ func init() {
web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject")
/***** CompanyDividends 账期结算 *****/
/***** CompanyDividends 账期结算 *****/
web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch")
web.Router("/v1/app/company/credit-accounts/:creditId", &mobile_client.CooperationController{}, "Get:CreditAccountGet")
web.Router("/v1/app/company/credit-accounts/pay", &mobile_client.CooperationController{}, "Post:CreditAccountPay")
web.Router("/v1/app/company/credit-accounts/pay/search", &mobile_client.CooperationController{}, "Post:CreditAccountPaySearch")
web.Router("/v1/app/company/credit-accounts/payment-history/statistics", &mobile_client.CooperationController{}, "Post:PaymentHistoryStatistics")
web.Router("/v1/app/company/credit-accounts/payment-history/histogram-statistics", &mobile_client.CooperationController{}, "Post:PaymentHistoryHistogramStatistics")
web.Router("/v1/app/company/credit-accounts/pay/search/person", &mobile_client.CooperationController{}, "Post:PersonCreditAccountPaySearch")
web.Router("/v1/app/credit-accounts/payment-history/statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryStatistics")
web.Router("/v1/app/credit-accounts/payment-history/histogram-statistics", &mobile_client.CooperationController{}, "Post:PersonPaymentHistoryHistogramStatistics")
/***** CompanyDividends 企业端分红 *****/
web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:GetDividendContracts")
... ...