Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
72c92e95
提交
72c92e95
authored
5月 05, 2022
作者:
17607474349
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:
1、部门同步zy
上级
cb5fc1e0
全部展开
显示空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
503 行增加
和
436 行删除
+503
-436
LocationBeacon.java
...n/java/com/yiring/app/domain/location/LocationBeacon.java
+4
-0
LocationTagExportExcel.java
...yiring/app/excel/location/tag/LocationTagExportExcel.java
+1
-1
LocationTagImportExcel.java
...yiring/app/excel/location/tag/LocationTagImportExcel.java
+3
-2
DepartmentAddParam.java
...in/java/com/yiring/app/param/dept/DepartmentAddParam.java
+0
-5
DepartmentModifyParam.java
...java/com/yiring/app/param/dept/DepartmentModifyParam.java
+9
-8
LocationTagDeleteParam.java
...yiring/app/param/location/tag/LocationTagDeleteParam.java
+0
-4
LocationTagModifyParam.java
...yiring/app/param/location/tag/LocationTagModifyParam.java
+6
-8
LocationTagTypeFindParam.java
...ring/app/param/location/tag/LocationTagTypeFindParam.java
+3
-0
PostModifyParam.java
.../main/java/com/yiring/app/param/post/PostModifyParam.java
+5
-9
PostParam.java
app/src/main/java/com/yiring/app/param/post/PostParam.java
+1
-8
UserAddParam.java
...src/main/java/com/yiring/app/param/user/UserAddParam.java
+0
-5
UserModifyParam.java
.../main/java/com/yiring/app/param/user/UserModifyParam.java
+9
-14
ZyLocationTagAddParam.java
...ring/app/param/zy/location/tag/ZyLocationTagAddParam.java
+5
-23
DepartmentService.java
...n/java/com/yiring/app/service/dept/DepartmentService.java
+0
-7
DepartmentServiceImpl.java
...m/yiring/app/service/dept/impl/DepartmentServiceImpl.java
+0
-0
LocationTagService.java
...m/yiring/app/service/location/tag/LocationTagService.java
+3
-3
LocationTagTypeService.java
...ring/app/service/location/tag/LocationTagTypeService.java
+8
-0
LocationTagServiceImpl.java
...app/service/location/tag/impl/LocationTagServiceImpl.java
+103
-26
LocationTagTypeServiceImpl.java
...service/location/tag/impl/LocationTagTypeServiceImpl.java
+29
-0
PostServiceImpl.java
...ava/com/yiring/app/service/post/impl/PostServiceImpl.java
+13
-7
UserServiceImpl.java
...ava/com/yiring/app/service/user/impl/UserServiceImpl.java
+89
-12
ZyHttpService.java
...rc/main/java/com/yiring/app/service/zy/ZyHttpService.java
+0
-49
ZyHttpServiceImpl.java
...ava/com/yiring/app/service/zy/impl/ZyHttpServiceImpl.java
+0
-118
ZyUtil.java
app/src/main/java/com/yiring/app/util/zy/ZyUtil.java
+121
-0
PostVo.java
app/src/main/java/com/yiring/app/vo/post/PostVo.java
+4
-0
UserVo.java
app/src/main/java/com/yiring/app/vo/user/UserVo.java
+18
-1
HelloController.java
app/src/main/java/com/yiring/app/web/HelloController.java
+6
-0
DepartmentController.java
...in/java/com/yiring/app/web/dept/DepartmentController.java
+1
-7
LocationBeaconController.java
...ing/app/web/location/beacon/LocationBeaconController.java
+42
-1
LocationTagController.java
...om/yiring/app/web/location/tag/LocationTagController.java
+2
-2
LocationTagTypeController.java
...iring/app/web/location/tag/LocationTagTypeController.java
+8
-0
MapController.java
app/src/main/java/com/yiring/app/web/map/MapController.java
+2
-3
Department.java
...src/main/java/com/yiring/auth/domain/dept/Department.java
+4
-27
Post.java
...-auth/src/main/java/com/yiring/auth/domain/post/Post.java
+4
-19
ZyUtil.java
basic-auth/src/main/java/com/yiring/auth/util/ZyUtil.java
+0
-67
没有找到文件。
app/src/main/java/com/yiring/app/domain/location/LocationBeacon.java
浏览文件 @
72c92e95
...
@@ -6,6 +6,7 @@ import com.yiring.common.domain.BasicEntity;
...
@@ -6,6 +6,7 @@ import com.yiring.common.domain.BasicEntity;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -94,6 +95,9 @@ public class LocationBeacon extends BasicEntity implements Serializable {
...
@@ -94,6 +95,9 @@ public class LocationBeacon extends BasicEntity implements Serializable {
@Comment
(
"电量单位"
)
@Comment
(
"电量单位"
)
String
voltUnit
;
String
voltUnit
;
@Comment
(
"状态更新时间"
)
LocalDateTime
time
;
@Comment
(
"围栏集合"
)
@Comment
(
"围栏集合"
)
@Builder
.
Default
@Builder
.
Default
@ManyToMany
@ManyToMany
...
...
app/src/main/java/com/yiring/app/excel/location/LocationTagExportExcel.java
→
app/src/main/java/com/yiring/app/excel/location/
tag/
LocationTagExportExcel.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
location
;
package
com
.
yiring
.
app
.
excel
.
location
.
tag
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
...
...
app/src/main/java/com/yiring/app/excel/location/LocationTagImportExcel.java
→
app/src/main/java/com/yiring/app/excel/location/
tag/
LocationTagImportExcel.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
location
;
package
com
.
yiring
.
app
.
excel
.
location
.
tag
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTag
;
import
java.io.Serial
;
import
java.io.Serial
;
...
@@ -41,7 +42,7 @@ public class LocationTagImportExcel implements Serializable {
...
@@ -41,7 +42,7 @@ public class LocationTagImportExcel implements Serializable {
.
builder
()
.
builder
()
.
code
(
locationTagImportExcel
.
code
)
.
code
(
locationTagImportExcel
.
code
)
.
type
(
LocationTag
.
Type
.
valueOf
(
locationTagImportExcel
.
type
))
.
type
(
LocationTag
.
Type
.
valueOf
(
locationTagImportExcel
.
type
))
.
imei
(
locationTagImportExcel
.
imei
)
.
imei
(
StrUtil
.
isEmpty
(
locationTagImportExcel
.
imei
)
?
null
:
locationTagImportExcel
.
imei
)
.
createTime
(
LocalDateTime
.
now
())
.
createTime
(
LocalDateTime
.
now
())
.
build
();
.
build
();
}
}
...
...
app/src/main/java/com/yiring/app/param/dept/DepartmentAddParam.java
浏览文件 @
72c92e95
...
@@ -2,12 +2,10 @@
...
@@ -2,12 +2,10 @@
package
com
.
yiring
.
app
.
param
.
dept
;
package
com
.
yiring
.
app
.
param
.
dept
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
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
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -48,10 +46,7 @@ public class DepartmentAddParam implements Serializable {
...
@@ -48,10 +46,7 @@ public class DepartmentAddParam implements Serializable {
.
builder
()
.
builder
()
.
pid
(
departmentAddParam
.
getId
())
.
pid
(
departmentAddParam
.
getId
())
.
name
(
departmentAddParam
.
getName
())
.
name
(
departmentAddParam
.
getName
())
.
leader
(
User
.
builder
().
id
(
departmentAddParam
.
getLeaderId
()).
build
())
.
enable
(
departmentAddParam
.
getEnable
())
.
enable
(
departmentAddParam
.
getEnable
())
.
createTime
(
LocalDateTime
.
now
())
.
updateTime
(
LocalDateTime
.
now
())
.
build
();
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/dept/DepartmentModifyParam.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
dept
;
package
com
.
yiring
.
app
.
param
.
dept
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -44,13 +46,12 @@ public class DepartmentModifyParam implements Serializable {
...
@@ -44,13 +46,12 @@ public class DepartmentModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"负责人"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"负责人"
,
example
=
"1"
)
Long
leaderId
;
Long
leaderId
;
public
Department
transform
()
{
public
void
transform
(
DepartmentModifyParam
departmentModifyParam
,
Department
department
)
{
return
Department
department
.
setPid
(
departmentModifyParam
.
getPid
());
.
builder
()
department
.
setName
(
departmentModifyParam
.
getName
());
.
id
(
this
.
id
)
if
(
ObjectUtil
.
isNotEmpty
(
departmentModifyParam
.
getLeaderId
()))
{
.
pid
(
this
.
pid
)
department
.
setLeader
(
User
.
builder
().
id
(
departmentModifyParam
.
getLeaderId
()).
build
());
.
name
(
this
.
name
)
}
.
leader
(
User
.
builder
().
id
(
this
.
leaderId
).
build
())
department
.
setUpdateTime
(
LocalDateTimeUtil
.
now
());
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/location/tag/LocationTagDeleteParam.java
浏览文件 @
72c92e95
...
@@ -29,8 +29,4 @@ public class LocationTagDeleteParam implements Serializable {
...
@@ -29,8 +29,4 @@ public class LocationTagDeleteParam implements Serializable {
@ApiModelProperty
(
value
=
"ids"
,
example
=
"145235231,145235232"
,
required
=
true
)
@ApiModelProperty
(
value
=
"ids"
,
example
=
"145235231,145235232"
,
required
=
true
)
@NotNull
(
message
=
"ids 不能为空"
)
@NotNull
(
message
=
"ids 不能为空"
)
Long
[]
ids
;
Long
[]
ids
;
@ApiModelProperty
(
value
=
"codes"
,
example
=
"BTT99999998,BTT99999999"
,
required
=
true
)
@NotNull
(
message
=
"codes 不能为空"
)
String
[]
codes
;
}
}
app/src/main/java/com/yiring/app/param/location/tag/LocationTagModifyParam.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
tag
;
package
com
.
yiring
.
app
.
param
.
location
.
tag
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTag
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -38,13 +39,10 @@ public class LocationTagModifyParam implements Serializable {
...
@@ -38,13 +39,10 @@ public class LocationTagModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"imei 设备编码标识"
,
example
=
"88888888"
)
@ApiModelProperty
(
value
=
"imei 设备编码标识"
,
example
=
"88888888"
)
String
imei
;
String
imei
;
public
static
LocationTag
transform
(
LocationTagModifyParam
locationTagModifyParam
)
{
public
static
void
transform
(
LocationTagModifyParam
locationTagModifyParam
,
LocationTag
locationTag
)
{
return
LocationTag
locationTag
.
setCode
(
locationTagModifyParam
.
getCode
());
.
builder
()
locationTag
.
setType
(
locationTagModifyParam
.
getType
());
.
id
(
locationTagModifyParam
.
id
)
locationTag
.
setImei
(
locationTagModifyParam
.
getImei
());
.
code
(
locationTagModifyParam
.
code
)
locationTag
.
setUpdateTime
(
LocalDateTimeUtil
.
now
());
.
type
(
locationTagModifyParam
.
type
)
.
imei
(
locationTagModifyParam
.
imei
)
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/location/tag/LocationTagTypeFindParam.java
浏览文件 @
72c92e95
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
app
.
param
.
location
.
tag
;
package
com
.
yiring
.
app
.
param
.
location
.
tag
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.*
;
...
@@ -25,7 +26,9 @@ public class LocationTagTypeFindParam implements Serializable {
...
@@ -25,7 +26,9 @@ public class LocationTagTypeFindParam implements Serializable {
@Serial
@Serial
private
static
final
long
serialVersionUID
=
-
647961131755069990L
;
private
static
final
long
serialVersionUID
=
-
647961131755069990L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"BTT8888888"
)
String
code
;
String
code
;
@ApiModelProperty
(
value
=
"类别"
,
example
=
"1:内部/2:访客"
)
Integer
category
;
Integer
category
;
}
}
app/src/main/java/com/yiring/app/param/post/PostModifyParam.java
浏览文件 @
72c92e95
...
@@ -43,14 +43,10 @@ public class PostModifyParam implements Serializable {
...
@@ -43,14 +43,10 @@ public class PostModifyParam implements Serializable {
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"true"
)
@ApiModelProperty
(
value
=
"是否启用"
,
example
=
"true"
)
Boolean
enable
;
Boolean
enable
;
public
Post
transform
(
PostModifyParam
postParam
)
{
public
void
transform
(
PostModifyParam
postParam
,
Post
post
)
{
return
Post
post
.
setName
(
postParam
.
getName
());
.
builder
()
post
.
setDescribe
(
postParam
.
getDescribe
());
.
id
(
postParam
.
getId
())
post
.
setEnable
(
postParam
.
getEnable
());
.
name
(
postParam
.
getName
())
post
.
setUpdateTime
(
LocalDateTimeUtil
.
now
());
.
describe
(
postParam
.
getDescribe
())
.
enable
(
postParam
.
getEnable
())
.
createTime
(
LocalDateTimeUtil
.
now
())
.
build
();
}
}
}
}
app/src/main/java/com/yiring/app/param/post/PostParam.java
浏览文件 @
72c92e95
/* (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
;
...
@@ -39,12 +38,6 @@ public class PostParam implements Serializable {
...
@@ -39,12 +38,6 @@ public class PostParam implements Serializable {
Boolean
enable
;
Boolean
enable
;
public
static
Post
transform
(
PostParam
postParam
)
{
public
static
Post
transform
(
PostParam
postParam
)
{
return
Post
return
Post
.
builder
().
name
(
postParam
.
name
).
describe
(
postParam
.
describe
).
enable
(
postParam
.
enable
).
build
();
.
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
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
user
;
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
com.yiring.auth.domain.user.User
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -65,9 +62,7 @@ public class UserAddParam implements Serializable {
...
@@ -65,9 +62,7 @@ public class UserAddParam implements Serializable {
.
mobile
(
userAddParam
.
getMobile
())
.
mobile
(
userAddParam
.
getMobile
())
.
type
(
userAddParam
.
getType
())
.
type
(
userAddParam
.
getType
())
.
gender
(
userAddParam
.
getGender
())
.
gender
(
userAddParam
.
getGender
())
.
department
(
Department
.
builder
().
id
(
Convert
.
toLong
(
userAddParam
.
getDeptId
())).
build
())
.
uuid
(
userAddParam
.
getUuid
())
.
uuid
(
userAddParam
.
getUuid
())
.
post
(
Post
.
builder
().
id
(
Convert
.
toLong
(
userAddParam
.
getPostId
())).
build
())
.
isSpecial
(
userAddParam
.
getIsSpecial
())
.
isSpecial
(
userAddParam
.
getIsSpecial
())
.
build
();
.
build
();
}
}
...
...
app/src/main/java/com/yiring/app/param/user/UserModifyParam.java
浏览文件 @
72c92e95
...
@@ -68,19 +68,14 @@ public class UserModifyParam implements Serializable {
...
@@ -68,19 +68,14 @@ public class UserModifyParam implements Serializable {
@NotNull
@NotNull
Boolean
isSpecial
;
Boolean
isSpecial
;
public
User
transform
()
{
public
static
void
transform
(
UserModifyParam
userModifyParam
,
User
user
)
{
return
User
user
.
setAvatar
(
userModifyParam
.
getAvatar
());
.
builder
()
user
.
setRealName
(
userModifyParam
.
getRealName
());
.
id
(
this
.
id
)
user
.
setMobile
(
userModifyParam
.
getMobile
());
.
avatar
(
this
.
avatar
)
user
.
setType
(
userModifyParam
.
getType
());
.
realName
(
this
.
realName
)
user
.
setGender
(
userModifyParam
.
getGender
());
.
mobile
(
this
.
mobile
)
user
.
setDepartment
(
Department
.
builder
().
id
(
Convert
.
toLong
(
userModifyParam
.
getDeptId
())).
build
());
.
type
(
this
.
type
)
user
.
setUuid
(
userModifyParam
.
getUuid
());
.
gender
(
this
.
gender
)
user
.
setPost
(
Post
.
builder
().
id
(
Convert
.
toLong
(
userModifyParam
.
getPostId
())).
build
());
.
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/
location/zy
/ZyLocationTagAddParam.java
→
app/src/main/java/com/yiring/app/param/
zy/location/tag
/ZyLocationTagAddParam.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
zy
;
package
com
.
yiring
.
app
.
param
.
zy
.
location
.
tag
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.domain.location.LocationTag
;
import
com.yiring.app.excel.location.LocationTagImportExcel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
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
;
...
@@ -42,6 +39,9 @@ public class ZyLocationTagAddParam implements Serializable {
...
@@ -42,6 +39,9 @@ public class ZyLocationTagAddParam implements Serializable {
@ApiModelProperty
(
value
=
"实体类型"
,
example
=
"car"
,
required
=
true
)
@ApiModelProperty
(
value
=
"实体类型"
,
example
=
"car"
,
required
=
true
)
String
entityType
;
String
entityType
;
@ApiModelProperty
(
value
=
"card"
,
example
=
"card"
)
String
card
;
public
static
ZyLocationTagAddParam
transform
(
LocationTag
locationTag
,
Integer
orgId
)
{
public
static
ZyLocationTagAddParam
transform
(
LocationTag
locationTag
,
Integer
orgId
)
{
String
entityType
=
StrUtil
.
equals
(
locationTag
.
getType
().
name
(),
"BTT02"
)
?
"car"
:
"staff"
;
String
entityType
=
StrUtil
.
equals
(
locationTag
.
getType
().
name
(),
"BTT02"
)
?
"car"
:
"staff"
;
return
ZyLocationTagAddParam
return
ZyLocationTagAddParam
...
@@ -50,25 +50,7 @@ public class ZyLocationTagAddParam implements Serializable {
...
@@ -50,25 +50,7 @@ public class ZyLocationTagAddParam implements Serializable {
.
tagId
(
locationTag
.
getCode
())
.
tagId
(
locationTag
.
getCode
())
.
types
(
locationTag
.
getType
())
.
types
(
locationTag
.
getType
())
.
entityType
(
entityType
)
.
entityType
(
entityType
)
.
card
(
locationTag
.
getImei
())
.
build
();
.
build
();
}
}
public
static
List
<
ZyLocationTagAddParam
>
transforms
(
List
<
LocationTagImportExcel
>
locationTagImportExcels
,
Integer
orgId
)
{
return
locationTagImportExcels
.
stream
()
.
map
(
locationTagImportExcel
->
{
String
entityType
=
StrUtil
.
equals
(
locationTagImportExcel
.
getType
(),
"BTT02"
)
?
"car"
:
"staff"
;
return
ZyLocationTagAddParam
.
builder
()
.
entityType
(
entityType
)
.
orgId
(
orgId
)
.
tagId
(
locationTagImportExcel
.
getCode
())
.
types
(
LocationTag
.
Type
.
valueOf
(
locationTagImportExcel
.
getType
()))
.
build
();
})
.
collect
(
Collectors
.
toList
());
}
}
}
app/src/main/java/com/yiring/app/service/dept/DepartmentService.java
浏览文件 @
72c92e95
...
@@ -58,13 +58,6 @@ public interface DepartmentService {
...
@@ -58,13 +58,6 @@ public interface DepartmentService {
Result
<
String
>
deleteDepartment
(
IdParam
idParam
);
Result
<
String
>
deleteDepartment
(
IdParam
idParam
);
/**
/**
* 启用/停用
* @param idParam IdParam
* @return Result<String>
*/
Result
<
String
>
stateDepartment
(
IdParam
idParam
);
/**
* 部门添加岗位
* 部门添加岗位
* @param idParam IdParam
* @param idParam IdParam
* @param idsParam IdsParam
* @param idsParam IdsParam
...
...
app/src/main/java/com/yiring/app/service/dept/impl/DepartmentServiceImpl.java
浏览文件 @
72c92e95
差异被折叠。
点击展开。
app/src/main/java/com/yiring/app/service/location/tag/LocationTagService.java
浏览文件 @
72c92e95
...
@@ -52,12 +52,12 @@ public interface LocationTagService {
...
@@ -52,12 +52,12 @@ public interface LocationTagService {
*/
*/
Result
<
String
>
importLocationTagInfo
(
MultipartFile
file
);
Result
<
String
>
importLocationTagInfo
(
MultipartFile
file
);
/**
/*
*//*
*
* 修改定位标签
* 修改定位标签
* @param locationTagModifyParam 入参
* @param locationTagModifyParam 入参
* @return Result<String>
* @return Result<String>
*/
*/
/*
Result
<
String
>
modifyLocationTag
(
LocationTagModifyParam
locationTagModifyParam
);
Result<String> modifyLocationTag(LocationTagModifyParam locationTagModifyParam);
*/
/**
/**
* 检索标签
* 检索标签
...
...
app/src/main/java/com/yiring/app/service/location/tag/LocationTagTypeService.java
浏览文件 @
72c92e95
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
app
.
service
.
location
.
tag
;
package
com
.
yiring
.
app
.
service
.
location
.
tag
;
import
com.yiring.app.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeSendParam
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
...
@@ -24,4 +25,11 @@ public interface LocationTagTypeService {
...
@@ -24,4 +25,11 @@ public interface LocationTagTypeService {
LocationTagTypeFindParam
locationTagTypeFindParam
,
LocationTagTypeFindParam
locationTagTypeFindParam
,
PageParam
pageParam
PageParam
pageParam
);
);
/**
* 批量分配内部/外部
* @param locationtagtypeSendParam LocationTagTypeSendParam
* @return Result<String>
*/
Result
<
String
>
sendLocationTagType
(
LocationTagTypeSendParam
locationtagtypeSendParam
);
}
}
app/src/main/java/com/yiring/app/service/location/tag/impl/LocationTagServiceImpl.java
浏览文件 @
72c92e95
...
@@ -2,23 +2,29 @@
...
@@ -2,23 +2,29 @@
package
com
.
yiring
.
app
.
service
.
location
.
tag
.
impl
;
package
com
.
yiring
.
app
.
service
.
location
.
tag
.
impl
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
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
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.SaxExcelReader
;
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.location.LocationTagExportExcel
;
import
com.yiring.app.excel.location.tag.LocationTagExportExcel
;
import
com.yiring.app.excel.location.LocationTagImportExcel
;
import
com.yiring.app.excel.location.tag.LocationTagImportExcel
;
import
com.yiring.app.feign.zy.location.tag.LocationTagClient
;
import
com.yiring.app.param.location.tag.*
;
import
com.yiring.app.param.location.tag.*
;
import
com.yiring.app.param.
location.zy
.ZyLocationTagAddParam
;
import
com.yiring.app.param.
zy.location.tag
.ZyLocationTagAddParam
;
import
com.yiring.app.service.location.tag.LocationTagService
;
import
com.yiring.app.service.location.tag.LocationTagService
;
import
com.yiring.app.
service.zy.ZyHttpService
;
import
com.yiring.app.
util.zy.ZyUtil
;
import
com.yiring.app.vo.location.tag.LocationTagIndexVo
;
import
com.yiring.app.vo.location.tag.LocationTagIndexVo
;
import
com.yiring.app.vo.location.tag.LocationTagVo
;
import
com.yiring.app.vo.location.tag.LocationTagVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IndexParam
;
import
com.yiring.common.param.IndexParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
...
@@ -56,21 +62,41 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -56,21 +62,41 @@ public class LocationTagServiceImpl implements LocationTagService {
final
Integer
FACTORY_ID
=
100
;
final
Integer
FACTORY_ID
=
100
;
@Resource
@Resource
ZyHttpService
zyHttpService
;
LocationTagRepository
locationTagRepository
;
@Resource
@Resource
LocationTag
Repository
locationTagRepository
;
LocationTag
Client
locationTagClient
;
@Override
@Override
public
Result
<
String
>
addLocationTag
(
LocationTagAddParam
locationTagAddParam
)
{
public
Result
<
String
>
addLocationTag
(
LocationTagAddParam
locationTagAddParam
)
{
if
(
hasLocationTagInfoByCode
(
locationTagAddParam
.
getCode
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"编号已存在"
);
if
(
hasLocationTagInfoByCode
(
locationTagAddParam
.
getCode
()))
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"编号已存在"
);
LocationTag
locationTag
=
LocationTagAddParam
.
transform
(
locationTagAddParam
);
LocationTag
locationTag
=
LocationTagAddParam
.
transform
(
locationTagAddParam
);
locationTag
=
locationTagRepository
.
save
(
locationTag
);
ZyLocationTagAddParam
zyLocationTagAddParam
=
ZyLocationTagAddParam
.
transform
(
locationTag
,
FACTORY_ID
);
ZyLocationTagAddParam
zyLocationTagAddParam
=
ZyLocationTagAddParam
.
transform
(
locationTag
,
FACTORY_ID
);
List
<
ZyLocationTagAddParam
>
of
=
ListUtil
.
of
(
zyLocationTagAddParam
);
JSONObject
jsonObject
=
locationTagClient
.
tagSave
(
zyHttpService
.
post
(
"/positionApi/api/tag/saveTag"
,
of
,
3000
);
JSONUtil
.
toJsonStr
(
zyLocationTagAddParam
),
locationTagRepository
.
save
(
locationTag
);
"Bearer "
+
ZyUtil
.
manageLogin
()
);
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
HashMap
<
String
,
Object
>
page
=
new
HashMap
<>();
page
.
put
(
"orgId"
,
FACTORY_ID
);
page
.
put
(
"pageNum"
,
1
);
page
.
put
(
"pageSize"
,
1
);
page
.
put
(
"tagId"
,
locationTag
.
getCode
());
JSONObject
result
=
locationTagClient
.
tagPage
(
JSONUtil
.
toJsonStr
(
page
),
ZyUtil
.
manageLogin
());
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
JSONObject
data
=
JSONUtil
.
parseObj
(
result
.
get
(
"data"
));
JSONArray
records
=
JSONUtil
.
parseArray
(
data
.
get
(
"records"
));
List
<
IdParam
>
idParams
=
JSONUtil
.
toList
(
JSONUtil
.
toJsonStr
(
records
),
IdParam
.
class
);
Long
id
=
idParams
.
get
(
0
).
getId
();
locationTag
.
setLinkId
(
id
);
locationTagRepository
.
save
(
locationTag
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
@@ -114,10 +140,27 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -114,10 +140,27 @@ public class LocationTagServiceImpl implements LocationTagService {
@Override
@Override
public
Result
<
String
>
deleteLocationTag
(
LocationTagDeleteParam
locationTagDeleteParam
)
{
public
Result
<
String
>
deleteLocationTag
(
LocationTagDeleteParam
locationTagDeleteParam
)
{
Map
<
Object
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
Map
<
Object
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"tagIds"
,
locationTagDeleteParam
.
getCodes
());
map
.
put
(
"orgId"
,
FACTORY_ID
);
map
.
put
(
"orgId"
,
FACTORY_ID
);
zyHttpService
.
delete
(
"/positionApi/api/tag/delete"
,
map
,
3000
);
Long
[]
ids
=
locationTagDeleteParam
.
getIds
();
locationTagRepository
.
deleteAllById
(
ListUtil
.
toList
(
locationTagDeleteParam
.
getIds
()));
for
(
Long
id
:
ids
)
{
Optional
<
LocationTag
>
locationTagOptional
=
locationTagRepository
.
findOne
(
Example
.
of
(
LocationTag
.
builder
().
id
(
id
).
build
())
);
if
(
locationTagOptional
.
isEmpty
())
{
throw
new
RuntimeException
();
}
LocationTag
locationTag
=
locationTagOptional
.
get
();
locationTagRepository
.
deleteById
(
id
);
Object
code
=
locationTagClient
.
tagDelete
(
Convert
.
toStr
(
locationTag
.
getLinkId
()),
JSONUtil
.
toJsonStr
(
map
),
ZyUtil
.
manageLogin
())
.
get
(
"code"
);
if
(!
ObjectUtil
.
equals
(
code
,
200
))
{
throw
new
RuntimeException
();
}
}
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
@@ -205,33 +248,67 @@ public class LocationTagServiceImpl implements LocationTagService {
...
@@ -205,33 +248,67 @@ public class LocationTagServiceImpl implements LocationTagService {
.
map
(
LocationTagImportExcel:
:
transform
)
.
map
(
LocationTagImportExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
List
<
ZyLocationTagAddParam
>
zyLocationTagAddParams
=
ZyLocationTagAddParam
.
transforms
(
locationTags
.
forEach
(
locationTag
->
{
locationTagImportExcels
,
locationTag
=
locationTagRepository
.
save
(
locationTag
);
FACTORY_ID
ZyLocationTagAddParam
zyLocationTagAddParam
=
ZyLocationTagAddParam
.
transform
(
locationTag
,
FACTORY_ID
);
JSONObject
jsonObject
=
locationTagClient
.
tagSave
(
JSONUtil
.
toJsonStr
(
zyLocationTagAddParam
),
"Bearer "
+
ZyUtil
.
manageLogin
()
);
);
zyHttpService
.
post
(
"/positionApi/api/tag/saveTag"
,
zyLocationTagAddParams
,
3000
);
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
locationTagRepository
.
saveAll
(
locationTags
);
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
HashMap
<
String
,
Object
>
page
=
new
HashMap
<>();
page
.
put
(
"orgId"
,
FACTORY_ID
);
page
.
put
(
"pageNum"
,
1
);
page
.
put
(
"pageSize"
,
1
);
page
.
put
(
"tagId"
,
locationTag
.
getCode
());
JSONObject
result
=
locationTagClient
.
tagPage
(
JSONUtil
.
toJsonStr
(
page
),
ZyUtil
.
manageLogin
());
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
JSONObject
data
=
JSONUtil
.
parseObj
(
result
.
get
(
"data"
));
JSONArray
records
=
JSONUtil
.
parseArray
(
data
.
get
(
"records"
));
List
<
IdParam
>
idParams
=
JSONUtil
.
toList
(
JSONUtil
.
toJsonStr
(
records
),
IdParam
.
class
);
Long
id
=
idParams
.
get
(
0
).
getId
();
locationTag
.
setLinkId
(
id
);
locationTagRepository
.
save
(
locationTag
);
});
// List<ZyLocationTagAddParam> zyLocationTagAddParams = locationTags
// .stream()
// .map(locationTag ->
// ZyLocationTagAddParam.transform(locationTag, FACTORY_ID)
// )
// .collect(Collectors.toList());
// locationTagClient.tagImport(file,"{'orgId':100}",ZyUtil.manageLogin());
// locationTagRepository.saveAll(locationTags);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@Override
/*
@Override
public Result<String> modifyLocationTag(LocationTagModifyParam locationTagModifyParam) {
public Result<String> modifyLocationTag(LocationTagModifyParam locationTagModifyParam) {
long
count
=
locationTagRepository
.
count
(
Optional<LocationTag> locationTagOptional = locationTagRepository.findOne(
Example
.
of
(
Example.of(LocationTag.builder().id(locationTagModifyParam.getId()).build())
LocationTag
.
builder
().
id
(
locationTagModifyParam
.
getId
()).
code
(
locationTagModifyParam
.
getCode
()).
build
()
)
);
);
if (locationTagOptional.isEmpty()) return Result.no(Status.BAD_REQUEST, "标签不存在");
LocationTag locationTag = locationTagOptional.get();
// code相同
// code相同
if
(
count
==
0
&&
hasLocationTagInfoByCode
(
locationTagModifyParam
.
getCode
()))
{
if (
!StrUtil.equals(locationTag.getCode(), locationTagModifyParam.getCode()) &&
hasLocationTagInfoByCode(locationTagModifyParam.getCode())
) {
return Result.no(Status.BAD_REQUEST, "编号重复");
return Result.no(Status.BAD_REQUEST, "编号重复");
}
}
LocationTag
locationTag
=
LocationTagModifyParam
.
transform
(
locationTagModifyParam
);
LocationTag
ModifyParam.transform(locationTagModifyParam, locationTag
);
locationTagRepository.save(locationTag);
locationTagRepository.save(locationTag);
return Result.ok();
return Result.ok();
}
}
*/
@Override
@Override
public
Result
<
PageVo
<
LocationTagIndexVo
>>
indexLocationTag
(
IndexParam
indexParam
)
{
public
Result
<
PageVo
<
LocationTagIndexVo
>>
indexLocationTag
(
IndexParam
indexParam
)
{
...
...
app/src/main/java/com/yiring/app/service/location/tag/impl/LocationTagTypeServiceImpl.java
浏览文件 @
72c92e95
...
@@ -7,14 +7,18 @@ import cn.hutool.core.util.StrUtil;
...
@@ -7,14 +7,18 @@ import cn.hutool.core.util.StrUtil;
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.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeSendParam
;
import
com.yiring.app.service.location.tag.LocationTagTypeService
;
import
com.yiring.app.service.location.tag.LocationTagTypeService
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.domain.BasicEntity
;
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.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -68,4 +72,29 @@ public class LocationTagTypeServiceImpl implements LocationTagTypeService {
...
@@ -68,4 +72,29 @@ public class LocationTagTypeServiceImpl implements LocationTagTypeService {
PageVo
<
LocationTagTypeVo
>
pageVo
=
PageVo
.
build
(
locationTagTypeVos
,
locationTagTypeVos
.
size
());
PageVo
<
LocationTagTypeVo
>
pageVo
=
PageVo
.
build
(
locationTagTypeVos
,
locationTagTypeVos
.
size
());
return
Result
.
ok
(
pageVo
);
return
Result
.
ok
(
pageVo
);
}
}
@Override
public
Result
<
String
>
sendLocationTagType
(
LocationTagTypeSendParam
locationtagtypeSendParam
)
{
Specification
<
LocationTag
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
locationtagtypeSendParam
.
getIds
()))
{
CriteriaBuilder
.
In
<
Object
>
in
=
cb
.
in
(
root
.
get
(
BasicEntity
.
Fields
.
id
));
String
[]
split
=
locationtagtypeSendParam
.
getIds
().
split
(
","
);
ArrayList
<
String
>
list
=
ListUtil
.
toList
(
split
);
for
(
String
id
:
list
)
in
.
value
(
id
);
predicates
.
add
(
cb
.
and
(
in
));
}
Order
order
=
cb
.
desc
(
root
.
get
(
LocationTag
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
List
<
LocationTag
>
locationTags
=
locationTagRepository
.
findAll
(
specification
);
locationTags
=
locationTags
.
stream
()
.
peek
(
locationTag
->
locationTag
.
setCategory
(
locationtagtypeSendParam
.
getCategory
()))
.
collect
(
Collectors
.
toList
());
locationTagRepository
.
saveAll
(
locationTags
);
return
Result
.
ok
();
}
}
}
app/src/main/java/com/yiring/app/service/post/impl/PostServiceImpl.java
浏览文件 @
72c92e95
...
@@ -15,6 +15,7 @@ import com.yiring.auth.domain.post.PostRepository;
...
@@ -15,6 +15,7 @@ import com.yiring.auth.domain.post.PostRepository;
import
com.yiring.auth.excel.post.PostExcel
;
import
com.yiring.auth.excel.post.PostExcel
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IndexParam
;
import
com.yiring.common.param.IndexParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
...
@@ -23,6 +24,7 @@ import java.io.OutputStream;
...
@@ -23,6 +24,7 @@ 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.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -62,16 +64,20 @@ public class PostServiceImpl implements PostService {
...
@@ -62,16 +64,20 @@ public class PostServiceImpl implements PostService {
@Override
@Override
public
Result
<
String
>
modifyPost
(
PostModifyParam
postModifyParam
)
{
public
Result
<
String
>
modifyPost
(
PostModifyParam
postModifyParam
)
{
// 是否变更 职位名称
// 是否变更 职位名称
long
count
=
postRepository
.
count
(
Optional
<
Post
>
postOptional
=
postRepository
.
findOne
(
Example
.
of
(
Post
.
builder
().
id
(
postModifyParam
.
getId
()).
name
(
postModifyParam
.
getName
()).
build
())
Example
.
of
(
Post
.
builder
().
id
(
postModifyParam
.
getId
()).
name
(
postModifyParam
.
getName
()).
build
())
);
);
if
(
postOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
);
Post
post
=
postOptional
.
get
();
// 变更处理
// 变更处理
if
(
count
==
0
&&
hasPostInfo
(
postModifyParam
.
getName
()))
{
if
(
!
StrUtil
.
equals
(
post
.
getName
(),
postModifyParam
.
getName
())
&&
hasPostInfo
(
postModifyParam
.
getName
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位名称重复"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"职位名称重复"
);
}
}
Post
post
=
postModifyParam
.
transform
(
postModifyParam
);
postModifyParam
.
transform
(
postModifyParam
,
post
);
postRepository
.
save
(
post
);
postRepository
.
save
(
post
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
@@ -96,7 +102,7 @@ public class PostServiceImpl implements PostService {
...
@@ -96,7 +102,7 @@ public class PostServiceImpl implements PostService {
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
postFindParam
.
getEnable
()));
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
postFindParam
.
getEnable
()));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
Post
.
Fields
.
createTime
));
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
};
...
@@ -105,7 +111,7 @@ public class PostServiceImpl implements PostService {
...
@@ -105,7 +111,7 @@ public class PostServiceImpl implements PostService {
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Page
<
Post
>
page
=
postRepository
.
findAll
(
specification
,
pageable
);
Page
<
Post
>
page
=
postRepository
.
findAll
(
specification
,
pageable
);
List
<
PostVo
>
postVos
=
page
.
getContent
().
stream
().
map
(
PostVo:
:
transform
).
collect
(
Collectors
.
toList
());
List
<
PostVo
>
postVos
=
page
.
getContent
().
stream
().
map
(
PostVo:
:
transform
).
collect
(
Collectors
.
toList
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
p
ostVos
.
size
());
PageVo
<
PostVo
>
pageVo
=
PageVo
.
build
(
postVos
,
p
age
.
getTotalElements
());
return
Result
.
ok
(
pageVo
);
return
Result
.
ok
(
pageVo
);
}
}
...
@@ -135,7 +141,7 @@ public class PostServiceImpl implements PostService {
...
@@ -135,7 +141,7 @@ public class PostServiceImpl implements PostService {
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
postExportParam
.
getEnable
()));
predicates
.
add
(
cb
.
equal
(
root
.
get
(
Post
.
Fields
.
enable
),
postExportParam
.
getEnable
()));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
Post
.
Fields
.
createTime
));
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
};
...
@@ -184,7 +190,7 @@ public class PostServiceImpl implements PostService {
...
@@ -184,7 +190,7 @@ public class PostServiceImpl implements PostService {
predicates
.
add
(
cb
.
like
(
root
.
get
(
Post
.
Fields
.
name
),
"%"
+
indexParam
.
getStr
()
+
"%"
));
predicates
.
add
(
cb
.
like
(
root
.
get
(
Post
.
Fields
.
name
),
"%"
+
indexParam
.
getStr
()
+
"%"
));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
Post
.
Fields
.
createTime
));
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
});
});
...
...
app/src/main/java/com/yiring/app/service/user/impl/UserServiceImpl.java
浏览文件 @
72c92e95
...
@@ -2,17 +2,25 @@
...
@@ -2,17 +2,25 @@
package
com
.
yiring
.
app
.
service
.
user
.
impl
;
package
com
.
yiring
.
app
.
service
.
user
.
impl
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.convert.Convert
;
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
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.github.liaochong.myexcel.core.SaxExcelReader
;
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.excel.user.UserImportExcel
;
import
com.yiring.app.feign.zy.user.UserClient
;
import
com.yiring.app.param.user.*
;
import
com.yiring.app.param.user.*
;
import
com.yiring.app.param.zy.user.ZyUserAddParam
;
import
com.yiring.app.param.zy.user.ZyUserFindParam
;
import
com.yiring.app.service.dept.DepartmentService
;
import
com.yiring.app.service.dept.DepartmentService
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.util.zy.ZyUtil
;
import
com.yiring.app.vo.user.UserInfoVo
;
import
com.yiring.app.vo.user.UserInfoVo
;
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
;
...
@@ -59,6 +67,8 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -59,6 +67,8 @@ import org.springframework.web.multipart.MultipartFile;
@Slf4j
@Slf4j
public
class
UserServiceImpl
implements
UserService
{
public
class
UserServiceImpl
implements
UserService
{
final
Integer
FACTORY_ID
=
100
;
@Resource
@Resource
EntityManager
em
;
EntityManager
em
;
...
@@ -77,16 +87,21 @@ public class UserServiceImpl implements UserService {
...
@@ -77,16 +87,21 @@ public class UserServiceImpl implements UserService {
@Resource
@Resource
PostRepository
postRepository
;
PostRepository
postRepository
;
@Resource
UserClient
userClient
;
@Override
@Override
public
Result
<
PageVo
<
UserVo
>>
findUserPage
(
UserFindParam
userFindParam
,
PageParam
pageParam
)
{
public
Result
<
PageVo
<
UserVo
>>
findUserPage
(
UserFindParam
userFindParam
,
PageParam
pageParam
)
{
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
userFindParam
);
CriteriaQuery
<
UserVo
>
cq
=
getUserVoCriteriaQuery
(
userFindParam
);
List
<
UserVo
>
userVos
=
em
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
)
.
createQuery
(
cq
)
.
setFirstResult
(
pageParam
.
getPageNo
())
.
setFirstResult
(
(
pageParam
.
getPageNo
()
-
1
)
*
pageParam
.
getPageSize
())
.
setMaxResults
(
pageParam
.
getPageSize
())
.
setMaxResults
(
pageParam
.
getPageSize
())
.
getResultList
();
.
getResultList
();
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
int
size
=
em
.
createQuery
(
cq
).
getResultList
().
size
();
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
size
);
return
Result
.
ok
(
page
);
return
Result
.
ok
(
page
);
}
}
...
@@ -224,20 +239,61 @@ public class UserServiceImpl implements UserService {
...
@@ -224,20 +239,61 @@ public class UserServiceImpl implements UserService {
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"工号相同"
);
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"工号相同"
);
}
}
User
newUser
=
userModifyParam
.
transform
();
if
(!
StrUtil
.
equals
(
user
.
getMobile
(),
userModifyParam
.
getMobile
()))
{
long
count
=
userRepository
.
count
(
Example
.
of
(
User
.
builder
().
uuid
(
userModifyParam
.
getMobile
()).
build
()));
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"手机号相同"
);
}
UserModifyParam
.
transform
(
userModifyParam
,
user
);
userRepository
.
save
(
newU
ser
);
userRepository
.
save
(
u
ser
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
@Override
@Override
public
Result
<
String
>
addUser
(
UserAddParam
userAddParam
)
{
public
Result
<
String
>
addUser
(
UserAddParam
userAddParam
)
{
long
count
=
userRepository
.
count
(
Example
.
of
(
User
.
builder
().
uuid
(
userAddParam
.
getUuid
()).
build
())
);
User
user
=
UserAddParam
.
transform
(
userAddParam
);
if
(
count
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"工号相同"
);
Optional
<
Department
>
departmentOptional
=
departmentRepository
.
findOne
(
Example
.
of
(
user
.
getDepartment
())
);
User
user
=
UserAddParam
.
transform
(
userAddParam
);
if
(
departmentOptional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
BAD_REQUEST
);
}
Long
linkId
=
departmentOptional
.
get
().
getLinkId
();
user
.
setDepartment
(
departmentOptional
.
get
());
ZyUserAddParam
zyUserAddParam
=
ZyUserAddParam
.
transform
(
user
,
FACTORY_ID
);
zyUserAddParam
.
setDeptId
(
linkId
);
zyUserAddParam
.
setEntityIconId
(
user
.
getIsSpecial
()
?
10028
:
1
);
JSONObject
jsonObject
=
userClient
.
userAdd
(
JSONUtil
.
toJsonStr
(
zyUserAddParam
),
ZyUtil
.
clientLogin
());
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
ZyUserFindParam
zyUserFindParam
=
ZyUserFindParam
.
builder
()
.
orgId
(
FACTORY_ID
)
.
jobNum
(
zyUserAddParam
.
getJobNumber
())
.
pageNum
(
1
)
.
pageSize
(
1
)
.
build
();
JSONObject
result
=
userClient
.
list
(
JSONUtil
.
toJsonStr
(
zyUserFindParam
),
ZyUtil
.
clientLogin
());
if
(!
ObjectUtil
.
equals
(
result
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
result
.
get
(
"msg"
)));
}
JSONObject
data
=
JSONUtil
.
parseObj
(
result
.
get
(
"data"
));
JSONArray
records
=
JSONUtil
.
parseArray
(
data
.
get
(
"records"
));
// 拿第一个数据的id
Object
id
=
JSONUtil
.
parseObj
(
records
.
get
(
0
)).
get
(
"id"
);
user
.
setLinkId
(
Convert
.
toLong
(
id
));
userRepository
.
save
(
user
);
userRepository
.
save
(
user
);
return
Result
.
ok
();
return
Result
.
ok
();
...
@@ -333,7 +389,7 @@ public class UserServiceImpl implements UserService {
...
@@ -333,7 +389,7 @@ public class UserServiceImpl implements UserService {
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
).
getResultList
();
List
<
UserVo
>
userVos
=
em
.
createQuery
(
cq
).
getResultList
();
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
PageVo
<
UserVo
>
page
=
PageVo
.
build
(
userVos
,
getCount
());
return
Result
.
ok
(
page
);
return
Result
.
ok
(
page
);
}
}
...
@@ -345,20 +401,37 @@ public class UserServiceImpl implements UserService {
...
@@ -345,20 +401,37 @@ public class UserServiceImpl implements UserService {
Root
<
User
>
root
=
cq
.
from
(
User
.
class
);
Root
<
User
>
root
=
cq
.
from
(
User
.
class
);
Expression
<
Long
>
id
=
root
.
get
(
BasicEntity
.
Fields
.
id
);
Expression
<
Long
>
id
=
root
.
get
(
BasicEntity
.
Fields
.
id
);
Expression
<
String
>
realName
=
root
.
get
(
User
.
Fields
.
realName
);
Expression
<
String
>
realName
=
root
.
get
(
User
.
Fields
.
realName
);
Expression
<
String
>
avatar
=
root
.
get
(
User
.
Fields
.
avatar
);
Expression
<
String
>
uuid
=
root
.
get
(
User
.
Fields
.
uuid
);
Expression
<
String
>
uuid
=
root
.
get
(
User
.
Fields
.
uuid
);
Expression
<
User
.
Type
>
type
=
root
.
get
(
User
.
Fields
.
type
);
Expression
<
User
.
Type
>
type
=
root
.
get
(
User
.
Fields
.
type
);
Expression
<
Boolean
>
gender
=
root
.
get
(
User
.
Fields
.
gender
);
Expression
<
Boolean
>
gender
=
root
.
get
(
User
.
Fields
.
gender
);
Expression
<
Boolean
>
isSpecial
=
root
.
get
(
User
.
Fields
.
isSpecial
);
Expression
<
Boolean
>
isSpecial
=
root
.
get
(
User
.
Fields
.
isSpecial
);
Expression
<
Department
>
department
=
root
.
get
(
User
.
Fields
.
department
).
get
(
"name"
);
Expression
<
String
>
department
=
root
.
get
(
User
.
Fields
.
department
).
get
(
"name"
);
Expression
<
String
>
departmentId
=
root
.
get
(
User
.
Fields
.
department
).
get
(
"id"
);
Expression
<
String
>
mobile
=
root
.
get
(
User
.
Fields
.
mobile
);
Expression
<
String
>
mobile
=
root
.
get
(
User
.
Fields
.
mobile
);
Expression
<
Post
>
post
=
root
.
get
(
User
.
Fields
.
post
).
get
(
"name"
);
Expression
<
String
>
post
=
root
.
get
(
User
.
Fields
.
post
).
get
(
"name"
);
Expression
<
String
>
postId
=
root
.
get
(
User
.
Fields
.
post
).
get
(
"id"
);
Subquery
<
String
>
query
=
cq
.
subquery
(
String
.
class
);
Subquery
<
String
>
query
=
cq
.
subquery
(
String
.
class
);
Root
<
LocationTag
>
tagRoot
=
query
.
from
(
LocationTag
.
class
);
Root
<
LocationTag
>
tagRoot
=
query
.
from
(
LocationTag
.
class
);
query
.
select
(
tagRoot
.
get
(
LocationTag
.
Fields
.
code
));
query
.
select
(
tagRoot
.
get
(
LocationTag
.
Fields
.
code
));
query
.
where
(
cb
.
equal
(
tagRoot
.
get
(
LocationTag
.
Fields
.
user
),
root
));
query
.
where
(
cb
.
equal
(
tagRoot
.
get
(
LocationTag
.
Fields
.
user
),
root
));
cq
.
multiselect
(
id
,
realName
,
uuid
,
type
,
department
,
mobile
,
post
,
query
,
gender
,
isSpecial
);
cq
.
multiselect
(
id
,
realName
,
uuid
,
type
,
department
,
mobile
,
post
,
query
,
gender
,
isSpecial
,
departmentId
,
postId
,
avatar
);
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
...
@@ -367,7 +440,7 @@ public class UserServiceImpl implements UserService {
...
@@ -367,7 +440,7 @@ public class UserServiceImpl implements UserService {
}
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getCode
()))
{
if
(
StrUtil
.
isNotEmpty
(
param
.
getCode
()))
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
LocationTag
.
Fields
.
code
)
,
"%"
+
param
.
getCode
()
+
"%"
));
predicates
.
add
(
cb
.
like
(
query
,
"%"
+
param
.
getCode
()
+
"%"
));
}
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getUuid
()))
{
if
(
StrUtil
.
isNotEmpty
(
param
.
getUuid
()))
{
...
@@ -387,4 +460,8 @@ public class UserServiceImpl implements UserService {
...
@@ -387,4 +460,8 @@ public class UserServiceImpl implements UserService {
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
return
cq
;
return
cq
;
}
}
public
Long
getCount
()
{
return
userRepository
.
count
();
}
}
}
app/src/main/java/com/yiring/app/service/zy/ZyHttpService.java
deleted
100644 → 0
浏览文件 @
cb5fc1e0
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
zy
;
import
com.yiring.common.core.Result
;
import
java.io.Serializable
;
import
java.util.concurrent.CompletableFuture
;
/**
* ZyHttp请求
* @author LJ-2204
* @date 2022/4/18
*/
public
interface
ZyHttpService
{
/**
* get请求
* @param urlString 路径
* @param obj 参数
* @param timeout 请求时长
* @return json
*/
CompletableFuture
<
Result
<
Serializable
>>
get
(
String
urlString
,
Object
obj
,
int
timeout
);
/**
* post请求
* @param urlString 路径
* @param obj 参数
* @param timeout 请求时长
* @return json
*/
CompletableFuture
<
Result
<
Serializable
>>
post
(
String
urlString
,
Object
obj
,
int
timeout
);
/**
* put请求
* @param urlString 路径
* @param obj 参数
* @param timeout 请求时长
* @return json
*/
CompletableFuture
<
Result
<
Serializable
>>
put
(
String
urlString
,
Object
obj
,
int
timeout
);
/**
* delete请求
* @param urlString 路径
* @param obj 参数
* @param timeout 请求时长
* @return json
*/
CompletableFuture
<
Result
<
Serializable
>>
delete
(
String
urlString
,
Object
obj
,
int
timeout
);
}
app/src/main/java/com/yiring/app/service/zy/impl/ZyHttpServiceImpl.java
deleted
100644 → 0
浏览文件 @
cb5fc1e0
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
zy
.
impl
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.Header
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.json.JSONUtil
;
import
com.yiring.app.service.zy.ZyHttpService
;
import
com.yiring.auth.util.ZyUtil
;
import
com.yiring.common.core.Result
;
import
java.io.Serializable
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* ZyHttp请求
* @author LJ-2204
* @date 2022/4/18
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Service
@Slf4j
public
class
ZyHttpServiceImpl
implements
ZyHttpService
{
public
final
String
TOKEN_TYPE
=
"bearer "
;
public
final
String
URL_PREFIX
=
"http://project.yz-online.com:789"
;
@Override
@Async
(
"httpThreadPool"
)
public
CompletableFuture
<
Result
<
Serializable
>>
get
(
String
urlString
,
Object
obj
,
int
timeout
)
{
String
json
=
JSONUtil
.
toJsonStr
(
obj
);
String
token
=
ZyUtil
.
login
();
String
body
=
HttpRequest
.
get
(
URL_PREFIX
+
urlString
)
.
header
(
Header
.
AUTHORIZATION
,
TOKEN_TYPE
+
token
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/json"
)
.
body
(
json
)
.
timeout
(
timeout
)
.
execute
()
.
body
();
return
CompletableFuture
.
completedFuture
(
getResult
(
body
));
}
@Override
@Async
(
"httpThreadPool"
)
public
CompletableFuture
<
Result
<
Serializable
>>
post
(
String
urlString
,
Object
obj
,
int
timeout
)
{
String
json
=
JSONUtil
.
toJsonStr
(
obj
);
String
token
=
ZyUtil
.
login
();
String
body
=
HttpRequest
.
post
(
URL_PREFIX
+
urlString
)
.
header
(
Header
.
AUTHORIZATION
,
TOKEN_TYPE
+
token
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/json"
)
.
body
(
json
)
.
timeout
(
timeout
)
.
execute
()
.
body
();
return
CompletableFuture
.
completedFuture
(
getResult
(
body
));
}
@Override
@Async
(
"httpThreadPool"
)
public
CompletableFuture
<
Result
<
Serializable
>>
put
(
String
urlString
,
Object
obj
,
int
timeout
)
{
String
json
=
JSONUtil
.
toJsonStr
(
obj
);
String
token
=
ZyUtil
.
login
();
String
body
=
HttpRequest
.
put
(
URL_PREFIX
+
urlString
)
.
header
(
Header
.
AUTHORIZATION
,
TOKEN_TYPE
+
token
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/json"
)
.
body
(
json
)
.
timeout
(
timeout
)
.
execute
()
.
body
();
return
CompletableFuture
.
completedFuture
(
getResult
(
body
));
}
@Override
@Async
(
"httpThreadPool"
)
public
CompletableFuture
<
Result
<
Serializable
>>
delete
(
String
urlString
,
Object
obj
,
int
timeout
)
{
String
json
=
JSONUtil
.
toJsonStr
(
obj
);
String
token
=
ZyUtil
.
login
();
String
body
=
HttpRequest
.
delete
(
URL_PREFIX
+
urlString
)
.
header
(
Header
.
AUTHORIZATION
,
TOKEN_TYPE
+
token
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/x-www-form-urlencoded"
)
.
body
(
json
)
.
timeout
(
timeout
)
.
execute
()
.
body
();
return
CompletableFuture
.
completedFuture
(
getResult
(
body
));
}
/**
* 返回类型转换
* @param body json
* @return Result
*/
private
static
Result
<
Serializable
>
getResult
(
String
body
)
{
String
data
=
null
;
Map
map
=
JSONUtil
.
toBean
(
body
,
Map
.
class
);
Integer
code
=
Convert
.
toInt
(
map
.
get
(
"code"
));
String
msg
=
Convert
.
toStr
(
map
.
get
(
"msg"
));
if
(
ObjectUtil
.
isNotEmpty
(
map
.
get
(
"data"
)))
{
data
=
Convert
.
toStr
(
map
.
get
(
"data"
));
}
return
Result
.
builder
().
status
(
code
).
message
(
msg
).
body
(
data
).
build
();
}
}
app/src/main/java/com/yiring/app/util/zy/ZyUtil.java
0 → 100644
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
util
.
zy
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
cn.hutool.http.Header
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.yiring.app.rabbit.config.ZyConfigProperties
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
lombok.experimental.UtilityClass
;
import
org.springframework.data.redis.core.RedisTemplate
;
/**
* 真源授权工具
* @author LJ-2204
* @date 2022/4/15
*/
@UtilityClass
public
class
ZyUtil
{
RedisTemplate
<
String
,
Object
>
redisTemplate
;
ZyConfigProperties
.
ZyConfigOpen
zyConfigOpen
;
ZyConfigProperties
.
ZyConfigProxy
zyConfigProxy
;
static
{
redisTemplate
=
SpringUtil
.
getBean
(
"redisTemplate"
);
zyConfigOpen
=
SpringUtil
.
getBean
(
"zyConfigProperties.ZyConfigOpen"
);
zyConfigProxy
=
SpringUtil
.
getBean
(
"zyConfigProperties.ZyConfigProxy"
);
}
public
final
Integer
ORG_ID
=
100
;
public
final
String
OPEN_KEY
=
"zy_open_token"
;
// public final String CLIENT_KEY = "zy_client_token";
// public final String MANAGE_KEY = "zy_manage_token";
/**
* 获取openToken
* @return token
*/
public
static
String
openLogin
()
{
Object
obj
=
redisTemplate
.
opsForValue
().
get
(
OPEN_KEY
);
if
(
ObjectUtil
.
isNotEmpty
(
obj
))
{
return
String
.
valueOf
(
obj
);
}
Map
<
String
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"client_id"
,
zyConfigOpen
.
getClientId
());
map
.
put
(
"client_secret"
,
zyConfigOpen
.
getClientSecret
());
map
.
put
(
"grant_type"
,
zyConfigOpen
.
getGrantType
());
String
json
=
HttpUtil
.
get
(
zyConfigOpen
.
getApi
()
+
"/oauth/token"
,
map
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
json
);
String
access_token
=
Convert
.
toStr
(
jsonObject
.
get
(
"access_token"
));
Integer
expires_in
=
Convert
.
toInt
(
jsonObject
.
get
(
"expires_in"
));
redisTemplate
.
opsForValue
().
set
(
OPEN_KEY
,
access_token
,
expires_in
,
TimeUnit
.
SECONDS
);
return
access_token
;
}
/**
* 获取应用平台token
* @return token
*/
public
static
String
clientLogin
()
{
// Object obj = redisTemplate.opsForValue().get(CLIENT_KEY);
// if (ObjectUtil.isNotEmpty(obj)) {
// return String.valueOf(obj);
// }
Map
<
String
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"orgId"
,
ORG_ID
);
map
.
put
(
"tenantId"
,
zyConfigProxy
.
getTenant
());
map
.
put
(
"username"
,
zyConfigProxy
.
getClient
().
getUsername
());
map
.
put
(
"password"
,
zyConfigProxy
.
getClient
().
getPassword
());
String
json
=
HttpRequest
.
post
(
zyConfigProxy
.
getApi
()
+
"/position/login"
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/json"
)
.
body
(
JSONUtil
.
toJsonStr
(
map
))
.
execute
()
.
body
();
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
json
);
// String token = Convert.toStr(jsonObject.get("token"));
// redisTemplate.opsForValue().set(CLIENT_KEY, token, 1200, TimeUnit.SECONDS);
return
Convert
.
toStr
(
jsonObject
.
get
(
"token"
));
}
/**
* 获取管理平台token
* @return token
*/
public
static
String
manageLogin
()
{
// Object obj = redisTemplate.opsForValue().get(MANAGE_KEY);
// if (ObjectUtil.isNotEmpty(obj)) {
// return String.valueOf(obj);
// }
Map
<
String
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"orgId"
,
ORG_ID
);
map
.
put
(
"tenantId"
,
zyConfigProxy
.
getTenant
());
map
.
put
(
"username"
,
zyConfigProxy
.
getManage
().
getUsername
());
map
.
put
(
"password"
,
zyConfigProxy
.
getManage
().
getPassword
());
String
json
=
HttpRequest
.
post
(
zyConfigProxy
.
getApi
()
+
"/position/login"
)
.
header
(
Header
.
CONTENT_TYPE
,
"application/json"
)
.
body
(
JSONUtil
.
toJsonStr
(
map
))
.
execute
()
.
body
();
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
json
);
// String token = Convert.toStr(jsonObject.get("token"));
// redisTemplate.opsForValue().set(MANAGE_KEY, token, 1200, TimeUnit.SECONDS);
return
Convert
.
toStr
(
jsonObject
.
get
(
"token"
));
}
}
app/src/main/java/com/yiring/app/vo/post/PostVo.java
浏览文件 @
72c92e95
...
@@ -39,6 +39,9 @@ public class PostVo implements Serializable {
...
@@ -39,6 +39,9 @@ public class PostVo implements Serializable {
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
"创建时间"
)
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
"创建时间"
)
LocalDateTime
createTime
;
LocalDateTime
createTime
;
@ApiModelProperty
(
value
=
"描述"
,
example
=
"描述"
)
String
describe
;
@ApiModelProperty
(
value
=
"职位状态"
,
example
=
"true"
)
@ApiModelProperty
(
value
=
"职位状态"
,
example
=
"true"
)
Boolean
enable
;
Boolean
enable
;
...
@@ -48,6 +51,7 @@ public class PostVo implements Serializable {
...
@@ -48,6 +51,7 @@ public class PostVo implements Serializable {
.
id
(
post
.
getId
())
.
id
(
post
.
getId
())
.
name
(
post
.
getName
())
.
name
(
post
.
getName
())
.
enable
(
post
.
getEnable
())
.
enable
(
post
.
getEnable
())
.
describe
(
post
.
getDescribe
())
.
createTime
(
post
.
getCreateTime
())
.
createTime
(
post
.
getCreateTime
())
.
build
();
.
build
();
}
}
...
...
app/src/main/java/com/yiring/app/vo/user/UserVo.java
浏览文件 @
72c92e95
...
@@ -44,12 +44,20 @@ public class UserVo implements Serializable {
...
@@ -44,12 +44,20 @@ public class UserVo implements Serializable {
@ApiModelProperty
(
value
=
"部门"
,
example
=
"系统管理员"
)
@ApiModelProperty
(
value
=
"部门"
,
example
=
"系统管理员"
)
String
department
;
String
department
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"200"
)
Long
departmentId
;
@ApiModelProperty
(
value
=
"手机号"
,
example
=
"13012345678"
)
@ApiModelProperty
(
value
=
"手机号"
,
example
=
"13012345678"
)
String
mobile
;
String
mobile
;
@ApiModelProperty
(
value
=
"职位"
,
example
=
"系统管理员"
)
@ApiModelProperty
(
value
=
"职位"
,
example
=
"系统管理员"
)
String
post
;
String
post
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"职位id"
,
example
=
"100"
)
Long
postId
;
@ApiModelProperty
(
value
=
"标签编号"
,
example
=
"BTT88888888"
)
@ApiModelProperty
(
value
=
"标签编号"
,
example
=
"BTT88888888"
)
String
code
;
String
code
;
...
@@ -62,6 +70,9 @@ public class UserVo implements Serializable {
...
@@ -62,6 +70,9 @@ public class UserVo implements Serializable {
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"developer@yiring.com"
)
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"developer@yiring.com"
)
String
email
;
String
email
;
@ApiModelProperty
(
value
=
"头像"
,
example
=
"baidu.com"
)
String
avatar
;
public
UserVo
(
public
UserVo
(
Long
id
,
Long
id
,
String
realName
,
String
realName
,
...
@@ -72,7 +83,10 @@ public class UserVo implements Serializable {
...
@@ -72,7 +83,10 @@ public class UserVo implements Serializable {
String
post
,
String
post
,
String
code
,
String
code
,
Boolean
gender
,
Boolean
gender
,
Boolean
isSpecial
Boolean
isSpecial
,
Long
departmentId
,
Long
postId
,
String
avatar
)
{
)
{
this
.
id
=
id
;
this
.
id
=
id
;
this
.
realName
=
realName
;
this
.
realName
=
realName
;
...
@@ -84,6 +98,9 @@ public class UserVo implements Serializable {
...
@@ -84,6 +98,9 @@ public class UserVo implements Serializable {
this
.
code
=
code
;
this
.
code
=
code
;
this
.
gender
=
gender
;
this
.
gender
=
gender
;
this
.
isSpecial
=
isSpecial
;
this
.
isSpecial
=
isSpecial
;
this
.
departmentId
=
departmentId
;
this
.
postId
=
postId
;
this
.
avatar
=
avatar
;
}
}
public
static
UserVo
transformDept
(
User
user
)
{
public
static
UserVo
transformDept
(
User
user
)
{
...
...
app/src/main/java/com/yiring/app/web/HelloController.java
浏览文件 @
72c92e95
...
@@ -3,6 +3,7 @@ package com.yiring.app.web;
...
@@ -3,6 +3,7 @@ package com.yiring.app.web;
import
com.yiring.app.constant.Code
;
import
com.yiring.app.constant.Code
;
import
com.yiring.app.exception.CodeException
;
import
com.yiring.app.exception.CodeException
;
import
com.yiring.app.util.zy.ZyUtil
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
...
@@ -46,4 +47,9 @@ public class HelloController {
...
@@ -46,4 +47,9 @@ public class HelloController {
PageVo
<
String
>
vo
=
PageVo
.
build
(
data
,
data
.
size
());
PageVo
<
String
>
vo
=
PageVo
.
build
(
data
,
data
.
size
());
return
Result
.
ok
(
vo
);
return
Result
.
ok
(
vo
);
}
}
@GetMapping
(
"test"
)
public
Result
<
String
>
test
()
{
return
Result
.
ok
(
ZyUtil
.
manageLogin
());
}
}
}
app/src/main/java/com/yiring/app/web/dept/DepartmentController.java
浏览文件 @
72c92e95
...
@@ -68,12 +68,6 @@ public class DepartmentController {
...
@@ -68,12 +68,6 @@ public class DepartmentController {
return
departmentService
.
deleteDepartment
(
idParam
);
return
departmentService
.
deleteDepartment
(
idParam
);
}
}
@ApiOperation
(
"启用/停用"
)
@PutMapping
(
"stateDepartment"
)
public
Result
<
String
>
stateDepartment
(
@Valid
IdParam
idParam
)
{
return
departmentService
.
stateDepartment
(
idParam
);
}
@ApiOperation
(
"给部门添加职位"
)
@ApiOperation
(
"给部门添加职位"
)
@PutMapping
(
"deptBingPost"
)
@PutMapping
(
"deptBingPost"
)
public
Result
<
String
>
deptBingPost
(
@Valid
IdParam
idParam
,
@Valid
IdsParam
idsParam
)
{
public
Result
<
String
>
deptBingPost
(
@Valid
IdParam
idParam
,
@Valid
IdsParam
idsParam
)
{
...
@@ -87,7 +81,7 @@ public class DepartmentController {
...
@@ -87,7 +81,7 @@ public class DepartmentController {
}
}
@ApiOperation
(
"部门导入"
)
@ApiOperation
(
"部门导入"
)
@PostMapping
(
"Department"
)
@PostMapping
(
"
import
Department"
)
public
Result
<
String
>
importDepartment
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
public
Result
<
String
>
importDepartment
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
return
departmentService
.
importDepartment
(
file
);
return
departmentService
.
importDepartment
(
file
);
}
}
...
...
app/src/main/java/com/yiring/app/web/location/beacon/LocationBeaconController.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
location
.
beacon
;
package
com
.
yiring
.
app
.
web
.
location
.
beacon
;
import
com.yiring.app.param.location.beacon.LocationBeaconExportParam
;
import
com.yiring.app.param.location.beacon.LocationBeaconFindParam
;
import
com.yiring.app.service.location.beacon.LocationBeaconService
;
import
com.yiring.app.vo.location.beacon.LocationBeaconVo
;
import
com.yiring.common.core.Result
;
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.servlet.http.HttpServletResponse
;
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
;
...
@@ -19,4 +32,32 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -19,4 +32,32 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
tags
=
"定位信标"
)
@Api
(
tags
=
"定位信标"
)
@RestController
@RestController
@RequestMapping
(
"/location/beacon/"
)
@RequestMapping
(
"/location/beacon/"
)
public
class
LocationBeaconController
{}
public
class
LocationBeaconController
{
@Resource
LocationBeaconService
locationBeaconService
;
@ApiOperation
(
"添加定位信标"
)
@PostMapping
(
"saveLocationBeacon"
)
public
void
saveLocationBeacon
()
{
locationBeaconService
.
saveLocationBeacon
();
}
@ApiOperation
(
"表格查询"
)
@GetMapping
(
"findLocationBeacon"
)
public
Result
<
PageVo
<
LocationBeaconVo
>>
findLocationBeacon
(
@Valid
LocationBeaconFindParam
locationBeaconFindParam
,
@Valid
PageParam
pageParam
)
{
return
locationBeaconService
.
findLocationBeacon
(
locationBeaconFindParam
,
pageParam
);
}
@ApiOperation
(
"导出"
)
@GetMapping
(
"exportLocationBeacon"
)
public
void
exportLocationBeacon
(
@Valid
LocationBeaconExportParam
locationBeaconExportParam
,
HttpServletResponse
response
)
{
locationBeaconService
.
exportLocationBeacon
(
locationBeaconExportParam
,
response
);
}
}
app/src/main/java/com/yiring/app/web/location/tag/LocationTagController.java
浏览文件 @
72c92e95
...
@@ -71,11 +71,11 @@ public class LocationTagController {
...
@@ -71,11 +71,11 @@ public class LocationTagController {
return
locationTagService
.
importLocationTagInfo
(
file
);
return
locationTagService
.
importLocationTagInfo
(
file
);
}
}
@ApiOperation
(
"修改定位标签"
)
/*
@ApiOperation("修改定位标签")
@PutMapping("modifyLocationTag")
@PutMapping("modifyLocationTag")
public Result<String> modifyLocationTag(@Valid LocationTagModifyParam locationTagModifyParam) {
public Result<String> modifyLocationTag(@Valid LocationTagModifyParam locationTagModifyParam) {
return locationTagService.modifyLocationTag(locationTagModifyParam);
return locationTagService.modifyLocationTag(locationTagModifyParam);
}
}
*/
@ApiOperation
(
"标签检索"
)
@ApiOperation
(
"标签检索"
)
@GetMapping
(
"indexLocationTag"
)
@GetMapping
(
"indexLocationTag"
)
...
...
app/src/main/java/com/yiring/app/web/location/tag/LocationTagTypeController.java
浏览文件 @
72c92e95
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
app
.
web
.
location
.
tag
;
package
com
.
yiring
.
app
.
web
.
location
.
tag
;
import
com.yiring.app.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeFindParam
;
import
com.yiring.app.param.location.tag.LocationTagTypeSendParam
;
import
com.yiring.app.service.location.tag.LocationTagTypeService
;
import
com.yiring.app.service.location.tag.LocationTagTypeService
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.app.vo.location.tag.LocationTagTypeVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
...
@@ -14,6 +15,7 @@ import javax.validation.Valid;
...
@@ -14,6 +15,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.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
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
;
...
@@ -42,4 +44,10 @@ public class LocationTagTypeController {
...
@@ -42,4 +44,10 @@ public class LocationTagTypeController {
)
{
)
{
return
locationTagTypeService
.
findLocationTagType
(
locationTagTypeFindParam
,
pageParam
);
return
locationTagTypeService
.
findLocationTagType
(
locationTagTypeFindParam
,
pageParam
);
}
}
@ApiOperation
(
"批量分配内部/外部"
)
@PutMapping
(
"sendLocationTagType"
)
public
Result
<
String
>
sendLocationTagType
(
@Valid
LocationTagTypeSendParam
locationtagtypeSendParam
)
{
return
locationTagTypeService
.
sendLocationTagType
(
locationtagtypeSendParam
);
}
}
}
app/src/main/java/com/yiring/app/web/map/MapController.java
浏览文件 @
72c92e95
...
@@ -3,7 +3,7 @@ package com.yiring.app.web.map;
...
@@ -3,7 +3,7 @@ package com.yiring.app.web.map;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.feign.MapClient
;
import
com.yiring.app.feign.MapClient
;
import
com.yiring.a
uth.util
.ZyUtil
;
import
com.yiring.a
pp.util.zy
.ZyUtil
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
...
@@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
* 地图控制器
* 地图控制器
* @author Administrator
* @author Administrator
* @version 1.0
* @version 1.0
* @description: TODO
* @date 2022/4/24 13:48
* @date 2022/4/24 13:48
*/
*/
@Slf4j
@Slf4j
...
@@ -36,7 +35,7 @@ public class MapController {
...
@@ -36,7 +35,7 @@ public class MapController {
@GetMapping
(
"/mapSelect"
)
@GetMapping
(
"/mapSelect"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"orgId"
,
required
=
true
,
name
=
"orgId"
)
})
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"orgId"
,
required
=
true
,
name
=
"orgId"
)
})
public
Result
<
Serializable
>
fail
(
String
orgId
)
{
public
Result
<
Serializable
>
fail
(
String
orgId
)
{
String
login
=
ZyUtil
.
l
ogin
();
String
login
=
ZyUtil
.
openL
ogin
();
JSONObject
jsonObject
=
mapClient
.
selectMap
(
orgId
,
"bearer "
+
login
);
JSONObject
jsonObject
=
mapClient
.
selectMap
(
orgId
,
"bearer "
+
login
);
return
Result
.
ok
(
jsonObject
.
get
(
"data"
).
toString
());
return
Result
.
ok
(
jsonObject
.
get
(
"data"
).
toString
());
}
}
...
...
basic-auth/src/main/java/com/yiring/auth/domain/dept/Department.java
浏览文件 @
72c92e95
...
@@ -5,20 +5,17 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
...
@@ -5,20 +5,17 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.post.Post
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.Hibernate
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
/**
* 部门
* 部门
...
@@ -30,7 +27,7 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -30,7 +27,7 @@ import org.hibernate.snowflake.SnowflakeId;
@Getter
@Getter
@Setter
@Setter
@ToString
@ToString
@
Builder
@
SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
...
@@ -38,17 +35,11 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -38,17 +35,11 @@ import org.hibernate.snowflake.SnowflakeId;
@Entity
@Entity
@Comment
(
"系统部门"
)
@Comment
(
"系统部门"
)
@Table
(
name
=
"SYS_DEPARTMENT"
,
indexes
=
{
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
)
})
@Table
(
name
=
"SYS_DEPARTMENT"
,
indexes
=
{
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
)
})
public
class
Department
implements
Serializable
{
public
class
Department
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
-
5402731145404250150L
;
private
static
final
long
serialVersionUID
=
-
5402731145404250150L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
/**
/**
* 数据来源于【真源人员定位系统 - 部门】
* 数据来源于【真源人员定位系统 - 部门】
* 作用: 用于双向联动进行数据同步
* 作用: 用于双向联动进行数据同步
...
@@ -87,12 +78,6 @@ public class Department implements Serializable {
...
@@ -87,12 +78,6 @@ public class Department implements Serializable {
@Comment
(
"树节点标识"
)
@Comment
(
"树节点标识"
)
String
tree
;
String
tree
;
@Comment
(
"更新时间"
)
LocalDateTime
updateTime
;
@Comment
(
"创建时间"
)
LocalDateTime
createTime
;
@Comment
(
"岗位集合"
)
@Comment
(
"岗位集合"
)
@Builder
.
Default
@Builder
.
Default
@ToString
.
Exclude
@ToString
.
Exclude
...
@@ -105,14 +90,6 @@ public class Department implements Serializable {
...
@@ -105,14 +90,6 @@ public class Department implements Serializable {
Set
<
Post
>
posts
=
new
HashSet
<>(
0
);
Set
<
Post
>
posts
=
new
HashSet
<>(
0
);
@Override
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
Hibernate
.
getClass
(
this
)
!=
Hibernate
.
getClass
(
o
))
return
false
;
Department
that
=
(
Department
)
o
;
return
id
!=
null
&&
Objects
.
equals
(
id
,
that
.
id
);
}
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
getClass
().
hashCode
();
return
getClass
().
hashCode
();
}
}
...
...
basic-auth/src/main/java/com/yiring/auth/domain/post/Post.java
浏览文件 @
72c92e95
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
auth
.
domain
.
post
;
package
com
.
yiring
.
auth
.
domain
.
post
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
/**
* 岗位
* 岗位
...
@@ -25,7 +22,7 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -25,7 +22,7 @@ import org.hibernate.snowflake.SnowflakeId;
@Getter
@Getter
@Setter
@Setter
@ToString
@ToString
@
Builder
@
SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
...
@@ -33,29 +30,17 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -33,29 +30,17 @@ import org.hibernate.snowflake.SnowflakeId;
@Entity
@Entity
@Comment
(
"系统岗位"
)
@Comment
(
"系统岗位"
)
@Table
(
name
=
"SYS_POST"
)
@Table
(
name
=
"SYS_POST"
)
public
class
Post
implements
Serializable
{
public
class
Post
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
3744892781714515997L
;
private
static
final
long
serialVersionUID
=
3744892781714515997L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
@Comment
(
"名称"
)
@Comment
(
"名称"
)
String
name
;
String
name
;
@Comment
(
"描述"
)
@Comment
(
"描述"
)
String
describe
;
String
describe
;
@Comment
(
"创建时间"
)
LocalDateTime
createTime
;
@Comment
(
"更新时间"
)
LocalDateTime
updateTime
;
@Comment
(
"是否启用"
)
@Comment
(
"是否启用"
)
Boolean
enable
;
Boolean
enable
;
}
}
basic-auth/src/main/java/com/yiring/auth/util/ZyUtil.java
deleted
100644 → 0
浏览文件 @
cb5fc1e0
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
auth
.
util
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
lombok.experimental.UtilityClass
;
import
org.springframework.data.redis.core.RedisTemplate
;
/**
* 真源授权工具
* @author LJ-2204
* @date 2022/4/15
*/
@UtilityClass
public
class
ZyUtil
{
RedisTemplate
<
String
,
Object
>
redisTemplate
;
static
{
redisTemplate
=
SpringUtil
.
getBean
(
"redisTemplate"
);
}
public
final
String
CLIENT_ID
=
"sc21080400"
;
public
final
String
CLIENT_SECRET
=
"12A14FDC"
;
public
final
String
GRANT_TYPE
=
"client_credentials"
;
public
final
String
KEY
=
"zy_token"
;
/**
* 获取token
* @return token
*/
public
static
String
login
()
{
Object
obj
=
redisTemplate
.
opsForValue
().
get
(
KEY
);
if
(
ObjectUtil
.
isNotEmpty
(
obj
))
{
return
String
.
valueOf
(
obj
);
}
Map
<
String
,
Object
>
map
=
MapUtil
.
createMap
(
HashMap
.
class
);
map
.
put
(
"client_id"
,
CLIENT_ID
);
map
.
put
(
"client_secret"
,
CLIENT_SECRET
);
map
.
put
(
"grant_type"
,
GRANT_TYPE
);
String
json
=
HttpUtil
.
get
(
"http://project.yz-online.com:789/positionApi/oauth/token"
,
map
);
Map
result
=
JSON
.
parseObject
(
json
,
Map
.
class
);
String
access_token
=
result
.
get
(
"access_token"
).
toString
();
String
expires_in
=
result
.
get
(
"expires_in"
).
toString
();
redisTemplate
.
opsForValue
().
set
(
KEY
,
access_token
,
Convert
.
toInt
(
expires_in
),
TimeUnit
.
SECONDS
);
return
access_token
;
}
/**
* 判断token是否有效
* @return T/F
*/
public
static
boolean
getToken
()
{
return
ObjectUtil
.
isNotEmpty
(
redisTemplate
.
opsForValue
().
get
(
KEY
));
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论