|
|
@@ -3,19 +3,27 @@ package cn.com.taiji.managew.manager.ass; |
|
|
|
import cn.com.taiji.common.manager.ManagerException; |
|
|
|
import cn.com.taiji.common.model.dao.Pagination; |
|
|
|
import cn.com.taiji.core.entity.ass.AssOrderinfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCustomerInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkObuInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkVehicleInfo; |
|
|
|
import cn.com.taiji.core.entity.dict.ass.AssOrderType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.CardStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.ObuStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.SourceType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.VehicleType; |
|
|
|
import cn.com.taiji.core.entity.dict.log.OperateType; |
|
|
|
import cn.com.taiji.core.entity.user.Staff; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ass.*; |
|
|
|
import cn.com.taiji.core.repo.jpa.ass.AssOrderinfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkCustomerInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkObuInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkVehicleInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.user.StaffRepo; |
|
|
|
import cn.com.taiji.managew.dto.ass.AssDeviceLossPageReqDTO; |
|
|
|
import cn.com.taiji.managew.dto.ass.AssDeviceLossPageResDTO; |
|
|
|
import cn.com.taiji.managew.dto.ass.AssDeviceLossReqDTO; |
|
|
|
import cn.com.taiji.managew.dto.ass.*; |
|
|
|
import cn.com.taiji.managew.manager.AbstractManagewManager; |
|
|
|
import cn.com.taiji.managew.model.ass.CardObuInfoModel; |
|
|
|
import cn.com.taiji.managew.repo.jpa.request.ass.AssDeviceLossPageRequest; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@@ -33,6 +41,12 @@ public class AssDeviceLossManagerImpl extends AbstractManagewManager implements |
|
|
|
private QtkVehicleInfoRepo vehicleInfoRepo; |
|
|
|
@Autowired |
|
|
|
private StaffRepo staffRepo; |
|
|
|
@Autowired |
|
|
|
private QtkCustomerInfoRepo customerInfoRepo; |
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo cardInfoRepo; |
|
|
|
@Autowired |
|
|
|
private QtkObuInfoRepo obuInfoRepo; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void loss(AssDeviceLossReqDTO reqDto) throws ManagerException { |
|
|
@@ -101,7 +115,7 @@ public class AssDeviceLossManagerImpl extends AbstractManagewManager implements |
|
|
|
AssDeviceLossPageRequest request = new AssDeviceLossPageRequest(); |
|
|
|
BeanUtils.copyProperties(reqDto, request); |
|
|
|
if (hasText(reqDto.getVehiclePlate()) && hasText(reqDto.getVehiclePlateColor())) { |
|
|
|
request.setVehicleId(reqDto.getVehiclePlate() + "_" + reqDto.getVehiclePlate()); |
|
|
|
request.setVehicleId(reqDto.getVehiclePlate() + "_" + reqDto.getVehiclePlateColor()); |
|
|
|
} |
|
|
|
|
|
|
|
List<AssOrderType> orderTypes = new ArrayList<>(); |
|
|
@@ -109,20 +123,20 @@ public class AssDeviceLossManagerImpl extends AbstractManagewManager implements |
|
|
|
//1-挂失,2-解挂 |
|
|
|
if ("1".equals(reqDto.getLossType())) { |
|
|
|
orderTypes.add(AssOrderType.LOSS); |
|
|
|
orderTypes.add(AssOrderType.CARD_LOSS); |
|
|
|
orderTypes.add(AssOrderType.OBU_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.CARD_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.OBU_LOSS); |
|
|
|
} else { |
|
|
|
orderTypes.add(AssOrderType.RELEASE_LOSS); |
|
|
|
orderTypes.add(AssOrderType.CARD_RELEASE_LOSS); |
|
|
|
orderTypes.add(AssOrderType.OBU_RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.CARD_RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.OBU_RELEASE_LOSS); |
|
|
|
} |
|
|
|
}else { |
|
|
|
orderTypes.add(AssOrderType.LOSS); |
|
|
|
orderTypes.add(AssOrderType.CARD_LOSS); |
|
|
|
orderTypes.add(AssOrderType.OBU_LOSS); |
|
|
|
orderTypes.add(AssOrderType.RELEASE_LOSS); |
|
|
|
orderTypes.add(AssOrderType.CARD_RELEASE_LOSS); |
|
|
|
orderTypes.add(AssOrderType.OBU_RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.CARD_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.OBU_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.CARD_RELEASE_LOSS); |
|
|
|
// orderTypes.add(AssOrderType.OBU_RELEASE_LOSS); |
|
|
|
} |
|
|
|
request.setOrderTypes(orderTypes); |
|
|
|
return orderInfoRepo.page(request).convertResult(this::toModel); |
|
|
@@ -144,13 +158,17 @@ public class AssDeviceLossManagerImpl extends AbstractManagewManager implements |
|
|
|
model.setVehicleType(vehicleInfo.getVehicleType()); |
|
|
|
} |
|
|
|
} |
|
|
|
//处理订单类型 |
|
|
|
if (orderInfo.getOrderType() == AssOrderType.LOSS || orderInfo.getOrderType() == AssOrderType.CARD_LOSS || orderInfo.getOrderType() == AssOrderType.OBU_LOSS) { |
|
|
|
model.setOrderType("挂失"); |
|
|
|
} |
|
|
|
if (orderInfo.getOrderType() == AssOrderType.RELEASE_LOSS || orderInfo.getOrderType() == AssOrderType.CARD_RELEASE_LOSS || orderInfo.getOrderType() == AssOrderType.OBU_RELEASE_LOSS) { |
|
|
|
model.setOrderType("解挂"); |
|
|
|
//处理证件类型 |
|
|
|
if (orderInfo.getCustomerIdType() != null) { |
|
|
|
model.setCustomerIdType(orderInfo.getCustomerIdType().getCode()+""); |
|
|
|
} |
|
|
|
//处理订单类型 |
|
|
|
// if (orderInfo.getOrderType() == AssOrderType.LOSS || orderInfo.getOrderType() == AssOrderType.CARD_LOSS || orderInfo.getOrderType() == AssOrderType.OBU_LOSS) { |
|
|
|
// model.setOrderType("挂失"); |
|
|
|
// } |
|
|
|
// if (orderInfo.getOrderType() == AssOrderType.RELEASE_LOSS || orderInfo.getOrderType() == AssOrderType.CARD_RELEASE_LOSS || orderInfo.getOrderType() == AssOrderType.OBU_RELEASE_LOSS) { |
|
|
|
// model.setOrderType("解挂"); |
|
|
|
// } |
|
|
|
//处理操作人,用审核人 |
|
|
|
if (orderInfo.getOrderSource() == SourceType.WECHAT) { |
|
|
|
model.setAuditName(orderInfo.getCustomerName()); |
|
|
@@ -163,4 +181,72 @@ public class AssDeviceLossManagerImpl extends AbstractManagewManager implements |
|
|
|
} |
|
|
|
return model; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public AssBaseInfoQueryResponseDTO query(AssBaseInfoQueryRequestDTO dto) throws ManagerException { |
|
|
|
// 查询车辆信息 |
|
|
|
QtkVehicleInfo vehicle = vehicleInfoRepo.findByVehicleId(dto.getVehicleId()); |
|
|
|
if (vehicle == null) { |
|
|
|
throw new ManagerException("未获取到车辆信息!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询用户信息 |
|
|
|
QtkCustomerInfo customer = customerInfoRepo.findByCustomerId(vehicle.getCustomerId()); |
|
|
|
if (customer == null) { |
|
|
|
throw new ManagerException("未获取到用户信息!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 状态过滤卡和OBU |
|
|
|
CardStatus[] cardStatus = new CardStatus[1]; |
|
|
|
ObuStatus[] obuStatus = new ObuStatus[1]; |
|
|
|
if ("1".equals(dto.getStatus())) { |
|
|
|
cardStatus[0] = CardStatus.ZC; |
|
|
|
obuStatus[0] = ObuStatus.ZC; |
|
|
|
} else { |
|
|
|
cardStatus[0] = CardStatus.KGS; |
|
|
|
obuStatus[0] = ObuStatus.BQGS; |
|
|
|
} |
|
|
|
|
|
|
|
// 查询卡和OBU信息 |
|
|
|
List<QtkCardInfo> cardInfos = cardInfoRepo.listByVehicleIdInUse(dto.getVehicleId(), cardStatus); |
|
|
|
if (cardInfos.isEmpty()) { |
|
|
|
throw new ManagerException("未获取到卡信息!"); |
|
|
|
} |
|
|
|
List<QtkObuInfo> obuInfos = obuInfoRepo.listObuByVehicleIdInUse(dto.getVehicleId(), obuStatus); |
|
|
|
if (obuInfos.isEmpty()) { |
|
|
|
throw new ManagerException("未获取到OBU信息!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 卡OBU信息 |
|
|
|
List<CardObuInfoModel> cardObuInfos = new ArrayList<>(); |
|
|
|
for (QtkCardInfo card : cardInfos) { |
|
|
|
for (QtkObuInfo obu : obuInfos) { |
|
|
|
if (card.getVehicleId().equals(obu.getVehicleId())) { |
|
|
|
CardObuInfoModel model = new CardObuInfoModel(); |
|
|
|
model.setCardId(card.getCardId()); |
|
|
|
model.setCardType(card.getCardTypeNew() != null ? card.getCardTypeNew().getValue() : null); |
|
|
|
model.setCardStatus(card.getCardStatus() != null ? card.getCardStatus().getValue() : null); |
|
|
|
model.setObuId(obu.getObuId()); |
|
|
|
model.setObuType(obu.getObuType() != null ? obu.getObuType().getValue() : null); |
|
|
|
model.setObuStatus(obu.getObuStatus() != null ? obu.getObuStatus().getValue() : null); |
|
|
|
cardObuInfos.add(model); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 响应 |
|
|
|
AssBaseInfoQueryResponseDTO response = new AssBaseInfoQueryResponseDTO(); |
|
|
|
response.setCustomerName(customer.getCustomerName()); |
|
|
|
response.setCustomerIdType(customer.getCustomerIdType().getValue()); |
|
|
|
response.setCustomerIdNum(customer.getCustomerIdNum()); |
|
|
|
response.setVehiclePlate(vehicle.getVehiclePlate()); |
|
|
|
response.setVehiclePlateColor(vehicle.getVehiclePlateColor() + ""); |
|
|
|
if (vehicle.getType() != null) { |
|
|
|
VehicleType vehicleType = VehicleType.fromCode(vehicle.getType()); |
|
|
|
response.setVehicleType(vehicleType != null ? vehicleType.getValue() : null); |
|
|
|
} |
|
|
|
response.setCardObuInfos(cardObuInfos); |
|
|
|
|
|
|
|
return response; |
|
|
|
} |
|
|
|
} |