Parcourir la source

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/GeoHazardMonitor

 Conflicts:
	hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java
gao.qiang il y a 2 ans
Parent
commit
e9d9e6e39f

+ 2 - 2
.idea/compiler.xml

@@ -7,10 +7,10 @@
         <sourceOutputDir name="target/generated-sources/annotations" />
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
+        <module name="base-admin" />
+        <module name="hazard-admin" />
         <module name="hazard-sdk" />
         <module name="business-service" />
-        <module name="hazard-admin" />
-        <module name="base-admin" />
       </profile>
     </annotationProcessing>
     <bytecodeTargetLevel>

+ 15 - 15
.idea/jarRepositories.xml

@@ -2,8 +2,8 @@
 <project version="4">
   <component name="RemoteRepositoriesConfiguration">
     <remote-repository>
-      <option name="id" value="public" />
-      <option name="name" value="aliyun nexus" />
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
       <option name="url" value="https://maven.aliyun.com/repository/public" />
     </remote-repository>
     <remote-repository>
@@ -11,6 +11,16 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="https://repo.maven.apache.org/maven2" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="public" />
+      <option name="name" value="aliyun nexus" />
+      <option name="url" value="https://maven.aliyun.com/repository/public" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
     <remote-repository>
       <option name="id" value="central" />
       <option name="name" value="Central Repository" />
@@ -26,25 +36,15 @@
       <option name="name" value="Central Repository" />
       <option name="url" value="http://maven.aliyun.com/nexus/content/repositories/central/" />
     </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Maven Central repository" />
-      <option name="url" value="https://repo1.maven.org/maven2" />
-    </remote-repository>
-    <remote-repository>
-      <option name="id" value="jboss.community" />
-      <option name="name" value="JBoss Community repository" />
-      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
-    </remote-repository>
     <remote-repository>
       <option name="id" value="custom_group" />
       <option name="name" value="Nexus Repository" />
       <option name="url" value="http://124.71.171.71:18881/repository/custom_group/" />
     </remote-repository>
     <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Central Repository" />
-      <option name="url" value="https://maven.aliyun.com/repository/public" />
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
     </remote-repository>
   </component>
 </project>

+ 75 - 0
business-service/src/main/java/com/ozs/service/entity/MsgAppPush.java

@@ -0,0 +1,75 @@
+package com.ozs.service.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.ozs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("app推送报警信息记录表")
+public class MsgAppPush extends BaseEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 报警唯一标识
+     */
+    private String alarmId;
+
+    /**
+     * 接收人
+     */
+    private Long recipient;
+
+    /**
+     * 状态:0未读;1已读
+     */
+    private Integer status;
+
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 修改人
+     */
+    private String updateBy;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 16 - 0
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatistic.java

@@ -0,0 +1,16 @@
+package com.ozs.service.entity.vo;
+
+import lombok.Data;
+
+/**统计管理页面强求参数
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Data
+public class AlarmStatistic {
+    /**
+     * 报警线路
+     */
+    private String alarmLine;
+}

+ 2 - 1
business-service/src/main/java/com/ozs/service/entity/vo/MsgAlarmVo.java

@@ -71,5 +71,6 @@ public class MsgAlarmVo extends PageVo implements Serializable {
      * 报警是否解除 1已解除2未解除
      */
     private Integer isLock;
-    
+
+
 }

+ 57 - 0
business-service/src/main/java/com/ozs/service/entity/vo/MsgAppPushVo.java

@@ -0,0 +1,57 @@
+package com.ozs.service.entity.vo;
+
+import com.ozs.common.vo.PageVo;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Data
+public class MsgAppPushVo extends PageVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 报警唯一标识
+     */
+    private String alarmId;
+
+    /**
+     * 接收人
+     */
+    private Long recipient;
+
+    /**
+     * 状态:0未读;1已读
+     */
+    private Integer status;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 修改人
+     */
+    private String updateBy;
+
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 15 - 0
business-service/src/main/java/com/ozs/service/mapper/MsgAppPushMapper.java

@@ -0,0 +1,15 @@
+package com.ozs.service.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ozs.service.entity.MsgAppPush;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Mapper
+public interface MsgAppPushMapper extends BaseMapper<MsgAppPush> {
+
+}

+ 28 - 0
business-service/src/main/java/com/ozs/service/params/UserLoginParams.java

@@ -0,0 +1,28 @@
+package com.ozs.service.params;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class UserLoginParams {
+
+    /**
+     * 用户名
+     */
+    @ApiModelProperty("用户名")
+    private String username;
+
+    /**
+     * 密码
+     */
+    @ApiModelProperty("密码")
+    private String password;
+
+    /**
+     * 验证码
+     */
+    @ApiModelProperty("验证码")
+    private String securityCode;
+}

