正在显示
7 个修改的文件
包含
188 行增加
和
25 行删除
1 | +package command | ||
2 | + | ||
3 | +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
4 | + | ||
5 | +type PayCreditAccountCommand struct { | ||
6 | + //操作人 | ||
7 | + Operator domain.Operator `json:"-"` | ||
8 | + CreditAccountId int `json:"creditAccountId"` //账期结算id | ||
9 | + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` //实际金额 | ||
10 | + Remarks string `json:"remarks"` //备注 | ||
11 | + Attachment domain.Attachment `json:"attachment"` //附件 | ||
12 | +} |
1 | package query | 1 | package query |
2 | 2 | ||
3 | +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
4 | + | ||
3 | type ListCreditAccountQuery struct { | 5 | type ListCreditAccountQuery struct { |
6 | + //操作人 | ||
7 | + Operator domain.Operator `json:"-"` | ||
8 | + PageNumber int `json:"pageNumber"` | ||
9 | + PageSize int `json:"pageSize"` | ||
10 | + Participator string `json:"participator"` //参与人 | ||
11 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` //账期结算单号 | ||
4 | } | 12 | } |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command" | ||
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query" |
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
5 | ) | 8 | ) |
6 | 9 | ||
7 | type CreditAccountService struct{} | 10 | type CreditAccountService struct{} |
8 | 11 | ||
12 | +func NewCreditAccountService(option map[string]interface{}) CreditAccountService { | ||
13 | + return CreditAccountService{} | ||
14 | +} | ||
15 | + | ||
9 | //ListCreditAccount返回账期结算列表 | 16 | //ListCreditAccount返回账期结算列表 |
10 | func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { | 17 | func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { |
11 | 18 | ||
@@ -13,19 +20,34 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc | @@ -13,19 +20,34 @@ func (srv *CreditAccountService) ListCreditAccount(listQuery *query.ListCreditAc | ||
13 | } | 20 | } |
14 | 21 | ||
15 | //GetCreditAccount 返回账期结算详情 | 22 | //GetCreditAccount 返回账期结算详情 |
16 | -func (srv *CreditAccountService) GetCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { | 23 | +func (srv *CreditAccountService) GetCreditAccount(getQuery *query.GetCreditAccountQuery) (interface{}, error) { |
17 | 24 | ||
18 | - return 0, nil, nil | 25 | + return nil, nil |
19 | } | 26 | } |
20 | 27 | ||
21 | //PayCreditAccount 支付账期结算 | 28 | //PayCreditAccount 支付账期结算 |
22 | -func (srv *CreditAccountService) PayCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { | ||
23 | - | ||
24 | - return 0, nil, nil | 29 | +func (srv *CreditAccountService) PayCreditAccount(payCommand *command.PayCreditAccountCommand) (interface{}, error) { |
30 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(payCommand.Operator) | ||
31 | + _, err := creationCooperationGateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{ | ||
32 | + CreditAccountId: payCommand.CreditAccountId, | ||
33 | + ActuallyPaidAmount: payCommand.ActuallyPaidAmount, | ||
34 | + Remarks: payCommand.Remarks, | ||
35 | + Attachment: payCommand.Attachment, | ||
36 | + }) | ||
37 | + if err != nil { | ||
38 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
39 | + } | ||
40 | + return payCommand, nil | ||
25 | } | 41 | } |
26 | 42 | ||
27 | //RemoveCreditAccount 删除账期结算 | 43 | //RemoveCreditAccount 删除账期结算 |
28 | -func (srv *CreditAccountService) RemoveCreditAccount(listQuery *query.ListCreditAccountQuery) (int64, interface{}, error) { | ||
29 | - | ||
30 | - return 0, nil, nil | 44 | +func (srv *CreditAccountService) RemoveCreditAccount(removeCommand *command.RemoveCreditAccountCommand) (interface{}, error) { |
45 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeCommand.Operator) | ||
46 | + _, err := creationCooperationGateway.CreditAccountRemove(allied_creation_cooperation.ReqCreditAccountRemove{ | ||
47 | + CreditAccountId: removeCommand.CreditAccountId, | ||
48 | + }) | ||
49 | + if err != nil { | ||
50 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
51 | + } | ||
52 | + return removeCommand, nil | ||
31 | } | 53 | } |
1 | package allied_creation_cooperation | 1 | package allied_creation_cooperation |
2 | 2 | ||
3 | -import "time" | 3 | +import ( |
4 | + "time" | ||
5 | + | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +type CreditAccount struct { | ||
10 | + CreditAccountId int64 `json:"creditAccountId,string"` // 账期结算单ID | ||
11 | + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 账期结算实付金额 | ||
12 | + CreditAccountOrderNum string `json:"creditAccountOrderNum"` // 账期结算单号 | ||
13 | + PaymentStatus int `json:"paymentStatus"` // 账期结算支付状态,1待支付,2已支付 | ||
14 | + PaymentTime time.Time `json:"paymentTime"` // 共创账期结算支付时间 | ||
15 | + SettlementAmount float64 `json:"settlementAmount"` // 账期结算金额 | ||
16 | + SettlementTime time.Time `json:"settlementTime"` // 共创账期结算时间 | ||
17 | + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联共创合约编号 | ||
18 | + // 参与人uid,包括承接人、推荐人、关联业务员 | ||
19 | + Participator struct { | ||
20 | + UserId int64 `json:"userId,string"` // 用户ID, | ||
21 | + UserBaseId int64 `json:"userBaseId,string"` // 用户基本id | ||
22 | + Org domain.Org `json:"org"` // 用户所属的组织机构 | ||
23 | + Department domain.Department `json:"department"` // 用户所属的部门 | ||
24 | + UserInfo domain.UserInfo `json:"userInfo"` // | ||
25 | + UserName string `json:"userName"` // 用户姓名 | ||
26 | + UserPhone string `json:"userPhone"` // 用户手机号 | ||
27 | + UserType int32 `json:"userType"` // 用户类型,1员工,2共创用户,3公开 | ||
28 | + Status int32 `json:"status"` // 状态 | ||
29 | + } `json:"participator"` | ||
30 | + // 参与类型 | ||
31 | + ParticipateType string `json:"participateType"` | ||
32 | + // 支付凭证附件 | ||
33 | + PaymentDocumentAttachment domain.Attachment `json:"paymentDocumentAttachment"` | ||
34 | + // 数据所属组织机构 | ||
35 | + Org domain.Org `json:"org"` | ||
36 | + // 公司 | ||
37 | + Company domain.CompanyData `json:"company"` | ||
38 | + // 创建时间 | ||
39 | + CreatedAt time.Time `json:"createdAt"` | ||
40 | + // 更新时间 | ||
41 | + UpdatedAt time.Time `json:"updatedAt"` | ||
42 | +} | ||
4 | 43 | ||
5 | //创建账期结算单 | 44 | //创建账期结算单 |
6 | type ( | 45 | type ( |
@@ -14,6 +53,10 @@ type ( | @@ -14,6 +53,10 @@ type ( | ||
14 | //支付账期结算 | 53 | //支付账期结算 |
15 | type ( | 54 | type ( |
16 | ReqCreditAccountsPay struct { | 55 | ReqCreditAccountsPay struct { |
56 | + CreditAccountId int `json:"creditAccountId"` | ||
57 | + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` | ||
58 | + Remarks string `json:"remarks"` | ||
59 | + Attachment domain.Attachment `json:"attachment"` //附件 | ||
17 | } | 60 | } |
18 | 61 | ||
19 | DataCreditAccountsPay struct { | 62 | DataCreditAccountsPay struct { |
@@ -33,35 +76,31 @@ type ( | @@ -33,35 +76,31 @@ type ( | ||
33 | type ( | 76 | type ( |
34 | ReqCreditAccountsSearch struct { | 77 | ReqCreditAccountsSearch struct { |
35 | // 页面大小 | 78 | // 页面大小 |
36 | - PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` | 79 | + PageNumber int64 `json:"pageNumber,omitempty"` |
37 | // 页面大小 | 80 | // 页面大小 |
38 | - PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` | 81 | + PageSize int64 `json:"pageSize,omitempty"` |
39 | // 账期结算单号 | 82 | // 账期结算单号 |
40 | - CreditAccountOrderNum string `cname:"账期结算单号" json:"creditAccountOrderNum" valid:"Required"` | 83 | + CreditAccountOrderNum string `json:"creditAccountOrderNum" valid:"Required"` |
41 | // 参与人姓名 | 84 | // 参与人姓名 |
42 | - ParticipatorName string `cname:"参与人姓名" json:"participatorName,omitempty"` | ||
43 | - // 公司ID,通过集成REST上下文获取 | ||
44 | - // CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
45 | - // 组织机构ID | ||
46 | - // OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
47 | - // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
48 | - // UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
49 | - // 用户基础数据id | ||
50 | - // UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | 85 | + ParticipatorName string ` json:"participatorName,omitempty"` |
51 | // 账期结算支付状态,1待支付,2已支付,APP端结算记录返回已结算的账期结算单 | 86 | // 账期结算支付状态,1待支付,2已支付,APP端结算记录返回已结算的账期结算单 |
52 | - PaymentStatus int32 `cname:"账期结算支付状态" json:"paymentStatus" valid:"Required"` | 87 | + PaymentStatus int32 `json:"paymentStatus" valid:"Required"` |
53 | // 结算周期,按年“2021”或者按月结算”2021-07“ | 88 | // 结算周期,按年“2021”或者按月结算”2021-07“ |
54 | - Period time.Time `cname:"结算周期" json:"period,omitempty"` | 89 | + Period time.Time `json:"period,omitempty"` |
55 | } | 90 | } |
56 | 91 | ||
57 | DataCreditAccountsSearch struct { | 92 | DataCreditAccountsSearch struct { |
93 | + Grid struct { | ||
94 | + Total int `json:"total"` | ||
95 | + List []CreditAccount `json:"list"` | ||
96 | + } `json:"grid"` | ||
58 | } | 97 | } |
59 | ) | 98 | ) |
60 | 99 | ||
61 | //移除账期结算单 | 100 | //移除账期结算单 |
62 | type ( | 101 | type ( |
63 | ReqCreditAccountRemove struct { | 102 | ReqCreditAccountRemove struct { |
64 | - CreditAccountId int | 103 | + CreditAccountId int `json:"creditAccountId"` |
65 | } | 104 | } |
66 | 105 | ||
67 | DataCreditAccountRemove struct { | 106 | DataCreditAccountRemove struct { |
@@ -80,9 +119,10 @@ type ( | @@ -80,9 +119,10 @@ type ( | ||
80 | //返回账期结算单详情 | 119 | //返回账期结算单详情 |
81 | type ( | 120 | type ( |
82 | ReqCreditAccountGet struct { | 121 | ReqCreditAccountGet struct { |
83 | - CreditAccountId int | 122 | + CreditAccountId int `json:"creditAccountId"` |
84 | } | 123 | } |
85 | 124 | ||
86 | DataCreditAccountGet struct { | 125 | DataCreditAccountGet struct { |
126 | + CreditAccount | ||
87 | } | 127 | } |
88 | ) | 128 | ) |
1 | +package web_client | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/command" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/query" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/creditAccount/service" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | ||
8 | +) | ||
9 | + | ||
10 | +type CreditAccountController struct { | ||
11 | + baseController | ||
12 | +} | ||
13 | + | ||
14 | +//ListCreditAccount返回账期结算列表 | ||
15 | +func (controller *CreditAccountController) ListCreditAccount() { | ||
16 | + creditAccountService := service.NewCreditAccountService(nil) | ||
17 | + listQuery := &query.ListCreditAccountQuery{} | ||
18 | + err := controller.Unmarshal(listQuery) | ||
19 | + if err != nil { | ||
20 | + log.Logger.Debug("json err:" + err.Error()) | ||
21 | + } | ||
22 | + listQuery.Operator = controller.GetOperator() | ||
23 | + cnt, data, err := creditAccountService.ListCreditAccount(listQuery) | ||
24 | + controller.ReturnListData(cnt, data, err) | ||
25 | +} | ||
26 | + | ||
27 | +//GetCreditAccount 返回账期结算详情 | ||
28 | +func (controller *CreditAccountController) GetCreditAccount() { | ||
29 | + creditAccountService := service.NewCreditAccountService(nil) | ||
30 | + creditAccountID, err := controller.GetInt(":creditAccountId") | ||
31 | + getQuery := &query.GetCreditAccountQuery{ | ||
32 | + CreditAccountId: creditAccountID, | ||
33 | + Operator: controller.GetOperator(), | ||
34 | + } | ||
35 | + data, err := creditAccountService.GetCreditAccount(getQuery) | ||
36 | + controller.Response(data, err) | ||
37 | +} | ||
38 | + | ||
39 | +//PayCreditAccount 支付账期结算 | ||
40 | +func (controller *CreditAccountController) PayCreditAccount() { | ||
41 | + creditAccountService := service.NewCreditAccountService(nil) | ||
42 | + payCreditAccountCommand := &command.PayCreditAccountCommand{} | ||
43 | + err := controller.Unmarshal(payCreditAccountCommand) | ||
44 | + if err != nil { | ||
45 | + log.Logger.Debug("json err:" + err.Error()) | ||
46 | + } | ||
47 | + payCreditAccountCommand.Operator = controller.GetOperator() | ||
48 | + data, err := creditAccountService.PayCreditAccount(payCreditAccountCommand) | ||
49 | + controller.Response(data, err) | ||
50 | +} | ||
51 | + | ||
52 | +//RemoveCreditAccount 删除账期结算 | ||
53 | +func (controller *CreditAccountController) RemoveCreditAccount() { | ||
54 | + creditAccountService := service.NewCreditAccountService(nil) | ||
55 | + removeCreditAccountCommand := &command.RemoveCreditAccountCommand{} | ||
56 | + err := controller.Unmarshal(removeCreditAccountCommand) | ||
57 | + if err != nil { | ||
58 | + log.Logger.Debug("json err:" + err.Error()) | ||
59 | + } | ||
60 | + removeCreditAccountCommand.Operator = controller.GetOperator() | ||
61 | + data, err := creditAccountService.RemoveCreditAccount(removeCreditAccountCommand) | ||
62 | + controller.Response(data, err) | ||
63 | +} |
-
请 注册 或 登录 后发表评论