Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
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
ZTGK
hzsomms
Commits
f2005619
Commit
f2005619
authored
Jul 08, 2023
by
shizhilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发工具类和检查道床记录相关提交 --shizhilong
parent
a8dd5eb1
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2388 additions
and
1 deletion
+2388
-1
pom.xml
jeecg-module-system/pom.xml
+13
-0
CodeGenerate.java
...em/src/main/java/org/jeecg/codegenerate/CodeGenerate.java
+1
-1
RecordsMasterCheckDTO.java
...eckData/equipmentCheckData/dto/RecordsMasterCheckDTO.java
+93
-0
TrackBedManagementCheckDTO.java
...ta/equipmentCheckData/dto/TrackBedManagementCheckDTO.java
+62
-0
RecordsMasterCheckVO.java
...checkData/equipmentCheckData/vo/RecordsMasterCheckVO.java
+117
-0
TrackBedManagementCheckVO.java
...Data/equipmentCheckData/vo/TrackBedManagementCheckVO.java
+83
-0
BeanCopyUtil.java
...m/src/main/java/org/jeecg/modules/utils/BeanCopyUtil.java
+118
-0
BeanCopyUtilCallBack.java
...in/java/org/jeecg/modules/utils/BeanCopyUtilCallBack.java
+16
-0
BeanCopyUtilCallBackPlus.java
...ava/org/jeecg/modules/utils/BeanCopyUtilCallBackPlus.java
+16
-0
CngcPage.java
...ystem/src/main/java/org/jeecg/modules/utils/CngcPage.java
+80
-0
ConstansVariable.java
...c/main/java/org/jeecg/modules/utils/ConstansVariable.java
+44
-0
DicMap.java
...-system/src/main/java/org/jeecg/modules/utils/DicMap.java
+36
-0
JsonResult.java
...tem/src/main/java/org/jeecg/modules/utils/JsonResult.java
+171
-0
PageUtils.java
...stem/src/main/java/org/jeecg/modules/utils/PageUtils.java
+111
-0
StringUtil.java
...tem/src/main/java/org/jeecg/modules/utils/StringUtil.java
+1427
-0
No files found.
jeecg-module-system/pom.xml
View file @
f2005619
...
@@ -45,6 +45,19 @@
...
@@ -45,6 +45,19 @@
<groupId>
org.jeecgframework.jimureport
</groupId>
<groupId>
org.jeecgframework.jimureport
</groupId>
<artifactId>
jimureport-spring-boot-starter
</artifactId>
<artifactId>
jimureport-spring-boot-starter
</artifactId>
</dependency>
</dependency>
<!-- hutool -->
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.4.0
</version>
</dependency>
<!--字符串-->
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
2.5.1
</version>
</dependency>
<!-- 积木报表 mongo redis 支持包
<!-- 积木报表 mongo redis 支持包
<dependency>
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<groupId>org.jeecgframework.jimureport</groupId>
...
...
jeecg-module-system/src/main/java/org/jeecg/codegenerate/CodeGenerate.java
View file @
f2005619
...
@@ -29,7 +29,7 @@ public class CodeGenerate {
...
@@ -29,7 +29,7 @@ public class CodeGenerate {
// 表名
// 表名
String
[]
tables
=
{
String
[]
tables
=
{
"t_ek_t
urnout_use
_check"
,
"t_ek_t
rack_bed_management
_check"
,
};
};
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/dto/RecordsMasterCheckDTO.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
checkData
.
equipmentCheckData
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* <p>
* 设备检查记录主表接收类
* </p>
*
* @author hkl
* @since 2023-07-07
*/
@Data
public
class
RecordsMasterCheckDTO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
String
id
;
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
@ApiModelProperty
(
"创建日期"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新人"
)
private
String
updateBy
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"检查批次编号"
)
private
String
ekCode
;
@ApiModelProperty
(
"工单编号"
)
private
String
workCode
;
@ApiModelProperty
(
"轨距水平尺编号"
)
private
String
gaugeCode
;
@ApiModelProperty
(
"检查区间id"
)
private
String
subwaySectionId
;
@ApiModelProperty
(
"检查区间名称"
)
private
String
subwaySectionName
;
@ApiModelProperty
(
"所属线路id"
)
private
String
lightRailId
;
@ApiModelProperty
(
"所属线路名称"
)
private
String
lightRailName
;
@ApiModelProperty
(
"所属线别id"
)
private
String
lineAliasId
;
@ApiModelProperty
(
"所属线别名称"
)
private
String
lineAliasName
;
@ApiModelProperty
(
"起始里程"
)
private
BigDecimal
startingMileage
;
@ApiModelProperty
(
"终点里程"
)
private
BigDecimal
endMileage
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"检查人姓名"
)
private
String
checkBy
;
@ApiModelProperty
(
"检查日期"
)
private
Date
checkTime
;
@ApiModelProperty
(
"审核人姓名"
)
private
String
verifyBy
;
@ApiModelProperty
(
"审核时间"
)
private
Date
verifyTime
;
@ApiModelProperty
(
"是否删除(0:未删除;1:已删除)"
)
private
String
delFlag
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/dto/TrackBedManagementCheckDTO.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
checkData
.
equipmentCheckData
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.Date
;
/**
* <p>
* 设备检查记录数据-道床使用情况记录数据接收扩展类
* </p>
*
* @author hkl
* @since 2023-07-07
*/
@Data
public
class
TrackBedManagementCheckDTO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
private
String
id
;
@ApiModelProperty
(
"创建人"
)
private
String
createBy
;
@ApiModelProperty
(
"创建日期"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新人"
)
private
String
updateBy
;
@ApiModelProperty
(
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"设备检查记录主表id->外键"
)
private
String
recordsMasterCheckId
;
@ApiModelProperty
(
"道床id->外键"
)
private
String
trakBedManagementId
;
@ApiModelProperty
(
"检查项目名称"
)
private
String
ekProjectName
;
@ApiModelProperty
(
"检查项目内容"
)
private
String
ekProjectContent
;
@ApiModelProperty
(
"检查合格评判标准"
)
private
String
ekPeojectTemplate
;
@ApiModelProperty
(
"现场检查项目状态(1:合格;2:良好;3:不合格)"
)
private
String
ekProjectStatus
;
@ApiModelProperty
(
"是否删除(0:未删除,1:已删除)"
)
private
String
delFlag
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/vo/RecordsMasterCheckVO.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
checkData
.
equipmentCheckData
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* <p>
* 设备检查记录主表返回类
* </p>
*
* @author hkl
* @since 2023-07-07
*/
@Data
public
class
RecordsMasterCheckVO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
@TableId
(
"id"
)
private
String
id
;
@ApiModelProperty
(
"创建人"
)
@TableField
(
"create_by"
)
private
String
createBy
;
@ApiModelProperty
(
"创建日期"
)
@TableField
(
"create_time"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新人"
)
@TableField
(
"update_by"
)
private
String
updateBy
;
@ApiModelProperty
(
"更新时间"
)
@TableField
(
"update_time"
)
private
Date
updateTime
;
@ApiModelProperty
(
"检查批次编号"
)
@TableField
(
"ek_code"
)
private
String
ekCode
;
@ApiModelProperty
(
"工单编号"
)
@TableField
(
"work_code"
)
private
String
workCode
;
@ApiModelProperty
(
"轨距水平尺编号"
)
@TableField
(
"gauge_code"
)
private
String
gaugeCode
;
@ApiModelProperty
(
"检查区间id"
)
@TableField
(
"subway_section_id"
)
private
String
subwaySectionId
;
@ApiModelProperty
(
"检查区间名称"
)
@TableField
(
"subway_section_name"
)
private
String
subwaySectionName
;
@ApiModelProperty
(
"所属线路id"
)
@TableField
(
"light_rail_id"
)
private
String
lightRailId
;
@ApiModelProperty
(
"所属线路名称"
)
@TableField
(
"light_rail_name"
)
private
String
lightRailName
;
@ApiModelProperty
(
"所属线别id"
)
@TableField
(
"line_alias_id"
)
private
String
lineAliasId
;
@ApiModelProperty
(
"所属线别名称"
)
@TableField
(
"line_alias_name"
)
private
String
lineAliasName
;
@ApiModelProperty
(
"起始里程"
)
@TableField
(
"starting_mileage"
)
private
BigDecimal
startingMileage
;
@ApiModelProperty
(
"终点里程"
)
@TableField
(
"end_mileage"
)
private
BigDecimal
endMileage
;
@ApiModelProperty
(
"备注"
)
@TableField
(
"remark"
)
private
String
remark
;
@ApiModelProperty
(
"检查人姓名"
)
@TableField
(
"check_by"
)
private
String
checkBy
;
@ApiModelProperty
(
"检查日期"
)
@TableField
(
"check_time"
)
private
Date
checkTime
;
@ApiModelProperty
(
"审核人姓名"
)
@TableField
(
"verify_by"
)
private
String
verifyBy
;
@ApiModelProperty
(
"审核时间"
)
@TableField
(
"verify_time"
)
private
Date
verifyTime
;
@ApiModelProperty
(
"是否删除(0:未删除;1:已删除)"
)
@TableField
(
"del_flag"
)
private
String
delFlag
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/vo/TrackBedManagementCheckVO.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
checkData
.
equipmentCheckData
.
vo
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.jeecg.modules.utils.DicMap
;
import
java.util.Date
;
/**
* <p>
* 设备检查记录数据-道床使用情况记录数据返回扩展类
* </p>
*
* @author hkl
* @since 2023-07-07
*/
@Data
public
class
TrackBedManagementCheckVO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"主键"
)
@TableId
(
"id"
)
private
String
id
;
@ApiModelProperty
(
"创建人"
)
@TableField
(
"create_by"
)
private
String
createBy
;
@ApiModelProperty
(
"创建日期"
)
@TableField
(
"create_time"
)
private
Date
createTime
;
@ApiModelProperty
(
"更新人"
)
@TableField
(
"update_by"
)
private
String
updateBy
;
@ApiModelProperty
(
"更新时间"
)
@TableField
(
"update_time"
)
private
Date
updateTime
;
@ApiModelProperty
(
"设备检查记录主表id->外键"
)
@TableField
(
"records_master_check_id"
)
private
String
recordsMasterCheckId
;
@ApiModelProperty
(
"道床id->外键"
)
@TableField
(
"trak_bed_management_id"
)
private
String
trakBedManagementId
;
@ApiModelProperty
(
"检查项目名称"
)
@TableField
(
"ek_project_name"
)
private
String
ekProjectName
;
@ApiModelProperty
(
"检查项目内容"
)
@TableField
(
"ek_project_content"
)
private
String
ekProjectContent
;
@ApiModelProperty
(
"检查合格评判标准"
)
@TableField
(
"ek_peoject_template"
)
private
String
ekPeojectTemplate
;
@ApiModelProperty
(
"现场检查项目状态(1:合格;2:良好;3:不合格)"
)
@TableField
(
"ek_project_status"
)
private
String
ekProjectStatus
;
@ApiModelProperty
(
"现场检查项目状态翻译(1:合格;2:良好;3:不合格)"
)
private
String
ekProjectStatusStr
;
public
String
getApprovalStatusStr
()
{
return
DicMap
.
EK_APPROVAL_STATUS_MAP
.
get
(
ekProjectStatus
);
}
@ApiModelProperty
(
"是否删除(0:未删除,1:已删除)"
)
@TableField
(
"del_flag"
)
private
String
delFlag
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/BeanCopyUtil.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.FatalBeanException
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.function.Supplier
;
/**
* 对象转换
*/
public
class
BeanCopyUtil
extends
BeanUtils
{
/**
* 集合数据的拷贝
*
* @param sources: 数据源类
* @param target: 目标类::new(eg: UserVO::new)
* @return
*/
public
static
<
S
,
T
>
List
<
T
>
copyListProperties
(
List
<
S
>
sources
,
Supplier
<
T
>
target
)
{
return
copyListProperties
(
sources
,
target
,
null
);
}
/**
* 带回调函数的集合数据的拷贝(可自定义字段拷贝规则)
*
* @param sources: 数据源类
* @param target: 目标类::new(eg: UserVO::new)
* @param callBack: 回调函数
* @return
*/
public
static
<
S
,
T
>
List
<
T
>
copyListProperties
(
List
<
S
>
sources
,
Supplier
<
T
>
target
,
BeanCopyUtilCallBack
<
S
,
T
>
callBack
)
{
List
list
=
new
ArrayList
<>(
sources
.
size
());
for
(
S
source
:
sources
)
{
T
t
=
target
.
get
();
copyProperties
(
source
,
t
);
list
.
add
(
t
);
if
(
callBack
!=
null
)
{
// 回调
callBack
.
callBack
(
source
,
t
);
}
}
return
list
;
}
/**
* 带回调函数的集合数据的拷贝(可自定义字段拷贝规则),如果拷贝过程中发现有数据不符合不想拷贝可以调用以下方法
*
* @param sources: 数据源类
* @param target: 目标类::new(eg: UserVO::new)
* @param callBack: 回调函数
* @return
*/
public
static
<
S
,
T
>
List
<
T
>
copyListPropertiesPlus
(
List
<
S
>
sources
,
Supplier
<
T
>
target
,
BeanCopyUtilCallBackPlus
<
S
,
T
>
callBack
)
{
List
list
=
new
ArrayList
<>(
sources
.
size
());
Boolean
flag
=
true
;
for
(
S
source
:
sources
)
{
T
t
=
target
.
get
();
copyProperties
(
source
,
t
);
if
(
callBack
!=
null
)
{
// 回调
flag
=
callBack
.
callBack
(
source
,
t
);
}
if
(
flag
)
{
list
.
add
(
t
);
}
flag
=
true
;
}
return
list
;
}
/**
* 进行拷贝时属性为null的属性
* @param source 源对象
* @param target 目标对象
* @throws BeansException
*/
public
static
void
copyPropertiesIgnoreNullProperties
(
Object
source
,
Object
target
)
throws
BeansException
{
Class
<?>
actualEditable
=
target
.
getClass
();
PropertyDescriptor
[]
targetPds
=
getPropertyDescriptors
(
actualEditable
);
for
(
PropertyDescriptor
targetPd
:
targetPds
)
{
if
(
targetPd
.
getWriteMethod
()
!=
null
)
{
PropertyDescriptor
sourcePd
=
getPropertyDescriptor
(
source
.
getClass
(),
targetPd
.
getName
());
if
(
sourcePd
!=
null
&&
sourcePd
.
getReadMethod
()
!=
null
)
{
try
{
Method
readMethod
=
sourcePd
.
getReadMethod
();
if
(!
Modifier
.
isPublic
(
readMethod
.
getDeclaringClass
().
getModifiers
()))
{
readMethod
.
setAccessible
(
true
);
}
Object
value
=
readMethod
.
invoke
(
source
);
// 这里判断以下value是否为空 当然这里也能进行一些特殊要求的处理 例如绑定时格式转换等等
if
(
value
!=
null
)
{
Method
writeMethod
=
targetPd
.
getWriteMethod
();
if
(!
Modifier
.
isPublic
(
writeMethod
.
getDeclaringClass
().
getModifiers
()))
{
writeMethod
.
setAccessible
(
true
);
}
writeMethod
.
invoke
(
target
,
value
);
}
}
catch
(
Throwable
ex
)
{
throw
new
FatalBeanException
(
"Could not copy properties from source to target"
,
ex
);
}
}
}
}
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/BeanCopyUtilCallBack.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
/**
* @author admin
*/
@FunctionalInterface
public
interface
BeanCopyUtilCallBack
<
S
,
T
>
{
/**
* 定义默认回调方法
* @param t
* @param s
*/
void
callBack
(
S
t
,
T
s
);
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/BeanCopyUtilCallBackPlus.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
/**
* @author admin
*/
@FunctionalInterface
public
interface
BeanCopyUtilCallBackPlus
<
S
,
T
>
{
/**
* 定义默认回调方法
* @param t
* @param s
*/
boolean
callBack
(
S
t
,
T
s
);
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/CngcPage.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
import
java.io.Serializable
;
/**
* 分页
*/
public
class
CngcPage
implements
Serializable
{
/**
* 页号
*/
private
Long
page
;
/**
* 每页条数
// @JsonProperty("per_page")
*/
private
Long
perPage
;
/**
* 排序字段
*/
private
String
sort
;
/**
* 是否查询总数
*/
private
boolean
count
;
/**
* 排序
*/
private
String
order
;
public
Long
getPage
()
{
return
page
;
}
public
void
setPage
(
Long
page
)
{
this
.
page
=
page
;
}
public
Long
getPerPage
()
{
return
perPage
;
}
public
void
setPerPage
(
Long
perPage
)
{
this
.
perPage
=
perPage
;
}
public
boolean
isCount
()
{
return
count
;
}
public
void
setCount
(
boolean
count
)
{
this
.
count
=
count
;
}
public
String
getSort
()
{
return
sort
;
}
public
void
setSort
(
String
sort
)
{
this
.
sort
=
sort
;
}
public
String
getOrder
()
{
return
order
;
}
public
void
setOrder
(
String
order
)
{
this
.
order
=
order
;
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/ConstansVariable.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
/**
* 公共编码
* @author admin
*/
public
class
ConstansVariable
{
/**
* 状态码为0
*/
public
final
static
String
RESPONSE_CODE
=
"0"
;
/**
* 值为null
*/
public
final
static
String
RESULT_NULL
=
"null"
;
/**
* 值为2
*/
public
final
static
int
RESULT_TWO
=
2
;
/**
* 值为“ ”
*/
public
final
static
String
RESULT_IS_NULL
=
" "
;
/**
* 值为8
*/
public
final
static
int
RESULT_EIGHT
=
8
;
/**
* 值为\t
*/
public
final
static
String
RESULT_BY
=
"\t"
;
/**
* 值为 “Bearer”
*/
public
final
static
String
BEARER
=
"Bearer "
;
/**
* 资源根节点
*/
public
final
static
String
RESOURCE_ROOT_CODE
=
"0"
;
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/DicMap.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author 50519
* 数据字典服务约定俗称的,
* TODO: 后续迁移到redis
*/
public
class
DicMap
{
/**
* 现场检查项目状态(1:合格;2:良好;3:不合格)
*/
public
final
static
String
EK_APPROVAL_STATUS
=
"EK_APPROVAL_STATUS"
;
/**
* 现场检查项目状态对应的map
*/
public
final
static
HashMap
<
String
,
String
>
EK_APPROVAL_STATUS_MAP
=
new
HashMap
<
String
,
String
>(){{
put
(
"1"
,
"合格"
);
put
(
"2"
,
"良好"
);
put
(
"3"
,
"不合格"
);
}};
/**
* 路由地址 此路由地址放在最后,最后加载
*
*/
public
final
static
Map
<
String
,
HashMap
<
String
,
String
>>
ROUTE_MAP
=
new
HashMap
<
String
,
HashMap
<
String
,
String
>>(){{
put
(
"EK_APPROVAL_STATUS"
,
EK_APPROVAL_STATUS_MAP
);
}};
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/JsonResult.java
0 → 100644
View file @
f2005619
package
org
.
jeecg
.
modules
.
utils
;
import
cn.hutool.json.JSONObject
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 封装返回
* @param <T>
*/
public
class
JsonResult
<
T
>
extends
ResponseEntity
<
T
>
{
//TODO 下方常量为暂时性方案,后期统计完全后,归类到统一枚举或字典内
static
final
String
CONSTANT_TRUE
=
"true"
;
static
final
String
QR_CODE_FALSE
=
"验证码校验失败"
;
static
final
String
LOGIN_FOBIDDEN
=
"错误次数太多,15分钟后再尝试登录"
;
static
final
String
USER_STATUS_UNUSUAL
=
"用户处于禁用状态"
;
static
final
String
USER_DEL_FLAG
=
"用户处于注销状态"
;
static
final
String
CHANGE_PASSWORD
=
"密码复杂度不够,需要修改密码!"
;
public
JsonResult
(
List
data
,
MultiValueMap
<
String
,
String
>
header
,
String
code
)
{
super
((
T
)
data
,
header
,
Message
.
num2HttpStatus
(
code
));
}
public
JsonResult
(
String
code
,
T
data
)
{
super
(
data
,
Message
.
num2HttpStatus
(
code
));
}
public
static
<
T
>
JsonResult
<
T
>
created
(
T
data
)
{
return
new
JsonResult
(
"201"
,
data
);
}
public
static
<
T
>
JsonResult
<
T
>
success
(
T
data
)
{
return
new
JsonResult
(
"200"
,
data
);
}
public
static
<
T
>
JsonResult
<
T
>
success
(
String
msg
)
{
JSONObject
json
=
new
JSONObject
();
json
.
putOpt
(
"message"
,
msg
);
return
new
JsonResult
(
"200"
,
json
);
}
public
static
<
T
>
JsonResult
<
T
>
success
()
{
JSONObject
json
=
new
JSONObject
();
return
new
JsonResult
(
"200"
,
json
);
}
public
static
<
T
>
JsonResult
<
T
>
accepted
(
T
data
)
{
return
new
JsonResult
(
"202"
,
data
);
}
public
static
<
T
>
JsonResult
<
T
>
noContented
()
{
return
new
JsonResult
(
"204"
,
null
);
}
public
static
<
T
>
JsonResult
<
T
>
movedPermanently
(
T
data
)
{
return
new
JsonResult
(
"301"
,
data
);
}
public
static
<
T
>
JsonResult
<
T
>
found
(
T
data
)
{
return
new
JsonResult
(
"302"
,
data
);
}
public
static
<
T
>
JsonResult
<
T
>
paged
(
PageUtils
data
,
Map
<
String
,
Object
>
params
)
{
String
str
=
StringUtil
.
objectToString
(
params
.
get
(
"count"
));
if
(
null
!=
str
&&
CONSTANT_TRUE
.
equals
(
str
)){
MultiValueMap
<
String
,
String
>
header
=
new
LinkedMultiValueMap
<>();
header
.
add
(
"X-Total-Count"
,
String
.
valueOf
(
data
.
getTotalCount
()));
// 因为浏览器的安全策略获取不到header信息,此处将X-Total-Count数据暴露出来
header
.
add
(
"Access-Control-Expose-Headers"
,
"X-Total-Count"
);
return
new
JsonResult
(
data
.
getList
(),
header
,
"200"
);
}
else
{
return
new
JsonResult
(
"200"
,
data
.
getList
());
}
}
public
static
<
T
>
JsonResult
<
T
>
paged
(
Map
<
String
,
Object
>
map
,
Map
<
String
,
Object
>
params
)
{
String
str
=
(
String
)
params
.
get
(
"count"
);
if
(
null
!=
str
&&
CONSTANT_TRUE
.
equals
(
str
)){
MultiValueMap
<
String
,
String
>
header
=
new
LinkedMultiValueMap
<>();
header
.
add
(
"X-Total-Count"
,
String
.
valueOf
(
map
.
get
(
"total_count"
)));
// 因为浏览器的安全策略获取不到header信息,此处将X-Total-Count数据暴露出来
header
.
add
(
"Access-Control-Expose-Headers"
,
"X-Total-Count"
);
return
new
JsonResult
((
List
)
map
.
get
(
"list"
),
header
,
"200"
);
}
else
{
return
new
JsonResult
(
"200"
,
(
List
)
map
.
get
(
"list"
));
}
}
public
static
<
T
>
JsonResult
<
T
>
paged
(
PageUtils
data
,
CngcPage
model
)
{
Boolean
ifCount
=
model
.
isCount
();
if
(
null
!=
ifCount
&&
ifCount
){
MultiValueMap
<
String
,
String
>
header
=
new
LinkedMultiValueMap
<>();
header
.
add
(
"X-Total-Count"
,
String
.
valueOf
(
data
.
getTotalCount
()));
return
new
JsonResult
(
data
.
getList
(),
header
,
"200"
);
}
else
{
return
new
JsonResult
(
"200"
,
data
.
getList
());
}
}
public
static
<
T
>
JsonResult
<
T
>
unauthorized
(
String
msg
)
{
JSONObject
json
=
new
JSONObject
();
json
.
putOpt
(
"message"
,
msg
);
return
new
JsonResult
(
"401"
,
json
);
}
public
static
<
T
>
JsonResult
<
T
>
notFounded
()
{
return
new
JsonResult
(
"404"
,
null
);
}
public
static
<
T
>
JsonResult
<
T
>
failMsg
()
{
return
new
JsonResult
(
"422"
,
null
);
}
public
static
<
T
>
JsonResult
<
T
>
failMsg
(
String
msg
)
{
JSONObject
json
=
new
JSONObject
();
json
.
putOpt
(
"message"
,
msg
);
return
new
JsonResult
(
"422"
,
json
);
}
public
static
<
T
>
JsonResult
<
T
>
failMsg
(
String
code
,
String
msg
)
{
JSONObject
json
=
new
JSONObject
();
json
.
putOpt
(
"message"
,
msg
);
return
new
JsonResult
(
code
,
json
);
}
public
static
<
T
>
JsonResult
<
T
>
failMsg
(
T
data
)
{
return
new
JsonResult
(
"422"
,
data
);
}
//2021-10-28 shiruojiang
public
static
<
T
>
JsonResult
<
T
>
qrcodeFail
(){
com
.
alibaba
.
fastjson
.
JSONObject
obj
=
new
com
.
alibaba
.
fastjson
.
JSONObject
();
obj
.
put
(
"message"
,
QR_CODE_FALSE
);
obj
.
put
(
"qrcode"
,
true
);
return
new
JsonResult
(
"422"
,
obj
);
}
public
static
<
T
>
JsonResult
<
T
>
loginForbidden
(){
com
.
alibaba
.
fastjson
.
JSONObject
obj
=
new
com
.
alibaba
.
fastjson
.
JSONObject
();
obj
.
put
(
"message"
,
LOGIN_FOBIDDEN
);
obj
.
put
(
"qrcode"
,
true
);
return
new
JsonResult
(
"422"
,
obj
);
}
public
static
<
T
>
JsonResult
<
T
>
userStatusUnusual
(){
com
.
alibaba
.
fastjson
.
JSONObject
obj
=
new
com
.
alibaba
.
fastjson
.
JSONObject
();
obj
.
put
(
"message"
,
USER_STATUS_UNUSUAL
);
return
new
JsonResult
(
"422"
,
obj
);
}
public
static
<
T
>
JsonResult
<
T
>
userDelFlag
(){
com
.
alibaba
.
fastjson
.
JSONObject
obj
=
new
com
.
alibaba
.
fastjson
.
JSONObject
();
obj
.
put
(
"message"
,
USER_DEL_FLAG
);
return
new
JsonResult
(
"422"
,
obj
);
}
public
static
<
T
>
JsonResult
<
T
>
changePwd
(){
com
.
alibaba
.
fastjson
.
JSONObject
obj
=
new
com
.
alibaba
.
fastjson
.
JSONObject
();
obj
.
put
(
"message"
,
CHANGE_PASSWORD
);
obj
.
put
(
"changePassword"
,
true
);
return
new
JsonResult
(
"422"
,
obj
);
}
}
class
Message
<
T
>
{
public
static
HttpStatus
num2HttpStatus
(
String
code
)
{
HttpStatus
status
=
HttpStatus
.
NOT_FOUND
;
for
(
HttpStatus
httpStatus
:
HttpStatus
.
values
())
{
boolean
b
=
Integer
.
parseInt
(
code
)
==
httpStatus
.
value
();
if
(
b
)
{
return
httpStatus
;
}
}
return
status
;
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/PageUtils.java
0 → 100644
View file @
f2005619
/**
* Copyright (c) 中国兵器 All rights reserved.
*
* norincogroup
*
* 版权所有,侵权必究!
*/
package
org
.
jeecg
.
modules
.
utils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 分页工具类
*
* @author Sun
*/
public
class
PageUtils
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 总记录数
*/
private
int
totalCount
;
/**
* 每页记录数
*/
private
int
pageSize
;
/**
* 总页数
*/
private
int
totalPage
;
/**
* 当前页数
*/
private
int
currPage
;
/**
* 列表数据
*/
private
List
<?>
list
;
/**
* 分页
* @param list 列表数据
* @param totalCount 总记录数
* @param pageSize 每页记录数
* @param currPage 当前页数
*/
public
PageUtils
(
List
<?>
list
,
int
totalCount
,
int
pageSize
,
int
currPage
)
{
this
.
list
=
list
;
this
.
totalCount
=
totalCount
;
this
.
pageSize
=
pageSize
;
this
.
currPage
=
currPage
;
this
.
totalPage
=
(
int
)
Math
.
ceil
((
double
)
totalCount
/
pageSize
);
}
/**
* 分页
*/
public
PageUtils
(
IPage
<?>
page
)
{
this
.
list
=
page
.
getRecords
();
this
.
totalCount
=
(
int
)
page
.
getTotal
();
this
.
pageSize
=
(
int
)
page
.
getSize
();
this
.
currPage
=
(
int
)
page
.
getCurrent
();
this
.
totalPage
=
(
int
)
page
.
getPages
();
}
public
int
getTotalCount
()
{
return
totalCount
;
}
public
void
setTotalCount
(
int
totalCount
)
{
this
.
totalCount
=
totalCount
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
int
getTotalPage
()
{
return
totalPage
;
}
public
void
setTotalPage
(
int
totalPage
)
{
this
.
totalPage
=
totalPage
;
}
public
int
getCurrPage
()
{
return
currPage
;
}
public
void
setCurrPage
(
int
currPage
)
{
this
.
currPage
=
currPage
;
}
public
List
<?>
getList
()
{
return
list
;
}
public
void
setList
(
List
<?>
list
)
{
this
.
list
=
list
;
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/utils/StringUtil.java
0 → 100644
View file @
f2005619
This diff is collapsed.
Click to expand it.
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