Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 10 months ago
parent
commit
958341ad1b
  1. 6
      hzims-service-api/safeproduct-api/pom.xml
  2. 54
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarAnnualInspectionEntity.java
  3. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java
  4. 54
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarInsuranceEntity.java
  5. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/CarAnnualInspectionStatusEnum.java
  6. 43
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarAnnualInspectionPageVO.java
  7. 43
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarInsurancePageVO.java
  8. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java
  9. BIN
      hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx
  10. 6
      hzims-service/safeproduct/pom.xml
  11. 94
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  12. 80
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java
  13. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarAnnualInspectionMapper.java
  14. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarAnnualInspectionMapper.xml
  15. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarInsuranceMapper.java
  16. 25
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarInsuranceMapper.xml
  17. 40
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarAnnualInspectionService.java
  18. 41
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarInsuranceService.java
  19. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java
  20. 8
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java
  21. 119
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarAnnualInspectionServiceImpl.java
  22. 116
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarInsuranceServiceImpl.java
  23. 18
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  24. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  25. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java
  26. 43
      hzims-service/safeproduct/src/main/resources/db/1.0.2.sql

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

@ -32,6 +32,12 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-dict-api</artifactId> <artifactId>blade-dict-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>${easpoi.version}</version>
</dependency>
</dependencies> </dependencies>
<packaging>jar</packaging> <packaging>jar</packaging>

54
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarAnnualInspectionEntity.java

@ -0,0 +1,54 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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.Size;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_car_annual_inspection")
@ApiModel(value = "年检记录实体类")
public class CarAnnualInspectionEntity extends BaseEntity {
@ApiModelProperty("车辆id")
private Long carId;
@Size(max = 50, message = "编码长度不能超过50")
@ApiModelProperty("编码")
private String code;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("年检时间")
private Date annualInspectionTime;
@Size(max = 255, message = "年检地点长度不能超过255")
@ApiModelProperty("年检地点")
private String location;
@ApiModelProperty("年检费用")
private Long cost;
@Size(max = 50, message = "年间负责人长度不能超过50")
@ApiModelProperty("年检负责人")
private String inspectionManager;
@Size(max = 1000, message = "年间照片长度不能超过1000")
@ApiModelProperty("年检照片")
private String imgPath;
@TableField(exist = false)
@ApiModelProperty("下次年检时间")
private Date nextAnnualInspectionTime;
}

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

@ -58,10 +58,14 @@ public class CarEntity extends BaseEntity {
@ApiModelProperty("下期缴车保时间") @ApiModelProperty("下期缴车保时间")
private Date insurancePayNextTime; private Date insurancePayNextTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("上期年检时间")
private Date lastAnnualInspectionTime;
@NotNull @NotNull
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("年检时间") @ApiModelProperty("下期年检时间")
private Date annualInspectionTime; private Date nextAnnualInspectionTime;
@NotNull @NotNull
@Size(max = 50, message = "年检状态长度不能超过50") @Size(max = 50, message = "年检状态长度不能超过50")

54
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarInsuranceEntity.java

@ -0,0 +1,54 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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.Size;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-22
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_car_insurance")
@ApiModel(value = "车保记录实体类")
public class CarInsuranceEntity extends BaseEntity {
@ApiModelProperty("车辆id")
private Long carId;
@Size(max = 50, message = "编码长度不能超过50")
@ApiModelProperty("编码")
private String code;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("车保时间")
private Date insuranceTime;
@Size(max = 255, message = "车保地点长度不能超过255")
@ApiModelProperty("车保地点")
private String location;
@ApiModelProperty("车保费用")
private Long cost;
@Size(max = 50, message = "车保负责人长度不能超过50")
@ApiModelProperty("车保负责人")
private String insuranceManager;
@Size(max = 1000, message = "车保照片长度不能超过1000")
@ApiModelProperty("车保照片")
private String imgPath;
@TableField(exist = false)
@ApiModelProperty("下次车保时间")
private Date nextInsuranceTime;
}

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

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 车辆年检记录状态枚举类
*
* @author liwen
* @date 2024-01-22
*/
public enum CarAnnualInspectionStatusEnum {
FINISHED("FINISHED", "已完成"),
UNFINISHED("UNFINISHED", "未完成");
private final String value;
private final String desc;
CarAnnualInspectionStatusEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

43
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarAnnualInspectionPageVO.java

@ -0,0 +1,43 @@
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-22
*/
@Data
@ApiModel(value = "年检记录页面VO类")
public class CarAnnualInspectionPageVO {
@ApiModelProperty("车辆id")
private Long carId;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("品牌")
private String carBrand;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("年检时间")
private Date annualInspectionTime;
@ApiModelProperty("年检地点")
private String location;
@ApiModelProperty("年检费用")
private Long cost;
@ApiModelProperty("年检负责人")
private String inspectionManager;
}

43
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarInsurancePageVO.java

@ -0,0 +1,43 @@
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-22
*/
@Data
@ApiModel(value = "年保记录页面VO类")
public class CarInsurancePageVO {
@ApiModelProperty("车辆id")
private Long carId;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("品牌")
private String carBrand;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("年保时间")
private Date insuranceTime;
@ApiModelProperty("年保地点")
private String location;
@ApiModelProperty("年保费用")
private Long cost;
@ApiModelProperty("年保负责人")
private String insuranceManager;
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java

@ -102,7 +102,7 @@ public class OperAccessLibraryController extends BladeController {
@ApiOperation(value = "检修库导入") @ApiOperation(value = "检修库导入")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@PostMapping(value = "/import") @PostMapping(value = "/import")
public void libraryImport(@RequestParam("library") MultipartFile multipartFile) { public void libraryImport(@RequestParam MultipartFile multipartFile) {
service.libraryImport(multipartFile); service.libraryImport(multipartFile);
} }
} }

BIN
hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx

Binary file not shown.

6
hzims-service/safeproduct/pom.xml

@ -151,6 +151,12 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath> <systemPath>${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>${easpoi.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

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

@ -6,13 +6,8 @@ import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO; import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO;
import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO; import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO;
import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO; import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.entity.*;
import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; import com.hnac.hzims.safeproduct.service.*;
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 com.hnac.hzims.safeproduct.vo.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -49,6 +44,10 @@ public class CarController extends BladeController {
private final ICarCheckRecordService carCheckRecordService; private final ICarCheckRecordService carCheckRecordService;
private final ICarAnnualInspectionService carAnnualInspectionService;
private final ICarInsuranceService carInsuranceService;
@PostMapping("/saveCar") @PostMapping("/saveCar")
@ApiOperation(value = "新增车辆") @ApiOperation(value = "新增车辆")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ -263,4 +262,85 @@ public class CarController extends BladeController {
public void exportCarMilesData(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletResponse response) { public void exportCarMilesData(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletResponse response) {
carService.exportCarMilesData(param, query, response); carService.exportCarMilesData(param, query, response);
} }
@PostMapping("/saveCarAnnualInspection")
@ApiOperation(value = "新增年检记录")
@ApiOperationSupport(order = 28)
public R saveCarAnnualInspection(@Valid @RequestBody CarAnnualInspectionEntity carAnnualInspectionEntity) {
return R.status(carAnnualInspectionService.saveCarAnnualInspection(carAnnualInspectionEntity));
}
@PostMapping("/updateCarAnnualInspection")
@ApiOperation(value = "修改年检记录")
@ApiOperationSupport(order = 29)
public R updateCarAnnualInspection(@Valid @RequestBody CarAnnualInspectionEntity carAnnualInspectionEntity) {
return R.status(carAnnualInspectionService.updateCarAnnualInspection(carAnnualInspectionEntity));
}
@PostMapping("/removeCarAnnualInspection")
@ApiOperation(value = "删除年检记录")
@ApiOperationSupport(order = 30)
public R removeCarAnnualInspection(@RequestParam Long id) {
return R.status(carAnnualInspectionService.removeById(id));
}
@GetMapping("/carAnnualInspectionDetail")
@ApiOperation(value = "年检记录详情")
@ApiOperationSupport(order = 31)
public R<CarAnnualInspectionEntity> carAnnualInspectionDetail(@RequestParam Long id) {
return R.data(carAnnualInspectionService.getById(id));
}
@GetMapping("/carAnnualInspectionPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "annualInspectionTime", value = "年检时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "年检记录分页")
@ApiOperationSupport(order = 32)
public R<IPage<CarAnnualInspectionPageVO>> carAnnualInspectionPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarAnnualInspectionPageVO> page = carAnnualInspectionService.getCarAnnualInspectionPage(param, query);
return R.data(page);
}
@PostMapping("/saveCarInsurance")
@ApiOperation(value = "新增车保记录")
@ApiOperationSupport(order = 33)
public R saveCarInsurance(@Valid @RequestBody CarInsuranceEntity carInsuranceEntity) {
return R.status(carInsuranceService.saveCarCheckRecord(carInsuranceEntity));
}
@PostMapping("/updateCarInsurance")
@ApiOperation(value = "修改车保记录")
@ApiOperationSupport(order = 34)
public R updateCarInsurance(@Valid @RequestBody CarInsuranceEntity carInsuranceEntity) {
return R.status(carInsuranceService.updateCarCheckRecord(carInsuranceEntity));
}
@PostMapping("/removeCarInsurance")
@ApiOperation(value = "删除车保记录")
@ApiOperationSupport(order = 35)
public R removeCarInsurance(@RequestParam Long id) {
return R.status(carInsuranceService.removeById(id));
}
@GetMapping("/carInsuranceDetail")
@ApiOperation(value = "车保记录详情")
@ApiOperationSupport(order = 36)
public R<CarInsuranceEntity> carInsuranceDetail(@RequestParam Long id) {
return R.data(carInsuranceService.getById(id));
}
@GetMapping("/carInsurancePage")
@ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车保记录分页")
@ApiOperationSupport(order = 37)
public R<IPage<CarInsurancePageVO>> carInsurancePage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<CarInsurancePageVO> page = carInsuranceService.getCarInsurancePage(param, query);
return R.data(page);
}
} }

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

@ -5,15 +5,15 @@ import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.dto.BusinessMessageDTO; import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.safeproduct.entity.CarEntity; import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.entity.CarMaintenanceEntity; import com.hnac.hzims.safeproduct.enums.CarAnnualInspectionStatusEnum;
import com.hnac.hzims.safeproduct.enums.CarInsuranceStatusEnum; import com.hnac.hzims.safeproduct.enums.CarInsuranceStatusEnum;
import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum; import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum;
import com.hnac.hzims.safeproduct.service.ICarInsuranceService;
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
import com.hnac.hzims.safeproduct.service.ICarService; import com.hnac.hzims.safeproduct.service.ICarService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
@ -52,6 +52,9 @@ public class CarJob {
@Autowired @Autowired
IUserClient userClient; IUserClient userClient;
@Autowired
ICarInsuranceService carInsuranceService;
/** /**
* 车辆台账自动变更 * 车辆台账自动变更
*/ */
@ -66,33 +69,37 @@ public class CarJob {
// 车保状态变更 // 车保状态变更
List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday); List<CarEntity> uninsuredCarList = carService.getCarListByInsuranceTime(today, yesterday);
if (!CollectionUtils.isEmpty(uninsuredCarList)) { if (!CollectionUtils.isEmpty(uninsuredCarList)) {
uninsuredCarList.forEach(car -> { uninsuredCarList.forEach(car -> car.setInsuranceStatus(CarInsuranceStatusEnum.UNINSURED.getValue()));
car.setInsuranceStatus(CarInsuranceStatusEnum.UNINSURED.getValue());
sendUninsuredMessage(car);
});
boolean insuranceUpdate = carService.updateBatchById(uninsuredCarList); boolean insuranceUpdate = carService.updateBatchById(uninsuredCarList);
if (!insuranceUpdate) { if (!insuranceUpdate) {
return ReturnT.FAIL; return ReturnT.FAIL;
} }
// 变更成功则推送消息
uninsuredCarList.forEach(this::sendUninsuredMessage);
} }
// 维保状态变更 // 维保状态变更
List<CarEntity> unMaintainedCarList = carService.getCarListByMaintenanceTime(today, yesterday); List<CarEntity> unmaintainedCarList = carService.getCarListByMaintenanceTime(today, yesterday);
if (CollectionUtils.isEmpty(unMaintainedCarList)) { if (!CollectionUtils.isEmpty(unmaintainedCarList)) {
return ReturnT.SUCCESS; unmaintainedCarList.forEach(car -> car.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue()));
boolean maintenanceUpdate = carService.updateBatchById(unmaintainedCarList);
if (!maintenanceUpdate) {
return ReturnT.FAIL;
} }
unMaintainedCarList.forEach(car -> { // 变更成功则推送消息
// 查询车辆在两次维保时间内是否有确认过的维保记录 unmaintainedCarList.forEach(this::sendUnmaintainedMessage);
String lastMaintenanceTime = DateUtil.format(car.getMaintenanceLastTime(), DateUtil.PATTERN_DATE);
String nextMaintenanceTime = DateUtil.format(car.getMaintenanceNextTime(), DateUtil.PATTERN_DATE);
List<CarMaintenanceEntity> carMaintenanceList = carMaintenanceService.getCarMaintenanceByCarIdAndTime(car.getId(),
lastMaintenanceTime, nextMaintenanceTime);
// 若无维保记录,说明在规定范围内未进行有效维保
if (CollectionUtils.isEmpty(carMaintenanceList)) {
car.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue());
sendUnMaintainedMessage(car);
} }
}); // 年检状态变更
return carService.updateBatchById(unMaintainedCarList) ? ReturnT.SUCCESS : ReturnT.FAIL; List<CarEntity> uninspectedCarList = carService.getCarListByAnnualInspectionTime(today, yesterday);
if (!CollectionUtils.isEmpty(uninspectedCarList)) {
uninspectedCarList.forEach(car -> car.setAnnualInspectionStatus(CarAnnualInspectionStatusEnum.UNFINISHED.getValue()));
boolean inspectionUpdate = carService.updateBatchById(uninspectedCarList);
if (!inspectionUpdate) {
return ReturnT.FAIL;
}
// 变更成功则推送消息
uninspectedCarList.forEach(this::sendUninspectedMessage);
}
return ReturnT.SUCCESS;
} }
/** /**
@ -128,7 +135,7 @@ public class CarJob {
* 推送维保过期消息 * 推送维保过期消息
* @param carEntity 车辆实体类 * @param carEntity 车辆实体类
*/ */
private void sendUnMaintainedMessage(CarEntity carEntity) { private void sendUnmaintainedMessage(CarEntity carEntity) {
if (carEntity.getManagerId() == null) { if (carEntity.getManagerId() == null) {
log.error("系统无该用户信息,推送维保过期消息失败"); log.error("系统无该用户信息,推送维保过期消息失败");
return; return;
@ -152,4 +159,33 @@ public class CarJob {
} }
messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
} }
/**
* 推送年检过期消息
* @param carEntity 车辆实体类
*/
private void sendUninspectedMessage(CarEntity carEntity) {
if (carEntity.getManagerId() == null) {
log.error("系统无该用户信息,推送年检过期消息失败");
return;
}
// 查询用户
R<User> userRes = userClient.userInfoById(carEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
if (StringUtils.isNotEmpty(user.getDeptId())) {
Long id = Long.valueOf(user.getDeptId());
businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("年检到期");
businessMessageDTO.setBusinessClassify("system");
businessMessageDTO.setTaskId(carEntity.getId());
businessMessageDTO.setSubject("年检到期通知");
businessMessageDTO.setContent("您所管理的车辆" + carEntity.getPlateNumber() + "年检已过期,请及时进行年检。");
businessMessageDTO.setUserIds(String.valueOf(carEntity.getManagerId()));
businessMessageDTO.setCreateUser(carEntity.getCreateUser());
businessMessageDTO.setTenantId(CommonConstant.TENANT_ID);
}
messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
}
} }

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarAnnualInspectionMapper.java

@ -0,0 +1,27 @@
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.CarAnnualInspectionEntity;
import com.hnac.hzims.safeproduct.vo.CarAnnualInspectionPageVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/**
* 年检记录Mapper类
*
* @author liwen
* @date 2024-01-22
*/
@Mapper
public interface CarAnnualInspectionMapper extends BaseMapper<CarAnnualInspectionEntity> {
/**
* 年检记录分页
* @param param 入参
* @param page 分页类
* @return 年检记录数据
*/
IPage<CarAnnualInspectionPageVO> getCarAnnualInspectionPage(IPage<CarAnnualInspectionPageVO> page, Map<String, Object> param);
}

26
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarAnnualInspectionMapper.xml

@ -0,0 +1,26 @@
<?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.CarAnnualInspectionMapper">
<select id="getCarAnnualInspectionPage"
resultType="com.hnac.hzims.safeproduct.vo.CarAnnualInspectionPageVO">
SELECT
t1.code, t1.annual_inspection_time, t1.location, t1.cost, t1.inspection_manager, t2.unit, t2.car_brand, t2.plate_number
FROM
hzims_car_annual_inspection t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
t1.is_deleted = 0
<if test = "param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
<if test="param.unit != null and param.unit != ''">
AND t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.annualInspectionTime != null and param.annualInspectionTime != ''">
AND t1.annualInspectionTime = #{param.annualInspectionTime}
</if>
ORDER BY
t1.create_time DESC
</select>
</mapper>

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarInsuranceMapper.java

@ -0,0 +1,27 @@
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.CarInsuranceEntity;
import com.hnac.hzims.safeproduct.vo.CarInsurancePageVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/**
* 车保记录Mapper类
*
* @author liwen
* @date 2024-01-22
*/
@Mapper
public interface CarInsuranceMapper extends BaseMapper<CarInsuranceEntity> {
/**
* 车保记录页面
* @param param 入参
* @param page 分页类
* @return 车保记录数据
*/
IPage<CarInsurancePageVO> getCarInsurancePage(IPage<CarInsurancePageVO> page, Map<String, Object> param);
}

25
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarInsuranceMapper.xml

@ -0,0 +1,25 @@
<?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.CarInsuranceMapper">
<select id="getCarInsurancePage" resultType="com.hnac.hzims.safeproduct.vo.CarInsurancePageVO">
SELECT
t1.code, t1.insurance_time, t1.location, t1.cost, t1.insurance_manager, t2.unit, t2.car_brand, t2.plate_number
FROM
hzims_car_insurance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
WHERE
t1.is_deleted = 0
<if test = "param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
<if test="param.unit != null and param.unit != ''">
AND t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.insuranceTime != null and param.insuranceTime != ''">
AND t1.insuranceTime = #{param.insuranceTime}
</if>
ORDER BY
t1.create_time DESC
</select>
</mapper>

40
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarAnnualInspectionService.java

@ -0,0 +1,40 @@
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.CarAnnualInspectionEntity;
import com.hnac.hzims.safeproduct.vo.CarAnnualInspectionPageVO;
import org.springblade.core.mp.support.Query;
import java.util.Map;
/**
* 年检记录服务类
*
* @author liwen
* @date 2024-01-22
*/
public interface ICarAnnualInspectionService extends IService<CarAnnualInspectionEntity> {
/**
* 新增年检记录
* @param carAnnualInspectionEntity 年检记录实体类
* @return true-成功false-失败
*/
boolean saveCarAnnualInspection(CarAnnualInspectionEntity carAnnualInspectionEntity);
/**
* 修改年检记录
* @param carAnnualInspectionEntity 年检记录实体类
* @return true-成功false-失败
*/
boolean updateCarAnnualInspection(CarAnnualInspectionEntity carAnnualInspectionEntity);
/**
* 年检记录分页
* @param param 入参
* @param query 分页类
* @return 年检记录数据
*/
IPage<CarAnnualInspectionPageVO> getCarAnnualInspectionPage(Map<String, Object> param, Query query);
}

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

@ -0,0 +1,41 @@
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.CarInsuranceEntity;
import com.hnac.hzims.safeproduct.vo.CarInsurancePageVO;
import org.springblade.core.mp.support.Query;
import java.util.List;
import java.util.Map;
/**
* 车保记录服务类
*
* @author liwen
* @date 2024-01-22
*/
public interface ICarInsuranceService extends IService<CarInsuranceEntity> {
/**
* 新增车保记录
* @param carInsuranceEntity 车保记录实体类
* @return true-成功false-失败
*/
boolean saveCarCheckRecord(CarInsuranceEntity carInsuranceEntity);
/**
* 修改车保记录
* @param carInsuranceEntity 车保记录实体类
* @return true-成功false-失败
*/
boolean updateCarCheckRecord(CarInsuranceEntity carInsuranceEntity);
/**
* 车保记录页面
* @param param 入参
* @param query 分页类
* @return 车保记录数据
*/
IPage<CarInsurancePageVO> getCarInsurancePage(Map<String, Object> param, Query query);
}

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

