Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
9 个修改的文件
包含
150 行增加
和
2 行删除
@@ -47,7 +47,7 @@ spec: | @@ -47,7 +47,7 @@ spec: | ||
47 | - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy | 47 | - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy |
48 | containers: | 48 | containers: |
49 | - name: allied-creation-gateway | 49 | - name: allied-creation-gateway |
50 | - image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev | 50 | + image: 192.168.0.243:5000/mmm/allied-creation-gateway:test |
51 | imagePullPolicy: Always | 51 | imagePullPolicy: Always |
52 | ports: | 52 | ports: |
53 | - containerPort: 8082 | 53 | - containerPort: 8082 |
@@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
43 | } | 43 | } |
44 | 44 | ||
45 | // 模式列表 | 45 | // 模式列表 |
46 | + var modeStatistics = struct { | ||
47 | + TotalCooperationModeStatistics interface{} `json:"totalCooperationModeStatistics"` | ||
48 | + CooperationModeStatistics interface{} `json:"cooperationModeStatistics"` | ||
49 | + CooperationModes interface{} `json:"cooperationModes"` | ||
50 | + }{} | ||
51 | + err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics) | ||
52 | + if err != nil { | ||
53 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
54 | + } | ||
55 | + | ||
56 | + // 项目概览统计 | ||
57 | + contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ | ||
58 | + PageNumber: 1, | ||
59 | + PageSize: 1, | ||
60 | + CompanyId: cmd.Operator.CompanyId, | ||
61 | + OrgId: cmd.Operator.OrgId, | ||
62 | + }) | ||
63 | + if err != nil { | ||
64 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
65 | + } | ||
66 | + projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | ||
67 | + PageNumber: 1, | ||
68 | + PageSize: 1, | ||
69 | + CompanyId: cmd.Operator.CompanyId, | ||
70 | + OrgId: cmd.Operator.OrgId, | ||
71 | + Status: 1, | ||
72 | + }) | ||
73 | + if err != nil { | ||
74 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
75 | + } | ||
76 | + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( | ||
77 | + cmd.Operator) | ||
78 | + users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{ | ||
79 | + Limit: 1, | ||
80 | + Offset: 0, | ||
81 | + CompanyId: cmd.Operator.CompanyId, | ||
82 | + OrganizationId: cmd.Operator.OrgId, | ||
83 | + UserType: domain.UserTypeCooperation, | ||
84 | + InEnableStatus: []int{domain.UserStatusEnable}, | ||
85 | + }) | ||
86 | + if err != nil { | ||
87 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
88 | + } | ||
89 | + var projectOverviewStatistics = map[string]interface{}{ | ||
90 | + "contractSum": contracts.Grid.Total, | ||
91 | + "cooperationUserCount": users.Count, | ||
92 | + "projectSum": projects.Total, | ||
93 | + } | ||
94 | + | ||
95 | + return map[string]interface{}{ | ||
96 | + "projectOverviewStatistics": projectOverviewStatistics, | ||
97 | + "currentMonthDividendsStatistics": companyDividendsStatistics, | ||
98 | + "cooperationModeStatistics": modeStatistics.CooperationModeStatistics, | ||
99 | + "cooperationGoodsStatistics": cooperationGoodsStatistics, | ||
100 | + "cooperationModes": modeStatistics.CooperationModes, | ||
101 | + "totalCooperationModeStatistics": modeStatistics.TotalCooperationModeStatistics, | ||
102 | + }, nil | ||
103 | +} | ||
104 | + | ||
105 | +// IndexStatistics 首页统计 (入口页面统计数据) | ||
106 | +func (srv CompanyStatisticsService) IndexStatisticsBak(cmd *command.IndexStatisticsCommand) (interface{}, error) { | ||
107 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
108 | + cmd.Operator) | ||
109 | + companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{ | ||
110 | + "companyId": cmd.Operator.CompanyId, | ||
111 | + "orgId": cmd.Operator.OrgId, | ||
112 | + "action": 1, //当前月 | ||
113 | + }) | ||
114 | + if err != nil { | ||
115 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
116 | + } | ||
117 | + cooperationModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationModeStatistics, map[string]interface{}{ | ||
118 | + "companyId": cmd.Operator.CompanyId, | ||
119 | + "orgId": cmd.Operator.OrgId, | ||
120 | + }) | ||
121 | + if err != nil { | ||
122 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
123 | + } | ||
124 | + cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{ | ||
125 | + "companyId": cmd.Operator.CompanyId, | ||
126 | + "orgId": cmd.Operator.OrgId, | ||
127 | + "rankType": 1, //月榜 | ||
128 | + "top": 5, | ||
129 | + }) | ||
130 | + if err != nil { | ||
131 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
132 | + } | ||
133 | + | ||
134 | + // 模式列表 | ||
46 | var modeStatistics []CooperationModeStatistics | 135 | var modeStatistics []CooperationModeStatistics |
47 | var responseModeStatistics []CooperationModeStatistics | 136 | var responseModeStatistics []CooperationModeStatistics |
48 | var modeNumbers []string | 137 | var modeNumbers []string |
@@ -280,3 +280,22 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | @@ -280,3 +280,22 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | ||
280 | } | 280 | } |
281 | return result | 281 | return result |
282 | } | 282 | } |
283 | + | ||
284 | +// ImportCompanyUser 导入公司用户信息 | ||
285 | +func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { | ||
286 | + var mapTemplate = map[string]string{ | ||
287 | + domain.TemplateCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
288 | + // 模板待更新 | ||
289 | + domain.TemplateOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
290 | + domain.TemplateCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
291 | + domain.TemplateDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
292 | + } | ||
293 | + var url string | ||
294 | + var ok bool | ||
295 | + if url, ok = mapTemplate[importDataCommand.Code]; !ok { | ||
296 | + return nil, application.ThrowError(application.BUSINESS_ERROR, fmt.Sprintf("模板:%v 不存在", importDataCommand.Code)) | ||
297 | + } | ||
298 | + return map[string]string{ | ||
299 | + "url": url, | ||
300 | + }, nil | ||
301 | +} |
@@ -38,6 +38,7 @@ type UserOrg struct { | @@ -38,6 +38,7 @@ type UserOrg struct { | ||
38 | 38 | ||
39 | type UserRole struct { | 39 | type UserRole struct { |
40 | RoleID string `json:"roleId"` | 40 | RoleID string `json:"roleId"` |
41 | + OrgId int64 `json:"orgId,string"` | ||
41 | RoleName string `json:"roleName"` | 42 | RoleName string `json:"roleName"` |
42 | OrgName string `json:"orgName"` | 43 | OrgName string `json:"orgName"` |
43 | RoleType int `json:"roleType"` | 44 | RoleType int `json:"roleType"` |
@@ -72,6 +72,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp | @@ -72,6 +72,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp | ||
72 | for _, v := range resultUser.UserRole { | 72 | for _, v := range resultUser.UserRole { |
73 | userRole = append(userRole, dto.UserRole{ | 73 | userRole = append(userRole, dto.UserRole{ |
74 | RoleID: strconv.Itoa(v.RoleID), | 74 | RoleID: strconv.Itoa(v.RoleID), |
75 | + OrgId: v.OrgId, | ||
75 | RoleName: v.RoleName, | 76 | RoleName: v.RoleName, |
76 | OrgName: v.Ext.OrgName, | 77 | OrgName: v.Ext.OrgName, |
77 | RoleType: v.RoleType, | 78 | RoleType: v.RoleType, |
@@ -48,3 +48,27 @@ const ( | @@ -48,3 +48,27 @@ const ( | ||
48 | MaxQueryRowCount = 1000 | 48 | MaxQueryRowCount = 1000 |
49 | NormalQueryRowCount = 100 | 49 | NormalQueryRowCount = 100 |
50 | ) | 50 | ) |
51 | + | ||
52 | +const ( | ||
53 | + // 导入公司用户 | ||
54 | + ImportCompanyUser = "ImportCompanyUser" | ||
55 | + // 导入公司组织 | ||
56 | + ImportOrganization = "ImportOrganization" | ||
57 | + // 导入共创用户 | ||
58 | + ImportCooperationUser = "ImportCooperationUser" | ||
59 | + | ||
60 | + // 导入分红订单 | ||
61 | + ImportDividendsOrders = "ImportDividendsOrders" | ||
62 | +) | ||
63 | + | ||
64 | +const ( | ||
65 | + // 导入公司用户 | ||
66 | + TemplateCompanyUser = "TemplateCompanyUser" | ||
67 | + // 导入公司组织 | ||
68 | + TemplateOrganization = "TemplateOrganization" | ||
69 | + // 导入共创用户 | ||
70 | + TemplateCooperationUser = "TemplateCooperationUser" | ||
71 | + | ||
72 | + // 分红订单模板 | ||
73 | + TemplateDividendsOrders = "TemplateDividendsOrders" | ||
74 | +) |
@@ -48,6 +48,7 @@ type UserDetail struct { | @@ -48,6 +48,7 @@ type UserDetail struct { | ||
48 | RoleID int `json:"roleId"` | 48 | RoleID int `json:"roleId"` |
49 | RoleName string `json:"roleName"` | 49 | RoleName string `json:"roleName"` |
50 | RoleType int `json:"roleType"` | 50 | RoleType int `json:"roleType"` |
51 | + OrgId int64 `json:"orgId"` | ||
51 | Ext struct { | 52 | Ext struct { |
52 | OrgName string `json:"orgName"` | 53 | OrgName string `json:"orgName"` |
53 | } `json:"ext,omitempty"` | 54 | } `json:"ext,omitempty"` |
@@ -2,6 +2,7 @@ package web_client | @@ -2,6 +2,7 @@ package web_client | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | "path/filepath" | 6 | "path/filepath" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -283,8 +284,19 @@ func (controller ExcelDataController) FileImport() { | @@ -283,8 +284,19 @@ func (controller ExcelDataController) FileImport() { | ||
283 | cmd.Reader = r | 284 | cmd.Reader = r |
284 | var data interface{} | 285 | var data interface{} |
285 | switch cmd.Code { | 286 | switch cmd.Code { |
286 | - case "ImportCompanyUser": | 287 | + case domain.ImportCompanyUser: |
287 | data, err = excelService.ImportCompanyUser(cmd) | 288 | data, err = excelService.ImportCompanyUser(cmd) |
288 | } | 289 | } |
289 | controller.Response(data, err) | 290 | controller.Response(data, err) |
290 | } | 291 | } |
292 | + | ||
293 | +func (controller ExcelDataController) FileImportTemplate() { | ||
294 | + excelService := service.NewExcelDataService(nil) | ||
295 | + cmd := &command.ImportDataCommand{} | ||
296 | + //controller.Unmarshal(cmd) | ||
297 | + code := controller.GetString(":code") | ||
298 | + cmd.Code = code | ||
299 | + var data interface{} | ||
300 | + data, err := excelService.FileImportTemplate(cmd) | ||
301 | + controller.Response(data, err) | ||
302 | +} |
@@ -18,4 +18,5 @@ func init() { | @@ -18,4 +18,5 @@ func init() { | ||
18 | web.Router("/v1/web/excel/import/organization", &web_client.ExcelDataController{}, "Post:ImportOrganization") | 18 | web.Router("/v1/web/excel/import/organization", &web_client.ExcelDataController{}, "Post:ImportOrganization") |
19 | 19 | ||
20 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") | 20 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") |
21 | + web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate") | ||
21 | } | 22 | } |
-
请 注册 或 登录 后发表评论