作者 yangfu

共创统计模块

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/application/mobile/cooperation/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// 企业端分红服务
... ... @@ -10,14 +12,14 @@ type CompanyDividendsService struct {
}
// GetDividendContracts 企业的合约列表(分红信息按合约划分)
func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *command.GetDividendContractsCommand) (interface{}, error) {
//var items []*dto.CompanyContractDividendDto
//for i := 0; i < 2; i++ {
// item := dto.NewCompanyContractDividendDto()
// item.LoadDto()
// items = append(items, item)
//}
return struct{}{}, nil
func (srv CompanyStatisticsService) GetDividendContracts(cmd *command.GetDividendContractsCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, cmd)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, nil
}
// GetDividendContracts 企业的合约列表(分红信息按合约划分)
... ...
... ... @@ -77,8 +77,10 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"list": resultMenu,
"grid": map[string]interface{}{
"list": resultMenu.Grid.List,
"sum": 6000,
},
}, nil
}
... ...
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
const (
// 合约分红列表查询
SearchContractDividends = "ContractDividends"
)
// CooperationStatistics 共创统计
func (gateway HttplibAlliedCreationCooperation) CooperationStatistics(action string, queryOptions interface{}) (interface{}, error) {
url := gateway.baseUrL + "/cooperation-statistics"
method := "post"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:共创统计。", map[string]interface{}{
"api": method + ":" + url,
"param": queryOptions,
})
param := map[string]interface{}{
"action": action,
"queryOptions": queryOptions,
}
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求共创统计失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取共创统计失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:共创统计。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析共创统计:%w", err)
}
var data map[string]interface{}
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -364,6 +364,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB
//UserUpdateBaseInfo 返回用户有权限的菜单
func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) {
url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus")
url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v", param.MenuCategory, param.ALLDisableMenu)
method := "get"
req := gateway.CreateRequest(url, method)
//TODO traceID
... ...