Commit 6be0e033 by 程裕兵

feat:添加半屏小程序

parent 222c702d
......@@ -26,4 +26,6 @@ finance:
wx:
component:
appId: wxe6c4979bafd48126
\ No newline at end of file
appId: wxe6c4979bafd48126
authorizer:
appId: wx06a084dcba4f0a05
\ No newline at end of file
......@@ -27,3 +27,5 @@ finance:
wx:
component:
appId: wxda913f3b6f1439b4
authorizer:
appId: wxf187be22c2234300
\ No newline at end of file
......@@ -32,3 +32,5 @@ finance:
wx:
component:
appId: wxda913f3b6f1439b4
authorizer:
appId: wxf187be22c2234300
......@@ -26,4 +26,6 @@ finance:
wx:
component:
appId: wxe6c4979bafd48126
\ No newline at end of file
appId: wxe6c4979bafd48126
authorizer:
appId: wx06a084dcba4f0a05
\ No newline at end of file
......@@ -26,4 +26,6 @@ finance:
wx:
component:
appId: wxfe4c26daa7e85d14
\ No newline at end of file
appId: wxfe4c26daa7e85d14
authorizer:
appId: wxf187be22c2234300
\ No newline at end of file
......@@ -131,6 +131,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Value("${wx.component.appId}")
private String wxComponentAppId;
@Value("${wx.authorizer.appId}")
private String authorizerAppId;
private static final Integer WX_SUCCESS_CODE = 0;
private final static List<String> SPECIAL_FAIL_LIST = Lists.newArrayList(
......@@ -258,9 +261,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Override
public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String appId) {
String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAppId(
studioId, wxComponentAppId, systemAppId, appId);
studioId, wxComponentAppId, authorizerAppId, appId);
if (null == embeddedXcx) {
return null;
}
......@@ -273,13 +275,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
if (CollectionUtil.isEmpty(appIds)) {
return;
}
String systemXcxAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
if (StringUtil.isBlank(systemXcxAppId)) {
return;
}
Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAppId(
studioId, wxComponentAppId, systemXcxAppId, appIds);
studioId, wxComponentAppId, authorizerAppId, appIds);
appIds.stream()
.filter(appId -> null == existMap.get(appId) || EmbededXcxEnum.isFail(existMap.get(appId).getState()))
.forEach(appId -> {
......@@ -287,13 +285,13 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
StudioEmbeddedXcxApply entity = existMap.get(appId);
if (null == entity) {
entity = StudioEmbeddedXcxConvert.toEntity(studioId, wxComponentAppId, systemXcxAppId, appId);
entity = StudioEmbeddedXcxConvert.toEntity(studioId, wxComponentAppId, authorizerAppId, appId);
studioEmbeddedXcxApplyRpService.insert(entity);
} else {
studioEmbeddedXcxApplyRpService.updateById(StudioEmbeddedXcxConvert.toInit(entity));
}
try {
JSONObject result = weXcxService.addEmbeddedXcx(wxComponentAppId, systemXcxAppId, appId,
JSONObject result = weXcxService.addEmbeddedXcx(wxComponentAppId, authorizerAppId, appId,
"申请半屏小程序");
Integer code = result.getInteger("errcode");
String message = result.getString("errmsg");
......@@ -315,14 +313,13 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Override
public void syncEmbeddedXcx() {
String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
List<AuthXcxInfo> list = this.listBoundAppIds(systemAppId);
List<AuthXcxInfo> list = this.listBoundAppIds();
if (CollectionUtil.isEmpty(list)) {
return;
}
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAppIds(
wxComponentAppId, systemAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAppIds(wxComponentAppId,
authorizerAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(applies)) {
return;
}
......@@ -362,13 +359,13 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
});
}
private List<AuthXcxInfo> listBoundAppIds(String systemAppId) {
private List<AuthXcxInfo> listBoundAppIds() {
List<AuthXcxInfo> result = new ArrayList<>();
int num = 100;
for (int start = 0; start < 10; start++) {
HalfScreenXcxAuthVO vo = weXcxService.listEmbeddedXcx(wxComponentAppId, systemAppId, start, num);
HalfScreenXcxAuthVO vo = weXcxService.listEmbeddedXcx(wxComponentAppId, authorizerAppId, start, num);
if (CollectionUtil.isEmpty(vo.getWxaEmbeddedList())) {
break;
}
......
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