抛出更改为返回

main
rong.liu 11 months ago
parent 6f16b75d70
commit 3f6eb37476
  1. 34
      users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java

@ -79,13 +79,15 @@ public class AliRealNameAuthenticationController {
//身份证信息返回 //身份证信息返回
String idCardInformationReturn = FaceRecognitionAidUtil.IdCardOCRRecognition(imgFile, side); String idCardInformationReturn = FaceRecognitionAidUtil.IdCardOCRRecognition(imgFile, side);
if (ObjectUtils.isEmpty(idCardInformationReturn)) { if (ObjectUtils.isEmpty(idCardInformationReturn)) {
throw new RuntimeException("身份证图片验证失败,请重新再试!"); // ("身份证图片验证失败,请重新再试!");
return R.error("身份证图片验证失败,请重新再试!");
} }
IdCardOCRResp resp = new Gson().fromJson(idCardInformationReturn, IdCardOCRResp.class); IdCardOCRResp resp = new Gson().fromJson(idCardInformationReturn, IdCardOCRResp.class);
if (resp.getSuccess()) { if (resp.getSuccess()) {
return R.ok().put("data", resp); return R.ok().put("data", resp);
} else { } else {
throw new RuntimeException("身份证图片验证失败,请重新再试!"); // ("身份证图片验证失败,请重新再试!");
return R.error("身份证图片验证失败,请重新再试!");
} }
} }
@ -101,7 +103,8 @@ public class AliRealNameAuthenticationController {
RealNameAuthenticationResp info = new Gson().fromJson(json, RealNameAuthenticationResp.class); RealNameAuthenticationResp info = new Gson().fromJson(json, RealNameAuthenticationResp.class);
if (!info.getRespCode().equals("0000")) { if (!info.getRespCode().equals("0000")) {
throw new RuntimeException(info.getRespMessage()); // ();
return R.error(info.getRespMessage());
} }
QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>(); QueryWrapper<UserAuthenticationInformation> queryWrapper = new QueryWrapper<>();
@ -151,7 +154,7 @@ public class AliRealNameAuthenticationController {
queryWrapper.eq("account_id", accountId); queryWrapper.eq("account_id", accountId);
UserAuthenticationInformation userAuthenticationInformation = service.getOne(queryWrapper); UserAuthenticationInformation userAuthenticationInformation = service.getOne(queryWrapper);
if (ObjectUtils.isEmpty(userAuthenticationInformation)) { if (ObjectUtils.isEmpty(userAuthenticationInformation)) {
return R.ok().put("data", false); return R.ok().put("data", false).put("msg", "未认证");
} }
return R.ok().put("data", true).put("authenticationInformation", userAuthenticationInformation); return R.ok().put("data", true).put("authenticationInformation", userAuthenticationInformation);
} }
@ -174,11 +177,13 @@ public class AliRealNameAuthenticationController {
if (info.getSuccess()) { if (info.getSuccess()) {
return R.ok().put("data", info); return R.ok().put("data", info);
} else { } else {
throw new RuntimeException("营业执照图片验证,请重新再试!"); //("营业执照图片验证失败,请重新再试!");
return R.error("营业执照图片验证失败,请重新再试!");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("营业执照图片验证,请重新再试!"); // ("营业执照图片验证失败,请重新再试!");
return R.error("营业执照图片验证失败,请重新再试!");
} }
} }
@ -214,7 +219,9 @@ public class AliRealNameAuthenticationController {
if (info.getStatus()) { if (info.getStatus()) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), certification.getId(), enterpriseCertification.getOpenId()))) { if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), certification.getId(), enterpriseCertification.getOpenId()))) {
errorMsg = "企业名称已存在"; errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg); // (errorMsg);
return R.error(errorMsg);
} }
enterpriseCertificationService.updateById(enterpriseCertification); enterpriseCertificationService.updateById(enterpriseCertification);
@ -225,7 +232,8 @@ public class AliRealNameAuthenticationController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(errorMsg); // (errorMsg);
return R.error(errorMsg);
} }
@ -258,7 +266,7 @@ public class AliRealNameAuthenticationController {
if (info.getStatus()) { if (info.getStatus()) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) { if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) {
errorMsg = "企业名称已存在"; errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg); return R.error(errorMsg);
} }
enterpriseCertificationService.save(enterpriseCertification); enterpriseCertificationService.save(enterpriseCertification);
return R.ok("提交成功,请等待审核!"); return R.ok("提交成功,请等待审核!");
@ -268,7 +276,7 @@ public class AliRealNameAuthenticationController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(errorMsg); return R.error().put("message", errorMsg);
} }
@ -294,7 +302,7 @@ public class AliRealNameAuthenticationController {
if (info.getStatus()) { if (info.getStatus()) {
/*if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) { /*if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) {
errorMsg = "企业名称已存在"; errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg); (errorMsg);
} }
enterpriseCertificationService.save(enterpriseCertification);*/ enterpriseCertificationService.save(enterpriseCertification);*/
@ -305,9 +313,9 @@ public class AliRealNameAuthenticationController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(errorMsg); errorMsg = "系统错误";
}
} }
} }
}
Loading…
Cancel
Save