Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
fa526f10
提交
fa526f10
authored
4月 26, 2022
作者:
17607474349
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:
上级
01cfceda
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
768 行增加
和
209 行删除
+768
-209
DepartmentExportExcel.java
...java/com/yiring/app/excel/dept/DepartmentExportExcel.java
+6
-13
DepartmentImportExcel.java
...java/com/yiring/app/excel/dept/DepartmentImportExcel.java
+49
-0
LocationTagExportExcel.java
...com/yiring/app/excel/location/LocationTagExportExcel.java
+10
-17
LocationTagImportExcel.java
...com/yiring/app/excel/location/LocationTagImportExcel.java
+4
-4
UserExportExcel.java
.../main/java/com/yiring/app/excel/user/UserExportExcel.java
+7
-14
UserImportExcel.java
.../main/java/com/yiring/app/excel/user/UserImportExcel.java
+80
-0
DepartmentAddParam.java
...in/java/com/yiring/app/param/dept/DepartmentAddParam.java
+2
-2
DepartmentModifyParam.java
...java/com/yiring/app/param/dept/DepartmentModifyParam.java
+56
-0
LocationTagModifyParam.java
...com/yiring/app/param/location/LocationTagModifyParam.java
+8
-2
PostModifyParam.java
.../main/java/com/yiring/app/param/post/PostModifyParam.java
+56
-0
PostParam.java
app/src/main/java/com/yiring/app/param/post/PostParam.java
+11
-4
UserAddParam.java
...src/main/java/com/yiring/app/param/user/UserAddParam.java
+74
-0
UserModifyParam.java
.../main/java/com/yiring/app/param/user/UserModifyParam.java
+86
-0
DepartmentService.java
...n/java/com/yiring/app/service/dept/DepartmentService.java
+25
-0
DepartmentServiceImpl.java
...m/yiring/app/service/dept/impl/DepartmentServiceImpl.java
+0
-0
LocationTagServiceImpl.java
...ing/app/service/location/impl/LocationTagServiceImpl.java
+23
-27
PostService.java
...rc/main/java/com/yiring/app/service/post/PostService.java
+2
-2
PostServiceImpl.java
...ava/com/yiring/app/service/post/impl/PostServiceImpl.java
+22
-34
UserService.java
...rc/main/java/com/yiring/app/service/user/UserService.java
+31
-0
UserServiceImpl.java
...ava/com/yiring/app/service/user/impl/UserServiceImpl.java
+120
-16
DepartmentInfoVo.java
...rc/main/java/com/yiring/app/vo/dept/DepartmentInfoVo.java
+3
-0
DepartmentVo.java
app/src/main/java/com/yiring/app/vo/dept/DepartmentVo.java
+15
-17
LocationTagVo.java
...c/main/java/com/yiring/app/vo/location/LocationTagVo.java
+11
-18
PostVo.java
app/src/main/java/com/yiring/app/vo/post/PostVo.java
+0
-19
DepartmentController.java
...in/java/com/yiring/app/web/dept/DepartmentController.java
+21
-0
PostController.java
...src/main/java/com/yiring/app/web/post/PostController.java
+3
-2
UserAppController.java
.../main/java/com/yiring/app/web/user/UserAppController.java
+29
-2
User.java
...-auth/src/main/java/com/yiring/auth/domain/user/User.java
+6
-0
PostExcel.java
...h/src/main/java/com/yiring/auth/excel/post/PostExcel.java
+8
-16
没有找到文件。
app/src/main/java/com/yiring/app/excel/dept/DepartmentExportExcel.java
浏览文件 @
fa526f10
...
@@ -7,8 +7,6 @@ import com.github.liaochong.myexcel.core.annotation.ExcelModel;
...
@@ -7,8 +7,6 @@ import com.github.liaochong.myexcel.core.annotation.ExcelModel;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.AccessLevel
;
import
lombok.AccessLevel
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -36,16 +34,11 @@ public class DepartmentExportExcel implements Serializable {
...
@@ -36,16 +34,11 @@ public class DepartmentExportExcel implements Serializable {
@ExcelColumn
(
title
=
"创建时间"
)
@ExcelColumn
(
title
=
"创建时间"
)
String
createTime
;
String
createTime
;
public
static
List
<
DepartmentExportExcel
>
transforms
(
List
<
Department
>
departments
)
{
public
static
DepartmentExportExcel
transform
(
Department
department
)
{
return
departments
return
DepartmentExportExcel
.
stream
()
.
builder
()
.
map
(
department
->
.
name
(
department
.
getName
())
DepartmentExportExcel
.
createTime
(
LocalDateTimeUtil
.
format
(
department
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
builder
()
.
build
();
.
name
(
department
.
getName
())
.
createTime
(
LocalDateTimeUtil
.
format
(
department
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
app/src/main/java/com/yiring/app/excel/dept/DepartmentImportExcel.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
dept
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.yiring.auth.domain.dept.Department
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 部门导入
*
* @author LJ-2204
* @date 2022/4/25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DepartmentImportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
1287875741111587840L
;
@ExcelColumn
(
index
=
0
)
@NotNull
String
name
;
@ExcelColumn
(
index
=
1
)
String
realName
;
@ExcelColumn
(
index
=
2
)
String
mobile
;
@ExcelColumn
(
index
=
3
)
Boolean
enable
;
public
static
Department
transform
(
DepartmentImportExcel
departmentImportExcel
)
{
return
Department
.
builder
()
.
name
(
departmentImportExcel
.
getName
())
.
enable
(
departmentImportExcel
.
getEnable
())
.
build
();
}
}
app/src/main/java/com/yiring/app/excel/location/LocationTagExportExcel.java
浏览文件 @
fa526f10
...
@@ -7,8 +7,6 @@ import com.github.liaochong.myexcel.core.annotation.ExcelModel;
...
@@ -7,8 +7,6 @@ import com.github.liaochong.myexcel.core.annotation.ExcelModel;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTag
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.AccessLevel
;
import
lombok.AccessLevel
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -51,20 +49,15 @@ public class LocationTagExportExcel implements Serializable {
...
@@ -51,20 +49,15 @@ public class LocationTagExportExcel implements Serializable {
@ExcelColumn
(
title
=
"最近更新时间"
)
@ExcelColumn
(
title
=
"最近更新时间"
)
String
updateTime
;
String
updateTime
;
public
static
List
<
LocationTagExportExcel
>
transforms
(
List
<
LocationTag
>
locationTags
)
{
public
static
LocationTagExportExcel
transform
(
LocationTag
locationTag
)
{
return
locationTags
return
LocationTagExportExcel
.
stream
()
.
builder
()
.
map
(
locationTag
->
.
code
(
locationTag
.
getCode
())
LocationTagExportExcel
.
type
(
locationTag
.
getType
())
.
builder
()
.
silent
(
locationTag
.
getSilent
())
.
code
(
locationTag
.
getCode
())
.
imei
(
locationTag
.
getImei
())
.
type
(
locationTag
.
getType
())
.
volt
(
locationTag
.
getVolt
())
.
silent
(
locationTag
.
getSilent
())
.
updateTime
(
LocalDateTimeUtil
.
format
(
locationTag
.
getUpdateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
imei
(
locationTag
.
getImei
())
.
build
();
.
volt
(
locationTag
.
getVolt
())
.
updateTime
(
LocalDateTimeUtil
.
format
(
locationTag
.
getUpdateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
app/src/main/java/com/yiring/app/excel/location/LocationTagImportExcel.java
浏览文件 @
fa526f10
...
@@ -36,12 +36,12 @@ public class LocationTagImportExcel implements Serializable {
...
@@ -36,12 +36,12 @@ public class LocationTagImportExcel implements Serializable {
@ExcelColumn
(
index
=
2
)
@ExcelColumn
(
index
=
2
)
String
imei
;
String
imei
;
public
LocationTag
transform
(
)
{
public
static
LocationTag
transform
(
LocationTagImportExcel
locationTagImportExcel
)
{
return
LocationTag
return
LocationTag
.
builder
()
.
builder
()
.
code
(
this
.
code
)
.
code
(
locationTagImportExcel
.
code
)
.
type
(
LocationTag
.
Type
.
valueOf
(
this
.
type
))
.
type
(
LocationTag
.
Type
.
valueOf
(
locationTagImportExcel
.
type
))
.
imei
(
this
.
imei
)
.
imei
(
locationTagImportExcel
.
imei
)
.
createTime
(
LocalDateTime
.
now
())
.
createTime
(
LocalDateTime
.
now
())
.
build
();
.
build
();
}
}
...
...
app/src/main/java/com/yiring/app/excel/user/UserExportExcel.java
浏览文件 @
fa526f10
...
@@ -6,13 +6,11 @@ import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
...
@@ -6,13 +6,11 @@ import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
/**
/**
*
部门信息控制器
*
用户导出
*
*
* @author LJ-2204
* @author LJ-2204
* @date 2022/4/24
* @date 2022/4/24
...
@@ -34,16 +32,11 @@ public class UserExportExcel implements Serializable {
...
@@ -34,16 +32,11 @@ public class UserExportExcel implements Serializable {
@ExcelColumn
(
title
=
"创建时间"
)
@ExcelColumn
(
title
=
"创建时间"
)
String
createTime
;
String
createTime
;
public
static
List
<
UserExportExcel
>
transforms
(
List
<
UserVo
>
userVos
)
{
public
static
UserExportExcel
transform
(
UserVo
userVo
)
{
return
userVos
return
UserExportExcel
.
stream
()
.
builder
()
.
map
(
userVo
->
.
realName
(
userVo
.
getRealName
())
UserExportExcel
.
createTime
(
LocalDateTimeUtil
.
format
(
userVo
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
builder
()
.
build
();
.
realName
(
userVo
.
getRealName
())
.
createTime
(
LocalDateTimeUtil
.
format
(
userVo
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
app/src/main/java/com/yiring/app/excel/user/UserImportExcel.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
user
;
import
cn.hutool.core.convert.Convert
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.user.User
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 用户导入
*
* @author LJ-2204
* @date 2022/4/25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
UserImportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
3471291755743945051L
;
// 姓名
@ExcelColumn
(
index
=
0
)
String
realName
;
// 工号
@ExcelColumn
(
index
=
1
)
String
uuid
;
// 图标类型
@ExcelColumn
(
index
=
2
)
String
type
;
// 手机号
@ExcelColumn
(
index
=
3
)
String
mobile
;
// 部门id
@ExcelColumn
(
index
=
4
)
String
deptId
;
// 职位id
@ExcelColumn
(
index
=
5
)
String
postId
;
// 标签号
@ExcelColumn
(
index
=
6
)
String
code
;
// 性别
@ExcelColumn
(
index
=
7
)
Boolean
gender
;
// 是否为特殊人员
@ExcelColumn
(
index
=
8
)
Boolean
isSpecial
;
public
static
User
transform
(
UserImportExcel
userImportExcel
)
{
return
User
.
builder
()
.
realName
(
userImportExcel
.
getRealName
())
.
uuid
(
userImportExcel
.
getUuid
())
.
type
(
User
.
Type
.
valueOf
(
userImportExcel
.
getType
()))
.
mobile
(
userImportExcel
.
getMobile
())
.
department
(
Department
.
builder
().
id
(
Convert
.
toLong
(
userImportExcel
.
getDeptId
())).
build
())
.
post
(
Post
.
builder
().
id
(
Convert
.
toLong
(
userImportExcel
.
getPostId
())).
build
())
.
gender
(
userImportExcel
.
getGender
())
.
isSpecial
(
userImportExcel
.
getIsSpecial
())
.
build
();
}
}
app/src/main/java/com/yiring/app/param/dept/DepartmentAddParam.java
浏览文件 @
fa526f10
...
@@ -31,7 +31,7 @@ public class DepartmentAddParam implements Serializable {
...
@@ -31,7 +31,7 @@ public class DepartmentAddParam implements Serializable {
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"1"
,
required
=
true
)
@NotNull
@NotNull
Long
p
id
;
Long
id
;
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@NotNull
@NotNull
...
@@ -46,7 +46,7 @@ public class DepartmentAddParam implements Serializable {
...
@@ -46,7 +46,7 @@ public class DepartmentAddParam implements Serializable {
public
Department
transform
()
{
public
Department
transform
()
{
return
Department
return
Department
.
builder
()
.
builder
()
.
pid
(
this
.
p
id
)
.
pid
(
this
.
id
)
.
name
(
this
.
name
)
.
name
(
this
.
name
)
.
leader
(
User
.
builder
().
id
(
this
.
leaderId
).
build
())
.
leader
(
User
.
builder
().
id
(
this
.
leaderId
).
build
())
.
enable
(
this
.
enable
)
.
enable
(
this
.
enable
)
...
...
app/src/main/java/com/yiring/app/param/dept/DepartmentModifyParam.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dept
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 部门修改入参
*
* @author LJ-2204
* @date 2022/4/24
*/
@ApiModel
(
"DepartmentModifyParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DepartmentModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
8839239258775446219L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"1"
,
required
=
true
)
@NotNull
Long
id
;
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"1"
,
required
=
true
)
@NotNull
Long
pid
;
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@NotNull
String
name
;
@ApiModelProperty
(
value
=
"负责人"
,
example
=
"1"
)
Long
leaderId
;
public
Department
transform
()
{
return
Department
.
builder
()
.
id
(
this
.
id
)
.
pid
(
this
.
pid
)
.
name
(
this
.
name
)
.
leader
(
User
.
builder
().
id
(
this
.
leaderId
).
build
())
.
build
();
}
}
app/src/main/java/com/yiring/app/param/location/LocationTagModifyParam.java
浏览文件 @
fa526f10
...
@@ -38,7 +38,13 @@ public class LocationTagModifyParam implements Serializable {
...
@@ -38,7 +38,13 @@ public class LocationTagModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"imei 设备编码标识"
,
example
=
"88888888"
)
@ApiModelProperty
(
value
=
"imei 设备编码标识"
,
example
=
"88888888"
)
String
imei
;
String
imei
;
public
LocationTag
transform
()
{
public
static
LocationTag
transform
(
LocationTagModifyParam
locationTagModifyParam
)
{
return
LocationTag
.
builder
().
code
(
this
.
code
).
type
(
this
.
type
).
imei
(
this
.
imei
).
build
();
return
LocationTag
.
builder
()
.
id
(
locationTagModifyParam
.
id
)
.
code
(
locationTagModifyParam
.
code
)
.
type
(
locationTagModifyParam
.
type
)
.
imei
(
locationTagModifyParam
.
imei
)
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/post/PostModifyParam.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
post
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.yiring.auth.domain.post.Post
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 职位修改
*
* @author LJ-2204
* @date 2022/4/25
*/
@ApiModel
(
"PostModifyParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
PostModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
9182648236336186660L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"1"
,
required
=
true
)
@NotNull
Long
id
;
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@NotNull
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
example
=
"描述"
)
String
describe
;
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"true"
)
Boolean
enable
;
public
Post
transform
(
PostModifyParam
postParam
)
{
return
Post
.
builder
()
.
id
(
postParam
.
getId
())
.
name
(
postParam
.
getName
())
.
describe
(
postParam
.
getDescribe
())
.
enable
(
postParam
.
getEnable
())
.
createTime
(
LocalDateTimeUtil
.
now
())
.
build
();
}
}
app/src/main/java/com/yiring/app/param/post/PostParam.java
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
post
;
package
com
.
yiring
.
app
.
param
.
post
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.post.Post
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -31,13 +32,19 @@ public class PostParam implements Serializable {
...
@@ -31,13 +32,19 @@ public class PostParam implements Serializable {
@NotNull
@NotNull
String
name
;
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
example
=
"描述"
,
required
=
true
)
@ApiModelProperty
(
value
=
"描述"
,
example
=
"描述"
)
String
describe
;
String
describe
;
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"true"
,
required
=
true
)
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"true"
)
Boolean
enable
;
Boolean
enable
;
public
Post
transform
()
{
public
static
Post
transform
(
PostParam
postParam
)
{
return
Post
.
builder
().
name
(
this
.
name
).
describe
(
this
.
describe
).
enable
(
this
.
enable
).
build
();
return
Post
.
builder
()
.
name
(
postParam
.
name
)
.
describe
(
postParam
.
describe
)
.
enable
(
postParam
.
enable
)
.
createTime
(
LocalDateTimeUtil
.
now
())
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/user/UserAddParam.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
user
;
import
cn.hutool.core.convert.Convert
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 用户新增入参
*
* @author LJ-2204
* @date 2022/4/25
*/
@ApiModel
(
"UserAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
UserAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
4976674015255774601L
;
@ApiModelProperty
(
value
=
"头像"
,
example
=
"url"
)
String
avatar
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
,
required
=
true
)
String
realName
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"1888888888"
,
required
=
true
)
String
mobile
;
@ApiModelProperty
(
value
=
"图标类型"
,
example
=
"EMPLOYEES人员、GUEST访客"
,
required
=
true
)
User
.
Type
type
;
@ApiModelProperty
(
value
=
"性别"
,
example
=
"0/1"
)
Boolean
gender
;
@ApiModelProperty
(
value
=
"归属部门"
,
example
=
"1"
,
required
=
true
)
String
deptId
;
@ApiModelProperty
(
value
=
"工号"
,
example
=
"1888888888"
,
required
=
true
)
String
uuid
;
@ApiModelProperty
(
value
=
"职位"
,
example
=
"1"
)
String
postId
;
@ApiModelProperty
(
value
=
"是否特殊人员"
,
example
=
"0/1"
,
required
=
true
)
Boolean
isSpecial
;
public
User
transform
()
{
return
User
.
builder
()
.
avatar
(
this
.
avatar
)
.
realName
(
this
.
realName
)
.
mobile
(
this
.
mobile
)
.
type
(
this
.
type
)
.
gender
(
this
.
gender
)
.
department
(
Department
.
builder
().
id
(
Convert
.
toLong
(
this
.
deptId
)).
build
())
.
uuid
(
this
.
uuid
)
.
post
(
Post
.
builder
().
id
(
Convert
.
toLong
(
this
.
postId
)).
build
())
.
isSpecial
(
this
.
isSpecial
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/user/UserModifyParam.java
0 → 100644
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
user
;
import
cn.hutool.core.convert.Convert
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotNull
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 用户修改入参
*
* @author LJ-2204
* @date 2022/4/25
*/
@ApiModel
(
"UserModifyParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
UserModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5475181111082029313L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"11"
,
required
=
true
)
@NotNull
Long
id
;
@ApiModelProperty
(
value
=
"头像"
,
example
=
"url"
)
String
avatar
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
,
required
=
true
)
@NotNull
String
realName
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"1888888888"
,
required
=
true
)
@NotNull
String
mobile
;
@ApiModelProperty
(
value
=
"图标类型"
,
example
=
"EMPLOYEES人员、GUEST访客"
,
required
=
true
)
@NotNull
User
.
Type
type
;
@ApiModelProperty
(
value
=
"性别"
,
example
=
"0/1"
)
Boolean
gender
;
@ApiModelProperty
(
value
=
"归属部门"
,
example
=
"1"
,
required
=
true
)
@NotNull
String
deptId
;
@ApiModelProperty
(
value
=
"工号"
,
example
=
"1888888888"
,
required
=
true
)
@NotNull
String
uuid
;
@ApiModelProperty
(
value
=
"职位"
,
example
=
"1"
)
String
postId
;
@ApiModelProperty
(
value
=
"是否特殊人员"
,
example
=
"0/1"
,
required
=
true
)
@NotNull
Boolean
isSpecial
;
public
User
transform
()
{
return
User
.
builder
()
.
id
(
this
.
id
)
.
avatar
(
this
.
avatar
)
.
realName
(
this
.
realName
)
.
mobile
(
this
.
mobile
)
.
type
(
this
.
type
)
.
gender
(
this
.
gender
)
.
department
(
Department
.
builder
().
id
(
Convert
.
toLong
(
this
.
deptId
)).
build
())
.
uuid
(
this
.
uuid
)
.
post
(
Post
.
builder
().
id
(
Convert
.
toLong
(
this
.
postId
)).
build
())
.
isSpecial
(
this
.
isSpecial
)
.
build
();
}
}
app/src/main/java/com/yiring/app/service/dept/DepartmentService.java
浏览文件 @
fa526f10
...
@@ -3,12 +3,15 @@ package com.yiring.app.service.dept;
...
@@ -3,12 +3,15 @@ package com.yiring.app.service.dept;
import
com.yiring.app.param.dept.DepartmentAddParam
;
import
com.yiring.app.param.dept.DepartmentAddParam
;
import
com.yiring.app.param.dept.DepartmentFindParam
;
import
com.yiring.app.param.dept.DepartmentFindParam
;
import
com.yiring.app.param.dept.DepartmentModifyParam
;
import
com.yiring.app.vo.dept.DepartmentInfoVo
;
import
com.yiring.app.vo.dept.DepartmentInfoVo
;
import
com.yiring.app.vo.dept.DepartmentVo
;
import
com.yiring.app.vo.dept.DepartmentVo
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 部门管理
* 部门管理
...
@@ -57,4 +60,26 @@ public interface DepartmentService {
...
@@ -57,4 +60,26 @@ public interface DepartmentService {
* @return Result<String>
* @return Result<String>
*/
*/
Result
<
String
>
stateDepartment
(
IdParam
idParam
);
Result
<
String
>
stateDepartment
(
IdParam
idParam
);
/**
* 部门添加岗位
* @param idParam IdParam
* @param idsParam IdsParam
* @return Result<String>
*/
Result
<
String
>
deptBingPost
(
IdParam
idParam
,
IdsParam
idsParam
);
/**
* 部门修改
* @param param DepartmentModifyParam
* @return Result<String>
*/
Result
<
String
>
modifyDept
(
DepartmentModifyParam
param
);
/**
* 导入部门
* @param file MultipartFile
* @return Result<String>
*/
Result
<
String
>
importDepartment
(
MultipartFile
file
);
}
}
app/src/main/java/com/yiring/app/service/dept/impl/DepartmentServiceImpl.java
浏览文件 @
fa526f10
差异被折叠。
点击展开。
app/src/main/java/com/yiring/app/service/location/impl/LocationTagServiceImpl.java
浏览文件 @
fa526f10
...
@@ -71,33 +71,27 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -71,33 +71,27 @@ public class LocationTagServiceImpl implements LocationTagService {
List
<
ZyLocationTagAddParam
>
of
=
ListUtil
.
of
(
zyLocationTagAddParam
);
List
<
ZyLocationTagAddParam
>
of
=
ListUtil
.
of
(
zyLocationTagAddParam
);
zyHttpService
.
post
(
"/positionApi/api/tag/saveTag"
,
of
,
3000
);
zyHttpService
.
post
(
"/positionApi/api/tag/saveTag"
,
of
,
3000
);
locationTagRepository
.
save
(
locationTag
);
locationTagRepository
.
save
(
locationTag
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@Override
@Override
public
Result
<
PageVo
<
LocationTagVo
>>
findLocationTagPage
(
LocationTagFindParam
param
,
PageParam
pageParam
)
{
public
Result
<
PageVo
<
LocationTagVo
>>
findLocationTagPage
(
LocationTagFindParam
param
,
PageParam
pageParam
)
{
Specification
<
LocationTag
>
specification
=
getLocationTagPageSpecification
(
param
);
Specification
<
LocationTag
>
specification
=
getLocationTagPageSpecification
(
param
);
// 分页
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
LocationTag
.
Fields
.
createTime
));
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
if
(
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageNo
())
&&
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageSize
()))
{
Page
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
,
pageable
);
//分页
List
<
LocationTagVo
>
locationTagVos
=
locationTags
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
.
stream
()
Page
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
,
pageable
);
.
map
(
LocationTagVo:
:
transform
)
List
<
LocationTagVo
>
locationTagVos
=
LocationTagVo
.
transforms
(
locationTags
.
getContent
());
.
collect
(
Collectors
.
toList
());
PageVo
<
LocationTagVo
>
page
=
PageVo
.
build
(
locationTagVos
,
locationTags
.
getTotalElements
());
PageVo
<
LocationTagVo
>
page
=
PageVo
.
build
(
locationTagVos
,
locationTags
.
getTotalElements
());
return
Result
.
ok
(
page
);
return
Result
.
ok
(
page
);
}
else
{
List
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
,
sort
);
List
<
LocationTagVo
>
locationTagVos
=
LocationTagVo
.
transforms
(
locationTags
);
PageVo
<
LocationTagVo
>
page
=
PageVo
.
build
(
locationTagVos
,
locationTagVos
.
size
());
return
Result
.
ok
(
page
);
}
}
}
@Override
@Override
public
Result
<
String
>
deleteLocationTag
(
LocationTagDeleteParam
param
)
{
public
Result
<
String
>
deleteLocationTag
(
LocationTagDeleteParam
param
)
{
if
(
ObjectUtil
.
isEmpty
(
param
))
return
Result
.
no
(
Status
.
EXPECTATION_FAILED
);
Map
<
Object
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
Map
<
Object
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"tagIds"
,
param
.
getCodes
());
map
.
put
(
"tagIds"
,
param
.
getCodes
());
map
.
put
(
"orgId"
,
FACTORY_ID
);
map
.
put
(
"orgId"
,
FACTORY_ID
);
...
@@ -110,7 +104,10 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -110,7 +104,10 @@ public class LocationTagServiceImpl implements LocationTagService {
public
void
exportLocationTagInfo
(
LocationTagFindParam
param
,
HttpServletResponse
response
)
{
public
void
exportLocationTagInfo
(
LocationTagFindParam
param
,
HttpServletResponse
response
)
{
Specification
<
LocationTag
>
specification
=
getLocationTagPageSpecification
(
param
);
Specification
<
LocationTag
>
specification
=
getLocationTagPageSpecification
(
param
);
List
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
);
List
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
);
List
<
LocationTagExportExcel
>
locationTagExportExcels
=
LocationTagExportExcel
.
transforms
(
locationTags
);
List
<
LocationTagExportExcel
>
locationTagExportExcels
=
locationTags
.
stream
()
.
map
(
LocationTagExportExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
try
(
try
(
DefaultStreamExcelBuilder
<
LocationTagExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
DefaultStreamExcelBuilder
<
LocationTagExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
LocationTagExportExcel
.
class
)
.
of
(
LocationTagExportExcel
.
class
)
...
@@ -138,7 +135,7 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -138,7 +135,7 @@ public class LocationTagServiceImpl implements LocationTagService {
out
.
close
();
out
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
"导出
岗
位信息失败: "
+
e
.
getMessage
());
throw
new
RuntimeException
(
"导出
定
位信息失败: "
+
e
.
getMessage
());
}
}
}
}
...
@@ -177,17 +174,16 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -177,17 +174,16 @@ public class LocationTagServiceImpl implements LocationTagService {
@Override
@Override
public
Result
<
String
>
modifyLocationTag
(
LocationTagModifyParam
param
)
{
public
Result
<
String
>
modifyLocationTag
(
LocationTagModifyParam
param
)
{
Optional
<
LocationTag
>
locationTagOptional
=
locationTagRepository
.
findById
(
param
.
getId
());
long
count
=
locationTagRepository
.
count
(
if
(
locationTagOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"被修改的数据不存在"
);
Example
.
of
(
LocationTag
.
builder
().
id
(
param
.
getId
()).
code
(
param
.
getCode
()).
build
())
);
LocationTag
locationTag
=
locationTagOptional
.
get
();
if
(!
StrUtil
.
equals
(
locationTag
.
getCode
(),
param
.
getCode
()))
{
// code相同
if
(
hasLocationTagInfoByCode
(
param
.
getCode
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"编号已存在"
);
if
(
count
==
0
&&
hasLocationTagInfoByCode
(
param
.
getCode
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"编号重复"
);
}
}
locationTag
=
param
.
transform
();
LocationTag
locationTag
=
LocationTagModifyParam
.
transform
(
param
);
locationTag
.
setId
(
param
.
getId
());
locationTagRepository
.
save
(
locationTag
);
locationTagRepository
.
save
(
locationTag
);
return
Result
.
ok
();
return
Result
.
ok
();
...
...
app/src/main/java/com/yiring/app/service/post/PostService.java
浏览文件 @
fa526f10
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
app
.
service
.
post
;
package
com
.
yiring
.
app
.
service
.
post
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostModifyParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.vo.post.PostVo
;
import
com.yiring.app.vo.post.PostVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
...
@@ -26,10 +27,9 @@ public interface PostService {
...
@@ -26,10 +27,9 @@ public interface PostService {
/**
/**
* 修改职位信息
* 修改职位信息
* @param postParam 入参
* @param postParam 入参
* @param idParam id
* @return Result<String>
* @return Result<String>
*/
*/
Result
<
String
>
modifyPost
(
Post
Param
postParam
,
IdParam
id
Param
);
Result
<
String
>
modifyPost
(
Post
ModifyParam
post
Param
);
/**
/**
* 销毁职位信息
* 销毁职位信息
...
...
app/src/main/java/com/yiring/app/service/post/impl/PostServiceImpl.java
浏览文件 @
fa526f10
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostModifyParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.service.post.PostService
;
import
com.yiring.app.service.post.PostService
;
import
com.yiring.app.vo.post.PostVo
;
import
com.yiring.app.vo.post.PostVo
;
...
@@ -20,10 +21,9 @@ import com.yiring.common.vo.PageVo;
...
@@ -20,10 +21,9 @@ import com.yiring.common.vo.PageVo;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
...
@@ -50,28 +50,25 @@ public class PostServiceImpl implements PostService {
...
@@ -50,28 +50,25 @@ public class PostServiceImpl implements PostService {
@Override
@Override
public
Result
<
String
>
addPost
(
PostParam
postParam
)
{
public
Result
<
String
>
addPost
(
PostParam
postParam
)
{
// 判断职位是否存在
if
(
hasPostInfo
(
postParam
.
getName
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位已存在"
);
if
(
hasPostInfo
(
postParam
.
getName
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位已存在"
);
Post
post
=
postParam
.
transform
();
Post
post
=
PostParam
.
transform
(
postParam
);
post
.
setCreateTime
(
LocalDateTime
.
now
());
postRepository
.
save
(
post
);
postRepository
.
save
(
post
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@Override
@Override
public
Result
<
String
>
modifyPost
(
PostParam
postParam
,
IdParam
idParam
)
{
public
Result
<
String
>
modifyPost
(
PostModifyParam
postParam
)
{
Optional
<
Post
>
postOptional
=
postRepository
.
findById
(
idParam
.
getId
());
// 是否变更 职位名称
if
(
postOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"被修改的数据不存在"
);
long
count
=
postRepository
.
count
(
Example
.
of
(
Post
.
builder
().
id
(
postParam
.
getId
()).
name
(
postParam
.
getName
()).
build
())
Post
post
=
postOptional
.
get
();
);
if
(!
StrUtil
.
equals
(
post
.
getName
(),
postParam
.
getName
()))
{
// 变更处理
if
(
hasPostInfo
(
postParam
.
getName
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位已存在"
);
if
(
count
==
0
&&
hasPostInfo
(
postParam
.
getName
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位名称重复"
);
}
}
post
.
setName
(
postParam
.
getName
());
Post
post
=
postParam
.
transform
(
postParam
);
post
.
setDescribe
(
postParam
.
getDescribe
());
post
.
setEnable
(
postParam
.
getEnable
());
post
.
setUpdateTime
(
LocalDateTime
.
now
());
post
.
setId
(
idParam
.
getId
());
postRepository
.
save
(
post
);
postRepository
.
save
(
post
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
@@ -86,22 +83,13 @@ public class PostServiceImpl implements PostService {
...
@@ -86,22 +83,13 @@ public class PostServiceImpl implements PostService {
@Override
@Override
public
Result
<
PageVo
<
PostVo
>>
findPostPage
(
PostFindParam
param
,
PageParam
pageParam
)
{
public
Result
<
PageVo
<
PostVo
>>
findPostPage
(
PostFindParam
param
,
PageParam
pageParam
)
{
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
// 分页
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
Post
.
Fields
.
createTime
));
Page
<
Post
>
page
=
postRepository
.
findAll
(
specification
,
pageable
);
List
<
PostVo
>
postVos
=
page
.
getContent
().
stream
().
map
(
PostVo:
:
transform
).
collect
(
Collectors
.
toList
());
if
(
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageSize
())
&&
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageNo
()))
{
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
//分页
return
Result
.
ok
(
pageVo
);
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Page
<
Post
>
page
=
postRepository
.
findAll
(
specification
,
pageable
);
List
<
PostVo
>
postVos
=
PostVo
.
transforms
(
page
.
getContent
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
return
Result
.
ok
(
pageVo
);
}
else
{
List
<
Post
>
posts
=
postRepository
.
findAll
(
specification
,
sort
);
List
<
PostVo
>
postVos
=
PostVo
.
transforms
(
posts
);
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
return
Result
.
ok
(
pageVo
);
}
}
}
@Override
@Override
...
@@ -121,7 +109,7 @@ public class PostServiceImpl implements PostService {
...
@@ -121,7 +109,7 @@ public class PostServiceImpl implements PostService {
public
void
exportPostInfo
(
PostFindParam
param
,
HttpServletResponse
response
)
{
public
void
exportPostInfo
(
PostFindParam
param
,
HttpServletResponse
response
)
{
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
Specification
<
Post
>
specification
=
getPostPageSpecification
(
param
);
List
<
Post
>
postList
=
postRepository
.
findAll
(
specification
);
List
<
Post
>
postList
=
postRepository
.
findAll
(
specification
);
List
<
PostExcel
>
postExcels
=
PostExcel
.
transforms
(
postList
);
List
<
PostExcel
>
postExcels
=
postList
.
stream
().
map
(
PostExcel:
:
transform
).
collect
(
Collectors
.
toList
()
);
try
(
try
(
DefaultStreamExcelBuilder
<
PostExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
DefaultStreamExcelBuilder
<
PostExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
PostExcel
.
class
)
.
of
(
PostExcel
.
class
)
...
@@ -156,7 +144,7 @@ public class PostServiceImpl implements PostService {
...
@@ -156,7 +144,7 @@ public class PostServiceImpl implements PostService {
@Override
@Override
public
Result
<
PageVo
<
PostVo
>>
selectPost
()
{
public
Result
<
PageVo
<
PostVo
>>
selectPost
()
{
List
<
Post
>
posts
=
postRepository
.
findAll
();
List
<
Post
>
posts
=
postRepository
.
findAll
();
List
<
PostVo
>
postVos
=
PostVo
.
transforms
(
posts
);
List
<
PostVo
>
postVos
=
posts
.
stream
().
map
(
PostVo:
:
transform
).
collect
(
Collectors
.
toList
()
);
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
postVos
.
size
());
return
Result
.
ok
(
pageVo
);
return
Result
.
ok
(
pageVo
);
}
}
...
...
app/src/main/java/com/yiring/app/service/user/UserService.java
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
user
;
package
com
.
yiring
.
app
.
service
.
user
;
import
com.yiring.app.param.user.UserAddParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserModifyParam
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 用户
* 用户
...
@@ -64,4 +67,32 @@ public interface UserService {
...
@@ -64,4 +67,32 @@ public interface UserService {
* @param response HttpServletResponse
* @param response HttpServletResponse
*/
*/
void
exportUser
(
UserFindParam
param
,
HttpServletResponse
response
);
void
exportUser
(
UserFindParam
param
,
HttpServletResponse
response
);
/**
* 启用/停用
* @param idParam IdParam
* @return Result<String>
*/
Result
<
String
>
stateUser
(
IdParam
idParam
);
/**
* 修改用户
* @param param UserModifyParam
* @return Result<String>
*/
Result
<
String
>
modifyUser
(
UserModifyParam
param
);
/**
* 新增用户
* @param param UserAddParam
* @return Result<String>
*/
Result
<
String
>
addUser
(
UserAddParam
param
);
/**
* 导入
* @param file MultipartFile
* @return Result<String>
*/
Result
<
String
>
importUser
(
MultipartFile
file
);
}
}
app/src/main/java/com/yiring/app/service/user/impl/UserServiceImpl.java
浏览文件 @
fa526f10
...
@@ -5,11 +5,15 @@ import cn.hutool.core.collection.ListUtil;
...
@@ -5,11 +5,15 @@ import cn.hutool.core.collection.ListUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.SaxExcelReader
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTagRepository
;
import
com.yiring.app.domain.location.LocationTagRepository
;
import
com.yiring.app.excel.user.UserExportExcel
;
import
com.yiring.app.excel.user.UserExportExcel
;
import
com.yiring.app.excel.user.UserImportExcel
;
import
com.yiring.app.param.user.UserAddParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserModifyParam
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
...
@@ -23,12 +27,15 @@ import com.yiring.common.domain.BasicEntity;
...
@@ -23,12 +27,15 @@ import com.yiring.common.domain.BasicEntity;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.*
;
import
javax.persistence.criteria.*
;
...
@@ -39,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
...
@@ -39,6 +46,7 @@ import org.jetbrains.annotations.NotNull;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.Example
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 用户
* 用户
...
@@ -67,19 +75,13 @@ public class UserServiceImpl implements UserService {
...
@@ -67,19 +75,13 @@ public class UserServiceImpl implements UserService {
public
Result
<
PageVo
<
UserVo
>>
findUserPage
(
UserFindParam
param
,
PageParam
pageParam
)
{
public
Result
<
PageVo
<
UserVo
>>
findUserPage
(
UserFindParam
param
,
PageParam
pageParam
)
{
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
param
);
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
param
);
if
(
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageNo
())
||
ObjectUtil
.
isNotEmpty
(
pageParam
.
getPageSize
()))
{
List
<
UserVo
>
userVos
=
em
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
)
.
createQuery
(
cq
)
.
setFirstResult
(
pageParam
.
getPageNo
())
.
setFirstResult
(
pageParam
.
getPageNo
())
.
setMaxResults
(
pageParam
.
getPageSize
())
.
setMaxResults
(
pageParam
.
getPageSize
())
.
getResultList
();
.
getResultList
();
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
return
Result
.
ok
(
page
);
return
Result
.
ok
(
page
);
}
else
{
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
).
getResultList
();
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
return
Result
.
ok
(
page
);
}
}
}
@Override
@Override
...
@@ -98,6 +100,7 @@ public class UserServiceImpl implements UserService {
...
@@ -98,6 +100,7 @@ public class UserServiceImpl implements UserService {
Example
.
of
(
LocationTag
.
builder
().
code
(
param
.
getCode
()).
build
())
Example
.
of
(
LocationTag
.
builder
().
code
(
param
.
getCode
()).
build
())
);
);
if
(
locationTagOptional
.
isEmpty
())
throw
new
RuntimeException
(
"标签卡不存在"
);
if
(
locationTagOptional
.
isEmpty
())
throw
new
RuntimeException
(
"标签卡不存在"
);
LocationTag
locationTag
=
locationTagOptional
.
get
();
LocationTag
locationTag
=
locationTagOptional
.
get
();
if
(!
ObjectUtil
.
isNotEmpty
(
locationTag
.
getUser
()))
{
if
(!
ObjectUtil
.
isNotEmpty
(
locationTag
.
getUser
()))
{
throw
new
RuntimeException
(
"已绑定其他用户 : "
+
locationTag
.
getUser
().
getRealName
());
throw
new
RuntimeException
(
"已绑定其他用户 : "
+
locationTag
.
getUser
().
getRealName
());
...
@@ -112,9 +115,11 @@ public class UserServiceImpl implements UserService {
...
@@ -112,9 +115,11 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
Result
<
String
>
userUnBingTag
(
IdParam
idParam
)
{
public
Result
<
String
>
userUnBingTag
(
IdParam
idParam
)
{
LocationTag
build
=
LocationTag
.
builder
().
user
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()).
build
();
Optional
<
LocationTag
>
locationTagOptional
=
locationTagRepository
.
findOne
(
Optional
<
LocationTag
>
locationTagOptional
=
locationTagRepository
.
findOne
(
Example
.
of
(
build
));
Example
.
of
(
LocationTag
.
builder
().
user
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()).
build
())
);
if
(
locationTagOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
);
if
(
locationTagOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
);
LocationTag
locationTag
=
locationTagOptional
.
get
();
LocationTag
locationTag
=
locationTagOptional
.
get
();
locationTag
.
setUser
(
null
);
locationTag
.
setUser
(
null
);
locationTag
.
setUsed
(
false
);
locationTag
.
setUsed
(
false
);
...
@@ -149,7 +154,10 @@ public class UserServiceImpl implements UserService {
...
@@ -149,7 +154,10 @@ public class UserServiceImpl implements UserService {
public
void
exportUser
(
UserFindParam
param
,
HttpServletResponse
response
)
{
public
void
exportUser
(
UserFindParam
param
,
HttpServletResponse
response
)
{
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
param
);
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
param
);
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
).
getResultList
();
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
).
getResultList
();
List
<
UserExportExcel
>
userExportExcels
=
UserExportExcel
.
transforms
(
userVos
);
List
<
UserExportExcel
>
userExportExcels
=
userVos
.
stream
()
.
map
(
UserExportExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
try
(
try
(
DefaultStreamExcelBuilder
<
UserExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
DefaultStreamExcelBuilder
<
UserExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
UserExportExcel
.
class
)
.
of
(
UserExportExcel
.
class
)
...
@@ -181,6 +189,102 @@ public class UserServiceImpl implements UserService {
...
@@ -181,6 +189,102 @@ public class UserServiceImpl implements UserService {
}
}
}
}
@Override
public
Result
<
String
>
stateUser
(
IdParam
idParam
)
{
LocationTag
locationTagBuild
=
LocationTag
.
builder
().
user
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()).
build
();
long
locationTagCount
=
locationTagRepository
.
count
(
Example
.
of
(
locationTagBuild
));
if
(
locationTagCount
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"已发卡,不可停用"
);
Department
departmentBuild
=
Department
.
builder
().
leader
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()).
build
();
long
departmentCount
=
departmentRepository
.
count
(
Example
.
of
(
departmentBuild
));
if
(
departmentCount
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"部门负责人,请先解绑"
);
Optional
<
User
>
userOptional
=
userRepository
.
findOne
(
Example
.
of
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()));
if
(
userOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
);
User
user
=
userOptional
.
get
();
user
.
setEnabled
(!
user
.
getEnabled
());
userRepository
.
save
(
user
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
modifyUser
(
UserModifyParam
param
)
{
Optional
<
User
>
userOptional
=
userRepository
.
findOne
(
Example
.
of
(
User
.
builder
().
id
(
param
.
getId
()).
build
()));
if
(
userOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"用户不存在"
);
User
user
=
userOptional
.
get
();
if
(!
StrUtil
.
equals
(
user
.
getUuid
(),
param
.
getUuid
()))
{
long
count
=
userRepository
.
count
(
Example
.
of
(
User
.
builder
().
uuid
(
param
.
getUuid
()).
build
()));
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"工号相同"
);
}
User
newUser
=
param
.
transform
();
userRepository
.
save
(
newUser
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
addUser
(
UserAddParam
param
)
{
long
count
=
userRepository
.
count
(
Example
.
of
(
User
.
builder
().
uuid
(
param
.
getUuid
()).
build
()));
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"工号相同"
);
User
user
=
param
.
transform
();
userRepository
.
save
(
user
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
importUser
(
MultipartFile
file
)
{
if
(
file
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"请选择文件"
);
List
<
UserImportExcel
>
userImportExcels
;
try
(
InputStream
inputStream
=
file
.
getInputStream
())
{
userImportExcels
=
SaxExcelReader
.
of
(
UserImportExcel
.
class
)
.
rowFilter
(
row
->
row
.
getRowNum
()
>
0
)
.
ignoreBlankRow
()
.
read
(
inputStream
);
}
catch
(
IOException
e
)
{
log
.
info
(
e
.
getMessage
());
throw
new
RuntimeException
(
"文件导入异常"
);
}
userImportExcels
=
userImportExcels
.
stream
()
.
filter
(
userImportExcel
->
userRepository
.
count
(
Example
.
of
(
User
.
builder
().
uuid
(
userImportExcel
.
getUuid
()).
build
()))
==
0
)
.
filter
(
userImportExcel
->
locationTagRepository
.
count
(
Example
.
of
(
LocationTag
.
builder
().
code
(
userImportExcel
.
getCode
()).
used
(
true
).
build
())
)
==
0
)
.
collect
(
Collectors
.
toList
());
userImportExcels
.
forEach
(
userImportExcel
->
{
User
user
=
UserImportExcel
.
transform
(
userImportExcel
);
User
saveUser
=
userRepository
.
save
(
user
);
if
(
StrUtil
.
isNotEmpty
(
userImportExcel
.
getCode
()))
{
LocationTag
locationTag
=
LocationTag
.
builder
().
code
(
userImportExcel
.
getCode
()).
user
(
saveUser
).
build
();
locationTagRepository
.
save
(
locationTag
);
}
});
return
Result
.
ok
();
}
@NotNull
@NotNull
private
CriteriaQuery
<
UserVo
>
getUserVoCriteriaQuery
(
UserFindParam
param
)
{
private
CriteriaQuery
<
UserVo
>
getUserVoCriteriaQuery
(
UserFindParam
param
)
{
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
...
...
app/src/main/java/com/yiring/app/vo/dept/DepartmentInfoVo.java
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
dept
;
package
com
.
yiring
.
app
.
vo
.
dept
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.post.Post
;
...
@@ -41,6 +43,7 @@ public class DepartmentInfoVo implements Serializable {
...
@@ -41,6 +43,7 @@ public class DepartmentInfoVo implements Serializable {
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"T/F"
)
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"T/F"
)
Boolean
enable
;
Boolean
enable
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"0根目录"
)
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"0根目录"
)
Long
pid
;
Long
pid
;
...
...
app/src/main/java/com/yiring/app/vo/dept/DepartmentVo.java
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
dept
;
package
com
.
yiring
.
app
.
vo
.
dept
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -9,7 +11,6 @@ import java.io.Serial;
...
@@ -9,7 +11,6 @@ import java.io.Serial;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -31,6 +32,7 @@ public class DepartmentVo implements Serializable {
...
@@ -31,6 +32,7 @@ public class DepartmentVo implements Serializable {
@Serial
@Serial
private
static
final
long
serialVersionUID
=
-
8193039102015929156L
;
private
static
final
long
serialVersionUID
=
-
8193039102015929156L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"111"
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"111"
)
Long
id
;
Long
id
;
...
@@ -43,6 +45,7 @@ public class DepartmentVo implements Serializable {
...
@@ -43,6 +45,7 @@ public class DepartmentVo implements Serializable {
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"T/F"
)
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"T/F"
)
Boolean
enable
;
Boolean
enable
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"0根目录"
)
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"0根目录"
)
Long
pid
;
Long
pid
;
...
@@ -58,21 +61,16 @@ public class DepartmentVo implements Serializable {
...
@@ -58,21 +61,16 @@ public class DepartmentVo implements Serializable {
@ApiModelProperty
(
value
=
"子节点"
)
@ApiModelProperty
(
value
=
"子节点"
)
List
<
DepartmentVo
>
childList
;
List
<
DepartmentVo
>
childList
;
public
static
List
<
DepartmentVo
>
transforms
(
List
<
Department
>
departments
)
{
public
static
DepartmentVo
transform
(
Department
department
)
{
return
departments
return
DepartmentVo
.
stream
()
.
builder
()
.
map
(
department
->
.
id
(
department
.
getId
())
DepartmentVo
.
name
(
department
.
getName
())
.
builder
()
.
leader
(
UserVo
.
transform
(
department
.
getLeader
()))
.
id
(
department
.
getId
())
.
enable
(
department
.
getEnable
())
.
name
(
department
.
getName
())
.
pid
(
department
.
getPid
())
.
leader
(
UserVo
.
transform
(
department
.
getLeader
()))
.
updateTime
(
department
.
getUpdateTime
())
.
enable
(
department
.
getEnable
())
.
createTime
(
department
.
getCreateTime
())
.
pid
(
department
.
getPid
())
.
build
();
.
updateTime
(
department
.
getUpdateTime
())
.
createTime
(
department
.
getCreateTime
())
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
app/src/main/java/com/yiring/app/vo/location/LocationTagVo.java
浏览文件 @
fa526f10
...
@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -53,21 +51,16 @@ public class LocationTagVo implements Serializable {
...
@@ -53,21 +51,16 @@ public class LocationTagVo implements Serializable {
@ApiModelProperty
(
value
=
"最近更新时间"
,
example
=
"2022-01-01 00:00:00"
)
@ApiModelProperty
(
value
=
"最近更新时间"
,
example
=
"2022-01-01 00:00:00"
)
LocalDateTime
updateTime
;
LocalDateTime
updateTime
;
public
static
List
<
LocationTagVo
>
transforms
(
List
<
LocationTag
>
locationTags
)
{
public
static
LocationTagVo
transform
(
LocationTag
locationTag
)
{
return
locationTags
return
LocationTagVo
.
stream
()
.
builder
()
.
map
(
locationTag
->
.
id
(
locationTag
.
getId
())
LocationTagVo
.
code
(
locationTag
.
getCode
())
.
builder
()
.
type
(
locationTag
.
getType
())
.
id
(
locationTag
.
getId
())
.
silent
(
locationTag
.
getSilent
())
.
code
(
locationTag
.
getCode
())
.
volt
(
locationTag
.
getVolt
())
.
type
(
locationTag
.
getType
())
.
imei
(
locationTag
.
getImei
())
.
silent
(
locationTag
.
getSilent
())
.
updateTime
(
locationTag
.
getUpdateTime
())
.
volt
(
locationTag
.
getVolt
())
.
build
();
.
imei
(
locationTag
.
getImei
())
.
updateTime
(
locationTag
.
getUpdateTime
())
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
app/src/main/java/com/yiring/app/vo/post/PostVo.java
浏览文件 @
fa526f10
...
@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -9,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -61,21 +59,4 @@ public class PostVo implements Serializable {
...
@@ -61,21 +59,4 @@ public class PostVo implements Serializable {
.
updateTime
(
post
.
getUpdateTime
())
.
updateTime
(
post
.
getUpdateTime
())
.
build
();
.
build
();
}
}
public
static
List
<
PostVo
>
transforms
(
List
<
Post
>
posts
)
{
return
posts
.
stream
()
.
map
(
post
->
PostVo
.
builder
()
.
id
(
post
.
getId
())
.
name
(
post
.
getName
())
.
describe
(
post
.
getDescribe
())
.
enable
(
post
.
getEnable
())
.
createTime
(
post
.
getCreateTime
())
.
updateTime
(
post
.
getUpdateTime
())
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
app/src/main/java/com/yiring/app/web/dept/DepartmentController.java
浏览文件 @
fa526f10
...
@@ -3,9 +3,11 @@ package com.yiring.app.web.dept;
...
@@ -3,9 +3,11 @@ package com.yiring.app.web.dept;
import
com.yiring.app.param.dept.DepartmentAddParam
;
import
com.yiring.app.param.dept.DepartmentAddParam
;
import
com.yiring.app.param.dept.DepartmentFindParam
;
import
com.yiring.app.param.dept.DepartmentFindParam
;
import
com.yiring.app.param.dept.DepartmentModifyParam
;
import
com.yiring.app.service.dept.DepartmentService
;
import
com.yiring.app.service.dept.DepartmentService
;
import
com.yiring.app.vo.dept.DepartmentInfoVo
;
import
com.yiring.app.vo.dept.DepartmentInfoVo
;
import
com.yiring.app.vo.dept.DepartmentVo
;
import
com.yiring.app.vo.dept.DepartmentVo
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
...
@@ -17,6 +19,7 @@ import javax.validation.Valid;
...
@@ -17,6 +19,7 @@ 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.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 部门信息控制器
* 部门信息控制器
...
@@ -69,4 +72,22 @@ public class DepartmentController {
...
@@ -69,4 +72,22 @@ public class DepartmentController {
public
Result
<
String
>
stateDepartment
(
@Valid
IdParam
idParam
)
{
public
Result
<
String
>
stateDepartment
(
@Valid
IdParam
idParam
)
{
return
departmentService
.
stateDepartment
(
idParam
);
return
departmentService
.
stateDepartment
(
idParam
);
}
}
@ApiOperation
(
"给部门添加职位"
)
@PutMapping
(
"deptBingPost"
)
public
Result
<
String
>
deptBingPost
(
@Valid
IdParam
idParam
,
@Valid
IdsParam
idsParam
)
{
return
departmentService
.
deptBingPost
(
idParam
,
idsParam
);
}
@ApiOperation
(
"部门编辑"
)
@PutMapping
(
"modifyDepartment"
)
public
Result
<
String
>
modifyDepartment
(
@Valid
DepartmentModifyParam
param
)
{
return
departmentService
.
modifyDept
(
param
);
}
@ApiOperation
(
"部门导入"
)
@PostMapping
(
"Department"
)
public
Result
<
String
>
importDepartment
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
return
departmentService
.
importDepartment
(
file
);
}
}
}
app/src/main/java/com/yiring/app/web/post/PostController.java
浏览文件 @
fa526f10
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
app
.
web
.
post
;
package
com
.
yiring
.
app
.
web
.
post
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostFindParam
;
import
com.yiring.app.param.post.PostModifyParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.param.post.PostParam
;
import
com.yiring.app.service.post.PostService
;
import
com.yiring.app.service.post.PostService
;
import
com.yiring.app.vo.post.PostVo
;
import
com.yiring.app.vo.post.PostVo
;
...
@@ -42,8 +43,8 @@ public class PostController {
...
@@ -42,8 +43,8 @@ public class PostController {
@ApiOperation
(
value
=
"修改职位"
)
@ApiOperation
(
value
=
"修改职位"
)
@PutMapping
(
"modifyPost"
)
@PutMapping
(
"modifyPost"
)
public
Result
<
String
>
modifyPost
(
@Valid
Post
Param
postParam
,
@Valid
IdParam
id
Param
)
{
public
Result
<
String
>
modifyPost
(
@Valid
Post
ModifyParam
post
Param
)
{
return
postService
.
modifyPost
(
postParam
,
idParam
);
return
postService
.
modifyPost
(
postParam
);
}
}
@ApiOperation
(
value
=
"销毁职位"
)
@ApiOperation
(
value
=
"销毁职位"
)
...
...
app/src/main/java/com/yiring/app/web/user/UserAppController.java
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
user
;
package
com
.
yiring
.
app
.
web
.
user
;
import
com.yiring.app.param.user.UserAddParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserBingTagParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserFindParam
;
import
com.yiring.app.param.user.UserModifyParam
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
...
@@ -17,6 +19,7 @@ import javax.validation.Valid;
...
@@ -17,6 +19,7 @@ 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.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 用户信息
* 用户信息
...
@@ -28,9 +31,9 @@ import org.springframework.web.bind.annotation.*;
...
@@ -28,9 +31,9 @@ import org.springframework.web.bind.annotation.*;
@Slf4j
@Slf4j
@Validated
@Validated
@Api
(
tags
=
"
User
"
)
@Api
(
tags
=
"
人员管理
"
)
@RestController
@RestController
@RequestMapping
(
"/user/"
)
@RequestMapping
(
"/user/
app/
"
)
public
class
UserAppController
{
public
class
UserAppController
{
@Resource
@Resource
...
@@ -77,4 +80,28 @@ public class UserAppController {
...
@@ -77,4 +80,28 @@ public class UserAppController {
public
void
exportUser
(
@Valid
UserFindParam
param
,
HttpServletResponse
response
)
{
public
void
exportUser
(
@Valid
UserFindParam
param
,
HttpServletResponse
response
)
{
userService
.
exportUser
(
param
,
response
);
userService
.
exportUser
(
param
,
response
);
}
}
@ApiOperation
(
"启用/停用"
)
@PutMapping
(
"stateUser"
)
public
Result
<
String
>
stateUser
(
@Valid
IdParam
idParam
)
{
return
userService
.
stateUser
(
idParam
);
}
@ApiOperation
(
"编辑用户"
)
@PutMapping
(
"modifyUser"
)
public
Result
<
String
>
modifyUser
(
@Valid
UserModifyParam
param
)
{
return
userService
.
modifyUser
(
param
);
}
@ApiOperation
(
"新增用户"
)
@PostMapping
(
"addUser"
)
public
Result
<
String
>
addUser
(
@Valid
UserAddParam
param
)
{
return
userService
.
addUser
(
param
);
}
@ApiOperation
(
"导入"
)
@PostMapping
(
"importUser"
)
public
Result
<
String
>
importUser
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
return
userService
.
importUser
(
file
);
}
}
}
basic-auth/src/main/java/com/yiring/auth/domain/user/User.java
浏览文件 @
fa526f10
...
@@ -98,6 +98,12 @@ public class User extends BasicEntity implements Serializable {
...
@@ -98,6 +98,12 @@ public class User extends BasicEntity implements Serializable {
@Comment
(
"是否删除"
)
@Comment
(
"是否删除"
)
Boolean
deleted
;
Boolean
deleted
;
@Comment
(
"是否特殊"
)
Boolean
isSpecial
;
@Comment
(
"性别"
)
Boolean
gender
;
@JsonIgnore
@JsonIgnore
@Builder
.
Default
@Builder
.
Default
@Comment
(
"角色集合"
)
@Comment
(
"角色集合"
)
...
...
basic-auth/src/main/java/com/yiring/auth/excel/post/PostExcel.java
浏览文件 @
fa526f10
...
@@ -5,8 +5,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
...
@@ -5,8 +5,6 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.post.Post
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
lombok.AccessLevel
;
import
lombok.AccessLevel
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -40,19 +38,13 @@ public class PostExcel {
...
@@ -40,19 +38,13 @@ public class PostExcel {
@ExcelColumn
(
title
=
"创建时间"
)
@ExcelColumn
(
title
=
"创建时间"
)
String
createTime
;
String
createTime
;
public
static
List
<
PostExcel
>
transforms
(
List
<
Post
>
posts
)
{
public
static
PostExcel
transform
(
Post
post
)
{
return
posts
return
PostExcel
.
stream
()
.
builder
()
.
map
(
post
->
.
name
(
post
.
getName
())
PostExcel
.
describe
(
post
.
getDescribe
())
.
builder
()
.
enable
(
post
.
getEnable
()
?
"启用"
:
"禁用"
)
// .id(post.getId())
.
createTime
(
LocalDateTimeUtil
.
format
(
post
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
name
(
post
.
getName
())
.
build
();
.
describe
(
post
.
getDescribe
())
.
enable
(
post
.
getEnable
()
?
"启用"
:
"禁用"
)
.
createTime
(
LocalDateTimeUtil
.
format
(
post
.
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
))
.
build
()
)
.
collect
(
Collectors
.
toList
());
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论