Browse Source

add: 车辆管理模块

zhongwei
liwen 11 months ago
parent
commit
10b9b7e4d2
  1. 25
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java
  2. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMilesYearDTO.java
  3. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java
  4. 28
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java
  5. 45
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java
  6. 93
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java
  7. 63
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java
  8. 64
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java
  9. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckItemVO.java
  10. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java
  11. 61
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java
  12. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java
  13. 64
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java
  14. 62
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java
  15. 44
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java
  16. 232
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  17. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/ConferenceJob.java
  18. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/HygieneJob.java
  19. 16
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.java
  20. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml
  21. 16
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java
  22. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml
  23. 35
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.java
  24. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml
  25. 45
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.java
  26. 58
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml
  27. 35
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.java
  28. 34
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml
  29. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java
  30. 28
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java
  31. 49
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java
  32. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java
  33. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java
  34. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java
  35. 122
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  36. 107
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  37. 105
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  38. 100
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java

25
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;
}

31
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;
}

22
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;
}

28
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;
}

45
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;
}

93
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;
}

63
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;
}

64
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;
}

23
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;
}

41
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<CarCheckItemVO> checkItemList;
}

61
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;
}

41
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;
}

64
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;
}

62
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;
}

44
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;
}

232
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<CarEntity> 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<IPage<CarEntity>> carPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarEntity> 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<CarMaintenanceDetailVO> 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<IPage<CarMaintenancePageVO>> carMaintenancePage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarMaintenancePageVO> 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<CarUsedRecordDetailVO> 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<IPage<CarUsedRecordPageVO>> carUsedRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarUsedRecordPageVO> 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<IPage<CarMilesYearVO>> milesDataByYear(@RequestParam String year, String unit, Query query) {
IPage<CarMilesYearVO> 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<CarCheckRecordDetailVO> 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<IPage<CarUsedRecordPageVO>> carCheckRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarUsedRecordPageVO> page = carUsedRecordService.getCarUsedRecordPage(param, query);
return R.data(page);
}
}

4
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 {
}

4
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 {
}

16
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<CarCheckItemEntity> {
}

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckItemMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.CarCheckItemMapper">
</mapper>

16
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<CarCheckRecordEntity> {
}

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.CarCheckRecordMapper">
</mapper>

35
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<CarMaintenanceEntity> {
/**
* 查询车辆维保记录详情
* @param carMaintenanceId 车辆维保记录id
* @return 车辆维保记录详情VO类
*/
CarMaintenanceDetailVO getCarMaintenance(Long carMaintenanceId);
/**
* 车辆维保记录数据页
* @param param 入参
* @param page 分页类
* @return 分页数据
*/
IPage<CarMaintenancePageVO> getCarMaintenancePage(IPage<CarMaintenancePageVO> page, Map<String, Object> param);
}

42
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper">
<select id="getCarMaintenance" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO">
SELECT
t1.code, t1.start_time, t1.end_time, t1.location, t1.cost, t1.maintainer, t1.content, t1.img_path, t1.file_path,
t1.manager_advice, t1.confirmation_time, t2.plate_number, t2.unit, t2.car_brand, t2.car_type
FROM
hzims_car_maintenance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
is_deleted = 0
<if test="carMaintenanceId != null and carMaintenanceId != ''">
AND t1.id = #{carMaintenanceId}
</if>
</select>
<select id="getCarMaintenancePage" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO">
SELECT
t2.unit, t2.car_brand, t2.car_type, t1.id, t1.type, t1.content, t1.location, t1.cost, t1.maintainer
FROM
hzims_car_maintenance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
is_deleted = 0
<if test="param.unit != null and param.unit != ''">
AND t2.unit = #{param.unit}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND t1.start_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.end_time &lt; #{param.endTime}
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
ORDER BY
t1.create_time DESC
</select>
</mapper>

