|
@@ -106,6 +106,12 @@ public class BizVehicleServiceImpl extends ServiceImpl<BizVehicleMapper, BizVehi
|
|
|
throw new CommonException("手机号码:{}格式错误", bizVehicleAddParam.getDriverMobile());
|
|
|
}
|
|
|
}
|
|
|
+ long count = this.count(new QueryWrapper<BizVehicle>().lambda().
|
|
|
+ eq(BizVehicle::getCreateUser, StpLoginUserUtil.getLoginUser().getId()).
|
|
|
+ eq(BizVehicle::getStatus, "1"));
|
|
|
+ if(count>0){
|
|
|
+ throw new CommonException("已添加过启用得车辆信息");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void checkParam(BizVehicleEditParam bizVehicleEditParam,BizVehicle bizVehicle){
|
|
@@ -123,6 +129,13 @@ public class BizVehicleServiceImpl extends ServiceImpl<BizVehicleMapper, BizVehi
|
|
|
if(count>0){
|
|
|
throw new CommonException("车牌号:{}已经添加过!",bizVehicleEditParam.getLicensePlate());
|
|
|
}
|
|
|
+ long sum = this.count(new QueryWrapper<BizVehicle>().lambda().
|
|
|
+ eq(BizVehicle::getCreateUser, StpLoginUserUtil.getLoginUser().getId()).
|
|
|
+ eq(BizVehicle::getStatus, "1").
|
|
|
+ ne(BizVehicle::getLicensePlate,bizVehicle.getLicensePlate()));
|
|
|
+ if(sum>0){
|
|
|
+ throw new CommonException("已添加过启用得车辆信息");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//校验司机电话
|
|
@@ -132,15 +145,22 @@ public class BizVehicleServiceImpl extends ServiceImpl<BizVehicleMapper, BizVehi
|
|
|
}
|
|
|
}
|
|
|
//启用时校验修改状态
|
|
|
- if(StringUtils.equals(bizVehicleEditParam.getStatus(),"1")){
|
|
|
- long count = this.count(new QueryWrapper<BizVehicle>().lambda().
|
|
|
- eq(BizVehicle::getLicensePlate, bizVehicleEditParam.getLicensePlate()).
|
|
|
- eq(BizVehicle::getStatus, "1"));
|
|
|
- if(count>0){
|
|
|
- throw new CommonException("车牌号:{}已经添加过!",bizVehicleEditParam.getLicensePlate());
|
|
|
+ if(!StringUtils.equals(bizVehicle.getStatus(),bizVehicleEditParam.getStatus())){
|
|
|
+ if(StringUtils.equals(bizVehicleEditParam.getStatus(),"1")){
|
|
|
+ long count = this.count(new QueryWrapper<BizVehicle>().lambda().
|
|
|
+ eq(BizVehicle::getLicensePlate, bizVehicleEditParam.getLicensePlate()).
|
|
|
+ eq(BizVehicle::getStatus, "1"));
|
|
|
+ if(count>0){
|
|
|
+ throw new CommonException("车牌号:{}已经添加过!",bizVehicleEditParam.getLicensePlate());
|
|
|
+ }
|
|
|
+ long sum = this.count(new QueryWrapper<BizVehicle>().lambda().
|
|
|
+ eq(BizVehicle::getCreateUser, StpLoginUserUtil.getLoginUser().getId()).
|
|
|
+ eq(BizVehicle::getStatus, "1"));
|
|
|
+ if(sum>0){
|
|
|
+ throw new CommonException("已添加过启用得车辆信息");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|