diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckRecordDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckRecordDTO.java new file mode 100644 index 0000000..0eac4c5 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckRecordDTO.java @@ -0,0 +1,46 @@ +package com.hnac.hzims.safeproduct.dto; + +import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.Date; +import java.util.List; + +/** + * @author liwen + * @date 2024-01-09 + */ +@Data +@ApiModel(value = "车检记录DTO类") +public class CarCheckRecordDTO { + + @ApiModelProperty("车检记录id") + private Long id; + + @ApiModelProperty("车辆id") + private Long carId; + + @NotNull + @Size(max = 50, message = "检查人长度不能超过50") + @ApiModelProperty("检查人") + private String checker; + + @NotNull + @ApiModelProperty("检查时间") + private Date checkTime; + + @NotNull + @ApiModelProperty("检查结论") + private String conclusion; + + @Size(max = 500, message = "填报备注长度不能超过50") + @ApiModelProperty("填报备注") + private String remark; + + @ApiModelProperty("检查项列表") + List itemList; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java index 313ecc5..9bfbcf7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java @@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; import java.util.Date; /** @@ -14,12 +16,19 @@ import java.util.Date; @ApiModel(value = "车辆维保记录确认DTO类") public class CarMaintenanceConfirmationDTO { + @NotNull @ApiModelProperty("车辆维保记录id") private Long carMaintenanceId; + @NotNull @ApiModelProperty("车辆管理人意见") private String managerAdvice; - @ApiModelProperty("确认时间") - private Date confirmationTime; + @NotNull + @ApiModelProperty("下次维保时间") + private Date maintenanceNextTime; + + @NotNull + @ApiModelProperty("维保里程") + private BigDecimal maintenanceMileage; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java index 47a8df7..acabb4e 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import javax.validation.constraints.NotNull; /** * @author liwen @@ -14,9 +14,7 @@ import java.util.Date; @ApiModel(value = "用车记录确认DTO类") public class CarUsedRecordConfirmationDTO { + @NotNull @ApiModelProperty("用车记录id") private Long carUsedRecordId; - - @ApiModelProperty("确认时间") - private Date confirmationTime; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java index 9332d2f..d4c074f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java @@ -21,8 +21,11 @@ import java.util.List; @ApiModel(value = "卫生自查计划DTO类") public class HygienePlanDTO extends BaseEntity { - @ApiModelProperty("编码") - private String code; + @ApiModelProperty("卫生自查计划id") + private Long id; + + @ApiModelProperty("计划名称") + private String name; @ApiModelProperty("标准总分值") private Integer standardScore; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java index 21dd74b..3461c52 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java @@ -1,5 +1,6 @@ package com.hnac.hzims.safeproduct.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -7,6 +8,9 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + /** * @author liwen * @date 2024-01-05 @@ -20,9 +24,16 @@ public class CarCheckItemEntity extends BaseEntity { @ApiModelProperty("车检记录id") private Long carCheckRecordId; + @NotNull + @Size(max = 500, message = "检查项目长度不能超过50") @ApiModelProperty("检查项目") private String checkItem; + @NotNull @ApiModelProperty("检查内容") private String checkContent; + + @NotNull + @ApiModelProperty("检查结果") + private String checkResult; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java index 8035cf5..c1a899b 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java @@ -7,6 +7,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.util.Date; /** @@ -22,24 +24,24 @@ public class CarCheckRecordEntity extends BaseEntity { @ApiModelProperty("车辆id") private Long carId; + @Size(max = 50, message = "编码长度不能超过50") @ApiModelProperty("编码") private String code; + @NotNull + @Size(max = 50, message = "检查人长度不能超过50") @ApiModelProperty("检查人") private String checker; + @NotNull @ApiModelProperty("检查时间") private Date checkTime; - @ApiModelProperty("检查项id") - private String checkItemIds; - - @ApiModelProperty("检查项结果") - private String checkItemResults; - + @NotNull @ApiModelProperty("检查结论") private String conclusion; + @Size(max = 500, message = "填报备注长度不能超过50") @ApiModelProperty("填报备注") private String remark; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java index b0292ef..d758fd4 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java @@ -1,6 +1,7 @@ package com.hnac.hzims.safeproduct.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -43,51 +44,60 @@ public class CarEntity extends BaseEntity { private String plateNumber; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("上牌时间") private Date registrationTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("上期缴车保时间") private Date insurancePayLastTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("下期缴车保时间") private Date insurancePayNextTime; @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("年检时间") private Date annualInspectionTime; @NotNull + @Size(max = 50, message = "年检状态长度不能超过50") @ApiModelProperty("年检状态") private String annualInspectionStatus; @NotNull + @Size(max = 50, message = "保险状态长度不能超过50") @ApiModelProperty("保险状态") private String insuranceStatus; - @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("上期保养时间") private Date maintenanceLastTime; - @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("下期保养时间") private Date maintenanceNextTime; @ApiModelProperty("保养里程") private BigDecimal maintenanceMileage; - @NotNull + @Size(max = 50, message = "保养状态长度不能超过50") @ApiModelProperty("保养状态") private String maintenanceStatus; @NotNull + @Size(max = 50, message = "车辆管理人长度不能超过50") @ApiModelProperty("车辆管理人") private String manager; + @Size(max = 1000, message = "车辆照片长度不能超过1000") @ApiModelProperty("车辆照片") private String imgPath; + @Size(max = 1000, message = "车辆附件长度不能超过1000") @ApiModelProperty("车辆附件") private String filePath; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java index 2d106df..10da28b 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java @@ -1,12 +1,15 @@ package com.hnac.hzims.safeproduct.entity; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.util.Date; /** @@ -22,42 +25,60 @@ public class CarMaintenanceEntity extends BaseEntity { @ApiModelProperty("车辆id") private Long carId; + @Size(max = 50, message = "编码长度不能超过50") @ApiModelProperty("编码") private String code; + @NotNull + @Size(max = 50, message = "维保类型长度不能超过50") @ApiModelProperty("维保类型") private String maintenanceType; + @NotNull @ApiModelProperty("维保内容") private String content; + @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("维保开始时间") private Date startTime; + @NotNull + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("维保结束时间") private Date endTime; + @NotNull + @Size(max = 255, message = "维保地点长度不能超过255") @ApiModelProperty("维保地点") private String location; + @NotNull @ApiModelProperty("维保费用") private Long cost; + @NotNull + @Size(max = 20, message = "维保人长度不能超过20") @ApiModelProperty("维保人") private String maintainer; + @Size(max = 1000, message = "维保照片长度不能超过1000") @ApiModelProperty("维保照片") private String imgPath; + @Size(max = 1000, message = "维保附件长度不能超过1000") @ApiModelProperty("维保附件") private String filePath; + @Size(max = 500, message = "车辆管理人意见长度不能超过500") @ApiModelProperty("车辆管理人意见") private String managerAdvice; + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("确认时间") private Date confirmationTime; + @Size(max = 50, message = "维保状态长度不能超过50") @ApiModelProperty("维保状态") private String maintenanceStatus; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java index baf0c43..941a57a 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java @@ -7,6 +7,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.math.BigDecimal; import java.util.Date; @@ -23,33 +25,44 @@ public class CarUsedRecordEntity extends BaseEntity { @ApiModelProperty("车辆id") private Long carId; + @Size(max = 50, message = "编码长度不能超过50") @ApiModelProperty("编码") private String code; + @NotNull + @Size(max = 50, message = "用车单位长度不能超过50") @ApiModelProperty("用车单位") private String unit; + @NotNull @ApiModelProperty("使用时间") private Date startTime; + @NotNull + @Size(max = 255, message = "使用地点长度不能超过255") @ApiModelProperty("使用地点") private String usedLocation; + @NotNull + @Size(max = 20, message = "使用人长度不能超过20") @ApiModelProperty("使用人") private String user; @ApiModelProperty("用途详情") private String remark; + @NotNull @ApiModelProperty("出车公里数") private BigDecimal startMiles; @ApiModelProperty("收车公里数") private BigDecimal endMiles; + @NotNull @ApiModelProperty("行驶公里数") private BigDecimal miles; + @NotNull @ApiModelProperty("收车时间") private Date endTime; @@ -59,6 +72,7 @@ public class CarUsedRecordEntity extends BaseEntity { @ApiModelProperty("用车状态") private String usedStatus; - @ApiModelProperty("图片路径") + @Size(max = 1000, message = "用车图片长度不能超过1000") + @ApiModelProperty("用车图片") private String imgPath; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java index 0379406..f4af9aa 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java @@ -9,7 +9,6 @@ import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.Date; /** @@ -22,8 +21,8 @@ import java.util.Date; @ApiModel(value = "卫生自查计划实体类") public class HygienePlanEntity extends BaseEntity { - @ApiModelProperty("编码") - private String code; + @ApiModelProperty("计划名称") + private String name; @ApiModelProperty("标准总分值") private Integer standardScore; @@ -38,8 +37,6 @@ public class HygienePlanEntity extends BaseEntity { @ApiModelProperty("计划结束时间") private Date scheduledEndTime; - @NotNull - @Size(max = 20, message = "卫生自查状态字段长度不能超过20") - @ApiModelProperty("卫生自查状态") - private String hygieneStatus; + @ApiModelProperty("自查计划状态") + private String hygienePlanStatus; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java index 25d7842..275d3dd 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java @@ -45,6 +45,7 @@ public class HygieneRecordEntity extends BaseEntity { @ApiModelProperty("责任区id") private String hygieneZoneIds; + @NotNull @ApiModelProperty("检查结果") private String checkResult; @@ -58,4 +59,7 @@ public class HygieneRecordEntity extends BaseEntity { @Size(max = 1000, message = "检查图片字段长度不能超过1000") @ApiModelProperty("检查图片") private String imgPath; + + @ApiModelProperty("自查记录状态") + private String hygieneRecordStatus; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java index 1bcf594..1b139d9 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java @@ -9,6 +9,7 @@ import org.springblade.core.mp.base.BaseEntity; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.util.Date; @@ -38,12 +39,15 @@ public class RehearsalRecordEntity extends BaseEntity { @ApiModelProperty("参演人员") private String peopleName; + @NotNull @ApiModelProperty("演练实际开始时间") private Date actualStartTime; + @NotNull @ApiModelProperty("演练实际结束时间") private Date actualEndTime; + @NotNull @Size(max = 250, message = "演练记录字段长度不能超过250") @ApiModelProperty("演练记录") private String record; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarInsuranceStatusEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarInsuranceStatusEnum.java new file mode 100644 index 0000000..c3e90e2 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarInsuranceStatusEnum.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.enums; + +/** + * 车辆保险记录状态枚举类 + * + * @author liwen + * @date 2024-01-11 + */ +public enum CarInsuranceStatusEnum { + + INSURED("INSURED", "已参保"), + UNINSURED("UNINSURED", "未参保"); + + private final String value; + + private final String desc; + + CarInsuranceStatusEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarMaintenanceStatusEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarMaintenanceStatusEnum.java new file mode 100644 index 0000000..f239837 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarMaintenanceStatusEnum.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.enums; + +/** + * 车辆维保记录状态枚举类 + * + * @author liwen + * @date 2024-01-10 + */ +public enum CarMaintenanceStatusEnum { + + MAINTAINED("MAINTAINED", "已维保"), + UNMAINTAINED("UNMAINTAINED", "未维保"); + + private final String value; + + private final String desc; + + CarMaintenanceStatusEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarUsedRecordEnum.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarUsedRecordEnum.java new file mode 100644 index 0000000..b8e5211 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarUsedRecordEnum.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.safeproduct.enums; + +/** + * 用车记录枚举类 + * + * @author liwen + * @date 2024-01-10 + */ +public enum CarUsedRecordEnum { + + USING("USING", "使用中"), + USED("USED", "已使用"); + + private final String value; + + private final String desc; + + CarUsedRecordEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java index 2a48891..2c1ff91 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java @@ -1,5 +1,6 @@ package com.hnac.hzims.safeproduct.vo; +import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -37,5 +38,5 @@ public class CarCheckRecordDetailVO { private String remark; @ApiModelProperty("检查列表") - private List checkItemList; + private List checkItemList; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordPageVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordPageVO.java new file mode 100644 index 0000000..d274cd3 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordPageVO.java @@ -0,0 +1,37 @@ +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-09 + */ +@Data +@ApiModel(value = "车检记录页面VO类") +public class CarCheckRecordPageVO { + + @ApiModelProperty("车检记录id") + private Long id; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("检查人") + private String checker; + + @ApiModelProperty("检查时间") + private Date checkTime; + + @ApiModelProperty("检查结论") + private String conclusion; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java index 0c54dc9..5b166b6 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java @@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + /** * @author liwen * @date 2024-01-04 @@ -24,8 +26,11 @@ public class CarMaintenancePageVO { @ApiModelProperty("型号") private String carType; + @ApiModelProperty("车牌号") + private String plateNumber; + @ApiModelProperty("维保类型") - private String type; + private String maintenanceType; @ApiModelProperty("维保内容") private String content; @@ -38,4 +43,7 @@ public class CarMaintenancePageVO { @ApiModelProperty("维保人") private String maintainer; + + @ApiModelProperty("确认时间") + private Date confirmationTime; } diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java index 38fa1eb..d24ba26 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java @@ -15,6 +15,9 @@ import java.util.Date; @ApiModel(value = "用车记录页面VO类") public class CarUsedRecordPageVO { + @ApiModelProperty("用车记录id") + private Long id; + @ApiModelProperty("用车单位") private String unit; @@ -24,6 +27,9 @@ public class CarUsedRecordPageVO { @ApiModelProperty("车牌号") private String plateNumber; + @ApiModelProperty("使用地点") + private String usedLocation; + @ApiModelProperty("使用时间") private Date startTime; @@ -41,4 +47,7 @@ public class CarUsedRecordPageVO { @ApiModelProperty("行驶公里数") private BigDecimal miles; + + @ApiModelProperty("确认时间") + private Date confirmationTime; } diff --git a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java index 8b01972..f55df9c 100644 --- a/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java +++ b/hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java @@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam; * @author ysj */ @FeignClient( - value = TicketConstants.APP_NAME, - fallback = RepairClientFallback.class + value = TicketConstants.APP_NAME +// fallback = RepairClientFallback.class ) public interface IRepairClient { diff --git a/hzims-service/safeproduct/lib/aspose-words-15.8.0-jdk16.jar b/hzims-service/safeproduct/lib/aspose-words-15.8.0-jdk16.jar new file mode 100644 index 0000000..c0e699f Binary files /dev/null and b/hzims-service/safeproduct/lib/aspose-words-15.8.0-jdk16.jar differ diff --git a/hzims-service/safeproduct/pom.xml b/hzims-service/safeproduct/pom.xml index c33eae4..a048dd1 100644 --- a/hzims-service/safeproduct/pom.xml +++ b/hzims-service/safeproduct/pom.xml @@ -132,6 +132,14 @@ com.hnac.hzims ticket-api + + + com.aspose + aspose-words + 15.8.0 + system + ${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar + diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java index 6d83610..20ce27e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java @@ -3,9 +3,9 @@ package com.hnac.hzims.safeproduct.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO; import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO; import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO; -import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity; @@ -25,6 +25,7 @@ import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.Map; @@ -84,7 +85,8 @@ public class CarController extends BladeController { @ApiOperation(value = "车辆分页") @ApiOperationSupport(order = 5) public R> carPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = carService.page(Condition.getPage(query), Condition.getQueryWrapper(param, CarEntity.class)); + IPage page = carService.page(Condition.getPage(query), Condition.getQueryWrapper(param, CarEntity.class) + .lambda().orderByDesc(CarEntity::getCreateTime)); return R.data(page); } @@ -133,8 +135,8 @@ public class CarController extends BladeController { @PostMapping("/confirmCarMaintenance") @ApiOperation(value = "车辆维保记录确认") @ApiOperationSupport(order = 11) - public R confirmCarMaintenance(@RequestBody CarMaintenanceConfirmationDTO confirmationDTO) { - return R.status(carMaintenanceService.confirmCarMaintenance(confirmationDTO)); + public R confirmCarMaintenance(@Valid @RequestBody CarMaintenanceConfirmationDTO confirmationDTO) { + return carMaintenanceService.confirmCarMaintenance(confirmationDTO); } @PostMapping("/saveCarUsedRecord") @@ -148,7 +150,7 @@ public class CarController extends BladeController { @ApiOperation(value = "修改用车记录") @ApiOperationSupport(order = 13) public R updateCarUsedRecord(@Valid @RequestBody CarUsedRecordEntity carUsedRecordEntity) { - return R.status(carUsedRecordService.updateById(carUsedRecordEntity)); + return R.status(carUsedRecordService.updateCarUsedRecord(carUsedRecordEntity)); } @PostMapping("/removeCarUsedRecord") @@ -167,9 +169,10 @@ public class CarController extends BladeController { @GetMapping("/carUsedRecordPage") @ApiImplicitParams({ - @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string") }) - @ApiOperation(value = "车辆维保记录分页") + @ApiOperation(value = "用车记录分页") @ApiOperationSupport(order = 16) public R> carUsedRecordPage(@ApiIgnore @RequestParam Map param, Query query) { IPage page = carUsedRecordService.getCarUsedRecordPage(param, query); @@ -179,8 +182,8 @@ public class CarController extends BladeController { @PostMapping("/confirmCarUsedRecord") @ApiOperation(value = "用车记录确认") @ApiOperationSupport(order = 17) - public R confirmCarUsedRecord(@RequestBody CarUsedRecordConfirmationDTO confirmationDTO) { - return R.status(carUsedRecordService.confirmCarUsedRecord(confirmationDTO)); + public R confirmCarUsedRecord(@Valid @RequestBody CarUsedRecordConfirmationDTO confirmationDTO) { + return carUsedRecordService.confirmCarUsedRecord(confirmationDTO); } @GetMapping("/milesDataByYear") @@ -194,39 +197,61 @@ public class CarController extends BladeController { @PostMapping("/saveCarCheckRecord") @ApiOperation(value = "新增车检记录") @ApiOperationSupport(order = 19) - public R saveCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) { - return R.status(carCheckRecordService.saveCarCheckRecord(carCheckRecordEntity)); + public R saveCarCheckRecord(@Valid @RequestBody CarCheckRecordDTO carCheckRecordDTO) { + return R.status(carCheckRecordService.saveCarCheckRecord(carCheckRecordDTO)); } @PostMapping("/updateCarCheckRecord") @ApiOperation(value = "修改车检记录") @ApiOperationSupport(order = 20) - public R updateCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) { - return R.status(carCheckRecordService.updateById(carCheckRecordEntity)); + public R updateCarCheckRecord(@Valid @RequestBody CarCheckRecordDTO carCheckRecordDTO) { + return R.status(carCheckRecordService.updateCarCheckRecord(carCheckRecordDTO)); } @PostMapping("/removeCarCheckRecord") @ApiOperation(value = "删除车检记录") @ApiOperationSupport(order = 21) public R removeCarCheckRecord(@RequestParam Long id) { - return R.status(carCheckRecordService.removeById(id)); + return R.status(carCheckRecordService.removeCarCheckRecord(id)); } @GetMapping("/carCheckRecordDetail") @ApiOperation(value = "车检记录详情") - @ApiOperationSupport(order = 15) + @ApiOperationSupport(order = 22) public R carCheckRecordDetail(@RequestParam Long id) { return R.data(carCheckRecordService.getCarCheckRecord(id)); } @GetMapping("/carCheckRecordPage") @ApiImplicitParams({ - @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string") }) - @ApiOperation(value = "车辆维保记录分页") - @ApiOperationSupport(order = 16) - public R> carCheckRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = carUsedRecordService.getCarUsedRecordPage(param, query); + @ApiOperation(value = "车检记录分页") + @ApiOperationSupport(order = 23) + public R> carCheckRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = carCheckRecordService.getCarCheckRecordPage(param, query); return R.data(page); } + + @GetMapping("/exportCarMaintenanceData") + @ApiOperation(value = "导出车辆维保记录单") + @ApiOperationSupport(order = 24) + public void exportCarMaintenanceData(@RequestParam Long id, HttpServletResponse response) { + carMaintenanceService.exportCarMaintenanceData(id, response); + } + + @GetMapping("/exportCarUsedRecordData") + @ApiOperation(value = "导出用车记录单") + @ApiOperationSupport(order = 25) + public void exportCarUsedRecordData() { + + } + + @GetMapping("/exportCarCheckRecordData") + @ApiOperation(value = "导出车检记录单") + @ApiOperationSupport(order = 26) + public void exportCarCheckRecordData() { + + } } 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 aea0139..38e48e4 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 @@ -148,4 +148,11 @@ public class RehearsalController extends BladeController { public void exportRehearsalData(@ApiIgnore @RequestParam Map param, HttpServletResponse response) { rehearsalPlanService.exportRehearsalPlanData(param, response); } + + @GetMapping("/exportRecordDetailData") + @ApiOperation(value = "演练记录表导出") + @ApiOperationSupport(order = 14) + public void exportRecordDetailData(@RequestParam Long id) { + rehearsalRecordService.exportRecordDetailData(id); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java new file mode 100644 index 0000000..86c7e55 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.safeproduct.jobs; + +import com.hnac.hzims.safeproduct.entity.CarEntity; +import com.hnac.hzims.safeproduct.service.ICarService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.List; + +/** + * 车辆模块定时任务 + * + * @author liwen + * @date 2024-01-11 + */ +@Component +public class CarJob { + + @Autowired + ICarService carService; + + /** + * 车辆台账自动变更 + */ + @XxlJob("autoChangeCarStatus") + public ReturnT autoChangeCarStatus(String param) { + // 获取时间范围 + Date current = DateUtil.now(); + Date before = DateUtil.minusDays(current, 1); + String today = DateUtil.format(current, "yyyy-mm-dd"); + String yesterday = DateUtil.format(before, "yyyy-mm-dd"); + List uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday); +// uninsuredCarList.forEach(car -> car.setInsuranceStatus()); +// List carListByMaintenanceTime = carService.getCarListByMaintenanceTime(today, yesterday); + return ReturnT.SUCCESS; + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java index 608b499..3f63ae6 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java @@ -1,9 +1,13 @@ package com.hnac.hzims.safeproduct.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; +import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; import org.apache.ibatis.annotations.Mapper; +import java.util.Map; + /** * 车检记录Mapper类 * @@ -13,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface CarCheckRecordMapper extends BaseMapper { + /** + * 车检记录分页 + * @param param 入参 + * @param page 分页类 + * @return 分页数据 + */ + IPage getCarCheckRecordPage(IPage page, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml index f372a67..3678e62 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml @@ -2,4 +2,21 @@ + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml index 86c1564..33ba901 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml @@ -10,7 +10,7 @@ hzims_car_maintenance t1 LEFT JOIN hzims_car t2 ON t1.car_id = t2.id WHERE - is_deleted = 0 + t1.is_deleted = 0 AND t1.id = #{carMaintenanceId} @@ -18,12 +18,13 @@ SELECT - t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t1.confirmation_time, '%m') as dateTime, sum(t2.miles) as miles + t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles FROM hzims_car t1 LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id WHERE t1.is_deleted = 0 - AND t2.confirmation_time like concat('%', #{year}, '%') + AND t2.end_time like concat('%', #{year}, '%') - AND t2.used_status = 'CONFIRMED' + AND t2.used_status = 'USED' AND t1.plate_number in #{car} GROUP BY - t1.plate_number, DATE_FORMAT(t1.confirmation_time, '%m') + t1.plate_number, DATE_FORMAT(t2.end_time, '%m') ORDER BY - t1.end_time DESC + t1.create_time DESC SELECT - t1.unit, t1.start_time, t1.user, t1.remark, t1.start_miles, t1.end_miles, t1.miles, - t2.car_brand, t2.plate_number + t1.id, t1.unit, t1.start_time, t1.user, t1.remark, t1.start_miles, t1.end_miles, t1.miles, + t2.car_brand, t2.plate_number, t1.used_location, t1.confirmation_time, t1.used_location FROM hzims_car_used_record t1 LEFT JOIN hzims_car t2 ON t1.car_id = t2.id @@ -28,6 +28,9 @@ AND t1.unit = #{param.unit} + + AND t1.car_id = #{param.carId} + ORDER BY t1.create_time DESC diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml index 18fdba8..ce87bbb 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml @@ -22,11 +22,11 @@ SELECT unit, count(1) as finished_task_num FROM - hzims_hygiene_plan + hzims_hygiene_record WHERE is_deleted = 0 AND scheduled_end_time like concat('%', #{month}, '%') - AND hygiene_status = 'FINISHED' + AND hygiene_plan_status = 'FINISHED' AND unit like concat('%', #{unit}, '%') diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java index 9bd0042..934bb38 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java @@ -3,6 +3,8 @@ package com.hnac.hzims.safeproduct.service; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; +import java.util.List; + /** * 车检项服务类 * @@ -11,4 +13,24 @@ import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; */ public interface ICarCheckItemService extends IService { + /** + * 根据检查项获取数据 + * @param checkContent 检查内容 + * @return 检查项数据 + */ + CarCheckItemEntity getDetailByCheckContent(String checkContent); + + /** + * 删除关联检查项数据 + * @param carCheckRecordId 车检记录id + * @return true-成功,false-失败 + */ + boolean removeRelativeCarCheckItem(Long carCheckRecordId); + + /** + * 根据车检记录id查询检查项数据 + * @param carCheckRecordId 车检记录id + * @return 检查项数据 + */ + List getListByCarCheckRecordId(Long carCheckRecordId); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java index 0337b44..e9dfc26 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java @@ -1,8 +1,14 @@ package com.hnac.hzims.safeproduct.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO; import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; +import org.springblade.core.mp.support.Query; + +import java.util.Map; /** * 车检记录服务类 @@ -14,10 +20,10 @@ public interface ICarCheckRecordService extends IService { /** * 新增车检记录 - * @param carCheckRecordEntity 车检记录实体类 + * @param carCheckRecordDTO 车检记录DTO类 * @return true-成功,false-失败 */ - boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity); + boolean saveCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO); /** * 车检记录详情 @@ -25,4 +31,33 @@ public interface ICarCheckRecordService extends IService { * @return 车检记录详情VO类 */ CarCheckRecordDetailVO getCarCheckRecord(Long id); + + /** + * 车检记录分页 + * @param param 入参 + * @param query 分页类 + * @return 分页数据 + */ + IPage getCarCheckRecordPage(Map param, Query query); + + /** + * 根据编码查询车检记录 + * @param code 编码 + * @return 车检记录实体类 + */ + CarCheckRecordEntity getCarCheckRecordByCode(String code); + + /** + * 修改车检记录 + * @param carCheckRecordDTO 车检记录DTO类 + * @return true-成功,false-失败 + */ + boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO); + + /** + * 删除车检记录 + * @param id 车检记录id + * @return true-成功,false-失败 + */ + boolean removeCarCheckRecord(Long id); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java index f85ba53..a925669 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java @@ -7,7 +7,9 @@ import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import javax.servlet.http.HttpServletResponse; import java.util.Map; /** @@ -43,7 +45,14 @@ public interface ICarMaintenanceService extends IService { /** * 车辆维保记录确认 * @param confirmationDTO 车辆维保记录确认DTO类 - * @return true-成功,false-失败 + * @return 封装结果类 + */ + R confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO); + + /** + * 导出车辆维保记录单 + * @param id 车辆维保记录id + * @param response 响应类 */ - boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO); + void exportCarMaintenanceData(Long id, HttpServletResponse response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java index 43c815f..ce6daed 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java @@ -1,12 +1,13 @@ package com.hnac.hzims.safeproduct.service; - import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; import org.springblade.core.mp.support.Query; +import java.util.List; + /** * 车辆管理服务类 * @@ -23,4 +24,12 @@ public interface ICarService extends IService { * @return 分页数据 */ IPage milesDataByYear(String year, String unit, Query query); + + /** + * 根据参保时间查询车辆列表 + * @param today 当天 + * @param yesterday 昨天 + * @return 车辆列表数据 + */ + List getCarListByInsuranceTime(String today, String yesterday); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java index b8ba1f9..53af9f1 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java @@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO; import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity; -import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; import java.util.Map; @@ -44,7 +44,14 @@ public interface ICarUsedRecordService extends IService { /** * 用车记录确认 * @param confirmationDTO 用车记录确认DTO类 + * @return 封装结果类 + */ + R confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO); + + /** + * 更新用车记录 + * @param carUsedRecordEntity 用车记录实体类 * @return true-成功,false-失败 */ - boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO); + boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java index 6d3e98d..0846fbb 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java @@ -66,11 +66,11 @@ public interface IHygienePlanService extends IService { HygienePlanDetailVO getPlan(Long id); /** - * 根据编码查询卫生自查计划 - * @param code 编码 + * 根据名称查询卫生自查计划 + * @param name 名称 * @return 卫生自查计划实体类 */ - HygienePlanEntity getPlanByCode(String code); + HygienePlanEntity getPlanByName(String name); /** * 月度数据导出 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 0fab88d..f1092da 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 @@ -31,4 +31,10 @@ public interface IRehearsalRecordService extends IService * @return true-成功,false-失败 */ boolean removeRelativeRehearsalRecord(Long rehearsalPlanId); + + /** + * 演练记录表导出 + * @param id 演练记录id + */ + void exportRecordDetailData(Long id); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java index ede8a3a..17da3e5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java @@ -1,11 +1,16 @@ package com.hnac.hzims.safeproduct.service.impl; +import com.alibaba.excel.util.CollectionUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; import com.hnac.hzims.safeproduct.mapper.CarCheckItemMapper; import com.hnac.hzims.safeproduct.service.ICarCheckItemService; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.stream.Collectors; + /** * 车检项服务实现类 * @@ -15,4 +20,40 @@ import org.springframework.stereotype.Service; @Service public class CarCheckItemServiceImpl extends ServiceImpl implements ICarCheckItemService { + /** + * 根据检查项获取数据 + */ + @Override + public CarCheckItemEntity getDetailByCheckContent(String checkContent) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckItemEntity::getCheckContent, checkContent); + return this.getOne(queryWrapper); + } + + /** + * 删除关联检查项数据 + */ + @Override + public boolean removeRelativeCarCheckItem(Long carCheckRecordId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckItemEntity::getCarCheckRecordId, carCheckRecordId); + List list = this.list(queryWrapper); + // 若无相关检查项,返回true + if (CollectionUtils.isEmpty(list)) { + return true; + } + List ids = list.stream().map(CarCheckItemEntity::getId).collect(Collectors.toList()); + return this.removeByIds(ids); + } + + /** + * 根据车检记录id查询检查项数据 + */ + @Override + public List getListByCarCheckRecordId(Long carCheckRecordId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckItemEntity::getCarCheckRecordId, carCheckRecordId) + .orderByDesc(CarCheckItemEntity::getCheckItem); + return this.list(queryWrapper); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java index 60a876a..5e6db20 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -1,10 +1,12 @@ package com.hnac.hzims.safeproduct.service.impl; -import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; 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.safeproduct.dto.CarCheckRecordDTO; import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; import com.hnac.hzims.safeproduct.entity.CarEntity; @@ -15,14 +17,19 @@ import com.hnac.hzims.safeproduct.service.ICarCheckRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarCheckItemVO; import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.utils.BeanUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; /** * 车检记录服务实现类 @@ -42,16 +49,28 @@ public class CarCheckRecordServiceImpl extends ServiceImpl itemList = carCheckRecordDTO.getItemList(); + itemList.forEach(x -> x.setCarCheckRecordId(recordEntity.getId())); + return carCheckItemService.saveBatch(itemList); + } + return false; } /** @@ -77,31 +96,29 @@ public class CarCheckRecordServiceImpl extends ServiceImpl checkList = new ArrayList<>(); - String[] checkItemIds = carCheckRecord.getCheckItemIds().split(",|,"); - String[] checkItemResults = carCheckRecord.getCheckItemResults().split(",|,"); - for (int i = 0; i < checkItemIds.length; i++) { - CarCheckItemEntity checkItemEntity = carCheckItemService.getById(checkItemIds[i]); - CarCheckItemVO carCheckItemVO = new CarCheckItemVO(); - carCheckItemVO.setCheckItem(checkItemEntity.getCheckItem()); - carCheckItemVO.setCheckContent(checkItemEntity.getCheckContent()); - carCheckItemVO.setCheckResult(checkItemResults[i]); - checkList.add(carCheckItemVO); - } - carCheckRecordDetailVO.setCheckItemList(checkList); + List itemList = carCheckItemService.getListByCarCheckRecordId(id); + carCheckRecordDetailVO.setCheckItemList(itemList); return carCheckRecordDetailVO; } return null; } /** + * 车检记录分页 + */ + @Override + public IPage getCarCheckRecordPage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + return baseMapper.getCarCheckRecordPage(page, param); + } + + /** * 查询是否存在同月编号 * @param currentMonth 当月 * @return 存在则返回上一编号,否则返回null */ private String getLastCode(String currentMonth) { - String month = currentMonth.substring(currentMonth.length() - 2); - List list = getCarCheckRecordByMonth(month); + List list = getCarCheckRecordByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } @@ -109,9 +126,9 @@ public class CarCheckRecordServiceImpl extends ServiceImpl getCarCheckRecordByMonth(String month) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -119,4 +136,45 @@ public class CarCheckRecordServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(CarCheckRecordEntity::getCode, code); + return this.getOne(queryWrapper); + } + + /** + * 修改车检记录 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) { + // 更新检查项 + List itemList = carCheckRecordDTO.getItemList(); + boolean updateItem = carCheckItemService.updateBatchById(itemList); + // 若更新检查项成功,则更新车检记录 + if (updateItem) { + CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity(); + BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity); + return this.updateById(carCheckRecordEntity); + } + return false; + } + + /** + * 删除车检记录 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public boolean removeCarCheckRecord(Long id) { + boolean remove = this.removeById(id); + if (remove) { + return carCheckItemService.removeRelativeCarCheckItem(id); + } + return false; + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java index 3aa1cf3..79836c5 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java @@ -1,24 +1,41 @@ package com.hnac.hzims.safeproduct.service.impl; import cn.hutool.core.date.DatePattern; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.util.CollectionUtils; +import com.alibaba.excel.write.metadata.WriteSheet; 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.safeproduct.dto.CarMaintenanceConfirmationDTO; +import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; +import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum; import com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper; -import com.hnac.hzims.safeproduct.mapper.CarMapper; import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; +import com.hnac.hzims.safeproduct.service.ICarService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; +import com.hnac.hzims.ticket.constants.WorkTicketConstants; +import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -32,8 +49,8 @@ import java.util.Map; @Service public class CarMaintenanceServiceImpl extends ServiceImpl implements ICarMaintenanceService { - @Resource - CarMapper carMapper; + @Autowired + ICarService carService; /** * 新增车辆维保记录 @@ -41,12 +58,13 @@ public class CarMaintenanceServiceImpl extends ServiceImpl params = BaseUtil.convertObjectToMap(carMaintenanceEntity); +// String templateFile = "" + try { + List res = new ArrayList<>(); + XWPFDocument document = BaseUtil.fillDocument("template/", params); + res.add(document); + BaseUtil.exportWord(res, ""); + } catch (Exception e) { + throw new RuntimeException(e); + } +// String pdfPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".pdf"; +// AsposeUtil.wordToPdf(wordPath, pdfPath); +// PdfUtils.readPdf(response,pdfPath); +// ServletOutputStream outputStream = null; +// try { +// outputStream = response.getOutputStream(); +// CarMaintenanceDetailVO carMaintenance = getCarMaintenance(id); +// // 设置响应头 +// // URLEncoder.encode防止中文乱码 +// String fileName = URLEncoder.encode("车辆维保记录单", "UTF-8"); +// response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); +// response.setContentType("application/vnd.ms-excel"); +// response.setCharacterEncoding("UTF-8"); +// List dataList = new ArrayList<>(); +// dataList.add(carMaintenance); +// String templatePath = "template/车辆维保记录单.xlsx"; +// Resource resource = new ClassPathResource(templatePath); +// // ExcelWriter初始化 +// ExcelWriter excelWriter = EasyExcel +// .write(response.getOutputStream(), CarMaintenanceDetailVO.class) +// .autoCloseStream(Boolean.TRUE) +// .withTemplate(resource.getInputStream()) +// .build(); +// WriteSheet writeSheet = EasyExcel.writerSheet(1, "车辆维保记录单").build(); +// excelWriter.write(dataList, writeSheet); +// excelWriter.finish(); +// } catch (Exception e) { +// // 重置response +// response.reset(); +// response.setContentType("application/json"); +// response.setCharacterEncoding("utf-8"); +// throw new ServiceException("车辆维保记录单导出异常: " + e.getMessage()); +// } finally { +// if (outputStream != null) { +// try { +// outputStream.close(); +// } catch (IOException e) { +// log.error("车辆维保记录单导出响应头输出流关闭异常: " + e.getMessage()); +// } +// } +// } } /** @@ -85,8 +178,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl list = getHygieneByMonth(month); + List list = getCarMaintenanceByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } @@ -98,7 +190,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl getHygieneByMonth(String month) { + private List getCarMaintenanceByMonth(String month) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().like(CarMaintenanceEntity::getCreateTime, month) .orderByDesc(CarMaintenanceEntity::getCode); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java index 64c55cd..d9e8adf 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzims.safeproduct.service.impl; +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; @@ -102,4 +103,15 @@ public class CarServiceImpl extends ServiceImpl implements carPage.setRecords(res); return carPage; } + + /** + * 根据参保时间查询车辆列表 + */ + @Override + public List getCarListByInsuranceTime(String today, String yesterday) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().le(CarEntity::getInsurancePayLastTime, today) + .ge(CarEntity::getInsurancePayNextTime, today); + return this.list(queryWrapper); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java index 2b35beb..d8f2295 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java @@ -8,14 +8,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO; import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity; +import com.hnac.hzims.safeproduct.enums.CarUsedRecordEnum; import com.hnac.hzims.safeproduct.mapper.CarUsedRecordMapper; import com.hnac.hzims.safeproduct.service.ICarUsedRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO; import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO; import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; @@ -35,14 +39,18 @@ public class CarUsedRecordServiceImpl extends ServiceImpl list = getHygieneByMonth(month); + List list = getCarUsedRecordByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } @@ -87,11 +111,11 @@ public class CarUsedRecordServiceImpl extends ServiceImpl getHygieneByMonth(String month) { + private List getCarUsedRecordByMonth(String month) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().like(CarUsedRecordEntity::getCreateTime, month) .orderByDesc(CarUsedRecordEntity::getCode); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index 7299e93..d9a787f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -95,14 +95,20 @@ public class HygienePlanServiceImpl extends ServiceImpl zoneList = hygienePlanDTO.getZoneList(); // 若计划新增成功,新增关联责任区数据 if (savePlan) { - HygienePlanEntity hygienePlan = getPlanByCode(hygienePlanDTO.getCode()); + hygienePlan = getPlanByName(hygienePlanDTO.getName()); for (HygieneZoneEntity zone : zoneList) { // 传计划id if (hygienePlan != null) { @@ -126,6 +132,14 @@ public class HygienePlanServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().ne(HygienePlanEntity::getId, hygienePlanDTO.getId()); + queryWrapper.lambda().eq(HygienePlanEntity::getName, hygienePlanDTO.getName()); + HygienePlanEntity hygienePlan = this.getOne(queryWrapper); + if (hygienePlan != null) { + return R.fail("名称不可重复"); + } // 修改卫生自查计划 HygienePlanEntity hygienePlanEntity = new HygienePlanEntity(); BeanUtils.copyProperties(hygienePlanDTO, hygienePlanEntity); @@ -211,9 +225,9 @@ public class HygienePlanServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(HygienePlanEntity::getCode, code); + queryWrapper.lambda().eq(HygienePlanEntity::getName, name); return this.getOne(queryWrapper); } 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 ccc7785..2baeec5 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 @@ -12,10 +12,13 @@ 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.safeproduct.constants.SafeProductConstant; 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.entity.RehearsalPlanEntity; +import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper; import com.hnac.hzims.safeproduct.service.IHygieneRecordService; @@ -101,7 +104,13 @@ public class HygieneRecordServiceImpl extends ServiceImpl list = getRehearsalByMonth(month); + List list = getRehearsalByMonth(currentMonth); if (CollectionUtils.isEmpty(list)) { return null; } @@ -118,4 +125,16 @@ public class RehearsalRecordServiceImpl extends ServiceImpl ids = rehearsalRecordList.stream().map(RehearsalRecordEntity::getId).collect(Collectors.toList()); return this.removeByIds(ids); } + + /** + * 演练记录表导出 + */ + @Override + public void exportRecordDetailData(Long id) { + RehearsalRecordEntity rehearsalRecordEntity = this.getById(id); + String tempFileName = "演练记录表.xlsx"; + Assert.isTrue(StringUtil.isNotBlank(tempFileName),() -> { + throw new ServiceException("未找到模板文件,预览失败!"); + }); + } } 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 58cfad5..e36ac90 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,6 +1,17 @@ package com.hnac.hzims.safeproduct.utils; +import cn.afterturn.easypoi.word.WordExportUtil; import com.hnac.hzims.common.logs.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.xwpf.usermodel.XWPFDocument; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 公用工具类 @@ -8,6 +19,7 @@ import com.hnac.hzims.common.logs.utils.StringUtils; * @author liwen * @date 2024-01-02 */ +@Slf4j public class BaseUtil { /** @@ -36,4 +48,65 @@ public class BaseUtil { } return code; } + + /** + * 对象转map + * @param entity 对象 + * @return map + */ + public static Map convertObjectToMap(Object entity) { + Map map = new HashMap<>(); + Field[] fields = entity.getClass().getFields(); + try { + for (Field field : fields) { + field.setAccessible(true); + Object value = field.get(entity); + map.put(field.getName(), value); + } + } catch (IllegalAccessException e) { + log.info("对象转map异常: {}", e.getMessage()); + } + return map; + } + + /** + * 文件导出 + * @param documents doc文件 + * @param savePath 存储路径 + */ + public static void exportWord(List documents, String savePath) { + FileOutputStream out = null; + try { + out = new FileOutputStream(savePath); + for (XWPFDocument document : documents) { + document.write(out); + } + out.close(); + } catch (IOException e) { + log.error("文件导出异常: {}", e.getMessage()); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException e) { + log.error("文件导出-输出流关闭异常: {}", e.getMessage()); + } + } + } + } + + /** + * 数据写入模板文件 + * @param templatePath 模板路径 + * @param params 数据 + */ + public static XWPFDocument fillDocument(String templatePath, Map params) { + XWPFDocument xwpfDocument = null; + try { + xwpfDocument = WordExportUtil.exportWord07(templatePath, params); + } catch (Exception e) { + log.error("数据写入异常: {}", e.getMessage()); + } + return xwpfDocument; + } } diff --git a/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql index 419e469..ef3b5b4 100644 --- a/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/1.0.1.sql @@ -37,10 +37,10 @@ CREATE TABLE `hzims_rehearsal_record` ( `code` varchar(50) NOT NULL COMMENT '编号', `people_num` int(10) NOT NULL DEFAULT '0' COMMENT '参演人数', `people_name` varchar(5000) DEFAULT '' COMMENT '参演人员', - `actual_start_time` datetime DEFAULT NULL COMMENT '演练实际开始时间', - `actual_end_time` datetime DEFAULT NULL COMMENT '演练实际结束时间', - `record` varchar(250) DEFAULT '' COMMENT '演练记录', - `comment` varchar(250) DEFAULT '' DEFAULT '' COMMENT '演练评价', + `actual_start_time` datetime NOT NULL COMMENT '演练实际开始时间', + `actual_end_time` datetime NOT NULL COMMENT '演练实际结束时间', + `record` varchar(250) NOT NULL DEFAULT '' COMMENT '演练记录', + `comment` varchar(250) NOT NULL DEFAULT '' COMMENT '演练评价', `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '演练图片', `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '演练附件', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', @@ -183,6 +183,7 @@ CREATE TABLE `hzims_hygiene_plan` ( `standard_score` int(10) NOT NULL DEFAULT '100' COMMENT '标准总分值', `scheduled_start_time` date NOT NULL COMMENT '计划开始时间', `scheduled_end_time` date NOT NULL COMMENT '计划结束时间', + `hygiene_plan_status` varchar(50) NOT NULL DEFAULT 'WAITING' COMMENT '自查计划状态', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', @@ -231,4 +232,121 @@ CREATE TABLE `hzims_hygiene_record` ( `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查记录表' ROW_FORMAT=Dynamic; \ No newline at end of file +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查记录表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_car` ( + `id` bigint(20) NOT NULL COMMENT '主键id', + `unit` varchar(50) NOT NULL COMMENT '单位', + `car_brand` varchar(50) NOT NULL COMMENT '品牌', + `car_type` varchar(50) NOT NULL COMMENT '型号', + `plate_number` varchar(50) NOT NULL COMMENT '车牌号', + `registration_time` date NOT NULL COMMENT '上牌时间', + `insurance_pay_last_time` date NOT NULL COMMENT '上期缴车保时间', + `insurance_pay_next_time` date NOT NULL COMMENT '下期缴车保时间', + `annual_inspection_time` date NOT NULL COMMENT '年检时间', + `annual_inspection_status` varchar(50) NOT NULL COMMENT '年检状态', + `insurance_status` varchar(50) NOT NULL COMMENT '保险状态', + `maintenance_last_time` date DEFAULT NULL COMMENT '上期保养时间', + `maintenance_next_time` date DEFAULT NULL COMMENT '下期保养时间', + `maintenance_mileage` decimal(10, 2) DEFAULT NULL COMMENT '保养里程', + `maintenance_status` varchar(50) DEFAULT NULL COMMENT '保养状态', + `manager` varchar(50) NOT NULL COMMENT '车辆管理人', + `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆图片', + `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车辆附件', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车辆台账表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_car_maintenance` ( + `id` bigint(20) NOT NULL COMMENT '主键id', + `car_id` bigint(20) NOT NULL COMMENT '车辆id', + `code` varchar(50) NOT NULL COMMENT '编号', + `maintenance_type` varchar(50) NOT NULL COMMENT '维保类型', + `content` mediumtext NOT NULL COMMENT '维保内容', + `start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '维保开始时间', + `end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '维保结束时间', + `location` varchar(255) NOT NULL COMMENT '维保地点', + `cost` bigint(20) NOT NULL COMMENT '维保费用', + `maintainer` varchar(20) NOT NULL COMMENT '维保人', + `manager_advice` varchar(500) DEFAULT NULL COMMENT '车辆管理人意见', + `maintenance_status` varchar(50) DEFAULT NULL COMMENT '维保状态', + `confirmation_time` datetime DEFAULT NULL COMMENT '确认时间', + `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '维保图片', + `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '维保附件', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车辆维保记录表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_car_used_record` ( + `id` bigint(20) NOT NULL COMMENT '主键id', + `car_id` bigint(20) NOT NULL COMMENT '车辆id', + `code` varchar(50) NOT NULL COMMENT '编号', + `unit` varchar(50) NOT NULL COMMENT '用车单位', + `used_location` varchar(255) NOT NULL COMMENT '使用地点', + `user` varchar(20) NOT NULL COMMENT '使用人', + `remark` mediumtext DEFAULT NULL COMMENT '使用详情', + `start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '使用时间', + `end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '收车时间', + `start_miles` decimal(10, 2) NOT NULL COMMENT '出车公里数', + `end_miles` decimal(10, 2) NOT NULL COMMENT '收车公里数', + `miles` decimal(10, 2) NOT NULL COMMENT '行驶公里数', + `used_status` varchar(50) DEFAULT NULL COMMENT '用车状态', + `confirmation_time` datetime DEFAULT NULL COMMENT '确认时间', + `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '里程图片', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用车记录表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_car_check_record` ( + `id` bigint(20) NOT NULL COMMENT '主键id', + `car_id` bigint(20) NOT NULL COMMENT '车辆id', + `code` varchar(50) NOT NULL COMMENT '编号', + `checker` varchar(50) NOT NULL COMMENT '检查人', + `check_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '检查时间', + `conclusion` mediumtext NOT NULL COMMENT '检查结论', + `remark` varchar(500) NOT NULL DEFAULT '' COMMENT '填报备注', + `confirmation_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '确认时间', + `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '里程图片', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车检记录表' ROW_FORMAT=Dynamic; + +CREATE TABLE `hzims_car_check_item` ( + `id` bigint(20) NOT NULL COMMENT '主键id', + `car_check_record_id` bigint(20) NOT NULL COMMENT '车检记录id', + `check_item` varchar(500) NOT NULL COMMENT '检查项目', + `check_content` mediumtext NOT NULL COMMENT '检查内容', + `check_result` mediumtext NOT NULL COMMENT '检查结果', + `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', + `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_user` bigint(20) DEFAULT '-1' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', + `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', + `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车检项表' ROW_FORMAT=Dynamic; \ No newline at end of file