use of com.bc.pmpheep.annotation.LogDetail in project pmph by BCSquad.
the class FileDownLoadController method declarationWord.
/**
* 功能描述:申报表批量导出word
*
* @param materialId
* 教材id
* @param textBookids
* 书籍id集合
* @param realname
* 条件查询的账号或者姓名
* @param position
* 条件查询 职务
* @param title
* 条件查询 职称
* @param orgName
* 条件查询 工作单位
* @param unitName
* 条件查询 申报单位
* @param positionType
* 条件查询 申报职位 ;null全部 1主编 2副主编 3编委
* @param onlineProgress
* 1待审核 3已经审核
* @param offlineProgress
* 0 未 2 收到
* @param response
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "申报表批量导出word")
@RequestMapping(value = "/word/declaration", method = RequestMethod.GET)
public String declarationWord(Long materialId, String textBookids, String realname, String position, String title, String orgName, String unitName, Integer positionType, Integer onlineProgress, Integer offlineProgress) {
String id = String.valueOf(System.currentTimeMillis()).concat(String.valueOf(RandomUtil.getRandomNum()));
taskExecutor.execute(new SpringThread(zipHelper, wordHelper, materialService, textbookService, declarationService, materialId, textBookids, realname, position, title, orgName, unitName, positionType, onlineProgress, offlineProgress, id, materialExtensionService));
return '"' + id + '"';
}
use of com.bc.pmpheep.annotation.LogDetail in project pmph by BCSquad.
the class FileDownLoadController method exportResultBook.
/**
* Description:申报结果统计页面按书名统计导出统计结果
*
* @author:lyc
* @date:2018年1月9日下午2:42:26
* @param
* @return void
*/
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "申报结果统计页面按书名统计导出统计结果")
@RequestMapping(value = "/result/exportResultBook", method = RequestMethod.GET)
public void exportResultBook(Long materialId, String bookName, HttpServletRequest request, HttpServletResponse response) {
PageParameter<DeclarationResultBookVO> pageParameter = new PageParameter<>(1, 50000);
DeclarationResultBookVO declarationResultBookVO = new DeclarationResultBookVO();
declarationResultBookVO.setMaterialId(materialId);
declarationResultBookVO.setBookName(bookName);
pageParameter.setParameter(declarationResultBookVO);
Workbook workbook = null;
List<DeclarationResultBookVO> list = null;
list = decPositionService.listDeclarationResultBookVOs(pageParameter).getRows();
if (list.size() == 0) {
list.add(new DeclarationResultBookVO());
}
try {
workbook = excelHelper.fromBusinessObjectList(list, "申报结果按书名统计");
} catch (CheckedServiceException | IllegalArgumentException | IllegalAccessException e) {
logger.warn("数据表格化的时候失败");
}
Material material = materialService.getMaterialById(materialId);
String fileName = returnFileName(request, material.getMaterialName() + ".xls");
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
try (OutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.warn("文件下载时出现IO异常: {}", e.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_DOWNLOAD_FAILED, "文件在传输时中断");
}
}
use of com.bc.pmpheep.annotation.LogDetail in project pmph by BCSquad.
the class FileDownLoadController method exportEditors.
/**
* 角色遴选 批量导出主编、副主编
*
* @param textbookIds
* @param request
* @param response
* @throws IllegalAccessException
*/
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "角色遴选 批量导出主编、副主编")
@RequestMapping(value = "/position/exportEditors", method = RequestMethod.GET)
public void exportEditors(Long[] textbookIds, HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, Exception {
List<DecPositionBO> list;
Workbook workbook = null;
try {
list = textbookService.getExcelDecByMaterialId(textbookIds);
workbook = excelHelper.fromDecPositionBOList(list, "主编-副主编");
} catch (CheckedServiceException | IllegalArgumentException e) {
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_CREATION_FAILED, "数据表格化的时候失败");
}
// 通过书籍id获取教材信息
Material material = materialService.getMaterialByName(textbookIds);
String fileName = returnFileName(request, material.getMaterialName() + ".xls");
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
try (OutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.warn("文件下载时出现IO异常:{}", e.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_DOWNLOAD_FAILED, "文件在传输时中断");
}
}
use of com.bc.pmpheep.annotation.LogDetail in project pmph by BCSquad.
the class FileDownLoadController method surveyQuestionExcel.
/**
* <pre>
* 功能描述:导出填空题调查结果Excel 使用示范:
*
* @user tyc
* @param request
* @param response
* 2018.01.08 18:31
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "导出填空题调查结果")
@RequestMapping(value = "/excel/surveyQuestionExcel", method = RequestMethod.GET)
public void surveyQuestionExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam("surveyId") Long surveyId, @RequestParam("questionId") Long questionId) {
Workbook workbook = null;
List<SurveyQuestionFillVO> surveyQuestionFillVO = null;
try {
PageParameter<SurveyQuestionFillVO> pageParameter = new PageParameter<>(1, 50000);
pageParameter.setParameter(new SurveyQuestionFillVO(surveyId, questionId));
surveyQuestionFillVO = surveyQuestionAnswerService.listFillQuestion(pageParameter).getRows();
if (CollectionUtil.isEmpty(surveyQuestionFillVO)) {
surveyQuestionFillVO.add(new SurveyQuestionFillVO());
}
workbook = excelHelper.fromBusinessObjectList(surveyQuestionFillVO, "填空题调查结果");
} catch (CheckedServiceException | IllegalArgumentException | IllegalAccessException e) {
logger.warn("数据表格化的时候失败");
}
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
String name = "填空题调查结果";
String fileName = returnFileName(request, name + ".xls");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
try (OutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.warn("文件下载时出现IO异常:{}", e.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_DOWNLOAD_FAILED, "文件在传输时中断");
}
}
use of com.bc.pmpheep.annotation.LogDetail in project pmph by BCSquad.
the class FileDownLoadController method exportExcel.
/**
* 导出纠错信息
*
* @introduction
* @author Mryang
* @createDate 2017年12月20日 下午5:01:53
* @param request
* @param response
* @param bookname
* @param isEditorReplied
* @throws CheckedServiceException
* @throws Exception
*/
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "导出纠错信息")
@RequestMapping(value = "/bookCorrectionTrack/exportExcel", method = RequestMethod.GET)
public void exportExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "bookname", required = false) String bookname, @RequestParam(value = "isEditorReplied", required = false) Boolean isEditorReplied) throws CheckedServiceException, Exception {
Workbook workbook = null;
List<BookCorrectionTrackVO> list = null;
try {
list = bookCorrectionService.listBookCorrectionTrack(request, null, null, bookname, isEditorReplied, null).getRows();
if (list.size() == 0) {
// 设置表头 ,放置初始化表出错
list.add(new BookCorrectionTrackVO());
}
workbook = excelHelper.fromBusinessObjectList(list, "sheet1");
} catch (CheckedServiceException | IllegalArgumentException e) {
logger.warn("数据表格化的时候失败");
}
String fileName = returnFileName(request, "纠错跟踪" + DateUtil.getTime() + ".xls");
response.setCharacterEncoding("utf-8");
response.setContentType("application/force-download");
response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", fileName));
try (OutputStream out = response.getOutputStream()) {
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.warn("文件下载时出现IO异常:{}", e.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.FILE, CheckedExceptionResult.FILE_DOWNLOAD_FAILED, "文件在传输时中断");
}
}
Aggregations