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
7efc9eba
Commit
7efc9eba
authored
Mar 21, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.数据权限开发
parent
d341d9f1
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
984 additions
and
698 deletions
+984
-698
AuthTypeEnum.java
src/main/java/com/baosight/hpjx/common/AuthTypeEnum.java
+66
-0
ConfigurationBean.java
...m/baosight/hpjx/core/configuration/ConfigurationBean.java
+0
-36
DaoUtils.java
src/main/java/com/baosight/hpjx/core/dao/DaoUtils.java
+3
-3
UserSessionUtils.java
...ava/com/baosight/hpjx/core/security/UserSessionUtils.java
+1
-28
HPSqlConstant.java
...ain/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
+0
-2
ServiceHPMT002.java
.../java/com/baosight/hpjx/hp/mt/service/ServiceHPMT002.java
+1
-10
HPPZ010.java
src/main/java/com/baosight/hpjx/hp/pz/domain/HPPZ010.java
+169
-113
ServiceHPPZ009.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ009.java
+2
-3
ServiceHPPZ010.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ010.java
+74
-164
ServiceHPPZ014.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ014.java
+0
-6
HPPZ009.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ009.xml
+3
-0
HPPZ010.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ010.xml
+80
-39
HPPZTools.java
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
+31
-0
ServiceHPSC003A.java
...java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003A.java
+0
-21
ServiceHPSC003B.java
...java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003B.java
+0
-2
ServiceHPSC005A.java
...java/com/baosight/hpjx/hp/sc/service/ServiceHPSC005A.java
+0
-2
ServiceHPSC006.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC006.java
+0
-7
ServiceHPSC007.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC007.java
+0
-7
ServiceHPSC098.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC098.java
+0
-2
Org.java
src/main/java/com/baosight/hpjx/hp/xs/domain/Org.java
+38
-0
ServiceHPXSUser.java
...java/com/baosight/hpjx/hp/xs/service/ServiceHPXSUser.java
+3
-1
HPXS002.xml
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXS002.xml
+14
-14
HPXSOrg.xml
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXSOrg.xml
+27
-0
HPXSTools.java
src/main/java/com/baosight/hpjx/hp/xs/tools/HPXSTools.java
+47
-26
ServiceHPZL001.java
.../java/com/baosight/hpjx/hp/zl/service/ServiceHPZL001.java
+0
-3
LogUtils.java
src/main/java/com/baosight/hpjx/util/LogUtils.java
+6
-21
SqlMapDaoLogProxy.java
...sight/iplat4j/core/data/ibatis/dao/SqlMapDaoLogProxy.java
+76
-6
ServiceXSOG0801A.java
...om/baosight/xservices/xs/og/service/ServiceXSOG0801A.java
+0
-1
ServiceXSOG0801B.java
...om/baosight/xservices/xs/og/service/ServiceXSOG0801B.java
+0
-8
ServiceXS0705.java
...java/com/baosight/xservices/xs/service/ServiceXS0705.java
+31
-37
XS0702.xml
src/main/java/com/baosight/xservices/xs/sql/XS0702.xml
+1
-1
HPPZ010.js
src/main/webapp/HP/PZ/HPPZ010.js
+254
-35
HPPZ010.jsp
src/main/webapp/HP/PZ/HPPZ010.jsp
+57
-100
No files found.
src/main/java/com/baosight/hpjx/common/AuthTypeEnum.java
0 → 100644
View file @
7efc9eba
package
com
.
baosight
.
hpjx
.
common
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 数据权限类型
*
* @author:songx
* @date:2024/3/21,9:58
*/
public
enum
AuthTypeEnum
{
ONLY_FACTORY
(
"onlyFactory"
,
"本厂"
),
ONLY_DEPT
(
"onlyDept"
,
"本部门"
);
/**
* 编码
*/
private
String
code
;
/**
* 中文名称
*/
private
String
name
;
AuthTypeEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
/**
* 根据编码获取
*
* @param code
* @return
*/
public
static
AuthTypeEnum
getByCode
(
String
code
)
{
for
(
AuthTypeEnum
item
:
AuthTypeEnum
.
values
())
{
if
(
item
.
getCode
().
equals
(
code
))
{
return
item
;
}
}
return
null
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
src/main/java/com/baosight/hpjx/core/configuration/ConfigurationBean.java
deleted
100644 → 0
View file @
d341d9f1
package
com
.
baosight
.
hpjx
.
core
.
configuration
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.eu.dm.PlatFileUploadManagerByAmazonS3
;
import
com.baosight.iplat4j.eu.dm.util.PlatFileUploader
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
lombok.extern.slf4j.Slf4j
;
/**
* 初始化注入bean
*
* @author:songx
* @date:2024/3/13,15:03
*/
@Slf4j
@Configuration
@ConditionalOnProperty
(
name
=
{
"iplat4j.admin.objectStorage.s3.switch"
},
havingValue
=
"on"
)
public
class
ConfigurationBean
{
@Bean
(
name
=
"platFileUploader"
)
public
PlatFileUploader
newPlatFileUploader
()
{
return
new
PlatFileUploader
();
}
@Bean
(
name
=
"fileUpLoadManager"
)
public
PlatFileUploadManagerByAmazonS3
newPlatFileUploadManagerByAmazonS3
()
{
return
new
PlatFileUploadManagerByAmazonS3
();
}
}
src/main/java/com/baosight/hpjx/core/dao/DaoUtils.java
View file @
7efc9eba
...
...
@@ -119,9 +119,9 @@ public class DaoUtils {
}
// 创建人部门编码
try
{
BeanUtils
.
setProperty
(
bean
,
"depCode"
,
HPXSTools
.
getOrgId
());
BeanUtils
.
setProperty
(
bean
,
"depCode"
,
HPXSTools
.
XsOrg
.
getOrgId
());
}
catch
(
Exception
e
)
{
log
.
warn
(
"写入创建人
企业
编码失败"
,
e
);
log
.
warn
(
"写入创建人
部门
编码失败"
,
e
);
}
// 创建时刻
try
{
...
...
@@ -175,7 +175,7 @@ public class DaoUtils {
}
// 创建人部门编码
try
{
map
.
put
(
"depCode"
,
HPXSTools
.
getOrgId
());
map
.
put
(
"depCode"
,
HPXSTools
.
XsOrg
.
getOrgId
());
}
catch
(
Exception
e
)
{
log
.
warn
(
"写入创建人企业编码失败"
,
e
);
}
...
...
src/main/java/com/baosight/hpjx/core/security/UserSessionUtils.java
View file @
7efc9eba
...
...
@@ -7,7 +7,6 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.xservices.xs.util.LoginUserDetails
;
import
org.apache.commons.collections.MapUtils
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -20,8 +19,6 @@ import java.util.concurrent.ConcurrentMap;
public
class
UserSessionUtils
extends
UserSession
{
private
static
ConcurrentMap
companyMap
=
new
ConcurrentHashMap
();
private
static
ConcurrentMap
depMap
=
new
ConcurrentHashMap
();
private
static
ConcurrentMap
userAdminMap
=
new
ConcurrentHashMap
();
/**
* 获取用户信息
...
...
@@ -79,31 +76,7 @@ public class UserSessionUtils extends UserSession {
if
(
loginName
==
null
)
{
return
null
;
}
String
depCode
=
MapUtils
.
getString
(
depMap
,
loginName
);
if
(
depCode
==
null
)
{
depCode
=
HPXSTools
.
getOrgId
();
depCode
=
depCode
==
null
?
""
:
depCode
.
trim
();
depMap
.
put
(
loginName
,
depCode
);
}
return
depCode
;
}
/**
* 获取登录用户是否超级管理员
*
* @return
*/
public
static
boolean
isUserAdmin
()
{
String
loginName
=
getLoginName
();
if
(
loginName
==
null
)
{
return
false
;
}
Boolean
isUserAdmin
=
MapUtils
.
getBoolean
(
userAdminMap
,
loginName
);
if
(
isUserAdmin
==
null
)
{
isUserAdmin
=
LoginUserDetails
.
isUserAdmin
(
loginName
);
userAdminMap
.
put
(
loginName
,
isUserAdmin
);
}
return
isUserAdmin
;
return
HPXSTools
.
XsOrg
.
getOrgId
();
}
}
src/main/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
View file @
7efc9eba
...
...
@@ -252,8 +252,6 @@ public class HPSqlConstant {
*/
public
class
HPPZ010
{
// 新增
public
static
final
String
INSERT
=
"HPPZ010.insert"
;
// 查询
public
static
final
String
QUERY
=
"HPPZ010.query"
;
}
...
...
src/main/java/com/baosight/hpjx/hp/mt/service/ServiceHPMT002.java
View file @
7efc9eba
package
com
.
baosight
.
hpjx
.
hp
.
mt
.
service
;
import
cn.hutool.core.util.PageUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
...
...
@@ -10,10 +9,7 @@ import com.baosight.hpjx.hp.constant.HPConstant;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile
;
import
com.baosight.hpjx.hp.mt.untils.Base64Utils
;
import
com.baosight.hpjx.hp.mt.untils.UploadUtils
;
import
com.baosight.hpjx.hp.sc.domain.HPSC002A
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.xs.domain.User
;
import
com.baosight.hpjx.hp.zl.domain.HPZL001
;
import
com.baosight.hpjx.hp.zl.domain.HPZL001A
;
...
...
@@ -26,12 +22,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
javax.imageio.ImageIO
;
...
...
src/main/java/com/baosight/hpjx/hp/pz/domain/HPPZ010.java
View file @
7efc9eba
...
...
@@ -15,109 +15,129 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-0
1-18 17:09:53
create
* @history 2024-0
3-21 10:15:34
create
*/
public
class
HPPZ010
extends
DaoEPBase
{
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
String
FIELD_ID
=
"id"
;
public
static
final
String
FIELD_SUBJECT_ID
=
"subjectId"
;
/* 授权主体ID*/
public
static
final
String
FIELD_SUBJECT_TYPE
=
"subjectType"
;
/* 授权主体类别*/
public
static
final
String
FIELD_OBJECT_ID
=
"objectId"
;
/* 授权客体ID*/
public
static
final
String
FIELD_OBJECT_TYPE
=
"objectType"
;
/* 授权客体类别*/
public
static
final
String
FIELD_COMPANY_CODE
=
"companyCode"
;
/* 企业编码*/
public
static
final
String
FIELD_DEP_CODE
=
"depCode"
;
/* 部门编码*/
public
static
final
String
FIELD_CREATED_BY
=
"createdBy"
;
/* 创建人*/
public
static
final
String
FIELD_CREATED_NAME
=
"createdName"
;
/* 创建人名称*/
public
static
final
String
FIELD_CREATED_TIME
=
"createdTime"
;
/* 创建时间*/
public
static
final
String
FIELD_UPDATED_BY
=
"updatedBy"
;
/* 更新人*/
public
static
final
String
FIELD_UPDATED_NAME
=
"updatedName"
;
/* 更新人名称*/
public
static
final
String
FIELD_UPDATED_TIME
=
"updatedTime"
;
/* 更新时间*/
public
static
final
String
FIELD_PAGE_ENAME
=
"pageEname"
;
/* 页面英文名*/
public
static
final
String
FIELD_PAGE_CNAME
=
"pageCname"
;
/* 页面中文名*/
public
static
final
String
FIELD_CUSTOM_AUTH
=
"customAuth"
;
/* 自定义权限*/
public
static
final
String
FIELD_DEP_AUTH
=
"depAuth"
;
/* 部门权限*/
public
static
final
String
COL_ID
=
"ID"
;
public
static
final
String
COL_SUBJECT_ID
=
"SUBJECT_ID"
;
/* 授权主体ID*/
public
static
final
String
COL_SUBJECT_TYPE
=
"SUBJECT_TYPE"
;
/* 授权主体类别*/
public
static
final
String
COL_OBJECT_ID
=
"OBJECT_ID"
;
/* 授权客体ID*/
public
static
final
String
COL_OBJECT_TYPE
=
"OBJECT_TYPE"
;
/* 授权客体类别*/
public
static
final
String
COL_COMPANY_CODE
=
"COMPANY_CODE"
;
/* 企业编码*/
public
static
final
String
COL_DEP_CODE
=
"DEP_CODE"
;
/* 部门编码*/
public
static
final
String
COL_CREATED_BY
=
"CREATED_BY"
;
/* 创建人*/
public
static
final
String
COL_CREATED_NAME
=
"CREATED_NAME"
;
/* 创建人名称*/
public
static
final
String
COL_CREATED_TIME
=
"CREATED_TIME"
;
/* 创建时间*/
public
static
final
String
COL_UPDATED_BY
=
"UPDATED_BY"
;
/* 更新人*/
public
static
final
String
COL_UPDATED_NAME
=
"UPDATED_NAME"
;
/* 更新人名称*/
public
static
final
String
COL_UPDATED_TIME
=
"UPDATED_TIME"
;
/* 更新时间*/
private
Long
id
=
null
;
private
String
subjectId
=
" "
;
/* 授权主体ID*/
private
String
subjectType
=
" "
;
/* 授权主体类别*/
private
String
objectId
=
" "
;
/* 授权客体ID*/
private
String
objectType
=
" "
;
/* 授权客体类别*/
public
static
final
String
COL_PAGE_ENAME
=
"PAGE_ENAME"
;
/* 页面英文名*/
public
static
final
String
COL_PAGE_CNAME
=
"PAGE_CNAME"
;
/* 页面中文名*/
public
static
final
String
COL_CUSTOM_AUTH
=
"CUSTOM_AUTH"
;
/* 自定义权限*/
public
static
final
String
COL_DEP_AUTH
=
"DEP_AUTH"
;
/* 部门权限*/
public
static
final
String
QUERY
=
"HPPZ010.query"
;
public
static
final
String
COUNT
=
"HPPZ010.count"
;
public
static
final
String
INSERT
=
"HPPZ010.insert"
;
public
static
final
String
UPDATE
=
"HPPZ010.update"
;
public
static
final
String
DELETE
=
"HPPZ010.delete"
;
private
Long
id
;
private
String
companyCode
=
" "
;
/* 企业编码*/
private
String
depCode
=
" "
;
/* 部门编码*/
private
String
createdBy
=
" "
;
/* 创建人*/
private
String
createdName
=
" "
;
/* 创建人名称*/
private
String
createdTime
=
" "
;
/* 创建时间*/
private
String
updatedBy
=
" "
;
/* 更新人*/
private
String
updatedName
=
" "
;
/* 更新人名称*/
private
String
updatedTime
=
" "
;
/* 更新时间*/
private
String
pageEname
=
" "
;
/* 页面英文名*/
private
String
pageCname
=
" "
;
/* 页面中文名*/
private
String
customAuth
=
" "
;
/* 自定义权限*/
private
String
depAuth
=
" "
;
/* 部门权限*/
/**
* initialize the metadata.
*/
public
void
initMetaData
()
{
EiColumn
eiColumn
;
eiColumn
=
new
EiColumn
(
FIELD_ID
);
eiColumn
.
setPrimaryKey
(
true
);
eiColumn
.
setDescName
(
" "
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_
SUBJECT_ID
);
eiColumn
.
setDescName
(
"
授权主体ID
"
);
eiColumn
=
new
EiColumn
(
FIELD_
COMPANY_CODE
);
eiColumn
.
setDescName
(
"
企业编码
"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_
SUBJECT_TYP
E
);
eiColumn
.
setDescName
(
"
授权主体类别
"
);
eiColumn
=
new
EiColumn
(
FIELD_
DEP_COD
E
);
eiColumn
.
setDescName
(
"
部门编码
"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_OBJECT_ID
);
eiColumn
.
setDescName
(
"授权客体ID"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_OBJECT_TYPE
);
eiColumn
.
setDescName
(
"授权客体类别"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_CREATED_BY
);
eiColumn
.
setDescName
(
"创建人"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_CREATED_NAME
);
eiColumn
.
setDescName
(
"创建人名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_CREATED_TIME
);
eiColumn
.
setDescName
(
"创建时间"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_UPDATED_BY
);
eiColumn
.
setDescName
(
"更新人"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_UPDATED_NAME
);
eiColumn
.
setDescName
(
"更新人名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_UPDATED_TIME
);
eiColumn
.
setDescName
(
"更新时间"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_PAGE_ENAME
);
eiColumn
.
setDescName
(
"页面英文名"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_PAGE_CNAME
);
eiColumn
.
setDescName
(
"页面中文名"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_CUSTOM_AUTH
);
eiColumn
.
setDescName
(
"自定义权限"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_DEP_AUTH
);
eiColumn
.
setDescName
(
"部门权限"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
/**
* the constructor.
*/
public
HPPZ010
()
{
initMetaData
();
}
/**
* get the id .
* @return the id
...
...
@@ -125,7 +145,7 @@ public class HPPZ010 extends DaoEPBase {
public
Long
getId
()
{
return
this
.
id
;
}
/**
* set the id .
*
...
...
@@ -135,68 +155,36 @@ public class HPPZ010 extends DaoEPBase {
this
.
id
=
id
;
}
/**
* get the
subjectId - 授权主体ID
.
* @return the
subjectId
* get the
companyCode - 企业编码
.
* @return the
companyCode
*/
public
String
get
SubjectId
()
{
return
this
.
subjectId
;
public
String
get
CompanyCode
()
{
return
this
.
companyCode
;
}
/**
* set the
subjectId - 授权主体ID
.
* set the
companyCode - 企业编码
.
*
* @param
subjectId - 授权主体ID
* @param
companyCode - 企业编码
*/
public
void
set
SubjectId
(
String
subjectId
)
{
this
.
subjectId
=
subjectId
;
public
void
set
CompanyCode
(
String
companyCode
)
{
this
.
companyCode
=
companyCode
;
}
/**
* get the
subjectType - 授权主体类别
.
* @return the
subjectTyp
e
* get the
depCode - 部门编码
.
* @return the
depCod
e
*/
public
String
get
SubjectTyp
e
()
{
return
this
.
subjectTyp
e
;
public
String
get
DepCod
e
()
{
return
this
.
depCod
e
;
}
/**
* set the
subjectType - 授权主体类别
.
* set the
depCode - 部门编码
.
*
* @param
subjectType - 授权主体类别
* @param
depCode - 部门编码
*/
public
void
setSubjectType
(
String
subjectType
)
{
this
.
subjectType
=
subjectType
;
}
/**
* get the objectId - 授权客体ID.
* @return the objectId
*/
public
String
getObjectId
()
{
return
this
.
objectId
;
}
/**
* set the objectId - 授权客体ID.
*
* @param objectId - 授权客体ID
*/
public
void
setObjectId
(
String
objectId
)
{
this
.
objectId
=
objectId
;
}
/**
* get the objectType - 授权客体类别.
* @return the objectType
*/
public
String
getObjectType
()
{
return
this
.
objectType
;
}
/**
* set the objectType - 授权客体类别.
*
* @param objectType - 授权客体类别
*/
public
void
setObjectType
(
String
objectType
)
{
this
.
objectType
=
objectType
;
public
void
setDepCode
(
String
depCode
)
{
this
.
depCode
=
depCode
;
}
/**
* get the createdBy - 创建人.
...
...
@@ -205,7 +193,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getCreatedBy
()
{
return
this
.
createdBy
;
}
/**
* set the createdBy - 创建人.
*
...
...
@@ -221,7 +209,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getCreatedName
()
{
return
this
.
createdName
;
}
/**
* set the createdName - 创建人名称.
*
...
...
@@ -237,7 +225,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getCreatedTime
()
{
return
this
.
createdTime
;
}
/**
* set the createdTime - 创建时间.
*
...
...
@@ -253,7 +241,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getUpdatedBy
()
{
return
this
.
updatedBy
;
}
/**
* set the updatedBy - 更新人.
*
...
...
@@ -269,7 +257,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getUpdatedName
()
{
return
this
.
updatedName
;
}
/**
* set the updatedName - 更新人名称.
*
...
...
@@ -285,7 +273,7 @@ public class HPPZ010 extends DaoEPBase {
public
String
getUpdatedTime
()
{
return
this
.
updatedTime
;
}
/**
* set the updatedTime - 更新时间.
*
...
...
@@ -295,45 +283,113 @@ public class HPPZ010 extends DaoEPBase {
this
.
updatedTime
=
updatedTime
;
}
/**
* get the pageEname - 页面英文名.
* @return the pageEname
*/
public
String
getPageEname
()
{
return
this
.
pageEname
;
}
/**
* set the pageEname - 页面英文名.
*
* @param pageEname - 页面英文名
*/
public
void
setPageEname
(
String
pageEname
)
{
this
.
pageEname
=
pageEname
;
}
/**
* get the pageCname - 页面中文名.
* @return the pageCname
*/
public
String
getPageCname
()
{
return
this
.
pageCname
;
}
/**
* set the pageCname - 页面中文名.
*
* @param pageCname - 页面中文名
*/
public
void
setPageCname
(
String
pageCname
)
{
this
.
pageCname
=
pageCname
;
}
/**
* get the customAuth - 自定义权限.
* @return the customAuth
*/
public
String
getCustomAuth
()
{
return
this
.
customAuth
;
}
/**
* set the customAuth - 自定义权限.
*
* @param customAuth - 自定义权限
*/
public
void
setCustomAuth
(
String
customAuth
)
{
this
.
customAuth
=
customAuth
;
}
/**
* get the depAuth - 部门权限.
* @return the depAuth
*/
public
String
getDepAuth
()
{
return
this
.
depAuth
;
}
/**
* set the depAuth - 部门权限.
*
* @param depAuth - 部门权限
*/
public
void
setDepAuth
(
String
depAuth
)
{
this
.
depAuth
=
depAuth
;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public
void
fromMap
(
Map
map
)
{
setId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_ID
)),
id
));
setSubjectId
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUBJECT_ID
)),
subjectId
));
setSubjectType
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUBJECT_TYPE
)),
subjectType
));
setObjectId
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_OBJECT_ID
)),
objectId
));
setObjectType
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_OBJECT_TYPE
)),
objectType
));
setCompanyCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_COMPANY_CODE
)),
companyCode
));
setDepCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_DEP_CODE
)),
depCode
));
setCreatedBy
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CREATED_BY
)),
createdBy
));
setCreatedName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CREATED_NAME
)),
createdName
));
setCreatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CREATED_TIME
)),
createdTime
));
setUpdatedBy
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_BY
)),
updatedBy
));
setUpdatedName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_NAME
)),
updatedName
));
setUpdatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_TIME
)),
updatedTime
));
setPageEname
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_PAGE_ENAME
)),
pageEname
));
setPageCname
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_PAGE_CNAME
)),
pageCname
));
setCustomAuth
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CUSTOM_AUTH
)),
customAuth
));
setDepAuth
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_DEP_AUTH
)),
depAuth
));
}
/**
* set the value to Map.
*/
@Override
public
Map
toMap
()
{
Map
map
=
new
HashMap
();
map
.
put
(
FIELD_ID
,
StringUtils
.
toString
(
id
,
eiMetadata
.
getMeta
(
FIELD_ID
)));
map
.
put
(
FIELD_SUBJECT_ID
,
StringUtils
.
toString
(
subjectId
,
eiMetadata
.
getMeta
(
FIELD_SUBJECT_ID
)));
map
.
put
(
FIELD_SUBJECT_TYPE
,
StringUtils
.
toString
(
subjectType
,
eiMetadata
.
getMeta
(
FIELD_SUBJECT_TYPE
)));
map
.
put
(
FIELD_OBJECT_ID
,
StringUtils
.
toString
(
objectId
,
eiMetadata
.
getMeta
(
FIELD_OBJECT_ID
)));
map
.
put
(
FIELD_OBJECT_TYPE
,
StringUtils
.
toString
(
objectType
,
eiMetadata
.
getMeta
(
FIELD_OBJECT_TYPE
)));
map
.
put
(
FIELD_COMPANY_CODE
,
StringUtils
.
toString
(
companyCode
,
eiMetadata
.
getMeta
(
FIELD_COMPANY_CODE
)));
map
.
put
(
FIELD_DEP_CODE
,
StringUtils
.
toString
(
depCode
,
eiMetadata
.
getMeta
(
FIELD_DEP_CODE
)));
map
.
put
(
FIELD_CREATED_BY
,
StringUtils
.
toString
(
createdBy
,
eiMetadata
.
getMeta
(
FIELD_CREATED_BY
)));
map
.
put
(
FIELD_CREATED_NAME
,
StringUtils
.
toString
(
createdName
,
eiMetadata
.
getMeta
(
FIELD_CREATED_NAME
)));
map
.
put
(
FIELD_CREATED_TIME
,
StringUtils
.
toString
(
createdTime
,
eiMetadata
.
getMeta
(
FIELD_CREATED_TIME
)));
map
.
put
(
FIELD_UPDATED_BY
,
StringUtils
.
toString
(
updatedBy
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_BY
)));
map
.
put
(
FIELD_UPDATED_NAME
,
StringUtils
.
toString
(
updatedName
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_NAME
)));
map
.
put
(
FIELD_UPDATED_TIME
,
StringUtils
.
toString
(
updatedTime
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_TIME
)));
map
.
put
(
FIELD_PAGE_ENAME
,
StringUtils
.
toString
(
pageEname
,
eiMetadata
.
getMeta
(
FIELD_PAGE_ENAME
)));
map
.
put
(
FIELD_PAGE_CNAME
,
StringUtils
.
toString
(
pageCname
,
eiMetadata
.
getMeta
(
FIELD_PAGE_CNAME
)));
map
.
put
(
FIELD_CUSTOM_AUTH
,
StringUtils
.
toString
(
customAuth
,
eiMetadata
.
getMeta
(
FIELD_CUSTOM_AUTH
)));
map
.
put
(
FIELD_DEP_AUTH
,
StringUtils
.
toString
(
depAuth
,
eiMetadata
.
getMeta
(
FIELD_DEP_AUTH
)));
return
map
;
}
}
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ009.java
View file @
7efc9eba
...
...
@@ -233,10 +233,9 @@ public class ServiceHPPZ009 extends ServiceBase {
HPPZ009
fPz009
=
new
HPPZ009
();
fPz009
.
fromMap
(
resultRows
.
get
(
i
));
// 校验企业下是否存在用户
int
count
=
HPXSTools
.
countByCompany
(
fPz009
.
getCompanyCode
());
int
count
=
HPXSTools
.
XsUser
.
countByCompany
(
fPz009
.
getCompanyCode
());
if
(
count
>
0
)
{
throw
new
PlatException
(
String
.
format
(
"企业[%s]已关联用户,请先解除用户"
,
fPz009
.
getCompanyName
()));
throw
new
PlatException
(
String
.
format
(
"企业[%s]已关联用户,请先解除用户"
,
fPz009
.
getCompanyName
()));
}
DaoUtils
.
update
(
HPPZ009
.
DELETE
,
fPz009
);
}
...
...
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ010.java
View file @
7efc9eba
...
...
@@ -3,13 +3,18 @@ package com.baosight.hpjx.hp.pz.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ010
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.EiInfoUtils
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.MapUtils
;
import
com.baosight.hpjx.util.RsaUtils
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
...
...
@@ -17,6 +22,10 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
com.baosight.xservices.xs.constants.LoginConstants
;
import
com.baosight.xservices.xs.util.LoginUserDetails
;
import
com.baosight.xservices.xs.util.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -36,7 +45,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"
配置管理"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
@OperationLogAnnotation
(
operModul
=
"
数据权限管理"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
new
HPPZ010
().
eiMetadata
);
...
...
@@ -52,8 +61,8 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"配置管理"
,
operType
=
"查询"
,
operDesc
=
"查询数据列表"
)
@Override
@OperationLogAnnotation
(
operModul
=
"数据权限管理"
,
operType
=
"查询"
,
operDesc
=
"查询数据列表"
)
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
inInfo
=
super
.
query
(
inInfo
,
HPSqlConstant
.
HPPZ010
.
QUERY
,
new
HPPZ010
());
...
...
@@ -64,211 +73,112 @@ public class ServiceHPPZ010 extends ServiceBase {
}
/**
*
保存操作.
*
查询树节点
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"配置管理"
,
operType
=
"新增"
,
operDesc
=
"保存操作"
)
public
EiInfo
save
(
EiInfo
inInfo
)
{
public
EiInfo
queryTreeNode
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
// 写入数据
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPPZ009
fPz009
=
new
HPPZ009
();
fPz009
.
fromMap
(
resultRows
.
get
(
i
));
if
(
fPz009
.
getId
()
==
null
||
fPz009
.
getId
()
==
0
)
{
this
.
add
(
fPz009
);
}
else
{
this
.
modify
(
fPz009
);
}
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
node
=
MapUtils
.
getString
(
queryMap
,
"node"
);
String
parentNode
=
StringUtils
.
isEmpty
(
node
)
||
"$"
.
equals
(
node
)
?
"root"
:
node
;
Map
params
=
new
HashMap
();
String
loginName
=
UserSession
.
getUser
().
getUsername
();
params
.
put
(
"node"
,
parentNode
);
params
.
put
(
"loginName"
,
loginName
);
params
.
put
(
"isOnlyAuth"
,
CommonConstant
.
YesNo
.
YES
);
// root:根节点或管理员查所有
if
(
"root"
.
equals
(
parentNode
)
||
LoginUserDetails
.
isUserAdmin
(
loginName
))
{
params
.
put
(
"isOnlyAuth"
,
CommonConstant
.
YesNo
.
NO
);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
List
results
=
dao
.
query
(
"HPPZ010.queryTreeNode"
,
params
);
inInfo
.
addBlock
(
node
).
addRows
(
results
);
}
catch
(
Exception
e
)
{
LogUtils
.
set
DetailMsg
(
inInfo
,
e
,
"保存
失败"
);
LogUtils
.
set
Msg
(
inInfo
,
e
,
"查询
失败"
);
}
return
inInfo
;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private
void
checkSaveData
(
List
<
Map
>
resultRows
)
{
// 数据校验
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPPZ009
hppz009
=
new
HPPZ009
();
hppz009
.
fromMap
(
resultRows
.
get
(
i
));
AssertUtils
.
isEmpty
(
hppz009
.
getCompanyName
(),
"企业名称不能为空"
);
AssertUtils
.
isNull
(
hppz009
.
getValidFlag
(),
"是否启用不能为空"
);
}
}
/**
* 新增企业信息
*
* @param fPz009
* @throws Exception
*/
private
void
add
(
HPPZ009
fPz009
)
throws
Exception
{
// 生成企业编码
fPz009
.
setCompanyCode
(
SequenceGenerator
.
getNextSequence
(
"COMPANY_CODE"
));
fPz009
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
insert
(
"HPPZ009.insert"
,
fPz009
);
// 默认新增企业管理员账号
this
.
initUser
(
fPz009
);
// 关联企业管理员角色
this
.
insertGroupMember
(
fPz009
);
}
/**
* 修改数据
*
* @param fPz009
*/
private
void
modify
(
HPPZ009
fPz009
)
{
DaoUtils
.
update
(
"HPPZ009.update"
,
fPz009
);
}
/**
* 新增操作.
* 查询页面的权限
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"配置管理"
,
operType
=
"新增"
,
operDesc
=
"新增操作"
)
@Override
public
EiInfo
insert
(
EiInfo
inInfo
)
{
@OperationLogAnnotation
(
operModul
=
"数据权限管理"
,
operType
=
"查询"
,
operDesc
=
"查询页面的权限"
)
public
EiInfo
getByPage
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
// 数据写入
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPPZ009
fPz009
=
new
HPPZ009
();
fPz009
.
fromMap
(
resultRows
.
get
(
i
));
this
.
add
(
fPz009
);
EiBlock
resultBlock
=
inInfo
.
addBlock
(
EiConstant
.
resultBlock
);
resultBlock
.
addBlockMeta
(
new
HPPZ010
().
eiMetadata
);
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
List
<
HPPZ010
>
dbPz010s
=
dao
.
query
(
HPPZ010
.
QUERY
,
queryMap
);
if
(
CollectionUtils
.
isEmpty
(
dbPz010s
))
{
return
inInfo
;
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据新增成功!"
);
resultBlock
.
addRows
(
dbPz010s
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"
新增
失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"
查询
失败"
);
}
return
inInfo
;
}
/**
* 初始化用户
*
* @param hppz009
*/
private
void
initUser
(
HPPZ009
hppz009
)
throws
Exception
{
String
companyCode
=
hppz009
.
getCompanyCode
();
Map
inInfoRowMap
=
new
HashMap
();
inInfoRowMap
.
put
(
"userId"
,
companyCode
);
inInfoRowMap
.
put
(
"loginName"
,
companyCode
);
inInfoRowMap
.
put
(
"userName"
,
hppz009
.
getCompanyName
());
// 使用公钥加密密码
String
password
=
RsaUtils
.
encryptByPublicKey
(
LoginConstants
.
rsaPublicKey
,
companyCode
);
inInfoRowMap
.
put
(
"password"
,
password
);
inInfoRowMap
.
put
(
"rePass"
,
password
);
inInfoRowMap
.
put
(
"email"
,
" "
);
inInfoRowMap
.
put
(
"mobile"
,
" "
);
inInfoRowMap
.
put
(
"companyCode"
,
hppz009
.
getCompanyCode
());
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
addBlock
(
"details"
).
addRow
(
inInfoRowMap
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"XS0102"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"insert"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
outInfo
.
getMsg
());
}
}
/**
* 用户关联角色
*
* @param hppz009
*/
private
void
insertGroupMember
(
HPPZ009
hppz009
)
{
String
companyCode
=
hppz009
.
getCompanyCode
();
Map
inInfoRowMap
=
new
HashMap
();
inInfoRowMap
.
put
(
"memberId"
,
companyCode
);
inInfoRowMap
.
put
(
"memberName"
,
hppz009
.
getCompanyName
());
// TODO 该用户组固定不能修改,代码中其他地方有写死的地方
inInfoRowMap
.
put
(
"parentId"
,
"companyManage"
);
inInfoRowMap
.
put
(
"parentName"
,
"企业管理员"
);
inInfoRowMap
.
put
(
"memberType"
,
"USER"
);
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addRow
(
inInfoRowMap
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"XS03"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"insert"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
outInfo
.
getMsg
());
}
}
/**
* 修改操作
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"
配置管理"
,
operType
=
"修改"
,
operDesc
=
"修改
操作"
)
public
EiInfo
updat
e
(
EiInfo
inInfo
)
{
@OperationLogAnnotation
(
operModul
=
"
数据权限管理"
,
operType
=
"新增"
,
operDesc
=
"保存
操作"
)
public
EiInfo
sav
e
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPPZ009
hppz009
=
new
HPPZ009
();
hppz009
.
fromMap
(
resultRows
.
get
(
i
));
DaoUtils
.
update
(
"HPPZ009.update"
,
hppz009
);
}
inInfo
=
this
.
query
(
inInfo
);
// 写入数据
this
.
saveData
(
resultRows
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"
操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据修改
成功!"
);
inInfo
.
setMsg
(
"
保存
成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
set
DetailMsg
(
inInfo
,
e
,
"修改
失败"
);
LogUtils
.
set
Msg
(
inInfo
,
e
,
"保存
失败"
);
}
return
inInfo
;
}
/**
* 删除操作
* 校验保存的数据
*
* @param resultRows
*/
private
void
checkSaveData
(
List
<
Map
>
resultRows
)
{
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getCompanyCode
(),
"当前用户未绑定公司,无法操作数据,请联系管理员!"
);
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getDepCode
(),
"当前用户未绑定部门,无法操作数据,请联系管理员!"
);
for
(
Map
resultRow
:
resultRows
)
{
HPPZ010
fPz010
=
new
HPPZ010
();
fPz010
.
fromMap
(
resultRow
);
AssertUtils
.
isEmpty
(
fPz010
.
getPageEname
(),
"请选择菜单"
);
}
}
/**
* 保存数据
*
* @param inInfo
* @return
* @param resultRows
*/
@OperationLogAnnotation
(
operModul
=
"配置管理"
,
operType
=
"删除"
,
operDesc
=
"删除操作"
)
public
EiInfo
delete
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPPZ009
fPz009
=
new
HPPZ009
();
fPz009
.
fromMap
(
resultRows
.
get
(
i
));
// 校验企业下是否存在用户
int
count
=
HPXSTools
.
countByCompany
(
fPz009
.
getCompanyCode
());
if
(
count
>
0
)
{
throw
new
PlatException
(
String
.
format
(
"企业[%s]已关联用户,请先解除用户"
,
fPz009
.
getCompanyName
()));
}
DaoUtils
.
update
(
"HPPZ009.delete"
,
fPz009
);
private
void
saveData
(
List
<
Map
>
resultRows
)
{
for
(
Map
resultRow
:
resultRows
)
{
HPPZ010
fPz010
=
new
HPPZ010
();
fPz010
.
fromMap
(
resultRow
);
// 当前企业是否已经设置过权限
HPPZ010
dbPz010
=
HPPZTools
.
HpPz010
.
getByPage
(
fPz010
.
getPageEname
());
if
(
dbPz010
==
null
)
{
DaoUtils
.
insert
(
HPPZ010
.
INSERT
,
fPz010
);
}
else
{
dbPz010
.
setCustomAuth
(
fPz010
.
getCustomAuth
());
dbPz010
.
setDepAuth
(
fPz010
.
getDepAuth
());
DaoUtils
.
update
(
HPPZ010
.
UPDATE
,
dbPz010
);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据删除成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"修改失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ014.java
View file @
7efc9eba
...
...
@@ -4,15 +4,10 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.enums.UserStatusEnum
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ013
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ01301
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ014
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ01401
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.CommonMethod
;
...
...
@@ -23,7 +18,6 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ009.xml
View file @
7efc9eba
...
...
@@ -20,6 +20,9 @@
<sql
id=
"condition"
>
AND DELETE_FLAG = 0
<isNotEmpty
prepend=
" "
property=
"dataAuthCondition"
>
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
...
...
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ010.xml
View file @
7efc9eba
...
...
@@ -4,43 +4,52 @@
<sql
id=
"column"
>
ID as "id",
SUBJECT_ID as "subjectId",
<!-- 授权主体ID -->
SUBJECT_TYPE as "subjectType",
<!-- 授权主体类别 -->
OBJECT_ID as "objectId",
<!-- 授权客体ID -->
OBJECT_TYPE as "objectType",
<!-- 授权客体类别 -->
COMPANY_CODE as "companyCode",
<!-- 企业编码 -->
DEP_CODE as "depCode",
<!-- 部门编码 -->
CREATED_BY as "createdBy",
<!-- 创建人 -->
CREATED_NAME as "createdName",
<!-- 创建人名称 -->
CREATED_TIME as "createdTime",
<!-- 创建时间 -->
UPDATED_BY as "updatedBy",
<!-- 更新人 -->
UPDATED_NAME as "updatedName",
<!-- 更新人名称 -->
UPDATED_TIME as "updatedTime"
<!-- 更新时间 -->
UPDATED_TIME as "updatedTime",
<!-- 更新时间 -->
PAGE_ENAME as "pageEname",
<!-- 页面英文名 -->
PAGE_CNAME as "pageCname",
<!-- 页面中文名 -->
CUSTOM_AUTH as "customAuth",
<!-- 自定义权限 -->
DEP_AUTH as "depAuth"
<!-- 部门权限 -->
</sql>
<sql
id=
"condition"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"subjectId
"
>
SUBJECT_ID = #subjectId
#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"subjectTyp
e"
>
SUBJECT_TYPE = #subjectTyp
e#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"objectId
"
>
OBJECT_ID = #objectId
#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"objectTyp
e"
>
OBJECT_TYPE = #objectTyp
e#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode
"
>
COMPANY_CODE = #companyCode
#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depCod
e"
>
DEP_CODE = #depCod
e#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"pageEname
"
>
PAGE_ENAME = #pageEname
#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"pageCnam
e"
>
PAGE_CNAME = #pageCnam
e#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql
id=
"updateRevise"
>
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql
id=
"orderBy"
>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
ID
asc
ID
ASC
</isEmpty>
</dynamic>
</sql>
...
...
@@ -58,20 +67,57 @@
<include
refid=
"condition"
/>
</select>
<!-- 查询树节点 -->
<select
id=
"queryTreeNode"
resultClass=
"java.util.HashMap"
>
SELECT
TREE_ENAME AS "parent",
NODE_ENAME AS "label",
NODE_CNAME AS "text",
(CASE WHEN NODE_TYPE='2' THEN 0 ELSE 1 END) AS "leaf",
NODE_SORT_ID AS "sortIndex"
FROM ${platSchema}.TEDPI10
WHERE 1=1
AND NODE_ENAME NOT IN ('EP')
<!-- 排除系统页面 -->
<isNotEmpty
prepend=
" AND "
property=
"node"
>
TREE_ENAME = #node#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"nodeEnames"
>
NODE_ENAME IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"nodeEnames"
>
#nodeEnames[]#
</iterate>
</isNotEmpty>
<!-- nodeType=2:目录。非目录或者非管理员非root节点仅显示有权限的菜单 -->
<isEqual
prepend=
" AND "
property=
"isOnlyAuth"
compareValue=
"Y"
>
(NODE_TYPE = '2' OR NODE_ENAME IN (
SELECT D.RESOURCE_ENAME
FROM ${platSchema}.XS_USER A,
${platSchema}.XS_USER_GROUP_MEMBER B,
${platSchema}.XS_AUTHORIZATION C,
${platSchema}.XS_RESOURCE D
WHERE A.USER_ID = B.MEMBER_ID
AND B.PARENT_ID = C.SUBJECT_ID
AND C.OBJECT_ID = D.ID
AND A.LOGIN_NAME = #loginName#
AND D.TYPE = 'PAGE'
))
</isEqual>
ORDER BY NODE_SORT_ID ASC
</select>
<insert
id=
"insert"
>
INSERT INTO ${hpjxSchema}.T_HPPZ010 (
SUBJECT_ID,
<!-- 授权主体ID -->
SUBJECT_TYPE,
<!-- 授权主体类别 -->
OBJECT_ID,
<!-- 授权客体ID -->
OBJECT_TYPE,
<!-- 授权客体类别 -->
CREATED_BY,
<!-- 创建人 -->
CREATED_NAME,
<!-- 创建人名称 -->
CREATED_TIME
<!-- 创建时间 -->
COMPANY_CODE,
<!-- 企业编码 -->
DEP_CODE,
<!-- 部门编码 -->
CREATED_BY,
<!-- 创建人 -->
CREATED_NAME,
<!-- 创建人名称 -->
CREATED_TIME,
<!-- 创建时间 -->
PAGE_ENAME,
<!-- 页面英文名 -->
PAGE_CNAME,
<!-- 页面中文名 -->
CUSTOM_AUTH,
<!-- 自定义权限 -->
DEP_AUTH
<!-- 部门权限 -->
) VALUES (
#subjectId#, #subjectType#, #objectId#, #objectType#, #createdBy
#,
#createdName#, #createdTime
#
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime
#,
#pageEname#, #pageCname#, #customAuth#, #depAuth
#
)
</insert>
</insert>
<delete
id=
"delete"
>
DELETE FROM ${hpjxSchema}.T_HPPZ010 WHERE ID = #id#
...
...
@@ -79,14 +125,9 @@
<update
id=
"update"
>
UPDATE ${hpjxSchema}.T_HPPZ010
SET
SUBJECT_ID = #subjectId#,
<!-- 授权主体ID -->
SUBJECT_TYPE = #subjectType#,
<!-- 授权主体类别 -->
OBJECT_ID = #objectId#,
<!-- 授权客体ID -->
OBJECT_TYPE = #objectType#,
<!-- 授权客体类别 -->
UPDATED_BY = #updatedBy#,
<!-- 更新人 -->
UPDATED_NAME = #updatedName#,
<!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#
<!-- 更新时间 -->
SET CUSTOM_AUTH = #customAuth#,
<!-- 权限类型 -->
DEP_AUTH = #depAuth#,
<!-- 部门权限 -->
<include
refid=
"updateRevise"
/>
WHERE ID = #id#
</update>
...
...
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
View file @
7efc9eba
...
...
@@ -4,12 +4,14 @@ import com.baosight.hpjx.common.InventTypeEnum;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ010
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ013
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ015
;
...
...
@@ -544,6 +546,35 @@ public class HPPZTools {
}
/**
* 数据权限管理
*
* @author:songx
* @date:2024/3/20,14:20
*/
public
static
class
HpPz010
{
/**
* 查询菜单权限
*
* @param pageEname
* @return
*/
public
static
HPPZ010
getByPage
(
String
pageEname
)
{
AssertUtils
.
isNull
(
pageEname
,
"菜单ID不能为空"
);
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StringUtils
.
isBlank
(
companyCode
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
HPPZ010
.
FIELD_COMPANY_CODE
,
UserSessionUtils
.
getCompanyCode
());
queryMap
.
put
(
HPPZ010
.
FIELD_PAGE_ENAME
,
pageEname
);
List
<
HPPZ010
>
results
=
DaoBase
.
getInstance
().
query
(
HPPZ010
.
QUERY
,
queryMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
* @author:songx
* @date:2024/3/14,20:59
*/
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003A.java
View file @
7efc9eba
...
...
@@ -2,33 +2,12 @@ package com.baosight.hpjx.hp.sc.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.HPConstants
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.sc.domain.HPSC006
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.StringUtil
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.util.NumberUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
*
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC003B.java
View file @
7efc9eba
...
...
@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.sc.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.ProdOrderStatusEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
...
...
@@ -20,7 +19,6 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC005A.java
View file @
7efc9eba
...
...
@@ -6,8 +6,6 @@ import com.baosight.hpjx.common.ProdOrderStatusEnum;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005A
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC006.java
View file @
7efc9eba
package
com
.
baosight
.
hpjx
.
hp
.
sc
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.HPConstants
;
import
com.baosight.hpjx.common.ProdOrderStatusEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.ds.domain.HPDS002
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sc.domain.*
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
import
com.baosight.hpjx.hp.xs.domain.Org
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.util.*
;
import
com.baosight.iplat4j.core.ProjectInfo
;
...
...
@@ -25,13 +20,11 @@ import com.baosight.iplat4j.core.exception.PlatException;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.util.NumberUtils
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC007.java
View file @
7efc9eba
...
...
@@ -2,25 +2,18 @@ package com.baosight.hpjx.hp.sc.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sc.domain.HPSC004
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.hp.sc.domain.HPSC006
;
import
com.baosight.hpjx.hp.sc.domain.HPSC007
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
import
com.baosight.hpjx.hp.xs.domain.User
;
import
com.baosight.hpjx.util.*
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC098.java
View file @
7efc9eba
...
...
@@ -2,10 +2,8 @@ package com.baosight.hpjx.hp.sc.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.hp.sc.domain.HPSC001
;
import
com.baosight.hpjx.hp.sc.domain.HPSC098
;
import
com.baosight.hpjx.hp.xs.domain.Org
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
...
...
src/main/java/com/baosight/hpjx/hp/xs/domain/Org.java
View file @
7efc9eba
...
...
@@ -33,6 +33,21 @@ public class Org implements Serializable {
*/
private
String
parentOrgId
;
/**
* 厂区编码
*/
private
String
factoryCode
;
/**
* 厂区名称
*/
private
String
factoryName
;
/**
* 层级
*/
private
String
level
;
public
String
getOrgId
()
{
return
orgId
;
}
...
...
@@ -73,4 +88,27 @@ public class Org implements Serializable {
this
.
parentOrgId
=
parentOrgId
;
}
public
String
getFactoryCode
()
{
return
factoryCode
;
}
public
void
setFactoryCode
(
String
factoryCode
)
{
this
.
factoryCode
=
factoryCode
;
}
public
String
getFactoryName
()
{
return
factoryName
;
}
public
void
setFactoryName
(
String
factoryName
)
{
this
.
factoryName
=
factoryName
;
}
public
String
getLevel
()
{
return
level
;
}
public
void
setLevel
(
String
level
)
{
this
.
level
=
level
;
}
}
src/main/java/com/baosight/hpjx/hp/xs/service/ServiceHPXSUser.java
View file @
7efc9eba
package
com
.
baosight
.
hpjx
.
hp
.
xs
.
service
;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.xs.domain.User
;
...
...
@@ -18,6 +17,8 @@ import java.util.List;
import
java.util.Map
;
/**
* 当前类已屏蔽SQL自动补全企业参数,如需查询需要需自行添加企业编码参数
*
* @author:songx
* @date:2024/1/15,15:08
*/
...
...
@@ -90,6 +91,7 @@ public class ServiceHPXSUser extends ServiceBase {
}
List
<
DdynamicEnum
>
list
=
new
ArrayList
<>();
list
.
add
(
DdynamicEnum
.
COMPANY_RECORD_BLOCK_ID
);
queryMap
.
put
(
"companyCode"
,
UserSessionUtils
.
getCompanyCode
());
CommonMethod
.
initBlock
(
inInfo
,
list
,
queryMap
,
false
);
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"查询企业失败"
);
...
...
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXS002.xml
View file @
7efc9eba
...
...
@@ -4,20 +4,20 @@
Version : 1.0
schema : hpjx
tableName : TEUDM_TEMP
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
COMPANY_CODE VARCHAR NOT NULL primarykey,
DOC_ID VARCHAR NOT NULL primarykey,
DIR_ID VARCHAR NOT NULL,
DOC_NAME VARCHAR NOT NULL,
CHG_NAME VARCHAR NOT NULL,
DOC_SIZE DECIMAL NOT NULL,
DOC_TAG VARCHAR NOT NULL,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ARCHIVE_FLAG VARCHAR NOT NULL,
REAL_PATH VARCHAR
-->
<sqlMap
namespace=
"HPXS002"
>
...
...
src/main/java/com/baosight/hpjx/hp/xs/sql/HPXSOrg.xml
View file @
7efc9eba
...
...
@@ -63,6 +63,33 @@
<include
refid=
"customCondition"
/>
</select>
<!-- 查询企业所有的组织机构 -->
<select
id=
"queryAll"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.hpjx.hp.xs.domain.Org"
>
SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId",
(CASE WHEN T3.ORG_TYPE = 'factory' THEN T3.ORG_CNAME ELSE CONCAT('[',T5.FACTORY_NAME,']',T3.ORG_CNAME) END) AS "orgCname",
T3.ORG_TYPE AS "orgType", T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName"
FROM (
SELECT
@CODES AS CODES,
(SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01,
(SELECT @CODES:='root', @LEVEL:= 0) T4
WHERE @CODES IS NOT NULL
) T2,
${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
ORDER BY T3.FACTORY_CODE ASC, T2.LEVEL ASC, T3.ORG_ID ASC
</select>
<!-- 查询父级信息(递归) -->
<select
id=
"queryParent"
resultClass=
"com.baosight.hpjx.hp.xs.domain.Org"
>
SELECT
...
...
src/main/java/com/baosight/hpjx/hp/xs/tools/HPXSTools.java
View file @
7efc9eba
...
...
@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.xs.tools;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.enums.OrgTypeEnum
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.xs.domain.Org
;
import
com.baosight.hpjx.hp.xs.domain.User
;
import
com.baosight.hpjx.util.AssertUtils
;
...
...
@@ -29,31 +30,6 @@ import java.util.stream.Collectors;
public
class
HPXSTools
{
/**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public
static
int
countByCompany
(
String
companyCode
)
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"companyCode"
,
companyCode
);
List
<
Integer
>
results
=
DaoBase
.
getInstance
().
query
(
"HPXSUser.count"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
0
:
results
.
get
(
0
);
}
/**
* 查询用户组织机构
*
* @return
*/
public
static
String
getOrgId
()
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"userId"
,
UserSession
.
getLoginName
());
List
<
Map
>
results
=
DaoBase
.
getInstance
().
query
(
"HPXSUser.queryOrgId"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
""
:
results
.
get
(
0
).
get
(
"orgId"
).
toString
();
}
/**
* @author:songx
* @date:2024/2/4,10:35
*/
...
...
@@ -102,6 +78,19 @@ public class HPXSTools {
}
/**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public
static
int
countByCompany
(
String
companyCode
)
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"companyCode"
,
companyCode
);
List
<
Integer
>
results
=
DaoBase
.
getInstance
().
query
(
"HPXSUser.count"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
0
:
results
.
get
(
0
);
}
/**
* 初始化新增用户
*
* @param companyCode
...
...
@@ -179,6 +168,18 @@ public class HPXSTools {
}
/**
* 查询用户组织机构
*
* @return
*/
public
static
String
getOrgId
()
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"userId"
,
UserSession
.
getLoginName
());
List
<
Map
>
results
=
DaoBase
.
getInstance
().
query
(
"HPXSUser.queryOrgId"
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
""
:
results
.
get
(
0
).
get
(
"orgId"
).
toString
();
}
/**
* 查询
*
* @param orgId
...
...
@@ -208,7 +209,27 @@ public class HPXSTools {
AssertUtils
.
isNull
(
results
,
String
.
format
(
"组织[%s]不存在厂区信息"
,
orgId
));
return
results
.
get
(
0
);
}
/**
* 查询企业下所有组织按厂区分组
*
* @return
*/
public
static
Map
<
String
,
List
<
Org
>>
queryAllFactoryMap
()
{
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
if
(
StringUtils
.
isBlank
(
companyCode
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"companyCode"
,
companyCode
);
List
<
Org
>
results
=
DaoBase
.
getInstance
().
query
(
"HPXSOrg.queryAll"
,
queryMap
);
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
return
results
.
stream
().
filter
(
org
->
StringUtils
.
isNotNull
(
org
.
getFactoryCode
()))
.
collect
(
Collectors
.
groupingBy
(
Org:
:
getFactoryCode
));
}
/**
* 查询
*
...
...
src/main/java/com/baosight/hpjx/hp/zl/service/ServiceHPZL001.java
View file @
7efc9eba
...
...
@@ -6,8 +6,6 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.sc.tools.HPSCTools
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
import
com.baosight.hpjx.hp.zl.domain.HPZL001
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.CommonMethod
;
...
...
@@ -17,7 +15,6 @@ import com.baosight.hpjx.util.StringUtil;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.MapUtils
;
...
...
src/main/java/com/baosight/hpjx/util/LogUtils.java
View file @
7efc9eba
...
...
@@ -26,26 +26,7 @@ public class LogUtils {
* @return
*/
public
static
void
setDetailMsg
(
EiInfo
inInfo
,
Throwable
e
,
String
title
)
{
title
=
StringUtils
.
isEmpty
(
title
)
?
"服务异常"
:
title
;
// 打印日志
print
(
e
,
title
);
// 设置EiInfo错误消息
if
(
inInfo
==
null
)
{
return
;
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
title
);
if
(
e
==
null
)
{
inInfo
.
setDetailMsg
(
""
);
return
;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo
.
setDetailMsg
(
e
.
getMessage
());
if
(
e
instanceof
PlatException
)
{
inInfo
.
setMsg
(
inInfo
.
getMsg
().
concat
(
",原因:"
).
concat
(
e
.
getMessage
()));
}
else
{
inInfo
.
setMsg
(
inInfo
.
getMsg
().
concat
(
",原因参见详细错误描述!"
));
}
setMsg
(
inInfo
,
e
,
title
);
}
/**
...
...
@@ -70,7 +51,11 @@ public class LogUtils {
inInfo
.
setMsg
(
msg
.
concat
(
"未知"
));
return
;
}
inInfo
.
setMsg
(
msg
.
concat
(
e
.
getMessage
()));
if
(
e
instanceof
PlatException
)
{
inInfo
.
setMsg
(
msg
.
concat
(
e
.
getMessage
()));
}
else
{
inInfo
.
setMsg
(
msg
.
concat
(
"内部错误,请稍后再试"
));
}
}
/**
...
...
src/main/java/com/baosight/iplat4j/core/data/ibatis/dao/SqlMapDaoLogProxy.java
View file @
7efc9eba
package
com
.
baosight
.
iplat4j
.
core
.
data
.
ibatis
.
dao
;
import
com.baosight.hpjx.common.AuthTypeEnum
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ010
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.util.MapUtils
;
import
com.baosight.hpjx.util.ObjectUtils
;
import
com.baosight.hpjx.util.StringUtils
;
import
com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus
;
import
com.baosight.iplat4j.core.util.ExceptionUtil
;
...
...
@@ -24,7 +29,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public
List
query
(
String
name
,
Object
parameters
)
{
try
{
// 初始化参数
this
.
initParam
(
name
,
parameters
);
this
.
setCompanyCode
(
name
,
parameters
);
List
ret
=
super
.
query
(
name
,
parameters
);
return
ret
;
}
catch
(
RuntimeException
var4
)
{
...
...
@@ -35,7 +40,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public
List
queryAll
(
String
name
,
Object
parameters
)
{
try
{
// 初始化参数
this
.
initParam
(
name
,
parameters
);
this
.
setCompanyCode
(
name
,
parameters
);
List
ret
=
super
.
queryAll
(
name
,
parameters
);
return
ret
;
}
catch
(
RuntimeException
var4
)
{
...
...
@@ -46,7 +51,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
public
List
query
(
String
name
,
Object
parameters
,
int
offset
,
int
limit
)
{
try
{
// 初始化参数
this
.
initParam
(
name
,
parameters
);
this
.
setCompanyCode
(
name
,
parameters
);
List
ret
=
super
.
query
(
name
,
parameters
,
offset
,
limit
);
return
ret
;
}
catch
(
RuntimeException
var6
)
{
...
...
@@ -72,7 +77,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
try
{
// 初始化参数
this
.
initParam
(
name
,
parameters
);
this
.
setCompanyCode
(
name
,
parameters
);
int
ret
=
super
.
count
(
name
,
parameters
);
return
ret
;
}
catch
(
RuntimeException
var5
)
{
...
...
@@ -149,12 +154,12 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
}
/**
*
初始化参数
*
设置企业编码
*
* @param name
* @param parameters
*/
private
void
initParam
(
String
name
,
Object
parameters
)
{
private
void
setCompanyCode
(
String
name
,
Object
parameters
)
{
// 查询登录用户信息时不设置企业编码,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码
if
(
name
.
startsWith
(
"HPXSUser"
)
||
!
name
.
startsWith
(
"HP"
)
||
!(
parameters
instanceof
Map
))
{
...
...
@@ -168,4 +173,69 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
/**
* 设置数据权限
*
* @param name
* @param parameters
*/
private
void
setDataAuth
(
String
name
,
Object
parameters
)
{
// 仅限业务模块的查询需要设置企业编码
if
(
name
.
startsWith
(
"HPXSUser"
)
||
!
name
.
startsWith
(
"HP"
)
||
!(
parameters
instanceof
Map
))
{
return
;
}
if
(
parameters
==
null
)
{
parameters
=
new
HashMap
();
}
// 页面英文名
String
pageEname
=
MapUtils
.
getString
((
Map
)
parameters
,
"pageEname"
);
if
(
StringUtils
.
isBlank
(
pageEname
))
{
return
;
}
// 组装权限条件
HPPZ010
dbPz010
=
HPPZTools
.
HpPz010
.
getByPage
(
pageEname
);
if
(
dbPz010
==
null
||
StringUtils
.
isBlank
(
dbPz010
.
getCustomAuth
())
||
StringUtils
.
isBlank
(
dbPz010
.
getDepAuth
()))
{
((
Map
)
parameters
).
put
(
"dataAuthCondition"
,
" AND DEP_CODE = 'NOT AUTH'"
);
return
;
}
buildCustomCondition
(
dbPz010
);
buildDepCondition
(
dbPz010
);
}
/**
* 组装 Custom Data Auth Condition
*
* @param dbPz010
*/
private
void
buildCustomCondition
(
HPPZ010
dbPz010
)
{
if
(
StringUtils
.
isBlank
(
dbPz010
.
getCustomAuth
()))
{
return
;
}
String
[]
customAuths
=
dbPz010
.
getCustomAuth
().
split
(
","
);
for
(
String
item
:
customAuths
)
{
AuthTypeEnum
authTypeEnum
=
AuthTypeEnum
.
getByCode
(
item
);
if
(
authTypeEnum
==
null
)
{
continue
;
}
}
}
/**
* 组装 Dep Data Auth Condition
*
* @param dbPz010
*/
private
void
buildDepCondition
(
HPPZ010
dbPz010
)
{
if
(
StringUtils
.
isBlank
(
dbPz010
.
getDepAuth
()))
{
return
;
}
String
[]
depAuths
=
dbPz010
.
getDepAuth
().
split
(
","
);
for
(
String
item
:
depAuths
)
{
}
}
}
src/main/java/com/baosight/xservices/xs/og/service/ServiceXSOG0801A.java
View file @
7efc9eba
...
...
@@ -26,7 +26,6 @@ import com.baosight.xservices.xs.util.LoginUserDetails;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
src/main/java/com/baosight/xservices/xs/og/service/ServiceXSOG0801B.java
View file @
7efc9eba
package
com
.
baosight
.
xservices
.
xs
.
og
.
service
;
import
com.baosight.hpjx.core.constant.CodesetConstant
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.enums.OrgTypeEnum
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.core.tools.CodeValueTools
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC010
;
import
com.baosight.hpjx.hp.xs.domain.Org
;
import
com.baosight.hpjx.hp.xs.tools.HPXSTools
;
...
...
@@ -13,19 +11,13 @@ import com.baosight.hpjx.util.DateUtils;
import
com.baosight.hpjx.util.EiInfoUtils
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.MapUtils
;
import
com.baosight.hpjx.util.StringUtils
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.core.service.soa.XServiceManager
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
com.baosight.xservices.xs.og.domain.XSOG01
;
import
com.baosight.xservices.xs.util.LoginUserDetails
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
src/main/java/com/baosight/xservices/xs/service/ServiceXS0705.java
View file @
7efc9eba
package
com
.
baosight
.
xservices
.
xs
.
service
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.iplat4j.core.FrameworkInfo
;
import
com.baosight.iplat4j.core.ei.EiBlockMeta
;
import
com.baosight.iplat4j.core.ei.EiColumn
;
...
...
@@ -41,10 +40,10 @@ public class ServiceXS0705 extends MenuTreeService {
public
List
getChildNodes
(
String
parentLabel
)
{
String
manageSwitch
=
StringUtils
.
defaultIfEmpty
(
PlatApplicationContext
.
getProperty
(
"xservices.security.manage.switch"
),
"off"
);
Map
params
=
new
HashMap
();
if
(
StringUtils
.
isEmpty
(
parentLabel
)
||
"$"
.
equals
(
parentLabel
))
{
parentLabel
=
"root"
;
}
Map
params
=
new
HashMap
();
String
loginName
=
UserSession
.
getUser
().
getUsername
();
params
.
put
(
"node"
,
parentLabel
);
params
.
put
(
"loginName"
,
loginName
);
...
...
@@ -61,46 +60,41 @@ public class ServiceXS0705 extends MenuTreeService {
List
ret
=
this
.
dao
.
query
(
stmt
,
params
);
if
(
"off"
.
equals
(
manageSwitch
))
{
return
ret
;
}
else
{
List
ret2
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
ret
.
size
();
++
i
)
{
Map
node
=
(
Map
)
ret
.
get
(
i
);
String
text
=
node
.
get
(
"text"
).
toString
();
if
(
text
.
indexOf
(
"[页面]"
)
>
0
)
{
ret2
.
add
(
0
,
ret
.
get
(
i
));
}
else
{
ret2
.
add
(
ret
.
get
(
i
));
}
}
List
ret2
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
ret
.
size
();
++
i
)
{
Map
node
=
(
Map
)
ret
.
get
(
i
);
String
text
=
node
.
get
(
"text"
).
toString
();
if
(
text
.
indexOf
(
"[页面]"
)
>
0
)
{
ret2
.
add
(
0
,
ret
.
get
(
i
));
}
else
{
ret2
.
add
(
ret
.
get
(
i
));
}
List
authorized
=
new
ArrayList
();
if
(!
LoginUserDetails
.
isUserAdmin
(
loginName
))
{
if
(
AuthenticationInfo
.
userManageAuthentication
.
get
(
loginName
)
==
null
)
{
AuthenticationInfo
.
getUserManageAuthentication
(
loginName
);
}
List
authManageList
=
(
List
)
AuthenticationInfo
.
userManageAuthentication
.
get
(
loginName
);
for
(
int
i
=
0
;
i
<
ret2
.
size
();
++
i
)
{
Map
node
=
(
Map
)
ret
.
get
(
i
);
BigDecimal
nodeLeaf
=
new
BigDecimal
(
"1"
);
BigDecimal
leaf
=
(
BigDecimal
)
node
.
get
(
"leaf"
);
if
(
nodeLeaf
.
equals
(
leaf
))
{
String
label
=
(
String
)
node
.
get
(
"label"
);
if
(
this
.
isManageResource
(
label
,
authManageList
))
{
authorized
.
add
(
node
);
}
}
else
{
authorized
.
add
(
node
);
}
}
List
authorized
=
new
ArrayList
();
if
(
LoginUserDetails
.
isUserAdmin
(
loginName
))
{
authorized
=
ret2
;
return
authorized
;
}
if
(
AuthenticationInfo
.
userManageAuthentication
.
get
(
loginName
)
==
null
)
{
AuthenticationInfo
.
getUserManageAuthentication
(
loginName
);
}
List
authManageList
=
(
List
)
AuthenticationInfo
.
userManageAuthentication
.
get
(
loginName
);
for
(
int
i
=
0
;
i
<
ret2
.
size
();
++
i
)
{
Map
node
=
(
Map
)
ret
.
get
(
i
);
BigDecimal
nodeLeaf
=
new
BigDecimal
(
"1"
);
BigDecimal
leaf
=
(
BigDecimal
)
node
.
get
(
"leaf"
);
if
(
nodeLeaf
.
equals
(
leaf
))
{
String
label
=
(
String
)
node
.
get
(
"label"
);
if
(
this
.
isManageResource
(
label
,
authManageList
))
{
authorized
.
add
(
node
);
}
}
else
{
authorized
=
ret2
;
authorized
.
add
(
node
)
;
}
return
authorized
;
}
return
authorized
;
}
private
boolean
isManageResource
(
String
label
,
List
authManageList
)
{
...
...
src/main/java/com/baosight/xservices/xs/sql/XS0702.xml
View file @
7efc9eba
...
...
@@ -67,7 +67,7 @@
<isNotEmpty
prepend=
" AND "
property=
"node"
>
t1.node_ename like concat(#node#, '%')
</isNotEmpty>
order by
"sortIndex"
order by
sortIndex asc
</select>
<select
id=
"query2"
resultClass=
"java.util.HashMap"
>
...
...
src/main/webapp/HP/PZ/HPPZ010.js
View file @
7efc9eba
$
(
function
()
{
IPLATUI
.
EFGrid
.
result
=
{
pageable
:
{
pageSize
:
20
,
pageSizes
:
[
10
,
20
,
50
,
70
,
100
],
},
}
// 查询
$
(
"#QUERY"
).
on
(
"click"
,
query
);
IPLATUI
.
EFTree
=
{
"pageTree"
:
{
// ROOT: {label: "root", text: "系统菜单", leaf: true}
select
:
function
(
e
)
{
treeNodeSelect
(
this
.
dataItem
(
e
.
node
));
},
selectTreeNode
:
{}
}
};
// 保存
$
(
"#BTN_SAVE"
).
on
(
"click"
,
save
);
// 删除
$
(
"#BTN_DELETE"
).
on
(
"click"
,
deleteFunc
);
$
(
"#SAVE"
).
on
(
"click"
,
save
);
});
/**
* 页面加载时执行
*/
$
(
window
).
load
(
function
()
{
// 查询
query
();
// 禁用checkBox
disableCheckBox
(
true
);
// 全选框绑定事件
allCheckBoxEvent
();
// 子项绑定事件
customAuthCheckBoxEvent
();
depAuthCheckBoxEvent
()
});
/**
* 查询
* checkBox集合
*
* @returns {*|jQuery|HTMLElement}
*/
let
listCustomCheckBox
=
function
()
{
return
$
(
"input:checkbox[name='result-0-customAuth']"
);
}
/**
* checkBox集合
*
* @returns {*|jQuery|HTMLElement}
*/
let
listDepCheckBox
=
function
()
{
return
$
(
"input:checkbox[name='result-0-depAuth']"
);
}
/**
* 清除checkBox选择
*
* @param bool
*/
let
clearCheckedCheckBox
=
function
()
{
// 全选
$
(
"input:checkbox[name='result-0-authAll']"
).
prop
(
'checked'
,
''
);
// 权限子项
checkedCheckBox
(
false
);
}
/**
* 选中或取消checkBox
*
* @param bool
*/
let
checkedCheckBox
=
function
(
bool
)
{
// 权限子项
listCustomCheckBox
().
prop
(
'checked'
,
bool
);
listDepCheckBox
().
prop
(
'checked'
,
bool
);
}
/**
* 禁用或启用checkBox
*/
let
disableCheckBox
=
function
(
bool
)
{
// 全选
$
(
"input:checkbox[name='result-0-authAll']"
).
attr
(
'readonly'
,
bool
);
// 权限子项
listCustomCheckBox
().
each
(
function
()
{
$
(
this
).
attr
(
'readonly'
,
bool
);
});
listDepCheckBox
().
each
(
function
()
{
$
(
this
).
attr
(
'readonly'
,
bool
);
});
}
/**
* 全选框绑定事件
*/
let
allCheckBoxEvent
=
function
()
{
$
(
"input:checkbox[name='result-0-authAll']"
).
on
(
"change"
,
function
()
{
if
(
$
(
this
).
prop
(
'readonly'
))
{
$
(
this
).
attr
(
'checked'
,
false
);
return
;
}
checkedCheckBox
(
this
.
checked
);
});
}
/**
* 子项绑定事件
*/
let
customAuthCheckBoxEvent
=
function
()
{
$
(
"input:checkbox[name='result-0-customAuth']"
).
on
(
"change"
,
function
()
{
if
(
$
(
this
).
prop
(
'readonly'
))
{
$
(
this
).
prop
(
'checked'
,
''
);
return
;
}
// 判断全选框是选中还是不选中
setAllCheckBox
();
});
}
/**
* 子项绑定事件
*/
let
depAuthCheckBoxEvent
=
function
()
{
$
(
"input:checkbox[name='result-0-depAuth']"
).
on
(
"change"
,
function
()
{
if
(
$
(
this
).
prop
(
'readonly'
))
{
$
(
this
).
prop
(
'checked'
,
''
);
return
;
}
// 判断全选框是选中还是不选中
setAllCheckBox
();
});
}
/**
* 设置全选框选中或取消
*/
let
setAllCheckBox
=
function
(){
// 判断全选框是选中还是不选中
let
allCheckBool
=
true
;
listCustomCheckBox
().
each
(
function
()
{
if
(
$
(
this
).
prop
(
'checked'
)
==
false
)
{
allCheckBool
=
false
;
}
})
listDepCheckBox
().
each
(
function
()
{
if
(
$
(
this
).
prop
(
'checked'
)
==
false
)
{
allCheckBool
=
false
;
}
})
// 全选
$
(
"input:checkbox[name='result-0-authAll']"
).
prop
(
'checked'
,
allCheckBool
);
}
/**
* 树节点选中
*
* @param e
*/
let
treeNodeSelect
=
function
(
nodeData
)
{
// 设置选择的节点
setSelectTreeNode
(
nodeData
);
// 非叶子节点清空显示
if
(
nodeData
.
leaf
)
{
// 禁用checkBox
disableCheckBox
(
true
);
// 清空选项
clearCheckedCheckBox
();
}
else
{
// 启用checkBox
disableCheckBox
(
false
);
// 渲染权限
showAuthInput
(
nodeData
.
label
);
}
}
/**
* 设置选择的节点
*
* @param nodeData
*/
let
query
=
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
let
setSelectTreeNode
=
function
(
nodeData
)
{
IPLATUI
.
EFTree
.
pageTree
.
selectTreeNode
.
label
=
nodeData
.
label
;
IPLATUI
.
EFTree
.
pageTree
.
selectTreeNode
.
text
=
nodeData
.
text
;
IPLATUI
.
EFTree
.
pageTree
.
selectTreeNode
.
leaf
=
nodeData
.
leaf
;
}
/**
* 显示权限选择框
*
* @param node
*/
let
showAuthInput
=
function
(
node
)
{
// 渲染权限
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-pageEname"
,
node
);
EiCommunicator
.
send
(
"HPPZ010"
,
"getByPage"
,
inInfo
,
{
onSuccess
:
getByPageSuccess
,
onFail
:
function
(
res
)
{
}
},
{
async
:
false
});
}
/**
* 获取页面权限成功
*
* @param res
*/
let
getByPageSuccess
=
function
(
res
)
{
// 清空所有选项
clearCheckedCheckBox
();
if
(
res
.
status
<
0
)
{
message
(
res
.
msg
);
return
;
}
let
resultRows
=
res
.
getBlock
(
"result"
).
getMappedRows
();
if
(
resultRows
.
length
==
0
)
{
return
;
}
let
customAuth
=
resultRows
[
0
][
'customAuth'
];
if
(
!
isBlank
(
customAuth
)){
let
customAuths
=
customAuth
.
split
(
','
);
listCustomCheckBox
().
each
(
function
()
{
for
(
let
i
=
0
;
i
<
customAuths
.
length
;
i
++
)
{
if
(
$
(
this
).
val
()
==
customAuths
[
i
])
{
$
(
this
).
prop
(
'checked'
,
'true'
);
}
}
})
}
let
depAuth
=
resultRows
[
0
][
'depAuth'
];
if
(
!
isBlank
(
depAuth
)){
let
depAuths
=
depAuth
.
split
(
','
);
listDepCheckBox
().
each
(
function
()
{
for
(
let
i
=
0
;
i
<
depAuths
.
length
;
i
++
)
{
if
(
$
(
this
).
val
()
==
depAuths
[
i
])
{
$
(
this
).
prop
(
'checked'
,
'true'
);
}
}
})
}
// 判断全选框是选中还是不选中
setAllCheckBox
();
}
/**
* 保存
*/
let
save
=
function
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
// 检查是否选择的叶子节点
let
selectTreeNode
=
IPLATUI
.
EFTree
.
pageTree
.
selectTreeNode
;
if
(
selectTreeNode
.
leaf
)
{
message
(
"【"
+
selectTreeNode
.
text
+
"】不是叶子节点,请选择菜单树叶子节点进行授权"
);
return
;
}
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPPZ009"
,
"save"
,
true
);
}
JSUtils
.
confirm
(
"确定对勾选中的数据做
\"
保存
\"
操作? "
,
{
ok
:
saveOk
});
}
/**
*
删除
*
保存确认
*/
let
deleteFunc
=
function
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
删除
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPPZ009"
,
"delete"
,
true
);
let
saveOk
=
function
()
{
let
customAuth
=
''
;
listCustomCheckBox
().
each
(
function
()
{
if
(
$
(
this
).
prop
(
'checked'
))
{
customAuth
+=
(
''
==
customAuth
?
$
(
this
).
val
()
:
','
+
$
(
this
).
val
());
}
});
})
let
depAuth
=
''
;
listDepCheckBox
().
each
(
function
()
{
if
(
$
(
this
).
prop
(
'checked'
))
{
depAuth
+=
(
''
==
depAuth
?
$
(
this
).
val
()
:
','
+
$
(
this
).
val
());
}
})
let
selectTreeNode
=
IPLATUI
.
EFTree
.
pageTree
.
selectTreeNode
;
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"result-0-pageEname"
,
selectTreeNode
.
label
);
inInfo
.
set
(
"result-0-pageCname"
,
selectTreeNode
.
text
);
inInfo
.
set
(
"result-0-customAuth"
,
customAuth
);
inInfo
.
set
(
"result-0-depAuth"
,
depAuth
);
EiCommunicator
.
send
(
"HPPZ010"
,
"save"
,
inInfo
,
{
onSuccess
:
function
(
res
)
{
message
(
res
.
msg
);
},
onFail
:
function
(
res
)
{
}
},
{
async
:
false
});
}
src/main/webapp/HP/PZ/HPPZ010.jsp
View file @
7efc9eba
<%@ page import="com.baosight.hpjx.hp.xs.tools.HPXSTools" %>
<%@ page import="java.util.List" %>
<%@ page import="com.baosight.hpjx.hp.xs.domain.Org" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.baosight.hpjx.core.enums.OrgTypeEnum" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
Map<String, List<Org>> orgMap = HPXSTools.XsOrg.queryAllFactoryMap();
if (orgMap == null) {
orgMap = new HashMap<>();
}
request.setAttribute("orgMap", orgMap);
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage>
<div class="row" style="margin: 0 -10px;">
<div
class=
"col-md-
4
"
>
<div class="col-md-
3
">
<EF:EFRegion title="系统菜单树" id="tree" fitHeight="true">
<EF:EFTree
bindId=
"
groups
Tree"
ename=
"node"
textField=
"text"
valueField=
"label"
hasChildren=
"leaf"
serviceName=
"
XS0705"
methodName=
"query"
style=
"height:435px;
"
>
<EF:EFTree bindId="
page
Tree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="
HPPZ010" methodName="queryTreeNode
">
</EF:EFTree>
</EF:EFRegion>
</div>
<div
class=
"col-md-8"
>
<EF:EFRegion
title=
"查询区"
id=
"inqu"
>
<div
class=
"row"
>
<EF:EFInput
type=
"hidden"
cname=
"授权主体ID"
ename=
"subjectId"
row=
"0"
blockId=
"inqu_status"
/>
<EF:EFInput
type=
"hidden"
ename=
"objectCname"
row =
"0"
blockId=
"inqu_status"
/>
<EF:EFInput
type=
"hidden"
cname=
"授权类别"
ename=
"operationType"
row=
"0"
blockId=
"inqu_status"
value=
"ACCESS"
/>
<EF:EFInput
row=
"0"
blockId=
"inqu_status"
ename=
"objectEname"
cname=
"授权客体名称"
type=
"hidden"
/>
<div
class=
"col-xs-4"
>
<div
class=
"form-group"
>
<label
class=
"col-md-5 control-label"
>
授权主体名称
</label>
<div
class=
"col-md-7"
>
<input
name=
"inqu_status-0-subjectName"
data-query=
"gt"
class=
"k-textbox input-time query-need"
placeholder=
"请输入授权主体名称"
/>
</div>
</div>
</div>
<EF:EFSelect
blockId=
"inqu_status"
cname=
"授权主体类别"
ename=
"subjectType"
row=
"0"
defaultValue=
"全部"
colWidth=
"4"
ratio=
"5:7"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFCodeOption
codeName=
"iplat.xs.subjectType"
textField=
"label"
valueField=
"value"
/>
</EF:EFSelect>
<div
class=
"col-xs-4"
>
<div
class=
"form-group"
>
<label
class=
"col-md-5 control-label"
>
授权客体名称
</label>
<div
class=
"col-md-7"
>
<input
name=
"inqu_status-0-objectName"
data-query=
"gt"
class=
"k-textbox input-time query-need"
placeholder=
"请输入授权客体名称"
/>
</div>
</div>
</div>
<EF:EFSelect
blockId=
"inqu_status"
cname=
"授权客体类别"
colWidth=
"4"
ename=
"objectType"
row=
"0"
defaultValue=
"全部"
ratio=
"5:7"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFCodeOption
codeName=
"xs.og.objectType"
textField=
"label"
valueField=
"value"
/>
</EF:EFSelect>
<div
class=
"col-xs-8"
style=
"text-align: right"
id=
"inqu_inside"
></div>
</div>
</EF:EFRegion>
<EF:EFInput
ename=
"objectCname"
cname=
"授权主体名称"
type=
"hidden"
/>
<EF:EFRegion
title=
"记录集"
id=
"result"
fitHeight=
"true"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"false"
>
<EF:EFColumn
ename=
"subjectId"
cname=
"授权主体ID"
hidden=
"true"
/>
<EF:EFColumn
ename=
"subjectName"
cname=
"授权主体名称"
readonly=
"true"
locked=
"true"
/>
<EF:EFComboColumn
enable=
"false"
cname=
"授权主体类别"
locked=
"true"
ename=
"subjectType"
defaultValue=
"USER"
style=
"text-align:center;"
>
<EF:EFCodeOption
codeName=
"iplat.xs.subjectType"
textField=
"label"
valueField=
"value"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"objectId"
cname=
"授权客体ID"
hidden=
"true"
/>
<EF:EFColumn
ename=
"objectName"
cname=
"授权客体名称"
readonly=
"true"
locked=
"true"
/>
<EF:EFComboColumn
enable=
"false"
cname=
"授权客体类别"
locked=
"true"
ename=
"objectType"
defaultValue=
"RESOURCE"
style=
"text-align:center;"
>
<EF:EFCodeOption
codeName=
"xs.og.objectType"
textField=
"label"
valueField=
"value"
/>
</EF:EFComboColumn>
<EF:EFComboColumn
cname=
"操作类型"
ename=
"operationType"
readonly=
"true"
defaultValue=
"ACCESS"
style=
"text-align:center;"
>
<EF:EFCodeOption
codeName=
"services.xs.operationType"
textField=
"label"
valueField=
"value"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"sortIndex"
cname=
"排序"
style=
"text-align:center;"
/>
<EF:EFColumn
ename=
"recCreator"
cname=
"创建人"
style=
"text-align:center;"
readonly=
"true"
/>
<EF:EFColumn
ename=
"recCreateTime"
cname=
"创建时间"
editType=
"datetime"
readonly=
"true"
displayType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"
style=
"text-align:center;"
/>
<EF:EFColumn
ename=
"recRevisor"
cname=
"修改人"
style=
"text-align:center;"
readonly=
"true"
/>
<EF:EFColumn
ename=
"recReviseTime"
cname=
"修改时间"
readonly=
"true"
editType=
"datetime"
displayType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"
style=
"text-align:center;"
/>
<EF:EFColumn
ename=
"archiveFlag"
cname=
"归档标记"
style=
"text-align:center;"
/>
</EF:EFGrid>
</EF:EFRegion>
</div>
</div>
<EF:EFWindow
id=
"authSubject"
width=
"58%"
top=
"100px"
left=
"280px"
>
<div
id=
"ef_popup_gridA"
>
<EF:EFRegion
id=
"inquA"
title=
"查询条件"
type=
"query"
efRegionShowClear=
"true"
efRegionSave=
"true"
>
<div class="col-md-9">
<%-- <EF:EFRegion title="自定义" id="result" hidden="true">--%>
<%-- <div class="row">--%>
<%-- <EF:EFInput cname="本厂" blockId="result" ename="customAuth" row="0" value="onlyFactory" colWidth="3"--%>
<%-- type="checkbox" inline="true"/>--%>
<%-- <EF:EFInput cname="本部门" blockId="result" ename="customAuth" row="0" value="onlyDept" colWidth="3"--%>
<%-- type="checkbox" inline="true"/>--%>
<%-- </div>--%>
<%-- </EF:EFRegion>--%>
<EF:EFRegion title="组织机构" id="org">
<div class="row">
<div
class=
"col-xs-2 control-label"
>
<span>
用户组英文名
</span>
</div>
<div
class=
"col-xs-2"
>
<EF:EFInput
ename=
"inqu_status-0-groupEname"
cname=
"用户组英文名"
inline=
"true"
/>
</div>
<div
class=
"col-xs-3 control-label"
>
<span>
用户组中文名
</span>
</div>
<div
class=
"col-xs-2"
>
<EF:EFInput
ename=
"inqu_status-0-groupCname"
cname=
"用户组中文名"
inline=
"true"
/>
</div>
<div
class=
"col-xs-2"
style=
"text-align: right"
id=
"inqua_inside"
></div>
<EF:EFInput cname="全选" blockId="result" ename="authAll" row="0" value="0" colWidth="3"
type="checkbox" inline="true"/>
</div>
<c:forEach items="${requestScope.orgMap}" var="entry">
<c:forEach items="${entry.value}" var="item" varStatus="i">
<c:if test="${item.orgType == 'factory'}">
<c:if test="${i.index == 0}">
<div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
</c:if>
<c:if test="${i.index != 0}">
</div>
<div class="row">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</div>
<div class="row">
</c:if>
</c:if>
<c:if test="${item.orgType != 'factory'}">
<EF:EFInput cname="${item.orgCname}" blockId="result" ename="depAuth" row="0"
value="${item.orgId}" colWidth="3" type="checkbox" inline="true"/>
</c:if>
</c:forEach>
</div>
</c:forEach>
</EF:EFRegion>
<EF:EFRegion
id=
"resultA"
title=
"记录集"
>
<div
class=
"text-right"
>
<EF:EFButton
cname=
"确定"
ename=
"ef_popup_gridA_commit"
></EF:EFButton>
</div>
<EF:EFGrid
blockId=
"resultA"
queryMethod=
"queryForGridSubject"
autoDraw=
"false"
>
<EF:EFColumn
ename=
"groupId"
locked=
"true"
cname=
"群组ID"
hidden=
"true"
primaryKey=
"true"
/>
<EF:EFColumn
ename=
"groupEname"
locked=
"true"
cname=
"群组英文名"
readonly=
"true"
width=
"300"
/>
<EF:EFColumn
ename=
"groupCname"
cname=
"群组中文名"
readonly=
"true"
width=
"300"
/>
</EF:EFGrid>
<EF:EFRegion title="提示">
<%-- <span style="color: red">1:非叶子节点授权时,会同步将该节点下的所有子节点权限设置为当前选择的权限。</span>--%>
</EF:EFRegion>
</div>
</
EF:EFWindow
>
</
div
>
<EF:EFWindow
id=
"menuPageAuth"
url=
"${ctx}/web/XS0707"
width=
"78%"
top=
"80px"
left=
"120px"
></EF:EFWindow>
</EF:EFPage>
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