Browse Source

fix: 修改导出演练记录表的数据内容

zhongwei
liwen 11 months ago
parent
commit
fc7eb24fda
  1. 5
      hzims-service-api/safeproduct-api/pom.xml
  2. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java
  3. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  4. 1
      hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

5
hzims-service-api/safeproduct-api/pom.xml

@ -15,6 +15,11 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-system-api</artifactId> <artifactId>blade-system-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
</dependencies> </dependencies>
<packaging>jar</packaging> <packaging>jar</packaging>

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java

@ -1,5 +1,7 @@
package com.hnac.hzims.safeproduct.entity; package com.hnac.hzims.safeproduct.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -19,40 +21,48 @@ import java.util.Date;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ExcelIgnoreUnannotated
@TableName("hzims_rehearsal_record") @TableName("hzims_rehearsal_record")
@ApiModel(value = "演练记录实体类") @ApiModel(value = "演练记录实体类")
public class RehearsalRecordEntity extends BaseEntity { public class RehearsalRecordEntity extends BaseEntity {
@Size(max = 50, message = "编码字段长度不能超过50") @Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码") @ApiModelProperty("编码")
@ExcelProperty(value = "编码", index = 0)
private String code; private String code;
@NotNull @NotNull
@Size(max = 50, message = "单位字段长度不能超过50") @Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位") @ApiModelProperty("单位")
@ExcelProperty(value = "单位", index = 1)
private String unit; private String unit;
@NotNull @NotNull
@Size(max = 50, message = "演练科目字段长度不能超过50") @Size(max = 50, message = "演练科目字段长度不能超过50")
@ApiModelProperty("演练科目") @ApiModelProperty("演练科目")
@ExcelProperty(value = "演练科目", index = 2)
private String subject; private String subject;
@NotNull @NotNull
@ApiModelProperty("演练计划开始时间") @ApiModelProperty("演练计划开始时间")
@ExcelProperty(value = "演练计划开始时间", index = 3)
private Date scheduledStartTime; private Date scheduledStartTime;
@NotNull @NotNull
@ApiModelProperty("演练计划结束时间") @ApiModelProperty("演练计划结束时间")
@ExcelProperty(value = "演练计划结束时间", index = 4)
private Date scheduledEndTime; private Date scheduledEndTime;
@NotNull @NotNull
@Size(max = 255, message = "演练地点字段长度不能超过255") @Size(max = 255, message = "演练地点字段长度不能超过255")
@ApiModelProperty("演练地点") @ApiModelProperty("演练地点")
@ExcelProperty(value = "演练地点", index = 5)
private String location; private String location;
@Min(value = 0, message = "参演人数不能小于0") @Min(value = 0, message = "参演人数不能小于0")
@Max(value = 1000, message = "参演人数字段长度超出限制范围") @Max(value = 1000, message = "参演人数字段长度超出限制范围")
@ApiModelProperty("参演人数") @ApiModelProperty("参演人数")
@ExcelProperty(value = "参演人数", index = 6)
private Integer peopleNum; private Integer peopleNum;
@Size(max = 5000, message = "参演人员字段长度超出限制范围") @Size(max = 5000, message = "参演人员字段长度超出限制范围")
@ -65,9 +75,11 @@ public class RehearsalRecordEntity extends BaseEntity {
private String commander; private String commander;
@ApiModelProperty("演练实际开始时间") @ApiModelProperty("演练实际开始时间")
@ExcelProperty(value = "演练实际开始时间", index = 7)
private Date actualStartTime; private Date actualStartTime;
@ApiModelProperty("演练实际结束时间") @ApiModelProperty("演练实际结束时间")
@ExcelProperty(value = "演练实际结束时间", index = 8)
private Date actualEndTime; private Date actualEndTime;
@Size(max = 250, message = "演练记录字段长度不能超过250") @Size(max = 250, message = "演练记录字段长度不能超过250")
@ -85,6 +97,7 @@ public class RehearsalRecordEntity extends BaseEntity {
@NotNull @NotNull
@Size(max = 20, message = "演练状态字段长度不能超过20") @Size(max = 20, message = "演练状态字段长度不能超过20")
@ApiModelProperty("演练状态") @ApiModelProperty("演练状态")
@ExcelProperty(value = "演练状态", index = 9)
private String rehearsalStatus; private String rehearsalStatus;
@Size(max = 1000, message = "演练图片字段长度不能超过1000") @Size(max = 1000, message = "演练图片字段长度不能超过1000")

17
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

@ -207,24 +207,7 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe
.registerConverter(new LongStringConverter()) .registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build(); .build();
Set<String> excludeColumnFiledNames = new HashSet<>();
excludeColumnFiledNames.add("peopleName");
excludeColumnFiledNames.add("commander");
excludeColumnFiledNames.add("record");
excludeColumnFiledNames.add("comment");
excludeColumnFiledNames.add("rehearsalMethod");
excludeColumnFiledNames.add("imgPath");
excludeColumnFiledNames.add("filePath");
excludeColumnFiledNames.add("id");
excludeColumnFiledNames.add("createUser");
excludeColumnFiledNames.add("createDept");
excludeColumnFiledNames.add("createTime");
excludeColumnFiledNames.add("updateUser");
excludeColumnFiledNames.add("updateTime");
excludeColumnFiledNames.add("status");
excludeColumnFiledNames.add("isDeleted");
WriteSheet writeSheet = EasyExcel.writerSheet(1, "演练记录表").head(RehearsalRecordEntity.class) WriteSheet writeSheet = EasyExcel.writerSheet(1, "演练记录表").head(RehearsalRecordEntity.class)
.excludeColumnFiledNames(excludeColumnFiledNames)
.build(); .build();
excelWriter.write(rehearsalRecordList, writeSheet); excelWriter.write(rehearsalRecordList, writeSheet);
excelWriter.finish(); excelWriter.finish();

1
hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

@ -20,6 +20,7 @@ CREATE TABLE `hzims`.`hzims_rehearsal_record` (
`scheduled_end_time` datetime NOT NULL COMMENT '演练计划结束时间', `scheduled_end_time` datetime NOT NULL COMMENT '演练计划结束时间',
`location` varchar(255) NOT NULL COMMENT '演练地点', `location` varchar(255) NOT NULL COMMENT '演练地点',
`people_num` int(10) NOT NULL DEFAULT '0' COMMENT '参演人数', `people_num` int(10) NOT NULL DEFAULT '0' COMMENT '参演人数',
`people_name` varchar(5000) DEFAULT '' COMMENT '参演人员',
`commander` varchar(10) NOT NULL COMMENT '总指挥', `commander` varchar(10) NOT NULL COMMENT '总指挥',
`actual_start_time` datetime DEFAULT NULL COMMENT '演练实际开始时间', `actual_start_time` datetime DEFAULT NULL COMMENT '演练实际开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '演练实际结束时间', `actual_end_time` datetime DEFAULT NULL COMMENT '演练实际结束时间',

Loading…
Cancel
Save