燕山石化溯源三维电子沙盘-【后端】-服务
e268d54c84a86bd2e82e56860525181537758d16..45c17599219449d032af7d6a78e9cb000c72fc1d
2024-11-05 13693261870
1
45c175 对比 | 目录
2024-11-01 13693261870
1
99042d 对比 | 目录
2024-11-01 13693261870
1
2b75d8 对比 | 目录
已修改8个文件
89 ■■■■ 文件已修改
src/main/java/com/yssh/config/InitConfig.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/ScheduleConfig.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/DistanceSuYuan.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/SuYuanService.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/CsvParser.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-scheduled.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-test.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/logback.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/InitConfig.java
@@ -28,8 +28,8 @@
    @Resource
    WarningAnalyseService warningAnalyseService;
    //@Resource
    //ScheduleConfig task;
    @Resource
    ScheduleConfig task;
    @Resource
    XlsReportService xlsReportService;
@@ -52,7 +52,6 @@
        //task.createMonthReport();
        //task.corpReserveDataSync();
        //task.corpReserveDataSync();
        //warningAnalyseService.warningOperationStorage(cal.getTime());
        /*Calendar cal1 = Calendar.getInstance();
src/main/java/com/yssh/config/ScheduleConfig.java
@@ -58,22 +58,32 @@
    @Value("${email.enable}")
    private Boolean enableEmail;
    private static boolean flag = false;
    private static final Object OBJ = new Object();
    private final static List<String> md5List = new ArrayList<>();
    private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
    public void corpReserveDataSync() {
        loadVocSync();
        //loadVocSync();
        loadCsvSync();
    }
    @Scheduled(cron = "${csv.cron}")
    private void loadCsvSync() {
        synchronized (OBJ) {
            if (flag) return;
            flag = true;
        }
        logger.info("***************** 开始执行CSV入库 *****************" + "\n");
        Calendar calendar = getCalendar(1);
        calendar.add(Calendar.HOUR, -cronMax);
        for (int i = 0; i < cronMax; i++) {
            try {
                calendar.add(Calendar.HOUR, -1);
                calendar.add(Calendar.HOUR, 1);
                String time = format.format(calendar.getTime());
                String filePath = csvFilePathConfig.getFilePath() + File.separator + time + ".csv";
@@ -102,6 +112,7 @@
            }
        }
        logger.info("***************** CSV入库执行完成 *****************" + "\n");
        flag = false;
    }
    public Calendar getCalendar(int start) {
src/main/java/com/yssh/entity/DistanceSuYuan.java
@@ -11,8 +11,6 @@
import lombok.NoArgsConstructor;
import lombok.ToString;
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class DistanceSuYuan implements Serializable, Comparable<DistanceSuYuan> {
    private static final long serialVersionUID = -115407591473808022L;
@@ -48,6 +46,25 @@
    private double lat;
    public DistanceSuYuan() {
    }
    public DistanceSuYuan(String name, String vocsName, double vocsValue, String id, Integer x, Integer y, double u, double v, String addr, double windSpeed, double windDirection, double lon, double lat) {
        this.name = name;
        this.vocsName = vocsName;
        this.vocsValue = vocsValue;
        this.id = id;
        this.x = x;
        this.y = y;
        this.u = u;
        this.v = v;
        this.addr = addr;
        this.windSpeed = windSpeed;
        this.windDirection = windDirection;
        this.lon = lon;
        this.lat = lat;
    }
    public String getId() {
        return id;
    }
src/main/java/com/yssh/service/SuYuanService.java
@@ -126,7 +126,8 @@
        }
        if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> list = getList(ids3d, source);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
@@ -145,6 +146,20 @@
        return result;
    }
    private List<DistanceSuYuan> getList(List<String> ids3d, List<DistanceSuYuan> source) {
        List<DistanceSuYuan> list = new ArrayList<>();
        for (String id : ids3d) {
            DistanceSuYuan suYuan = source.stream().filter(db -> id.equals(db.getId())).findFirst().orElse(null);
            if (null == suYuan) {
                String[] strs = id.split("_");
                suYuan = new DistanceSuYuan(null, null, 0.0, id, Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), 0, 0, null, 0.0, 0.0, 0.0, 0.0);
            }
            list.add(suYuan);
        }
        return list;
    }
    public Map<String, Object> selectSuYuan200(String name, Date date) {
        Map<String, Object> result = new HashMap<String, Object>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
@@ -160,7 +175,8 @@
        }
        if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> list = getList(ids3d, source);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
@@ -194,7 +210,8 @@
        }
        if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> list = getList(ids3d, source);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
@@ -228,7 +245,8 @@
        }
        if (suYuanMapper.isTableExists(dictRecord.getTableName()) == 0) return null;
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> source = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        List<DistanceSuYuan> list = getList(ids3d, source);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
src/main/java/com/yssh/utils/CsvParser.java
@@ -56,8 +56,13 @@
        /*if ("0_0_0".equals(t.getId())) {
            return; // 解决主键重复
        }*/
        if (t.getZ() > 0 && t.getC() < jcyj) {
        /*if (t.getZ() > 0 && t.getC() < jcyj) {
            return; // 只入第0层数据+Voc值大于1
        }*/
        // 只入值 > =0.05
        if (t.getC() < 0.1) {
            return;
        }
        cachedData.add(t);
src/main/resources/application-scheduled.yml
@@ -1,7 +1,7 @@
csv:
  # 221Mb CSV入库时间
  cron: '0 35 * * * ?'
  cron_max: 720
  # 221Mb CSV入库时间,35,720
  cron: '* 35 * * * ?'
  cron_max: 5200
  # 112Kb CSV入库时间
  voc: '0 40 * * * ?'
src/main/resources/application-test.yml
@@ -21,11 +21,11 @@
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        #url: jdbc:mysql://127.0.0.1:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        url: jdbc:mysql://192.168.11.206:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        url: jdbc:mysql://127.0.0.1:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        #url: jdbc:mysql://192.168.11.206:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        username: root
        #password: mysql
        password: 123456
        password: mysql
        #password: 123456
        # 初始连接数
        initialSize: 10
        # 最小连接池数量
src/main/resources/logback.xml
@@ -8,6 +8,7 @@
    <!-- 控制台输出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <charset>UTF-8</charset>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>