|
|
|
@ -3,6 +3,7 @@ package com.ssf.mysqloracletest.task;
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import com.ssf.mysqloracletest.domain.JcjCjxxViewMysql;
|
|
|
|
|
import com.ssf.mysqloracletest.domain.JcjCjxxViewOracle;
|
|
|
|
|
import com.ssf.mysqloracletest.domain.JcjJjxxViewMysql;
|
|
|
|
|
import com.ssf.mysqloracletest.service.JcjCjxxViewMysqlService;
|
|
|
|
|
import com.ssf.mysqloracletest.service.JcjCjxxViewOracleService;
|
|
|
|
|
import com.ssf.mysqloracletest.utils.ConfigParam;
|
|
|
|
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
@ -23,7 +25,7 @@ import java.util.concurrent.ExecutorService;
|
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户数据接入
|
|
|
|
|
* 用户数据接入
|
|
|
|
|
*/
|
|
|
|
|
@Component
|
|
|
|
|
public class JcjCjxxTask {
|
|
|
|
@ -83,16 +85,16 @@ public class JcjCjxxTask {
|
|
|
|
|
byte[] qrCode1 = cjxx.getXZB();
|
|
|
|
|
byte[] qrCode2 = cjxx.getYZB();
|
|
|
|
|
try {
|
|
|
|
|
String filePath = getFolderPath(ConfigParam.GyzhafPhotoPicPath) + cjxx.getCJBH() +"XZB"+ StringKit.toString(UUID.randomUUID()).replaceAll("-", "") + ".jpg";
|
|
|
|
|
String filePath = getFolderPath(ConfigParam.GyzhafPhotoPicPath) + cjxx.getCJBH() + "XZB" + StringKit.toString(UUID.randomUUID()).replaceAll("-", "") + ".jpg";
|
|
|
|
|
File file = FileUtil.writeBytes(qrCode1, filePath);
|
|
|
|
|
logger.info(file.getPath() + ",生成成功");
|
|
|
|
|
String filePath1 = getFolderPath(ConfigParam.GyzhafPhotoPicPath) + cjxx.getCJBH() +"YZB"+ StringKit.toString(UUID.randomUUID()).replaceAll("-", "") + ".jpg";
|
|
|
|
|
String filePath1 = getFolderPath(ConfigParam.GyzhafPhotoPicPath) + cjxx.getCJBH() + "YZB" + StringKit.toString(UUID.randomUUID()).replaceAll("-", "") + ".jpg";
|
|
|
|
|
File file1 = FileUtil.writeBytes(qrCode2, filePath1);
|
|
|
|
|
logger.info(file1.getPath() + ",生成成功");
|
|
|
|
|
sBean.setXZB(filePath);
|
|
|
|
|
sBean.setYZB(filePath1);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.info(cjxx.getCJBH()+ ",文件生成失败");
|
|
|
|
|
logger.info(cjxx.getCJBH() + ",文件生成失败");
|
|
|
|
|
}
|
|
|
|
|
//确定一个数据是否唯一
|
|
|
|
|
JcjCjxxViewMysql checkcjxx = cjxxMysqlService.selectCjxxById(cjxx.getCJBH());
|
|
|
|
@ -127,6 +129,7 @@ public class JcjCjxxTask {
|
|
|
|
|
logger.info(StringKit.getTrace(e));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String getFolderPath(String picpath) {
|
|
|
|
|
String floderPath;
|
|
|
|
|
Date date = new Date();
|
|
|
|
@ -142,32 +145,47 @@ public class JcjCjxxTask {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* 功能描述: 接入出警信息实时数据
|
|
|
|
|
*
|
|
|
|
|
* @param:
|
|
|
|
|
* @return:
|
|
|
|
|
* @return:
|
|
|
|
|
* @auther: cyfeng
|
|
|
|
|
* @date: 2023/12/2 14:31
|
|
|
|
|
*/
|
|
|
|
|
@Scheduled(initialDelay = 100, fixedDelay = 3000)
|
|
|
|
|
public void transcjxxNow() {
|
|
|
|
|
|
|
|
|
|
if (!"true".equals(ConfigParam.cjxxSwitch)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
//1 去mysql查出当前最大时间
|
|
|
|
|
|
|
|
|
|
JcjCjxxViewMysql cjxxViewMysql = cjxxMysqlService.selectRecordOrderByRksj();
|
|
|
|
|
//2 用得到的最大时间去oracle 查询大于这个时间的记录
|
|
|
|
|
|
|
|
|
|
List<JcjCjxxViewOracle> list = cjxxOracleService.getRealTimeRecording(cjxxViewMysql.getCJSJ());
|
|
|
|
|
//3 解析入库
|
|
|
|
|
for (JcjCjxxViewOracle cjxx : list) {
|
|
|
|
|
JcjCjxxViewMysql sBean = new JcjCjxxViewMysql();
|
|
|
|
|
BeanUtils.copyProperties(cjxx, sBean);
|
|
|
|
|
//确定一个数据是否唯一
|
|
|
|
|
JcjCjxxViewMysql checkcjxx = cjxxMysqlService.selectCjxxById(cjxx.getCJBH());
|
|
|
|
|
|
|
|
|
|
if (checkcjxx == null) {
|
|
|
|
|
cjxxMysqlService.insertCjxx(sBean);
|
|
|
|
|
logger.info("cjxx-" + cjxx.getCJBH() + ":插入成功");
|
|
|
|
|
} else {
|
|
|
|
|
cjxxMysqlService.updateCjxxById(sBean);
|
|
|
|
|
logger.info("cjxx-" + cjxx.getCJBH() + ":更新成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|