@@ -24,13 +24,6 @@ public class ActiveController extends MyValidController { | |||
@Autowired | |||
private ActiveManager manager; | |||
@ApiOperation(value = "新增激活记录") | |||
@PostMapping(value = "/saveRecord") | |||
public ApiResponse<SaveRecordResponseDTO> saveRecord(@Valid @RequestBody SaveRecordRequestDTO reqDto) throws ManagerException { | |||
SaveRecordResponseDTO resDto = manager.saveRecord(reqDto); | |||
return ApiResponse.of(resDto).setMessage("添加成功"); | |||
} | |||
@ApiOperation(value = "查询可激活车辆列表") | |||
@PostMapping(value = "/queryVehicle") | |||
public ApiResponse<QueryVehicleResponseDTO> queryVehicle(@Valid @RequestBody QueryVehicleRequestDTO reqDto) throws ManagerException { | |||
@@ -51,4 +44,11 @@ public class ActiveController extends MyValidController { | |||
manager.checkSendCode(reqDto); | |||
return ApiResponse.success().setMessage("操作成功"); | |||
} | |||
@ApiOperation(value = "是否可重置") | |||
@PostMapping(value = "/checkCanActive") | |||
public ApiResponse<CheckCanActiveResponse> checkCanActive(@Valid @RequestBody CheckCanActiveRequest reqDto) throws ServiceHandleException { | |||
CheckCanActiveResponse response = manager.checkCanActive(reqDto); | |||
return ApiResponse.of(response).setMessage("操作成功"); | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package cn.com.taiji.iaw.dto.ass.active; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class CheckCanActiveRequest extends AbstractBizRequestDTO { | |||
@NotBlank(message = "手机号码不能为空") | |||
private String vehiclePlate;//车牌号 | |||
@NotNull(message = "车牌颜色不能为空") | |||
private Integer vehiclePlateColor;//车牌颜色 | |||
@NotBlank(message = "etc卡号不能为空") | |||
private String cardId;// etc卡号 | |||
@NotBlank(message = "OBU号不能为空") | |||
private String obuId;// OBU号 | |||
} |
@@ -0,0 +1,14 @@ | |||
package cn.com.taiji.iaw.dto.ass.active; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class CheckCanActiveResponse extends BaseModel { | |||
} |
@@ -12,4 +12,5 @@ public interface ActiveManager { | |||
QueryVehicleResponseDTO queryVehicle(QueryVehicleRequestDTO requestDTO) throws ManagerException; | |||
ActivateDetailsResponseDTO saveRecords(ActivateDetailsRequestDTO requestDTO) throws ManagerException; | |||
void checkSendCode(CheckCodeRequest request) throws ManagerException; | |||
CheckCanActiveResponse checkCanActive(CheckCanActiveRequest request) throws ServiceHandleException; | |||
} |
@@ -4,6 +4,7 @@ import java.time.LocalDateTime; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.entity.basic.QtkObuInfo; | |||
import cn.com.taiji.core.entity.dict.basic.CardStatus; | |||
import cn.com.taiji.core.entity.dict.basic.ObuStatus; | |||
@@ -186,4 +187,14 @@ public class ActiveManagerImpl extends AbstractCommManager implements ActiveMana | |||
if (!smsCode.equals(request.getCode())) | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("短信验证码错误!"); | |||
} | |||
@Override | |||
public CheckCanActiveResponse checkCanActive(CheckCanActiveRequest request) throws ServiceHandleException { | |||
CheckCanActiveResponse response = new CheckCanActiveResponse(); | |||
List<ActiveRecord> activeRecords = recordRepo.listByVehicleAndStatus(request.getVehiclePlate(), request.getVehiclePlateColor(), request.getCardId(), request.getObuId(),0); | |||
if (!activeRecords.isEmpty() && activeRecords.size() > 5){ | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("短信验证码已过期,请重新发送"); | |||
} | |||
return response; | |||
} | |||
} |