From 9fc60ad29590eeffb19a348caed94718ae26f8d3 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Sat, 13 Aug 2022 13:38:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=A7=E7=BB=AD=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E9=87=8D=E6=96=B0=E4=B8=8B=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E5=85=BC=E5=AE=B9jdk11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 21 +++++++++++++++++++ .../device/UdidlDeviceController.java | 13 ++++++++++-- .../controller/info/JobLogController.java | 19 +++++++++++++---- .../dataSync/DeviceDownloadService.java | 2 +- .../admin/service/udi/JobLogService.java | 4 +++- .../service/udi/impl/JobLogServiceImpl.java | 5 +++++ 6 files changed, 56 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 9b11842..a7e58a5 100644 --- a/pom.xml +++ b/pom.xml @@ -180,6 +180,27 @@ 4.2.3 + + javax.xml.bind + jaxb-api + 2.3.0 + + + com.sun.xml.bind + jaxb-impl + 2.3.0 + + + com.sun.xml.bind + jaxb-core + 2.3.0 + + + javax.activation + activation + 1.1.1 + + diff --git a/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java b/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java index ef15719..f500fd3 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/device/UdidlDeviceController.java @@ -60,9 +60,18 @@ public class UdidlDeviceController { @ApiImplicitParam(name = "day", value = "指定日期", required = true, dataType = "String") @AuthRuleAnnotation("udidl/device/dlByDay") @GetMapping("udidl/device/dlByDay") - public BaseResponse dlByDay(String day) { + public BaseResponse dlByDay(String day, String jobId) { logger.info(day + "---按天开启下载"); - deviceSyncService.downloadUdi(day, "manual"); + + if (jobId != null) { + jobLogService.deleteById(jobId); + } + DeviceRequest deviceRequest = new DeviceRequest(); + deviceRequest.setRequestType("1"); //按天请求 + deviceRequest.setRangeValue(day); + deviceRequest.setDownloadType("manual"); //下载方式 + deviceRequest.setDataType("3"); //全量下载 + deviceSyncService.downloadUdiData(deviceRequest); return ResultVOUtils.success("后台已开始下载!"); } diff --git a/src/main/java/com/glxp/udidl/admin/controller/info/JobLogController.java b/src/main/java/com/glxp/udidl/admin/controller/info/JobLogController.java index 6be3f8b..89864c2 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/info/JobLogController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/info/JobLogController.java @@ -3,15 +3,14 @@ package com.glxp.udidl.admin.controller.info; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.entity.udid.JobLog; import com.glxp.udidl.admin.req.udid.JobLogFilterRequest; +import com.glxp.udidl.admin.req.udid.JobRequest; import com.glxp.udidl.admin.res.BaseResponse; import com.glxp.udidl.admin.service.udi.JobLogService; +import com.glxp.udidl.admin.util.ResultVOUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @Api(tags = "任务日志接口") @RestController @@ -28,4 +27,16 @@ public class JobLogController { return jobLogService.getList(jobLogFilterRequest); } + @AuthRuleAnnotation("jobLog/delete") + @PostMapping("/delete") + public BaseResponse deleteById(@RequestBody JobRequest jobRequest) { + int result = jobLogService.deleteById(jobRequest.getJobId()); + if (result != -1) { + return ResultVOUtils.success("删除成功"); + } else { + return ResultVOUtils.error(500, "下载失败!"); + } + } + + } diff --git a/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java b/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java index d81a29f..57e07e6 100644 --- a/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java +++ b/src/main/java/com/glxp/udidl/admin/service/dataSync/DeviceDownloadService.java @@ -329,7 +329,7 @@ public class DeviceDownloadService { jobLog.setRealCount(jobLog.getRealCount() + dataSetResult.getDataSet().getDeviceInfo().size()); jobLog.setInsertCount(jobLog.getInsertCount() + insertCount); jobLog.setTotalCount(dataSetResult.getTotalRecordCount()); - jobLog.setMsg("下载中:" + "总条数:" + dataSetResult.getTotalRecordCount() + ";下载条数:" + jobLog.getInsertCount() + ";插入条数:" + jobLog.getInsertCount()); + jobLog.setMsg("下载中:" + "总条数:" + dataSetResult.getTotalRecordCount() + ";下载条数:" + jobLog.getRealCount() + ";插入条数:" + jobLog.getInsertCount()); jobLog.setLastUploadRequest(JSONUtil.toJsonStr(deviceRequest)); jobLogService.update(jobLog); } catch (Exception e) { diff --git a/src/main/java/com/glxp/udidl/admin/service/udi/JobLogService.java b/src/main/java/com/glxp/udidl/admin/service/udi/JobLogService.java index 0b79447..d440512 100644 --- a/src/main/java/com/glxp/udidl/admin/service/udi/JobLogService.java +++ b/src/main/java/com/glxp/udidl/admin/service/udi/JobLogService.java @@ -7,7 +7,6 @@ import com.glxp.udidl.admin.res.BaseResponse; public interface JobLogService { BaseResponse getList(JobLogFilterRequest param); - JobLog findById(String jobId); int insert(JobLog jobLog); @@ -20,4 +19,7 @@ public interface JobLogService { * @param jobLog */ int insertLog(JobLog jobLog); + + + int deleteById(String jobId); } diff --git a/src/main/java/com/glxp/udidl/admin/service/udi/impl/JobLogServiceImpl.java b/src/main/java/com/glxp/udidl/admin/service/udi/impl/JobLogServiceImpl.java index 5cf70e6..6b3bb7f 100644 --- a/src/main/java/com/glxp/udidl/admin/service/udi/impl/JobLogServiceImpl.java +++ b/src/main/java/com/glxp/udidl/admin/service/udi/impl/JobLogServiceImpl.java @@ -58,4 +58,9 @@ public class JobLogServiceImpl implements JobLogService { return insert; } + @Override + public int deleteById(String jobId) { + return jobLogMapper.deleteById(jobId); + } + }