Browse Source

#两票统计

zhongwei
yang_shj 11 months ago
parent
commit
c3057ba1c3
  1. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java
  2. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java
  3. 57
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java

@ -36,8 +36,8 @@ public class CensController {
@GetMapping ("/censExport")
@ApiOperation("两票统计导出")
@ApiOperationSupport(order = 2)
public R censExport(HttpServletResponse response,CensParamVo param) {
return censService.censExport(response,param);
public void censExport(HttpServletResponse response,CensParamVo param) {
censService.censExport(response,param);
}
@PostMapping("/censYear")
@ -50,7 +50,7 @@ public class CensController {
@GetMapping ("/censYearExport")
@ApiOperation("两票年度统计导出")
@ApiOperationSupport(order = 4)
public R censYearExport(HttpServletResponse response,CensYearParamVo param) {
return censService.censYearExport(response,param);
public void censYearExport(HttpServletResponse response,CensYearParamVo param) {
censService.censYearExport(response,param);
}
}

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java

@ -18,7 +18,7 @@ public interface CensService {
List<CensYearVo> censYear(CensYearParamVo param);
R censExport(HttpServletResponse response, CensParamVo param);
void censExport(HttpServletResponse response, CensParamVo param);
R censYearExport(HttpServletResponse response, CensYearParamVo param);
void censYearExport(HttpServletResponse response, CensYearParamVo param);
}

57
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

@ -222,7 +222,7 @@ public class CensServiceImpl implements CensService {
* @param param
*/
@Override
public R censExport(HttpServletResponse response, CensParamVo param) {
public void censExport(HttpServletResponse response, CensParamVo param) {
// 创建Excel文件
HSSFWorkbook hssWB = new HSSFWorkbook();
// 添加sheet页
@ -259,7 +259,6 @@ public class CensServiceImpl implements CensService {
} catch (IOException e) {
e.printStackTrace();
}
return R.data("success");
}
/**
@ -367,7 +366,6 @@ public class CensServiceImpl implements CensService {
headStyle.setFillForegroundColor(HSSFColor.HSSFColorPredefined.WHITE.getIndex());
}
//字体格式
headStyle.setFont(font);
return headStyle;
}
@ -387,7 +385,7 @@ public class CensServiceImpl implements CensService {
CensVo cens = censs.get(i);
// 序号
HSSFCell header_row_cell_0 = row.getCell(0);
header_row_cell_0.setCellValue(i);
header_row_cell_0.setCellValue(i + 1);
// 单位
HSSFCell header_row_cell_1 = row.getCell(1);
header_row_cell_1.setCellValue(cens.getDeptName());
@ -409,14 +407,14 @@ public class CensServiceImpl implements CensService {
* @param param
*/
@Override
public R censYearExport(HttpServletResponse response, CensYearParamVo param) {
public void censYearExport(HttpServletResponse response, CensYearParamVo param) {
if(StringUtil.isEmpty(param.getYear())){
param.setYear(DateUtil.format(new Date(),"yyyy"));
}
// 创建Excel文件
HSSFWorkbook hssWB = new HSSFWorkbook();
// 添加sheet页
HSSFSheet sheet = hssWB.createSheet("两票" + param.getYear() + "年度统计报表");
HSSFSheet sheet = hssWB.createSheet(param.getYear() +"两票年度统计报表");
// 行高
sheet.setDefaultRowHeight((short) (20 * 25));
// 列宽
@ -431,7 +429,7 @@ public class CensServiceImpl implements CensService {
}
// 下载导出
String filename = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) + "年度两票统计报表";
String filename = param.getYear() + "年度两票统计报表";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
@ -449,7 +447,6 @@ public class CensServiceImpl implements CensService {
} catch (IOException e) {
e.printStackTrace();
}
return R.data("success");
}
/**
@ -466,31 +463,31 @@ public class CensServiceImpl implements CensService {
header_row_1_cell_1.setCellValue("序号");
HSSFCell header_row_1_cell_2 = row_1.getCell(1);
header_row_1_cell_2.setCellValue("单位");
HSSFCell header_row_1_cell_3 = row_1.getCell(3);
HSSFCell header_row_1_cell_3 = row_1.getCell(2);
header_row_1_cell_3.setCellValue("1月");
HSSFCell header_row_1_cell_4 = row_1.getCell(5);
HSSFCell header_row_1_cell_4 = row_1.getCell(4);
header_row_1_cell_4.setCellValue("2月");
HSSFCell header_row_1_cell_5 = row_1.getCell(7);
HSSFCell header_row_1_cell_5 = row_1.getCell(6);
header_row_1_cell_5.setCellValue("3月");
HSSFCell header_row_1_cell_6 = row_1.getCell(9);
HSSFCell header_row_1_cell_6 = row_1.getCell(8);
header_row_1_cell_6.setCellValue("4月");
HSSFCell header_row_1_cell_7 = row_1.getCell(11);
HSSFCell header_row_1_cell_7 = row_1.getCell(10);
header_row_1_cell_7.setCellValue("5月");
HSSFCell header_row_1_cell_8 = row_1.getCell(13);
HSSFCell header_row_1_cell_8 = row_1.getCell(12);
header_row_1_cell_8.setCellValue("6月");
HSSFCell header_row_1_cell_9 = row_1.getCell(15);
HSSFCell header_row_1_cell_9 = row_1.getCell(14);
header_row_1_cell_9.setCellValue("7月");
HSSFCell header_row_1_cell_10 = row_1.getCell(17);
HSSFCell header_row_1_cell_10 = row_1.getCell(16);
header_row_1_cell_10.setCellValue("8月");
HSSFCell header_row_1_cell_11 = row_1.getCell(19);
HSSFCell header_row_1_cell_11 = row_1.getCell(18);
header_row_1_cell_11.setCellValue("9月");
HSSFCell header_row_1_cell_12 = row_1.getCell(21);
HSSFCell header_row_1_cell_12 = row_1.getCell(20);
header_row_1_cell_12.setCellValue("10月");
HSSFCell header_row_1_cell_13 = row_1.getCell(23);
HSSFCell header_row_1_cell_13 = row_1.getCell(22);
header_row_1_cell_13.setCellValue("11月");
HSSFCell header_row_1_cell_14 = row_1.getCell(25);
HSSFCell header_row_1_cell_14 = row_1.getCell(24);
header_row_1_cell_14.setCellValue("12月");
HSSFCell header_row_1_cell_15 = row_1.getCell(27);
HSSFCell header_row_1_cell_15 = row_1.getCell(26);
header_row_1_cell_15.setCellValue("总计");
// 第二行
@ -596,7 +593,7 @@ public class CensServiceImpl implements CensService {
CensYearVo censYear = censYears.get(i);
// 序号
HSSFCell header_row_cell_0 = row.getCell(0);
header_row_cell_0.setCellValue(i);
header_row_cell_0.setCellValue(i + 1);
// 单位
HSSFCell header_row_cell_1 = row.getCell(1);
header_row_cell_1.setCellValue(censYear.getDeptName());
@ -604,15 +601,23 @@ public class CensServiceImpl implements CensService {
if(CollectionUtil.isEmpty(censs)){
return;
}
int workSum = 0,operateSum = 0;
for(int mon = 0; mon < 12; mon ++){
CensVo cens = censs.get(mon);
// 工作票数量
HSSFCell work_cell = row.getCell(3 + mon);
HSSFCell work_cell = row.getCell(2 * (mon + 1));
work_cell.setCellValue(cens.getWorkCount());
workSum += cens.getWorkCount();
// 操作票数量
HSSFCell operate_cell = row.getCell(3 + mon + 1);
work_cell.setCellValue(cens.getOperateCount());
}
HSSFCell operate_cell = row.getCell(2 * (mon + 1) + 1);
operate_cell.setCellValue(cens.getOperateCount());
operateSum += cens.getOperateCount();
}
// 总计
HSSFCell work_sum_cell = row.getCell(26);
work_sum_cell.setCellValue(workSum);
HSSFCell operate_sum_cell = row.getCell(27);
operate_sum_cell.setCellValue(operateSum);
}
}

Loading…
Cancel
Save