Commit fb73cb9a authored by zhouts's avatar zhouts

告警展示

parent 04239193
package com.cx.cn.cxquartz.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.Calendar;
@Configuration
@EnableScheduling
public class ScheduleTaskConfig {
/***
* 每隔20分钟执行一遍判断rtsp 是否变换
*/
@Scheduled(cron = "0 0 2 * * ? ")
private void statis() {
}
// @Scheduled(cron = "0 30/5 6-19 * * ?")//每隔5分钟统计当天目前为止的数据
// private void statistoday() {
// //判断是否为空表
// //执行查询存在更新,不存在新增
// log.info("每隔5分钟");
// Integer result= traffFlowService.insertOrUpdatevehicleTodaystatistic();
// log.info("today"+result);
//
// }
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.vo.Code;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Mapper
public interface CodeMapper {
Code selectalarmNum(String keyid);
}
...@@ -41,4 +41,6 @@ public interface QuartzTaskInformationsMapper { ...@@ -41,4 +41,6 @@ public interface QuartzTaskInformationsMapper {
List< PatrolCtrlRecord> queryCameraCode(List<String> ids); List< PatrolCtrlRecord> queryCameraCode(List<String> ids);
List<Sbtdspsr> selectByRtsp(String rtsp); List<Sbtdspsr> selectByRtsp(String rtsp);
Integer UpdateExecuteParam(Map map);
} }
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Code;
/**
* <p>
* 服务类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public interface CodeService {
Code selectalarmNum(String keyid);
}
...@@ -15,7 +15,7 @@ import java.util.ArrayList; ...@@ -15,7 +15,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* ftpַȡ߷ * ftp��ַ��ȡ���߷�����
* @author cp * @author cp
*/ */
@Service @Service
...@@ -32,26 +32,26 @@ public class FtpService { ...@@ -32,26 +32,26 @@ public class FtpService {
try { try {
this.ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue())); this.ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue()));
}catch (Exception e){ }catch (Exception e){
log.error("ftpListȡʧ:"+e.toString()); log.error("ftpList��ȡʧ��:"+e.toString());
} }
} }
public Ftp reloadFtp() { public Ftp reloadFtp() {
try { try {
cacheLoadService.loadFtpCache(); // cacheLoadService.loadFtpCache();
if(null==stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue())){ if(null==stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue())){
cacheLoadService.loadFtpCache(); cacheLoadService.loadFtpCache();
} }
ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue())); ftpList = getFtpList(stringRedisTemplate.opsForValue().get(RedisEnum.FTPLIST.getValue()));
}catch (Exception e){ }catch (Exception e){
log.error("ftpListȡʧ:"+e.toString()); log.error("ftpListerror:"+e.toString());
} }
Long count = null; Long count = null;
try { try {
count = stringRedisTemplate.opsForValue().increment(RedisEnum.FTPLIST_INDEX.getValue(), 1L); count = stringRedisTemplate.opsForValue().increment(RedisEnum.FTPLIST_INDEX.getValue(), 1L);
} catch (Exception e) { } catch (Exception e) {
log.error("ȡredis FtpIndex쳣" + e.toString()); log.error("redis error" + e.toString());
} }
if (count == null) { if (count == null) {
count = 0L; count = 0L;
......
...@@ -6,6 +6,7 @@ import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo; ...@@ -6,6 +6,7 @@ import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import java.util.List; import java.util.List;
import java.util.Map;
public interface QuartzService { public interface QuartzService {
String addTask(QuartzTaskInformations quartzTaskInformations); String addTask(QuartzTaskInformations quartzTaskInformations);
...@@ -16,6 +17,9 @@ public interface QuartzService { ...@@ -16,6 +17,9 @@ public interface QuartzService {
String updateTask(QuartzTaskInformations quartzTaskInformations); String updateTask(QuartzTaskInformations quartzTaskInformations);
Integer UpdateExecuteParam(Map map);
String startJob(String taskNo) throws SchedulerException; String startJob(String taskNo) throws SchedulerException;
void initLoadOnlineTasks(); void initLoadOnlineTasks();
......
...@@ -7,6 +7,7 @@ import com.cx.cn.cxquartz.bean.PictureTime; ...@@ -7,6 +7,7 @@ import com.cx.cn.cxquartz.bean.PictureTime;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations; import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import java.util.List; import java.util.List;
import java.util.Map;
public interface QuartzTaskInformationsService { public interface QuartzTaskInformationsService {
String insert(QuartzTaskInformations quartzTaskInformations); String insert(QuartzTaskInformations quartzTaskInformations);
...@@ -17,6 +18,8 @@ public interface QuartzTaskInformationsService { ...@@ -17,6 +18,8 @@ public interface QuartzTaskInformationsService {
String updateTask(QuartzTaskInformations quartzTaskInformations); String updateTask(QuartzTaskInformations quartzTaskInformations);
Integer UpdateExecuteParam(Map map);
QuartzTaskInformations getTaskByTaskNo(String taskNo); QuartzTaskInformations getTaskByTaskNo(String taskNo);
Integer updateStatusById(QuartzTaskInformations quartzTaskInformations); Integer updateStatusById(QuartzTaskInformations quartzTaskInformations);
......
package com.cx.cn.cxquartz.service.quartz.impl;
import com.cx.cn.cxquartz.dao.CodeMapper;
import com.cx.cn.cxquartz.service.quartz.CodeService;
import com.cx.cn.cxquartz.vo.Code;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author wjj
* @since 2021-04-29
*/
@Service
public class CodeServiceImpl implements CodeService {
@Autowired
private CodeMapper codeMapper;
@Override
public Code selectalarmNum(String keyid) {
return codeMapper.selectalarmNum(keyid);
}
}
...@@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@Service @Service
...@@ -84,6 +85,11 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean { ...@@ -84,6 +85,11 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
return quartzTaskInformationsService.updateTask(quartzTaskInformations); return quartzTaskInformationsService.updateTask(quartzTaskInformations);
} }
@Override
public Integer UpdateExecuteParam(Map map) {
return quartzTaskInformationsService.UpdateExecuteParam(map);
}
/** /**
* 启动 or 暂停定时任务 * 启动 or 暂停定时任务
* *
......
...@@ -9,7 +9,6 @@ import com.cx.cn.cxquartz.dao.QuartzTaskInformationsMapper; ...@@ -9,7 +9,6 @@ import com.cx.cn.cxquartz.dao.QuartzTaskInformationsMapper;
import com.cx.cn.cxquartz.service.quartz.QuartzTaskInformationsService; import com.cx.cn.cxquartz.service.quartz.QuartzTaskInformationsService;
import com.cx.cn.cxquartz.util.ResultEnum; import com.cx.cn.cxquartz.util.ResultEnum;
import com.cx.cn.cxquartz.util.ResultUtil; import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -77,6 +76,11 @@ public class QuartzTaskInformationsServiceImpl implements QuartzTaskInformations ...@@ -77,6 +76,11 @@ public class QuartzTaskInformationsServiceImpl implements QuartzTaskInformations
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage()); return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage());
} }
@Override
public Integer UpdateExecuteParam(Map map) {
return quartzTaskInformationsMapper.UpdateExecuteParam(map);
}
@Override @Override
public QuartzTaskInformations getTaskByTaskNo(String taskNo) { public QuartzTaskInformations getTaskByTaskNo(String taskNo) {
return quartzTaskInformationsMapper.getTaskByTaskNo(taskNo); return quartzTaskInformationsMapper.getTaskByTaskNo(taskNo);
...@@ -111,6 +115,8 @@ public class QuartzTaskInformationsServiceImpl implements QuartzTaskInformations ...@@ -111,6 +115,8 @@ public class QuartzTaskInformationsServiceImpl implements QuartzTaskInformations
public List<PictureTime> findLastPicTime() { public List<PictureTime> findLastPicTime() {
return quartzTaskInformationsMapper.findLastPicTime(); return quartzTaskInformationsMapper.findLastPicTime();
} }
@Override @Override
public List<PatrolCtrlRecord> queryCameraCode(List<String> ids){ public List<PatrolCtrlRecord> queryCameraCode(List<String> ids){
return quartzTaskInformationsMapper.queryCameraCode(ids); return quartzTaskInformationsMapper.queryCameraCode(ids);
......
...@@ -103,12 +103,10 @@ public class FTPUtil { ...@@ -103,12 +103,10 @@ public class FTPUtil {
if (inputImg == null) { if (inputImg == null) {
return false; return false;
} }
//base64����
BASE64Decoder decoder = new BASE64Decoder(); BASE64Decoder decoder = new BASE64Decoder();
byte[] b_img = decoder.decodeBuffer(inputImg); byte[] b_img = decoder.decodeBuffer(inputImg);
input = new ByteArrayInputStream(b_img); input = new ByteArrayInputStream(b_img);
ftpClient = connectServer(ftpUrl); ftpClient = connectServer(ftpUrl);
//new ByteArrayInputStream
if (ftpClient.isConnected()) { if (ftpClient.isConnected()) {
changeWorkingDirectory(ftpClient, path); changeWorkingDirectory(ftpClient, path);
flag = ftpClient.storeFile(filename, input); flag = ftpClient.storeFile(filename, input);
......
...@@ -22,7 +22,6 @@ public class FileTransferManager { ...@@ -22,7 +22,6 @@ public class FileTransferManager {
private static CompletionService<TransferResult> completionService = new ExecutorCompletionService<TransferResult>(ThreadPoolUtil.getPool()); private static CompletionService<TransferResult> completionService = new ExecutorCompletionService<TransferResult>(ThreadPoolUtil.getPool());
private static CompletionService<PictureResult> threadService = new ExecutorCompletionService<PictureResult>(ThreadPoolUtil.getPool()); private static CompletionService<PictureResult> threadService = new ExecutorCompletionService<PictureResult>(ThreadPoolUtil.getPool());
private static final Logger log = LoggerFactory.getLogger(ExtController.class); private static final Logger log = LoggerFactory.getLogger(ExtController.class);
/** /**
* @param transferRecord * @param transferRecord
* @param ftp * @param ftp
...@@ -168,5 +167,7 @@ public class FileTransferManager { ...@@ -168,5 +167,7 @@ public class FileTransferManager {
} }
} }
} }
} }
package com.cx.cn.cxquartz.vo;
import java.io.Serializable;
public class Code implements Serializable {
private String key;
private String name;
private String type;
private String alarmlevel;
private Integer rectifytime ;
private Integer manualchecktime;
private Integer pushchecktime ;
private Integer maxnum;
private Integer alarmnum;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getAlarmlevel() {
return alarmlevel;
}
public void setAlarmlevel(String alarmlevel) {
this.alarmlevel = alarmlevel;
}
public Integer getRectifytime() {
return rectifytime;
}
public void setRectifytime(Integer rectifytime) {
this.rectifytime = rectifytime;
}
public Integer getManualchecktime() {
return manualchecktime;
}
public void setManualchecktime(Integer manualchecktime) {
this.manualchecktime = manualchecktime;
}
public Integer getPushchecktime() {
return pushchecktime;
}
public void setPushchecktime(Integer pushchecktime) {
this.pushchecktime = pushchecktime;
}
public Integer getMaxnum() {
return maxnum;
}
public void setMaxnum(Integer maxnum) {
this.maxnum = maxnum;
}
public Integer getAlarmnum() {
return alarmnum;
}
public void setAlarmnum(Integer alarmnum) {
this.alarmnum = alarmnum;
}
}
\ No newline at end of file
...@@ -31,7 +31,7 @@ public class TraffpictureParam extends Traffpicture { ...@@ -31,7 +31,7 @@ public class TraffpictureParam extends Traffpicture {
@JsonIgnore @JsonIgnore
private Integer retrycount; private Integer retrycount;
@JsonIgnore @JsonIgnore
private Integer recordlevel; private String recordlevel;
@JsonIgnore @JsonIgnore
private Integer checkstatus; private Integer checkstatus;
@JsonIgnore @JsonIgnore
...@@ -132,11 +132,11 @@ public class TraffpictureParam extends Traffpicture { ...@@ -132,11 +132,11 @@ public class TraffpictureParam extends Traffpicture {
this.retrycount = retrycount; this.retrycount = retrycount;
} }
public Integer getRecordlevel() { public String getRecordlevel() {
return recordlevel; return recordlevel;
} }
public void setRecordlevel(Integer recordlevel) { public void setRecordlevel(String recordlevel) {
this.recordlevel = recordlevel; this.recordlevel = recordlevel;
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cx.cn.cxquartz.dao.CodeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.Code">
<result column="key" jdbcType="VARCHAR" property="key" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="CHAR" property="type" />
<result column="alarmlevel" jdbcType="VARCHAR" property="alarmlevel" />
<result column="rectifytime" jdbcType="INTEGER" property="rectifytime" />
<result column="manualchecktime" jdbcType="INTEGER" property="manualchecktime" />
<result column="pushchecktime" jdbcType="INTEGER" property="pushchecktime" />
<result column="maxnum" jdbcType="INTEGER" property="maxnum" />
<result column="alarmnum" jdbcType="INTEGER" property="alarmnum" />
</resultMap>
<select id="selectalarmNum" resultMap="BaseResultMap">
select * from t_code t where t.type=2 and t.key=#{key,jdbcType=VARCHAR}
</select>
</mapper>
...@@ -394,6 +394,9 @@ ...@@ -394,6 +394,9 @@
<result column="sbbh" jdbcType="VARCHAR" property="sbbh"/> <result column="sbbh" jdbcType="VARCHAR" property="sbbh"/>
<result column="tdbh" jdbcType="INTEGER" property="tdbh"/> <result column="tdbh" jdbcType="INTEGER" property="tdbh"/>
<result column="xzbh" jdbcType="VARCHAR" property="xzbh"/> <result column="xzbh" jdbcType="VARCHAR" property="xzbh"/>
</resultMap> </resultMap>
<update id="UpdateExecuteParam" parameterType="java.util.HashMap">
update quartz_task_informations set executeParamter=#{nrtsp} where executeParamter=#{ortsp}
</update>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment