Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hp-smart
Commits
67395f14
Commit
67395f14
authored
Apr 11, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-sx' of
http://git.pseer.com/platform/hp-smart
into dev
parents
4351e2cf
427c3f48
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2216 additions
and
2 deletions
+2216
-2
PlatformUserDetailsService.java
...t4j/core/security/service/PlatformUserDetailsService.java
+69
-0
User.java
...in/java/com/baosight/iplat4j/core/security/user/User.java
+525
-0
ServiceXS0102.java
...java/com/baosight/xservices/xs/service/ServiceXS0102.java
+12
-0
ServiceXS0103.java
...java/com/baosight/xservices/xs/service/ServiceXS0103.java
+116
-0
ServiceXSUserManage.java
...om/baosight/xservices/xs/service/ServiceXSUserManage.java
+1489
-0
XSUser.xml
src/main/java/com/baosight/xservices/xs/sql/XSUser.xml
+4
-1
XS3201.js
src/main/webapp/XS/XS3201.js
+1
-1
No files found.
src/main/java/com/baosight/iplat4j/core/security/service/PlatformUserDetailsService.java
0 → 100644
View file @
67395f14
package
com
.
baosight
.
iplat4j
.
core
.
security
.
service
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.security.base.SecurityFactory
;
import
com.baosight.iplat4j.core.security.base.UserNotExistException
;
import
com.baosight.iplat4j.core.security.user.IUserManager
;
import
com.baosight.iplat4j.core.security.user.User
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.util.StringUtils
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Date
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,16:08
*/
public
class
PlatformUserDetailsService
implements
UserDetailsService
{
private
String
role
=
"ROLE_VERIFIED"
;
public
PlatformUserDetailsService
()
{
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
;
}
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
try
{
IUserManager
userManager
=
SecurityFactory
.
getUserManager
();
User
user
=
userManager
.
getUser
(
username
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"找不到这个用户"
);
}
else
{
SimpleGrantedAuthority
authority
=
new
SimpleGrantedAuthority
(
this
.
role
);
Collection
<
GrantedAuthority
>
authorities
=
new
ArrayList
();
authorities
.
add
(
authority
);
boolean
valid
=
user
.
getValid
()
==
1
;
boolean
userNotExpired
=
true
;
String
expireDate
=
user
.
getExpireDate
();
if
(
expireDate
!=
null
&&
StringUtils
.
hasText
(
expireDate
))
{
Calendar
currentDate
=
Calendar
.
getInstance
();
Date
nowTime
=
currentDate
.
getTime
();
SimpleDateFormat
time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
expireDateTime
=
time
.
parse
(
expireDate
);
userNotExpired
=
expireDateTime
.
after
(
nowTime
);
}
boolean
passwordNotExpired
=
true
;
// 支持登录名或手机号两种方式登录 modify by songx at 2024-04-10
return
new
org
.
springframework
.
security
.
core
.
userdetails
.
User
(
user
.
getLoginName
(),
user
.
getLoginName
(),
valid
,
userNotExpired
,
passwordNotExpired
,
!
user
.
getIsLocked
(),
authorities
);
}
}
catch
(
UserNotExistException
var13
)
{
throw
new
UsernameNotFoundException
(
var13
.
getMessage
(),
var13
);
}
catch
(
Exception
var14
)
{
throw
new
PlatException
(
var14
);
}
}
}
src/main/java/com/baosight/iplat4j/core/security/user/User.java
0 → 100644
View file @
67395f14
package
com
.
baosight
.
iplat4j
.
core
.
security
.
user
;
import
com.baosight.iplat4j.core.security.base.Subject
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,16:12
*/
public
class
User
extends
Subject
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
String
KEY_USER_ID
=
"userId"
;
private
static
final
String
KEY_LOGIN_NAME
=
"loginName"
;
private
static
final
String
KEY_USER_DISPLAYNAME
=
"DisplayName"
;
private
static
final
String
KEY_USER_PASSWORD
=
"Password"
;
private
static
final
String
KEY_USER_CODEDPASSWORD
=
"CodedPassword"
;
private
static
final
String
KEY_USER_DESC
=
"Desc"
;
private
static
final
String
KEY_USER_LAST_NAME
=
"LastName"
;
private
static
final
String
KEY_USER_FIRST_NAME
=
"FirstName"
;
private
static
final
String
KEY_USER_MIDDLE_NAME
=
"MiddleName"
;
private
static
final
String
KEY_USER_NICK_NAME
=
"NickName"
;
private
static
final
String
KEY_USER_TITLE
=
"Title"
;
private
static
final
String
KEY_USER_INITIALS
=
"Initials"
;
private
static
final
String
KEY_USER_FULL_NAME
=
"FullName"
;
private
static
final
String
KEY_USER_PROF
=
"Prof"
;
private
static
final
String
KEY_USER_POSITION
=
"Position"
;
private
static
final
String
KEY_USER_DEPT
=
"Dept"
;
private
static
final
String
KEY_USER_ACCOUNT
=
"Account"
;
private
static
final
String
KEY_USER_ID_NUMBER
=
"IDNumber"
;
private
static
final
String
KEY_USER_WORK_NUMBER
=
"WorkNumber"
;
private
static
final
String
KEY_USER_GENDER
=
"Gender"
;
private
static
final
String
KEY_USER_BIRTHDAY
=
"Birthday"
;
private
static
final
String
KEY_USER_COUNTRY
=
"Country"
;
private
static
final
String
KEY_USER_PROVINCE
=
"Province"
;
private
static
final
String
KEY_USER_CITY
=
"City"
;
private
static
final
String
KEY_USER_STREET
=
"Street"
;
private
static
final
String
KEY_USER_ADDR
=
"Addr"
;
private
static
final
String
KEY_USER_HOME_ADDR
=
"HomeAddr"
;
private
static
final
String
KEY_USER_OFFICE_ADDR
=
"OfficeAddr"
;
private
static
final
String
KEY_USER_BUSINESS_ADDR
=
"BusinessAddr"
;
private
static
final
String
KEY_USER_OTHER_ADDR
=
"OtherAddr"
;
private
static
final
String
KEY_USER_POSTAL_CODE
=
"PostalCode"
;
private
static
final
String
KEY_USER_POST_BOX
=
"PostBox"
;
private
static
final
String
KEY_USER_WEBSITE
=
"WebSite"
;
private
static
final
String
KEY_USER_EMAIL
=
"Email"
;
private
static
final
String
KEY_USER_IM
=
"IM"
;
private
static
final
String
KEY_USER_DOMAIN
=
"Domain"
;
private
static
final
String
KEY_USER_MAIN_PHONE
=
"MainPhone"
;
private
static
final
String
KEY_USER_HOME_PHONE
=
"HomePhone"
;
private
static
final
String
KEY_USER_MOBILE_PHONE
=
"MobilePhone"
;
private
static
final
String
KEY_USER_OFFICE_PHONE
=
"OfficePhone"
;
private
static
final
String
KEY_USER_BUSINESS_PHONE
=
"BusinessPhone"
;
private
static
final
String
KEY_USER_OTHER_PHONE
=
"OtherPhone"
;
private
static
final
String
KEY_USER_FAX
=
"Fax"
;
private
static
final
String
KEY_USER_TYPE
=
"UserType"
;
private
static
final
String
KEY_USER_CODE
=
"UserCode"
;
private
static
final
String
KEY_USER_ORG_CODE
=
"OrgCode"
;
private
static
final
String
KEY_USER_CREATE_DATE
=
"CreateDate"
;
private
static
final
String
KEY_USER_EXPIRE_DATE
=
"ExpireDate"
;
private
static
final
String
KEY_USER_PWD_EXPIRE_DATE
=
"PwdExpireDate"
;
private
static
final
String
KEY_USER_PROPERTY_UPDATE_DATE
=
"UpdateDate"
;
private
static
final
String
KEY_USER_PWD_UPDATE_DATE
=
"PwdUpdateDate"
;
private
static
final
String
KEY_USER_LAST_LOGIN_DATE
=
"LastLoginDate"
;
private
static
final
String
KEY_USER_ERROR_LOGIN_DATE
=
"ErrorLoginDate"
;
private
static
final
String
KEY_USER_VALID
=
"Valid"
;
private
static
final
String
KEY_USER_SORT_INDEX
=
"Index"
;
private
static
final
String
KEY_IS_LOCKED
=
"isLocked"
;
public
static
final
String
ENTITY_USER
=
"TYP_ES00"
;
public
User
()
{
}
public
User
(
String
name
)
{
super
(
name
,
"TYP_ES00"
);
}
public
String
getUserId
()
{
return
this
.
getStringValue
(
"userId"
);
}
public
void
setUserId
(
String
userId
)
{
this
.
setStringValue
(
"userId"
,
userId
);
}
public
String
getLoginName
()
{
return
this
.
getStringValue
(
KEY_LOGIN_NAME
);
}
public
void
setLoginName
(
String
loginName
)
{
this
.
setStringValue
(
KEY_LOGIN_NAME
,
loginName
);
}
public
String
getDisplayName
()
{
return
this
.
getStringValue
(
"DisplayName"
);
}
public
void
setDisplayName
(
String
displayName
)
{
this
.
setStringValue
(
"DisplayName"
,
displayName
);
}
public
String
getPassword
()
{
return
this
.
getStringValue
(
"Password"
);
}
public
void
setPassword
(
String
password
)
{
this
.
setStringValue
(
"Password"
,
password
);
}
public
String
getCodedPassword
()
{
return
this
.
getStringValue
(
"CodedPassword"
);
}
public
void
setCodedPassword
(
String
codedPassword
)
{
this
.
setStringValue
(
"CodedPassword"
,
codedPassword
);
}
public
String
getDesc
()
{
return
this
.
getStringValue
(
"Desc"
);
}
public
void
setDesc
(
String
desc
)
{
this
.
setStringValue
(
"Desc"
,
desc
);
}
public
String
getLastName
()
{
return
this
.
getStringValue
(
"LastName"
);
}
public
void
setLastName
(
String
lastName
)
{
this
.
setStringValue
(
"LastName"
,
lastName
);
}
public
String
getFirstName
()
{
return
this
.
getStringValue
(
"FirstName"
);
}
public
void
setFirstName
(
String
firstName
)
{
this
.
setStringValue
(
"FirstName"
,
firstName
);
}
public
String
getMiddleName
()
{
return
this
.
getStringValue
(
"MiddleName"
);
}
public
void
setMiddleName
(
String
middleName
)
{
this
.
setStringValue
(
"MiddleName"
,
middleName
);
}
public
String
getNickName
()
{
return
this
.
getStringValue
(
"NickName"
);
}
public
void
setNickName
(
String
nickName
)
{
this
.
setStringValue
(
"NickName"
,
nickName
);
}
public
String
getTitle
()
{
return
this
.
getStringValue
(
"Title"
);
}
public
void
setTitle
(
String
title
)
{
this
.
setStringValue
(
"Title"
,
title
);
}
public
String
getInitials
()
{
return
this
.
getStringValue
(
"Initials"
);
}
public
void
setInitials
(
String
initials
)
{
this
.
setStringValue
(
"Initials"
,
initials
);
}
public
String
getFullName
()
{
return
this
.
getStringValue
(
"FullName"
);
}
public
void
setFullName
(
String
fullName
)
{
this
.
setStringValue
(
"FullName"
,
fullName
);
}
public
String
getProf
()
{
return
this
.
getStringValue
(
"Prof"
);
}
public
void
setProf
(
String
prof
)
{
this
.
setStringValue
(
"Prof"
,
prof
);
}
public
String
getPosition
()
{
return
this
.
getStringValue
(
"Position"
);
}
public
void
setPosition
(
String
position
)
{
this
.
setStringValue
(
"Position"
,
position
);
}
public
String
getDept
()
{
return
this
.
getStringValue
(
"Dept"
);
}
public
void
setDept
(
String
dept
)
{
this
.
setStringValue
(
"Dept"
,
dept
);
}
public
String
getAccount
()
{
return
this
.
getStringValue
(
"Account"
);
}
public
void
setAccount
(
String
account
)
{
this
.
setStringValue
(
"Account"
,
account
);
}
public
String
getIDNumber
()
{
return
this
.
getStringValue
(
"IDNumber"
);
}
public
void
setIDNumber
(
String
idNumber
)
{
this
.
setStringValue
(
"IDNumber"
,
idNumber
);
}
public
String
getWorkNumber
()
{
return
this
.
getStringValue
(
"WorkNumber"
);
}
public
void
setWorkNumber
(
String
workNumber
)
{
this
.
setStringValue
(
"WorkNumber"
,
workNumber
);
}
public
String
getGender
()
{
return
this
.
getStringValue
(
"Gender"
);
}
public
void
setGender
(
String
gender
)
{
this
.
setStringValue
(
"Gender"
,
gender
);
}
public
String
getBirthday
()
{
return
this
.
getStringValue
(
"Birthday"
);
}
public
void
setBirthday
(
String
birthday
)
{
this
.
setStringValue
(
"Birthday"
,
birthday
);
}
public
String
getCountry
()
{
return
this
.
getStringValue
(
"Country"
);
}
public
void
setCountry
(
String
country
)
{
this
.
setStringValue
(
"Country"
,
country
);
}
public
String
getProvince
()
{
return
this
.
getStringValue
(
"Province"
);
}
public
void
setProvince
(
String
province
)
{
this
.
setStringValue
(
"Province"
,
province
);
}
public
String
getCity
()
{
return
this
.
getStringValue
(
"City"
);
}
public
void
setCity
(
String
city
)
{
this
.
setStringValue
(
"City"
,
city
);
}
public
String
getStreet
()
{
return
this
.
getStringValue
(
"Street"
);
}
public
void
setStreet
(
String
street
)
{
this
.
setStringValue
(
"Street"
,
street
);
}
public
String
getAddr
()
{
return
this
.
getStringValue
(
"Addr"
);
}
public
void
setAddr
(
String
addr
)
{
this
.
setStringValue
(
"Addr"
,
addr
);
}
public
String
getHomeAddr
()
{
return
this
.
getStringValue
(
"HomeAddr"
);
}
public
void
setHomeAddr
(
String
homeAddr
)
{
this
.
setStringValue
(
"HomeAddr"
,
homeAddr
);
}
public
String
getOfficeAddr
()
{
return
this
.
getStringValue
(
"OfficeAddr"
);
}
public
void
setOfficeAddr
(
String
officeAddr
)
{
this
.
setStringValue
(
"OfficeAddr"
,
officeAddr
);
}
public
String
getBusinessAddr
()
{
return
this
.
getStringValue
(
"BusinessAddr"
);
}
public
void
setBusinessAddr
(
String
businessAddr
)
{
this
.
setStringValue
(
"BusinessAddr"
,
businessAddr
);
}
public
String
getOtherAddr
()
{
return
this
.
getStringValue
(
"OtherAddr"
);
}
public
void
setOtherAddr
(
String
otherAddr
)
{
this
.
setStringValue
(
"OtherAddr"
,
otherAddr
);
}
public
String
getPostalCode
()
{
return
this
.
getStringValue
(
"PostalCode"
);
}
public
void
setPostalCode
(
String
postalCode
)
{
this
.
setStringValue
(
"PostalCode"
,
postalCode
);
}
public
String
getPostBox
()
{
return
this
.
getStringValue
(
"PostBox"
);
}
public
void
setPostBox
(
String
postBox
)
{
this
.
setStringValue
(
"PostBox"
,
postBox
);
}
public
String
getWebSite
()
{
return
this
.
getStringValue
(
"WebSite"
);
}
public
void
setWebSite
(
String
webSite
)
{
this
.
setStringValue
(
"WebSite"
,
webSite
);
}
public
String
getEmail
()
{
return
this
.
getStringValue
(
"Email"
);
}
public
void
setEmail
(
String
email
)
{
this
.
setStringValue
(
"Email"
,
email
);
}
public
String
getIM
()
{
return
this
.
getStringValue
(
"IM"
);
}
public
void
setIM
(
String
im
)
{
this
.
setStringValue
(
"IM"
,
im
);
}
public
String
getDomain
()
{
return
this
.
getStringValue
(
"Domain"
);
}
public
void
setDomain
(
String
domain
)
{
this
.
setStringValue
(
"Domain"
,
domain
);
}
public
String
getMainPhone
()
{
return
this
.
getStringValue
(
"MainPhone"
);
}
public
void
setMainPhone
(
String
mainPhone
)
{
this
.
setStringValue
(
"MainPhone"
,
mainPhone
);
}
public
String
getHomePhone
()
{
return
this
.
getStringValue
(
"HomePhone"
);
}
public
void
setHomePhone
(
String
homePhone
)
{
this
.
setStringValue
(
"HomePhone"
,
homePhone
);
}
public
String
getMobilePhone
()
{
return
this
.
getStringValue
(
"MobilePhone"
);
}
public
void
setMobilePhone
(
String
mobilePhone
)
{
this
.
setStringValue
(
"MobilePhone"
,
mobilePhone
);
}
public
String
getOfficePhone
()
{
return
this
.
getStringValue
(
"OfficePhone"
);
}
public
void
setOfficePhone
(
String
officePhone
)
{
this
.
setStringValue
(
"OfficePhone"
,
officePhone
);
}
public
String
getBusinessPhone
()
{
return
this
.
getStringValue
(
"BusinessPhone"
);
}
public
void
setBusinessPhone
(
String
businessPhone
)
{
this
.
setStringValue
(
"BusinessPhone"
,
businessPhone
);
}
public
String
getOtherPhone
()
{
return
this
.
getStringValue
(
"OtherPhone"
);
}
public
void
setOtherPhone
(
String
otherPhone
)
{
this
.
setStringValue
(
"OtherPhone"
,
otherPhone
);
}
public
String
getFax
()
{
return
this
.
getStringValue
(
"Fax"
);
}
public
void
setFax
(
String
fax
)
{
this
.
setStringValue
(
"Fax"
,
fax
);
}
public
String
getUserType
()
{
return
this
.
getStringValue
(
"UserType"
);
}
public
void
setUserType
(
String
userType
)
{
this
.
setStringValue
(
"UserType"
,
userType
);
}
public
String
getUserCode
()
{
return
this
.
getStringValue
(
"UserCode"
);
}
public
void
setUserCode
(
String
userCode
)
{
this
.
setStringValue
(
"UserCode"
,
userCode
);
}
public
String
getOrgCode
()
{
return
this
.
getStringValue
(
"OrgCode"
);
}
public
void
setOrgCode
(
String
orgCode
)
{
this
.
setStringValue
(
"OrgCode"
,
orgCode
);
}
public
String
getCreateDate
()
{
return
this
.
getStringValue
(
"CreateDate"
);
}
public
void
setCreateDate
(
String
createDate
)
{
this
.
setStringValue
(
"CreateDate"
,
createDate
);
}
public
String
getExpireDate
()
{
return
this
.
getStringValue
(
"ExpireDate"
);
}
public
void
setExpireDate
(
String
expireDate
)
{
this
.
setStringValue
(
"ExpireDate"
,
expireDate
);
}
public
String
getPwdExpireDate
()
{
return
this
.
getStringValue
(
"PwdExpireDate"
);
}
public
void
setPwdExpireDate
(
String
pwdExpireDate
)
{
this
.
setStringValue
(
"PwdExpireDate"
,
pwdExpireDate
);
}
public
String
getUpdateDate
()
{
return
this
.
getStringValue
(
"UpdateDate"
);
}
public
void
setUpdateDate
(
String
updateDate
)
{
this
.
setStringValue
(
"UpdateDate"
,
updateDate
);
}
public
String
getPwdUpdateDate
()
{
return
this
.
getStringValue
(
"PwdUpdateDate"
);
}
public
void
setPwdUpdateDate
(
String
pwdUpdateDate
)
{
this
.
setStringValue
(
"PwdUpdateDate"
,
pwdUpdateDate
);
}
public
String
getLastLoginDate
()
{
return
this
.
getStringValue
(
"LastLoginDate"
);
}
public
void
setLastLoginDate
(
String
lastLoginDate
)
{
this
.
setStringValue
(
"LastLoginDate"
,
lastLoginDate
);
}
public
String
getErrorLoginDate
()
{
return
this
.
getStringValue
(
"ErrorLoginDate"
);
}
public
void
setErrorLoginDate
(
String
errorLoginDate
)
{
this
.
setStringValue
(
"ErrorLoginDate"
,
errorLoginDate
);
}
public
int
getValid
()
{
return
this
.
getValidValue
(
"Valid"
);
}
public
void
setValid
(
int
valid
)
{
this
.
put
(
"Valid"
,
Integer
.
toString
(
valid
));
}
public
boolean
getIsLocked
()
{
return
this
.
containsKey
(
"isLocked"
)
?
"-1"
.
equals
(
this
.
get
(
"isLocked"
).
toString
())
:
false
;
}
public
void
setIsLocked
(
String
isLocked
)
{
this
.
put
(
"isLocked"
,
isLocked
);
}
public
int
getIndex
()
{
return
this
.
getIndexValue
(
"Index"
);
}
public
void
setIndex
(
int
index
)
{
this
.
put
(
"Index"
,
Integer
.
toString
(
index
));
}
}
src/main/java/com/baosight/xservices/xs/service/ServiceXS0102.java
View file @
67395f14
...
...
@@ -16,6 +16,7 @@ import com.baosight.xservices.xs.constants.LoginConstants;
import
com.baosight.xservices.xs.domain.XS01
;
import
com.baosight.xservices.xs.domain.XS02
;
import
com.baosight.xservices.xs.util.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -84,6 +85,17 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
return
inInfo
;
}
// 校验手机号是否存在 added by songx at 2024-04-10
if
(
StringUtils
.
isNotBlank
(
mobile
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"mobile"
,
mobile
);
List
existMobile
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
CollectionUtils
.
isNotEmpty
(
existMobile
))
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"注册失败!手机号已被其他用户使用"
);
return
inInfo
;
}
}
String
userGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"groupName"
);
inInfoRowMap
.
put
(
"userGroupEname"
,
userGroupEname
);
inInfoRowMap
.
put
(
"password"
,
password
);
...
...
src/main/java/com/baosight/xservices/xs/service/ServiceXS0103.java
0 → 100644
View file @
67395f14
package
com
.
baosight
.
xservices
.
xs
.
service
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.xservices.xs.util.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,17:15
*/
public
class
ServiceXS0103
extends
ServiceEPBase
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
ServiceXS0103
.
class
);
public
ServiceXS0103
()
{
}
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
return
this
.
query
(
inInfo
);
}
public
EiInfo
query
(
EiInfo
inInfo
)
{
String
loginName
=
UserSession
.
getUser
().
getUsername
();
Map
map
=
new
HashMap
();
map
.
put
(
"loginName"
,
loginName
);
List
resultList
=
this
.
dao
.
query
(
"XS0103.query"
,
map
);
if
(
null
!=
resultList
&&
resultList
.
size
()
>
0
)
{
Map
result
=
(
Map
)
resultList
.
get
(
0
);
inInfo
.
set
(
"userId"
,
result
.
get
(
"userId"
));
inInfo
.
set
(
"userName"
,
result
.
get
(
"userName"
));
inInfo
.
set
(
"mobile"
,
result
.
get
(
"mobile"
));
inInfo
.
set
(
"email"
,
result
.
get
(
"email"
));
}
return
inInfo
;
}
public
EiInfo
update
(
EiInfo
inInfo
)
{
StringBuilder
buffer
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
String
mobile
=
(
String
)
inInfo
.
get
(
"mobile"
);
Map
map
=
new
HashMap
();
map
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
map
.
put
(
"userName"
,
inInfo
.
get
(
"userName"
));
map
.
put
(
"mobile"
,
mobile
);
map
.
put
(
"email"
,
inInfo
.
get
(
"email"
));
map
.
put
(
"recRevisor"
,
inInfo
.
get
(
"userName"
));
map
.
put
(
"recReviseTime"
,
DateUtils
.
curDateTimeStr14
());
try
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
List
existsUsers
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
existsUsers
.
size
()
<
1
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"编辑用户信息失败,不存在: "
+
inInfo
.
get
(
"userName"
)
+
"的用户!"
);
return
inInfo
;
}
Map
existsUserMap
=
(
Map
)
existsUsers
.
get
(
0
);
String
dbMobile
=
(
String
)
existsUserMap
.
get
(
"mobile"
);
// 手机号变更需要校验唯一性 added by songx at 2024-04-10
if
(
StringUtils
.
isNotBlank
(
mobile
)
&&
!
dbMobile
.
equals
(
mobile
))
{
paramMap
=
new
HashMap
();
paramMap
.
put
(
"mobile"
,
mobile
);
List
existMobile
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
CollectionUtils
.
isNotEmpty
(
existMobile
))
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"手机号已被其他用户使用"
);
return
inInfo
;
}
}
this
.
dao
.
update
(
"XS0103.update"
,
map
);
buffer
.
append
(
"更新记录成功"
);
Map
param
=
new
HashMap
();
param
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
List
userList
=
this
.
dao
.
query
(
"XS01.query"
,
param
);
if
(
userList
!=
null
&&
userList
.
size
()
>
0
)
{
Map
userMap
=
(
Map
)
userList
.
get
(
0
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1002"
);
xEyeEntity
.
setLogName
(
"修改用户信息"
);
xEyeEntity
.
setInvokeInfo
(
UserSession
.
getUser
().
getUsername
()
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"修改了登录名为 "
+
userMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
userMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
UserSession
.
getUser
().
getUsername
());
xEyeEntity
.
set
(
"x_xs_ln"
,
userMap
.
get
(
"loginName"
));
this
.
log
(
xEyeEntity
);
}
}
catch
(
Exception
var9
)
{
buffer
.
append
(
"更新记录失败"
);
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var9
.
getCause
().
toString
());
logger
.
error
(
var9
.
getCause
().
getMessage
());
}
EiInfo
outInfo
=
this
.
query
(
inInfo
);
outInfo
.
setMsg
(
buffer
.
toString
());
outInfo
.
setDetailMsg
(
detail
.
toString
());
return
outInfo
;
}
}
src/main/java/com/baosight/xservices/xs/service/ServiceXSUserManage.java
0 → 100644
View file @
67395f14
package
com
.
baosight
.
xservices
.
xs
.
service
;
import
com.baosight.iplat4j.core.cache.CacheManager
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.core.log.xeye.PlatEye
;
import
com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.soa.XEventManager
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.iplat4j.core.util.ExceptionUtil
;
import
com.baosight.iplat4j.core.util.JudgeCircleUtils
;
import
com.baosight.xservices.xs.authentication.AuthenticationInfo
;
import
com.baosight.xservices.xs.authentication.SecurityBridgeFactory
;
import
com.baosight.xservices.xs.common.AuthInfoManager
;
import
com.baosight.xservices.xs.util.LoginUserDetails
;
import
com.baosight.xservices.xs.util.UserSession
;
import
com.baosight.xservices.xs.util.XSServiceUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.GregorianCalendar
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,16:36
*/
public
class
ServiceXSUserManage
extends
ServiceEPBase
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
ServiceXSUserManage
.
class
);
private
static
final
String
defaultPassword
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.default.password"
),
"pwd123!@#"
);
private
static
final
String
ENABLE_EHR_INFO
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.enableEhrInfo"
),
"on"
);
public
ServiceXSUserManage
()
{
}
public
EiInfo
insertUser
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
detail
=
new
StringBuffer
();
List
insertedUser
=
new
ArrayList
();
List
insertedFailUser
=
new
ArrayList
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
String
passwordMode
=
inInfo
.
getString
(
"passwordMode"
);
boolean
ignoreDuplicate
=
"true"
.
equals
(
inInfo
.
getString
(
"ignoreDuplicate"
));
int
rowCount
=
eiBlock
.
getRowCount
();
for
(
int
i
=
0
;
i
<
rowCount
;
++
i
)
{
try
{
Map
<
String
,
Object
>
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
userId
=
inInfoRowMap
.
get
(
"uuid"
)
!=
null
?
inInfoRowMap
.
get
(
"uuid"
).
toString
()
:
(
inInfoRowMap
.
get
(
"userId"
)
!=
null
?
inInfoRowMap
.
get
(
"userId"
).
toString
()
:
""
);
if
(
StringUtils
.
isBlank
(
userId
))
{
userId
=
XSServiceUtils
.
getUUID
();
}
inInfoRowMap
.
put
(
"userId"
,
userId
);
String
password
=
(
String
)
inInfoRowMap
.
get
(
"password"
);
String
rePass
=
(
String
)
inInfoRowMap
.
get
(
"rePass"
);
String
loginName
=
(
String
)
inInfoRowMap
.
get
(
"loginName"
);
EiInfo
xInfo
=
this
.
getEiInfo
(
inInfo
,
passwordMode
,
inInfoRowMap
,
password
,
rePass
,
loginName
);
if
(
xInfo
!=
null
&&
xInfo
.
getStatus
()
<
0
)
{
return
xInfo
;
}
String
userName
=
(
String
)
inInfoRowMap
.
get
(
"userName"
);
String
recCreator
=
(
String
)
inInfoRowMap
.
get
(
"recCreator"
);
String
userGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"userGroupEname"
);
String
isLocked
=
(
String
)
inInfoRowMap
.
get
(
"isLocked"
);
String
gender
=
(
String
)
inInfoRowMap
.
get
(
"gender"
);
String
mobile
=
(
String
)
inInfoRowMap
.
get
(
"mobile"
);
boolean
flag
=
""
.
equals
(
userName
)
||
""
.
equals
(
loginName
)
||
""
.
equals
(
recCreator
);
String
accountExpireDays
;
if
(
null
==
loginName
||
null
==
userName
||
null
==
recCreator
||
flag
)
{
accountExpireDays
=
"传入的登录号,用户姓名,创建者不能为空"
;
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
accountExpireDays
);
return
inInfo
;
}
if
(
null
==
userGroupEname
)
{
inInfoRowMap
.
put
(
"userGroupEname"
,
" "
);
}
inInfoRowMap
.
put
(
"userType"
,
"USER"
);
inInfoRowMap
.
put
(
"status"
,
"1"
);
if
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
recCreator
))
{
inInfoRowMap
.
put
(
"recCreator"
,
recCreator
);
}
else
{
inInfoRowMap
.
put
(
"recCreator"
,
UserSession
.
getUser
().
getUsername
());
}
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
gender
))
{
inInfoRowMap
.
put
(
"gender"
,
" "
);
}
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
mobile
))
{
inInfoRowMap
.
put
(
"mobile"
,
" "
);
}
inInfoRowMap
.
put
(
"recCreateTime"
,
DateUtils
.
curDateTimeStr14
());
accountExpireDays
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.accountExpireDays"
),
"90"
);
String
pwdExpireDays
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.pwdExpireDays"
),
"90"
);
GregorianCalendar
gc
=
new
GregorianCalendar
();
gc
.
setTime
(
new
Date
());
gc
.
add
(
5
,
Integer
.
parseInt
(
accountExpireDays
));
inInfoRowMap
.
put
(
"accountExpireDate"
,
DateUtils
.
toDateStr8
(
gc
.
getTime
()));
gc
.
setTime
(
new
Date
());
gc
.
add
(
5
,
Integer
.
parseInt
(
pwdExpireDays
));
inInfoRowMap
.
put
(
"pwdExpireDate"
,
DateUtils
.
toDateStr8
(
gc
.
getTime
()));
String
archiveFlag
=
(
String
)
inInfoRowMap
.
get
(
"archiveFlag"
);
if
(
null
==
archiveFlag
||
""
.
equals
(
archiveFlag
))
{
archiveFlag
=
"0"
;
inInfoRowMap
.
put
(
"archiveFlag"
,
archiveFlag
);
}
String
sortIndex
=
(
String
)
inInfoRowMap
.
get
(
"sortIndex"
);
if
(
StringUtils
.
isBlank
(
sortIndex
))
{
inInfoRowMap
.
put
(
"sortIndex"
,
0
);
}
if
(
"-1"
.
equals
(
isLocked
))
{
inInfoRowMap
.
put
(
"isLocked"
,
"-1"
);
inInfoRowMap
.
put
(
"status"
,
"-1"
);
}
else
{
inInfoRowMap
.
put
(
"isLocked"
,
"1"
);
inInfoRowMap
.
put
(
"status"
,
"1"
);
}
String
jobId
=
(
String
)
inInfoRowMap
.
get
(
"jobId"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
jobId
))
{
inInfoRowMap
.
put
(
"jobId"
,
" "
);
}
String
jobName
=
(
String
)
inInfoRowMap
.
get
(
"jobName"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
jobName
))
{
inInfoRowMap
.
put
(
"jobName"
,
" "
);
}
String
ehrOrgId
=
(
String
)
inInfoRowMap
.
get
(
"ehrOrgId"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
ehrOrgId
))
{
inInfoRowMap
.
put
(
"ehrOrgId"
,
" "
);
}
inInfoRowMap
.
put
(
"recRevisor"
,
" "
);
inInfoRowMap
.
put
(
"recReviseTime"
,
" "
);
inInfoRowMap
.
put
(
"pwdReviseDate"
,
" "
);
inInfoRowMap
.
put
(
"pwdRevisor"
,
" "
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"loginName"
,
loginName
);
List
existUser
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
null
!=
existUser
&&
existUser
.
size
()
>
0
)
{
String
errorMsg
=
"注册失败!该用户已经存在"
;
if
(!
ignoreDuplicate
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"注册失败!该用户已经存在"
);
return
inInfo
;
}
inInfoRowMap
.
put
(
"failReason"
,
errorMsg
);
insertedFailUser
.
add
(
inInfoRowMap
);
}
else
{
if
(
"on"
.
equals
(
ENABLE_EHR_INFO
))
{
this
.
dao
.
insert
(
"XS01.insertWithEhrInfo"
,
inInfoRowMap
);
}
else
{
this
.
dao
.
insert
(
"XS01.insert"
,
inInfoRowMap
);
}
inInfoRowMap
.
remove
(
"password"
);
inInfoRowMap
.
remove
(
"rePass"
);
Map
map
=
new
HashMap
();
map
.
put
(
"userId"
,
userId
);
List
insertUserList
=
this
.
dao
.
query
(
"XS01.query"
,
map
);
Map
userMap
=
(
Map
)
insertUserList
.
get
(
0
);
insertedUser
.
add
(
userMap
);
buffer
.
append
(
"注册成功\n"
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1000"
);
xEyeEntity
.
setLogName
(
"新增用户"
);
xEyeEntity
.
setInvokeInfo
(
recCreator
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口注册了登录名为 "
+
inInfoRowMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
inInfoRowMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recCreator
);
xEyeEntity
.
set
(
"x_xs_ln"
,
inInfoRowMap
.
get
(
"loginName"
));
this
.
log
(
xEyeEntity
);
}
}
catch
(
Exception
var38
)
{
buffer
.
append
(
"注册失败\n"
).
append
(
var38
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
ExceptionUtil
.
getRootCauseMessage
(
var38
));
logger
.
error
(
var38
);
}
}
inInfo
.
setMsg
(
buffer
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
if
(
insertedUser
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
insertedUser
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_15"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
buffer
.
append
(
"注册失败\n"
).
append
(
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
inInfo
.
set
(
"successCount"
,
insertedUser
.
size
());
inInfo
.
set
(
"failCount"
,
insertedFailUser
.
size
());
return
inInfo
;
}
}
private
EiInfo
getEiInfo
(
EiInfo
inInfo
,
String
passwordMode
,
Map
<
String
,
Object
>
inInfoRowMap
,
String
password
,
String
rePass
,
String
loginName
)
{
if
(
passwordMode
==
null
)
{
passwordMode
=
""
;
}
byte
var8
=
-
1
;
switch
(
passwordMode
.
hashCode
())
{
case
77736178
:
if
(
passwordMode
.
equals
(
"SystemDefault"
))
{
var8
=
1
;
}
break
;
case
959908130
:
if
(
passwordMode
.
equals
(
"BCryptEncoded"
))
{
var8
=
0
;
}
}
switch
(
var8
)
{
case
0
:
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
password
))
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的加密后的密码参数不能为空"
);
return
inInfo
;
}
break
;
case
1
:
if
(
StringUtils
.
isNotBlank
(
defaultPassword
))
{
password
=
defaultPassword
;
}
else
{
password
=
loginName
;
}
inInfoRowMap
.
put
(
"password"
,
SecurityBridgeFactory
.
getSecurityPasswordEncrypt
().
encode
(
password
));
break
;
default
:
if
(
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
rePass
))
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的密码,确认密码不能为空"
);
return
inInfo
;
}
if
(!
rePass
.
equals
(
password
))
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"注册失败!两次输入的密码不一致"
);
return
inInfo
;
}
inInfoRowMap
.
put
(
"password"
,
SecurityBridgeFactory
.
getSecurityPasswordEncrypt
().
encode
(
password
));
}
return
null
;
}
public
EiInfo
updateUser
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
List
updatedUserList
=
new
ArrayList
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
String
passwordMode
=
inInfo
.
getString
(
"passwordMode"
);
for
(
int
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
loginName
=
(
String
)
inInfoRowMap
.
get
(
"loginName"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
String
userGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"userGroupEname"
);
String
isLocked
=
(
String
)
inInfoRowMap
.
get
(
"isLocked"
);
String
status
=
(
String
)
inInfoRowMap
.
get
(
"status"
);
String
mobile
=
(
String
)
inInfoRowMap
.
get
(
"mobile"
);
if
(
null
==
loginName
||
""
.
equals
(
loginName
)
||
null
==
recRevisor
||
""
.
equals
(
recRevisor
))
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的用户登录账号与修改人均不能为空!"
);
return
inInfo
;
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"loginName"
,
loginName
);
try
{
List
userList
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
userList
.
size
()
<
1
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"编辑用户信息失败,不存在登录账号: "
+
loginName
+
"的用户!"
);
return
inInfo
;
}
Map
userMap
=
(
Map
)
userList
.
get
(
0
);
// 手机号变更需要校验唯一性 added by songx at 2024-04-10
String
dbMobile
=
(
String
)
userMap
.
get
(
"mobile"
);
if
(
StringUtils
.
isNotBlank
(
mobile
)
&&
!
dbMobile
.
equals
(
mobile
))
{
paramMap
=
new
HashMap
();
paramMap
.
put
(
"mobile"
,
mobile
);
List
existMobile
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
CollectionUtils
.
isNotEmpty
(
existMobile
))
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"编辑用户信息失败!手机号已被其他用户使用"
);
return
inInfo
;
}
}
String
userId
=
(
String
)
userMap
.
get
(
"userId"
);
inInfoRowMap
.
put
(
"userId"
,
userId
);
if
(
null
==
userGroupEname
)
{
inInfoRowMap
.
put
(
"userGroupEname"
,
""
);
}
if
(
"-1"
.
equals
(
isLocked
))
{
inInfoRowMap
.
put
(
"isLocked"
,
"-1"
);
inInfoRowMap
.
put
(
"status"
,
"-1"
);
}
else
{
inInfoRowMap
.
put
(
"isLocked"
,
"1"
);
inInfoRowMap
.
put
(
"status"
,
"1"
);
CacheManager
.
refreshCacheKey
(
"iplat:security:loginFailCountCache"
,
loginName
);
}
if
(
"-1"
.
equals
(
status
)
||
"1"
.
equals
(
status
))
{
inInfoRowMap
.
put
(
"status"
,
status
);
}
String
gender
=
(
String
)
inInfoRowMap
.
get
(
"gender"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
gender
))
{
inInfoRowMap
.
put
(
"gender"
,
" "
);
}
String
jobId
=
(
String
)
inInfoRowMap
.
get
(
"jobId"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
jobId
))
{
inInfoRowMap
.
put
(
"jobId"
,
" "
);
}
String
jobName
=
(
String
)
inInfoRowMap
.
get
(
"jobName"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
jobName
))
{
inInfoRowMap
.
put
(
"jobName"
,
" "
);
}
String
ehrOrgId
=
(
String
)
inInfoRowMap
.
get
(
"ehrOrgId"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
ehrOrgId
))
{
inInfoRowMap
.
put
(
"ehrOrgId"
,
" "
);
}
String
password
=
(
String
)
inInfoRowMap
.
get
(
"password"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
password
)
&&
"BCryptEncoded"
.
equals
(
passwordMode
))
{
inInfoRowMap
.
put
(
"password"
,
password
);
String
accountExpireDays
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.accountExpireDays"
),
"90"
);
String
pwdExpireDays
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.pwdExpireDays"
),
"90"
);
GregorianCalendar
gc
=
new
GregorianCalendar
();
gc
.
setTime
(
DateUtils
.
toDate8
(
DateUtils
.
curDateStr8
()));
gc
.
add
(
5
,
Integer
.
parseInt
(
pwdExpireDays
));
inInfoRowMap
.
put
(
"pwdExpireDate"
,
DateUtils
.
toDateStr8
(
gc
.
getTime
()));
gc
.
setTime
(
DateUtils
.
toDate8
(
DateUtils
.
curDateStr8
()));
gc
.
add
(
5
,
Integer
.
parseInt
(
accountExpireDays
));
inInfoRowMap
.
put
(
"accountExpireDate"
,
DateUtils
.
toDateStr8
(
gc
.
getTime
()));
}
inInfoRowMap
.
put
(
"recReviseTime"
,
DateUtils
.
curDateTimeStr14
());
if
(
"on"
.
equals
(
ENABLE_EHR_INFO
))
{
this
.
dao
.
update
(
"XS01.updateWithEhrInfo"
,
inInfoRowMap
);
}
else
{
this
.
dao
.
update
(
"XS01.update"
,
inInfoRowMap
);
}
inInfoRowMap
.
remove
(
"password"
);
inInfoRowMap
.
remove
(
"rePass"
);
Map
map
=
new
HashMap
();
map
.
put
(
"userId"
,
userId
);
List
userMapList
=
this
.
dao
.
query
(
"XS01.query"
,
map
);
userMap
=
(
Map
)
userMapList
.
get
(
0
);
updatedUserList
.
add
(
userMap
);
builder
.
append
(
"编辑用户:"
+
loginName
+
"的信息成功!\n"
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1002"
);
xEyeEntity
.
setLogName
(
"修改用户信息"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口修改了登录名为 "
+
inInfoRowMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
inInfoRowMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_ln"
,
inInfoRowMap
.
get
(
"loginName"
));
this
.
log
(
xEyeEntity
);
}
catch
(
Exception
var27
)
{
builder
.
append
(
"编辑用户:"
+
loginName
+
"的信息失败!\n"
+
var27
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var27
.
getMessage
());
logger
.
error
(
var27
.
getMessage
());
}
}
if
(
updatedUserList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
updatedUserList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_17"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
builder
.
append
(
"修改用户失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
inInfo
.
setMsg
(
builder
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
return
inInfo
;
}
}
public
EiInfo
deleteUser
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
List
ExceptionInfoList
=
new
ArrayList
();
Boolean
ignoreError
=
"true"
.
equals
(
inInfo
.
getString
(
"ignoreError"
));
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
List
deletedUserList
=
new
ArrayList
();
int
i
;
for
(
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
loginName
=
(
String
)
inInfoRowMap
.
get
(
"loginName"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
if
(
null
!=
loginName
&&
!
""
.
equals
(
loginName
)
&&
null
!=
recRevisor
&&
!
""
.
equals
(
recRevisor
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"loginName"
,
loginName
);
try
{
List
userList
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
userList
.
size
()
<
1
)
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"删除用户信息失败,不存在登录账号: "
+
loginName
+
"的用户!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:删除用户信息失败,不存在登录账号: "
+
loginName
+
"的用户!\n"
);
}
else
{
Map
userMap
=
(
Map
)
userList
.
get
(
0
);
String
userId
=
(
String
)
userMap
.
get
(
"userId"
);
inInfoRowMap
.
put
(
"userId"
,
userId
);
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
EiConstant
.
serviceId
,
"S_XS_22"
);
EiBlock
block
=
new
EiBlock
(
"result"
);
eiInfo
.
setBlock
(
block
);
Map
map
=
new
HashMap
();
map
.
put
(
"memberId"
,
userId
);
List
userAsMembers
=
this
.
dao
.
query
(
"XS03.query"
,
map
);
if
(
null
!=
userAsMembers
&&
userAsMembers
.
size
()
>
0
)
{
if
(!
ignoreError
)
{
throw
new
PlatException
(
"["
+
loginName
+
"]用户有用户组成员关系,不能删除!"
);
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:["
+
loginName
+
"]用户有用户组成员关系,不能删除!\n"
);
}
else
{
map
.
put
(
"subjectId"
,
userId
);
List
userAsSubjects
=
this
.
dao
.
query
(
"XS07.query"
,
map
);
eiInfo
.
set
(
EiConstant
.
serviceId
,
"S_XS_26"
);
if
(
null
!=
userAsSubjects
&&
userAsSubjects
.
size
()
>
0
)
{
if
(!
ignoreError
)
{
throw
new
PlatException
(
"["
+
loginName
+
"]用户存在资源授权关系,不能删除!"
);
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:["
+
loginName
+
"]用户存在资源授权关系,不能删除!\n"
);
}
else
{
this
.
dao
.
delete
(
"XS01.delete"
,
inInfoRowMap
);
builder
.
append
(
"删除用户:"
+
loginName
+
"的信息成功!\n"
);
deletedUserList
.
add
(
inInfoRowMap
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1001"
);
xEyeEntity
.
setLogName
(
"删除用户"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口删除了登录名为 "
+
inInfoRowMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
inInfoRowMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_ln"
,
inInfoRowMap
.
get
(
"loginName"
));
this
.
log
(
xEyeEntity
);
}
}
}
}
catch
(
Exception
var23
)
{
builder
.
append
(
"删除用户:"
+
loginName
+
"的信息失败!\n"
+
var23
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var23
.
getMessage
());
logger
.
error
(
var23
.
getMessage
());
}
}
else
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的用户登录账号与修改人均不能为空!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入的用户登录账号与修改人均不能为空!\n"
);
}
}
if
(
deletedUserList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
deletedUserList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_16"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
builder
.
append
(
"修改用户失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
if
(
ExceptionInfoList
.
size
()
>
0
)
{
for
(
i
=
0
;
i
<
ExceptionInfoList
.
size
();
++
i
)
{
detail
.
append
(
ExceptionInfoList
.
get
(
i
));
}
}
inInfo
.
setMsg
(
builder
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
return
inInfo
;
}
}
public
EiInfo
insertUserGroup
(
EiInfo
inInfo
)
{
boolean
ignoreDuplicate
=
"true"
.
equals
(
inInfo
.
get
(
"ignoreDuplicate"
));
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuilder
buffer
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
List
insertedGroups
=
new
ArrayList
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
for
(
int
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
<
String
,
Object
>
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
groupEname
=
(
String
)
inInfoRowMap
.
get
(
"groupEname"
);
String
groupCname
=
(
String
)
inInfoRowMap
.
get
(
"groupCname"
);
String
recCreator
=
(
String
)
inInfoRowMap
.
get
(
"recCreator"
);
String
manageGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"manageGroupEname"
);
String
groupType
=
(
String
)
inInfoRowMap
.
get
(
"groupType"
);
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
groupEname
)
||
!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
groupCname
)
||
!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
recCreator
)
||
!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
groupType
))
{
inInfo
.
setMsg
(
"传入的群组英文名,中文名、群组类型及创建者均不能为空\n"
);
inInfo
.
setStatus
(-
1
);
return
inInfo
;
}
try
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"groupEname"
,
groupEname
);
List
existGroup
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
paramMap
);
if
(
null
!=
existGroup
&&
existGroup
.
size
()
>
0
)
{
if
(!
ignoreDuplicate
)
{
inInfo
.
setMsg
(
"新增第"
+
(
i
+
1
)
+
"条记录失败,该用户组已存在"
);
inInfoRowMap
.
put
(
"groupId"
,
""
);
inInfo
.
setStatus
(-
1
);
return
inInfo
;
}
}
else
{
String
groupId
=
(
String
)
inInfoRowMap
.
get
(
"groupId"
);
if
(
StringUtils
.
isBlank
(
groupId
))
{
groupId
=
XSServiceUtils
.
getUUID
();
inInfoRowMap
.
put
(
"groupId"
,
groupId
);
}
inInfoRowMap
.
put
(
"recCreateTime"
,
DateUtils
.
curDateTimeStr14
());
String
archiveFlag
=
(
String
)
inInfoRowMap
.
get
(
"archiveFlag"
);
if
(
null
==
archiveFlag
||
""
.
equals
(
archiveFlag
))
{
archiveFlag
=
"0"
;
inInfoRowMap
.
put
(
"archiveFlag"
,
archiveFlag
);
}
String
sortIndex
=
(
String
)
inInfoRowMap
.
get
(
"sortIndex"
);
if
(
StringUtils
.
isBlank
(
sortIndex
))
{
inInfoRowMap
.
put
(
"sortIndex"
,
0
);
}
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
String
recReviseTime
=
(
String
)
inInfoRowMap
.
get
(
"recReviseTime"
);
if
(!
""
.
equals
(
recRevisor
))
{
inInfoRowMap
.
put
(
"recRevisor"
,
" "
);
}
if
(!
""
.
equals
(
recReviseTime
))
{
inInfoRowMap
.
put
(
"recReviseTime"
,
" "
);
}
if
(
null
==
manageGroupEname
)
{
inInfoRowMap
.
put
(
"manageGroupEname"
,
" "
);
}
this
.
dao
.
insert
(
"XS02.insert"
,
inInfoRowMap
);
Map
map
=
new
HashMap
();
map
.
put
(
"groupId"
,
groupId
);
List
insertGroupList
=
this
.
dao
.
query
(
"XS02.query"
,
map
);
Map
groupMap
=
(
Map
)
insertGroupList
.
get
(
0
);
insertedGroups
.
add
(
groupMap
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"3300"
);
xEyeEntity
.
setLogName
(
"新增用户组"
);
xEyeEntity
.
setInvokeInfo
(
recCreator
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口新增了群组英文名为 "
+
groupEname
+
" 的用户组信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_gi"
,
inInfoRowMap
.
get
(
"groupId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recCreator
);
xEyeEntity
.
set
(
"x_xs_ge"
,
groupEname
);
this
.
log
(
xEyeEntity
);
}
}
catch
(
Exception
var26
)
{
buffer
.
append
(
"新增第"
).
append
(
i
+
1
).
append
(
"条记录失败\n"
).
append
(
var26
.
getMessage
());
inInfo
.
setStatus
(-
1
);
inInfoRowMap
.
put
(
"groupId"
,
""
);
detail
.
append
(
var26
.
getMessage
());
logger
.
error
(
var26
.
getMessage
());
return
inInfo
;
}
}
buffer
.
append
(
"新增"
).
append
(
rowCount
).
append
(
"条记录成功\n"
);
if
(
inInfo
.
getStatus
()
!=
-
1
)
{
inInfo
.
setStatus
(
1
);
}
inInfo
.
setMsg
(
buffer
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
if
(
insertedGroups
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
insertedGroups
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_18"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
buffer
.
append
(
"新增用户组失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
return
inInfo
;
}
}
public
EiInfo
updateUserGroup
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
List
updatedGroupList
=
new
ArrayList
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
for
(
int
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
groupEname
=
(
String
)
inInfoRowMap
.
get
(
"groupEname"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
String
groupId
=
(
String
)
inInfoRowMap
.
get
(
"groupId"
);
String
manageGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"manageGroupEname"
);
if
(
null
==
groupEname
||
""
.
equals
(
groupEname
)
||
null
==
recRevisor
||
""
.
equals
(
recRevisor
))
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的用户组英文名与修改人均不能为空!"
);
return
inInfo
;
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"groupEname"
,
groupEname
);
try
{
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
groupId
))
{
List
groupList
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
paramMap
);
if
(
groupList
.
size
()
<
1
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"编辑用户组信息失败,不存在英文名: "
+
groupEname
+
"的用户组!"
);
return
inInfo
;
}
Map
groupMap
=
(
Map
)
groupList
.
get
(
0
);
groupId
=
(
String
)
groupMap
.
get
(
"groupId"
);
}
inInfoRowMap
.
put
(
"groupId"
,
groupId
);
if
(
null
==
manageGroupEname
)
{
inInfoRowMap
.
put
(
"manageGroupEname"
,
" "
);
}
this
.
dao
.
update
(
"XS02.update"
,
inInfoRowMap
);
Map
map
=
new
HashMap
();
map
.
put
(
"groupId"
,
groupId
);
List
groupMapList
=
this
.
dao
.
query
(
"XS02.query"
,
map
);
Map
groupMap
=
(
Map
)
groupMapList
.
get
(
0
);
updatedGroupList
.
add
(
groupMap
);
builder
.
append
(
"编辑用户组:"
+
groupEname
+
"的信息成功!\n"
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"3302"
);
xEyeEntity
.
setLogName
(
"修改用户组"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口修改了群组英文名为 "
+
inInfoRowMap
.
get
(
"groupEname"
)
+
" 的用户组信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_gi"
,
inInfoRowMap
.
get
(
"groupId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_ge"
,
inInfoRowMap
.
get
(
"groupEname"
));
this
.
log
(
xEyeEntity
);
}
catch
(
Exception
var18
)
{
builder
.
append
(
"修改用户组:"
+
groupEname
+
"的信息失败!\n"
+
var18
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var18
.
getMessage
());
logger
.
error
(
var18
.
getMessage
());
}
}
if
(
updatedGroupList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
updatedGroupList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_20"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
builder
.
append
(
"修改用户组失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
inInfo
.
setMsg
(
builder
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
return
inInfo
;
}
}
public
EiInfo
deleteUserGroup
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
String
casadeDelete
=
""
;
if
(
"1"
.
equals
((
String
)
inInfo
.
get
(
"casadeDelete"
)))
{
casadeDelete
=
"1"
;
}
List
ExceptionInfoList
=
new
ArrayList
();
Boolean
ignoreError
=
"true"
.
equals
(
inInfo
.
getString
(
"ignoreError"
));
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
List
deletedList
=
new
ArrayList
();
int
i
;
for
(
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
groupEname
=
(
String
)
inInfoRowMap
.
get
(
"groupEname"
);
String
groupId
=
(
String
)
inInfoRowMap
.
get
(
"groupId"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
if
((
null
!=
groupId
&&
!
""
.
equals
(
groupId
)
||
null
!=
groupEname
&&
!
""
.
equals
(
groupEname
))
&&
null
!=
recRevisor
&&
!
""
.
equals
(
recRevisor
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"groupEname"
,
groupEname
);
try
{
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
groupId
))
{
List
groupList
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
paramMap
);
if
(
groupList
.
size
()
<
1
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"删除用户组信息失败,不存在英文名: "
+
groupEname
+
"的用户组!"
);
return
inInfo
;
}
Map
groupMap
=
(
Map
)
groupList
.
get
(
0
);
groupId
=
(
String
)
groupMap
.
get
(
"groupId"
);
}
AuthInfoManager
.
clearSubjectAuth
(
groupEname
);
this
.
clearUserGroupCacheById
(
groupId
,
"USER_GROUP"
);
if
(
"1"
.
equals
(
casadeDelete
))
{
this
.
dao
.
delete
(
"XSCascadeClear.cascadeDeleteUserGroupAuth"
,
paramMap
);
this
.
dao
.
delete
(
"XSCascadeClear.cascadeDeleteUserGroupDsAuth"
,
paramMap
);
paramMap
.
put
(
"groupId"
,
groupId
);
this
.
dao
.
delete
(
"XSCascadeClear.cascadeDeleteUserGroupMember"
,
paramMap
);
this
.
dao
.
delete
(
"XSCascadeClear.cascadeDeleteOrgUserGroup"
,
paramMap
);
}
else
{
EiInfo
eiInfo
=
new
EiInfo
();
EiBlock
block
=
new
EiBlock
(
"result"
);
eiInfo
.
set
(
EiConstant
.
serviceId
,
"S_XS_22"
);
eiInfo
.
setBlock
(
block
);
Map
map
=
new
HashMap
();
map
.
put
(
"memberId"
,
groupId
);
List
groupAsMembers
=
this
.
dao
.
query
(
"XS03.query"
,
map
);
if
(
null
!=
groupAsMembers
&&
groupAsMembers
.
size
()
>
0
)
{
throw
new
PlatException
(
"["
+
groupEname
+
"]用户组是其他用户组的成员,不能删除!"
);
}
map
.
put
(
"memberId"
,
""
);
map
.
put
(
"parentId"
,
groupId
);
List
groupAsParents
=
this
.
dao
.
query
(
"XS03.query"
,
map
);
if
(
null
!=
groupAsParents
&&
groupAsParents
.
size
()
>
0
)
{
throw
new
PlatException
(
"["
+
groupEname
+
"]用户组下存在成员关系,不能删除!"
);
}
map
.
put
(
"subjectId"
,
groupId
);
List
groupAsSubjects
=
this
.
dao
.
query
(
"XS07.query"
,
map
);
eiInfo
.
set
(
EiConstant
.
serviceId
,
"S_XS_26"
);
if
(
null
!=
groupAsSubjects
&&
groupAsSubjects
.
size
()
>
0
)
{
throw
new
PlatException
(
"["
+
groupEname
+
"]用户组存在授权关系,不能删除!"
);
}
map
.
put
(
"authGroupId"
,
groupId
);
List
groupDataAuth
=
this
.
dao
.
query
(
"XS10.query"
,
map
);
eiInfo
.
set
(
EiConstant
.
serviceId
,
"S_XS_31"
);
if
(
null
!=
groupDataAuth
&&
groupDataAuth
.
size
()
>
0
)
{
throw
new
PlatException
(
"["
+
groupEname
+
"]用户组存在数据集授权关系,不能删除!"
);
}
}
inInfoRowMap
.
put
(
"groupId"
,
groupId
);
this
.
dao
.
delete
(
"XS02.delete"
,
inInfoRowMap
);
deletedList
.
add
(
inInfoRowMap
);
builder
.
append
(
"删除用户组:"
+
groupEname
+
"的信息成功!\n"
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"3301"
);
xEyeEntity
.
setLogName
(
" 删除用户组"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口删除了群组英文名为 "
+
inInfoRowMap
.
get
(
"groupEname"
)
+
" 的用户组信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_gi"
,
inInfoRowMap
.
get
(
"groupId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_ge"
,
inInfoRowMap
.
get
(
"groupEname"
));
this
.
log
(
xEyeEntity
);
}
catch
(
Exception
var23
)
{
builder
.
append
(
"删除用户组:"
+
groupEname
+
"的信息失败!\n"
+
var23
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var23
.
getMessage
());
logger
.
error
(
var23
.
getMessage
());
}
}
else
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的用户组ID或英文名,与修改人均不能为空!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入的用户组ID或英文名,与修改人均不能为空!\n"
);
}
}
if
(
deletedList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
deletedList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_19"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
builder
.
append
(
"删除用户组失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
if
(
ExceptionInfoList
.
size
()
>
0
)
{
for
(
i
=
0
;
i
<
ExceptionInfoList
.
size
();
++
i
)
{
detail
.
append
(
ExceptionInfoList
.
get
(
i
));
}
}
if
(
inInfo
.
getStatus
()
!=
-
1
)
{
inInfo
.
setMsg
(
builder
.
toString
());
}
else
{
inInfo
.
setMsg
(
"删除失败,请关注消息明细"
);
}
inInfo
.
setDetailMsg
(
detail
.
toString
());
return
inInfo
;
}
}
private
void
changeRecRevisor
(
List
list
,
String
recRevisor
)
{
Iterator
var3
=
list
.
iterator
();
while
(
var3
.
hasNext
())
{
Object
obj
=
var3
.
next
();
Map
parent
=
(
Map
)
obj
;
parent
.
put
(
"recRevisor"
,
recRevisor
);
}
}
public
EiInfo
insertGroupMember
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
StringBuilder
buffer
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
boolean
ignoreDuplicate
=
"true"
.
equals
(
inInfo
.
get
(
"ignoreDuplicate"
));
List
memberList
=
new
ArrayList
();
List
errList
=
new
ArrayList
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
for
(
int
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
<
String
,
Object
>
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
Map
errMap
=
new
HashMap
();
inInfoRowMap
.
put
(
"recCreateTime"
,
DateUtils
.
curDateTimeStr14
());
String
memberName
=
(
String
)
inInfoRowMap
.
get
(
"memberName"
);
String
parentName
=
(
String
)
inInfoRowMap
.
get
(
"parentName"
);
String
memberId
=
(
String
)
inInfoRowMap
.
get
(
"memberId"
);
String
parentId
=
(
String
)
inInfoRowMap
.
get
(
"parentId"
);
String
memberType
=
(
String
)
inInfoRowMap
.
get
(
"memberType"
);
String
recCreator
=
(
String
)
inInfoRowMap
.
get
(
"recCreator"
);
if
((
null
!=
memberName
&&
!
""
.
equals
(
memberName
)
||
null
!=
memberId
&&
!
""
.
equals
(
memberId
))
&&
(
null
!=
parentName
&&
!
""
.
equals
(
parentName
)
||
null
!=
parentId
&&
!
""
.
equals
(
parentId
))
&&
null
!=
memberType
&&
!
""
.
equals
(
memberType
)
&&
null
!=
recCreator
&&
!
""
.
equals
(
recCreator
))
{
try
{
Map
paramMap
=
new
HashMap
();
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
memberId
))
{
memberId
=
AuthenticationInfo
.
getSubjectId
(
memberType
,
memberName
);
if
(
memberId
==
null
)
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"reason"
,
"传入的成员名称的信息不存在或成员类型有误!"
);
errList
.
add
(
errMap
);
continue
;
}
}
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
parentId
))
{
paramMap
.
put
(
"groupEname"
,
parentName
);
List
parents
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
paramMap
);
if
(
parents
.
size
()
<
1
)
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"reason"
,
"传入的父用户组的信息不存在!"
);
errList
.
add
(
errMap
);
continue
;
}
parentId
=
((
Map
)
parents
.
get
(
0
)).
get
(
"groupId"
).
toString
();
}
Map
queryParam
=
new
HashMap
();
queryParam
.
put
(
"memberId"
,
memberId
);
queryParam
.
put
(
"parentId"
,
parentId
);
List
list
=
this
.
dao
.
query
(
"XS03.query"
,
queryParam
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
if
(!
ignoreDuplicate
)
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"reason"
,
"已存在该记录!"
);
errList
.
add
(
errMap
);
}
}
else
{
EiInfo
eiInfo
=
new
EiInfo
();
EiInfo
groupInfo
=
null
;
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_00"
);
eiInfo
.
set
(
"groupId"
,
parentId
);
eiInfo
.
set
(
"memberId"
,
memberId
);
groupInfo
=
XEventManager
.
call
(
eiInfo
);
int
groupStatus
=
groupInfo
.
getStatus
();
if
(
groupStatus
<
0
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
groupInfo
.
getMsg
());
return
inInfo
;
}
String
archiveFlag
=
(
String
)
inInfoRowMap
.
get
(
"archiveFlag"
);
if
(
null
==
archiveFlag
||
""
.
equals
(
archiveFlag
))
{
archiveFlag
=
"0"
;
inInfoRowMap
.
put
(
"archiveFlag"
,
archiveFlag
);
}
String
sortIndex
=
(
String
)
inInfoRowMap
.
get
(
"sortIndex"
);
if
(
StringUtils
.
isBlank
(
sortIndex
))
{
inInfoRowMap
.
put
(
"sortIndex"
,
0
);
}
if
(
null
==
inInfoRowMap
.
get
(
"path"
))
{
inInfoRowMap
.
put
(
"path"
,
" "
);
}
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
String
recReviseTime
=
(
String
)
inInfoRowMap
.
get
(
"recReviseTime"
);
if
(!
""
.
equals
(
recRevisor
))
{
inInfoRowMap
.
put
(
"recRevisor"
,
" "
);
}
if
(!
""
.
equals
(
recReviseTime
))
{
inInfoRowMap
.
put
(
"recReviseTime"
,
" "
);
}
inInfoRowMap
.
put
(
"memberId"
,
memberId
);
inInfoRowMap
.
put
(
"parentId"
,
parentId
);
this
.
dao
.
insert
(
"XS03.insert"
,
inInfoRowMap
);
Map
map
=
new
HashMap
();
map
.
put
(
"memberId"
,
memberId
);
map
.
put
(
"parentId"
,
parentId
);
if
(
JudgeCircleUtils
.
judgeCircle
(
"XS03.queryParentInfo"
,
"XS03.queryChildInfo"
,
parentId
,
memberId
).
getStatus
()
<
0
)
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"memberId"
,
memberId
);
errMap
.
put
(
"parentId"
,
parentId
);
errMap
.
put
(
"reason"
,
"插入数据或原有数据将导致节点循环嵌套,请检查插入数据或原有数据!"
);
errList
.
add
(
errMap
);
}
else
{
List
insertMemberList
=
this
.
dao
.
query
(
"XS03.query"
,
map
);
Map
insertMemberMap
=
(
Map
)
insertMemberList
.
get
(
0
);
memberList
.
add
(
insertMemberMap
);
try
{
if
(
memberName
==
null
)
{
memberName
=
(
String
)
insertMemberMap
.
get
(
"memberEname"
);
}
if
(
memberName
!=
null
)
{
this
.
clearUserGroupCacheById
(
memberId
,
memberType
);
}
}
catch
(
Exception
var32
)
{
logger
.
warn
(
"刷新缓存出错!请注意手动刷新!原因:"
+
var32
.
getMessage
(),
var32
);
}
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"3303"
);
xEyeEntity
.
setLogName
(
"为用户组添加新的成员"
);
xEyeEntity
.
setInvokeInfo
(
recCreator
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口将 "
+
inInfoRowMap
.
get
(
"memberName"
)
+
"添加为"
+
inInfoRowMap
.
get
(
"parentName"
)
+
" 用户组的成员"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_mi"
,
memberId
);
xEyeEntity
.
set
(
"x_xs_pi"
,
parentId
);
xEyeEntity
.
set
(
"x_xs_on"
,
recCreator
);
xEyeEntity
.
set
(
"x_xs_mn"
,
inInfoRowMap
.
get
(
"memberName"
));
xEyeEntity
.
set
(
"x_xs_pn"
,
inInfoRowMap
.
get
(
"parentName"
));
this
.
log
(
xEyeEntity
);
}
}
}
catch
(
Exception
var33
)
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"reason"
,
var33
.
getMessage
());
errList
.
add
(
errMap
);
logger
.
error
(
var33
.
getMessage
());
}
}
else
{
errMap
.
put
(
"index"
,
i
);
errMap
.
put
(
"memberName"
,
memberName
);
errMap
.
put
(
"reason"
,
"传入成员ID或名称,父节点ID或名称,成员类别及创建人均不能为空!"
);
errList
.
add
(
errMap
);
}
}
if
(
errList
.
size
()
==
0
)
{
inInfo
.
setStatus
(
1
);
inInfo
.
setMsg
(
"总数据共"
+
rowCount
+
"条,成功导入"
+
rowCount
+
"条数据,失败0条"
);
}
else
{
inInfo
.
set
(
"errList"
,
errList
);
inInfo
.
setStatus
(-
1
);
StringBuffer
errMsg
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
errList
.
size
();
++
i
)
{
Map
errMap
=
(
Map
)
errList
.
get
(
i
);
int
errIndex
=
(
Integer
)
errMap
.
get
(
"index"
)
+
1
;
errMsg
.
append
(
"第"
+
errIndex
+
"条数据:"
+
errMap
.
get
(
"reason"
)
+
"\n"
);
}
inInfo
.
setMsg
(
"数据导入失败,总数据共"
+
rowCount
+
"条,错误数据"
+
errList
.
size
()
+
"条。\n错误信息如下:\n"
+
errMsg
.
toString
());
}
if
(
memberList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
memberList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_21"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
buffer
.
append
(
"新增用户组成员失败\n"
+
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
return
inInfo
;
}
}
public
EiInfo
deleteGroupMember
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
List
ExceptionInfoList
=
new
ArrayList
();
Boolean
ignoreError
=
"true"
.
equals
(
inInfo
.
getString
(
"ignoreError"
));
StringBuilder
buffer
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
List
deletedList
=
new
ArrayList
();
int
i
;
for
(
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
<
String
,
Object
>
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
memberName
=
(
String
)
inInfoRowMap
.
get
(
"memberName"
);
String
parentName
=
(
String
)
inInfoRowMap
.
get
(
"parentName"
);
String
memberType
=
(
String
)
inInfoRowMap
.
get
(
"memberType"
);
String
memberId
=
(
String
)
inInfoRowMap
.
get
(
"memberId"
);
String
parentId
=
(
String
)
inInfoRowMap
.
get
(
"parentId"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
if
((
null
!=
memberName
&&
!
""
.
equals
(
memberName
)
||
null
!=
memberId
&&
!
""
.
equals
(
memberId
))
&&
(
null
!=
parentName
&&
!
""
.
equals
(
parentName
)
||
null
!=
parentId
&&
!
""
.
equals
(
parentId
))
&&
null
!=
memberType
&&
!
""
.
equals
(
memberType
)
&&
null
!=
recRevisor
&&
!
""
.
equals
(
recRevisor
))
{
String
checkSqlId
=
null
;
HashMap
queryMap
;
List
queryList
;
Map
deleteMap
;
if
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
memberId
)
&&
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
parentId
))
{
queryMap
=
new
HashMap
();
queryMap
.
put
(
"memberId"
,
memberId
);
queryMap
.
put
(
"parentId"
,
parentId
);
queryList
=
this
.
dao
.
query
(
"XS03.query"
,
queryMap
);
if
(
queryList
.
size
()
>
0
)
{
deleteMap
=
(
Map
)
queryList
.
get
(
0
);
this
.
dao
.
delete
(
"XS03.delete"
,
inInfoRowMap
);
deletedList
.
add
(
deleteMap
);
buffer
.
append
(
"删除第"
+
(
i
+
1
)
+
"条记录成功\n"
);
try
{
if
(
memberName
==
null
)
{
memberName
=
(
String
)
deleteMap
.
get
(
"memberEname"
);
}
if
(
memberId
!=
null
)
{
this
.
clearUserGroupCacheById
(
memberId
,
memberType
);
}
}
catch
(
Exception
var22
)
{
logger
.
warn
(
"刷新缓存出错!请注意手动刷新!原因:"
+
var22
.
getMessage
(),
var22
);
}
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"3304"
);
xEyeEntity
.
setLogName
(
"解除用户组与成员的关系"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口解除了 "
+
inInfoRowMap
.
get
(
"memberName"
)
+
"与"
+
inInfoRowMap
.
get
(
"parentName"
)
+
" 用户组的成员关系"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_mi"
,
memberId
);
xEyeEntity
.
set
(
"x_xs_pi"
,
parentId
);
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_mn"
,
inInfoRowMap
.
get
(
"memberName"
));
xEyeEntity
.
set
(
"x_xs_pn"
,
inInfoRowMap
.
get
(
"parentName"
));
this
.
log
(
xEyeEntity
);
}
}
else
{
try
{
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
memberId
))
{
memberId
=
AuthenticationInfo
.
getSubjectId
(
memberType
,
memberName
);
if
(
memberId
==
null
)
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的成员,父节点没有对应的用户或用户组信息!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入的成员,父节点没有对应的用户或用户组信息!\n"
);
continue
;
}
}
if
(!
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
parentId
))
{
queryMap
=
new
HashMap
();
queryMap
.
put
(
"groupEname"
,
parentName
);
queryList
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
queryMap
);
if
(
queryList
.
size
()
<
1
)
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的成员,父节点没有对应的用户或用户组信息!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入的成员,父节点没有对应的用户或用户组信息!\n"
);
continue
;
}
parentId
=
((
Map
)
queryList
.
get
(
0
)).
get
(
"groupId"
).
toString
();
}
queryMap
=
new
HashMap
();
queryMap
.
put
(
"memberId"
,
memberId
);
queryMap
.
put
(
"parentId"
,
parentId
);
queryList
=
this
.
dao
.
query
(
"XS03.query"
,
queryMap
);
if
(
queryList
.
size
()
<
1
)
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"删除失败,不存在的用户组成员关系!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:删除失败,不存在的用户组成员关系!\n"
);
}
else
{
inInfoRowMap
.
put
(
"memberId"
,
memberId
);
inInfoRowMap
.
put
(
"parentId"
,
parentId
);
this
.
dao
.
delete
(
"XS03.delete"
,
inInfoRowMap
);
deletedList
.
add
(
queryList
.
get
(
0
));
try
{
if
(
memberName
==
null
)
{
deleteMap
=
(
Map
)
queryList
.
get
(
0
);
memberName
=
(
String
)
deleteMap
.
get
(
"memberEname"
);
}
if
(
memberName
!=
null
)
{
this
.
clearUserGroupCacheById
(
memberId
,
memberType
);
}
}
catch
(
Exception
var23
)
{
logger
.
warn
(
"刷新缓存出错!请注意手动刷新!原因:"
+
var23
.
getMessage
(),
var23
);
}
}
}
catch
(
Exception
var24
)
{
buffer
.
append
(
"删除第"
+
(
i
+
1
)
+
"条记录失败\n"
+
var24
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var24
.
getMessage
());
logger
.
error
(
var24
.
getMessage
());
return
inInfo
;
}
}
}
else
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入成员ID或名称,父节点ID或名称,成员类别及修改人均不能为空!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入成员ID或名称,父节点ID或名称,成员类别及修改人均不能为空!\n"
);
}
}
if
(
ExceptionInfoList
.
size
()
>
0
)
{
for
(
i
=
0
;
i
<
ExceptionInfoList
.
size
();
++
i
)
{
detail
.
append
(
ExceptionInfoList
.
get
(
i
));
}
buffer
.
append
(
"删除"
+
(
rowCount
-
ExceptionInfoList
.
size
())
+
"条记录成功\n"
);
inInfo
.
setDetailMsg
(
detail
.
toString
());
}
else
{
buffer
.
append
(
"删除"
+
rowCount
+
"条记录成功\n"
);
}
inInfo
.
setMsg
(
buffer
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
if
(
deletedList
.
size
()
>
0
)
{
EiInfo
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"list"
,
deletedList
);
eiInfo
.
set
(
EiConstant
.
eventId
,
"E_XS_22"
);
EiInfo
outInfo
=
XEventManager
.
call
(
eiInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
buffer
.
append
(
"新增用户组成员失败\n"
).
append
(
outInfo
.
getMsg
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
outInfo
.
getDetailMsg
());
}
}
return
inInfo
;
}
}
private
void
clearUserGroupCacheById
(
String
memberId
,
String
memberType
)
{
Map
map
=
new
HashMap
();
map
.
put
(
"memberId"
,
memberId
);
List
<
Map
>
query
=
this
.
dao
.
query
(
"XS03.queryEnameByMemberId"
,
map
);
String
subjectEname
=
""
;
if
(
query
.
size
()
>
0
&&
((
Map
)
query
.
get
(
0
)).
get
(
"subjectEname"
)
!=
null
&&
!
""
.
equals
(((
Map
)
query
.
get
(
0
)).
get
(
"subjectEname"
)))
{
subjectEname
=
(
String
)((
Map
)
query
.
get
(
0
)).
get
(
"subjectEname"
);
AuthInfoManager
.
removeGroupMemberInfo
(
subjectEname
,
memberType
,
(
List
)
null
);
}
}
public
EiInfo
getUserInfoByLoginName
(
EiInfo
inInfo
)
{
String
loginName
=
(
String
)
inInfo
.
get
(
"loginName"
);
int
status
=
0
;
String
msg
=
""
;
try
{
if
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
loginName
))
{
Map
map
=
new
HashMap
();
map
.
put
(
"loginName"
,
loginName
);
List
result
=
this
.
dao
.
query
(
"XSUser.query"
,
map
);
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
msg
=
"该账号存在"
;
status
=
1
;
}
}
else
{
msg
=
"传入的登录账号不能为空"
;
}
}
catch
(
Exception
var7
)
{
logger
.
error
(
var7
.
getMessage
());
status
=
-
1
;
}
inInfo
.
setMsg
(
msg
);
inInfo
.
setStatus
(
status
);
return
inInfo
;
}
public
EiInfo
isAdmin
(
EiInfo
inInfo
)
{
int
status
=
-
1
;
String
msg
=
""
;
String
loginName
=
inInfo
.
get
(
"loginName"
).
toString
();
try
{
if
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
loginName
))
{
Map
map
=
new
HashMap
();
map
.
put
(
"loginName"
,
loginName
);
List
result
=
this
.
dao
.
query
(
"XSUser.query"
,
map
);
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
boolean
flag
=
LoginUserDetails
.
isUserAdmin
(
loginName
);
if
(
flag
)
{
msg
=
"该用户是系统管理员"
;
status
=
1
;
}
else
{
msg
=
"该用户不是系统管理员"
;
status
=
0
;
}
}
else
{
msg
=
"不存在该用户"
;
status
=
0
;
}
}
else
{
msg
=
"登录账号不能为空"
;
}
}
catch
(
Exception
var8
)
{
logger
.
error
(
var8
.
getMessage
());
}
inInfo
.
setMsg
(
msg
);
inInfo
.
setStatus
(
status
);
return
inInfo
;
}
public
EiInfo
getResourceAuthByUserGroup
(
EiInfo
eiInfo
)
{
String
msg
=
""
;
int
status
=
0
;
List
subjectList
=
null
;
String
subjectId
=
""
;
String
groupEname
=
eiInfo
.
get
(
"groupEname"
).
toString
();
String
resourceType
=
eiInfo
.
getString
(
"resourceType"
);
try
{
if
(
null
!=
groupEname
&&
!
""
.
equals
(
groupEname
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"groupEname"
,
groupEname
);
subjectList
=
this
.
dao
.
query
(
"XSUserManage.queryUserGroup"
,
paramMap
);
if
(
null
!=
subjectList
&&
subjectList
.
size
()
>
0
)
{
subjectId
=
((
Map
)
subjectList
.
get
(
0
)).
get
(
"groupId"
).
toString
();
}
Map
map
=
new
HashMap
();
if
(
null
!=
subjectId
&&
!
""
.
equals
(
subjectId
))
{
map
.
put
(
"subjectId"
,
subjectId
);
if
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
isNotEmpty
(
resourceType
))
{
map
.
put
(
"resourceType"
,
resourceType
);
}
List
list
=
this
.
dao
.
query
(
"XS07.query"
,
map
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
status
=
1
;
msg
=
"该用户组下存在授权的资源权限信息!"
;
eiInfo
.
set
(
"result"
,
list
);
}
else
{
msg
=
"该用户组下没有授权的资源权限信息!"
;
}
}
}
else
{
msg
=
"传入的用户组英文名不能为空!"
;
status
=
-
1
;
}
}
catch
(
Exception
var11
)
{
logger
.
error
(
var11
.
getMessage
());
status
=
-
1
;
msg
=
var11
.
getMessage
();
}
eiInfo
.
setMsg
(
msg
);
eiInfo
.
setStatus
(
status
);
return
eiInfo
;
}
public
EiInfo
forceDeleteUser
(
EiInfo
inInfo
)
{
XSServiceUtils
.
apiDataHandleDecorator
(
inInfo
);
if
(
inInfo
.
getStatus
()
==
-
1
)
{
return
inInfo
;
}
else
{
List
ExceptionInfoList
=
new
ArrayList
();
Boolean
ignoreError
=
"true"
.
equals
(
inInfo
.
getString
(
"ignoreError"
));
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
"result"
);
int
rowCount
=
eiBlock
.
getRowCount
();
List
deletedUserList
=
new
ArrayList
();
int
i
;
for
(
i
=
0
;
i
<
rowCount
;
++
i
)
{
Map
inInfoRowMap
=
eiBlock
.
getRow
(
i
);
String
loginName
=
(
String
)
inInfoRowMap
.
get
(
"loginName"
);
String
recRevisor
=
(
String
)
inInfoRowMap
.
get
(
"recRevisor"
);
if
(
null
!=
loginName
&&
!
""
.
equals
(
loginName
)
&&
null
!=
recRevisor
&&
!
""
.
equals
(
recRevisor
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"loginName"
,
loginName
);
try
{
List
userList
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
userList
.
size
()
<
1
)
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(
0
);
inInfo
.
setMsg
(
"不需要清理账号,不存在登录账号: "
+
loginName
+
"的用户!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:不需要清理账号,不存在登录账号: "
+
loginName
+
"的用户!\n"
);
}
else
{
Map
userMap
=
(
Map
)
userList
.
get
(
0
);
String
userId
=
(
String
)
userMap
.
get
(
"userId"
);
inInfoRowMap
.
put
(
"userId"
,
userId
);
Map
map
=
new
HashMap
();
map
.
put
(
"memberId"
,
userId
);
List
userAsMembers
=
this
.
dao
.
query
(
"XS03.query"
,
map
);
if
(
null
!=
userAsMembers
&&
userAsMembers
.
size
()
>
0
)
{
this
.
dao
.
delete
(
"XSUserManage.clearMember"
,
map
);
}
map
.
put
(
"subjectId"
,
userId
);
List
userAsSubjects
=
this
.
dao
.
query
(
"XS07.query"
,
map
);
if
(
null
!=
userAsSubjects
&&
userAsSubjects
.
size
()
>
0
)
{
this
.
dao
.
delete
(
"XSUserManage.clearAuth"
,
map
);
}
this
.
dao
.
delete
(
"XS01.delete"
,
inInfoRowMap
);
builder
.
append
(
"强制清理用户:"
+
loginName
+
"的信息成功!\n"
);
deletedUserList
.
add
(
inInfoRowMap
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1001"
);
xEyeEntity
.
setLogName
(
"删除用户"
);
xEyeEntity
.
setInvokeInfo
(
recRevisor
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"调用接口强制清理了登录名为 "
+
inInfoRowMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
inInfoRowMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
recRevisor
);
xEyeEntity
.
set
(
"x_xs_ln"
,
inInfoRowMap
.
get
(
"loginName"
));
PlatEye
.
linkTrace
(
xEyeEntity
);
}
}
catch
(
Exception
var21
)
{
builder
.
append
(
"强制清理用户:"
+
loginName
+
"的信息失败!\n"
+
var21
.
getMessage
());
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var21
.
getMessage
());
logger
.
error
(
var21
.
getMessage
());
}
}
else
{
if
(!
ignoreError
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"传入的用户登录账号与修改人均不能为空!"
);
return
inInfo
;
}
ExceptionInfoList
.
add
(
"第"
+
(
i
+
1
)
+
"行数据异常:传入的用户登录账号与修改人均不能为空!\n"
);
}
}
if
(
ExceptionInfoList
.
size
()
>
0
)
{
for
(
i
=
0
;
i
<
ExceptionInfoList
.
size
();
++
i
)
{
detail
.
append
(
ExceptionInfoList
.
get
(
i
));
}
}
inInfo
.
setMsg
(
builder
.
toString
());
inInfo
.
setDetailMsg
(
detail
.
toString
());
System
.
out
.
println
(
inInfo
.
toJSONString
());
return
inInfo
;
}
}
}
src/main/java/com/baosight/xservices/xs/sql/XSUser.xml
View file @
67395f14
...
...
@@ -52,7 +52,10 @@
USER_NAME like ('%$userName$%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"loginName"
>
LOGIN_NAME = #loginName#
(LOGIN_NAME = #loginName# OR MOBILE = #loginName#)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"mobile"
>
MOBILE = #mobile#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"userType"
>
USER_TYPE = #userType#
...
...
src/main/webapp/XS/XS3201.js
View file @
67395f14
...
...
@@ -162,7 +162,7 @@ $(function () {
return
}
$
(
"#authWindow"
).
data
(
"kendoWindow"
).
open
()
result4Grid
.
dataSource
.
page
(
1
);
//
result4Grid.dataSource.page(1);
result5Grid
.
dataSource
.
page
(
1
);
})
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment