Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
ad00c1e6
提交
ad00c1e6
authored
4月 14, 2022
作者:
谭志磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat : 新增字典功能,导入导出字典翻译
上级
713143a3
隐藏空白字符变更
内嵌
并排
正在显示
30 个修改的文件
包含
408 行增加
和
181 行删除
+408
-181
Car.java
app/src/main/java/com/yiring/app/domain/car/Car.java
+2
-2
CarRepository.java
...rc/main/java/com/yiring/app/domain/car/CarRepository.java
+19
-1
Video.java
app/src/main/java/com/yiring/app/domain/video/Video.java
+0
-3
CarQueryParam.java
...src/main/java/com/yiring/app/param/car/CarQueryParam.java
+1
-1
DictParam.java
app/src/main/java/com/yiring/app/param/dict/DictParam.java
+8
-2
DictQueryParam.java
...c/main/java/com/yiring/app/param/dict/DictQueryParam.java
+3
-0
DictTypeParam.java
...rc/main/java/com/yiring/app/param/dict/DictTypeParam.java
+5
-2
DictTypeQueryParam.java
...in/java/com/yiring/app/param/dict/DictTypeQueryParam.java
+2
-0
VideoParam.java
app/src/main/java/com/yiring/app/param/video/VideoParam.java
+49
-0
CarService.java
app/src/main/java/com/yiring/app/service/car/CarService.java
+11
-4
CarServiceImpl.java
.../java/com/yiring/app/service/car/impl/CarServiceImpl.java
+34
-13
DictService.java
...rc/main/java/com/yiring/app/service/dict/DictService.java
+4
-6
DictTypeService.java
...ain/java/com/yiring/app/service/dict/DictTypeService.java
+2
-10
DictServiceImpl.java
...ava/com/yiring/app/service/dict/impl/DictServiceImpl.java
+34
-16
DictTypeServiceImpl.java
...com/yiring/app/service/dict/impl/DictTypeServiceImpl.java
+15
-9
VideoService.java
.../main/java/com/yiring/app/service/video/VideoService.java
+20
-0
VideoServiceImpl.java
...a/com/yiring/app/service/video/impl/VideoServiceImpl.java
+39
-0
CarVo.java
app/src/main/java/com/yiring/app/vo/car/CarVo.java
+40
-12
CarController.java
app/src/main/java/com/yiring/app/web/car/CarController.java
+2
-2
DictController.java
...src/main/java/com/yiring/app/web/dict/DictController.java
+8
-10
DictTypeController.java
...main/java/com/yiring/app/web/dict/DictTypeController.java
+4
-11
VideoController.java
...c/main/java/com/yiring/app/web/video/VideoController.java
+37
-0
RedisCache.java
...rc/main/java/com/yiring/common/core/redis/RedisCache.java
+7
-6
Dict.java
...ommon/core/src/main/java/com/yiring/common/dict/Dict.java
+8
-10
DictRepository.java
.../src/main/java/com/yiring/common/dict/DictRepository.java
+4
-6
DictType.java
...n/core/src/main/java/com/yiring/common/dict/DictType.java
+8
-9
DictTypeRepository.java
.../main/java/com/yiring/common/dict/DictTypeRepository.java
+3
-9
Excel.java
...til/src/main/java/com/yiring/common/annotation/Excel.java
+29
-28
DictUtils.java
.../util/src/main/java/com/yiring/common/util/DictUtils.java
+3
-1
SpringUtil.java
...c/main/java/com/yiring/common/util/spring/SpringUtil.java
+7
-8
没有找到文件。
app/src/main/java/com/yiring/app/domain/car/Car.java
浏览文件 @
ad00c1e6
...
...
@@ -41,7 +41,7 @@ public class Car implements Serializable {
String
carNum
;
@Comment
(
"车辆类型"
)
@Excel
(
name
=
"车辆类型"
,
sort
=
2
)
@Excel
(
name
=
"车辆类型"
,
sort
=
2
,
dictType
=
"car_type"
)
String
carType
;
@Comment
(
"司机名称"
)
...
...
@@ -57,7 +57,7 @@ public class Car implements Serializable {
String
labelCard
;
@Comment
(
"标签卡状态"
)
@Excel
(
name
=
"标签卡状态"
,
sort
=
10
)
@Excel
(
name
=
"标签卡状态"
,
sort
=
10
,
dictType
=
"car_label_status"
)
String
labelCardStatus
;
@Comment
(
"所属单位id"
)
...
...
app/src/main/java/com/yiring/app/domain/car/CarRepository.java
浏览文件 @
ad00c1e6
...
...
@@ -11,4 +11,22 @@ import org.springframework.stereotype.Repository;
* 2022/4/11 13:42
*/
@Repository
public
interface
CarRepository
extends
JpaRepository
<
Car
,
Serializable
>,
JpaSpecificationExecutor
<
Car
>
{}
public
interface
CarRepository
extends
JpaRepository
<
Car
,
Serializable
>,
JpaSpecificationExecutor
<
Car
>
{
// /**
// * 检查是否存在相同车牌号登记
// *
// * @param param String 车牌号码
// * @return 是否存在
// */
// @Query("SELECT COUNT(c.id) FROM bs_car c where car_num=?1 and label_card_status <>'已收卡'")
// boolean hasCarInfoByCarNum(String param);
//
// /**
// * 检查是否存在相同手机号码登记
// *
// * @param param String 手机号码
// * @return 是否存在
// */
// @Query("SELECT COUNT(c.id) FROM bs_car c where driver_mobile=?1 and label_card_status <>'已收卡'")
// boolean hasCarInfoByMobile(String param);
}
app/src/main/java/com/yiring/app/domain/video/Video.java
浏览文件 @
ad00c1e6
...
...
@@ -50,9 +50,6 @@ public class Video implements Serializable {
@Comment
(
"标识"
)
String
uuid
;
/**
* rtsp 地址
*/
@Comment
(
"rtsp 媒体地址"
)
String
rtsp
;
...
...
app/src/main/java/com/yiring/app/param/car/CarQueryParam.java
浏览文件 @
ad00c1e6
...
...
@@ -11,7 +11,7 @@ import lombok.experimental.FieldDefaults;
* @author tzl
* 2022/4/12 11:11
*/
@ApiModel
(
"CarParam"
)
@ApiModel
(
"Car
Query
Param"
)
@Data
@Builder
@NoArgsConstructor
...
...
app/src/main/java/com/yiring/app/param/dict/DictParam.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dict
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
javax.validation.constraints.NotEmpty
;
/**
* @author tzl
* 2022/4/13 15:51
...
...
@@ -18,20 +18,26 @@ import javax.validation.constraints.NotEmpty;
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictParam
{
@ApiModelProperty
(
value
=
"排序"
,
example
=
"1"
,
required
=
true
)
Integer
dictSort
;
@ApiModelProperty
(
value
=
"字典标签"
,
example
=
"男"
,
required
=
true
)
@NotEmpty
(
message
=
"字典标签不能为空"
)
String
dictLabel
;
@ApiModelProperty
(
value
=
"字典值"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"字典值不能为空"
)
String
dictValue
;
@ApiModelProperty
(
value
=
"字典类型"
,
example
=
"user_sex"
,
required
=
true
)
@NotEmpty
(
message
=
"字典类型不能为空"
)
String
dictType
;
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"是否启用必填"
)
String
status
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"性别"
,
required
=
true
)
String
remark
;
}
app/src/main/java/com/yiring/app/param/dict/DictQueryParam.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dict
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -16,8 +17,10 @@ import lombok.experimental.FieldDefaults;
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictQueryParam
{
@ApiModelProperty
(
value
=
"字典标签"
,
example
=
"男"
)
String
dictLabel
;
@ApiModelProperty
(
value
=
"字典类型"
,
example
=
"user_sex"
)
String
dictType
;
}
app/src/main/java/com/yiring/app/param/dict/DictTypeParam.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dict
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
javax.validation.constraints.NotEmpty
;
/**
* @author tzl
* 2022/4/13 15:51
...
...
@@ -18,12 +18,15 @@ import javax.validation.constraints.NotEmpty;
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictTypeParam
{
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
,
required
=
true
)
@NotEmpty
(
message
=
"字典名称不能为空"
)
String
dictName
;
@ApiModelProperty
(
value
=
"字典类型"
,
example
=
"user_sex"
,
required
=
true
)
@NotEmpty
(
message
=
"字典类型不能为空"
)
String
dictType
;
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"是否启用必填"
)
String
status
;
...
...
app/src/main/java/com/yiring/app/param/dict/DictTypeQueryParam.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dict
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -16,6 +17,7 @@ import lombok.experimental.FieldDefaults;
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictTypeQueryParam
{
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
)
String
dictName
;
}
app/src/main/java/com/yiring/app/param/video/VideoParam.java
0 → 100644
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
video
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
org.locationtech.jts.geom.Point
;
/**
* 监控视频入参类
*
* @author tzl
* 2022/4/8 16:07
*/
@ApiModel
(
"VideoParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoParam
implements
Serializable
{
@ApiModelProperty
(
value
=
"标识"
,
example
=
""
,
required
=
true
)
@NotEmpty
(
message
=
"标识不能为空"
)
String
uuid
;
@ApiModelProperty
(
value
=
"rtsp 媒体地址"
,
example
=
""
,
required
=
true
)
@NotEmpty
(
message
=
"rtsp 媒体地址不能为空"
)
String
rtsp
;
@ApiModelProperty
(
value
=
"m3u8 地址"
,
example
=
""
)
@NotEmpty
(
message
=
"m3u8 地址不能为空"
)
String
m3u8
;
@ApiModelProperty
(
value
=
"坐标点信息"
,
example
=
""
)
Point
point
;
@ApiModelProperty
(
value
=
"分类"
,
example
=
""
)
String
type
;
@ApiModelProperty
(
value
=
"是否在线"
,
example
=
""
)
Boolean
online
;
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
""
)
Boolean
enable
;
}
app/src/main/java/com/yiring/app/service/car/CarService.java
浏览文件 @
ad00c1e6
...
...
@@ -53,7 +53,7 @@ public interface CarService {
* 删除车辆来访信息
*
* @param idParam IdParam
* @return
* @return
String
*/
Result
<
String
>
deleteCarInfo
(
IdParam
idParam
);
...
...
@@ -79,15 +79,22 @@ public interface CarService {
List
<
Car
>
export
(
CarQueryParam
carParam
);
/**
* 检查是否存在相同车牌号
* 检查是否存在相同车牌号
登记
*
* @param param String
* @param param String
车牌号码
* @return 是否存在
*/
boolean
hasCarInfo
(
String
param
);
boolean
hasCarInfo
ByCarNum
(
String
param
);
/**
* 检查是否存在相同手机号码登记
*
* @param param String 手机号码
* @return 是否存在
*/
boolean
hasCarInfoByMobile
(
String
param
);
/**
* @param carParam CarQueryParam
* @return Specification
*/
...
...
app/src/main/java/com/yiring/app/service/car/impl/CarServiceImpl.java
浏览文件 @
ad00c1e6
...
...
@@ -43,11 +43,16 @@ public class CarServiceImpl implements CarService {
@Override
public
Result
<
Long
>
saveCarInfo
(
CarParam
carParam
)
{
// 检查车牌号是否已存在
if
(
hasCarInfo
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"车牌号重复"
);
if
(
hasCarInfoByCarNum
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的车牌号已预约登记"
);
}
// 检查司机手机号码号是否已存在
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已预约登记"
);
}
Car
car
=
Car
.
builder
()
.
labelCardStatus
(
"未发卡"
)
.
carNum
(
carParam
.
getCarNum
())
.
carType
(
carParam
.
getCarType
())
.
driverMobile
(
carParam
.
getDriverMobile
())
...
...
@@ -68,17 +73,22 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
car
=
optional
.
get
();
//如果标签卡在使用中无法修改
if
(
StringUtils
.
isNotBlank
(
car
.
getLabelCardStatus
())
&&
"使用中"
.
equals
(
car
.
getLabelCardStatus
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法修改"
);
}
if
(!
car
.
getCarNum
().
equals
(
carParam
.
getCarNum
()))
{
// 当修改车牌号时才检查重复
if
(
hasCarInfo
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"
车牌号重复
"
);
if
(
hasCarInfo
ByCarNum
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"
您的车牌号已预约登记
"
);
}
//如果标签卡在使用中无法修改
if
(
StringUtils
.
isNotBlank
(
car
.
getLabelCardStatus
())
&&
"使用中"
.
equals
(
car
.
getLabelCardStatus
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法修改"
);
}
if
(!
car
.
getDriverMobile
().
equals
(
carParam
.
getDriverMobile
()))
{
// 当修改联系方式时才检查重复
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已预约登记"
);
}
}
BeanUtils
.
copyProperties
(
carParam
,
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
...
...
@@ -90,7 +100,6 @@ public class CarServiceImpl implements CarService {
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"已收卡"
);
car
.
setCardRecTime
(
LocalDateTime
.
now
());
...
...
@@ -119,7 +128,7 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
//
已经发卡
的信息无法删除
//
正在使用中
的信息无法删除
Car
entity
=
optional
.
get
();
if
(
entity
.
getLabelCardStatus
().
equals
(
"使用中"
))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法删除"
);
...
...
@@ -162,9 +171,21 @@ public class CarServiceImpl implements CarService {
}
@Override
public
boolean
hasCarInfo
(
String
param
)
{
Car
entity
=
Car
.
builder
().
carNum
(
param
).
build
();
return
carRepository
.
count
(
Example
.
of
(
entity
))
>
0
;
public
boolean
hasCarInfoByCarNum
(
String
param
)
{
Car
entity
=
Car
.
builder
().
carNum
(
param
).
labelCardStatus
(
"未发卡"
).
build
();
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
entity
=
Car
.
builder
().
carNum
(
param
).
labelCardStatus
(
"使用中"
).
build
();
long
count1
=
carRepository
.
count
(
Example
.
of
(
entity
));
return
count
+
count1
>
0
;
}
@Override
public
boolean
hasCarInfoByMobile
(
String
param
)
{
Car
entity
=
Car
.
builder
().
driverMobile
(
param
).
labelCardStatus
(
"未发卡"
).
build
();
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
entity
=
Car
.
builder
().
driverMobile
(
param
).
labelCardStatus
(
"使用中"
).
build
();
long
count1
=
carRepository
.
count
(
Example
.
of
(
entity
));
return
count
+
count1
>
0
;
}
@Override
...
...
app/src/main/java/com/yiring/app/service/dict/DictService.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.common.vo.PageVo
;
import
java.util.ArrayList
;
/**
...
...
@@ -94,6 +93,5 @@ public interface DictService {
/**
* 加载字典缓存
*/
void
loadingDictCache
();
void
loadingDictCache
();
}
app/src/main/java/com/yiring/app/service/dict/DictTypeService.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.app.param.dict.DictTypeParam
;
import
com.yiring.app.param.dict.DictTypeQueryParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.dict.DictType
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
java.util.ArrayList
;
/**
* @author tzl
* 2022/4/14 14:10
*/
public
interface
DictTypeService
{
/**
* 根据条件分页查询字典类型
*
...
...
@@ -28,15 +22,13 @@ public interface DictTypeService {
*/
Result
<
PageVo
<
DictType
>>
pageDictTypeInfo
(
DictTypeQueryParam
dictTypeQueryParam
,
PageParam
param
);
Result
<
DictType
>
getDictTypeInfo
(
Long
id
);
Result
<
String
>
delecteById
(
Long
id
);
Result
<
String
>
saveDictTypeInfo
(
DictTypeParam
dictTypeParam
);
Result
<
String
>
updateDictTypeInfo
(
DictTypeParam
dictTypeParam
,
IdParam
idParam
);
Result
<
String
>
updateDictTypeInfo
(
DictTypeParam
dictTypeParam
,
IdParam
idParam
);
boolean
has
(
String
param
);
}
app/src/main/java/com/yiring/app/service/dict/impl/DictServiceImpl.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
.
impl
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.app.service.dict.DictService
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
...
...
@@ -7,24 +10,21 @@ import com.yiring.common.dict.Dict;
import
com.yiring.common.dict.DictRepository
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.common.util.DictUtils
;
import
com.yiring.common.util.StrUtils
;
import
com.yiring.common.vo.PageVo
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
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
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 字典
*
...
...
@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
*/
@Service
public
class
DictServiceImpl
implements
DictService
{
@Resource
DictRepository
dictRepository
;
...
...
@@ -50,15 +51,20 @@ public class DictServiceImpl implements DictService {
@Override
public
void
loadingDictCache
()
{
Dict
dict
=
Dict
.
builder
().
status
(
"1"
).
build
();
Map
<
String
,
List
<
Dict
>>
dictDataMap
=
dictRepository
.
findAll
(
Example
.
of
(
dict
)).
stream
().
collect
(
Collectors
.
groupingBy
(
Dict:
:
getDictType
));
Map
<
String
,
List
<
Dict
>>
dictDataMap
=
dictRepository
.
findAll
(
Example
.
of
(
dict
))
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
Dict:
:
getDictType
));
for
(
Map
.
Entry
<
String
,
List
<
Dict
>>
entry
:
dictDataMap
.
entrySet
())
{
DictUtils
.
setDictCache
(
entry
.
getKey
(),
entry
.
getValue
().
stream
().
sorted
(
Comparator
.
comparing
(
Dict:
:
getDictSort
)).
collect
(
Collectors
.
toList
()));
DictUtils
.
setDictCache
(
entry
.
getKey
(),
entry
.
getValue
().
stream
().
sorted
(
Comparator
.
comparing
(
Dict:
:
getDictSort
)).
collect
(
Collectors
.
toList
())
);
}
}
@Override
public
Result
<
PageVo
<
Dict
>>
pageDictInfo
(
DictQueryParam
dictQueryParam
,
PageParam
param
)
{
Page
<
Dict
>
all
=
dictRepository
.
findAll
(
condition
(
dictQueryParam
),
PageParam
.
toPageable
(
param
));
List
<
Dict
>
data
=
all
.
get
()
...
...
@@ -127,7 +133,6 @@ public class DictServiceImpl implements DictService {
@Override
public
Result
<
String
>
updateDictInfo
(
DictParam
dictParam
,
IdParam
idParam
)
{
Optional
<
Dict
>
optional
=
dictRepository
.
findById
(
idParam
.
getId
());
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
...
...
@@ -139,7 +144,10 @@ public class DictServiceImpl implements DictService {
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签已存在"
);
}
}
if
(!
entity
.
getDictValue
().
equals
(
dictParam
.
getDictValue
())
||
!
entity
.
getDictType
().
equals
(
dictParam
.
getDictType
()))
{
if
(
!
entity
.
getDictValue
().
equals
(
dictParam
.
getDictValue
())
||
!
entity
.
getDictType
().
equals
(
dictParam
.
getDictType
())
)
{
//当修改了字典类型或字典值时
if
(
hasValue
(
dictParam
.
getDictType
(),
dictParam
.
getDictValue
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"该类型,字典值已存在"
);
...
...
@@ -156,11 +164,21 @@ public class DictServiceImpl implements DictService {
return
(
root
,
query
,
criteriaBuilder
)
->
{
List
<
Predicate
>
list
=
new
ArrayList
<>();
if
(
StrUtils
.
isNotBlank
(
dictQueryParam
.
getDictType
()))
{
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictType"
).
as
(
String
.
class
),
"%"
+
dictQueryParam
.
getDictType
()
+
"%"
));
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictType"
).
as
(
String
.
class
),
"%"
+
dictQueryParam
.
getDictType
()
+
"%"
)
);
}
if
(
StrUtils
.
isNotBlank
(
dictQueryParam
.
getDictLabel
()))
{
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictLabel"
).
as
(
String
.
class
),
"%"
+
dictQueryParam
.
getDictLabel
()
+
"%"
));
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictLabel"
).
as
(
String
.
class
),
"%"
+
dictQueryParam
.
getDictLabel
()
+
"%"
)
);
}
Predicate
[]
predicates
=
new
Predicate
[
list
.
size
()];
query
.
where
(
list
.
toArray
(
predicates
));
...
...
app/src/main/java/com/yiring/app/service/dict/impl/DictTypeServiceImpl.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
.
impl
;
import
com.yiring.app.param.dict.DictTypeParam
;
...
...
@@ -14,18 +15,17 @@ import com.yiring.common.param.PageParam;
import
com.yiring.common.util.DictUtils
;
import
com.yiring.common.util.StrUtils
;
import
com.yiring.common.vo.PageVo
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
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
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 字典类型
*
...
...
@@ -34,8 +34,10 @@ import java.util.stream.Collectors;
*/
@Service
public
class
DictTypeServiceImpl
implements
DictTypeService
{
@Resource
DictTypeRepository
dictTypeRepository
;
@Resource
DictRepository
dictRepository
;
...
...
@@ -112,7 +114,7 @@ public class DictTypeServiceImpl implements DictTypeService {
//查询该字典类型下的字典值数据
List
<
Dict
>
byDictType
=
dictRepository
.
findByDictType
(
dictType
.
getDictType
());
//添加新缓存
DictUtils
.
setDictCache
(
dictType
.
getDictType
(),
byDictType
);
DictUtils
.
setDictCache
(
dictType
.
getDictType
(),
byDictType
);
return
Result
.
ok
();
}
...
...
@@ -122,12 +124,16 @@ public class DictTypeServiceImpl implements DictTypeService {
return
dictTypeRepository
.
count
(
Example
.
of
(
dictType
))
>
0
;
}
public
Specification
<
DictType
>
condition
(
DictTypeQueryParam
dictTypeQueryParam
)
{
return
(
root
,
query
,
criteriaBuilder
)
->
{
List
<
Predicate
>
list
=
new
ArrayList
<>();
if
(
StrUtils
.
isNotBlank
(
dictTypeQueryParam
.
getDictName
()))
{
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictType"
).
as
(
String
.
class
),
"%"
+
dictTypeQueryParam
.
getDictName
()
+
"%"
));
list
.
add
(
criteriaBuilder
.
like
(
root
.
get
(
"dictType"
).
as
(
String
.
class
),
"%"
+
dictTypeQueryParam
.
getDictName
()
+
"%"
)
);
}
Predicate
[]
predicates
=
new
Predicate
[
list
.
size
()];
query
.
where
(
list
.
toArray
(
predicates
));
...
...
app/src/main/java/com/yiring/app/service/video/VideoService.java
0 → 100644
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
video
;
import
com.yiring.app.param.video.VideoParam
;
import
com.yiring.common.core.Result
;
/**
* @author tzl
* 2022/4/8 15:28
*/
public
interface
VideoService
{
/**
* 监控视频点位添加
* @param videoParam VideoParam
* @return Result<String>
* @author tzl
* @date 2022/4/8 16:23
*/
Result
<
String
>
saveVideo
(
VideoParam
videoParam
);
}
app/src/main/java/com/yiring/app/service/video/impl/VideoServiceImpl.java
0 → 100644
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
video
.
impl
;
import
com.yiring.app.domain.video.Video
;
import
com.yiring.app.domain.video.VideoRepository
;
import
com.yiring.app.param.video.VideoParam
;
import
com.yiring.app.service.video.VideoService
;
import
com.yiring.common.core.Result
;
import
java.time.LocalDateTime
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Service
;
/**
* @author tzl
* 2022/4/8 15:28
*/
@Service
public
class
VideoServiceImpl
implements
VideoService
{
@Resource
VideoRepository
videoRepository
;
@Override
public
Result
<
String
>
saveVideo
(
VideoParam
videoParam
)
{
Video
video
=
Video
.
builder
()
.
createTime
(
LocalDateTime
.
now
())
.
enable
(
videoParam
.
getEnable
())
.
m3u8
(
videoParam
.
getM3u8
())
.
point
(
videoParam
.
getPoint
())
.
rtsp
(
videoParam
.
getRtsp
())
.
online
(
videoParam
.
getOnline
())
.
type
(
videoParam
.
getType
())
.
uuid
(
videoParam
.
getUuid
())
.
build
();
videoRepository
.
saveAndFlush
(
video
);
return
Result
.
ok
();
}
}
app/src/main/java/com/yiring/app/vo/car/CarVo.java
浏览文件 @
ad00c1e6
...
...
@@ -2,12 +2,14 @@
package
com
.
yiring
.
app
.
vo
.
car
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yiring.common.util.DictUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
org.apache.commons.lang3.StringUtils
;
/**
* @author tzl
...
...
@@ -21,42 +23,68 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarVo
implements
Serializable
{
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
""
)
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"
湘A99999
"
)
String
carNum
;
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
""
)
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
"
1
"
)
String
carType
;
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
""
)
/**
* 车辆类型翻译
*/
@ApiModelProperty
(
value
=
"车辆类型(字典翻译)"
,
example
=
"货车"
)
String
carTypeName
;
public
String
getCarTypeName
()
{
if
(
StringUtils
.
isNotBlank
(
carType
))
{
return
DictUtils
.
getDictLabel
(
"car_type"
,
carType
);
}
return
null
;
}
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
)
String
driverName
;
@ApiModelProperty
(
value
=
"司机电话"
,
example
=
""
)
@ApiModelProperty
(
value
=
"司机电话"
,
example
=
"
17688888888
"
)
String
driverMobile
;
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
""
)
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"
DT8875666
"
)
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
""
)
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"
1
"
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"单位id"
,
example
=
""
)
/**
* 车辆类型翻译
*/
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"未发卡"
)
String
labelCardStatusName
;
public
String
getLabelCardStatusName
()
{
if
(
StringUtils
.
isNotBlank
(
carType
))
{
return
DictUtils
.
getDictLabel
(
"car_label_status"
,
labelCardStatus
);
}
return
null
;
}
@ApiModelProperty
(
value
=
"单位id"
,
example
=
"湖南壹润科技"
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
""
)
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"
1
"
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
""
)
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"
装货
"
)
String
reason
;
@ApiModelProperty
(
value
=
"收卡时间"
,
example
=
""
)
@ApiModelProperty
(
value
=
"收卡时间"
,
example
=
"
2022-04-11 17:25:33
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardRecTime
;
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
""
)
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
"
2022-04-11 17:25:33
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
createTime
;
@ApiModelProperty
(
value
=
"发卡时间"
,
example
=
""
)
@ApiModelProperty
(
value
=
"发卡时间"
,
example
=
"
2022-04-11 17:25:33
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardSendTime
;
}
app/src/main/java/com/yiring/app/web/car/CarController.java
浏览文件 @
ad00c1e6
...
...
@@ -9,7 +9,7 @@ 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.util.poi.ExcelUtil
s
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -88,7 +88,7 @@ public class CarController {
@PostMapping
(
"exportCarInfo"
)
public
void
exportCarInfo
(
HttpServletResponse
response
,
@Valid
CarQueryParam
carParam
)
{
List
<
Car
>
export
=
carService
.
export
(
carParam
);
ExcelUtil
<
Car
>
util
=
new
ExcelUtil
<>(
Car
.
class
);
ExcelUtil
s
<
Car
>
util
=
new
ExcelUtils
<>(
Car
.
class
);
util
.
exportExcel
(
response
,
export
,
"车辆来访信息"
);
}
}
app/src/main/java/com/yiring/app/web/dict/DictController.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
dict
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.app.service.dict.DictService
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.ArrayList
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -18,10 +22,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
java.util.ArrayList
;
/**
* 字典数据控制器
* @author tzl
...
...
@@ -33,6 +33,7 @@ import java.util.ArrayList;
@RestController
@RequestMapping
(
"/Dict/"
)
public
class
DictController
{
@Resource
DictService
dictService
;
...
...
@@ -48,14 +49,12 @@ public class DictController {
return
dictService
.
updateDictInfo
(
dictParam
,
idParam
);
}
@ApiOperation
(
value
=
"删除字典信息"
)
@PostMapping
(
"deleteDictById"
)
public
Result
<
String
>
deleteDictById
(
@Valid
IdParam
idParam
)
{
return
dictService
.
deleteDictById
(
idParam
);
}
@ApiOperation
(
value
=
"查看字典信息(分页)"
)
@GetMapping
(
"pageDictInfo"
)
public
Result
<
PageVo
<
Dict
>>
pageDictInfo
(
@Valid
DictQueryParam
queryParam
,
@Valid
PageParam
param
)
{
...
...
@@ -74,5 +73,4 @@ public class DictController {
public
Result
<
ArrayList
<
Dict
>>
selectDict
(
String
dictType
)
{
return
dictService
.
selectDict
(
dictType
);
}
}
app/src/main/java/com/yiring/app/web/dict/DictTypeController.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
dict
;
import
com.yiring.app.param.dict.DictParam
;
import
com.yiring.app.param.dict.DictQueryParam
;
import
com.yiring.app.param.dict.DictTypeParam
;
import
com.yiring.app.param.dict.DictTypeQueryParam
;
import
com.yiring.app.service.dict.DictService
;
import
com.yiring.app.service.dict.DictTypeService
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.dict.DictType
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -22,10 +20,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
java.util.ArrayList
;
/**
* 字典类型控制器
* @author tzl
...
...
@@ -37,6 +31,7 @@ import java.util.ArrayList;
@RestController
@RequestMapping
(
"/DictType/"
)
public
class
DictTypeController
{
@Resource
DictTypeService
dictTypeService
;
...
...
@@ -52,14 +47,12 @@ public class DictTypeController {
return
dictTypeService
.
updateDictTypeInfo
(
dictTypeParam
,
idParam
);
}
@ApiOperation
(
value
=
"删除字典类型信息"
)
@PostMapping
(
"delecteById"
)
public
Result
<
String
>
delecteById
(
@Valid
IdParam
idParam
)
{
return
dictTypeService
.
delecteById
(
idParam
.
getId
());
}
@ApiOperation
(
value
=
"查看字典类型信息(分页)"
)
@GetMapping
(
"pageDictTypeInfo"
)
public
Result
<
PageVo
<
DictType
>>
pageDictInfo
(
@Valid
DictTypeQueryParam
queryParam
,
@Valid
PageParam
param
)
{
...
...
app/src/main/java/com/yiring/app/web/video/VideoController.java
0 → 100644
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
video
;
import
com.yiring.app.param.video.VideoParam
;
import
com.yiring.app.service.video.VideoService
;
import
com.yiring.common.core.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
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/8 16:51
*/
@Slf4j
@Validated
@Api
(
tags
=
"Video"
)
@RestController
@RequestMapping
(
"/video/"
)
public
class
VideoController
{
@Resource
VideoService
videoService
;
@ApiOperation
(
value
=
"新增监控点位"
)
@PostMapping
(
"saveVideo"
)
public
Result
<
String
>
findLatest
(
@Valid
VideoParam
videoParam
)
{
return
videoService
.
saveVideo
(
videoParam
);
}
}
basic-common/core/src/main/java/com/yiring/common/core/redis/RedisCache.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
core
.
redis
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.BoundSetOperations
;
import
org.springframework.data.redis.core.HashOperations
;
...
...
@@ -7,12 +13,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
/**
* redis缓存 工具类
*
...
...
@@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit;
*/
@Component
public
class
RedisCache
{
@Autowired
public
RedisTemplate
redisTemplate
;
...
...
basic-common/core/src/main/java/com/yiring/common/dict/Dict.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
...
...
@@ -8,13 +14,6 @@ import org.hibernate.annotaions.Comment;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 字典表
*
...
...
@@ -30,7 +29,7 @@ import java.time.LocalDateTime;
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"SYS_DICT"
)
@Table
(
name
=
"SYS_DICT"
)
@Comment
(
"字典"
)
public
class
Dict
implements
Serializable
{
...
...
@@ -57,5 +56,4 @@ public class Dict implements Serializable {
@Comment
(
"创建时间"
)
LocalDateTime
createTime
;
}
basic-common/core/src/main/java/com/yiring/common/dict/DictRepository.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serializable
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author tzl
* 2022/4/13 15:32
*/
public
interface
DictRepository
extends
JpaRepository
<
Dict
,
Serializable
>,
JpaSpecificationExecutor
<
Dict
>
{
/**
* 根据字典类型和字典键值查询字典数据信息
*
...
...
@@ -37,6 +36,5 @@ public interface DictRepository extends JpaRepository<Dict, Serializable>, JpaSp
@Modifying
@Transactional
@Query
(
"update Dict set dictType=?1 where dictType=?2"
)
boolean
updateDictType
(
String
param
,
String
dictType
);
boolean
updateDictType
(
String
param
,
String
dictType
);
}
basic-common/core/src/main/java/com/yiring/common/dict/DictType.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
...
...
@@ -7,13 +14,6 @@ import org.hibernate.annotaions.Comment;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* @author tzl
* 2022/4/14 14:07
...
...
@@ -27,7 +27,7 @@ import java.time.LocalDateTime;
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"SYS_DICT_TYPE"
)
@Table
(
name
=
"SYS_DICT_TYPE"
)
@Comment
(
"字典类型"
)
public
class
DictType
implements
Serializable
{
...
...
@@ -48,5 +48,4 @@ public class DictType implements Serializable {
@Comment
(
"创建时间"
)
LocalDateTime
createTime
;
}
basic-common/core/src/main/java/com/yiring/common/dict/DictTypeRepository.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author tzl
* 2022/4/13 15:32
*/
public
interface
DictTypeRepository
extends
JpaRepository
<
DictType
,
Serializable
>,
JpaSpecificationExecutor
<
DictType
>
{
}
public
interface
DictTypeRepository
extends
JpaRepository
<
DictType
,
Serializable
>,
JpaSpecificationExecutor
<
DictType
>
{}
basic-common/util/src/main/java/com/yiring/common/annotation/Excel.java
浏览文件 @
ad00c1e6
...
...
@@ -15,113 +15,114 @@ import java.math.BigDecimal;
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
Excel
{
public
@interface
Excel
{
/**
* 导出时在excel中排序
*/
public
int
sort
()
default
Integer
.
MAX_VALUE
;
int
sort
()
default
Integer
.
MAX_VALUE
;
/**
* 导出到Excel中的名字.
*/
public
String
name
()
default
""
;
String
name
()
default
""
;
/**
* 日期格式, 如: yyyy-MM-dd
*/
public
String
dateFormat
()
default
""
;
String
dateFormat
()
default
""
;
/**
* 如果是字典类型,请设置字典的type值 (如: user_sex)
*/
public
String
dictType
()
default
""
;
String
dictType
()
default
""
;
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
public
String
readConverterExp
()
default
""
;
String
readConverterExp
()
default
""
;
/**
* 分隔符,读取字符串组内容
*/
public
String
separator
()
default
","
;
String
separator
()
default
","
;
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
public
int
scale
()
default
-
1
;
int
scale
()
default
-
1
;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
public
int
roundingMode
()
default
BigDecimal
.
ROUND_HALF_EVEN
;
int
roundingMode
()
default
BigDecimal
.
ROUND_HALF_EVEN
;
/**
* 导出类型(0数字 1字符串)
*/
public
ColumnType
cellType
()
default
ColumnType
.
STRING
;
ColumnType
cellType
()
default
ColumnType
.
STRING
;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
public
double
height
()
default
14
;
double
height
()
default
14
;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
public
double
width
()
default
16
;
double
width
()
default
16
;
/**
* 文字后缀,如% 90 变成90%
*/
public
String
suffix
()
default
""
;
String
suffix
()
default
""
;
/**
* 当值为空时,字段的默认值
*/
public
String
defaultValue
()
default
""
;
String
defaultValue
()
default
""
;
/**
* 提示信息
*/
public
String
prompt
()
default
""
;
String
prompt
()
default
""
;
/**
* 设置只能选择不能输入的列内容.
*/
public
String
[]
combo
()
default
{};
String
[]
combo
()
default
{};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
public
boolean
isExport
()
default
true
;
boolean
isExport
()
default
true
;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
public
String
targetAttr
()
default
""
;
String
targetAttr
()
default
""
;
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
public
boolean
isStatistics
()
default
false
;
boolean
isStatistics
()
default
false
;
/**
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
*/
public
Align
align
()
default
Align
.
AUTO
;
Align
align
()
default
Align
.
AUTO
;
/**
* 自定义数据处理器
*/
public
Class
<?>
handler
()
default
ExcelHandlerAdapter
.
class
;
Class
<?>
handler
()
default
ExcelHandlerAdapter
.
class
;
/**
* 自定义数据处理器参数
*/
public
String
[]
args
()
default
{};
String
[]
args
()
default
{};
public
enum
Align
enum
Align
{
AUTO
(
0
),
LEFT
(
1
),
CENTER
(
2
),
RIGHT
(
3
);
private
final
int
value
;
...
...
@@ -131,7 +132,7 @@ public @interface Excel {
this
.
value
=
value
;
}
public
int
value
()
public
int
value
()
{
return
this
.
value
;
}
...
...
@@ -142,7 +143,7 @@ public @interface Excel {
*/
Type
type
()
default
Type
.
ALL
;
public
enum
Type
enum
Type
{
ALL
(
0
),
EXPORT
(
1
),
IMPORT
(
2
);
private
final
int
value
;
...
...
@@ -152,13 +153,13 @@ public @interface Excel {
this
.
value
=
value
;
}
public
int
value
()
int
value
()
{
return
this
.
value
;
}
}
public
enum
ColumnType
enum
ColumnType
{
NUMERIC
(
0
),
STRING
(
1
),
IMAGE
(
2
);
private
final
int
value
;
...
...
@@ -168,7 +169,7 @@ public @interface Excel {
this
.
value
=
value
;
}
public
int
value
()
int
value
()
{
return
this
.
value
;
}
...
...
basic-common/util/src/main/java/com/yiring/common/util/DictUtils.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
;
import
com.yiring.common.core.redis.RedisCache
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.util.spring.SpringUtil
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -13,6 +13,7 @@ import java.util.List;
* @author tzl
*/
public
class
DictUtils
{
/**
* 分隔符
*/
...
...
@@ -41,6 +42,7 @@ public class DictUtils {
}
return
null
;
}
/**
* 根据字典类型和字典值获取字典标签
*
...
...
basic-common/util/src/main/java/com/yiring/common/util/spring/SpringUtil.java
浏览文件 @
ad00c1e6
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
spring
;
import
org.springframework.beans.BeansException
;
...
...
@@ -13,24 +14,23 @@ import org.springframework.stereotype.Component;
* @author ruoyi
*/
@Component
public
final
class
SpringUtil
implements
BeanFactoryPostProcessor
,
ApplicationContextAware
{
public
final
class
SpringUtil
implements
BeanFactoryPostProcessor
,
ApplicationContextAware
{
/** Spring应用上下文环境 */
private
static
ConfigurableListableBeanFactory
beanFactory
;
private
static
ApplicationContext
applicationContext
;
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
SpringUtil
.
beanFactory
=
beanFactory
;
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
SpringUtil
.
applicationContext
=
applicationContext
;
}
/**
* 获取类型为requiredType的对象
*
...
...
@@ -38,8 +38,7 @@ public final class SpringUtil implements BeanFactoryPostProcessor, ApplicationCo
* @return T
*
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clz
)
throws
BeansException
{
public
static
<
T
>
T
getBean
(
Class
<
T
>
clz
)
throws
BeansException
{
return
(
T
)
beanFactory
.
getBean
(
clz
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论