作者 yangfu

登录修改、共创用户列表修改

  1 +package dto
  2 +
  3 +type UserInfoDto struct {
  4 +}
@@ -441,6 +441,32 @@ func (svr AuthService) ResetPassword(resetPasswordCommand *command.ResetPassword @@ -441,6 +441,32 @@ func (svr AuthService) ResetPassword(resetPasswordCommand *command.ResetPassword
441 func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error) { 441 func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error) {
442 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 442 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
443 operator) 443 operator)
  444 +
  445 + // 个人用户登录
  446 + if operator.UserId == 0 && len(operator.Phone) != 0 {
  447 + resultUser, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
  448 + Account: operator.Phone,
  449 + })
  450 + if err != nil {
  451 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  452 + }
  453 + var user = map[string]interface{}{
  454 + "userId": 0,
  455 + //"userOpenId": fmt.Sprintf("%v",resultUser.UserBaseID),
  456 + "userInfo": map[string]interface{}{
  457 + "userName": resultUser.UserInfo.UserName,
  458 + "userPhone": resultUser.UserInfo.Phone,
  459 + "userAvatar": resultUser.UserInfo.Avatar,
  460 + "email": resultUser.UserInfo.Email,
  461 + },
  462 + "department": struct{}{},
  463 + "company": map[string]interface{}{},
  464 + "im": resultUser.Im,
  465 + "org": struct{}{},
  466 + }
  467 + return user, nil
  468 + }
  469 + // 企业用户登录
444 resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGetUser{ 470 resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGetUser{
445 UserId: int(operator.UserId), 471 UserId: int(operator.UserId),
446 }) 472 })
@@ -455,11 +481,12 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error @@ -455,11 +481,12 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error
455 } 481 }
456 var user = map[string]interface{}{ 482 var user = map[string]interface{}{
457 "userId": resultUser.UserId, 483 "userId": resultUser.UserId,
  484 + //"userOpenId": fmt.Sprintf("%v",resultUser.UserBaseId),
458 "userInfo": map[string]interface{}{ 485 "userInfo": map[string]interface{}{
459 "userName": resultUser.UserInfo.UserName, 486 "userName": resultUser.UserInfo.UserName,
460 "userPhone": resultUser.UserInfo.Phone, 487 "userPhone": resultUser.UserInfo.Phone,
461 "userAvatar": resultUser.UserInfo.Avatar, 488 "userAvatar": resultUser.UserInfo.Avatar,
462 - //"userCode": resultUser.UserInfo.UserCode, 489 + "userCode": resultUser.UserInfo.UserCode,
463 "email": resultUser.UserInfo.Email, 490 "email": resultUser.UserInfo.Email,
464 }, 491 },
465 "department": resultUser.Department, 492 "department": resultUser.Department,
@@ -488,6 +515,7 @@ func (svr AuthService) getToken(loginToken domain.LoginToken) (map[string]interf @@ -488,6 +515,7 @@ func (svr AuthService) getToken(loginToken domain.LoginToken) (map[string]interf
488 userSearchResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ 515 userSearchResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
489 Phone: loginToken.Account, 516 Phone: loginToken.Account,
490 UserType: domain.UserTypeEmployee, 517 UserType: domain.UserTypeEmployee,
  518 + EnableStatus: domain.UserStatusEnable,
491 }) 519 })
492 if err != nil { 520 if err != nil {
493 return nil, application.ThrowError(application.BUSINESS_ERROR, "用户信息获取失败,"+err.Error()) 521 return nil, application.ThrowError(application.BUSINESS_ERROR, "用户信息获取失败,"+err.Error())
@@ -516,9 +544,10 @@ loopUser1: @@ -516,9 +544,10 @@ loopUser1:
516 } 544 }
517 } 545 }
518 } 546 }
519 - if !currentOrgIsOK { 547 + if !currentOrgIsOK && loginToken.Platform == domain.LoginPlatformWeb {
520 return nil, application.ThrowError(application.TRANSACTION_ERROR, "登录的公司组织不可用") 548 return nil, application.ThrowError(application.TRANSACTION_ERROR, "登录的公司组织不可用")
521 } 549 }
  550 + if currentOrgIsOK {
522 loginToken.UserId = int64(currentUser.UserId) 551 loginToken.UserId = int64(currentUser.UserId)
523 loginToken.UserBaseId = int64(currentUser.UserBaseId) 552 loginToken.UserBaseId = int64(currentUser.UserBaseId)
524 loginToken.CompanyId = int64(currentUser.Company.CompanyId) 553 loginToken.CompanyId = int64(currentUser.Company.CompanyId)
@@ -527,6 +556,18 @@ loopUser1: @@ -527,6 +556,18 @@ loopUser1:
527 orgIds = append(orgIds, int64(currentUser.UserOrg[i].OrgID)) 556 orgIds = append(orgIds, int64(currentUser.UserOrg[i].OrgID))
528 } 557 }
529 loginToken.OrgIds = orgIds 558 loginToken.OrgIds = orgIds
  559 + }
  560 +
  561 + // 个人登录
  562 + if len(userSearchResult.Users) == 0 {
  563 + userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{
  564 + Account: loginToken.Account,
  565 + })
  566 + if err != nil {
  567 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "账号不存在")
  568 + }
  569 + loginToken.UserBaseId = int64(userBase.UserBaseID)
  570 + }
530 571
531 // 2. 更新currentAccess信息 572 // 2. 更新currentAccess信息
532 transactionContext, err := factory.CreateTransactionContext(nil) 573 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -11,7 +11,7 @@ type CooperationDividendsStatisticsCommand struct { @@ -11,7 +11,7 @@ type CooperationDividendsStatisticsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 查询偏离量 13 // 查询偏离量
14 - PageNumber int `json:"pageIndex" valid:"Required"` 14 + PageNumber int `json:"pageNumber" valid:"Required"`
15 // 查询限制 15 // 查询限制
16 PageSize int `json:"pageSize" valid:"Required"` 16 PageSize int `json:"pageSize" valid:"Required"`
17 //审核状态 1:正序 2:倒序 17 //审核状态 1:正序 2:倒序
@@ -40,6 +40,8 @@ type CreditAccountItem struct { @@ -40,6 +40,8 @@ type CreditAccountItem struct {
40 DividendsType int `json:"dividendsType"` 40 DividendsType int `json:"dividendsType"`
41 DividendsAmount float64 `json:"dividendsAmount"` 41 DividendsAmount float64 `json:"dividendsAmount"`
42 } `json:"accountDetail"` //结算明细 42 } `json:"accountDetail"` //结算明细
  43 + //备注
  44 + Remarks string `json:"remark"`
43 } 45 }
44 46
45 func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem { 47 func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *CreditAccountItem {
@@ -62,6 +64,7 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred @@ -62,6 +64,7 @@ func ToCreditAccountItem(param *allied_creation_cooperation.CreditAccount) *Cred
62 CreatedAt: param.CreatedAt.Unix() * 1000, // 创建时间 64 CreatedAt: param.CreatedAt.Unix() * 1000, // 创建时间
63 UpdatedAt: param.UpdatedAt.Unix() * 1000, // 更新时间 65 UpdatedAt: param.UpdatedAt.Unix() * 1000, // 更新时间
64 AccountDetail: param.AccountDetail, 66 AccountDetail: param.AccountDetail,
  67 + Remarks: param.Remarks,
65 } 68 }
66 data.Participator.UserInfo.UserName = param.Participator.UserInfo.UsersName 69 data.Participator.UserInfo.UserName = param.Participator.UserInfo.UsersName
67 data.Participator.UserInfo.UserPhone = param.Participator.UserInfo.Phone 70 data.Participator.UserInfo.UserPhone = param.Participator.UserInfo.Phone
@@ -160,6 +160,7 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap @@ -160,6 +160,7 @@ func (srv CooperationApplicationsService) PersonSearchCooperationApplications(ap
160 PageSize: applicationQuery.PageSize, 160 PageSize: applicationQuery.PageSize,
161 CompanyId: int(applicationQuery.Operator.CompanyId), 161 CompanyId: int(applicationQuery.Operator.CompanyId),
162 CooperationApplicationStatus: applicationQuery.Status, 162 CooperationApplicationStatus: applicationQuery.Status,
  163 + UserBaseId: applicationQuery.Operator.UserBaseId,
163 }) 164 })
164 if err != nil { 165 if err != nil {
165 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 166 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
1 package service 1 package service
2 2
3 import ( 3 import (
4 - "fmt"  
5 - "math/rand"  
6 - "time"  
7 -  
8 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
@@ -112,25 +108,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -112,25 +108,8 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
112 }, nil 108 }, nil
113 } 109 }
114 110
115 -// GoodsStatistics TODO:产品统计排行榜 年月榜 111 +// GoodsStatistics 产品统计排行榜 年月榜
116 func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatisticsCommand) (int64, interface{}, error) { 112 func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatisticsCommand) (int64, interface{}, error) {
117 - //type rankItem struct {  
118 - // GoodAmount float64 `json:"goodAmount"`  
119 - // GoodName string `json:"goodName"`  
120 - // GoodRatio float64 `json:"goodRatio"`  
121 - // Rank int `json:"rank"`  
122 - //}  
123 - //var items []rankItem  
124 - //for i := 0; i < 5; i++ {  
125 - // item := rankItem{  
126 - // GoodAmount: 2000,  
127 - // GoodName: fmt.Sprintf("商品%v", rand.Intn(100)),  
128 - // GoodRatio: 20,  
129 - // Rank: i + 1,  
130 - // }  
131 - // items = append(items, item)  
132 - //}  
133 -  
134 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 113 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
135 cmd.Operator) 114 cmd.Operator)
136 cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{ 115 cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
@@ -147,40 +126,20 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics @@ -147,40 +126,20 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics
147 return 0, cooperationGoodsStatistics, nil 126 return 0, cooperationGoodsStatistics, nil
148 } 127 }
149 128
150 -// CooperationDividendsStatistics TODO:公司共创人员列表  
151 -func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (int64, interface{}, error) {  
152 - type cooperationDividendItem struct {  
153 - CooperationTime int64 `json:"cooperationTime"`  
154 - DividendsOrderAmount float64 `json:"dividendsOrderAmount"`  
155 - ActuallyPaidAmount float64 `json:"actuallyPaidAmount"`  
156 - UnPaidAmount float64 `json:"unPaidAmount"`  
157 - Participator struct {  
158 - UserType int `json:"userType"`  
159 - UserInfo struct {  
160 - // 用户姓名  
161 - UserName string `json:"userName,omitempty"`  
162 - // 手机号码  
163 - UserPhone string `json:"userPhone,omitempty"`  
164 - // 头像  
165 - //Avatar string `json:"avatar,omitempty"`  
166 - // 邮箱  
167 - //Email string `json:"email,omitempty"`  
168 - } `json:"userInfo"`  
169 - } `json:"participator"` // 参与人  
170 - }  
171 -  
172 - var results []cooperationDividendItem  
173 - for i := 0; i < 5; i++ {  
174 - item := cooperationDividendItem{  
175 - CooperationTime: time.Now().Unix() * 1000,  
176 - DividendsOrderAmount: 6000,  
177 - ActuallyPaidAmount: 5000,  
178 - UnPaidAmount: 1000,  
179 - }  
180 - item.Participator.UserInfo.UserName = fmt.Sprintf("用户%v", rand.Intn(100))  
181 - results = append(results, item) 129 +// CooperationDividendsStatistics 公司共创人员列表
  130 +func (srv CompanyStatisticsService) CooperationDividendsStatistics(cmd *command.CooperationDividendsStatisticsCommand) (int64, interface{}, error) {
  131 + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  132 + cmd.Operator)
  133 + cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyCooperationUsersStatistics, map[string]interface{}{
  134 + "orgId": cmd.Operator.OrgId,
  135 + "offset": cmd.PageNumber * cmd.PageSize,
  136 + "limit": cmd.PageSize,
  137 + "sortByActuallyPaidAmount": cmd.SortByActuallyPaidAmount,
  138 + })
  139 + if err != nil {
  140 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
182 } 141 }
183 - return 5, results, nil 142 + return 0, cooperationUsersStatistics, nil
184 } 143 }
185 144
186 // CooperationPersonStatistics TODO:共创人员统计(共创人员明细) 145 // CooperationPersonStatistics TODO:共创人员统计(共创人员明细)
@@ -19,23 +19,21 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -19,23 +19,21 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
19 cmd.Operator) 19 cmd.Operator)
20 20
21 // 1.项目概览统计 21 // 1.项目概览统计
22 - contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{  
23 - PageNumber: 1,  
24 - PageSize: 1,  
25 - UserBaseId: cmd.Operator.UserBaseId, 22 + contractStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCooperationContractStatistics, map[string]interface{}{
  23 + "userBaseId": cmd.Operator.UserBaseId,
26 }) 24 })
27 if err != nil { 25 if err != nil {
28 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 26 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
29 } 27 }
30 - stoppedContracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{  
31 - PageNumber: 1,  
32 - PageSize: 1,  
33 - Status: 2,  
34 - UserBaseId: cmd.Operator.UserBaseId,  
35 - })  
36 - if err != nil { 28 + type contractStatistics struct {
  29 + ContractSum int `json:"contractSum"`
  30 + ContractStoppedSum int `json:"contractStoppedSum"`
  31 + }
  32 + var cs = &contractStatistics{}
  33 + if err := json.UnmarshalFromString(json.MarshalToString(contractStatisticsResult), cs); err != nil {
37 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 34 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
38 } 35 }
  36 +
