diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalDetailVO.java new file mode 100644 index 0000000..bb7bd8e --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalDetailVO.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-15 + */ +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalDetailVO { + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("参演人员") + private String peopleName; + + @ApiModelProperty("演练实际开始时间") + private Date actualStartTime; + + @ApiModelProperty("演练实际结束时间") + private Date actualEndTime; + + @ApiModelProperty("演练记录") + private String record; + + @ApiModelProperty("演练评价") + private String comment; + + @ApiModelProperty("演练图片") + private String imgPath; + + @ApiModelProperty("演练附件") + private String filePath; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("演练地点") + private String location; + + @ApiModelProperty("总指挥") + private String commander; + + @ApiModelProperty("演练方式") + private String rehearsalMethod; + + @ApiModelProperty("演练科目") + private String subject; +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 38e48e4..60c96c9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -7,6 +7,7 @@ import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.service.IRehearsalPlanService; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; +import com.hnac.hzims.safeproduct.vo.RehearsalDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import io.swagger.annotations.Api; @@ -105,8 +106,8 @@ public class RehearsalController extends BladeController { @GetMapping("/rehearsalRecordDetail") @ApiOperation(value = "演练记录详情") @ApiOperationSupport(order = 9) - public R rehearsalRecordDetail(@RequestParam Long id) { - return R.data(rehearsalRecordService.getById(id)); + public R rehearsalRecordDetail(@RequestParam Long id) { + return R.data(rehearsalRecordService.getRecordDetailVOById(id)); } @GetMapping("/rehearsalRecordPage") @@ -152,7 +153,7 @@ public class RehearsalController extends BladeController { @GetMapping("/exportRecordDetailData") @ApiOperation(value = "演练记录表导出") @ApiOperationSupport(order = 14) - public void exportRecordDetailData(@RequestParam Long id) { - rehearsalRecordService.exportRecordDetailData(id); + public void exportRecordDetailData(@RequestParam Long id, HttpServletResponse response) { + rehearsalRecordService.exportRecordDetailData(id, response); } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java index 1c77f92..9cbd708 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.java @@ -2,6 +2,7 @@ package com.hnac.hzims.safeproduct.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; +import com.hnac.hzims.safeproduct.vo.RehearsalDetailVO; import org.apache.ibatis.annotations.Mapper; /** @@ -13,4 +14,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface RehearsalRecordMapper extends BaseMapper { + /** + * 查询演练记录表详情 + * @param id 演练记录id + * @return 演练记录表VO类 + */ + RehearsalDetailVO getRecordDetailVOById(Long id); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml index 123fddd..4eb9ff8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalRecordMapper.xml @@ -2,4 +2,15 @@ + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java index f1092da..8f5d5e2 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java @@ -2,6 +2,9 @@ package com.hnac.hzims.safeproduct.service; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; +import com.hnac.hzims.safeproduct.vo.RehearsalDetailVO; + +import javax.servlet.http.HttpServletResponse; /** * 演练记录服务类 @@ -35,6 +38,14 @@ public interface IRehearsalRecordService extends IService /** * 演练记录表导出 * @param id 演练记录id + * @param response 响应类 + */ + void exportRecordDetailData(Long id, HttpServletResponse response); + + /** + * 查询演练记录表详情 + * @param id 演练记录id + * @return 演练记录表VO类 */ - void exportRecordDetailData(Long id); + RehearsalDetailVO getRecordDetailVOById(Long id); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index e37f4b5..f6ece0d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -13,17 +13,13 @@ import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper; import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; -import com.hnac.hzims.ticket.constants.WorkTicketConstants; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import com.hnac.hzims.safeproduct.vo.RehearsalDetailVO; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.xwpf.usermodel.XWPFDocument; -import org.springblade.core.log.exception.ServiceException; -import org.springblade.core.tool.utils.StringUtil; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.util.Assert; import javax.annotation.Resource; -import java.io.IOException; +import javax.servlet.http.HttpServletResponse; import java.util.*; import java.util.stream.Collectors; @@ -40,6 +36,9 @@ public class RehearsalRecordServiceImpl extends ServiceImpl { - throw new ServiceException("未找到模板文件,预览失败!"); - }); + public void exportRecordDetailData(Long id, HttpServletResponse response) { + RehearsalDetailVO rehearsalDetailVO = this.getRecordDetailVOById(id); + Map params = BaseUtil.obj2Map(rehearsalDetailVO); + String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; + String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; + String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; + BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, response); + } + + /** + * 查询演练记录表详情 + */ + @Override + public RehearsalDetailVO getRecordDetailVOById(Long id) { + return baseMapper.getRecordDetailVOById(id); } } diff --git a/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx b/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx new file mode 100644 index 0000000..07a0f0e Binary files /dev/null and b/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx differ