作者 Your Name

更新 账期结算

package command
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type PayCreditAccountCommand struct {
//操作人
Operator domain.Operator `json:"-"`
CreditAccountId int `json:"creditAccountId"` //账期结算id
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际金额
Remarks string `json:"remarks"` //备注
Attachment domain.Attachment `json:"attachment"` //附件
}
... ...
package command
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type RemoveCreditAccountCommand struct {
//操作人
Operator domain.Operator `json:"-"`
CreditAccountId int `json:"creditAccountId"` //账期结算id
}
... ...
package query
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type GetCreditAccountQuery struct {
//操作人
Operator domain.Operator `json:"-"`
CreditAccountId int `json:"creditAccountId"` //账期结算id
}
... ...
package query
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
type ListCreditAccountQuery struct {
//操作人
Operator domain.Operator `json:"-"`
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
Participator string `json:"participator"` //参与人
CreditAccountOrderNum string `json:"creditAccountOrderNum"` //账期结算单号
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type CreditAccountService struct{}
func NewCreditAccountService(option map[string]interface{}) CreditAccountService {
return CreditAccountService{}
}
//ListCreditAccount返回账期结算列表
func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) {
... ... @@ -13,19 +20,34 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc
}
//GetCreditAccount 返回账期结算详情
func (srv *CreditAccountService) GetCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) {
func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccountQuery) (interface{}, error) {
return 0, nil, nil
return nil, nil
}
//PayCreditAccount 支付账期结算
func (srv *CreditAccountService) PayCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) {
return 0, nil, nil
func (srv *CreditAccountService) PayCreditAccount(payCommand *command.PayCreditAccountCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(payCommand.Operator)
_, err := creationCooperationGateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{
CreditAccountId: payCommand.CreditAccountId,
ActuallyPaidAmount: payCommand.ActuallyPaidAmount,
Remarks: payCommand.Remarks,
Attachment: payCommand.Attachment,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return payCommand, nil
}
//RemoveCreditAccount 删除账期结算
func (srv *CreditAccountService) RemoveCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) {
return 0, nil, nil
func (srv *CreditAccountService) RemoveCreditAccount(removeCommand *command.RemoveCreditAccountCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeCommand.Operator)
_, err := creationCooperationGateway.CreditAccountRemove(allied_creation_cooperation.ReqCreditAccountRemove{
CreditAccountId: removeCommand.CreditAccountId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return removeCommand, nil
}
... ...
package allied_creation_cooperation
import "time"
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CreditAccount struct {
CreditAccountId int64 `json:"creditAccountId,string"` // 账期结算单ID
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额
CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号
PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付
PaymentTime time.Time `json:"paymentTime"` // 共创账期结算支付时间
SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额
SettlementTime time.Time `json:"settlementTime"` // 共创账期结算时间
CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号
// 参与人uid,包括承接人、推荐人、关联业务员
Participator struct {
UserId int64 `json:"userId,string"` // 用户ID,
UserBaseId int64 `json:"userBaseId,string"` // 用户基本id
Org domain.Org `json:"org"` // 用户所属的组织机构
Department domain.Department `json:"department"` // 用户所属的部门
UserInfo domain.UserInfo `json:"userInfo"` //
UserName string `json:"userName"` // 用户姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserType int32 `json:"userType"` // 用户类型,1员工,2共创用户,3公开
Status int32 `json:"status"` // 状态
} `json:"participator"`
// 参与类型
ParticipateType string `json:"participateType"`
// 支付凭证附件
PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"`
// 数据所属组织机构
Org domain.Org `json:"org"`
// 公司
Company domain.CompanyData `json:"company"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
//创建账期结算单
type (
... ... @@ -14,6 +53,10 @@ type (
//支付账期结算
type (
ReqCreditAccountsPay struct {
CreditAccountId int `json:"creditAccountId"`
ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`
Remarks string `json:"remarks"`
Attachment domain.Attachment `json:"attachment"` //附件
}
DataCreditAccountsPay struct {
... ... @@ -33,35 +76,31 @@ type (
type (
ReqCreditAccountsSearch struct {
// 页面大小
PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"`
PageNumber int64 `json:"pageNumber,omitempty"`
// 页面大小
PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
PageSize int64 `json:"pageSize,omitempty"`
// 账期结算单号
CreditAccountOrderNum string `cname:"账期结算单号" json:"creditAccountOrderNum" valid:"Required"`
CreditAccountOrderNum string `json:"creditAccountOrderNum" valid:"Required"`
// 参与人姓名
ParticipatorName string `cname:"参与人姓名" json:"participatorName,omitempty"`
// 公司ID,通过集成REST上下文获取
// CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
// 组织机构ID
// OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
// UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
// 用户基础数据id
// UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
ParticipatorName string ` json:"participatorName,omitempty"`
// 账期结算支付状态,1待支付,2已支付,APP端结算记录返回已结算的账期结算单
PaymentStatus int32 `cname:"账期结算支付状态" json:"paymentStatus" valid:"Required"`
PaymentStatus int32 `json:"paymentStatus" valid:"Required"`
// 结算周期,按年“2021”或者按月结算”2021-07“
Period time.Time `cname:"结算周期" json:"period,omitempty"`
Period time.Time `json:"period,omitempty"`
}
DataCreditAccountsSearch struct {
Grid struct {
Total int `json:"total"`
List []CreditAccount `json:"list"`
} `json:"grid"`
}
)
//移除账期结算单
type (
ReqCreditAccountRemove struct {
CreditAccountId int
CreditAccountId int `json:"creditAccountId"`
}
DataCreditAccountRemove struct {
... ... @@ -80,9 +119,10 @@ type (
//返回账期结算单详情
type (
ReqCreditAccountGet struct {
CreditAccountId int
CreditAccountId int `json:"creditAccountId"`
}
DataCreditAccountGet struct {
CreditAccount
}
)
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CreditAccountController struct {
baseController
}
//ListCreditAccount返回账期结算列表
func (controller *CreditAccountController) ListCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
listQuery := &query.ListCreditAccountQuery{}
err := controller.Unmarshal(listQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listQuery.Operator = controller.GetOperator()
cnt, data, err := creditAccountService.ListCreditAccount(listQuery)
controller.ReturnListData(cnt, data, err)
}
//GetCreditAccount 返回账期结算详情
func (controller *CreditAccountController) GetCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
creditAccountID, err := controller.GetInt(":creditAccountId")
getQuery := &query.GetCreditAccountQuery{
CreditAccountId: creditAccountID,
Operator: controller.GetOperator(),
}
data, err := creditAccountService.GetCreditAccount(getQuery)
controller.Response(data, err)
}
//PayCreditAccount 支付账期结算
func (controller *CreditAccountController) PayCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
payCreditAccountCommand := &command.PayCreditAccountCommand{}
err := controller.Unmarshal(payCreditAccountCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
payCreditAccountCommand.Operator = controller.GetOperator()
data, err := creditAccountService.PayCreditAccount(payCreditAccountCommand)
controller.Response(data, err)
}
//RemoveCreditAccount 删除账期结算
func (controller *CreditAccountController) RemoveCreditAccount() {
creditAccountService := service.NewCreditAccountService(nil)
removeCreditAccountCommand := &command.RemoveCreditAccountCommand{}
err := controller.Unmarshal(removeCreditAccountCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
removeCreditAccountCommand.Operator = controller.GetOperator()
data, err := creditAccountService.RemoveCreditAccount(removeCreditAccountCommand)
controller.Response(data, err)
}
... ...