45
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<CarEntity> {
/**
* 查询当年的全部车辆
* @param page 分页类
* @param year 年份
* @param unit 单位
* @return 分页车辆数据
*/
IPage<CarMilesYearVO> selectCarByYear(IPage<CarMilesYearVO> page, String year, String unit);
/**
* 查询车辆当年的月度里程数
* @param carList 车牌列表
* @param year 年份
* @return 里程数列表
*/
List<CarMilesYearDTO> selectMilesByCar(List<String> carList, String year);
/**
* 查询车辆的里程数
* @param plateNumber 车牌号
* @return 里程数
*/
BigDecimal selectMilesByPlateNumber(String plateNumber);
}

58
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.CarMapper">
<select id="selectCarByYear" resultType="com.hnac.hzims.safeproduct.vo.CarMilesYearVO">
SELECT
t1.unit, t1.car_brand, t1.plate_number
FROM
hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id
WHERE
t1.is_deleted = 0
<if test="year != null and year != ''">
AND t2.end_time like concat('%', #{year}, '%')
</if>
<if test="unit != null and unit != ''">
AND t1.unit like concat('%', #{unit}, '%')
</if>
ORDER BY
t1.create_time DESC
</select>
<select id="selectMilesByCar" resultType="com.hnac.hzims.safeproduct.dto.CarMilesYearDTO">
SELECT
t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t1.confirmation_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
<if test="year != null and year != ''">
AND t2.confirmation_time like concat('%', #{year}, '%')
</if>
AND t2.used_status = 'CONFIRMED'
AND t1.plate_number in
<foreach collection="carList" item="car" open="(" close=")" separator=",">
#{car}
</foreach>
GROUP BY
t1.plate_number, DATE_FORMAT(t1.confirmation_time, '%m')
ORDER BY
t1.end_time DESC
</select>
<select id="selectMilesByPlateNumber" resultType="java.math.BigDecimal">
SELECT
sum(t2.miles)
FROM
hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id
WHERE
t1.is_deleted = 0
<if test="plateNumber != null and plateNumber != ''">
AND t1.plate_number = #{plateNumber}
</if>
</select>
</mapper>

35
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<CarUsedRecordEntity> {
/**
* 用车记录详情
* @param carUsedRecordId 用车记录id
* @return 用车记录详情VO类
*/
CarUsedRecordDetailVO getCarUsedRecord(Long carUsedRecordId);
/**
* 用车记录页面
* @param param 入参
* @param page 分页类
* @return 分页数据
*/
IPage<CarUsedRecordPageVO> getCarUsedRecordPage(IPage<CarUsedRecordPageVO> page, Map<String, Object> param);
}

34
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.CarUsedRecordMapper">
<select id="getCarUsedRecord" resultType="com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO">
SELECT
t1.code, t1.start_time, t1.used_location, t1.remark, t1.unit, t1.start_miles, t1.end_miles, t1.miles,
t1.img_path, t1.user, t1.end_time, t1.confirmation_time, t2.manager, t2.car_brand, t2.plate_number
FROM
hzims_car_used_record t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
t1.is_deleted = 0
<if test="carUsedRecordId != null and carUsedRecordId != ''">
AND t1.id = #{carUsedRecordId}
</if>
</select>
<select id="getCarUsedRecordPage" resultType="com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO">
SELECT
t1.unit, t1.start_time, t1.user, t1.remark, t1.start_miles, t1.end_miles, t1.miles,
t2.car_brand, t2.plate_number
FROM
hzims_car_used_record t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
t1.is_deleted = 0
<if test="param.unit != null and param.unit != ''">
AND t1.unit = #{param.unit}
</if>
ORDER BY
t1.create_time DESC
</select>
</mapper>

14
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<CarCheckItemEntity> {
}

28
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<CarCheckRecordEntity> {
/**
* 新增车检记录
* @param carCheckRecordEntity 车检记录实体类
* @return true-成功false-失败
*/
boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity);
/**
* 车检记录详情
* @param id 车检记录id
* @return 车检记录详情VO类
*/
CarCheckRecordDetailVO getCarCheckRecord(Long id);
}

49
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<CarMaintenanceEntity> {
/**
* 新增车辆维保记录
* @param carMaintenanceEntity 车辆维保记录实体类
* @return true-成功false-失败
*/
boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity);
/**
* 查询车辆维保记录详情
* @param id 车辆维保记录id
* @return 车辆维保记录详情VO类
*/
CarMaintenanceDetailVO getCarMaintenance(Long id);
/**
* 车辆维保记录数据页
* @param param 入参
* @param query 分页类
* @return 分页数据
*/
IPage<CarMaintenancePageVO> getCarMaintenancePage(Map<String, Object> param, Query query);
/**
* 车辆维保记录确认
* @param confirmationDTO 车辆维保记录确认DTO类
* @return true-成功false-失败
*/
boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO);
}

