Forráskód Böngészése

收藏事件列表增加图片返回

Memory_LG 1 hónapja
szülő
commit
e1b9ca1623

+ 6 - 0
src/main/java/com/sooka/sponest/event/centereventteventcollect/domain/CentereventTEventCollect.java

@@ -10,6 +10,7 @@ import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
 
 import javax.validation.constraints.NotBlank;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -195,4 +196,9 @@ public class CentereventTEventCollect extends BaseBusinessEntity {
 
     private List<CenterdataTAttach> attach;
 
+    private String picturePath;
+    private List<String> picturePathList = new ArrayList<>();
+    private String pictureSource;
+    private String pictureType;
+
 }

+ 48 - 8
src/main/java/com/sooka/sponest/event/centereventteventcollect/service/impl/CentereventTEventCollectServiceImpl.java

@@ -1,19 +1,28 @@
 package com.sooka.sponest.event.centereventteventcollect.service.impl;
 
-import java.util.List;
-
-import com.alibaba.nacos.common.utils.UuidUtils;
-import com.ruoyi.common.core.text.UUID;
+import com.ruoyi.common.core.utils.SpringUtils;
 import com.ruoyi.common.core.utils.StringUtils;
-import com.ruoyi.common.core.utils.uuid.IdUtils;
-import com.ruoyi.common.security.utils.DictUtils;
+import com.ruoyi.common.core.utils.file.FilePrefixUtils;
+import com.ruoyi.common.datascope.base.service.BaseService;
 import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.RemoteConfigService;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.bo.VisuForestCloudMapEventListBO;
+import com.sooka.sponest.event.centereventteventcatalogue.domain.vo.VisuForestCloudMapVO;
+import com.sooka.sponest.event.centereventteventcatalogue.mapper.CenterEventViewMapper;
 import com.sooka.sponest.event.centereventteventcollect.domain.CentereventTEventCollect;
 import com.sooka.sponest.event.centereventteventcollect.mapper.CentereventTEventCollectMapper;
 import com.sooka.sponest.event.centereventteventcollect.service.ICentereventTEventCollectService;
+import com.sooka.sponest.event.utils.RemoteApiUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static com.sooka.sponest.event.utils.EventConstants.*;
+
 /**
  * 事件收藏Service业务层处理
  *
@@ -21,10 +30,13 @@ import org.springframework.stereotype.Service;
  * @date 2025-06-24
  */
 @Service
-public class CentereventTEventCollectServiceImpl implements ICentereventTEventCollectService {
+public class CentereventTEventCollectServiceImpl extends BaseService implements ICentereventTEventCollectService {
     @Autowired
     private CentereventTEventCollectMapper centereventTEventCollectMapper;
 
+    @Autowired
+    private CenterEventViewMapper centerEventViewMapper;
+
     /**
      * 查询事件收藏
      *
@@ -47,7 +59,35 @@ public class CentereventTEventCollectServiceImpl implements ICentereventTEventCo
         if(StringUtils.isBlank(centereventTEventCollect.getUserId())){
             centereventTEventCollect.setUserId(SecurityUtils.getUserId().toString());
         }
-        return centereventTEventCollectMapper.selectCentereventTEventCollectList(centereventTEventCollect);
+        List<CentereventTEventCollect> result = centereventTEventCollectMapper.selectCentereventTEventCollectList(centereventTEventCollect);
+
+        if (StringUtils.isEmpty(result)) {
+            return result;
+        }
+        Map<String, String> keyMap = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigMap(Arrays.asList(FILE_PREFIX_LOCAL, FILE_PREFIX_HIK1, FILE_PREFIX_HIK2, FILE_PREFIX_DH1, FILE_PREFIX_DH2)).getData();
+        String token = RemoteApiUtil.getInstance().getToken();// 大华token
+
+        List<String> eventCodes = result.stream().map(CentereventTEventCollect::getEventCode).collect(Collectors.toList());
+//        centereventTEventCollect
+
+        VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO();
+        visuForestCloudMapVO.setEventStatus(eventCodes);
+        setSookaDataBase(visuForestCloudMapVO);
+        List<VisuForestCloudMapEventListBO> attachs = centerEventViewMapper.getEventFile(visuForestCloudMapVO);
+        result.forEach(event -> {
+            for (VisuForestCloudMapEventListBO attach : attachs) {
+                if (event.getEventCode().equals(attach.getEventCode())) {
+                    if ("DH_1".equals(attach.getPictureSource())) {
+                        event.setPicturePath(FilePrefixUtils.getUrlPrefix(attach.getPictureSource(), keyMap) + attach.getPicturePath() + "?token=" + token);
+                    } else {
+                        event.setPicturePath(FilePrefixUtils.getUrlPrefix(attach.getPictureSource(), keyMap) + attach.getPicturePath());
+                    }
+                    event.setPictureSource(attach.getReportSource());
+                    event.setPictureType(attach.getPictureType());
+                }
+            }
+        });
+        return result;
     }
 
     /**

+ 1 - 1
src/main/resources/mapper/centereventteventcollect/CentereventTEventCollectMapper.xml

@@ -4,7 +4,7 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sooka.sponest.event.centereventteventcollect.mapper.CentereventTEventCollectMapper">
 
-    <resultMap type="CentereventTEventcatalogue" id="CentereventTEventcatalogueResult">
+    <resultMap type="CentereventTEventCollect" id="CentereventTEventcatalogueResult">
         <result property="id" column="id"/>
         <result property="eventCode" column="event_code"/>
         <result property="eventType" column="event_type"/>