yangpeilai 3 недель назад
Родитель
Сommit
22ed1c1ad0

+ 8
- 0
zhywpt-app-managew/src/main/java/cn/com/taiji/managew/api/ass/AssDeviceLossController.java Просмотреть файл

@@ -4,6 +4,8 @@ import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.model.dao.Pagination;
import cn.com.taiji.common.web.ApiResponse;
import cn.com.taiji.managew.api.MyValidController;
import cn.com.taiji.managew.dto.ass.AssBaseInfoQueryRequestDTO;
import cn.com.taiji.managew.dto.ass.AssBaseInfoQueryResponseDTO;
import cn.com.taiji.managew.dto.ass.AssDeviceLossPageReqDTO;
import cn.com.taiji.managew.dto.ass.AssDeviceLossReqDTO;
import cn.com.taiji.managew.manager.ass.AssDeviceLossManager;
@@ -38,4 +40,10 @@ public class AssDeviceLossController extends MyValidController {
return ApiResponse.of(manager.lossPage(reqDto));
}


@ApiOperation("03-信息查询")
@PostMapping("/query")
public ApiResponse<AssBaseInfoQueryResponseDTO> query(@Valid @RequestBody AssBaseInfoQueryRequestDTO dto) throws ManagerException {
return ApiResponse.of(manager.query(dto));
}
}

+ 1
- 1
zhywpt-app-managew/src/main/java/cn/com/taiji/managew/dto/ass/AssDeviceLossPageReqDTO.java Просмотреть файл

@@ -28,7 +28,7 @@ public class AssDeviceLossPageReqDTO extends AbstractStaffBizPageRequestDTO {
@Override
protected void validate(ViolationValidator validator) {
super.validate(validator);
if (StringUtils.isEmpty(vehiclePlate) != StringUtils.isEmpty(vehiclePlateColor)) {
if (StringUtils.hasText(vehiclePlate) != StringUtils.hasText(vehiclePlateColor)) {
validator.addViolation("vehiclePlate","车牌号和车牌颜色不能为空");
validator.addViolation("vehiclePlateColor","车牌号和车牌颜色不能为空");
}

+ 1
- 2
zhywpt-app-managew/src/main/java/cn/com/taiji/managew/dto/ass/AssDeviceLossPageResDTO.java Просмотреть файл

@@ -1,6 +1,5 @@
package cn.com.taiji.managew.dto.ass;

import cn.com.taiji.core.entity.dict.basic.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@@ -17,7 +16,7 @@ public class AssDeviceLossPageResDTO {
private String customerName;//客户名称

@ApiModelProperty(value = "用户证件类型")
private IdType customerIdType;//客户证件类型
private String customerIdType;//客户证件类型

@ApiModelProperty(value = "用户证件号")
private String customerIdNum;//客户证件号

+ 4
- 0
zhywpt-app-managew/src/main/java/cn/com/taiji/managew/manager/ass/AssDeviceLossManager.java Просмотреть файл

@@ -2,6 +2,8 @@ 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.managew.dto.ass.AssBaseInfoQueryRequestDTO;
import cn.com.taiji.managew.dto.ass.AssBaseInfoQueryResponseDTO;
import cn.com.taiji.managew.dto.ass.AssDeviceLossPageReqDTO;
import cn.com.taiji.managew.dto.ass.AssDeviceLossReqDTO;

@@ -9,4 +11,6 @@ public interface AssDeviceLossManager {
void loss(AssDeviceLossReqDTO reqDto) throws ManagerException;

Pagination lossPage(AssDeviceLossPageReqDTO reqDto);

AssBaseInfoQueryResponseDTO query(AssBaseInfoQueryRequestDTO dto) throws ManagerException;
}

+ 106
- 20
zhywpt-app-managew/src/main/java/cn/com/taiji/managew/manager/ass/AssDeviceLossManagerImpl.java Просмотреть файл

@@ -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;
}
}

Загрузка…
Отмена
Сохранить