Browse Source

优化

platform-api
4670101279 2 years ago
parent
commit
6d84a38d8a
  1. 10
      ruoyi-admin/src/main/resources/application.yml
  2. 35
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraAutoRebootLog.java
  3. 17
      ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraAutoRebootLogMapper.java
  4. 14
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraAutoRebootLogService.java
  5. 18
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraAutoRebootLogServiceImpl.java
  6. 9
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java

10
ruoyi-admin/src/main/resources/application.yml

@ -100,11 +100,11 @@ mybatis-plus: @@ -100,11 +100,11 @@ mybatis-plus:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
global-config:
db-config:
logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
# global-config:
# db-config:
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2)
# logic-delete-value: 1 # 逻辑已删除值(默认为 1)
# logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
# PageHelper分页插件

35
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/CameraAutoRebootLog.java

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
package com.ruoyi.code.camera.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("camera_auto_reboot_log")
public class CameraAutoRebootLog implements Serializable
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(type = IdType.INPUT)
private Long id;
/** 设备序列号 */
private String devsn;
/** 重启结果 */
private String result;
/** 重启时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date rebootTime;
}

17
ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraAutoRebootLogMapper.java

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
package com.ruoyi.code.camera.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.camera.domain.CameraAutoRebootLog;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-06-21
*/
@Mapper
public interface CameraAutoRebootLogMapper extends BaseMapper<CameraAutoRebootLog>
{
}

14
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraAutoRebootLogService.java

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
package com.ruoyi.code.camera.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.camera.domain.CameraAutoRebootLog;
/**
* Service接口
*
* @author ruoyi
* @date 2022-06-21
*/
public interface ICameraAutoRebootLogService extends IService<CameraAutoRebootLog>
{
}

18
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraAutoRebootLogServiceImpl.java

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
package com.ruoyi.code.camera.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.camera.domain.CameraAutoRebootLog;
import com.ruoyi.code.camera.mapper.CameraAutoRebootLogMapper;
import com.ruoyi.code.camera.service.ICameraAutoRebootLogService;
import org.springframework.stereotype.Service;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-06-21
*/
@Service("cameraAutoRebootLogService")
public class CameraAutoRebootLogServiceImpl extends ServiceImpl<CameraAutoRebootLogMapper, CameraAutoRebootLog> implements ICameraAutoRebootLogService
{
}

9
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java

@ -2,7 +2,9 @@ package com.ruoyi.quartz.task; @@ -2,7 +2,9 @@ package com.ruoyi.quartz.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.domain.CameraAutoRebootLog;
import com.ruoyi.code.camera.domain.ScImageUploadAlarm;
import com.ruoyi.code.camera.service.ICameraAutoRebootLogService;
import com.ruoyi.code.camera.service.ICameraService;
import com.ruoyi.code.camera.service.IScImageUploadAlarmService;
import com.ruoyi.common.core.page.R;
@ -12,6 +14,7 @@ import org.springframework.stereotype.Component; @@ -12,6 +14,7 @@ import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;
import utils.CameraUtil;
import java.util.Date;
import java.util.List;
/**
@ -82,6 +85,7 @@ public class RyTask @@ -82,6 +85,7 @@ public class RyTask
public void checkCameraUpload(){
IScImageUploadAlarmService scImageUploadAlarmService = BeanUtil.getBean(IScImageUploadAlarmService.class);
ICameraService cameraService = BeanUtil.getBean(ICameraService.class);
ICameraAutoRebootLogService cameraAutoRebootLogService = BeanUtil.getBean(ICameraAutoRebootLogService.class);
List<ScImageUploadAlarm> alarms = scImageUploadAlarmService.list(new QueryWrapper<ScImageUploadAlarm>().eq("flag","1"));
@ -91,6 +95,11 @@ public class RyTask @@ -91,6 +95,11 @@ public class RyTask
System.out.println(c);
R result = cameraService.rebootByLoginId(c);
System.out.println(result);
CameraAutoRebootLog log = new CameraAutoRebootLog();
log.setDevsn(c.getDevsn());
log.setRebootTime(new Date());
log.setResult(result.toString());
cameraAutoRebootLogService.save(log);
sleep(10);
}
alarm.setFlag("0");

Loading…
Cancel
Save