作者 yangfu

合约统计修改

@@ -63,8 +63,8 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred @@ -63,8 +63,8 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
63 UpdatedAt: param.UpdatedAt.Unix() * 1000, // 更新时间 63 UpdatedAt: param.UpdatedAt.Unix() * 1000, // 更新时间
64 AccountDetail: param.AccountDetail, 64 AccountDetail: param.AccountDetail,
65 } 65 }
66 - data.Participator.UserInfo.UserName = param.Participator.UserName  
67 - data.Participator.UserInfo.UserPhone = param.Participator.UserPhone 66 + data.Participator.UserInfo.UserName = param.Participator.UserInfo.UsersName
  67 + data.Participator.UserInfo.UserPhone = param.Participator.UserInfo.Phone
68 data.Participator.UserType = param.Participator.UserType 68 data.Participator.UserType = param.Participator.UserType
69 return &data 69 return &data
70 } 70 }
@@ -3,11 +3,10 @@ package service @@ -3,11 +3,10 @@ package service
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
8 ) 7 )
9 8
10 -// 企业端分红服务 【50%】 9 +// 企业端分红服务 【80%】
11 type CompanyDividendsService struct { 10 type CompanyDividendsService struct {
12 } 11 }
13 12
@@ -42,58 +41,38 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD @@ -42,58 +41,38 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD
42 41
43 // DividendsStatistics TODO:企业的合约统计(分红统计) 42 // DividendsStatistics TODO:企业的合约统计(分红统计)
44 func (srv CompanyStatisticsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) { 43 func (srv CompanyStatisticsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) {
45 - //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(  
46 - // cmd.Operator)  
47 - //result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{  
48 - // "companyId":cmd.Operator.CompanyId,  
49 - // "orgId":cmd.Operator.OrgId,  
50 - //})  
51 - //if err != nil {  
52 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
53 - //}  
54 - //return result, nil  
55 - return map[string]interface{}{  
56 - "allDividends": map[string]interface{}{  
57 - "sumTotal": 9000,  
58 - "accounting": 6000,  
59 - "accounted": 3000,  
60 - "paid": 2000,  
61 - },  
62 - "annualDividends": map[string]interface{}{  
63 - "sumTotal": 9000,  
64 - "accounting": 6000,  
65 - "accounted": 3000,  
66 - "paid": 2000,  
67 - },  
68 - "quarterDividends": map[string]interface{}{  
69 - "sumTotal": 9000,  
70 - "accounting": 6000,  
71 - "accounted": 3000,  
72 - "paid": 2000,  
73 - },  
74 - }, nil 44 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  45 + cmd.Operator)
  46 + result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
  47 + "companyId": cmd.Operator.CompanyId,
  48 + "orgId": cmd.Operator.OrgId,
  49 + })
  50 + if err != nil {
  51 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  52 + }
  53 + return result, nil
75 } 54 }
76 55
77 // SearchDividendsEstimates 企业的合约明细列表(分红预算信息) 56 // SearchDividendsEstimates 企业的合约明细列表(分红预算信息)
78 func (srv CompanyStatisticsService) SearchDividendsEstimates(cmd *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) { 57 func (srv CompanyStatisticsService) SearchDividendsEstimates(cmd *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
79 - //gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(  
80 - // cmd.Operator)  
81 - //result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{  
82 - // "companyId":cmd.Operator.CompanyId,  
83 - // "orgId":cmd.Operator.OrgId,  
84 - // "dividendsAccountStatus":cmd.Status,  
85 - // "offset":(cmd.PageNumber-1)*cmd.PageSize,  
86 - // "limit":cmd.PageSize,  
87 - //})  
88 - //if err != nil {  
89 - // return 0,nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
90 - //}  
91 - //return 0,result, nil  
92 - var items []*dto.DividendsEstimatesDto  
93 - for i := 0; i < 2; i++ {  
94 - item := dto.NewDividendsEstimatesDto()  
95 - item.LoadDto()  
96 - items = append(items, item) 58 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  59 + cmd.Operator)
  60 + result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{
  61 + "companyId": cmd.Operator.CompanyId,
  62 + "orgId": cmd.Operator.OrgId,
  63 + "dividendsAccountStatus": cmd.Status,
  64 + "offset": (cmd.PageNumber - 1) * cmd.PageSize,
  65 + "limit": cmd.PageSize,
  66 + })
  67 + if err != nil {
  68 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
97 } 69 }
98 - return 2, items, nil 70 + return 0, result, nil
  71 + //var items []*dto.DividendsEstimatesDto
  72 + //for i := 0; i < 2; i++ {
  73 + // item := dto.NewDividendsEstimatesDto()
  74 + // item.LoadDto()
  75 + // items = append(items, item)
  76 + //}
  77 + //return 2, items, nil
99 } 78 }
@@ -79,6 +79,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -79,6 +79,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
79 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ 79 projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
80 PageNumber: 1, 80 PageNumber: 1,
81 PageSize: 1, 81 PageSize: 1,
  82 + //CompanyId: cmd.Operator.CompanyId,
  83 + OrgId: cmd.Operator.OrgId,
82 }) 84 })
83 if err != nil { 85 if err != nil {
84 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 86 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -111,24 +113,38 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -111,24 +113,38 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
111 } 113 }
112 114
113 // GoodsStatistics TODO:产品统计排行榜 年月榜 115 // GoodsStatistics TODO:产品统计排行榜 年月榜
114 -func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (int64, interface{}, error) {  
115 - type rankItem struct {  
116 - GoodAmount float64 `json:"goodAmount"`  
117 - GoodName string `json:"goodName"`  
118 - GoodRatio float64 `json:"goodRatio"`  
119 - Rank int `json:"rank"`  
120 - }  
121 - var items []rankItem  
122 - for i := 0; i < 5; i++ {  
123 - item := rankItem{  
124 - GoodAmount: 2000,  
125 - GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),  
126 - GoodRatio: 20,  
127 - Rank: i + 1,  
128 - }  
129 - items = append(items, item) 116 +func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatisticsCommand) (int64, interface{}, error) {
  117 + //type rankItem struct {
  118 + // GoodAmount float64 `json:"goodAmount"`
  119 + // GoodName string `json:"goodName"`
  120 + // GoodRatio float64 `json:"goodRatio"`
  121 + // Rank int `json:"rank"`
  122 + //}
  123 + //var items []rankItem
  124 + //for i := 0; i < 5; i++ {
  125 + // item := rankItem{
  126 + // GoodAmount: 2000,
  127 + // GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),
  128 + // GoodRatio: 20,
  129 + // Rank: i + 1,
  130 + // }
  131 + // items = append(items, item)
  132 + //}
  133 +
  134 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  135 + cmd.Operator)
  136 + cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
  137 + "companyId": cmd.Operator.CompanyId,
  138 + "orgId": cmd.Operator.OrgId,
  139 + "rankType": cmd.RankingType, //当前月
  140 + //"offset":cmd.PageNumber*cmd.PageSize,
  141 + "top": 100,
  142 + })
  143 + if err != nil {
  144 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
130 } 145 }
131 - return 5, items, nil 146 +
  147 + return 0, cooperationGoodsStatistics, nil
132 } 148 }
133 149
134 // CooperationDividendsStatistics TODO:公司共创人员列表 150 // CooperationDividendsStatistics TODO:公司共创人员列表
@@ -18,6 +18,8 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC @@ -18,6 +18,8 @@ func (srv UndertakerFeedbackService) SearchFeedback(cmd *command.SearchFeedbackC
18 PageNumber: cmd.PageNumber, 18 PageNumber: cmd.PageNumber,
19 PageSize: cmd.PageSize, 19 PageSize: cmd.PageSize,
20 MatchWord: cmd.MatchWord, 20 MatchWord: cmd.MatchWord,
  21 + CompanyId: cmd.Operator.CompanyId,
  22 + OrgId: cmd.Operator.OrgId,
21 }) 23 })
22 if err != nil { 24 if err != nil {
23 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 25 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -43,6 +43,10 @@ type ( @@ -43,6 +43,10 @@ type (
43 CooperationContractName string `json:"cooperationContractName"` 43 CooperationContractName string `json:"cooperationContractName"`
44 // 查询关键词 44 // 查询关键词
45 MatchWord string `cname:"查询关键词" json:"matchWord,omitempty"` 45 MatchWord string `cname:"查询关键词" json:"matchWord,omitempty"`
  46 + // 公司ID,通过集成REST上下文获取
  47 + CompanyId int64 `cname:"公司ID" json:"companyId"`
  48 + // 组织机构ID
  49 + OrgId int64 `cname:"组织机构ID" json:"orgId"`
46 } 50 }
47 51
48 DataContractUndertakerFeedbackSearch struct { 52 DataContractUndertakerFeedbackSearch struct {