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
a5f19520
Commit
a5f19520
authored
Jan 22, 2024
by
李小惠
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.sothing.top/843502640/jyzb_platformV2
into develop-lxh
parents
c2a78484
088becef
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
141 行增加
和
70 行删除
+141
-70
UpdatePolicemanReq.java
jyzb-api/src/main/java/com/junmp/jyzb/api/bean/req/UpdatePolicemanReq.java
+1
-1
PolicemanExceptionEnum.java
jyzb-api/src/main/java/com/junmp/jyzb/api/exception/enums/PolicemanExceptionEnum.java
+5
-1
RabbitmqConfig.java
jyzb-biz/src/main/java/com/junmp/jyzb/config/rabbitMQ/RabbitmqConfig.java
+0
-65
TopicRabbitConfig.java
jyzb-biz/src/main/java/com/junmp/jyzb/config/rabbitMQ/TopicRabbitConfig.java
+71
-0
PoliceController.java
jyzb-biz/src/main/java/com/junmp/jyzb/controller/PoliceController.java
+9
-1
PolicemanService.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/PolicemanService.java
+2
-0
PolicemanServiceImpl.java
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
+42
-2
RabbitMQSendMsg.java
jyzb-biz/src/main/java/com/junmp/jyzb/utils/RabbitMQSendMsg.java
+11
-0
没有找到文件。
jyzb-api/src/main/java/com/junmp/jyzb/api/bean/req/UpdatePolicemanReq.java
View file @
a5f19520
...
...
@@ -15,7 +15,7 @@ public class UpdatePolicemanReq extends BaseRequest {
@NotBlank
(
message
=
"警员主键不能为空"
,
groups
=
{
edit
.
class
,
delete
.
class
,
detail
.
class
})
private
String
id
;
private
String
serialNum
;
@NotBlank
(
message
=
"警员名字不能为空"
,
groups
=
{
add
.
class
,
edit
.
class
})
private
String
name
;
...
...
jyzb-api/src/main/java/com/junmp/jyzb/api/exception/enums/PolicemanExceptionEnum.java
View file @
a5f19520
...
...
@@ -36,7 +36,11 @@ public enum PolicemanExceptionEnum implements IExceptionEnum {
/**
* 该警员已经在审核流中,请勿重复操作
*/
POLICE_IS_IN_EXAMINE
(
CommonConstant
.
DEFAULT_USER_ERROR_CODE
,
"该警员已经在审核流中或已经调岗完成,请勿重复操作"
)
POLICE_IS_IN_EXAMINE
(
CommonConstant
.
DEFAULT_USER_ERROR_CODE
,
"该警员已经在审核流中或已经调岗完成,请勿重复操作"
),
/**
* 该警员已经在审核流中,请勿重复操作
*/
POLICE_IS_BUSY
(
CommonConstant
.
DEFAULT_USER_ERROR_CODE
,
"警员调岗中,无法操作"
)
;
/**
* 错误编码
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/config/rabbitMQ/RabbitmqConfig.java
deleted
100644 → 0
View file @
c2a78484
//package com.junmp.jyzb.config.rabbitMQ;
//
//import com.junmp.jyzb.api.bean.dto.OrderDto;
//import com.junmp.jyzb.service.OrderMainService;
//import org.springframework.amqp.core.*;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//
//@Configuration
//public class RabbitmqConfig {
// @Resource
// private OrderMainService orderMainService;
//
// //1.交换机
// @Bean("LogExchange")
// public Exchange bootExchange(){
// return ExchangeBuilder.directExchange("LogExchange").durable(true).build();
// }
//
// //2.队列
// @Bean("LogQueue")
// public Queue bootQueue(){
// return QueueBuilder.durable("LogQueue").build();
// }
// //3.队列和交换机的绑定关系(队列,交换机,rountingkey)
// @Bean
// public Binding bingQueueExchange(@Qualifier("LogQueue") Queue queue, @Qualifier("LogExchange")Exchange exchange){
// return BindingBuilder.bind(queue).to(exchange).with("log").noargs();
//
// }
//
// @Bean
// public DirectExchange OrderExchange(){
// return new DirectExchange("OrderExchange");
// }
//
// //2.队列
// @Bean
// public List<Queue> OrderQueue(){
// List<Queue> queues =new ArrayList<>();
// List<OrderDto> orderList = orderMainService.getOrder();
// for (OrderDto orderDto:orderList) {
// queues.add(new Queue(orderDto.getEndOrgName()));
// }
// return queues;
// }
//
// //3.队列和交换机的绑定关系(队列,交换机,rountingkey)
// @Bean
// public List<Binding> bindQueueExchange(List<Queue> queue, DirectExchange exchange){
// List<Binding> bindings=new ArrayList<>();
// List<OrderDto> orderList = orderMainService.getOrder();
// for(int i=0;i<Math.min(queue.size(),orderList.size());i++){
// bindings.add(BindingBuilder.bind(queue.get(i)).to(exchange).with(orderList.get(i).getEndOrgId()));
// }
// return bindings;
//
// }
//
//}
jyzb-biz/src/main/java/com/junmp/jyzb/config/rabbitMQ/TopicRabbitConfig.java
0 → 100644
View file @
a5f19520
package
com
.
junmp
.
jyzb
.
config
.
rabbitMQ
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.junmp.jyzb.entity.Cabinet
;
import
com.junmp.jyzb.entity.PubOrg
;
import
com.junmp.jyzb.service.CabinetService
;
import
com.junmp.jyzb.service.PubOrgService
;
import
org.springframework.amqp.core.*
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
public
class
TopicRabbitConfig
{
private
static
final
String
EXCHANGE
=
"topicExchange"
;
private
static
final
String
ORG_ROUTING_KEY_PREFIX
=
"org."
;
private
static
final
String
CABINET_ROUTING_KEY_PREFIX
=
"cabinet."
;
@Resource
private
PubOrgService
pubOrgService
;
@Resource
private
CabinetService
cabinetService
;
// Inject the services using constructor injection
public
TopicRabbitConfig
()
{
}
@Bean
public
TopicExchange
topicExchange
()
{
return
new
TopicExchange
(
EXCHANGE
);
}
// Dynamic creation of queues and bindings for each organization and cabinet
@Bean
public
List
<
Binding
>
createQueuesAndBindings
(
TopicExchange
topicExchange
)
{
List
<
PubOrg
>
orgList
=
pubOrgService
.
list
(
new
LambdaQueryWrapper
<
PubOrg
>().
eq
(
PubOrg:
:
getStatusFlag
,
1
));
List
<
Cabinet
>
cabinetList
=
cabinetService
.
list
();
List
<
Binding
>
bindings
=
new
ArrayList
<>();
for
(
PubOrg
org
:
orgList
)
{
// Create a unique queue for each organization
Queue
orgQueue
=
new
Queue
(
org
.
getOrgId
().
toString
());
// Bind the queue to the exchange with the routing key specific to the organization
Binding
orgBinding
=
BindingBuilder
.
bind
(
orgQueue
).
to
(
topicExchange
)
.
with
(
ORG_ROUTING_KEY_PREFIX
+
org
.
getOrgId
());
bindings
.
add
(
orgBinding
);
}
for
(
Cabinet
cabinet
:
cabinetList
)
{
// Create a unique queue for each cabinet
Queue
cabinetQueue
=
new
Queue
(
cabinet
.
getCabinetNum
().
toString
());
// Bind the queue to the exchange with the routing key specific to the cabinet
Binding
cabinetBinding
=
BindingBuilder
.
bind
(
cabinetQueue
).
to
(
topicExchange
)
.
with
(
CABINET_ROUTING_KEY_PREFIX
+
cabinet
.
getCabinetNum
());
bindings
.
add
(
cabinetBinding
);
}
return
bindings
;
}
}
jyzb-biz/src/main/java/com/junmp/jyzb/controller/PoliceController.java
View file @
a5f19520
...
...
@@ -66,6 +66,15 @@ public class PoliceController {
return
ApiRes
.
success
(
policemanService
.
GetPoliceWithoutOrg
());
}
@PostMapping
(
path
=
"/DeletePoliceFromCab"
,
name
=
"警柜禁用警员信息#logType=30"
)
@ApiOperation
(
"删除警员信息"
)
public
ApiRes
<
Boolean
>
DeletePoliceFromCab
(
@RequestBody
@Validated
(
ValidationApi
.
delete
.
class
)
UpdatePolicemanReq
req
)
{
boolean
b
=
policemanService
.
DeletePoliceFromCab
(
req
);
if
(!
b
){
return
ApiRes
.
failure
(
"删除失败"
);
}
return
ApiRes
.
success
(
b
);
}
@PostMapping
(
path
=
"/DeletePolice"
,
name
=
"删除警员信息#logType=30"
)
@ApiOperation
(
"删除警员信息"
)
public
ApiRes
<
Boolean
>
DeletePolice
(
@RequestBody
@Validated
(
ValidationApi
.
delete
.
class
)
UpdatePolicemanReq
req
)
{
...
...
@@ -75,7 +84,6 @@ public class PoliceController {
}
return
ApiRes
.
success
(
b
);
}
//添加人脸和指纹照片或修改
@PostMapping
(
path
=
"/addFaceAndfinger"
,
name
=
"添加警员人脸照片和指纹照片#logType=30"
)
@ApiOperation
(
"添加警员人脸照片和指纹照片"
)
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/PolicemanService.java
View file @
a5f19520
...
...
@@ -40,6 +40,8 @@ public interface PolicemanService extends IService<Policeman> {
boolean
DeletePolice
(
UpdatePolicemanReq
req
);
//删除警员
boolean
DeletePoliceFromCab
(
UpdatePolicemanReq
req
);
//修改警员信息
boolean
UpdatePolice
(
UpdatePolicemanReq
req
);
boolean
UpdatePoliceFromCab
(
CabinetPolicemanReq
req
);
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/service/impl/PolicemanServiceImpl.java
View file @
a5f19520
...
...
@@ -489,6 +489,44 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return
removeById
(
req
.
getId
());
}
/**
* 禁用警员信息
*
* @param req
* @return
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
DeletePoliceFromCab
(
UpdatePolicemanReq
req
)
{
//通过警员id查询警员信息
Policeman
policeman
=
PoliceExist
(
req
.
getId
());
if
(
policeman
.
getState
().
equals
(
2
))
//说明当前警员调岗中不可操作
{
throw
new
ServiceException
(
PolicemanExceptionEnum
.
POLICE_IS_BUSY
);
}
else
{
policeman
.
setState
(
req
.
getState
());
}
PubOrg
orgInfos
=
pubOrgService
.
getOne
(
new
LambdaQueryWrapper
<
PubOrg
>().
eq
(
PubOrg:
:
getOrgId
,
req
.
getOrgId
()));
orgInfos
.
setPoliceUpdateTime
(
DateTime
.
now
());
Cabinet
cabinetOrg
=
cabinetService
.
getOne
(
new
LambdaQueryWrapper
<
Cabinet
>().
eq
(
Cabinet:
:
getCabinetNum
,
req
.
getSerialNum
()));
orgInfos
.
setPoliceUpdateService
(
cabinetOrg
.
getName
()+
"-"
+
cabinetOrg
.
getCabinetNum
());
pubOrgService
.
updateById
(
orgInfos
);
//人员信息修改之后推送至本地主机和单警柜
List
<
Cabinet
>
cabinets
=
cabinetService
.
list
(
new
LambdaQueryWrapper
<
Cabinet
>().
eq
(
Cabinet:
:
getOrgIdInt
,
req
.
getCabinetOrgId
()));
//拿到组织机构下所有的警柜用于消息推送
if
(
cabinets
.
size
()>
0
)
{
cabinets
.
forEach
(
t
->
MQ
.
SendMsg
(
"cabinetMsg"
,
t
.
getCabinetNum
(),
"policeChange"
));
}
MQ
.
SendMsg
(
"warehouseMsg"
,
req
.
getOrgId
().
toString
(),
"policeChange"
);
//推送至仓库主机
return
this
.
updateById
(
policeman
);
}
/**
...
...
@@ -835,8 +873,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
cpDto
.
setActionUpdateTime
(
String
.
valueOf
(
orgInfo
.
getPoliceUpdateTime
()));
cpDto
.
setOrgName
(
orgInfo
.
getOrgName
());
// 获取组织机构下的警员列表
List
<
Policeman
>
policeList
=
this
.
list
(
new
LambdaQueryWrapper
<
Policeman
>().
eq
(
Policeman:
:
getOrgId
,
org
));
// 获取组织机构下的警员列表,state字段为字符串 "1"
List
<
Policeman
>
policeList
=
this
.
list
(
new
LambdaQueryWrapper
<
Policeman
>()
.
eq
(
Policeman:
:
getOrgId
,
org
)
.
eq
(
Policeman:
:
getState
,
1
));
// 转换警员信息为 PoliceDetailDto
List
<
PoliceDetailDto
>
policeDtoList
=
new
ArrayList
<>();
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/utils/RabbitMQSendMsg.java
View file @
a5f19520
...
...
@@ -33,6 +33,17 @@ public class RabbitMQSendMsg {
rabbitTemplate
.
convertAndSend
(
exchangeName
,
name
,
jsonString
);
}
// 发布消息到交换机,根据不同的主题和消息内容
public
void
publishOrgMessage
(
String
orgId
,
String
message
)
{
String
routingKey
=
"org."
+
orgId
;
rabbitTemplate
.
convertAndSend
(
"topicExchange"
,
routingKey
,
message
);
}
public
void
publishCabinetMessage
(
String
cabinetId
,
String
message
)
{
String
routingKey
=
"cabinet."
+
cabinetId
;
rabbitTemplate
.
convertAndSend
(
"topicExchange"
,
routingKey
,
message
);
}
//推送消息(广播式推送)
public
void
sendFanoutMsg
(
String
exchangeName
,
List
<
String
>
names
,
Object
msg
){
//exchangeName交换机名称,name单警柜或本地仓库,msg发送的消息
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论