diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/HomeController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/HomeController.java index 3477828..66ee7cc 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/HomeController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/HomeController.java @@ -38,10 +38,36 @@ public class HomeController extends BaseController { return success(list); } + /** + * 今日实时报警信息 + * @param date + * @return + */ @GetMapping("/queryTodayAlarm") public AjaxResult queryTodayAlarm(String date) { List> list = homeService.queryTodayAlarm(date); return success(list); } + /** + * 近3日报警数量统计 + * @param date + * @return + */ + @GetMapping("/queryAlarmCount") + public AjaxResult queryAlarmCount(String date) { + List> list = homeService.queryAlarmCount(date); + return success(list); + } + + /** + * 分港口展示企业平均值 + * @param date + * @return + */ + @GetMapping("/queryAvgByGangkou") + public AjaxResult queryAvgByGangkou(String date,Long deptId) { + List> list = homeService.queryAvgByGangkou(date,deptId); + return success(list); + } } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilMonitorController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilMonitorController.java index 26ee9fb..323e12d 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilMonitorController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilMonitorController.java @@ -92,15 +92,7 @@ public class OilMonitorController extends BaseController { List list = oilMonitorService.listMonitorMap(); return AjaxResult.success(list); } - /** - * 新增报警修复任务 - */ - @PostMapping("/addAlarm") - public AjaxResult addAlarm(@RequestBody ThAlramTask thAlramTask) { - thAlramTask.setCreateBy(SecurityUtils.getUsername()); - thAlramTask.setCreateTime(DateUtils.getNowDate()); - return toAjax(oilMonitorService.addAlarm(thAlramTask)); - } + /** * 处理报警信息 */ diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlarm.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlarm.java index 5bef869..ac6b904 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlarm.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlarm.java @@ -34,9 +34,13 @@ public class ThAlarm extends BaseEntity { /** - *是否处理 + *处理状态 1正在 2处理完成 */ - private String isDeal; + private Long status; + + private String fileUrl; + + private String remark; private String name ; /** @@ -145,9 +149,7 @@ public class ThAlarm extends BaseEntity { this.reportId = reportId; } - public String getIsDeal() { - return isDeal; - } + public Long getDeptId() { return deptId; @@ -165,8 +167,31 @@ public class ThAlarm extends BaseEntity { this.deptName = deptName; } - public void setIsDeal(String isDeal) { - this.isDeal = isDeal; + + public Long getStatus() { + return status; + } + + public void setStatus(Long status) { + this.status = status; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; } public Date getStartTime() { diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlramTask.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlramTask.java index 1fb76b0..dddcbc4 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlramTask.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/domain/monitor/ThAlramTask.java @@ -22,7 +22,12 @@ public class ThAlramTask extends BaseEntity { private String reason; - private String isDeal; + private Long status; + + private String fileUrl; + + private String remark; + private String factoryName; @@ -79,12 +84,30 @@ public class ThAlramTask extends BaseEntity { this.dealWay = dealWay; } - public String getIsDeal() { - return isDeal; + public Long getStatus() { + return status; } - public void setIsDeal(String isDeal) { - this.isDeal = isDeal; + public void setStats(Long stats) { + this.status = stats; + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; } public Date getDealTime() { diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/HomeMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/HomeMapper.java index 75cc35a..d14cb88 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/HomeMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/HomeMapper.java @@ -17,8 +17,23 @@ public interface HomeMapper { /** * 查询今日报警信息 - * @param queryTodayAlarm + * @param date * @return */ List> queryTodayAlarm(String date); + + /** + * 近3日报警数量统计 + * @param date + * @return + */ + List> queryAlarmCount(String date); + + /** + * 统计该港区下的所有企业平均值 + * @param date + * @param deptId + * @return + */ + List> queryAvgByGangkou(String date, Long deptId); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java index 824be21..943fbdd 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/OilMonitorMapper.java @@ -66,11 +66,7 @@ public interface OilMonitorMapper { */ void addAlarmTask(ThAlramTask thAlramTask); - /** - * 处理报警信息 - * @param thAlramTask - */ - void dealAlarm(ThAlramTask thAlramTask); + /** * 查询设备历史记录 @@ -118,9 +114,5 @@ public interface OilMonitorMapper { Integer querryDealTotal(@Param("reportId") Long reportId); - /** - * - * @param thAlramTask - */ - void dealAlarmAll(ThAlramTask thAlramTask); + } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IHomeService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IHomeService.java index ea8554e..e95d5e5 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IHomeService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IHomeService.java @@ -20,4 +20,17 @@ public interface IHomeService { * @return */ List> queryTodayAlarm(String date); + + /** + * 近3日报警数量统计 + * @param date + * @return + */ + List> queryAlarmCount(String date); + /** + * 分港口展示企业平均值 + * @param date + * @return + */ + List> queryAvgByGangkou(String date, Long deptId); } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilMonitorService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilMonitorService.java index 0b68607..f91de0b 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilMonitorService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilMonitorService.java @@ -35,12 +35,7 @@ public interface IOilMonitorService { */ List listAlarm(ThAlarm thAlarm); - /** - * 新增报警修复任务 - * @param thAlramTask - * @return - */ - int addAlarm(ThAlramTask thAlramTask); + /** * 处理报警信息 diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/HomeServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/HomeServiceImpl.java index a7ef84c..173901f 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/HomeServiceImpl.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/HomeServiceImpl.java @@ -1,18 +1,14 @@ package com.ruoyi.project.oil.service.impl; - -import com.ruoyi.framework.web.domain.AjaxResult; -import com.ruoyi.project.oil.domain.SendInfo; import com.ruoyi.project.oil.mapper.HomeMapper; import com.ruoyi.project.oil.service.IHomeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; + import java.util.List; import java.util.Map; -import static com.ruoyi.framework.web.domain.AjaxResult.success; + @Service public class HomeServiceImpl implements IHomeService { @@ -35,4 +31,14 @@ public class HomeServiceImpl implements IHomeService { public List> queryTodayAlarm(String queryTodayAlarm) { return homeMapper.queryTodayAlarm(queryTodayAlarm); } + + @Override + public List> queryAlarmCount(String date) { + return homeMapper.queryAlarmCount(date); + } + + @Override + public List> queryAvgByGangkou(String date, Long deptId) { + return homeMapper.queryAvgByGangkou(date,deptId); + } } diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilMonitorServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilMonitorServiceImpl.java index e7a3865..1f2f000 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilMonitorServiceImpl.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilMonitorServiceImpl.java @@ -79,50 +79,28 @@ public class OilMonitorServiceImpl implements IOilMonitorService { } @Override - @DataScope(deptAlias = "f") + @DataScope(deptAlias = "dept",permission="4") public List listAlarm(ThAlarm thAlarm) { List list=oilMonitorMapper.listAlarm(thAlarm); -// list.forEach(map->{ -// Double lng= Double.valueOf(map.getLongitude()); -// Double lat= Double.valueOf(map.getLatitude()); -// double[] zuobiao= CoordinateTransformUtil.wgs84tobd09(lng,lat); -// map.setLng(zuobiao[0]); -// map.setLat(zuobiao[1]); -// -// }); return list; } - @Override - public int addAlarm(ThAlramTask thAlramTask) { - oilMonitorMapper.deleteAlarmTaskBYReportId(thAlramTask.getReportId()); - oilMonitorMapper.addAlarmTask(thAlramTask); - return 1; - } + @Override @DataScope(deptAlias = "f") public int dealAlarm(ThAlramTask thAlramTask) { -// oilMonitorMapper.deleteAlarmTaskBYReportId(thAlramTask.getReportId()); -// oilMonitorMapper.addAlarmTask(thAlramTask); - Integer count=oilMonitorMapper.querryDealTotal(thAlramTask.getReportId()); - - if(count>0){ - oilMonitorMapper.dealAlarm(thAlramTask); - }else{ - logger.info("数量:{}count", count); - thAlramTask.setDealUser(SecurityUtils.getUsername()); - thAlramTask.setCreateTime(DateUtils.getNowDate()); - thAlramTask.setCreateBy(SecurityUtils.getUsername()); - thAlramTask.setIsDeal("1"); - oilMonitorMapper.dealAlarmAll(thAlramTask); - } + oilMonitorMapper.deleteAlarmTaskBYReportId(thAlramTask.getReportId()); + String dealUser=SecurityUtils.getUsername(); + thAlramTask.setDealUser(dealUser); + thAlramTask.setDealTime(DateUtils.getNowDate()); + oilMonitorMapper.addAlarmTask(thAlramTask); return 1; } @Override - @DataScope(deptAlias = "f") + @DataScope(deptAlias = "dept",permission="4") public List listAlarmHistory(ThAlarm thAlarm) { List list=oilMonitorMapper.listAlarmHistory(thAlarm); return list; diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/HomeMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/HomeMapper.xml index 148318a..2dff2cb 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/HomeMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/HomeMapper.xml @@ -19,7 +19,7 @@ pp.dept_name AS "gangqu" FROM th_device d LEFT JOIN sys_dept p ON d.dept_id = p.dept_id - LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id + JOIN sys_dept pp ON p.parent_id = pp.dept_id GROUP BY p.dept_name, pp.dept_name @@ -31,7 +31,7 @@ r.zt AS "level" FROM th_device d LEFT JOIN th_device_report r ON d.sn = r.sn - LEFT JOIN sys_dept p ON d.dept_id = p.dept_id + JOIN sys_dept p ON d.dept_id = p.dept_id LEFT JOIN sys_dept pp ON p.parent_id = pp.dept_id WHERE r.REPORT_TIME = TO_DATE(#{date}, 'YYYY-MM-DD') @@ -39,4 +39,41 @@ + + + + \ No newline at end of file diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml index a3e19c7..4436baa 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/OilMonitorMapper.xml @@ -65,11 +65,13 @@ - + + + @@ -236,10 +238,12 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea dept.dept_name, d.id as dealId, d.deal_way, - d.is_deal, d.deal_time, d.reason, - d.deal_user + d.deal_user, + d.status, + d.remark, + d.file_url FROM th_device_report LEFT JOIN th_device t ON th_device_report.sn = t.sn @@ -265,14 +269,7 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea and th_device_report.sn= #{sn} and t.name like concat(concat('%',#{name, jdbcType=VARCHAR}),'%') and d.deal_user like concat(concat('%',#{dealUser, jdbcType=VARCHAR}),'%') - - - and d.is_deal='1' - - - and (d.is_deal is null or d.is_deal='0') - - + and d.staus=#{status} ${params.dataScope} order by th_device_report.report_time desc @@ -287,57 +284,32 @@ select t.id,t. name,t.unit_no,t.system_no,t.status,t.sn,t.file_url,t.note,t.crea report_id, deal_user, - is_deal, + status, create_by, create_time, - + file_url, + remark, + deal_time, + reason, + deal_way, #{reportId}, #{dealUser}, - #{isDeal}, + #{status}, #{createBy}, #{createTime}, + #{fileUrl}, + #{remark}, + #{dealTime}, + #{reason}, + #{dealWay}, - - update th_device_deal - - deal_user = #{dealUser}, - deal_way = #{dealWay}, - deal_time=#{dealTime}, - is_deal=#{isDeal}, - reason=#{reason}, - - where id = #{dealId} - - - insert into th_device_deal - - report_id, - deal_user, - is_deal, - create_by, - create_time, - reason, - deal_way, - deal_time, - - - #{reportId}, - #{dealUser}, - #{isDeal}, - #{createBy}, - #{createTime}, - #{reason}, - #{dealWay}, - #{dealTime}, - -