作者 tangxuhui
... ... @@ -63,8 +63,8 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
UpdatedAt: param.UpdatedAt.Unix() * 1000, // 更新时间
AccountDetail: param.AccountDetail,
}
data.Participator.UserInfo.UserName = param.Participator.UserName
data.Participator.UserInfo.UserPhone = param.Participator.UserPhone
data.Participator.UserInfo.UserName = param.Participator.UserInfo.UsersName
data.Participator.UserInfo.UserPhone = param.Participator.UserInfo.Phone
data.Participator.UserType = param.Participator.UserType
return &data
}
... ...
... ... @@ -3,11 +3,10 @@ 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"
)
// 企业端分红服务 【50%】
// 企业端分红服务 【80%】
type CompanyDividendsService struct {
}
... ... @@ -42,58 +41,38 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD
// DividendsStatistics TODO:企业的合约统计(分红统计)
func (srv CompanyStatisticsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
// "companyId":cmd.Operator.CompanyId,
// "orgId":cmd.Operator.OrgId,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//return result, nil
return map[string]interface{}{
"allDividends": map[string]interface{}{
"sumTotal": 9000,
"accounting": 6000,
"accounted": 3000,
"paid": 2000,
},
"annualDividends": map[string]interface{}{
"sumTotal": 9000,
"accounting": 6000,
"accounted": 3000,
"paid": 2000,
},
"quarterDividends": map[string]interface{}{
"sumTotal": 9000,
"accounting": 6000,
"accounted": 3000,
"paid": 2000,
},
}, nil
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result, nil
}
// SearchDividendsEstimates 企业的合约明细列表(分红预算信息)
func (srv CompanyStatisticsService) SearchDividendsEstimates(cmd *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
// "companyId":cmd.Operator.CompanyId,
// "orgId":cmd.Operator.OrgId,
// "dividendsAccountStatus":cmd.Status,
// "offset":(cmd.PageNumber-1)*cmd.PageSize,
// "limit":cmd.PageSize,
//})
//if err != nil {
// return 0,nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
//return 0,result, nil
var items []*dto.DividendsEstimatesDto
for i := 0; i < 2; i++ {
item := dto.NewDividendsEstimatesDto()
item.LoadDto()
items = append(items, item)
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
"dividendsAccountStatus": cmd.Status,
"offset": (cmd.PageNumber - 1) * cmd.PageSize,
"limit": cmd.PageSize,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return 2, items, nil
return 0, result, nil
//var items []*dto.DividendsEstimatesDto
//for i := 0; i < 2; i++ {
// item := dto.NewDividendsEstimatesDto()
// item.LoadDto()
// items = append(items, item)
//}
//return 2, items, nil
}
... ...
... ... @@ -79,6 +79,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: 1,
PageSize: 1,
//CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ... @@ -111,24 +113,38 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
}
// GoodsStatistics TODO:产品统计排行榜 年月榜
func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (int64, interface{}, error) {
type rankItem struct {
GoodAmount float64 `json:"goodAmount"`
GoodName string `json:"goodName"`
GoodRatio float64 `json:"goodRatio"`
Rank int `json:"rank"`
}
var items []rankItem
for i := 0; i < 5; i++ {
item := rankItem{
GoodAmount: 2000,
GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),
GoodRatio: 20,
Rank: i + 1,
}
items = append(items, item)
func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatisticsCommand) (int64, interface{}, error) {
//type rankItem struct {
// GoodAmount float64 `json:"goodAmount"`
// GoodName string `json:"goodName"`
// GoodRatio float64 `json:"goodRatio"`
// Rank int `json:"rank"`
//}
//var items []rankItem
//for i := 0; i < 5; i++ {
// item := rankItem{
// GoodAmount: 2000,
// GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),
// GoodRatio: 20,
// Rank: i + 1,
// }
// items = append(items, item)
//}
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
"companyId": cmd.Operator.CompanyId,
"orgId": cmd.Operator.OrgId,
"rankType": cmd.RankingType, //当前月
//"offset":cmd.PageNumber*cmd.PageSize,
"top": 100,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return 5, items, nil
return 0, cooperationGoodsStatistics, nil
}
// CooperationDividendsStatistics TODO:公司共创人员列表
... ...
... ... @@ -18,6 +18,8 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC
PageNumber: cmd.PageNumber,
PageSize: cmd.PageSize,
MatchWord: cmd.MatchWord,
CompanyId: cmd.Operator.CompanyId,
OrgId: cmd.Operator.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -43,6 +43,10 @@ type (
CooperationContractName string `json:"cooperationContractName"`
// 查询关键词
MatchWord string `cname:"查询关键词" json:"matchWord,omitempty"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
}
DataContractUndertakerFeedbackSearch struct {
... ...