diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java index 93db233..3f67a4d 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainPlanEntity.java @@ -35,13 +35,11 @@ public class TrainPlanEntity extends BaseEntity { @NotNull @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("计划开始时间") - @ExcelProperty(value = "计划开始时间", index = 6) private Date scheduledStartTime; @NotNull @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("计划结束时间") - @ExcelProperty(value = "计划结束时间", index = 7) private Date scheduledEndTime; @NotNull @@ -80,4 +78,14 @@ public class TrainPlanEntity extends BaseEntity { @ApiModelProperty("是否考试") @ExcelProperty(value = "是否考试", index = 5) private String hasTest; + + @TableField(exist = false) + @ApiModelProperty("计划开始时间") + @ExcelProperty(value = "计划开始时间", index = 6) + private String startTime; + + @TableField(exist = false) + @ApiModelProperty("计划结束时间") + @ExcelProperty(value = "计划结束时间", index = 7) + private String endTime; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java index ecf6b78..e7a6dff 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java @@ -1,10 +1,12 @@ package com.hnac.hzims.safeproduct.vo; +import cn.afterturn.easypoi.entity.ImageEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; +import java.util.List; /** * @author liwen @@ -52,4 +54,13 @@ public class TrainRecordDetailVO { @ApiModelProperty("培训附件") private String filePath; + + @ApiModelProperty("图片列表") + private List images; + + @ApiModelProperty("年份") + private String year; + + @ApiModelProperty("月份") + private String month; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java index eeaa00a..5573afa 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java @@ -87,6 +87,7 @@ public class TestServiceImpl extends ServiceImpl impleme /** * 删除关联考试记录 */ + @Transactional(rollbackFor = Exception.class) @Override public boolean removeRelativeTest(Long trainRecordId) { // 查询关联考试记录 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java index 9dc05c5..37aabc0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java @@ -23,6 +23,7 @@ import com.hnac.hzims.safeproduct.vo.TrainMonthVO; import com.hnac.hzims.safeproduct.vo.TrainYearVO; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -194,7 +195,7 @@ public class TrainPlanServiceImpl extends ServiceImpl trainPlanList = getTrainPlanByUnitAndDate(unit, startTime, endTime); - // 处理字段信息 + // 数据处理 trainPlanList.forEach(train -> { // 培训状态 String status; @@ -209,6 +210,9 @@ public class TrainPlanServiceImpl extends ServiceImpl list = new ArrayList<>(); + for (String img : imgArr) { + ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); + list.add(imageEntity); + } + trainRecordDetailVO.setImages(list); + } + // 表头年月 + String code = trainRecordDetailVO.getCode(); + trainRecordDetailVO.setYear(code.substring(4, 8)); + trainRecordDetailVO.setMonth(code.substring(8, 10)); Map params = BaseUtil.obj2Map(trainRecordDetailVO); String templateFile = "template/培训记录表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/培训记录表" + SafeProductConstant.DOCX_SUFFIX; diff --git a/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx b/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx index 9fd0baf..803c532 100644 Binary files a/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx and b/hzims-service/safeproduct/src/main/resources/template/培训记录表.docx differ