+ 20 - 0
business-service/src/main/java/com/ozs/service/service/MsgAppPushService.java

@@ -0,0 +1,20 @@
+package com.ozs.service.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ozs.service.entity.MsgAppPush;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+public interface MsgAppPushService extends IService<MsgAppPush> {
+    /**
+     * 修改app推送报警信息记录为已读
+     * @param id
+     * @param
+     * @return
+     */
+    //MsgAppPush updateStatus(Long id);
+
+}

+ 17 - 0
business-service/src/main/java/com/ozs/service/service/impl/MsgAppPushServiceImpl.java

@@ -0,0 +1,17 @@
+package com.ozs.service.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ozs.service.entity.MsgAppPush;
+import com.ozs.service.mapper.MsgAppPushMapper;
+import com.ozs.service.service.MsgAppPushService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@Service
+public class MsgAppPushServiceImpl extends ServiceImpl<MsgAppPushMapper, MsgAppPush> implements MsgAppPushService {
+
+}

+ 136 - 0
hazard-admin/src/main/java/com/ozs/web/controller/app/GeoHazardMineController.java

@@ -0,0 +1,136 @@
+package com.ozs.web.controller.app;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ozs.common.core.controller.BaseController;
+import com.ozs.common.core.domain.AjaxResult;
+
+import com.ozs.service.entity.MsgAppPush;
+import com.ozs.service.entity.vo.MsgAppPushVo;
+import com.ozs.service.service.MsgAppPushService;
+import com.ozs.system.service.ISysUserService;
+import com.ozs.web.controller.tool.ImgUtil;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.UUID;
+
+/**
+ * @author wyy
+ * @subject
+ * @creat 2023/3/6
+ */
+@RestController
+@RequestMapping("/app/mine")
+@Slf4j
+public class GeoHazardMineController extends BaseController {
+    @Value("${file.avatarUrl:#{null}}")
+    private String avatarURL;
+    @Value("${file.filreUrl:#{null}}")
+    private String fileUrl;
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private MsgAppPushService msgAppPushService;
+
+    /**
+     * 修改头像
+     */
+    @PostMapping("/updateAvatar")
+    @ApiOperation("app修改头像")
+    public AjaxResult updateAvatar(MultipartFile image, Long userId) {
+
+        String imageUrl = null;
+        try {
+            if (image != null) {
+                //获取文件名
+                String fileName = image.getOriginalFilename();
+                if (org.springframework.util.StringUtils.isEmpty(fileName) || image.getSize() == 0) {
+                    throw new Exception("图像文件不能为空!");
+                }
+                //验证文件名是否合格
+                if (!ImgUtil.isImg(fileName)) {
+                    throw new Exception("图像文件必须是图片格式!");
+                }
+                String saveFileName = UUID.randomUUID().toString();
+                File saveDirFile = new File(avatarURL);
+                if (!saveDirFile.exists()) {
+                    saveDirFile.mkdirs();
+                }
+                File picFullFile = new File(saveDirFile.getAbsolutePath(), saveFileName);
+                FileOutputStream fos = new FileOutputStream(picFullFile);
+                fos.write(image.getBytes());
+                imageUrl = fileUrl + avatarURL + saveFileName;
+                sysUserService.updateUserAvatarById(userId, imageUrl);
+            } else {
+                throw new Exception("上传文件不能为空");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return AjaxResult.success(imageUrl);
+    }
+
+    /**
+     * 修改密码
+     */
+    @RequestMapping(value = "/updateAvatar", method = RequestMethod.POST)
+    @ApiOperation("app修改密码")
+    public AjaxResult updateAvatar(@RequestParam("userId") Long userId,@RequestParam("newPwd") String newPwd) {
+        sysUserService.updatePassword(userId,newPwd);
+        return AjaxResult.success();
+    }
+
+    /**
+     * app推送报警信息记录分页显示(全部信息)
+     */
+    @RequestMapping(value = "allList", method = RequestMethod.POST)
+    @ApiOperation("app推送报警信息记录分页显示(全部信息)")
+    public AjaxResult allList(@RequestBody MsgAppPushVo msgAppPushVo) {
+        QueryWrapper<MsgAppPush> queryWrapper = new QueryWrapper<MsgAppPush>();
+        IPage<MsgAppPush> page = msgAppPushService.page(new Page<>(msgAppPushVo.getPageNum(), msgAppPushVo.getPageSize()), queryWrapper);
+        return AjaxResult.success(page);
+    }
+    /**
+     * app推送报警信息记录分页显示(未读信息)
+     */
+    @RequestMapping(value = "unReadList", method = RequestMethod.POST)
+    @ApiOperation("app推送报警信息记录分页显示(未读信息)")
+    public AjaxResult unReadList(@RequestBody MsgAppPushVo msgAppPushVo) {
+        LambdaQueryWrapper<MsgAppPush> queryWrapper = new LambdaQueryWrapper<MsgAppPush>();
+        if (!ObjectUtils.isEmpty(msgAppPushVo.getStatus())) {
+            queryWrapper.eq(MsgAppPush::getStatus, 0);
+        }
+        IPage<MsgAppPush> page = msgAppPushService.page(new Page<>(msgAppPushVo.getPageNum(), msgAppPushVo.getPageSize()), queryWrapper);
+        return AjaxResult.success(page);
+    }
+    /**
+     * app推送报警信息记录分页显示(已读信息)
+     */
+    @RequestMapping(value = "readList", method = RequestMethod.POST)
+    @ApiOperation("app推送报警信息记录分页显示(已读信息)")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(paramType = "query", name = "caseMonth", value = "分析年份"),
+            @ApiImplicitParam(paramType = "query", name = "current", value = "当前页数"),
+    })
+    public AjaxResult readList(@RequestBody MsgAppPushVo msgAppPushVo) {
+        LambdaQueryWrapper<MsgAppPush> queryWrapper = new LambdaQueryWrapper<MsgAppPush>();
+        if (!ObjectUtils.isEmpty(msgAppPushVo.getStatus())) {
+            queryWrapper.eq(MsgAppPush::getStatus, 1);
+        }
+        IPage<MsgAppPush> page = msgAppPushService.page(new Page<>(msgAppPushVo.getPageNum(), msgAppPushVo.getPageSize()), queryWrapper);
+        return AjaxResult.success(page);
+    }
+}
+

+ 2 - 4
hazard-admin/src/main/java/com/ozs/web/controller/system/SysLoginController.java

@@ -3,10 +3,7 @@ package com.ozs.web.controller.system;
 import java.util.List;
 import java.util.Set;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ozs.common.constant.Constants;
 import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysMenu;
@@ -23,6 +20,7 @@ import com.ozs.system.service.ISysMenuService;
  * @author ruoyi
  */
 @RestController
+@RequestMapping("/app")
 public class SysLoginController
 {
     @Autowired

+ 53 - 12
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -7,6 +7,7 @@ import com.ozs.common.exception.base.BaseException;
 import com.ozs.common.utils.DateUtils;
 import com.ozs.common.utils.http.HttpUtils;
 import com.ozs.web.core.config.CaneraConfig;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -22,6 +23,7 @@ import java.util.regex.Pattern;
  * 相机工具
  */
 @Component
+@Slf4j
 public class CameraUtil {
 
     private static String url;
@@ -43,6 +45,8 @@ public class CameraUtil {
     public static String historyPlay(List<String> fromVideoFileList, String ph) throws IOException {
         // 视频服务映射路径
         String NewfilePath = BaseConfig.getProfile() + ph;
+        log.info("NewfilePath:{}", NewfilePath);
+        log.info("fromVideoFileList:{}", fromVideoFileList);
         convetor(fromVideoFileList, NewfilePath);
         return "/profile" + ph;
     }
@@ -67,7 +71,7 @@ public class CameraUtil {
     }
 
 
-    public static String historyPlayList(String channel, Date startTm, Date endTm) {
+    public static List<String> historyPlayList(String channel, Date startTm, Date endTm) {
         if (StringUtils.isBlank(channel)
                 || ObjectUtils.isEmpty(startTm)
                 || ObjectUtils.isEmpty(endTm)) {
@@ -77,14 +81,14 @@ public class CameraUtil {
         List<String> ls = new ArrayList<>();
         // 调用视频服务返回参数
         String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm);
-        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm);
+        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endTm);
         String ph = "/flv/" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date())
                 + "/" + channel + "/" + startTime + "/" + endTime + "/"
                 + UUID.randomUUID().toString() + ".flv";
         String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime;
         String s = HttpUtils.sendGet(historyUrl + "/api/record/flv/list", param);
         // 视频拼接
-        if (!StringUtils.isBlank(s)) {
+        if (!StringUtils.isBlank(s) || "null".equals(s)) {
             List<Map<String, Object>> maps = JSON.parseArray(s, Map.class);
             for (Map<String, Object> map : maps) {
                 Object path = map.get("Path");
@@ -99,19 +103,19 @@ public class CameraUtil {
                         Date sdate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s3);
                         Date edate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s4);
                         /*     s | e     | */
-                        if (sdate.compareTo(startTm) <= 0 && edate.compareTo(startTm) > 0) {
+                        if (startTm.compareTo(sdate) <= 0 && endTm.compareTo(edate) > 0) {
                             ls.add(mappingUrl + path.toString());
 
                             /*  |   s    e    | */
-                        } else if (sdate.compareTo(startTm) >= 0 && edate.compareTo(endTm) <= 0) {
+                        } else if (startTm.compareTo(sdate) >= 0 && endTm.compareTo(edate) <= 0) {
                             ls.add(mappingUrl + path.toString());
 
                             /*  |   s     |  e  */
-                        } else if (sdate.compareTo(startTm) >= 0 && edate.compareTo(endTm) >= 0) {
+                        } else if (startTm.compareTo(sdate) >= 0 && endTm.compareTo(edate) >= 0) {
                             ls.add(mappingUrl + path.toString());
 
                             /*  s|      | e  */
-                        } else if (sdate.compareTo(startTm) <= 0 && edate.compareTo(endTm) >= 0) {
+                        } else if (startTm.compareTo(sdate) <= 0 && endTm.compareTo(edate) >= 0) {
                             ls.add(mappingUrl + path.toString());
                         }
                     }
@@ -119,11 +123,12 @@ public class CameraUtil {
             }
         }
         if (!ObjectUtils.isEmpty(ls)) {
-            try {
-                return historyPlay(ls, ph);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+            return ls;
+//            try {
+//                return historyPlay(ls, ph);
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
         }
         return null;
     }
@@ -144,6 +149,7 @@ public class CameraUtil {
      */
     public static void convetor(List<String> fromVideoFileList,
                                 String NewfilePath) throws IOException {
+
         new Thread(
                 () -> {
                     try {
@@ -255,4 +261,39 @@ public class CameraUtil {
     }
 
 
+    /**
+     * 合并多个视频文件
+     */
+    public static void mergeFile(List<String> fromVideoFileList, String NewfilePath) {
+        // 合并命令
+        String commit = "$0 -f concat -safe 0 -i $1 -c copy $2";
+
+        String str = commit.replace("$0", ffmpegPath);
+        if (!ObjectUtils.isEmpty(fromVideoFileList)) {
+            for (String s : fromVideoFileList) {
+                str = str.replace("$1", s);
+            }
+        }
+        str = str.replace("$2", NewfilePath);
+        System.out.println(str);
+        Runtime runtime = Runtime.getRuntime();
+        try {
+            Process proce = runtime.exec(str);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) throws IOException {
+
+        List<String> fromVideoFileList = new ArrayList();
+        String p = "C:\\Users\\Administrator.DESKTOP-0NUUTMM\\Desktop\\work\\106\\流媒体\\";
+        String NewfilePath = p + "mergevideo.flv";
+        fromVideoFileList.add(p + "20230303_174931_175031-d6d56396-b9a8-11ed-aeb9-00163e06a5f3.flv");
+        fromVideoFileList.add(p + "20230303_175032_175132-fb32b9fe-b9a8-11ed-aeb9-00163e06a5f3.flv");
+        fromVideoFileList.add(p + "20230303_175133_175233-1f97af04-b9a9-11ed-aeb9-00163e06a5f3.flv");
+        fromVideoFileList.add(p + "20230303_175234_175334-43f4daf1-b9a9-11ed-aeb9-00163e06a5f3.flv");
+        convetor(fromVideoFileList, NewfilePath);
+
+    }
 }

+ 8 - 2
hazard-admin/src/main/resources/application.yml

@@ -9,12 +9,13 @@ base:
   # 实例演示开关
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: /data/service/hazard-admin/uploadPath
+  #  profile: /data/service/hazard-admin/uploadPath
+  profile: C:\base\uploadPath
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
   captchaType: math
-#  path: http://47.106.159.135:8554
+  #  path: http://47.106.159.135:8554
   path: http://47.106.159.135:8554
   ffmpegPath: /usr/local/ffmpeg/bin/ffmpeg
 
@@ -152,3 +153,8 @@ minio:
   bucketName: picbucket #存储桶名称
   accessKey: admin #访问的key
   secretKey: admin123 #访问的秘钥
+file:
+  #头像存储目录
+  avatarUrl: /data/service/avatar/
+  #文件访问前缀
+  filreUrl: http://124.71.171.71:18878