Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_platformV2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_platformV2
Commits
6b28da93
Commit
6b28da93
authored
Dec 05, 2023
by
李小惠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.sothing.top/843502640/jyzb_platformV2
into develop-lxh
parents
a27fc08b
a7f34569
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
141 行增加
和
133 行删除
+141
-133
Cabinet.java
jyzb-biz/src/main/java/com/junmp/jyzb/entity/Cabinet.java
+14
-16
CabinetBoxServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetBoxServiceImpl.java
+85
-83
CabinetServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetServiceImpl.java
+25
-23
PolicemanServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
+2
-1
CabinetMapper.xml
jyzb-biz/src/main/resources/mapper/CabinetMapper.xml
+15
-10
没有找到文件。
jyzb-biz/src/main/java/com/junmp/jyzb/entity/Cabinet.java
View file @
6b28da93
...
@@ -17,20 +17,14 @@ import lombok.NoArgsConstructor;
...
@@ -17,20 +17,14 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
@TableName
(
"base_cabinet"
)
@TableName
(
"base_cabinet"
)
public
class
Cabinet
implements
Serializable
{
public
class
Cabinet
implements
Serializable
{
/**
/**
* 单警柜ID
* 单警柜ID
*/
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
ASSIGN_UUID
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
ASSIGN_UUID
)
@ApiModelProperty
(
value
=
"单警柜ID"
)
private
String
id
;
private
String
id
;
/**
* 单警柜编号
*/
@ApiModelProperty
(
value
=
"单警柜编号"
)
@TableField
(
"cabinet_num"
)
private
String
cabinetNum
;
/**
/**
* 单警柜名称
* 单警柜名称
*/
*/
...
@@ -44,7 +38,11 @@ public class Cabinet implements Serializable {
...
@@ -44,7 +38,11 @@ public class Cabinet implements Serializable {
@TableField
(
"org_id_int"
)
@TableField
(
"org_id_int"
)
private
Long
orgIdInt
;
private
Long
orgIdInt
;
/**
* 单警柜编号
*/
@TableField
(
"cabinet_num"
)
private
String
cabinetNum
;
/**
/**
* 部门id
* 部门id
*/
*/
...
@@ -129,14 +127,13 @@ public class Cabinet implements Serializable {
...
@@ -129,14 +127,13 @@ public class Cabinet implements Serializable {
*/
*/
@ApiModelProperty
(
value
=
"箱数"
)
@ApiModelProperty
(
value
=
"箱数"
)
private
Integer
num
;
private
Integer
num
;
private
String
policeName
;
private
String
policeName
;
private
String
policeId
;
private
Long
policeId
;
private
Integer
number
;
private
Integer
number
;
private
String
orgName
;
private
String
boxId
;
private
String
containType
;
private
String
boxState
;
private
String
equipmentConfig
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetBoxServiceImpl.java
View file @
6b28da93
...
@@ -46,95 +46,97 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
...
@@ -46,95 +46,97 @@ public class CabinetBoxServiceImpl extends ServiceImpl<CabinetBoxMapper, Cabinet
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
AddOrUpdateBoxInfo
(
UpdateCabinetReq
req
)
{
public
String
AddOrUpdateBoxInfo
(
UpdateCabinetReq
req
)
{
Cabinet
cabinet
=
cabinetService
.
getOne
(
new
LambdaQueryWrapper
<
Cabinet
>()
// Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.
eq
(
Cabinet:
:
getCabinetNum
,
req
.
getSerialNum
()));
// .eq(Cabinet::getCabinetNum, req.getSerialNum()));
if
(
ObjectUtil
.
isNull
(
cabinet
))
{
// if (ObjectUtil.isNull(cabinet)) {
throw
new
ServiceException
(
CabinetExceptionEnum
.
CABINET_ISNOT_EXISTS
);
// throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
// }
//
List
<
UpdateCabinetBoxReq
>
addList
=
req
.
getCabinetBoxList
();
// List<UpdateCabinetBoxReq> addList = req.getCabinetBoxList();
List
<
CabinetBox
>
existingBoxes
=
list
(
new
LambdaQueryWrapper
<
CabinetBox
>()
// List<CabinetBox> existingBoxes = list(new LambdaQueryWrapper<CabinetBox>()
.
eq
(
CabinetBox:
:
getCabinetId
,
cabinet
.
getId
()));
// .eq(CabinetBox::getCabinetId, cabinet.getId()));
//
Map
<
Integer
,
CabinetBox
>
existingBoxMap
=
existingBoxes
.
stream
()
// Map<Integer, CabinetBox> existingBoxMap = existingBoxes.stream()
.
collect
(
Collectors
.
toMap
(
CabinetBox:
:
getNum
,
Function
.
identity
()));
// .collect(Collectors.toMap(CabinetBox::getNum, Function.identity()));
//
List
<
CabinetBox
>
boxListAdd
=
new
ArrayList
<>();
// List<CabinetBox> boxListAdd = new ArrayList<>();
//
for
(
UpdateCabinetBoxReq
boxReq
:
addList
)
{
// for (UpdateCabinetBoxReq boxReq : addList) {
CabinetBox
box
=
new
CabinetBox
();
// CabinetBox box = new CabinetBox();
box
.
setCabinetId
(
cabinet
.
getId
());
// box.setCabinetId(cabinet.getId());
box
.
setPower
(
boxReq
.
getPower
());
// box.setPower(boxReq.getPower());
box
.
setEquipmentConfig
(
boxReq
.
getEquipmentConfig
());
// box.setEquipmentConfig(boxReq.getEquipmentConfig());
box
.
setContainType
(
boxReq
.
getContainType
());
// box.setContainType(boxReq.getContainType());
box
.
setState
(
0
);
// box.setState(0);
box
.
setBoxName
(
boxReq
.
getBoxName
());
// box.setBoxName(boxReq.getBoxName());
box
.
setNum
(
boxReq
.
getNum
());
// box.setNum(boxReq.getNum());
box
.
setUpdateTime
(
new
Date
());
// box.setUpdateTime(new Date());
// 在内存中比较是否存在相同 SerialNum 和相同 num 的数据
// // 在内存中比较是否存在相同 SerialNum 和相同 num 的数据
CabinetBox
existingBox
=
existingBoxMap
.
get
(
boxReq
.
getNum
());
// CabinetBox existingBox = existingBoxMap.get(boxReq.getNum());
//
if
(
existingBox
!=
null
)
{
// if (existingBox != null) {
// 如果存在,则更新数据
// // 如果存在,则更新数据
box
.
setId
(
existingBox
.
getId
());
// box.setId(existingBox.getId());
updateById
(
box
);
// updateById(box);
}
else
{
// } else {
// 如果不存在,则新增数据
// // 如果不存在,则新增数据
boxListAdd
.
add
(
box
);
// boxListAdd.add(box);
}
// }
}
// }
//
Integer
num
=
cabinet
.
getNum
();
//获取当前柜的总数量
// Integer num = cabinet.getNum();//获取当前柜的总数量
if
(
num
==
null
)
{
// if (num == null) {
num
=
0
;
// num = 0;
}
// }
//
// 更新 Cabinet 实体
// // 更新 Cabinet 实体
cabinet
.
setNum
(
num
+
addList
.
size
());
// cabinet.setNum(num + addList.size());
cabinetService
.
updateById
(
cabinet
);
// cabinetService.updateById(cabinet);
//
if
(
req
.
getActionFrom
().
equals
(
"platform"
))
//请求来源于平台,则进行推送
// if (req.getActionFrom().equals("platform"))//请求来源于平台,则进行推送
{
// {
MQ
.
SendMsg
(
"cabinetMsg"
,
req
.
getSerialNum
(),
"cabinetChange"
);
// MQ.SendMsg("cabinetMsg",req.getSerialNum(),"cabinetChange");
}
// }
// 批量保存新增的数据
// // 批量保存新增的数据
saveBatch
(
boxListAdd
);
// saveBatch(boxListAdd);
//
return
cabinet
.
getId
();
// return cabinet.getId();
return
null
;
}
}
//删除箱门
//删除箱门
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
DeleteBox
(
UpdateCabinetReq
req
)
{
public
String
DeleteBox
(
UpdateCabinetReq
req
)
{
Cabinet
cabinet
=
cabinetService
.
getOne
(
new
LambdaQueryWrapper
<
Cabinet
>()
// Cabinet cabinet = cabinetService.getOne(new LambdaQueryWrapper<Cabinet>()
.
eq
(
Cabinet:
:
getCabinetNum
,
req
.
getSerialNum
()));
// .eq(Cabinet::getCabinetNum, req.getSerialNum()));
if
(
ObjectUtil
.
isNull
(
cabinet
)){
// if (ObjectUtil.isNull(cabinet)){
throw
new
ServiceException
(
CabinetExceptionEnum
.
CABINET_ISNOT_EXISTS
);
// throw new ServiceException(CabinetExceptionEnum.CABINET_ISNOT_EXISTS);
}
// }
CabinetBox
one
=
getOne
(
new
LambdaQueryWrapper
<
CabinetBox
>()
// CabinetBox one = getOne(new LambdaQueryWrapper<CabinetBox>()
.
eq
(
CabinetBox:
:
getCabinetId
,
cabinet
.
getId
())
// .eq(CabinetBox::getCabinetId, cabinet.getId())
.
eq
(
CabinetBox:
:
getId
,
req
.
getId
()));
// .eq(CabinetBox::getId,req.getId()));
if
(
ObjectUtil
.
isNotNull
(
one
)){
// if (ObjectUtil.isNotNull(one)){
throw
new
ServiceException
(
CabinetBoxExceptionEnum
.
CABINETBOX_IS_EXISTS
);
// throw new ServiceException(CabinetBoxExceptionEnum.CABINETBOX_IS_EXISTS);
}
// }
//添加单警柜箱门信息默认状态为0正常
// //添加单警柜箱门信息默认状态为0正常
List
<
String
>
boxNumList
=
req
.
getNumList
();
// List<String> boxNumList = req.getNumList();
remove
(
new
LambdaQueryWrapper
<
CabinetBox
>()
// remove(new LambdaQueryWrapper<CabinetBox>()
.
eq
(
CabinetBox:
:
getCabinetId
,
cabinet
.
getId
())
// .eq(CabinetBox::getCabinetId, cabinet.getId())
.
in
(
CabinetBox:
:
getNum
,
boxNumList
));
// .in(CabinetBox::getNum, boxNumList));
//
// 更新 Cabinet 实体的 num 字段
// // 更新 Cabinet 实体的 num 字段
Integer
cabinetNum
=
cabinet
.
getNum
();
// Integer cabinetNum = cabinet.getNum();
if
(
cabinetNum
!=
null
)
{
// if (cabinetNum != null) {
cabinet
.
setNum
(
cabinetNum
-
boxNumList
.
size
());
// cabinet.setNum(cabinetNum - boxNumList.size());
cabinetService
.
updateById
(
cabinet
);
// cabinetService.updateById(cabinet);
}
// }
if
(
req
.
getActionFrom
().
equals
(
"platform"
))
//请求来源于平台,则进行推送
// if (req.getActionFrom().equals("platform"))//请求来源于平台,则进行推送
{
// {
MQ
.
SendMsg
(
"cabinetMsg"
,
req
.
getSerialNum
(),
"cabinetChange"
);
// MQ.SendMsg("cabinetMsg",req.getSerialNum(),"cabinetChange");
}
// }
return
cabinet
.
getId
();
// return cabinet.getId();
return
null
;
}
}
//判断箱子信息是否存在
//判断箱子信息是否存在
@Override
@Override
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/CabinetServiceImpl.java
View file @
6b28da93
...
@@ -185,35 +185,37 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
...
@@ -185,35 +185,37 @@ public class CabinetServiceImpl extends ServiceImpl<CabinetMapper, Cabinet> impl
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
for
(
Cabinet
cabinet
:
list
)
{
// 使用 Stream API 对数据进行分组和排序
CabinetDto
cabinetDto
=
new
CabinetDto
();
Map
<
String
,
List
<
Cabinet
>>
groupedCabinets
=
list
.
stream
()
BeanPlusUtil
.
copyProperties
(
cabinet
,
cabinetDto
);
.
collect
(
Collectors
.
groupingBy
(
Cabinet:
:
getId
));
List
<
CabinetBox
>
list1
;
groupedCabinets
.
forEach
((
id
,
cabinets
)
->
{
list1
=
cabinetBoxService
.
list
(
// 对每个分组内的数据按照 num 字段升序排序
new
LambdaQueryWrapper
<
CabinetBox
>()
List
<
Cabinet
>
sortedCabinets
=
cabinets
.
stream
()
.
eq
(
CabinetBox:
:
getCabinetId
,
cabinet
.
getId
())
.
sorted
(
Comparator
.
comparingInt
(
Cabinet:
:
getNumber
))
.
collect
(
Collectors
.
toList
());
.
orderByAsc
(
CabinetBox:
:
getNum
)
// 根据 Num 字段升序排序
);
// 创建 CabinetDto 对象并设置属性
CabinetDto
cabinetDto
=
new
CabinetDto
();
BeanPlusUtil
.
copyProperties
(
sortedCabinets
.
get
(
0
),
cabinetDto
);
cabinetDto
.
setOrgId
(
sortedCabinets
.
get
(
0
).
getOrgIdInt
());
cabinetDto
.
setOrgName
(
sortedCabinets
.
get
(
0
).
getOrgName
());
List
<
CabinetBoxDto
>
cabinetBoxList
=
new
ArrayList
<>();
List
<
CabinetBoxDto
>
cabinetBoxList
=
new
ArrayList
<>();
for
(
Cabinet
Box
cabinetBox
:
list1
)
{
for
(
Cabinet
cabinet
:
sortedCabinets
)
{
CabinetBoxDto
cabinetBoxDto
=
new
CabinetBoxDto
();
CabinetBoxDto
cabinetBoxDto
=
new
CabinetBoxDto
();
BeanPlusUtil
.
copyProperties
(
cabinetBox
,
cabinetBoxDto
);
BeanPlusUtil
.
copyProperties
(
cabinet
,
cabinetBoxDto
);
// 查询箱门绑定的警员id和姓名
cabinetBoxDto
.
setNum
(
cabinet
.
getNumber
());
// List<Policeman> policeList=cabinetBoxPoliceMapper.selectByBoxId(cabinetBox.getId());
cabinetBoxDto
.
setPoliceId
(
cabinet
.
getPoliceId
());
// if (policeList.size() != 0) {
cabinetBoxDto
.
setId
(
cabinet
.
getBoxId
());
// Policeman policeman = policeList.get(0);
// 设置其他属性...
// cabinetBoxDto.setPoliceId(policeman.getId());
// cabinetBoxDto.setPoliceName(policeman.getName());
// }
cabinetBoxDto
.
setNum
(
cabinetBox
.
getNum
());
cabinetBoxList
.
add
(
cabinetBoxDto
);
cabinetBoxList
.
add
(
cabinetBoxDto
);
}
}
cabinetDto
.
setCabinetBoxList
(
cabinetBoxList
);
cabinetDto
.
setCabinetBoxList
(
cabinetBoxList
);
cabinetList
.
add
(
cabinetDto
);
// 添加到cabinetList中
cabinetList
.
add
(
cabinetDto
);
}
});
return
cabinetList
;
return
cabinetList
;
}
}
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
View file @
6b28da93
...
@@ -254,7 +254,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
...
@@ -254,7 +254,8 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
BeanPlusUtil
.
copyProperties
(
one
,
policemanDto
);
BeanPlusUtil
.
copyProperties
(
one
,
policemanDto
);
//将箱门信息展示:
//将箱门信息展示:
List
<
CabinetBoxPolice
>
list
=
cabinetBoxPoliceService
.
list
(
new
LambdaQueryWrapper
<
CabinetBoxPolice
>()
List
<
CabinetBoxPolice
>
list
=
cabinetBoxPoliceService
.
list
(
new
LambdaQueryWrapper
<
CabinetBoxPolice
>()
.
eq
(
CabinetBoxPolice:
:
getPoliceId
,
req
.
getId
()));
.
eq
(
CabinetBoxPolice:
:
getPoliceId
,
req
.
getId
())
);
List
<
String
>
soloList
=
new
ArrayList
<>();
List
<
String
>
soloList
=
new
ArrayList
<>();
List
<
String
>
publicList
=
new
ArrayList
<>();
List
<
String
>
publicList
=
new
ArrayList
<>();
String
soloName
=
""
;
String
soloName
=
""
;
...
...
jyzb-biz/src/main/resources/mapper/CabinetMapper.xml
View file @
6b28da93
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.junmp.jyzb.mapper.CabinetMapper"
>
<mapper
namespace=
"com.junmp.jyzb.mapper.CabinetMapper"
>
<resultMap
id=
"cabinetResultMap"
type=
"com.junmp.jyzb.entity.Cabinet"
>
<resultMap
id=
"cabinetResultMap"
type=
"com.junmp.jyzb.entity.Cabinet"
>
<id
property=
"id"
column=
"id"
/>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
property=
"cabinetNum"
column=
"cabinet_num"
/>
<result
property=
"cabinetNum"
column=
"cabinet_num"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"orgIdInt"
column=
"org_id_int"
/>
<result
property=
"orgIdInt"
column=
"org_id_int"
/>
...
@@ -18,10 +19,13 @@
...
@@ -18,10 +19,13 @@
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"createUser"
column=
"create_user"
/>
<result
property=
"policeName"
column=
"police_name"
/>
<result
property=
"policeName"
column=
"police_name"
/>
<result
property=
"policeId"
column=
"police_id"
/>
<result
property=
"policeId"
column=
"police_id"
/>
<result
property=
"boxId"
column=
"box_id"
/>
<result
property=
"containType"
column=
"contain_type"
/>
<result
property=
"boxState"
column=
"box_state"
/>
<result
property=
"equipmentConfig"
column=
"equipment_config"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"orgName"
column=
"org_name"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<result
property=
"updateUser"
column=
"update_user"
/>
<!-- <collection property="list" ofType="com.junmp.jyzb.entity.CabinetBox" column="cabinet_id"-->
<!-- select="com.junmp.jyzb.mapper.CabinetBoxMapper.selectById">-->
<!-- </collection>-->
<!-- </collection>-->
</resultMap>
</resultMap>
...
@@ -75,15 +79,16 @@
...
@@ -75,15 +79,16 @@
</foreach>
</foreach>
</select>
</select>
<select
id=
"getAllCabinetsWithSingleCabinet"
resultType=
"com.junmp.jyzb.entity.Cabinet"
>
<select
id=
"getAllCabinetsWithSingleCabinet"
resultType=
"com.junmp.jyzb.entity.Cabinet"
>
SELECT c.*, cb.num as number,bp.`name` as police_name,bp.id as police_id
FROM base_cabinet c
SELECT cabinet.id as id,cabinet.cabinet_num,cabinet.name,cabinet.org_id_int,cabinet.location,cabinet.state,
JOIN pub_org o ON c.org_id_int = o.org_id
cabinet.online_state,cabinet.create_time,cabinet.update_time,cabinet.num,cb.id as box_id,cb.contain_type,cb.state as box_state,
LEFT JOIN base_cabinet_box cb ON cb.cabinet_id = c.id
cb.equipment_config, cb.num as number,bp.`name` as police_name,bp.id as police_id,o.org_name
FROM base_cabinet cabinet
left join pub_org o ON cabinet.org_id_int = o.org_id
LEFT JOIN base_cabinet_box cb ON cb.cabinet_id = cabinet.id
LEFT JOIN base_cabinet_box_police ccp ON ccp.cabinet_box_id = cb.id
LEFT JOIN base_cabinet_box_police ccp ON ccp.cabinet_box_id = cb.id
LEFT JOIN base_policeman bp ON bp.id = ccp.police_id
LEFT JOIN base_policeman bp ON bp.id = ccp.police_id
WHERE c.org_id_int = #{orgId} and cb.num is not null;
WHERE cabinet.org_id_int = #{orgId} and cb.num is not null;
</select>
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论