Commit a5f19520 by 李小惠

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-lxh

parents c2a78484 088becef
...@@ -15,7 +15,7 @@ public class UpdatePolicemanReq extends BaseRequest { ...@@ -15,7 +15,7 @@ public class UpdatePolicemanReq extends BaseRequest {
@NotBlank(message = "警员主键不能为空", groups = {edit.class, delete.class, detail.class}) @NotBlank(message = "警员主键不能为空", groups = {edit.class, delete.class, detail.class})
private String id; private String id;
private String serialNum;
@NotBlank(message = "警员名字不能为空", groups = {add.class,edit.class}) @NotBlank(message = "警员名字不能为空", groups = {add.class,edit.class})
private String name; private String name;
......
...@@ -36,7 +36,11 @@ public enum PolicemanExceptionEnum implements IExceptionEnum { ...@@ -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,"警员调岗中,无法操作")
; ;
/** /**
* 错误编码 * 错误编码
......
//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;
//
// }
//
//}
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;
}
}
...@@ -66,6 +66,15 @@ public class PoliceController { ...@@ -66,6 +66,15 @@ public class PoliceController {
return ApiRes.success(policemanService.GetPoliceWithoutOrg()); 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") @PostMapping(path="/DeletePolice",name="删除警员信息#logType=30")
@ApiOperation("删除警员信息") @ApiOperation("删除警员信息")
public ApiRes<Boolean> DeletePolice(@RequestBody @Validated(ValidationApi.delete.class) UpdatePolicemanReq req) { public ApiRes<Boolean> DeletePolice(@RequestBody @Validated(ValidationApi.delete.class) UpdatePolicemanReq req) {
...@@ -75,7 +84,6 @@ public class PoliceController { ...@@ -75,7 +84,6 @@ public class PoliceController {
} }
return ApiRes.success(b); return ApiRes.success(b);
} }
//添加人脸和指纹照片或修改 //添加人脸和指纹照片或修改
@PostMapping(path="/addFaceAndfinger",name="添加警员人脸照片和指纹照片#logType=30") @PostMapping(path="/addFaceAndfinger",name="添加警员人脸照片和指纹照片#logType=30")
@ApiOperation("添加警员人脸照片和指纹照片") @ApiOperation("添加警员人脸照片和指纹照片")
......
...@@ -40,6 +40,8 @@ public interface PolicemanService extends IService<Policeman> { ...@@ -40,6 +40,8 @@ public interface PolicemanService extends IService<Policeman> {
boolean DeletePolice(UpdatePolicemanReq req); boolean DeletePolice(UpdatePolicemanReq req);
//删除警员
boolean DeletePoliceFromCab(UpdatePolicemanReq req);
//修改警员信息 //修改警员信息
boolean UpdatePolice(UpdatePolicemanReq req); boolean UpdatePolice(UpdatePolicemanReq req);
boolean UpdatePoliceFromCab(CabinetPolicemanReq req); boolean UpdatePoliceFromCab(CabinetPolicemanReq req);
......
...@@ -489,6 +489,44 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman ...@@ -489,6 +489,44 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
return removeById(req.getId()); 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 ...@@ -835,8 +873,10 @@ public class PolicemanServiceImpl extends ServiceImpl<PolicemanMapper, Policeman
cpDto.setActionUpdateTime(String.valueOf(orgInfo.getPoliceUpdateTime())); cpDto.setActionUpdateTime(String.valueOf(orgInfo.getPoliceUpdateTime()));
cpDto.setOrgName(orgInfo.getOrgName()); cpDto.setOrgName(orgInfo.getOrgName());
// 获取组织机构下的警员列表 // 获取组织机构下的警员列表,state字段为字符串 "1"
List<Policeman> policeList = this.list(new LambdaQueryWrapper<Policeman>().eq(Policeman::getOrgId, org)); List<Policeman> policeList = this.list(new LambdaQueryWrapper<Policeman>()
.eq(Policeman::getOrgId, org)
.eq(Policeman::getState, 1));
// 转换警员信息为 PoliceDetailDto // 转换警员信息为 PoliceDetailDto
List<PoliceDetailDto> policeDtoList = new ArrayList<>(); List<PoliceDetailDto> policeDtoList = new ArrayList<>();
......
...@@ -33,6 +33,17 @@ public class RabbitMQSendMsg { ...@@ -33,6 +33,17 @@ public class RabbitMQSendMsg {
rabbitTemplate.convertAndSend(exchangeName, name, jsonString); 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){ public void sendFanoutMsg(String exchangeName, List<String> names,Object msg){
//exchangeName交换机名称,name单警柜或本地仓库,msg发送的消息 //exchangeName交换机名称,name单警柜或本地仓库,msg发送的消息
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论