正在显示
4 个修改的文件
包含
89 行增加
和
0 行删除
1 | +package query | ||
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 | +// 共创项目用户查询 | ||
10 | +type CooperationProjectUsersQuery struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // 共创项目ID - 获取项目申请人列表 | ||
14 | + CooperationProjectId int `json:"cooperationProjectId,string"` | ||
15 | +} | ||
16 | + | ||
17 | +func (departmentsUsersQuery *CooperationProjectUsersQuery) Valid(validation *validation.Validation) { | ||
18 | + | ||
19 | +} | ||
20 | + | ||
21 | +func (departmentsUsersQuery *CooperationProjectUsersQuery) ValidateQuery() error { | ||
22 | + valid := validation.Validation{} | ||
23 | + b, err := valid.Valid(departmentsUsersQuery) | ||
24 | + if err != nil { | ||
25 | + return err | ||
26 | + } | ||
27 | + if !b { | ||
28 | + for _, validErr := range valid.Errors { | ||
29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
30 | + } | ||
31 | + } | ||
32 | + return nil | ||
33 | +} |
@@ -3,6 +3,7 @@ package service | @@ -3,6 +3,7 @@ package service | ||
3 | import ( | 3 | import ( |
4 | "crypto/sha1" | 4 | "crypto/sha1" |
5 | "fmt" | 5 | "fmt" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | "strconv" | 7 | "strconv" |
7 | "time" | 8 | "time" |
8 | 9 | ||
@@ -570,3 +571,46 @@ func (usersService *UsersService) GetInitPassword(operator domain.Operator) (str | @@ -570,3 +571,46 @@ func (usersService *UsersService) GetInitPassword(operator domain.Operator) (str | ||
570 | password = fmt.Sprintf("%x", sha1.Sum([]byte(reqResult.Value))) | 571 | password = fmt.Sprintf("%x", sha1.Sum([]byte(reqResult.Value))) |
571 | return password, reqResult.Value, err | 572 | return password, reqResult.Value, err |
572 | } | 573 | } |
574 | + | ||
575 | +// SelectorCooperationProjectUsers 共创项目用户下拉列表 | ||
576 | +func (usersService *UsersService) SelectorCooperationProjectUsers(q *query.CooperationProjectUsersQuery) (interface{}, error) { | ||
577 | + applications := make([]interface{}, 0) | ||
578 | + // 项目申请人 | ||
579 | + if q.CooperationProjectId != 0 { | ||
580 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(q.Operator) | ||
581 | + resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{ | ||
582 | + CooperationProjectId: q.CooperationProjectId, | ||
583 | + }) | ||
584 | + if err != nil { | ||
585 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
586 | + } | ||
587 | + resultApplication, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ | ||
588 | + CooperationProjectNumber: resultProject.CooperationProject.CooperationProjectNumber, | ||
589 | + PageNumber: 0, | ||
590 | + PageSize: 1000, | ||
591 | + CompanyId: resultProject.Company.CompanyId, | ||
592 | + OrgId: int64(resultProject.Org.OrgId), | ||
593 | + CooperationApplicationStatus: 2, //审核通过的 | ||
594 | + }) | ||
595 | + if err != nil { | ||
596 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
597 | + } | ||
598 | + | ||
599 | + for i := range resultApplication.Grid.List { | ||
600 | + item := resultApplication.Grid.List[i] | ||
601 | + user := map[string]interface{}{ | ||
602 | + "userId": item.CooperationApplicationApplicant.UserID, | ||
603 | + "userCode": item.CooperationApplicationApplicant.UserInfo.UserCode, | ||
604 | + "userInfo": map[string]interface{}{ | ||
605 | + "userName": item.CooperationApplicationApplicant.UserInfo.UserName, | ||
606 | + "phone": item.CooperationApplicationApplicant.UserInfo.UserPhone, | ||
607 | + }, | ||
608 | + "department": item.CooperationApplicationApplicant.Department, | ||
609 | + } | ||
610 | + applications = append(applications, user) | ||
611 | + } | ||
612 | + } | ||
613 | + return map[string]interface{}{ | ||
614 | + "applicants": applications, | ||
615 | + }, nil | ||
616 | +} |
@@ -157,3 +157,13 @@ func (controller *UsersController) SelectorCompanyOrgAll() { | @@ -157,3 +157,13 @@ func (controller *UsersController) SelectorCompanyOrgAll() { | ||
157 | _, data, err := usersService.SelectorCompanyOrgAll(selectorQuery) | 157 | _, data, err := usersService.SelectorCompanyOrgAll(selectorQuery) |
158 | controller.Response(data, err) | 158 | controller.Response(data, err) |
159 | } | 159 | } |
160 | + | ||
161 | +//CompanyOrgSelector 全组织部门选择表 | ||
162 | +func (controller *UsersController) SelectorCooperationProjectUsers() { | ||
163 | + usersService := service.NewUsersService(nil) | ||
164 | + selectorQuery := &query.CooperationProjectUsersQuery{} | ||
165 | + controller.Unmarshal(selectorQuery) | ||
166 | + selectorQuery.Operator = controller.GetOperator() | ||
167 | + data, err := usersService.SelectorCooperationProjectUsers(selectorQuery) | ||
168 | + controller.Response(data, err) | ||
169 | +} |
@@ -21,4 +21,6 @@ func init() { | @@ -21,4 +21,6 @@ func init() { | ||
21 | web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg") | 21 | web.Router("/v1/web/users/selector/org", &web_client.UsersController{}, "Post:SelectorCompanyOrg") |
22 | web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole") | 22 | web.Router("/v1/web/users/selector/role", &web_client.UsersController{}, "Post:SelectorCompanyRole") |
23 | web.Router("/v1/web/users/selector/org/all", &web_client.UsersController{}, "Post:SelectorCompanyOrgAll") | 23 | web.Router("/v1/web/users/selector/org/all", &web_client.UsersController{}, "Post:SelectorCompanyOrgAll") |
24 | + | ||
25 | + web.Router("/v1/web/users/selector/cooperation-project-users", &web_client.UsersController{}, "Post:SelectorCooperationProjectUsers") | ||
24 | } | 26 | } |
-
请 注册 或 登录 后发表评论