From 10b9b7e4d254f8212929690a0c137ea9a595990f Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 5 Jan 2024 16:52:20 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E8=BD=A6=E8=BE=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/CarMaintenanceConfirmationDTO.java | 25 +++ .../hzims/safeproduct/dto/CarMilesYearDTO.java | 31 +++ .../dto/CarUsedRecordConfirmationDTO.java | 22 ++ .../safeproduct/entity/CarCheckItemEntity.java | 28 +++ .../safeproduct/entity/CarCheckRecordEntity.java | 45 ++++ .../hnac/hzims/safeproduct/entity/CarEntity.java | 93 +++++++++ .../safeproduct/entity/CarMaintenanceEntity.java | 63 ++++++ .../safeproduct/entity/CarUsedRecordEntity.java | 64 ++++++ .../hnac/hzims/safeproduct/vo/CarCheckItemVO.java | 23 ++ .../safeproduct/vo/CarCheckRecordDetailVO.java | 41 ++++ .../safeproduct/vo/CarMaintenanceDetailVO.java | 61 ++++++ .../hzims/safeproduct/vo/CarMaintenancePageVO.java | 41 ++++ .../hnac/hzims/safeproduct/vo/CarMilesYearVO.java | 64 ++++++ .../safeproduct/vo/CarUsedRecordDetailVO.java | 62 ++++++ .../hzims/safeproduct/vo/CarUsedRecordPageVO.java | 44 ++++ .../safeproduct/controller/CarController.java | 232 +++++++++++++++++++++ .../hnac/hzims/safeproduct/jobs/ConferenceJob.java | 4 + .../hnac/hzims/safeproduct/jobs/HygieneJob.java | 4 + .../safeproduct/mapper/CarCheckItemMapper.java | 16 ++ .../safeproduct/mapper/CarCheckItemMapper.xml | 5 + .../safeproduct/mapper/CarCheckRecordMapper.java | 16 ++ .../safeproduct/mapper/CarCheckRecordMapper.xml | 5 + .../safeproduct/mapper/CarMaintenanceMapper.java | 35 ++++ .../safeproduct/mapper/CarMaintenanceMapper.xml | 42 ++++ .../hnac/hzims/safeproduct/mapper/CarMapper.java | 45 ++++ .../hnac/hzims/safeproduct/mapper/CarMapper.xml | 58 ++++++ .../safeproduct/mapper/CarUsedRecordMapper.java | 35 ++++ .../safeproduct/mapper/CarUsedRecordMapper.xml | 34 +++ .../safeproduct/service/ICarCheckItemService.java | 14 ++ .../service/ICarCheckRecordService.java | 28 +++ .../service/ICarMaintenanceService.java | 49 +++++ .../hzims/safeproduct/service/ICarService.java | 26 +++ .../safeproduct/service/ICarUsedRecordService.java | 50 +++++ .../service/impl/CarCheckItemServiceImpl.java | 18 ++ .../service/impl/CarCheckRecordServiceImpl.java | 122 +++++++++++ .../service/impl/CarMaintenanceServiceImpl.java | 107 ++++++++++ .../safeproduct/service/impl/CarServiceImpl.java | 105 ++++++++++ .../service/impl/CarUsedRecordServiceImpl.java | 100 +++++++++ 38 files changed, 1857 insertions(+) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMilesYearDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckItemVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java 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 new file mode 100644 index 0000000..313ecc5 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.safeproduct.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "车辆维保记录确认DTO类") +public class CarMaintenanceConfirmationDTO { + + @ApiModelProperty("车辆维保记录id") + private Long carMaintenanceId; + + @ApiModelProperty("车辆管理人意见") + private String managerAdvice; + + @ApiModelProperty("确认时间") + private Date confirmationTime; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMilesYearDTO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMilesYearDTO.java new file mode 100644 index 0000000..39568c4 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMilesYearDTO.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.safeproduct.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author liwen + * @date 2024-01-05 + */ +@Data +@ApiModel(value = "年度里程DTO类") +public class CarMilesYearDTO { + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("日期") + private String dateTime; + + @ApiModelProperty("里程数") + private BigDecimal miles; +} 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 new file mode 100644 index 0000000..47a8df7 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.safeproduct.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "用车记录确认DTO类") +public class CarUsedRecordConfirmationDTO { + + @ApiModelProperty("用车记录id") + private Long carUsedRecordId; + + @ApiModelProperty("确认时间") + private Date confirmationTime; +} 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 new file mode 100644 index 0000000..21dd74b --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +/** + * @author liwen + * @date 2024-01-05 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_check_item") +@ApiModel(value = "车检项实体类") +public class CarCheckItemEntity extends BaseEntity { + + @ApiModelProperty("车检记录id") + private Long carCheckRecordId; + + @ApiModelProperty("检查项目") + private String checkItem; + + @ApiModelProperty("检查内容") + private String checkContent; +} 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 new file mode 100644 index 0000000..8035cf5 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java @@ -0,0 +1,45 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-05 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_check_record") +@ApiModel(value = "车检记录实体类") +public class CarCheckRecordEntity extends BaseEntity { + + @ApiModelProperty("车辆id") + private Long carId; + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("检查人") + private String checker; + + @ApiModelProperty("检查时间") + private Date checkTime; + + @ApiModelProperty("检查项id") + private String checkItemIds; + + @ApiModelProperty("检查项结果") + private String checkItemResults; + + @ApiModelProperty("检查结论") + private String conclusion; + + @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 new file mode 100644 index 0000000..b0292ef --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java @@ -0,0 +1,93 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +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.math.BigDecimal; +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car") +@ApiModel(value = "车辆实体类") +public class CarEntity extends BaseEntity { + + @NotNull + @Size(max = 50, message = "单位长度不能超过50") + @ApiModelProperty("单位") + private String unit; + + @NotNull + @Size(max = 50, message = "品牌长度不能超过50") + @ApiModelProperty("品牌") + private String carBrand; + + @NotNull + @Size(max = 50, message = "型号长度不能超过50") + @ApiModelProperty("型号") + private String carType; + + @NotNull + @Size(max = 50, message = "车牌号长度不能超过50") + @ApiModelProperty("车牌号") + private String plateNumber; + + @NotNull + @ApiModelProperty("上牌时间") + private Date registrationTime; + + @NotNull + @ApiModelProperty("上期缴车保时间") + private Date insurancePayLastTime; + + @NotNull + @ApiModelProperty("下期缴车保时间") + private Date insurancePayNextTime; + + @NotNull + @ApiModelProperty("年检时间") + private Date annualInspectionTime; + + @NotNull + @ApiModelProperty("年检状态") + private String annualInspectionStatus; + + @NotNull + @ApiModelProperty("保险状态") + private String insuranceStatus; + + @NotNull + @ApiModelProperty("上期保养时间") + private Date maintenanceLastTime; + + @NotNull + @ApiModelProperty("下期保养时间") + private Date maintenanceNextTime; + + @ApiModelProperty("保养里程") + private BigDecimal maintenanceMileage; + + @NotNull + @ApiModelProperty("保养状态") + private String maintenanceStatus; + + @NotNull + @ApiModelProperty("车辆管理人") + private String manager; + + @ApiModelProperty("车辆照片") + private String imgPath; + + @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 new file mode 100644 index 0000000..2d106df --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java @@ -0,0 +1,63 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_maintenance") +@ApiModel(value = "车辆维保实体类") +public class CarMaintenanceEntity extends BaseEntity { + + @ApiModelProperty("车辆id") + private Long carId; + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("维保类型") + private String maintenanceType; + + @ApiModelProperty("维保内容") + private String content; + + @ApiModelProperty("维保开始时间") + private Date startTime; + + @ApiModelProperty("维保结束时间") + private Date endTime; + + @ApiModelProperty("维保地点") + private String location; + + @ApiModelProperty("维保费用") + private Long cost; + + @ApiModelProperty("维保人") + private String maintainer; + + @ApiModelProperty("维保照片") + private String imgPath; + + @ApiModelProperty("维保附件") + private String filePath; + + @ApiModelProperty("车辆管理人意见") + private String managerAdvice; + + @ApiModelProperty("确认时间") + private Date confirmationTime; + + @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 new file mode 100644 index 0000000..baf0c43 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java @@ -0,0 +1,64 @@ +package com.hnac.hzims.safeproduct.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-03 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("hzims_car_used_record") +@ApiModel(value = "用车记录实体类") +public class CarUsedRecordEntity extends BaseEntity { + + @ApiModelProperty("车辆id") + private Long carId; + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("用车单位") + private String unit; + + @ApiModelProperty("使用时间") + private Date startTime; + + @ApiModelProperty("使用地点") + private String usedLocation; + + @ApiModelProperty("使用人") + private String user; + + @ApiModelProperty("用途详情") + private String remark; + + @ApiModelProperty("出车公里数") + private BigDecimal startMiles; + + @ApiModelProperty("收车公里数") + private BigDecimal endMiles; + + @ApiModelProperty("行驶公里数") + private BigDecimal miles; + + @ApiModelProperty("收车时间") + private Date endTime; + + @ApiModelProperty("确认时间") + private Date confirmationTime; + + @ApiModelProperty("用车状态") + private String usedStatus; + + @ApiModelProperty("图片路径") + private String imgPath; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckItemVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckItemVO.java new file mode 100644 index 0000000..4c5fd37 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckItemVO.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liwen + * @date 2024-01-05 + */ +@Data +@ApiModel(value = "车辆检查项VO类") +public class CarCheckItemVO { + + @ApiModelProperty("检查项目") + private String checkItem; + + @ApiModelProperty("检查内容") + private String checkContent; + + @ApiModelProperty("检查结果") + private String checkResult; +} 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 new file mode 100644 index 0000000..2a48891 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author liwen + * @date 2024-01-05 + */ +@Data +@ApiModel(value = "车辆检查记录详情VO类") +public class CarCheckRecordDetailVO { + + @ApiModelProperty("检查人") + private String checker; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("行驶里程") + private BigDecimal miles; + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("检查结论") + private String conclusion; + + @ApiModelProperty("填报备注") + private String remark; + + @ApiModelProperty("检查列表") + private List checkItemList; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java new file mode 100644 index 0000000..278e6b7 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java @@ -0,0 +1,61 @@ +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-04 + */ +@Data +@ApiModel(value = "车辆维保记录详情VO类") +public class CarMaintenanceDetailVO { + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("维保开始时间") + private Date startTime; + + @ApiModelProperty("维保结束时间") + private Date endTime; + + @ApiModelProperty("维保地点") + private String location; + + @ApiModelProperty("维保费用") + private Long cost; + + @ApiModelProperty("维保人") + private String maintainer; + + @ApiModelProperty("维保内容") + private String content; + + @ApiModelProperty("维保照片") + private String imgPath; + + @ApiModelProperty("维保附件") + private String filePath; + + @ApiModelProperty("车辆管理人意见") + private String managerAdvice; + + @ApiModelProperty("确认时间") + private Date confirmationTime; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("型号") + private String carType; + + @ApiModelProperty("车牌号") + private String plateNumber; +} 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 new file mode 100644 index 0000000..0c54dc9 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java @@ -0,0 +1,41 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "车辆维保记录页面VO类") +public class CarMaintenancePageVO { + + @ApiModelProperty("车辆维保记录id") + private Long id; + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("型号") + private String carType; + + @ApiModelProperty("维保类型") + private String type; + + @ApiModelProperty("维保内容") + private String content; + + @ApiModelProperty("维保地点") + private String location; + + @ApiModelProperty("维保费用") + private Long cost; + + @ApiModelProperty("维保人") + private String maintainer; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java new file mode 100644 index 0000000..492587d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java @@ -0,0 +1,64 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "年度里程数据VO类") +public class CarMilesYearVO { + + @ApiModelProperty("单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("1月里程数") + private BigDecimal januaryMiles; + + @ApiModelProperty("2月里程数") + private BigDecimal februaryMiles; + + @ApiModelProperty("3月里程数") + private BigDecimal marchMiles; + + @ApiModelProperty("4月里程数") + private BigDecimal aprilMiles; + + @ApiModelProperty("5月里程数") + private BigDecimal mayMiles; + + @ApiModelProperty("6月里程数") + private BigDecimal juneMiles; + + @ApiModelProperty("7月里程数") + private BigDecimal julyMiles; + + @ApiModelProperty("8月里程数") + private BigDecimal augustMiles; + + @ApiModelProperty("9月里程数") + private BigDecimal septemberMiles; + + @ApiModelProperty("10月里程数") + private BigDecimal octoberMiles; + + @ApiModelProperty("11月里程数") + private BigDecimal novemberMiles; + + @ApiModelProperty("12月里程数") + private BigDecimal decemberMiles; + + @ApiModelProperty("合计里程数") + private BigDecimal sumMiles; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java new file mode 100644 index 0000000..06cdf91 --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java @@ -0,0 +1,62 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "用车记录详情VO类") +public class CarUsedRecordDetailVO { + + @ApiModelProperty("编码") + private String code; + + @ApiModelProperty("使用时间") + private Date startTime; + + @ApiModelProperty("使用地点") + private String usedLocation; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("用途详情") + private String remark; + + @ApiModelProperty("用车单位") + private String unit; + + @ApiModelProperty("出车公里数") + private BigDecimal startMiles; + + @ApiModelProperty("收车公里数") + private BigDecimal endMiles; + + @ApiModelProperty("行驶公里数") + private BigDecimal miles; + + @ApiModelProperty("图片路径") + private String imgPath; + + @ApiModelProperty("使用人") + private String user; + + @ApiModelProperty("车辆管理人") + private String manager; + + @ApiModelProperty("收车时间") + private Date endTime; + + @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 new file mode 100644 index 0000000..38fa1eb --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author liwen + * @date 2024-01-04 + */ +@Data +@ApiModel(value = "用车记录页面VO类") +public class CarUsedRecordPageVO { + + @ApiModelProperty("用车单位") + private String unit; + + @ApiModelProperty("品牌") + private String carBrand; + + @ApiModelProperty("车牌号") + private String plateNumber; + + @ApiModelProperty("使用时间") + private Date startTime; + + @ApiModelProperty("使用人") + private String user; + + @ApiModelProperty("用途详情") + private String remark; + + @ApiModelProperty("出车公里数") + private BigDecimal startMiles; + + @ApiModelProperty("收车公里数") + private BigDecimal endMiles; + + @ApiModelProperty("行驶公里数") + private BigDecimal miles; +} 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 new file mode 100644 index 0000000..6d83610 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java @@ -0,0 +1,232 @@ +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.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; +import com.hnac.hzims.safeproduct.service.ICarCheckRecordService; +import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; +import com.hnac.hzims.safeproduct.service.ICarService; +import com.hnac.hzims.safeproduct.service.ICarUsedRecordService; +import com.hnac.hzims.safeproduct.vo.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.validation.Valid; +import java.util.Map; + +/** + * 车辆管理接口类 + * + * @author liwen + * @date 2024-01-03 + */ +@RestController +@RequestMapping("/car") +@AllArgsConstructor +@Api(value = "车辆管理", tags = "车辆管理接口") +public class CarController extends BladeController { + + private final ICarService carService; + + private final ICarMaintenanceService carMaintenanceService; + + private final ICarUsedRecordService carUsedRecordService; + + private final ICarCheckRecordService carCheckRecordService; + + @PostMapping("/saveCar") + @ApiOperation(value = "新增车辆") + @ApiOperationSupport(order = 1) + public R saveCar(@Valid @RequestBody CarEntity carEntity) { + return R.status(carService.save(carEntity)); + } + + @PostMapping("/updateCar") + @ApiOperation(value = "修改车辆") + @ApiOperationSupport(order = 2) + public R updateCar(@Valid @RequestBody CarEntity carEntity) { + return R.status(carService.updateById(carEntity)); + } + + @PostMapping("/removeCar") + @ApiOperation(value = "删除车辆") + @ApiOperationSupport(order = 3) + public R removeCar(@RequestParam Long id) { + return R.status(carService.removeById(id)); + } + + @GetMapping("/carDetail") + @ApiOperation(value = "车辆详情") + @ApiOperationSupport(order = 4) + public R carDetail(@RequestParam Long id) { + return R.data(carService.getById(id)); + } + + @GetMapping("/carPage") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string") + }) + @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)); + return R.data(page); + } + + @PostMapping("/saveCarMaintenance") + @ApiOperation(value = "新增车辆维保记录") + @ApiOperationSupport(order = 6) + public R saveCarMaintenance(@Valid @RequestBody CarMaintenanceEntity carMaintenanceEntity) { + return R.status(carMaintenanceService.saveCarMaintenance(carMaintenanceEntity)); + } + + @PostMapping("/updateCarMaintenance") + @ApiOperation(value = "修改车辆维保记录") + @ApiOperationSupport(order = 7) + public R updateCarMaintenance(@Valid @RequestBody CarMaintenanceEntity carMaintenanceEntity) { + return R.status(carMaintenanceService.updateById(carMaintenanceEntity)); + } + + @PostMapping("/removeCarMaintenance") + @ApiOperation(value = "删除车辆维保记录") + @ApiOperationSupport(order = 8) + public R removeCarMaintenance(@RequestParam Long id) { + return R.status(carMaintenanceService.removeById(id)); + } + + @GetMapping("/carMaintenanceDetail") + @ApiOperation(value = "车辆维保记录详情") + @ApiOperationSupport(order = 9) + public R carMaintenanceDetail(@RequestParam Long id) { + return R.data(carMaintenanceService.getCarMaintenance(id)); + } + + @GetMapping("/carMaintenancePage") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "车辆维保记录分页") + @ApiOperationSupport(order = 10) + public R> carMaintenancePage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = carMaintenanceService.getCarMaintenancePage(param, query); + return R.data(page); + } + + @PostMapping("/confirmCarMaintenance") + @ApiOperation(value = "车辆维保记录确认") + @ApiOperationSupport(order = 11) + public R confirmCarMaintenance(@RequestBody CarMaintenanceConfirmationDTO confirmationDTO) { + return R.status(carMaintenanceService.confirmCarMaintenance(confirmationDTO)); + } + + @PostMapping("/saveCarUsedRecord") + @ApiOperation(value = "新增用车记录") + @ApiOperationSupport(order = 12) + public R saveCarUsedRecord(@Valid @RequestBody CarUsedRecordEntity carUsedRecordEntity) { + return R.status(carUsedRecordService.saveCarUsedRecord(carUsedRecordEntity)); + } + + @PostMapping("/updateCarUsedRecord") + @ApiOperation(value = "修改用车记录") + @ApiOperationSupport(order = 13) + public R updateCarUsedRecord(@Valid @RequestBody CarUsedRecordEntity carUsedRecordEntity) { + return R.status(carUsedRecordService.updateById(carUsedRecordEntity)); + } + + @PostMapping("/removeCarUsedRecord") + @ApiOperation(value = "删除用车记录") + @ApiOperationSupport(order = 14) + public R removeCarUsedRecord(@RequestParam Long id) { + return R.status(carUsedRecordService.removeById(id)); + } + + @GetMapping("/carUsedRecordDetail") + @ApiOperation(value = "用车记录详情") + @ApiOperationSupport(order = 15) + public R carUsedRecordDetail(@RequestParam Long id) { + return R.data(carUsedRecordService.getCarUsedRecord(id)); + } + + @GetMapping("/carUsedRecordPage") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "车辆维保记录分页") + @ApiOperationSupport(order = 16) + public R> carUsedRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = carUsedRecordService.getCarUsedRecordPage(param, query); + return R.data(page); + } + + @PostMapping("/confirmCarUsedRecord") + @ApiOperation(value = "用车记录确认") + @ApiOperationSupport(order = 17) + public R confirmCarUsedRecord(@RequestBody CarUsedRecordConfirmationDTO confirmationDTO) { + return R.status(carUsedRecordService.confirmCarUsedRecord(confirmationDTO)); + } + + @GetMapping("/milesDataByYear") + @ApiOperation(value = "年度里程数据") + @ApiOperationSupport(order = 18) + public R> milesDataByYear(@RequestParam String year, String unit, Query query) { + IPage page = carService.milesDataByYear(year, unit, query); + return R.data(page); + } + + @PostMapping("/saveCarCheckRecord") + @ApiOperation(value = "新增车检记录") + @ApiOperationSupport(order = 19) + public R saveCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) { + return R.status(carCheckRecordService.saveCarCheckRecord(carCheckRecordEntity)); + } + + @PostMapping("/updateCarCheckRecord") + @ApiOperation(value = "修改车检记录") + @ApiOperationSupport(order = 20) + public R updateCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) { + return R.status(carCheckRecordService.updateById(carCheckRecordEntity)); + } + + @PostMapping("/removeCarCheckRecord") + @ApiOperation(value = "删除车检记录") + @ApiOperationSupport(order = 21) + public R removeCarCheckRecord(@RequestParam Long id) { + return R.status(carCheckRecordService.removeById(id)); + } + + @GetMapping("/carCheckRecordDetail") + @ApiOperation(value = "车检记录详情") + @ApiOperationSupport(order = 15) + public R carCheckRecordDetail(@RequestParam Long id) { + return R.data(carCheckRecordService.getCarCheckRecord(id)); + } + + @GetMapping("/carCheckRecordPage") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "车辆维保记录分页") + @ApiOperationSupport(order = 16) + public R> carCheckRecordPage(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = carUsedRecordService.getCarUsedRecordPage(param, query); + return R.data(page); + } +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java new file mode 100644 index 0000000..83ea0fa --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java @@ -0,0 +1,4 @@ +package com.hnac.hzims.safeproduct.jobs; + +public class ConferenceJob { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java new file mode 100644 index 0000000..745ae01 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java @@ -0,0 +1,4 @@ +package com.hnac.hzims.safeproduct.jobs; + +public class HygieneJob { +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.java new file mode 100644 index 0000000..d068070 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 车检项Mapper类 + * + * @author liwen + * @date 2024-01-05 + */ +@Mapper +public interface CarCheckItemMapper extends BaseMapper { + +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml new file mode 100644 index 0000000..1aa7909 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..608b499 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 车检记录Mapper类 + * + * @author liwen + * @date 2024-01-05 + */ +@Mapper +public interface CarCheckRecordMapper extends BaseMapper { + +} 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 new file mode 100644 index 0000000..f372a67 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.java new file mode 100644 index 0000000..2a6dc38 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.java @@ -0,0 +1,35 @@ +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.CarMaintenanceEntity; +import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; +import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +/** + * 车辆维保记录Mapper类 + * + * @author liwen + * @date 2024-01-04 + */ +@Mapper +public interface CarMaintenanceMapper extends BaseMapper { + + /** + * 查询车辆维保记录详情 + * @param carMaintenanceId 车辆维保记录id + * @return 车辆维保记录详情VO类 + */ + CarMaintenanceDetailVO getCarMaintenance(Long carMaintenanceId); + + /** + * 车辆维保记录数据页 + * @param param 入参 + * @param page 分页类 + * @return 分页数据 + */ + IPage getCarMaintenancePage(IPage page, Map param); +} 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 new file mode 100644 index 0000000..86c1564 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.java new file mode 100644 index 0000000..f327415 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.java @@ -0,0 +1,45 @@ +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.dto.CarMilesYearDTO; +import com.hnac.hzims.safeproduct.entity.CarEntity; +import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; +import org.apache.ibatis.annotations.Mapper; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 车辆管理Mapper类 + * + * @author liwen + * @date 2024-01-03 + */ +@Mapper +public interface CarMapper extends BaseMapper { + + /** + * 查询当年的全部车辆 + * @param page 分页类 + * @param year 年份 + * @param unit 单位 + * @return 分页车辆数据 + */ + IPage selectCarByYear(IPage page, String year, String unit); + + /** + * 查询车辆当年的月度里程数 + * @param carList 车牌列表 + * @param year 年份 + * @return 里程数列表 + */ + List selectMilesByCar(List carList, String year); + + /** + * 查询车辆的里程数 + * @param plateNumber 车牌号 + * @return 里程数 + */ + BigDecimal selectMilesByPlateNumber(String plateNumber); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml new file mode 100644 index 0000000..0fda798 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.java new file mode 100644 index 0000000..38f26bd --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.java @@ -0,0 +1,35 @@ +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.CarUsedRecordEntity; +import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO; +import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +/** + * 用车记录Mapper类 + * + * @author liwen + * @date 2024-01-04 + */ +@Mapper +public interface CarUsedRecordMapper extends BaseMapper { + + /** + * 用车记录详情 + * @param carUsedRecordId 用车记录id + * @return 用车记录详情VO类 + */ + CarUsedRecordDetailVO getCarUsedRecord(Long carUsedRecordId); + + /** + * 用车记录页面 + * @param param 入参 + * @param page 分页类 + * @return 分页数据 + */ + IPage getCarUsedRecordPage(IPage page, Map param); +} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml new file mode 100644 index 0000000..8a10fa4 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000..9bd0042 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.safeproduct.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; + +/** + * 车检项服务类 + * + * @author liwen + * @date 2024-01-05 + */ +public interface ICarCheckItemService extends IService { + +} 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 new file mode 100644 index 0000000..0337b44 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.safeproduct.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; +import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO; + +/** + * 车检记录服务类 + * + * @author liwen + * @date 2024-01-05 + */ +public interface ICarCheckRecordService extends IService { + + /** + * 新增车检记录 + * @param carCheckRecordEntity 车检记录实体类 + * @return true-成功,false-失败 + */ + boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity); + + /** + * 车检记录详情 + * @param id 车检记录id + * @return 车检记录详情VO类 + */ + CarCheckRecordDetailVO getCarCheckRecord(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 new file mode 100644 index 0000000..f85ba53 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java @@ -0,0 +1,49 @@ +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.CarMaintenanceConfirmationDTO; +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 java.util.Map; + +/** + * 车辆维保记录服务类 + * + * @author liwen + * @date 2024-01-04 + */ +public interface ICarMaintenanceService extends IService { + + /** + * 新增车辆维保记录 + * @param carMaintenanceEntity 车辆维保记录实体类 + * @return true-成功,false-失败 + */ + boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity); + + /** + * 查询车辆维保记录详情 + * @param id 车辆维保记录id + * @return 车辆维保记录详情VO类 + */ + CarMaintenanceDetailVO getCarMaintenance(Long id); + + /** + * 车辆维保记录数据页 + * @param param 入参 + * @param query 分页类 + * @return 分页数据 + */ + IPage getCarMaintenancePage(Map param, Query query); + + /** + * 车辆维保记录确认 + * @param confirmationDTO 车辆维保记录确认DTO类 + * @return true-成功,false-失败 + */ + boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO); +} 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 new file mode 100644 index 0000000..43c815f --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java @@ -0,0 +1,26 @@ +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; + +/** + * 车辆管理服务类 + * + * @author liwen + * @date 2024-01-03 + */ +public interface ICarService extends IService { + + /** + * 年度里程数页面 + * @param year 年份 + * @param unit 单位 + * @param query 分页类 + * @return 分页数据 + */ + IPage milesDataByYear(String year, String unit, Query query); +} 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 new file mode 100644 index 0000000..b8ba1f9 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java @@ -0,0 +1,50 @@ +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.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 java.util.Map; + +/** + * 用车记录服务类 + * + * @author liwen + * @date 2024-01-04 + */ +public interface ICarUsedRecordService extends IService { + + /** + * 新增用车记录 + * @param carUsedRecordEntity 用车记录实体类 + * @return true-成功,false-失败 + */ + boolean saveCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity); + + /** + * 用车记录详情 + * @param id 用车记录id + * @return 用车记录详情VO类 + */ + CarUsedRecordDetailVO getCarUsedRecord(Long id); + + /** + * 用车记录页面 + * @param param 入参 + * @param query 分页类 + * @return 分页数据 + */ + IPage getCarUsedRecordPage(Map param, Query query); + + /** + * 用车记录确认 + * @param confirmationDTO 用车记录确认DTO类 + * @return true-成功,false-失败 + */ + boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO); +} 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 new file mode 100644 index 0000000..ede8a3a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.safeproduct.service.impl; + +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; + +/** + * 车检项服务实现类 + * + * @author liwen + * @date 2024-01-05 + */ +@Service +public class CarCheckItemServiceImpl extends ServiceImpl implements ICarCheckItemService { + +} 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 new file mode 100644 index 0000000..60a876a --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java @@ -0,0 +1,122 @@ +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.extension.service.impl.ServiceImpl; +import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; +import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity; +import com.hnac.hzims.safeproduct.entity.CarEntity; +import com.hnac.hzims.safeproduct.mapper.CarCheckRecordMapper; +import com.hnac.hzims.safeproduct.mapper.CarMapper; +import com.hnac.hzims.safeproduct.service.ICarCheckItemService; +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 org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * 车检记录服务实现类 + * + * @author liwen + * @date 2024-01-05 + */ +@Service +public class CarCheckRecordServiceImpl extends ServiceImpl implements ICarCheckRecordService { + + @Resource + CarMapper carMapper; + + @Autowired + ICarCheckItemService carCheckItemService; + + /** + * 新增车检记录 + */ + @Override + public boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity) { + // 编码生成 + // 获取当月时间(yyyymm) + String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); + // 查询是否存在同月编号 + String lastCode = getLastCode(currentMonth); + String code = BaseUtil.getUniqueCode("CLJC", lastCode, currentMonth); + carCheckRecordEntity.setCode(code); + return this.save(carCheckRecordEntity); + } + + /** + * 车检记录详情 + */ + @Override + public CarCheckRecordDetailVO getCarCheckRecord(Long id) { + CarCheckRecordEntity carCheckRecord = this.getById(id); + if (carCheckRecord != null) { + CarCheckRecordDetailVO carCheckRecordDetailVO = new CarCheckRecordDetailVO(); + // 车检记录属性 + carCheckRecordDetailVO.setCode(carCheckRecord.getCode()); + carCheckRecordDetailVO.setChecker(carCheckRecord.getChecker()); + carCheckRecordDetailVO.setConclusion(carCheckRecord.getConclusion()); + carCheckRecordDetailVO.setRemark(carCheckRecord.getRemark()); + // 车辆台账属性 + CarEntity car = carMapper.selectById(carCheckRecord.getCarId()); + if (car != null) { + carCheckRecordDetailVO.setCarBrand(car.getCarBrand()); + carCheckRecordDetailVO.setPlateNumber(car.getPlateNumber()); + // 用车记录属性 + BigDecimal miles = carMapper.selectMilesByPlateNumber(car.getPlateNumber()); + carCheckRecordDetailVO.setMiles(miles); + } + // 拼装检查列表 + List 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); + return carCheckRecordDetailVO; + } + return null; + } + + /** + * 查询是否存在同月编号 + * @param currentMonth 当月 + * @return 存在则返回上一编号,否则返回null + */ + private String getLastCode(String currentMonth) { + String month = currentMonth.substring(currentMonth.length() - 2); + List list = getCarCheckRecordByMonth(month); + if (CollectionUtils.isEmpty(list)) { + return null; + } + return list.get(0).getCode(); + } + + /** + * 查询当月卫生自查记录 + * @param month 当月 + * @return 当月卫生自查数据表 + */ + private List getCarCheckRecordByMonth(String month) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().like(CarCheckRecordEntity::getCreateTime, month) + .orderByDesc(CarCheckRecordEntity::getCode); + return this.list(queryWrapper); + } +} 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 new file mode 100644 index 0000000..3aa1cf3 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java @@ -0,0 +1,107 @@ +package com.hnac.hzims.safeproduct.service.impl; + +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.CarMaintenanceConfirmationDTO; +import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; +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.utils.BaseUtil; +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.utils.DateUtil; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 车辆维保记录服务实现类 + * + * @author liwen + * @date 2024-01-04 + */ +@Service +public class CarMaintenanceServiceImpl extends ServiceImpl implements ICarMaintenanceService { + + @Resource + CarMapper carMapper; + + /** + * 新增车辆维保记录 + */ + @Override + public boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) { + // 编码生成 + // 获取当月时间(yyyymm) + String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); + // 查询是否存在同月编号 + String lastCode = getLastCode(currentMonth); + // 若不存在,新增编号 + String code = BaseUtil.getUniqueCode("YCJL", lastCode, currentMonth); + carMaintenanceEntity.setCode(code); + return this.save(carMaintenanceEntity); + } + + /** + * 查询车辆维保记录详情 + */ + @Override + public CarMaintenanceDetailVO getCarMaintenance(Long id) { + return baseMapper.getCarMaintenance(id); + } + + /** + * 车辆维保记录数据页 + */ + @Override + public IPage getCarMaintenancePage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + return baseMapper.getCarMaintenancePage(page, param); + } + + /** + * 车辆维保记录确认 + */ + @Override + public boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO) { + CarMaintenanceEntity carMaintenanceEntity = this.getById(confirmationDTO.getCarMaintenanceId()); + carMaintenanceEntity.setManagerAdvice(confirmationDTO.getManagerAdvice()); + carMaintenanceEntity.setConfirmationTime(DateUtil.now()); + return this.updateById(carMaintenanceEntity); + } + + /** + * 查询是否存在同月编号 + * @param currentMonth 当月 + * @return 存在则返回上一编号,否则返回null + */ + private String getLastCode(String currentMonth) { + String month = currentMonth.substring(currentMonth.length() - 2); + List list = getHygieneByMonth(month); + if (CollectionUtils.isEmpty(list)) { + return null; + } + return list.get(0).getCode(); + } + + /** + * 查询当月车辆维保记录 + * @param month 当月 + * @return 当月车辆维保数据表 + */ + private List getHygieneByMonth(String month) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().like(CarMaintenanceEntity::getCreateTime, month) + .orderByDesc(CarMaintenanceEntity::getCode); + return this.list(queryWrapper); + } +} 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 new file mode 100644 index 0000000..64c55cd --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java @@ -0,0 +1,105 @@ +package com.hnac.hzims.safeproduct.service.impl; + +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.CarMilesYearDTO; +import com.hnac.hzims.safeproduct.entity.CarEntity; +import com.hnac.hzims.safeproduct.mapper.CarMapper; +import com.hnac.hzims.safeproduct.service.ICarService; +import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; +import org.springblade.core.mp.support.Query; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 车辆管理服务实现类 + * + * @author liwen + * @date 2024-01-03 + */ +@Service +public class CarServiceImpl extends ServiceImpl implements ICarService { + + /** + * 年度里程数页面 + */ + @Override + public IPage milesDataByYear(String year, String unit, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + IPage carPage = baseMapper.selectCarByYear(page, year, unit); + List records = carPage.getRecords(); + // 若无数据,返回空页面 + if (CollectionUtils.isEmpty(records)) { + return carPage; + } + List carList = records.stream().map(CarMilesYearVO::getPlateNumber).collect(Collectors.toList()); + List milesList = baseMapper.selectMilesByCar(carList, year); + List res = new ArrayList<>(); + milesList.forEach(data -> { + CarMilesYearVO carMilesYearVO = records.stream().filter(x -> x.getPlateNumber().equals(data.getPlateNumber())) + .collect(Collectors.toList()).get(0); + BigDecimal sum = carMilesYearVO.getSumMiles() == null ? new BigDecimal(0) : carMilesYearVO.getSumMiles(); + // 根据月份匹配写入对应字段 + switch (data.getDateTime()) { + case "01": + carMilesYearVO.setJanuaryMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "02": + carMilesYearVO.setFebruaryMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "03": + carMilesYearVO.setMarchMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "04": + carMilesYearVO.setAprilMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "05": + carMilesYearVO.setMayMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "06": + carMilesYearVO.setJuneMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "07": + carMilesYearVO.setJulyMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "08": + carMilesYearVO.setAugustMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "09": + carMilesYearVO.setSeptemberMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "10": + carMilesYearVO.setOctoberMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "11": + carMilesYearVO.setNovemberMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + break; + case "12": + carMilesYearVO.setDecemberMiles(data.getMiles()); + carMilesYearVO.setSumMiles(sum.add(data.getMiles())); + } + if (!carMilesYearVO.getSumMiles().equals(new BigDecimal(0))) { + res.add(carMilesYearVO); + } + }); + carPage.setRecords(res); + return carPage; + } +} 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 new file mode 100644 index 0000000..2b35beb --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java @@ -0,0 +1,100 @@ +package com.hnac.hzims.safeproduct.service.impl; + +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.CarUsedRecordConfirmationDTO; +import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity; +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.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 用车记录服务实现类 + * + * @author liwen + * @date 2024-01-04 + */ +@Service +public class CarUsedRecordServiceImpl extends ServiceImpl implements ICarUsedRecordService { + + /** + * 新增用车记录 + */ + @Override + public boolean saveCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity) { + // 编码生成 + // 获取当月时间(yyyymm) + String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); + // 查询是否存在同月编号 + String lastCode = getLastCode(currentMonth); + // 若不存在,新增编号 + String code = BaseUtil.getUniqueCode("WBJL", lastCode, currentMonth); + carUsedRecordEntity.setCode(code); + return false; + } + + /** + * 用车记录详情 + */ + @Override + public CarUsedRecordDetailVO getCarUsedRecord(Long id) { + return baseMapper.getCarUsedRecord(id); + } + + /** + * 用车记录页面 + */ + @Override + public IPage getCarUsedRecordPage(Map param, Query query) { + IPage page = new Page<>(query.getCurrent(), query.getSize()); + return baseMapper.getCarUsedRecordPage(page, param); + } + + /** + * 用车记录确认 + */ + @Override + public boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO) { + CarUsedRecordEntity carUsedRecord = this.getById(confirmationDTO.getCarUsedRecordId()); + carUsedRecord.setConfirmationTime(confirmationDTO.getConfirmationTime()); + return this.updateById(carUsedRecord); + } + + /** + * 查询是否存在同月编号 + * @param currentMonth 当月 + * @return 存在则返回上一编号,否则返回null + */ + private String getLastCode(String currentMonth) { + String month = currentMonth.substring(currentMonth.length() - 2); + List list = getHygieneByMonth(month); + if (CollectionUtils.isEmpty(list)) { + return null; + } + return list.get(0).getCode(); + } + + /** + * 查询当月车辆维保记录 + * @param month 当月 + * @return 当月车辆维保数据表 + */ + private List getHygieneByMonth(String month) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().like(CarUsedRecordEntity::getCreateTime, month) + .orderByDesc(CarUsedRecordEntity::getCode); + return this.list(queryWrapper); + } +}