车辆信息管理功能可用
This commit is contained in:
parent
ffbce36c30
commit
f59371ae53
@ -42,21 +42,38 @@ public class CarMainController {
|
|||||||
@Resource
|
@Resource
|
||||||
private CarMainService carMainService;
|
private CarMainService carMainService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建车辆信息
|
||||||
|
*
|
||||||
|
* @param createReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建车辆信息")
|
@Operation(summary = "创建车辆信息")
|
||||||
@PreAuthorize("@ss.hasPermission('base:car-main:create')")
|
@PreAuthorize("@ss.hasPermission('base:car-main:create')")
|
||||||
public CommonResult<String> createCarMain(@RequestBody CarMainReqVO createReqVO) {
|
public CommonResult<String> createCarMain(@RequestBody CarMainReqVO createReqVO) {
|
||||||
return success(carMainService.createCarMain(createReqVO));
|
return carMainService.createCarMain(createReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新车辆信息
|
||||||
|
*
|
||||||
|
* @param updateReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新车辆信息")
|
@Operation(summary = "更新车辆信息")
|
||||||
@PreAuthorize("@ss.hasPermission('base:car-main:update')")
|
@PreAuthorize("@ss.hasPermission('base:car-main:update')")
|
||||||
public CommonResult<Boolean> updateCarMain(@RequestBody CarMainReqVO updateReqVO) {
|
public CommonResult<String> updateCarMain(@RequestBody CarMainReqVO updateReqVO) {
|
||||||
carMainService.updateCarMain(updateReqVO);
|
return carMainService.updateCarMain(updateReqVO);
|
||||||
return success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除车辆信息")
|
@Operation(summary = "删除车辆信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@ -66,6 +83,12 @@ public class CarMainController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得车辆信息")
|
@Operation(summary = "获得车辆信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@ -75,15 +98,27 @@ public class CarMainController {
|
|||||||
return success(BeanUtils.toBean(carMain, CarMainRespVO.class));
|
return success(BeanUtils.toBean(carMain, CarMainRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆信息分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得车辆信息分页")
|
@Operation(summary = "获得车辆信息分页")
|
||||||
@PreAuthorize("@ss.hasPermission('base:car-main:query')")
|
@PreAuthorize("@ss.hasPermission('base:car-main:query')")
|
||||||
public CommonResult<IPage<CarMainRespVO>> getCarMainPage(CarMainReqVO pageReqVO) {
|
public CommonResult<IPage<CarMainRespVO>> getCarMainPage(CarMainReqVO pageReqVO) {
|
||||||
|
|
||||||
IPage<CarMainRespVO> pageResult = carMainService.getCarMainPage(pageReqVO);
|
IPage<CarMainRespVO> pageResult = carMainService.getCarMainPage(pageReqVO);
|
||||||
return success(pageResult);
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆信息
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @param response
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出车辆信息 Excel")
|
@Operation(summary = "导出车辆信息 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('base:car-main:export')")
|
@PreAuthorize("@ss.hasPermission('base:car-main:export')")
|
||||||
|
@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息 Mapper
|
* 车辆信息 Mapper
|
||||||
*
|
*
|
||||||
@ -18,7 +20,15 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CarMainMapper extends BaseMapper<CarMain> {
|
public interface CarMainMapper extends BaseMapper<CarMain> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆信息分页
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
IPage<CarMainRespVO> findPage(Page<CarMain> page, @Param("dto") CarMainReqVO pageReqVO);
|
IPage<CarMainRespVO> findPage(Page<CarMain> page, @Param("dto") CarMainReqVO pageReqVO);
|
||||||
|
|
||||||
|
List<CarMain> isDataKeyValueRepeat(@Param("dto") CarMain carMain);
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.custom.service;
|
|||||||
|
|
||||||
import javax.validation.*;
|
import javax.validation.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
|
||||||
@ -24,14 +25,14 @@ public interface CarMainService extends IService<CarMain> {
|
|||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
String createCarMain(CarMainReqVO createReqVO);
|
CommonResult<String> createCarMain(CarMainReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新车辆信息
|
* 更新车辆信息
|
||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateCarMain(CarMainReqVO updateReqVO);
|
CommonResult<String> updateCarMain(CarMainReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除车辆信息
|
* 删除车辆信息
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.custom.service;
|
package cn.iocoder.yudao.module.custom.service;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.company.entity.DlCompany;
|
|
||||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
|
||||||
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
|
||||||
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.custom.service.impl;
|
package cn.iocoder.yudao.module.custom.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||||
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
|
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
|
||||||
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
import cn.iocoder.yudao.module.custom.service.CarMainService;
|
||||||
@ -11,6 +14,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息 Service 实现类
|
* 车辆信息 Service 实现类
|
||||||
*
|
*
|
||||||
@ -19,40 +24,170 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
@Service
|
@Service
|
||||||
public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> implements CarMainService{
|
public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> implements CarMainService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建车辆信息
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String createCarMain(CarMainReqVO createReqVO) {
|
public CommonResult<String> createCarMain(CarMainReqVO createReqVO) {
|
||||||
|
//车牌号license_number,车架号vin,发动机号码engine_number 重复校验
|
||||||
|
int checkResult = isDataKeyValueRepeat(createReqVO);
|
||||||
|
//如果查重失败
|
||||||
|
if (checkResult != 0){
|
||||||
|
switch (checkResult){
|
||||||
|
case 1: return CommonResult.error(4051,"该车牌号已在系统中登记");
|
||||||
|
case 2: return CommonResult.error(4052,"该车架号已在系统中登记");
|
||||||
|
case 3: return CommonResult.error(4053,"该发动机号码已在系统中登记");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
// 插入
|
// 插入
|
||||||
CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class);
|
CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class);
|
||||||
baseMapper.insert(carMain);
|
baseMapper.insert(carMain);
|
||||||
// 返回
|
// 返回
|
||||||
return carMain.getId();
|
return CommonResult.success("新增成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新车辆信息
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateCarMain(CarMainReqVO updateReqVO){
|
public CommonResult<String> updateCarMain(CarMainReqVO updateReqVO){
|
||||||
|
//车牌号license_number,车架号vin,发动机号码engine_number 重复校验
|
||||||
|
int checkResult = isDataKeyValueRepeat(updateReqVO);
|
||||||
|
//如果查重失败
|
||||||
|
if (checkResult != 0){
|
||||||
|
switch (checkResult){
|
||||||
|
case 1: return CommonResult.error(4051,"该车牌号已在系统中登记");
|
||||||
|
case 2: return CommonResult.error(4052,"该车架号已在系统中登记");
|
||||||
|
case 3: return CommonResult.error(4053,"该发动机号码已在系统中登记");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
// 更新
|
// 更新
|
||||||
CarMain updateObj = BeanUtils.toBean(updateReqVO, CarMain.class);
|
CarMain updateObj = BeanUtils.toBean(updateReqVO, CarMain.class);
|
||||||
baseMapper.updateById(updateObj);
|
baseMapper.updateById(updateObj);
|
||||||
|
return CommonResult.success("修改成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteCarMain(String id) {
|
public void deleteCarMain(String id) {
|
||||||
// 删除
|
//判断车辆是否发生过业务
|
||||||
|
CarMain target = baseMapper.selectById(id);
|
||||||
|
if (ObjectUtil.isEmpty(target.getRecentlyHandledBusiness()) && !"".equals(target.getRecentlyHandledBusiness()) ){
|
||||||
|
|
||||||
|
}
|
||||||
|
// 逻辑删除
|
||||||
baseMapper.deleteById(id);
|
baseMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆信息
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CarMain getCarMain(String id) {
|
public CarMain getCarMain(String id) {
|
||||||
|
//数据单查
|
||||||
return baseMapper.selectById(id);
|
return baseMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆信息分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO) {
|
public IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO) {
|
||||||
|
//取分页参数
|
||||||
Page<CarMain> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
Page<CarMain> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||||
|
//分页查询
|
||||||
return baseMapper.findPage(page,pageReqVO);
|
return baseMapper.findPage(page,pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号,车架号,发动机号码 查重
|
||||||
|
* @param reqVO
|
||||||
|
* @return 0无重复,1车牌号重复,2车架号重复,发动机号码重复
|
||||||
|
*/
|
||||||
|
private int isDataKeyValueRepeat(CarMainReqVO reqVO){
|
||||||
|
|
||||||
|
//车牌号license_number 查重
|
||||||
|
if(ObjectUtil.isNotEmpty(reqVO.getLicenseNumber())){
|
||||||
|
CarMain target = new CarMain();
|
||||||
|
target.setLicenseNumber(reqVO.getLicenseNumber());
|
||||||
|
List<CarMain> results = baseMapper.isDataKeyValueRepeat(target);
|
||||||
|
//判断是否登记过这个车牌号的车辆
|
||||||
|
if (results.size()>0){
|
||||||
|
//无id是新增,有相应登记记录
|
||||||
|
if(ObjectUtil.isEmpty(reqVO.getId()) ){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//有id是修改,如果登记过,比较id查验是否是当前要修改的车辆本身
|
||||||
|
for (CarMain item: results) {
|
||||||
|
if (!item.getId().equals(reqVO.getId())){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//车架号vin 查重
|
||||||
|
}else if (ObjectUtil.isNotEmpty(reqVO.getVin())){
|
||||||
|
CarMain target = new CarMain();
|
||||||
|
target.setVin(reqVO.getVin());
|
||||||
|
List<CarMain> results = baseMapper.isDataKeyValueRepeat(target);
|
||||||
|
//判断是否登记过这个车架号的车辆
|
||||||
|
if (results.size()>0){
|
||||||
|
//无id是新增,有相应登记记录
|
||||||
|
if(ObjectUtil.isEmpty(reqVO.getId()) ){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
//有id是修改,如果登记过,比较id查验是否是当前要修改的车辆本身
|
||||||
|
for (CarMain item: results) {
|
||||||
|
if (!item.getId().equals(reqVO.getId())){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//发动机号码engine_number 查重
|
||||||
|
}else if (ObjectUtil.isNotEmpty(reqVO.getEngineNumber())){
|
||||||
|
CarMain target = new CarMain();
|
||||||
|
target.setEngineNumber(reqVO.getEngineNumber());
|
||||||
|
List<CarMain> results = baseMapper.isDataKeyValueRepeat(target);
|
||||||
|
//判断是否登记过这个发动机号的车辆
|
||||||
|
if (results.size()>0){
|
||||||
|
//无id是新增,有相应登记记录
|
||||||
|
if(ObjectUtil.isEmpty(reqVO.getId()) ){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
//有id是修改,如果登记过,比较id查验是否是当前要修改的车辆本身
|
||||||
|
for (CarMain item: results) {
|
||||||
|
if (!item.getId().equals(reqVO.getId())){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//返回查验无重复结果
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.custom.vo;
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 车辆信息分页 Request VO")
|
@Schema(description = "管理后台 - 车辆信息分页 Request VO")
|
||||||
@ -30,22 +30,22 @@ public class CarMainReqVO extends PageParam {
|
|||||||
private String carModel;
|
private String carModel;
|
||||||
|
|
||||||
@Schema(description = "保养日期")
|
@Schema(description = "保养日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime maintenanceDate;
|
private LocalDateTime maintenanceDate;
|
||||||
|
|
||||||
@Schema(description = "保养里程")
|
@Schema(description = "保养里程")
|
||||||
private String maintenanceMileage;
|
private String maintenanceMileage;
|
||||||
|
|
||||||
@Schema(description = "年检日期")
|
@Schema(description = "年检日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime inspectionDate;
|
private LocalDateTime inspectionDate;
|
||||||
|
|
||||||
@Schema(description = "保险日期")
|
@Schema(description = "保险日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime insuranceDate;
|
private LocalDateTime insuranceDate;
|
||||||
|
|
||||||
@Schema(description = "二级维护时间")
|
@Schema(description = "二级维护时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime checkDate;
|
private LocalDateTime checkDate;
|
||||||
|
|
||||||
@Schema(description = "车辆品牌")
|
@Schema(description = "车辆品牌")
|
||||||
@ -58,7 +58,7 @@ public class CarMainReqVO extends PageParam {
|
|||||||
private String carCategory;
|
private String carCategory;
|
||||||
|
|
||||||
@Schema(description = "车辆注册日期")
|
@Schema(description = "车辆注册日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime carRegisterDate;
|
private LocalDateTime carRegisterDate;
|
||||||
|
|
||||||
@Schema(description = "行驶证图片")
|
@Schema(description = "行驶证图片")
|
||||||
@ -68,11 +68,11 @@ public class CarMainReqVO extends PageParam {
|
|||||||
private String recentlyHandledBusiness;
|
private String recentlyHandledBusiness;
|
||||||
|
|
||||||
@Schema(description = "最近办理业务的时间")
|
@Schema(description = "最近办理业务的时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime recentlyHandleBusinessTime;
|
private LocalDateTime recentlyHandleBusinessTime;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Schema(description = "租户ID")
|
@Schema(description = "租户ID")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.custom.vo;
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -12,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Schema(description = "管理后台 - 车辆信息 Response VO")
|
@Schema(description = "管理后台 - 车辆信息 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class CarMainRespVO {
|
public class CarMainRespVO extends CarMain {
|
||||||
|
|
||||||
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
|
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
|
||||||
@ExcelProperty("主键标识")
|
@ExcelProperty("主键标识")
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package cn.iocoder.yudao.utils.CarMain;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
public class GetNextBusinessTimeUtils {
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 取下次保养日期
|
||||||
|
// *
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public static LocalDateTime getNextMaintenanceDate(CarMain target){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 取下次保养里程
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public static Long getNextMaintenanceMileage(CarMain target){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 下次年检日期
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public static LocalDateTime getNextMaintenanceDate(CarMain target){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 保险到期日期
|
||||||
|
// */
|
||||||
|
// public static LocalDateTime getInsuranceExpiryDate(CarMain target){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 下次二级维护时间
|
||||||
|
// */
|
||||||
|
// public static LocalDateTime getNextCheckDate(CarMain target){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,188 @@
|
|||||||
|
package cn.iocoder.yudao.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
|
{
|
||||||
|
public static String YYYY = "yyyy";
|
||||||
|
|
||||||
|
public static String YYYY_MM = "yyyy-MM";
|
||||||
|
|
||||||
|
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
|
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
private static String[] parsePatterns = {
|
||||||
|
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||||
|
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||||
|
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前Date型日期
|
||||||
|
*
|
||||||
|
* @return Date() 当前日期
|
||||||
|
*/
|
||||||
|
public static Date getNowDate()
|
||||||
|
{
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前日期, 默认格式为yyyy-MM-dd
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String getDate()
|
||||||
|
{
|
||||||
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String getTime()
|
||||||
|
{
|
||||||
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTimeNow()
|
||||||
|
{
|
||||||
|
return dateTimeNow(YYYYMMDDHHMMSS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTimeNow(final String format)
|
||||||
|
{
|
||||||
|
return parseDateToStr(format, new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String dateTime(final Date date)
|
||||||
|
{
|
||||||
|
return parseDateToStr(YYYY_MM_DD, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String parseDateToStr(final String format, final Date date)
|
||||||
|
{
|
||||||
|
return new SimpleDateFormat(format).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Date dateTime(final String format, final String ts)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new SimpleDateFormat(format).parse(ts);
|
||||||
|
}
|
||||||
|
catch (ParseException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期路径 即年/月/日 如2018/08/08
|
||||||
|
*/
|
||||||
|
public static final String datePath()
|
||||||
|
{
|
||||||
|
Date now = new Date();
|
||||||
|
return DateFormatUtils.format(now, "yyyy/MM/dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期路径 即年/月/日 如20180808
|
||||||
|
*/
|
||||||
|
public static final String dateTime()
|
||||||
|
{
|
||||||
|
Date now = new Date();
|
||||||
|
return DateFormatUtils.format(now, "yyyyMMdd");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期型字符串转化为日期 格式
|
||||||
|
*/
|
||||||
|
public static Date parseDate(Object str)
|
||||||
|
{
|
||||||
|
if (str == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return parseDate(str.toString(), parsePatterns);
|
||||||
|
}
|
||||||
|
catch (ParseException e)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务器启动时间
|
||||||
|
*/
|
||||||
|
public static Date getServerStartDate()
|
||||||
|
{
|
||||||
|
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||||
|
return new Date(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算相差天数
|
||||||
|
*/
|
||||||
|
public static int differentDaysByMillisecond(Date date1, Date date2)
|
||||||
|
{
|
||||||
|
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算时间差
|
||||||
|
*
|
||||||
|
* @param endDate 最后时间
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @return 时间差(天/小时/分钟)
|
||||||
|
*/
|
||||||
|
public static String timeDistance(Date endDate, Date startTime)
|
||||||
|
{
|
||||||
|
long nd = 1000 * 24 * 60 * 60;
|
||||||
|
long nh = 1000 * 60 * 60;
|
||||||
|
long nm = 1000 * 60;
|
||||||
|
// long ns = 1000;
|
||||||
|
// 获得两个时间的毫秒时间差异
|
||||||
|
long diff = endDate.getTime() - startTime.getTime();
|
||||||
|
// 计算差多少天
|
||||||
|
long day = diff / nd;
|
||||||
|
// 计算差多少小时
|
||||||
|
long hour = diff % nd / nh;
|
||||||
|
// 计算差多少分钟
|
||||||
|
long min = diff % nd % nh / nm;
|
||||||
|
// 计算差多少秒//输出结果
|
||||||
|
// long sec = diff % nd % nh % nm / ns;
|
||||||
|
return day + "天" + hour + "小时" + min + "分钟";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加 LocalDateTime ==> Date
|
||||||
|
*/
|
||||||
|
public static Date toDate(LocalDateTime temporalAccessor)
|
||||||
|
{
|
||||||
|
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
|
||||||
|
return Date.from(zdt.toInstant());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加 LocalDate ==> Date
|
||||||
|
*/
|
||||||
|
public static Date toDate(LocalDate temporalAccessor)
|
||||||
|
{
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
|
||||||
|
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||||
|
return Date.from(zdt.toInstant());
|
||||||
|
}
|
||||||
|
}
|
@ -2,69 +2,91 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CarMainMapper">
|
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CarMainMapper">
|
||||||
|
|
||||||
<!--
|
<sql id="baseCarMainColumn">
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
tbcm.id,
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
tbcm.engine_number,
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
tbcm.vin,
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
tbcm.license_number,
|
||||||
-->
|
tbcm.car_model,
|
||||||
<sql id="column">
|
tbcm.maintenance_date,
|
||||||
id,
|
tbcm.maintenance_mileage,
|
||||||
engine_number,
|
tbcm.inspection_date,
|
||||||
vin,
|
tbcm.insurance_date,
|
||||||
license_number,
|
tbcm.check_date,
|
||||||
car_model,
|
tbcm.next_maintenance_date,
|
||||||
maintenance_date,
|
tbcm.next_maintenance_mileage,
|
||||||
maintenance_mileage,
|
tbcm.next_inspection_date,
|
||||||
inspection_date,
|
tbcm.insurance_expiry_date,
|
||||||
insurance_date,
|
tbcm.next_check_date,
|
||||||
check_date,
|
tbcm.car_brand,
|
||||||
next_maintenance_date,
|
tbcm.car_nature,
|
||||||
next_maintenance_mileage,
|
tbcm.car_category,
|
||||||
next_inspection_date,
|
tbcm.car_register_date,
|
||||||
insurance_expiry_date,
|
tbcm.car_license_img,
|
||||||
next_check_date,
|
tbcm.recently_handled_business,
|
||||||
car_brand,
|
tbcm.recently_handle_business_time,
|
||||||
car_nature,
|
tbcm.deleted,
|
||||||
car_category,
|
tbcm.creator,
|
||||||
car_register_date,
|
tbcm.create_time,
|
||||||
car_license_img,
|
tbcm.updater,
|
||||||
recently_handled_business,
|
tbcm.update_time
|
||||||
recently_handle_business_time,
|
|
||||||
deleted,
|
|
||||||
creator,
|
|
||||||
create_time,
|
|
||||||
updater,
|
|
||||||
update_time
|
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="column"></include>
|
<include refid="baseCarMainColumn"></include>
|
||||||
FROM `base_car_main`
|
FROM `base_car_main` tbcm
|
||||||
WHERE
|
WHERE
|
||||||
deleted = 0
|
tbcm.deleted = 0
|
||||||
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
|
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
|
||||||
AND license_number LIKE CONCAT('%',#{dto.licenseNumber},'%')
|
AND tbcm.license_number LIKE CONCAT('%',#{dto.licenseNumber},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.carBrand != null and dto.carBrand != ''">
|
<if test="dto.carBrand != null and dto.carBrand != ''">
|
||||||
AND car_brand = #{dto.carBrand}
|
AND tbcm.car_brand = #{dto.carBrand}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.carCategory != null and dto.carCategory != ''">
|
<if test="dto.carCategory != null and dto.carCategory != ''">
|
||||||
AND car_category = #{dto.carCategory}
|
AND tbcm.car_category = #{dto.carCategory}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
||||||
AND recently_handled_business = #{dto.recentlyHandledBusiness}
|
AND tbcm.recently_handled_business = #{dto.recentlyHandledBusiness}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.recentlyHandleBusinessTime != null">
|
<if test="dto.recentlyHandleBusinessTime != null">
|
||||||
AND recently_handle_business_time = #{dto.recentlyHandleBusinessTime}
|
AND tbcm.recently_handle_business_time = #{dto.recentlyHandleBusinessTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.vin != null and dto.vin != ''">
|
<if test="dto.vin != null and dto.vin != ''">
|
||||||
AND vin LIKE CONCAT('%',#{dto.vin},'%')
|
AND tbcm.vin LIKE CONCAT('%',#{dto.vin},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
||||||
AND tenant_id = #{dto.tenant}
|
AND tbcm.tenant_id = #{dto.tenant}
|
||||||
|
</if>
|
||||||
|
<if test="dto.carModel != null and dto.carModel != ''">
|
||||||
|
AND tbcm.car_model = #{dto.carModel}
|
||||||
|
</if>
|
||||||
|
<if test="dto.carNature != null and dto.carNature != ''">
|
||||||
|
AND tbcm.car_nature = #{dto.carNature}
|
||||||
|
</if>
|
||||||
|
<if test="dto.engineNumber != null and dto.engineNumber != ''">
|
||||||
|
AND tbcm.engine_number LIKE CONCAT('%',#{dto.engineNumber},'%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
ORDER BY
|
||||||
|
tbcm.car_register_date DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="isDataKeyValueRepeat" resultType="cn.iocoder.yudao.module.custom.entity.CarMain">
|
||||||
|
SELECT
|
||||||
|
tbcm.id
|
||||||
|
FROM `base_car_main` tbcm
|
||||||
|
WHERE
|
||||||
|
tbcm.deleted = 0
|
||||||
|
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
|
||||||
|
AND tbcm.license_number = #{dto.licenseNumber}
|
||||||
|
</if>
|
||||||
|
<if test="dto.vin != null and dto.vin != ''">
|
||||||
|
AND tbcm.vin = #{dto.vin}
|
||||||
|
</if>
|
||||||
|
<if test="dto.engineNumber != null and dto.engineNumber != ''">
|
||||||
|
AND tbcm.engine_number = #{dto.engineNumber}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
Reference in New Issue
Block a user