yangpeilai пре 3 недеља
родитељ
комит
5aaf3caeec

+ 0
- 8
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/ass/DeviceLossController.java Прегледај датотеку

@@ -3,8 +3,6 @@ package cn.com.taiji.iaw.api.ass;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.web.ApiResponse;
import cn.com.taiji.iaw.api.MyValidController;
import cn.com.taiji.iaw.dto.ass.AssBaseInfoQueryRequestDTO;
import cn.com.taiji.iaw.dto.ass.AssBaseInfoQueryResponseDTO;
import cn.com.taiji.iaw.dto.ass.DeviceLossReqDTO;
import cn.com.taiji.iaw.manager.ass.DeviceLossManager;
import io.swagger.annotations.Api;
@@ -31,10 +29,4 @@ public class DeviceLossController extends MyValidController {
manager.loss(reqDto);
return ApiResponse.success().setMessage("操作成功");
}

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

+ 1
- 1
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/DeviceLossReqDTO.java Прегледај датотеку

@@ -18,7 +18,7 @@ import javax.validation.constraints.NotNull;
public class DeviceLossReqDTO extends AbstractBizRequestDTO {

//业务类型 1-单卡挂失 2-单签挂失 3-卡签挂失 4-单卡解挂 5-单签解挂 6-卡签解挂
@ApiModelProperty(value = "业务类型", required = true)
@ApiModelProperty(value = "业务类型 1-单卡挂失 2-单签挂失 3-卡签挂失 4-单卡解挂 5-单签解挂 6-卡签解挂", required = true)
@IntegerConstant(values = "1,2,3,4,5,6", message = "业务类型错误")
@NotNull
private Integer businessType;

+ 0
- 4
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceLossManager.java Прегледај датотеку

@@ -1,12 +1,8 @@
package cn.com.taiji.iaw.manager.ass;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.iaw.dto.ass.AssBaseInfoQueryRequestDTO;
import cn.com.taiji.iaw.dto.ass.AssBaseInfoQueryResponseDTO;
import cn.com.taiji.iaw.dto.ass.DeviceLossReqDTO;

public interface DeviceLossManager {
void loss(DeviceLossReqDTO reqDto) throws ManagerException;

AssBaseInfoQueryResponseDTO query(AssBaseInfoQueryRequestDTO dto) throws ManagerException;
}

+ 0
- 104
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceLossManagerImpl.java Прегледај датотеку

@@ -1,46 +1,18 @@
package cn.com.taiji.iaw.manager.ass;

import cn.com.taiji.common.manager.ManagerException;
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.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.manager.cache.RedisKeyGenerator;
import cn.com.taiji.core.model.comm.protocol.ias.ass.*;
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError;
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.iaw.dto.ass.AssBaseInfoQueryRequestDTO;
import cn.com.taiji.iaw.dto.ass.AssBaseInfoQueryResponseDTO;
import cn.com.taiji.iaw.dto.ass.DeviceLossReqDTO;
import cn.com.taiji.iaw.manager.AbstractIawManager;
import cn.com.taiji.iaw.model.ass.CardObuInfoModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class DeviceLossManagerImpl extends AbstractIawManager implements DeviceLossManager {

@Autowired
private QtkCustomerInfoRepo customerInfoRepo;
@Autowired
private QtkVehicleInfoRepo vehicleInfoRepo;
@Autowired
private QtkCardInfoRepo cardInfoRepo;
@Autowired
private QtkObuInfoRepo obuInfoRepo;

@Override
public void loss(DeviceLossReqDTO reqDto) throws ManagerException {
reqDto.validate();
@@ -106,80 +78,4 @@ public class DeviceLossManagerImpl extends AbstractIawManager implements DeviceL
// 保存日志操作日志 失败不计入日志
persistOperateLog(operateType, response.getOrderNo(), source, findOpenIdByToken(reqDto.getAccessToken()), "挂失解挂操作" + response.getMsg());
}

@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;
ObuStatus[] obuStatus;

if ("1".equals(dto.getStatus())) {
// 状态1:只查询正常的卡和OBU
cardStatus = new CardStatus[]{CardStatus.ZC};
obuStatus = new ObuStatus[]{ObuStatus.ZC};
} else if ("2".equals(dto.getStatus())) {
// 状态2:只查询已挂失的卡和OBU
cardStatus = new CardStatus[]{CardStatus.KGS};
obuStatus = new ObuStatus[]{ObuStatus.BQGS};
} else {
// 查询所有卡和OBU(正常+挂失)
cardStatus = new CardStatus[]{CardStatus.ZC, CardStatus.KGS};
obuStatus = new ObuStatus[]{ObuStatus.ZC, 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());
model.setCardStatus(card.getCardStatus());
model.setObuId(obu.getObuId());
model.setObuType(obu.getObuType());
model.setObuStatus(obu.getObuStatus());
cardObuInfos.add(model);
}
}
}

// 响应
AssBaseInfoQueryResponseDTO response = new AssBaseInfoQueryResponseDTO();
response.setCustomerName(customer.getCustomerName());
response.setCustomerTel(customer.getCustomerTel());
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;
}
}

zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/AssBaseInfoQueryRequestDTO.java → zhywpt-app-managew/src/main/java/cn/com/taiji/managew/dto/ass/AssBaseInfoQueryRequestDTO.java Прегледај датотеку

@@ -1,4 +1,4 @@
package cn.com.taiji.iaw.dto.ass;
package cn.com.taiji.managew.dto.ass;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -11,10 +11,11 @@ import javax.validation.constraints.NotBlank;
@Getter
@Setter
public class AssBaseInfoQueryRequestDTO {
@ApiModelProperty(value = "车辆ID", required = true)
@ApiModelProperty(value = "车辆ID")
@NotBlank(message = "车辆ID不能为空")
private String vehicleId;//车辆ID;

@ApiModelProperty(value = "状态 1-查询正常的 2-查询挂失的 null-查询全部")
@ApiModelProperty(value = "状态 1-查询正常 2-查询挂失")
@NotBlank(message = "卡状态不能为空")
private String status;
}

zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/AssBaseInfoQueryResponseDTO.java → zhywpt-app-managew/src/main/java/cn/com/taiji/managew/dto/ass/AssBaseInfoQueryResponseDTO.java Прегледај датотеку

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

import cn.com.taiji.iaw.model.ass.CardObuInfoModel;
import cn.com.taiji.managew.model.ass.CardObuInfoModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@@ -14,8 +14,6 @@ import java.util.List;
public class AssBaseInfoQueryResponseDTO {
@ApiModelProperty(value = "用户名称")
private String customerName;
@ApiModelProperty(value = "用户手机号")
private String customerTel;
@ApiModelProperty(value = "用户证件类型")
private String customerIdType;
@ApiModelProperty(value = "用户证件号")
@@ -28,4 +26,4 @@ public class AssBaseInfoQueryResponseDTO {
private String vehicleType;
@ApiModelProperty(value = "卡签信息")
private List<CardObuInfoModel> cardObuInfos;
}
}

Loading…
Откажи
Сачувај