Procházet zdrojové kódy

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

gao.qiang před 2 roky
rodič
revize
4855d1ef21

+ 1 - 1
.idea/compiler.xml

@@ -7,9 +7,9 @@
         <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="base-admin" />
         <module name="business-service" />
       </profile>
     </annotationProcessing>

+ 4 - 0
business-service/src/main/resources/mapper/service/MsgAlarmMapper.xml

@@ -73,6 +73,7 @@
             <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
     </select>
@@ -122,6 +123,7 @@
             <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)
 
@@ -172,6 +174,7 @@
             <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
     </select>
@@ -214,6 +217,7 @@
             <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)
 

+ 1 - 0
business-service/src/main/resources/mapper/service/MsgAppPushMapper.xml

@@ -62,6 +62,7 @@
             <if test="status != null and status != 0">
                 and UPPER(status) like UPPER(CONCAT('%',#{status},'%'))
             </if>
+            and YEAR(a.alarm_time) = YEAR(SYSDATE())
         </where>
     </select>
     <update id="update" parameterType="com.ozs.service.entity.MsgAppPush">

+ 13 - 25
hazard-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -11,16 +11,10 @@ import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.utils.AppendUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.poi.ExcelUtil;
-import com.ozs.service.entity.BaseCameraManagement;
-import com.ozs.service.entity.BaseRailwayManagement;
-import com.ozs.service.entity.MsgAlarm;
-import com.ozs.service.entity.MsgAlarmFrequency;
+import com.ozs.service.entity.*;
 import com.ozs.service.entity.vo.*;
 import com.ozs.service.mapper.MsgAlarmMapper;
-import com.ozs.service.service.BaseCameraManagementService;
-import com.ozs.service.service.BaseRailwayManagementService;
-import com.ozs.service.service.MsgAlarmFrequencyService;
-import com.ozs.service.service.MsgAlarmService;
+import com.ozs.service.service.*;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
@@ -80,25 +74,19 @@ public class MsgAlarmController extends BaseController {
     BaseRailwayManagementService baseRailwayManagementService;
     @Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
     private String imgUrl;
-
+    @Autowired
+    private MsgWebPushService msgWebPushService;
 
     /**
-     * 测试消息推送
+     * web消息已读
      */
-    @PostMapping("/push")
+    @PostMapping("/read")
     @ApiOperation(value = "预报警信息分页")
-    public AjaxResult insertDate(String[] args) {
-        // 模拟需要推送的用户群
-        ArrayList<String> ids = new ArrayList<>();
-        ids.add("001");
-        ids.add("002");
-        ids.add("003");
-        ids.add("004");
-        ids.add("005");
-//
-//        WebSocketService webSocketService = new WebSocketService();
-//        webSocketService.sendMsgToUsers(ids);
-        return AjaxResult.success("推送成功");
+    public AjaxResult read(@RequestBody MsgWebPush msgWebPush) {
+        if (StringUtils.isEmpty(msgWebPush) || StringUtils.isEmpty(msgWebPush.getId())) {
+            return AjaxResult.error("主键ID不能为空!");
+        }
+        return toAjax(msgWebPushService.read(msgWebPush));
     }
 
     /**
@@ -320,7 +308,7 @@ public class MsgAlarmController extends BaseController {
             @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
     })
     public void exportDataStatistic(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        String userId = "1";//getUserId();
+        String userId = getUserId();
         if ("1".equals(userId)) {
             userId = "";
         }
@@ -349,7 +337,7 @@ public class MsgAlarmController extends BaseController {
             @ApiImplicitParam(paramType = "query", name = "alarmType", value = "灾害类型"),
     })
     public void exportDataStatisticMonth(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
-        String userId = "1";//getUserId();
+        String userId = getUserId();
         if ("1".equals(userId)) {
             userId = "";
         }

+ 13 - 2
hazard-admin/src/main/java/com/ozs/web/controller/websocket/WebSocketConteoller.java

@@ -13,6 +13,7 @@ import com.ozs.service.service.BaseUserService;
 import com.ozs.service.service.UserRegistrationidService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
@@ -40,6 +41,8 @@ public class WebSocketConteoller extends BaseController {
     private BaseCameraManagementService baseCameraManagementService;
     @Autowired
     private UserRegistrationidService userRegistrationidService;
+    @Value("${base.imgUrl:http://124.71.171.71:18801/picbucket}")
+    private String imgUrl;
 
     @ResponseBody
     @PostMapping("/publish")
@@ -58,13 +61,21 @@ public class WebSocketConteoller extends BaseController {
         String endMile = begin + "-" + end;
         msgAlarmResp.setBeginMile(endMile);
         msgAlarmResp.setAlarmType(msgAlarm.getAlarmType());
-        msgAlarmResp.setAlarmTime(msgAlarm.getAlarmTime());
         String mile = AppendUtils.stringAppend(baseCameraManagement.getInstallMile());
         msgAlarmResp.setAlarmMile(mile);
         String cameraCode = baseCameraManagement.getCameraCode();
         String cameraName = baseRailwayManagementService.getCameraNameByCameraCode(cameraCode);
         msgAlarmResp.setRailwayName(cameraName != null ? cameraName : "");
         msgAlarmResp.setLineDirStr(baseCameraManagement.getLineDir() == 1 ? "上行" : "下行");
+        msgAlarmResp.setAlarmTime(msgAlarm.getAlarmTime() != null ? msgAlarm.getAlarmTime() : new Date());
+        // 图片
+        ArrayList<String> objects = new ArrayList<>();
+        String[] split = msgAlarm.getImageUrl().split(";");
+        for (String s : split) {
+            s = imgUrl + s;
+            objects.add(s);
+        }
+        msgAlarmResp.setImageUrls(objects);
         // 推送消息reqMsgAlarmVo
         webSocketServer.sendMoreMessage(list, objStr(msgAlarmResp));
 
@@ -79,7 +90,7 @@ public class WebSocketConteoller extends BaseController {
         JPushUtil.sendToRegistrationId(
                 alias,
                 "报警通知!", cameraName != null ? cameraName : "",
-                formatDate + "     " + (msgAlarmResp.getAlarmType() == 1 ? "泥石流" : msgAlarmResp.getAlarmType())+ "     " + (baseCameraManagement.getLineDir() == 1 ? "上行" : "下行") + "     " + mile + "     " + endMile,
+                formatDate + "     " + (msgAlarmResp.getAlarmType() == 1 ? "泥石流" : msgAlarmResp.getAlarmType()) + "     " + (baseCameraManagement.getLineDir() == 1 ? "上行" : "下行") + "     " + mile + "     " + endMile,
                 "");
         HashMap<String, Object> map = new HashMap<>();
         map.put("code", 200);

+ 1 - 0
hazard-admin/src/main/resources/logback.xml

@@ -2,6 +2,7 @@
 <configuration>
     <!-- 日志存放路径 -->
     <property name="log.path" value="/data/service/hazard-admin/logs"/>
+<!--    <property name="log.path" value="/Users/sunhuanhuan/Documents/project/106/project/logs"/>-->
     <!-- 日志输出格式 -->
     <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>