Merge remote-tracking branch 'origin/test'
# Conflicts: # deploy/k8s/prd/allied-creation-gateway.yaml
正在显示
16 个修改的文件
包含
255 行增加
和
15 行删除
@@ -121,6 +121,8 @@ spec: | @@ -121,6 +121,8 @@ spec: | ||
121 | value: "http://cost-structured-dev.fjmaimaimai.com" | 121 | value: "http://cost-structured-dev.fjmaimaimai.com" |
122 | - name: SUPLUS_SALE_APP | 122 | - name: SUPLUS_SALE_APP |
123 | value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | 123 | value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" |
124 | + - name: ALLIED_CREATION_REPORTING_SYSTEM | ||
125 | + value: "https://allied-creation-reporting-system-dev.fjmaimaimai.com" | ||
124 | # - name: REDIS_HOST | 126 | # - name: REDIS_HOST |
125 | # valueFrom: | 127 | # valueFrom: |
126 | # configMapKeyRef: | 128 | # configMapKeyRef: |
@@ -123,10 +123,12 @@ spec: | @@ -123,10 +123,12 @@ spec: | ||
123 | value: "https://sms.fjmaimaimai.com:9897" | 123 | value: "https://sms.fjmaimaimai.com:9897" |
124 | - name: COST_STRUCTURED | 124 | - name: COST_STRUCTURED |
125 | value: "http://cost-structured-prd.fjmaimaimai.com" | 125 | value: "http://cost-structured-prd.fjmaimaimai.com" |
126 | + - name: ALLIED_CREATION_REPORTING_SYSTEM | ||
127 | + value: "https://allied-creation-reporting-system-prd.fjmaimaimai.com" | ||
126 | - name: MANUFACTURE_WEIGH_DEFAULT_COMPANYID | 128 | - name: MANUFACTURE_WEIGH_DEFAULT_COMPANYID |
127 | value: "4" | 129 | value: "4" |
128 | - name: MANUFACTURE_WEIGH_DEFAULT_ORGID | 130 | - name: MANUFACTURE_WEIGH_DEFAULT_ORGID |
129 | - value: "44" | 131 | + value: "44" |
130 | # - name: REDIS_HOST | 132 | # - name: REDIS_HOST |
131 | # valueFrom: | 133 | # valueFrom: |
132 | # configMapKeyRef: | 134 | # configMapKeyRef: |
@@ -127,6 +127,8 @@ spec: | @@ -127,6 +127,8 @@ spec: | ||
127 | value: "http://cost-structured-test.fjmaimaimai.com" | 127 | value: "http://cost-structured-test.fjmaimaimai.com" |
128 | - name: SUPLUS_SALE_APP | 128 | - name: SUPLUS_SALE_APP |
129 | value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | 129 | value: "http://suplus-sale-app-gateway-test.fjmaimaimai.com" |
130 | + - name: ALLIED_CREATION_REPORTING_SYSTEM | ||
131 | + value: "https://allied-creation-reporting-system-test.fjmaimaimai.com" | ||
130 | - name: MANUFACTURE_WEIGH_DEFAULT_COMPANYID | 132 | - name: MANUFACTURE_WEIGH_DEFAULT_COMPANYID |
131 | value: "23" | 133 | value: "23" |
132 | - name: MANUFACTURE_WEIGH_DEFAULT_ORGID | 134 | - name: MANUFACTURE_WEIGH_DEFAULT_ORGID |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
7 | +) | ||
8 | + | ||
9 | +type CheckModuleAccessCommand struct { | ||
10 | + // 操作人 | ||
11 | + Operator domain.Operator `json:"-"` | ||
12 | + // 模块 | ||
13 | + Module string `json:"module"` | ||
14 | + // 参数 | ||
15 | + Options []string `json:"options"` | ||
16 | +} | ||
17 | + | ||
18 | +func (cmd *CheckModuleAccessCommand) Valid(validation *validation.Validation) { | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +func (cmd *CheckModuleAccessCommand) ValidateCommand() error { | ||
23 | + valid := validation.Validation{} | ||
24 | + b, err := valid.Valid(cmd) | ||
25 | + if err != nil { | ||
26 | + return err | ||
27 | + } | ||
28 | + if !b { | ||
29 | + for _, validErr := range valid.Errors { | ||
30 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
31 | + } | ||
32 | + } | ||
33 | + return nil | ||
34 | +} |
1 | +package dto | ||
2 | + | ||
3 | +// 数控中心报表 | ||
4 | +type ModuleAccessToDigitalControlCentreDto struct { | ||
5 | + // 用户的角色权限列表 | ||
6 | + UserRoles []string `json:"userRoles"` | ||
7 | + // 列表 | ||
8 | + Allows []*ModuleAccessAllowItem `json:"modules"` | ||
9 | +} | ||
10 | + | ||
11 | +type ModuleAccessAllowItem struct { | ||
12 | + Allow bool `json:"allow"` | ||
13 | + SettingCode string `json:"settingCode"` | ||
14 | + ConfigRoles []string `json:"configRoles"` | ||
15 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/linmadan/egglib-go/core/application" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/auth/command" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/auth/dto" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | ||
11 | + "strings" | ||
12 | +) | ||
13 | + | ||
14 | +func (svr AuthService) CheckModuleAccess(cmd *command.CheckModuleAccessCommand) (interface{}, error) { | ||
15 | + var ( | ||
16 | + result interface{} | ||
17 | + err error | ||
18 | + ) | ||
19 | + | ||
20 | + switch cmd.Module { | ||
21 | + case "DigitalControlCentre": | ||
22 | + result, err = svr.digitalControlCentreModuleAccess(cmd) | ||
23 | + break | ||
24 | + default: | ||
25 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "unknown module "+cmd.Module) | ||
26 | + } | ||
27 | + if err != nil { | ||
28 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
29 | + } | ||
30 | + return result, nil | ||
31 | +} | ||
32 | + | ||
33 | +func (svr AuthService) digitalControlCentreModuleAccess(cmd *command.CheckModuleAccessCommand) (interface{}, error) { | ||
34 | + if len(cmd.Options) == 0 { | ||
35 | + return nil, fmt.Errorf("options is empty") | ||
36 | + } | ||
37 | + | ||
38 | + alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(cmd.Operator) | ||
39 | + | ||
40 | + response := dto.ModuleAccessToDigitalControlCentreDto{ | ||
41 | + Allows: make([]*dto.ModuleAccessAllowItem, 0), | ||
42 | + } | ||
43 | + var mapAllowItem = make(map[string]*dto.ModuleAccessAllowItem) | ||
44 | + for i := range cmd.Options { | ||
45 | + allow := &dto.ModuleAccessAllowItem{ | ||
46 | + SettingCode: cmd.Options[i], | ||
47 | + Allow: false, | ||
48 | + ConfigRoles: []string{}, | ||
49 | + } | ||
50 | + response.Allows = append(response.Allows, allow) | ||
51 | + mapAllowItem[allow.SettingCode] = allow | ||
52 | + } | ||
53 | + | ||
54 | + alliedCreationUser := allied_creation_user.NewHttplibAlliedCreationUser(cmd.Operator) | ||
55 | + user, err := alliedCreationUser.UserGet(allied_creation_user.ReqGetUser{ | ||
56 | + UserId: int(cmd.Operator.UserId), | ||
57 | + }) | ||
58 | + if err != nil { | ||
59 | + log.Logger.Error(err.Error()) | ||
60 | + return nil, fmt.Errorf("user get fail") | ||
61 | + } | ||
62 | + roles := make([]string, 0) | ||
63 | + for i := range user.UserRole { | ||
64 | + role := user.UserRole[i] | ||
65 | + roles = append(roles, role.RoleName) | ||
66 | + } | ||
67 | + if len(roles) == 0 { | ||
68 | + return response, nil | ||
69 | + } | ||
70 | + response.UserRoles = roles | ||
71 | + | ||
72 | + for _, code := range cmd.Options { | ||
73 | + settingCode := code | ||
74 | + if len(settingCode) == 0 { | ||
75 | + return nil, fmt.Errorf("setting code is empty") | ||
76 | + } | ||
77 | + result, err := alliedCreationBasic.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{ | ||
78 | + SettingCode: settingCode, | ||
79 | + }) | ||
80 | + if err != nil { | ||
81 | + //log.Logger.Error(err.Error(), map[string]interface{}{"company": cmd.Operator.CompanyId}) | ||
82 | + //return nil, fmt.Errorf("system setting get fail") | ||
83 | + continue | ||
84 | + } | ||
85 | + configRoles := strings.Split(result.Value, ";") | ||
86 | + if len(configRoles) == 0 { | ||
87 | + continue | ||
88 | + } | ||
89 | + var allow bool = false | ||
90 | + for _, vi := range configRoles { | ||
91 | + for _, vj := range roles { | ||
92 | + if vi == vj { | ||
93 | + allow = true | ||
94 | + break | ||
95 | + } | ||
96 | + } | ||
97 | + if allow { | ||
98 | + break | ||
99 | + } | ||
100 | + } | ||
101 | + if v, ok := mapAllowItem[settingCode]; ok { | ||
102 | + v.Allow = allow | ||
103 | + v.ConfigRoles = configRoles | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + return response, nil | ||
108 | +} |
@@ -48,7 +48,8 @@ func (svr AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ | @@ -48,7 +48,8 @@ func (svr AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ | ||
48 | Phone: loginCommand.Phone, | 48 | Phone: loginCommand.Phone, |
49 | }) | 49 | }) |
50 | if err != nil { | 50 | if err != nil { |
51 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 51 | + log.Logger.Error("refresh im error:" + err.Error()) // 只做提示继续进行登录 |
52 | + //return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
52 | } | 53 | } |
53 | switch loginCommand.GrantType { | 54 | switch loginCommand.GrantType { |
54 | case domain.LoginPwd: | 55 | case domain.LoginPwd: |
@@ -13,6 +13,7 @@ type GetLatestVersionQuery struct { | @@ -13,6 +13,7 @@ type GetLatestVersionQuery struct { | ||
13 | DeviceType string `json:"-"` | 13 | DeviceType string `json:"-"` |
14 | VersionNo int `json:"versionNo,string"` | 14 | VersionNo int `json:"versionNo,string"` |
15 | Channel int `json:"channel"` | 15 | Channel int `json:"channel"` |
16 | + AppName string `json:"appName"` | ||
16 | Request *http.Request `json:"-"` | 17 | Request *http.Request `json:"-"` |
17 | } | 18 | } |
18 | 19 |
@@ -51,6 +51,21 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | @@ -51,6 +51,21 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | ||
51 | //LatestVersionInfo 版本升级 | 51 | //LatestVersionInfo 版本升级 |
52 | func (srv *CommonService) LatestVersionInfo(q *query.GetLatestVersionQuery) (interface{}, error) { | 52 | func (srv *CommonService) LatestVersionInfo(q *query.GetLatestVersionQuery) (interface{}, error) { |
53 | vs := version_server.NewHttpLibVersionServer() | 53 | vs := version_server.NewHttpLibVersionServer() |
54 | + // TODO:版本管理系统按应用名称查询相应版本信息,目前维护人没在,此处先写死手动维护 | ||
55 | + if len(q.AppName) != 0 && q.AppName == "com.mmm.manufacture-weigh.pad" { | ||
56 | + return map[string]interface{}{ | ||
57 | + "version": map[string]interface{}{ | ||
58 | + "versionName": "版本 v1.0.1", | ||
59 | + "content": "版本升级", | ||
60 | + "title": "版本升级", | ||
61 | + "versionNo": "100001", | ||
62 | + "downloadFile": "upgrade", | ||
63 | + "downloadPage": "http://fir.fjmaimaimai.com/ben1", | ||
64 | + "updateType": 0, | ||
65 | + "channel": 1, | ||
66 | + }, | ||
67 | + }, nil | ||
68 | + } | ||
54 | data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{ | 69 | data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{ |
55 | VersionNo: q.VersionNo, | 70 | VersionNo: q.VersionNo, |
56 | Channel: q.Channel, | 71 | Channel: q.Channel, |
@@ -321,10 +321,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | @@ -321,10 +321,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | ||
321 | if err != nil { | 321 | if err != nil { |
322 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") | 322 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") |
323 | } | 323 | } |
324 | - ossFile = append(ossFile,ossFile1) | 324 | + ossFile = append(ossFile, ossFile1) |
325 | } | 325 | } |
326 | //图片2 | 326 | //图片2 |
327 | - _,mBytes2,err := f.GetPicture(f.GetSheetName(index), "F"+fmt.Sprintf("%v", excelImport.RowBegin+key+1)) | 327 | + _, mBytes2, err := f.GetPicture(f.GetSheetName(index), "F"+fmt.Sprintf("%v", excelImport.RowBegin+key+1)) |
328 | if err != nil { | 328 | if err != nil { |
329 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败") | 329 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败") |
330 | } | 330 | } |
@@ -333,10 +333,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | @@ -333,10 +333,10 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | ||
333 | if err != nil { | 333 | if err != nil { |
334 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") | 334 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") |
335 | } | 335 | } |
336 | - ossFile = append(ossFile,ossFile2) | 336 | + ossFile = append(ossFile, ossFile2) |
337 | } | 337 | } |
338 | //图片3 | 338 | //图片3 |
339 | - _,mBytes3,err := f.GetPicture(f.GetSheetName(index), "G"+fmt.Sprintf("%v", excelImport.RowBegin+key+1)) | 339 | + _, mBytes3, err := f.GetPicture(f.GetSheetName(index), "G"+fmt.Sprintf("%v", excelImport.RowBegin+key+1)) |
340 | if err != nil { | 340 | if err != nil { |
341 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败") | 341 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取图片失败") |
342 | } | 342 | } |
@@ -345,7 +345,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | @@ -345,7 +345,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | ||
345 | if err != nil { | 345 | if err != nil { |
346 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") | 346 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "上传图片失败") |
347 | } | 347 | } |
348 | - ossFile = append(ossFile,ossFile3) | 348 | + ossFile = append(ossFile, ossFile3) |
349 | } | 349 | } |
350 | //choiceId, err := strconv.Atoi(v["choiceId"]) | 350 | //choiceId, err := strconv.Atoi(v["choiceId"]) |
351 | choiceId := domain.NodeType{}.GetIdByName(strings.TrimSpace(v["choiceId"])) | 351 | choiceId := domain.NodeType{}.GetIdByName(strings.TrimSpace(v["choiceId"])) |
@@ -382,7 +382,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | @@ -382,7 +382,7 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | ||
382 | YesterdayActual: strings.TrimSpace(v["yesterdayActual"]), | 382 | YesterdayActual: strings.TrimSpace(v["yesterdayActual"]), |
383 | Types: importCostCommand.Types, | 383 | Types: importCostCommand.Types, |
384 | } | 384 | } |
385 | - if len(ossFile) >0 { | 385 | + if len(ossFile) > 0 { |
386 | item.Urls = ossFile | 386 | item.Urls = ossFile |
387 | } else { | 387 | } else { |
388 | item.Urls = []string{} | 388 | item.Urls = []string{} |
@@ -398,15 +398,15 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | @@ -398,15 +398,15 @@ func (srv ExcelDataService) ImportCost(importDataCommand *command.ImportDataComm | ||
398 | "successCount": 0, | 398 | "successCount": 0, |
399 | "fail": map[string]interface{}{ | 399 | "fail": map[string]interface{}{ |
400 | "header": map[string]string{ | 400 | "header": map[string]string{ |
401 | - "failReason": "错误详情", | ||
402 | - "projectCode": "项目编码", | ||
403 | - "itemName": "细项名称", | 401 | + "failReason": "错误详情", |
402 | + "projectCode": "项目编码", | ||
403 | + "itemName": "细项名称", | ||
404 | }, | 404 | }, |
405 | - "body": []map[string]interface{}{ | ||
406 | - {"failReason":result.Msg,"projectCode":"","itemName":""}, | 405 | + "body": []map[string]interface{}{ |
406 | + {"failReason": result.Msg, "projectCode": "", "itemName": ""}, | ||
407 | }, | 407 | }, |
408 | }, | 408 | }, |
409 | - "successData":nil, | 409 | + "successData": nil, |
410 | }, nil | 410 | }, nil |
411 | } else { | 411 | } else { |
412 | return result.Data, nil | 412 | return result.Data, nil |
@@ -451,7 +451,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool { | @@ -451,7 +451,7 @@ func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool { | ||
451 | // FileImportTemplate 导入模板 | 451 | // FileImportTemplate 导入模板 |
452 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 452 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
453 | var mapTemplate = map[string]string{ | 453 | var mapTemplate = map[string]string{ |
454 | - domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220222/object/1645495589_cFNDGRTfCxYMZ5hPYzfKxThYd3ywARRz.xlsx", | 454 | + domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/opportunity/dev_online/20220427/object/1651040510_YxpaeFBaZfGKxs6dERrsKeZY5ha7ByrQ.xlsx", |
455 | domain.ImportOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807490_r2XWhGmbWWmpbeePBkZ3EJQFKcZEMpEm.xlsx", | 455 | domain.ImportOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807490_r2XWhGmbWWmpbeePBkZ3EJQFKcZEMpEm.xlsx", |
456 | domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx", | 456 | domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210927/object/1632743206_NPYTKw6RGhXn4TpYNEQhGGdCkXKXTnxM.xlsx", |
457 | domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx", | 457 | domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210926/object/1632635345_SbfzmkXjQHhCwPw4MB7zb5EBBtdp2MSE.xlsx", |
@@ -46,8 +46,12 @@ var EnableBlockChain = true | @@ -46,8 +46,12 @@ var EnableBlockChain = true | ||
46 | 46 | ||
47 | // 天联共创 成本结构化 | 47 | // 天联共创 成本结构化 |
48 | var COST_STRUCTURED = "http://cost-structured-dev.fjmaimaimai.com" | 48 | var COST_STRUCTURED = "http://cost-structured-dev.fjmaimaimai.com" |
49 | + | ||
49 | //var COST_STRUCTURED = "http://localhost:8085" | 50 | //var COST_STRUCTURED = "http://localhost:8085" |
50 | 51 | ||
52 | +// 天联共创 生产制造模块 | ||
53 | +var ALLIED_CREATION_REPORTING_SYSTEM = "https://allied-creation-reporting-system-test.fjmaimaimai.com" | ||
54 | + | ||
51 | func init() { | 55 | func init() { |
52 | if os.Getenv("LOG_LEVEL") != "" { | 56 | if os.Getenv("LOG_LEVEL") != "" { |
53 | LOG_LEVEL = os.Getenv("LOG_LEVEL") | 57 | LOG_LEVEL = os.Getenv("LOG_LEVEL") |
@@ -88,4 +92,7 @@ func init() { | @@ -88,4 +92,7 @@ func init() { | ||
88 | if os.Getenv("COST_STRUCTURED") != "" { | 92 | if os.Getenv("COST_STRUCTURED") != "" { |
89 | COST_STRUCTURED = os.Getenv("COST_STRUCTURED") | 93 | COST_STRUCTURED = os.Getenv("COST_STRUCTURED") |
90 | } | 94 | } |
95 | + if os.Getenv("ALLIED_CREATION_REPORTING_SYSTEM") != "" { | ||
96 | + ALLIED_CREATION_REPORTING_SYSTEM = os.Getenv("ALLIED_CREATION_REPORTING_SYSTEM") | ||
97 | + } | ||
91 | } | 98 | } |
@@ -372,6 +372,7 @@ type ( | @@ -372,6 +372,7 @@ type ( | ||
372 | ParentPath string `json:"parentPath"` | 372 | ParentPath string `json:"parentPath"` |
373 | Remark string `json:"remark"` | 373 | Remark string `json:"remark"` |
374 | Sort int `json:"sort"` | 374 | Sort int `json:"sort"` |
375 | + Link string `json:"link"` | ||
375 | } `json:"menus"` | 376 | } `json:"menus"` |
376 | } | 377 | } |
377 | ) | 378 | ) |
1 | +package chart_editor | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" | ||
7 | + "time" | ||
8 | +) | ||
9 | + | ||
10 | +//HttpLibAlliedCreationManufacture 生产制造模块 | ||
11 | +type HttpLibAlliedChartEditor struct { | ||
12 | + service_gateway.BaseServiceGateway | ||
13 | + baseUrL string | ||
14 | +} | ||
15 | + | ||
16 | +func NewHttpLibAlliedChartEditor(operator domain.Operator) *HttpLibAlliedChartEditor { | ||
17 | + return &HttpLibAlliedChartEditor{ | ||
18 | + BaseServiceGateway: service_gateway.BaseServiceGateway{ | ||
19 | + ConnectTimeout: 100 * time.Second, | ||
20 | + ReadWriteTimeout: 100 * time.Second, | ||
21 | + CompanyId: operator.CompanyId, | ||
22 | + OrgId: operator.OrgId, | ||
23 | + InOrgIds: operator.OrgIds, | ||
24 | + UserId: operator.UserId, | ||
25 | + UserBaseId: operator.UserBaseId, | ||
26 | + }, | ||
27 | + baseUrL: constant.ALLIED_CREATION_REPORTING_SYSTEM, | ||
28 | + } | ||
29 | + | ||
30 | +} | ||
31 | + | ||
32 | +func (gateway HttpLibAlliedChartEditor) BaseUrl() string { | ||
33 | + return gateway.baseUrL | ||
34 | +} |
@@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_manufacture" |
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" |
7 | + chart_editor "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/chart-editor" | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured" |
8 | "net/http" | 9 | "net/http" |
9 | "os" | 10 | "os" |
@@ -70,6 +71,8 @@ func init() { | @@ -70,6 +71,8 @@ func init() { | ||
70 | web.InsertFilter("/v1/manufacture/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/manufacture", allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(domain.Operator{}))) | 71 | web.InsertFilter("/v1/manufacture/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/manufacture", allied_creation_manufacture.NewHttpLibAlliedCreationManufacture(domain.Operator{}))) |
71 | web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken()) | 72 | web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.CheckAccessToken()) |
72 | web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{}))) | 73 | web.InsertFilter("/v1/cost/*", web.BeforeRouter, middleware.RedirectInternalService("/v1/cost", cost_structured.NewHttpLibCostStructured(domain.Operator{}))) |
74 | + web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.CheckAccessToken()) | ||
75 | + web.InsertFilter("/v1/chart-editor/*", web.BeforeRouter, middleware.RedirectInternalService("/chart-editor", chart_editor.NewHttpLibAlliedChartEditor(domain.Operator{}))) | ||
73 | } | 76 | } |
74 | 77 | ||
75 | func AllowCors() func(ctx *context.Context) { | 78 | func AllowCors() func(ctx *context.Context) { |
@@ -225,3 +225,16 @@ func (controller *AuthController) CaptchaInit() { | @@ -225,3 +225,16 @@ func (controller *AuthController) CaptchaInit() { | ||
225 | data, err := authService.CaptchaInit(cmd) | 225 | data, err := authService.CaptchaInit(cmd) |
226 | controller.Response(data, err) | 226 | controller.Response(data, err) |
227 | } | 227 | } |
228 | + | ||
229 | +func (controller *AuthController) CheckModuleAccessCommand() { | ||
230 | + authService := service.AuthService{} | ||
231 | + cmd := &command.CheckModuleAccessCommand{} | ||
232 | + err := controller.Unmarshal(cmd) | ||
233 | + if err != nil { | ||
234 | + controller.Response(nil, err) | ||
235 | + return | ||
236 | + } | ||
237 | + cmd.Operator = controller.GetOperator() | ||
238 | + data, err := authService.CheckModuleAccess(cmd) | ||
239 | + controller.Response(data, err) | ||
240 | +} |
@@ -21,4 +21,6 @@ func init() { | @@ -21,4 +21,6 @@ func init() { | ||
21 | web.Router("/v1/auth/user-sign-up", &controllers.AuthController{}, "Post:UserSignUp") | 21 | web.Router("/v1/auth/user-sign-up", &controllers.AuthController{}, "Post:UserSignUp") |
22 | web.Router("/v1/auth/reset-password", &controllers.AuthController{}, "Post:ResetPassword") //公司重置密码 | 22 | web.Router("/v1/auth/reset-password", &controllers.AuthController{}, "Post:ResetPassword") //公司重置密码 |
23 | web.Router("/v1/auth/org-switch", &controllers.AuthController{}, "Post:OrgSwitch") | 23 | web.Router("/v1/auth/org-switch", &controllers.AuthController{}, "Post:OrgSwitch") |
24 | + | ||
25 | + web.Router("/v1/auth/check-module-access", &controllers.AuthController{}, "Post:CheckModuleAccessCommand") | ||
24 | } | 26 | } |
-
请 注册 或 登录 后发表评论