作者 yangfu

共创首页统计

正在显示 30 个修改的文件 包含 369 行增加39 行删除
@@ -278,6 +278,21 @@ func (svr AuthService) GetUserInfo(userInfoCommand *command.UserInfoCommand) (in @@ -278,6 +278,21 @@ func (svr AuthService) GetUserInfo(userInfoCommand *command.UserInfoCommand) (in
278 }, nil 278 }, nil
279 } 279 }
280 280
  281 +//GetUserMenus 获取用户信息-额外的数据
  282 +func (svr AuthService) GetUserInfoExtra(userInfoCommand *command.UserInfoCommand) (interface{}, error) {
  283 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  284 + userInfoCommand.Operator)
  285 + resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGetUser{
  286 + UserId: int(userInfoCommand.Operator.UserId),
  287 + })
  288 + if err != nil {
  289 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  290 + }
  291 + return map[string]interface{}{
  292 + "favoriteMenus": resultUser.FavoriteMenus,
  293 + }, nil
  294 +}
  295 +
281 //GetUserMenus 获取用户菜单 296 //GetUserMenus 获取用户菜单
282 func (svr AuthService) GetUserMenus(userMenusCommand *command.UserMenusCommand) (interface{}, error) { 297 func (svr AuthService) GetUserMenus(userMenusCommand *command.UserMenusCommand) (interface{}, error) {
283 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 298 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
@@ -442,6 +457,8 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error @@ -442,6 +457,8 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error
442 "companyId": resultUser.Company.CompanyId, 457 "companyId": resultUser.Company.CompanyId,
443 "companyName": resultUser.Company.CompanyName, 458 "companyName": resultUser.Company.CompanyName,
444 "logo": resultUser.Company.Log, 459 "logo": resultUser.Company.Log,
  460 + "systemName": resultUser.Company.SystemName,
  461 + "address": resultUser.Company.Address,
445 }, 462 },
446 "im": resultUser.IM, 463 "im": resultUser.IM,
447 "org": map[string]interface{}{ 464 "org": map[string]interface{}{
@@ -450,7 +467,8 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error @@ -450,7 +467,8 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error
450 "orgCode": resultOrg.OrgCode, 467 "orgCode": resultOrg.OrgCode,
451 "companyId": resultOrg.CompanyID, 468 "companyId": resultOrg.CompanyID,
452 }, 469 },
453 - //"currentLoginOrg":resultUser.Org, 470 + "currentLoginOrg": resultUser.Org,
  471 + "favoriteMenus": resultUser.FavoriteMenus,
454 } 472 }
455 return user, nil 473 return user, nil
456 } 474 }
@@ -493,6 +511,11 @@ loopUser1: @@ -493,6 +511,11 @@ loopUser1:
493 loginToken.UserId = int64(currentUser.UserId) 511 loginToken.UserId = int64(currentUser.UserId)
494 loginToken.UserBaseId = int64(currentUser.UserBaseId) 512 loginToken.UserBaseId = int64(currentUser.UserBaseId)
495 loginToken.CompanyId = int64(currentUser.Company.CompanyId) 513 loginToken.CompanyId = int64(currentUser.Company.CompanyId)
  514 + var orgIds []int64
  515 + for i := range currentUser.UserOrg {
  516 + orgIds = append(orgIds, int64(currentUser.UserOrg[i].OrgID))
  517 + }
  518 + loginToken.OrgIds = orgIds
496 519
497 // 2. 更新currentAccess信息 520 // 2. 更新currentAccess信息
498 transactionContext, err := factory.CreateTransactionContext(nil) 521 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -528,6 +551,7 @@ loopUser1: @@ -528,6 +551,7 @@ loopUser1:
528 currentAccess.Platform = loginToken.Platform 551 currentAccess.Platform = loginToken.Platform
529 currentAccess.CompanyId = int64(loginToken.CompanyId) 552 currentAccess.CompanyId = int64(loginToken.CompanyId)
530 currentAccess.OrganizationId = loginToken.OrgId 553 currentAccess.OrganizationId = loginToken.OrgId
  554 + currentAccess.OrgIds = loginToken.OrgIds
