This commit is contained in:
Vinjor 2024-11-06 18:23:52 +08:00
parent ffbf0130d6
commit a9f2a8f967
3 changed files with 39 additions and 12 deletions

View File

@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -107,17 +108,20 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
@Override
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, "该发动机号码已在系统中登记");
if(StringUtils.isEmpty(updateReqVO.getId())){
//没有车辆id才需要查重
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, "该发动机号码已在系统中登记");
}
}
}
//车俩品牌型号级联选择器返回值第一位是品牌第二位是型号

View File

@ -1,17 +1,25 @@
package cn.iocoder.yudao.module.booking.controller.admin;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -28,6 +36,9 @@ public class DlRepairBookingController {
*/
@Resource
private DlRepairBookingService dlRepairBookingService;
@Resource
private DictDataApi dictDataApi;
/**
* 维修预约表 新增修改
@ -92,9 +103,20 @@ public class DlRepairBookingController {
@GetMapping("/list")
@Operation(summary = "维修预约表 不分页")
public CommonResult<?> getBookingList(@RequestParam("userId")Integer userId){
return success(dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>()
//维修项目类型字典
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
List<DlRepairBooking> respVOList = dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>()
.eq(DlRepairBooking::getUserId,userId)
.orderByDesc(DlRepairBooking::getBookingTime)));
.orderByDesc(DlRepairBooking::getBookingTime));
List<DlRepairBookingRespVO> rtnList = new ArrayList<>();
for(DlRepairBooking booking:respVOList){
DlRepairBookingRespVO newEntity = new DlRepairBookingRespVO();
BeanUtil.copyProperties(booking,newEntity);
newEntity.setRepairText(repairTypeMap.get(newEntity.getRepairType()));
rtnList.add(newEntity);
}
return success(rtnList);
}
}

View File

@ -11,4 +11,5 @@ import lombok.Data;
**/
@Data
public class DlRepairBookingRespVO extends DlRepairBooking {
private String repairText;
}