Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
e21e94dc
提交
e21e94dc
authored
5月 07, 2022
作者:
方治民
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev_lijing' of
https://gitlab.yiring.com/chemical-kesai/kshg-api
into dev_fzm
上级
a98f9f9c
b432177a
显示空白字符变更
内嵌
并排
正在显示
40 个修改的文件
包含
1906 行增加
和
16 行删除
+1906
-16
KeyAlarm.java
app/src/main/java/com/yiring/app/domain/key/KeyAlarm.java
+11
-0
KeyAlarmRules.java
...rc/main/java/com/yiring/app/domain/key/KeyAlarmRules.java
+60
-0
KeyAlarmRulesRepository.java
...va/com/yiring/app/domain/key/KeyAlarmRulesRepository.java
+17
-0
DepartmentExportExcel.java
...java/com/yiring/app/excel/dept/DepartmentExportExcel.java
+7
-2
KeyAlarmRulesExportExcel.java
...va/com/yiring/app/excel/key/KeyAlarmRulesExportExcel.java
+54
-0
LocationBeaconExportExcel.java
.../app/excel/location/beacon/LocationBeaconExportExcel.java
+36
-0
DepartmentClient.java
...n/java/com/yiring/app/feign/zy/dept/DepartmentClient.java
+33
-0
LocationBeaconClient.java
...ng/app/feign/zy/location/beacon/LocationBeaconClient.java
+21
-0
LocationTagClient.java
...m/yiring/app/feign/zy/location/tag/LocationTagClient.java
+37
-0
LocationTagTypeClient.java
...ring/app/feign/zy/location/tag/LocationTagTypeClient.java
+24
-0
UserClient.java
...rc/main/java/com/yiring/app/feign/zy/user/UserClient.java
+40
-0
KeyAlarmRulesAddParam.java
.../java/com/yiring/app/param/key/KeyAlarmRulesAddParam.java
+41
-0
KeyAlarmRulesExportParam.java
...va/com/yiring/app/param/key/KeyAlarmRulesExportParam.java
+34
-0
KeyAlarmRulesModifyParam.java
...va/com/yiring/app/param/key/KeyAlarmRulesModifyParam.java
+45
-0
KeyAlarmRulesPageParam.java
...java/com/yiring/app/param/key/KeyAlarmRulesPageParam.java
+34
-0
LocationBeaconAddParam.java
...ing/app/param/location/beacon/LocationBeaconAddParam.java
+76
-0
LocationBeaconExportParam.java
.../app/param/location/beacon/LocationBeaconExportParam.java
+31
-0
LocationBeaconFindParam.java
...ng/app/param/location/beacon/LocationBeaconFindParam.java
+31
-0
LocationTagTypeSendParam.java
...ring/app/param/location/tag/LocationTagTypeSendParam.java
+36
-0
ZyDepartmentAddParam.java
...va/com/yiring/app/param/zy/dept/ZyDepartmentAddParam.java
+71
-0
ZyDepartmentFindParam.java
...a/com/yiring/app/param/zy/dept/ZyDepartmentFindParam.java
+39
-0
ZyDepartmentModifyParam.java
...com/yiring/app/param/zy/dept/ZyDepartmentModifyParam.java
+76
-0
ZyLocationTagTypeSendParam.java
...app/param/zy/location/tag/ZyLocationTagTypeSendParam.java
+39
-0
ZyUserAddParam.java
...ain/java/com/yiring/app/param/zy/user/ZyUserAddParam.java
+65
-0
ZyUserFindParam.java
...in/java/com/yiring/app/param/zy/user/ZyUserFindParam.java
+43
-0
ZyUserModifyParam.java
.../java/com/yiring/app/param/zy/user/ZyUserModifyParam.java
+69
-0
KeyAlarmRulesService.java
...java/com/yiring/app/service/key/KeyAlarmRulesService.java
+57
-0
KeyAlarmRulesServiceImpl.java
...yiring/app/service/key/impl/KeyAlarmRulesServiceImpl.java
+221
-0
LocationBeaconService.java
...ng/app/service/location/beacon/LocationBeaconService.java
+41
-0
LocationBeaconServiceImpl.java
...rvice/location/beacon/impl/LocationBeaconServiceImpl.java
+198
-0
LocationTagService.java
...m/yiring/app/service/location/tag/LocationTagService.java
+7
-0
LocationTagServiceImpl.java
...app/service/location/tag/impl/LocationTagServiceImpl.java
+31
-0
UserService.java
...rc/main/java/com/yiring/app/service/user/UserService.java
+10
-2
UserServiceImpl.java
...ava/com/yiring/app/service/user/impl/UserServiceImpl.java
+60
-8
KeyAlarmRulesVo.java
app/src/main/java/com/yiring/app/vo/key/KeyAlarmRulesVo.java
+66
-0
LocationBeaconVo.java
...a/com/yiring/app/vo/location/beacon/LocationBeaconVo.java
+56
-0
UserInfoVo.java
app/src/main/java/com/yiring/app/vo/user/UserInfoVo.java
+6
-2
KeyAlarmRulesController.java
.../java/com/yiring/app/web/key/KeyAlarmRulesController.java
+68
-0
LocationTagController.java
...om/yiring/app/web/location/tag/LocationTagController.java
+6
-0
UserAppController.java
.../main/java/com/yiring/app/web/user/UserAppController.java
+9
-2
没有找到文件。
app/src/main/java/com/yiring/app/domain/key/KeyAlarm.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
key
;
/**
*
*
* @author LJ-2204
* @date 2022/5/6
*/
public
class
KeyAlarm
{}
app/src/main/java/com/yiring/app/domain/key/KeyAlarmRules.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
key
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.annotations.Comment
;
/**
* 按键报警规则
*
* @author LJ-2204
* @date 2022/5/6
*/
@Getter
@Setter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"BS_KEY_ALARM_RULES"
)
@Comment
(
"按键报警规则"
)
public
class
KeyAlarmRules
extends
BasicEntity
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
302167871277966250L
;
@Comment
(
"所属部门"
)
@ManyToOne
@JsonIgnore
@JoinColumn
(
name
=
"department_id"
)
Department
department
;
@JsonIgnore
@Builder
.
Default
@Comment
(
"用户集合"
)
@ManyToMany
(
fetch
=
FetchType
.
EAGER
)
@JoinTable
(
name
=
"BS_KEY_ALARM_RULES_USERS"
,
joinColumns
=
{
@JoinColumn
(
name
=
"key_id"
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"user_id"
)
}
)
Set
<
User
>
users
=
new
HashSet
<>(
0
);
@Comment
(
"推送类型"
)
String
types
;
}
app/src/main/java/com/yiring/app/domain/key/KeyAlarmRulesRepository.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
key
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
*
* @author LJ-2204
* @date 2022/5/6
*/
@Repository
public
interface
KeyAlarmRulesRepository
extends
JpaRepository
<
KeyAlarmRules
,
Serializable
>,
JpaSpecificationExecutor
<
KeyAlarmRules
>
{}
app/src/main/java/com/yiring/app/excel/dept/DepartmentExportExcel.java
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
dept
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.auth.domain.dept.Department
;
...
...
@@ -40,12 +41,16 @@ public class DepartmentExportExcel implements Serializable {
String
enable
;
public
static
DepartmentExportExcel
transform
(
Department
department
)
{
return
DepartmentExportExcel
DepartmentExportExcel
departmentExportExcel
=
DepartmentExportExcel
.
builder
()
.
name
(
department
.
getName
())
.
realName
(
department
.
getLeader
().
getRealName
())
.
mobile
(
department
.
getLeader
().
getMobile
())
.
enable
(
department
.
getEnable
()
?
"启用"
:
"禁用"
)
.
build
();
if
(
ObjectUtil
.
isNotEmpty
(
department
.
getLeader
()))
{
departmentExportExcel
.
setRealName
(
department
.
getLeader
().
getRealName
());
}
return
departmentExportExcel
;
}
}
app/src/main/java/com/yiring/app/excel/key/KeyAlarmRulesExportExcel.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
key
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.app.domain.key.KeyAlarmRules
;
import
com.yiring.auth.domain.user.User
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.util.Set
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 按键报警规则导出
*
* @author LJ-2204
* @date 2022/5/7
*/
@ExcelModel
@Data
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesExportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
800228727313291675L
;
@ExcelColumn
(
title
=
"部门名称"
)
String
deptName
;
@ExcelColumn
(
title
=
"负责人"
)
String
userNames
;
@ExcelColumn
(
title
=
"通知类型"
)
String
types
;
public
static
KeyAlarmRulesExportExcel
transform
(
KeyAlarmRules
keyAlarmRules
)
{
Set
<
User
>
users
=
keyAlarmRules
.
getUsers
();
StringBuilder
userNames
=
new
StringBuilder
();
for
(
User
user
:
users
)
{
userNames
.
append
(
user
.
getRealName
());
userNames
.
append
(
"、"
);
}
String
substring
=
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
);
return
KeyAlarmRulesExportExcel
.
builder
()
.
deptName
(
keyAlarmRules
.
getDepartment
().
getName
())
.
userNames
(
substring
)
.
types
(
keyAlarmRules
.
getTypes
())
.
build
();
}
}
app/src/main/java/com/yiring/app/excel/location/beacon/LocationBeaconExportExcel.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
location
.
beacon
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
com.yiring.app.domain.location.LocationBeacon
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.AccessLevel
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.experimental.FieldDefaults
;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/4/29
*/
@ExcelModel
@Data
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationBeaconExportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
8548586352563859939L
;
@ExcelColumn
(
title
=
"编号"
)
String
code
;
public
static
LocationBeaconExportExcel
transform
(
LocationBeacon
locationBeacon
)
{
return
LocationBeaconExportExcel
.
builder
().
code
(
locationBeacon
.
getCode
()).
build
();
}
}
app/src/main/java/com/yiring/app/feign/zy/dept/DepartmentClient.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
.
zy
.
dept
;
import
cn.hutool.json.JSONObject
;
import
com.yiring.app.param.zy.dept.ZyDepartmentFindParam
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.SpringQueryMap
;
import
org.springframework.web.bind.annotation.*
;
/**
* zy部门接口
*
* @author LJ-2204
* @date 2022/5/5
*/
@FeignClient
(
url
=
"${zy-config.proxy.api}"
,
name
=
"DepartmentClient"
)
public
interface
DepartmentClient
{
@PostMapping
(
value
=
"/position/system/dept"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
deptAdd
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@GetMapping
(
value
=
"/position/system/dept/list"
)
JSONObject
deptList
(
@SpringQueryMap
ZyDepartmentFindParam
zyDepartmentFindParam
,
@RequestHeader
(
"Authorization"
)
String
token
);
@DeleteMapping
(
value
=
"/position/system/dept/{id}"
)
JSONObject
deptDelete
(
@PathVariable
(
"id"
)
Long
id
,
@RequestHeader
(
"Authorization"
)
String
token
);
@PutMapping
(
value
=
"/position/system/dept"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
deptModify
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/feign/zy/location/beacon/LocationBeaconClient.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
.
zy
.
location
.
beacon
;
import
cn.hutool.json.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/4/28
*/
@FeignClient
(
url
=
"${zy-config.proxy.api}"
,
name
=
"LocationTagBeaconClient"
)
public
interface
LocationBeaconClient
{
@PostMapping
(
value
=
"/position/config/device/page"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
page
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/feign/zy/location/tag/LocationTagClient.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
.
zy
.
location
.
tag
;
import
cn.hutool.json.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* 定位标签
*
* @author LJ-2204
* @date 2022/4/28
*/
@FeignClient
(
url
=
"${zy-config.proxy.api}"
,
name
=
"locationTagClient"
)
public
interface
LocationTagClient
{
@PostMapping
(
value
=
"/position/config/tag/page"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
tagPage
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@PostMapping
(
value
=
"/position/config/tag/save"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
tagSave
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@RequestMapping
(
value
=
"/position/config/tag/delete/{ids}"
,
method
=
RequestMethod
.
POST
)
JSONObject
tagDelete
(
@PathVariable
(
"ids"
)
String
ids
,
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@RequestMapping
(
value
=
"/position/config/tag/import"
,
method
=
RequestMethod
.
POST
)
JSONObject
tagImport
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/feign/zy/location/tag/LocationTagTypeClient.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
.
zy
.
location
.
tag
;
import
cn.hutool.json.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
/**
* 标签分配
*
* @author LJ-2204
* @date 2022/5/6
*/
@FeignClient
(
url
=
"${zy-config.proxy.api}"
,
name
=
"LocationTagTypeClient"
)
public
interface
LocationTagTypeClient
{
@PostMapping
(
value
=
"/position/bizTag/updateEntityType"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
}
)
JSONObject
updateEntityType
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/feign/zy/user/UserClient.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
.
zy
.
user
;
import
cn.hutool.json.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/5/5
*/
@FeignClient
(
url
=
"${zy-config.proxy.api}"
,
name
=
"UserClient"
)
public
interface
UserClient
{
@PostMapping
(
value
=
"/position/staff/save"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
save
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@PostMapping
(
value
=
"/position/staff/list"
,
headers
=
{
"Content-Type=application/json;charset=UTF-8"
})
JSONObject
list
(
@RequestBody
String
json
,
@RequestHeader
(
"Authorization"
)
String
token
);
@DeleteMapping
(
value
=
"/position/staff/delete/{id}"
)
JSONObject
delete
(
@PathVariable
(
"id"
)
String
id
,
@RequestHeader
(
"Authorization"
)
String
token
);
@GetMapping
(
value
=
"position/staff/unbind/{id}"
)
JSONObject
unbind
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"orgId"
)
Integer
orgId
,
@RequestHeader
(
"Authorization"
)
String
token
);
@GetMapping
(
value
=
"position/staff/bindTag/{id}/{code}/1"
)
JSONObject
unbind
(
@PathVariable
(
"id"
)
Long
id
,
@PathVariable
(
"code"
)
String
code
,
@RequestParam
(
"orgId"
)
Integer
orgId
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/param/key/KeyAlarmRulesAddParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
key
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 按键报警规则
*
* @author LJ-2204
* @date 2022/5/6
*/
@ApiModel
(
"KeyAlarmRulesAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
758462772473378637L
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"100"
,
required
=
true
)
@NotEmpty
(
message
=
"部门ID不能为空"
)
Long
deptId
;
@ApiModelProperty
(
value
=
"用户ids"
,
example
=
"1111,2222"
,
required
=
true
)
@NotEmpty
(
message
=
"用户ids不能为空"
)
String
userIds
;
@ApiModelProperty
(
value
=
"报警类型"
,
example
=
"APP/SMS/CALL_TTS"
,
required
=
true
)
@NotEmpty
(
message
=
"报警类型不能为空"
)
String
types
;
}
app/src/main/java/com/yiring/app/param/key/KeyAlarmRulesExportParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
key
;
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/5/6
*/
@ApiModel
(
"KeyAlarmRulesExportParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesExportParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
2940487513251067057L
;
@ApiModelProperty
(
value
=
"部门ids"
,
example
=
"100,101,102"
)
String
deptIds
;
@ApiModelProperty
(
value
=
"通知方式"
,
example
=
"APP/SMS"
)
String
types
;
}
app/src/main/java/com/yiring/app/param/key/KeyAlarmRulesModifyParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
key
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 报警规则修改
*
* @author LJ-2204
* @date 2022/5/6
*/
@ApiModel
(
"KeyAlarmRulesAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
3526756145220971363L
;
@ApiModelProperty
(
value
=
"id"
,
example
=
"100"
,
required
=
true
)
@NotEmpty
(
message
=
"ID不能为空"
)
Long
id
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"100"
,
required
=
true
)
@NotEmpty
(
message
=
"部门ID不能为空"
)
Long
deptId
;
@ApiModelProperty
(
value
=
"用户ids"
,
example
=
"1111,2222"
,
required
=
true
)
@NotEmpty
(
message
=
"用户ids不能为空"
)
String
userIds
;
@ApiModelProperty
(
value
=
"报警类型"
,
example
=
"APP/SMS/CALL_TTS"
,
required
=
true
)
@NotEmpty
(
message
=
"报警类型不能为空"
)
String
types
;
}
app/src/main/java/com/yiring/app/param/key/KeyAlarmRulesPageParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
key
;
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/5/7
*/
@ApiModel
(
"KeyAlarmRulesPageParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesPageParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2876239519436815639L
;
@ApiModelProperty
(
value
=
"部门ids"
,
example
=
"100,101,102"
)
String
deptIds
;
@ApiModelProperty
(
value
=
"通知方式"
,
example
=
"APP/SMS"
)
String
types
;
}
app/src/main/java/com/yiring/app/param/location/beacon/LocationBeaconAddParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
beacon
;
import
com.yiring.app.domain.location.LocationBeacon
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 定位信标
*
* @author LJ-2204
* @date 2022/4/28
*/
@ApiModel
(
"LocationBeaconAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationBeaconAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
3955765845330886658L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"1"
)
Long
id
;
@ApiModelProperty
(
value
=
"地图"
,
example
=
"BTI88888888"
)
Long
areaId
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"BTI22085224"
)
String
deviceId
;
@ApiModelProperty
(
value
=
"x"
,
example
=
"661.6708034161"
)
BigDecimal
x
;
@ApiModelProperty
(
value
=
"y"
,
example
=
"64.609831996"
)
BigDecimal
y
;
@ApiModelProperty
(
value
=
"z"
,
example
=
"0"
)
BigDecimal
z
;
@ApiModelProperty
LocalDateTime
time
;
@ApiModelProperty
(
value
=
"电量"
,
example
=
"2900"
)
Integer
volt
;
@ApiModelProperty
(
value
=
"电量单位"
,
example
=
"mv"
)
String
voltUnit
;
public
static
LocationBeacon
transform
(
LocationBeaconAddParam
locationBeaconAddParam
)
{
return
LocationBeacon
.
builder
()
.
linkId
(
locationBeaconAddParam
.
getId
())
.
areaId
(
locationBeaconAddParam
.
getAreaId
())
.
code
(
locationBeaconAddParam
.
getDeviceId
())
.
x
(
locationBeaconAddParam
.
getX
())
.
y
(
locationBeaconAddParam
.
getY
())
.
z
(
locationBeaconAddParam
.
getZ
())
// .point(GeoUtils.xyzToPoint(
// locationBeaconAddParam.getPointX().doubleValue(),locationBeaconAddParam.getPointY().doubleValue(),locationBeaconAddParam.getPointZ().doubleValue()
// ))
.
time
(
locationBeaconAddParam
.
getTime
())
.
volt
(
locationBeaconAddParam
.
getVolt
())
.
voltUnit
(
locationBeaconAddParam
.
getVoltUnit
())
.
build
();
}
}
app/src/main/java/com/yiring/app/param/location/beacon/LocationBeaconExportParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
beacon
;
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/29
*/
@ApiModel
(
"LocationBeaconExportParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationBeaconExportParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2076855906391376170L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"BTI88888888"
)
String
code
;
}
app/src/main/java/com/yiring/app/param/location/beacon/LocationBeaconFindParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
beacon
;
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/28
*/
@ApiModel
(
"LocationBeaconFindParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationBeaconFindParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
8870987053623333234L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"BTI88888888"
)
String
code
;
}
app/src/main/java/com/yiring/app/param/location/tag/LocationTagTypeSendParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
location
.
tag
;
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/28
*/
@ApiModel
(
"LocationTagTypeSendParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationTagTypeSendParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
4964886106668963909L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"111,222"
)
@NotNull
(
message
=
"主键不能为空"
)
String
ids
;
@ApiModelProperty
(
value
=
"类别"
,
example
=
"1内部/2访客"
)
Integer
category
;
}
app/src/main/java/com/yiring/app/param/zy/dept/ZyDepartmentAddParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
dept
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.yiring.auth.domain.dept.Department
;
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
;
/**
* zy部门新增参数
*
* @author LJ-2204
* @date 2022/5/5
*/
@ApiModel
(
"ZyDepartmentAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyDepartmentAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
2949706685712988765L
;
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@NotNull
String
deptName
;
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"@163.com"
)
String
email
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
)
String
leader
;
@ApiModelProperty
(
value
=
"工厂"
,
example
=
"100"
)
Integer
orgId
;
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"1"
,
required
=
true
)
@NotNull
Long
parentId
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"18888888888"
)
String
phone
;
@ApiModelProperty
(
value
=
"部门状态"
,
example
=
"0/1"
)
String
status
;
public
static
ZyDepartmentAddParam
transform
(
Department
department
,
Integer
orgId
)
{
ZyDepartmentAddParam
zyDepartmentAddParam
=
ZyDepartmentAddParam
.
builder
()
.
deptName
(
department
.
getName
())
.
orgId
(
orgId
)
.
status
(
department
.
getEnable
()
?
"0"
:
"1"
)
.
build
();
if
(
ObjectUtil
.
isNotEmpty
(
department
.
getLeader
()))
{
zyDepartmentAddParam
.
setEmail
(
department
.
getLeader
().
getEmail
());
zyDepartmentAddParam
.
setLeader
(
department
.
getLeader
().
getRealName
());
zyDepartmentAddParam
.
setPhone
(
department
.
getLeader
().
getMobile
());
}
return
zyDepartmentAddParam
;
}
}
app/src/main/java/com/yiring/app/param/zy/dept/ZyDepartmentFindParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
dept
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* zy部门查询
*
* @author LJ-2204
* @date 2022/5/5
*/
@ApiModel
(
"ZyDepartmentFindParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyDepartmentFindParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
1009265085945027885L
;
@ApiModelProperty
(
value
=
"部门名称"
,
example
=
"研发部"
)
String
deptName
;
@ApiModelProperty
(
value
=
"状态"
,
example
=
"f/t"
)
String
status
;
String
ancestors
;
@ApiModelProperty
(
value
=
"工厂"
,
example
=
"100"
)
String
orgId
;
}
app/src/main/java/com/yiring/app/param/zy/dept/ZyDepartmentModifyParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
dept
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.yiring.auth.domain.dept.Department
;
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
;
/**
* zy部门修改参数
*
* @author LJ-2204
* @date 2022/5/5
*/
@ApiModel
(
"ZyDepartmentModifyParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyDepartmentModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
1008100771548933210L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"100"
,
required
=
true
)
@NotNull
Long
deptId
;
@ApiModelProperty
(
value
=
"名称"
,
example
=
"Java"
,
required
=
true
)
@NotNull
String
deptName
;
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"@163.com"
)
String
email
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
)
String
leader
;
@ApiModelProperty
(
value
=
"工厂"
,
example
=
"100"
)
Integer
orgId
;
@ApiModelProperty
(
value
=
"上级部门"
,
example
=
"1"
,
required
=
true
)
@NotNull
Long
parentId
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"18888888888"
)
String
phone
;
@ApiModelProperty
(
value
=
"部门状态"
,
example
=
"0/1"
)
String
status
;
public
static
ZyDepartmentModifyParam
transform
(
Department
department
,
Integer
orgId
)
{
ZyDepartmentModifyParam
zyDepartmentModifyParam
=
ZyDepartmentModifyParam
.
builder
()
.
deptId
(
department
.
getLinkId
())
.
deptName
(
department
.
getName
())
.
orgId
(
orgId
)
.
status
(
department
.
getEnable
()
?
"0"
:
"1"
)
.
build
();
if
(
ObjectUtil
.
isNotEmpty
(
department
.
getLeader
()))
{
zyDepartmentModifyParam
.
setEmail
(
department
.
getLeader
().
getEmail
());
zyDepartmentModifyParam
.
setLeader
(
department
.
getLeader
().
getRealName
());
zyDepartmentModifyParam
.
setPhone
(
department
.
getLeader
().
getMobile
());
}
return
zyDepartmentModifyParam
;
}
}
app/src/main/java/com/yiring/app/param/zy/location/tag/ZyLocationTagTypeSendParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
location
.
tag
;
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/5/6
*/
@ApiModel
(
"ZyLocationTagTypeSendParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyLocationTagTypeSendParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2083251032811952742L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"111,222"
)
@NotNull
(
message
=
"主键不能为空"
)
Long
[]
ids
;
@ApiModelProperty
(
value
=
"类别"
,
example
=
"1:内部/2:访客"
)
Integer
category
;
@ApiModelProperty
(
value
=
"工厂ID"
,
example
=
"100"
)
Integer
orgId
;
}
app/src/main/java/com/yiring/app/param/zy/user/ZyUserAddParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
user
;
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
;
/**
* zy用户新增参数
*
* @author LJ-2204
* @date 2022/5/5
*/
@ApiModel
(
"ZyUserAddParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyUserAddParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
7945473190204335719L
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"100"
)
Long
deptId
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
)
String
name
;
@ApiModelProperty
(
value
=
"工厂"
,
example
=
"100"
)
Integer
orgId
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"18888888888"
)
String
phone
;
@ApiModelProperty
(
value
=
"性别"
,
example
=
"男/1女2"
)
Integer
sex
;
@ApiModelProperty
(
value
=
"工号"
,
example
=
"YH10086"
)
String
jobNumber
;
@ApiModelProperty
(
value
=
"类型"
,
example
=
"1"
)
Integer
type
;
@ApiModelProperty
(
value
=
"图标类型"
,
example
=
"1普通,10028特殊"
)
Integer
entityIconId
;
public
static
ZyUserAddParam
transform
(
User
user
,
Integer
factoryId
)
{
return
ZyUserAddParam
.
builder
()
.
name
(
user
.
getRealName
())
.
orgId
(
factoryId
)
.
phone
(
user
.
getMobile
())
.
sex
(
user
.
getGender
()
?
1
:
2
)
.
jobNumber
(
user
.
getUuid
())
.
type
(
1
)
.
build
();
}
}
app/src/main/java/com/yiring/app/param/zy/user/ZyUserFindParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
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/5/5
*/
@ApiModel
(
"ZyUserFindParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyUserFindParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
8190370314958519070L
;
@ApiModelProperty
(
value
=
"工号"
,
example
=
"1100"
)
String
jobNum
;
@ApiModelProperty
(
value
=
"工厂ID"
,
example
=
"100"
)
Integer
orgId
;
@ApiModelProperty
(
value
=
"起始页"
,
example
=
"1"
)
Integer
pageNum
;
@ApiModelProperty
(
value
=
"显示数"
,
example
=
"10"
)
Integer
pageSize
;
@ApiModelProperty
(
value
=
"类型"
,
example
=
"100"
)
Integer
type
;
}
app/src/main/java/com/yiring/app/param/zy/user/ZyUserModifyParam.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
zy
.
user
;
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/5/6
*/
@ApiModel
(
"ZyUserModifyParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
ZyUserModifyParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
4654860807059567162L
;
@ApiModelProperty
(
value
=
"主键"
,
example
=
"1"
)
Long
id
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"100"
)
Long
deptId
;
@ApiModelProperty
(
value
=
"真实姓名"
,
example
=
"张三"
)
String
name
;
@ApiModelProperty
(
value
=
"工厂"
,
example
=
"100"
)
Integer
orgId
;
@ApiModelProperty
(
value
=
"电话"
,
example
=
"18888888888"
)
String
phone
;
@ApiModelProperty
(
value
=
"性别"
,
example
=
"男/1女2"
)
Integer
sex
;
@ApiModelProperty
(
value
=
"工号"
,
example
=
"YH10086"
)
String
jobNumber
;
@ApiModelProperty
(
value
=
"类型"
,
example
=
"1"
)
Integer
type
;
@ApiModelProperty
(
value
=
"图标类型"
,
example
=
"1普通,10028特殊"
)
Integer
entityIconId
;
public
static
ZyUserModifyParam
transform
(
User
user
,
Integer
factoryId
)
{
return
ZyUserModifyParam
.
builder
()
.
id
(
user
.
getId
())
.
name
(
user
.
getRealName
())
.
orgId
(
factoryId
)
.
phone
(
user
.
getMobile
())
.
sex
(
user
.
getGender
()
?
1
:
2
)
.
jobNumber
(
user
.
getUuid
())
.
type
(
1
)
.
build
();
}
}
app/src/main/java/com/yiring/app/service/key/KeyAlarmRulesService.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
key
;
import
com.yiring.app.param.key.KeyAlarmRulesAddParam
;
import
com.yiring.app.param.key.KeyAlarmRulesExportParam
;
import
com.yiring.app.param.key.KeyAlarmRulesModifyParam
;
import
com.yiring.app.param.key.KeyAlarmRulesPageParam
;
import
com.yiring.app.vo.key.KeyAlarmRulesVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 按键报警规则
*
* @author LJ-2204
* @date 2022/5/6
*/
public
interface
KeyAlarmRulesService
{
/**
* 添加报警类型
* @param keyAlarmRulesAddParam KeyAlarmRulesAddParam
* @return Result<String>
*/
Result
<
String
>
add
(
KeyAlarmRulesAddParam
keyAlarmRulesAddParam
);
/**
* 删除报警规则
* @param idParam IdParam
* @return Result<String>
*/
Result
<
String
>
delete
(
IdParam
idParam
);
/**
* 修改报警规则
* @param keyAlarmRulesModifyParam KeyAlarmRulesModifyParam
* @return Result<String>
*/
Result
<
String
>
modify
(
KeyAlarmRulesModifyParam
keyAlarmRulesModifyParam
);
/**
* 导出
* @param keyAlarmRulesExportParam KeyAlarmRulesExportParam
* @param response HttpServletResponse
*/
void
export
(
KeyAlarmRulesExportParam
keyAlarmRulesExportParam
,
HttpServletResponse
response
);
/**
* 分页
* @param keyAlarmRulesPageParam KeyAlarmRulesPageParam
* @param pageParam PageParam
* @return Result<PageVo<KeyAlarmRulesVo>>
*/
Result
<
PageVo
<
KeyAlarmRulesVo
>>
page
(
KeyAlarmRulesPageParam
keyAlarmRulesPageParam
,
PageParam
pageParam
);
}
app/src/main/java/com/yiring/app/service/key/impl/KeyAlarmRulesServiceImpl.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
key
.
impl
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.yiring.app.domain.key.KeyAlarmRules
;
import
com.yiring.app.domain.key.KeyAlarmRulesRepository
;
import
com.yiring.app.excel.key.KeyAlarmRulesExportExcel
;
import
com.yiring.app.param.key.KeyAlarmRulesAddParam
;
import
com.yiring.app.param.key.KeyAlarmRulesExportParam
;
import
com.yiring.app.param.key.KeyAlarmRulesModifyParam
;
import
com.yiring.app.param.key.KeyAlarmRulesPageParam
;
import
com.yiring.app.service.key.KeyAlarmRulesService
;
import
com.yiring.app.vo.key.KeyAlarmRulesVo
;
import
com.yiring.auth.domain.dept.Department
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Predicate
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 按键报警规则
*
* @author LJ-2204
* @date 2022/5/6
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Service
@Slf4j
public
class
KeyAlarmRulesServiceImpl
implements
KeyAlarmRulesService
{
@Resource
KeyAlarmRulesRepository
keyAlarmRulesRepository
;
@Override
public
Result
<
String
>
add
(
KeyAlarmRulesAddParam
keyAlarmRulesAddParam
)
{
HashSet
<
User
>
users
=
new
HashSet
<>();
String
[]
strings
=
keyAlarmRulesAddParam
.
getUserIds
().
split
(
","
);
Long
[]
ids
=
Convert
.
toLongArray
(
strings
);
if
(
ids
.
length
<
3
)
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"报警接收人至少3个"
);
}
for
(
Long
id
:
ids
)
{
users
.
add
(
User
.
builder
().
id
(
id
).
build
());
}
KeyAlarmRules
keyAlarmRules
=
KeyAlarmRules
.
builder
()
.
department
(
Department
.
builder
().
id
(
keyAlarmRulesAddParam
.
getDeptId
()).
build
())
.
users
(
users
)
.
types
(
keyAlarmRulesAddParam
.
getTypes
())
.
build
();
keyAlarmRulesRepository
.
save
(
keyAlarmRules
);
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
delete
(
IdParam
idParam
)
{
Optional
<
KeyAlarmRules
>
keyAlarmRulesOptional
=
keyAlarmRulesRepository
.
findById
(
idParam
.
getId
());
if
(
keyAlarmRulesOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"报警规则不存在"
);
keyAlarmRulesRepository
.
delete
(
keyAlarmRulesOptional
.
get
());
return
Result
.
ok
();
}
@Override
public
Result
<
String
>
modify
(
KeyAlarmRulesModifyParam
keyAlarmRulesModifyParam
)
{
Optional
<
KeyAlarmRules
>
keyAlarmRulesOptional
=
keyAlarmRulesRepository
.
findById
(
keyAlarmRulesModifyParam
.
getId
()
);
if
(
keyAlarmRulesOptional
.
isEmpty
())
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"报警规则不存在"
);
HashSet
<
User
>
users
=
new
HashSet
<>();
String
[]
strings
=
keyAlarmRulesModifyParam
.
getUserIds
().
split
(
","
);
Long
[]
ids
=
Convert
.
toLongArray
(
strings
);
if
(
ids
.
length
<
3
)
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"报警接收人至少3个"
);
}
for
(
Long
id
:
ids
)
{
users
.
add
(
User
.
builder
().
id
(
id
).
build
());
}
KeyAlarmRules
keyAlarmRules
=
keyAlarmRulesOptional
.
get
();
keyAlarmRules
.
setDepartment
(
Department
.
builder
().
id
(
keyAlarmRulesModifyParam
.
getDeptId
()).
build
());
keyAlarmRules
.
setUsers
(
users
);
keyAlarmRules
.
setTypes
(
keyAlarmRulesModifyParam
.
getTypes
());
keyAlarmRulesRepository
.
save
(
keyAlarmRules
);
return
Result
.
ok
();
}
@Override
public
void
export
(
KeyAlarmRulesExportParam
keyAlarmRulesExportParam
,
HttpServletResponse
response
)
{
Specification
<
KeyAlarmRules
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
keyAlarmRulesExportParam
.
getDeptIds
()))
{
String
[]
ids
=
keyAlarmRulesExportParam
.
getDeptIds
().
split
(
","
);
CriteriaBuilder
.
In
<
Object
>
in
=
cb
.
in
(
root
.
get
(
KeyAlarmRules
.
Fields
.
department
).
get
(
BasicEntity
.
Fields
.
id
)
);
for
(
String
id
:
ids
)
in
.
value
(
Convert
.
toLong
(
id
));
predicates
.
add
(
in
);
}
if
(
StrUtil
.
isNotEmpty
(
keyAlarmRulesExportParam
.
getTypes
()))
{
String
[]
types
=
keyAlarmRulesExportParam
.
getTypes
().
split
(
","
);
for
(
String
type
:
types
)
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
KeyAlarmRules
.
Fields
.
types
),
"%"
+
type
+
"%"
));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
List
<
KeyAlarmRules
>
keyAlarmRules
=
keyAlarmRulesRepository
.
findAll
(
specification
);
List
<
KeyAlarmRulesExportExcel
>
keyAlarmRulesExportExcels
=
keyAlarmRules
.
stream
()
.
map
(
KeyAlarmRulesExportExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
try
(
DefaultStreamExcelBuilder
<
KeyAlarmRulesExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
KeyAlarmRulesExportExcel
.
class
)
.
threadPool
(
Executors
.
newFixedThreadPool
(
2
))
.
rowHeight
(
14
)
.
titleRowHeight
(
14
)
.
style
(
"cell->vertical-align:center;text-align:center"
,
"title->vertical-align:center;text-align:center;font-weight:bold;font-family:等线"
)
.
start
()
)
{
streamExcelBuilder
.
append
(
keyAlarmRulesExportExcels
);
String
fileName
=
URLEncoder
.
encode
(
"按键报警规则信息.xlsx"
,
StandardCharsets
.
UTF_8
);
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
fileName
);
OutputStream
out
=
response
.
getOutputStream
();
Workbook
workbook
=
streamExcelBuilder
.
fixedTitles
().
build
();
workbook
.
write
(
out
);
workbook
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
"导出按键报警规则信息失败: "
+
e
.
getMessage
());
}
}
@Override
public
Result
<
PageVo
<
KeyAlarmRulesVo
>>
page
(
KeyAlarmRulesPageParam
keyAlarmRulesPageParam
,
PageParam
pageParam
)
{
Specification
<
KeyAlarmRules
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
keyAlarmRulesPageParam
.
getDeptIds
()))
{
String
[]
ids
=
keyAlarmRulesPageParam
.
getDeptIds
().
split
(
","
);
CriteriaBuilder
.
In
<
Object
>
in
=
cb
.
in
(
root
.
get
(
KeyAlarmRules
.
Fields
.
department
).
get
(
BasicEntity
.
Fields
.
id
)
);
for
(
String
id
:
ids
)
in
.
value
(
Convert
.
toLong
(
id
));
predicates
.
add
(
in
);
}
if
(
StrUtil
.
isNotEmpty
(
keyAlarmRulesPageParam
.
getTypes
()))
{
String
[]
types
=
keyAlarmRulesPageParam
.
getTypes
().
split
(
","
);
for
(
String
type
:
types
)
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
KeyAlarmRules
.
Fields
.
types
),
"%"
+
type
+
"%"
));
}
}
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Page
<
KeyAlarmRules
>
pages
=
keyAlarmRulesRepository
.
findAll
(
specification
,
pageable
);
List
<
KeyAlarmRulesVo
>
keyAlarmRulesVos
=
pages
.
getContent
()
.
stream
()
.
map
(
KeyAlarmRulesVo:
:
transform
)
.
collect
(
Collectors
.
toList
());
PageVo
<
KeyAlarmRulesVo
>
pageVo
=
PageVo
.
build
(
keyAlarmRulesVos
,
pages
.
getTotalElements
());
return
Result
.
ok
(
pageVo
);
}
}
app/src/main/java/com/yiring/app/service/location/beacon/LocationBeaconService.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
location
.
beacon
;
import
com.yiring.app.param.location.beacon.LocationBeaconExportParam
;
import
com.yiring.app.param.location.beacon.LocationBeaconFindParam
;
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
javax.servlet.http.HttpServletResponse
;
/**
* 定位信标
*
* @author LJ-2204
* @date 2022/4/28
*/
public
interface
LocationBeaconService
{
/**
* 数据同步
*/
void
saveLocationBeacon
();
/**
* 表格查询
* @param locationBeaconFindParam LocationBeaconFindParam
* @param pageParam PageParam
* @return Result<PageVo<LocationBeaconVo>>
*/
Result
<
PageVo
<
LocationBeaconVo
>>
findLocationBeacon
(
LocationBeaconFindParam
locationBeaconFindParam
,
PageParam
pageParam
);
/**
* 导出
* @param locationBeaconExportParam locationBeaconExportParam
* @param response HttpServletResponse
*/
void
exportLocationBeacon
(
LocationBeaconExportParam
locationBeaconExportParam
,
HttpServletResponse
response
);
}
app/src/main/java/com/yiring/app/service/location/beacon/impl/LocationBeaconServiceImpl.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
location
.
beacon
.
impl
;
import
cn.hutool.core.collection.ListUtil
;
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.yiring.app.domain.location.LocationBeacon
;
import
com.yiring.app.domain.location.LocationBeaconRepository
;
import
com.yiring.app.excel.location.beacon.LocationBeaconExportExcel
;
import
com.yiring.app.feign.zy.location.beacon.LocationBeaconClient
;
import
com.yiring.app.param.location.beacon.LocationBeaconAddParam
;
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.util.zy.ZyUtil
;
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
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Order
;
import
javax.persistence.criteria.Predicate
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 定位信标
*
* @author LJ-2204
* @date 2022/4/28
*/
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Service
@Slf4j
public
class
LocationBeaconServiceImpl
implements
LocationBeaconService
{
@Resource
LocationBeaconClient
locationTagBeaconClient
;
@Resource
LocationBeaconRepository
locationBeaconRepository
;
@Override
public
void
saveLocationBeacon
()
{
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"deviceType"
,
"BTI"
);
hashMap
.
put
(
"pageSize"
,
100
);
hashMap
.
put
(
"pageNum"
,
0
);
hashMap
.
put
(
"orgId"
,
100
);
hashMap
.
put
(
"deviceId"
,
""
);
JSONObject
jsonObject
=
locationTagBeaconClient
.
page
(
JSONUtil
.
toJsonStr
(
hashMap
),
ZyUtil
.
manageLogin
());
JSONObject
data
=
JSONUtil
.
parseObj
(
jsonObject
.
get
(
"data"
));
JSONArray
records
=
JSONUtil
.
parseArray
(
data
.
get
(
"records"
));
List
<
LocationBeaconAddParam
>
locationBeaconAddParams
=
JSONUtil
.
toList
(
JSONUtil
.
toJsonStr
(
records
),
LocationBeaconAddParam
.
class
);
locationBeaconAddParams
.
forEach
(
locationBeaconAddParam
->
{
Optional
<
LocationBeacon
>
locationBeaconOptional
=
locationBeaconRepository
.
findOne
(
Example
.
of
(
LocationBeacon
.
builder
()
.
code
(
locationBeaconAddParam
.
getDeviceId
())
.
linkId
(
locationBeaconAddParam
.
getId
())
.
build
()
)
);
if
(
locationBeaconOptional
.
isEmpty
())
{
LocationBeacon
locationBeacon
=
LocationBeaconAddParam
.
transform
(
locationBeaconAddParam
);
locationBeaconRepository
.
save
(
locationBeacon
);
}
else
{
LocationBeacon
locationBeacon
=
locationBeaconOptional
.
get
();
modifyLocationBeacon
(
locationBeacon
,
locationBeaconAddParam
);
}
});
}
@Override
public
Result
<
PageVo
<
LocationBeaconVo
>>
findLocationBeacon
(
LocationBeaconFindParam
locationBeaconFindParam
,
PageParam
pageParam
)
{
Specification
<
LocationBeacon
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
locationBeaconFindParam
.
getCode
()))
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
LocationBeacon
.
Fields
.
code
),
"%"
+
locationBeaconFindParam
.
getCode
()
+
"%"
)
);
}
Order
order
=
cb
.
desc
(
root
.
get
(
LocationBeacon
.
Fields
.
time
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
Pageable
pageable
=
PageRequest
.
of
(
pageParam
.
getPageNo
()
-
1
,
pageParam
.
getPageSize
());
Page
<
LocationBeacon
>
locationBeacons
=
locationBeaconRepository
.
findAll
(
specification
,
pageable
);
List
<
LocationBeaconVo
>
locationBeaconVos
=
locationBeacons
.
stream
()
.
map
(
LocationBeaconVo:
:
transform
)
.
collect
(
Collectors
.
toList
());
PageVo
<
LocationBeaconVo
>
pageVo
=
PageVo
.
build
(
locationBeaconVos
,
locationBeacons
.
getTotalElements
());
return
Result
.
ok
(
pageVo
);
}
@Override
public
void
exportLocationBeacon
(
LocationBeaconExportParam
locationBeaconExportParam
,
HttpServletResponse
response
)
{
Specification
<
LocationBeacon
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
locationBeaconExportParam
.
getCode
()))
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
LocationBeacon
.
Fields
.
code
),
"%"
+
locationBeaconExportParam
.
getCode
()
+
"%"
)
);
}
Order
order
=
cb
.
desc
(
root
.
get
(
LocationBeacon
.
Fields
.
time
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
List
<
LocationBeacon
>
locationBeacons
=
locationBeaconRepository
.
findAll
(
specification
);
List
<
LocationBeaconExportExcel
>
locationBeaconExportExcels
=
locationBeacons
.
stream
()
.
map
(
LocationBeaconExportExcel:
:
transform
)
.
collect
(
Collectors
.
toList
());
try
(
DefaultStreamExcelBuilder
<
LocationBeaconExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
LocationBeaconExportExcel
.
class
)
.
threadPool
(
Executors
.
newFixedThreadPool
(
2
))
.
rowHeight
(
14
)
.
titleRowHeight
(
14
)
.
style
(
"cell->vertical-align:center;text-align:center"
,
"title->vertical-align:center;text-align:center;font-weight:bold;font-family:等线"
)
.
start
()
)
{
streamExcelBuilder
.
append
(
locationBeaconExportExcels
);
String
fileName
=
URLEncoder
.
encode
(
"信标信息.xlsx"
,
StandardCharsets
.
UTF_8
);
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
fileName
);
OutputStream
out
=
response
.
getOutputStream
();
Workbook
workbook
=
streamExcelBuilder
.
fixedTitles
().
build
();
workbook
.
write
(
out
);
workbook
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
"导出信标信息失败: "
+
e
.
getMessage
());
}
}
private
void
modifyLocationBeacon
(
LocationBeacon
locationBeacon
,
LocationBeaconAddParam
locationBeaconAddParam
)
{
locationBeacon
.
setCode
(
locationBeaconAddParam
.
getDeviceId
());
locationBeacon
.
setAreaId
(
locationBeaconAddParam
.
getAreaId
());
locationBeacon
.
setLinkId
(
locationBeaconAddParam
.
getId
());
locationBeacon
.
setX
(
locationBeaconAddParam
.
getX
());
locationBeacon
.
setY
(
locationBeaconAddParam
.
getY
());
locationBeacon
.
setZ
(
locationBeaconAddParam
.
getZ
());
locationBeacon
.
setTime
(
locationBeaconAddParam
.
getTime
());
locationBeacon
.
setVolt
(
locationBeaconAddParam
.
getVolt
());
locationBeacon
.
setVoltUnit
(
locationBeaconAddParam
.
getVoltUnit
());
// locationBeacon.setPoint(GeoUtils.xyzToPoint(
// locationBeaconAddParam.getPointX().doubleValue(),locationBeaconAddParam.getPointY().doubleValue(),locationBeaconAddParam.getPointZ().doubleValue()
// ));
}
}
app/src/main/java/com/yiring/app/service/location/tag/LocationTagService.java
浏览文件 @
e21e94dc
...
...
@@ -65,4 +65,11 @@ public interface LocationTagService {
* @return Result<PageVo<LocationTagIndexVo>>
*/
Result
<
PageVo
<
LocationTagIndexVo
>>
indexLocationTag
(
IndexParam
indexParam
);
/**
* 条件查询
* @param locationTagFindParam LocationTagFindParam
* @return Result<PageVo<LocationTagVo>>
*/
Result
<
PageVo
<
LocationTagVo
>>
findLocationTag
(
LocationTagFindParam
locationTagFindParam
);
}
app/src/main/java/com/yiring/app/service/location/tag/impl/LocationTagServiceImpl.java
浏览文件 @
e21e94dc
...
...
@@ -331,6 +331,37 @@ public class LocationTagServiceImpl implements LocationTagService {
return
Result
.
ok
(
pageVo
);
}
@Override
public
Result
<
PageVo
<
LocationTagVo
>>
findLocationTag
(
LocationTagFindParam
locationTagFindParam
)
{
Specification
<
LocationTag
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
StrUtil
.
isNotEmpty
(
locationTagFindParam
.
getCode
()))
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
LocationTag
.
Fields
.
code
),
"%"
+
locationTagFindParam
.
getCode
()
+
"%"
));
}
if
(
ObjectUtil
.
isNotEmpty
(
locationTagFindParam
.
getType
()))
{
predicates
.
add
(
cb
.
equal
(
root
.
get
(
LocationTag
.
Fields
.
type
),
locationTagFindParam
.
getType
()));
}
if
(
ObjectUtil
.
isNotEmpty
(
locationTagFindParam
.
getSilent
()))
{
predicates
.
add
(
cb
.
equal
(
root
.
get
(
LocationTag
.
Fields
.
silent
),
locationTagFindParam
.
getSilent
()));
}
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
);
List
<
LocationTagVo
>
locationTagVos
=
locationTags
.
stream
()
.
map
(
LocationTagVo:
:
transform
)
.
collect
(
Collectors
.
toList
());
PageVo
<
LocationTagVo
>
page
=
PageVo
.
build
(
locationTagVos
,
locationTagVos
.
size
());
return
Result
.
ok
(
page
);
}
private
boolean
hasLocationTagInfoByCode
(
String
code
)
{
LocationTag
locationTag
=
LocationTag
.
builder
().
code
(
code
).
build
();
return
locationTagRepository
.
count
(
Example
.
of
(
locationTag
))
>
0
;
...
...
app/src/main/java/com/yiring/app/service/user/UserService.java
浏览文件 @
e21e94dc
...
...
@@ -4,6 +4,7 @@ package com.yiring.app.service.user;
import
com.yiring.app.param.user.*
;
import
com.yiring.app.vo.user.UserInfoVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IndexParam
;
...
...
@@ -49,10 +50,10 @@ public interface UserService {
/**
* 删除用户
* @param id
Param Id
Param
* @param id
sParam Ids
Param
* @return Result<String>
*/
Result
<
String
>
deleteUser
(
Id
Param
id
Param
);
Result
<
String
>
deleteUser
(
Id
sParam
ids
Param
);
/**
* 导出用户
...
...
@@ -95,4 +96,11 @@ public interface UserService {
* @return Result<PageVo<UserVo>>
*/
Result
<
PageVo
<
UserVo
>>
indexUser
(
IndexParam
indexParam
);
/**
* 用户条件查询
* @param userFindParam UserFindParam
* @return Result<PageVo<UserVo>>
*/
Result
<
PageVo
<
UserVo
>>
findUser
(
UserFindParam
userFindParam
);
}
app/src/main/java/com/yiring/app/service/user/impl/UserServiceImpl.java
浏览文件 @
e21e94dc
...
...
@@ -30,6 +30,7 @@ import com.yiring.auth.domain.post.Post;
import
com.yiring.auth.domain.post.PostRepository
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.UserRepository
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.domain.BasicEntity
;
...
...
@@ -53,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -180,28 +182,43 @@ public class UserServiceImpl implements UserService {
}
@Override
public
Result
<
String
>
deleteUser
(
IdParam
idParam
)
{
Optional
<
User
>
userOptional
=
userRepository
.
findById
(
idParam
.
getId
());
public
Result
<
String
>
deleteUser
(
IdsParam
idsParam
)
{
String
[]
strings
=
idsParam
.
getIds
().
split
(
","
);
Long
[]
ids
=
Convert
.
toLongArray
(
strings
);
StringBuilder
linkIds
=
new
StringBuilder
();
for
(
Long
id
:
ids
)
{
Optional
<
User
>
userOptional
=
userRepository
.
findById
(
id
);
if
(
userOptional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"员工不存在"
);
}
User
user
=
userOptional
.
get
();
LocationTag
locationTagBuild
=
LocationTag
.
builder
().
user
(
User
.
builder
().
id
(
idParam
.
getId
()).
build
()).
build
();
linkIds
.
append
(
user
.
getLinkId
()).
append
(
","
);
LocationTag
locationTagBuild
=
LocationTag
.
builder
()
.
user
(
User
.
builder
().
id
(
Convert
.
toLong
(
id
)).
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
();
Department
departmentBuild
=
Department
.
builder
()
.
leader
(
User
.
builder
().
id
(
Convert
.
toLong
(
id
)).
build
())
.
build
();
long
departmentCount
=
departmentRepository
.
count
(
Example
.
of
(
departmentBuild
));
if
(
departmentCount
>
0
)
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"部门负责人,请先解绑"
);
}
String
linkId
=
linkIds
.
toString
();
if
(
linkIds
.
indexOf
(
","
)
!=
-
1
)
{
linkId
=
linkIds
.
substring
(
0
,
linkIds
.
length
()
-
1
);
}
JSONObject
jsonObject
=
userClient
.
delete
(
user
.
getLinkId
()
,
ZyUtil
.
clientLogin
());
JSONObject
jsonObject
=
userClient
.
delete
(
linkId
,
ZyUtil
.
clientLogin
());
if
(!
ObjectUtil
.
equals
(
jsonObject
.
get
(
"code"
),
200
))
{
throw
new
RuntimeException
(
StrUtil
.
toString
(
jsonObject
.
get
(
"msg"
)));
}
userRepository
.
delete
(
user
);
userRepository
.
delete
AllById
(
ListUtil
.
toList
(
ids
)
);
return
Result
.
ok
();
}
...
...
@@ -526,6 +543,41 @@ public class UserServiceImpl implements UserService {
return
Result
.
ok
(
page
);
}
@Override
public
Result
<
PageVo
<
UserVo
>>
findUser
(
UserFindParam
userFindParam
)
{
Specification
<
User
>
specification
=
(
root
,
cq
,
cb
)
->
{
List
<
Predicate
>
predicates
=
ListUtil
.
toList
();
if
(
ObjectUtil
.
isNotEmpty
(
userFindParam
.
getDeptId
()))
{
predicates
.
add
(
cb
.
equal
(
root
.
get
(
User
.
Fields
.
department
).
get
(
BasicEntity
.
Fields
.
id
),
userFindParam
.
getDeptId
())
);
}
if
(
ObjectUtil
.
isNotEmpty
(
userFindParam
.
getRealName
()))
{
predicates
.
add
(
cb
.
like
(
root
.
get
(
User
.
Fields
.
realName
),
"%"
+
userFindParam
.
getRealName
()
+
"%"
));
}
Order
order
=
cb
.
desc
(
root
.
get
(
BasicEntity
.
Fields
.
createTime
));
return
cq
.
orderBy
(
order
).
where
(
predicates
.
toArray
(
new
Predicate
[
0
])).
getRestriction
();
};
List
<
User
>
users
=
userRepository
.
findAll
(
specification
);
List
<
UserVo
>
userVos
=
users
.
stream
()
.
map
(
user
->
{
UserVo
userVo
=
UserVo
.
builder
().
id
(
user
.
getId
()).
realName
(
user
.
getRealName
()).
build
();
if
(
ObjectUtil
.
isNotEmpty
(
user
.
getDepartment
()))
{
userVo
.
setDepartment
(
user
.
getDepartment
().
getName
());
userVo
.
setDepartmentId
(
user
.
getDepartment
().
getId
());
}
return
userVo
;
})
.
collect
(
Collectors
.
toList
());
PageVo
<
UserVo
>
pageVo
=
PageVo
.
build
(
userVos
,
userVos
.
size
());
return
Result
.
ok
(
pageVo
);
}
@NotNull
private
CriteriaQuery
<
UserVo
>
getUserVoCriteriaQuery
(
UserFindParam
param
)
{
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
...
...
@@ -546,7 +598,7 @@ public class UserServiceImpl implements UserService {
Join
<
User
,
Post
>
postJoin
=
root
.
join
(
User
.
Fields
.
post
,
JoinType
.
LEFT
);
Expression
<
String
>
post
=
postJoin
.
get
(
Post
.
Fields
.
name
);
Expression
<
Long
>
postId
=
departmen
tJoin
.
get
(
BasicEntity
.
Fields
.
id
);
Expression
<
Long
>
postId
=
pos
tJoin
.
get
(
BasicEntity
.
Fields
.
id
);
Subquery
<
String
>
query
=
cq
.
subquery
(
String
.
class
);
Root
<
LocationTag
>
tagRoot
=
query
.
from
(
LocationTag
.
class
);
...
...
app/src/main/java/com/yiring/app/vo/key/KeyAlarmRulesVo.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
key
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.domain.key.KeyAlarmRules
;
import
com.yiring.app.vo.user.UserInfoVo
;
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
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 按键报警规则
*
* @author LJ-2204
* @date 2022/5/7
*/
@ApiModel
(
"KeyAlarmRulesVo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
KeyAlarmRulesVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5083435104462641333L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"111"
)
Long
id
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"111"
)
Long
deptId
;
@ApiModelProperty
(
value
=
"部门名称"
,
example
=
"Java"
)
String
deptName
;
@ApiModelProperty
(
value
=
"负责人"
,
example
=
"111"
)
List
<
UserInfoVo
>
users
;
@ApiModelProperty
(
value
=
"推送类型"
,
example
=
"111"
)
String
types
;
public
static
KeyAlarmRulesVo
transform
(
KeyAlarmRules
keyAlarmRules
)
{
Set
<
User
>
users
=
keyAlarmRules
.
getUsers
();
List
<
UserInfoVo
>
userInfoVos
=
users
.
stream
().
map
(
UserInfoVo:
:
transform
).
collect
(
Collectors
.
toList
());
return
KeyAlarmRulesVo
.
builder
()
.
id
(
keyAlarmRules
.
getId
())
.
deptId
(
keyAlarmRules
.
getDepartment
().
getId
())
.
deptName
(
keyAlarmRules
.
getDepartment
().
getName
())
.
users
(
userInfoVos
)
.
types
(
keyAlarmRules
.
getTypes
())
.
build
();
}
}
app/src/main/java/com/yiring/app/vo/location/beacon/LocationBeaconVo.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
location
.
beacon
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.app.domain.location.LocationBeacon
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* 定位信标模型
*
* @author LJ-2204
* @date 2022/4/28
*/
@ApiModel
(
"LocationBeaconVo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
LocationBeaconVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
996556953940775577L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"188354391834"
)
Long
id
;
@ApiModelProperty
(
value
=
"信标"
,
example
=
"BTI88888888"
)
String
code
;
@ApiModelProperty
(
value
=
"最后一次在线时间"
,
example
=
"BTI88888888"
)
LocalDateTime
time
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"所属地图"
,
example
=
"1:总图2:一层3:二层"
)
Long
areaId
;
public
static
LocationBeaconVo
transform
(
LocationBeacon
locationBeacon
)
{
return
LocationBeaconVo
.
builder
()
.
id
(
locationBeacon
.
getId
())
.
code
(
locationBeacon
.
getCode
())
.
time
(
locationBeacon
.
getTime
())
.
areaId
(
locationBeacon
.
getAreaId
())
.
build
();
}
}
app/src/main/java/com/yiring/app/vo/user/UserInfoVo.java
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
user
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.auth.domain.user.User
;
...
...
@@ -77,7 +78,7 @@ public class UserInfoVo implements Serializable {
LocalDateTime
updateTime
;
public
static
UserInfoVo
transform
(
User
user
)
{
return
UserInfoVo
UserInfoVo
userInfoVo
=
UserInfoVo
.
builder
()
.
id
(
user
.
getId
())
.
realName
(
user
.
getRealName
())
...
...
@@ -85,7 +86,6 @@ public class UserInfoVo implements Serializable {
.
type
(
user
.
getType
())
.
department
(
user
.
getDepartment
().
getName
())
.
mobile
(
user
.
getMobile
())
.
post
(
user
.
getPost
().
getName
())
.
email
(
user
.
getEmail
())
.
avatar
(
user
.
getAvatar
())
.
enabled
(
user
.
getEnabled
())
...
...
@@ -95,5 +95,9 @@ public class UserInfoVo implements Serializable {
.
createTime
(
user
.
getCreateTime
())
.
updateTime
(
user
.
getUpdateTime
())
.
build
();
if
(
ObjectUtil
.
isNotEmpty
(
user
.
getPost
()))
{
userInfoVo
.
setPost
(
user
.
getPost
().
getName
());
}
return
userInfoVo
;
}
}
app/src/main/java/com/yiring/app/web/key/KeyAlarmRulesController.java
0 → 100644
浏览文件 @
e21e94dc
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
key
;
import
com.yiring.app.param.key.KeyAlarmRulesAddParam
;
import
com.yiring.app.param.key.KeyAlarmRulesExportParam
;
import
com.yiring.app.param.key.KeyAlarmRulesModifyParam
;
import
com.yiring.app.param.key.KeyAlarmRulesPageParam
;
import
com.yiring.app.service.key.KeyAlarmRulesService
;
import
com.yiring.app.vo.key.KeyAlarmRulesVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
* 按键报警规则控制器
*
* @author LJ-2204
* @date 2022/5/6
*/
@Slf4j
@Validated
@Api
(
tags
=
"按键报警规则"
)
@RestController
@RequestMapping
(
"/key/alarm/rules"
)
public
class
KeyAlarmRulesController
{
@Resource
KeyAlarmRulesService
keyAlarmRulesService
;
@ApiOperation
(
"新增报警规则"
)
@PostMapping
(
"add"
)
public
Result
<
String
>
add
(
KeyAlarmRulesAddParam
keyAlarmRulesAddParam
)
{
return
keyAlarmRulesService
.
add
(
keyAlarmRulesAddParam
);
}
@ApiOperation
(
"删除报警规则"
)
@DeleteMapping
(
"delete"
)
public
Result
<
String
>
delete
(
IdParam
idParam
)
{
return
keyAlarmRulesService
.
delete
(
idParam
);
}
@ApiOperation
(
"更新报警规则"
)
@PutMapping
(
"modify"
)
public
Result
<
String
>
modify
(
KeyAlarmRulesModifyParam
keyAlarmRulesModifyParam
)
{
return
keyAlarmRulesService
.
modify
(
keyAlarmRulesModifyParam
);
}
@ApiOperation
(
"导出"
)
@GetMapping
(
"export"
)
public
void
export
(
KeyAlarmRulesExportParam
keyAlarmRulesExportParam
,
HttpServletResponse
response
)
{
keyAlarmRulesService
.
export
(
keyAlarmRulesExportParam
,
response
);
}
@ApiOperation
(
"表格查询"
)
@GetMapping
(
"page"
)
public
Result
<
PageVo
<
KeyAlarmRulesVo
>>
page
(
KeyAlarmRulesPageParam
keyAlarmRulesPageParam
,
PageParam
pageParam
)
{
return
keyAlarmRulesService
.
page
(
keyAlarmRulesPageParam
,
pageParam
);
}
}
app/src/main/java/com/yiring/app/web/location/tag/LocationTagController.java
浏览文件 @
e21e94dc
...
...
@@ -50,6 +50,12 @@ public class LocationTagController {
return
locationTagService
.
findLocationTagPage
(
locationTagFindParam
,
pageParam
);
}
@ApiOperation
(
"条件查询"
)
@GetMapping
(
"findLocationTag"
)
public
Result
<
PageVo
<
LocationTagVo
>>
findLocationTag
(
@Valid
LocationTagFindParam
locationTagFindParam
)
{
return
locationTagService
.
findLocationTag
(
locationTagFindParam
);
}
@ApiOperation
(
"销毁定位标签"
)
@DeleteMapping
(
"deleteLocationTag"
)
public
Result
<
String
>
deleteLocationTag
(
@Valid
LocationTagDeleteParam
locationTagDeleteParam
)
{
...
...
app/src/main/java/com/yiring/app/web/user/UserAppController.java
浏览文件 @
e21e94dc
...
...
@@ -5,6 +5,7 @@ import com.yiring.app.param.user.*;
import
com.yiring.app.service.user.UserService
;
import
com.yiring.app.vo.user.UserInfoVo
;
import
com.yiring.app.vo.user.UserVo
;
import
com.yiring.auth.param.IdsParam
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IndexParam
;
...
...
@@ -64,8 +65,8 @@ public class UserAppController {
@ApiOperation
(
"逻辑删除用户"
)
@DeleteMapping
(
"deleteUser"
)
public
Result
<
String
>
deleteUser
(
@Valid
Id
Param
id
Param
)
{
return
userService
.
deleteUser
(
idParam
);
public
Result
<
String
>
deleteUser
(
@Valid
Id
sParam
ids
Param
)
{
return
userService
.
deleteUser
(
id
s
Param
);
}
@ApiOperation
(
"用户导出"
)
...
...
@@ -103,4 +104,10 @@ public class UserAppController {
public
Result
<
PageVo
<
UserVo
>>
indexUser
(
@Valid
IndexParam
indexParam
)
{
return
userService
.
indexUser
(
indexParam
);
}
@ApiOperation
(
"条件查询"
)
@GetMapping
(
"findUser"
)
public
Result
<
PageVo
<
UserVo
>>
findUser
(
@Valid
UserFindParam
userFindParam
)
{
return
userService
.
findUser
(
userFindParam
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论