lyq 1 rok temu
rodzic
commit
d301461f59

+ 7 - 3
src/main/java/com/sooka/sponest/mobile/event/service/impl/AppEventServiceImpl.java

@@ -9,6 +9,7 @@ import com.sooka.sponest.mobile.remoteapi.RemoteDataBaseService;
 import com.sooka.sponest.mobile.remoteapi.RemoteEventBaseService;
 import com.sooka.sponest.mobile.remoteapi.RemoteMonitorBaseService;
 import com.sooka.sponest.mobile.remoteapi.RemoteSystemBaseService;
+import org.apache.commons.collections4.MapUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -100,16 +101,19 @@ public class AppEventServiceImpl implements AppEventService {
             if (dahuaFile) {
                 token = remoteMonitorService.getToken();
             }
+            Map<String, String> keyMap = remoteSystemBaseService.remotegetConfigMap(Arrays.asList("downloadUrl", "appUrl", "HIK_1", "HIK_2", "DH_1", "DH_2")).getData();
             String finalToken = token;
             appEventSalBO.getAttachs().forEach(item -> {
+                String urlPrefix = FilePrefixUtils.getAPPUrlPrefix(item.getBusSource(), keyMap);
                 if ("DH_1".equals(item.getBusSource())) {
                     item.setAttachPath(DH1 + item.getAttachPath() + "?token=" + finalToken);
-                } else {
+                } else if ("DH_2".equals(item.getBusSource())) {
                     item.setAttachPath(DH2 + item.getAttachPath());
+                } else {
+                    item.setAttachPath(urlPrefix + item.getAttachPath());
                 }
             });
-            String prefix = remoteSystemBaseService.selectConfigKey("appUrl").getData();
-            appEventSalBO.getAttachsMpf().forEach(item -> item.setAttachPath(prefix + item.getAttachPath()));
+            appEventSalBO.getAttachsMpf().forEach(item -> item.setAttachPath(MapUtils.getString(keyMap, "appUrl") + item.getAttachPath()));
             return AjaxResult.success(appEventSalBO);
         } catch (Exception e) {
             log.error(e.getMessage());