Commit c6c26678 by 程裕兵

feat:listBoundEmbeddedXcx

parent 62815b70
......@@ -83,4 +83,12 @@ public class StudioEmbeddedXcxConvert {
toInit.setUpdateTime(new Date());
return toInit;
}
public static StudioEmbeddedXcxApply toFail(Long id, EmbededXcxEnum state) {
StudioEmbeddedXcxApply toInit = new StudioEmbeddedXcxApply();
toInit.setId(id);
toInit.setState(state.getCode());
toInit.setUpdateTime(new Date());
return toInit;
}
}
......@@ -300,7 +300,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
"申请半屏小程序");
Integer code = result.getInteger("errcode");
String message = result.getString("errmsg");
if (!WX_SUCCESS_CODE.equals(code)) {
if (WX_SUCCESS_CODE.equals(code)) {
this.doComplete(entity.getId(), appId);
} else {
studioEmbeddedXcxApplyRpService.updateById(
StudioEmbeddedXcxConvert.toRefuse(entity.getId(), message));
}
......@@ -314,6 +316,35 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
});
}
private void doComplete(Long id, String appId) {
HalfScreenXcxAuthVO vo = weXcxService.listBoundEmbeddedXcx(wxComponentAppId, appId, 0, 100);
if (null == vo) {
return;
}
if (CollectionUtil.isEmpty(vo.getWxaEmbeddedList())) {
return;
}
AuthXcxInfo info = vo.getWxaEmbeddedList().stream().filter(e -> e.getAppId().equals(embeddedAppId))
.findFirst().orElse(null);
if (null == info) {
return;
}
EmbededXcxEnum state = EmbededXcxEnum.getByWxCode(Integer.parseInt(info.getStatus()));
switch (state) {
case SUCCESS:
studioEmbeddedXcxApplyRpService.updateById(StudioEmbeddedXcxConvert.toSuccess(id));
break;
case REFUSE:
case TIMEOUT:
case REVOKE:
case CANCEL:
studioEmbeddedXcxApplyRpService.updateById(StudioEmbeddedXcxConvert.toFail(id, state));
break;
default:
break;
}
}
@Override
public void syncEmbeddedXcx() {
List<AuthXcxInfo> list = this.listBoundAppIds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment