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 个修改的文件
包含
1016 行增加
和
39 行删除
+1016
-39
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
+0
-0
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 {
}
@GetMapping
(
"/getFileList"
)
@ApiOperation
(
"通过任务id查询账单中文件"
)
public
ResponseEntity
getFileList
(
Integer
taskId
){
return
ResponseEntity
.
ok
(
allotBillService
.
getFileList
(
taskId
));
}
...
...
@@ -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;
import
com.tykj.dev.config.cache.ConfigCache
;
import
com.tykj.dev.config.repository.SystemConfigDao
;
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.UserCache
;
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.UserDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -33,6 +35,9 @@ public class CacheBeanConfig {
@Autowired
private
SystemConfigDao
systemConfigDao
;
@Autowired
AreaExhibitionDao
areaExhibitionDao
;
@Bean
public
AreaCache
initAreaCache
()
{
return
new
AreaCache
(
areaRepo
.
findAll
());
...
...
@@ -43,6 +48,10 @@ public class CacheBeanConfig {
return
new
UserCache
(
userDao
.
findAll
());
}
@Bean
public
AreaExhibitionCache
initAreaExhibitionCache
()
{
return
new
AreaExhibitionCache
(
areaExhibitionDao
.
findAll
());
}
@Bean
public
UnitsCache
initUnitCache
()
{
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 {
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
(){
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>,
@Query
(
"update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds"
)
int
updateStorageLocation
(
@Param
(
"storageLocation"
)
String
storageLocation
,
@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 {
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 {
});
}
@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
// @UpdateCache
// 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;
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.DeviceVo
;
import
com.tykj.dev.device.library.subject.vo.WorkUseVo
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -277,6 +278,10 @@ public class DeviceLibrary implements Serializable {
@Transient
private
Integer
orderNumber
;
@ApiModelProperty
(
value
=
"是否在库"
,
notes
=
"0 在库 1不在库"
)
@Transient
private
Integer
isInLibrary
;
public
void
addChildNode
(
DeviceLibrary
deviceLibraryEntity
)
{
childs
.
add
(
deviceLibraryEntity
);
}
...
...
@@ -292,6 +297,13 @@ public class DeviceLibrary implements Serializable {
return
mapper
.
map
(
this
,
DeviceVo
.
class
);
}
// public WorkUseVo toWorkUse(){
// setConfigName();
// //modelMap复制
// ModelMapper mapper = BeanHelper.getUserMapper();
// return mapper.map(this, WorkUseVo.class);
// }
public
DeviceExcelVo
toDeviceExcelVo
(){
setConfigName
();
//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.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.username
=
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
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.AreaExhibition
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
...
...
@@ -21,6 +23,7 @@ public class AreaCache {
private
Map
<
Integer
,
Area
>
idMap
;
public
AreaCache
(
List
<
Area
>
areaList
)
{
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
idMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getId
,
Function
.
identity
()));
...
...
@@ -30,6 +33,10 @@ public class AreaCache {
Area
area
=
nameMap
.
get
(
name
);
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
)
{
return
nameMap
.
get
(
name
)
==
null
?
new
Area
(
0
,
"省直属"
,
9999
,
"9999"
,
0
,
""
)
:
nameMap
.
get
(
name
);
...
...
@@ -38,6 +45,11 @@ public class AreaCache {
public
Area
findById
(
Integer
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
)
{
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 {
private
Map
<
Integer
,
Units
>
idMap
;
private
Map
<
Integer
,
Units
>
areaIdMpa
;
public
UnitsCache
(
List
<
Units
>
unitsList
){
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
()
{
return
idMap
;
}
public
Units
findByAreaId
(
Integer
areaId
){
return
areaIdMpa
.
get
(
areaId
);
}
public
Units
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
}
...
...
@@ -30,8 +38,43 @@ public class UnitsCache {
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
){
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
this
.
areaIdMpa
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getAreaId
,
Function
.
identity
()));
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 {
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;
import
com.tykj.dev.config.swagger.AutoDocument
;
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.Units
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
...
...
@@ -25,7 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@RestController
@AutoDocument
@Api
(
tags
=
"
用户
模块"
,
description
=
"提供用户相关的接口"
)
@Api
(
tags
=
"
单位
模块"
,
description
=
"提供用户相关的接口"
)
@RequestMapping
(
"/units"
)
@Slf4j
public
class
UnitsController
{
...
...
@@ -62,13 +63,13 @@ public class UnitsController {
@GetMapping
(
value
=
"/areaDevice"
)
@ApiOperation
(
value
=
"查询装备库区域单位列表"
,
notes
=
"查询装备库区域单位列表"
)
public
ResponseEntity
selectOrganizationUnits1
(
@ApiIgnore
@AuthenticationPrincipal
SecurityUser
securityUser
)
{
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
1
(
securityUser
));
return
ResponseEntity
.
ok
(
unitsService
.
findLeftNavigation
(
securityUser
));
}
@GetMapping
(
value
=
"/areaDirectlyUnder"
)
@ApiOperation
(
value
=
"查询直属代管单位列表"
,
notes
=
"查询直属代管单位列表"
)
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}"
)
...
...
@@ -134,8 +135,6 @@ public class UnitsController {
return
ResponseEntity
.
ok
(
unitsService
.
findbyName
(
unitNameVo
.
getUnitName
()));
}
@GetMapping
(
"/countries/units"
)
@ApiOperation
(
value
=
"省入库发件单位下拉接口"
,
notes
=
"省入库发件单位下拉接口"
)
public
ResponseEntity
findSuperiorUnitsList
(){
...
...
@@ -154,5 +153,49 @@ public class UnitsController {
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 {
private
String
name
;
/**
* 等级 等级 0
国家级 1省级 2市级 3县级 4.直属单位
* 等级 等级 0
.国家级 1.省级 2.市级 3.县级 4.直属
*/
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;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.persistence.*
;
import
java.util.UUID
;
...
...
@@ -88,7 +89,7 @@ public class Units {
@ApiModelProperty
(
value
=
"排序"
,
name
=
"showOrder"
,
example
=
"12321L"
)
private
Integer
showOrder
;
@ApiModelProperty
(
value
=
"区域名称"
,
name
=
"areaName"
,
example
=
"12321L"
)
@ApiModelProperty
(
value
=
"区域
展示
名称"
,
name
=
"areaName"
,
example
=
"12321L"
)
@Transient
private
String
areaName
;
...
...
@@ -98,12 +99,20 @@ public class Units {
@ApiModelProperty
(
value
=
"是否代管"
)
private
Integer
escrow
;
@ApiModelProperty
(
value
=
"展示区域id"
)
private
Integer
exhibitionId
;
@Transient
@ApiModelProperty
(
value
=
"上级单位ID"
)
private
Integer
parentUnitId
;
/**
* 区域对象
*/
@Transient
private
Area
area
;
public
static
Units
toDb
()
{
return
new
Units
(
null
,
...
...
@@ -117,6 +126,8 @@ public class Units {
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> {
List
<
Integer
>
findIdQuerySubordinateIds
(
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
;
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.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.Units
;
...
...
@@ -143,8 +144,8 @@ public interface UnitsService extends PublicService<Units> {
*/
List
<
Units
>
findAllByIdIn
(
List
<
Integer
>
ids
);
List
<
Units
>
finAllDirectlUnderUnits
();
List
<
Units
>
finAllDirectlUnderUnits
();
/**
* 左边侧面导航栏接口
...
...
@@ -187,4 +188,32 @@ public interface UnitsService extends PublicService<Units> {
* @return 所有的单位id
*/
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 {
*/
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;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
* @author zjm
...
...
@@ -136,9 +138,23 @@ public class AreaServiceImpl implements AreaService {
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
){
List
<
Area
>
areas
=
area
Dao
.
findAllByFatherId
(
areaId
);
List
<
Area
>
areas
=
area
Cache
.
findAllByFatherId
(
areaId
);
ids
.
add
(
areaId
);
if
(
areas
!=
null
&&
areas
.
size
()!=
0
){
areas
.
forEach
(
...
...
@@ -166,29 +182,6 @@ public class AreaServiceImpl implements AreaService {
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
public
Area
save
(
Area
area
)
{
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
差异被折叠。
点击展开。
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 {
@Autowired
UnitsCache
unitsCache
;
// @Autowired
// AreaExhibitionServiceImpl
@Autowired
UnitsService
unitsService
;
...
...
@@ -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
public
String
findUnitsNameByUserId
(
Integer
userId
)
{
User
resultEntity
=
userCache
.
findById
(
userId
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论