package com.glxp.udidl.admin.thread; import com.glxp.udidl.admin.controller.device.DownloadDeviceHelper; import com.glxp.udidl.admin.dao.udid.DevicedownloadMapper; import com.glxp.udidl.admin.entity.udid.Devicedownload; import com.glxp.udidl.admin.entity.udid.TokenEntity; import com.glxp.udidl.admin.req.udid.DeviceRequest; import com.glxp.udidl.admin.req.udid.DownloadDiRequest; import com.glxp.udidl.admin.service.dataSync.DeviceDownloadService; import com.glxp.udidl.admin.service.dataSync.DeviceSyncService; import com.glxp.udidl.admin.service.info.CompanyService; import com.glxp.udidl.admin.service.inout.DeviceService; import com.glxp.udidl.admin.service.inout.ProductInfoService; import com.glxp.udidl.admin.service.udi.UdiCompanyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.annotation.Resource; @Service public class AsyncDownloadTask { @Resource DeviceService deviceService; @Resource CompanyService companyService; @Resource UdiCompanyService udiCompanyService; @Resource ProductInfoService productInfoService; @Resource DeviceDownloadService deviceDownloadService; @Resource DeviceSyncService deviceSyncService; @Resource DownloadDeviceHelper downloadDeviceHelper; @Async public void downloadByDi(String primaryDeviceId) { String token = deviceDownloadService.getToken(); DownloadDiRequest downloadDiRequest = new DownloadDiRequest(); downloadDiRequest.setAccessToken(token); downloadDiRequest.setPrimaryDeviceId(primaryDeviceId); downloadDeviceHelper.downloadBydi(downloadDiRequest, deviceService, productInfoService); } //https://www.udims.com/UDI_DL_Server/udidl/device/dlBymonth?month=2021-10&page=1 //按月下载UDI @Async public void downloadByMonth(String month, int page) { deviceDownloadService.downloadByMonth(month, page); } @Async public void downloadByMonthTest(String month, int page) { deviceDownloadService.downloadByMonthTest(month, page); } }