From abaf2b8217862c269b70edd98f51f5adf4a0f2b2 Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 22 Aug 2024 13:44:10 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=96=B0=E5=A2=9E=E5=8D=AB=E7=94=9F?= =?UTF-8?q?=E8=80=83=E6=A0=B8=E8=A1=A8=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/constants/SafeProductConstant.java | 1 + .../dto/HygieneEvaluationExportDTO.java | 59 ++++++++++++ .../safeproduct/controller/HygieneController.java | 50 ++++++----- .../safeproduct/service/IHygieneRecordService.java | 7 ++ .../service/impl/HygieneRecordServiceImpl.java | 99 ++++++++++++++++++++- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 40 +++++++++ .../main/resources/template/卫生考核表.xlsx | Bin 0 -> 10754 bytes 7 files changed, 231 insertions(+), 25 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java create mode 100644 hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java index fd81755..ecff4d7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java @@ -20,6 +20,7 @@ public interface SafeProductConstant { */ String DOCX_SUFFIX = ".docx"; String PDF_SUFFIX = ".pdf"; + String XLSX_SUFFIX = ".xlsx"; /** * 培训管理 diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java new file mode 100644 index 0000000..2987b84 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneEvaluationExportDTO.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.safeproduct.dto; + +import com.hnac.hzims.safeproduct.vo.HygieneEvaluationPeopleVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liwen + * @date 2024-08-20 + */ +@Data +@ApiModel(value = "卫生考核导出DTO类") +public class HygieneEvaluationExportDTO { + + @ApiModelProperty(value = "年份") + private String year; + + @ApiModelProperty(value = "月份") + private String month; + + @ApiModelProperty(value = "第一周开始日") + private String firstWeekStart; + + @ApiModelProperty(value = "第一周结束日") + private String firstWeekEnd; + + @ApiModelProperty(value = "第二周开始日") + private String secondWeekStart; + + @ApiModelProperty(value = "第二周结束日") + private String secondWeekEnd; + + @ApiModelProperty(value = "第三周开始日") + private String thirdWeekStart; + + @ApiModelProperty(value = "第三周结束日") + private String thirdWeekEnd; + + @ApiModelProperty(value = "第四周开始日") + private String fourthWeekStart; + + @ApiModelProperty(value = "第四周结束日") + private String fourthWeekEnd; + + @ApiModelProperty(value = "第五周开始日") + private String fifthWeekStart; + + @ApiModelProperty(value = "第五周结束日") + private String fifthWeekEnd; + + @ApiModelProperty(value = "备注") + private String remark; + + @ApiModelProperty(value = "考核人员列表") + private List evaluationList; +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index 1119951..7ac7509 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -39,7 +39,7 @@ import java.util.Map; @RestController @AllArgsConstructor @RequestMapping("/hygiene") -@Business(module = Constants.APP_NAME, value = "卫生自查", ignore = false) +@Business(module = Constants.APP_NAME, value = "卫生自查") @Api(value = "卫生自查", tags = "卫生自查接口") public class HygieneController extends BladeController { @@ -52,7 +52,7 @@ public class HygieneController extends BladeController { @PostMapping("/savePlan") @ApiOperation(value = "新增卫生自查计划") @ApiOperationSupport(order = 1) - @Operate(label = "新增卫生自查计划", type = BusinessType.INSERT, ignore = false) + @Operate(label = "新增卫生自查计划", type = BusinessType.INSERT) public R savePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) { return hygienePlanService.savePlan(hygienePlanDTO); } @@ -60,7 +60,7 @@ public class HygieneController extends BladeController { @PostMapping("/updatePlan") @ApiOperation(value = "修改卫生自查计划") @ApiOperationSupport(order = 2) - @Operate(label = "修改卫生自查计划", type = BusinessType.UPDATE, ignore = false) + @Operate(label = "修改卫生自查计划", type = BusinessType.UPDATE) public R updatePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) { return hygienePlanService.updatePlan(hygienePlanDTO); } @@ -68,7 +68,7 @@ public class HygieneController extends BladeController { @PostMapping("/removePlan") @ApiOperation(value = "删除卫生自查计划") @ApiOperationSupport(order = 3) - @Operate(label = "删除卫生自查计划", type = BusinessType.DELETE, ignore = false) + @Operate(label = "删除卫生自查计划", type = BusinessType.DELETE) public R removePlan(@RequestParam Long id) { return R.status(hygienePlanService.removePlan(id)); } @@ -76,7 +76,7 @@ public class HygieneController extends BladeController { @GetMapping("/planDetail") @ApiOperation(value = "卫生自查计划详情") @ApiOperationSupport(order = 4) - @Operate(label = "卫生自查计划详情", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查计划详情", type = BusinessType.QUERY) public R planDetail(@RequestParam Long id) { return R.data(hygienePlanService.getPlan(id)); } @@ -90,7 +90,7 @@ public class HygieneController extends BladeController { }) @ApiOperation(value = "卫生自查计划分页") @ApiOperationSupport(order = 5) - @Operate(label = "卫生自查计划分页", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查计划分页", type = BusinessType.QUERY) public R> planPage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygienePlanService.planPage(param, query); return R.data(page); @@ -99,7 +99,7 @@ public class HygieneController extends BladeController { @PostMapping("/saveRecord") @ApiOperation(value = "新增卫生自查记录") @ApiOperationSupport(order = 6) - @Operate(label = "新增卫生自查记录", type = BusinessType.INSERT, ignore = false) + @Operate(label = "新增卫生自查记录", type = BusinessType.INSERT) public R saveRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) { return hygieneRecordService.saveRecord(hygieneRecordDTO); } @@ -107,7 +107,7 @@ public class HygieneController extends BladeController { @PostMapping("/updateRecord") @ApiOperation(value = "修改卫生自查记录") @ApiOperationSupport(order = 7) - @Operate(label = "修改卫生自查记录", type = BusinessType.UPDATE, ignore = false) + @Operate(label = "修改卫生自查记录", type = BusinessType.UPDATE) public R updateRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) { return hygieneRecordService.updateRecord(hygieneRecordDTO); } @@ -115,7 +115,7 @@ public class HygieneController extends BladeController { @PostMapping("/removeRecord") @ApiOperation(value = "删除卫生自查记录") @ApiOperationSupport(order = 8) - @Operate(label = "删除卫生自查记录", type = BusinessType.DELETE, ignore = false) + @Operate(label = "删除卫生自查记录", type = BusinessType.DELETE) public R removeRecord(@RequestParam Long id) { return R.status(hygieneRecordService.removeById(id)); } @@ -123,7 +123,7 @@ public class HygieneController extends BladeController { @GetMapping("/recordDetail") @ApiOperation(value = "卫生自查记录详情") @ApiOperationSupport(order = 9) - @Operate(label = "卫生自查记录详情", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查记录详情", type = BusinessType.QUERY) public R recordDetail(@RequestParam Long id) { return R.data(hygieneRecordService.getRecordDetail(id)); } @@ -137,7 +137,7 @@ public class HygieneController extends BladeController { }) @ApiOperation(value = "卫生自查记录分页") @ApiOperationSupport(order = 10) - @Operate(label = "卫生自查记录分页", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查记录分页", type = BusinessType.QUERY) public R> recordPage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygieneRecordService.recordPage(param, query); return R.data(page); @@ -146,7 +146,7 @@ public class HygieneController extends BladeController { @GetMapping("/dataByMonth") @ApiOperation(value = "月度统计表") @ApiOperationSupport(order = 11) - @Operate(label = "月度统计表", type = BusinessType.QUERY, ignore = false) + @Operate(label = "月度统计表", type = BusinessType.QUERY) public R> dataByMonth(@RequestParam String month, String unit, Query query) { IPage page = hygienePlanService.dataByMonth(month, unit, query); return R.data(page); @@ -155,7 +155,7 @@ public class HygieneController extends BladeController { @GetMapping("/exportHygieneRecordData") @ApiOperation(value = "卫生自查记录表导出") @ApiOperationSupport(order = 12) - @Operate(label = "卫生自查记录表导出", type = BusinessType.EXPORT, ignore = false) + @Operate(label = "卫生自查记录表导出", type = BusinessType.EXPORT) public void exportHygieneRecordData(@RequestParam Long id, HttpServletResponse response) { hygieneRecordService.exportHygieneRecordData(id, response); } @@ -167,7 +167,7 @@ public class HygieneController extends BladeController { }) @ApiOperation(value = "月度数据导出") @ApiOperationSupport(order = 13) - @Operate(label = "月度数据导出", type = BusinessType.EXPORT, ignore = false) + @Operate(label = "月度数据导出", type = BusinessType.EXPORT) public void exportMonthData(@ApiIgnore @RequestParam Map param, Query query, HttpServletResponse response) { hygienePlanService.exportMonthData(param, query, response); } @@ -181,7 +181,7 @@ public class HygieneController extends BladeController { }) @ApiOperation(value = "卫生自查计划导出") @ApiOperationSupport(order = 14) - @Operate(label = "卫生自查计划导出", type = BusinessType.EXPORT, ignore = false) + @Operate(label = "卫生自查计划导出", type = BusinessType.EXPORT) public void exportHygienePlanData(@ApiIgnore @RequestParam Map param, HttpServletResponse response) { hygienePlanService.exportHygienePlanData(param, response); } @@ -189,7 +189,7 @@ public class HygieneController extends BladeController { @PostMapping("/saveHygieneTemplate") @ApiOperation(value = "新增卫生自查模板") @ApiOperationSupport(order = 15) - @Operate(label = "新增卫生自查模板", type = BusinessType.INSERT, ignore = false) + @Operate(label = "新增卫生自查模板", type = BusinessType.INSERT) public R saveHygieneTemplate(@RequestBody HygieneTemplateDTO hygieneTemplateDTO) { boolean save = hygieneTemplateService.saveHygieneTemplate(hygieneTemplateDTO); return R.status(save); @@ -198,7 +198,7 @@ public class HygieneController extends BladeController { @PostMapping("/updateHygieneTemplate") @ApiOperation(value = "修改卫生自查模板") @ApiOperationSupport(order = 16) - @Operate(label = "修改卫生自查模板", type = BusinessType.UPDATE, ignore = false) + @Operate(label = "修改卫生自查模板", type = BusinessType.UPDATE) public R updateHygieneTemplate(@RequestBody HygieneTemplateDTO hygieneTemplateDTO) { boolean update = hygieneTemplateService.updateHygieneTemplate(hygieneTemplateDTO); return R.status(update); @@ -207,7 +207,7 @@ public class HygieneController extends BladeController { @PostMapping("/removeHygieneTemplate") @ApiOperation(value = "删除卫生自查模板") @ApiOperationSupport(order = 17) - @Operate(label = "删除卫生自查模板", type = BusinessType.DELETE, ignore = false) + @Operate(label = "删除卫生自查模板", type = BusinessType.DELETE) public R removeHygieneTemplate(@RequestParam Long id) { boolean remove = hygieneTemplateService.removeHygieneTemplate(id); return R.status(remove); @@ -216,7 +216,7 @@ public class HygieneController extends BladeController { @GetMapping("/hygieneTemplateDetail") @ApiOperation(value = "卫生自查模板详情") @ApiOperationSupport(order = 18) - @Operate(label = "卫生自查模板详情", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查模板详情", type = BusinessType.QUERY) public R hygieneTemplateDetail(@RequestParam Long id) { HygieneTemplateDetailVO detail = hygieneTemplateService.getHygieneTemplateDetail(id); return R.data(detail); @@ -225,7 +225,7 @@ public class HygieneController extends BladeController { @GetMapping("/hygieneTemplatePage") @ApiOperation(value = "卫生自查模板分页") @ApiOperationSupport(order = 19) - @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生自查模板分页", type = BusinessType.QUERY) public R> hygieneTemplatePage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygieneTemplateService.getHygieneTemplatePage(param, query); return R.data(page); @@ -240,7 +240,7 @@ public class HygieneController extends BladeController { }) @ApiOperation(value = "卫生月度详情列表") @ApiOperationSupport(order = 20) - @Operate(label = "卫生月度详情列表", type = BusinessType.QUERY, ignore = false) + @Operate(label = "卫生月度详情列表", type = BusinessType.QUERY) public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { IPage page = hygienePlanService.getDetailListByMonth(param, query); return R.data(page); @@ -254,4 +254,12 @@ public class HygieneController extends BladeController { HygieneEvaluationPageVO page = hygieneRecordService.getEvaluationPage(month); return R.data(page); } + + @GetMapping("/exportEvaluationData") + @ApiOperation(value = "卫生考核数据导出") + @ApiOperationSupport(order = 22) + @Operate(label = "卫生考核数据导出", type = BusinessType.EXPORT) + public void exportEvaluationData(@RequestParam String month, HttpServletResponse response) { + hygieneRecordService.exportEvaluationData(month, response); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java index 59152e5..f4f1660 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java @@ -78,4 +78,11 @@ public interface IHygieneRecordService extends IService { * @return 考核记录表VO类 */ HygieneEvaluationPageVO getEvaluationPage(String month); + + /** + * 卫生考核数据导出 + * @param month 当前月份 + * @param response 响应类 + */ + void exportEvaluationData(String month, HttpServletResponse response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index 755daf7..30db487 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -1,17 +1,24 @@ package com.hnac.hzims.safeproduct.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.date.DatePattern; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; +import com.hnac.hzims.safeproduct.dto.HygieneEvaluationExportDTO; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; +import com.hnac.hzims.safeproduct.hazard.util.ExcelConvertPdf; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper; import com.hnac.hzims.safeproduct.service.IHygieneRecordService; @@ -19,6 +26,9 @@ import com.hnac.hzims.safeproduct.service.IHygieneZoneService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.*; import com.hnac.hzinfo.exception.HzServiceException; +import com.itextpdf.text.DocumentException; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -32,7 +42,14 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.ZoneId; @@ -268,21 +285,21 @@ public class HygieneRecordServiceImpl extends ServiceImpl peopleNameList = baseMapper.selectHygieneZoneByIds(Arrays.asList(zoneIds)); - // 遍历责任区数据 for (int j = 0; j < zoneIds.length; j++) { List scoreList = new ArrayList<>(); HygieneEvaluationPeopleVO peopleVO = new HygieneEvaluationPeopleVO(); + // 查询责任区的负责人名称 String zoneId = zoneIds[j]; Optional zoneOptional = peopleNameList.stream().filter(x -> x.getId().equals(Long.valueOf(zoneId))).findFirst(); if (zoneOptional.isPresent()) { + // 卫生记录周数 Integer weekNo = hygieneRecordEntity.getWeekNum(); - // 考核人名称 + // 负责人名称 String principal = zoneOptional.get().getPrincipal(); - // 判断单位内该名称是否已存在 + // 判断单位内该名称是否已存在,存在则补充新的考核分数据,否则新增其考核分数据 Optional checkPeople = evaluationList.stream().filter(x -> x.getPrincipal().equals(principal) && x.getUnit().equals(hygieneRecordEntity.getUnit())).findFirst(); - if (checkPeople.isPresent()) { peopleVO = checkPeople.get(); scoreList = peopleVO.getScoreList(); @@ -307,11 +324,85 @@ public class HygieneRecordServiceImpl extends ServiceImpl weekList = page.getWeekList(); + weekList.forEach(week -> { + String start = DateUtil.format(week.getStartDate(), "yyyy-MM-dd"); + start = start.substring(start.indexOf("-") + 1); + String end = DateUtil.format(week.getEndDate(), "yyyy-MM-dd"); + end = end.substring(end.indexOf("-") + 1); + switch (week.getWeekNum()) { + case 1: + exportDTO.setFirstWeekStart(start); + exportDTO.setFirstWeekEnd(end); + break; + case 2: + exportDTO.setSecondWeekStart(start); + exportDTO.setSecondWeekEnd(end); + break; + case 3: + exportDTO.setThirdWeekStart(start); + exportDTO.setThirdWeekEnd(end); + break; + case 4: + exportDTO.setFourthWeekStart(start); + exportDTO.setFourthWeekEnd(end); + break; + case 5: + exportDTO.setFifthWeekStart(start); + exportDTO.setFifthWeekEnd(end); + break; + } + }); + // 考核人员数据 + exportDTO.setEvaluationList(page.getEvaluationList()); + // 封装参数 + Map params = BaseUtil.obj2Map(exportDTO); + TemplateExportParams templateParams = new TemplateExportParams("template/卫生考核表.xlsx", true); + // 导出 + try { + String fileName = URLEncoder.encode("卫生考核表.xlsx", "UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + fileName); + response.setContentType("application/vnd.ms-excel;charset=utf-8"); + Workbook workbook = ExcelExportUtil.exportExcel(templateParams, params); + Sheet sheet = workbook.getSheetAt(0); + BaseUtil.mergeCell(0, 0, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "unit").forEach(sheet::addMergedRegion); + BaseUtil.mergeCell(0, 7, JSONArray.parseArray(JSON.toJSONString(exportDTO)), "remark").forEach(sheet::addMergedRegion); + String pdfPath = "D://" + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX; + OutputStream outputStream = Files.newOutputStream(Paths.get(pdfPath)); + ExcelConvertPdf.excelConvertPdf(workbook, outputStream); + BaseUtil.readPdf(response, pdfPath); + } catch (UnsupportedEncodingException e) { + log.error("卫生考核表导出异常-UnsupportedEncodingException:" + e.getMessage()); + } catch (DocumentException e) { + log.error("卫生考核表导出异常-DocumentException:" + e.getMessage()); + } catch (IOException e) { + log.error("卫生考核表导出异常-IOException:" + e.getMessage()); + } + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 2c1755e..914c81f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -1,10 +1,13 @@ package com.hnac.hzims.safeproduct.utils; import cn.afterturn.easypoi.word.WordExportUtil; +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Lists; import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; +import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xwpf.usermodel.*; import org.json.JSONArray; import org.json.JSONObject; @@ -421,4 +424,41 @@ public class BaseUtil { throw new ServiceException("标准总分值未全部分配"); } } + + /** + * + * @param initRow 起始行数 + * @param initColumn 起始列数 + * @param data 数据 + * @param attribute 合并属性 + * @return 单元格列表 + */ + public static List mergeCell(int initRow, int initColumn, com.alibaba.fastjson.JSONArray data, String attribute) { + List result = Lists.newArrayList(); + String initAttribute = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(0))).getString(attribute); + int mergeCount = 1; + for (int index = 0; index < data.size(); index++) { + if (index == 0) { + continue; + } + com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(data.get(index))); + if (object.getString(attribute).equals(initAttribute)) { + mergeCount++; + } + else { + if (mergeCount > 1) { + result.add(new CellRangeAddress(initRow, initRow+mergeCount-1, initColumn, initColumn)); + } + initRow = initRow+mergeCount; + initAttribute = object.getString(attribute); + mergeCount = 1; + } + if (index == data.size() -1) { + if (mergeCount > 1) { + result.add(new CellRangeAddress(initRow, initRow + mergeCount-1, initColumn, initColumn)); + } + } + } + return result; + } } diff --git a/hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx b/hzims-service/safeproduct/src/main/resources/template/卫生考核表.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..93b2b21c51b27f4dbe290920c42962a950f66238 GIT binary patch literal 10754 zcmeHtbyQr-^CuGA3GVK0!QFyGu)zro4uiWp1b2daa0u?M!ASxkI0SbIA=nPd`@X#7 z_x5{s|J-x7&zZh+?k(y2saw_E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