合并分支 'test' 到 'master'
Test 查看合并请求 !13
正在显示
23 个修改的文件
包含
357 行增加
和
118 行删除
@@ -5,6 +5,7 @@ go 1.16 | @@ -5,6 +5,7 @@ go 1.16 | ||
5 | require ( | 5 | require ( |
6 | github.com/Andrew-M-C/go.timeconv v0.4.0 | 6 | github.com/Andrew-M-C/go.timeconv v0.4.0 |
7 | github.com/Shopify/sarama v1.25.0 | 7 | github.com/Shopify/sarama v1.25.0 |
8 | + github.com/beego/beego v1.12.11 | ||
8 | github.com/beego/beego/v2 v2.0.5 | 9 | github.com/beego/beego/v2 v2.0.5 |
9 | github.com/bwmarrin/snowflake v0.3.0 | 10 | github.com/bwmarrin/snowflake v0.3.0 |
10 | github.com/dgrijalva/jwt-go v3.2.0+incompatible | 11 | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
@@ -61,6 +61,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l | @@ -61,6 +61,8 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l | ||
61 | github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= | 61 | github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= |
62 | github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= | 62 | github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= |
63 | github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= | 63 | github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= |
64 | +github.com/beego/beego v1.12.11 h1:MWKcnpavb7iAIS0m6uuEq6pHKkYvGNw/5umIUKqL7jM= | ||
65 | +github.com/beego/beego v1.12.11/go.mod h1:QURFL1HldOcCZAxnc1cZ7wrplsYR5dKPHFjmk6WkLAs= | ||
64 | github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI= | 66 | github.com/beego/beego/v2 v2.0.1/go.mod h1:8zyHi1FnWO1mZLwTn62aKRIZF/aIKvkCBB2JYs+eqQI= |
65 | github.com/beego/beego/v2 v2.0.5 h1:fa2TBWfKGDs35Ck9an9SVnpS0zM8sRTXlW8rFjpeYlE= | 67 | github.com/beego/beego/v2 v2.0.5 h1:fa2TBWfKGDs35Ck9an9SVnpS0zM8sRTXlW8rFjpeYlE= |
66 | github.com/beego/beego/v2 v2.0.5/go.mod h1:CH2/JIaB4ceGYVQlYqTAFft4pVk/ol1ZkakUrUvAyns= | 68 | github.com/beego/beego/v2 v2.0.5/go.mod h1:CH2/JIaB4ceGYVQlYqTAFft4pVk/ol1ZkakUrUvAyns= |
@@ -102,10 +104,13 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV | @@ -102,10 +104,13 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV | ||
102 | github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= | 104 | github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= |
103 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= | 105 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= |
104 | github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= | 106 | github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= |
107 | +github.com/couchbase/go-couchbase v0.0.0-20201216133707-c04035124b17/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A= | ||
105 | github.com/couchbase/go-couchbase v0.1.0/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A= | 108 | github.com/couchbase/go-couchbase v0.1.0/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A= |
106 | github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= | 109 | github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= |
110 | +github.com/couchbase/gomemcached v0.1.2-0.20201224031647-c432ccf49f32/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= | ||
107 | github.com/couchbase/gomemcached v0.1.3/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= | 111 | github.com/couchbase/gomemcached v0.1.3/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= |
108 | github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= | 112 | github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= |
113 | +github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= | ||
109 | github.com/couchbase/goutils v0.1.0/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= | 114 | github.com/couchbase/goutils v0.1.0/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= |
110 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | 115 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= |
111 | github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= | 116 | github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= |
@@ -505,6 +510,7 @@ github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgq | @@ -505,6 +510,7 @@ github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgq | ||
505 | github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= | 510 | github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= |
506 | github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= | 511 | github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= |
507 | github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= | 512 | github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= |
513 | +github.com/wendal/errors v0.0.0-20181209125328-7f31f4b264ec/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= | ||
508 | github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= | 514 | github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= |
509 | github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= | 515 | github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= |
510 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= | 516 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= |
@@ -566,6 +572,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U | @@ -566,6 +572,7 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U | ||
566 | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | 572 | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= |
567 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | 573 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= |
568 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | 574 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= |
575 | +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||
569 | golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | 576 | golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= |
570 | golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= | 577 | golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= |
571 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | 578 | golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= |
@@ -2,5 +2,5 @@ package command | @@ -2,5 +2,5 @@ package command | ||
2 | 2 | ||
3 | type LoginCommand struct { | 3 | type LoginCommand struct { |
4 | Code string `json:"code" valid:"Required"` //授权code | 4 | Code string `json:"code" valid:"Required"` //授权code |
5 | - PlatformId int `json:"platformId" valid:"Required"` //登录平台ID,28-绩效管理后台 29-员工绩效 | 5 | + PlatformId int `json:"platformId" valid:"Required"` //登录平台ID,constant.IdPlatformAdmin=28 绩效管理后台 constant.IdPlatformUser=29 员工绩效 |
6 | } | 6 | } |
pkg/application/auth/command/mobile_login.go
0 → 100644
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "reflect" | ||
6 | + "strings" | ||
7 | + | ||
8 | + "github.com/beego/beego/validation" | ||
9 | +) | ||
10 | + | ||
11 | +type MobileLoginCommand struct { | ||
12 | + Credentials string `json:"credentials" valid:"Required;"` //登录凭证 | ||
13 | + Cuid int `json:"cuid,string" valid:"Required;"` //统一用户中心用户 UID | ||
14 | + Cid int `json:"cid,string" valid:"Required;"` //统一用户中心公司 ID | ||
15 | + Muid int `json:"muid,string" valid:"Required;"` //企业平台中的用户 UID | ||
16 | + //ClientId string `json:"clientId"` //客户端密钥 | ||
17 | +} | ||
18 | + | ||
19 | +func (authorizeCommand *MobileLoginCommand) Valid(validation *validation.Validation) { | ||
20 | + | ||
21 | +} | ||
22 | + | ||
23 | +func (authorizeCommand *MobileLoginCommand) ValidateCommand() error { | ||
24 | + valid := validation.Validation{} | ||
25 | + b, err := valid.Valid(authorizeCommand) | ||
26 | + if err != nil { | ||
27 | + return err | ||
28 | + } | ||
29 | + if !b { | ||
30 | + elem := reflect.TypeOf(authorizeCommand).Elem() | ||
31 | + for _, validErr := range valid.Errors { | ||
32 | + field, isExist := elem.FieldByName(validErr.Field) | ||
33 | + if isExist { | ||
34 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
35 | + } else { | ||
36 | + return fmt.Errorf(validErr.Message) | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | + return nil | ||
41 | +} |
@@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
4 | "github.com/linmadan/egglib-go/core/application" | 4 | "github.com/linmadan/egglib-go/core/application" |
5 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/command" | 5 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/command" |
6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
8 | ) | 9 | ) |
9 | 10 | ||
@@ -53,18 +54,19 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface | @@ -53,18 +54,19 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface | ||
53 | "companyId": company.Id, | 54 | "companyId": company.Id, |
54 | }) | 55 | }) |
55 | if err != nil { | 56 | if err != nil { |
56 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司数据失败") | 57 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户数据失败") |
57 | } | 58 | } |
58 | if user.Status != domain.UserStatusEnable { | 59 | if user.Status != domain.UserStatusEnable { |
59 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用") | 60 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用") |
60 | } | 61 | } |
61 | userAuth := &domain.UserAuth{ | 62 | userAuth := &domain.UserAuth{ |
62 | - UserId: user.Id, | ||
63 | - CompanyId: user.CompanyId, | ||
64 | - Phone: user.Account, | ||
65 | - PlatformId: loginCommand.PlatformId, | ||
66 | - Name: user.Name, | ||
67 | - AdminType: user.AdminType, | 63 | + UserId: user.Id, |
64 | + CompanyId: user.CompanyId, | ||
65 | + CompanyName: company.Name, | ||
66 | + Phone: user.Account, | ||
67 | + PlatformId: loginCommand.PlatformId, | ||
68 | + Name: user.Name, | ||
69 | + AdminType: user.AdminType, | ||
68 | } | 70 | } |
69 | accessToken, err := userAuth.CreateAccessToken() | 71 | accessToken, err := userAuth.CreateAccessToken() |
70 | if err != nil { | 72 | if err != nil { |
@@ -80,3 +82,77 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface | @@ -80,3 +82,77 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface | ||
80 | }, | 82 | }, |
81 | }, nil | 83 | }, nil |
82 | } | 84 | } |
85 | + | ||
86 | +// 员工绩效 手机端登录,来源于能力展示app | ||
87 | +func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[string]interface{}, error) { | ||
88 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
89 | + if err != nil { | ||
90 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
91 | + } | ||
92 | + if errStart := transactionContext.StartTransaction(); errStart != nil { | ||
93 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, errStart.Error()) | ||
94 | + } | ||
95 | + defer func() { | ||
96 | + _ = transactionContext.RollbackTransaction() | ||
97 | + }() | ||
98 | + // 统一用户中心登录 | ||
99 | + authCodeReply, err := factory.UCenterApi().AppAuthCode(param.Credentials, param.Cuid, param.Cid) | ||
100 | + if err != nil || !authCodeReply.IsOk() { | ||
101 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统一用户中心认证失败") | ||
102 | + } | ||
103 | + // 用户权限校验 | ||
104 | + // 登录平台ID,28-绩效管理后台 29-员工绩效 | ||
105 | + userAuthReply, err := factory.BusinessAdminApi().GetUserAuth(int64(param.Muid), constant.IdPlatformUser) | ||
106 | + if err != nil { | ||
107 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户鉴权失败") | ||
108 | + } | ||
109 | + if !userAuthReply.IsOk() { | ||
110 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, userAuthReply.Message()) | ||
111 | + } | ||
112 | + //获取公司数据 | ||
113 | + companyRepository := factory.CreateCompanyRepository(map[string]interface{}{ | ||
114 | + "transactionContext": transactionContext, | ||
115 | + }) | ||
116 | + company, err := companyRepository.FindOne(map[string]interface{}{ | ||
117 | + "id": param.Cid, | ||
118 | + }) | ||
119 | + if err != nil { | ||
120 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取公司数据失败") | ||
121 | + } | ||
122 | + userRepository := factory.CreateUserRepository(map[string]interface{}{ | ||
123 | + "transactionContext": transactionContext, | ||
124 | + }) | ||
125 | + user, err := userRepository.FindOne(map[string]interface{}{ | ||
126 | + "id": param.Muid, | ||
127 | + "companyId": company.Id, | ||
128 | + }) | ||
129 | + if err != nil { | ||
130 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户数据失败") | ||
131 | + } | ||
132 | + if user.Status != domain.UserStatusEnable { | ||
133 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用") | ||
134 | + } | ||
135 | + userAuth := &domain.UserAuth{ | ||
136 | + UserId: user.Id, | ||
137 | + CompanyId: user.CompanyId, | ||
138 | + CompanyName: company.Name, | ||
139 | + Phone: user.Account, | ||
140 | + PlatformId: constant.IdPlatformUser, | ||
141 | + Name: user.Name, | ||
142 | + AdminType: user.AdminType, | ||
143 | + } | ||
144 | + accessToken, err := userAuth.CreateAccessToken() | ||
145 | + if err != nil { | ||
146 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
147 | + } | ||
148 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
149 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
150 | + } | ||
151 | + result := map[string]interface{}{ | ||
152 | + "access": map[string]interface{}{ | ||
153 | + "accessToken": accessToken, | ||
154 | + "expiresIn": domain.JWTExpiresSecond, | ||
155 | + }, | ||
156 | + } | ||
157 | + return result, nil | ||
158 | +} |
@@ -9,16 +9,17 @@ type AssessInfoResp struct { | @@ -9,16 +9,17 @@ type AssessInfoResp struct { | ||
9 | CycleName string `json:"cycleName"` //周期名称 | 9 | CycleName string `json:"cycleName"` //周期名称 |
10 | EvaluationProjectId int `json:"evaluationProjectId"` //项目id | 10 | EvaluationProjectId int `json:"evaluationProjectId"` //项目id |
11 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | 11 | EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 |
12 | - LinkNodeId int `json:"linkNodeId,string"` | ||
13 | - LinkNodeName string `json:"linkNodeName"` | ||
14 | - BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | ||
15 | - EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | ||
16 | - Status string `json:"status"` //完成状态 | ||
17 | - TargetUserId int `json:"targetUserId,string"` //目标用户 | ||
18 | - TargetUserName string `json:"targetUserName"` //目标用户名称 | ||
19 | - CompanyId int `json:"companyId,string,"` // | ||
20 | - CompanyName string `json:"companyName"` //公司名称 | ||
21 | - SupperUser string `json:"superUser"` //目标用户的上级 | ||
22 | - DutyTime string `json:"dutyTime"` //入职时间 // | ||
23 | - AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 | 12 | + LinkNodeId int `json:"linkNodeId,string"` //评估环节id |
13 | + LinkNodeName string `json:"linkNodeName"` //评估环节名称 | ||
14 | + BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | ||
15 | + EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | ||
16 | + Status string `json:"status"` //完成状态 | ||
17 | + TargetUserId int `json:"targetUserId,string"` //目标用户 | ||
18 | + TargetUserName string `json:"targetUserName"` //目标用户名称 | ||
19 | + CompanyId int `json:"companyId,string,"` //公司id | ||
20 | + CompanyLogo string `json:"companyLogo,string,"` //公司logo | ||
21 | + CompanyName string `json:"companyName"` //公司名称 | ||
22 | + SupperUser string `json:"superUser"` //目标用户的上级 | ||
23 | + DutyTime string `json:"dutyTime"` //入职时间 // | ||
24 | + AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 | ||
24 | } | 25 | } |
@@ -12,6 +12,7 @@ type AssessSelfList struct { | @@ -12,6 +12,7 @@ type AssessSelfList struct { | ||
12 | 12 | ||
13 | type StaffInfo struct { | 13 | type StaffInfo struct { |
14 | UserName string `json:"userName"` //员工名称 | 14 | UserName string `json:"userName"` //员工名称 |
15 | + CompanyLogo string `json:"companyLogo"` //公司logo | ||
15 | CompanyName string `json:"companyName"` //公司名称 | 16 | CompanyName string `json:"companyName"` //公司名称 |
16 | SupperUserName string `json:"supperUserName"` //上级名称 | 17 | SupperUserName string `json:"supperUserName"` //上级名称 |
17 | DutyTime string `json:"dutyTime"` //上岗时间 | 18 | DutyTime string `json:"dutyTime"` //上岗时间 |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type ListSupperAssessResp struct { | 3 | type ListSupperAssessResp struct { |
4 | - StaffAssessTaskId int `json:"staffAssessTaskId"` | ||
5 | - AssessId int `json:"assessId"` // | ||
6 | - CycleId int `json:"cycleId"` //周期id | ||
7 | - BeginDay string `json:"beginDay"` //开始的日期 | ||
8 | - UserId int `json:"userId,string"` //用户id | ||
9 | - UserName string `json:"userName"` //用户名称 | ||
10 | - EndTime string `json:"endTime"` //截止时间 | ||
11 | - InviteTotal int `json:"inviteTota"` //邀请总数 | ||
12 | - InviteCompleted int `json:"inviteCompleted"` //邀请未完成 | ||
13 | - Status string `json:"status"` //评估任务是否填写完成 | ||
14 | - Department string `json:"department"` //部门 | ||
15 | - Position string `json:"position"` //职位 | ||
16 | - DutyTime string `json:"dutyTime"` //入职时间 | 4 | + StaffAssessTaskId int `json:"staffAssessTaskId"` |
5 | + AssessId int `json:"assessId"` // | ||
6 | + CycleId int `json:"cycleId"` //周期id | ||
7 | + BeginDay string `json:"beginDay"` //开始的日期 | ||
8 | + UserId int `json:"userId,string"` //用户id | ||
9 | + UserName string `json:"userName"` //用户名称 | ||
10 | + EndTime string `json:"endTime"` //截止时间 | ||
11 | + InviteTotal int `json:"inviteTota"` //邀请总数 | ||
12 | + InviteCompleted int `json:"inviteCompleted"` //邀请未完成 | ||
13 | + Status string `json:"status"` //评估任务是否填写完成 | ||
14 | + Department string `json:"department"` //部门 | ||
15 | + Position string `json:"position"` //职位 | ||
16 | + CompanyName string `json:"companyName"` //公司名称 | ||
17 | + DutyTime string `json:"dutyTime"` //入职时间 | ||
18 | + ContentValue []string `json:"contentValue"` //评估填写的结果 | ||
17 | } | 19 | } |
1 | package adapter | 1 | package adapter |
2 | 2 | ||
3 | type SelectInviteUser struct { | 3 | type SelectInviteUser struct { |
4 | - UserId int `json:"userId,string"` | ||
5 | - UserName string `json:"userName"` // | ||
6 | - IsSupper bool `json:"isSupper"` // 是否,是直属上级 | ||
7 | - Types int `json:"types"` // 1:相同上级的同事 2:不相同上级的同事 | 4 | + UserId int `json:"userId,string"` |
5 | + UserName string `json:"userName"` // | ||
6 | + CompanyName string `json:"companyName"` // | ||
7 | + IsSupper bool `json:"isSupper"` // 是否,是直属上级 | ||
8 | + Types int `json:"types"` // 1:相同上级的同事 2:不相同上级的同事 | ||
8 | } | 9 | } |
@@ -121,7 +121,7 @@ func (e *exportData) setData(param []*dao.ExportData2) { | @@ -121,7 +121,7 @@ func (e *exportData) setData(param []*dao.ExportData2) { | ||
121 | e.data[key] = &strings.Builder{} | 121 | e.data[key] = &strings.Builder{} |
122 | e.data[key].WriteString(v.Value + "\n") //填写的等级 | 122 | e.data[key].WriteString(v.Value + "\n") //填写的等级 |
123 | for _, vv := range v.Remark { | 123 | for _, vv := range v.Remark { |
124 | - e.data[key].WriteString(vv.Definition + "\n") | 124 | + e.data[key].WriteString(vv.Title + "\n") |
125 | e.data[key].WriteString(vv.RemarkText + "\n") | 125 | e.data[key].WriteString(vv.RemarkText + "\n") |
126 | } | 126 | } |
127 | if _, ok := userDay[userName+v.BeginDay]; !ok { | 127 | if _, ok := userDay[userName+v.BeginDay]; !ok { |
@@ -203,7 +203,7 @@ func (e *exportData2) setData(param []dao.ExportData1) { | @@ -203,7 +203,7 @@ func (e *exportData2) setData(param []dao.ExportData1) { | ||
203 | e.data[key] = &strings.Builder{} | 203 | e.data[key] = &strings.Builder{} |
204 | e.data[key].WriteString(v.Value + "\n") | 204 | e.data[key].WriteString(v.Value + "\n") |
205 | for _, v2 := range v.Remark { | 205 | for _, v2 := range v.Remark { |
206 | - e.data[key].WriteString(v2.Definition + "\n") | 206 | + e.data[key].WriteString(v2.Title + "\n") |
207 | e.data[key].WriteString(v2.RemarkText + "\n") | 207 | e.data[key].WriteString(v2.RemarkText + "\n") |
208 | } | 208 | } |
209 | } | 209 | } |
@@ -1121,6 +1121,13 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI | @@ -1121,6 +1121,13 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI | ||
1121 | userRepo := factory.CreateUserRepository(map[string]interface{}{ | 1121 | userRepo := factory.CreateUserRepository(map[string]interface{}{ |
1122 | "transactionContext": transactionContext, | 1122 | "transactionContext": transactionContext, |
1123 | }) | 1123 | }) |
1124 | + //获取公司信息 | ||
1125 | + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{ | ||
1126 | + "transactionContext": transactionContext, | ||
1127 | + }) | ||
1128 | + companyInfo, _ := companyRepo.FindOne(map[string]interface{}{ | ||
1129 | + "id": param.CompanyId, | ||
1130 | + }) | ||
1124 | targetUser, err := userRepo.FindOne(map[string]interface{}{ | 1131 | targetUser, err := userRepo.FindOne(map[string]interface{}{ |
1125 | "id": param.TargetUserId, | 1132 | "id": param.TargetUserId, |
1126 | }) | 1133 | }) |
@@ -1174,12 +1181,17 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI | @@ -1174,12 +1181,17 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI | ||
1174 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1181 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
1175 | } | 1182 | } |
1176 | listData := []adapter.SelectInviteUser{} | 1183 | listData := []adapter.SelectInviteUser{} |
1184 | + companyName := "" | ||
1185 | + if companyInfo != nil { | ||
1186 | + companyName = companyInfo.Name | ||
1187 | + } | ||
1177 | for _, v := range userList { | 1188 | for _, v := range userList { |
1178 | item := adapter.SelectInviteUser{ | 1189 | item := adapter.SelectInviteUser{ |
1179 | - UserId: int(v.Id), | ||
1180 | - UserName: v.Name, | ||
1181 | - IsSupper: false, | ||
1182 | - Types: 2, //默认是不同上级 | 1190 | + UserId: int(v.Id), |
1191 | + UserName: v.Name, | ||
1192 | + CompanyName: companyName, | ||
1193 | + IsSupper: false, | ||
1194 | + Types: 2, //默认是不同上级 | ||
1183 | } | 1195 | } |
1184 | if _, ok := targetUserCharge[v.Id]; ok { | 1196 | if _, ok := targetUserCharge[v.Id]; ok { |
1185 | item.IsSupper = true | 1197 | item.IsSupper = true |
@@ -1598,6 +1610,7 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada | @@ -1598,6 +1610,7 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada | ||
1598 | if targetUserDesc != nil { | 1610 | if targetUserDesc != nil { |
1599 | result.CompanyName = targetUserDesc.CompanyName | 1611 | result.CompanyName = targetUserDesc.CompanyName |
1600 | result.SupperUser = targetUserDesc.SupperUserName | 1612 | result.SupperUser = targetUserDesc.SupperUserName |
1613 | + result.CompanyLogo = targetUserDesc.CompanyLogo | ||
1601 | result.DutyTime = targetUserDesc.DutyTime | 1614 | result.DutyTime = targetUserDesc.DutyTime |
1602 | } | 1615 | } |
1603 | return &result, nil | 1616 | return &result, nil |
@@ -1628,40 +1641,11 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | @@ -1628,40 +1641,11 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | ||
1628 | log.Logger.Error("获取公司信息," + err.Error()) | 1641 | log.Logger.Error("获取公司信息," + err.Error()) |
1629 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error()) | 1642 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取公司信息,"+err.Error()) |
1630 | } | 1643 | } |
1631 | - // departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ | ||
1632 | - // "transactionContext": transactionContext, | ||
1633 | - // }) | ||
1634 | - // //查找员工的部门 | ||
1635 | - // var departmentList []*domain.Department | ||
1636 | - // if len(userData.DepartmentId) > 0 { | ||
1637 | - | ||
1638 | - // } | ||
1639 | - | ||
1640 | - // var supperUserList []*domain.User | ||
1641 | - // if len(userData.DepartmentId) > 0 { | ||
1642 | - // _, departmentList, err := departmentRepo.Find(map[string]interface{}{ | ||
1643 | - // "ids": userData.DepartmentId, | ||
1644 | - // }) | ||
1645 | - // if err != nil { | ||
1646 | - // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error()) | ||
1647 | - // } | ||
1648 | - // var chargeUserIds []int64 | ||
1649 | - // for _, v := range departmentList { | ||
1650 | - // chargeUserIds = append(chargeUserIds, v.ChargeUserIds...) | ||
1651 | - // } | ||
1652 | - // if len(chargeUserIds) > 0 { | ||
1653 | - // _, supperUserList, err = userRepo.Find(map[string]interface{}{ | ||
1654 | - // "ids": chargeUserIds, | ||
1655 | - // }) | ||
1656 | - // if err != nil { | ||
1657 | - // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error()) | ||
1658 | - // } | ||
1659 | - // } | ||
1660 | - // } | ||
1661 | supperUserList, _ := srv.getStaffSuper(transactionContext, *userData) | 1644 | supperUserList, _ := srv.getStaffSuper(transactionContext, *userData) |
1662 | userInfo := adapter.StaffInfo{ | 1645 | userInfo := adapter.StaffInfo{ |
1663 | UserName: userData.Name, | 1646 | UserName: userData.Name, |
1664 | CompanyName: companyData.Name, | 1647 | CompanyName: companyData.Name, |
1648 | + CompanyLogo: companyData.Logo, | ||
1665 | SupperUserName: "", | 1649 | SupperUserName: "", |
1666 | DutyTime: userData.EntryTime, | 1650 | DutyTime: userData.EntryTime, |
1667 | } | 1651 | } |
@@ -1739,9 +1723,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1739,9 +1723,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1739 | if !ok { | 1723 | if !ok { |
1740 | continue | 1724 | continue |
1741 | } | 1725 | } |
1726 | + if v.Required == domain.NodeRequiredYes && len(item.Value) == 0 { | ||
1727 | + return nil, application.ThrowError(application.BUSINESS_ERROR, v.Category+"-"+v.Name+":必填项") | ||
1728 | + } | ||
1742 | v.Value = item.Value | 1729 | v.Value = item.Value |
1743 | - if v.Required == domain.NodeRequiredYes { | ||
1744 | - //转换填入的评估值 | 1730 | + if len(item.Value) > 0 { |
1731 | + // 转换填入的评估值 | ||
1745 | err = v.TransformValue() | 1732 | err = v.TransformValue() |
1746 | if err != nil { | 1733 | if err != nil { |
1747 | return nil, application.ThrowError(application.BUSINESS_ERROR, v.Category+"-"+v.Name+":"+err.Error()) | 1734 | return nil, application.ThrowError(application.BUSINESS_ERROR, v.Category+"-"+v.Name+":"+err.Error()) |
@@ -1822,7 +1809,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | @@ -1822,7 +1809,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma | ||
1822 | // return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil | 1809 | // return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil |
1823 | // } | 1810 | // } |
1824 | 1811 | ||
1825 | -// 获取员工的上级是谁 ,TODO | 1812 | +// 获取员工的上级是谁 |
1826 | func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) { | 1813 | func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) { |
1827 | departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ | 1814 | departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ |
1828 | "transactionContext": transactionContext, | 1815 | "transactionContext": transactionContext, |
@@ -14,7 +14,7 @@ import ( | @@ -14,7 +14,7 @@ import ( | ||
14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" | 14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" |
15 | ) | 15 | ) |
16 | 16 | ||
17 | -//获取我的项目周期列表 | 17 | +// 获取我的项目周期列表 |
18 | func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQuery) (map[string]interface{}, error) { | 18 | func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQuery) (map[string]interface{}, error) { |
19 | transactionContext, err := factory.CreateTransactionContext(nil) | 19 | transactionContext, err := factory.CreateTransactionContext(nil) |
20 | if err != nil { | 20 | if err != nil { |
@@ -63,7 +63,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | @@ -63,7 +63,7 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ | ||
63 | return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil | 63 | return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil |
64 | } | 64 | } |
65 | 65 | ||
66 | -//获取我的项目周期进度描述 | 66 | +// 获取我的项目周期进度描述 |
67 | func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Query) (*adapter.AssessCycleDescResp, error) { | 67 | func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Query) (*adapter.AssessCycleDescResp, error) { |
68 | transactionContext, err := factory.CreateTransactionContext(nil) | 68 | transactionContext, err := factory.CreateTransactionContext(nil) |
69 | if err != nil { | 69 | if err != nil { |
@@ -218,7 +218,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que | @@ -218,7 +218,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que | ||
218 | return &result, nil | 218 | return &result, nil |
219 | } | 219 | } |
220 | 220 | ||
221 | -//根据周期获取,我的自评任务添加的邀请人 | 221 | +// 根据周期获取,我的自评任务添加的邀请人 |
222 | func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUserQuery) (*adapter.AssessInviteUserResp, error) { | 222 | func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUserQuery) (*adapter.AssessInviteUserResp, error) { |
223 | transactionContext, err := factory.CreateTransactionContext(nil) | 223 | transactionContext, err := factory.CreateTransactionContext(nil) |
224 | if err != nil { | 224 | if err != nil { |
@@ -234,7 +234,12 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUse | @@ -234,7 +234,12 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUse | ||
234 | assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | 234 | assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ |
235 | "transactionContext": transactionContext, | 235 | "transactionContext": transactionContext, |
236 | }) | 236 | }) |
237 | - | 237 | + companyReps := factory.CreateCompanyRepository(map[string]interface{}{ |
238 | + "transactionContext": transactionContext, | ||
239 | + }) | ||
240 | + companyInfo, _ := companyReps.FindOne(map[string]interface{}{ | ||
241 | + "id": param.CompanyId, | ||
242 | + }) | ||
238 | assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ | 243 | assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ |
239 | "transactionContext": transactionContext, | 244 | "transactionContext": transactionContext, |
240 | }) | 245 | }) |
@@ -281,11 +286,17 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUse | @@ -281,11 +286,17 @@ func (srv StaffAssessServeice) ListAssessInviteUserV2(param *query.ListInviteUse | ||
281 | result.EndTime = v.EndTime.Local().Format("2006-01-02 15:04:05") | 286 | result.EndTime = v.EndTime.Local().Format("2006-01-02 15:04:05") |
282 | break | 287 | break |
283 | } | 288 | } |
289 | + companyName := "" | ||
290 | + if companyInfo != nil { | ||
291 | + companyName = companyInfo.Name | ||
292 | + } | ||
284 | for _, v := range assessList { | 293 | for _, v := range assessList { |
285 | if v.Types == domain.AssessInviteDiffSuper { | 294 | if v.Types == domain.AssessInviteDiffSuper { |
295 | + v.Executor.CompanyName = companyName | ||
286 | result.InviteDiffSuper = append(result.InviteDiffSuper, v.Executor) | 296 | result.InviteDiffSuper = append(result.InviteDiffSuper, v.Executor) |
287 | } | 297 | } |
288 | if v.Types == domain.AssessInviteSameSuper { | 298 | if v.Types == domain.AssessInviteSameSuper { |
299 | + v.Executor.CompanyName = companyName | ||
289 | result.InviteSameSuper = append(result.InviteSameSuper, v.Executor) | 300 | result.InviteSameSuper = append(result.InviteSameSuper, v.Executor) |
290 | } | 301 | } |
291 | } | 302 | } |
@@ -309,7 +320,12 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | @@ -309,7 +320,12 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | ||
309 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ | 320 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ |
310 | "transactionContext": transactionContext, | 321 | "transactionContext": transactionContext, |
311 | }) | 322 | }) |
312 | - | 323 | + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{ |
324 | + "transactionContext": transactionContext, | ||
325 | + }) | ||
326 | + companyInfo, _ := companyRepo.FindOne(map[string]interface{}{ | ||
327 | + "id": param.CompanyId, | ||
328 | + }) | ||
313 | //获取 executorId 对应的360评估任务 用户 | 329 | //获取 executorId 对应的360评估任务 用户 |
314 | condition := map[string]interface{}{ | 330 | condition := map[string]interface{}{ |
315 | "beginDay": param.BeginDay, | 331 | "beginDay": param.BeginDay, |
@@ -412,6 +428,10 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | @@ -412,6 +428,10 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | ||
412 | } | 428 | } |
413 | tableHeader = append(tableHeader, changeableHeader...) | 429 | tableHeader = append(tableHeader, changeableHeader...) |
414 | listData := []map[string]interface{}{} | 430 | listData := []map[string]interface{}{} |
431 | + companyName := "" | ||
432 | + if companyInfo != nil { | ||
433 | + companyName = companyInfo.Name | ||
434 | + } | ||
415 | for _, v := range assessList { | 435 | for _, v := range assessList { |
416 | m := map[string]interface{}{ | 436 | m := map[string]interface{}{ |
417 | "staffAssessTaskId": v.StaffAssessTaskId, | 437 | "staffAssessTaskId": v.StaffAssessTaskId, |
@@ -423,6 +443,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | @@ -423,6 +443,7 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu | ||
423 | "types": string(v.Types), | 443 | "types": string(v.Types), |
424 | "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), | 444 | "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), |
425 | "assessId": strconv.Itoa(v.Id), | 445 | "assessId": strconv.Itoa(v.Id), |
446 | + "companyName": companyName, | ||
426 | } | 447 | } |
427 | switch v.Status { | 448 | switch v.Status { |
428 | case domain.StaffAssessCompleted: | 449 | case domain.StaffAssessCompleted: |
@@ -478,6 +499,14 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -478,6 +499,14 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
478 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ | 499 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ |
479 | "transactionContext": transactionContext, | 500 | "transactionContext": transactionContext, |
480 | }) | 501 | }) |
502 | + //公司存储 | ||
503 | + companyRepo := factory.CreateCompanyRepository(map[string]interface{}{ | ||
504 | + "transactionContext": transactionContext, | ||
505 | + }) | ||
506 | + | ||
507 | + companyInfo, _ := companyRepo.FindOne(map[string]interface{}{ | ||
508 | + "id": param.CompanyId, | ||
509 | + }) | ||
481 | 510 | ||
482 | limit := 20 | 511 | limit := 20 |
483 | if param.PageSize > 0 { | 512 | if param.PageSize > 0 { |
@@ -502,6 +531,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -502,6 +531,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
502 | if err != nil { | 531 | if err != nil { |
503 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 532 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
504 | } | 533 | } |
534 | + | ||
505 | //获取目标用户 | 535 | //获取目标用户 |
506 | userIds := []int{} | 536 | userIds := []int{} |
507 | for _, v := range assessList { | 537 | for _, v := range assessList { |
@@ -556,10 +586,20 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -556,10 +586,20 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
556 | if err != nil { | 586 | if err != nil { |
557 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) | 587 | return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) |
558 | } | 588 | } |
589 | + var allAssessId []int | ||
590 | + for _, v := range assessList { | ||
591 | + allAssessId = append(allAssessId, v.Id) | ||
592 | + } | ||
593 | + | ||
594 | + assessValueMap := d.SearchContentValueByAssessId(allAssessId) | ||
595 | + | ||
559 | if err := transactionContext.CommitTransaction(); err != nil { | 596 | if err := transactionContext.CommitTransaction(); err != nil { |
560 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 597 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
561 | } | 598 | } |
562 | - | 599 | + companyName := "" |
600 | + if companyInfo != nil { | ||
601 | + companyName = companyInfo.Name | ||
602 | + } | ||
563 | resultList := []adapter.ListSupperAssessResp{} | 603 | resultList := []adapter.ListSupperAssessResp{} |
564 | for _, v := range assessList { | 604 | for _, v := range assessList { |
565 | item := adapter.ListSupperAssessResp{ | 605 | item := adapter.ListSupperAssessResp{ |
@@ -575,7 +615,12 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | @@ -575,7 +615,12 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu | ||
575 | InviteTotal: 5, | 615 | InviteTotal: 5, |
576 | Department: "", | 616 | Department: "", |
577 | Position: "", | 617 | Position: "", |
618 | + CompanyName: companyName, | ||
578 | DutyTime: "", | 619 | DutyTime: "", |
620 | + ContentValue: []string{}, | ||
621 | + } | ||
622 | + if values, ok := assessValueMap[v.Id]; ok { | ||
623 | + item.ContentValue = values | ||
579 | } | 624 | } |
580 | //填入部门 | 625 | //填入部门 |
581 | for _, vv := range v.TargetDepartment { | 626 | for _, vv := range v.TargetDepartment { |
@@ -690,19 +735,21 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | @@ -690,19 +735,21 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | ||
690 | TargetUserName: assessData.TargetUser.UserName, | 735 | TargetUserName: assessData.TargetUser.UserName, |
691 | CompanyId: assessData.CompanyId, | 736 | CompanyId: assessData.CompanyId, |
692 | CompanyName: "", | 737 | CompanyName: "", |
738 | + CompanyLogo: "", | ||
693 | SupperUser: "", | 739 | SupperUser: "", |
694 | DutyTime: "", | 740 | DutyTime: "", |
695 | AssessContent: assessContentList, | 741 | AssessContent: assessContentList, |
696 | } | 742 | } |
697 | if staffDesc != nil { | 743 | if staffDesc != nil { |
698 | result.CompanyName = staffDesc.CompanyName | 744 | result.CompanyName = staffDesc.CompanyName |
745 | + result.CompanyLogo = staffDesc.CompanyLogo | ||
699 | result.SupperUser = staffDesc.SupperUserName | 746 | result.SupperUser = staffDesc.SupperUserName |
700 | result.DutyTime = staffDesc.DutyTime | 747 | result.DutyTime = staffDesc.DutyTime |
701 | } | 748 | } |
702 | return &result, nil | 749 | return &result, nil |
703 | } | 750 | } |
704 | 751 | ||
705 | -//根据周期和日期。获取360评估的列表,员工的被其他人评估 | 752 | +// 根据周期和日期。获取360评估的列表,员工的被其他人评估 |
706 | func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { | 753 | func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { |
707 | 754 | ||
708 | transactionContext, err := factory.CreateTransactionContext(nil) | 755 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -744,7 +791,7 @@ func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTarge | @@ -744,7 +791,7 @@ func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTarge | ||
744 | return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil | 791 | return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil |
745 | } | 792 | } |
746 | 793 | ||
747 | -//根据周期和日期。获取上级评估的列表,员工的被其他人评估 | 794 | +// 根据周期和日期。获取上级评估的列表,员工的被其他人评估 |
748 | func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { | 795 | func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { |
749 | 796 | ||
750 | transactionContext, err := factory.CreateTransactionContext(nil) | 797 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -774,7 +821,7 @@ func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTarget | @@ -774,7 +821,7 @@ func (srv StaffAssessServeice) ListTargetUserSuperAssess(param *query.ListTarget | ||
774 | if err := transactionContext.CommitTransaction(); err != nil { | 821 | if err := transactionContext.CommitTransaction(); err != nil { |
775 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 822 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
776 | } | 823 | } |
777 | - var resultList []map[string]interface{} | 824 | + resultList := []map[string]interface{}{} |
778 | for _, v := range assessList { | 825 | for _, v := range assessList { |
779 | item := map[string]interface{}{ | 826 | item := map[string]interface{}{ |
780 | "id": v.Id, | 827 | "id": v.Id, |
@@ -4,9 +4,15 @@ import "os" | @@ -4,9 +4,15 @@ import "os" | ||
4 | 4 | ||
5 | const SERVICE_NAME = "performance" | 5 | const SERVICE_NAME = "performance" |
6 | 6 | ||
7 | +// 登录平台ID,28-绩效管理后台 29-员工绩效 | ||
8 | +const ( | ||
9 | + IdPlatformAdmin int = 28 | ||
10 | + IdPlatformUser int = 29 | ||
11 | +) | ||
12 | + | ||
7 | var LOG_LEVEL = "debug" | 13 | var LOG_LEVEL = "debug" |
8 | 14 | ||
9 | -//过期时间 7天时间 | 15 | +// 过期时间 7天时间 |
10 | var AdminJwtExpiresIn = int64(3600 * 24 * 7) | 16 | var AdminJwtExpiresIn = int64(3600 * 24 * 7) |
11 | 17 | ||
12 | var AdminJWTSecretKey = "sg-storage" | 18 | var AdminJWTSecretKey = "sg-storage" |
@@ -4,7 +4,10 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/se | @@ -4,7 +4,10 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/se | ||
4 | 4 | ||
5 | // UCenterApi 统一用户中心 | 5 | // UCenterApi 统一用户中心 |
6 | type UCenterApi interface { | 6 | type UCenterApi interface { |
7 | + // pc 端 | ||
7 | AuthCode(code string) (*reply.UCenterAuthCode, error) | 8 | AuthCode(code string) (*reply.UCenterAuthCode, error) |
9 | + //手机app端 | ||
10 | + AppAuthCode(tokenCode string, uid int, companyId int) (*reply.UCenterAuthCode, error) | ||
8 | } | 11 | } |
9 | 12 | ||
10 | // BusinessAdminApi 企业平台 | 13 | // BusinessAdminApi 企业平台 |
@@ -2,9 +2,10 @@ package domain | @@ -2,9 +2,10 @@ package domain | ||
2 | 2 | ||
3 | //员工基本信息描述 | 3 | //员工基本信息描述 |
4 | type StaffDesc struct { | 4 | type StaffDesc struct { |
5 | - UserId int `json:"userId,string"` //用户id | ||
6 | - Account string `json:"account"` //用户的账号 | ||
7 | - UserName string `json:"userName"` //用户的名称 | 5 | + UserId int `json:"userId,string"` //用户id |
6 | + CompanyName string `json:"companyName"` //公司名称 | ||
7 | + Account string `json:"account"` //用户的账号 | ||
8 | + UserName string `json:"userName"` //用户的名称 | ||
8 | } | 9 | } |
9 | 10 | ||
10 | //员工的部门 | 11 | //员工的部门 |
@@ -2,14 +2,16 @@ package domain | @@ -2,14 +2,16 @@ package domain | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | - "github.com/dgrijalva/jwt-go" | ||
6 | "time" | 5 | "time" |
6 | + | ||
7 | + "github.com/dgrijalva/jwt-go" | ||
7 | ) | 8 | ) |
8 | 9 | ||
9 | type UserAuth struct { | 10 | type UserAuth struct { |
10 | jwt.StandardClaims `json:"-"` | 11 | jwt.StandardClaims `json:"-"` |
11 | UserId int64 `json:"userId"` | 12 | UserId int64 `json:"userId"` |
12 | CompanyId int64 `json:"companyId"` | 13 | CompanyId int64 `json:"companyId"` |
14 | + CompanyName string `json:"companyName"` | ||
13 | Phone string `json:"phone"` | 15 | Phone string `json:"phone"` |
14 | PlatformId int `json:"platformId"` | 16 | PlatformId int `json:"platformId"` |
15 | Name string `json:"name"` | 17 | Name string `json:"name"` |
@@ -1096,14 +1096,15 @@ func (d *StaffAssessDao) CountAssessCycleMe(executorId int, companyId int) (int, | @@ -1096,14 +1096,15 @@ func (d *StaffAssessDao) CountAssessCycleMe(executorId int, companyId int) (int, | ||
1096 | 1096 | ||
1097 | // 评估的指标 | 1097 | // 评估的指标 |
1098 | type ContentCategoryName struct { | 1098 | type ContentCategoryName struct { |
1099 | - Category string //指标分类 | ||
1100 | - Name string //指标名称 | ||
1101 | - Weight float64 //指标权重 | ||
1102 | - CycleId string //周期id | ||
1103 | - CycleName string //周期名称 | ||
1104 | - TargetUserId string //评估的目标员工id | ||
1105 | - TargetUserName string //评估的目标员工名称 | ||
1106 | - Cnt int //排序 | 1099 | + Category string `pg:"category"` //指标分类 |
1100 | + Name string `pg:"name"` //指标名称 | ||
1101 | + Weight float64 `pg:"weight"` //指标权重 | ||
1102 | + CycleId string `pg:"cycle_id"` //周期id | ||
1103 | + CycleName string `pg:"cycle_name"` //周期名称 | ||
1104 | + SortBy int `pg:"sort_by"` // | ||
1105 | + TargetUserId string `pg:"target_user_id"` //评估的目标员工id | ||
1106 | + TargetUserName string `pg:"target_user_name"` //评估的目标员工名称 | ||
1107 | + //Cnt int `pg:"cnt"` //排序 | ||
1107 | } | 1108 | } |
1108 | 1109 | ||
1109 | // 员工绩效-综合管理-导出绩效指标 | 1110 | // 员工绩效-综合管理-导出绩效指标 |
@@ -1114,16 +1115,11 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u | @@ -1114,16 +1115,11 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u | ||
1114 | staff_assess_content.category, | 1115 | staff_assess_content.category, |
1115 | staff_assess_content."name" , | 1116 | staff_assess_content."name" , |
1116 | staff_assess_content.weight , | 1117 | staff_assess_content.weight , |
1118 | + staff_assess_content.sort_by , | ||
1117 | t_staff_assess_1.cycle_id , | 1119 | t_staff_assess_1.cycle_id , |
1118 | t_staff_assess_1.cycle_name, | 1120 | t_staff_assess_1.cycle_name, |
1119 | t_staff_assess_1.target_user_id, | 1121 | t_staff_assess_1.target_user_id, |
1120 | - t_staff_assess_1.target_user_name, | ||
1121 | - sum( | ||
1122 | - case | ||
1123 | - when staff_assess_content.value isnull then 0 | ||
1124 | - when staff_assess_content.value='' then 0 | ||
1125 | - ELSE 1 | ||
1126 | - END) as cnt | 1122 | + t_staff_assess_1.target_user_name |
1127 | from staff_assess_content | 1123 | from staff_assess_content |
1128 | join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id | 1124 | join t_staff_assess_1 on staff_assess_content.staff_assess_id = t_staff_assess_1.assess_id |
1129 | where 1=1 | 1125 | where 1=1 |
@@ -1133,13 +1129,9 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u | @@ -1133,13 +1129,9 @@ func (d *StaffAssessDao) SearchContentCategoryName(companyId int, cycleId int, u | ||
1133 | condition = append(condition, pg.In(exportUserIds)) | 1129 | condition = append(condition, pg.In(exportUserIds)) |
1134 | sqlStr += ` and t_staff_assess_1.target_user_id in(?) ` | 1130 | sqlStr += ` and t_staff_assess_1.target_user_id in(?) ` |
1135 | } | 1131 | } |
1136 | - sqlStr += ` group by staff_assess_content.category, | ||
1137 | - staff_assess_content."name" , | ||
1138 | - t_staff_assess_1.cycle_id , | ||
1139 | - t_staff_assess_1.cycle_name, | ||
1140 | - staff_assess_content.weight , | ||
1141 | - target_user_id,target_user_name | ||
1142 | - order by cnt desc,target_user_id ` | 1132 | + sqlStr += ` group by category,"name" ,cycle_id ,cycle_name,weight , |
1133 | + target_user_id,target_user_name,sort_by | ||
1134 | + order by target_user_id,sort_by ` | ||
1143 | sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf)) | 1135 | sqlStr0 := d.useTStaffAssess(companyId, cycleId, userId, "", hrbp, 5000, 0, string(domain.AssessSelf)) |
1144 | sqlStr = sqlStr0 + sqlStr | 1136 | sqlStr = sqlStr0 + sqlStr |
1145 | tx := d.transactionContext.PgTx | 1137 | tx := d.transactionContext.PgTx |
@@ -1200,3 +1192,37 @@ func (d *StaffAssessDao) ExportDataUserAssess2(companyId int, cycleId int, opera | @@ -1200,3 +1192,37 @@ func (d *StaffAssessDao) ExportDataUserAssess2(companyId int, cycleId int, opera | ||
1200 | _, err := tx.Query(&result, sqlStr, condition...) | 1192 | _, err := tx.Query(&result, sqlStr, condition...) |
1201 | return result, err | 1193 | return result, err |
1202 | } | 1194 | } |
1195 | + | ||
1196 | +type ContentValue struct { | ||
1197 | + StaffAssessId int `pg:"staff_assess_id"` | ||
1198 | + Value string `pg:"value"` | ||
1199 | +} | ||
1200 | + | ||
1201 | +func (d *StaffAssessDao) SearchContentValueByAssessId(assessId []int) map[int][]string { | ||
1202 | + if len(assessId) == 0 { | ||
1203 | + return map[int][]string{} | ||
1204 | + } | ||
1205 | + sqlStr := `select | ||
1206 | + staff_assess_content.staff_assess_id , | ||
1207 | + staff_assess_content.value | ||
1208 | + from staff_assess_content | ||
1209 | + where staff_assess_content.staff_assess_id in (?)` | ||
1210 | + tx := d.transactionContext.PgTx | ||
1211 | + result := []ContentValue{} | ||
1212 | + condition := []interface{}{pg.In(assessId)} | ||
1213 | + _, err := tx.Query(&result, sqlStr, condition...) | ||
1214 | + if err != nil { | ||
1215 | + return map[int][]string{} | ||
1216 | + } | ||
1217 | + valueMap := map[int][]string{} | ||
1218 | + for _, v := range result { | ||
1219 | + if _, ok := valueMap[v.StaffAssessId]; !ok { | ||
1220 | + valueMap[v.StaffAssessId] = []string{} | ||
1221 | + } | ||
1222 | + if len(v.Value) > 0 { | ||
1223 | + valueMap[v.StaffAssessId] = append(valueMap[v.StaffAssessId], v.Value) | ||
1224 | + } | ||
1225 | + } | ||
1226 | + | ||
1227 | + return valueMap | ||
1228 | +} |
@@ -161,7 +161,7 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | @@ -161,7 +161,7 @@ func (repo *StaffAssessRepository) Find(queryOptions map[string]interface{}) (in | ||
161 | if v, ok := queryOptions["beginDay"]; ok { | 161 | if v, ok := queryOptions["beginDay"]; ok { |
162 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) | 162 | query.Where("to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')= ? ", v) |
163 | } | 163 | } |
164 | - query.Order("staff_assess.id") | 164 | + query.Order("staff_assess.id DESC") |
165 | count, err := query.SelectAndCount() | 165 | count, err := query.SelectAndCount() |
166 | if err != nil { | 166 | if err != nil { |
167 | return 0, nil, err | 167 | return 0, nil, err |
@@ -3,11 +3,14 @@ package serviceGateway | @@ -3,11 +3,14 @@ package serviceGateway | ||
3 | import ( | 3 | import ( |
4 | "crypto/sha1" | 4 | "crypto/sha1" |
5 | "fmt" | 5 | "fmt" |
6 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" | ||
7 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/serviceGateway/reply" | ||
8 | "net/http" | 6 | "net/http" |
9 | "net/url" | 7 | "net/url" |
8 | + "strconv" | ||
9 | + "strings" | ||
10 | "time" | 10 | "time" |
11 | + | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" | ||
13 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/serviceGateway/reply" | ||
11 | ) | 14 | ) |
12 | 15 | ||
13 | type HttpLibUCenterApiServiceGateway struct { | 16 | type HttpLibUCenterApiServiceGateway struct { |
@@ -27,7 +30,7 @@ func (serviceGateway *HttpLibUCenterApiServiceGateway) buildHeaders() map[string | @@ -27,7 +30,7 @@ func (serviceGateway *HttpLibUCenterApiServiceGateway) buildHeaders() map[string | ||
27 | } | 30 | } |
28 | } | 31 | } |
29 | 32 | ||
30 | -// AuthCode PC端登录 | 33 | +// AuthCode PC端登录, 为后台单点登录 |
31 | func (serviceGateway *HttpLibUCenterApiServiceGateway) AuthCode(code string) (*reply.UCenterAuthCode, error) { | 34 | func (serviceGateway *HttpLibUCenterApiServiceGateway) AuthCode(code string) (*reply.UCenterAuthCode, error) { |
32 | authCodeReply := &reply.UCenterAuthCode{} | 35 | authCodeReply := &reply.UCenterAuthCode{} |
33 | serviceGateway.CreateRequest(http.MethodPost, "/auth/serverLogin") | 36 | serviceGateway.CreateRequest(http.MethodPost, "/auth/serverLogin") |
@@ -40,6 +43,21 @@ func (serviceGateway *HttpLibUCenterApiServiceGateway) AuthCode(code string) (*r | @@ -40,6 +43,21 @@ func (serviceGateway *HttpLibUCenterApiServiceGateway) AuthCode(code string) (*r | ||
40 | return authCodeReply, err | 43 | return authCodeReply, err |
41 | } | 44 | } |
42 | 45 | ||
46 | +// AuthCode 手机应用端登录, 为token登录,app登录 | ||
47 | +func (serviceGateway *HttpLibUCenterApiServiceGateway) AppAuthCode(tokenCode string, uid int, companyId int) (*reply.UCenterAuthCode, error) { | ||
48 | + authCodeReply := &reply.UCenterAuthCode{} | ||
49 | + serviceGateway.CreateRequest(http.MethodPost, "/auth/serverLogin") | ||
50 | + serviceGateway.SetBody(map[string]interface{}{ | ||
51 | + "type": 2, | ||
52 | + "token": strings.TrimSpace(tokenCode), | ||
53 | + "uid": strconv.Itoa(uid), | ||
54 | + "companyId": strconv.Itoa(companyId), | ||
55 | + }) | ||
56 | + serviceGateway.SetHeaders(serviceGateway.buildHeaders()) | ||
57 | + err := serviceGateway.ToJson(authCodeReply) | ||
58 | + return authCodeReply, err | ||
59 | +} | ||
60 | + | ||
43 | func NewHttpLibUCenterApiServiceGateway() *HttpLibUCenterApiServiceGateway { | 61 | func NewHttpLibUCenterApiServiceGateway() *HttpLibUCenterApiServiceGateway { |
44 | return &HttpLibUCenterApiServiceGateway{ | 62 | return &HttpLibUCenterApiServiceGateway{ |
45 | httpLibBaseServiceGateway{baseURL: constant.UCENTER_SERVICE_HOST}, | 63 | httpLibBaseServiceGateway{baseURL: constant.UCENTER_SERVICE_HOST}, |
@@ -21,9 +21,17 @@ func (controller *AuthController) Login() { | @@ -21,9 +21,17 @@ func (controller *AuthController) Login() { | ||
21 | } | 21 | } |
22 | 22 | ||
23 | func (controller *AuthController) User() { | 23 | func (controller *AuthController) User() { |
24 | - | ||
25 | userAuth := controller.Ctx.Input.GetData(domain.UserAuth{}).(*domain.UserAuth) | 24 | userAuth := controller.Ctx.Input.GetData(domain.UserAuth{}).(*domain.UserAuth) |
26 | controller.Response(map[string]interface{}{ | 25 | controller.Response(map[string]interface{}{ |
27 | "user": userAuth, | 26 | "user": userAuth, |
28 | }, nil) | 27 | }, nil) |
29 | } | 28 | } |
29 | + | ||
30 | +// Login PC端登录 | ||
31 | +func (controller *AuthController) MobileLogin() { | ||
32 | + authService := &service.AuthService{} | ||
33 | + loginCommand := &command.MobileLoginCommand{} | ||
34 | + _ = controller.Unmarshal(loginCommand) | ||
35 | + resp, err := authService.MobileLogin(loginCommand) | ||
36 | + controller.Response(resp, err) | ||
37 | +} |
@@ -47,7 +47,7 @@ func (c *StaffAssessControllerV2) AssessTaskMeDesc() { | @@ -47,7 +47,7 @@ func (c *StaffAssessControllerV2) AssessTaskMeDesc() { | ||
47 | c.Response(data, err) | 47 | c.Response(data, err) |
48 | } | 48 | } |
49 | 49 | ||
50 | -// 获取我要执行360评估,用户列表和评估填写的值 | 50 | +// 获取我要执行的360评估,用户列表和评估填写的值 |
51 | func (c *StaffAssessControllerV2) ListMeInviteUserAssess() { | 51 | func (c *StaffAssessControllerV2) ListMeInviteUserAssess() { |
52 | srv := service.NewStaffAssessServeice() | 52 | srv := service.NewStaffAssessServeice() |
53 | paramReq := &query.ListExecutorAssessQuery{} | 53 | paramReq := &query.ListExecutorAssessQuery{} |
@@ -9,6 +9,8 @@ import ( | @@ -9,6 +9,8 @@ import ( | ||
9 | func init() { | 9 | func init() { |
10 | web.Router("/login", &controllers.AuthController{}, "Post:Login") | 10 | web.Router("/login", &controllers.AuthController{}, "Post:Login") |
11 | 11 | ||
12 | + web.Router("/login/mobile", &controllers.AuthController{}, "Post:MobileLogin") | ||
13 | + // | ||
12 | web.InsertFilter("/auth/admin/*", web.BeforeExec, middlewares.CheckAdminToken()) | 14 | web.InsertFilter("/auth/admin/*", web.BeforeExec, middlewares.CheckAdminToken()) |
13 | web.Router("/auth/admin/user", &controllers.AuthController{}, "Get:User") | 15 | web.Router("/auth/admin/user", &controllers.AuthController{}, "Get:User") |
14 | 16 |
-
请 注册 或 登录 后发表评论