| @@ -586,13 +586,26 @@ public class WxWeappInfoController extends BaseController { | |||
| } | |||
| List<WxWeappCodeStatusVo> apps = weappCodeStatusService.getList(queryVo); | |||
| apps.stream().forEach( app -> { | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||
| WxOpenMaQueryAuditResult openResult = openMaService.getLatestAuditStatus(); | |||
| logger.info(openResult.toString()); | |||
| if(openResult.isSuccess()) { | |||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||
| if(codeStatus != null) { | |||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||
| if(codeStatus == null) { | |||
| return; | |||
| } | |||
| if(codeStatus.getCodeStatus() == null) { | |||
| return; | |||
| } | |||
| if(!codeStatus.getCodeStatus().equals(EnumWeappCodeCommitStatus.SUCCESS.getCode())) { | |||
| return; | |||
| } | |||
| if(codeStatus.getAuditStatus() == null) { | |||
| return; | |||
| } | |||
| // 审核中,可以发起审核查询 | |||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||
| WxOpenMaQueryAuditResult openResult = openMaService.getLatestAuditStatus(); | |||
| logger.info(openResult.toString()); | |||
| if (openResult.isSuccess()) { | |||
| // 审核状态,其中0为审核成功,1为审核失败,2为审核中,3已撤回 | |||
| switch (openResult.getStatus().intValue()) { | |||
| case 0: | |||
| @@ -613,9 +626,9 @@ public class WxWeappInfoController extends BaseController { | |||
| } | |||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| }); | |||
| return new ResultData(); | |||
| @@ -631,17 +644,22 @@ public class WxWeappInfoController extends BaseController { | |||
| queryVo.setUserVersion(version); | |||
| } | |||
| List<WxWeappCodeStatusVo> apps = weappCodeStatusService.getList(queryVo); | |||
| apps.stream().forEach( app -> { | |||
| apps.stream().forEach( codeStatus -> { | |||
| if(codeStatus.getAuditStatus() == null) { | |||
| return; | |||
| } | |||
| // 审核通过,已发布不可撤回 | |||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.SUCCESS.getCode()) | |||
| && codeStatus.getReleaseStatus().equals(EnumWeappReleaseStatus.SUCCESS.getCode())) { | |||
| return; | |||
| } | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeStatus.getAppId()); | |||
| WxOpenResult openResult = openMaService.undoCodeAudit(); | |||
| logger.info(openResult.toString()); | |||
| if(openResult.isSuccess()) { | |||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||
| if(codeStatus != null) { | |||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||
| } | |||
| codeStatus.setAuditStatus(EnumWeappAuditStatus.UNDO.getCode()); | |||
| weappCodeStatusService.updateAuditStatus(codeStatus); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -663,16 +681,26 @@ public class WxWeappInfoController extends BaseController { | |||
| apps.stream().forEach( app -> { | |||
| Gson gson = new GsonBuilder().create(); | |||
| WxWeappCodeStatus codeStatus = weappCodeStatusService.getByAppId(app.getAppId()); | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||
| logger.info(openRet.toString()); | |||
| boolean releaseSuccess = false; | |||
| if(openRet.isSuccess()) { | |||
| releaseSuccess = true; | |||
| } | |||
| if(codeStatus != null) { | |||
| if(codeStatus == null) { | |||
| return; | |||
| } | |||
| if(codeStatus.getAuditStatus() == null) { | |||
| return; | |||
| } | |||
| // 已发布不能再发布 | |||
| if(codeStatus.getReleaseStatus() != null) { | |||
| return; | |||
| } | |||
| // 已审核通过的才可以发布 | |||
| if(codeStatus.getAuditStatus().equals(EnumWeappAuditStatus.SUCCESS.getCode())) { | |||
| try { | |||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(app.getAppId()); | |||
| WxOpenResult openRet = openMaService.releaesAudited(); | |||
| logger.info(openRet.toString()); | |||
| boolean releaseSuccess = false; | |||
| if(openRet.isSuccess()) { | |||
| releaseSuccess = true; | |||
| } | |||
| if(releaseSuccess) { | |||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.SUCCESS.getCode()); | |||
| } else { | |||
| @@ -680,10 +708,8 @@ public class WxWeappInfoController extends BaseController { | |||
| codeStatus.setReleaseErrCode(gson.toJson(openRet)); | |||
| } | |||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| if(codeStatus != null) { | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| codeStatus.setReleaseStatus(EnumWeappReleaseStatus.FAIL.getCode()); | |||
| codeStatus.setReleaseErrCode(e.getMessage()); | |||
| weappCodeStatusService.updateReleaseStatus(codeStatus); | |||