作者 yangfu

个人统计修改

... ... @@ -8,7 +8,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// CooperationApplicationsService 共创申请服务 【80%】
// CooperationApplicationsService 共创申请服务 【100%】
type CooperationApplicationsService struct {
}
... ...
... ... @@ -9,7 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// CooperationProjectService 共创项目服务 【90%】
// CooperationProjectService 共创项目服务 【100%】
type CooperationProjectService struct {
}
... ... @@ -69,18 +69,18 @@ func (srv CooperationProjectService) UpdateCooperationProject(updateCooperationP
return updateCooperationProjectCommand, nil
}
// EndCooperationProject TODO:企业结束共创项目
// EndCooperationProject 企业结束共创项目
func (srv CooperationProjectService) EndCooperationProject(endCooperationProjectCommand *command.EndCooperationProjectCommand) (interface{}, error) {
//creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
var projectIds []string
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
//var projectIds []string
idStr := strconv.Itoa(endCooperationProjectCommand.CooperationProjectId)
projectIds = append(projectIds, idStr)
//_, err := creationCooperationGateway.CooperationProjectBatchEnd(allied_creation_cooperation.ReqCooperationProjectBatchEnd{
// CooperationProjectIds: projectIds,
//})
//if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
//}
//projectIds = append(projectIds, idStr)
_, err := creationCooperationGateway.CooperationProjectEnd(allied_creation_cooperation.ReqCooperationProjectEnd{
CooperationProjectId: idStr,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return endCooperationProjectCommand, nil
}
... ...
... ... @@ -4,7 +4,6 @@ import (
"fmt"
"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/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
... ... @@ -18,11 +17,6 @@ type CompanyStatisticsService struct {
// IndexStatistics 首页统计 (入口页面统计数据)
func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatisticsCommand) (interface{}, error) {
value := dto.IndexStatistics{}
value.ProjectOverviewStatistics.ContractSum = 20
value.ProjectOverviewStatistics.CooperationUserCount = 5
value.ProjectOverviewStatistics.ProjectSum = 5
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{
... ... @@ -71,6 +65,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: 1,
PageSize: 1,
CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -3,7 +3,9 @@ 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/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
// 个人端统计 【0%】
... ... @@ -11,27 +13,65 @@ type PersonStatisticsService struct {
}
// IndexStatistics TODO:个人端 - 首页统计 (入口页面统计数据)
func (srv PersonStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
//resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
// UserId: int(userMenusCommand.Operator.UserId),
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
// 项目概览统计
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: 1,
PageSize: 1,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 项目概览统计
stoppedContracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: 1,
PageSize: 1,
Status: 2,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
cmd.Operator)
users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 1,
Offset: 0,
UserType: domain.UserTypeCooperation,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var overview = map[string]interface{}{
"contractSum": contracts.Grid.Total,
"contractStoppedSum": stoppedContracts.Grid.Total,
"companySum": users.Count,
}
return map[string]interface{}{
"overview": map[string]interface{}{
"contractSum": 60,
"contractStoppedSum": 70,
"companySum": 6,
},
"overview": overview,
"dividendStatistics": map[string]interface{}{
"dividendAmount": 9000,
"paidAmount": 2000,
"unPaidAmount": 7000,
},
}, nil
//return map[string]interface{}{
// "overview": map[string]interface{}{
// "contractSum": 60,
// "contractStoppedSum": 70,
// "companySum": 6,
// },
// "dividendStatistics": map[string]interface{}{
// "dividendAmount": 9000,
// "paidAmount": 2000,
// "unPaidAmount": 7000,
// },
//}, nil
}
// CompanyStatistics 共创用户-共创企业统计
... ...
... ... @@ -287,3 +287,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectBatchEnd(param
err = gateway.GetResponseData(result, &data)
return &data, err
}
//CooperationProjectBatchEnd 批量结束共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectEnd(param ReqCooperationProjectEnd) (*DataCooperationProjectEnd, error) {
url := gateway.baseUrL + "/cooperation-projects/end"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:批量结束共创项目。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
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 DataCooperationProjectEnd
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -211,6 +211,13 @@ type (
PageSize int `json:"pageSize"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
SponsorName string `json:"sponsorName"` //发起人名字
Status int `json:"status"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId`
}
DataCooperationContractSearch struct {
... ...
... ... @@ -271,3 +271,13 @@ type (
DataCooperationProjectBatchEnd struct {
}
)
// 结束项目
type (
ReqCooperationProjectEnd struct {
CooperationProjectId string `json:"cooperationProjectId"`
}
DataCooperationProjectEnd struct {
}
)
... ...