|
|
@ -15,9 +15,6 @@ import com.zdxt.enforcementcode.report.IStatisticsInspectionPlanReport; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.pdfbox.Loader; |
|
|
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument; |
|
|
|
|
|
import org.apache.pdfbox.pdmodel.PDDocumentInformation; |
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -144,41 +141,7 @@ public class StatisticsInspectionPlanReportImpl implements IStatisticsInspection |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void previewFile(String id, HttpServletResponse response) { |
|
|
|
|
|
LambdaQueryWrapper<ZdxtFile> bo = new LambdaQueryWrapper<>(); |
|
|
|
|
|
bo.eq(ZdxtFile::getGuid, id); |
|
|
|
|
|
List<ZdxtFileVo> files = zdxtFileMapper.selectVoList(bo); |
|
|
|
|
|
if (files.size() == 0) return; |
|
|
|
|
|
String path = files.get(0).getUploadPath().replace("/profile", urlProfile); |
|
|
|
|
|
OutputStream os=null; |
|
|
|
|
|
try{ |
|
|
|
|
|
FileInputStream is=new FileInputStream(path); |
|
|
|
|
|
response.reset(); |
|
|
|
|
|
response.setContentType("application/pdf;charset=UTF-8"); |
|
|
|
|
|
response.setHeader("Content-Disposition", "inline;filename=file." + path); |
|
|
|
|
|
byte[] bs = new byte[is.available()]; |
|
|
|
|
|
is.read(bs); |
|
|
|
|
|
os = response.getOutputStream(); |
|
|
|
|
|
PDDocument doc= Loader.loadPDF(bs); |
|
|
|
|
|
PDDocumentInformation info =doc.getDocumentInformation(); |
|
|
|
|
|
info.setTitle("附件"); |
|
|
|
|
|
doc.setDocumentInformation(info); |
|
|
|
|
|
doc.save(os); |
|
|
|
|
|
doc.close(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
}finally { |
|
|
|
|
|
if(os!=null){ |
|
|
|
|
|
try{ |
|
|
|
|
|
os.flush(); |
|
|
|
|
|
os.close(); |
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ===== 私有方法 =====
|
|
|
// ===== 私有方法 =====
|
|
|
|
|
|
|
|
|
|