正在显示
6 个修改的文件
包含
77 行增加
和
0 行删除
@@ -172,3 +172,15 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( | @@ -172,3 +172,15 @@ func (dividendsEmmateService *DividendsEstimateService) MoneyIncentivesSelector( | ||
172 | } | 172 | } |
173 | return data, nil | 173 | return data, nil |
174 | } | 174 | } |
175 | + | ||
176 | +//ConfimDividendsEstimate 确定分红预算 | ||
177 | +func (dividendsEstimateService *DividendsEstimateService) ConfimDividendsEstimate(confimDividendsEstimateCommand *command.ConfimDividendsEstimateCommand) (interface{}, error) { | ||
178 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(confimDividendsEstimateCommand.Operator) | ||
179 | + _, err := creationCooperationGateway.CreditAccountsAdd(allied_creation_cooperation.ReqCreditAccountsAdd{ | ||
180 | + DividendsEstimateIds: confimDividendsEstimateCommand.DividendsEstimateId, | ||
181 | + }) | ||
182 | + if err != nil { | ||
183 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
184 | + } | ||
185 | + return confimDividendsEstimateCommand, nil | ||
186 | +} |
@@ -164,3 +164,34 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCredit | @@ -164,3 +164,34 @@ func (gateway HttplibAlliedCreationCooperation) CreditAccountGet(param ReqCredit | ||
164 | err = gateway.GetResponseData(result, &data) | 164 | err = gateway.GetResponseData(result, &data) |
165 | return &data, err | 165 | return &data, err |
166 | } | 166 | } |
167 | + | ||
168 | +// CreditAccountsAdd 创建账期结算 | ||
169 | +func (gateway HttplibAlliedCreationCooperation) CreditAccountsAdd(param ReqCreditAccountsAdd) (*DataCreditAccountsAdd, error) { | ||
170 | + url := gateway.baseUrL + "/credit-accounts" | ||
171 | + method := "POST" | ||
172 | + req := gateway.CreateRequest(url, method) | ||
173 | + log.Logger.Debug("向业务模块请求数据:创建账期结算。", map[string]interface{}{ | ||
174 | + "api": method + ":" + url, | ||
175 | + "param": param, | ||
176 | + }) | ||
177 | + req, err := req.JSONBody(param) | ||
178 | + if err != nil { | ||
179 | + return nil, fmt.Errorf("请求创建账期结算失败:%w", err) | ||
180 | + } | ||
181 | + | ||
182 | + byteResult, err := req.Bytes() | ||
183 | + if err != nil { | ||
184 | + return nil, fmt.Errorf("获取创建账期结算失败:%w", err) | ||
185 | + } | ||
186 | + log.Logger.Debug("获取业务模块请求数据:创建账期结算。", map[string]interface{}{ | ||
187 | + "result": string(byteResult), | ||
188 | + }) | ||
189 | + var result service_gateway.GatewayResponse | ||
190 | + err = json.Unmarshal(byteResult, &result) | ||
191 | + if err != nil { | ||
192 | + return nil, fmt.Errorf("解析创建账期结算:%w", err) | ||
193 | + } | ||
194 | + var data DataCreditAccountsAdd | ||
195 | + err = gateway.GetResponseData(result, &data) | ||
196 | + return &data, err | ||
197 | +} |
@@ -106,3 +106,13 @@ type ( | @@ -106,3 +106,13 @@ type ( | ||
106 | CreditAccount | 106 | CreditAccount |
107 | } | 107 | } |
108 | ) | 108 | ) |
109 | + | ||
110 | +//创建账期结算 | ||
111 | +type ( | ||
112 | + ReqCreditAccountsAdd struct { | ||
113 | + DividendsEstimateIds []string `json:"dividendsEstimateIdss"` | ||
114 | + } | ||
115 | + | ||
116 | + DataCreditAccountsAdd []struct { | ||
117 | + } | ||
118 | +) |
@@ -101,3 +101,16 @@ func (controller *DividendsEstimateController) MoneyIncentivesSelector() { | @@ -101,3 +101,16 @@ func (controller *DividendsEstimateController) MoneyIncentivesSelector() { | ||
101 | data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery) | 101 | data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery) |
102 | controller.Response(data, err) | 102 | controller.Response(data, err) |
103 | } | 103 | } |
104 | + | ||
105 | +//ConfimDividendsEstimate 确定分红预算 | ||
106 | +func (controller *DividendsEstimateController) ConfimDividendsEstimate() { | ||
107 | + dividendsEstimateService := service.NewDividendsEstimateService(nil) | ||
108 | + confimDividendsEstimateCommand := &command.ConfimDividendsEstimateCommand{} | ||
109 | + err := controller.Unmarshal(confimDividendsEstimateCommand) | ||
110 | + if err != nil { | ||
111 | + log.Logger.Debug("json err:" + err.Error()) | ||
112 | + } | ||
113 | + confimDividendsEstimateCommand.Operator = controller.GetOperator() | ||
114 | + data, err := dividendsEstimateService.ConfimDividendsEstimate(confimDividendsEstimateCommand) | ||
115 | + controller.Response(data, err) | ||
116 | +} |
@@ -13,4 +13,6 @@ func init() { | @@ -13,4 +13,6 @@ func init() { | ||
13 | web.Router("/v1/web/dividends-estimate/money-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateMoneyIncentives") | 13 | web.Router("/v1/web/dividends-estimate/money-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateMoneyIncentives") |
14 | web.Router("/v1/web/dividends-estimate/dividends-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateDividendsIncentives") | 14 | web.Router("/v1/web/dividends-estimate/dividends-incentives/estimate", &web_client.DividendsEstimateController{}, "Post:EstimateDividendsIncentives") |
15 | web.Router("/v1/web/dividends-estimate/money-incentives/selector", &web_client.DividendsEstimateController{}, "Post:MoneyIncentivesSelector") | 15 | web.Router("/v1/web/dividends-estimate/money-incentives/selector", &web_client.DividendsEstimateController{}, "Post:MoneyIncentivesSelector") |
16 | + web.Router("/v1/web/dividends-estimate/confim", &web_client.DividendsEstimateController{}, "Post:ConfimDividendsEstimate") | ||
17 | + | ||
16 | } | 18 | } |
-
请 注册 或 登录 后发表评论