作者 tangxuhui
... ... @@ -41,7 +41,17 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD
}
// DividendsStatistics TODO:企业的合约统计(分红统计)
func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) {
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,
... ... @@ -64,8 +74,21 @@ func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *comman
}, nil
}
// SearchDividendsEstimates TODO:企业的合约明细列表(分红预算信息)
func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
// 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()
... ...
... ... @@ -34,8 +34,17 @@ func (srv PersonDividendsService) SearchDividendContracts(cmd *command.SearchDiv
return 0, result, nil
}
// DividendsStatistics TODO:企业的合约统计(分红统计)
func (srv PersonDividendsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) {
// DividendsStatistics 企业的合约统计(分红统计)
func (srv PersonDividendsService) DividendsStatistics(cmd *command.DividendsStatisticsCommand) (interface{}, error) {
//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
// cmd.Operator)
//result, err := gateway.CooperationStatistics(allied_creation_cooperation.DividendsStatistics, map[string]interface{}{
// "userBaseId":cmd.Operator.UserBaseId,
//})
//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,
... ... @@ -58,8 +67,22 @@ func (srv PersonDividendsService) DividendsStatistics(userMenusCommand *command.
}, nil
}
// SearchDividendsEstimates TODO:企业的合约明细列表(分红预算信息)
func (srv PersonDividendsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (int64, interface{}, error) {
// SearchDividendsEstimates 企业的合约明细列表(分红预算信息)
func (srv PersonDividendsService) 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,
// "userBaseId":cmd.Operator.UserBaseId,
// "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()
... ...
... ... @@ -12,11 +12,11 @@ import (
"time"
)
// 企业端统计 【0%】
// 企业端统计 【25%】
type CompanyStatisticsService struct {
}
// IndexStatistics TODO:首页统计 (入口页面统计数据)
// IndexStatistics 首页统计 (入口页面统计数据)
func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatisticsCommand) (interface{}, error) {
value := dto.IndexStatistics{}
value.ProjectOverviewStatistics.ContractSum = 20
... ...
... ... @@ -62,11 +62,6 @@ func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.C
}, nil
}
// CompanyDividendStatistics (废弃)共创用户-共创企业分红统计
func (srv PersonStatisticsService) CompanyDividendStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
return map[string]interface{}{}, nil
}
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
... ...
... ... @@ -10,7 +10,7 @@ import (
type MessageMarkReadCommand struct {
Operator domain.Operator `json:"-"`
MsgId int `json:"msgId"`
ReadAll int `json:"readAll"`
ReadAll bool `json:"readAll"`
}
func (cmd *MessageMarkReadCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -24,3 +24,18 @@ func NewMessageDto() *MessageDto {
Read: 1,
}
}
func (m *MessageDto) LoadMsgType(module string, action string) int {
switch module {
case "module01":
switch action {
case "action01_01", "action01_02":
return 1001 //跳转共创申请列表页面
case "action01_03":
return 1002 //跳转共创企业列表页面
case "action01_04", "action01_05", "action01_06":
return 1003
}
}
return 1 // 系统注册消息
}
... ...
... ... @@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
... ... @@ -167,36 +168,44 @@ func (srv UserService) DepartmentsUsers(departmentsUsersQuery *query.Departments
//MessagesList 消息列表
func (srv UserService) MessagesList(cmd *query.MessagesListQuery) (int64, interface{}, error) {
gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
cmd.Operator)
messages, err := gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{
PageIndex: cmd.PageNumber,
PageSize: cmd.PageSize,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var results []*dto.MessageDto
for i := 0; i < 5; i++ {
results = append(results, dto.NewMessageDto())
for i := 0; i < len(messages.List); i++ {
mItem := messages.List[i]
message := &dto.MessageDto{
MsgId: mItem.NoticePersonalID,
MsgContent: mItem.Content,
MsgTime: mItem.CreatedAt.Unix() * 1000,
Read: mItem.IsRead,
}
message.MsgType = message.LoadMsgType(mItem.Module, mItem.ModuleAction)
results = append(results, message)
}
//gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
// cmd.Operator)
//_,err:= gateway.NoticePersonal(allied_creation_basic.ReqNoticePersonal{
// PageIndex: cmd.PageNumber,
// PageSize: cmd.PageSize,
// UserId: cmd.Operator.UserId,
//})
//if err!=nil{
// return 0,nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return 2, results, nil
return messages.Count, results, nil
}
//MessagesList 消息列表
func (srv UserService) MessagesMarkRead(cmd *command.MessageMarkReadCommand) (interface{}, error) {
//gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
// cmd.Operator)
//_,err:= gateway.ReadNotice(allied_creation_basic.ReqReadNotice{
// MsgId: cmd.MsgId,
// ReadAll: cmd.ReadAll,
// UserId: cmd.Operator.UserId,
//})
//if err!=nil{
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
gateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
cmd.Operator)
_, err := gateway.ReadNotice(allied_creation_basic.ReqReadNotice{
MsgId: cmd.MsgId,
ReadAll: cmd.ReadAll,
UserBaseId: cmd.Operator.UserBaseId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return struct{}{}, nil
}
... ...
... ... @@ -10,8 +10,8 @@ import (
// NoticeSettingUpdate 获取消息列表
func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal) (*DataNoticePersonal, error) {
url := gateway.baseUrL + "/notice-personal"
method := "Post"
url := gateway.baseUrL + "/notice-personal/search"
method := "post"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:获取消息列表。", map[string]interface{}{
"api": method + ":" + url,
... ... @@ -42,7 +42,7 @@ func (gateway HttplibAlliedCreationBasic) NoticePersonal(param ReqNoticePersonal
// NoticeSettingAdd 消息标记已读
func (gateway HttplibAlliedCreationBasic) ReadNotice(param ReqReadNotice) (*DataReadNotice, error) {
url := gateway.baseUrL + "/notice-personal/read"
method := "POST"
method := "post"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:消息标记已读。", map[string]interface{}{
"api": method + ":" + url,
... ...
package allied_creation_basic
import "time"
//返回编排消息通知内容列表
type (
ReqNoticePersonal struct {
IsRead int `json:"isRead"`
PageIndex int `json:"pageIndex"`
PageSize int `json:"pageSize"`
UserId int64 `json:"userId"`
IsRead int `json:"isRead"`
PageIndex int `json:"pageIndex"`
PageSize int `json:"pageSize"`
UserBaseId int64 `json:"userBaseId"`
}
DataNoticePersonal struct {
NoticePersonal []struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
CreatedAt string `json:"createdAt"`
DeletedAt string `json:"deletedAt"`
Extend string `json:"extend"`
IsRead string `json:"isRead"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticePersonalID int `json:"noticePersonalId"`
OrganizationID int `json:"organizationId"`
SysCode string `json:"sysCode"`
UpdatedAt string `json:"updatedAt"`
UserID int `json:"userId"`
} `json:"noticePersonal"`
Count float64 `json:"count"`
List []struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt time.Time `json:"deletedAt"`
Extend string `json:"extend"`
IsRead int `json:"isRead"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticePersonalID int `json:"noticePersonalId"`
OrganizationID int `json:"organizationId"`
SysCode string `json:"sysCode"`
UpdatedAt string `json:"updatedAt"`
UserID int `json:"userId"`
} `json:"list"`
Count int64 `json:"count"`
}
)
//返回编排消息通知内容列表
type (
ReqReadNotice struct {
IsRead int `json:"isRead"`
MsgId int `json:"msgId"`
ReadAll int `json:"readAll"`
UserId int64 `json:"userId"`
IsRead int `json:"isRead"`
MsgId int `json:"noticeId"`
ReadAll bool `json:"readAll"`
UserBaseId int64 `json:"userBaseId"`
}
DataReadNotice struct {
... ...
... ... @@ -13,6 +13,8 @@ const (
SearchContractDividends = "SearchContractDividends"
// 获取分红合约详情
GetContractDividends = "GetContractDividends"
// 分红统计(分红明细)
DividendsStatistics = "DividendsStatistics"
// 企业-商品统计
CooperationGoodsStatistics = "cooperationGoodsStatistics"
... ... @@ -20,6 +22,8 @@ const (
CooperationModeStatistics = "CooperationModeStatistics"
// 企业-分红统计
CompanyDividendsStatistics = "CompanyDividendsStatistics"
// 企业、个人 - 分红预算列表
SearchDividendsEstimates = "SearchDividendsEstimates"
)
// CooperationStatistics 共创统计
... ...
... ... @@ -540,18 +540,18 @@ func (controller *CooperationController) PersonCompanyStatistics() {
controller.Response(data, err)
}
func (controller *CooperationController) PersonCompanyDividendStatistics() {
svr := service.PersonStatisticsService{}
cmd := &command.CooperationPersonStatisticsCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CompanyDividendStatistics(cmd)
controller.Response(data, err)
}
//func (controller *CooperationController) PersonCompanyDividendStatistics() {
// svr := service.PersonStatisticsService{}
// cmd := &command.CooperationPersonStatisticsCommand{}
// err := controller.Unmarshal(cmd)
// if err != nil {
// controller.Response(nil, err)
// return
// }
// cmd.Operator = controller.GetOperator()
// data, err := svr.CompanyDividendStatistics(cmd)
// controller.Response(data, err)
//}
func (controller *CooperationController) PersonCooperationProjectRecommend() {
svr := service.PersonStatisticsService{}
... ...
... ... @@ -71,6 +71,6 @@ func init() {
/***** PersonStatistics 用户端统计 *****/
web.Router("/v1/app/cooperation-user/index", &mobile_client.CooperationController{}, "Get:PersonIndexStatistics")
web.Router("/v1/app/cooperation-user/company-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyStatistics")
web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics")
//web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics")
web.Router("/v1/app/cooperation-projects/recommend", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectRecommend")
}
... ...