Commit 6d50a7f4 authored by jiaorz's avatar jiaorz

添加积分补充接口

parent 54bae5c0
package com.github.wxiaoqi.security.common.util;
import org.apache.commons.lang3.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringToolsUtil {
/**
* 验证手机号码
* @param mobiles
* @return
*/
public static boolean isMobileNO( String mobiles){
boolean flag = false;
try{
if(StringUtils.isBlank(mobiles)) {
flag = false;
}
Pattern regex = Pattern.compile("^((16[0-9])|(13[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$");
Matcher m = regex .matcher(mobiles);
flag = m.matches();
}catch(Exception e){
flag = false;
}
return flag;
}
/**
* 校验身份证
*
* @param idCard
* @return 校验通过返回true,否则返回false
*/
public static boolean isIDCard(String idCard) {
if(StringUtils.isBlank(idCard)) {
return false;
}
String REGEX_ID_CARD = "(^\\d{18}$)|(^\\d{15}$)";
return Pattern.matches(REGEX_ID_CARD, idCard);
}
}
......@@ -24,6 +24,8 @@ public enum ResCode {
VEHICLE_BOOKED_RECORD_STATUS_CHANGED(103002,"车辆预定申请状态已变更"),
VEHICLE_BOOKED_RECORD_MILEAGE_CHANGED(103003,"请输入仪表盘内当前显示的公里数"),
CHECKUSER_AND_PHONE_NOT_NULL(103999, "收车或交车人姓名和电话不能为空"),
USERNAME_AND_TELE_NOT_NULL(104000, "使用人和电话不能为空"),
VEHICLE_DEPARTURE_VEHICLE_UNEXIST(104001,"车辆不存在"),
VEHICLE_DEPARTURE_VEHICLE_DISABLE(104002,"车辆不可用"),
VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE(104003,"车辆未出车"),
......
......@@ -10,6 +10,7 @@ import com.xxfc.platform.vehicle.constant.VehicleStatus;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.mapper.*;
import com.xxfc.platform.vehicle.pojo.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -55,6 +56,14 @@ public class VehicleActiveService {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
}
if(StringUtils.isBlank(departureVo.getUser()) || StringUtils.isBlank(departureVo.getUserTel())) {
throw new BaseException(ResCode.USERNAME_AND_TELE_NOT_NULL.getDesc(),
ResCode.USERNAME_AND_TELE_NOT_NULL.getCode());
}
if(StringUtils.isBlank(departureVo.getCheckMan()) || StringUtils.isBlank(departureVo.getCheckManTel())) {
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
}
if (!vehicle.getStatus().equals(VehicleStatus.NORMAL.getCode())) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()),
ResCode.VEHICLE_DEPARTURE_VEHICLE_DISABLE.getCode());
......@@ -155,6 +164,10 @@ public class VehicleActiveService {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getDesc(),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNEXIST.getCode());
}
if(StringUtils.isBlank(arrivalVo.getRecycleMan()) || StringUtils.isBlank(arrivalVo.getRecycleManTel())) {
throw new BaseException(ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getDesc(),
ResCode.CHECKUSER_AND_PHONE_NOT_NULL.getCode());
}
if (!vehicle.getStatus().equals(VehicleStatus.DEPARTURE.getCode())) {
throw new BaseException(ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getDesc() + ", 车辆状态是:" + getVehicleStatus(vehicle.getStatus(), vehicle.getId()),
ResCode.VEHICLE_DEPARTURE_VEHICLE_UNDEPARTURE.getCode());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment