diff --git a/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java b/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java index 9a619cd..dd5e1a3 100644 --- a/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java +++ b/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java @@ -25,6 +25,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.http.HttpResponse; import org.apache.http.util.EntityUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; @@ -201,7 +202,7 @@ public class AliRealNameAuthenticationController { String method = "GET"; Map headers = new HashMap(); //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 - headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE); + headers.put("Authorization", "APPCODE " + "5a7f623d06724a4da5806c1fb0544e47"); Map querys = new HashMap(); querys.put("ComapnyName", enterpriseCertification.getCompanyName()); querys.put("CreditCode", enterpriseCertification.getCreditCode()); @@ -210,7 +211,7 @@ public class AliRealNameAuthenticationController { String errorMsg = ""; //查询认证id QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("account_id", accountId); + queryWrapper.eq("open_id", enterpriseCertification.getOpenId()); EnterpriseCertification certification = enterpriseCertificationService.getOne(queryWrapper); enterpriseCertification.setId(certification.getId()); try { @@ -225,7 +226,9 @@ public class AliRealNameAuthenticationController { } enterpriseCertificationService.updateById(enterpriseCertification); - return R.ok("提交成功,请等待审核!"); + + //更改二次验证的组织信息 + return changeTeamInformation(enterpriseCertification); } else { errorMsg = info.getReason(); return R.error().put("message", info.getReason()); @@ -239,6 +242,22 @@ public class AliRealNameAuthenticationController { } + @NotNull + private R changeTeamInformation(@RequestBody EnterpriseCertification enterpriseCertification) { + enterpriseCertification.setSubmitTime(new Date()); + QueryWrapper accountQueryWrapper1 = new QueryWrapper<>(); + accountQueryWrapper1.eq("app_open_id", enterpriseCertification.getOpenId()); + accountQueryWrapper1.eq("platform_id", enterpriseCertification.getPlatformSource()); + HrUserAccount userAccount1 = userAccountService.getOne(accountQueryWrapper1); + userAccount1.setAccount(enterpriseCertification.getCompanyName()); + userAccountService.updateById(userAccount1); + UpdateWrapper userInfoUpdateWrapper = new UpdateWrapper<>(); + userInfoUpdateWrapper.set("user_name", enterpriseCertification.getCompanyName()); + userInfoUpdateWrapper.eq("user_id", userAccount1.getUserId()); + userInfoService.update(new HrUserInfo(), userInfoUpdateWrapper); + return R.ok("提交成功,请等待审核!"); + } + @ApiOperation(value = "统一社会信用代码认证(auditStatus给1,新增认证状态为待审核,用于个人认证幼儿园或供应商情况下)", response = CreditCodeResp.class) @PostMapping("/organizationCertification") public R organizationCertification(@RequestBody EnterpriseCertification enterpriseCertification, HttpServletRequest request) throws IOException { @@ -252,7 +271,7 @@ public class AliRealNameAuthenticationController { String method = "GET"; Map headers = new HashMap(); //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 - headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE); + headers.put("Authorization", "APPCODE " +"5a7f623d06724a4da5806c1fb0544e47"); Map querys = new HashMap(); querys.put("ComapnyName", enterpriseCertification.getCompanyName()); querys.put("CreditCode", enterpriseCertification.getCreditCode()); @@ -269,7 +288,9 @@ public class AliRealNameAuthenticationController { return R.error(errorMsg); } enterpriseCertificationService.save(enterpriseCertification); - return R.ok("提交成功,请等待审核!"); + + //更改二次验证的组织信息 + return changeTeamInformation(enterpriseCertification); } else { errorMsg = info.getReason(); @@ -282,10 +303,6 @@ public class AliRealNameAuthenticationController { userInfoService.removeById(userAccount.getUserId()); userAccountService.removeById(userAccount); - - // - - return R.error().put("message", info.getReason()); } } catch (Exception e) {