531 currentAccess.UpdatedTime = time.Now() 555 currentAccess.UpdatedTime = time.Now()
532 556
533 accessTokenStr, err := loginToken.GenerateAccessToken() 557 accessTokenStr, err := loginToken.GenerateAccessToken()
@@ -11,9 +11,9 @@ type AuditAllCooperationApplicationCommand struct { @@ -11,9 +11,9 @@ type AuditAllCooperationApplicationCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 审核动作,1同意,2拒绝 13 // 审核动作,1同意,2拒绝
14 - CooperationApplicationStatus int `json:"cooperationApplicationStatus" valid:"Required"` 14 + CooperationApplicationStatus int `json:"action" valid:"Required"`
15 // 共创申请审核描述 15 // 共创申请审核描述
16 - CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription" valid:"Required"` 16 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationDescription" valid:"Required"`
17 } 17 }
18 18
19 func (listCooperationApplicationQuery *AuditAllCooperationApplicationCommand) Valid(validation *validation.Validation) { 19 func (listCooperationApplicationQuery *AuditAllCooperationApplicationCommand) Valid(validation *validation.Validation) {
@@ -10,6 +10,12 @@ import ( @@ -10,6 +10,12 @@ import (
10 type CooperationDividendsStatisticsCommand struct { 10 type CooperationDividendsStatisticsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageIndex" valid:"Required"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + //审核状态 1:正序 2:倒序
  18 + SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount"`
13 } 19 }
14 20
15 func (cmd *CooperationDividendsStatisticsCommand) Valid(validation *validation.Validation) { 21 func (cmd *CooperationDividendsStatisticsCommand) Valid(validation *validation.Validation) {
@@ -10,6 +10,12 @@ import ( @@ -10,6 +10,12 @@ import (
10 type GoodsStatisticsCommand struct { 10 type GoodsStatisticsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageIndex"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + // 排行榜类型,1月榜,2年榜 3总榜,默认展示年榜
  18 + RankingType int `json:"rankingType"`
13 } 19 }
14 20
15 func (cmd *GoodsStatisticsCommand) Valid(validation *validation.Validation) { 21 func (cmd *GoodsStatisticsCommand) Valid(validation *validation.Validation) {
  1 +package dto
  2 +
  3 +type IndexStatistics struct {
  4 + ProjectOverviewStatistics struct {
  5 + ContractSum int `json:"contractSum"`
  6 + CooperationUserCount int `json:"cooperationUserCount"`
  7 + ProjectSum int `json:"projectSum"`
  8 + } `json:"projectOverviewStatistics"`
  9 + Org struct {
  10 + OrgName string `json:"orgName"`
  11 + OrgID float64 `json:"orgId"`
  12 + } `json:"org"`
  13 + CurrentMonthDividendsStatistics struct {
  14 + CreditAccount float64 `json:"creditAccount"`
  15 + DividendsEstimate float64 `json:"dividendsEstimate"`
  16 + OrderAmount float64 `json:"orderAmount"`
  17 + } `json:"currentMonthDividendsStatistics"`
  18 + CooperationModeStatistics []struct {
  19 + CooperationPeople float64 `json:"cooperationPeople"`
  20 + DividendsEstimate float64 `json:"dividendsEstimate"`
  21 + OrderAmount float64 `json:"orderAmount"`
  22 + CooperationMode struct {
  23 + CooperationModeID int `json:"cooperationModeId"`
  24 + CooperationModeName string `json:"cooperationModeName"`
  25 + CooperationModeNumber string `json:"cooperationModeNumber"`
  26 + } `json:"cooperationMode"`
  27 + } `json:"cooperationModeStatistics"`
  28 + CooperationModes []struct {
  29 + CooperationModeID int `json:"cooperationModeId"`
  30 + CooperationModeName string `json:"cooperationModeName"`
  31 + CooperationModeNumber string `json:"cooperationModeNumber"`
  32 + } `json:"cooperationModes"`
  33 + CooperationGoodsStatistics []struct {
  34 + GoodAmount float64 `json:"goodAmount"`
  35 + GoodName string `json:"goodName"`
  36 + GoodRatio float64 `json:"goodRatio"`
  37 + Rank int `json:"rank"`
  38 + } `json:"cooperationGoodsStatistics"`
  39 +}
@@ -4,10 +4,10 @@ type DividendsEstimatesDto struct { @@ -4,10 +4,10 @@ type DividendsEstimatesDto struct {
4 CooperationProjectNumber string `json:"cooperationProjectNumber"` 4 CooperationProjectNumber string `json:"cooperationProjectNumber"`
5 DividendsAccountStatus int `json:"dividendsAccountStatus"` 5 DividendsAccountStatus int `json:"dividendsAccountStatus"`
6 DividendsAmount float64 `json:"dividendsAmount"` 6 DividendsAmount float64 `json:"dividendsAmount"`
7 - DividendsOrderAmount string `json:"dividendsOrderAmount"` 7 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
8 DividendsEstimateID int `json:"dividendsEstimateId"` 8 DividendsEstimateID int `json:"dividendsEstimateId"`
9 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 9 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
10 - DividendsEstimateTime string `json:"dividendsEstimateTime"` 10 + DividendsEstimateTime int64 `json:"dividendsEstimateTime"`
11 DividendsParticipateType int `json:"dividendsParticipateType"` 11 DividendsParticipateType int `json:"dividendsParticipateType"`
12 DividendsType int `json:"dividendsType"` 12 DividendsType int `json:"dividendsType"`
13 DividendsUser struct { 13 DividendsUser struct {
@@ -22,6 +22,10 @@ type DividendsEstimatesDto struct { @@ -22,6 +22,10 @@ type DividendsEstimatesDto struct {
22 UserType int `json:"userType"` 22 UserType int `json:"userType"`
23 } `json:"dividendsUser"` 23 } `json:"dividendsUser"`
24 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` 24 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
  25 + // 客户姓名
  26 + CustomerName string `json:"customerName"`
  27 + // 订单产品名称
  28 + OrderGoodName string `json:"orderGoodName"`
25 } 29 }
26 30
27 func (d *DividendsEstimatesDto) LoadDto() { 31 func (d *DividendsEstimatesDto) LoadDto() {
@@ -64,7 +64,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *comman @@ -64,7 +64,7 @@ func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *comman
64 }, nil 64 }, nil
65 } 65 }
66 66
67 -// SearchDividendsEstimates 企业的合约明细列表(分红预算信息) 67 +// SearchDividendsEstimates TODO:企业的合约明细列表(分红预算信息)
68 func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) { 68 func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
69 var items []*dto.DividendsEstimatesDto 69 var items []*dto.DividendsEstimatesDto
70 for i := 0; i < 2; i++ { 70 for i := 0; i < 2; i++ {
@@ -58,7 +58,7 @@ func (srv PersonDividendsService) DividendsStatistics(userMenusCommand *command. @@ -58,7 +58,7 @@ func (srv PersonDividendsService) DividendsStatistics(userMenusCommand *command.
58 }, nil 58 }, nil
59 } 59 }
60 60
61 -// SearchDividendsEstimates 企业的合约明细列表(分红预算信息) 61 +// SearchDividendsEstimates TODO:企业的合约明细列表(分红预算信息)
62 func (srv PersonDividendsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) { 62 func (srv PersonDividendsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
63 var items []*dto.DividendsEstimatesDto 63 var items []*dto.DividendsEstimatesDto
64 for i := 0; i < 2; i++ { 64 for i := 0; i < 2; i++ {
@@ -173,6 +173,7 @@ func (srv CooperationApplicationsService) CooperationApplicationsOneclickApprova @@ -173,6 +173,7 @@ func (srv CooperationApplicationsService) CooperationApplicationsOneclickApprova
173 allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{ 173 allied_creation_cooperation.ReqCooperationApplicationOneclickApproval{
174 CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription, 174 CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription,
175 Action: auditCommand.CooperationApplicationStatus, 175 Action: auditCommand.CooperationApplicationStatus,
  176 + Code: "a1-2",
176 }) 177 })
177 if err != nil { 178 if err != nil {
178 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 179 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "fmt"
  5 + "github.com/linmadan/egglib-go/core/application"
4 "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/command"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  9 + "math/rand"
  10 + "time"
5 ) 11 )
6 12
7 // 企业端统计 【0%】 13 // 企业端统计 【0%】
@@ -9,16 +15,44 @@ type CompanyStatisticsService struct { @@ -9,16 +15,44 @@ type CompanyStatisticsService struct {
9 } 15 }
10 16
11 // IndexStatistics TODO:首页统计 (入口页面统计数据) 17 // IndexStatistics TODO:首页统计 (入口页面统计数据)
12 -func (srv CompanyStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (interface{}, error) {  
13 - //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
14 - // userMenusCommand.Operator)  
15 - //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{  
16 - // UserId: int(userMenusCommand.Operator.UserId),  
17 - //})  
18 - //if err != nil {  
19 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
20 - //}  
21 - return map[string]interface{}{}, nil 18 +func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatisticsCommand) (interface{}, error) {
  19 + value := dto.IndexStatistics{}
  20 + value.ProjectOverviewStatistics.ContractSum = 20
  21 + value.ProjectOverviewStatistics.CooperationUserCount = 5
  22 + value.ProjectOverviewStatistics.ProjectSum = 5
  23 +
  24 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  25 + cmd.Operator)
  26 + companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{
  27 + "companyId": cmd.Operator.CompanyId,
  28 + "orgId": cmd.Operator.OrgId,
  29 + "action": 1, //当前月
  30 + })
  31 + if err != nil {
  32 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  33 + }
  34 + cooperationModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationModeStatistics, map[string]interface{}{
  35 + "companyId": cmd.Operator.CompanyId,
  36 + "orgId": cmd.Operator.OrgId,
  37 + })
  38 + if err != nil {
  39 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  40 + }
  41 + cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
  42 + "companyId": cmd.Operator.CompanyId,
  43 + "orgId": cmd.Operator.OrgId,
  44 + "rankType": 1, //月榜
  45 + "top": 5,
  46 + })
  47 + if err != nil {
  48 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  49 + }
  50 +
  51 + return map[string]interface{}{
  52 + "currentMonthDividendsStatistics": companyDividendsStatistics,
  53 + "cooperationModeStatistics": cooperationModeStatistics,
  54 + "CooperationGoodsStatistics": cooperationGoodsStatistics,
  55 + }, nil
22 } 56 }
23 57
24 // CooperationPersonStatistics TODO:共创人员统计(共创人员明细) 58 // CooperationPersonStatistics TODO:共创人员统计(共创人员明细)
@@ -27,11 +61,58 @@ func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand @@ -27,11 +61,58 @@ func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand
27 } 61 }
28 62
29 // GoodsStatistics TODO:产品统计排行榜 年月榜 63 // GoodsStatistics TODO:产品统计排行榜 年月榜
30 -func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (interface{}, error) {  
31 - return map[string]interface{}{}, nil 64 +func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (int64, interface{}, error) {
  65 + type rankItem struct {
  66 + GoodAmount float64 `json:"goodAmount"`
  67 + GoodName string `json:"goodName"`
  68 + GoodRatio float64 `json:"goodRatio"`
  69 + Rank int `json:"rank"`
  70 + }
  71 + var items []rankItem
  72 + for i := 0; i < 5; i++ {
  73 + item := rankItem{
  74 + GoodAmount: 2000,
  75 + GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),
  76 + GoodRatio: 20,
  77 + Rank: i + 1,
  78 + }
  79 + items = append(items, item)
  80 + }
  81 + return 5, items, nil
32 } 82 }
33 83
34 // CooperationDividendsStatistics TODO:公司共创人员列表(分红支出统计) 84 // CooperationDividendsStatistics TODO:公司共创人员列表(分红支出统计)
35 -func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (interface{}, error) {  
36 - return map[string]interface{}{}, nil 85 +func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (int64, interface{}, error) {
  86 + type cooperationDividendItem struct {
  87 + CooperationTime int64 `json:"cooperationTime"`
  88 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
  89 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`
  90 + UnPaidAmount float64 `json:"unPaidAmount"`
  91 + Participator struct {
  92 + UserType int `json:"userType"`
  93 + UserInfo struct {
  94 + // 用户姓名
  95 + UserName string `json:"userName,omitempty"`
  96 + // 手机号码
  97 + UserPhone string `json:"userPhone,omitempty"`
  98 + // 头像
  99 + //Avatar string `json:"avatar,omitempty"`
  100 + // 邮箱
  101 + //Email string `json:"email,omitempty"`
  102 + } `json:"userInfo"`
  103 + } `json:"participator"` // 参与人
  104 + }
  105 +
  106 + var results []cooperationDividendItem
  107 + for i := 0; i < 5; i++ {
  108 + item := cooperationDividendItem{
  109 + CooperationTime: time.Now().Unix() * 1000,
  110 + DividendsOrderAmount: 6000,
  111 + ActuallyPaidAmount: 5000,
  112 + UnPaidAmount: 1000,
  113 + }
  114 + item.Participator.UserInfo.UserName = fmt.Sprintf("用户%v", rand.Intn(100))
  115 + results = append(results, item)
  116 + }
  117 + return 5, results, nil
37 } 118 }
@@ -171,10 +171,31 @@ func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interf @@ -171,10 +171,31 @@ func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interf
171 for i := 0; i < 5; i++ { 171 for i := 0; i < 5; i++ {
172 results = append(results, dto.NewMessageDto()) 172 results = append(results, dto.NewMessageDto())
173 } 173 }
  174 +
  175 + //gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
  176 + // cmd.Operator)
  177 + //_,err:= gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{
  178 + // PageIndex: cmd.PageNumber,
  179 + // PageSize: cmd.PageSize,
  180 + // UserId: cmd.Operator.UserId,
  181 + //})
  182 + //if err!=nil{
  183 + // return 0,nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  184 + //}
174 return 2, results, nil 185 return 2, results, nil
175 } 186 }
176 187
177 //MessagesList 消息列表 188 //MessagesList 消息列表
178 func (srv UserService) MessagesMarkRead(cmd *command.MessageMarkReadCommand) (interface{}, error) { 189 func (srv UserService) MessagesMarkRead(cmd *command.MessageMarkReadCommand) (interface{}, error) {
  190 + //gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
  191 + // cmd.Operator)
  192 + //_,err:= gateway.ReadNotice(allied_creation_basic.ReqReadNotice{
  193 + // MsgId: cmd.MsgId,
  194 + // ReadAll: cmd.ReadAll,
  195 + // UserId: cmd.Operator.UserId,
  196 + //})
  197 + //if err!=nil{
  198 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  199 + //}
179 return struct{}{}, nil 200 return struct{}{}, nil
180 } 201 }
@@ -187,6 +187,9 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -187,6 +187,9 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
187 // "cooperationProjectName": item.CooperationProjectName, 187 // "cooperationProjectName": item.CooperationProjectName,
188 // }) 188 // })
189 //} 189 //}
  190 + for i := range result.List {
  191 + result.List[i].CooperationProjectUndertakerType = result.List[i].CooperationProjectUndertakerTypes
  192 + }
190 return int64(result.Total), result.List, nil 193 return int64(result.Total), result.List, nil
191 } 194 }
192 195
@@ -13,7 +13,7 @@ type RoleMenuEditCommand struct { @@ -13,7 +13,7 @@ type RoleMenuEditCommand struct {
13 // 角色ID 13 // 角色ID
14 RoleId string `json:"roleId" valid:"Required"` 14 RoleId string `json:"roleId" valid:"Required"`
15 // 关联菜单的id 15 // 关联菜单的id
16 - MenuId []string `json:"menuId"` 16 + MenuId []string `json:"accessMenus"`
17 } 17 }
18 18
19 func (roleMenuEditQuery *RoleMenuEditCommand) Valid(validation *validation.Validation) { 19 func (roleMenuEditQuery *RoleMenuEditCommand) Valid(validation *validation.Validation) {
@@ -91,6 +91,7 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) ( @@ -91,6 +91,7 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
91 Limit: roleListQuery.PageSize, 91 Limit: roleListQuery.PageSize,
92 OrgName: roleListQuery.OrgName, 92 OrgName: roleListQuery.OrgName,
93 RoleName: roleListQuery.RoleName, 93 RoleName: roleListQuery.RoleName,
  94 + InOrgIds: roleListQuery.Operator.OrgIds,
94 }) 95 })
95 if err != nil { 96 if err != nil {
96 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 97 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -186,6 +186,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -186,6 +186,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
186 DepName: companyUserListQuery.DepartmentName, 186 DepName: companyUserListQuery.DepartmentName,
187 Phone: "", 187 Phone: "",
188 UserType: domain.UserTypeEmployee, 188 UserType: domain.UserTypeEmployee,
  189 + InOrgIds: companyUserListQuery.Operator.OrgIds,
189 }) 190 })
190 191
191 if err != nil { 192 if err != nil {
@@ -370,6 +371,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -370,6 +371,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
370 DepName: "", 371 DepName: "",
371 Phone: "", 372 Phone: "",
372 UserType: domain.UserTypeCooperation, 373 UserType: domain.UserTypeCooperation,
  374 + InOrgIds: cooperationUserListQuery.Operator.OrgIds,
373 }) 375 })
374 var ( 376 var (
375 listData []dto.CooperationUserItem 377 listData []dto.CooperationUserItem
@@ -40,9 +40,10 @@ var codeMsg = map[int]string{ @@ -40,9 +40,10 @@ var codeMsg = map[int]string{
40 40
41 // 登录凭证存储 41 // 登录凭证存储
42 type LoginAccess struct { 42 type LoginAccess struct {
43 - LoginAccessId int64 `json:"loginAccessId"`  
44 - UserBaseId int64 `json:"userBaseId"`  
45 - UserId int64 `json:"userId"` 43 + LoginAccessId int64 `json:"loginAccessId"`
  44 + UserBaseId int64 `json:"userBaseId"`
  45 + UserId int64 `json:"userId"`
  46 + OrgIds []int64 `json:"orgIds"`
46 // 账号 47 // 账号
47 Account string `json:"account"` 48 Account string `json:"account"`
48 // 对应平台 49 // 对应平台
@@ -26,7 +26,7 @@ type LoginToken struct { @@ -26,7 +26,7 @@ type LoginToken struct {
26 // 组织id 26 // 组织id
27 OrgId int64 `json:"orgId"` 27 OrgId int64 `json:"orgId"`
28 // 用户关联的组织列表 28 // 用户关联的组织列表
29 - Orgs []int64 `json:"orgs"` 29 + OrgIds []int64 `json:"orgIds"`
30 // 会话模式 1: 短时效模式 2: 长时效模式(默认) 30 // 会话模式 1: 短时效模式 2: 长时效模式(默认)
31 SessionMode int `json:"sessionMode"` 31 SessionMode int `json:"sessionMode"`
32 } 32 }
@@ -2,10 +2,11 @@ package domain @@ -2,10 +2,11 @@ package domain
2 2
3 // 登录系统的操作人员 可以从toke中获取数据 3 // 登录系统的操作人员 可以从toke中获取数据
4 type Operator struct { 4 type Operator struct {
5 - UserId int64 `json:"userId"`  
6 - CompanyId int64 `json:"companyId"`  
7 - OrgId int64 `json:"orgId"`  
8 - UserBaseId int64 `json:"userBaseId"`  
9 - Phone string `json:"phone"`  
10 - Token string `json:"token"` 5 + UserId int64 `json:"userId"`
  6 + CompanyId int64 `json:"companyId"`
  7 + OrgId int64 `json:"orgId"`
  8 + UserBaseId int64 `json:"userBaseId"`
  9 + Phone string `json:"phone"`
  10 + Token string `json:"token"`
  11 + OrgIds []int64 `json:"orgIds"` //当前用户关联的组织ID列表
11 } 12 }
  1 +package allied_creation_basic
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 +
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  9 +)
  10 +
  11 +// NoticeSettingUpdate 获取消息列表
  12 +func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal) (*DataNoticePersonal, error) {
  13 + url := gateway.baseUrL + "/notice-personal"
  14 + method := "Post"
  15 + req := gateway.CreateRequest(url, method)
  16 + log.Logger.Debug("向基础模块请求数据:获取消息列表。", map[string]interface{}{
  17 + "api": method + ":" + url,
  18 + "param": param,
  19 + })
  20 + req, err := req.JSONBody(param)
  21 + if err != nil {
  22 + return nil, fmt.Errorf("请求获取消息列表失败:%w", err)
  23 + }
  24 +
  25 + byteResult, err := req.Bytes()
  26 + if err != nil {
  27 + return nil, fmt.Errorf("获取获取消息列表失败:%w", err)
  28 + }
  29 + log.Logger.Debug("获取基础模块请求数据:获取消息列表。", map[string]interface{}{
  30 + "result": string(byteResult),
  31 + })
  32 + var result service_gateway.GatewayResponse
  33 + err = json.Unmarshal(byteResult, &result)
  34 + if err != nil {
  35 + return nil, fmt.Errorf("解析获取消息列表:%w", err)
  36 + }
  37 + var data DataNoticePersonal
  38 + err = gateway.GetResponseData(result, &data)
  39 + return &data, err
  40 +}
  41 +
  42 +// NoticeSettingAdd 消息标记已读
  43 +func (gateway HttplibAlliedCreationBasic) ReadNotice(param ReqReadNotice) (*DataReadNotice, error) {
  44 + url := gateway.baseUrL + "/notice-personal/read"
  45 + method := "POST"
  46 + req := gateway.CreateRequest(url, method)
  47 + log.Logger.Debug("向基础模块请求数据:消息标记已读。", map[string]interface{}{
  48 + "api": method + ":" + url,
  49 + "param": param,
  50 + })
  51 + req, err := req.JSONBody(param)
  52 + if err != nil {
  53 + return nil, fmt.Errorf("请求消息标记已读失败:%w", err)
  54 + }
  55 +
  56 + byteResult, err := req.Bytes()
  57 + if err != nil {
  58 + return nil, fmt.Errorf("获取消息标记已读失败:%w", err)
  59 + }
  60 + log.Logger.Debug("获取基础模块请求数据:消息标记已读。", map[string]interface{}{
  61 + "result": string(byteResult),
  62 + })
  63 + var result service_gateway.GatewayResponse
  64 + err = json.Unmarshal(byteResult, &result)
  65 + if err != nil {
  66 + return nil, fmt.Errorf("解析消息标记已读:%w", err)
  67 + }
  68 + var data DataReadNotice
  69 + err = gateway.GetResponseData(result, &data)
  70 + return &data, err
  71 +}
  1 +package allied_creation_basic
  2 +
  3 +//返回编排消息通知内容列表
  4 +type (
  5 + ReqNoticePersonal struct {
  6 + IsRead int `json:"isRead"`
  7 + PageIndex int `json:"pageIndex"`
  8 + PageSize int `json:"pageSize"`
  9 + UserId int64 `json:"userId"`
  10 + }
  11 +
  12 + DataNoticePersonal struct {
  13 + NoticePersonal []struct {
  14 + CompanyID int `json:"companyId"`
  15 + Content string `json:"content"`
  16 + CreatedAt string `json:"createdAt"`
  17 + DeletedAt string `json:"deletedAt"`
  18 + Extend string `json:"extend"`
  19 + IsRead string `json:"isRead"`
  20 + Module string `json:"module"`
  21 + ModuleAction string `json:"moduleAction"`
  22 + NoticePersonalID int `json:"noticePersonalId"`
  23 + OrganizationID int `json:"organizationId"`
  24 + SysCode string `json:"sysCode"`
  25 + UpdatedAt string `json:"updatedAt"`
  26 + UserID int `json:"userId"`
  27 + } `json:"noticePersonal"`
  28 + Count float64 `json:"count"`
  29 + }
  30 +)
  31 +
  32 +//返回编排消息通知内容列表
  33 +type (
  34 + ReqReadNotice struct {
  35 + IsRead int `json:"isRead"`
  36 + MsgId int `json:"msgId"`
  37 + ReadAll int `json:"readAll"`
  38 + UserId int64 `json:"userId"`
  39 + }
  40 +
  41 + DataReadNotice struct {
  42 + }
  43 +)
@@ -74,7 +74,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsBatchAppr @@ -74,7 +74,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsBatchAppr
74 74
75 // CooperationApplicationsBatchApproval 共创申请审核 75 // CooperationApplicationsBatchApproval 共创申请审核
76 func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsApproval(param ReqCooperationApplicationApproval) (*DataCooperationApplicationApproval, error) { 76 func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsApproval(param ReqCooperationApplicationApproval) (*DataCooperationApplicationApproval, error) {
77 - url := gateway.baseUrL + "/cooperation-applications/agree-cooperation-application" 77 + url := gateway.baseUrL + "/cooperation-applications/approval-cooperation-application"
78 method := "POST" 78 method := "POST"
79 req := gateway.CreateRequest(url, method) 79 req := gateway.CreateRequest(url, method)
80 log.Logger.Debug("向业务模块请求数据:共创申请批量审核。", map[string]interface{}{ 80 log.Logger.Debug("向业务模块请求数据:共创申请批量审核。", map[string]interface{}{
@@ -13,6 +13,13 @@ const ( @@ -13,6 +13,13 @@ const (
13 SearchContractDividends = "SearchContractDividends" 13 SearchContractDividends = "SearchContractDividends"
14 // 获取分红合约详情 14 // 获取分红合约详情
15 GetContractDividends = "GetContractDividends" 15 GetContractDividends = "GetContractDividends"
  16 +
  17 + // 企业-商品统计
  18 + CooperationGoodsStatistics = "cooperationGoodsStatistics"
  19 + // 企业-共创模式统计
  20 + CooperationModeStatistics = "CooperationModeStatistics"
  21 + // 企业-分红统计
  22 + CompanyDividendsStatistics = "CompanyDividendsStatistics"
16 ) 23 )
17 24
18 // CooperationStatistics 共创统计 25 // CooperationStatistics 共创统计
@@ -216,6 +216,7 @@ type ( @@ -216,6 +216,7 @@ type (
216 ReqCooperationApplicationOneclickApproval struct { 216 ReqCooperationApplicationOneclickApproval struct {
217 CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //审核描述 217 CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //审核描述
218 Action int `json:"action"` //审核动作,1同意,2拒绝 218 Action int `json:"action"` //审核动作,1同意,2拒绝
  219 + Code string `cname:"菜单编码" json:"code" valid:"Required"`
219 } 220 }
220 221
221 DataCooperationApplicationOneclickApproval struct { 222 DataCooperationApplicationOneclickApproval struct {
@@ -220,6 +220,7 @@ type ( @@ -220,6 +220,7 @@ type (
220 //IsOrganization bool `json:"isOrganization"` 220 //IsOrganization bool `json:"isOrganization"`
221 } `json:"department"` 221 } `json:"department"`
222 CooperationProjectUndertakerTypes []int `json:"cooperationProjectUndertakerTypes"` 222 CooperationProjectUndertakerTypes []int `json:"cooperationProjectUndertakerTypes"`
  223 + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"`
223 Org struct { 224 Org struct {
224 OrgID string `json:"orgId"` 225 OrgID string `json:"orgId"`
225 OrgName string `json:"orgName"` 226 OrgName string `json:"orgName"`
@@ -63,6 +63,8 @@ type UserDetail struct { @@ -63,6 +63,8 @@ type UserDetail struct {
63 ImToken string `json:"imToken"` 63 ImToken string `json:"imToken"`
64 CsAccountID string `json:"csAccountId"` 64 CsAccountID string `json:"csAccountId"`
65 } `json:"im"` 65 } `json:"im"`
  66 + // 收藏的菜单(工作台)(菜单编码列表)
  67 + FavoriteMenus []string `json:"favoriteMenus"`
66 } 68 }
67 69
68 //搜索用户列表 70 //搜索用户列表
@@ -85,6 +85,19 @@ func (controller *AuthController) GetUserInfo() { @@ -85,6 +85,19 @@ func (controller *AuthController) GetUserInfo() {
85 controller.Response(data, err) 85 controller.Response(data, err)
86 } 86 }
87 87
  88 +func (controller *AuthController) GetUserInfoExtra() {
  89 + authService := service.AuthService{}
  90 + userInfoCommand := &command.UserInfoCommand{}
  91 + err := controller.Unmarshal(userInfoCommand)
  92 + if err != nil {
  93 + controller.Response(nil, err)
  94 + return
  95 + }
  96 + userInfoCommand.Operator = controller.GetOperator()
  97 + data, err := authService.GetUserInfoExtra(userInfoCommand)
  98 + controller.Response(data, err)
  99 +}
  100 +
88 func (controller *AuthController) GetUserMenus() { 101 func (controller *AuthController) GetUserMenus() {
89 authService := service.AuthService{} 102 authService := service.AuthService{}
90 userMenusCommand := &command.UserMenusCommand{} 103 userMenusCommand := &command.UserMenusCommand{}
@@ -90,6 +90,7 @@ func (controller *BaseController) GetOperator() domain.Operator { @@ -90,6 +90,7 @@ func (controller *BaseController) GetOperator() domain.Operator {
90 UserBaseId: loginToken.UserBaseId, 90 UserBaseId: loginToken.UserBaseId,
91 Phone: loginToken.Account, 91 Phone: loginToken.Account,
92 Token: token, 92 Token: token,
  93 + OrgIds: loginToken.OrgIds,
93 } 94 }
94 // TODO:测试数据后期删除 95 // TODO:测试数据后期删除
95 if op.UserId == 0 { 96 if op.UserId == 0 {
@@ -99,7 +100,7 @@ func (controller *BaseController) GetOperator() domain.Operator { @@ -99,7 +100,7 @@ func (controller *BaseController) GetOperator() domain.Operator {
99 op.UserBaseId = 1 100 op.UserBaseId = 1
100 } 101 }
101 // TODO:打印测试日志 102 // TODO:打印测试日志
102 - //log.Logger.Debug("operator " + json.MarshalToString(op)) 103 + log.Logger.Debug("operator " + json.MarshalToString(op))
103 return op 104 return op
104 } 105 }
105 106
@@ -495,8 +495,8 @@ func (controller *CooperationController) GoodsStatistics() { @@ -495,8 +495,8 @@ func (controller *CooperationController) GoodsStatistics() {
495 return 495 return
496 } 496 }
497 cmd.Operator = controller.GetOperator() 497 cmd.Operator = controller.GetOperator()
498 - data, err := svr.GoodsStatistics(cmd)  
499 - controller.Response(data, err) 498 + total, data, err := svr.GoodsStatistics(cmd)
  499 + controller.ReturnPageListData(total, data, err, 0)
500 } 500 }
501 501
502 func (controller *CooperationController) CooperationDividendsStatistics() { 502 func (controller *CooperationController) CooperationDividendsStatistics() {
@@ -508,8 +508,8 @@ func (controller *CooperationController) CooperationDividendsStatistics() { @@ -508,8 +508,8 @@ func (controller *CooperationController) CooperationDividendsStatistics() {
508 return 508 return
509 } 509 }
510 cmd.Operator = controller.GetOperator() 510 cmd.Operator = controller.GetOperator()
511 - data, err := svr.CooperationDividendsStatistics(cmd)  
512 - controller.Response(data, err) 511 + total, data, err := svr.CooperationDividendsStatistics(cmd)
  512 + controller.ReturnPageListData(total, data, err, 0)
513 } 513 }
514 514
515 /***** PersonStatistics 用户端统计 *****/ 515 /***** PersonStatistics 用户端统计 *****/
@@ -12,7 +12,7 @@ func init() { @@ -12,7 +12,7 @@ func init() {
12 12
13 /***** 共创申请服务 企业端 *****/ 13 /***** 共创申请服务 企业端 *****/
14 web.Router("/v1/app/cooperation-applications/:applicationId", &mobile_client.CooperationController{}, "Get:GetCooperationApplication") 14 web.Router("/v1/app/cooperation-applications/:applicationId", &mobile_client.CooperationController{}, "Get:GetCooperationApplication")
15 - web.Router("/v1/app/cooperation-applications/audit", &mobile_client.CooperationController{}, "Put:AuditCooperationApplication") 15 + web.Router("/v1/app/cooperation-applications/audit", &mobile_client.CooperationController{}, "Post:AuditCooperationApplication")
16 web.Router("/v1/app/cooperation-applications/oneclick-approval", &mobile_client.CooperationController{}, "Post:AuditAllCooperationApplication") 16 web.Router("/v1/app/cooperation-applications/oneclick-approval", &mobile_client.CooperationController{}, "Post:AuditAllCooperationApplication")
17 web.Router("/v1/app/cooperation-applications/search", &mobile_client.CooperationController{}, "Post:SearchCooperationApplication") 17 web.Router("/v1/app/cooperation-applications/search", &mobile_client.CooperationController{}, "Post:SearchCooperationApplication")
18 18
@@ -11,6 +11,7 @@ func init() { @@ -11,6 +11,7 @@ func init() {
11 11
12 web.Router("/v1/user/company-orgs", &controllers.AuthController{}, "Post:GetCompanyOrgsByUser") 12 web.Router("/v1/user/company-orgs", &controllers.AuthController{}, "Post:GetCompanyOrgsByUser")
13 web.Router("/v1/user/user-info", &controllers.AuthController{}, "Post:GetUserInfo") 13 web.Router("/v1/user/user-info", &controllers.AuthController{}, "Post:GetUserInfo")
  14 + web.Router("/v1/user/user-info-extra", &controllers.AuthController{}, "Post:GetUserInfoExtra")
14 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus") 15 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus")
15 web.Router("/v1/user/user-orgs", &controllers.AuthController{}, "Post:GetUserOrg") 16 web.Router("/v1/user/user-orgs", &controllers.AuthController{}, "Post:GetUserOrg")
16 17