@ -58,15 +58,6 @@ public interface ICarMaintenanceService extends IService<CarMaintenanceEntity> {
void exportCarMaintenanceData(Long id, HttpServletResponse response); void exportCarMaintenanceData(Long id, HttpServletResponse response);
/** /**
* 根据车辆id和时间查询相关维保记录
* @param carId 车辆id
* @param lastTime 上次维保时间
* @param nextTime 下次维保时间
* @return 车辆维保记录列表
*/
List<CarMaintenanceEntity> getCarMaintenanceByCarIdAndTime(Long carId, String lastTime, String nextTime);
/**
* 更新车辆维保记录 * 更新车辆维保记录
* @param carMaintenanceEntity 车辆维保记录实体类 * @param carMaintenanceEntity 车辆维保记录实体类
* @return 结果封装类 * @return 结果封装类

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

@ -72,4 +72,12 @@ public interface ICarService extends IService<CarEntity> {
* @param response 响应类 * @param response 响应类
*/ */
void exportCarMilesData(Map<String, Object> param, Query query, HttpServletResponse response); void exportCarMilesData(Map<String, Object> param, Query query, HttpServletResponse response);
/**
* 根据年检时间查询车辆列表
* @param today 当天
* @param yesterday 昨天
* @return 车辆列表数据
*/
List<CarEntity> getCarListByAnnualInspectionTime(String today, String yesterday);
} }

119
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarAnnualInspectionServiceImpl.java

@ -0,0 +1,119 @@
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.entity.CarAnnualInspectionEntity;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.enums.CarAnnualInspectionStatusEnum;
import com.hnac.hzims.safeproduct.mapper.CarAnnualInspectionMapper;
import com.hnac.hzims.safeproduct.service.ICarAnnualInspectionService;
import com.hnac.hzims.safeproduct.service.ICarService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarAnnualInspectionPageVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 年检记录服务实现类
*
* @author liwen
* @date 2024-01-22
*/
@Service
public class CarAnnualInspectionServiceImpl extends ServiceImpl<CarAnnualInspectionMapper, CarAnnualInspectionEntity> implements ICarAnnualInspectionService {
@Autowired
ICarService carService;
/**
* 新增年检记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveCarAnnualInspection(CarAnnualInspectionEntity carAnnualInspectionEntity) {
// 编码
// 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
String lastCode = getLastCode(currentNormMonth);
String code = BaseUtil.getUniqueCode("CLNJ", lastCode, currentSimpleMonth);
carAnnualInspectionEntity.setCode(code);
boolean save = this.save(carAnnualInspectionEntity);
// 新增年检记录成功,更新车辆信息
if (save) {
CarEntity carEntity = carService.getById(carAnnualInspectionEntity.getCarId());
if (carEntity != null) {
carEntity.setLastAnnualInspectionTime(carAnnualInspectionEntity.getAnnualInspectionTime());
carEntity.setNextAnnualInspectionTime(carAnnualInspectionEntity.getNextAnnualInspectionTime());
// 更新年检状态
carEntity.setAnnualInspectionStatus(CarAnnualInspectionStatusEnum.FINISHED.getValue());
return carService.updateById(carEntity);
}
}
return false;
}
/**
* 修改年检记录
*/
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateCarAnnualInspection(CarAnnualInspectionEntity carAnnualInspectionEntity) {
boolean update = this.updateById(carAnnualInspectionEntity);
// 同步更新车辆的年检时间
if (update) {
CarEntity carEntity = carService.getById(carAnnualInspectionEntity.getCarId());
if (carEntity != null) {
carEntity.setLastAnnualInspectionTime(carAnnualInspectionEntity.getAnnualInspectionTime());
carEntity.setNextAnnualInspectionTime(carAnnualInspectionEntity.getNextAnnualInspectionTime());
return carService.updateById(carEntity);
}
}
return false;
}
/**
* 年检记录分页
*/
@Override
public IPage<CarAnnualInspectionPageVO> getCarAnnualInspectionPage(Map<String, Object> param, Query query) {
IPage<CarAnnualInspectionPageVO> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.getCarAnnualInspectionPage(page, param);
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
List<CarAnnualInspectionEntity> list = getCarAnnualInspectionByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月年检记录
* @param month 当月
* @return 当月年检记录数据表
*/
private List<CarAnnualInspectionEntity> getCarAnnualInspectionByMonth(String month) {
QueryWrapper<CarAnnualInspectionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarAnnualInspectionEntity::getCreateTime, month)
.orderByDesc(CarAnnualInspectionEntity::getCode);
return this.list(queryWrapper);
}
}

116
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarInsuranceServiceImpl.java

@ -0,0 +1,116 @@
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.entity.CarEntity;
import com.hnac.hzims.safeproduct.entity.CarInsuranceEntity;
import com.hnac.hzims.safeproduct.enums.CarInsuranceStatusEnum;
import com.hnac.hzims.safeproduct.mapper.CarInsuranceMapper;
import com.hnac.hzims.safeproduct.service.ICarInsuranceService;
import com.hnac.hzims.safeproduct.service.ICarService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarInsurancePageVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 车保记录服务实现类
*
* @author liwen
* @date 2024-01-22
*/
@Service
public class CarInsuranceServiceImpl extends ServiceImpl<CarInsuranceMapper, CarInsuranceEntity> implements ICarInsuranceService {
@Autowired
ICarService carService;
/**
* 新增车保记录
*/
@Override
public boolean saveCarCheckRecord(CarInsuranceEntity carInsuranceEntity) {
// 编码
// 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
String currentSimpleMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号
String lastCode = getLastCode(currentNormMonth);
String code = BaseUtil.getUniqueCode("CBJL", lastCode, currentSimpleMonth);
carInsuranceEntity.setCode(code);
boolean save = this.save(carInsuranceEntity);
// 新增年检记录成功,更新车辆信息
if (save) {
CarEntity carEntity = carService.getById(carInsuranceEntity.getCarId());
if (carEntity != null) {
carEntity.setInsurancePayLastTime(carInsuranceEntity.getInsuranceTime());
carEntity.setInsurancePayNextTime(carInsuranceEntity.getNextInsuranceTime());
// 更新年检状态
carEntity.setAnnualInspectionStatus(CarInsuranceStatusEnum.INSURED.getValue());
return carService.updateById(carEntity);
}
}
return false;
}
/**
* 修改车保记录
*/
@Override
public boolean updateCarCheckRecord(CarInsuranceEntity carInsuranceEntity) {
boolean update = this.updateById(carInsuranceEntity);
// 同步更新车辆的年检时间
if (update) {
CarEntity carEntity = carService.getById(carInsuranceEntity.getCarId());
if (carEntity != null) {
carEntity.setInsurancePayLastTime(carInsuranceEntity.getInsuranceTime());
carEntity.setInsurancePayNextTime(carInsuranceEntity.getNextInsuranceTime());
return carService.updateById(carEntity);
}
}
return false;
}
/**
* 车保记录页面
*/
@Override
public IPage<CarInsurancePageVO> getCarInsurancePage(Map<String, Object> param, Query query) {
IPage<CarInsurancePageVO> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.getCarInsurancePage(page, param);
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null
*/
private String getLastCode(String currentMonth) {
List<CarInsuranceEntity> list = getCarInsuranceByMonth(currentMonth);
if (CollectionUtils.isEmpty(list)) {
return null;
}
return list.get(0).getCode();
}
/**
* 查询当月年保记录
* @param month 当月
* @return 当月年保记录数据表
*/
private List<CarInsuranceEntity> getCarInsuranceByMonth(String month) {
QueryWrapper<CarInsuranceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().like(CarInsuranceEntity::getCreateTime, month)
.orderByDesc(CarInsuranceEntity::getCode);
return this.list(queryWrapper);
}
}

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

@ -52,6 +52,8 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
*/ */
@Override @Override
public boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) { public boolean saveCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) {
// 维保状态
carMaintenanceEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.MAINTAINED.getValue());
// 编码生成 // 编码生成
// 获取当月时间 // 获取当月时间
String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date()); String currentNormMonth = DatePattern.NORM_MONTH_FORMAT.format(new Date());
@ -129,26 +131,12 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
} }
/** /**
* 根据车辆id和时间查询相关维保记录
*/
@Override
public List<CarMaintenanceEntity> getCarMaintenanceByCarIdAndTime(Long carId, String lastTime, String nextTime) {
QueryWrapper<CarMaintenanceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CarMaintenanceEntity::getCarId, carId)
.ge(CarMaintenanceEntity::getEndTime, lastTime)
.le(CarMaintenanceEntity::getEndTime, nextTime)
.eq(CarMaintenanceEntity::getMaintenanceStatus, CarMaintenanceStatusEnum.MAINTAINED.getValue())
.orderByDesc(CarMaintenanceEntity::getCreateTime);
return this.list(queryWrapper);
}
/**
* 更新车辆维保记录 * 更新车辆维保记录
*/ */
@Override @Override
public R updateCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) { public R updateCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) {
String maintenanceStatus = carMaintenanceEntity.getMaintenanceStatus(); String maintenanceStatus = carMaintenanceEntity.getMaintenanceStatus();
if (maintenanceStatus.equals(CarMaintenanceStatusEnum.MAINTAINED.getValue())) { if (maintenanceStatus != null && maintenanceStatus.equals(CarMaintenanceStatusEnum.MAINTAINED.getValue())) {
return R.fail("已确认的维保记录无法被修改"); return R.fail("已确认的维保记录无法被修改");
} }
return R.status(this.updateById(carMaintenanceEntity)); return R.status(this.updateById(carMaintenanceEntity));

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

@ -253,4 +253,15 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
} }
} }
} }
/**
* 根据年检时间查询车辆列表
*/
@Override
public List<CarEntity> getCarListByAnnualInspectionTime(String today, String yesterday) {
QueryWrapper<CarEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().lt(CarEntity::getNextAnnualInspectionTime, today)
.ge(CarEntity::getNextAnnualInspectionTime, yesterday);
return this.list(queryWrapper);
}
} }

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

@ -101,7 +101,7 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
// 行驶公里数 // 行驶公里数
BigDecimal miles = carUsedRecordEntity.getEndMiles().subtract(carUsedRecordEntity.getStartMiles()); BigDecimal miles = carUsedRecordEntity.getEndMiles().subtract(carUsedRecordEntity.getStartMiles());
carUsedRecordEntity.setMiles(miles); carUsedRecordEntity.setMiles(miles);
return this.save(carUsedRecordEntity); return this.updateById(carUsedRecordEntity);
} }
/** /**

43
hzims-service/safeproduct/src/main/resources/db/1.0.2.sql

@ -233,9 +233,10 @@ CREATE TABLE `hzims_car` (
`registration_time` date NOT NULL COMMENT '上牌时间', `registration_time` date NOT NULL COMMENT '上牌时间',
`insurance_pay_last_time` date NOT NULL COMMENT '上期缴车保时间', `insurance_pay_last_time` date NOT NULL COMMENT '上期缴车保时间',
`insurance_pay_next_time` date NOT NULL COMMENT '下期缴车保时间', `insurance_pay_next_time` date NOT NULL COMMENT '下期缴车保时间',
`annual_inspection_time` date NOT NULL COMMENT '年检时间',
`annual_inspection_status` varchar(50) NOT NULL COMMENT '年检状态',
`insurance_status` varchar(50) NOT NULL COMMENT '保险状态', `insurance_status` varchar(50) NOT NULL COMMENT '保险状态',
`last_annual_inspection_time` date NOT NULL COMMENT '上期年检时间',
`next_annual_inspection_time` date NOT NULL COMMENT '下期年检时间',
`annual_inspection_status` varchar(50) NOT NULL COMMENT '年检状态',
`maintenance_last_time` date DEFAULT NULL COMMENT '上期保养时间', `maintenance_last_time` date DEFAULT NULL COMMENT '上期保养时间',
`maintenance_next_time` date DEFAULT NULL COMMENT '下期保养时间', `maintenance_next_time` date DEFAULT NULL COMMENT '下期保养时间',
`maintenance_mileage` decimal(10, 2) DEFAULT NULL COMMENT '保养里程', `maintenance_mileage` decimal(10, 2) DEFAULT NULL COMMENT '保养里程',
@ -340,6 +341,44 @@ CREATE TABLE `hzims_car_check_item` (
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车检项表' ROW_FORMAT=Dynamic; ) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车检项表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_car_annual_inspection` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`car_id` bigint(20) NOT NULL COMMENT '车辆id',
`code` varchar(50) NOT NULL COMMENT '编号',
`annual_inspection_time` date NOT NULL COMMENT '年检时间',
`location` varchar(255) NOT NULL DEFAULT '' COMMENT '年检地点',
`cost` bigint(20) NOT NULL COMMENT '年检费用',
`inspection_manager` varchar(50) NOT NULL DEFAULT '' COMMENT '年检负责人',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '年检图片',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车辆年检记录表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_car_insurance` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`car_id` bigint(20) NOT NULL COMMENT '车辆id',
`code` varchar(50) NOT NULL COMMENT '编号',
`insurance_time` date NOT NULL COMMENT '车保时间',
`location` varchar(255) NOT NULL DEFAULT '' COMMENT '车保地点',
`cost` bigint(20) NOT NULL COMMENT '车保费用',
`insurance_manager` varchar(50) NOT NULL DEFAULT '' COMMENT '车保负责人',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '车保图片',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='车保记录表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_device` ( CREATE TABLE `hzims_device` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`name` varchar(50) NOT NULL COMMENT '设备名称', `name` varchar(50) NOT NULL COMMENT '设备名称',

Loading…
Cancel
Save