1
zhang
2 天以前 e9cc2b361b5788c5e7aac0af3fe53031a76a6787
1
2个文件已修改
28 ■■■■ 已修改文件
zy-acs-common/src/main/java/com/zy/acs/common/utils/Utils.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-common/src/main/java/com/zy/acs/common/utils/Utils.java
@@ -2,10 +2,7 @@
import com.zy.acs.framework.common.Cools;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
@@ -76,6 +73,7 @@
    /**
     * 截取数组
     *
     * @param bytes 原数组
     * @param pos   定位(截取后包含定位点数据)
     * @param len   长度
@@ -258,14 +256,28 @@
        if (Cools.isEmpty(lastSeqNum)) {
            return zeroFill("1", 4);
        } else {
            if (isNumericZidai(lastSeqNum)) {
            int i = Integer.parseInt(lastSeqNum);
            if (i >= 9999) {
                return zeroFill("1", 4);
            } else {
                return zeroFill(String.valueOf(i+1), 4);
            }
            } else {
                return zeroFill(new Random().nextInt(1000000) + "", 6);
        }
    }
    }
    public static boolean isNumericZidai(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
    // pos start in 0
    public static boolean getBit(byte b, int position) {
zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
@@ -62,15 +62,15 @@
    }
    /**
     * 删除超过一天的上报历史记录
     * 删除超过一定天数的上报历史记录
     */
    @Scheduled(fixedDelay = 3000)
    public void execute2() {
        Boolean report = configService.getVal("REPORT", Boolean.class, false);
        if (report) {
            Calendar instance = Calendar.getInstance();
            instance.add(Calendar.DATE, 1);
            List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getCompleted, 1).ge(TaskReport::getUpdateTime, instance.getTime()));
            instance.add(Calendar.DATE, 7);
            List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().ge(TaskReport::getUpdateTime, instance.getTime()));
            Integer times = configService.getVal("REPORT_TIMES", Integer.class, 3);
            for (TaskReport taskReport : list) {
                if ((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) > times) {
@@ -99,7 +99,7 @@
                    .doPost();
            log.info("返回参数:{}", response);
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("code").equals(200)) {
            if (jsonObject != null && jsonObject.getInteger("code").equals(200)) {
                return true;
            }
        } catch (IOException e) {