Browse Source

update: 车辆管理优化

zhongwei
liwen 10 months ago
parent
commit
8f627a931d
  1. 2
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java
  2. 10
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarAnnualInspectionEntity.java
  3. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarEntity.java
  4. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarInsuranceEntity.java
  5. 9
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarAnnualInspectionPageVO.java
  6. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarCheckRecordDetailVO.java
  7. 9
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarInsurancePageVO.java
  8. 11
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java
  9. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenancePageVO.java
  10. 11
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java
  11. 2
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordPageVO.java
  12. 37
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  13. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarAnnualInspectionMapper.xml
  14. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarCheckRecordMapper.xml
  15. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarInsuranceMapper.xml
  16. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml
  17. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarUsedRecordMapper.xml
  18. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarService.java
  19. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarUsedRecordService.java
  20. 8
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarCheckRecordServiceImpl.java
  21. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  22. 15
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarServiceImpl.java
  23. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java
  24. BIN
      hzims-service/safeproduct/src/main/resources/template/用车记录单.docx
  25. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆检查表.docx
  26. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

2
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java

@ -10,6 +10,8 @@ public interface SafeProductConstant {
String TENANT_ID = "200000";
String SAFEPRODUCT_EXPORT_DATE = "yyyy-MM-dd HH:mm:ss";
int SUCCESS = 1;
int FAILURE = 0;

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

@ -37,18 +37,10 @@ public class CarAnnualInspectionEntity extends BaseEntity {
@ApiModelProperty("年检地点")
private String location;
@ApiModelProperty("年检费用")
private Long cost;
@Size(max = 50, message = "年间负责人长度不能超过50")
@ApiModelProperty("年检负责人")
private String inspectionManager;
@Size(max = 1000, message = "年间照片长度不能超过1000")
@Size(max = 1000, message = "年检照片长度不能超过1000")
@ApiModelProperty("年检照片")
private String imgPath;
@TableField(exist = false)
@ApiModelProperty("下次年检时间")
private Date nextAnnualInspectionTime;
}

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

@ -48,12 +48,10 @@ public class CarEntity extends BaseEntity {
@ApiModelProperty("上牌时间")
private Date registrationTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("上期缴车保时间")
private Date insurancePayLastTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("下期缴车保时间")
private Date insurancePayNextTime;
@ -62,7 +60,6 @@ public class CarEntity extends BaseEntity {
@ApiModelProperty("上期年检时间")
private Date lastAnnualInspectionTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("下期年检时间")
private Date nextAnnualInspectionTime;

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

@ -37,18 +37,10 @@ public class CarInsuranceEntity extends BaseEntity {
@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;
}

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

@ -14,6 +14,9 @@ import java.util.Date;
@ApiModel(value = "年检记录页面VO类")
public class CarAnnualInspectionPageVO {
@ApiModelProperty("年检记录id")
private Long id;
@ApiModelProperty("车辆id")
private Long carId;
@ -34,10 +37,4 @@ public class CarAnnualInspectionPageVO {
@ApiModelProperty("年检地点")
private String location;
@ApiModelProperty("年检费用")
private Long cost;
@ApiModelProperty("年检负责人")
private String inspectionManager;
}

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

@ -43,4 +43,10 @@ public class CarCheckRecordDetailVO {
@ApiModelProperty("检查列表")
private List<CarCheckItemEntity> checkItemList;
@ApiModelProperty("年份")
private String year;
@ApiModelProperty("月份")
private String month;
}

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

@ -14,6 +14,9 @@ import java.util.Date;
@ApiModel(value = "年保记录页面VO类")
public class CarInsurancePageVO {
@ApiModelProperty("年保记录id")
private Long id;
@ApiModelProperty("车辆id")
private Long carId;
@ -34,10 +37,4 @@ public class CarInsurancePageVO {
@ApiModelProperty("年保地点")
private String location;
@ApiModelProperty("年保费用")
private Long cost;
@ApiModelProperty("年保负责人")
private String insuranceManager;
}

11
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java

@ -1,10 +1,12 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -61,4 +63,13 @@ public class CarMaintenanceDetailVO {
@ApiModelProperty("维保类型")
private String maintenanceType;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;
@ApiModelProperty("月份")
private String month;
}

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

@ -46,4 +46,7 @@ public class CarMaintenancePageVO {
@ApiModelProperty("确认时间")
private Date confirmationTime;
@ApiModelProperty("维保状态")
private String maintenanceStatus;
}

11
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -62,4 +64,13 @@ public class CarUsedRecordDetailVO {
@ApiModelProperty("确认时间")
private Date confirmationTime;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;
@ApiModelProperty("月份")
private String month;
}

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

@ -18,7 +18,7 @@ public class CarUsedRecordPageVO {
@ApiModelProperty("用车记录id")
private Long id;
@ApiModelProperty("用车单位")
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("品牌")

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

@ -22,6 +22,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
@ -119,9 +120,11 @@ public class CarController extends BladeController {
@GetMapping("/carMaintenancePage")
@ApiImplicitParams({
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车辆维保记录分页")
@ApiOperationSupport(order = 10)
@ -148,7 +151,7 @@ public class CarController extends BladeController {
@ApiOperation(value = "修改用车记录")
@ApiOperationSupport(order = 13)
public R updateCarUsedRecord(@Valid @RequestBody CarUsedRecordEntity carUsedRecordEntity) {
return R.status(carUsedRecordService.updateCarUsedRecord(carUsedRecordEntity));
return carUsedRecordService.updateCarUsedRecord(carUsedRecordEntity);
}
@PostMapping("/removeCarUsedRecord")
@ -167,7 +170,11 @@ public class CarController extends BladeController {
@GetMapping("/carUsedRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "用车记录分页")
@ApiOperationSupport(order = 16)
@ -221,8 +228,11 @@ public class CarController extends BladeController {
@GetMapping("/carCheckRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车检记录分页")
@ApiOperationSupport(order = 23)
@ -295,7 +305,9 @@ public class CarController extends BladeController {
@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")
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "年检记录分页")
@ApiOperationSupport(order = 32)
@ -334,8 +346,11 @@ public class CarController extends BladeController {
@GetMapping("/carInsurancePage")
@ApiImplicitParams({
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "carId", value = "车辆id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "plateNumber", value = "车牌号", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "车保记录分页")
@ApiOperationSupport(order = 37)
@ -343,4 +358,12 @@ public class CarController extends BladeController {
IPage<CarInsurancePageVO> page = carInsuranceService.getCarInsurancePage(param, query);
return R.data(page);
}
@GetMapping("/carList")
@ApiOperation(value = "查询车辆列表")
@ApiOperationSupport(order = 38)
public R<List<CarEntity>> carList(String plateNumber) {
List<CarEntity> list = carService.getCarListByPlateNumber(plateNumber);
return R.data(list);
}
}

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

@ -5,7 +5,7 @@
<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
t1.id, t1.code, t1.annual_inspection_time, t1.location, 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
@ -14,11 +14,17 @@
<if test = "param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
<if test="param.plateNumber != null and param.plateNumber != ''">
AND t2.plate_number like concat('%', #{param.plateNumber}, '%')
</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 test="param.startTime != null and param.startTime != ''">
AND t1.annual_inspection_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.annual_inspection_time &lt;= #{param.endTime}
</if>
ORDER BY
t1.create_time DESC

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

@ -13,9 +13,18 @@
<if test="param.unit != null and param.unit != ''">
AND t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.plateNumber != null and param.plateNumber != ''">
AND t2.plate_number like concat('%', #{param.plateNumber}, '%')
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND t1.check_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.check_time &lt;= #{param.endTime}
</if>
ORDER BY
t1.create_time DESC
</select>

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

@ -4,7 +4,7 @@
<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
t1.id, t1.code, t1.insurance_time, t1.location, t2.unit, t2.car_brand, t2.plate_number
FROM
hzims_car_insurance t1
LEFT JOIN hzims_car t2 ON t1.car_id = t2.id
@ -16,8 +16,14 @@
<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 test="param.plateNumber != null and param.plateNumber != ''">
AND t2.plate_number like concat('%', #{param.plateNumber}, '%')
</if>
<if test="param.startTime != null and param.startTime != ''">
AND t1.insurance_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.insurance_time &lt;= #{param.endTime}
</if>
ORDER BY
t1.create_time DESC

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

@ -19,7 +19,7 @@
<select id="getCarMaintenancePage" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO">
SELECT
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
t1.cost, t1.maintainer, t1.confirmation_time, t1.maintenance_status
FROM
hzims_car_maintenance 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 t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.plateNumber != null and param.plateNumber != ''">
AND t2.plate_number like concat('%', #{param.plateNumber}, '%')
</if>
<if test="param.startTime != null and param.startTime != ''">
AND t1.start_time >= #{param.startTime}
</if>

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

@ -18,7 +18,7 @@
<select id="getCarUsedRecordPage" resultType="com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO">
SELECT
t1.id, t1.unit, t1.start_time, t1.user, t1.remark, t1.start_miles, t1.end_miles, t1.miles,
t1.id, t2.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
@ -26,11 +26,20 @@
WHERE
t1.is_deleted = 0
<if test="param.unit != null and param.unit != ''">
AND t1.unit like concat('%', #{param.unit}, '%')
AND t2.unit like concat('%', #{param.unit}, '%')
</if>
<if test="param.plateNumber != null and param.plateNumber != ''">
AND t2.plate_number like concat('%', #{param.plateNumber}, '%')
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND t1.start_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.end_time &lt;= #{param.endTime}
</if>
ORDER BY
t1.create_time DESC
</select>

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

@ -80,4 +80,11 @@ public interface ICarService extends IService<CarEntity> {
* @return 车辆列表数据
*/
List<CarEntity> getCarListByAnnualInspectionTime(String today, String yesterday);
/**
* 根据车牌查询车辆
* @param plateNumber 车牌号
* @return 车辆列表
*/
List<CarEntity> getCarListByPlateNumber(String plateNumber);
}

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

@ -52,9 +52,9 @@ public interface ICarUsedRecordService extends IService<CarUsedRecordEntity> {
/**
* 更新用车记录
* @param carUsedRecordEntity 用车记录实体类
* @return true-成功false-失败
* @return 结果封装类
*/
boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity);
R updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity);
/**
* 导出用车记录单

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

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
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.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.CarCheckRecordDTO;
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity;
@ -28,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -190,6 +193,11 @@ public class CarCheckRecordServiceImpl extends ServiceImpl<CarCheckRecordMapper,
@Override
public void exportCarCheckRecordData(Long id, HttpServletResponse response) {
CarCheckRecordDetailVO carCheckRecordDetailVO = this.getCarCheckRecord(id);
// 数据处理
// 表头年月
String code = carCheckRecordDetailVO.getCode();
carCheckRecordDetailVO.setYear(code.substring(4, 8));
carCheckRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(carCheckRecordDetailVO);
String templateFile = "template/车辆检查表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/车辆检查表" + SafeProductConstant.DOCX_SUFFIX;

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

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
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.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.CarMaintenanceConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarEntity;
@ -27,6 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -116,6 +119,22 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
@Override
public void exportCarMaintenanceData(Long id, HttpServletResponse response) {
CarMaintenanceDetailVO carMaintenanceDetailVO = this.getCarMaintenance(id);
// 数据处理
// 图片
if (StringUtils.isNotEmpty(carMaintenanceDetailVO.getImgPath())) {
String[] imgArr = carMaintenanceDetailVO.getImgPath().split(",");
List<ImageEntity> list = new ArrayList<>();
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
carMaintenanceDetailVO.setImages(list);
}
// 表头年月
String code = carMaintenanceDetailVO.getCode();
carMaintenanceDetailVO.setYear(code.substring(4, 8));
carMaintenanceDetailVO.setMonth(code.substring(8, 10));
// 维保类型
String maintenanceType = carMaintenanceDetailVO.getMaintenanceType();
if (maintenanceType.equals(CarMaintenanceTypeEnum.MAINTAIN.getValue())) {
@ -135,8 +154,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
*/
@Override
public R updateCarMaintenance(CarMaintenanceEntity carMaintenanceEntity) {
String maintenanceStatus = carMaintenanceEntity.getMaintenanceStatus();
if (maintenanceStatus != null && maintenanceStatus.equals(CarMaintenanceStatusEnum.MAINTAINED.getValue())) {
if (carMaintenanceEntity.getConfirmationTime() != null) {
return R.fail("已确认的维保记录无法被修改");
}
return R.status(this.updateById(carMaintenanceEntity));

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

@ -9,6 +9,7 @@ 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.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.dto.CarMilesYearDTO;
import com.hnac.hzims.safeproduct.entity.CarEntity;
import com.hnac.hzims.safeproduct.enums.CarMaintenanceStatusEnum;
@ -163,7 +164,6 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
queryWrapper.lambda().eq(CarEntity::getPlateNumber, carEntity.getPlateNumber());
CarEntity car = this.getOne(queryWrapper);
if (car == null) {
carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.UNMAINTAINED.getValue());
return R.status(this.save(carEntity));
}
return R.fail("车牌号已存在");
@ -264,4 +264,17 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
.ge(CarEntity::getNextAnnualInspectionTime, yesterday);
return this.list(queryWrapper);
}
/**
* 根据车牌查询车辆
*/
@Override
public List<CarEntity> getCarListByPlateNumber(String plateNumber) {
QueryWrapper<CarEntity> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotEmpty(plateNumber)) {
queryWrapper.lambda().like(CarEntity::getPlateNumber, plateNumber);
}
queryWrapper.lambda().orderByDesc(CarEntity::getCreateTime);
return this.list(queryWrapper);
}
}

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

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
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.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.CarUsedRecordConfirmationDTO;
import com.hnac.hzims.safeproduct.entity.CarUsedRecordEntity;
@ -23,6 +25,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -97,11 +100,14 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
* 更新用车记录
*/
@Override
public boolean updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity) {
public R updateCarUsedRecord(CarUsedRecordEntity carUsedRecordEntity) {
if (carUsedRecordEntity.getConfirmationTime() != null) {
return R.fail("已确认的用车记录无法更改");
}
// 行驶公里数
BigDecimal miles = carUsedRecordEntity.getEndMiles().subtract(carUsedRecordEntity.getStartMiles());
carUsedRecordEntity.setMiles(miles);
return this.updateById(carUsedRecordEntity);
return R.status(this.updateById(carUsedRecordEntity));
}
/**
@ -110,6 +116,22 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
@Override
public void exportCarUsedRecordData(Long id, HttpServletResponse response) {
CarUsedRecordDetailVO carUsedRecordDetailVO = this.getCarUsedRecord(id);
// 数据处理
// 图片
if (StringUtils.isNotEmpty(carUsedRecordDetailVO.getImgPath())) {
String[] imgArr = carUsedRecordDetailVO.getImgPath().split(",");
List<ImageEntity> list = new ArrayList<>();
for (String img : imgArr) {
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath +
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150);
list.add(imageEntity);
}
carUsedRecordDetailVO.setImages(list);
}
// 表头年月
String code = carUsedRecordDetailVO.getCode();
carUsedRecordDetailVO.setYear(code.substring(4, 8));
carUsedRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(carUsedRecordDetailVO);
String templateFile = "template/用车记录单" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/用车记录单" + SafeProductConstant.DOCX_SUFFIX;

BIN
hzims-service/safeproduct/src/main/resources/template/用车记录单.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/车辆检查表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

Binary file not shown.
Loading…
Cancel
Save