预约登记错误提示
This commit is contained in:
1 parent
ffe72bab70
commit
adc5843e65
1 file changed
+12
-2
+12
-2
@@ -339,9 +339,19 @@ public class VisitorService extends BaseHikvisionService {
|
||||
RegisterAppointmentResponse response = JSON.parseObject(json,
|
||||
new TypeReference<RegisterAppointmentResponse>() {});
|
||||
|
||||
if (!"0".equals(response.getCode())) {
|
||||
throw new HikvisionException(response.getCode(), response.getMsg());
|
||||
// 处理不同的错误码,提供友好的错误提示
|
||||
String code = response.getCode();
|
||||
if ("0".equals(code)) {
|
||||
// 成功情况
|
||||
log.info("海康预约登记成功");
|
||||
} else if ("0x05320009".equals(code)) {
|
||||
throw new ServiceException("订单无效或已登记,请检查订单状态");
|
||||
} else {
|
||||
// 其他错误码
|
||||
log.error("海康预约登记失败,错误码: {}, 错误信息: {}", code, response.getMsg());
|
||||
throw new ServiceException("预约登记失败: " + response.getMsg());
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user