|
|
@@ -1,13 +1,24 @@ |
|
|
|
package cn.com.taiji.iaw.manager.vfj; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.ManagerException; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
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; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.inss.vfj.*; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkObuInfoRepo; |
|
|
|
import cn.com.taiji.iaw.dto.vfj.*; |
|
|
|
import cn.com.taiji.iaw.manager.AbstractCommManager; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class VfjManagerImpl extends AbstractCommManager implements VfjManager { |
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo qtkCardInfoRepo; |
|
|
|
@Autowired |
|
|
|
private QtkObuInfoRepo qtkObuInfoRepo; |
|
|
|
|
|
|
|
@Override |
|
|
|
public VfjGetVehicleInfoClearResponseDTO handle(VfjGetVehicleInfoClearRequestDTO dto) throws ManagerException { |
|
|
@@ -71,8 +82,18 @@ public class VfjManagerImpl extends AbstractCommManager implements VfjManager { |
|
|
|
|
|
|
|
@Override |
|
|
|
public VfjObuActiveResponseDTO handle(VfjObuActiveRequestDTO dto) throws ManagerException { |
|
|
|
QtkCardInfo cardInfo = qtkCardInfoRepo.findByVehicleIdAndCardStatus(dto.getVehicleId(), CardStatus.ZC); |
|
|
|
if (cardInfo == null) throw new ManagerException("不存在正常状态的卡"); |
|
|
|
if (!dto.getCardId().equals(cardInfo.getCardId())) |
|
|
|
throw new ManagerException("设备中的卡号与车辆关联的卡号不一致"); |
|
|
|
QtkObuInfo obuInfo = qtkObuInfoRepo.findByVehicleIdAndObuStatus(dto.getVehicleId(), ObuStatus.ZC); |
|
|
|
if (obuInfo == null) throw new ManagerException("不存在正常状态的OBU"); |
|
|
|
if (!dto.getObuId().equals(obuInfo.getObuId())) |
|
|
|
throw new ManagerException("设备中的OBU编号与车辆关联的OBU编号不一致"); |
|
|
|
VfjObuActiveRequest request = new VfjObuActiveRequest(); |
|
|
|
copyProperties(dto, request); |
|
|
|
request.setFlag("0001"); |
|
|
|
request.setContractSn(dto.getObuId()); |
|
|
|
request.setRandom(dto.getRandom()); |
|
|
|
VfjObuActiveResponse response = jsonPostRepeat(request); |
|
|
|
VfjObuActiveResponseDTO resDto = new VfjObuActiveResponseDTO(); |
|
|
|
copyProperties(response, resDto); |