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
39f84e76
Commit
39f84e76
authored
Mar 16, 2021
by
PWF-WK01\pengwufeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
砂厂用户基础模型整套提交
parent
dd4e6d8a
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1343 additions
and
26 deletions
+1343
-26
SecurityConfig.java
...war/src/main/java/com/beecode/inz/war/SecurityConfig.java
+1
-3
CommonConfig.java
.../main/java/com/beecode/inz/basis/config/CommonConfig.java
+22
-0
WarehouseUserConstants.java
...de/inz/basis/config/constants/WarehouseUserConstants.java
+16
-0
WarehouseUserDao.java
...main/java/com/beecode/inz/basis/dao/WarehouseUserDao.java
+14
-0
WarehouseUserDaoImpl.java
.../beecode/inz/basis/internal/dao/WarehouseUserDaoImpl.java
+59
-0
WarehouseUserServiceImpl.java
.../inz/basis/internal/service/WarehouseUserServiceImpl.java
+193
-0
WarehouseUser.java
...c/main/java/com/beecode/inz/basis/pojo/WarehouseUser.java
+332
-0
WarehouseUserService.java
...a/com/beecode/inz/basis/service/WarehouseUserService.java
+57
-0
JsonUtil.java
...is/src/main/java/com/beecode/inz/basis/util/JsonUtil.java
+96
-0
WarehouseUserController.java
...va/com/beecode/inz/basis/web/WarehouseUserController.java
+57
-0
WarehouseUser.mk
...in/model/com/beecode/inz/basis/datamodel/WarehouseUser.mk
+79
-0
WarehouseUser.jmx
...sources/com/beecode/inz/basis/datamodel/WarehouseUser.jmx
+258
-0
WarehouseUser.hbm.xml
...inz.basis/src/main/resources/config/WarehouseUser.hbm.xml
+69
-0
JsonUtil.java
...n/src/main/java/com/beecode/inz/common/util/JsonUtil.java
+88
-23
settings.gradle
backend/xyst.dinas.oa/settings.gradle
+2
-0
No files found.
backend/build.war/src/main/java/com/beecode/inz/war/SecurityConfig.java
View file @
39f84e76
...
@@ -130,7 +130,6 @@ public class SecurityConfig {
...
@@ -130,7 +130,6 @@ public class SecurityConfig {
private
CustomerContextRepository
customerContextRepository
;
private
CustomerContextRepository
customerContextRepository
;
@Configuration
@Configuration
@Order
(
1
)
@Order
(
1
)
public
class
InzAppSecurityConfigurerAdapter
extends
WebSecurityConfigurerAdapter
{
public
class
InzAppSecurityConfigurerAdapter
extends
WebSecurityConfigurerAdapter
{
...
@@ -174,7 +173,6 @@ public class SecurityConfig {
...
@@ -174,7 +173,6 @@ public class SecurityConfig {
protected
AuthenticationManager
authenticationManager
()
throws
Exception
{
protected
AuthenticationManager
authenticationManager
()
throws
Exception
{
return
super
.
authenticationManager
();
return
super
.
authenticationManager
();
}
}
}
}
@Configuration
@Configuration
...
@@ -226,6 +224,7 @@ public class SecurityConfig {
...
@@ -226,6 +224,7 @@ public class SecurityConfig {
.
antMatchers
(
"/crm/load/publicity/byAssetPackage/**"
).
permitAll
()
.
antMatchers
(
"/crm/load/publicity/byAssetPackage/**"
).
permitAll
()
.
antMatchers
(
"/workflow/api/**"
).
permitAll
()
.
antMatchers
(
"/workflow/api/**"
).
permitAll
()
.
antMatchers
(
"/dnaserver/**"
).
permitAll
()
.
antMatchers
(
"/dnaserver/**"
).
permitAll
()
.
antMatchers
(
"/warehouseuser/**"
).
permitAll
()
.
anyRequest
().
authenticated
();
//listAll,modifySelfPassword,loadAuctionByAsset临时开放
.
anyRequest
().
authenticated
();
//listAll,modifySelfPassword,loadAuctionByAsset临时开放
http
.
exceptionHandling
().
authenticationEntryPoint
(
authenticationEntryPoint
);
http
.
exceptionHandling
().
authenticationEntryPoint
(
authenticationEntryPoint
);
InzWebAuthenticationFilter
filter
=
new
InzWebAuthenticationFilter
();
InzWebAuthenticationFilter
filter
=
new
InzWebAuthenticationFilter
();
...
@@ -258,6 +257,5 @@ public class SecurityConfig {
...
@@ -258,6 +257,5 @@ public class SecurityConfig {
return
super
.
authenticationManager
();
return
super
.
authenticationManager
();
}
}
}
}
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/config/CommonConfig.java
View file @
39f84e76
...
@@ -5,12 +5,17 @@ import org.springframework.context.annotation.Bean;
...
@@ -5,12 +5,17 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
com.beecode.inz.basis.dao.CustomerDao
;
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.handler.SMSsnedHandlers
;
import
com.beecode.inz.basis.internal.dao.CustomerDaoImpl
;
import
com.beecode.inz.basis.internal.dao.CustomerDaoImpl
;
import
com.beecode.inz.basis.internal.dao.WarehouseUserDaoImpl
;
import
com.beecode.inz.basis.internal.service.CustomerServiceImpl
;
import
com.beecode.inz.basis.internal.service.CustomerServiceImpl
;
import
com.beecode.inz.basis.internal.service.WarehouseUserServiceImpl
;
import
com.beecode.inz.basis.service.CustomerService
;
import
com.beecode.inz.basis.service.CustomerService
;
import
com.beecode.inz.basis.service.WarehouseUserService
;
import
com.beecode.inz.basis.sms.internal.SMSsendingServiceImpl
;
import
com.beecode.inz.basis.sms.internal.SMSsendingServiceImpl
;
import
com.beecode.inz.basis.sms.service.SMSsendingService
;
import
com.beecode.inz.basis.sms.service.SMSsendingService
;
import
com.beecode.inz.basis.web.WarehouseUserController
;
@Configuration
@Configuration
public
class
CommonConfig
{
public
class
CommonConfig
{
...
@@ -35,4 +40,21 @@ public class CommonConfig {
...
@@ -35,4 +40,21 @@ public class CommonConfig {
public
CustomerDao
customerDao
()
{
public
CustomerDao
customerDao
()
{
return
new
CustomerDaoImpl
();
return
new
CustomerDaoImpl
();
}
}
@Bean
public
WarehouseUserService
warehouseUserService
()
{
return
new
WarehouseUserServiceImpl
();
}
@Bean
public
WarehouseUserDao
warehouseUserDao
()
{
return
new
WarehouseUserDaoImpl
();
}
@Bean
public
WarehouseUserController
warehouseUserController
()
{
return
new
WarehouseUserController
();
}
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/config/constants/WarehouseUserConstants.java
0 → 100644
View file @
39f84e76
package
com
.
beecode
.
inz
.
basis
.
config
.
constants
;
public
interface
WarehouseUserConstants
extends
CommonConstants
{
String
ENTITY
=
"com.beecode.inz.basis.datamodel.WarehouseUser"
;
String
USERNAME
=
"username"
;
String
PASSWORD
=
"password"
;
String
TYPE
=
"type"
;
String
ORG
=
"org"
;
String
PATH
=
"path"
;
String
ROLE
=
"role"
;
String
CONFIG
=
"config"
;
String
DESCRIPTION
=
"description"
;
String
TELEPHONE
=
"telephone"
;
String
ENABLED
=
"enabled"
;
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/dao/WarehouseUserDao.java
0 → 100644
View file @
39f84e76
package
com
.
beecode
.
inz
.
basis
.
dao
;
import
java.util.List
;
import
com.beecode.bcp.type.KObject
;
public
interface
WarehouseUserDao
extends
BaseDao
{
List
<
KObject
>
listByUserName
(
String
username
);
List
<
KObject
>
listByTelephone
(
String
telephone
);
KObject
findByUsernameOrTelephone
(
String
username
);
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/internal/dao/WarehouseUserDaoImpl.java
0 → 100644
View file @
39f84e76
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.WarehouseUserConstants
;
import
com.beecode.inz.basis.dao.WarehouseUserDao
;
@Repository
public
class
WarehouseUserDaoImpl
extends
AbstractBaseDao
implements
WarehouseUserDao
{
@Autowired
private
HibernateTemplate
template
;
public
WarehouseUserDaoImpl
(){
}
@Override
protected
HibernateTemplate
getHibernateTemplate
()
{
return
template
;
}
@Override
protected
String
getModelName
()
{
return
WarehouseUserConstants
.
ENTITY
;
}
@Override
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
;
});
}
@Override
public
List
<
KObject
>
listByUserName
(
String
username
)
{
return
listByAttributes
(
buildSingleMap
(
WarehouseUserConstants
.
USERNAME
,
username
));
}
@Override
public
List
<
KObject
>
listByTelephone
(
String
telephone
)
{
return
listByAttributes
(
buildSingleMap
(
WarehouseUserConstants
.
TELEPHONE
,
telephone
));
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/internal/service/WarehouseUserServiceImpl.java
0 → 100644
View file @
39f84e76
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.WarehouseUserConstants
;
import
com.beecode.inz.basis.dao.WarehouseUserDao
;
import
com.beecode.inz.basis.pojo.WarehouseUser
;
import
com.beecode.inz.basis.service.WarehouseUserService
;
/**
* 砂场用户 service
* @author pengwufeng
*
*/
public
class
WarehouseUserServiceImpl
implements
WarehouseUserService
{
//spring 密码加密工具类
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Autowired
private
WarehouseUserDao
dao
;
@Override
public
WarehouseUser
getById
(
UUID
id
)
{
Assert
.
notNull
(
id
,
"'id' must be not null!"
);
KObject
entity
=
dao
.
findById
(
id
);
return
WarehouseUser
.
fromCustomerKObject
(
entity
);
}
@Override
public
WarehouseUser
getByUsernameOrTelephone
(
String
userame
)
{
Assert
.
notNull
(
userame
,
"'userName' must be not null!"
);
KObject
object
=
dao
.
findByUsernameOrTelephone
(
userame
);
if
(
object
!=
null
)
{
return
WarehouseUser
.
fromCustomerKObject
(
object
);
}
return
null
;
}
@Override
public
WarehouseUser
getByUsername
(
String
userame
)
{
Assert
.
notNull
(
userame
,
"'userName' must be not null!"
);
List
<
KObject
>
list
=
dao
.
listByUserName
(
userame
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
WarehouseUser
.
fromCustomerKObject
(
list
.
get
(
0
));
}
return
null
;
}
@Transactional
@Override
public
WarehouseUser
getByTelephone
(
String
telephone
)
{
Assert
.
notNull
(
telephone
,
"'telephone' must be not null!"
);
List
<
KObject
>
list
=
dao
.
listByTelephone
(
telephone
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
WarehouseUser
.
fromCustomerKObject
(
list
.
get
(
0
));
}
return
null
;
}
@Transactional
@Override
public
UUID
create
(
WarehouseUser
warehouseUser
)
{
Assert
.
notNull
(
warehouseUser
,
"'warehouseUser' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getUsername
(),
"'username' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getTitle
(),
"'title' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getPassword
(),
"'password' must be not null!"
);
if
(
warehouseUser
.
getId
()
==
null
)
{
warehouseUser
.
setId
(
UUID
.
randomUUID
());
}
warehouseUser
.
setState
(
"NORMAL"
);
warehouseUser
.
setEnabled
(
true
);
warehouseUser
.
setCreator
(
AminoContextHolder
.
getContext
().
getStaff
());
if
(
warehouseUser
.
getCreateTime
()
==
null
)
{
warehouseUser
.
setCreateTime
(
new
Date
());
}
//密码加密
warehouseUser
.
setPassword
(
passwordEncoder
.
encode
(
warehouseUser
.
getPassword
()));
return
dao
.
insert
(
beanToObject
(
warehouseUser
));
}
public
KObject
beanToObject
(
WarehouseUser
warehouseUser
){
KClass
kclass
=
Amino
.
getApplicationMetadataContext
().
getBean
(
WarehouseUserConstants
.
ENTITY
,
KClass
.
class
);
KObject
obj
=
kclass
.
newInstance
();
obj
.
set
(
WarehouseUserConstants
.
ID
,
warehouseUser
.
getId
());
obj
.
set
(
WarehouseUserConstants
.
USERNAME
,
warehouseUser
.
getUsername
());
obj
.
set
(
WarehouseUserConstants
.
PASSWORD
,
warehouseUser
.
getPassword
());
obj
.
set
(
WarehouseUserConstants
.
TITLE
,
warehouseUser
.
getTitle
());
obj
.
set
(
WarehouseUserConstants
.
CODE
,
warehouseUser
.
getCode
());
obj
.
set
(
WarehouseUserConstants
.
TYPE
,
warehouseUser
.
getType
());
obj
.
set
(
WarehouseUserConstants
.
TELEPHONE
,
warehouseUser
.
getTelephone
());
obj
.
set
(
WarehouseUserConstants
.
ORG
,
warehouseUser
.
getOrg
());
obj
.
set
(
WarehouseUserConstants
.
PATH
,
warehouseUser
.
getPath
());
obj
.
set
(
WarehouseUserConstants
.
ROLE
,
warehouseUser
.
getRole
());
obj
.
set
(
WarehouseUserConstants
.
CONFIG
,
warehouseUser
.
getConfig
());
obj
.
set
(
WarehouseUserConstants
.
DESCRIPTION
,
warehouseUser
.
getDescription
());
obj
.
set
(
WarehouseUserConstants
.
STATE
,
warehouseUser
.
getState
());
obj
.
set
(
WarehouseUserConstants
.
ENABLED
,
warehouseUser
.
isEnabled
());
obj
.
set
(
WarehouseUserConstants
.
CREATOR
,
warehouseUser
.
getCreator
());
obj
.
set
(
WarehouseUserConstants
.
CREATE_TIME
,
warehouseUser
.
getCreateTime
());
obj
.
set
(
WarehouseUserConstants
.
MODIFIER
,
warehouseUser
.
getModifier
());
obj
.
set
(
WarehouseUserConstants
.
MODIFY_TIME
,
warehouseUser
.
getModifyTime
());
obj
.
set
(
WarehouseUserConstants
.
VERSION
,
warehouseUser
.
getVersion
());
return
obj
;
}
@Transactional
@Override
public
void
modify
(
WarehouseUser
warehouseUser
)
{
Assert
.
notNull
(
warehouseUser
,
"'warehouseUser' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getId
(),
"'warehouseUser.id' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getUsername
(),
"'warehouseUser.userName' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getTitle
(),
"'warehouseUser.title' must be not null!"
);
Assert
.
notNull
(
warehouseUser
.
getCreateTime
(),
"'warehouseUser.createTime' must be not null!"
);
KObject
entity
=
dao
.
findById
(
warehouseUser
.
getId
());
if
(
entity
!=
null
)
{
//赋值,更新
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getUsername
()))
{
entity
.
set
(
WarehouseUserConstants
.
USERNAME
,
warehouseUser
.
getUsername
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getTitle
()))
{
entity
.
set
(
WarehouseUserConstants
.
TITLE
,
warehouseUser
.
getTitle
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getTelephone
()))
{
entity
.
set
(
WarehouseUserConstants
.
TELEPHONE
,
warehouseUser
.
getTelephone
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getOrg
()))
{
entity
.
set
(
WarehouseUserConstants
.
ORG
,
warehouseUser
.
getOrg
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getPath
()))
{
entity
.
set
(
WarehouseUserConstants
.
PATH
,
warehouseUser
.
getPath
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getRole
()))
{
entity
.
set
(
WarehouseUserConstants
.
ROLE
,
warehouseUser
.
getRole
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getDescription
()))
{
entity
.
set
(
WarehouseUserConstants
.
DESCRIPTION
,
warehouseUser
.
getDescription
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getState
()))
{
entity
.
set
(
WarehouseUserConstants
.
STATE
,
warehouseUser
.
getState
());
}
if
(
StringUtils
.
isNotBlank
(
warehouseUser
.
getConfig
()))
{
entity
.
set
(
WarehouseUserConstants
.
CONFIG
,
warehouseUser
.
getConfig
());
}
if
(
warehouseUser
.
getModifier
()
!=
null
)
{
entity
.
set
(
WarehouseUserConstants
.
MODIFIER
,
warehouseUser
.
getModifier
());
}
entity
.
set
(
WarehouseUserConstants
.
MODIFY_TIME
,
warehouseUser
.
getModifyTime
());
dao
.
update
(
entity
);
}
}
@Transactional
@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
(
WarehouseUserConstants
.
PASSWORD
,
passwordEncoder
.
encode
(
newPassword
));
dao
.
update
(
entity
);
}
}
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/pojo/WarehouseUser.java
0 → 100644
View file @
39f84e76
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.WarehouseUserConstants
;
/**
* @author pengwufeng
*
*/
public
class
WarehouseUser
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
WarehouseUser
()
{
}
public
static
WarehouseUser
fromCustomerKObject
(
KObject
object
)
{
try
{
WarehouseUser
model
=
new
WarehouseUser
();
model
.
setId
(
object
.
getUuid
(
WarehouseUserConstants
.
ID
));
model
.
setVersion
(
object
.
getLong
(
WarehouseUserConstants
.
VERSION
));
model
.
setUsername
(
object
.
getString
(
WarehouseUserConstants
.
USERNAME
));
model
.
setPassword
(
object
.
getString
(
WarehouseUserConstants
.
PASSWORD
));
model
.
setTitle
(
object
.
getString
(
WarehouseUserConstants
.
TITLE
));
model
.
setCode
(
object
.
getString
(
WarehouseUserConstants
.
CODE
));
model
.
setType
(
object
.
getString
(
WarehouseUserConstants
.
TYPE
));
model
.
setTelephone
(
object
.
getString
(
WarehouseUserConstants
.
TELEPHONE
));
model
.
setOrg
(
object
.
getString
(
WarehouseUserConstants
.
ORG
));
model
.
setPath
(
object
.
getString
(
WarehouseUserConstants
.
PATH
));
model
.
setRole
(
object
.
getString
(
WarehouseUserConstants
.
ROLE
));
model
.
setDescription
(
object
.
getString
(
WarehouseUserConstants
.
DESCRIPTION
));
model
.
setState
(
object
.
getString
(
WarehouseUserConstants
.
STATE
));
model
.
setConfig
(
object
.
getString
(
WarehouseUserConstants
.
CONFIG
));
model
.
setEnabled
(
object
.
getBoolean
(
WarehouseUserConstants
.
ENABLED
));
model
.
setCreateTime
(
object
.
getDate
(
WarehouseUserConstants
.
CREATE_TIME
));
model
.
setCreator
(
object
.
get
(
WarehouseUserConstants
.
MODIFIER
).
isNull
()
?
null
:
object
.
get
(
WarehouseUserConstants
.
CREATOR
));
model
.
setModifyTime
(
object
.
getDate
(
WarehouseUserConstants
.
MODIFY_TIME
));
model
.
setModifier
(
object
.
get
(
WarehouseUserConstants
.
MODIFIER
).
isNull
()
?
null
:
object
.
get
(
WarehouseUserConstants
.
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/WarehouseUserService.java
0 → 100644
View file @
39f84e76
package
com
.
beecode
.
inz
.
basis
.
service
;
import
java.util.UUID
;
import
com.beecode.inz.basis.pojo.WarehouseUser
;
/**
* Service
* @author pengwufeng
*
*/
public
interface
WarehouseUserService
{
/**
* 创建客户
* @param warehouseUser
* @return
*/
UUID
create
(
WarehouseUser
warehouseUser
);
/**
* 根据电话获取客户
* @param telephone
* @return
*/
WarehouseUser
getByTelephone
(
String
telephone
);
/**
* 根据用户名获取客户
* @param userame
* @return
*/
WarehouseUser
getByUsername
(
String
userame
);
/**
* 根据id获取客户
* @param userame
* @return
*/
WarehouseUser
getById
(
UUID
id
);
WarehouseUser
getByUsernameOrTelephone
(
String
userame
);
/**
* 根据传参对每个字段进行识别更新,不包含id,code,createtime,version等字段
* @param warehouseUser
*/
void
modify
(
WarehouseUser
warehouseUser
);
/**
* 更新指定客户的密码
* @param id
* @param newPassword
*/
void
updatePassword
(
UUID
id
,
String
newPassword
);
}
backend/inz.basis/src/main/java/com/beecode/inz/basis/util/JsonUtil.java
0 → 100644
View file @
39f84e76
package
com
.
beecode
.
inz
.
basis
.
util
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
public
class
JsonUtil
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
JsonUtil
.
class
);
private
static
ObjectMapper
objectMapper
=
new
ObjectMapper
();
static
{
// //该属性设置主要是将对象的所有字段全部列入,若有特殊需求,可以进入JsonSerialize.Inclusion该枚举类查看
// objectMapper.setSerializationInclusion(JsonSerialize.Inclusion.ALWAYS);
//
// //该属性设置主要是取消将对象的时间默认转换timesstamps(时间戳)形式
// objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS,
// false);
//
// //该属性设置主要是将忽略空bean转json错误
// objectMapper.configure(MapperFeature.Feature.FAIL_ON_EMPTY_BEANS,
// false);
// 。
// 忽略在json字符串中存在,在java类中不存在字段,防止错误
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 设置转时间的格式
objectMapper
.
setDateFormat
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
));
}
public
static
<
T
>
String
beanToJson
(
T
obj
)
{
if
(
obj
==
null
)
{
return
null
;
}
try
{
return
obj
instanceof
String
?
(
String
)
obj
:
objectMapper
.
writeValueAsString
(
obj
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"obj To json is error"
,
e
);
return
null
;
}
}
public
static
<
T
>
T
jsonToBean
(
String
json
,
Class
<
T
>
clazz
)
{
if
(
StringUtils
.
isEmpty
(
json
)
||
clazz
==
null
)
{
return
null
;
}
try
{
return
objectMapper
.
readValue
(
json
,
clazz
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"json To obj is error"
,
e
);
return
null
;
}
}
public
static
<
T
,
E
>
Map
<
T
,
E
>
jsonToMap
(
String
json
,
Class
<
T
>
clazz
,
Class
<
E
>
claze
)
{
Map
<
T
,
E
>
map
=
null
;
if
(
StringUtils
.
isNotEmpty
(
json
))
{
JavaType
javaType
=
objectMapper
.
getTypeFactory
().
constructParametricType
(
Map
.
class
,
clazz
,
claze
);
try
{
map
=
objectMapper
.
readValue
(
json
,
javaType
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"{}"
,
e
);
}
}
return
map
!=
null
?
map
:
new
ConcurrentHashMap
<>();
}
public
static
<
T
>
List
<
T
>
jsonToList
(
String
jsonArray
,
Class
<
T
>
clazz
)
{
List
<
T
>
list
=
null
;
if
(
StringUtils
.
isNotEmpty
(
jsonArray
))
{
JavaType
javaType
=
objectMapper
.
getTypeFactory
().
constructParametricType
(
ArrayList
.
class
,
clazz
);
try
{
list
=
objectMapper
.
readValue
(
jsonArray
,
javaType
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"{}"
,
e
);
}
}
return
list
!=
null
?
list
:
new
ArrayList
<>();
}
}
\ No newline at end of file
backend/inz.basis/src/main/java/com/beecode/inz/basis/web/WarehouseUserController.java
0 → 100644
View file @
39f84e76
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.inz.basis.pojo.WarehouseUser
;
import
com.beecode.inz.basis.service.WarehouseUserService
;
import
com.beecode.inz.basis.team.pojo.ResponseObj
;
import
com.beecode.inz.basis.util.JsonUtil
;
import
com.beecode.xlib.utils.StringUtil
;
/**
* 场站用户controller
* @author pengwufeng
*
*/
@RestController
@RequestMapping
(
"/warehouseuser"
)
public
class
WarehouseUserController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WarehouseUserController
.
class
);
@Autowired
private
WarehouseUserService
warehouseUserService
;
/**
* 创建场站用户
*
* @param obj
* @return
*/
@PostMapping
public
Object
create
(
@RequestBody
String
body
)
{
if
(
StringUtil
.
isEmpty
(
body
))
{
return
ResponseObj
.
error
(
"参数不能为空"
);
}
WarehouseUser
warehouseUser
=
JsonUtil
.
jsonToBean
(
body
,
WarehouseUser
.
class
);
if
(
warehouseUser
==
null
)
{
return
ResponseObj
.
error
(
"参数无法识别"
);
}
try
{
warehouseUserService
.
create
(
warehouseUser
);
}
catch
(
Exception
e
)
{
logger
.
error
(
""
,
e
);
return
ResponseObj
.
error
(
e
.
getMessage
());
}
return
ResponseObj
.
success
(
"操作成功"
,
null
);
}
}
backend/inz.basis/src/main/model/com/beecode/inz/basis/datamodel/WarehouseUser.mk
0 → 100644
View file @
39f84e76
<model>
<header>
<type>bcp.type.DataModel</type>
<package>com.beecode.inz.basis.datamodel</package>
<title>场站用户</title>
<name>WarehouseUser</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-54ee750ba9b2' multiVersion='undefined' domainInherit='undefined' tableName='xyst_dinas_basis_warehouse_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/WarehouseUser.hbm.xml</hibernate>
</dataModel>
</content>
</model>
\ No newline at end of file
backend/inz.basis/src/main/resources/com/beecode/inz/basis/datamodel/WarehouseUser.jmx
0 → 100644
View file @
39f84e76
<?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-54ee750ba9b2
</id>
<name>
com.beecode.inz.basis.datamodel.WarehouseUser
</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/WarehouseUser.hbm.xml
0 → 100644
View file @
39f84e76
<?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.WarehouseUser"
table=
"xyst_dinas_basis_warehouse_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/inz.common/src/main/java/com/beecode/inz/common/util/JsonUtil.java
View file @
39f84e76
package
com
.
beecode
.
inz
.
common
.
util
;
package
com
.
beecode
.
inz
.
common
.
util
;
import
com.google.gson.Gson
;
import
java.text.SimpleDateFormat
;
import
com.google.gson.GsonBuilder
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
public
class
JsonUtil
{
public
class
JsonUtil
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
JsonUtil
.
class
);
private
static
ObjectMapper
objectMapper
=
new
ObjectMapper
();
static
{
// //该属性设置主要是将对象的所有字段全部列入,若有特殊需求,可以进入JsonSerialize.Inclusion该枚举类查看
// objectMapper.setSerializationInclusion(JsonSerialize.Inclusion.ALWAYS);
//
// //该属性设置主要是取消将对象的时间默认转换timesstamps(时间戳)形式
// objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS,
// false);
//
// //该属性设置主要是将忽略空bean转json错误
// objectMapper.configure(MapperFeature.Feature.FAIL_ON_EMPTY_BEANS,
// false);
// 。
// 忽略在json字符串中存在,在java类中不存在字段,防止错误
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// 设置转时间的格式
objectMapper
.
setDateFormat
(
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
));
}
public
static
<
T
>
String
beanToJson
(
T
obj
)
{
if
(
obj
==
null
)
{
return
null
;
}
try
{
return
obj
instanceof
String
?
(
String
)
obj
:
objectMapper
.
writeValueAsString
(
obj
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"obj To json is error"
,
e
);
return
null
;
}
}
public
static
<
T
>
T
jsonToBean
(
String
json
,
Class
<
T
>
clazz
)
{
if
(
StringUtils
.
isEmpty
(
json
)
||
clazz
==
null
)
{
return
null
;
}
try
{
return
objectMapper
.
readValue
(
json
,
clazz
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"json To obj is error"
,
e
);
return
null
;
}
}
public
static
<
T
,
E
>
Map
<
T
,
E
>
jsonToMap
(
String
json
,
Class
<
T
>
clazz
,
Class
<
E
>
claze
)
{
Map
<
T
,
E
>
map
=
null
;
if
(
StringUtils
.
isNotEmpty
(
json
))
{
JavaType
javaType
=
objectMapper
.
getTypeFactory
().
constructParametricType
(
Map
.
class
,
clazz
,
claze
);
try
{
map
=
objectMapper
.
readValue
(
json
,
javaType
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"{}"
,
e
);
}
}
return
map
!=
null
?
map
:
new
ConcurrentHashMap
<>();
}
public
static
<
T
>
List
<
T
>
jsonToList
(
String
jsonArray
,
Class
<
T
>
clazz
)
{
List
<
T
>
list
=
null
;
if
(
StringUtils
.
isNotEmpty
(
jsonArray
))
{
JavaType
javaType
=
objectMapper
.
getTypeFactory
().
constructParametricType
(
ArrayList
.
class
,
clazz
);
try
{
list
=
objectMapper
.
readValue
(
jsonArray
,
javaType
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"{}"
,
e
);
}
}
public
static
final
Gson
gson
=
new
GsonBuilder
()
return
list
!=
null
?
list
:
new
ArrayList
<>();
.
setDateFormat
(
"yyyy-MM-dd HH:mm:ss"
)
.
create
();
/**
* json字符串转成对应的class object
* @param jsonText
* @param classz
* @return
*/
public
static
<
T
>
T
jsonToBean
(
String
jsonText
,
Class
<
T
>
classz
)
{
return
gson
.
fromJson
(
jsonText
,
classz
);
}
/**
* 对象to json字符串
* @param t
* @return
*/
public
static
String
toJsonString
(
Object
obj
)
{
return
gson
.
toJson
(
obj
);
}
}
}
}
\ No newline at end of file
backend/xyst.dinas.oa/settings.gradle
View file @
39f84e76
rootProject
.
name
=
'xyst.dinas.oa'
\ No newline at end of file
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