Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
jsherp-java-test
Commits
82cad570
Commit
82cad570
authored
Nov 22, 2023
by
gu-jinli1118
Browse files
Test
parents
Changes
220
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1126 additions
and
0 deletions
+1126
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotItemVoBatchNumberList.java
...com/jsh/erp/datasource/vo/DepotItemVoBatchNumberList.java
+90
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/FinishDepositVo.java
.../main/java/com/jsh/erp/datasource/vo/FinishDepositVo.java
+26
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/LogVo4List.java
...t/src/main/java/com/jsh/erp/datasource/vo/LogVo4List.java
+37
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialCountVo.java
.../main/java/com/jsh/erp/datasource/vo/MaterialCountVo.java
+26
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialExtendVo4List.java
...java/com/jsh/erp/datasource/vo/MaterialExtendVo4List.java
+68
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialsListVo.java
.../main/java/com/jsh/erp/datasource/vo/MaterialsListVo.java
+24
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/NodeAttributes.java
...c/main/java/com/jsh/erp/datasource/vo/NodeAttributes.java
+30
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/TreeNode.java
...oot/src/main/java/com/jsh/erp/datasource/vo/TreeNode.java
+114
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/TreeNodeEx.java
...t/src/main/java/com/jsh/erp/datasource/vo/TreeNodeEx.java
+96
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/BusinessParamCheckingException.java
...com/jsh/erp/exception/BusinessParamCheckingException.java
+32
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/BusinessRunTimeException.java
.../java/com/jsh/erp/exception/BusinessRunTimeException.java
+50
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
...in/java/com/jsh/erp/exception/GlobalExceptionHandler.java
+48
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/JshException.java
...oot/src/main/java/com/jsh/erp/exception/JshException.java
+27
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java
...-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java
+103
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/CommonQueryManager.java
...src/main/java/com/jsh/erp/service/CommonQueryManager.java
+138
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/ICommonQuery.java
...-boot/src/main/java/com/jsh/erp/service/ICommonQuery.java
+81
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/InterfaceContainer.java
...src/main/java/com/jsh/erp/service/InterfaceContainer.java
+31
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/ResourceInfo.java
...-boot/src/main/java/com/jsh/erp/service/ResourceInfo.java
+15
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountComponent.java
...in/java/com/jsh/erp/service/account/AccountComponent.java
+75
-0
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountResource.java
...ain/java/com/jsh/erp/service/account/AccountResource.java
+15
-0
No files found.
Too many changes to show.
To preserve performance only
220 of 220+
files are displayed.
Plain diff
Email patch
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/DepotItemVoBatchNumberList.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
java.math.BigDecimal
;
import
java.util.Date
;
public
class
DepotItemVoBatchNumberList
{
private
String
id
;
private
String
barCode
;
private
String
name
;
private
String
standard
;
private
String
model
;
private
String
batchNumber
;
private
Date
expirationDate
;
private
String
expirationDateStr
;
private
BigDecimal
totalNum
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getBarCode
()
{
return
barCode
;
}
public
void
setBarCode
(
String
barCode
)
{
this
.
barCode
=
barCode
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getStandard
()
{
return
standard
;
}
public
void
setStandard
(
String
standard
)
{
this
.
standard
=
standard
;
}
public
String
getModel
()
{
return
model
;
}
public
void
setModel
(
String
model
)
{
this
.
model
=
model
;
}
public
String
getBatchNumber
()
{
return
batchNumber
;
}
public
void
setBatchNumber
(
String
batchNumber
)
{
this
.
batchNumber
=
batchNumber
;
}
public
Date
getExpirationDate
()
{
return
expirationDate
;
}
public
void
setExpirationDate
(
Date
expirationDate
)
{
this
.
expirationDate
=
expirationDate
;
}
public
String
getExpirationDateStr
()
{
return
expirationDateStr
;
}
public
void
setExpirationDateStr
(
String
expirationDateStr
)
{
this
.
expirationDateStr
=
expirationDateStr
;
}
public
BigDecimal
getTotalNum
()
{
return
totalNum
;
}
public
void
setTotalNum
(
BigDecimal
totalNum
)
{
this
.
totalNum
=
totalNum
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/FinishDepositVo.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
java.math.BigDecimal
;
public
class
FinishDepositVo
{
private
String
number
;
private
BigDecimal
finishDeposit
;
public
String
getNumber
()
{
return
number
;
}
public
void
setNumber
(
String
number
)
{
this
.
number
=
number
;
}
public
BigDecimal
getFinishDeposit
()
{
return
finishDeposit
;
}
public
void
setFinishDeposit
(
BigDecimal
finishDeposit
)
{
this
.
finishDeposit
=
finishDeposit
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/LogVo4List.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
com.jsh.erp.datasource.entities.Log
;
public
class
LogVo4List
extends
Log
{
private
String
loginName
;
private
String
userName
;
private
String
createTimeStr
;
public
String
getLoginName
()
{
return
loginName
;
}
public
void
setLoginName
(
String
loginName
)
{
this
.
loginName
=
loginName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getCreateTimeStr
()
{
return
createTimeStr
;
}
public
void
setCreateTimeStr
(
String
createTimeStr
)
{
this
.
createTimeStr
=
createTimeStr
;
}
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialCountVo.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
java.math.BigDecimal
;
public
class
MaterialCountVo
{
private
Long
headerId
;
private
BigDecimal
materialCount
;
public
Long
getHeaderId
()
{
return
headerId
;
}
public
void
setHeaderId
(
Long
headerId
)
{
this
.
headerId
=
headerId
;
}
public
BigDecimal
getMaterialCount
()
{
return
materialCount
;
}
public
void
setMaterialCount
(
BigDecimal
materialCount
)
{
this
.
materialCount
=
materialCount
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialExtendVo4List.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
com.jsh.erp.datasource.entities.MaterialExtend
;
import
java.math.BigDecimal
;
public
class
MaterialExtendVo4List
extends
MaterialExtend
{
private
String
supplier
;
private
String
originPlace
;
private
String
unit
;
private
String
brandName
;
private
BigDecimal
guaranteePeriod
;
private
BigDecimal
memberDecimal
;
public
String
getSupplier
()
{
return
supplier
;
}
public
void
setSupplier
(
String
supplier
)
{
this
.
supplier
=
supplier
;
}
public
String
getOriginPlace
()
{
return
originPlace
;
}
public
void
setOriginPlace
(
String
originPlace
)
{
this
.
originPlace
=
originPlace
;
}
public
String
getUnit
()
{
return
unit
;
}
public
void
setUnit
(
String
unit
)
{
this
.
unit
=
unit
;
}
public
String
getBrandName
()
{
return
brandName
;
}
public
void
setBrandName
(
String
brandName
)
{
this
.
brandName
=
brandName
;
}
public
BigDecimal
getGuaranteePeriod
()
{
return
guaranteePeriod
;
}
public
void
setGuaranteePeriod
(
BigDecimal
guaranteePeriod
)
{
this
.
guaranteePeriod
=
guaranteePeriod
;
}
public
BigDecimal
getMemberDecimal
()
{
return
memberDecimal
;
}
public
void
setMemberDecimal
(
BigDecimal
memberDecimal
)
{
this
.
memberDecimal
=
memberDecimal
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/MaterialsListVo.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
public
class
MaterialsListVo
{
private
Long
headerId
;
private
String
materialsList
;
public
Long
getHeaderId
()
{
return
headerId
;
}
public
void
setHeaderId
(
Long
headerId
)
{
this
.
headerId
=
headerId
;
}
public
String
getMaterialsList
()
{
return
materialsList
;
}
public
void
setMaterialsList
(
String
materialsList
)
{
this
.
materialsList
=
materialsList
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/NodeAttributes.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:11
*/
public
class
NodeAttributes
{
//编号
private
String
no
;
//类型
private
Integer
type
;
public
String
getNo
()
{
return
no
;
}
public
void
setNo
(
String
no
)
{
this
.
no
=
no
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/TreeNode.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
java.util.List
;
/**
* Description
* 树形结构基本元素
* @Author: cjl
* @Date: 2019/2/19 11:27
*/
public
class
TreeNode
{
/**
* id主键
* */
private
Long
id
;
private
Long
key
;
private
Long
value
;
/**
* title显示的文本
* */
private
String
title
;
/**
*state节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
* */
private
String
state
=
"open"
;
/**
*iconCls 节点图标id
* */
private
String
iconCls
;
/**
* checked 是否被选中
* */
private
boolean
checked
;
/**
*attributes 自定义属性
* */
private
String
attributes
;
/**
* children 子节点
* */
private
List
<
TreeNode
>
children
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getKey
()
{
return
key
;
}
public
void
setKey
(
Long
key
)
{
this
.
key
=
key
;
}
public
Long
getValue
()
{
return
value
;
}
public
void
setValue
(
Long
value
)
{
this
.
value
=
value
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getIconCls
()
{
return
iconCls
;
}
public
void
setIconCls
(
String
iconCls
)
{
this
.
iconCls
=
iconCls
;
}
public
boolean
isChecked
()
{
return
checked
;
}
public
void
setChecked
(
boolean
checked
)
{
this
.
checked
=
checked
;
}
public
String
getAttributes
()
{
return
attributes
;
}
public
void
setAttributes
(
String
attributes
)
{
this
.
attributes
=
attributes
;
}
public
List
<
TreeNode
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
TreeNode
>
children
)
{
this
.
children
=
children
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/datasource/vo/TreeNodeEx.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.datasource.vo
;
import
java.util.List
;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/3/13 18:10
*/
public
class
TreeNodeEx
{
/**
* id主键
* */
private
Long
id
;
/**
* text显示的文本
* */
private
String
text
;
/**
*state节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
* */
private
String
state
=
"open"
;
/**
*iconCls 节点图标id
* */
private
String
iconCls
;
/**
* checked 是否被选中
* */
private
boolean
checked
;
/**
*attributes 自定义属性
* */
private
NodeAttributes
attributes
;
/**
* children 子节点
* */
private
List
<
TreeNode
>
children
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getIconCls
()
{
return
iconCls
;
}
public
void
setIconCls
(
String
iconCls
)
{
this
.
iconCls
=
iconCls
;
}
public
boolean
isChecked
()
{
return
checked
;
}
public
void
setChecked
(
boolean
checked
)
{
this
.
checked
=
checked
;
}
public
NodeAttributes
getAttributes
()
{
return
attributes
;
}
public
void
setAttributes
(
NodeAttributes
attributes
)
{
this
.
attributes
=
attributes
;
}
public
List
<
TreeNode
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
TreeNode
>
children
)
{
this
.
children
=
children
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/BusinessParamCheckingException.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.exception
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@Getter
public
class
BusinessParamCheckingException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
code
;
private
Map
<
String
,
Object
>
data
;
public
BusinessParamCheckingException
(
int
code
,
String
reason
)
{
super
(
reason
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"message"
,
reason
);
this
.
code
=
code
;
this
.
data
=
objectMap
;
}
public
BusinessParamCheckingException
(
int
code
,
String
reason
,
Throwable
throwable
)
{
super
(
reason
,
throwable
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"message"
,
reason
);
this
.
code
=
code
;
this
.
data
=
objectMap
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/BusinessRunTimeException.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.exception
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@Getter
public
class
BusinessRunTimeException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
code
;
private
Map
<
String
,
Object
>
data
;
public
BusinessRunTimeException
(
int
code
,
String
reason
)
{
super
(
reason
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"message"
,
reason
);
this
.
code
=
code
;
this
.
data
=
objectMap
;
}
public
BusinessRunTimeException
(
int
code
,
String
reason
,
Throwable
throwable
)
{
super
(
reason
,
throwable
);
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<>();
objectMap
.
put
(
"message"
,
reason
);
this
.
code
=
code
;
this
.
data
=
objectMap
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
Map
<
String
,
Object
>
getData
()
{
return
data
;
}
public
void
setData
(
Map
<
String
,
Object
>
data
)
{
this
.
data
=
data
;
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.exception
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
javax.servlet.http.HttpServletRequest
;
@Slf4j
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
(
value
=
Exception
.
class
)
@ResponseBody
public
Object
handleException
(
Exception
e
,
HttpServletRequest
request
)
{
JSONObject
status
=
new
JSONObject
();
// 针对业务参数异常的处理
if
(
e
instanceof
BusinessParamCheckingException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessParamCheckingException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_DATA
,
((
BusinessParamCheckingException
)
e
).
getData
());
return
status
;
}
//针对业务运行时异常的处理
if
(
e
instanceof
BusinessRunTimeException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessRunTimeException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_DATA
,
((
BusinessRunTimeException
)
e
).
getData
());
return
status
;
}
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_CODE
);
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_DATA
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_MSG
);
log
.
error
(
"Global Exception Occured => url : {}, msg : {}"
,
request
.
getRequestURL
(),
e
.
getMessage
());
/**
* create by: qiankunpingtai
* create time: 2019/4/18 17:41
* 这里输出完整的堆栈信息,否则有些异常完全不知道哪里出错了。
*/
log
.
error
(
"Global Exception Occured => url : {}"
,
request
.
getRequestURL
(),
e
);
e
.
printStackTrace
();
return
status
;
}
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/exception/JshException.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.exception
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
org.slf4j.Logger
;
/**
* 封装日志打印,收集日志
* author: ji shenghua, qq 752718 920
*/
public
class
JshException
{
public
static
void
readFail
(
Logger
logger
,
Exception
e
)
{
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
public
static
void
writeFail
(
Logger
logger
,
Exception
e
)
{
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/filter/LogCostFilter.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.filter
;
import
com.jsh.erp.service.redis.RedisService
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
javax.servlet.*
;
import
javax.servlet.annotation.WebFilter
;
import
javax.servlet.annotation.WebInitParam
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@WebFilter
(
filterName
=
"LogCostFilter"
,
urlPatterns
=
{
"/*"
},
initParams
=
{
@WebInitParam
(
name
=
"ignoredUrl"
,
value
=
".ico"
),
@WebInitParam
(
name
=
"filterPath"
,
value
=
"/jshERP-boot/user/login#/jshERP-boot/user/registerUser#/jshERP-boot/user/randomImage#"
+
"/jshERP-boot/platformConfig/getPlatform#/jshERP-boot/v2/api-docs#/jshERP-boot/webjars#"
+
"/jshERP-boot/systemConfig/static"
)})
public
class
LogCostFilter
implements
Filter
{
private
static
final
String
FILTER_PATH
=
"filterPath"
;
private
static
final
String
IGNORED_PATH
=
"ignoredUrl"
;
private
static
final
List
<
String
>
ignoredList
=
new
ArrayList
<>();
private
String
[]
allowUrls
;
private
String
[]
ignoredUrls
;
@Resource
private
RedisService
redisService
;
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
String
filterPath
=
filterConfig
.
getInitParameter
(
FILTER_PATH
);
if
(!
StringUtils
.
isEmpty
(
filterPath
))
{
allowUrls
=
filterPath
.
contains
(
"#"
)
?
filterPath
.
split
(
"#"
)
:
new
String
[]{
filterPath
};
}
String
ignoredPath
=
filterConfig
.
getInitParameter
(
IGNORED_PATH
);
if
(!
StringUtils
.
isEmpty
(
ignoredPath
))
{
ignoredUrls
=
ignoredPath
.
contains
(
"#"
)
?
ignoredPath
.
split
(
"#"
)
:
new
String
[]{
ignoredPath
};
for
(
String
ignoredUrl
:
ignoredUrls
)
{
ignoredList
.
add
(
ignoredUrl
);
}
}
}
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
HttpServletRequest
servletRequest
=
(
HttpServletRequest
)
request
;
HttpServletResponse
servletResponse
=
(
HttpServletResponse
)
response
;
String
requestUrl
=
servletRequest
.
getRequestURI
();
//具体,比如:处理若用户未登录,则跳转到登录页
Object
userId
=
redisService
.
getObjectFromSessionByKey
(
servletRequest
,
"userId"
);
if
(
userId
!=
null
)
{
//如果已登录,不阻止
chain
.
doFilter
(
request
,
response
);
return
;
}
if
(
requestUrl
!=
null
&&
(
requestUrl
.
contains
(
"/doc.html"
)
||
requestUrl
.
contains
(
"/user/login"
)
||
requestUrl
.
contains
(
"/user/register"
)))
{
chain
.
doFilter
(
request
,
response
);
return
;
}
if
(
verify
(
ignoredList
,
requestUrl
))
{
chain
.
doFilter
(
servletRequest
,
response
);
return
;
}
if
(
null
!=
allowUrls
&&
allowUrls
.
length
>
0
)
{
for
(
String
url
:
allowUrls
)
{
if
(
requestUrl
.
startsWith
(
url
))
{
chain
.
doFilter
(
request
,
response
);
return
;
}
}
}
servletResponse
.
setStatus
(
500
);
if
(
requestUrl
!=
null
&&
!
requestUrl
.
contains
(
"/user/logout"
)
&&
!
requestUrl
.
contains
(
"/function/findMenuByPNumber"
))
{
servletResponse
.
getWriter
().
write
(
"loginOut"
);
}
}
private
static
String
regexPrefix
=
"^.*"
;
private
static
String
regexSuffix
=
".*$"
;
private
static
boolean
verify
(
List
<
String
>
ignoredList
,
String
url
)
{
for
(
String
regex
:
ignoredList
)
{
Pattern
pattern
=
Pattern
.
compile
(
regexPrefix
+
regex
+
regexSuffix
);
Matcher
matcher
=
pattern
.
matcher
(
url
);
if
(
matcher
.
matches
())
{
return
true
;
}
}
return
false
;
}
@Override
public
void
destroy
()
{
}
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/CommonQueryManager.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author jishenghua 752718920 2018-10-7 15:25:58
*/
@Service
public
class
CommonQueryManager
{
@Resource
private
InterfaceContainer
container
;
@Resource
private
LogService
logService
;
/**
* 查询单条
*
* @param apiName 接口名称
* @param id ID
*/
public
Object
selectOne
(
String
apiName
,
Long
id
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
)
&&
id
!=
null
)
{
return
container
.
getCommonQuery
(
apiName
).
selectOne
(
id
);
}
return
null
;
}
/**
* 查询
* @param apiName
* @param parameterMap
* @return
*/
public
List
<?>
select
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
select
(
parameterMap
);
}
return
new
ArrayList
<
Object
>();
}
/**
* 计数
* @param apiName
* @param parameterMap
* @return
*/
public
Long
counts
(
String
apiName
,
Map
<
String
,
String
>
parameterMap
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
counts
(
parameterMap
);
}
return
BusinessConstants
.
DEFAULT_LIST_NULL_NUMBER
;
}
/**
* 插入
* @param apiName
* @param obj
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insert
(
String
apiName
,
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
insert
(
obj
,
request
);
}
return
0
;
}
/**
* 更新
* @param apiName
* @param obj
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
update
(
String
apiName
,
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
update
(
obj
,
request
);
}
return
0
;
}
/**
* 删除
* @param apiName
* @param id
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
delete
(
String
apiName
,
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
delete
(
id
,
request
);
}
return
0
;
}
/**
* 批量删除
* @param apiName
* @param ids
* @return
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteBatch
(
String
apiName
,
String
ids
,
HttpServletRequest
request
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
))
{
return
container
.
getCommonQuery
(
apiName
).
deleteBatch
(
ids
,
request
);
}
return
0
;
}
/**
* 判断是否存在
* @param apiName
* @param id
* @param name
* @return
*/
public
int
checkIsNameExist
(
String
apiName
,
Long
id
,
String
name
)
throws
Exception
{
if
(
StringUtil
.
isNotEmpty
(
apiName
)
&&
name
!=
null
)
{
return
container
.
getCommonQuery
(
apiName
).
checkIsNameExist
(
id
,
name
);
}
return
0
;
}
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/ICommonQuery.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
* 通用查询接口
* 功能:1、单条查询 2、分页+搜索 3、查询数量
*
* @author jishenghua
* @version 1.0
*/
public
interface
ICommonQuery
{
/**
* 根据id查询明细。
*
* @param id 资源id
* @return 资源
*/
Object
selectOne
(
Long
id
)
throws
Exception
;
/**
* 自定义查询
*
* @param parameterMap 查询参数
* @return 查询结果
*/
List
<?>
select
(
Map
<
String
,
String
>
parameterMap
)
throws
Exception
;
/**
* 查询数量
*
* @param parameterMap 查询参数
* @return 查询结果
*/
Long
counts
(
Map
<
String
,
String
>
parameterMap
)
throws
Exception
;
/**
* 新增数据
*
* @param obj
* @return
*/
int
insert
(
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
;
/**
* 更新数据
*
* @param obj
* @return
*/
int
update
(
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
;
/**
* 删除数据
*
* @param id
* @return
*/
int
delete
(
Long
id
,
HttpServletRequest
request
)
throws
Exception
;
/**
* 批量删除数据
*
* @param ids
* @return
*/
int
deleteBatch
(
String
ids
,
HttpServletRequest
request
)
throws
Exception
;
/**
* 查询名称是否存在
*
* @param id
* @return
*/
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
;
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/InterfaceContainer.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service
;
import
com.jsh.erp.utils.AnnotationUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author jishenghua 2018-10-7 15:25:09
*/
@Service
public
class
InterfaceContainer
{
private
final
Map
<
String
,
ICommonQuery
>
configComponentMap
=
new
HashMap
<>();
@Autowired
(
required
=
false
)
private
synchronized
void
init
(
ICommonQuery
[]
configComponents
)
{
for
(
ICommonQuery
configComponent
:
configComponents
)
{
ResourceInfo
info
=
AnnotationUtils
.
getAnnotation
(
configComponent
,
ResourceInfo
.
class
);
if
(
info
!=
null
)
{
configComponentMap
.
put
(
info
.
value
(),
configComponent
);
}
}
}
public
ICommonQuery
getCommonQuery
(
String
apiName
)
{
return
configComponentMap
.
get
(
apiName
);
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/ResourceInfo.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service
;
import
java.lang.annotation.*
;
/**
* @author jishenghua 2018-10-7 15:25:39
*/
@Target
({
ElementType
.
TYPE
,
ElementType
.
ANNOTATION_TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Inherited
@Documented
public
@interface
ResourceInfo
{
String
value
();
}
\ No newline at end of file
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountComponent.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service.account
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.service.ICommonQuery
;
import
com.jsh.erp.utils.Constants
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
@Service
(
value
=
"account_component"
)
@AccountResource
public
class
AccountComponent
implements
ICommonQuery
{
@Resource
private
AccountService
accountService
;
@Override
public
Object
selectOne
(
Long
id
)
throws
Exception
{
return
accountService
.
getAccount
(
id
);
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getAccountList
(
map
);
}
private
List
<?>
getAccountList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
serialNo
=
StringUtil
.
getInfo
(
search
,
"serialNo"
);
String
remark
=
StringUtil
.
getInfo
(
search
,
"remark"
);
String
order
=
QueryUtils
.
order
(
map
);
return
accountService
.
select
(
name
,
serialNo
,
remark
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
@Override
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
name
=
StringUtil
.
getInfo
(
search
,
"name"
);
String
serialNo
=
StringUtil
.
getInfo
(
search
,
"serialNo"
);
String
remark
=
StringUtil
.
getInfo
(
search
,
"remark"
);
return
accountService
.
countAccount
(
name
,
serialNo
,
remark
);
}
@Override
public
int
insert
(
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
{
return
accountService
.
insertAccount
(
obj
,
request
);
}
@Override
public
int
update
(
JSONObject
obj
,
HttpServletRequest
request
)
throws
Exception
{
return
accountService
.
updateAccount
(
obj
,
request
);
}
@Override
public
int
delete
(
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
return
accountService
.
deleteAccount
(
id
,
request
);
}
@Override
public
int
deleteBatch
(
String
ids
,
HttpServletRequest
request
)
throws
Exception
{
return
accountService
.
batchDeleteAccount
(
ids
,
request
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
accountService
.
checkIsNameExist
(
id
,
name
);
}
}
JSH_ERP/jshERP-boot/src/main/java/com/jsh/erp/service/account/AccountResource.java
0 → 100644
View file @
82cad570
package
com.jsh.erp.service.account
;
import
com.jsh.erp.service.ResourceInfo
;
import
java.lang.annotation.*
;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo
(
value
=
"account"
)
@Inherited
@Target
(
ElementType
.
TYPE
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
AccountResource
{
}
Prev
1
…
7
8
9
10
11
Next
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