| | |
| | | de.setDownloadUser(ue.getId()); |
| | | int rows = downloadService.update(de); |
| | | |
| | | //String filePath = exportService.getDownloadFilePath(de); |
| | | //WebHelper.download(filePath, de.getName(), res); |
| | | String filePath = downloadService.getDownloadFilePath(de); |
| | | WebHelper.download(filePath, de.getName(), res); |
| | | } catch (Exception ex) { |
| | | WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); |
| | | } |
| | |
| | | de.setDownloadUser(ue.getId()); |
| | | int rows = downloadService.update(de); |
| | | |
| | | String filePath = exportService.getDownloadFilePath(de); |
| | | String filePath = downloadService.getDownloadFilePath(de); |
| | | WebHelper.download(filePath, de.getName(), res); |
| | | } catch (Exception ex) { |
| | | WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class DownloadService implements DownloadMapper { |
| | | @Autowired |
| | | PathHelper pathHelper; |
| | | |
| | | @Autowired |
| | | DownloadMapper downloadMapper; |
| | | |
| | |
| | | public Integer updates(List<DownloadEntity> list) { |
| | | return downloadMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | * |
| | | * @param de 下载实体类 |
| | | * @return 下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | } |
| | |
| | | |
| | | return de; |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | * |
| | | * @param de 下载实体类 |
| | | * @return 下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | } |