From 92ca5218dc6186881a5b24c0592ff23baaff6064 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 15 Jan 2024 14:30:44 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=BC=94=E7=BB=83=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/safeproduct/vo/RehearsalDetailVO.java | 55 ---------------------- .../safeproduct/vo/RehearsalRecordDetailVO.java | 55 ++++++++++++++++++++++ .../controller/RehearsalController.java | 8 ++-- .../safeproduct/mapper/RehearsalRecordMapper.java | 4 +- .../safeproduct/mapper/RehearsalRecordMapper.xml | 2 +- .../service/IRehearsalRecordService.java | 6 +-- .../service/impl/RehearsalRecordServiceImpl.java | 20 ++++++-- 7 files changed, 80 insertions(+), 70 deletions(-) delete mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalDetailVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java 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 deleted file mode 100644 index bb7bd8e..0000000 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalDetailVO.java +++ /dev/null @@ -1,55 +0,0 @@ -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-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java new file mode 100644 index 0000000..86afcbe --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.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 RehearsalRecordDetailVO { + + @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 60c96c9..afb6c70 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,7 +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.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; import io.swagger.annotations.Api; @@ -106,7 +106,7 @@ public class RehearsalController extends BladeController { @GetMapping("/rehearsalRecordDetail") @ApiOperation(value = "演练记录详情") @ApiOperationSupport(order = 9) - public R rehearsalRecordDetail(@RequestParam Long id) { + public R rehearsalRecordDetail(@RequestParam Long id) { return R.data(rehearsalRecordService.getRecordDetailVOById(id)); } @@ -153,7 +153,7 @@ public class RehearsalController extends BladeController { @GetMapping("/exportRecordDetailData") @ApiOperation(value = "演练记录表导出") @ApiOperationSupport(order = 14) - public void exportRecordDetailData(@RequestParam Long id, HttpServletResponse response) { - rehearsalRecordService.exportRecordDetailData(id, response); + public void exportRehearsalRecordData(@RequestParam Long id, HttpServletResponse response) { + rehearsalRecordService.exportRehearsalRecordData(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 9cbd708..9a55888 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,7 +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 com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import org.apache.ibatis.annotations.Mapper; /** @@ -19,5 +19,5 @@ public interface RehearsalRecordMapper extends BaseMapper * @param id 演练记录id * @return 演练记录表VO类 */ - RehearsalDetailVO getRecordDetailVOById(Long id); + RehearsalRecordDetailVO 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 4eb9ff8..eecddec 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,7 +2,7 @@ - SELECT t1.code, t1.actual_start_time, t1.actual_end_time, t2.unit, t2.location, t2.rehearsal_method, t2.commander, t2.subject, t1.people_name, t1.record, t1.img_path, t1.command, t1.file_path 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 8f5d5e2..83dec8b 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,7 +2,7 @@ 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 com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import javax.servlet.http.HttpServletResponse; @@ -40,12 +40,12 @@ public interface IRehearsalRecordService extends IService * @param id 演练记录id * @param response 响应类 */ - void exportRecordDetailData(Long id, HttpServletResponse response); + void exportRehearsalRecordData(Long id, HttpServletResponse response); /** * 查询演练记录表详情 * @param id 演练记录id * @return 演练记录表VO类 */ - RehearsalDetailVO getRecordDetailVOById(Long id); + RehearsalRecordDetailVO 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 f6ece0d..68dbb45 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 @@ -8,12 +8,13 @@ import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; +import com.hnac.hzims.safeproduct.enums.RehearsalMethodEnum; import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; 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.safeproduct.vo.RehearsalDetailVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -129,9 +130,18 @@ public class RehearsalRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(rehearsalDetailVO); + public void exportRehearsalRecordData(Long id, HttpServletResponse response) { + RehearsalRecordDetailVO rehearsalRecordDetailVO = this.getRecordDetailVOById(id); + // 演练方式字段 + String rehearsalMethod = rehearsalRecordDetailVO.getRehearsalMethod(); + if (rehearsalMethod.equals(RehearsalMethodEnum.MIXED.getValue())) { + rehearsalRecordDetailVO.setRehearsalMethod(RehearsalMethodEnum.MIXED.getDesc()); + } else if (rehearsalMethod.equals(RehearsalMethodEnum.ONLINE.getValue())) { + rehearsalRecordDetailVO.setRehearsalMethod(RehearsalMethodEnum.ONLINE.getDesc()); + } else { + rehearsalRecordDetailVO.setRehearsalMethod(RehearsalMethodEnum.OFFLINE.getDesc()); + } + Map params = BaseUtil.obj2Map(rehearsalRecordDetailVO); String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; @@ -142,7 +152,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl