Browse Source

update: 车辆管理模块

zhongwei
liwen 11 months ago
parent
commit
8c427a835a
  1. 46
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckRecordDTO.java
  2. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java
  3. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java
  4. 11
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java
  5. 14
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java
  6. 16
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java
  7. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java
  8. 16
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java
  9. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarInsuranceStatusEnum.java
  10. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarMaintenanceStatusEnum.java
  11. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarUsedRecordEnum.java
  12. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java
  13. 37
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordPageVO.java
  14. 10
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java
  15. 9
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java
  16. 4
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java
  17. BIN
      hzims-service/safeproduct/lib/aspose-words-15.8.0-jdk16.jar
  18. 8
      hzims-service/safeproduct/pom.xml
  19. 65
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  20. 41
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java
  21. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.java
  22. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml
  23. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml
  24. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMapper.xml
  25. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml
  26. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java
  27. 39
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java
  28. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java
  29. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java
  30. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java
  31. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java
  32. 41
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java
  33. 106
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  34. 118
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  35. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  36. 50
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java
  37. 73
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

46
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarCheckRecordDTO.java

@ -0,0 +1,46 @@
package com.hnac.hzims.safeproduct.dto;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-09
*/
@Data
@ApiModel(value = "车检记录DTO类")
public class CarCheckRecordDTO {
@ApiModelProperty("车检记录id")
private Long id;
@ApiModelProperty("车辆id")
private Long carId;
@NotNull
@Size(max = 50, message = "检查人长度不能超过50")
@ApiModelProperty("检查人")
private String checker;
@NotNull
@ApiModelProperty("检查时间")
private Date checkTime;
@NotNull
@ApiModelProperty("检查结论")
private String conclusion;
@Size(max = 500, message = "填报备注长度不能超过50")
@ApiModelProperty("填报备注")
private String remark;
@ApiModelProperty("检查项列表")
List<CarCheckItemEntity> itemList;
}

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarMaintenanceConfirmationDTO.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -14,12 +16,19 @@ import java.util.Date;
@ApiModel(value = "车辆维保记录确认DTO类")
public class CarMaintenanceConfirmationDTO {
@NotNull
@ApiModelProperty("车辆维保记录id")
private Long carMaintenanceId;
@NotNull
@ApiModelProperty("车辆管理人意见")
private String managerAdvice;
@ApiModelProperty("确认时间")
private Date confirmationTime;
@NotNull
@ApiModelProperty("下次维保时间")
private Date maintenanceNextTime;
@NotNull
@ApiModelProperty("维保里程")
private BigDecimal maintenanceMileage;
}

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/CarUsedRecordConfirmationDTO.java

@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import javax.validation.constraints.NotNull;
/**
* @author liwen
@ -14,9 +14,7 @@ import java.util.Date;
@ApiModel(value = "用车记录确认DTO类")
public class CarUsedRecordConfirmationDTO {
@NotNull
@ApiModelProperty("用车记录id")
private Long carUsedRecordId;
@ApiModelProperty("确认时间")
private Date confirmationTime;
}

11
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckItemEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -7,6 +8,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* @author liwen
* @date 2024-01-05
@ -20,9 +24,16 @@ public class CarCheckItemEntity extends BaseEntity {
@ApiModelProperty("车检记录id")
private Long carCheckRecordId;
@NotNull
@Size(max = 500, message = "检查项目长度不能超过50")
@ApiModelProperty("检查项目")
private String checkItem;
@NotNull
@ApiModelProperty("检查内容")
private String checkContent;
@NotNull
@ApiModelProperty("检查结果")
private String checkResult;
}

14
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarCheckRecordEntity.java

@ -7,6 +7,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
@ -22,24 +24,24 @@ public class CarCheckRecordEntity extends BaseEntity {
@ApiModelProperty("车辆id")
private Long carId;
@Size(max = 50, message = "编码长度不能超过50")
@ApiModelProperty("编码")
private String code;
@NotNull
@Size(max = 50, message = "检查人长度不能超过50")
@ApiModelProperty("检查人")
private String checker;
@NotNull
@ApiModelProperty("检查时间")
private Date checkTime;
@ApiModelProperty("检查项id")
private String checkItemIds;
@ApiModelProperty("检查项结果")
private String checkItemResults;
@NotNull
@ApiModelProperty("检查结论")
private String conclusion;
@Size(max = 500, message = "填报备注长度不能超过50")
@ApiModelProperty("填报备注")
private String remark;
}

16
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -43,51 +44,60 @@ public class CarEntity extends BaseEntity {
private String plateNumber;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("上牌时间")
private Date registrationTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("上期缴车保时间")
private Date insurancePayLastTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("下期缴车保时间")
private Date insurancePayNextTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("年检时间")
private Date annualInspectionTime;
@NotNull
@Size(max = 50, message = "年检状态长度不能超过50")
@ApiModelProperty("年检状态")
private String annualInspectionStatus;
@NotNull
@Size(max = 50, message = "保险状态长度不能超过50")
@ApiModelProperty("保险状态")
private String insuranceStatus;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("上期保养时间")
private Date maintenanceLastTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("下期保养时间")
private Date maintenanceNextTime;
@ApiModelProperty("保养里程")
private BigDecimal maintenanceMileage;
@NotNull
@Size(max = 50, message = "保养状态长度不能超过50")
@ApiModelProperty("保养状态")
private String maintenanceStatus;
@NotNull
@Size(max = 50, message = "车辆管理人长度不能超过50")
@ApiModelProperty("车辆管理人")
private String manager;
@Size(max = 1000, message = "车辆照片长度不能超过1000")
@ApiModelProperty("车辆照片")
private String imgPath;
@Size(max = 1000, message = "车辆附件长度不能超过1000")
@ApiModelProperty("车辆附件")
private String filePath;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java

@ -1,12 +1,15 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
@ -22,42 +25,60 @@ public class CarMaintenanceEntity extends BaseEntity {
@ApiModelProperty("车辆id")
private Long carId;
@Size(max = 50, message = "编码长度不能超过50")
@ApiModelProperty("编码")
private String code;
@NotNull
@Size(max = 50, message = "维保类型长度不能超过50")
@ApiModelProperty("维保类型")
private String maintenanceType;
@NotNull
@ApiModelProperty("维保内容")
private String content;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("维保开始时间")
private Date startTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("维保结束时间")
private Date endTime;
@NotNull
@Size(max = 255, message = "维保地点长度不能超过255")
@ApiModelProperty("维保地点")
private String location;
@NotNull
@ApiModelProperty("维保费用")
private Long cost;
@NotNull
@Size(max = 20, message = "维保人长度不能超过20")
@ApiModelProperty("维保人")
private String maintainer;
@Size(max = 1000, message = "维保照片长度不能超过1000")
@ApiModelProperty("维保照片")
private String imgPath;
@Size(max = 1000, message = "维保附件长度不能超过1000")
@ApiModelProperty("维保附件")
private String filePath;
@Size(max = 500, message = "车辆管理人意见长度不能超过500")
@ApiModelProperty("车辆管理人意见")
private String managerAdvice;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("确认时间")
private Date confirmationTime;
@Size(max = 50, message = "维保状态长度不能超过50")
@ApiModelProperty("维保状态")
private String maintenanceStatus;
}

16
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarUsedRecordEntity.java

@ -7,6 +7,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Date;
@ -23,33 +25,44 @@ public class CarUsedRecordEntity extends BaseEntity {
@ApiModelProperty("车辆id")
private Long carId;
@Size(max = 50, message = "编码长度不能超过50")
@ApiModelProperty("编码")
private String code;
@NotNull
@Size(max = 50, message = "用车单位长度不能超过50")
@ApiModelProperty("用车单位")
private String unit;
@NotNull
@ApiModelProperty("使用时间")
private Date startTime;
@NotNull
@Size(max = 255, message = "使用地点长度不能超过255")
@ApiModelProperty("使用地点")
private String usedLocation;
@NotNull
@Size(max = 20, message = "使用人长度不能超过20")
@ApiModelProperty("使用人")
private String user;
@ApiModelProperty("用途详情")
private String remark;
@NotNull
@ApiModelProperty("出车公里数")
private BigDecimal startMiles;
@ApiModelProperty("收车公里数")
private BigDecimal endMiles;
@NotNull
@ApiModelProperty("行驶公里数")
private BigDecimal miles;
@NotNull
@ApiModelProperty("收车时间")
private Date endTime;
@ -59,6 +72,7 @@ public class CarUsedRecordEntity extends BaseEntity {
@ApiModelProperty("用车状态")
private String usedStatus;
@ApiModelProperty("图片路径")
@Size(max = 1000, message = "用车图片长度不能超过1000")
@ApiModelProperty("用车图片")
private String imgPath;
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarInsuranceStatusEnum.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 车辆保险记录状态枚举类
*
* @author liwen
* @date 2024-01-11
*/
public enum CarInsuranceStatusEnum {
INSURED("INSURED", "已参保"),
UNINSURED("UNINSURED", "未参保");
private final String value;
private final String desc;
CarInsuranceStatusEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarMaintenanceStatusEnum.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 车辆维保记录状态枚举类
*
* @author liwen
* @date 2024-01-10
*/
public enum CarMaintenanceStatusEnum {
MAINTAINED("MAINTAINED", "已维保"),
UNMAINTAINED("UNMAINTAINED", "未维保");
private final String value;
private final String desc;
CarMaintenanceStatusEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarUsedRecordEnum.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 用车记录枚举类
*
* @author liwen
* @date 2024-01-10
*/
public enum CarUsedRecordEnum {
USING("USING", "使用中"),
USED("USED", "已使用");
private final String value;
private final String desc;
CarUsedRecordEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.vo;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -37,5 +38,5 @@ public class CarCheckRecordDetailVO {
private String remark;
@ApiModelProperty("检查列表")
private List<CarCheckItemVO> checkItemList;
private List<CarCheckItemEntity> checkItemList;
}

37
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordPageVO.java

@ -0,0 +1,37 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-09
*/
@Data
@ApiModel(value = "车检记录页面VO类")
public class CarCheckRecordPageVO {
@ApiModelProperty("车检记录id")
private Long id;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("品牌")
private String carBrand;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("检查人")
private String checker;
@ApiModelProperty("检查时间")
private Date checkTime;
@ApiModelProperty("检查结论")
private String conclusion;
}

10
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-04
@ -24,8 +26,11 @@ public class CarMaintenancePageVO {
@ApiModelProperty("型号")
private String carType;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("维保类型")
private String type;
private String maintenanceType;
@ApiModelProperty("维保内容")
private String content;
@ -38,4 +43,7 @@ public class CarMaintenancePageVO {
@ApiModelProperty("维保人")
private String maintainer;
@ApiModelProperty("确认时间")
private Date confirmationTime;
}

9
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java

@ -15,6 +15,9 @@ import java.util.Date;
@ApiModel(value = "用车记录页面VO类")
public class CarUsedRecordPageVO {
@ApiModelProperty("用车记录id")
private Long id;
@ApiModelProperty("用车单位")
private String unit;
@ -24,6 +27,9 @@ public class CarUsedRecordPageVO {
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("使用地点")
private String usedLocation;
@ApiModelProperty("使用时间")
private Date startTime;
@ -41,4 +47,7 @@ public class CarUsedRecordPageVO {
@ApiModelProperty("行驶公里数")
private BigDecimal miles;
@ApiModelProperty("确认时间")
private Date confirmationTime;
}

4
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/repair/fegin/IRepairClient.java

@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author ysj
*/
@FeignClient(
value = TicketConstants.APP_NAME,
fallback = RepairClientFallback.class
value = TicketConstants.APP_NAME
// fallback = RepairClientFallback.class
)
public interface IRepairClient {

BIN
hzims-service/safeproduct/lib/aspose-words-15.8.0-jdk16.jar

Binary file not shown.

8
hzims-service/safeproduct/pom.xml

@ -132,6 +132,14 @@
<groupId>com.hnac.hzims</groupId>
<artifactId>ticket-api</artifactId>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency>
</dependencies>
<build>

65
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java

@ -3,9 +3,9 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO;
import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO;
import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity;
import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity;
@ -25,6 +25,7 @@ import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
@ -84,7 +85,8 @@ public class CarController extends BladeController {
@ApiOperation(value = "车辆分页")
@ApiOperationSupport(order = 5)
public R<IPage<CarEntity>> carPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarEntity> page = carService.page(Condition.getPage(query), Condition.getQueryWrapper(param, CarEntity.class));
IPage<CarEntity> page = carService.page(Condition.getPage(query), Condition.getQueryWrapper(param, CarEntity.class)
.lambda().orderByDesc(CarEntity::getCreateTime));
return R.data(page);
}
@ -133,8 +135,8 @@ public class CarController extends BladeController {
@PostMapping("/confirmCarMaintenance")
@ApiOperation(value = "车辆维保记录确认")
@ApiOperationSupport(order = 11)
public R confirmCarMaintenance(@RequestBody CarMaintenanceConfirmationDTO confirmationDTO) {
return R.status(carMaintenanceService.confirmCarMaintenance(confirmationDTO));
public R confirmCarMaintenance(@Valid @RequestBody CarMaintenanceConfirmationDTO confirmationDTO) {
return carMaintenanceService.confirmCarMaintenance(confirmationDTO);
}
@PostMapping("/saveCarUsedRecord")
@ -148,7 +150,7 @@ public class CarController extends BladeController {
@ApiOperation(value = "修改用车记录")
@ApiOperationSupport(order = 13)
public R updateCarUsedRecord(@Valid @RequestBody CarUsedRecordEntity carUsedRecordEntity) {
return R.status(carUsedRecordService.updateById(carUsedRecordEntity));
return R.status(carUsedRecordService.updateCarUsedRecord(carUsedRecordEntity));
}
@PostMapping("/removeCarUsedRecord")
@ -167,9 +169,10 @@ public class CarController extends BladeController {
@GetMapping("/carUsedRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车辆维保记录分页")
@ApiOperation(value = "车记录分页")
@ApiOperationSupport(order = 16)
public R<IPage<CarUsedRecordPageVO>> carUsedRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarUsedRecordPageVO> page = carUsedRecordService.getCarUsedRecordPage(param, query);
@ -179,8 +182,8 @@ public class CarController extends BladeController {
@PostMapping("/confirmCarUsedRecord")
@ApiOperation(value = "用车记录确认")
@ApiOperationSupport(order = 17)
public R confirmCarUsedRecord(@RequestBody CarUsedRecordConfirmationDTO confirmationDTO) {
return R.status(carUsedRecordService.confirmCarUsedRecord(confirmationDTO));
public R confirmCarUsedRecord(@Valid @RequestBody CarUsedRecordConfirmationDTO confirmationDTO) {
return carUsedRecordService.confirmCarUsedRecord(confirmationDTO);
}
@GetMapping("/milesDataByYear")
@ -194,39 +197,61 @@ public class CarController extends BladeController {
@PostMapping("/saveCarCheckRecord")
@ApiOperation(value = "新增车检记录")
@ApiOperationSupport(order = 19)
public R saveCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) {
return R.status(carCheckRecordService.saveCarCheckRecord(carCheckRecordEntity));
public R saveCarCheckRecord(@Valid @RequestBody CarCheckRecordDTO carCheckRecordDTO) {
return R.status(carCheckRecordService.saveCarCheckRecord(carCheckRecordDTO));
}
@PostMapping("/updateCarCheckRecord")
@ApiOperation(value = "修改车检记录")
@ApiOperationSupport(order = 20)
public R updateCarCheckRecord(@Valid @RequestBody CarCheckRecordEntity carCheckRecordEntity) {
return R.status(carCheckRecordService.updateById(carCheckRecordEntity));
public R updateCarCheckRecord(@Valid @RequestBody CarCheckRecordDTO carCheckRecordDTO) {
return R.status(carCheckRecordService.updateCarCheckRecord(carCheckRecordDTO));
}
@PostMapping("/removeCarCheckRecord")
@ApiOperation(value = "删除车检记录")
@ApiOperationSupport(order = 21)
public R removeCarCheckRecord(@RequestParam Long id) {
return R.status(carCheckRecordService.removeById(id));
return R.status(carCheckRecordService.removeCarCheckRecord(id));
}
@GetMapping("/carCheckRecordDetail")
@ApiOperation(value = "车检记录详情")
@ApiOperationSupport(order = 15)
@ApiOperationSupport(order = 22)
public R<CarCheckRecordDetailVO> carCheckRecordDetail(@RequestParam Long id) {
return R.data(carCheckRecordService.getCarCheckRecord(id));
}
@GetMapping("/carCheckRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车辆维保记录分页")
@ApiOperationSupport(order = 16)
public R<IPage<CarUsedRecordPageVO>> carCheckRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarUsedRecordPageVO> page = carUsedRecordService.getCarUsedRecordPage(param, query);
@ApiOperation(value = "车记录分页")
@ApiOperationSupport(order = 23)
public R<IPage<CarCheckRecordPageVO>> carCheckRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarCheckRecordPageVO> page = carCheckRecordService.getCarCheckRecordPage(param, query);
return R.data(page);
}
@GetMapping("/exportCarMaintenanceData")
@ApiOperation(value = "导出车辆维保记录单")
@ApiOperationSupport(order = 24)
public void exportCarMaintenanceData(@RequestParam Long id, HttpServletResponse response) {
carMaintenanceService.exportCarMaintenanceData(id, response);
}
@GetMapping("/exportCarUsedRecordData")
@ApiOperation(value = "导出用车记录单")
@ApiOperationSupport(order = 25)
public void exportCarUsedRecordData() {
}
@GetMapping("/exportCarCheckRecordData")
@ApiOperation(value = "导出车检记录单")
@ApiOperationSupport(order = 26)
public void exportCarCheckRecordData() {
}
}

41
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.jobs;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.service.ICarService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
* 车辆模块定时任务
*
* @author liwen
* @date 2024-01-11
*/
@Component
public class CarJob {
@Autowired
ICarService carService;
/**
* 车辆台账自动变更
*/
@XxlJob("autoChangeCarStatus")
public ReturnT<String> autoChangeCarStatus(String param) {
// 获取时间范围
Date current = DateUtil.now();
Date before = DateUtil.minusDays(current, 1);
String today = DateUtil.format(current, "yyyy-mm-dd");
String yesterday = DateUtil.format(before, "yyyy-mm-dd");
List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday);
// uninsuredCarList.forEach(car -> car.setInsuranceStatus());
// List<CarEntity> carListByMaintenanceTime = carService.getCarListByMaintenanceTime(today, yesterday);
return ReturnT.SUCCESS;
}
}

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

@ -1,9 +1,13 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity;
import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/**
* 车检记录Mapper类
*
@ -13,4 +17,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CarCheckRecordMapper extends BaseMapper<CarCheckRecordEntity> {
/**
* 车检记录分页
* @param param 入参
* @param page 分页类
* @return 分页数据
*/
IPage<CarCheckRecordPageVO> getCarCheckRecordPage(IPage<CarCheckRecordPageVO> page, Map<String, Object> param);
}

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

@ -2,4 +2,21 @@
<!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">
<select id="getCarCheckRecordPage" resultType="com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO">
SELECT
t1.id, t2.unit, t2.car_brand, t2.plate_number, t1.checker, t1.check_time, t1.conclusion
FROM
hzims_car_check_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 t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
ORDER BY
t1.create_time DESC
</select>
</mapper>

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

@ -10,7 +10,7 @@
hzims_car_maintenance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
is_deleted = 0
t1.is_deleted = 0
<if test="carMaintenanceId != null and carMaintenanceId != ''">
AND t1.id = #{carMaintenanceId}
</if>
@ -18,12 +18,13 @@
<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
t2.unit, t2.car_brand, t2.car_type, t2.plate_number, t1.id, t1.maintenance_type, t1.content, t1.location,
t1.cost, t1.maintainer, t1.confirmation_time
FROM
hzims_car_maintenance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
is_deleted = 0
t1.is_deleted = 0
<if test="param.unit != null and param.unit != ''">
AND t2.unit = #{param.unit}
</if>

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

@ -22,24 +22,24 @@
<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
t1.unit, t1.car_brand, t1.plate_number, DATE_FORMAT(t2.end_time, '%m') as dateTime, sum(t2.miles) as miles
FROM
hzims_car t1
LEFT JOIN hzims_car_used_record t2 ON t1.id = t2.car_id
WHERE
t1.is_deleted = 0
<if test="year != null and year != ''">
AND t2.confirmation_time like concat('%', #{year}, '%')
AND t2.end_time like concat('%', #{year}, '%')
</if>
AND t2.used_status = 'CONFIRMED'
AND t2.used_status = 'USED'
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')
t1.plate_number, DATE_FORMAT(t2.end_time, '%m')
ORDER BY
t1.end_time DESC
t1.create_time DESC
</select>
<select id="selectMilesByPlateNumber" resultType="java.math.BigDecimal">

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

@ -18,8 +18,8 @@
<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
t1.id, t1.unit, t1.start_time, t1.user, t1.remark, t1.start_miles, t1.end_miles, t1.miles,
t2.car_brand, t2.plate_number, t1.used_location, t1.confirmation_time, t1.used_location
FROM
hzims_car_used_record t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
@ -28,6 +28,9 @@
<if test="param.unit != null and param.unit != ''">
AND t1.unit = #{param.unit}
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
ORDER BY
t1.create_time DESC
</select>

22
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckItemService.java

@ -3,6 +3,8 @@ package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
import java.util.List;
/**
* 车检项服务类
*
@ -11,4 +13,24 @@ import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
*/
public interface ICarCheckItemService extends IService<CarCheckItemEntity> {
/**
* 根据检查项获取数据
* @param checkContent 检查内容
* @return 检查项数据
*/
CarCheckItemEntity getDetailByCheckContent(String checkContent);
/**
* 删除关联检查项数据
* @param carCheckRecordId 车检记录id
* @return true-成功false-失败
*/
boolean removeRelativeCarCheckItem(Long carCheckRecordId);
/**
* 根据车检记录id查询检查项数据
* @param carCheckRecordId 车检记录id
* @return 检查项数据
*/
List<CarCheckItemEntity> getListByCarCheckRecordId(Long carCheckRecordId);
}

39
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarCheckRecordService.java

@ -1,8 +1,14 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO;
import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity;
import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO;
import org.springblade.core.mp.support.Query;
import java.util.Map;
/**
* 车检记录服务类
@ -14,10 +20,10 @@ public interface ICarCheckRecordService extends IService<CarCheckRecordEntity> {
/**
* 新增车检记录
* @param carCheckRecordEntity 车检记录实体
* @param carCheckRecordDTO 车检记录DTO
* @return true-成功false-失败
*/
boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity);
boolean saveCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO);
/**
* 车检记录详情
@ -25,4 +31,33 @@ public interface ICarCheckRecordService extends IService<CarCheckRecordEntity> {
* @return 车检记录详情VO类
*/
CarCheckRecordDetailVO getCarCheckRecord(Long id);
/**
* 车检记录分页
* @param param 入参
* @param query 分页类
* @return 分页数据
*/
IPage<CarCheckRecordPageVO> getCarCheckRecordPage(Map<String, Object> param, Query query);
/**
* 根据编码查询车检记录
* @param code 编码
* @return 车检记录实体类
*/
CarCheckRecordEntity getCarCheckRecordByCode(String code);
/**
* 修改车检记录
* @param carCheckRecordDTO 车检记录DTO类
* @return true-成功false-失败
*/
boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO);
/**
* 删除车检记录
* @param id 车检记录id
* @return true-成功false-失败
*/
boolean removeCarCheckRecord(Long id);
}

13
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java

@ -7,7 +7,9 @@ import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity;
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO;
import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@ -43,7 +45,14 @@ public interface ICarMaintenanceService extends IService<CarMaintenanceEntity> {
/**
* 车辆维保记录确认
* @param confirmationDTO 车辆维保记录确认DTO类
* @return true-成功false-失败
* @return 封装结果类
*/
R confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO);
/**
* 导出车辆维保记录单
* @param id 车辆维保记录id
* @param response 响应类
*/
boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO);
void exportCarMaintenanceData(Long id, HttpServletResponse response);
}

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java

@ -1,12 +1,13 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.vo.CarMilesYearVO;
import org.springblade.core.mp.support.Query;
import java.util.List;
/**
* 车辆管理服务类
*
@ -23,4 +24,12 @@ public interface ICarService extends IService<CarEntity> {
* @return 分页数据
*/
IPage<CarMilesYearVO> milesDataByYear(String year, String unit, Query query);
/**
* 根据参保时间查询车辆列表
* @param today 当天
* @param yesterday 昨天
* @return 车辆列表数据
*/
List<CarEntity> getCarListByInsuranceTime(String today, String yesterday);
}

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java

@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity;
import com.hnac.hzims.safeproduct.vo.CarMilesYearVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.Map;
@ -44,7 +44,14 @@ public interface ICarUsedRecordService extends IService<CarUsedRecordEntity> {
/**
* 用车记录确认
* @param confirmationDTO 用车记录确认DTO类
* @return 封装结果类
*/
R confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO);
/**
* 更新用车记录
* @param carUsedRecordEntity 用车记录实体类
* @return true-成功false-失败
*/
boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO);
boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity);
}

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java

@ -66,11 +66,11 @@ public interface IHygienePlanService extends IService<HygienePlanEntity> {
HygienePlanDetailVO getPlan(Long id);
/**
* 根据编码查询卫生自查计划
* @param code 编码
* 根据名称查询卫生自查计划
* @param name 名称
* @return 卫生自查计划实体类
*/
HygienePlanEntity getPlanByCode(String code);
HygienePlanEntity getPlanByName(String name);
/**
* 月度数据导出

41
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckItemServiceImpl.java

@ -1,11 +1,16 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
import com.hnac.hzims.safeproduct.mapper.CarCheckItemMapper;
import com.hnac.hzims.safeproduct.service.ICarCheckItemService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 车检项服务实现类
*
@ -15,4 +20,40 @@ import org.springframework.stereotype.Service;
@Service
public class CarCheckItemServiceImpl extends ServiceImpl<CarCheckItemMapper, CarCheckItemEntity> implements ICarCheckItemService {
/**
* 根据检查项获取数据
*/
@Override
public CarCheckItemEntity getDetailByCheckContent(String checkContent) {
QueryWrapper<CarCheckItemEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CarCheckItemEntity::getCheckContent, checkContent);
return this.getOne(queryWrapper);
}
/**
* 删除关联检查项数据
*/
@Override
public boolean removeRelativeCarCheckItem(Long carCheckRecordId) {
QueryWrapper<CarCheckItemEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CarCheckItemEntity::getCarCheckRecordId, carCheckRecordId);
List<CarCheckItemEntity> list = this.list(queryWrapper);
// 若无相关检查项,返回true
if (CollectionUtils.isEmpty(list)) {
return true;
}
List<Long> ids = list.stream().map(CarCheckItemEntity::getId).collect(Collectors.toList());
return this.removeByIds(ids);
}
/**
* 根据车检记录id查询检查项数据
*/
@Override
public List<CarCheckItemEntity> getListByCarCheckRecordId(Long carCheckRecordId) {
QueryWrapper<CarCheckItemEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CarCheckItemEntity::getCarCheckRecordId, carCheckRecordId)
.orderByDesc(CarCheckItemEntity::getCheckItem);
return this.list(queryWrapper);
}
}

106
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java

@ -1,10 +1,12 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
import com.hnac.hzims.safeproduct.entity.CarCheckRecordEntity;
import com.hnac.hzims.safeproduct.entity.CarEntity;
@ -15,14 +17,19 @@ import com.hnac.hzims.safeproduct.service.ICarCheckRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarCheckItemVO;
import com.hnac.hzims.safeproduct.vo.CarCheckRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarCheckRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 车检记录服务实现类
@ -42,16 +49,28 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
/**
* 新增车检记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveCarCheckRecord(CarCheckRecordEntity carCheckRecordEntity) {
// 编码生成
// 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
public boolean saveCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) {
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity();
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity);
// 编码
// 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
String code = BaseUtil.getUniqueCode("CLJC", lastCode, currentMonth);
String lastCode = getLastCode(currentNormMonth);
String code = BaseUtil.getUniqueCode("CLJC", lastCode, currentSimpleMonth);
carCheckRecordEntity.setCode(code);
return this.save(carCheckRecordEntity);
// 若新增车检记录成功,新增相关检查项数据
boolean saveRecord = this.save(carCheckRecordEntity);
if (saveRecord) {
CarCheckRecordEntity recordEntity = getCarCheckRecordByCode(code);
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
itemList.forEach(x -> x.setCarCheckRecordId(recordEntity.getId()));
return carCheckItemService.saveBatch(itemList);
}
return false;
}
/**
@ -77,31 +96,29 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
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);
List<CarCheckItemEntity> itemList = carCheckItemService.getListByCarCheckRecordId(id);
carCheckRecordDetailVO.setCheckItemList(itemList);
return carCheckRecordDetailVO;
}
return null;
}
/**
* 车检记录分页
*/
@Override
public IPage<CarCheckRecordPageVO> getCarCheckRecordPage(Map<String, Object> param, Query query) {
IPage<CarCheckRecordPageVO> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.getCarCheckRecordPage(page, param);
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
String month = currentMonth.substring(currentMonth.length() - 2);
List<CarCheckRecordEntity> list = getCarCheckRecordByMonth(month);
List<CarCheckRecordEntity> list = getCarCheckRecordByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
return null;
}
@ -109,9 +126,9 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
}
/**
* 查询当月卫生自查记录
* 查询当月车检记录
* @param month 当月
* @return 当月卫生自查数据表
* @return 当月车检记录数据表
*/
private List<CarCheckRecordEntity> getCarCheckRecordByMonth(String month) {
QueryWrapper<CarCheckRecordEntity> queryWrapper = new QueryWrapper<>();
@ -119,4 +136,45 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
.orderByDesc(CarCheckRecordEntity::getCode);
return this.list(queryWrapper);
}
/**
* 根据编码查询车检记录
*/
@Override
public CarCheckRecordEntity getCarCheckRecordByCode(String code) {
QueryWrapper<CarCheckRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CarCheckRecordEntity::getCode, code);
return this.getOne(queryWrapper);
}
/**
* 修改车检记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateCarCheckRecord(CarCheckRecordDTO carCheckRecordDTO) {
// 更新检查项
List<CarCheckItemEntity> itemList = carCheckRecordDTO.getItemList();
boolean updateItem = carCheckItemService.updateBatchById(itemList);
// 若更新检查项成功,则更新车检记录
if (updateItem) {
CarCheckRecordEntity carCheckRecordEntity = new CarCheckRecordEntity();
BeanUtil.copyProperties(carCheckRecordDTO, carCheckRecordEntity);
return this.updateById(carCheckRecordEntity);
}
return false;
}
/**
* 删除车检记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean removeCarCheckRecord(Long id) {
boolean remove = this.removeById(id);
if (remove) {
return carCheckItemService.removeRelativeCarCheckItem(id);
}
return false;
}
}

118
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java

@ -1,24 +1,41 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity;
import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum;
import com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper;
import com.hnac.hzims.safeproduct.mapper.CarMapper;
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
import com.hnac.hzims.safeproduct.service.ICarService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO;
import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO;
import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -32,8 +49,8 @@ import java.util.Map;
@Service
public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper, CarMaintenanceEntity> implements ICarMaintenanceService {
@Resource
CarMapper carMapper;
@Autowired
ICarService carService;
/**
* 新增车辆维保记录
@ -41,12 +58,13 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
@Override
public boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) {
// 编码生成
// 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
String lastCode = getLastCode(currentNormMonth);
// 若不存在,新增编号
String code = BaseUtil.getUniqueCode("YCJL", lastCode, currentMonth);
String code = BaseUtil.getUniqueCode("WBJL", lastCode, currentSimpleMonth);
carMaintenanceEntity.setCode(code);
return this.save(carMaintenanceEntity);
}
@ -71,12 +89,87 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
/**
* 车辆维保记录确认
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO) {
public R confirmCarMaintenance(CarMaintenanceConfirmationDTO confirmationDTO) {
CarMaintenanceEntity carMaintenanceEntity = this.getById(confirmationDTO.getCarMaintenanceId());
// 判断是否已确认
Date confirmationTime = carMaintenanceEntity.getConfirmationTime();
if (confirmationTime != null) {
return R.fail("该维保记录已被确认");
}
carMaintenanceEntity.setManagerAdvice(confirmationDTO.getManagerAdvice());
carMaintenanceEntity.setConfirmationTime(DateUtil.now());
return this.updateById(carMaintenanceEntity);
boolean update = this.updateById(carMaintenanceEntity);
// 若确认成功,更新台账相关信息
if (update) {
CarEntity carEntity = carService.getById(carMaintenanceEntity.getCarId());
carEntity.setMaintenanceLastTime(carMaintenanceEntity.getConfirmationTime());
carEntity.setMaintenanceNextTime(confirmationDTO.getMaintenanceNextTime());
carEntity.setMaintenanceMileage(confirmationDTO.getMaintenanceMileage());
carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.MAINTAINED.getValue());
return R.status(carService.updateById(carEntity));
}
return R.fail("操作失败");
}
/**
* 导出车辆维保记录单
*/
@Override
public void exportCarMaintenanceData(Long id, HttpServletResponse response) {
CarMaintenanceEntity carMaintenanceEntity = this.getById(id);
Map<String, Object> params = BaseUtil.convertObjectToMap(carMaintenanceEntity);
// String templateFile = ""
try {
List<XWPFDocument> res = new ArrayList<>();
XWPFDocument document = BaseUtil.fillDocument("template/", params);
res.add(document);
BaseUtil.exportWord(res, "");
} catch (Exception e) {
throw new RuntimeException(e);
}
// String pdfPath = this.getFileSavePath() + params.get("code") + "_" + params.get("addressEquName") +".pdf";
// AsposeUtil.wordToPdf(wordPath, pdfPath);
// PdfUtils.readPdf(response,pdfPath);
// ServletOutputStream outputStream = null;
// try {
// outputStream = response.getOutputStream();
// CarMaintenanceDetailVO carMaintenance = getCarMaintenance(id);
// // 设置响应头
// // URLEncoder.encode防止中文乱码
// String fileName = URLEncoder.encode("车辆维保记录单", "UTF-8");
// response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
// response.setContentType("application/vnd.ms-excel");
// response.setCharacterEncoding("UTF-8");
// List<CarMaintenanceDetailVO> dataList = new ArrayList<>();
// dataList.add(carMaintenance);
// String templatePath = "template/车辆维保记录单.xlsx";
// Resource resource = new ClassPathResource(templatePath);
// // ExcelWriter初始化
// ExcelWriter excelWriter = EasyExcel
// .write(response.getOutputStream(), CarMaintenanceDetailVO.class)
// .autoCloseStream(Boolean.TRUE)
// .withTemplate(resource.getInputStream())
// .build();
// WriteSheet writeSheet = EasyExcel.writerSheet(1, "车辆维保记录单").build();
// excelWriter.write(dataList, writeSheet);
// excelWriter.finish();
// } catch (Exception e) {
// // 重置response
// response.reset();
// response.setContentType("application/json");
// response.setCharacterEncoding("utf-8");
// throw new ServiceException("车辆维保记录单导出异常: " + e.getMessage());
// } finally {
// if (outputStream != null) {
// try {
// outputStream.close();
// } catch (IOException e) {
// log.error("车辆维保记录单导出响应头输出流关闭异常: " + e.getMessage());
// }
// }
// }
}
/**
@ -85,8 +178,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
String month = currentMonth.substring(currentMonth.length() - 2);
List<CarMaintenanceEntity> list = getHygieneByMonth(month);
List<CarMaintenanceEntity> list = getCarMaintenanceByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
return null;
}
@ -98,7 +190,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
* @param month 当月
* @return 当月车辆维保数据表
*/
private List<CarMaintenanceEntity> getHygieneByMonth(String month) {
private List<CarMaintenanceEntity> getCarMaintenanceByMonth(String month) {
QueryWrapper<CarMaintenanceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarMaintenanceEntity::getCreateTime, month)
.orderByDesc(CarMaintenanceEntity::getCode);

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -102,4 +103,15 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
carPage.setRecords(res);
return carPage;
}
/**
* 根据参保时间查询车辆列表
*/
@Override
public List<CarEntity> getCarListByInsuranceTime(String today, String yesterday) {
QueryWrapper<CarEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().le(CarEntity::getInsurancePayLastTime, today)
.ge(CarEntity::getInsurancePayNextTime, today);
return this.list(queryWrapper);
}
}

