正在显示
8 个修改的文件
包含
90 行增加
和
69 行删除
@@ -62,11 +62,6 @@ func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.C | @@ -62,11 +62,6 @@ func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.C | ||
62 | }, nil | 62 | }, nil |
63 | } | 63 | } |
64 | 64 | ||
65 | -// CompanyDividendStatistics (废弃)共创用户-共创企业分红统计 | ||
66 | -func (srv PersonStatisticsService) CompanyDividendStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
67 | - return map[string]interface{}{}, nil | ||
68 | -} | ||
69 | - | ||
70 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) | 65 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) |
71 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { | 66 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { |
72 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 67 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
@@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
10 | type MessageMarkReadCommand struct { | 10 | type MessageMarkReadCommand struct { |
11 | Operator domain.Operator `json:"-"` | 11 | Operator domain.Operator `json:"-"` |
12 | MsgId int `json:"msgId"` | 12 | MsgId int `json:"msgId"` |
13 | - ReadAll int `json:"readAll"` | 13 | + ReadAll bool `json:"readAll"` |
14 | } | 14 | } |
15 | 15 | ||
16 | func (cmd *MessageMarkReadCommand) Valid(validation *validation.Validation) { | 16 | func (cmd *MessageMarkReadCommand) Valid(validation *validation.Validation) { |
@@ -24,3 +24,18 @@ func NewMessageDto() *MessageDto { | @@ -24,3 +24,18 @@ func NewMessageDto() *MessageDto { | ||
24 | Read: 1, | 24 | Read: 1, |
25 | } | 25 | } |
26 | } | 26 | } |
27 | + | ||
28 | +func (m *MessageDto) LoadMsgType(module string, action string) int { | ||
29 | + switch module { | ||
30 | + case "module01": | ||
31 | + switch action { | ||
32 | + case "action01_01", "action01_02": | ||
33 | + return 1001 //跳转共创申请列表页面 | ||
34 | + case "action01_03": | ||
35 | + return 1002 //跳转共创企业列表页面 | ||
36 | + case "action01_04", "action01_05", "action01_06": | ||
37 | + return 1003 | ||
38 | + } | ||
39 | + } | ||
40 | + return 1 // 系统注册消息 | ||
41 | +} |
@@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/query" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/query" |
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache" |
11 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic" | ||
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" |
12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve" | 13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve" |
13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | 14 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" |
@@ -167,36 +168,44 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments | @@ -167,36 +168,44 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments | ||
167 | 168 | ||
168 | //MessagesList 消息列表 | 169 | //MessagesList 消息列表 |
169 | func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interface{}, error) { | 170 | func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interface{}, error) { |
171 | + gateway := allied_creation_basic.NewHttplibAlliedCreationBasic( | ||
172 | + cmd.Operator) | ||
173 | + messages, err := gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{ | ||
174 | + PageIndex: cmd.PageNumber, | ||
175 | + PageSize: cmd.PageSize, | ||
176 | + UserBaseId: cmd.Operator.UserBaseId, | ||
177 | + }) | ||
178 | + if err != nil { | ||
179 | + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
180 | + } | ||
170 | var results []*dto.MessageDto | 181 | var results []*dto.MessageDto |
171 | - for i := 0; i < 5; i++ { | ||
172 | - results = append(results, dto.NewMessageDto()) | 182 | + for i := 0; i < len(messages.List); i++ { |
183 | + mItem := messages.List[i] | ||
184 | + message := &dto.MessageDto{ | ||
185 | + MsgId: mItem.NoticePersonalID, | ||
186 | + MsgContent: mItem.Content, | ||
187 | + MsgTime: mItem.CreatedAt.Unix() * 1000, | ||
188 | + Read: mItem.IsRead, | ||
189 | + } | ||
190 | + message.MsgType = message.LoadMsgType(mItem.Module, mItem.ModuleAction) | ||
191 | + results = append(results, message) | ||
173 | } | 192 | } |
174 | 193 | ||
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 | - //} | ||
185 | - return 2, results, nil | 194 | + return messages.Count, results, nil |
186 | } | 195 | } |
187 | 196 | ||
188 | //MessagesList 消息列表 | 197 | //MessagesList 消息列表 |
189 | func (srv UserService) MessagesMarkRead(cmd *command.MessageMarkReadCommand) (interface{}, error) { | 198 | 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 | - //} | 199 | + gateway := allied_creation_basic.NewHttplibAlliedCreationBasic( |
200 | + cmd.Operator) | ||
201 | + _, err := gateway.ReadNotice(allied_creation_basic.ReqReadNotice{ | ||
202 | + MsgId: cmd.MsgId, | ||
203 | + ReadAll: cmd.ReadAll, | ||
204 | + UserBaseId: cmd.Operator.UserBaseId, | ||
205 | + }) | ||
206 | + if err != nil { | ||
207 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
208 | + } | ||
200 | return struct{}{}, nil | 209 | return struct{}{}, nil |
201 | } | 210 | } |
202 | 211 |
@@ -10,8 +10,8 @@ import ( | @@ -10,8 +10,8 @@ import ( | ||
10 | 10 | ||
11 | // NoticeSettingUpdate 获取消息列表 | 11 | // NoticeSettingUpdate 获取消息列表 |
12 | func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal) (*DataNoticePersonal, error) { | 12 | func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal) (*DataNoticePersonal, error) { |
13 | - url := gateway.baseUrL + "/notice-personal" | ||
14 | - method := "Post" | 13 | + url := gateway.baseUrL + "/notice-personal/search" |
14 | + method := "post" | ||
15 | req := gateway.CreateRequest(url, method) | 15 | req := gateway.CreateRequest(url, method) |
16 | log.Logger.Debug("向基础模块请求数据:获取消息列表。", map[string]interface{}{ | 16 | log.Logger.Debug("向基础模块请求数据:获取消息列表。", map[string]interface{}{ |
17 | "api": method + ":" + url, | 17 | "api": method + ":" + url, |
@@ -42,7 +42,7 @@ func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal | @@ -42,7 +42,7 @@ func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal | ||
42 | // NoticeSettingAdd 消息标记已读 | 42 | // NoticeSettingAdd 消息标记已读 |
43 | func (gateway HttplibAlliedCreationBasic) ReadNotice(param ReqReadNotice) (*DataReadNotice, error) { | 43 | func (gateway HttplibAlliedCreationBasic) ReadNotice(param ReqReadNotice) (*DataReadNotice, error) { |
44 | url := gateway.baseUrL + "/notice-personal/read" | 44 | url := gateway.baseUrL + "/notice-personal/read" |
45 | - method := "POST" | 45 | + method := "post" |
46 | req := gateway.CreateRequest(url, method) | 46 | req := gateway.CreateRequest(url, method) |
47 | log.Logger.Debug("向基础模块请求数据:消息标记已读。", map[string]interface{}{ | 47 | log.Logger.Debug("向基础模块请求数据:消息标记已读。", map[string]interface{}{ |
48 | "api": method + ":" + url, | 48 | "api": method + ":" + url, |
1 | package allied_creation_basic | 1 | package allied_creation_basic |
2 | 2 | ||
3 | +import "time" | ||
4 | + | ||
3 | //返回编排消息通知内容列表 | 5 | //返回编排消息通知内容列表 |
4 | type ( | 6 | type ( |
5 | ReqNoticePersonal struct { | 7 | ReqNoticePersonal struct { |
6 | - IsRead int `json:"isRead"` | ||
7 | - PageIndex int `json:"pageIndex"` | ||
8 | - PageSize int `json:"pageSize"` | ||
9 | - UserId int64 `json:"userId"` | 8 | + IsRead int `json:"isRead"` |
9 | + PageIndex int `json:"pageIndex"` | ||
10 | + PageSize int `json:"pageSize"` | ||
11 | + UserBaseId int64 `json:"userBaseId"` | ||
10 | } | 12 | } |
11 | 13 | ||
12 | DataNoticePersonal struct { | 14 | 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"` | 15 | + List []struct { |
16 | + CompanyID int `json:"companyId"` | ||
17 | + Content string `json:"content"` | ||
18 | + CreatedAt time.Time `json:"createdAt"` | ||
19 | + DeletedAt time.Time `json:"deletedAt"` | ||
20 | + Extend string `json:"extend"` | ||
21 | + IsRead int `json:"isRead"` | ||
22 | + Module string `json:"module"` | ||
23 | + ModuleAction string `json:"moduleAction"` | ||
24 | + NoticePersonalID int `json:"noticePersonalId"` | ||
25 | + OrganizationID int `json:"organizationId"` | ||
26 | + SysCode string `json:"sysCode"` | ||
27 | + UpdatedAt string `json:"updatedAt"` | ||
28 | + UserID int `json:"userId"` | ||
29 | + } `json:"list"` | ||
30 | + Count int64 `json:"count"` | ||
29 | } | 31 | } |
30 | ) | 32 | ) |
31 | 33 | ||
32 | //返回编排消息通知内容列表 | 34 | //返回编排消息通知内容列表 |
33 | type ( | 35 | type ( |
34 | ReqReadNotice struct { | 36 | ReqReadNotice struct { |
35 | - IsRead int `json:"isRead"` | ||
36 | - MsgId int `json:"msgId"` | ||
37 | - ReadAll int `json:"readAll"` | ||
38 | - UserId int64 `json:"userId"` | 37 | + IsRead int `json:"isRead"` |
38 | + MsgId int `json:"noticeId"` | ||
39 | + ReadAll bool `json:"readAll"` | ||
40 | + UserBaseId int64 `json:"userBaseId"` | ||
39 | } | 41 | } |
40 | 42 | ||
41 | DataReadNotice struct { | 43 | DataReadNotice struct { |
@@ -540,18 +540,18 @@ func (controller *CooperationController) PersonCompanyStatistics() { | @@ -540,18 +540,18 @@ func (controller *CooperationController) PersonCompanyStatistics() { | ||
540 | controller.Response(data, err) | 540 | controller.Response(data, err) |
541 | } | 541 | } |
542 | 542 | ||
543 | -func (controller *CooperationController) PersonCompanyDividendStatistics() { | ||
544 | - svr := service.PersonStatisticsService{} | ||
545 | - cmd := &command.CooperationPersonStatisticsCommand{} | ||
546 | - err := controller.Unmarshal(cmd) | ||
547 | - if err != nil { | ||
548 | - controller.Response(nil, err) | ||
549 | - return | ||
550 | - } | ||
551 | - cmd.Operator = controller.GetOperator() | ||
552 | - data, err := svr.CompanyDividendStatistics(cmd) | ||
553 | - controller.Response(data, err) | ||
554 | -} | 543 | +//func (controller *CooperationController) PersonCompanyDividendStatistics() { |
544 | +// svr := service.PersonStatisticsService{} | ||
545 | +// cmd := &command.CooperationPersonStatisticsCommand{} | ||
546 | +// err := controller.Unmarshal(cmd) | ||
547 | +// if err != nil { | ||
548 | +// controller.Response(nil, err) | ||
549 | +// return | ||
550 | +// } | ||
551 | +// cmd.Operator = controller.GetOperator() | ||
552 | +// data, err := svr.CompanyDividendStatistics(cmd) | ||
553 | +// controller.Response(data, err) | ||
554 | +//} | ||
555 | 555 | ||
556 | func (controller *CooperationController) PersonCooperationProjectRecommend() { | 556 | func (controller *CooperationController) PersonCooperationProjectRecommend() { |
557 | svr := service.PersonStatisticsService{} | 557 | svr := service.PersonStatisticsService{} |
@@ -71,6 +71,6 @@ func init() { | @@ -71,6 +71,6 @@ func init() { | ||
71 | /***** PersonStatistics 用户端统计 *****/ | 71 | /***** PersonStatistics 用户端统计 *****/ |
72 | web.Router("/v1/app/cooperation-user/index", &mobile_client.CooperationController{}, "Get:PersonIndexStatistics") | 72 | web.Router("/v1/app/cooperation-user/index", &mobile_client.CooperationController{}, "Get:PersonIndexStatistics") |
73 | web.Router("/v1/app/cooperation-user/company-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyStatistics") | 73 | web.Router("/v1/app/cooperation-user/company-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyStatistics") |
74 | - web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics") | 74 | + //web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics") |
75 | web.Router("/v1/app/cooperation-projects/recommend", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectRecommend") | 75 | web.Router("/v1/app/cooperation-projects/recommend", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectRecommend") |
76 | } | 76 | } |
-
请 注册 或 登录 后发表评论