credit_account_controller.go
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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.ReturnPageListData(cnt, data, err, listQuery.PageNumber)
}
//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)
}