|
@@ -7,14 +7,10 @@ import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
-import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
import com.ruoyi.framework.websocket.WebSocketServer;
|
|
|
-import com.ruoyi.framework.websocket.WebsocketConst;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
-import com.ruoyi.zhdd.domain.GatewayDept;
|
|
|
import com.ruoyi.zhdd.domain.SingleDevice;
|
|
|
import com.ruoyi.zhdd.domain.bo.SingleDeviceBo;
|
|
|
import com.ruoyi.zhdd.service.ISingleDeviceService;
|
|
@@ -23,8 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.kafka.annotation.KafkaListener;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
@Component
|
|
|
@Slf4j
|
|
|
public class SysGatewayUserTask {
|
|
@@ -128,78 +122,78 @@ public class SysGatewayUserTask {
|
|
|
*
|
|
|
* @param message
|
|
|
*/
|
|
|
- @KafkaListener(topics = "t_uc_orgdept")
|
|
|
- public void onDeptMessage(String message) {
|
|
|
- log.info("kafka部门信息消费:{}", message);
|
|
|
- try {
|
|
|
- GatewayDept gatewayDept = JSONUtil.toBean(message, GatewayDept.class);
|
|
|
- if (gatewayDept != null) {
|
|
|
- SysDept qdept = new SysDept();
|
|
|
- qdept.setDeptId(gatewayDept.getId());
|
|
|
- List<SysDept> deptList = deptService.selectDeptList(qdept);
|
|
|
- if (deptList.isEmpty()) {
|
|
|
- //插入
|
|
|
-// SysDept dept = new SysDept();
|
|
|
- /*//查询父部门
|
|
|
- {
|
|
|
- SysDept qdept1 = new SysDept();
|
|
|
- if (gatewayDept.getParentId() == null || gatewayDept.getParentId().equals("")) {
|
|
|
- qdept1.setParentId("0");
|
|
|
- qdept1.setOtherId(gatewayDept.getOrgId());
|
|
|
- } else {
|
|
|
- qdept1.setOtherId(gatewayDept.getParentId());
|
|
|
- }
|
|
|
- List<SysDept> deptList1 = deptService.selectDeptList(qdept1);
|
|
|
- if (!deptList1.isEmpty()) {
|
|
|
- dept.setParentId(deptList1.get(0).getDeptId());
|
|
|
- } else {
|
|
|
- //无父组织或部门 暂不处理吧
|
|
|
- }
|
|
|
- }*/
|
|
|
- qdept.setParentId(StrUtil.emptyToDefault(gatewayDept.getParentId(), "0"));
|
|
|
- qdept.setDeptName(gatewayDept.getName());
|
|
|
- qdept.setUpdateBy(gatewayDept.getUpdateUser());
|
|
|
- qdept.setUpdateTime(DateUtil.parseDateTime(gatewayDept.getUpdateTime()));
|
|
|
- qdept.setCreateBy(gatewayDept.getCreateUser());
|
|
|
- qdept.setCreateTime(DateUtil.parseDateTime(gatewayDept.getCreateTime()));
|
|
|
- qdept.setDelFlag(gatewayDept.getDelFlag());
|
|
|
- qdept.setFlag(Convert.toStr(gatewayDept.getFlag()));
|
|
|
-
|
|
|
- deptService.insertDept(qdept);
|
|
|
- } else {
|
|
|
- //更新
|
|
|
- qdept = deptList.get(0);
|
|
|
- //查询父部门
|
|
|
- /*{
|
|
|
- SysDept qdept1 = new SysDept();
|
|
|
- if (gatewayDept.getParentId() == null || gatewayDept.getParentId().equals("")) {
|
|
|
- qdept1.setParentId("0");
|
|
|
- qdept1.setOtherId(gatewayDept.getOrgId());
|
|
|
- } else {
|
|
|
- qdept1.setOtherId(gatewayDept.getParentId());
|
|
|
- }
|
|
|
- List<SysDept> deptList1 = deptService.selectDeptList(qdept1);
|
|
|
- if (!deptList1.isEmpty()) {
|
|
|
- dept.setParentId(deptList1.get(0).getDeptId());
|
|
|
- } else {
|
|
|
- //无父组织或部门 暂不处理吧
|
|
|
- }
|
|
|
- }*/
|
|
|
- qdept.setParentId(StrUtil.emptyToDefault(gatewayDept.getParentId(), "0"));
|
|
|
- qdept.setDeptName(gatewayDept.getName());
|
|
|
- qdept.setUpdateBy(gatewayDept.getUpdateUser());
|
|
|
- qdept.setUpdateTime(DateUtil.parseDateTime(gatewayDept.getUpdateTime()));
|
|
|
- qdept.setCreateBy(gatewayDept.getCreateUser());
|
|
|
- qdept.setCreateTime(DateUtil.parseDateTime(gatewayDept.getCreateTime()));
|
|
|
- qdept.setDelFlag(gatewayDept.getDelFlag());
|
|
|
- qdept.setFlag(Convert.toStr(gatewayDept.getFlag()));
|
|
|
- deptService.updateDept(qdept);
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("t_uc_orgdept的kafka消费异常:{}", e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
+// @KafkaListener(topics = "t_uc_orgdept")
|
|
|
+// public void onDeptMessage(String message) {
|
|
|
+// log.info("kafka部门信息消费:{}", message);
|
|
|
+// try {
|
|
|
+// GatewayDept gatewayDept = JSONUtil.toBean(message, GatewayDept.class);
|
|
|
+// if (gatewayDept != null) {
|
|
|
+// SysDept qdept = new SysDept();
|
|
|
+// qdept.setDeptId(gatewayDept.getId());
|
|
|
+// List<SysDept> deptList = deptService.selectDeptList(qdept);
|
|
|
+// if (deptList.isEmpty()) {
|
|
|
+// //插入
|
|
|
+//// SysDept dept = new SysDept();
|
|
|
+// /*//查询父部门
|
|
|
+// {
|
|
|
+// SysDept qdept1 = new SysDept();
|
|
|
+// if (gatewayDept.getParentId() == null || gatewayDept.getParentId().equals("")) {
|
|
|
+// qdept1.setParentId("0");
|
|
|
+// qdept1.setOtherId(gatewayDept.getOrgId());
|
|
|
+// } else {
|
|
|
+// qdept1.setOtherId(gatewayDept.getParentId());
|
|
|
+// }
|
|
|
+// List<SysDept> deptList1 = deptService.selectDeptList(qdept1);
|
|
|
+// if (!deptList1.isEmpty()) {
|
|
|
+// dept.setParentId(deptList1.get(0).getDeptId());
|
|
|
+// } else {
|
|
|
+// //无父组织或部门 暂不处理吧
|
|
|
+// }
|
|
|
+// }*/
|
|
|
+// qdept.setParentId(StrUtil.emptyToDefault(gatewayDept.getParentId(), "0"));
|
|
|
+// qdept.setDeptName(gatewayDept.getName());
|
|
|
+// qdept.setUpdateBy(gatewayDept.getUpdateUser());
|
|
|
+// qdept.setUpdateTime(DateUtil.parseDateTime(gatewayDept.getUpdateTime()));
|
|
|
+// qdept.setCreateBy(gatewayDept.getCreateUser());
|
|
|
+// qdept.setCreateTime(DateUtil.parseDateTime(gatewayDept.getCreateTime()));
|
|
|
+// qdept.setDelFlag(gatewayDept.getDelFlag());
|
|
|
+// qdept.setFlag(Convert.toStr(gatewayDept.getFlag()));
|
|
|
+//
|
|
|
+// deptService.insertDept(qdept);
|
|
|
+// } else {
|
|
|
+// //更新
|
|
|
+// qdept = deptList.get(0);
|
|
|
+// //查询父部门
|
|
|
+// /*{
|
|
|
+// SysDept qdept1 = new SysDept();
|
|
|
+// if (gatewayDept.getParentId() == null || gatewayDept.getParentId().equals("")) {
|
|
|
+// qdept1.setParentId("0");
|
|
|
+// qdept1.setOtherId(gatewayDept.getOrgId());
|
|
|
+// } else {
|
|
|
+// qdept1.setOtherId(gatewayDept.getParentId());
|
|
|
+// }
|
|
|
+// List<SysDept> deptList1 = deptService.selectDeptList(qdept1);
|
|
|
+// if (!deptList1.isEmpty()) {
|
|
|
+// dept.setParentId(deptList1.get(0).getDeptId());
|
|
|
+// } else {
|
|
|
+// //无父组织或部门 暂不处理吧
|
|
|
+// }
|
|
|
+// }*/
|
|
|
+// qdept.setParentId(StrUtil.emptyToDefault(gatewayDept.getParentId(), "0"));
|
|
|
+// qdept.setDeptName(gatewayDept.getName());
|
|
|
+// qdept.setUpdateBy(gatewayDept.getUpdateUser());
|
|
|
+// qdept.setUpdateTime(DateUtil.parseDateTime(gatewayDept.getUpdateTime()));
|
|
|
+// qdept.setCreateBy(gatewayDept.getCreateUser());
|
|
|
+// qdept.setCreateTime(DateUtil.parseDateTime(gatewayDept.getCreateTime()));
|
|
|
+// qdept.setDelFlag(gatewayDept.getDelFlag());
|
|
|
+// qdept.setFlag(Convert.toStr(gatewayDept.getFlag()));
|
|
|
+// deptService.updateDept(qdept);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("t_uc_orgdept的kafka消费异常:{}", e.getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 单兵实时位置消费
|
|
@@ -234,23 +228,23 @@ public class SysGatewayUserTask {
|
|
|
*
|
|
|
* @param message
|
|
|
*/
|
|
|
- @KafkaListener(topics = "voice-vcg")
|
|
|
- public void onVoiceMessage(String message) {
|
|
|
- log.info("kafka语音指令消费:{}", message);
|
|
|
- JSONObject jsonObject = JSONUtil.parseObj(message);
|
|
|
- String id = jsonObject.getStr("id");
|
|
|
- String wordValue = jsonObject.getStr("wordValue");
|
|
|
- List<SysDictData> zhdd_voice = sysDictTypeService.selectDictDataByType("zhdd_voice");
|
|
|
- for (SysDictData sysDictData : zhdd_voice) {
|
|
|
- if (sysDictData.getDictLabel().contains(wordValue)) {
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
- obj.set(WebsocketConst.MSG_CMD, sysDictData.getDictValue());
|
|
|
- obj.set(WebsocketConst.MSG_ID, id);
|
|
|
- obj.set(WebsocketConst.MSG_TXT, wordValue);
|
|
|
- webSocketServer.sendAllMessage(obj.toString());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// @KafkaListener(topics = "voice-vcg")
|
|
|
+// public void onVoiceMessage(String message) {
|
|
|
+// log.info("kafka语音指令消费:{}", message);
|
|
|
+// JSONObject jsonObject = JSONUtil.parseObj(message);
|
|
|
+// String id = jsonObject.getStr("id");
|
|
|
+// String wordValue = jsonObject.getStr("wordValue");
|
|
|
+// List<SysDictData> zhdd_voice = sysDictTypeService.selectDictDataByType("zhdd_voice");
|
|
|
+// for (SysDictData sysDictData : zhdd_voice) {
|
|
|
+// if (sysDictData.getDictLabel().contains(wordValue)) {
|
|
|
+// JSONObject obj = new JSONObject();
|
|
|
+// obj.set(WebsocketConst.MSG_CMD, sysDictData.getDictValue());
|
|
|
+// obj.set(WebsocketConst.MSG_ID, id);
|
|
|
+// obj.set(WebsocketConst.MSG_TXT, wordValue);
|
|
|
+// webSocketServer.sendAllMessage(obj.toString());
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
}
|