Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
306331f2
提交
306331f2
authored
4月 14, 2022
作者:
谭志磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style: 车辆字典类型来访信息注释、代码修改,excel工具类代码格式优化
上级
038eaa6b
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
177 行增加
和
216 行删除
+177
-216
CarParam.java
app/src/main/java/com/yiring/app/param/car/CarParam.java
+1
-1
CarService.java
app/src/main/java/com/yiring/app/service/car/CarService.java
+1
-1
CarServiceImpl.java
.../java/com/yiring/app/service/car/impl/CarServiceImpl.java
+5
-5
DictService.java
...rc/main/java/com/yiring/app/service/dict/DictService.java
+4
-3
DictTypeService.java
...ain/java/com/yiring/app/service/dict/DictTypeService.java
+17
-25
DictTypeServiceImpl.java
...com/yiring/app/service/dict/impl/DictTypeServiceImpl.java
+106
-127
CarController.java
app/src/main/java/com/yiring/app/web/car/CarController.java
+3
-3
DictController.java
...src/main/java/com/yiring/app/web/dict/DictController.java
+1
-0
DictTypeController.java
...main/java/com/yiring/app/web/dict/DictTypeController.java
+35
-46
ExcelUtils.java
.../src/main/java/com/yiring/common/util/poi/ExcelUtils.java
+4
-5
没有找到文件。
app/src/main/java/com/yiring/app/param/car/CarParam.java
浏览文件 @
306331f2
...
@@ -27,7 +27,7 @@ public class CarParam {
...
@@ -27,7 +27,7 @@ public class CarParam {
@Pattern
(
regexp
=
RegEx
.
CARNUM
,
message
=
"车牌号码格式不正确"
)
@Pattern
(
regexp
=
RegEx
.
CARNUM
,
message
=
"车牌号码格式不正确"
)
String
carNum
;
String
carNum
;
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
"
轿车
"
)
@ApiModelProperty
(
value
=
"车辆类型"
,
example
=
"
1
"
)
String
carType
;
String
carType
;
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
,
required
=
true
)
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
,
required
=
true
)
...
...
app/src/main/java/com/yiring/app/service/car/CarService.java
浏览文件 @
306331f2
...
@@ -71,7 +71,7 @@ public interface CarService {
...
@@ -71,7 +71,7 @@ public interface CarService {
* @param carParam CarParam
* @param carParam CarParam
* @return 车辆来访信息分页数据
* @return 车辆来访信息分页数据
*/
*/
Result
<
PageVo
<
CarVo
>>
P
ageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
);
Result
<
PageVo
<
CarVo
>>
p
ageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
);
/**
/**
* 导出excel
* 导出excel
...
...
app/src/main/java/com/yiring/app/service/car/impl/CarServiceImpl.java
浏览文件 @
306331f2
...
@@ -52,7 +52,7 @@ public class CarServiceImpl implements CarService {
...
@@ -52,7 +52,7 @@ public class CarServiceImpl implements CarService {
}
}
Car
car
=
Car
Car
car
=
Car
.
builder
()
.
builder
()
.
labelCardStatus
(
"
未发卡
"
)
.
labelCardStatus
(
"
1
"
)
.
carNum
(
carParam
.
getCarNum
())
.
carNum
(
carParam
.
getCarNum
())
.
carType
(
carParam
.
getCarType
())
.
carType
(
carParam
.
getCarType
())
.
driverMobile
(
carParam
.
getDriverMobile
())
.
driverMobile
(
carParam
.
getDriverMobile
())
...
@@ -101,7 +101,7 @@ public class CarServiceImpl implements CarService {
...
@@ -101,7 +101,7 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
Car
car
=
optional
.
get
();
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"
已收卡
"
);
car
.
setLabelCardStatus
(
"
3
"
);
car
.
setCardRecTime
(
LocalDateTime
.
now
());
car
.
setCardRecTime
(
LocalDateTime
.
now
());
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
return
Result
.
ok
(
carReuslt
.
getId
());
...
@@ -114,7 +114,7 @@ public class CarServiceImpl implements CarService {
...
@@ -114,7 +114,7 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
Car
car
=
optional
.
get
();
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"
使用中
"
);
car
.
setLabelCardStatus
(
"
2
"
);
car
.
setCardSendTime
(
LocalDateTime
.
now
());
car
.
setCardSendTime
(
LocalDateTime
.
now
());
car
.
setLabelCard
(
labelCard
);
car
.
setLabelCard
(
labelCard
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
...
@@ -130,7 +130,7 @@ public class CarServiceImpl implements CarService {
...
@@ -130,7 +130,7 @@ public class CarServiceImpl implements CarService {
//正在使用中的信息无法删除
//正在使用中的信息无法删除
Car
entity
=
optional
.
get
();
Car
entity
=
optional
.
get
();
if
(
entity
.
getLabelCardStatus
().
equals
(
"使用中"
))
{
if
(
"使用中"
.
equals
(
entity
.
getLabelCardStatus
()
))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法删除"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法删除"
);
}
}
carRepository
.
delete
(
entity
);
carRepository
.
delete
(
entity
);
...
@@ -151,7 +151,7 @@ public class CarServiceImpl implements CarService {
...
@@ -151,7 +151,7 @@ public class CarServiceImpl implements CarService {
}
}
@Override
@Override
public
Result
<
PageVo
<
CarVo
>>
P
ageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
)
{
public
Result
<
PageVo
<
CarVo
>>
p
ageCarInfo
(
CarQueryParam
carParam
,
PageParam
param
)
{
Page
<
Car
>
all
=
carRepository
.
findAll
(
condition
(
carParam
),
PageParam
.
toPageable
(
param
));
Page
<
Car
>
all
=
carRepository
.
findAll
(
condition
(
carParam
),
PageParam
.
toPageable
(
param
));
List
<
CarVo
>
data
=
all
List
<
CarVo
>
data
=
all
.
get
()
.
get
()
...
...
app/src/main/java/com/yiring/app/service/dict/DictService.java
浏览文件 @
306331f2
...
@@ -36,8 +36,9 @@ public interface DictService {
...
@@ -36,8 +36,9 @@ public interface DictService {
/**
/**
* 从缓存中获取字典
* 从缓存中获取字典
* @param dictType
*
* @return
* @param dictType 字典类型
* @return 字典数据集合
*/
*/
Result
<
ArrayList
<
Dict
>>
selectDict
(
String
dictType
);
Result
<
ArrayList
<
Dict
>>
selectDict
(
String
dictType
);
...
@@ -84,7 +85,7 @@ public interface DictService {
...
@@ -84,7 +85,7 @@ public interface DictService {
/**
/**
* 是否该类型字典已有该字典值
* 是否该类型字典已有该字典值
*
*
* @param dictType String
* @param dictType
String
* @param dictValue String
* @param dictValue String
* @return 是否存在
* @return 是否存在
*/
*/
...
...
app/src/main/java/com/yiring/app/service/dict/DictTypeService.java
浏览文件 @
306331f2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
;
package
com
.
yiring
.
app
.
service
.
dict
;
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.DictType
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
/**
/**
* @author tzl
* @author tzl
* 2022/4/14 14:10
* 2022/4/14 14:10
*/
*/
public
interface
DictTypeService
{
public
interface
DictTypeService
{
/**
/
/ /
**
* 根据条件分页查询字典类型
//
* 根据条件分页查询字典类型
*
//
*
* @param dictTypeQueryParam DictTypeQueryParam
//
* @param dictTypeQueryParam DictTypeQueryParam
* @return 字典类型分页信息
//
* @return 字典类型分页信息
*/
//
*/
Result
<
PageVo
<
DictType
>>
pageDictTypeInfo
(
DictTypeQueryParam
dictTypeQueryParam
,
PageParam
param
);
//
Result<PageVo<DictType>> pageDictTypeInfo(DictTypeQueryParam dictTypeQueryParam, PageParam param);
//
Result
<
DictType
>
getDictTypeInfo
(
Long
id
);
//
Result<DictType> getDictTypeInfo(Long id);
//
Result
<
String
>
delecteById
(
Long
id
);
//
Result<String> delecteById(Long id);
//
Result
<
String
>
saveDictTypeInfo
(
DictTypeParam
dictTypeParam
);
//
Result<String> saveDictTypeInfo(DictTypeParam dictTypeParam);
//
Result
<
String
>
updateDictTypeInfo
(
DictTypeParam
dictTypeParam
,
IdParam
idParam
);
//
Result<String> updateDictTypeInfo(DictTypeParam dictTypeParam, IdParam idParam);
//
boolean
has
(
String
param
);
//
boolean has(String param);
}
}
app/src/main/java/com/yiring/app/service/dict/impl/DictTypeServiceImpl.java
浏览文件 @
306331f2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
dict
.
impl
;
package
com
.
yiring
.
app
.
service
.
dict
.
impl
;
import
com.yiring.app.param.dict.DictTypeParam
;
import
com.yiring.app.param.dict.DictTypeQueryParam
;
import
com.yiring.app.service.dict.DictTypeService
;
import
com.yiring.app.service.dict.DictTypeService
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.dict.DictRepository
;
import
com.yiring.common.dict.DictType
;
import
com.yiring.common.dict.DictTypeRepository
;
import
com.yiring.common.param.IdParam
;
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.*
;
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
org.springframework.stereotype.Service
;
/**
/**
...
@@ -34,110 +13,110 @@ import org.springframework.stereotype.Service;
...
@@ -34,110 +13,110 @@ import org.springframework.stereotype.Service;
*/
*/
@Service
@Service
public
class
DictTypeServiceImpl
implements
DictTypeService
{
public
class
DictTypeServiceImpl
implements
DictTypeService
{
//
@Resource
//
@Resource
DictTypeRepository
dictTypeRepository
;
//
DictTypeRepository dictTypeRepository;
//
@Resource
//
@Resource
DictRepository
dictRepository
;
//
DictRepository dictRepository;
//
@Override
//
@Override
public
Result
<
PageVo
<
DictType
>>
pageDictTypeInfo
(
DictTypeQueryParam
dictTypeQueryParam
,
PageParam
param
)
{
//
public Result<PageVo<DictType>> pageDictTypeInfo(DictTypeQueryParam dictTypeQueryParam, PageParam param) {
Page
<
DictType
>
all
=
dictTypeRepository
.
findAll
(
condition
(
dictTypeQueryParam
),
PageParam
.
toPageable
(
param
));
//
Page<DictType> all = dictTypeRepository.findAll(condition(dictTypeQueryParam), PageParam.toPageable(param));
List
<
DictType
>
data
=
all
//
List<DictType> data = all
.
get
()
//
.get()
.
map
(
car
->
{
//
.map(car -> {
DictType
vo
=
new
DictType
();
//
DictType vo = new DictType();
BeanUtils
.
copyProperties
(
car
,
vo
);
//
BeanUtils.copyProperties(car, vo);
return
vo
;
//
return vo;
})
//
})
.
collect
(
Collectors
.
toList
());
//
.collect(Collectors.toList());
PageVo
<
DictType
>
vo
=
PageVo
.
build
(
data
,
all
.
getTotalElements
());
//
PageVo<DictType> vo = PageVo.build(data, all.getTotalElements());
return
Result
.
ok
(
vo
);
//
return Result.ok(vo);
}
//
}
//
@Override
//
@Override
public
Result
<
DictType
>
getDictTypeInfo
(
Long
id
)
{
//
public Result<DictType> getDictTypeInfo(Long id) {
return
Result
.
ok
(
dictTypeRepository
.
getById
(
id
));
//
return Result.ok(dictTypeRepository.getById(id));
}
//
}
//
@Override
//
@Override
public
Result
<
String
>
delecteById
(
Long
id
)
{
//
public Result<String> delecteById(Long id) {
Optional
<
DictType
>
optional
=
dictTypeRepository
.
findById
(
id
);
//
Optional<DictType> optional = dictTypeRepository.findById(id);
if
(
optional
.
isEmpty
())
{
//
if (optional.isEmpty()) {
return
Result
.
no
(
Status
.
NOT_FOUND
);
//
return Result.no(Status.NOT_FOUND);
}
//
}
DictType
entity
=
optional
.
get
();
//
DictType entity = optional.get();
List
<
Dict
>
byDictType1
=
dictRepository
.
findByDictType
(
entity
.
getDictType
());
//
List<Dict> byDictType1 = dictRepository.findByDictType(entity.getDictType());
if
(
byDictType1
.
size
()
>
0
)
{
//
if (byDictType1.size() > 0) {
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"该类型下有字典数据,无法删除"
);
//
return Result.no(Status.BAD_REQUEST, "该类型下有字典数据,无法删除");
}
//
}
//
dictTypeRepository
.
delete
(
entity
);
//
dictTypeRepository.delete(entity);
//移除该类型缓存
//
//移除该类型缓存
DictUtils
.
removeDictCache
(
entity
.
getDictType
());
//
DictUtils.removeDictCache(entity.getDictType());
return
Result
.
ok
();
//
return Result.ok();
}
//
}
//
@Override
//
@Override
public
Result
<
String
>
saveDictTypeInfo
(
DictTypeParam
dictTypeParam
)
{
//
public Result<String> saveDictTypeInfo(DictTypeParam dictTypeParam) {
if
(
has
(
dictTypeParam
.
getDictType
()))
{
//
if (has(dictTypeParam.getDictType())) {
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"字典类型已存在"
);
//
return Result.no(Status.BAD_REQUEST, "字典类型已存在");
}
//
}
DictType
dictType
=
DictType
.
builder
().
createTime
(
LocalDateTime
.
now
()).
build
();
//
DictType dictType = DictType.builder().createTime(LocalDateTime.now()).build();
BeanUtils
.
copyProperties
(
dictTypeParam
,
dictType
);
//
BeanUtils.copyProperties(dictTypeParam, dictType);
dictTypeRepository
.
saveAndFlush
(
dictType
);
//
dictTypeRepository.saveAndFlush(dictType);
//添加空缓存
//
//添加空缓存
DictUtils
.
setDictCache
(
dictType
.
getDictType
(),
null
);
//
DictUtils.setDictCache(dictType.getDictType(), null);
return
Result
.
ok
();
//
return Result.ok();
}
//
}
//
@Override
//
@Override
public
Result
<
String
>
updateDictTypeInfo
(
DictTypeParam
dictTypeParam
,
IdParam
idParam
)
{
//
public Result<String> updateDictTypeInfo(DictTypeParam dictTypeParam, IdParam idParam) {
Optional
<
DictType
>
optional
=
dictTypeRepository
.
findById
(
idParam
.
getId
());
//
Optional<DictType> optional = dictTypeRepository.findById(idParam.getId());
if
(
optional
.
isEmpty
())
{
//
if (optional.isEmpty()) {
return
Result
.
no
(
Status
.
NOT_FOUND
);
//
return Result.no(Status.NOT_FOUND);
}
//
}
DictType
dictType
=
optional
.
get
();
//
DictType dictType = optional.get();
if
(!
dictType
.
getDictType
().
equals
(
dictTypeParam
.
getDictType
()))
{
//
if (!dictType.getDictType().equals(dictTypeParam.getDictType())) {
//在修改字典类型时
//
//在修改字典类型时
if
(
has
(
dictTypeParam
.
getDictType
()))
{
//
if (has(dictTypeParam.getDictType())) {
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"字典类型已存在"
);
//
return Result.no(Status.BAD_REQUEST, "字典类型已存在");
}
//
}
//将该字典类型下的字典数据一并修改
//
//将该字典类型下的字典数据一并修改
dictRepository
.
updateDictType
(
dictTypeParam
.
getDictType
(),
dictType
.
getDictType
());
//
dictRepository.updateDictType(dictTypeParam.getDictType(), dictType.getDictType());
//移除之前的缓存
//
//移除之前的缓存
DictUtils
.
removeDictCache
(
dictType
.
getDictType
());
//
DictUtils.removeDictCache(dictType.getDictType());
}
//
}
BeanUtils
.
copyProperties
(
dictTypeParam
,
dictType
);
//
BeanUtils.copyProperties(dictTypeParam, dictType);
dictTypeRepository
.
saveAndFlush
(
dictType
);
//
dictTypeRepository.saveAndFlush(dictType);
//查询该字典类型下的字典值数据
//
//查询该字典类型下的字典值数据
List
<
Dict
>
byDictType
=
dictRepository
.
findByDictType
(
dictType
.
getDictType
());
//
List<Dict> byDictType = dictRepository.findByDictType(dictType.getDictType());
//添加新缓存
//
//添加新缓存
DictUtils
.
setDictCache
(
dictType
.
getDictType
(),
byDictType
);
//
DictUtils.setDictCache(dictType.getDictType(), byDictType);
return
Result
.
ok
();
//
return Result.ok();
}
//
}
//
@Override
//
@Override
public
boolean
has
(
String
param
)
{
//
public boolean has(String param) {
DictType
dictType
=
DictType
.
builder
().
dictType
(
param
).
build
();
//
DictType dictType = DictType.builder().dictType(param).build();
return
dictTypeRepository
.
count
(
Example
.
of
(
dictType
))
>
0
;
//
return dictTypeRepository.count(Example.of(dictType)) > 0;
}
//
}
//
public
Specification
<
DictType
>
condition
(
DictTypeQueryParam
dictTypeQueryParam
)
{
//
public Specification<DictType> condition(DictTypeQueryParam dictTypeQueryParam) {
return
(
root
,
query
,
criteriaBuilder
)
->
{
//
return (root, query, criteriaBuilder) -> {
List
<
Predicate
>
list
=
new
ArrayList
<>();
//
List<Predicate> list = new ArrayList<>();
if
(
StrUtils
.
isNotBlank
(
dictTypeQueryParam
.
getDictName
()))
{
//
if (StrUtils.isNotBlank(dictTypeQueryParam.getDictName())) {
list
.
add
(
//
list.add(
criteriaBuilder
.
like
(
//
criteriaBuilder.like(
root
.
get
(
"dictType"
).
as
(
String
.
class
),
//
root.get("dictType").as(String.class),
"%"
+
dictTypeQueryParam
.
getDictName
()
+
"%"
//
"%" + dictTypeQueryParam.getDictName() + "%"
)
//
)
);
//
);
}
//
}
Predicate
[]
predicates
=
new
Predicate
[
list
.
size
()];
//
Predicate[] predicates = new Predicate[list.size()];
query
.
where
(
list
.
toArray
(
predicates
));
//
query.where(list.toArray(predicates));
return
criteriaBuilder
.
and
(
list
.
toArray
(
predicates
));
//
return criteriaBuilder.and(list.toArray(predicates));
};
//
};
}
//
}
}
}
app/src/main/java/com/yiring/app/web/car/CarController.java
浏览文件 @
306331f2
...
@@ -79,9 +79,9 @@ public class CarController {
...
@@ -79,9 +79,9 @@ public class CarController {
}
}
@ApiOperation
(
value
=
"查看车辆来访信息(分页)"
)
@ApiOperation
(
value
=
"查看车辆来访信息(分页)"
)
@GetMapping
(
"
P
ageCarInfo"
)
@GetMapping
(
"
p
ageCarInfo"
)
public
Result
<
PageVo
<
CarVo
>>
P
ageCarInfo
(
@Valid
CarQueryParam
carParam
,
@Valid
PageParam
param
)
{
public
Result
<
PageVo
<
CarVo
>>
p
ageCarInfo
(
@Valid
CarQueryParam
carParam
,
@Valid
PageParam
param
)
{
return
carService
.
P
ageCarInfo
(
carParam
,
param
);
return
carService
.
p
ageCarInfo
(
carParam
,
param
);
}
}
@ApiOperation
(
value
=
"导出车辆来访信息"
)
@ApiOperation
(
value
=
"导出车辆来访信息"
)
...
...
app/src/main/java/com/yiring/app/web/dict/DictController.java
浏览文件 @
306331f2
...
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
/**
/**
* 字典数据控制器
* 字典数据控制器
*
* @author tzl
* @author tzl
* 2022/4/13 17:10
* 2022/4/13 17:10
*/
*/
...
...
app/src/main/java/com/yiring/app/web/dict/DictTypeController.java
浏览文件 @
306331f2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
dict
;
package
com
.
yiring
.
app
.
web
.
dict
;
import
com.yiring.app.param.dict.DictTypeParam
;
import
com.yiring.app.param.dict.DictTypeQueryParam
;
import
com.yiring.app.service.dict.DictTypeService
;
import
com.yiring.common.core.Result
;
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.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* 字典类型控制器
* 字典类型控制器
*
* @author tzl
* @author tzl
* 2022/4/14 15:14
* 2022/4/14 15:14
*/
*/
@Slf4j
@Slf4j
@Validated
@Validated
@Api
(
tags
=
"DictType"
)
@Api
(
tags
=
"DictType"
)
@RestController
@RestController
@RequestMapping
(
"/DictType/"
)
@RequestMapping
(
"/DictType/"
)
public
class
DictTypeController
{
public
class
DictTypeController
{
//
@Resource
//
@Resource
DictTypeService
dictTypeService
;
//
DictTypeService dictTypeService;
//
@ApiOperation
(
value
=
"新增字典类型信息"
)
//
@ApiOperation(value = "新增字典类型信息")
@PostMapping
(
"saveDictTypeInfo"
)
//
@PostMapping("saveDictTypeInfo")
public
Result
<
String
>
saveDictTypeInfo
(
@Valid
DictTypeParam
dictTypeParam
)
{
//
public Result<String> saveDictTypeInfo(@Valid DictTypeParam dictTypeParam) {
return
dictTypeService
.
saveDictTypeInfo
(
dictTypeParam
);
//
return dictTypeService.saveDictTypeInfo(dictTypeParam);
}
//
}
//
@ApiOperation
(
value
=
"修改字典类型信息"
)
//
@ApiOperation(value = "修改字典类型信息")
@PostMapping
(
"updateDictTypeInfo"
)
//
@PostMapping("updateDictTypeInfo")
public
Result
<
String
>
updateDictTypeInfo
(
@Valid
DictTypeParam
dictTypeParam
,
@Valid
IdParam
idParam
)
{
//
public Result<String> updateDictTypeInfo(@Valid DictTypeParam dictTypeParam, @Valid IdParam idParam) {
return
dictTypeService
.
updateDictTypeInfo
(
dictTypeParam
,
idParam
);
//
return dictTypeService.updateDictTypeInfo(dictTypeParam, idParam);
}
//
}
//
@ApiOperation
(
value
=
"删除字典类型信息"
)
//
@ApiOperation(value = "删除字典类型信息")
@PostMapping
(
"delecteById"
)
//
@PostMapping("delecteById")
public
Result
<
String
>
delecteById
(
@Valid
IdParam
idParam
)
{
//
public Result<String> delecteById(@Valid IdParam idParam) {
return
dictTypeService
.
delecteById
(
idParam
.
getId
());
//
return dictTypeService.delecteById(idParam.getId());
}
//
}
//
@ApiOperation
(
value
=
"查看字典类型信息(分页)"
)
//
@ApiOperation(value = "查看字典类型信息(分页)")
@GetMapping
(
"pageDictTypeInfo"
)
//
@GetMapping("pageDictTypeInfo")
public
Result
<
PageVo
<
DictType
>>
pageDictInfo
(
@Valid
DictTypeQueryParam
queryParam
,
@Valid
PageParam
param
)
{
//
public Result<PageVo<DictType>> pageDictInfo(@Valid DictTypeQueryParam queryParam, @Valid PageParam param) {
return
dictTypeService
.
pageDictTypeInfo
(
queryParam
,
param
);
//
return dictTypeService.pageDictTypeInfo(queryParam, param);
}
//
}
//
@ApiOperation
(
value
=
"查看字典类型信息详情"
)
//
@ApiOperation(value = "查看字典类型信息详情")
@GetMapping
(
"getDictTypeInfo"
)
//
@GetMapping("getDictTypeInfo")
public
Result
<
DictType
>
getDictTypeInfo
(
@Valid
IdParam
idParam
)
{
//
public Result<DictType> getDictTypeInfo(@Valid IdParam idParam) {
return
dictTypeService
.
getDictTypeInfo
(
idParam
.
getId
());
//
return dictTypeService.getDictTypeInfo(idParam.getId());
}
//
}
}
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelUtils.java
浏览文件 @
306331f2
...
@@ -12,7 +12,6 @@ import com.yiring.common.util.date.DateUtils;
...
@@ -12,7 +12,6 @@ import com.yiring.common.util.date.DateUtils;
import
com.yiring.common.util.file.FileTypeUtils
;
import
com.yiring.common.util.file.FileTypeUtils
;
import
com.yiring.common.util.file.ImageUtils
;
import
com.yiring.common.util.file.ImageUtils
;
import
com.yiring.common.util.reflect.ReflectUtils
;
import
com.yiring.common.util.reflect.ReflectUtils
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
...
@@ -362,10 +361,10 @@ public class ExcelUtils<T> {
...
@@ -362,10 +361,10 @@ public class ExcelUtils<T> {
public
void
exportExcel
(
HttpServletResponse
response
)
{
public
void
exportExcel
(
HttpServletResponse
response
)
{
try
{
try
{
writeSheet
();
writeSheet
();
//
wb.write(response.getOutputStream());
wb
.
write
(
response
.
getOutputStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
"D:/a.xls"
);
//
FileOutputStream fos = new FileOutputStream("D:/a.xls");
wb
.
write
(
fos
);
//
wb.write(fos);
fos
.
close
();
//
fos.close();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"导出Excel异常{}"
,
e
.
getMessage
());
log
.
error
(
"导出Excel异常{}"
,
e
.
getMessage
());
}
finally
{
}
finally
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论