处警实时数据

develop
Angel 10 months ago
parent 09fccb14c5
commit e076b48057

@ -1,5 +1,7 @@
package com.ssf.mysqloracletest.domain; package com.ssf.mysqloracletest.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;

@ -2,6 +2,7 @@ package com.ssf.mysqloracletest.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql; import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
import com.ssf.mysqloracletest.domain.JcjJjxxViewMysql;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -18,6 +19,7 @@ public interface JcjCjxxViewMysqlMapper extends BaseMapper<JcjCjxxViewMysql> {
public int updateCjxxById(JcjCjxxViewMysql bean); public int updateCjxxById(JcjCjxxViewMysql bean);
JcjCjxxViewMysql selectRecordOrderByRksj();
} }

@ -20,6 +20,8 @@ public interface JcjCjxxViewOracleMapper extends BaseMapper<JcjCjxxViewOracle> {
public int countCjxx(); public int countCjxx();
public List<JcjCjxxViewOracle> getCjxxList(Map map); public List<JcjCjxxViewOracle> getCjxxList(Map map);
public List<JcjCjxxViewOracle> getRealTimeRecording(String time);
} }

@ -3,6 +3,7 @@ package com.ssf.mysqloracletest.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql; import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql; import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
import com.ssf.mysqloracletest.domain.JcjJjxxViewMysql;
/** /**
* @author 28758 * @author 28758
@ -16,4 +17,5 @@ public interface JcjCjxxViewMysqlService extends IService<JcjCjxxViewMysql> {
public int updateCjxxById(JcjCjxxViewMysql tjks); public int updateCjxxById(JcjCjxxViewMysql tjks);
public JcjCjxxViewMysql selectRecordOrderByRksj();
} }

@ -15,4 +15,6 @@ public interface JcjCjxxViewOracleService extends IService<JcjCjxxViewOracle> {
public int countCjxx(); public int countCjxx();
public List<JcjCjxxViewOracle> getCjxxList(Map map); public List<JcjCjxxViewOracle> getCjxxList(Map map);
public List<JcjCjxxViewOracle> getRealTimeRecording(String time);
} }

@ -3,6 +3,7 @@ package com.ssf.mysqloracletest.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql; import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
import com.ssf.mysqloracletest.domain.JcjJjxxViewMysql;
import com.ssf.mysqloracletest.mapper.JcjCjxxViewMysqlMapper; import com.ssf.mysqloracletest.mapper.JcjCjxxViewMysqlMapper;
import com.ssf.mysqloracletest.service.JcjCjxxViewMysqlService; import com.ssf.mysqloracletest.service.JcjCjxxViewMysqlService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -35,6 +36,11 @@ public class JcjCjxxViewMysqlServiceImpl extends ServiceImpl<JcjCjxxViewMysqlMap
return jcjCjxxViewMysqlMapper.updateCjxxById(tjks); return jcjCjxxViewMysqlMapper.updateCjxxById(tjks);
} }
@Override
public JcjCjxxViewMysql selectRecordOrderByRksj() {
return jcjCjxxViewMysqlMapper.selectRecordOrderByRksj();
}
} }

@ -33,6 +33,11 @@ public class JcjCjxxViewOracleServiceImpl extends ServiceImpl<JcjCjxxViewOracleM
return oracleMapper.getCjxxList(map); return oracleMapper.getCjxxList(map);
} }
@Override
public List<JcjCjxxViewOracle> getRealTimeRecording(String time) {
return oracleMapper.getRealTimeRecording(time);
}
} }

@ -3,6 +3,7 @@ package com.ssf.mysqloracletest.task;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql; import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
import com.ssf.mysqloracletest.domain.JcjCjxxViewOracle; import com.ssf.mysqloracletest.domain.JcjCjxxViewOracle;
import com.ssf.mysqloracletest.domain.JcjJjxxViewMysql;
import com.ssf.mysqloracletest.service.JcjCjxxViewMysqlService; import com.ssf.mysqloracletest.service.JcjCjxxViewMysqlService;
import com.ssf.mysqloracletest.service.JcjCjxxViewOracleService; import com.ssf.mysqloracletest.service.JcjCjxxViewOracleService;
import com.ssf.mysqloracletest.utils.ConfigParam; import com.ssf.mysqloracletest.utils.ConfigParam;
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -127,6 +129,7 @@ public class JcjCjxxTask {
logger.info(StringKit.getTrace(e)); logger.info(StringKit.getTrace(e));
} }
} }
private static String getFolderPath(String picpath) { private static String getFolderPath(String picpath) {
String floderPath; String floderPath;
Date date = new Date(); Date date = new Date();
@ -142,9 +145,7 @@ public class JcjCjxxTask {
} }
/** /**
*
* : * :
* *
* @param: * @param:
@ -155,19 +156,36 @@ public class JcjCjxxTask {
@Scheduled(initialDelay = 100, fixedDelay = 3000) @Scheduled(initialDelay = 100, fixedDelay = 3000)
public void transcjxxNow() { public void transcjxxNow() {
if (!"true".equals(ConfigParam.cjxxSwitch)) {
return;
}
try { try {
//1 去mysql查出当前最大时间 //1 去mysql查出当前最大时间
JcjCjxxViewMysql cjxxViewMysql = cjxxMysqlService.selectRecordOrderByRksj();
//2 用得到的最大时间去oracle 查询大于这个时间的记录 //2 用得到的最大时间去oracle 查询大于这个时间的记录
List<JcjCjxxViewOracle> list = cjxxOracleService.getRealTimeRecording(cjxxViewMysql.getCJSJ());
//3 解析入库 //3 解析入库
for (JcjCjxxViewOracle cjxx : list) {
JcjCjxxViewMysql sBean = new JcjCjxxViewMysql();
BeanUtils.copyProperties(cjxx, sBean);
//确定一个数据是否唯一
JcjCjxxViewMysql checkcjxx = cjxxMysqlService.selectCjxxById(cjxx.getCJBH());
}catch (Exception e){ if (checkcjxx == null) {
e.printStackTrace(); cjxxMysqlService.insertCjxx(sBean);
logger.info("cjxx-" + cjxx.getCJBH() + ":插入成功");
} else {
cjxxMysqlService.updateCjxxById(sBean);
logger.info("cjxx-" + cjxx.getCJBH() + ":更新成功");
} }
} }
} catch (Exception e) {
e.printStackTrace();
}
}
} }

@ -30,4 +30,8 @@ public class ConfigParam {
//将数据洗进 --->业务表的开关---------------------------------------------------------------------------------------------------------- //将数据洗进 --->业务表的开关----------------------------------------------------------------------------------------------------------
public static String NewNsydwSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNsydwSwitch")); public static String NewNsydwSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNsydwSwitch"));
public static String NewNalarminfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNalarminfoSwitch")); public static String NewNalarminfoSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("NewNalarminfoSwitch"));
//CJ实时数据开关
public static String actualTimecjxxSwitch = StringKit.toString(PropertiesUtil.queryPropertiesByKey("actualTimecjxxSwitch"));
} }

@ -445,7 +445,6 @@
where CJBH = #{CJBH} where CJBH = #{CJBH}
</update> </update>
<select id="selectRecordOrderByRksj" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectRecordOrderByRksj" parameterType="java.lang.String" resultMap="BaseResultMap">
select * select *
from jcj_cjxx_view order by ws_rksj desc limit 1; from jcj_cjxx_view order by ws_rksj desc limit 1;

Loading…
Cancel
Save