@@ -16,6 +16,7 @@ public enum YgzServiceCmd implements SignServiceCommand { | |||
OBUUPLOAD("obu信息上传", YgzObuUploadRequest.class, NioTransferType.OBUUPLOAD), | |||
CARDBLACKUPLOAD("卡黑名单上传", YgzCardBlackUploadRequest.class, NioTransferType.CARDBLACKLISTUPLOAD), | |||
OBUBLACKUPLOAD("obu黑名单上传", YgzObuBlackUploadRequest.class, NioTransferType.OBUBLACKLISTUPLOAD), | |||
VEHICLEPLATECHECK("车牌校验", YgzVehiclePlateCheckRequest.class, NioTransferType.PLATECHECK), | |||
; | |||
private final String value; |
@@ -0,0 +1,30 @@ | |||
package cn.com.taiji.core.model.comm.protocol.ias.ygz; | |||
import cn.com.taiji.core.entity.dict.ygz.DataSourceEnum; | |||
import cn.com.taiji.core.model.comm.protocol.ias.AbstractIasRequest; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class YgzVehiclePlateCheckRequest extends AbstractIasRequest<YgzVehiclePlateCheckResponse> { | |||
public YgzVehiclePlateCheckRequest() { | |||
super(YgzServiceCmd.VEHICLEPLATECHECK); | |||
} | |||
@NotBlank(message="车牌号不能为空") | |||
private String vehiclePlate; | |||
@NotNull(message="车牌颜色不能为空") | |||
private Integer vehicleColor; | |||
@NotNull(message="车型不能为空") | |||
private Integer vehicleType; | |||
@NotNull(message="发行方式不能为空") | |||
private Integer issueType; | |||
@NotNull(message = "dataSource不能为空") | |||
private DataSourceEnum dataSource; | |||
} |
@@ -0,0 +1,4 @@ | |||
package cn.com.taiji.core.model.comm.protocol.ias.ygz; | |||
public class YgzVehiclePlateCheckResponse extends YgzCommonResponse{ | |||
} |
@@ -167,7 +167,7 @@ public class BrzDataSendManagerImpl extends AbstractCommManager implements BrzDa | |||
} | |||
} catch (Exception e) { | |||
logger.error("部认证错误-单位上传:", e); | |||
return data.setOfflineSendResult("后台报错").setSuccess(false); | |||
return data.setOfflineSendResult(e.getMessage()).setSuccess(false); | |||
} | |||
} | |||
@@ -214,10 +214,15 @@ public class BrzDataSendManagerImpl extends AbstractCommManager implements BrzDa | |||
} | |||
} catch (Exception e) { | |||
logger.error("部认证错误-车辆上传:", e); | |||
return data.setOfflineSendResult("后台报错").setSuccess(false); | |||
return data.setOfflineSendResult(e.getMessage().substring(0, 200)).setSuccess(false); | |||
} | |||
} | |||
public static void main(String[] args) { | |||
String str = "123"; | |||
str.substring(0,200); | |||
} | |||
private DaspOfflineHasSend cardUpload(YgzCardUploadRequest ygzRequest, DaspOfflineHasSend data) { | |||
try { | |||
List<DaspOfflineHasSend> accounts = daspOfflineHasSendRepo.listByWithSuccess(ygzRequest.getCard().getCustomerId()); | |||
@@ -246,7 +251,7 @@ public class BrzDataSendManagerImpl extends AbstractCommManager implements BrzDa | |||
} | |||
} catch (Exception e) { | |||
logger.error("部认证错误-卡上传:", e); | |||
return data.setOfflineSendResult("后台报错").setSuccess(false); | |||
return data.setOfflineSendResult(e.getMessage()).setSuccess(false); | |||
} | |||
} | |||
@@ -278,7 +283,7 @@ public class BrzDataSendManagerImpl extends AbstractCommManager implements BrzDa | |||
} | |||
} catch (Exception e) { | |||
logger.error("部认证错误-OBU上传:", e); | |||
return data.setOfflineSendResult("后台报错").setSuccess(false); | |||
return data.setOfflineSendResult(e.getMessage()).setSuccess(false); | |||
} | |||
} | |||
@@ -26,6 +26,8 @@ public class YgzServiceHandler extends AbstractIasServiceHandler<YgzServiceCmd> | |||
private YgzCardBlackUploadManager cardBlackUploadManager; | |||
@Autowired | |||
private YgzObuBlackUploadManager obuBlackUploadManager; | |||
@Autowired | |||
private YgzVehiclePlateCheckManager ygzVehiclePlateCheckManager; | |||
protected YgzServiceHandler() { | |||
super(IasServiceType.YGZ); | |||
@@ -47,6 +49,8 @@ public class YgzServiceHandler extends AbstractIasServiceHandler<YgzServiceCmd> | |||
return cardBlackUploadManager.serviceHandle((YgzCardBlackUploadRequest) request); | |||
case OBUBLACKUPLOAD: | |||
return obuBlackUploadManager.serviceHandle((YgzObuBlackUploadRequest) request); | |||
case VEHICLEPLATECHECK: | |||
return ygzVehiclePlateCheckManager.serviceHandle((YgzVehiclePlateCheckRequest) request); | |||
default: | |||
throw FileProtocolSystemError.NOT_SUPPORT.toHandleException(jsonReq.getIfCode()); | |||
} |
@@ -0,0 +1,54 @@ | |||
package cn.com.taiji.ias.manager.ygz; | |||
import cn.com.taiji.core.entity.dict.ygz.DataSourceEnum; | |||
import cn.com.taiji.core.entity.dict.ygz.QtkServiceType; | |||
import cn.com.taiji.core.entity.log.YgzInterfaceLog; | |||
import cn.com.taiji.core.manager.comm.LogManager; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzServiceCmd; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehiclePlateCheckRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehiclePlateCheckResponse; | |||
import cn.com.taiji.ias.manager.ygz.nio.AbstractCommNioManager; | |||
import cn.com.taiji.ias.model.nio.PlateValidateNioRequest; | |||
import cn.com.taiji.ias.model.nio.PlateValidateNioResponse; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class YgzVehiclePlateCheckManager extends AbstractCommNioManager implements LogManager<YgzVehiclePlateCheckRequest, YgzVehiclePlateCheckResponse, YgzInterfaceLog> { | |||
public YgzVehiclePlateCheckResponse serviceHandle(YgzVehiclePlateCheckRequest request) { | |||
long begin = System.currentTimeMillis(); | |||
PlateValidateNioRequest nioRequest = toNioRequest(request.getVehiclePlate(), request.getVehicleColor(), request.getVehicleType(), request.getIssueType(), request.getDataSource()); | |||
PlateValidateNioResponse nioResponse = (PlateValidateNioResponse) sendRequest(nioRequest, PlateValidateNioResponse.class); | |||
if (nioResponse == null || !hasText(nioResponse.getStatusCode())) { | |||
YgzVehiclePlateCheckResponse response = new YgzVehiclePlateCheckResponse(); | |||
response.setSuccess(false); | |||
response.setMsg("接口无法返回值"); | |||
return onFailed(request, response, YgzInterfaceLog.class, System.currentTimeMillis() - begin, "接口无法返回值"); | |||
} | |||
if (!nioResponse.getStatusCode().equals("200")) { | |||
YgzVehiclePlateCheckResponse response = new YgzVehiclePlateCheckResponse(); | |||
response.setSuccess(false); | |||
response.setMsg(nioResponse.getErrorMsg()); | |||
return onFailed(request, response, YgzInterfaceLog.class, System.currentTimeMillis() - begin, nioResponse.getErrorMsg()); | |||
} else { | |||
return onSuccess(request, new YgzVehiclePlateCheckResponse(), YgzInterfaceLog.class, System.currentTimeMillis() - begin); | |||
} | |||
} | |||
private PlateValidateNioRequest toNioRequest(String vehiclePlate, Integer vehicleColor, Integer vehicleType, Integer issueType, final DataSourceEnum dataSource) { | |||
PlateValidateNioRequest request = new PlateValidateNioRequest(); | |||
request.setVehiclePlate(vehiclePlate); | |||
request.setVehicleColor(vehicleColor); | |||
request.setVehicleType(vehicleType); | |||
request.setIssueType(issueType); | |||
request.setDataSource(dataSource.name()); | |||
request.setServiceType(QtkServiceType.PLATEVALIDATE); | |||
return request; | |||
} | |||
@Override | |||
public void doSaveLog(YgzVehiclePlateCheckRequest request, YgzVehiclePlateCheckResponse response, YgzInterfaceLog log) { | |||
String uniqueId = request.getVehiclePlate() + "_" + request.getVehicleColor(); | |||
handleLog(uniqueId, null, request.getDataSource(), (YgzServiceCmd) request.getServiceCommand(), log); | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
/** | |||
* @Title PlateValidateRequest.java | |||
* @Package cn.com.taiji.dsi.model.request.nio | |||
* @Description TODO | |||
* @author yaonanlin | |||
* @date 2019年7月12日 下午3:14:41 | |||
* @version V1.0 | |||
*/ | |||
package cn.com.taiji.ias.model.nio; | |||
import cn.com.taiji.core.entity.dict.ygz.NioTransferType; | |||
import com.fasterxml.jackson.annotation.JsonInclude; | |||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class PlateValidateNioRequest extends NioRequest { | |||
public PlateValidateNioRequest() { | |||
super(NioTransferType.PLATECHECK); | |||
} | |||
@JsonInclude(Include.NON_EMPTY) | |||
private String vehiclePlate; | |||
@JsonInclude(Include.NON_NULL) | |||
private int vehicleColor; | |||
@JsonInclude(Include.NON_NULL) | |||
private int vehicleType; | |||
@JsonInclude(Include.NON_NULL) | |||
private int issueType; | |||
} | |||
@@ -0,0 +1,23 @@ | |||
/** | |||
* @Title PlateValidateResponse.java | |||
* @Package cn.com.taiji.dsi.model.request.nio | |||
* @Description TODO | |||
* @author yaonanlin | |||
* @date 2019年7月12日 下午3:20:03 | |||
* @version V1.0 | |||
*/ | |||
package cn.com.taiji.ias.model.nio; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class PlateValidateNioResponse extends NioResponse { | |||
private Boolean result; | |||
private Integer reason; | |||
private String info; | |||
} | |||