26
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<CarEntity> {
/**
* 年度里程数页面
* @param year 年份
* @param unit 单位
* @param query 分页类
* @return 分页数据
*/
IPage<CarMilesYearVO> milesDataByYear(String year, String unit, Query query);
}

50
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<CarUsedRecordEntity> {
/**
* 新增用车记录
* @param carUsedRecordEntity 用车记录实体类
* @return true-成功false-失败
*/
boolean saveCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity);
/**
* 用车记录详情
* @param id 用车记录id
* @return 用车记录详情VO类
*/
CarUsedRecordDetailVO getCarUsedRecord(Long id);
/**
* 用车记录页面
* @param param 入参
* @param query 分页类
* @return 分页数据
*/
IPage<CarUsedRecordPageVO> getCarUsedRecordPage(Map<String, Object> param, Query query);
/**
* 用车记录确认
* @param confirmationDTO 用车记录确认DTO类
* @return true-成功false-失败
*/
boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO);
}

18
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<CarCheckItemMapper, CarCheckItemEntity> implements ICarCheckItemService {
}

122
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<CarCheckRecordMapper, CarCheckRecordEntity> 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<CarCheckItemVO> 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<CarCheckRecordEntity> list = getCarCheckRecordByMonth(month);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月卫生自查记录
* @param month 当月
* @return 当月卫生自查数据表
*/
private List<CarCheckRecordEntity> getCarCheckRecordByMonth(String month) {
QueryWrapper<CarCheckRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarCheckRecordEntity::getCreateTime, month)
.orderByDesc(CarCheckRecordEntity::getCode);
return this.list(queryWrapper);
}
}

107
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<CarMaintenanceMapper, CarMaintenanceEntity> 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<CarMaintenancePageVO> getCarMaintenancePage(Map<String, Object> param, Query query) {
IPage<CarMaintenancePageVO> 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<CarMaintenanceEntity> list = getHygieneByMonth(month);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月车辆维保记录
* @param month 当月
* @return 当月车辆维保数据表
*/
private List<CarMaintenanceEntity> getHygieneByMonth(String month) {
QueryWrapper<CarMaintenanceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarMaintenanceEntity::getCreateTime, month)
.orderByDesc(CarMaintenanceEntity::getCode);
return this.list(queryWrapper);
}
}

105
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<CarMapper, CarEntity> implements ICarService {
/**
* 年度里程数页面
*/
@Override
public IPage<CarMilesYearVO> milesDataByYear(String year, String unit, Query query) {
IPage<CarMilesYearVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<CarMilesYearVO> carPage = baseMapper.selectCarByYear(page, year, unit);
List<CarMilesYearVO> records = carPage.getRecords();
// 若无数据,返回空页面
if (CollectionUtils.isEmpty(records)) {
return carPage;
}
List<String> carList = records.stream().map(CarMilesYearVO::getPlateNumber).collect(Collectors.toList());
List<CarMilesYearDTO> milesList = baseMapper.selectMilesByCar(carList, year);
List<CarMilesYearVO> 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;
}
}

100
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<CarUsedRecordMapper, CarUsedRecordEntity> 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<CarUsedRecordPageVO> getCarUsedRecordPage(Map<String, Object> param, Query query) {
IPage<CarUsedRecordPageVO> 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<CarUsedRecordEntity> list = getHygieneByMonth(month);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月车辆维保记录
* @param month 当月
* @return 当月车辆维保数据表
*/
private List<CarUsedRecordEntity> getHygieneByMonth(String month) {
QueryWrapper<CarUsedRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarUsedRecordEntity::getCreateTime, month)
.orderByDesc(CarUsedRecordEntity::getCode);
return this.list(queryWrapper);
}
}
Loading…
Cancel
Save