| | |
| | | import com.yssh.utils.CalculateUtils; |
| | | import com.yssh.utils.DateUtils; |
| | | import com.yssh.utils.ExcelUtils; |
| | | import com.yssh.utils.WebUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | |
| | | logger.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据ID下载 |
| | | */ |
| | | public void downloadById(Integer id, HttpServletResponse res) { |
| | | XlsReport xlsReport = mapper.selectById(id); |
| | | if (null == xlsReport) return; |
| | | |
| | | String file = reportPath + File.separator + xlsReport.getPath(); |
| | | File f = new File(file); |
| | | if (!f.exists() || f.isDirectory()) return; |
| | | |
| | | try { |
| | | WebUtils.download(file, xlsReport.getName(), false, res); |
| | | } catch (Exception ex) { |
| | | logger.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |