Browse Source

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

 Conflicts:
	hazard-admin/src/main/resources/application.yml
gao.qiang 2 years ago
parent
commit
30242f3a39

+ 12 - 12
.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,11 +36,6 @@
       <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="custom_group" />
       <option name="name" value="Nexus Repository" />
@@ -41,10 +46,5 @@
       <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="central" />
-      <option name="name" value="Central Repository" />
-      <option name="url" value="https://maven.aliyun.com/repository/public" />
-    </remote-repository>
   </component>
 </project>

+ 3 - 3
business-service/src/main/java/com/ozs/service/entity/vo/AlarmStatisticMonthDto.java

@@ -21,7 +21,7 @@ public class AlarmStatisticMonthDto {
     /**
      * 线路名称
      */
-    @Excel(name = "线路名称")
+    //@Excel(name = "线路名称")
     private String railwayName;
 
     /**
@@ -32,7 +32,7 @@ public class AlarmStatisticMonthDto {
     /**
      * 报警类型
      */
-    @Excel(name = "报警类型")
+    //@Excel(name = "报警类型")
     private String alarmTypeValue;
 
     /**
@@ -51,6 +51,6 @@ public class AlarmStatisticMonthDto {
      * 报警时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "报警时间")
+    //@Excel(name = "报警时间")
     private Date alarmTime;
 }

+ 1 - 1
business-service/src/main/java/com/ozs/service/service/MsgAlarmService.java

@@ -24,7 +24,7 @@ public interface MsgAlarmService extends IService<MsgAlarm> {
     IPage<AlarmStatisticVo> list(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, Integer pageNum, Integer pageSize, String userId);
 
     //web数据统计 报警月统计数据
-    List<AlarmStatisticVo> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId);
+    List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId);
 
     //报警数据详情导出数据集合
     List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId);

+ 2 - 16
business-service/src/main/java/com/ozs/service/service/impl/MsgAlarmServiceImpl.java

@@ -61,8 +61,8 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     }
 
     @Override
-    public List<AlarmStatisticVo> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId) {
-        List<AlarmStatisticVo> list = msgAlarmMapper.listMonth(railwayCode, startMonth, endMonth, alarmType, userId);
+    public List<AlarmStatisticMonthDto> getCount(String railwayCode, Integer startMonth, Integer endMonth, String alarmType, String userId) {
+        List<AlarmStatisticMonthDto> list = msgAlarmMapper.listDtoMonth(railwayCode, startMonth, endMonth, alarmType, userId);
         return list;
     }
 
@@ -70,15 +70,6 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     public List<AlarmStatisticDto> exportExcel(AlarmStatisticResVo alarmStatisticResVo, String userId) {
         List<AlarmStatisticDto> listDto = msgAlarmMapper.listDto(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
                 alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        listDto.forEach(l -> {
-            String alarmType = l.getAlarmType();
-            String alarmTypeValue = baseDictDataMapper.selectDictLabel("sys_alarm_type", alarmType);
-            l.setAlarmTypeValue(alarmTypeValue);
-
-            String lineDir = l.getLineDir();
-            String lineDirValue = baseDictDataMapper.selectDictLabel("sys_line_dir", lineDir);
-            l.setLineDirValue(lineDirValue);
-        });
         return listDto;
     }
 
@@ -86,11 +77,6 @@ public class MsgAlarmServiceImpl extends ServiceImpl<MsgAlarmMapper, MsgAlarm> i
     public List<AlarmStatisticMonthDto> exportExcelMonth(AlarmStatisticResVo alarmStatisticResVo, String userId) throws Exception {
         List<AlarmStatisticMonthDto> listDto = msgAlarmMapper.listDtoMonth(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
                 alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
-        listDto.forEach(l -> {
-            String alarmType = l.getAlarmType();
-            String alarmTypeValue = baseDictDataMapper.selectDictLabel("sys_alarm_type", alarmType);
-            l.setAlarmTypeValue(alarmTypeValue);
-        });
         return listDto;
     }
 

+ 6 - 62
business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml

@@ -78,57 +78,6 @@
         group by a.alarm_id
     </select>
 
-    <select id="listMonth" resultMap="AlarmStatisticVoResult">
-        SELECT
-        a.alarm_id ,
-        MONTH(a.alarm_time) as monthsta,
-        count(DISTINCT a.alarm_id) as frequency,
-        a.camera_code ,
-        a.alarm_time ,
-        a.alarm_mile ,
-        a.content ,
-        a.alarm_confidence,
-        a.line_dir ,
-        a.alarm_type ,
-        a.alarm_attr ,
-        a.image_url ,
-        a.released_by ,
-        a.released_time,
-        a.is_lock ,
-        b.railway_code AS railway_code,
-        b.channel AS channel,
-        b.install_mile AS install_mile,
-        b.begin_mile AS begin_mile,
-        b.end_mile AS end_mile,
-        b.install_longitude AS install_longitude,
-        b.install_latitude AS install_latitude
-        FROM
-        msg_alarm AS a left join
-        base_camera_management AS b on a.camera_code=b.camera_code left join
-        msg_web_push m on a.alarm_id = m.alarm_id
-
-        <where>
-            <if test="railwayCode != null and railwayCode != ''">
-                and UPPER(b.railway_code) like UPPER(CONCAT('%',#{railwayCode},'%'))
-            </if>
-            <if test="startMonth != null and startMonth != 0">
-                <![CDATA[and MONTH(a.alarm_time) >=#{startMonth}]]>
-            </if>
-            <if test="endMonth != null and endMonth != 0">
-                <![CDATA[and MONTH(a.alarm_time) <=#{endMonth}]]>
-            </if>
-            <if test="alarmType != null and alarmType != ''">
-                and UPPER(a.alarm_type) like UPPER(CONCAT('%',#{alarmType},'%'))
-            </if>
-            <if test="userId != null and userId != ''">
-                and UPPER(m.receive_by) like UPPER(CONCAT('%',#{userId},'%'))
-            </if>
-            and YEAR(a.alarm_time) = YEAR(SYSDATE())
-        </where>
-        group by a.alarm_id,MONTH(a.alarm_time)
-
-    </select>
-
     <resultMap id="AlarmStatisticDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticDto">
         <id column="id" property="id"/>
         <result column="alarmId" property="alarmId"/>
@@ -180,21 +129,16 @@
     </select>
     <resultMap id="AlarmStatisticMonthDtoResult" type="com.ozs.service.entity.vo.AlarmStatisticMonthDto">
         <id column="id" property="id"/>
-        <result column="alarmId" property="alarmId"/>
-        <result column="railwayName" property="railwayName"/>
-        <result column="alarmType" property="alarmType"/>
-        <result column="alarmTime" property="alarmTime"/>
         <result column="monthsta" property="monthsta"/>
         <result column="frequency" property="frequency"/>
+        <result column="alarm_type" property="alarmType"/>
     </resultMap>
     <select id="listDtoMonth" resultMap="AlarmStatisticMonthDtoResult">
-        SELECT
-        a.alarm_id AS alarmId,
+        SELECT p.monthsta,SUM(p.fre) as frequency
+        from
+        (SELECT
         MONTH(a.alarm_time) as monthsta,
-        count(DISTINCT a.alarm_id) as frequency,
-        a.alarm_type AS alarmType,
-        a.alarm_time AS alarmTime,
-        c.railway_name AS railwayName
+        count(DISTINCT a.alarm_id) as fre
         FROM
         msg_alarm AS a left join
         base_camera_management AS b on a.camera_code=b.camera_code left join
@@ -219,7 +163,7 @@
             </if>
             and YEAR(a.alarm_time) = YEAR(SYSDATE())
         </where>
-        group by a.alarm_id,MONTH(a.alarm_time)
+        group by a.alarm_id,MONTH(a.alarm_time)) AS p
     </select>
 
     <select id="selectCameraCode" parameterType="java.lang.String" resultType="java.util.Map">

+ 11 - 1
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -80,6 +80,7 @@ public class MsgAlarmController extends BaseController {
     @Autowired
     private ISysDictDataService dictDataService;
 
+
     /**
      * web更多消息-总数,已读数
      */
@@ -311,7 +312,7 @@ public class MsgAlarmController extends BaseController {
         if ("1".equals(userId)) {
             userId = "";
         }
-        List<AlarmStatisticVo> list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
+        List<AlarmStatisticMonthDto> list = msgAlarmService.getCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getStartMonth(),
                 alarmStatisticResVo.getEndMonth(), alarmStatisticResVo.getAlarmType(), userId);
         return AjaxResult.success(list);
     }