50
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java

@ -8,14 +8,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity;
import com.hnac.hzims.safeproduct.enums.CarUsedRecordEnum;
import com.hnac.hzims.safeproduct.mapper.CarUsedRecordMapper;
import com.hnac.hzims.safeproduct.service.ICarUsedRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -35,14 +39,18 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
@Override
public boolean saveCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity) {
// 编码生成
// 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
String lastCode = getLastCode(currentMonth);
String lastCode = getLastCode(currentNormMonth);
// 若不存在,新增编号
String code = BaseUtil.getUniqueCode("WBJL", lastCode, currentMonth);
String code = BaseUtil.getUniqueCode("YCJL", lastCode, currentSimpleMonth);
carUsedRecordEntity.setCode(code);
return false;
// 收车公里数
BigDecimal endMiles = carUsedRecordEntity.getStartMiles().add(carUsedRecordEntity.getMiles());
carUsedRecordEntity.setEndMiles(endMiles);
return this.save(carUsedRecordEntity);
}
/**
@ -66,10 +74,27 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
* 用车记录确认
*/
@Override
public boolean confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO) {
public R confirmCarUsedRecord(CarUsedRecordConfirmationDTO confirmationDTO) {
CarUsedRecordEntity carUsedRecord = this.getById(confirmationDTO.getCarUsedRecordId());
carUsedRecord.setConfirmationTime(confirmationDTO.getConfirmationTime());
return this.updateById(carUsedRecord);
// 判断是否已确认
Date confirmationTime = carUsedRecord.getConfirmationTime();
if (confirmationTime != null) {
return R.fail("该用车记录已被确认");
}
carUsedRecord.setConfirmationTime(DateUtil.now());
carUsedRecord.setUsedStatus(CarUsedRecordEnum.USED.getValue());
return R.status(this.updateById(carUsedRecord));
}
/**
* 更新用车记录
*/
@Override
public boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity) {
// 收车公里数
BigDecimal endMiles = carUsedRecordEntity.getStartMiles().add(carUsedRecordEntity.getMiles());
carUsedRecordEntity.setEndMiles(endMiles);
return this.save(carUsedRecordEntity);
}
/**
@ -78,8 +103,7 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
String month = currentMonth.substring(currentMonth.length() - 2);
List<CarUsedRecordEntity> list = getHygieneByMonth(month);
List<CarUsedRecordEntity> list = getCarUsedRecordByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
return null;
}
@ -87,11 +111,11 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
}
/**
* 查询当月车辆维保记录
* 查询当月车记录
* @param month 当月
* @return 当月车辆维保数据表
* @return 当月用车记录数据表
*/
private List<CarUsedRecordEntity> getHygieneByMonth(String month) {
private List<CarUsedRecordEntity> getCarUsedRecordByMonth(String month) {
QueryWrapper<CarUsedRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarUsedRecordEntity::getCreateTime, month)
.orderByDesc(CarUsedRecordEntity::getCode);

73
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java

@ -1,6 +1,17 @@
package com.hnac.hzims.safeproduct.utils;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.hnac.hzims.common.logs.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 公用工具类
@ -8,6 +19,7 @@ import com.hnac.hzims.common.logs.utils.StringUtils;
* @author liwen
* @date 2024-01-02
*/
@Slf4j
public class BaseUtil {
/**
@ -36,4 +48,65 @@ public class BaseUtil {
}
return code;
}
/**
* 对象转map
* @param entity 对象
* @return map
*/
public static Map<String, Object> convertObjectToMap(Object entity) {
Map<String, Object> map = new HashMap<>();
Field[] fields = entity.getClass().getFields();
try {
for (Field field : fields) {
field.setAccessible(true);
Object value = field.get(entity);
map.put(field.getName(), value);
}
} catch (IllegalAccessException e) {
log.info("对象转map异常: {}", e.getMessage());
}
return map;
}
/**
* 文件导出
* @param documents doc文件
* @param savePath 存储路径
*/
public static void exportWord(List<XWPFDocument> documents, String savePath) {
FileOutputStream out = null;
try {
out = new FileOutputStream(savePath);
for (XWPFDocument document : documents) {
document.write(out);
}
out.close();
} catch (IOException e) {
log.error("文件导出异常: {}", e.getMessage());
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
log.error("文件导出-输出流关闭异常: {}", e.getMessage());
}
}
}
}
/**
* 数据写入模板文件
* @param templatePath 模板路径
* @param params 数据
*/
public static XWPFDocument fillDocument(String templatePath, Map<String, Object> params) {
XWPFDocument xwpfDocument = null;
try {
xwpfDocument = WordExportUtil.exportWord07(templatePath, params);
} catch (Exception e) {
log.error("数据写入异常: {}", e.getMessage());
}
return xwpfDocument;
}
}

Loading…
Cancel
Save