Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hp-smart
Commits
98fb7153
Commit
98fb7153
authored
Apr 11, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://git.pseer.com/platform/hp-smart
into dev-ly
parents
be95e666
04534c1b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
373 additions
and
73 deletions
+373
-73
CKExcelTools.java
...main/java/com/baosight/hpjx/hp/kc/tools/CKExcelTools.java
+50
-39
HPMT003.xml
src/main/java/com/baosight/hpjx/hp/mt/sql/HPMT003.xml
+6
-3
HPSC002.xml
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC002.xml
+8
-9
PlatformUserDetailsService.java
...t4j/core/security/service/PlatformUserDetailsService.java
+69
-0
User.java
...in/java/com/baosight/iplat4j/core/security/user/User.java
+0
-0
ServiceXS0102.java
...java/com/baosight/xservices/xs/service/ServiceXS0102.java
+12
-0
ServiceXS0103.java
...java/com/baosight/xservices/xs/service/ServiceXS0103.java
+116
-0
ServiceXSUserJwt.java
...a/com/baosight/xservices/xs/service/ServiceXSUserJwt.java
+92
-0
ServiceXSUserManage.java
...om/baosight/xservices/xs/service/ServiceXSUserManage.java
+0
-0
XSUser.xml
src/main/java/com/baosight/xservices/xs/sql/XSUser.xml
+4
-1
HPPZ010.js
src/main/webapp/HP/PZ/HPPZ010.js
+15
-20
XS3201.js
src/main/webapp/XS/XS3201.js
+1
-1
No files found.
src/main/java/com/baosight/hpjx/hp/kc/tools/CKExcelTools.java
View file @
98fb7153
...
...
@@ -101,24 +101,26 @@ public class CKExcelTools {
sheet
.
setColumnWidth
(
1
,
30
*
256
);
sheet
.
setColumnWidth
(
5
,
15
*
256
);
sheet
.
setColumnWidth
(
6
,
15
*
256
);
// startRow:索引,从0开始
int
startRow
=
0
;
// 第1行
buildRow1
(
workbook
,
sheet
,
dataMap
);
startRow
=
buildRow1
(
workbook
,
sheet
,
startRow
,
dataMap
);
// 第2行:标题栏
buildRow2
(
workbook
,
sheet
);
startRow
=
buildRow2
(
workbook
,
sheet
,
startRow
);
// 第2行:标题栏
startRow
=
buildRow3
(
workbook
,
sheet
,
startRow
);
// 遍历数据行,excel行从第3行开始
int
headRow
=
2
;
int
lastRow
=
2
;
Map
<
String
,
List
<
HPKC004
>>
childrenMap
=
(
Map
<
String
,
List
<
HPKC004
>>)
dataMap
.
get
(
Field
.
CHILDREN
);
for
(
Map
.
Entry
<
String
,
List
<
HPKC004
>>
childrenEntry
:
childrenMap
.
entrySet
())
{
String
key
=
childrenEntry
.
getKey
();
List
<
HPKC004
>
values
=
childrenEntry
.
getValue
();
// 组名称
lastRow
=
buildGroupRow
(
workbook
,
sheet
,
key
,
lastRow
,
head
Row
);
startRow
=
buildGroupRow
(
workbook
,
sheet
,
key
,
start
Row
);
// 明细数据,返回末尾行数
lastRow
=
buildChildRow
(
workbook
,
sheet
,
values
,
lastRow
,
head
Row
);
startRow
=
buildChildRow
(
workbook
,
sheet
,
values
,
start
Row
);
}
// 页脚
buildFoot
(
workbook
,
sheet
,
las
tRow
);
buildFoot
(
workbook
,
sheet
,
star
tRow
);
return
workbook
;
}
...
...
@@ -127,12 +129,11 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param
las
tRow
* @param
star
tRow
*/
private
static
void
buildFoot
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
int
las
tRow
)
{
private
static
void
buildFoot
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
int
star
tRow
)
{
// 页脚第一行
int
currRow
=
lastRow
+
1
;
HSSFRow
row1
=
sheet
.
createRow
(
currRow
);
HSSFRow
row1
=
sheet
.
createRow
(
startRow
);
row1
.
setHeight
((
short
)
(
20
*
20
));
// 1.1
HSSFCell
cell1_1
=
row1
.
createCell
(
0
);
...
...
@@ -143,11 +144,11 @@ public class CKExcelTools {
cell1_2
.
setCellValue
(
"承运车号:"
);
cell1_2
.
setCellStyle
(
getCellStyle
(
workbook
,
HorizontalAlignment
.
LEFT
,
VerticalAlignment
.
CENTER
,
true
,
false
));
// 合并单元格
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
currRow
,
curr
Row
,
0
,
1
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
currRow
,
curr
Row
,
2
,
4
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
startRow
,
start
Row
,
0
,
1
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
startRow
,
start
Row
,
2
,
4
));
// 页脚第二行
currRow
=
curr
Row
+
1
;
HSSFRow
row2
=
sheet
.
createRow
(
curr
Row
);
startRow
=
start
Row
+
1
;
HSSFRow
row2
=
sheet
.
createRow
(
start
Row
);
row2
.
setHeight
((
short
)
(
20
*
20
));
// 1.1
HSSFCell
cell2_1
=
row2
.
createCell
(
0
);
...
...
@@ -158,8 +159,8 @@ public class CKExcelTools {
cell2_2
.
setCellValue
(
"发货人签字:"
);
cell2_2
.
setCellStyle
(
getCellStyle
(
workbook
,
HorizontalAlignment
.
LEFT
,
VerticalAlignment
.
CENTER
,
true
,
false
));
// 合并单元格
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
currRow
,
curr
Row
,
0
,
1
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
currRow
,
curr
Row
,
2
,
4
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
startRow
,
start
Row
,
0
,
1
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
startRow
,
start
Row
,
2
,
4
));
}
/**
...
...
@@ -168,20 +169,16 @@ public class CKExcelTools {
* @param workbook
* @param sheet
* @param values
* @param lastRow
* @param headRow
* @param startRow
*/
private
static
int
buildChildRow
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
List
<
HPKC004
>
values
,
int
lastRow
,
int
headRow
)
{
int
currRow
=
lastRow
+
1
;
private
static
int
buildChildRow
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
List
<
HPKC004
>
values
,
int
startRow
)
{
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++)
{
HPKC004
valueMap
=
values
.
get
(
i
);
currRow
=
currRow
+
i
;
HSSFRow
row
=
sheet
.
createRow
(
currRow
);
HSSFRow
row
=
sheet
.
createRow
(
startRow
);
row
.
setHeight
((
short
)
(
20
*
20
));
// 序号
HSSFCell
cell1_0
=
row
.
createCell
(
0
);
cell1_0
.
setCellValue
(
currRow
-
headRow
);
cell1_0
.
setCellValue
(
startRow
-
2
);
cell1_0
.
setCellStyle
(
getCellStyle
(
workbook
));
// 名称
HSSFCell
cell1_1
=
row
.
createCell
(
1
);
...
...
@@ -211,8 +208,9 @@ public class CKExcelTools {
HSSFCell
cell1_6
=
row
.
createCell
(
6
);
cell1_6
.
setCellValue
(
valueMap
.
getRemark
());
cell1_6
.
setCellStyle
(
getCellStyle
(
workbook
));
++
startRow
;
}
return
curr
Row
;
return
start
Row
;
}
/**
...
...
@@ -220,17 +218,14 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param lastRow
* @param headRow
* @param startRow
*/
private
static
int
buildGroupRow
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
String
groupName
,
int
lastRow
,
int
headRow
)
{
int
currRow
=
lastRow
+
1
;
HSSFRow
row
=
sheet
.
createRow
(
currRow
);
private
static
int
buildGroupRow
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
String
groupName
,
int
startRow
)
{
HSSFRow
row
=
sheet
.
createRow
(
startRow
);
row
.
setHeight
((
short
)
(
20
*
20
));
// 序号
HSSFCell
cell1_0
=
row
.
createCell
(
0
);
cell1_0
.
setCellValue
(
currRow
-
headRow
);
cell1_0
.
setCellValue
(
startRow
-
2
);
cell1_0
.
setCellStyle
(
getCellStyle
(
workbook
));
// 名称
HSSFCell
cell1_1
=
row
.
createCell
(
1
);
...
...
@@ -248,8 +243,8 @@ public class CKExcelTools {
HSSFCell
cell1_6
=
row
.
createCell
(
6
);
cell1_6
.
setCellStyle
(
getCellStyle
(
workbook
));
// 合并单元格
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
currRow
,
curr
Row
,
1
,
6
));
return
currRow
;
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
startRow
,
start
Row
,
1
,
6
));
return
startRow
+
1
;
}
/**
...
...
@@ -257,11 +252,12 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param startRow
* @param dataMap
*/
private
static
void
buildRow1
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
Map
dataMap
)
{
private
static
int
buildRow1
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
int
startRow
,
Map
dataMap
)
{
// 在sheet中添加第0行,注意老版本poi对Excel的行数列数有限制short
HSSFRow
row1
=
sheet
.
createRow
(
0
);
HSSFRow
row1
=
sheet
.
createRow
(
startRow
);
row1
.
setHeight
((
short
)
(
20
*
20
));
// 1.1、表头:项目名
HSSFCell
cell1_1
=
row1
.
createCell
(
0
);
...
...
@@ -274,6 +270,7 @@ public class CKExcelTools {
// 合并单元格
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
0
,
4
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
5
,
6
));
return
startRow
+
1
;
}
/**
...
...
@@ -281,10 +278,11 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param startRow
*/
private
static
void
buildRow2
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
)
{
private
static
int
buildRow2
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
int
startRow
)
{
// 2.第2行标题行
HSSFRow
row2
=
sheet
.
createRow
(
1
);
HSSFRow
row2
=
sheet
.
createRow
(
startRow
);
row2
.
setHeight
((
short
)
(
20
*
20
));
// 2.0、序号
HSSFCell
cell2_0
=
row2
.
createCell
(
0
);
...
...
@@ -316,6 +314,17 @@ public class CKExcelTools {
cell2_6
.
setCellValue
(
"备注"
);
cell2_6
.
setCellStyle
(
getCellStyle
(
workbook
,
HorizontalAlignment
.
CENTER
,
VerticalAlignment
.
CENTER
,
true
,
true
));
return
startRow
+
1
;
}
/**
* 构建第2~3行
*
* @param workbook
* @param sheet
* @param startRow
*/
private
static
int
buildRow3
(
HSSFWorkbook
workbook
,
HSSFSheet
sheet
,
int
startRow
)
{
// 3.第3行标题行
HSSFRow
row3
=
sheet
.
createRow
(
2
);
row3
.
setHeight
((
short
)
(
20
*
20
));
...
...
@@ -350,8 +359,10 @@ public class CKExcelTools {
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
2
,
4
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
2
,
5
,
5
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
2
,
6
,
6
));
return
startRow
+
1
;
}
/**
* 默认:居中+边框
*
...
...
src/main/java/com/baosight/hpjx/hp/mt/sql/HPMT003.xml
View file @
98fb7153
...
...
@@ -242,9 +242,11 @@
<select
id=
"queryPmXMinfo"
resultClass=
"java.util.HashMap"
>
select
select a.PROJ_NAME,a.JHDATE,a.JHCL,a.SJCL,a.SCJD,a.FHJD
from (select
a.PROJ_NAME,
concat(left(max(a.PLAN_COMPLETION_DATE),4),'年',substring(max(a.PLAN_COMPLETION_DATE),5,2),'月',right(max(a.PLAN_COMPLETION_DATE),2),'日') as JHDATE,
a.DELIVERY_DATE,
concat(left(max(a.PLAN_COMPLETION_DATE),4),'/',substring(max(a.PLAN_COMPLETION_DATE),5,2),'/',right(max(a.PLAN_COMPLETION_DATE),2),'/') as JHDATE,
concat(format(ifnull(sum(b.NUM*b.UNIT_WT ),0),2),'吨') as JHCL,
concat(format(ifnull(sum(c.WEIGHT),0),2),'吨') as SJCL,
concat(format((ifnull( sum( c.WEIGHT ), 0 ) / ifnull( sum( b.NUM*b.UNIT_WT ), 0 ) * 100),2),'%') as SCJD,
...
...
@@ -254,7 +256,8 @@
left join hpjx.T_HPkC003 c on c.PROD_ORDER_NO = b.PROD_ORDER_NO
left join hpjx.T_HPkC004 d on d.PROD_NO = b.PROD_ORDER_NO
where a.COMPANY_CODE = #companyCode# and c.FACTORY_CODE = #factorycode#
group by a.PROJ_NAME
group by a.PROJ_NAME) a
where left(a.SCJD,3)
<![CDATA[<>]]>
'100' and left(a.FHJD,3)
<![CDATA[<>]]>
'100' and a.DELIVERY_DATE > DATE_FORMAT(DATE_SUB(CURRENT_DATE(), INTERVAL 3 MONTH), '%Y%m%d')
</select>
<select
id=
"queryPmCompanyInfo"
resultClass=
"java.util.HashMap"
>
...
...
src/main/java/com/baosight/hpjx/hp/sc/sql/HPSC002.xml
View file @
98fb7153
...
...
@@ -327,9 +327,8 @@
DELIVERY_DATE as "deliveryDate"
FROM
hpjx.t_hpsc002
WHERE
1=1
<include
refid=
"authCondition"
/>
WHERE 1=1
<include
refid=
"authCondition"
/>
<isNotEmpty
prepend=
" AND "
property=
"pEname"
>
PARENT_ID = #pEname#
</isNotEmpty>
...
...
@@ -362,9 +361,10 @@
DELIVERY_DATE as "deliveryDate"
FROM
hpjx.t_hpsc002
WHERE
1=1 AND PARENT_ID NOT IN ('root') AND LV != 3
<include
refid=
"authCondition"
/>
WHERE 1=1
<include
refid=
"authCondition"
/>
AND PARENT_ID NOT IN ('root')
AND LV != 3
<isNotEmpty
prepend=
" AND "
property=
"pEname"
>
PARENT_ID = #pEname#
</isNotEmpty>
...
...
@@ -398,9 +398,8 @@
DELIVERY_DATE as "deliveryDate"
FROM
hpjx.t_hpsc002
WHERE
1=1
<include
refid=
"authCondition"
/>
WHERE 1=1
<include
refid=
"authCondition"
/>
<isNotEmpty
prepend=
" AND "
property=
"pEname"
>
PARENT_ID = #pEname#
</isNotEmpty>
...
...
src/main/java/com/baosight/iplat4j/core/security/service/PlatformUserDetailsService.java
0 → 100644
View file @
98fb7153
package
com
.
baosight
.
iplat4j
.
core
.
security
.
service
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.security.base.SecurityFactory
;
import
com.baosight.iplat4j.core.security.base.UserNotExistException
;
import
com.baosight.iplat4j.core.security.user.IUserManager
;
import
com.baosight.iplat4j.core.security.user.User
;
import
org.springframework.security.core.GrantedAuthority
;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
import
org.springframework.util.StringUtils
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Date
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,16:08
*/
public
class
PlatformUserDetailsService
implements
UserDetailsService
{
private
String
role
=
"ROLE_VERIFIED"
;
public
PlatformUserDetailsService
()
{
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
;
}
public
UserDetails
loadUserByUsername
(
String
username
)
throws
UsernameNotFoundException
{
try
{
IUserManager
userManager
=
SecurityFactory
.
getUserManager
();
User
user
=
userManager
.
getUser
(
username
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"找不到这个用户"
);
}
else
{
SimpleGrantedAuthority
authority
=
new
SimpleGrantedAuthority
(
this
.
role
);
Collection
<
GrantedAuthority
>
authorities
=
new
ArrayList
();
authorities
.
add
(
authority
);
boolean
valid
=
user
.
getValid
()
==
1
;
boolean
userNotExpired
=
true
;
String
expireDate
=
user
.
getExpireDate
();
if
(
expireDate
!=
null
&&
StringUtils
.
hasText
(
expireDate
))
{
Calendar
currentDate
=
Calendar
.
getInstance
();
Date
nowTime
=
currentDate
.
getTime
();
SimpleDateFormat
time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
expireDateTime
=
time
.
parse
(
expireDate
);
userNotExpired
=
expireDateTime
.
after
(
nowTime
);
}
boolean
passwordNotExpired
=
true
;
// 支持登录名或手机号两种方式登录 modify by songx at 2024-04-10
return
new
org
.
springframework
.
security
.
core
.
userdetails
.
User
(
user
.
getLoginName
(),
user
.
getLoginName
(),
valid
,
userNotExpired
,
passwordNotExpired
,
!
user
.
getIsLocked
(),
authorities
);
}
}
catch
(
UserNotExistException
var13
)
{
throw
new
UsernameNotFoundException
(
var13
.
getMessage
(),
var13
);
}
catch
(
Exception
var14
)
{
throw
new
PlatException
(
var14
);
}
}
}
src/main/java/com/baosight/iplat4j/core/security/user/User.java
0 → 100644
View file @
98fb7153
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/xservices/xs/service/ServiceXS0102.java
View file @
98fb7153
...
...
@@ -16,6 +16,7 @@ import com.baosight.xservices.xs.constants.LoginConstants;
import
com.baosight.xservices.xs.domain.XS01
;
import
com.baosight.xservices.xs.domain.XS02
;
import
com.baosight.xservices.xs.util.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -84,6 +85,17 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
return
inInfo
;
}
// 校验手机号是否存在 added by songx at 2024-04-10
if
(
StringUtils
.
isNotBlank
(
mobile
))
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"mobile"
,
mobile
);
List
existMobile
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
CollectionUtils
.
isNotEmpty
(
existMobile
))
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"注册失败!手机号已被其他用户使用"
);
return
inInfo
;
}
}
String
userGroupEname
=
(
String
)
inInfoRowMap
.
get
(
"groupName"
);
inInfoRowMap
.
put
(
"userGroupEname"
,
userGroupEname
);
inInfoRowMap
.
put
(
"password"
,
password
);
...
...
src/main/java/com/baosight/xservices/xs/service/ServiceXS0103.java
0 → 100644
View file @
98fb7153
package
com
.
baosight
.
xservices
.
xs
.
service
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.log.xeye.entity.XEyeEntity
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.xservices.xs.util.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 重写
*
* @author:songx
* @date:2024/4/10,17:15
*/
public
class
ServiceXS0103
extends
ServiceEPBase
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
ServiceXS0103
.
class
);
public
ServiceXS0103
()
{
}
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
return
this
.
query
(
inInfo
);
}
public
EiInfo
query
(
EiInfo
inInfo
)
{
String
loginName
=
UserSession
.
getUser
().
getUsername
();
Map
map
=
new
HashMap
();
map
.
put
(
"loginName"
,
loginName
);
List
resultList
=
this
.
dao
.
query
(
"XS0103.query"
,
map
);
if
(
null
!=
resultList
&&
resultList
.
size
()
>
0
)
{
Map
result
=
(
Map
)
resultList
.
get
(
0
);
inInfo
.
set
(
"userId"
,
result
.
get
(
"userId"
));
inInfo
.
set
(
"userName"
,
result
.
get
(
"userName"
));
inInfo
.
set
(
"mobile"
,
result
.
get
(
"mobile"
));
inInfo
.
set
(
"email"
,
result
.
get
(
"email"
));
}
return
inInfo
;
}
public
EiInfo
update
(
EiInfo
inInfo
)
{
StringBuilder
buffer
=
new
StringBuilder
();
StringBuilder
detail
=
new
StringBuilder
();
String
mobile
=
(
String
)
inInfo
.
get
(
"mobile"
);
Map
map
=
new
HashMap
();
map
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
map
.
put
(
"userName"
,
inInfo
.
get
(
"userName"
));
map
.
put
(
"mobile"
,
mobile
);
map
.
put
(
"email"
,
inInfo
.
get
(
"email"
));
map
.
put
(
"recRevisor"
,
inInfo
.
get
(
"userName"
));
map
.
put
(
"recReviseTime"
,
DateUtils
.
curDateTimeStr14
());
try
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
List
existsUsers
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
existsUsers
.
size
()
<
1
)
{
inInfo
.
setStatus
(-
1
);
inInfo
.
setMsg
(
"编辑用户信息失败,不存在: "
+
inInfo
.
get
(
"userName"
)
+
"的用户!"
);
return
inInfo
;
}
Map
existsUserMap
=
(
Map
)
existsUsers
.
get
(
0
);
String
dbMobile
=
(
String
)
existsUserMap
.
get
(
"mobile"
);
// 手机号变更需要校验唯一性 added by songx at 2024-04-10
if
(
StringUtils
.
isNotBlank
(
mobile
)
&&
!
dbMobile
.
equals
(
mobile
))
{
paramMap
=
new
HashMap
();
paramMap
.
put
(
"mobile"
,
mobile
);
List
existMobile
=
this
.
dao
.
query
(
"XSUser.query"
,
paramMap
);
if
(
CollectionUtils
.
isNotEmpty
(
existMobile
))
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"手机号已被其他用户使用"
);
return
inInfo
;
}
}
this
.
dao
.
update
(
"XS0103.update"
,
map
);
buffer
.
append
(
"更新记录成功"
);
Map
param
=
new
HashMap
();
param
.
put
(
"userId"
,
inInfo
.
get
(
"userId"
));
List
userList
=
this
.
dao
.
query
(
"XS01.query"
,
param
);
if
(
userList
!=
null
&&
userList
.
size
()
>
0
)
{
Map
userMap
=
(
Map
)
userList
.
get
(
0
);
XEyeEntity
xEyeEntity
=
new
XEyeEntity
();
xEyeEntity
.
setLogId
(
"1002"
);
xEyeEntity
.
setLogName
(
"修改用户信息"
);
xEyeEntity
.
setInvokeInfo
(
UserSession
.
getUser
().
getUsername
()
+
"在"
+
DateUtils
.
curDateStr
(
"yyyy-MM-dd HH:mm:ss"
)
+
"修改了登录名为 "
+
userMap
.
get
(
"loginName"
)
+
" 的用户信息"
);
xEyeEntity
.
setStatus
(
inInfo
.
getStatus
()
+
""
);
xEyeEntity
.
set
(
"x_xs_id"
,
userMap
.
get
(
"userId"
));
xEyeEntity
.
set
(
"x_xs_on"
,
UserSession
.
getUser
().
getUsername
());
xEyeEntity
.
set
(
"x_xs_ln"
,
userMap
.
get
(
"loginName"
));
this
.
log
(
xEyeEntity
);
}
}
catch
(
Exception
var9
)
{
buffer
.
append
(
"更新记录失败"
);
inInfo
.
setStatus
(-
1
);
detail
.
append
(
var9
.
getCause
().
toString
());
logger
.
error
(
var9
.
getCause
().
getMessage
());
}
EiInfo
outInfo
=
this
.
query
(
inInfo
);
outInfo
.
setMsg
(
buffer
.
toString
());
outInfo
.
setDetailMsg
(
detail
.
toString
());
return
outInfo
;
}
}
src/main/java/com/baosight/xservices/xs/service/ServiceXSUserJwt.java
0 → 100644
View file @
98fb7153
package
com
.
baosight
.
xservices
.
xs
.
service
;
import
com.baosight.iplat4j.core.FrameworkInfo
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.log.Logger
;
import
com.baosight.iplat4j.core.log.LoggerFactory
;
import
com.baosight.iplat4j.core.security.base.SecurityFactory
;
import
com.baosight.iplat4j.core.security.user.IUserManager
;
import
com.baosight.iplat4j.core.security.user.User
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.util.StringUtils
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.xservices.xs.jwt.JwtTokenValidator
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UsernameNotFoundException
;
/**
* 重写
*
* @author:songx
* @date:2024/4/11,15:28
*/
public
class
ServiceXSUserJwt
extends
ServiceBase
{
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceXSUserJwt
.
class
);
@Autowired
JwtTokenValidator
jwtTokenValidator
;
public
ServiceXSUserJwt
()
{
}
public
EiInfo
generateJwt
(
EiInfo
inInfo
)
{
String
username
=
inInfo
.
getString
(
"loginName"
);
String
password
=
inInfo
.
getString
(
"password"
);
String
audience
=
inInfo
.
getString
(
"audience"
);
EiInfo
outInfo
;
try
{
if
(!
StringUtils
.
isNotEmpty
(
audience
))
{
audience
=
FrameworkInfo
.
getProjectEname
().
toUpperCase
();
}
IUserManager
um
=
SecurityFactory
.
getUserManager
();
User
user
=
um
.
getUser
(
username
);
if
(
user
==
null
)
{
throw
new
UsernameNotFoundException
(
"Can't find user!"
);
}
outInfo
=
um
.
checkIdentity
(
user
.
getLoginName
(),
password
);
if
(
outInfo
.
getStatus
()
>
0
)
{
Map
tokenMap
=
new
HashMap
();
tokenMap
.
put
(
"sub"
,
user
.
getLoginName
());
tokenMap
.
put
(
"uid"
,
user
.
getUserId
());
Object
userCname
=
user
.
get
(
"userName"
);
if
(
userCname
!=
null
)
{
tokenMap
.
put
(
"ucn"
,
userCname
.
toString
());
}
if
(!
StringUtils
.
isNotEmpty
(
audience
))
{
audience
=
FrameworkInfo
.
getProjectEname
().
toUpperCase
();
}
String
token
=
this
.
jwtTokenValidator
.
generateToken
(
tokenMap
,
audience
);
outInfo
.
set
(
"token"
,
token
);
outInfo
.
set
(
"x-token"
,
token
);
outInfo
.
getAttr
().
put
(
"x-token"
,
token
);
}
}
catch
(
Exception
var11
)
{
outInfo
=
new
EiInfo
();
this
.
logger
.
error
(
var11
.
getMessage
(),
var11
);
outInfo
.
setStatus
(-
1
);
outInfo
.
setMsg
(
var11
.
getMessage
());
}
return
outInfo
;
}
public
EiInfo
validateTest
(
EiInfo
inInfo
)
{
new
HashMap
();
inInfo
.
set
(
"userSessionData"
,
new
HashMap
(
UserSession
.
getData
()));
inInfo
.
set
(
"loginName"
,
UserSession
.
getLoginName
());
return
inInfo
;
}
public
EiInfo
validateTokenTest
(
EiInfo
inInfo
)
{
String
token
=
inInfo
.
getString
(
"token"
);
Map
result
=
this
.
jwtTokenValidator
.
validateToken
(
token
);
inInfo
.
set
(
"result"
,
result
);
return
inInfo
;
}
}
src/main/java/com/baosight/xservices/xs/service/ServiceXSUserManage.java
0 → 100644
View file @
98fb7153
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/xservices/xs/sql/XSUser.xml
View file @
98fb7153
...
...
@@ -52,7 +52,10 @@
USER_NAME like ('%$userName$%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"loginName"
>
LOGIN_NAME = #loginName#
(LOGIN_NAME = #loginName# OR MOBILE = #loginName#)
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"mobile"
>
MOBILE = #mobile#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"userType"
>
USER_TYPE = #userType#
...
...
src/main/webapp/HP/PZ/HPPZ010.js
View file @
98fb7153
...
...
@@ -218,26 +218,21 @@ let save = function () {
return
;
}
JSUtils
.
confirm
(
"确定对勾选中的数据做
\"
保存
\"
操作? "
,
{
ok
:
saveOk
(
pageNode
,
orgNode
)
});
}
/**
* 保存确认
*/
let
saveOk
=
function
(
pageNode
,
orgNode
)
{
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"result-0-pageEname"
,
pageNode
.
label
);
inInfo
.
set
(
"result-0-pageCname"
,
pageNode
.
text
);
inInfo
.
set
(
"result-0-authDepCode"
,
orgNode
.
label
);
inInfo
.
set
(
"result-0-authDepName"
,
orgNode
.
text
);
inInfo
.
set
(
"result-0-authType"
,
$
(
"input:radio[name='result-0-authType']:checked"
).
val
());
EiCommunicator
.
send
(
"HPPZ010"
,
"save"
,
inInfo
,
{
onSuccess
:
function
(
res
)
{
message
(
res
.
msg
);
},
onFail
:
function
(
res
)
{
ok
:
function
()
{
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"result-0-pageEname"
,
pageNode
.
label
);
inInfo
.
set
(
"result-0-pageCname"
,
pageNode
.
text
);
inInfo
.
set
(
"result-0-authDepCode"
,
orgNode
.
label
);
inInfo
.
set
(
"result-0-authDepName"
,
orgNode
.
text
);
inInfo
.
set
(
"result-0-authType"
,
$
(
"input:radio[name='result-0-authType']:checked"
).
val
());
EiCommunicator
.
send
(
"HPPZ010"
,
"save"
,
inInfo
,
{
onSuccess
:
function
(
res
)
{
message
(
res
.
msg
);
},
onFail
:
function
(
res
)
{
}
},
{
async
:
false
});
}
}
,
{
async
:
false
}
);
});
}
src/main/webapp/XS/XS3201.js
View file @
98fb7153
...
...
@@ -162,7 +162,7 @@ $(function () {
return
}
$
(
"#authWindow"
).
data
(
"kendoWindow"
).
open
()
result4Grid
.
dataSource
.
page
(
1
);
//
result4Grid.dataSource.page(1);
result5Grid
.
dataSource
.
page
(
1
);
})
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment