Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
ffd8b1b1
提交
ffd8b1b1
authored
11月 15, 2021
作者:
zjm
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'unit-dev' of git.yfzx.zjtys.com.cn:matrix/device-back into dev
上级
73ad44f5
1d2eef21
隐藏空白字符变更
内嵌
并排
正在显示
36 个修改的文件
包含
1207 行增加
和
61 行删除
+1207
-61
AllotBillController.java
...tykj/dev/device/allot/controller/AllotBillController.java
+5
-6
CacheBeanConfig.java
...dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
+9
-0
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+14
-0
DeviceLibraryDao.java
.../tykj/dev/device/library/repository/DeviceLibraryDao.java
+13
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+14
-0
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+50
-0
DeviceLibrary.java
.../tykj/dev/device/library/subject/domin/DeviceLibrary.java
+12
-0
UpdateUnitVo.java
.../com/tykj/dev/device/library/subject/vo/UpdateUnitVo.java
+26
-0
WorkUseVo.java
...ava/com/tykj/dev/device/library/subject/vo/WorkUseVo.java
+37
-0
WorkUseVos.java
...va/com/tykj/dev/device/library/subject/vo/WorkUseVos.java
+28
-0
application-dev.properties
dev-union/src/main/resources/application-dev.properties
+1
-1
UnitStoreLocationVo.java
...om/tykj/dev/device/user/base/req/UnitStoreLocationVo.java
+27
-0
UnitsAddVo.java
...in/java/com/tykj/dev/device/user/base/req/UnitsAddVo.java
+76
-0
AreaCache.java
...c/main/java/com/tykj/dev/device/user/cache/AreaCache.java
+12
-0
AreaExhibitionCache.java
...a/com/tykj/dev/device/user/cache/AreaExhibitionCache.java
+71
-0
UnitsCache.java
.../main/java/com/tykj/dev/device/user/cache/UnitsCache.java
+43
-0
AreaController.java
...kj/dev/device/user/subject/controller/AreaController.java
+8
-0
AreaExhibitionController.java
...ice/user/subject/controller/AreaExhibitionController.java
+42
-0
UnitStoreLocationController.java
.../user/subject/controller/UnitStoreLocationController.java
+44
-0
UnitsController.java
...j/dev/device/user/subject/controller/UnitsController.java
+48
-5
AreaExhibitionDao.java
...m/tykj/dev/device/user/subject/dao/AreaExhibitionDao.java
+16
-0
UnitStoreLocationDao.java
...ykj/dev/device/user/subject/dao/UnitStoreLocationDao.java
+11
-0
Area.java
...in/java/com/tykj/dev/device/user/subject/entity/Area.java
+1
-1
AreaExhibition.java
...m/tykj/dev/device/user/subject/entity/AreaExhibition.java
+59
-0
UnitStoreLocation.java
...ykj/dev/device/user/subject/entity/UnitStoreLocation.java
+40
-0
Units.java
...n/java/com/tykj/dev/device/user/subject/entity/Units.java
+12
-1
AreaExhibitionService.java
...ev/device/user/subject/service/AreaExhibitionService.java
+21
-0
AreaService.java
...com/tykj/dev/device/user/subject/service/AreaService.java
+6
-0
UnitStoreLocationService.java
...device/user/subject/service/UnitStoreLocationService.java
+20
-0
UnitsService.java
...om/tykj/dev/device/user/subject/service/UnitsService.java
+30
-1
UserPublicService.java
...kj/dev/device/user/subject/service/UserPublicService.java
+11
-0
AreaExhibitionServiceImpl.java
.../user/subject/service/impl/AreaExhibitionServiceImpl.java
+110
-0
AreaServiceImpl.java
...dev/device/user/subject/service/impl/AreaServiceImpl.java
+17
-24
UnitStoreLocationServiceImpl.java
...er/subject/service/impl/UnitStoreLocationServiceImpl.java
+63
-0
UnitsServiceImpl.java
...ev/device/user/subject/service/impl/UnitsServiceImpl.java
+191
-22
UserPublicServiceImpl.java
...vice/user/subject/service/impl/UserPublicServiceImpl.java
+19
-0
没有找到文件。
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillController.java
浏览文件 @
ffd8b1b1
...
@@ -939,7 +939,11 @@ public class AllotBillController {
...
@@ -939,7 +939,11 @@ public class AllotBillController {
}
}
@GetMapping
(
"/getFileList"
)
@ApiOperation
(
"通过任务id查询账单中文件"
)
public
ResponseEntity
getFileList
(
Integer
taskId
){
return
ResponseEntity
.
ok
(
allotBillService
.
getFileList
(
taskId
));
}
...
@@ -1065,11 +1069,6 @@ public class AllotBillController {
...
@@ -1065,11 +1069,6 @@ public class AllotBillController {
}
}
}
}
@GetMapping
(
"getFileList"
)
@ApiOperation
(
"通过任务id查询账单中文件"
)
public
ResponseEntity
getFileList
(
Integer
taskId
){
return
ResponseEntity
.
ok
(
allotBillService
.
getFileList
(
taskId
));
}
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
浏览文件 @
ffd8b1b1
...
@@ -3,9 +3,11 @@ package com.tykj.dev.device.confirmcheck.entity.cache;
...
@@ -3,9 +3,11 @@ package com.tykj.dev.device.confirmcheck.entity.cache;
import
com.tykj.dev.config.cache.ConfigCache
;
import
com.tykj.dev.config.cache.ConfigCache
;
import
com.tykj.dev.config.repository.SystemConfigDao
;
import
com.tykj.dev.config.repository.SystemConfigDao
;
import
com.tykj.dev.device.user.cache.AreaCache
;
import
com.tykj.dev.device.user.cache.AreaCache
;
import
com.tykj.dev.device.user.cache.AreaExhibitionCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.AreaExhibitionDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.dao.UserDao
;
import
com.tykj.dev.device.user.subject.dao.UserDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -33,6 +35,9 @@ public class CacheBeanConfig {
...
@@ -33,6 +35,9 @@ public class CacheBeanConfig {
@Autowired
@Autowired
private
SystemConfigDao
systemConfigDao
;
private
SystemConfigDao
systemConfigDao
;
@Autowired
AreaExhibitionDao
areaExhibitionDao
;
@Bean
@Bean
public
AreaCache
initAreaCache
()
{
public
AreaCache
initAreaCache
()
{
return
new
AreaCache
(
areaRepo
.
findAll
());
return
new
AreaCache
(
areaRepo
.
findAll
());
...
@@ -43,6 +48,10 @@ public class CacheBeanConfig {
...
@@ -43,6 +48,10 @@ public class CacheBeanConfig {
return
new
UserCache
(
userDao
.
findAll
());
return
new
UserCache
(
userDao
.
findAll
());
}
}
@Bean
public
AreaExhibitionCache
initAreaExhibitionCache
()
{
return
new
AreaExhibitionCache
(
areaExhibitionDao
.
findAll
());
}
@Bean
@Bean
public
UnitsCache
initUnitCache
()
{
public
UnitsCache
initUnitCache
()
{
return
new
UnitsCache
(
unitsDao
.
findAll
());
return
new
UnitsCache
(
unitsDao
.
findAll
());
...
...
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
浏览文件 @
ffd8b1b1
...
@@ -1154,6 +1154,20 @@ public class DeviceLibraryController {
...
@@ -1154,6 +1154,20 @@ public class DeviceLibraryController {
return
setOrderNumber
(
sortNum
,
allListAndParent
);
return
setOrderNumber
(
sortNum
,
allListAndParent
);
}
}
@ApiOperation
(
value
=
"为工作交接查询装备"
,
notes
=
"为工作交接查询装备"
)
@GetMapping
(
"/selectDeviceForWorkUse"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
WorkUseVo
>
selectDeviceForWorkUse
(){
return
deviceLibraryService
.
getDevicesForWorkUse
();
}
@ApiOperation
(
value
=
"修改单位名称"
,
notes
=
"修改单位名称"
)
@PostMapping
(
"/updateDeviceLocationAndOwnUnit"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
<
String
>
updateDeviceLocationAndOwnUnit
(
@RequestBody
UpdateUnitVo
updateUnitVo
){
deviceLibraryService
.
updateDeviceLocationAndOwnUnit
(
updateUnitVo
);
return
ResponseEntity
.
ok
(
"修改成功"
);
}
public
List
<
DeviceLibrary
>
getAllListAndParent
(){
public
List
<
DeviceLibrary
>
getAllListAndParent
(){
DeviceLibrarySelectVo
deviceLibrarySelectVo
=
new
DeviceLibrarySelectVo
();
DeviceLibrarySelectVo
deviceLibrarySelectVo
=
new
DeviceLibrarySelectVo
();
...
...
dev-library/src/main/java/com/tykj/dev/device/library/repository/DeviceLibraryDao.java
浏览文件 @
ffd8b1b1
...
@@ -228,5 +228,18 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
...
@@ -228,5 +228,18 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query
(
"update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds"
)
@Query
(
"update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds"
)
int
updateStorageLocation
(
@Param
(
"storageLocation"
)
String
storageLocation
,
int
updateStorageLocation
(
@Param
(
"storageLocation"
)
String
storageLocation
,
@Param
(
"deviceIds"
)
List
<
Integer
>
deviceIds
);
@Param
(
"deviceIds"
)
List
<
Integer
>
deviceIds
);
@Transactional
@Modifying
@Query
(
"update DeviceLibrary o set o.locationUnit = :updateUnitName where o.locationUnit = :originUnitName"
)
int
updateLocationUnit
(
@Param
(
"originUnitName"
)
String
originUnitName
,
@Param
(
"updateUnitName"
)
String
updateUnitName
);
@Transactional
@Modifying
@Query
(
"update DeviceLibrary o set o.ownUnit = :updateUnitName where o.ownUnit = :originUnitName"
)
int
updateOwnUnit
(
@Param
(
"originUnitName"
)
String
originUnitName
,
@Param
(
"updateUnitName"
)
String
updateUnitName
);
}
}
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
ffd8b1b1
...
@@ -499,4 +499,18 @@ public interface DeviceLibraryService {
...
@@ -499,4 +499,18 @@ public interface DeviceLibraryService {
void
updateStorageLocation
(
UpdateStorageLocationVo
updateStorageLocationVo
);
void
updateStorageLocation
(
UpdateStorageLocationVo
updateStorageLocationVo
);
/**
* 查询装备给工作交接使用
* @return WorkUseVos
*/
List
<
WorkUseVo
>
getDevicesForWorkUse
();
/**
* 修改单位名称则装备的所属所在也需要进行修改
* @param updateUnitVo 修改单位名称的vo
*/
void
updateDeviceLocationAndOwnUnit
(
UpdateUnitVo
updateUnitVo
);
}
}
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
ffd8b1b1
...
@@ -1164,6 +1164,56 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -1164,6 +1164,56 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
});
});
}
}
@Override
public
List
<
WorkUseVo
>
getDevicesForWorkUse
()
{
//获取当前登录的单位名称
String
currentUserUnitName
=
userUtils
.
getCurrentUserUnitName
();
PredicateBuilder
<
DeviceLibrary
>
builder
=
Specifications
.
and
();
builder
.
eq
(
"ownUnit"
,
currentUserUnitName
);
List
<
DeviceLibrary
>
deviceLibraries
=
deviceLibraryDao
.
findAll
(
builder
.
build
());
List
<
Integer
>
status
=
new
ArrayList
<>(
Arrays
.
asList
(
5
,
11
,
12
));
deviceLibraries
=
deviceLibraries
.
stream
().
filter
(
deviceLibrary
->
!
status
.
contains
(
deviceLibrary
.
getLifeStatus
()))
.
collect
(
Collectors
.
toList
());
//进行过滤赋值、
deviceLibraries
.
forEach
(
deviceLibrary
->
{
if
(!
deviceLibrary
.
getOwnUnit
().
equals
(
deviceLibrary
.
getLocationUnit
())){
//不在库
deviceLibrary
.
setIsInLibrary
(
1
);
}
else
{
//在库
deviceLibrary
.
setIsInLibrary
(
0
);
}
});
//按照型号,名称,是否在库进行分组 "Ǵ"
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
deviceLibraries
.
stream
().
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()
+
"Ǵ"
+
deviceLibrary
.
getName
()
+
"Ǵ"
+
deviceLibrary
.
getIsInLibrary
()));
List
<
WorkUseVo
>
workUseVos
=
new
ArrayList
<>();
map
.
keySet
().
forEach
(
s
->
{
WorkUseVo
workUseVo
=
new
WorkUseVo
();
String
[]
split
=
s
.
split
(
"Ǵ"
);
workUseVo
.
setModel
(
split
[
0
]);
workUseVo
.
setName
(
split
[
1
]);
workUseVo
.
setIsInLibrary
(
Integer
.
valueOf
(
split
[
2
]));
List
<
DeviceLibrary
>
deviceLibraries1
=
map
.
get
(
s
);
List
<
String
>
seqList
=
deviceLibraries1
.
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
());
workUseVo
.
setSeqNumber
(
String
.
join
(
"-"
,
seqList
));
workUseVo
.
setDeviceCount
(
deviceLibraries1
.
size
());
workUseVos
.
add
(
workUseVo
);
});
return
workUseVos
;
}
@Override
@UpdateCache
public
void
updateDeviceLocationAndOwnUnit
(
UpdateUnitVo
updateUnitVo
)
{
//先修改所在
deviceLibraryDao
.
updateLocationUnit
(
updateUnitVo
.
getOriginUnitName
(),
updateUnitVo
.
getUpdateUnitName
());
//修改所属
deviceLibraryDao
.
updateOwnUnit
(
updateUnitVo
.
getOriginUnitName
(),
updateUnitVo
.
getUpdateUnitName
());
}
// @Override
// @Override
// @UpdateCache
// @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) {
// public int updatePartParentId(List<Integer> deviceIds) {
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/domin/DeviceLibrary.java
浏览文件 @
ffd8b1b1
...
@@ -4,6 +4,7 @@ import com.tykj.dev.config.cache.ConfigCache;
...
@@ -4,6 +4,7 @@ import com.tykj.dev.config.cache.ConfigCache;
import
com.tykj.dev.device.library.subject.vo.DeviceExcel
;
import
com.tykj.dev.device.library.subject.vo.DeviceExcel
;
import
com.tykj.dev.device.library.subject.vo.DeviceExcelVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceExcelVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceVo
;
import
com.tykj.dev.device.library.subject.vo.WorkUseVo
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -277,6 +278,10 @@ public class DeviceLibrary implements Serializable {
...
@@ -277,6 +278,10 @@ public class DeviceLibrary implements Serializable {
@Transient
@Transient
private
Integer
orderNumber
;
private
Integer
orderNumber
;
@ApiModelProperty
(
value
=
"是否在库"
,
notes
=
"0 在库 1不在库"
)
@Transient
private
Integer
isInLibrary
;
public
void
addChildNode
(
DeviceLibrary
deviceLibraryEntity
)
{
public
void
addChildNode
(
DeviceLibrary
deviceLibraryEntity
)
{
childs
.
add
(
deviceLibraryEntity
);
childs
.
add
(
deviceLibraryEntity
);
}
}
...
@@ -292,6 +297,13 @@ public class DeviceLibrary implements Serializable {
...
@@ -292,6 +297,13 @@ public class DeviceLibrary implements Serializable {
return
mapper
.
map
(
this
,
DeviceVo
.
class
);
return
mapper
.
map
(
this
,
DeviceVo
.
class
);
}
}
// public WorkUseVo toWorkUse(){
// setConfigName();
// //modelMap复制
// ModelMapper mapper = BeanHelper.getUserMapper();
// return mapper.map(this, WorkUseVo.class);
// }
public
DeviceExcelVo
toDeviceExcelVo
(){
public
DeviceExcelVo
toDeviceExcelVo
(){
setConfigName
();
setConfigName
();
//modelMap复制
//modelMap复制
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/UpdateUnitVo.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* @author zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
"修改单位名称的vo"
)
public
class
UpdateUnitVo
{
@ApiModelProperty
(
value
=
"原单位名称"
)
private
String
originUnitName
;
@ApiModelProperty
(
value
=
"修改后单位名称"
)
private
String
updateUnitName
;
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/WorkUseVo.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author zsp
*/
@Data
@ApiModel
(
"返回给工作交接的vo"
)
@Repository
public
class
WorkUseVo
{
@ApiModelProperty
(
value
=
"型号"
)
private
String
model
;
@ApiModelProperty
(
value
=
"名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"序列号"
)
private
String
seqNumber
;
@ApiModelProperty
(
value
=
"装备数量"
)
private
Integer
deviceCount
;
@ApiModelProperty
(
value
=
"是否在库"
,
notes
=
"0 在库 1不在库"
)
private
Integer
isInLibrary
;
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/WorkUseVos.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author zsp
*/
@Data
@ApiModel
(
"返回给工作交接的vos"
)
@Repository
public
class
WorkUseVos
{
@ApiModelProperty
(
value
=
"非在库装备列表"
)
private
List
<
WorkUseVo
>
exceptionList
;
@ApiModelProperty
(
value
=
"在库装备列表"
)
private
List
<
WorkUseVo
>
normalList
;
// @ApiModelProperty(value = "是否在库",notes = "0 在库 1不在库")
// private Integer isInLibrary;
}
dev-union/src/main/resources/application-dev.properties
浏览文件 @
ffd8b1b1
spring.application.name
=
device-dev
spring.application.name
=
device-dev
spring.datasource.url
=
jdbc:mysql://192.168.100.249:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.url
=
jdbc:mysql://192.168.100.249:3306/device
_master
?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.password
=
root
...
...
dev-user/src/main/java/com/tykj/dev/device/user/base/req/UnitStoreLocationVo.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
base
.
req
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitStoreLocationVo.java
* @Description TODO
* @createTime 2021年11月08日 13:47:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel
(
value
=
"根据单位名称查询用户的接口"
,
description
=
"根据单位名称查询用户的接口"
)
public
class
UnitStoreLocationVo
{
@ApiModelProperty
(
value
=
"单位ID"
,
name
=
"unitId"
,
example
=
"12321L"
)
private
Integer
unitId
;
@ApiModelProperty
(
value
=
"类型名称"
,
name
=
"typeName"
,
example
=
"12321L"
)
private
String
typeName
=
""
;
}
dev-user/src/main/java/com/tykj/dev/device/user/base/req/UnitsAddVo.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
base
.
req
;
import
com.tykj.dev.device.user.base.ret.AreaVo
;
import
com.tykj.dev.device.user.base.ret.LeftNavigation
;
import
com.tykj.dev.device.user.base.ret.UnitsTrainVo
;
import
com.tykj.dev.device.user.base.ret.UnitsVo
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.modelmapper.ModelMapper
;
import
javax.persistence.*
;
import
java.util.UUID
;
/**
* @author zjm
* @version 1.0.0
* @ClassName Units.java
* @Description 单位对象
* @createTime 2020年07月28日 09:23:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel
(
value
=
"单位添加对象"
,
description
=
"单位添加对象"
)
public
class
UnitsAddVo
{
/**
* 单位名称
*/
@ApiModelProperty
(
value
=
"单位名称"
,
name
=
"unitName"
,
example
=
"12321L"
)
private
String
name
;
/**
* 单位描述
*/
@ApiModelProperty
(
value
=
"单位描述"
,
name
=
"unitDesc"
,
example
=
"12321L"
)
private
String
unitDesc
;
/**
* 等级
*/
@ApiModelProperty
(
value
=
"等级"
,
name
=
"level"
,
example
=
"12321L"
)
private
Integer
level
;
/**
* 排序
*/
@ApiModelProperty
(
value
=
"排序"
,
name
=
"showOrder"
,
example
=
"12321L"
)
private
Integer
showOrder
;
@ApiModelProperty
(
value
=
"装备配用范围的指定"
)
private
Integer
packingMatchingRange
;
@ApiModelProperty
(
value
=
"是否代管"
)
private
Integer
escrow
;
@ApiModelProperty
(
value
=
"展示区域id"
)
private
Integer
exhibitionId
;
@ApiModelProperty
(
value
=
"上级单位ID"
)
private
Integer
parentUnitId
;
public
Units
toUnits
(){
ModelMapper
mapper
=
BeanHelper
.
getUserMapper
();
return
mapper
.
map
(
this
,
Units
.
class
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/cache/AreaCache.java
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
cache
;
package
com
.
tykj
.
dev
.
device
.
user
.
cache
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.function.Function
;
...
@@ -21,6 +23,7 @@ public class AreaCache {
...
@@ -21,6 +23,7 @@ public class AreaCache {
private
Map
<
Integer
,
Area
>
idMap
;
private
Map
<
Integer
,
Area
>
idMap
;
public
AreaCache
(
List
<
Area
>
areaList
)
{
public
AreaCache
(
List
<
Area
>
areaList
)
{
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
idMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getId
,
Function
.
identity
()));
idMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getId
,
Function
.
identity
()));
...
@@ -30,6 +33,10 @@ public class AreaCache {
...
@@ -30,6 +33,10 @@ public class AreaCache {
Area
area
=
nameMap
.
get
(
name
);
Area
area
=
nameMap
.
get
(
name
);
return
idMap
.
get
(
area
.
getFatherId
());
return
idMap
.
get
(
area
.
getFatherId
());
}
}
public
List
<
Area
>
findAllByFatherId
(
Integer
fatherId
)
{
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
area
->
area
.
getFatherId
().
equals
(
fatherId
)).
collect
(
Collectors
.
toList
());
}
public
Area
findByName
(
String
name
)
{
public
Area
findByName
(
String
name
)
{
return
nameMap
.
get
(
name
)
==
null
?
new
Area
(
0
,
"省直属"
,
9999
,
"9999"
,
0
,
""
)
:
nameMap
.
get
(
name
);
return
nameMap
.
get
(
name
)
==
null
?
new
Area
(
0
,
"省直属"
,
9999
,
"9999"
,
0
,
""
)
:
nameMap
.
get
(
name
);
...
@@ -38,6 +45,11 @@ public class AreaCache {
...
@@ -38,6 +45,11 @@ public class AreaCache {
public
Area
findById
(
Integer
id
)
{
public
Area
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
)
==
null
?
new
Area
(
0
,
"省直属"
,
9999
,
"9999"
,
0
,
""
)
:
idMap
.
get
(
id
);
return
idMap
.
get
(
id
)
==
null
?
new
Area
(
0
,
"省直属"
,
9999
,
"9999"
,
0
,
""
)
:
idMap
.
get
(
id
);
}
}
public
List
<
Area
>
findAll
(){
return
new
ArrayList
<>(
idMap
.
values
());
}
public
AreaCache
refresh
(
List
<
Area
>
areaList
)
{
public
AreaCache
refresh
(
List
<
Area
>
areaList
)
{
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
...
...
dev-user/src/main/java/com/tykj/dev/device/user/cache/AreaExhibitionCache.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
cache
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaExhibitionCache.java
* @Description TODO
* @createTime 2021年11月09日 14:36:00
*/
@Data
public
class
AreaExhibitionCache
{
private
Map
<
Integer
,
AreaExhibition
>
idMap
;
private
List
<
AreaExhibition
>
areaExhibitions
;
public
AreaExhibitionCache
(
List
<
AreaExhibition
>
areaExhibitionList
){
this
.
idMap
=
areaExhibitionList
.
stream
().
collect
(
Collectors
.
toMap
(
AreaExhibition:
:
getId
,
Function
.
identity
()));
this
.
areaExhibitions
=
areaExhibitionList
;
}
public
Map
<
Integer
,
AreaExhibition
>
getIdMap
()
{
return
idMap
;
}
public
AreaExhibition
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
}
public
List
<
AreaExhibition
>
findAll
(){
return
new
ArrayList
<>(
idMap
.
values
());
}
/**
* 查询大于等新序号,小于原序号
* @return
*/
public
List
<
AreaExhibition
>
findListGeNewAndLtOriginal
(
Integer
newOrder
,
Integer
OriginalOrder
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
areaExhibition
->
(
areaExhibition
.
getOrders
()>=
newOrder
)
&&(
areaExhibition
.
getOrders
()
<
OriginalOrder
)).
collect
(
Collectors
.
toList
());
}
/**
* 查询大于原序号,小于等于新序号
*/
public
List
<
AreaExhibition
>
findListLgOriginalAndLeNew
(
Integer
newOrder
,
Integer
OriginalOrder
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
areaExhibition
->
(
areaExhibition
.
getOrders
()<=
newOrder
)
&&(
areaExhibition
.
getOrders
()
>
OriginalOrder
)).
collect
(
Collectors
.
toList
());
}
/**
* 根据区域id查询下级以及
*/
public
List
<
AreaExhibition
>
findByFatherId
(
Integer
fatherId
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
areaExhibition
->
fatherId
.
equals
(
areaExhibition
.
getFatherId
())).
collect
(
Collectors
.
toList
());
}
public
AreaExhibitionCache
refresh
(
List
<
AreaExhibition
>
areaExhibitionList
){
this
.
idMap
=
areaExhibitionList
.
stream
().
collect
(
Collectors
.
toMap
(
AreaExhibition:
:
getId
,
Function
.
identity
()));
this
.
areaExhibitions
=
areaExhibitionList
;
return
this
;
}
}
dev-user/src/main/java/com/tykj/dev/device/user/cache/UnitsCache.java
浏览文件 @
ffd8b1b1
...
@@ -14,14 +14,22 @@ public class UnitsCache {
...
@@ -14,14 +14,22 @@ public class UnitsCache {
private
Map
<
Integer
,
Units
>
idMap
;
private
Map
<
Integer
,
Units
>
idMap
;
private
Map
<
Integer
,
Units
>
areaIdMpa
;
public
UnitsCache
(
List
<
Units
>
unitsList
){
public
UnitsCache
(
List
<
Units
>
unitsList
){
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
this
.
areaIdMpa
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getAreaId
,
Function
.
identity
()));
}
}
public
Map
<
Integer
,
Units
>
getIdMap
()
{
public
Map
<
Integer
,
Units
>
getIdMap
()
{
return
idMap
;
return
idMap
;
}
}
public
Units
findByAreaId
(
Integer
areaId
){
return
areaIdMpa
.
get
(
areaId
);
}
public
Units
findById
(
Integer
id
)
{
public
Units
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
return
idMap
.
get
(
id
);
}
}
...
@@ -30,8 +38,43 @@ public class UnitsCache {
...
@@ -30,8 +38,43 @@ public class UnitsCache {
return
new
ArrayList
<>(
idMap
.
values
());
return
new
ArrayList
<>(
idMap
.
values
());
}
}
public
List
<
Units
>
findAllByAreaExhibitionId
(
Integer
areaExhibitionId
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
units
->
units
.
getExhibitionId
().
equals
(
areaExhibitionId
)).
collect
(
Collectors
.
toList
());
}
/**
* 根据当前单位id查询下级以及本级
*/
public
List
<
Units
>
findByIdSubordinateAndOneself
(
Integer
unitId
){
Units
units
=
idMap
.
get
(
unitId
);
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
units1
->
units1
.
getExhibitionId
().
equals
(
units
.
getExhibitionId
())).
collect
(
Collectors
.
toList
());
}
/**
* 查询大于等新序号,小于原序号
* @return
*/
public
List
<
Units
>
findListGeNewAndLtOriginal
(
Integer
newOrder
,
Integer
OriginalOrder
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
units
->
(
units
.
getShowOrder
()>=
newOrder
)
&&(
units
.
getShowOrder
()
<
OriginalOrder
)).
collect
(
Collectors
.
toList
());
}
/**
* 查询大于原序号,小于等于新序号
*/
public
List
<
Units
>
findListLgOriginalAndLeNew
(
Integer
newOrder
,
Integer
OriginalOrder
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
units
->
(
units
.
getShowOrder
()<=
newOrder
)
&&(
units
.
getShowOrder
()
>
OriginalOrder
)).
collect
(
Collectors
.
toList
());
}
public
UnitsCache
refresh
(
List
<
Units
>
unitsList
){
public
UnitsCache
refresh
(
List
<
Units
>
unitsList
){
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
this
.
areaIdMpa
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getAreaId
,
Function
.
identity
()));
return
this
;
return
this
;
}
}
/**
* 根据区域id的集合查询所有的单位
*/
public
List
<
Units
>
findByAllAreaIds
(
List
<
Integer
>
areaIds
){
return
new
ArrayList
<>(
idMap
.
values
()).
stream
().
filter
(
units
->
areaIds
.
contains
(
units
.
getAreaId
())).
collect
(
Collectors
.
toList
());
}
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/AreaController.java
浏览文件 @
ffd8b1b1
...
@@ -81,4 +81,12 @@ public class AreaController {
...
@@ -81,4 +81,12 @@ public class AreaController {
return
ResponseEntity
.
ok
(
areaService
.
findIdQuerySubordinateIds
(
size
));
return
ResponseEntity
.
ok
(
areaService
.
findIdQuerySubordinateIds
(
size
));
}
}
@GetMapping
(
"/findAll"
)
@ApiOperation
(
value
=
"查询所有区域列表"
,
notes
=
"查询所有区域列表"
)
public
ResponseEntity
selectFindAll
(){
return
ResponseEntity
.
ok
(
areaService
.
findAllArea
());
}
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/AreaExhibitionController.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
com.tykj.dev.device.user.subject.service.AreaExhibitionService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaExhibitionController.java
* @Description TODO
* @createTime 2021年11月09日 11:29:00
*/
@RestController
@AutoDocument
@Api
(
tags
=
"区域展示模块"
,
description
=
"提供区域展示模块接口"
)
@RequestMapping
(
"/areaExhibition"
)
public
class
AreaExhibitionController
{
@Autowired
AreaExhibitionService
areaExhibitionService
;
@GetMapping
(
"/finaAll"
)
@ApiOperation
(
value
=
"查询所有区域列表"
,
notes
=
"查询所有区域列表"
)
public
ResponseEntity
selectFindAll
()
{
return
ResponseEntity
.
ok
(
areaExhibitionService
.
finaAllAreaExhibition
());
}
@PostMapping
(
"/save"
)
@ApiOperation
(
value
=
"保存区域展示对象"
,
notes
=
"保存区域展示对象"
)
public
ResponseEntity
saveExhibition
(
@RequestBody
AreaExhibition
areaExhibition
)
{
return
ResponseEntity
.
ok
(
areaExhibitionService
.
save
(
areaExhibition
));
}
}
\ No newline at end of file
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/UnitStoreLocationController.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.user.base.req.UnitStoreLocationVo
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
com.tykj.dev.device.user.subject.service.UnitStoreLocationService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitStoreLocationController.java
* @Description TODO
* @createTime 2021年11月08日 13:23:00
*/
@RestController
@AutoDocument
@Api
(
tags
=
"各单位存放位置"
,
description
=
"提供用户相关的接口"
)
@RequestMapping
(
"/unitStoreLocation"
)
@Slf4j
public
class
UnitStoreLocationController
{
@Autowired
UnitStoreLocationService
unitStoreLocationService
;
@PostMapping
(
value
=
"/unitIdAndTypeName"
)
@ApiOperation
(
value
=
"根据单位ID以及字段名称查询单位存储列表"
,
notes
=
"返回单位对象"
)
public
ResponseEntity
unitIdAndTypeName
(
@RequestBody
UnitStoreLocationVo
unitStoreLocationVo
)
{
return
ResponseEntity
.
ok
(
unitStoreLocationService
.
findAllByUnitIdAndTypeName
(
unitStoreLocationVo
));
}
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
value
=
"添加库房位置对象"
,
notes
=
"添加库房位置对象"
)
public
ResponseEntity
unitIdAndTypeName
(
@RequestBody
UnitStoreLocation
unitStoreLocation
)
{
return
ResponseEntity
.
ok
(
unitStoreLocationService
.
save
(
unitStoreLocation
));
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/controller/UnitsController.java
浏览文件 @
ffd8b1b1
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.subject.controller;
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.subject.controller;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitsAddVo
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
...
@@ -25,7 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
...
@@ -25,7 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
*/
@RestController
@RestController
@AutoDocument
@AutoDocument
@Api
(
tags
=
"
用户
模块"
,
description
=
"提供用户相关的接口"
)
@Api
(
tags
=
"
单位
模块"
,
description
=
"提供用户相关的接口"
)
@RequestMapping
(
"/units"
)
@RequestMapping
(
"/units"
)
@Slf4j
@Slf4j
public
class
UnitsController
{
public
class
UnitsController
{
...
@@ -62,13 +63,13 @@ public class UnitsController {
...
@@ -62,13 +63,13 @@ public class UnitsController {
@GetMapping
(
value
=
"/areaDevice"
)
@GetMapping
(
value
=
"/areaDevice"
)
@ApiOperation
(
value
=
"查询装备库区域单位列表"
,
notes
=
"查询装备库区域单位列表"
)
@ApiOperation
(
value
=
"查询装备库区域单位列表"
,
notes
=
"查询装备库区域单位列表"
)
public
ResponseEntity
selectOrganizationUnits1
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
public
ResponseEntity
selectOrganizationUnits1
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
1
(
securityUser
));
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
(
securityUser
));
}
}
@GetMapping
(
value
=
"/areaDirectlyUnder"
)
@GetMapping
(
value
=
"/areaDirectlyUnder"
)
@ApiOperation
(
value
=
"查询直属代管单位列表"
,
notes
=
"查询直属代管单位列表"
)
@ApiOperation
(
value
=
"查询直属代管单位列表"
,
notes
=
"查询直属代管单位列表"
)
public
ResponseEntity
selectOrganizationUnits2
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
public
ResponseEntity
selectOrganizationUnits2
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
2
(
securityUser
));
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
(
securityUser
));
}
}
@GetMapping
(
value
=
"/findAll/GreaterThanEqual/{level}"
)
@GetMapping
(
value
=
"/findAll/GreaterThanEqual/{level}"
)
...
@@ -134,8 +135,6 @@ public class UnitsController {
...
@@ -134,8 +135,6 @@ public class UnitsController {
return
ResponseEntity
.
ok
(
unitsService
.
findbyName
(
unitNameVo
.
getUnitName
()));
return
ResponseEntity
.
ok
(
unitsService
.
findbyName
(
unitNameVo
.
getUnitName
()));
}
}
@GetMapping
(
"/countries/units"
)
@GetMapping
(
"/countries/units"
)
@ApiOperation
(
value
=
"省入库发件单位下拉接口"
,
notes
=
"省入库发件单位下拉接口"
)
@ApiOperation
(
value
=
"省入库发件单位下拉接口"
,
notes
=
"省入库发件单位下拉接口"
)
public
ResponseEntity
findSuperiorUnitsList
(){
public
ResponseEntity
findSuperiorUnitsList
(){
...
@@ -154,5 +153,49 @@ public class UnitsController {
...
@@ -154,5 +153,49 @@ public class UnitsController {
return
ResponseEntity
.
ok
(
DeviceModelSort
.
mapUnitSort
);
return
ResponseEntity
.
ok
(
DeviceModelSort
.
mapUnitSort
);
}
}
/**
* 单位管理查询单位查询接口
*/
@GetMapping
(
"/findAll/unitManagement"
)
@ApiOperation
(
value
=
"[单位管理]单位管理查询单位查询接口"
,
notes
=
"单位管理查询单位查询接口"
)
public
ResponseEntity
unitManagement
(){
return
ResponseEntity
.
ok
(
unitsService
.
unitManagement
());
}
/**
* 单位管理查询单位查询接口
*/
@PostMapping
(
"/saveUnits"
)
@ApiOperation
(
value
=
"[单位管理]单位管理添加单位接口"
,
notes
=
"单位管理添加单位接口"
)
public
ResponseEntity
unitManagement
(
@RequestBody
UnitsAddVo
unitsAddVo
){
return
ResponseEntity
.
ok
(
unitsService
.
saveUnits
(
unitsAddVo
));
}
/**
* 查询添加单位中所有单位的下拉列表
*/
@GetMapping
(
"/belongsUnits/{unitId}"
)
@ApiOperation
(
value
=
"[单位管理]查询添加单位中所属单位的下拉列表去除自己"
,
notes
=
"查询添加单位中所属单位的下拉列表"
)
public
ResponseEntity
belongsUnits
(
@PathVariable
Integer
unitId
){
return
ResponseEntity
.
ok
(
unitsService
.
belongsUnits
(
unitId
));
}
/**
* 查询添加单位中所有单位的下拉列表
*/
@GetMapping
(
"/belongsUnits"
)
@ApiOperation
(
value
=
"[单位管理]查询添加单位中所属单位的下拉列表"
,
notes
=
"查询添加单位中所属单位的下拉列表"
)
public
ResponseEntity
belongsUnits2
(){
return
ResponseEntity
.
ok
(
unitsService
.
belongsUnits1
());
}
/**
* 单位管理修改单位接口
*/
@PostMapping
(
"/updateUnits"
)
@ApiOperation
(
value
=
"[单位管理]单位管理修改单位接口"
,
notes
=
"单位管理修改单位接口"
)
public
ResponseEntity
updateUnit
(
@RequestBody
Units
units
){
return
ResponseEntity
.
ok
(
unitsService
.
updateUnit
(
units
));
}
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/dao/AreaExhibitionDao.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
dao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaExhibitionDao.java
* @Description TODO
* @createTime 2021年11月09日 09:33:00
*/
public
interface
AreaExhibitionDao
extends
JpaRepository
<
AreaExhibition
,
Integer
>,
JpaSpecificationExecutor
<
AreaExhibition
>
{
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/dao/UnitStoreLocationDao.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
dao
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
public
interface
UnitStoreLocationDao
extends
JpaRepository
<
UnitStoreLocation
,
Integer
>,
JpaSpecificationExecutor
<
UnitStoreLocation
>
{
List
<
UnitStoreLocation
>
findAllByUnitIdAndTypeName
(
Integer
unitId
,
String
typeName
);
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/entity/Area.java
浏览文件 @
ffd8b1b1
...
@@ -39,7 +39,7 @@ public class Area {
...
@@ -39,7 +39,7 @@ public class Area {
private
String
name
;
private
String
name
;
/**
/**
* 等级 等级 0
国家级 1省级 2市级 3县级 4.直属单位
* 等级 等级 0
.国家级 1.省级 2.市级 3.县级 4.直属
*/
*/
private
Integer
type
;
private
Integer
type
;
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/entity/AreaExhibition.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
entity
;
import
com.tykj.dev.device.user.base.ret.LeftNavigation
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Transient
;
import
java.util.UUID
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaExhibition.java
* @Description TODO
* @createTime 2021年11月09日 09:12:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@ApiModel
(
value
=
"地区提供展示对象"
,
description
=
"地区提供展示信息"
)
public
class
AreaExhibition
extends
BaseEntity
{
/**
* 区域名称
*/
private
String
areaName
;
/**
* 区域描述
*/
@Column
(
name
=
"des"
,
columnDefinition
=
"TEXT"
)
private
String
des
;
/**
* 排序
*/
private
Integer
orders
;
/**
* 父类id
*/
private
Integer
fatherId
;
/**
* 父类名称
*/
@Transient
private
String
fatherName
;
public
LeftNavigation
toLeftNavigation
(){
return
new
LeftNavigation
(
this
.
getId
(),
areaName
,
null
,
UUID
.
randomUUID
().
toString
(),
1
,
Double
.
valueOf
(
orders
).
intValue
(),
null
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/entity/UnitStoreLocation.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
entity
;
import
com.tykj.dev.misc.base.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitStoreLocation.java
* @Description 存放位置信息
* @createTime 2021年11月08日 12:46:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@ApiModel
(
value
=
"单位对象"
,
description
=
"单位详细信息"
)
public
class
UnitStoreLocation
extends
BaseEntity
{
private
Integer
unitId
;
private
String
storeName
;
private
String
typeName
;
@Column
(
name
=
"des"
,
columnDefinition
=
"TEXT"
)
private
String
des
;
private
Integer
showOrder
;
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/entity/Units.java
浏览文件 @
ffd8b1b1
...
@@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
...
@@ -12,6 +12,7 @@ import lombok.NoArgsConstructor;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.hibernate.annotations.Where
;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -88,7 +89,7 @@ public class Units {
...
@@ -88,7 +89,7 @@ public class Units {
@ApiModelProperty
(
value
=
"排序"
,
name
=
"showOrder"
,
example
=
"12321L"
)
@ApiModelProperty
(
value
=
"排序"
,
name
=
"showOrder"
,
example
=
"12321L"
)
private
Integer
showOrder
;
private
Integer
showOrder
;
@ApiModelProperty
(
value
=
"区域名称"
,
name
=
"areaName"
,
example
=
"12321L"
)
@ApiModelProperty
(
value
=
"区域
展示
名称"
,
name
=
"areaName"
,
example
=
"12321L"
)
@Transient
@Transient
private
String
areaName
;
private
String
areaName
;
...
@@ -98,12 +99,20 @@ public class Units {
...
@@ -98,12 +99,20 @@ public class Units {
@ApiModelProperty
(
value
=
"是否代管"
)
@ApiModelProperty
(
value
=
"是否代管"
)
private
Integer
escrow
;
private
Integer
escrow
;
@ApiModelProperty
(
value
=
"展示区域id"
)
private
Integer
exhibitionId
;
@Transient
@ApiModelProperty
(
value
=
"上级单位ID"
)
private
Integer
parentUnitId
;
/**
/**
* 区域对象
* 区域对象
*/
*/
@Transient
@Transient
private
Area
area
;
private
Area
area
;
public
static
Units
toDb
()
{
public
static
Units
toDb
()
{
return
new
Units
(
return
new
Units
(
null
,
null
,
...
@@ -117,6 +126,8 @@ public class Units {
...
@@ -117,6 +126,8 @@ public class Units {
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
null
);
);
}
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/AreaExhibitionService.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
java.util.List
;
public
interface
AreaExhibitionService
extends
PublicService
<
AreaExhibition
>{
/**
* 区域使用
* @return 区域对象集合
*/
List
<
AreaExhibition
>
finaAllAreaExhibition
();
/**
* 根据id查询区域展示对象
*/
AreaExhibition
findById
(
Integer
areaExhibitionId
);
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/AreaService.java
浏览文件 @
ffd8b1b1
...
@@ -34,7 +34,13 @@ public interface AreaService extends PublicService<Area> {
...
@@ -34,7 +34,13 @@ public interface AreaService extends PublicService<Area> {
List
<
Integer
>
findIdQuerySubordinateIds
(
Integer
areaId
);
List
<
Integer
>
findIdQuerySubordinateIds
(
Integer
areaId
);
Area
findByIdTosuperiorArea
(
Integer
areaId
);
Area
findByIdTosuperiorArea
(
Integer
areaId
);
/**
* 区域管理使用
*/
List
<
Area
>
findAllArea
();
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/UnitStoreLocationService.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
;
import
com.tykj.dev.device.user.base.req.UnitStoreLocationVo
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitStoreLocationService.java
* @Description TODO
* @createTime 2021年11月08日 12:57:00
*/
public
interface
UnitStoreLocationService
extends
PublicService
<
UnitStoreLocation
>{
List
<
UnitStoreLocation
>
findAllByUnitIdAndTypeName
(
UnitStoreLocationVo
unitStoreLocationVo
);
Map
<
Integer
,
String
>
findByUnitIdToDeviceMap
(
Integer
unitId
);
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/UnitsService.java
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
;
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitsAddVo
;
import
com.tykj.dev.device.user.base.ret.*
;
import
com.tykj.dev.device.user.base.ret.*
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.Units
;
...
@@ -143,8 +144,8 @@ public interface UnitsService extends PublicService<Units> {
...
@@ -143,8 +144,8 @@ public interface UnitsService extends PublicService<Units> {
*/
*/
List
<
Units
>
findAllByIdIn
(
List
<
Integer
>
ids
);
List
<
Units
>
findAllByIdIn
(
List
<
Integer
>
ids
);
List
<
Units
>
finAllDirectlUnderUnits
();
List
<
Units
>
finAllDirectlUnderUnits
();
/**
/**
* 左边侧面导航栏接口
* 左边侧面导航栏接口
...
@@ -187,4 +188,32 @@ public interface UnitsService extends PublicService<Units> {
...
@@ -187,4 +188,32 @@ public interface UnitsService extends PublicService<Units> {
* @return 所有的单位id
* @return 所有的单位id
*/
*/
List
<
Integer
>
findByAreaId2
(
Integer
areaId
);
List
<
Integer
>
findByAreaId2
(
Integer
areaId
);
/**
* 单位管理使用 查询单位的接口
*/
List
<
Units
>
unitManagement
();
/**
* 新增单位接口
*/
List
<
Units
>
saveUnits
(
UnitsAddVo
unitsAddVo
);
/**
* 添加单位所有单位列表去掉自己
*/
List
<
Units
>
belongsUnits
(
Integer
unitId
);
/**
* 添加单位所有单位列表
*/
List
<
Units
>
belongsUnits1
();
/**
* 更新单位对象
*/
Units
updateUnit
(
Units
units
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/UserPublicService.java
浏览文件 @
ffd8b1b1
...
@@ -55,4 +55,15 @@ public interface UserPublicService {
...
@@ -55,4 +55,15 @@ public interface UserPublicService {
*/
*/
List
<
Integer
>
findAllUnitIdByAreaId
(
Integer
areaId
);
List
<
Integer
>
findAllUnitIdByAreaId
(
Integer
areaId
);
/*新的区域查询接口*/
List
<
Units
>
accordingExhibitionIdAllUnits
(
Integer
exhibitionId
);
/**
* 根据单位id查询当前单位下的全部子对象,以及对象下的子对象
* @return 单位集合
*/
List
<
Units
>
findByUnitIdSubordinateAll
(
Integer
unitId
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/AreaExhibitionServiceImpl.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
.
impl
;
import
com.tykj.dev.device.user.cache.AreaExhibitionCache
;
import
com.tykj.dev.device.user.subject.dao.AreaExhibitionDao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.AreaExhibitionService
;
import
com.tykj.dev.misc.exception.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaExhibitionServiceImpl.java
* @Description TODO
* @createTime 2021年11月09日 11:13:00
*/
@Service
public
class
AreaExhibitionServiceImpl
implements
AreaExhibitionService
{
@Autowired
AreaExhibitionDao
areaExhibitionDao
;
@Autowired
AreaExhibitionCache
areaExhibitionCache
;
@Override
public
List
<
AreaExhibition
>
finaAllAreaExhibition
()
{
List
<
AreaExhibition
>
areaExhibitions
=
areaExhibitionDao
.
findAll
().
stream
().
sorted
(
Comparator
.
comparing
(
AreaExhibition:
:
getOrders
)).
collect
(
Collectors
.
toList
());
areaExhibitions
.
forEach
(
areaExhibition
->
{
if
(
areaExhibition
.
getFatherId
()!=
null
)
{
AreaExhibition
areaExhibition1
=
areaExhibitionCache
.
findById
(
areaExhibition
.
getFatherId
());
areaExhibition
.
setFatherName
(
areaExhibition1
.
getAreaName
());
}
}
);
return
areaExhibitions
;
}
@Override
public
AreaExhibition
findById
(
Integer
areaExhibitionId
){
Optional
<
AreaExhibition
>
optionalAreaExhibition
=
areaExhibitionDao
.
findById
(
areaExhibitionId
);
if
(
optionalAreaExhibition
.
isPresent
()){
return
optionalAreaExhibition
.
get
();
}
else
{
throw
new
ApiException
(
"[区域展示] 根据id查询对象没找到:"
+
areaExhibitionId
);
}
}
@Override
public
AreaExhibition
save
(
AreaExhibition
areaExhibition
)
{
if
(
areaExhibition
.
getId
()==
null
){
areaExhibition
.
setOrders
(
areaExhibitionCache
.
findAll
().
size
()+
1
);
}
else
{
AreaExhibition
oldAreaExhibition
=
areaExhibitionCache
.
findById
(
areaExhibition
.
getId
());
int
count
=
areaExhibitionCache
.
findAll
().
size
();
if
(!
oldAreaExhibition
.
getOrders
().
equals
(
areaExhibition
.
getOrders
())){
if
(
count
<
areaExhibition
.
getOrders
()){
areaExhibition
.
setOrders
(
count
+
1
);
}
else
{
sortingAreaExhibition
(
areaExhibition
.
getOrders
(),
oldAreaExhibition
.
getOrders
());
}
}
}
AreaExhibition
areaExhibition1
=
areaExhibitionDao
.
save
(
areaExhibition
);
areaExhibitionCache
.
refresh
(
areaExhibitionDao
.
findAll
());
return
areaExhibition1
;
}
private
void
sortingAreaExhibition
(
Integer
originalOrder
,
Integer
newOrder
){
List
<
AreaExhibition
>
areaExhibitions
;
if
(
originalOrder
>
newOrder
){
areaExhibitions
=
areaExhibitionCache
.
findListGeNewAndLtOriginal
(
newOrder
,
originalOrder
);
areaExhibitions
.
forEach
(
areaExhibition
->
areaExhibition
.
setOrders
(
areaExhibition
.
getOrders
()+
1
)
);
}
else
{
areaExhibitions
=
areaExhibitionCache
.
findListLgOriginalAndLeNew
(
newOrder
,
originalOrder
);
areaExhibitions
.
forEach
(
areaExhibition
->
areaExhibition
.
setOrders
(
areaExhibition
.
getOrders
()-
1
)
);
}
areaExhibitionCache
.
refresh
(
areaExhibitionDao
.
saveAll
(
areaExhibitions
));
}
@Override
public
boolean
delete
(
Integer
id
)
{
return
false
;
}
@Override
public
List
<
AreaExhibition
>
findAll
()
{
return
areaExhibitionDao
.
findAll
();
}
@Override
public
AreaExhibition
update
(
AreaExhibition
areaExhibition
)
{
AreaExhibition
areaExhibition1
=
areaExhibitionDao
.
save
(
areaExhibition
);
areaExhibitionCache
.
refresh
(
areaExhibitionDao
.
findAll
());
return
areaExhibition1
;
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/AreaServiceImpl.java
浏览文件 @
ffd8b1b1
...
@@ -21,8 +21,10 @@ import org.springframework.http.ResponseEntity;
...
@@ -21,8 +21,10 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
/**
* @author zjm
* @author zjm
...
@@ -136,9 +138,23 @@ public class AreaServiceImpl implements AreaService {
...
@@ -136,9 +138,23 @@ public class AreaServiceImpl implements AreaService {
return
area
;
return
area
;
}
}
@Override
public
List
<
Area
>
findAllArea
()
{
//过滤掉直属的以及区域的
List
<
Area
>
areaList
=
areaDao
.
findAll
().
stream
().
filter
(
area
->
area
.
getType
()
<
3
).
collect
(
Collectors
.
toList
());
areaList
.
forEach
(
area
->{
if
(
area
.
getFatherId
()!=
null
)
{
area
.
setFatherName
(
areaCache
.
findById
(
area
.
getFatherId
()).
getName
());
}
}
);
areaList
=
areaList
.
stream
().
sorted
(
Comparator
.
comparing
(
Area:
:
getOrders
)).
collect
(
Collectors
.
toList
());
return
areaList
;
}
private
List
<
Integer
>
areaId
(
List
<
Integer
>
ids
,
Integer
areaId
){
private
List
<
Integer
>
areaId
(
List
<
Integer
>
ids
,
Integer
areaId
){
List
<
Area
>
areas
=
area
Dao
.
findAllByFatherId
(
areaId
);
List
<
Area
>
areas
=
area
Cache
.
findAllByFatherId
(
areaId
);
ids
.
add
(
areaId
);
ids
.
add
(
areaId
);
if
(
areas
!=
null
&&
areas
.
size
()!=
0
){
if
(
areas
!=
null
&&
areas
.
size
()!=
0
){
areas
.
forEach
(
areas
.
forEach
(
...
@@ -166,29 +182,6 @@ public class AreaServiceImpl implements AreaService {
...
@@ -166,29 +182,6 @@ public class AreaServiceImpl implements AreaService {
return
units
;
return
units
;
}
}
// private List<AreaInstitutions> subordinateArea(List<AreaInstitutions> areaInstitutions ,Area area){
// List<Area> list= areaDao.findAllByFatherId(area.getId());
// if (list==null || list.size()==0){
// areaInstitutions.add(new AreaInstitutions(area.getId(), area.getName(), areaInstitutions, unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toVo).collect(Collectors.toList())));
// return areaInstitutions;
// }
// if (area.getType() < 2) {
// areaInstitutions.add(new AreaInstitutions(area.getId(), area.getName(), areaInstitutions, unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toVo).collect(Collectors.toList())));
// }
//
// list.forEach(
// area1 -> {
// List<AreaInstitutions> areaInstitutions1=new ArrayList<>();
// subordinateArea(areaInstitutions1,area1);
// if (area.getType()==2) {
// areaInstitutions1.add(new AreaInstitutions(area.getId(), area.getName(), areaInstitutions, unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toVo).collect(Collectors.toList())));
// }
// areaInstitutions.add(new AreaInstitutions(area1.getId(),area1.getName(),areaInstitutions1,unitsDao.findAllByAreaId(area1.getId()).stream().map(Units::toVo).collect(Collectors.toList())));
// }
// );
// return areaInstitutions;
// }
@Override
@Override
public
Area
save
(
Area
area
)
{
public
Area
save
(
Area
area
)
{
Optional
<
Area
>
optionalArea
=
areaDao
.
findById
(
area
.
getFatherId
());
Optional
<
Area
>
optionalArea
=
areaDao
.
findById
(
area
.
getFatherId
());
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UnitStoreLocationServiceImpl.java
0 → 100644
浏览文件 @
ffd8b1b1
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
.
impl
;
import
com.tykj.dev.device.user.base.req.UnitStoreLocationVo
;
import
com.tykj.dev.device.user.subject.dao.UnitStoreLocationDao
;
import
com.tykj.dev.device.user.subject.entity.UnitStoreLocation
;
import
com.tykj.dev.device.user.subject.service.UnitStoreLocationService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitStoreLocationServiceImpl.java
* @Description TODO
* @createTime 2021年11月08日 13:02:00
*/
@Service
public
class
UnitStoreLocationServiceImpl
implements
UnitStoreLocationService
{
@Autowired
UnitStoreLocationDao
unitStoreLocationDao
;
@Override
public
List
<
UnitStoreLocation
>
findAllByUnitIdAndTypeName
(
UnitStoreLocationVo
unitStoreLocationVo
)
{
return
unitStoreLocationDao
.
findAllByUnitIdAndTypeName
(
unitStoreLocationVo
.
getUnitId
(),
unitStoreLocationVo
.
getTypeName
());
}
@Override
public
Map
<
Integer
,
String
>
findByUnitIdToDeviceMap
(
Integer
unitId
)
{
return
unitStoreLocationDao
.
findAllByUnitIdAndTypeName
(
unitId
,
"存放位置"
)
.
stream
()
.
sorted
(
Comparator
.
comparing
(
UnitStoreLocation:
:
getShowOrder
))
.
collect
(
Collectors
.
toMap
(
UnitStoreLocation:
:
getId
,
UnitStoreLocation:
:
getStoreName
));
}
@Override
public
UnitStoreLocation
save
(
UnitStoreLocation
unitStoreLocation
)
{
return
unitStoreLocationDao
.
save
(
unitStoreLocation
);
}
@Override
public
boolean
delete
(
Integer
id
)
{
return
false
;
}
@Override
public
List
<
UnitStoreLocation
>
findAll
()
{
return
unitStoreLocationDao
.
findAll
().
stream
().
sorted
(
Comparator
.
comparing
(
UnitStoreLocation:
:
getShowOrder
))
.
collect
(
Collectors
.
toList
());
}
@Override
public
UnitStoreLocation
update
(
UnitStoreLocation
unitStoreLocation
)
{
return
unitStoreLocationDao
.
save
(
unitStoreLocation
);
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UnitsServiceImpl.java
浏览文件 @
ffd8b1b1
...
@@ -2,13 +2,18 @@ package com.tykj.dev.device.user.subject.service.impl;
...
@@ -2,13 +2,18 @@ package com.tykj.dev.device.user.subject.service.impl;
import
com.tykj.dev.config.service.SystemConfigService
;
import
com.tykj.dev.config.service.SystemConfigService
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitNameVo
;
import
com.tykj.dev.device.user.base.req.UnitsAddVo
;
import
com.tykj.dev.device.user.base.ret.*
;
import
com.tykj.dev.device.user.base.ret.*
;
import
com.tykj.dev.device.user.cache.AreaCache
;
import
com.tykj.dev.device.user.cache.AreaExhibitionCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.AreaExhibitionService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.DeviceModelSort
;
import
com.tykj.dev.misc.utils.DeviceModelSort
;
...
@@ -41,9 +46,18 @@ public class UnitsServiceImpl implements UnitsService {
...
@@ -41,9 +46,18 @@ public class UnitsServiceImpl implements UnitsService {
@Autowired
@Autowired
UnitsCache
unitsCache
;
UnitsCache
unitsCache
;
@Autowired
AreaCache
areaCache
;
@Autowired
AreaExhibitionCache
areaExhibitionCache
;
@Autowired
@Autowired
SystemConfigService
systemConfigService
;
SystemConfigService
systemConfigService
;
@Autowired
AreaExhibitionService
areaExhibitionService
;
@Override
@Override
public
Units
findById
(
Integer
unitId
)
{
public
Units
findById
(
Integer
unitId
)
{
Optional
<
Units
>
unit
=
unitsDao
.
findById
(
unitId
);
Optional
<
Units
>
unit
=
unitsDao
.
findById
(
unitId
);
...
@@ -283,29 +297,27 @@ public class UnitsServiceImpl implements UnitsService {
...
@@ -283,29 +297,27 @@ public class UnitsServiceImpl implements UnitsService {
public
LeftNavigation
findLeftNavigation
(
SecurityUser
securityUser
)
{
public
LeftNavigation
findLeftNavigation
(
SecurityUser
securityUser
)
{
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
LeftNavigation
leftNavigation
=
new
LeftNavigation
();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
List
<
LeftNavigation
>
leftNavigationList
=
new
ArrayList
<>();
Integer
areaId
=
securityUser
.
getCurrentUserInfo
().
getUnits
().
getAreaId
();
Units
units
=
securityUser
.
getCurrentUserInfo
().
getUnits
();
Area
belongsArea
=
areaDao
.
findById
(
areaId
).
get
();
if
(
units
.
getLevel
()==
1
||
units
.
getLevel
()==
2
){
if
(
belongsArea
.
getType
()
==
1
||
belongsArea
.
getType
()
==
2
)
{
AreaExhibition
areaExhibition
=
areaExhibitionCache
.
findById
(
units
.
getExhibitionId
());
leftNavigation
=
belongsArea
.
toLeftNavigation
();
AreaExhibition
areaExhibitionParent
=
areaExhibitionCache
.
findById
(
areaExhibition
.
getFatherId
());
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
leftNavigation
=
areaExhibitionParent
.
toLeftNavigation
();
}
//根据上级展示区域id查询所有的下级区域展示对象
if
(
belongsArea
.
getType
()
==
1
)
{
List
<
AreaExhibition
>
areaExhibitions
=
areaExhibitionCache
.
findByFatherId
(
areaExhibitionParent
.
getId
());
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
for
(
AreaExhibition
areaEx:
areaExhibitions
){
// leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
//生成以及新的展示区域 LeftNavigation type =1
List
<
LeftNavigation
>
leftNavigationList2
=
unitsDao
.
findAllByType
(
2
).
stream
().
filter
(
units1
->
!
units1
.
getName
().
equals
(
"省应急小组"
)
&&
!
units1
.
getName
().
equals
(
"省机科技管理处"
)
&&
!
units1
.
getName
().
equals
(
"省机通信报务处"
)
&&
units1
.
getEscrow
()
==
1
).
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
LeftNavigation
leftNavigation1
=
areaEx
.
toLeftNavigation
();
LeftNavigation
leftNavigation2
=
new
LeftNavigation
(
0
,
"省直属"
,
leftNavigationList2
,
UUID
.
randomUUID
().
toString
(),
1
,
22
,
null
);
//根据区域展示ID查询相关的单位且转成单位LeftNavigation type =2
leftNavigationList
.
add
(
leftNavigation2
);
List
<
LeftNavigation
>
leftNavigationList1
=
unitsCache
.
findAllByAreaExhibitionId
(
areaEx
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
}
leftNavigation1
.
setLeftNavigations
(
leftNavigationList1
);
List
<
Area
>
areas
=
areaDao
.
findAllByFatherId
(
areaId
).
stream
().
filter
(
area
->
area
.
getType
()
<=
3
).
collect
(
Collectors
.
toList
());
//最大的一级LeftNavigation 进行附值
if
(
areas
.
size
()
!=
0
)
{
leftNavigationList
.
add
(
leftNavigation1
);
provinceAndCity
(
belongsArea
,
areas
,
leftNavigationList
);
leftNavigation
.
setLeftNavigations
(
leftNavigationList
);
}
else
{
}
leftNavigation
=
belongsArea
.
toLeftNavigation
();
}
else
{
leftNavigationList
=
unitsDao
.
findAllByAreaId
(
belongsArea
.
getId
()).
stream
().
map
(
Units:
:
toLeftNavigation
).
collect
(
Collectors
.
toList
());
leftNavigation
=
units
.
toLeftNavigation
();
leftNavigation
.
setLeftNavigations
(
leftNavigationList
);
}
}
leftNavigation
.
setLeftNavigations
(
leftNavigationList
.
stream
().
sorted
(
Comparator
.
comparing
(
LeftNavigation:
:
getOrder
,
Comparator
.
nullsLast
(
Integer:
:
compareTo
))).
collect
(
Collectors
.
toList
()));
return
leftNavigation
;
return
leftNavigation
;
}
}
...
@@ -454,6 +466,163 @@ public class UnitsServiceImpl implements UnitsService {
...
@@ -454,6 +466,163 @@ public class UnitsServiceImpl implements UnitsService {
return
unitsDao
.
findByAreaId
(
areaId
).
stream
().
map
(
Units:
:
getUnitId
).
distinct
().
collect
(
Collectors
.
toList
());
return
unitsDao
.
findByAreaId
(
areaId
).
stream
().
map
(
Units:
:
getUnitId
).
distinct
().
collect
(
Collectors
.
toList
());
}
}
@Override
public
List
<
Units
>
unitManagement
()
{
List
<
Units
>
unitsList
=
unitsDao
.
findAll
();
unitsList
.
forEach
(
units
->
{
AreaExhibition
areaExhibition
=
areaExhibitionService
.
findById
(
units
.
getExhibitionId
());
units
.
setAreaName
(
areaExhibition
.
getAreaName
());
//查询当前单位的逻辑区域
Units
units1
=
findByParentUnit
(
units
);
if
(
units1
!=
null
){
units
.
setParentUnitId
(
units1
.
getUnitId
());
}
}
);
unitsList
=
unitsList
.
stream
().
sorted
(
Comparator
.
comparing
(
Units:
:
getShowOrder
)).
collect
(
Collectors
.
toList
());
return
unitsList
;
}
@Override
public
List
<
Units
>
saveUnits
(
UnitsAddVo
unitsAddVo
)
{
Units
units
=
unitsAddVo
.
toUnits
();
//查询上级设备的单位
Units
parentUnits
=
unitsCache
.
findById
(
unitsAddVo
.
getParentUnitId
());
//查询上级的设备的区域a
Area
ParentArea
=
areaCache
.
findById
(
parentUnits
.
getAreaId
());
//创建一个区域b 上级id为a
Area
area
=
new
Area
();
area
.
setFatherId
(
ParentArea
.
getId
());
area
.
setOrders
(
"999"
);
area
.
setName
(
unitsAddVo
.
getName
());
area
.
setType
(
levelToAreaType
(
unitsAddVo
.
getLevel
()));
area
=
areaDao
.
save
(
area
);
//创建单位ub 区域id绑定为b
units
.
setAreaId
(
area
.
getId
());
units
.
setType
(
levelToType
(
unitsAddVo
.
getLevel
()));
units
.
setShowOrder
(
unitsCache
.
findAll
().
size
()+
1
);
unitsDao
.
save
(
units
);
unitsCache
.
refresh
(
unitsDao
.
findAll
());
areaCache
.
refresh
(
areaDao
.
findAll
());
return
unitsCache
.
findAll
();
}
@Override
public
List
<
Units
>
belongsUnits
(
Integer
unitId
)
{
return
unitsDao
.
findAll
().
stream
().
filter
(
units
->
(
units
.
getLevel
()==
1
||
units
.
getLevel
()==
2
)&&
!
units
.
getUnitId
().
equals
(
unitId
)).
sorted
(
Comparator
.
comparing
(
Units:
:
getShowOrder
)).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
Units
>
belongsUnits1
()
{
return
unitsDao
.
findAll
().
stream
().
filter
(
units
->
(
units
.
getLevel
()==
1
||
units
.
getLevel
()==
2
)).
sorted
(
Comparator
.
comparing
(
Units:
:
getShowOrder
)).
collect
(
Collectors
.
toList
());
}
private
Units
findByParentUnit
(
Units
units
){
Area
area
=
areaCache
.
findById
(
units
.
getAreaId
());
if
(
area
.
getFatherId
()!=
null
){
Area
area1
=
areaCache
.
findById
(
area
.
getFatherId
());
return
unitsCache
.
findByAreaId
(
area1
.
getId
());
}
else
{
return
null
;
}
}
@Override
public
Units
updateUnit
(
Units
units
)
{
Units
unitsOld
=
unitsCache
.
findById
(
units
.
getUnitId
());
if
(!
units
.
getLevel
().
equals
(
unitsOld
.
getLevel
())){
units
.
setType
(
levelToType
(
units
.
getLevel
()));
}
Units
parentUnitOld
=
findByParentUnit
(
units
);
if
(
units
.
getParentUnitId
()!=
null
){
if
(
parentUnitOld
==
null
||!
parentUnitOld
.
getUnitId
().
equals
(
units
.
getParentUnitId
())){
//查询需要修改的上级id
Units
parentUnitNow
=
unitsCache
.
findById
(
units
.
getParentUnitId
());
Area
newArea
=
areaCache
.
findById
(
parentUnitNow
.
getAreaId
());
Area
oldArea
=
areaCache
.
findById
(
unitsOld
.
getAreaId
());
oldArea
.
setFatherId
(
newArea
.
getId
());
areaDao
.
save
(
oldArea
);
}
}
else
{
if
(
parentUnitOld
!=
null
){
Area
oldArea
=
areaCache
.
findById
(
unitsOld
.
getAreaId
());
oldArea
.
setFatherId
(
null
);
areaDao
.
save
(
oldArea
);
}
}
if
(!
unitsOld
.
getShowOrder
().
equals
(
units
.
getShowOrder
())){
int
count
=
unitsCache
.
findAll
().
size
();
if
(
units
.
getShowOrder
()>
count
){
units
.
setShowOrder
(
count
+
1
);
}
else
{
sortingUnit
(
unitsOld
.
getShowOrder
(),
units
.
getShowOrder
());
}
}
unitsDao
.
save
(
units
);
unitsCache
.
refresh
(
unitsDao
.
findAll
());
areaCache
.
refresh
(
areaDao
.
findAll
());
return
units
;
}
private
void
sortingUnit
(
Integer
originalOrder
,
Integer
newOrder
){
List
<
Units
>
unitsList
;
if
(
originalOrder
>
newOrder
){
unitsList
=
unitsCache
.
findListGeNewAndLtOriginal
(
newOrder
,
originalOrder
);
unitsList
.
forEach
(
units
->
units
.
setShowOrder
(
units
.
getShowOrder
()+
1
)
);
}
else
{
unitsList
=
unitsCache
.
findListLgOriginalAndLeNew
(
newOrder
,
originalOrder
);
unitsList
.
forEach
(
units
->
units
.
setShowOrder
(
units
.
getShowOrder
()-
1
)
);
}
unitsCache
.
refresh
(
unitsDao
.
saveAll
(
unitsList
));
}
/**
* 工具类
* @return 单位类型
*/
private
Integer
levelToType
(
Integer
level
){
switch
(
level
){
case
0
:
return
3
;
case
1
:
return
2
;
case
2
:
return
1
;
case
3
:
return
1
;
case
4
:
return
2
;
default
:
return
null
;
}
}
/**
* 工具类
* @return 单位类型
*/
private
Integer
levelToAreaType
(
Integer
level
){
switch
(
level
){
case
0
:
return
0
;
case
1
:
return
4
;
case
2
:
return
2
;
case
3
:
return
3
;
case
4
:
return
4
;
default
:
return
null
;
}
}
@Override
@Override
public
Units
save
(
Units
units
)
{
public
Units
save
(
Units
units
)
{
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UserPublicServiceImpl.java
浏览文件 @
ffd8b1b1
...
@@ -46,6 +46,9 @@ public class UserPublicServiceImpl implements UserPublicService {
...
@@ -46,6 +46,9 @@ public class UserPublicServiceImpl implements UserPublicService {
@Autowired
@Autowired
UnitsCache
unitsCache
;
UnitsCache
unitsCache
;
// @Autowired
// AreaExhibitionServiceImpl
@Autowired
@Autowired
UnitsService
unitsService
;
UnitsService
unitsService
;
...
@@ -130,6 +133,22 @@ public class UserPublicServiceImpl implements UserPublicService {
...
@@ -130,6 +133,22 @@ public class UserPublicServiceImpl implements UserPublicService {
}
}
@Override
public
List
<
Units
>
accordingExhibitionIdAllUnits
(
Integer
exhibitionId
)
{
return
null
;
}
@Override
public
List
<
Units
>
findByUnitIdSubordinateAll
(
Integer
unitId
)
{
Units
units
=
unitsCache
.
findById
(
unitId
);
List
<
Integer
>
areaIds
=
areaService
.
findIdQuerySubordinateIds
(
units
.
getAreaId
());
return
unitsCache
.
findByAllAreaIds
(
areaIds
);
}
@Override
@Override
public
String
findUnitsNameByUserId
(
Integer
userId
)
{
public
String
findUnitsNameByUserId
(
Integer
userId
)
{
User
resultEntity
=
userCache
.
findById
(
userId
);
User
resultEntity
=
userCache
.
findById
(
userId
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论