use of com.bc.pmpheep.back.vo.DeclarationResultBookVO in project pmph by BCSquad.
the class DecPositionServiceImpl method listDeclarationResultBookVOs.
@Override
public PageResult<DeclarationResultBookVO> listDeclarationResultBookVOs(PageParameter<DeclarationResultBookVO> pageParameter) throws CheckedServiceException {
if (ObjectUtil.isNull(pageParameter.getParameter().getMaterialId())) {
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.NULL_PARAM, "教材id不能为空");
}
String bookName = pageParameter.getParameter().getBookName();
if (StringUtil.notEmpty(bookName)) {
pageParameter.getParameter().setBookName(bookName);
}
PageResult<DeclarationResultBookVO> pageResult = new PageResult<DeclarationResultBookVO>();
PageParameterUitl.CopyPageParameter(pageParameter, pageResult);
int total = decPositionDao.getBooks(pageParameter.getParameter().getMaterialId());
if (total > 0) {
List<DeclarationResultBookVO> books = decPositionDao.getBookListTwo(pageParameter);
List<DeclarationResultBookVO> VOs = decPositionDao.getBookChosenList(pageParameter);
List<DeclarationResultBookVO> list = new ArrayList<>();
if (null == VOs || VOs.isEmpty()) {
pageResult.setRows(books);
pageResult.setTotal(total);
return pageResult;
}
for (DeclarationResultBookVO book : books) {
for (DeclarationResultBookVO vo : VOs) {
if (vo.getId().equals(book.getId())) {
book.setEditorList(vo.getEditorList());
book.setSubEditorList(vo.getSubEditorList());
book.setEditorialList(vo.getEditorialList());
book.setIsDigitalEditorList(vo.getIsDigitalEditorList());
if (StringUtil.isEmpty(book.getEditorList())) {
book.setEditorList("-");
}
if (StringUtil.isEmpty(book.getSubEditorList())) {
book.setSubEditorList("-");
}
if (StringUtil.isEmpty(book.getEditorialList())) {
book.setEditorialList("-");
}
if (StringUtil.isEmpty(book.getIsDigitalEditorList())) {
book.setIsDigitalEditorList("-");
}
break;
}
}
list.add(book);
}
pageResult.setRows(list);
pageResult.setTotal(total);
}
return pageResult;
}
use of com.bc.pmpheep.back.vo.DeclarationResultBookVO 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.back.vo.DeclarationResultBookVO in project pmph by BCSquad.
the class DecPositionController method bookList.
/**
* Description:加载书本统计结果
*
* @author:lyc
* @date:2017年12月1日下午6:50:46
* @param
* @return ResponseBean
*/
@ResponseBody
@RequestMapping(value = "/list/bookList", method = RequestMethod.GET)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "加载书本统计结果")
public ResponseBean bookList(Integer pageSize, Integer pageNumber, Long materialId, String bookName) {
PageParameter<DeclarationResultBookVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
DeclarationResultBookVO declarationResultBookVO = new DeclarationResultBookVO();
declarationResultBookVO.setMaterialId(materialId);
declarationResultBookVO.setBookName(bookName);
pageParameter.setParameter(declarationResultBookVO);
return new ResponseBean(decPositionService.listDeclarationResultBookVOs(pageParameter));
}
Aggregations