39 gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( 37 gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
40 cmd.Operator) 38 cmd.Operator)
41 users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{ 39 users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
@@ -48,8 +46,8 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC @@ -48,8 +46,8 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
48 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 46 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
49 } 47 }
50 var overview = map[string]interface{}{ 48 var overview = map[string]interface{}{
51 - "contractSum": contracts.Grid.Total, //总合约数  
52 - "contractStoppedSum": stoppedContracts.Grid.Total, //停止的合约数 49 + "contractSum": cs.ContractSum, //总合约数
  50 + "contractStoppedSum": cs.ContractStoppedSum, //停止的合约数
53 "companySum": users.Count, //共创企业数 51 "companySum": users.Count, //共创企业数
54 } 52 }
55 53
@@ -92,6 +92,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD @@ -92,6 +92,7 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
92 PageSize: searchDividendsOrderQuery.PageSize, 92 PageSize: searchDividendsOrderQuery.PageSize,
93 CustomerName: searchDividendsOrderQuery.CustomerName, 93 CustomerName: searchDividendsOrderQuery.CustomerName,
94 DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber, 94 DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber,
  95 + OrgIds: searchDividendsOrderQuery.Operator.OrgIds,
95 }) 96 })
96 if err != nil { 97 if err != nil {
97 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 98 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -24,9 +24,13 @@ const ( @@ -24,9 +24,13 @@ const (
24 CompanyDividendsStatistics = "CompanyDividendsStatistics" 24 CompanyDividendsStatistics = "CompanyDividendsStatistics"
25 // 企业、个人 - 分红预算列表 25 // 企业、个人 - 分红预算列表
26 SearchDividendsEstimates = "SearchDividendsEstimates" 26 SearchDividendsEstimates = "SearchDividendsEstimates"
  27 + // 公司 - 共创用户统计
  28 + CompanyCooperationUsersStatistics = "CompanyCooperationUsersStatistics"
27 29
28 // 个人 - 共创企业统计 30 // 个人 - 共创企业统计
29 CooperationCompanyStatistics = "CooperationCompanyStatistics" 31 CooperationCompanyStatistics = "CooperationCompanyStatistics"
  32 + // 个人 - 用户合约统计
  33 + PersonCooperationContractStatistics = "PersonCooperationContractStatistics"
30 ) 34 )
31 35
32 // CooperationStatistics 共创统计 36 // CooperationStatistics 共创统计
@@ -46,6 +46,8 @@ type CreditAccount struct { @@ -46,6 +46,8 @@ type CreditAccount struct {
46 DividendsType int `json:"dividendsType"` 46 DividendsType int `json:"dividendsType"`
47 DividendsAmount float64 `json:"dividendsAmount"` 47 DividendsAmount float64 `json:"dividendsAmount"`
48 } `json:"accountDetail"` //结算明细 48 } `json:"accountDetail"` //结算明细
  49 + //备注
  50 + Remarks string `json:"remarks"`
49 } 51 }
50 52
51 //支付账期结算 53 //支付账期结算
@@ -127,7 +127,7 @@ type ( @@ -127,7 +127,7 @@ type (
127 CompanyId int `json:"companyId"` 127 CompanyId int `json:"companyId"`
128 CustomerName string `json:"customerName"` 128 CustomerName string `json:"customerName"`
129 DividendsOrderNumber string `json:"dividendsOrderNumber"` 129 DividendsOrderNumber string `json:"dividendsOrderNumber"`
130 - OrgIds []int `json:"orgIds"` 130 + OrgIds []int64 `json:"orgIds"`
131 PageNumber int `json:"pageNumber"` 131 PageNumber int `json:"pageNumber"`
132 PageSize int `json:"pageSize"` 132 PageSize int `json:"pageSize"`
133 UserId int `json:"userId"` 133 UserId int `json:"userId"`
@@ -224,3 +224,34 @@ func (gateway HttplibAlliedCreationUser) AuthRefreshIM(param ReqAuthRefreshIM) ( @@ -224,3 +224,34 @@ func (gateway HttplibAlliedCreationUser) AuthRefreshIM(param ReqAuthRefreshIM) (
224 err = gateway.GetResponseData(result, &data) 224 err = gateway.GetResponseData(result, &data)
225 return &data, err 225 return &data, err
226 } 226 }
  227 +
  228 +//RefreshIM 用户基础数据
  229 +func (gateway HttplibAlliedCreationUser) AuthUserBaseInfo(param ReqAuthUserBase) (*DataAuthUserBase, error) {
  230 + url := gateway.baseUrL + "/auth/user-base-info"
  231 + method := "POST"
  232 + req := gateway.CreateRequest(url, method)
  233 + log.Logger.Debug("向用户模块请求数据:用户基础数据。", map[string]interface{}{
  234 + "api": method + ":" + url,
  235 + "param": param,
  236 + })
  237 + req, err := req.JSONBody(param)
  238 + if err != nil {
  239 + return nil, fmt.Errorf("请求用户基础数据失败:%w", err)
  240 + }
  241 +
  242 + byteResult, err := req.Bytes()
  243 + if err != nil {
  244 + return nil, fmt.Errorf("获取用户基础数据失败:%w", err)
  245 + }
  246 + log.Logger.Debug("获取用户模块请求数据:用户基础数据。", map[string]interface{}{
  247 + "result": string(byteResult),
  248 + })
  249 + var result service_gateway.GatewayResponse
  250 + err = json.Unmarshal(byteResult, &result)
  251 + if err != nil {
  252 + return nil, fmt.Errorf("解析用户基础数据:%w", err)
  253 + }
  254 + var data DataAuthUserBase
  255 + err = gateway.GetResponseData(result, &data)
  256 + return &data, err
  257 +}
@@ -233,6 +233,38 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe @@ -233,6 +233,38 @@ func (gateway HttplibAlliedCreationUser) UserBatchResetPassword(param ReqBatchRe
233 return &data, err 233 return &data, err
234 } 234 }
235 235
  236 +// UserBatchAdd 批量添加用户
  237 +func (gateway HttplibAlliedCreationUser) UserBatchAdd(param ReqBatchAddUser) (*DataBatchAddUser, error) {
  238 + url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/batch-add")
  239 + method := "post"
  240 + req := gateway.CreateRequest(url, method)
  241 + //TODO traceID
  242 + log.Logger.Debug("向用户模块请求数据:批量添加用户。", map[string]interface{}{
  243 + "api": method + ":" + url,
  244 + "param": param,
  245 + })
  246 + req, err := req.JSONBody(param)
  247 + if err != nil {
  248 + return nil, fmt.Errorf("请求批量添加用户失败:%w", err)
  249 + }
  250 +
  251 + byteResult, err := req.Bytes()
  252 + if err != nil {
  253 + return nil, fmt.Errorf("获取批量添加用户失败:%w", err)
  254 + }
  255 + log.Logger.Debug("获取用户模块请求数据:批量添加用户。", map[string]interface{}{
  256 + "result": string(byteResult),
  257 + })
  258 + var result service_gateway.GatewayResponse
  259 + err = json.Unmarshal(byteResult, &result)
  260 + if err != nil {
  261 + return nil, fmt.Errorf("解析批量添加用户:%w", err)
  262 + }
  263 + var data DataBatchAddUser
  264 + err = gateway.GetResponseData(result, &data)
  265 + return &data, err
  266 +}
  267 +
236 //CooperatorUserCreate 创建共创用户 268 //CooperatorUserCreate 创建共创用户
237 func (gateway HttplibAlliedCreationUser) CooperatorUserCreate(param ReqCreateCooperatorUser) (*DataCreateCooperatorUser, error) { 269 func (gateway HttplibAlliedCreationUser) CooperatorUserCreate(param ReqCreateCooperatorUser) (*DataCreateCooperatorUser, error) {
238 url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/cooperator") 270 url := fmt.Sprintf("%s%s", gateway.baseUrL, "/user/cooperator")
@@ -89,3 +89,27 @@ type ( @@ -89,3 +89,27 @@ type (
89 CsAccountId string `json:"csAccountId"` 89 CsAccountId string `json:"csAccountId"`
90 } 90 }
91 ) 91 )
  92 +
  93 +//重置手机号
  94 +type (
  95 + ReqAuthUserBase struct {
  96 + // 手机号码
  97 + Account string `cname:"账号" json:"account" valid:"Required"`
  98 + }
  99 + DataAuthUserBase struct {
  100 + UserBaseID int `json:"userBaseId"`
  101 + UserInfo struct {
  102 + UserName string `json:"userName"`
  103 + Phone string `json:"phone"`
  104 + // 头像
  105 + Avatar string `json:"avatar,omitempty"`
  106 + // 邮箱
  107 + Email string `json:"email,omitempty"`
  108 + } `json:"userInfo"`
  109 + Im struct {
  110 + Accid string `json:"accid"`
  111 + ImToken string `json:"imToken"`
  112 + CsAccountID string `json:"csAccountId"`
  113 + } `json:"im"`
  114 + }
  115 +)
@@ -335,3 +335,32 @@ type ( @@ -335,3 +335,32 @@ type (
335 } `json:"menus"` 335 } `json:"menus"`
336 } 336 }
337 ) 337 )
  338 +
  339 +//批量修改用户启用状态
  340 +type (
  341 + ReqBatchAddUser struct {
  342 + Users []BatchAddUserItem `json:"users"`
  343 + Password int `json:"password"`
  344 + }
  345 +
  346 + DataBatchAddUser struct {
  347 + }
  348 +
  349 + BatchAddUserItem struct {
  350 + CompanyID int `json:"companyId"`
  351 + UserType int `json:"userType"`
  352 + UserCode string `json:"userCode"`
  353 + OrganizationID int `json:"organizationId"`
  354 + DepartmentID int `json:"departmentId"`
  355 + UserInfo struct {
  356 + Phone string `json:"phone"`
  357 + UserName string `json:"userName"`
  358 + Email string `json:"email"`
  359 + Avatar string `json:"avatar"`
  360 + } `json:"userInfo"`
  361 + CooperationInfo struct {
  362 + CooperationCompany string `json:"cooperationCompany"`
  363 + CooperationDeadline time.Time `json:"cooperationDeadline"`
  364 + } `json:"cooperationInfo"`
  365 + }
  366 +)