1
zhang
2 天以前 e9cc2b361b5788c5e7aac0af3fe53031a76a6787
zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
@@ -46,8 +46,9 @@
            String wmsPath = configService.getVal("WMS_PATH", String.class);
            List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getCompleted, 0).le(TaskReport::getReportTimes, 3));
            for (TaskReport taskReport : list) {
                log.info("开始上报:{}", taskReport);
                if (report(new TaskEvent(taskReport.getSeqNum(), taskReport.getEventType(), taskReport.getAgvId() + ""), wmsUrl, wmsPath)) {
                TaskEvent taskEvent = new TaskEvent(taskReport.getSeqNum(), taskReport.getEventType(), taskReport.getAgvId() + "");
                log.info("开始上报:{}", taskEvent);
                if (report(taskEvent, wmsUrl, wmsPath)) {
                    taskReport.setReportTimes((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) + 1);
                    taskReport.setUpdateTime(new Date());
                    taskReport.setCompleted(1);
@@ -61,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) {
@@ -92,12 +93,13 @@
            response = new HttpHandler.Builder()
                    .setUri(wmsUrl)
                    .setPath(wmsPath)
                    .setJson(JSON.toJSONString(taskReport))
                    .build()
                    .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) {