Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
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
王衍超
cloud-fb
Commits
f27ceb4b
Commit
f27ceb4b
authored
Mar 19, 2021
by
王衍超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加采砂用户体系;
parent
e8c61f88
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
1922 additions
and
16 deletions
+1922
-16
SecurityConfig.java
...war/src/main/java/com/beecode/inz/war/SecurityConfig.java
+95
-1
AuthenticationConfiguration.java
...nz/authentication/config/AuthenticationConfiguration.java
+11
-0
SandUserAuthenticationSuccessHandler.java
...ication/handler/SandUserAuthenticationSuccessHandler.java
+99
-0
SandUserAuthProvider.java
...ode/inz/authentication/provider/SandUserAuthProvider.java
+53
-0
CommonConfig.java
.../main/java/com/beecode/inz/basis/config/CommonConfig.java
+25
-0
CommonBaseConst.java
...m/beecode/inz/basis/config/constants/CommonBaseConst.java
+36
-0
SandUserConstants.java
...beecode/inz/basis/config/constants/SandUserConstants.java
+17
-0
SandUser.mk
.../main/java/com/beecode/inz/basis/context/sand/SandUser.mk
+79
-0
SandUserContext.java
...a/com/beecode/inz/basis/context/sand/SandUserContext.java
+17
-0
SandUserContextConstants.java
...code/inz/basis/context/sand/SandUserContextConstants.java
+10
-0
SandUserContextHolder.java
...beecode/inz/basis/context/sand/SandUserContextHolder.java
+53
-0
SandUserContextImpl.java
...m/beecode/inz/basis/context/sand/SandUserContextImpl.java
+57
-0
SandUserContextPersistenceFilter.java
.../basis/context/sand/SandUserContextPersistenceFilter.java
+90
-0
SandUserContextRepository.java
...ode/inz/basis/context/sand/SandUserContextRepository.java
+242
-0
SandUserDaoImpl.java
...a/com/beecode/inz/basis/internal/dao/SandUserDaoImpl.java
+50
-0
SandUserServiceImpl.java
...ecode/inz/basis/internal/service/SandUserServiceImpl.java
+188
-0
SandUser.java
...is/src/main/java/com/beecode/inz/basis/pojo/SandUser.java
+331
-0
SandUserService.java
...n/java/com/beecode/inz/basis/service/SandUserService.java
+58
-0
SandUserController.java
...in/java/com/beecode/inz/basis/web/SandUserController.java
+69
-0
SandUser.jmx
...in/resources/com/beecode/inz/basis/datamodel/SandUser.jmx
+258
-0
SandUser.hbm.xml
backend/inz.basis/src/main/resources/config/SandUser.hbm.xml
+69
-0
Position$sequence.jmx
...n/resources/com/xyst/dinas/biz/bill/Position$sequence.jmx
+1
-1
Position$serial.jmx
...ain/resources/com/xyst/dinas/biz/bill/Position$serial.jmx
+1
-1
Position.jmx
...z/src/main/resources/com/xyst/dinas/biz/bill/Position.jmx
+1
-1
BusinessTripApply$sequence.jmx
...ces/com/xyst/dinas/oa/bill/BusinessTripApply$sequence.jmx
+1
-1
BusinessTripApply$serial.jmx
...urces/com/xyst/dinas/oa/bill/BusinessTripApply$serial.jmx
+1
-1
BusinessTripApply.jmx
...in/resources/com/xyst/dinas/oa/bill/BusinessTripApply.jmx
+1
-1
ProtocolDocument$sequence.jmx
...rces/com/xyst/dinas/oa/bill/ProtocolDocument$sequence.jmx
+1
-1
ProtocolDocument$serial.jmx
...ources/com/xyst/dinas/oa/bill/ProtocolDocument$serial.jmx
+1
-1
ProtocolDocument.jmx
...ain/resources/com/xyst/dinas/oa/bill/ProtocolDocument.jmx
+1
-1
SealBorrow$sequence.jmx
.../resources/com/xyst/dinas/oa/bill/SealBorrow$sequence.jmx
+1
-1
SealBorrow$serial.jmx
...in/resources/com/xyst/dinas/oa/bill/SealBorrow$serial.jmx
+1
-1
SealBorrow.jmx
.../src/main/resources/com/xyst/dinas/oa/bill/SealBorrow.jmx
+1
-1
UseCarApply$sequence.jmx
...resources/com/xyst/dinas/oa/bill/UseCarApply$sequence.jmx
+1
-1
UseCarApply$serial.jmx
...n/resources/com/xyst/dinas/oa/bill/UseCarApply$serial.jmx
+1
-1
UseCarApply.jmx
...src/main/resources/com/xyst/dinas/oa/bill/UseCarApply.jmx
+1
-1
No files found.
backend/build.war/src/main/java/com/beecode/inz/war/SecurityConfig.java
View file @
f27ceb4b
...
...
@@ -53,10 +53,13 @@ import com.beecode.inz.authentication.handler.RESTAuthenticationEntryPoint;
import
com.beecode.inz.authentication.handler.RESTAuthenticationFailureHandler
;
import
com.beecode.inz.authentication.handler.RESTAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.handler.RESTWarehouseUserAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.handler.SandUserAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.provider.AppUserAuthenticationProvider
;
import
com.beecode.inz.authentication.provider.SandUserAuthProvider
;
import
com.beecode.inz.authentication.provider.UserAuthenticationProvider
;
import
com.beecode.inz.authentication.provider.WarehouseUserAuthenticationProvider
;
import
com.beecode.inz.basis.context.customer.CustomerContextRepository
;
import
com.beecode.inz.basis.context.sand.SandUserContextPersistenceFilter
;
import
com.beecode.inz.basis.context.sand.SandUserContextRepository
;
import
com.beecode.inz.basis.context.warehouse.WarehouseUserContextPersistenceFilter
;
import
com.beecode.inz.basis.context.warehouse.WarehouseUserContextRepository
;
...
...
@@ -117,6 +120,16 @@ public class SecurityConfig {
@Autowired
private
WarehouseUserContextRepository
warehouseUserContextRepository
;
//采砂用户
@Autowired
private
SandUserAuthenticationSuccessHandler
sandUserAuthenticationSuccessHandler
;
@Autowired
private
SandUserAuthProvider
sandUserAuthProvider
;
@Autowired
private
SandUserContextRepository
sandUserContextRepository
;
@Autowired
private
RestLogoutHandler
CLogoutHandler
;
...
...
@@ -267,6 +280,87 @@ public class SecurityConfig {
@Configuration
@Order
(
4
)
public
class
SandUserSecurityConfigurerAdapter
extends
WebSecurityConfigurerAdapter
{
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
List
<
SessionAuthenticationStrategy
>
delegateStrategies
=
new
ArrayList
<
SessionAuthenticationStrategy
>();
delegateStrategies
.
add
(
concurrentSessionControlAuthenticationStrategy
);
http
.
sessionManagement
().
maximumSessions
(
1
);
http
.
csrf
().
disable
();
http
.
cors
().
disable
();
http
.
antMatcher
(
"/sand/user/login"
).
authorizeRequests
().
anyRequest
().
authenticated
();
http
.
exceptionHandling
().
authenticationEntryPoint
(
authenticationEntryPoint
);
InzWebAuthenticationFilter
filter
=
new
InzWebAuthenticationFilter
();
filter
.
setAuthenticationSuccessHandler
(
sandUserAuthenticationSuccessHandler
);
filter
.
setAuthenticationFailureHandler
(
authenticationFailureHandler
);
filter
.
setAuthenticationManager
(
authenticationManager
());
filter
.
setSessionAuthenticationStrategy
(
new
CompositeSessionAuthenticationStrategy
(
delegateStrategies
));
RequestMatcher
requestMatcher
=
new
AntPathRequestMatcher
(
"/sand/user/login"
,
"POST"
);
filter
.
setRequiresAuthenticationRequestMatcher
(
requestMatcher
);
http
.
addFilterAt
(
filter
,
UsernamePasswordAuthenticationFilter
.
class
);
InzConcurrentSessionFilter
inzConcurrentSessionFilter
=
new
InzConcurrentSessionFilter
(
sessionRegistry
)
;
http
.
addFilterAt
(
inzConcurrentSessionFilter
,
ConcurrentSessionFilter
.
class
);
SandUserContextPersistenceFilter
contextPersistenceFilter
=
new
SandUserContextPersistenceFilter
(
metadataRuntime
,
sandUserContextRepository
);
http
.
addFilterAfter
(
contextPersistenceFilter
,
SecurityContextPersistenceFilter
.
class
);
http
.
addFilterAfter
(
new
INZTenantAuthenticationFilter
(),
UsernamePasswordAuthenticationFilter
.
class
);
}
@Override
protected
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
authenticationProvider
(
sandUserAuthProvider
);
}
@Override
protected
AuthenticationManager
authenticationManager
()
throws
Exception
{
return
super
.
authenticationManager
();
}
}
@Configuration
@Order
(
5
)
public
class
SandApiConfigurerAdapter
extends
WebSecurityConfigurerAdapter
{
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
List
<
SessionAuthenticationStrategy
>
delegateStrategies
=
new
ArrayList
<
SessionAuthenticationStrategy
>();
delegateStrategies
.
add
(
concurrentSessionControlAuthenticationStrategy
);
http
.
sessionManagement
().
maximumSessions
(
1
);
http
.
csrf
().
disable
();
http
.
cors
().
disable
();
http
.
antMatcher
(
"/sand/**"
).
authorizeRequests
()
.
antMatchers
(
"/sand/user"
).
permitAll
()
.
anyRequest
().
authenticated
();
http
.
exceptionHandling
().
authenticationEntryPoint
(
authenticationEntryPoint
);
InzConcurrentSessionFilter
inzConcurrentSessionFilter
=
new
InzConcurrentSessionFilter
(
sessionRegistry
)
;
http
.
addFilterAt
(
inzConcurrentSessionFilter
,
ConcurrentSessionFilter
.
class
);
SandUserContextPersistenceFilter
contextPersistenceFilter
=
new
SandUserContextPersistenceFilter
(
metadataRuntime
,
sandUserContextRepository
);
http
.
addFilterAfter
(
contextPersistenceFilter
,
SecurityContextPersistenceFilter
.
class
);
http
.
addFilterAfter
(
new
INZTenantAuthenticationFilter
(),
UsernamePasswordAuthenticationFilter
.
class
);
http
.
logout
().
logoutUrl
(
"/logout"
)
.
addLogoutHandler
(
logoutHandler
).
invalidateHttpSession
(
true
)
.
permitAll
();
}
@Override
protected
AuthenticationManager
authenticationManager
()
throws
Exception
{
return
super
.
authenticationManager
();
}
}
@Configuration
@Order
(
6
)
public
class
WebSecurityConfigurationAdapter
extends
WebSecurityConfigurerAdapter
{
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
...
...
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/config/AuthenticationConfiguration.java
View file @
f27ceb4b
...
...
@@ -20,9 +20,11 @@ import com.beecode.inz.authentication.handler.RESTAuthenticationEntryPoint;
import
com.beecode.inz.authentication.handler.RESTAuthenticationFailureHandler
;
import
com.beecode.inz.authentication.handler.RESTAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.handler.RESTWarehouseUserAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.handler.SandUserAuthenticationSuccessHandler
;
import
com.beecode.inz.authentication.internal.service.SMSsendingCustomerServiceImpl
;
import
com.beecode.inz.authentication.internal.service.SMSsendingServiceImpl
;
import
com.beecode.inz.authentication.provider.AppUserAuthenticationProvider
;
import
com.beecode.inz.authentication.provider.SandUserAuthProvider
;
import
com.beecode.inz.authentication.provider.WarehouseUserAuthenticationProvider
;
import
com.beecode.inz.authentication.service.SMSsendingCustomerService
;
import
com.beecode.inz.authentication.service.SMSsendingService
;
...
...
@@ -122,4 +124,13 @@ public class AuthenticationConfiguration {
return
new
WarehouseUserAuthenticationProvider
();
}
@Bean
public
SandUserAuthProvider
sandUserAuthProvider
()
{
return
new
SandUserAuthProvider
();
}
@Bean
public
SandUserAuthenticationSuccessHandler
sandUserAuthenticationSuccessHandler
()
{
return
new
SandUserAuthenticationSuccessHandler
();
}
}
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/handler/SandUserAuthenticationSuccessHandler.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
authentication
.
handler
;
import
java.io.IOException
;
import
java.util.Date
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
com.beecode.inz.authentication.constants.AuthcConstants
;
import
com.beecode.inz.authentication.constants.LoginLogConstants
;
import
com.beecode.inz.authentication.constants.TenantUserConstants
;
import
com.beecode.inz.authentication.datamodel.LoginLog
;
import
com.beecode.inz.authentication.enumeration.LoginModeEnum
;
import
com.beecode.inz.authentication.enumeration.LoginStateEnum
;
import
com.beecode.inz.authentication.enumeration.LoginTerminalEnum
;
import
com.beecode.inz.authentication.service.LoginLogService
;
import
com.beecode.inz.authentication.util.LoginLogUtil
;
import
com.beecode.inz.basis.pojo.SandUser
;
/**
* 处理采砂用户登录成功后的返回
*
* @author Jackpot
* @date 2021年3月19日
*/
@Component
public
class
SandUserAuthenticationSuccessHandler
extends
SimpleUrlAuthenticationSuccessHandler
{
@Autowired
private
LoginLogService
loginLogService
;
@Override
public
void
onAuthenticationSuccess
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Authentication
authentication
)
throws
IOException
,
ServletException
{
clearAuthenticationAttributes
(
request
);
LoginLog
loginLog
=
getLoginLog
(
request
);
try
{
String
tenant
=
request
.
getParameter
(
AuthcConstants
.
TENANT
);
SandUser
SandUser
=
(
SandUser
)
authentication
.
getPrincipal
();
if
(
SandUser
!=
null
)
{
JSONObject
returnJson
=
new
JSONObject
();
request
.
getSession
().
setAttribute
(
AuthcConstants
.
SESSION_TENANTID
,
tenant
);
request
.
getSession
().
setAttribute
(
AuthcConstants
.
USERID
,
SandUser
.
getId
());
request
.
getSession
().
setAttribute
(
AuthcConstants
.
USERNAME
,
SandUser
.
getUsername
());
request
.
getSession
().
setAttribute
(
AuthcConstants
.
TELEPHONE
,
SandUser
.
getTelephone
());
request
.
getSession
().
setAttribute
(
"mobile"
,
true
);
request
.
getSession
().
setMaxInactiveInterval
(
30
*
24
*
60
*
60
);
loginLog
.
setTenantId
(
tenant
);
loginLog
.
setDescription
(
"SandUser login"
);
loginLogService
.
insert
(
loginLog
);
ServletRequestAttributes
attr
=
(
ServletRequestAttributes
)
RequestContextHolder
.
currentRequestAttributes
();
returnJson
.
put
(
AuthcConstants
.
USERID
,
SandUser
.
getId
());
returnJson
.
put
(
AuthcConstants
.
USERNAME
,
SandUser
.
getUsername
());
returnJson
.
put
(
AuthcConstants
.
TELEPHONE
,
SandUser
.
getTelephone
());
returnJson
.
put
(
AuthcConstants
.
MESSAGE
,
"success"
);
returnJson
.
put
(
AuthcConstants
.
TOKEN
,
attr
.
getSessionId
());
returnJson
.
put
(
AuthcConstants
.
TENANT
,
tenant
);
response
.
getWriter
().
append
(
returnJson
.
toString
());
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
}
}
public
LoginLog
getLoginLog
(
HttpServletRequest
request
)
{
LoginLog
loginLog
=
new
LoginLog
();
String
userAgent
=
request
.
getHeader
(
LoginLogConstants
.
USER_AGENT
);
if
(
userAgent
.
contains
(
LoginLogConstants
.
WINDOWS
))
{
loginLog
.
setLoginTerminal
(
LoginTerminalEnum
.
WEB
.
getValue
());
}
else
if
(
userAgent
.
contains
(
LoginLogConstants
.
ANDROID
))
{
loginLog
.
setLoginTerminal
(
LoginTerminalEnum
.
ANDROID
.
getValue
());
}
else
if
(
userAgent
.
contains
(
LoginLogConstants
.
IOS
))
{
loginLog
.
setLoginTerminal
(
LoginTerminalEnum
.
ISO
.
getValue
());
}
else
{
loginLog
.
setLoginTerminal
(
LoginTerminalEnum
.
WEB
.
getValue
());
}
loginLog
.
setAccountNumber
(
request
.
getParameter
(
TenantUserConstants
.
USERNAME
));
loginLog
.
setLoginMode
(
request
.
getParameter
(
TenantUserConstants
.
USERNAME
)
==
null
?
LoginModeEnum
.
QRCODELODIN
.
getValue
()
:
LoginModeEnum
.
USERNAMEPASSWORD
.
getValue
());
loginLog
.
setIp
(
LoginLogUtil
.
getClientIp
(
request
));
loginLog
.
setLoginTime
(
new
Date
());
loginLog
.
setLoginState
(
LoginStateEnum
.
SUCCESS
.
getValue
());
return
loginLog
;
}
}
backend/inz.authentication/src/main/java/com/beecode/inz/authentication/provider/SandUserAuthProvider.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
authentication
.
provider
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationProvider
;
import
org.springframework.security.authentication.BadCredentialsException
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.AuthenticationException
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
com.beecode.inz.basis.pojo.SandUser
;
import
com.beecode.inz.basis.service.SandUserService
;
/**
* 采砂用户验证器
*
* @author Jackpot
* @date 2021年3月19日
*/
public
class
SandUserAuthProvider
implements
AuthenticationProvider
{
@Autowired
SandUserService
sandUserService
;
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Override
public
Authentication
authenticate
(
Authentication
authentication
)
throws
AuthenticationException
{
String
username
=
authentication
.
getName
();
String
passWord
=
(
String
)
authentication
.
getCredentials
();
SandUser
sandUser
=
sandUserService
.
getByUsername
(
username
);
if
(
null
==
sandUser
)
{
throw
new
BadCredentialsException
(
"用户名或密码错误!"
);
}
String
pwd
=
sandUser
.
getPassword
();
if
(!
passwordEncoder
.
matches
(
passWord
,
pwd
))
{
throw
new
BadCredentialsException
(
"密码错误!"
);
}
List
<
SimpleGrantedAuthority
>
roleList
=
new
ArrayList
<
SimpleGrantedAuthority
>();
return
new
UsernamePasswordAuthenticationToken
(
sandUser
,
passWord
,
roleList
);
}
@Override
public
boolean
supports
(
Class
<?>
authentication
)
{
return
authentication
!=
null
&&
authentication
==
UsernamePasswordAuthenticationToken
.
class
;
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/config/CommonConfig.java
View file @
f27ceb4b
...
...
@@ -4,17 +4,22 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
com.beecode.inz.basis.context.sand.SandUserContextRepository
;
import
com.beecode.inz.basis.dao.CustomerDao
;
import
com.beecode.inz.basis.dao.WarehouseUserDao
;
import
com.beecode.inz.basis.handler.SMSsnedHandlers
;
import
com.beecode.inz.basis.internal.dao.CustomerDaoImpl
;
import
com.beecode.inz.basis.internal.dao.SandUserDaoImpl
;
import
com.beecode.inz.basis.internal.dao.WarehouseUserDaoImpl
;
import
com.beecode.inz.basis.internal.service.CustomerServiceImpl
;
import
com.beecode.inz.basis.internal.service.SandUserServiceImpl
;
import
com.beecode.inz.basis.internal.service.WarehouseUserServiceImpl
;
import
com.beecode.inz.basis.service.CustomerService
;
import
com.beecode.inz.basis.service.SandUserService
;
import
com.beecode.inz.basis.service.WarehouseUserService
;
import
com.beecode.inz.basis.sms.internal.SMSsendingServiceImpl
;
import
com.beecode.inz.basis.sms.service.SMSsendingService
;
import
com.beecode.inz.basis.web.SandUserController
;
import
com.beecode.inz.basis.web.WarehouseUserController
;
@Configuration
...
...
@@ -56,5 +61,25 @@ public class CommonConfig {
return
new
WarehouseUserController
();
}
//采砂用户服务Bean
@Bean
public
SandUserService
sandUserService
()
{
return
new
SandUserServiceImpl
();
}
@Bean
public
SandUserDaoImpl
sandUserDao
()
{
return
new
SandUserDaoImpl
();
}
@Bean
public
SandUserController
sandUserController
()
{
return
new
SandUserController
();
}
@Bean
public
SandUserContextRepository
sandUserContextRepository
()
{
return
new
SandUserContextRepository
();
}
//end
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/config/constants/CommonBaseConst.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
config
.
constants
;
public
class
CommonBaseConst
{
//数据模型元数据
public
static
final
String
BASE_INFO_ENTITY
=
"com.beecode.inz.common.datamodel.BaseInfo"
;
//员工元数据
public
static
final
String
STAFF_ENTITY
=
"com.beecode.bap.staff.datamodel.Staff"
;
public
static
final
String
ID
=
"id"
;
public
static
final
String
VERSION
=
"version"
;
public
static
final
String
CODE
=
"code"
;
public
static
final
String
NAME
=
"name"
;
public
static
final
String
TITLE
=
"title"
;
public
static
final
String
CREATOR
=
"creator"
;
public
static
final
String
CREATE_TIME
=
"createTime"
;
public
static
final
String
MODIFIER
=
"modifier"
;
public
static
final
String
MODIFY_TIME
=
"modifyTime"
;
public
static
final
String
APPROVAL_STATE
=
"approvalState"
;
public
static
final
String
STATE
=
"state"
;
public
static
final
String
DISCARD
=
"discard"
;
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/config/constants/SandUserConstants.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
config
.
constants
;
public
class
SandUserConstants
extends
CommonBaseConst
{
public
static
final
String
ENTITY
=
"com.beecode.inz.basis.datamodel.SandUser"
;
public
static
final
String
USERNAME
=
"username"
;
public
static
final
String
PASSWORD
=
"password"
;
public
static
final
String
TYPE
=
"type"
;
public
static
final
String
ORG
=
"org"
;
public
static
final
String
PATH
=
"path"
;
public
static
final
String
ROLE
=
"role"
;
public
static
final
String
CONFIG
=
"config"
;
public
static
final
String
DESCRIPTION
=
"description"
;
public
static
final
String
TELEPHONE
=
"telephone"
;
public
static
final
String
ENABLED
=
"enabled"
;
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUser.mk
0 → 100644
View file @
f27ceb4b
<model>
<header>
<type>bcp.type.DataModel</type>
<package>com.beecode.inz.basis.datamodel</package>
<title>采砂用户</title>
<name>SandUser</name>
<tags></tags>
<description></description>
<templateName>mk.ide.ui.editor.data.model.template.common</templateName>
<tablePrefix>xyst_dinas_</tablePrefix>
</header>
<content>
<dataModel id='2ea32765-853e-11eb-b258-54ee750ba988' multiVersion='undefined' domainInherit='undefined' tableName='xyst_dinas_basis_sand_user'>
<attribute id='2ea327a9-853e-11eb-b258-54ee750ba9b2' name='id' columnName='id' title='id' type='uuid' default='' precision='' isArray='false'>
<annotation id='2ea327ad-853e-11eb-b258-54ee750ba9b2' attributeId='2ea327b1-853e-11eb-b258-54ee750ba9b2' name='length' value='undefined'></annotation>
<annotation id='2ea327b2-853e-11eb-b258-54ee750ba9b2' attributeId='2ea327b4-853e-11eb-b258-54ee750ba9b2' name='unique' value='false'></annotation>
</attribute>
<attribute id='49a99e2e-853e-11eb-b258-54ee750ba9b2' name='username' columnName='username' title='用户名' type='string' default='' precision='' isArray='false'>
<annotation id='49a99e31-853e-11eb-b258-54ee750ba9b2' attributeId='49a99e35-853e-11eb-b258-54ee750ba9b2' name='length' value='50'></annotation>
</attribute>
<attribute id='49a99e36-853e-11eb-b258-54ee750ba9b2' name='password' columnName='password' title='密码' type='string' default='' precision='' isArray='false'>
<annotation id='49a99e39-853e-11eb-b258-54ee750ba9b2' attributeId='49a99e3a-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id='6294310a-853e-11eb-b258-54ee750ba9b2' name='title' columnName='title' title='称呼' type='string' default='' precision='' isArray='false'>
<annotation id='62943111-853e-11eb-b258-54ee750ba9b2' attributeId='62943112-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id='62943115-853e-11eb-b258-54ee750ba9b2' name='code' columnName='code' title='编号' type='string' default='' precision='' isArray='false'>
<annotation id='62943119-853e-11eb-b258-54ee750ba9b2' attributeId='6294311a-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id='77aa55cb-853e-11eb-b258-54ee750ba9b2' name='type' columnName='type' title='用户类型' type='string' default='' precision='' isArray='false'>
<annotation id='77aa55d2-853e-11eb-b258-54ee750ba9b2' attributeId='77aa55d3-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id='77aa55d6-853e-11eb-b258-54ee750ba9b2' name='telephone' columnName='telephone' title='手机号' type='string' default='' precision='' isArray='false'>
<annotation id='77aa55d7-853e-11eb-b258-54ee750ba9b2' attributeId='77aa55d8-853e-11eb-b258-54ee750ba9b2' name='length' value='20'></annotation>
</attribute>
<attribute id='8f8ad8b3-853e-11eb-b258-54ee750ba9b2' name='org' columnName='org' title='所属组织' type='string' default='' precision='' isArray='false'>
<annotation id='8f8ad8b7-853e-11eb-b258-54ee750ba9b2' attributeId='8f8ad8bb-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id="8f8ad8bc-853e-11eb-b258-54ee750ba9b2" name="path" columnName='path' title="组织路径" type="string" default="" precision="" isArray="false">
<annotation name="length" value="300" id="8f8ad8be-853e-11eb-b258-54ee750ba9b2" attributeId="8f8ad8bf-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id='a4f104b3-853e-11eb-b258-54ee750ba9b2' name='role' columnName='role' title='所属角色' type='string' default='' precision='' isArray='false'>
<annotation id='a4f104be-853e-11eb-b258-54ee750ba9b2' attributeId='a4f104bf-853e-11eb-b258-54ee750ba9b2' name='length' value='100'></annotation>
</attribute>
<attribute id='a4f104c2-853e-11eb-b258-54ee750ba9b2' name='config' columnName='config' title='用户配置' type='string' default='' precision='' isArray='false'>
<annotation id='a4f104c3-853e-11eb-b258-54ee750ba9b2' attributeId='a4f104c4-853e-11eb-b258-54ee750ba9b2' name='length' value='1000'></annotation>
</attribute>
<attribute id='ba5bb842-853e-11eb-b258-54ee750ba9b2' name='description' columnName='description' title='描述' type='string' default='' precision='' isArray='false'>
<annotation id='ba5bb84a-853e-11eb-b258-54ee750ba9b2' attributeId='ba5bb84e-853e-11eb-b258-54ee750ba9b2' name='length' value='1000'></annotation>
</attribute>
<attribute id='ba5bb84f-853e-11eb-b258-54ee750ba9b2' name='state' columnName='state' title='状态' type='string' default='' precision='' isArray='false'>
<annotation id='ba5bb850-853e-11eb-b258-54ee750ba9b2' attributeId='ba5bb851-853e-11eb-b258-54ee750ba9b2' name='length' value='50'></annotation>
</attribute>
<attribute id="d2e9cc29-853e-11eb-b258-54ee750ba9b2" name="discard" title="是否废弃" type="boolean" default="false" precision="" isArray="false">
<annotation name="length" value="undefined" id="d2e9cc35-853e-11eb-b258-54ee750ba9b2" attributeId="d2e9cc36-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="11c46718-8540-11eb-b258-54ee750ba9b2" name="enabled" title="是否启用" type="boolean" default="false" precision="" isArray="false">
<annotation name="length" value="undefined" id="11c46720-8540-11eb-b258-54ee750ba9b2" attributeId="11c46721-8540-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="d2e9cc39-853e-11eb-b258-54ee750ba9b2" name="version" title="version" type="int" default="" precision="" isArray="false">
<annotation name="length" value="undefined" id="d2e9cc3c-853e-11eb-b258-54ee750ba9b2" attributeId="d2e9cc40-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="e955bd08-853e-11eb-b258-54ee750ba9b2" name="creator" title="创建人" type="com.beecode.bap.staff.datamodel.Staff" default="" precision="" isArray="false">
<annotation name="length" value="undefined" id="e955bd14-853e-11eb-b258-54ee750ba9b2" attributeId="e955bd15-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="e955bd18-853e-11eb-b258-54ee750ba9b2" name="createTime" columnName='create_time' title="创建时间" type="datetime" default="" precision="" isArray="false">
<annotation name="length" value="undefined" id="e955bd19-853e-11eb-b258-54ee750ba9b2" attributeId="e955bd1b-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="fd8dbf78-853e-11eb-b258-54ee750ba9b2" name="modifyTime" columnName='modify_time' title="最后修改时间" type="datetime" default="" precision="" isArray="false">
<annotation name="length" value="undefined" id="fd8dbf80-853e-11eb-b258-54ee750ba9b2" attributeId="fd8dbf81-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<attribute id="fd8dbf84-853e-11eb-b258-54ee750ba9b2" name="modifier" title="修改人" type="com.beecode.bap.staff.datamodel.Staff" default="" precision="" isArray="false">
<annotation name="length" value="undefined" id="fd8dbf85-853e-11eb-b258-54ee750ba9b2" attributeId="fd8dbf87-853e-11eb-b258-54ee750ba9b2"/>
</attribute>
<hibernate>/inz.basis/src/main/resources/config/SandUser.hbm.xml</hibernate>
</dataModel>
</content>
</model>
\ No newline at end of file
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContext.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
import
java.io.Serializable
;
import
com.beecode.inz.basis.pojo.SandUser
;
/**
* 采砂用户上下文
*
* @author Jackpot
* @date 2021年3月19日
*/
public
interface
SandUserContext
extends
Serializable
{
public
SandUser
getSandUser
();
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContextConstants.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
public
interface
SandUserContextConstants
{
/**
* 当前用户
*/
public
String
CURRENT_WAREHOUSE_USER
=
"currentSandUser"
;
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContextHolder.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
import
org.springframework.util.Assert
;
public
class
SandUserContextHolder
{
private
static
final
ThreadLocal
<
SandUserContext
>
contextHolder
=
new
ThreadLocal
<
SandUserContext
>();
/**
* Explicitly clears the context value from the current thread.
*/
public
static
void
clearContext
()
{
contextHolder
.
remove
();
}
/**
* Obtain the current <code>SecurityContext</code>.
*
* @return the security context (never <code>null</code>)
*/
public
static
SandUserContext
getContext
()
{
SandUserContext
ctx
=
contextHolder
.
get
();
if
(
ctx
==
null
)
{
ctx
=
createEmptyContext
();
contextHolder
.
set
(
ctx
);
}
return
ctx
;
}
/**
* Associates a new <code>SecurityContext</code> with the current thread of
* execution.
*
* @param context
* the new <code>SecurityContext</code> (may not be
* <code>null</code>)
*/
public
static
void
setContext
(
SandUserContext
context
)
{
Assert
.
notNull
(
context
,
"Only non-null AminoContext instances are permitted"
);
contextHolder
.
set
(
context
);
}
/**
* Delegates the creation of a new, empty context to the configured
* strategy.
*/
public
static
SandUserContext
createEmptyContext
()
{
return
new
SandUserContextImpl
();
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContextImpl.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
import
com.beecode.inz.basis.pojo.SandUser
;
public
class
SandUserContextImpl
implements
SandUserContext
{
private
static
final
long
serialVersionUID
=
7659762847744346459L
;
private
SandUser
SandUser
;
@Override
public
SandUser
getSandUser
()
{
return
SandUser
;
}
public
void
setSandUser
(
SandUser
SandUser
)
{
this
.
SandUser
=
SandUser
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
SandUser
==
null
)
?
0
:
SandUser
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
SandUserContextImpl
other
=
(
SandUserContextImpl
)
obj
;
if
(
SandUser
==
null
)
{
if
(
other
.
SandUser
!=
null
)
{
return
false
;
}
}
else
if
(!
SandUser
.
equals
(
other
.
SandUser
))
{
return
false
;
}
return
true
;
}
@Override
public
String
toString
()
{
return
"SandUserContextImpl [SandUser="
+
SandUser
+
"]"
;
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContextPersistenceFilter.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
import
java.io.IOException
;
import
javax.servlet.FilterChain
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.security.web.context.HttpRequestResponseHolder
;
import
org.springframework.web.filter.GenericFilterBean
;
import
com.beecode.amino.metadata.runtime.MetadataRuntime
;
public
class
SandUserContextPersistenceFilter
extends
GenericFilterBean
{
static
final
String
FILTER_APPLIED
=
"__sand_user_acpf_applied"
;
private
final
MetadataRuntime
metadataRuntime
;
private
final
SandUserContextRepository
repo
;
private
boolean
forceEagerSessionCreation
=
false
;
public
SandUserContextPersistenceFilter
(
MetadataRuntime
metadataRuntime
)
{
this
(
metadataRuntime
,
new
SandUserContextRepository
());
}
public
SandUserContextPersistenceFilter
(
MetadataRuntime
metadataRuntime
,
SandUserContextRepository
repo
)
{
this
.
metadataRuntime
=
metadataRuntime
;
this
.
repo
=
repo
;
}
/* (non-Javadoc)
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
@Override
public
void
doFilter
(
ServletRequest
req
,
ServletResponse
res
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
HttpServletRequest
request
=
(
HttpServletRequest
)
req
;
HttpServletResponse
response
=
(
HttpServletResponse
)
res
;
if
(
request
.
getAttribute
(
FILTER_APPLIED
)
!=
null
)
{
// ensure that filter is only applied once per request
chain
.
doFilter
(
request
,
response
);
return
;
}
if
(!
metadataRuntime
.
isActive
())
{
// TODO 元数据服务还没有启动好
return
;
}
final
boolean
debug
=
logger
.
isDebugEnabled
();
request
.
setAttribute
(
FILTER_APPLIED
,
Boolean
.
TRUE
);
if
(
forceEagerSessionCreation
)
{
HttpSession
session
=
request
.
getSession
();
if
(
debug
&&
session
.
isNew
())
{
logger
.
debug
(
"Eagerly created session: "
+
session
.
getId
());
}
}
HttpRequestResponseHolder
holder
=
new
HttpRequestResponseHolder
(
request
,
response
);
try
{
SandUserContext
contextBeforeChainExecution
=
repo
.
loadContext
(
holder
);
SandUserContextHolder
.
setContext
(
contextBeforeChainExecution
);
chain
.
doFilter
(
holder
.
getRequest
(),
holder
.
getResponse
());
}
finally
{
// Crucial removal of SecurityContextHolder contents - do this before anything
// else.
SandUserContextHolder
.
clearContext
();
request
.
removeAttribute
(
FILTER_APPLIED
);
if
(
debug
)
{
logger
.
debug
(
"SandUserContextHolder now cleared, as request processing completed"
);
}
}
}
public
void
setForceEagerSessionCreation
(
boolean
forceEagerSessionCreation
)
{
this
.
forceEagerSessionCreation
=
forceEagerSessionCreation
;
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/context/sand/SandUserContextRepository.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
context
.
sand
;
import
javax.servlet.AsyncContext
;
import
javax.servlet.ServletRequest
;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.authentication.AuthenticationTrustResolver
;
import
org.springframework.security.authentication.AuthenticationTrustResolverImpl
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.web.context.HttpRequestResponseHolder
;
import
org.springframework.security.web.util.OnCommittedResponseWrapper
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.StringUtils
;
import
com.beecode.inz.basis.pojo.SandUser
;
import
com.beecode.inz.basis.service.SandUserService
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
public
class
SandUserContextRepository
{
@Autowired
private
SandUserService
SandUserService
;
@Autowired
private
ObjectMapper
objectMapper
;
public
static
final
String
WAREHOUSE_USER_CONTEXT_KEY
=
"WAREHOUSE_USER_CONTEXT"
;
protected
final
Log
logger
=
LogFactory
.
getLog
(
this
.
getClass
());
private
final
Object
contextObject
=
SandUserContextHolder
.
createEmptyContext
();
private
boolean
isServlet3
=
ClassUtils
.
hasMethod
(
ServletRequest
.
class
,
"startAsync"
);
private
AuthenticationTrustResolver
trustResolver
=
new
AuthenticationTrustResolverImpl
();
@Transactional
(
readOnly
=
true
)
public
SandUserContext
loadContext
(
HttpRequestResponseHolder
requestResponseHolder
)
{
HttpServletRequest
request
=
requestResponseHolder
.
getRequest
();
HttpServletResponse
response
=
requestResponseHolder
.
getResponse
();
HttpSession
httpSession
=
request
.
getSession
(
false
);
SandUserContext
context
=
generateNewContext
(
httpSession
);
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
if
(
authentication
!=
null
&&
!
trustResolver
.
isAnonymous
(
authentication
))
{
SandUserContextImpl
contextImpl
=
(
SandUserContextImpl
)
context
;
if
(
contextImpl
.
getSandUser
()
==
null
)
{
loadContext
(
httpSession
,
contextImpl
);
}
}
SaveToSessionResponseWrapper
wrappedResponse
=
new
SaveToSessionResponseWrapper
(
response
,
request
,
httpSession
!=
null
,
context
);
requestResponseHolder
.
setResponse
(
wrappedResponse
);
if
(
isServlet3
)
{
requestResponseHolder
.
setRequest
(
new
Servlet3SaveToSessionRequestWrapper
(
request
,
wrappedResponse
));
}
return
context
;
}
public
boolean
containsContext
(
HttpServletRequest
request
)
{
HttpSession
session
=
request
.
getSession
(
false
);
if
(
session
==
null
)
{
return
false
;
}
return
session
.
getAttribute
(
WAREHOUSE_USER_CONTEXT_KEY
)
!=
null
;
}
protected
SandUserContext
generateNewContext
(
HttpSession
httpSession
)
{
return
SandUserContextHolder
.
createEmptyContext
();
}
/**
* 获取当前用户context
* @throws Exception
*/
private
void
loadContext
(
HttpSession
httpSession
,
SandUserContextImpl
contextImpl
)
{
if
(
null
==
httpSession
)
{
return
;
}
SandUser
SandUser
=
null
;
String
SandUserJsonObj
=
(
String
)
httpSession
.
getAttribute
(
SandUserContextConstants
.
CURRENT_WAREHOUSE_USER
);
if
(
StringUtils
.
isEmpty
(
SandUserJsonObj
))
{
try
{
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
if
(
null
==
authentication
)
{
return
;
}
String
userName
=
authentication
.
getName
();
if
(
StringUtils
.
isEmpty
(
userName
))
{
return
;
}
SandUser
=
SandUserService
.
getByUsername
(
userName
);
if
(
null
==
SandUser
)
{
throw
new
RuntimeException
(
"not found SandUser#"
+
userName
);
}
httpSession
.
setAttribute
(
SandUserContextConstants
.
CURRENT_WAREHOUSE_USER
,
objectMapper
.
writeValueAsString
(
SandUser
));
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
}
else
if
(
SandUserJsonObj
instanceof
String
)
{
try
{
SandUser
=
objectMapper
.
readValue
(
SandUserJsonObj
,
SandUser
.
class
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
httpSession
.
removeAttribute
(
SandUserContextConstants
.
CURRENT_WAREHOUSE_USER
);
}
}
contextImpl
.
setSandUser
(
SandUser
);
}
//~ Inner Classes ==================================================================================================
private
static
class
Servlet3SaveToSessionRequestWrapper
extends
HttpServletRequestWrapper
{
private
final
SaveToSessionResponseWrapper
response
;
public
Servlet3SaveToSessionRequestWrapper
(
HttpServletRequest
request
,
SaveToSessionResponseWrapper
response
)
{
super
(
request
);
this
.
response
=
response
;
}
@Override
public
AsyncContext
startAsync
()
{
response
.
disableSaveOnResponseCommitted
();
return
super
.
startAsync
();
}
@Override
public
AsyncContext
startAsync
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
)
throws
IllegalStateException
{
response
.
disableSaveOnResponseCommitted
();
return
super
.
startAsync
(
servletRequest
,
servletResponse
);
}
}
final
class
SaveToSessionResponseWrapper
extends
OnCommittedResponseWrapper
{
private
final
HttpServletRequest
request
;
private
final
boolean
httpSessionExistedAtStartOfRequest
;
public
SaveToSessionResponseWrapper
(
HttpServletResponse
response
,
HttpServletRequest
request
,
boolean
httpSessionExistedAtStartOfRequest
,
SandUserContext
context
)
{
super
(
response
);
this
.
request
=
request
;
this
.
httpSessionExistedAtStartOfRequest
=
httpSessionExistedAtStartOfRequest
;
// this.contextBeforeExecution = context;
// this.authBeforeExecution = context.getAuthentication();
}
public
void
disableSaveOnResponseCommitted
()
{
disableOnResponseCommitted
();
}
protected
void
saveContext
(
SandUserContext
context
)
{
final
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
HttpSession
httpSession
=
request
.
getSession
(
false
);
// See SEC-776
if
(
authentication
==
null
||
trustResolver
.
isAnonymous
(
authentication
))
{
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"SandUserContext is empty or contents are anonymous - context will not be stored in HttpSession."
);
}
if
(
httpSession
!=
null
)
{
// SEC-1587 A non-anonymous context may still be in the
// session
// SEC-1735 remove if the contextBeforeExecution was not
// anonymous
httpSession
.
removeAttribute
(
WAREHOUSE_USER_CONTEXT_KEY
);
}
return
;
}
if
(
httpSession
==
null
)
{
httpSession
=
createNewSessionIfAllowed
(
context
);
}
// If HttpSession exists, store current CustomerContext but only if
// it has
// actually changed in this thread (see SEC-37, SEC-1307, SEC-1528)
if
(
httpSession
!=
null
)
{
// We may have a new session, so check also whether the context
// attribute
// is set SEC-1561
if
(
contextChanged
(
context
)
||
httpSession
.
getAttribute
(
WAREHOUSE_USER_CONTEXT_KEY
)
==
null
)
{
// httpSession.setAttribute(customerContextKey, context);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"SandUserContext '"
+
context
+
"' stored to HttpSession: '"
+
httpSession
);
}
}
}
}
private
boolean
contextChanged
(
SandUserContext
context
)
{
return
true
;
}
private
HttpSession
createNewSessionIfAllowed
(
SandUserContext
context
)
{
if
(
httpSessionExistedAtStartOfRequest
)
{
return
null
;
}
// Generate a HttpSession only if we need to
if
(
contextObject
.
equals
(
context
))
{
return
null
;
}
try
{
return
request
.
getSession
(
true
);
}
catch
(
IllegalStateException
e
)
{
logger
.
warn
(
"Failed to create a session, as response has been committed. Unable to store"
+
" SandUserContext."
);
}
return
null
;
}
@Override
protected
void
onResponseCommitted
()
{
saveContext
(
SandUserContextHolder
.
getContext
());
}
@Override
public
final
String
encodeRedirectUrl
(
String
url
)
{
return
super
.
encodeURL
(
url
);
}
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/internal/dao/SandUserDaoImpl.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
internal
.
dao
;
import
java.util.List
;
import
org.hibernate.query.Query
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.orm.hibernate5.HibernateTemplate
;
import
org.springframework.stereotype.Repository
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.inz.basis.config.constants.SandUserConstants
;
@Repository
public
class
SandUserDaoImpl
extends
AbstractBaseDao
{
@Autowired
private
HibernateTemplate
template
;
@Override
protected
HibernateTemplate
getHibernateTemplate
()
{
return
template
;
}
@Override
protected
String
getModelName
()
{
return
SandUserConstants
.
ENTITY
;
}
public
KObject
findByUsernameOrTelephone
(
String
username
)
{
return
getHibernateTemplate
().
execute
(
session
->
{
StringBuffer
sql
=
new
StringBuffer
(
"FROM "
+
getModelName
()
+
" WHERE username = :username OR telephone = :username "
);
Query
<
KObject
>
query
=
session
.
createQuery
(
sql
.
toString
(),
KObject
.
class
);
query
.
setParameter
(
"username"
,
username
);
List
<
KObject
>
result
=
query
.
getResultList
();
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
return
result
.
get
(
0
);
}
return
null
;
});
}
public
List
<
KObject
>
listByUserName
(
String
username
)
{
return
listByAttributes
(
buildSingleMap
(
SandUserConstants
.
USERNAME
,
username
));
}
public
List
<
KObject
>
listByTelephone
(
String
telephone
)
{
return
listByAttributes
(
buildSingleMap
(
SandUserConstants
.
TELEPHONE
,
telephone
));
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/internal/service/SandUserServiceImpl.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
internal
.
service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
import
javax.transaction.Transactional
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.util.Assert
;
import
com.beecode.amino.core.Amino
;
import
com.beecode.bcp.core.context.AminoContextHolder
;
import
com.beecode.bcp.type.KClass
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.inz.basis.config.constants.SandUserConstants
;
import
com.beecode.inz.basis.internal.dao.SandUserDaoImpl
;
import
com.beecode.inz.basis.pojo.SandUser
;
import
com.beecode.inz.basis.service.SandUserService
;
/**
* 采砂用户 service
*
* @author Jackpot
* @date 2021年3月19日
*/
@Transactional
public
class
SandUserServiceImpl
implements
SandUserService
{
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Autowired
private
SandUserDaoImpl
dao
;
@Override
public
SandUser
getById
(
UUID
id
)
{
Assert
.
notNull
(
id
,
"'id' must be not null!"
);
KObject
entity
=
dao
.
findById
(
id
);
return
SandUser
.
fromCustomerKObject
(
entity
);
}
@Override
public
SandUser
getByUsernameOrTelephone
(
String
userame
)
{
Assert
.
notNull
(
userame
,
"'userName' must be not null!"
);
KObject
object
=
dao
.
findByUsernameOrTelephone
(
userame
);
if
(
object
!=
null
)
{
return
SandUser
.
fromCustomerKObject
(
object
);
}
return
null
;
}
@Override
public
SandUser
getByUsername
(
String
userame
)
{
Assert
.
notNull
(
userame
,
"'userName' must be not null!"
);
List
<
KObject
>
list
=
dao
.
listByUserName
(
userame
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
SandUser
.
fromCustomerKObject
(
list
.
get
(
0
));
}
return
null
;
}
@Override
public
SandUser
getByTelephone
(
String
telephone
)
{
Assert
.
notNull
(
telephone
,
"'telephone' must be not null!"
);
List
<
KObject
>
list
=
dao
.
listByTelephone
(
telephone
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
SandUser
.
fromCustomerKObject
(
list
.
get
(
0
));
}
return
null
;
}
@Override
public
UUID
create
(
SandUser
SandUser
)
{
Assert
.
notNull
(
SandUser
,
"'SandUser' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getUsername
(),
"'username' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getTitle
(),
"'title' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getPassword
(),
"'password' must be not null!"
);
if
(
SandUser
.
getId
()
==
null
)
{
SandUser
.
setId
(
UUID
.
randomUUID
());
}
SandUser
.
setState
(
"NORMAL"
);
SandUser
.
setEnabled
(
true
);
SandUser
.
setCreator
(
AminoContextHolder
.
getContext
().
getStaff
());
if
(
SandUser
.
getCreateTime
()
==
null
)
{
SandUser
.
setCreateTime
(
new
Date
());
}
//密码加密
SandUser
.
setPassword
(
passwordEncoder
.
encode
(
SandUser
.
getPassword
()));
return
dao
.
insert
(
beanToObject
(
SandUser
));
}
public
KObject
beanToObject
(
SandUser
SandUser
){
KClass
kclass
=
Amino
.
getApplicationMetadataContext
().
getBean
(
SandUserConstants
.
ENTITY
,
KClass
.
class
);
KObject
obj
=
kclass
.
newInstance
();
obj
.
set
(
SandUserConstants
.
ID
,
SandUser
.
getId
());
obj
.
set
(
SandUserConstants
.
USERNAME
,
SandUser
.
getUsername
());
obj
.
set
(
SandUserConstants
.
PASSWORD
,
SandUser
.
getPassword
());
obj
.
set
(
SandUserConstants
.
TITLE
,
SandUser
.
getTitle
());
obj
.
set
(
SandUserConstants
.
CODE
,
SandUser
.
getCode
());
obj
.
set
(
SandUserConstants
.
TYPE
,
SandUser
.
getType
());
obj
.
set
(
SandUserConstants
.
TELEPHONE
,
SandUser
.
getTelephone
());
obj
.
set
(
SandUserConstants
.
ORG
,
SandUser
.
getOrg
());
obj
.
set
(
SandUserConstants
.
PATH
,
SandUser
.
getPath
());
obj
.
set
(
SandUserConstants
.
ROLE
,
SandUser
.
getRole
());
obj
.
set
(
SandUserConstants
.
CONFIG
,
SandUser
.
getConfig
());
obj
.
set
(
SandUserConstants
.
DESCRIPTION
,
SandUser
.
getDescription
());
obj
.
set
(
SandUserConstants
.
STATE
,
SandUser
.
getState
());
obj
.
set
(
SandUserConstants
.
ENABLED
,
SandUser
.
isEnabled
());
obj
.
set
(
SandUserConstants
.
CREATOR
,
SandUser
.
getCreator
());
obj
.
set
(
SandUserConstants
.
CREATE_TIME
,
SandUser
.
getCreateTime
());
obj
.
set
(
SandUserConstants
.
MODIFIER
,
SandUser
.
getModifier
());
obj
.
set
(
SandUserConstants
.
MODIFY_TIME
,
SandUser
.
getModifyTime
());
obj
.
set
(
SandUserConstants
.
VERSION
,
SandUser
.
getVersion
());
return
obj
;
}
@Transactional
@Override
public
void
modify
(
SandUser
SandUser
)
{
Assert
.
notNull
(
SandUser
,
"'SandUser' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getId
(),
"'SandUser.id' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getUsername
(),
"'SandUser.userName' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getTitle
(),
"'SandUser.title' must be not null!"
);
Assert
.
notNull
(
SandUser
.
getCreateTime
(),
"'SandUser.createTime' must be not null!"
);
KObject
entity
=
dao
.
findById
(
SandUser
.
getId
());
if
(
entity
!=
null
)
{
//赋值,更新
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getUsername
()))
{
entity
.
set
(
SandUserConstants
.
USERNAME
,
SandUser
.
getUsername
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getTitle
()))
{
entity
.
set
(
SandUserConstants
.
TITLE
,
SandUser
.
getTitle
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getTelephone
()))
{
entity
.
set
(
SandUserConstants
.
TELEPHONE
,
SandUser
.
getTelephone
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getOrg
()))
{
entity
.
set
(
SandUserConstants
.
ORG
,
SandUser
.
getOrg
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getPath
()))
{
entity
.
set
(
SandUserConstants
.
PATH
,
SandUser
.
getPath
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getRole
()))
{
entity
.
set
(
SandUserConstants
.
ROLE
,
SandUser
.
getRole
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getDescription
()))
{
entity
.
set
(
SandUserConstants
.
DESCRIPTION
,
SandUser
.
getDescription
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getState
()))
{
entity
.
set
(
SandUserConstants
.
STATE
,
SandUser
.
getState
());
}
if
(
StringUtils
.
isNotBlank
(
SandUser
.
getConfig
()))
{
entity
.
set
(
SandUserConstants
.
CONFIG
,
SandUser
.
getConfig
());
}
if
(
SandUser
.
getModifier
()
!=
null
)
{
entity
.
set
(
SandUserConstants
.
MODIFIER
,
SandUser
.
getModifier
());
}
entity
.
set
(
SandUserConstants
.
MODIFY_TIME
,
SandUser
.
getModifyTime
());
dao
.
update
(
entity
);
}
}
@Override
public
void
updatePassword
(
UUID
id
,
String
newPassword
)
{
Assert
.
notNull
(
id
,
"'id' must be not null!"
);
Assert
.
notNull
(
newPassword
,
"'newPassword' must be not null!"
);
KObject
entity
=
dao
.
findById
(
id
);
if
(
entity
!=
null
)
{
//密码加密
entity
.
set
(
SandUserConstants
.
PASSWORD
,
passwordEncoder
.
encode
(
newPassword
));
dao
.
update
(
entity
);
}
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/pojo/SandUser.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
pojo
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.UUID
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.inz.basis.config.constants.SandUserConstants
;
/**
* 采砂用户
*
* @author Jackpot
* @date 2021年3月19日
*/
public
class
SandUser
implements
UserDetails
,
Serializable
{
private
static
final
long
serialVersionUID
=
-
553263854279399734L
;
/**
* 用户ID
*/
private
UUID
id
;
/**
* 版本号
*/
private
Long
version
;
/**
* 登录名
*/
private
String
username
;
/**
* 密码
*/
private
String
password
;
/**
* 用户名称
*/
private
String
title
;
/**
* 客户编码
*/
private
String
code
;
/**
* 客户类型
*/
private
String
type
;
/**
* 手机号
*/
private
String
telephone
;
/**
* 所属组织
*/
private
String
org
;
/**
* 组织路径
*/
private
String
path
;
/**
* 所属角色
*/
private
String
role
;
/**
* 用户配置
*/
private
String
config
;
/**
* 描述
*/
private
String
description
;
/**
* 状态
*/
private
String
state
;
/**
* 是否可用
*/
private
Boolean
enabled
;
/**
* 创建人
*/
private
KObject
creator
;
/**
* 创建日期
*/
private
Date
createTime
;
/**
* 修改日期
*/
private
Date
modifyTime
;
/**
* 修改人
*/
private
KObject
modifier
;
public
SandUser
()
{
}
public
static
SandUser
fromCustomerKObject
(
KObject
object
)
{
try
{
SandUser
model
=
new
SandUser
();
model
.
setId
(
object
.
getUuid
(
SandUserConstants
.
ID
));
model
.
setVersion
(
object
.
getLong
(
SandUserConstants
.
VERSION
));
model
.
setUsername
(
object
.
getString
(
SandUserConstants
.
USERNAME
));
model
.
setPassword
(
object
.
getString
(
SandUserConstants
.
PASSWORD
));
model
.
setTitle
(
object
.
getString
(
SandUserConstants
.
TITLE
));
model
.
setCode
(
object
.
getString
(
SandUserConstants
.
CODE
));
model
.
setType
(
object
.
getString
(
SandUserConstants
.
TYPE
));
model
.
setTelephone
(
object
.
getString
(
SandUserConstants
.
TELEPHONE
));
model
.
setOrg
(
object
.
getString
(
SandUserConstants
.
ORG
));
model
.
setPath
(
object
.
getString
(
SandUserConstants
.
PATH
));
model
.
setRole
(
object
.
getString
(
SandUserConstants
.
ROLE
));
model
.
setDescription
(
object
.
getString
(
SandUserConstants
.
DESCRIPTION
));
model
.
setState
(
object
.
getString
(
SandUserConstants
.
STATE
));
model
.
setConfig
(
object
.
getString
(
SandUserConstants
.
CONFIG
));
model
.
setEnabled
(
object
.
getBoolean
(
SandUserConstants
.
ENABLED
));
model
.
setCreateTime
(
object
.
getDate
(
SandUserConstants
.
CREATE_TIME
));
model
.
setCreator
(
object
.
get
(
SandUserConstants
.
MODIFIER
).
isNull
()
?
null
:
object
.
get
(
SandUserConstants
.
CREATOR
));
model
.
setModifyTime
(
object
.
getDate
(
SandUserConstants
.
MODIFY_TIME
));
model
.
setModifier
(
object
.
get
(
SandUserConstants
.
MODIFIER
).
isNull
()
?
null
:
object
.
get
(
SandUserConstants
.
MODIFIER
));
return
model
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
return
new
ArrayList
<
SimpleGrantedAuthority
>();
}
@Override
public
boolean
isAccountNonExpired
()
{
return
true
;
}
@Override
public
boolean
isAccountNonLocked
()
{
return
!
getEnabled
();
}
@Override
public
boolean
isCredentialsNonExpired
()
{
return
false
;
}
@Override
public
boolean
isEnabled
()
{
return
this
.
enabled
!=
null
?
this
.
enabled
:
false
;
}
public
UUID
getId
()
{
return
id
;
}
public
void
setId
(
UUID
id
)
{
this
.
id
=
id
;
}
public
Long
getVersion
()
{
return
version
;
}
public
void
setVersion
(
Long
version
)
{
this
.
version
=
version
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getTelephone
()
{
return
telephone
;
}
public
void
setTelephone
(
String
telephone
)
{
this
.
telephone
=
telephone
;
}
public
String
getOrg
()
{
return
org
;
}
public
void
setOrg
(
String
org
)
{
this
.
org
=
org
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
String
getRole
()
{
return
role
;
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
;
}
public
String
getConfig
()
{
return
config
;
}
public
void
setConfig
(
String
config
)
{
this
.
config
=
config
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
Boolean
getEnabled
()
{
return
enabled
;
}
public
void
setEnabled
(
Boolean
enabled
)
{
this
.
enabled
=
enabled
;
}
public
KObject
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
KObject
creator
)
{
this
.
creator
=
creator
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getModifyTime
()
{
return
modifyTime
;
}
public
void
setModifyTime
(
Date
modifyTime
)
{
this
.
modifyTime
=
modifyTime
;
}
public
KObject
getModifier
()
{
return
modifier
;
}
public
void
setModifier
(
KObject
modifier
)
{
this
.
modifier
=
modifier
;
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/service/SandUserService.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
service
;
import
java.util.UUID
;
import
com.beecode.inz.basis.pojo.SandUser
;
/**
* 采砂用户服务
*
* @author Jackpot
* @date 2021年3月19日
*/
public
interface
SandUserService
{
/**
* 创建客户
* @param SandUser
* @return
*/
UUID
create
(
SandUser
SandUser
);
/**
* 根据电话获取客户
* @param telephone
* @return
*/
SandUser
getByTelephone
(
String
telephone
);
/**
* 根据用户名获取客户
* @param userame
* @return
*/
SandUser
getByUsername
(
String
userame
);
/**
* 根据id获取客户
* @param userame
* @return
*/
SandUser
getById
(
UUID
id
);
SandUser
getByUsernameOrTelephone
(
String
userame
);
/**
* 根据传参对每个字段进行识别更新,不包含id,code,createtime,version等字段
* @param SandUser
*/
void
modify
(
SandUser
SandUser
);
/**
* 更新指定客户的密码
* @param id
* @param newPassword
*/
void
updatePassword
(
UUID
id
,
String
newPassword
);
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/web/SandUserController.java
0 → 100644
View file @
f27ceb4b
package
com
.
beecode
.
inz
.
basis
.
web
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.beecode.bcp.core.context.AminoContextHolder
;
import
com.beecode.bcp.type.KObject
;
import
com.beecode.inz.basis.context.sand.SandUserContextHolder
;
import
com.beecode.inz.basis.context.warehouse.WarehouseUserContextHolder
;
import
com.beecode.inz.basis.pojo.SandUser
;
import
com.beecode.inz.basis.pojo.WarehouseUser
;
import
com.beecode.inz.basis.service.SandUserService
;
import
com.beecode.inz.basis.team.pojo.ResponseObj
;
import
com.beecode.inz.basis.util.JsonUtil
;
import
com.beecode.xlib.utils.StringUtil
;
/**
* 采砂用户
* @author Jackpot
*/
@RestController
@RequestMapping
(
"/sand/user"
)
public
class
SandUserController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
private
SandUserService
sandUserService
;
/**
* 创建采砂用户
*
* @param obj
* @return
*/
@PostMapping
public
Object
create
(
@RequestBody
SandUser
sandUser
)
{
try
{
sandUserService
.
create
(
sandUser
);
}
catch
(
Exception
e
)
{
logger
.
error
(
""
,
e
);
return
ResponseObj
.
error
(
e
.
getMessage
());
}
return
ResponseObj
.
success
(
"操作成功"
,
null
);
}
/**
* 创建采砂用户
*
* @param obj
* @return
*/
@PostMapping
(
"/test"
)
public
Object
test
()
{
SandUser
sandUser
=
SandUserContextHolder
.
getContext
().
getSandUser
();
WarehouseUser
user
=
WarehouseUserContextHolder
.
getContext
().
getWarehouseUser
();
KObject
staff
=
AminoContextHolder
.
getContext
().
getStaff
();
return
ResponseObj
.
success
(
"操作成功"
,
null
);
}
}
backend/inz.basis/src/main/resources/com/beecode/inz/basis/datamodel/SandUser.jmx
0 → 100644
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-type"
>
<specification>
1.0
</specification>
<id>
2ea32765-853e-11eb-b258-54ee750ba988
</id>
<name>
com.beecode.inz.basis.datamodel.SandUser
</name>
<title>
采砂用户
</title>
<define>
bcp.type.Class
</define>
<define-version>
1.0
</define-version>
<dependency>
bcp.type.constraint.StringLength
</dependency>
<dependency>
com.beecode.bap.staff.datamodel.Staff
</dependency>
<content>
<m:class>
<m:parents/>
<m:attributes>
<m:attribute>
<m:annotations/>
<m:id>
2ea327a9-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
id
</m:name>
<m:title>
id
</m:title>
<m:type>
uuid
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
50
</m:value>
</m:annotation>
</m:annotations>
<m:id>
49a99e2e-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
username
</m:name>
<m:title>
用户名
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
49a99e36-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
password
</m:name>
<m:title>
密码
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
6294310a-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
title
</m:name>
<m:title>
称呼
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
62943115-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
code
</m:name>
<m:title>
编号
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
77aa55cb-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
type
</m:name>
<m:title>
用户类型
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
20
</m:value>
</m:annotation>
</m:annotations>
<m:id>
77aa55d6-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
telephone
</m:name>
<m:title>
手机号
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
8f8ad8b3-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
org
</m:name>
<m:title>
所属组织
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
300
</m:value>
</m:annotation>
</m:annotations>
<m:id>
8f8ad8bc-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
path
</m:name>
<m:title>
组织路径
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
100
</m:value>
</m:annotation>
</m:annotations>
<m:id>
a4f104b3-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
role
</m:name>
<m:title>
所属角色
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
1000
</m:value>
</m:annotation>
</m:annotations>
<m:id>
a4f104c2-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
config
</m:name>
<m:title>
用户配置
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
1000
</m:value>
</m:annotation>
</m:annotations>
<m:id>
ba5bb842-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
description
</m:name>
<m:title>
描述
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations>
<m:annotation>
<m:type>
bcp.type.constraint.StringLength
</m:type>
<m:value>
50
</m:value>
</m:annotation>
</m:annotations>
<m:id>
ba5bb84f-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
state
</m:name>
<m:title>
状态
</m:title>
<m:type>
string
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
d2e9cc29-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
discard
</m:name>
<m:title>
是否废弃
</m:title>
<m:type>
boolean
</m:type>
<m:description></m:description>
<m:default>
false
</m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
11c46718-8540-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
enabled
</m:name>
<m:title>
是否启用
</m:title>
<m:type>
boolean
</m:type>
<m:description></m:description>
<m:default>
false
</m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
d2e9cc39-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
version
</m:name>
<m:title>
version
</m:title>
<m:type>
int
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
e955bd08-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
creator
</m:name>
<m:title>
创建人
</m:title>
<m:type>
com.beecode.bap.staff.datamodel.Staff
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
e955bd18-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
createTime
</m:name>
<m:title>
创建时间
</m:title>
<m:type>
datetime
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
fd8dbf78-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
modifyTime
</m:name>
<m:title>
最后修改时间
</m:title>
<m:type>
datetime
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
<m:attribute>
<m:annotations/>
<m:id>
fd8dbf84-853e-11eb-b258-54ee750ba9b2
</m:id>
<m:name>
modifier
</m:name>
<m:title>
修改人
</m:title>
<m:type>
com.beecode.bap.staff.datamodel.Staff
</m:type>
<m:description></m:description>
<m:default></m:default>
</m:attribute>
</m:attributes>
</m:class>
</content>
</metadata>
backend/inz.basis/src/main/resources/config/SandUser.hbm.xml
0 → 100644
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping
xmlns=
"http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.hibernate.org/xsd/hibernate-mapping
http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd"
>
<class
entity-name=
"com.beecode.inz.basis.datamodel.SandUser"
table=
"xyst_dinas_basis_sand_user"
optimistic-lock=
"version"
>
<tuplizer
entity-mode=
"dynamic-map"
class=
"com.beecode.bcp.store.hibernate.KObjectEntityTuplizer"
/>
<id
name=
"id"
type=
"uuid-binary"
>
<column
name=
"id"
length=
"16"
/>
<generator
class=
"uuid2"
/>
</id>
<version
name=
"version"
type=
"long"
column=
"version"
></version>
<property
name=
"username"
type=
"string"
>
<column
name=
"username"
length=
"50"
unique=
"true"
></column>
</property>
<property
name=
"password"
type=
"string"
>
<column
name=
"password"
length=
"100"
></column>
</property>
<property
name=
"title"
type=
"string"
>
<column
name=
"title"
length=
"100"
></column>
</property>
<property
name=
"code"
type=
"string"
>
<column
name=
"code"
length=
"100"
unique=
"true"
></column>
</property>
<property
name=
"type"
type=
"string"
>
<column
name=
"type"
length=
"100"
></column>
</property>
<property
name=
"telephone"
type=
"string"
>
<column
name=
"telephone"
length=
"20"
></column>
</property>
<property
name=
"org"
type=
"string"
>
<column
name=
"org"
length=
"100"
></column>
</property>
<property
name=
"path"
type=
"string"
>
<column
name=
"path"
length=
"100"
></column>
</property>
<property
name=
"role"
type=
"string"
>
<column
name=
"role"
length=
"100"
></column>
</property>
<property
name=
"config"
type=
"text"
>
<column
name=
"config"
></column>
</property>
<property
name=
"description"
type=
"text"
>
<column
name=
"description"
/>
</property>
<property
name=
"state"
type=
"string"
>
<column
name=
"state"
length=
"50"
></column>
</property>
<property
name=
"discard"
type=
"boolean"
>
<column
name=
"discard"
/>
</property>
<property
name=
"enabled"
type=
"boolean"
>
<column
name=
"enabled"
/>
</property>
<property
name=
"createTime"
type=
"timestamp"
>
<column
name=
"create_time"
/>
</property>
<many-to-one
name=
"creator"
entity-name=
"com.beecode.bap.staff.datamodel.Staff"
fetch=
"select"
>
<column
name=
"creator_id"
not-null=
"false"
/>
</many-to-one>
<property
name=
"modifyTime"
type=
"timestamp"
>
<column
name=
"modify_time"
/>
</property>
<many-to-one
name=
"modifier"
entity-name=
"com.beecode.bap.staff.datamodel.Staff"
fetch=
"select"
>
<column
name=
"modifier_id"
not-null=
"false"
/>
</many-to-one>
</class>
</hibernate-mapping>
\ No newline at end of file
backend/xyst.dinas.biz/src/main/resources/com/xyst/dinas/biz/bill/Position$sequence.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-sequence"
>
<specification>
1.0
</specification>
<id>
12eab197-5cc0-4dbf-96ab-eecd0b13232c
</id>
<id>
7f76e0b6-30c6-4365-b7a8-ed44b83ac742
</id>
<name>
com.xyst.dinas.biz.bill.Position$sequence
</name>
<title>
岗位$sequence
</title>
<description>
岗位
</description>
...
...
backend/xyst.dinas.biz/src/main/resources/com/xyst/dinas/biz/bill/Position$serial.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-serial"
>
<specification>
1.0
</specification>
<id>
e54c3a90-a21c-489b-ab55-cda37706e8e5
</id>
<id>
4ab0c98c-a865-4cc5-aa98-65062df17a7e
</id>
<name>
com.xyst.dinas.biz.bill.Position$serial
</name>
<title>
岗位$serial
</title>
<description>
岗位
</description>
...
...
backend/xyst.dinas.biz/src/main/resources/com/xyst/dinas/biz/bill/Position.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-biztype"
>
<specification>
1.0
</specification>
<id>
5cd3ab7c-6fab-41f9-9921-780195eb24a2
</id>
<id>
33903504-3e8e-48a9-bdc3-05c7197f842c
</id>
<name>
com.xyst.dinas.biz.bill.Position
</name>
<title>
岗位
</title>
<description>
岗位
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/BusinessTripApply$sequence.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-sequence"
>
<specification>
1.0
</specification>
<id>
8cd1acd2-ea6a-46d7-8545-326c99a5bb89
</id>
<id>
e7136a79-9d58-4402-a53c-af0629a9b9a4
</id>
<name>
com.xyst.dinas.oa.bill.BusinessTripApply$sequence
</name>
<title>
出差申请$sequence
</title>
<description>
出差申请
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/BusinessTripApply$serial.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-serial"
>
<specification>
1.0
</specification>
<id>
b02bb6c4-3827-4102-b930-6f13435a7e76
</id>
<id>
55bb1063-d13c-4862-a854-cb60be8239d5
</id>
<name>
com.xyst.dinas.oa.bill.BusinessTripApply$serial
</name>
<title>
出差申请$serial
</title>
<description>
出差申请
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/BusinessTripApply.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-biztype"
>
<specification>
1.0
</specification>
<id>
e
b88e653-968c-47ee-bb6c-9a4518ad5071
</id>
<id>
e
c447a08-5c30-4ecc-a85a-f277f50dbc4e
</id>
<name>
com.xyst.dinas.oa.bill.BusinessTripApply
</name>
<title>
出差申请
</title>
<description>
出差申请
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/ProtocolDocument$sequence.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-sequence"
>
<specification>
1.0
</specification>
<id>
5e8338fa-7e65-4d4c-b0e3-6c82d749c136
</id>
<id>
9409d229-d33b-433d-9e26-2633c863fea4
</id>
<name>
com.xyst.dinas.oa.bill.ProtocolDocument$sequence
</name>
<title>
拟文$sequence
</title>
<description>
拟文
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/ProtocolDocument$serial.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-serial"
>
<specification>
1.0
</specification>
<id>
54dfa0b4-b205-4521-9d0b-cfbd375c0834
</id>
<id>
defcdd02-7707-4a13-a368-5d5d5080ee23
</id>
<name>
com.xyst.dinas.oa.bill.ProtocolDocument$serial
</name>
<title>
拟文$serial
</title>
<description>
拟文
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/ProtocolDocument.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-biztype"
>
<specification>
1.0
</specification>
<id>
a9db7f3e-daba-4f5c-9206-2251e9fc8a42
</id>
<id>
c6741756-a59b-448f-ba12-7573d0916500
</id>
<name>
com.xyst.dinas.oa.bill.ProtocolDocument
</name>
<title>
拟文
</title>
<description>
拟文
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/SealBorrow$sequence.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-sequence"
>
<specification>
1.0
</specification>
<id>
ff03f6c5-3843-4d65-9ece-6a0ae4b98e9a
</id>
<id>
3a4943d0-5867-4e75-bd3a-4383cdbe177e
</id>
<name>
com.xyst.dinas.oa.bill.SealBorrow$sequence
</name>
<title>
证章借出$sequence
</title>
<description>
证章借出
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/SealBorrow$serial.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-serial"
>
<specification>
1.0
</specification>
<id>
650e4eac-4ab0-4704-8b43-e04212eed383
</id>
<id>
a05be48f-04b2-4ce4-8479-6b72b61f60ad
</id>
<name>
com.xyst.dinas.oa.bill.SealBorrow$serial
</name>
<title>
证章借出$serial
</title>
<description>
证章借出
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/SealBorrow.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-biztype"
>
<specification>
1.0
</specification>
<id>
425c9108-d226-4210-ae7b-c22513b1b5f9
</id>
<id>
e37cda04-f87d-4654-9f21-584266c2943d
</id>
<name>
com.xyst.dinas.oa.bill.SealBorrow
</name>
<title>
证章借出
</title>
<description>
证章借出
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/UseCarApply$sequence.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-sequence"
>
<specification>
1.0
</specification>
<id>
8012c173-4025-4dcb-946f-2f715ea8e7dc
</id>
<id>
c9f4221c-5f56-43d8-bf3f-823fdee8e35a
</id>
<name>
com.xyst.dinas.oa.bill.UseCarApply$sequence
</name>
<title>
用车申请$sequence
</title>
<description>
用车申请
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/UseCarApply$serial.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-serial"
>
<specification>
1.0
</specification>
<id>
acc789ac-dd0b-4580-b271-0cc9931947a6
</id>
<id>
13edff2f-bc4d-4041-9d09-2881245d1ccd
</id>
<name>
com.xyst.dinas.oa.bill.UseCarApply$serial
</name>
<title>
用车申请$serial
</title>
<description>
用车申请
</description>
...
...
backend/xyst.dinas.oa/src/main/resources/com/xyst/dinas/oa/bill/UseCarApply.jmx
View file @
f27ceb4b
<?xml version="1.0" encoding="UTF-8"?>
<metadata
xmlns=
"http://www.beecode.cn/schema/amino-metadata"
xmlns:m=
"http://www.beecode.cn/schema/bcp-biztype"
>
<specification>
1.0
</specification>
<id>
3f8ff842-a50c-4b5b-a730-f4ccc9371b46
</id>
<id>
4ede1d03-e4a0-4a64-836c-e6e9f8f203a3
</id>
<name>
com.xyst.dinas.oa.bill.UseCarApply
</name>
<title>
用车申请
</title>
<description>
用车申请
</description>
...
...
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