@@ -338,6 +339,15 @@ public class MsgAlarmController extends BaseController {
         }
         try {
             List<AlarmStatisticDto> list = msgAlarmService.exportExcel(alarmStatisticResVo, userId);
+            list.forEach(l -> {
+                String alarmType = l.getAlarmType();
+                String alarmTypeValue = dictDataService.selectDictLabel("sys_alarm_type", alarmType);
+                l.setAlarmTypeValue(alarmTypeValue);
+
+                String lineDir = l.getLineDir();
+                String lineDirValue = dictDataService.selectDictLabel("sys_line_dir", lineDir);
+                l.setLineDirValue(lineDirValue);
+            });
             ExcelUtil<AlarmStatisticDto> util = new ExcelUtil<>(AlarmStatisticDto.class);
             util.exportExcel(response, list, "报警数据详情");
         } catch (Exception e) {

+ 36 - 28
hazard-admin/src/main/java/com/ozs/web/controller/app/GeoHazardMineController.java

@@ -8,6 +8,11 @@ import com.ozs.common.core.controller.BaseController;
 import com.ozs.common.core.domain.AjaxResult;
 
 import com.ozs.common.utils.ImgUtil;
+import com.ozs.common.utils.MinioUtils;
+import com.ozs.common.utils.StringUtils;
+import com.ozs.common.utils.uuid.IdUtils;
+import com.ozs.service.entity.BaseCameraManagement;
+import com.ozs.service.entity.BaseRailwayManagement;
 import com.ozs.service.entity.MsgAppPush;
 import com.ozs.service.entity.vo.MsgAppPushVo;
 import com.ozs.service.service.MsgAppPushService;
@@ -22,8 +27,11 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.UUID;
 
@@ -44,43 +52,43 @@ public class GeoHazardMineController extends BaseController {
     private ISysUserService sysUserService;
     @Autowired
     private MsgAppPushService msgAppPushService;
+    @Resource
+    private MinioUtils minioUtils;
+    @Value("${base.imgUrl}")
+    private String imgUrl;
 
     /**
      * 修改头像
      */
     @PostMapping("/updateAvatar")
     @ApiOperation("app修改头像")
-    public AjaxResult updateAvatar(MultipartFile image, String 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();
+    public AjaxResult updateAvatar(@RequestParam("image") MultipartFile image, @RequestParam("userId") String userId) {
+        if (image.isEmpty()) {
+            return AjaxResult.error("不能上传空文件哦");
+        }
+        //图片保存路径
+        //String fileUploadPath ="/"+userId+"/image";
+        String uploadFile = null;
+        if (image != null && !image.isEmpty()) {
+            String imageName = image.getOriginalFilename();
+            if (StringUtils.isNotBlank(imageName)) {
+                // String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
+                String filename = IdUtils.fastSimpleUUID() + image.getOriginalFilename().substring(image.getOriginalFilename().lastIndexOf("."));
+                SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
+                String format1 = dateFormat1.format(new Date());
+                String imgName = format1 + "/" + filename;
+                try {
+                    minioUtils.minIoClientUpload(image.getInputStream(), imgName);
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
-                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("上传文件不能为空");
+                uploadFile = imgUrl + "/" + format1 + "/" + filename;
+                sysUserService.updateUserAvatarById(userId, uploadFile);
             }
-        } catch (Exception e) {
-            e.printStackTrace();
+        } else {
+            return AjaxResult.error("上传功能出错");
         }
-        return AjaxResult.success(imageUrl);
+        return AjaxResult.success(uploadFile);
     }
 
     /**

+ 1 - 0
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

@@ -78,6 +78,7 @@ public class WebSocketConteoller extends BaseController {
             ArrayList<String> objects = new ArrayList<>(Arrays.asList(split));
             msgAlarmResp.setImageUrls(objects);
         }
+        msgAlarmResp.setId(msgAlarm.getId());
         // 推送消息reqMsgAlarmVo
         webSocketServer.sendMoreMessage(list, objStr(msgAlarmResp));
         // app 消息推送

+ 1 - 0
hazard-admin/src/main/resources/application.yml

@@ -21,6 +21,7 @@ base:
   historyUrl: http://124.70.58.209:9080
   webUrl: http://124.70.58.209:9080
   defaultPassword: yn5aq5Mt.106.tky
+  imgUrl: http://124.71.171.71:18801/picbucket
 
 # 开发环境配置
 server:

+ 1 - 1
hazard-sdk/src/main/resources/application.yml

@@ -154,4 +154,4 @@ minio:
   secretKey: admin123 #访问的秘钥
 
 sdk:
-  publish: http://http://124.70.58.209/:18819/hazard/sdk/publish
+  publish: http://124.70.58.209:18819/hazard/sdk/publish