Pārlūkot izejas kodu

修改图片替换路径公共方法,删除调用时的冗余参数。
修改手机端查询视联网,物联网,云广播详情接口,修改图片路径

Wang-Xiao-Ran 1 gadu atpakaļ
vecāks
revīzija
d005a0bf53

+ 3 - 3
src/main/java/com/sooka/sponest/mobile/appbigdata/controller/AppBigDataController.java

@@ -344,7 +344,7 @@ public class AppBigDataController extends VisuBaseService {
         AjaxResult ajaxResult = remoteDataBaseService.getKeyProjects(deptId);
         if ("200".equals(ajaxResult.get("code").toString())) {
             List<LinkedHashMap<String, Object>> list = (List<LinkedHashMap<String, Object>>) ajaxResult.get("data");
-            PictureReplaceAll.replaceAllPictureUrl(list, "photoId", "fileUrl", "appUrl");
+            PictureReplaceAll.replaceAllPictureUrl(list, "photoId");
         }
         return ajaxResult;
     }
@@ -363,7 +363,7 @@ public class AppBigDataController extends VisuBaseService {
         TableDataInfo keyProjectsByParams = remoteDataBaseService.getKeyProjectsByParams(bo.getPageNum(), bo.getPageSize(), bo.getDeptId(), bo.getPark(), bo.getProjectName(), bo.getTerritoriality(), bo.getNature());
         if (HttpStatus.SUCCESS == keyProjectsByParams.getCode()) {
             List<LinkedHashMap<String, Object>> list = (List<LinkedHashMap<String, Object>>) keyProjectsByParams.getRows();
-            PictureReplaceAll.replaceAllPictureUrl(list, "photoId", "fileUrl", "appUrl");
+            PictureReplaceAll.replaceAllPictureUrl(list, "photoId");
             return AjaxResult.success(list);
         } else {
             return AjaxResult.error(keyProjectsByParams.getMsg());
@@ -376,7 +376,7 @@ public class AppBigDataController extends VisuBaseService {
         AjaxResult ajaxResult = remoteDataBaseService.appGetScheduleByTime(bo.getKeyProjectsId(), bo.getStartTime(), bo.getEndTime());
         if ("200".equals(ajaxResult.get("code").toString())) {
             List<LinkedHashMap<String, Object>> list = (List<LinkedHashMap<String, Object>>) ajaxResult.get("data");
-            PictureReplaceAll.replaceAllPictureUrl(list, "schedulePictures", "fileUrl", "appUrl");
+            PictureReplaceAll.replaceAllPictureUrl(list, "schedulePictures");
         }
         return ajaxResult;
     }

+ 1 - 1
src/main/java/com/sooka/sponest/mobile/appbigdata/controller/AppBigDataCountController.java

@@ -81,7 +81,7 @@ public class AppBigDataCountController extends VisuBaseService {
             if(data.containsKey("pictures")){
                 List<String> pictures = (List<String>) data.get("pictures");
                 if(!pictures.isEmpty()){
-                    List<String> strList = PictureReplaceAll.replacePicturesList(pictures, "fileUrl", "appUrl");
+                    List<String> strList = PictureReplaceAll.replacePicturesList(pictures);
                     data.put("pictures", strList);
                 }
             }

+ 23 - 3
src/main/java/com/sooka/sponest/mobile/system/camera/controller/AppCameraController.java

@@ -8,6 +8,7 @@ import com.sooka.sponest.mobile.remoteapi.RemoteMonitorBaseService;
 import com.sooka.sponest.mobile.remoteapi.RemoteSystemBaseService;
 import com.sooka.sponest.mobile.system.camera.domain.*;
 import com.sooka.sponest.mobile.system.camera.service.AppCameraService;
+import com.sooka.sponest.mobile.utils.PictureReplaceAll;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 
@@ -262,16 +263,35 @@ public class AppCameraController extends AppBaseController {
      */
     @GetMapping("/getCameraById")
     public AjaxResult getCameraByCameraId(@RequestParam("id") String id, @RequestParam("type") String type){
+        AjaxResult result;
         if("1".equals(type)){
-            return remoteMonitorBaseService.selectByCameraId(id);
+            result = remoteMonitorBaseService.selectByCameraId(id);
         }else if("2".equals(type)){
-            return remoteMonitorBaseService.selectByDeviceId(id);
+            result = remoteMonitorBaseService.selectByDeviceId(id);
         }else if("3".equals(type)){
-            return remoteMonitorBaseService.selectByBroadcastId(id);
+            result = remoteMonitorBaseService.selectByBroadcastId(id);
         }else{
             return AjaxResult.error("Request type is not found!");
         }
 
+        if("200".equals(result.get("code").toString())){
+            StringBuilder urlType = new StringBuilder();
+           Map<String, Object> data = (Map<String, Object>) result.get("data");
+            if("1".equals(type)){
+                urlType.append("cameraImagesList");
+            }else if("2".equals(type)){
+                urlType.append("deviceImagesList");
+            }else if("3".equals(type)){
+                urlType.append("broadcastImagesList");
+            }
+            List<LinkedHashMap<String, Object>> dataList = (List<LinkedHashMap<String, Object>>) data.get(urlType.toString());
+            PictureReplaceAll.replaceAllPictureUrl(dataList, "url");
+            data.put(urlType.toString(),dataList);
+            return AjaxResult.success(data);
+        }else{
+            return result;
+        }
+
     }
 
 }

+ 1 - 1
src/main/java/com/sooka/sponest/mobile/system/mainpage/service/impl/AppMainPageServiceImpl.java

@@ -29,7 +29,7 @@ public class AppMainPageServiceImpl implements AppMainPageService {
         AjaxResult ajax = new AjaxResult();
         TableDataInfo info = remoteSystemBaseService.selectList();
         List<LinkedHashMap<String, Object>> list = (List<LinkedHashMap<String, Object>>) info.getRows();
-        PictureReplaceAll.replaceAllPictureUrl(list,"path", "fileUrl", "appUrl");
+        PictureReplaceAll.replaceAllPictureUrl(list,"path");
         ajax.put("total", info.getTotal());
         ajax.put("list", list);
         return AjaxResult.success(ajax);

+ 6 - 6
src/main/java/com/sooka/sponest/mobile/utils/PictureReplaceAll.java

@@ -17,9 +17,9 @@ public class PictureReplaceAll {
      * @author LG
      * @Date  2023/8/16 22:52
      */
-    public static void replaceAllPictureUrl(List<LinkedHashMap<String, Object>> list, String replaceKey, String oldIpKey, String newIpKey) {
-        String oldIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey(oldIpKey).getData();
-        String newIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey(newIpKey).getData();
+    public static void replaceAllPictureUrl(List<LinkedHashMap<String, Object>> list, String replaceKey) {
+        String oldIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("fileUrl").getData();
+        String newIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("appUrl").getData();
         list.replaceAll(map -> replaceSchedulePictures(map, replaceKey, oldIp, newIp));
     }
 
@@ -29,10 +29,10 @@ public class PictureReplaceAll {
         return map;
     }
 
-    public static List<String> replacePicturesList(List<String> picturesList, String oldIdKey, String newIpKey){
+    public static List<String> replacePicturesList(List<String> picturesList){
         List<String> result = new ArrayList<>();
-        String oldIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey(oldIdKey).getData();
-        String newIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey(newIpKey).getData();
+        String oldIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("fileUrl").getData();
+        String newIp = SpringUtils.getBean(RemoteConfigService.class).remotegetConfigKey("appUrl").getData();
         picturesList.forEach(s->{
             result.add(s.replaceAll(oldIp, newIp));
         });