Преглед на файлове

修复异常记录存库,监督管理平台联网调试

hanzhengyi преди 8 месеца
родител
ревизия
5f380bf0c6

+ 0 - 3
service-fire/service-fire-api/src/main/java/com/usky/fire/factory/RemoteFireFallbackFactory.java

@@ -1,8 +1,5 @@
 package com.usky.fire.factory;
 
-import com.alibaba.fastjson.JSONObject;
-import com.usky.common.core.bean.ApiResult;
-import com.usky.common.core.exception.BusinessException;
 import com.usky.common.core.exception.FeignBadRequestException;
 import com.usky.fire.RemoteFireService;
 import org.slf4j.Logger;

+ 41 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionEventServiceImpl.java

@@ -22,10 +22,17 @@ import com.usky.fire.service.config.rabbitmq.RabbitMQConfig;
 import com.usky.fire.service.vo.PatrolInspectionPlanRequestVO;
 import com.usky.system.RemoteDictService;
 import com.usky.system.RemoteMceService;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
 import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.List;
@@ -129,7 +136,40 @@ public class PatrolInspectionEventServiceImpl extends AbstractCrudService<Patrol
         jsonObject.addProperty("infoType",2);
         jsonObject.addProperty("id",patrolInspectionEvent.getId());
         remoteMceService.addMce(jsonObject.toString());
-
+        String url = "http://sgdzpic.3322.org:5901";
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n" +
+                "<Agent ID=\"SSJCZHQY0001\" Type=\"18\" Ver=\"1.2.0.0\">\n" +
+                "<DVRHeart State=\"1\" TotalSpace=\"XXXXX\" FreeSpace=\"XXXXXX\">\n" +
+                "System,smss.exe,csrss.exe…\n" +
+                "</DVRHeart>\n" +
+                "<GetTicks/>\n" +
+                "<OperationCmd Type=\"18\" Channel=\"0\" TriggerTime=\"2024-06-21 11:19:40\" Note=\"XXXXXX\" GUID=\"XXXXX…\">\n" +
+                "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABsSFBcUERsXFhceHBsgKEIrKCUlKFE6PTBCYFVlZF9V…\n" +
+                "</OperationCmd>\n" +
+                "</Agent>";
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(url);
+        try {
+            // 设置请求的内容为XML
+            StringEntity entity = new StringEntity(xml);
+            entity.setContentType("application/xml");
+            httpPost.setEntity(entity);
+
+            // 发送请求
+            HttpResponse response = httpClient.execute(httpPost);
+
+            // 打印响应状态和内容
+            System.out.println("Response Status: " + response.getStatusLine().getStatusCode());
+            System.out.println("Response Content: " + EntityUtils.toString(response.getEntity()));
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                httpClient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     @Override

+ 42 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -1,12 +1,10 @@
 package com.usky.fire.service.impl;
 
-import ch.qos.logback.core.pattern.FormatInfo;
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
-import com.usky.common.core.util.DateUtils;
 import com.usky.common.core.util.StringUtils;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
@@ -198,6 +196,20 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         List<Integer> personnelIdList = this.getpersonId();
         if (personnelIdList.size() <= 0) {
+            PatrolInspectionAbnormal patrolInspectionAbnormal = new PatrolInspectionAbnormal();
+            patrolInspectionAbnormal.setCreateTime(LocalDateTime.now());
+            patrolInspectionAbnormal.setCreator(SecurityUtils.getUsername());
+            patrolInspectionAbnormal.setPlanSonId(planSonId);
+            patrolInspectionAbnormal.setSiteId(siteId);
+            patrolInspectionAbnormal.setSiteNubmber(siteNubmber);
+            patrolInspectionAbnormal.setAbnormalStatus(2);
+            patrolInspectionAbnormal.setTenantId(SecurityUtils.getTenantId());
+            patrolInspectionAbnormal.setAreaName("未知区域1");
+            patrolInspectionAbnormal.setName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+            patrolInspectionAbnormal.setPhone(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
+            patrolInspectionAbnormal.setEndDate(LocalDateTime.now());
+            patrolInspectionAbnormal.setStartDate(LocalDateTime.now());
+            patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
             throw new BusinessException("该地点不在计划中");
         }
         LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
@@ -211,10 +223,38 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         }
         List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper);
         if (siteList.size() <= 0) {
+            PatrolInspectionAbnormal patrolInspectionAbnormal = new PatrolInspectionAbnormal();
+            patrolInspectionAbnormal.setCreateTime(LocalDateTime.now());
+            patrolInspectionAbnormal.setCreator(SecurityUtils.getUsername());
+            patrolInspectionAbnormal.setPlanSonId(planSonId);
+            patrolInspectionAbnormal.setSiteId(siteId);
+            patrolInspectionAbnormal.setSiteNubmber(siteNubmber);
+            patrolInspectionAbnormal.setAbnormalStatus(2);
+            patrolInspectionAbnormal.setTenantId(SecurityUtils.getTenantId());
+            patrolInspectionAbnormal.setAreaName("未知区域2");
+            patrolInspectionAbnormal.setName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+            patrolInspectionAbnormal.setPhone(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
+            patrolInspectionAbnormal.setEndDate(LocalDateTime.now());
+            patrolInspectionAbnormal.setStartDate(LocalDateTime.now());
+            patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
             throw new BusinessException("无效地点,请联系管理人员添加点位");
         }
         int planSonSiteCount = patrolInspectionPlanMapper.planSiteCount(personnelIdList, siteList.get(0).getId(), dateFormat.format(new Date()));
         if (planSonSiteCount <= 0) {
+            PatrolInspectionAbnormal patrolInspectionAbnormal = new PatrolInspectionAbnormal();
+            patrolInspectionAbnormal.setCreateTime(LocalDateTime.now());
+            patrolInspectionAbnormal.setCreator(SecurityUtils.getUsername());
+            patrolInspectionAbnormal.setPlanSonId(planSonId);
+            patrolInspectionAbnormal.setSiteId(siteId);
+            patrolInspectionAbnormal.setSiteNubmber(siteNubmber);
+            patrolInspectionAbnormal.setAbnormalStatus(2);
+            patrolInspectionAbnormal.setTenantId(SecurityUtils.getTenantId());
+            patrolInspectionAbnormal.setAreaName("未知区域3");
+            patrolInspectionAbnormal.setName(SecurityUtils.getLoginUser().getSysUser().getNickName());
+            patrolInspectionAbnormal.setPhone(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
+            patrolInspectionAbnormal.setEndDate(LocalDateTime.now());
+            patrolInspectionAbnormal.setStartDate(LocalDateTime.now());
+            patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
             throw new BusinessException("此地点尚未采集,请采集该点位");
         }
         Integer siteIdOne = 0;