| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.core.utils.HttpHandler; |
| | | import com.zy.acs.manager.manager.entity.TaskReport; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | if (report) { |
| | | String wmsUrl = configService.getVal("WMS_URL", String.class); |
| | | String wmsPath = configService.getVal("WMS_PATH", String.class); |
| | | Integer times = configService.getVal("REPORT_TIMES", Integer.class, 3); |
| | | String codes = configService.getVal("CODES", String.class, "1457;1612"); |
| | | List<TaskReport> list = taskReportService.list(); |
| | | List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getCompleted, 0).le(TaskReport::getReportTimes, 3)); |
| | | for (TaskReport taskReport : list) { |
| | | if ((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) > times) { |
| | | toLog(taskReport); |
| | | continue; |
| | | } |
| | | if (report(taskReport, wmsUrl, wmsPath)) { |
| | | toLog(taskReport); |
| | | taskReport.setReportTimes((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) + 1); |
| | | taskReport.setUpdateTime(new Date()); |
| | | taskReport.setCompleted(1); |
| | | } else { |
| | | taskReport.setReportTimes((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) + 1); |
| | | taskReport.setUpdateTime(new Date()); |
| | | taskReportService.updateById(taskReport); |
| | | } |
| | | taskReportService.updateById(taskReport); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 3000) |
| | | public void execute2() { |
| | | 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())); |
| | | Integer times = configService.getVal("REPORT_TIMES", Integer.class, 3); |
| | | for (TaskReport taskReport : list) { |
| | | if ((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) > times) { |
| | | toLog(taskReport); |
| | | } |
| | | } |
| | | list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getReportTimes, 4).ge(TaskReport::getUpdateTime, instance.getTime())); |
| | | for (TaskReport taskReport : list) { |
| | | if ((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) > times) { |
| | | toLog(taskReport); |
| | | } |
| | | } |
| | | } |