Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
fd72e226
提交
fd72e226
authored
4月 12, 2022
作者:
谭志磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 新增车辆管理,文件导出导入
上级
a3563bae
全部展开
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
1268 行增加
和
0 行删除
+1268
-0
Car.java
app/src/main/java/com/yiring/app/domain/car/Car.java
+90
-0
CarRepository.java
...rc/main/java/com/yiring/app/domain/car/CarRepository.java
+14
-0
CarParam.java
app/src/main/java/com/yiring/app/param/car/CarParam.java
+67
-0
CarQueryParam.java
...src/main/java/com/yiring/app/param/car/CarQueryParam.java
+60
-0
CarService.java
app/src/main/java/com/yiring/app/service/car/CarService.java
+95
-0
CarServiceImpl.java
.../java/com/yiring/app/service/car/impl/CarServiceImpl.java
+255
-0
CarVo.java
app/src/main/java/com/yiring/app/vo/car/CarVo.java
+62
-0
CarController.java
app/src/main/java/com/yiring/app/web/car/CarController.java
+94
-0
RegEx.java
.../core/src/main/java/com/yiring/common/constant/RegEx.java
+22
-0
Excel.java
...til/src/main/java/com/yiring/common/annotation/Excel.java
+172
-0
Excels.java
...il/src/main/java/com/yiring/common/annotation/Excels.java
+16
-0
Convert.java
...on/util/src/main/java/com/yiring/common/text/Convert.java
+0
-0
StrUtils.java
...n/util/src/main/java/com/yiring/common/util/StrUtils.java
+0
-0
DateUtils.java
.../src/main/java/com/yiring/common/util/date/DateUtils.java
+166
-0
FileTypeUtils.java
.../main/java/com/yiring/common/util/file/FileTypeUtils.java
+69
-0
ImageUtils.java
...src/main/java/com/yiring/common/util/file/ImageUtils.java
+67
-0
ExcelHandlerAdapter.java
.../java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
+16
-0
ExcelUtil.java
...l/src/main/java/com/yiring/common/util/poi/ExcelUtil.java
+0
-0
ReflectUtils.java
...ain/java/com/yiring/common/util/reflect/ReflectUtils.java
+0
-0
build.gradle
build.gradle
+3
-0
没有找到文件。
app/src/main/java/com/yiring/app/domain/car/Car.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
car
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yiring.common.annotation.Excel
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.annotaions.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
* @author tzl
* 2022/4/11 13:38
*/
@Getter
@Setter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"BS_CAR"
)
@Comment
(
"车辆"
)
public
class
Car
implements
Serializable
{
@Id
@Comment
(
"主键id"
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
@Comment
(
"车牌号"
)
@Excel
(
name
=
"车牌"
,
sort
=
1
)
String
carNum
;
@Comment
(
"车辆类型"
)
@Excel
(
name
=
"车辆类型"
,
sort
=
2
)
String
carType
;
@Comment
(
"司机名称"
)
@Excel
(
name
=
"司机"
,
sort
=
3
)
String
driverName
;
@Comment
(
"司机电话"
)
@Excel
(
name
=
"联系电话"
,
sort
=
4
)
String
driverMobile
;
@Comment
(
"标签卡"
)
@Excel
(
name
=
"标签卡"
,
sort
=
9
)
String
labelCard
;
@Comment
(
"标签卡状态"
)
@Excel
(
name
=
"标签卡状态"
,
sort
=
10
)
String
labelCardStatus
;
@Comment
(
"所属单位id"
)
@Excel
(
name
=
"所属单位"
,
sort
=
5
)
String
orgId
;
@Comment
(
"被访人id"
)
@Excel
(
name
=
"被访人"
,
sort
=
7
)
String
intervieweeId
;
@Comment
(
"来访原因"
)
@Excel
(
name
=
"来访原因"
,
sort
=
6
)
String
reason
;
@Comment
(
"收卡时间"
)
@Excel
(
name
=
"收卡时间"
,
sort
=
11
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardRecTime
;
@Comment
(
"创建时间"
)
@Excel
(
name
=
"到访时间"
,
sort
=
8
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
createTime
;
@Comment
(
"发卡时间"
)
LocalDateTime
cardSendTime
;
@Comment
(
"备用字段"
)
String
reserve4
;
}
app/src/main/java/com/yiring/app/domain/car/CarRepository.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
car
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author tzl
* 2022/4/11 13:42
*/
@Repository
public
interface
CarRepository
extends
JpaRepository
<
Car
,
Serializable
>,
JpaSpecificationExecutor
<
Car
>
{}
app/src/main/java/com/yiring/app/param/car/CarParam.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
car
;
import
com.yiring.common.constant.RegEx
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Size
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/11 14:00
*/
@ApiModel
(
"CarParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarParam
{
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A99999"
,
required
=
true
)
@NotEmpty
(
message
=
"车牌号码不能为空"
)
@Pattern
(
regexp
=
RegEx
.
CARNUM
,
message
=
"车牌号码格式不正确"
)
String
carNum
;
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
"轿车"
)
String
carType
;
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
,
required
=
true
)
@NotEmpty
(
message
=
"司机名称不能为空"
)
String
driverName
;
@ApiModelProperty
(
value
=
"司机电话"
,
example
=
"17688888888"
,
required
=
true
)
@NotEmpty
(
message
=
"司机电话不能为空"
)
@Pattern
(
regexp
=
RegEx
.
MOBILE
,
message
=
"手机号码格式不正确"
)
String
driverMobile
;
// @ApiModelProperty(value = "标签卡", example = "DW24515512")
// String labelCard;
//
// @ApiModelProperty(value = "标签卡状态", example = "使用中")
// String labelCardStatus;
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"所属单位id不能为空"
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"被访人id不能为空"
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"视察"
,
required
=
true
)
@NotEmpty
(
message
=
"来访原因不能为空"
)
@Size
(
min
=
2
,
max
=
20
,
message
=
"来访原因超出范围"
)
String
reason
;
// @ApiModelProperty(value = "收卡时间", example = "2022-04-11 17:25:33")
// LocalDateTime cardRecTime;
//
// @ApiModelProperty(value = "发卡时间", example = "2022-04-11 17:25:33")
// LocalDateTime cardSendTime;
// @ApiModelProperty(value = "创建时间", example = "")
// LocalDateTime createTime;
}
app/src/main/java/com/yiring/app/param/car/CarQueryParam.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
car
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/12 11:11
*/
@ApiModel
(
"CarParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarQueryParam
{
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A12345"
)
String
carNum
;
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
"轿车"
)
String
carType
;
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
)
String
driverName
;
@ApiModelProperty
(
value
=
"司机电话"
,
example
=
"17688888888"
)
String
driverMobile
;
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"DW24515512"
)
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"2"
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"视察"
)
String
reason
;
@ApiModelProperty
(
value
=
"收卡时间(开始)"
,
example
=
"2022-04-11 17:25:33"
)
LocalDateTime
cardRecTimeStart
;
@ApiModelProperty
(
value
=
"收卡时间(结束)"
,
example
=
"2022-04-11 17:26:33"
)
LocalDateTime
cardRecTimeEnd
;
@ApiModelProperty
(
value
=
"来访时间(开始)"
,
example
=
"2022-04-11 17:25:33"
)
LocalDateTime
createTimeStart
;
@ApiModelProperty
(
value
=
"来访时间(结束)"
,
example
=
"2022-04-11 17:26:33"
)
LocalDateTime
createTimeEnd
;
}
app/src/main/java/com/yiring/app/service/car/CarService.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
car
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.vo.car.CarVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
java.util.List
;
import
org.springframework.data.jpa.domain.Specification
;
/**
* @author tzl
* 2022/4/11 13:57
*/
public
interface
CarService
{
/**
* 添加车辆来访信息
*
* @param carParam CarParam
* @return 车辆来访信息id
*/
Result
<
Long
>
saveCarInfo
(
CarParam
carParam
);
/**
* 修改车辆来访信息
*
* @param carParam CarParam
* @return 修改的车辆来访信息id
*/
Result
<
Long
>
updateCarInfo
(
CarParam
carParam
,
IdParam
idParam
);
/**
* 收卡
*
* @param idParam IdParam
* @return 收卡信息id
*/
Result
<
Long
>
cardRec
(
IdParam
idParam
);
/**
* 发卡
*
* @param idParam IdParam
* @return 发卡信息id
*/
Result
<
Long
>
cardSend
(
IdParam
idParam
,
String
labelCard
);
/**
* 删除车辆来访信息
*
* @param idParam IdParam
* @return
*/
Result
<
String
>
deleteCarInfo
(
IdParam
idParam
);
/**
* 查询车辆来访信息详情
*
* @param idParam IdParam
* @return 车辆来访信息
*/
Result
<
CarVo
>
getCarInfo
(
IdParam
idParam
);
/**
* 查询车辆来访信息(分页)
*
* @param carParam CarParam
* @return 车辆来访信息分页数据
*/
Result
<
PageVo
<
CarVo
>>
PageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
);
/**
* 导出excel
*/
List
<
Car
>
export
(
CarQueryParam
carParam
);
/**
* 检查是否存在相同车牌号
*
* @param param String
* @return 是否存在
*/
boolean
hasCarInfo
(
String
param
);
/**
*
* @param carParam CarQueryParam
* @return Specification
*/
Specification
<
Car
>
condition
(
CarQueryParam
carParam
);
}
app/src/main/java/com/yiring/app/service/car/impl/CarServiceImpl.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
car
.
impl
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.domain.car.CarRepository
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.service.car.CarService
;
import
com.yiring.app.vo.car.CarVo
;
import
com.yiring.auth.domain.role.Role
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.util.StrUtils
;
import
com.yiring.common.util.date.DateUtils
;
import
com.yiring.common.vo.PageVo
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
/**
* @author tzl
* 2022/4/11 13:58
*/
@Service
public
class
CarServiceImpl
implements
CarService
{
@Resource
CarRepository
carRepository
;
@Override
public
Result
<
Long
>
saveCarInfo
(
CarParam
carParam
)
{
// 检查车牌号是否已存在
if
(
hasCarInfo
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"车牌号重复"
);
}
Car
car
=
Car
.
builder
()
.
carNum
(
carParam
.
getCarNum
())
.
carType
(
carParam
.
getCarType
())
.
driverMobile
(
carParam
.
getDriverMobile
())
.
driverName
(
carParam
.
getDriverName
())
.
intervieweeId
(
carParam
.
getIntervieweeId
())
.
orgId
(
carParam
.
getOrgId
())
.
reason
(
carParam
.
getReason
())
.
createTime
(
LocalDateTime
.
now
())
.
build
();
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
}
@Override
public
Result
<
Long
>
updateCarInfo
(
CarParam
carParam
,
IdParam
idParam
)
{
Optional
<
Car
>
optional
=
carRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
car
=
optional
.
get
();
if
(!
car
.
getCarNum
().
equals
(
carParam
.
getCarNum
()))
{
// 当修改车牌号时才检查重复
if
(
hasCarInfo
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"车牌号重复"
);
}
//如果标签卡在使用中无法修改
if
(
StringUtils
.
isNotBlank
(
car
.
getLabelCardStatus
())
&&
"使用中"
.
equals
(
car
.
getLabelCardStatus
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法修改"
);
}
}
BeanUtils
.
copyProperties
(
carParam
,
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
}
@Override
public
Result
<
Long
>
cardRec
(
IdParam
idParam
)
{
Optional
<
Car
>
optional
=
carRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"已收卡"
);
car
.
setCardRecTime
(
LocalDateTime
.
now
());
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
}
@Override
public
Result
<
Long
>
cardSend
(
IdParam
idParam
,
String
labelCard
)
{
Optional
<
Car
>
optional
=
carRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"使用中"
);
car
.
setCardSendTime
(
LocalDateTime
.
now
());
car
.
setLabelCard
(
labelCard
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
}
@Override
public
Result
<
String
>
deleteCarInfo
(
IdParam
idParam
)
{
Optional
<
Car
>
optional
=
carRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
//已经发卡的信息无法删除
Car
entity
=
optional
.
get
();
if
(
entity
.
getLabelCardStatus
().
equals
(
"使用中"
))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法删除"
);
}
carRepository
.
delete
(
entity
);
return
Result
.
ok
();
}
@Override
public
Result
<
CarVo
>
getCarInfo
(
IdParam
idParam
)
{
Optional
<
Car
>
optional
=
carRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
entity
=
optional
.
get
();
CarVo
vo
=
new
CarVo
();
BeanUtils
.
copyProperties
(
entity
,
vo
,
Role
.
Fields
.
permissions
);
return
Result
.
ok
(
vo
);
}
@Override
public
Result
<
PageVo
<
CarVo
>>
PageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
)
{
Page
<
Car
>
all
=
carRepository
.
findAll
(
condition
(
carParam
),
PageParam
.
toPageable
(
param
));
List
<
CarVo
>
data
=
all
.
get
()
.
map
(
car
->
{
CarVo
vo
=
new
CarVo
();
BeanUtils
.
copyProperties
(
car
,
vo
);
return
vo
;
})
.
collect
(
Collectors
.
toList
());
PageVo
<
CarVo
>
vo
=
PageVo
.
build
(
data
,
all
.
getTotalElements
());
return
Result
.
ok
(
vo
);
}
@Override
public
List
<
Car
>
export
(
CarQueryParam
carParam
)
{
return
carRepository
.
findAll
(
condition
(
carParam
));
}
@Override
public
boolean
hasCarInfo
(
String
param
)
{
Car
entity
=
Car
.
builder
().
carNum
(
param
).
build
();
return
carRepository
.
count
(
Example
.
of
(
entity
))
>
0
;
}
@Override
public
Specification
<
Car
>
condition
(
CarQueryParam
carParam
)
{
return
(
root
,
query
,
criteriaBuilder
)
->
{
List
<
Predicate
>
list
=
new
ArrayList
<>();
//查询条件
if
(
StrUtils
.
isNotBlank
(
carParam
.
getCarNum
()))
{
//车牌号码查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"carNum"
).
as
(
String
.
class
),
"%"
+
carParam
.
getCarNum
()
+
"%"
));
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getCarType
()))
{
//车辆类型查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"carType"
).
as
(
String
.
class
),
"%"
+
carParam
.
getCarType
()
+
"%"
));
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getDriverName
()))
{
//司机名称查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"driverName"
).
as
(
String
.
class
),
"%"
+
carParam
.
getDriverName
()
+
"%"
)
);
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getDriverMobile
()))
{
//司机电话号码查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"driverMobile"
).
as
(
String
.
class
),
"%"
+
carParam
.
getDriverMobile
()
+
"%"
)
);
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getOrgId
()))
{
//所属单位查询
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"orgId"
).
as
(
String
.
class
),
carParam
.
getOrgId
()));
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getReason
()))
{
//来访原因查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"reason"
).
as
(
String
.
class
),
"%"
+
carParam
.
getReason
()
+
"%"
));
}
if
(
StrUtils
.
isNotNull
(
carParam
.
getCreateTimeStart
())
&&
StrUtils
.
isNotNull
(
carParam
.
getCreateTimeEnd
()))
{
//来访时间区间段查询
list
.
add
(
criteriaBuilder
.
between
(
root
.
get
(
"createTime"
).
as
(
Date
.
class
),
DateUtils
.
toDate
(
carParam
.
getCreateTimeStart
()),
DateUtils
.
toDate
(
carParam
.
getCreateTimeEnd
())
)
);
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getLabelCard
()))
{
//标签卡号查询
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"labelCard"
).
as
(
String
.
class
),
"%"
+
carParam
.
getLabelCard
()
+
"%"
)
);
}
if
(
StrUtils
.
isNotBlank
(
carParam
.
getLabelCardStatus
()))
{
//标签卡状态查询
list
.
add
(
criteriaBuilder
.
equal
(
root
.
get
(
"labelCardStatus"
).
as
(
String
.
class
),
carParam
.
getLabelCardStatus
())
);
}
if
(
StrUtils
.
isNotNull
(
carParam
.
getCardRecTimeStart
())
&&
StrUtils
.
isNotNull
(
carParam
.
getCardRecTimeEnd
())
)
{
//来访时间区间段查询
list
.
add
(
criteriaBuilder
.
between
(
root
.
get
(
"cardRecTime"
).
as
(
Date
.
class
),
DateUtils
.
toDate
(
carParam
.
getCardRecTimeStart
()),
DateUtils
.
toDate
(
carParam
.
getCardRecTimeEnd
())
)
);
}
Predicate
[]
predicates
=
new
Predicate
[
list
.
size
()];
query
.
where
(
list
.
toArray
(
predicates
));
return
criteriaBuilder
.
and
(
list
.
toArray
(
predicates
));
};
}
}
app/src/main/java/com/yiring/app/vo/car/CarVo.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
car
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/11 14:52
*/
@ApiModel
(
"CarVo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarVo
implements
Serializable
{
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
""
)
String
carNum
;
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
""
)
String
carType
;
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
""
)
String
driverName
;
@ApiModelProperty
(
value
=
"司机电话"
,
example
=
""
)
String
driverMobile
;
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
""
)
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
""
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"单位id"
,
example
=
""
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
""
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
""
)
String
reason
;
@ApiModelProperty
(
value
=
"收卡时间"
,
example
=
""
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardRecTime
;
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
""
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
createTime
;
@ApiModelProperty
(
value
=
"发卡时间"
,
example
=
""
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardSendTime
;
}
app/src/main/java/com/yiring/app/web/car/CarController.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
car
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.service.car.CarService
;
import
com.yiring.app.vo.car.CarVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.util.poi.ExcelUtil
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 车辆来访信息控制器
*
* @author tzl
* 2022/4/11 17:02
*/
@Slf4j
@Validated
@Api
(
tags
=
"Car"
)
@RestController
@RequestMapping
(
"/Car/"
)
public
class
CarController
{
@Resource
CarService
carService
;
@ApiOperation
(
value
=
"新增车辆来访信息"
)
@PostMapping
(
"saveCarInfo"
)
public
Result
<
Long
>
saveCarInfo
(
@Valid
CarParam
carParam
)
{
return
carService
.
saveCarInfo
(
carParam
);
}
@ApiOperation
(
value
=
"修改车辆来访信息"
)
@PostMapping
(
"updateCarInfo"
)
public
Result
<
Long
>
updateCarInfo
(
@Valid
CarParam
carParam
,
@Valid
IdParam
idParam
)
{
return
carService
.
updateCarInfo
(
carParam
,
idParam
);
}
@ApiOperation
(
value
=
"收卡"
)
@PostMapping
(
"cardRec"
)
public
Result
<
Long
>
cardRec
(
@Valid
IdParam
idParam
)
{
return
carService
.
cardRec
(
idParam
);
}
@ApiOperation
(
value
=
"发卡"
)
@ApiImplicitParam
(
value
=
"标签卡"
,
example
=
"DW8544568"
,
required
=
true
,
name
=
"labelCard"
)
@PostMapping
(
"cardSend"
)
public
Result
<
Long
>
cardSend
(
@Valid
IdParam
idParam
,
String
labelCard
)
{
return
carService
.
cardSend
(
idParam
,
labelCard
);
}
@ApiOperation
(
value
=
"删除车辆来访信息"
)
@PostMapping
(
"deleteCarInfo"
)
public
Result
<
String
>
deleteCarInfo
(
@Valid
IdParam
idParam
)
{
return
carService
.
deleteCarInfo
(
idParam
);
}
@ApiOperation
(
value
=
"查看车辆来访信息详情"
)
@GetMapping
(
"getCarInfo"
)
public
Result
<
CarVo
>
getCarInfo
(
@Valid
IdParam
idParam
)
{
return
carService
.
getCarInfo
(
idParam
);
}
@ApiOperation
(
value
=
"查看车辆来访信息(分页)"
)
@GetMapping
(
"PageCarInfo"
)
public
Result
<
PageVo
<
CarVo
>>
PageCarInfo
(
@Valid
CarQueryParam
carParam
,
@Valid
PageParam
param
)
{
return
carService
.
PageCarInfo
(
carParam
,
param
);
}
@ApiOperation
(
value
=
"导出车辆来访信息"
)
@PostMapping
(
"exportCarInfo"
)
public
void
exportCarInfo
(
HttpServletResponse
response
,
@Valid
CarQueryParam
carParam
)
{
List
<
Car
>
export
=
carService
.
export
(
carParam
);
ExcelUtil
<
Car
>
util
=
new
ExcelUtil
<>(
Car
.
class
);
util
.
exportExcel
(
response
,
export
,
"车辆来访信息"
);
}
}
basic-common/core/src/main/java/com/yiring/common/constant/RegEx.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
constant
;
/**
* 常用相关验证正则表达式
* @author tzl
* 2022/4/12 12:00
*/
public
class
RegEx
{
//车牌号码验证
public
static
final
String
CARNUM
=
"([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]"
+
"{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([DF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[DF]"
+
"{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)"
+
"|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})"
+
"|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})"
;
//手机号码验证
public
static
final
String
MOBILE
=
"^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1、5、8、9]))\\d{8}$"
;
}
basic-common/util/src/main/java/com/yiring/common/annotation/Excel.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
com.yiring.common.util.poi.ExcelHandlerAdapter
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.math.BigDecimal
;
/**
* 自定义导出Excel数据注解
*
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
Excel
{
/**
* 导出时在excel中排序
*/
int
sort
()
default
Integer
.
MAX_VALUE
;
/**
* 导出到Excel中的名字.
*/
String
name
()
default
""
;
/**
* 日期格式, 如: yyyy-MM-dd
*/
String
dateFormat
()
default
""
;
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
String
readConverterExp
()
default
""
;
/**
* 分隔符,读取字符串组内容
*/
String
separator
()
default
","
;
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
int
scale
()
default
-
1
;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
int
roundingMode
()
default
BigDecimal
.
ROUND_HALF_EVEN
;
/**
* 导出类型(0数字 1字符串)
*/
ColumnType
cellType
()
default
ColumnType
.
STRING
;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
double
height
()
default
14
;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
double
width
()
default
16
;
/**
* 文字后缀,如% 90 变成90%
*/
String
suffix
()
default
""
;
/**
* 当值为空时,字段的默认值
*/
String
defaultValue
()
default
""
;
/**
* 提示信息
*/
String
prompt
()
default
""
;
/**
* 设置只能选择不能输入的列内容.
*/
String
[]
combo
()
default
{};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
boolean
isExport
()
default
true
;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
String
targetAttr
()
default
""
;
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
boolean
isStatistics
()
default
false
;
/**
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
*/
Align
align
()
default
Align
.
AUTO
;
/**
* 自定义数据处理器
*/
Class
<?>
handler
()
default
ExcelHandlerAdapter
.
class
;
/**
* 自定义数据处理器参数
*/
String
[]
args
()
default
{};
enum
Align
{
AUTO
(
0
),
LEFT
(
1
),
CENTER
(
2
),
RIGHT
(
3
);
private
final
int
value
;
Align
(
int
value
)
{
this
.
value
=
value
;
}
public
int
value
()
{
return
this
.
value
;
}
}
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type
type
()
default
Type
.
ALL
;
enum
Type
{
ALL
(
0
),
EXPORT
(
1
),
IMPORT
(
2
);
private
final
int
value
;
Type
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
enum
ColumnType
{
NUMERIC
(
0
),
STRING
(
1
),
IMAGE
(
2
);
private
final
int
value
;
ColumnType
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
}
basic-common/util/src/main/java/com/yiring/common/annotation/Excels.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Excel注解集
*/
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Excels
{
Excel
[]
value
();
}
basic-common/util/src/main/java/com/yiring/common/text/Convert.java
0 → 100644
浏览文件 @
fd72e226
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/StrUtils.java
0 → 100644
浏览文件 @
fd72e226
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/date/DateUtils.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
date
;
import
java.lang.management.ManagementFactory
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.util.Date
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
/**
* 时间工具类
*/
public
class
DateUtils
extends
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
{
public
static
String
YYYY
=
"yyyy"
;
public
static
String
YYYY_MM
=
"yyyy-MM"
;
public
static
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
private
static
final
String
[]
parsePatterns
=
{
"yyyy-MM-dd"
,
"yyyy-MM-dd HH:mm:ss"
,
"yyyy-MM-dd HH:mm"
,
"yyyy-MM"
,
"yyyy/MM/dd"
,
"yyyy/MM/dd HH:mm:ss"
,
"yyyy/MM/dd HH:mm"
,
"yyyy/MM"
,
"yyyy.MM.dd"
,
"yyyy.MM.dd HH:mm:ss"
,
"yyyy.MM.dd HH:mm"
,
"yyyy.MM"
,
};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public
static
Date
getNowDate
()
{
return
new
Date
();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public
static
String
getDate
()
{
return
dateTimeNow
(
YYYY_MM_DD
);
}
public
static
String
getTime
()
{
return
dateTimeNow
(
YYYY_MM_DD_HH_MM_SS
);
}
public
static
String
dateTimeNow
()
{
return
dateTimeNow
(
YYYYMMDDHHMMSS
);
}
public
static
String
dateTimeNow
(
final
String
format
)
{
return
parseDateToStr
(
format
,
new
Date
());
}
public
static
String
dateTime
(
final
Date
date
)
{
return
parseDateToStr
(
YYYY_MM_DD
,
date
);
}
public
static
String
parseDateToStr
(
final
String
format
,
final
Date
date
)
{
return
new
SimpleDateFormat
(
format
).
format
(
date
);
}
public
static
Date
dateTime
(
final
String
format
,
final
String
ts
)
{
try
{
return
new
SimpleDateFormat
(
format
).
parse
(
ts
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/
public
static
String
datePath
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyy/MM/dd"
);
}
/**
* 日期路径 即年/月/日 如20180808
*/
public
static
String
dateTime
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyyMMdd"
);
}
/**
* 日期型字符串转化为日期 格式
*/
public
static
Date
parseDate
(
Object
str
)
{
if
(
str
==
null
)
{
return
null
;
}
try
{
return
parseDate
(
str
.
toString
(),
parsePatterns
);
}
catch
(
ParseException
e
)
{
return
null
;
}
}
/**
* 获取服务器启动时间
*/
public
static
Date
getServerStartDate
()
{
long
time
=
ManagementFactory
.
getRuntimeMXBean
().
getStartTime
();
return
new
Date
(
time
);
}
/**
* 计算两个时间差
*/
public
static
String
getDatePoor
(
Date
endDate
,
Date
nowDate
)
{
long
nd
=
1000
*
24
*
60
*
60
;
long
nh
=
1000
*
60
*
60
;
long
nm
=
1000
*
60
;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long
diff
=
endDate
.
getTime
()
-
nowDate
.
getTime
();
// 计算差多少天
long
day
=
diff
/
nd
;
// 计算差多少小时
long
hour
=
diff
%
nd
/
nh
;
// 计算差多少分钟
long
min
=
diff
%
nd
%
nh
/
nm
;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return
day
+
"天"
+
hour
+
"小时"
+
min
+
"分钟"
;
}
/**
* 增加 LocalDateTime ==> Date
*/
public
static
Date
toDate
(
LocalDateTime
temporalAccessor
)
{
ZonedDateTime
zdt
=
temporalAccessor
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
/**
* 增加 LocalDate ==> Date
*/
public
static
Date
toDate
(
LocalDate
temporalAccessor
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
of
(
temporalAccessor
,
LocalTime
.
of
(
0
,
0
,
0
));
ZonedDateTime
zdt
=
localDateTime
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/FileTypeUtils.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.File
;
import
org.apache.commons.lang3.StringUtils
;
/**
* 文件类型工具类
*/
public
class
FileTypeUtils
{
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param file 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
File
file
)
{
if
(
null
==
file
)
{
return
StringUtils
.
EMPTY
;
}
return
getFileType
(
file
.
getName
());
}
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param fileName 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
String
fileName
)
{
int
separatorIndex
=
fileName
.
lastIndexOf
(
"."
);
if
(
separatorIndex
<
0
)
{
return
""
;
}
return
fileName
.
substring
(
separatorIndex
+
1
).
toLowerCase
();
}
/**
* 获取文件类型
*
* @param photoByte 文件字节码
* @return 后缀(不含".")
*/
public
static
String
getFileExtendName
(
byte
[]
photoByte
)
{
String
strFileExtendName
=
"JPG"
;
if
(
(
photoByte
[
0
]
==
71
)
&&
(
photoByte
[
1
]
==
73
)
&&
(
photoByte
[
2
]
==
70
)
&&
(
photoByte
[
3
]
==
56
)
&&
((
photoByte
[
4
]
==
55
)
||
(
photoByte
[
4
]
==
57
))
&&
(
photoByte
[
5
]
==
97
)
)
{
strFileExtendName
=
"GIF"
;
}
else
if
((
photoByte
[
6
]
==
74
)
&&
(
photoByte
[
7
]
==
70
)
&&
(
photoByte
[
8
]
==
73
)
&&
(
photoByte
[
9
]
==
70
))
{
strFileExtendName
=
"JPG"
;
}
else
if
((
photoByte
[
0
]
==
66
)
&&
(
photoByte
[
1
]
==
77
))
{
strFileExtendName
=
"BMP"
;
}
else
if
((
photoByte
[
1
]
==
80
)
&&
(
photoByte
[
2
]
==
78
)
&&
(
photoByte
[
3
]
==
71
))
{
strFileExtendName
=
"PNG"
;
}
return
strFileExtendName
;
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/ImageUtils.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.Arrays
;
import
org.apache.poi.util.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* 图片处理工具类
*/
public
class
ImageUtils
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ImageUtils
.
class
);
public
static
byte
[]
getImage
(
String
imagePath
)
{
InputStream
is
=
getFile
(
imagePath
);
try
{
return
IOUtils
.
toByteArray
(
is
);
}
catch
(
Exception
e
)
{
log
.
error
(
"图片加载异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
is
);
}
}
public
static
InputStream
getFile
(
String
imagePath
)
{
try
{
byte
[]
result
=
readFile
(
imagePath
);
result
=
Arrays
.
copyOf
(
result
,
result
.
length
);
return
new
ByteArrayInputStream
(
result
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取图片异常 {}"
,
e
);
}
return
null
;
}
/**
* 读取文件为字节数据
*
* @param url 地址
* @return 字节数据
*/
public
static
byte
[]
readFile
(
String
url
)
{
InputStream
in
=
null
;
try
{
// 网络地址
URL
urlObj
=
new
URL
(
url
);
URLConnection
urlConnection
=
urlObj
.
openConnection
();
urlConnection
.
setConnectTimeout
(
30
*
1000
);
urlConnection
.
setReadTimeout
(
60
*
1000
);
urlConnection
.
setDoInput
(
true
);
in
=
urlConnection
.
getInputStream
();
return
IOUtils
.
toByteArray
(
in
);
}
catch
(
Exception
e
)
{
log
.
error
(
"访问文件异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
in
);
}
}
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
0 → 100644
浏览文件 @
fd72e226
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
poi
;
/**
* Excel数据格式处理适配器
*/
public
interface
ExcelHandlerAdapter
{
/**
* 格式化
*
* @param value 单元格数据值
* @param args excel注解args参数组
* @return 处理后的值
*/
Object
format
(
Object
value
,
String
[]
args
);
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelUtil.java
0 → 100644
浏览文件 @
fd72e226
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/reflect/ReflectUtils.java
0 → 100644
浏览文件 @
fd72e226
差异被折叠。
点击展开。
build.gradle
浏览文件 @
fd72e226
...
...
@@ -70,6 +70,9 @@ subprojects {
compileOnly
'org.projectlombok:lombok'
annotationProcessor
'org.projectlombok:lombok'
annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
implementation
group:
'org.apache.poi'
,
name:
'poi'
,
version:
'5.0.0'
implementation
group:
'org.apache.poi'
,
name:
'poi-ooxml'
,
version:
'5.0.0'
implementation
group:
'org.apache.commons'
,
name:
'commons-lang3'
,
version:
'3.12.0'
}
[
compileJava
,
compileTestJava
,
javadoc
]*.
options
*.
encoding
=
'UTF-8'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论