Commit 81347470 by 程裕兵

feat:添加半屏小程序

parent 4136ba07
......@@ -27,5 +27,5 @@ finance:
wx:
component:
appId: wxe6c4979bafd48126
authorizer:
embedded:
appId: wx06a084dcba4f0a05
\ No newline at end of file
......@@ -27,5 +27,5 @@ finance:
wx:
component:
appId: wxda913f3b6f1439b4
authorizer:
embedded:
appId: wxf187be22c2234300
\ No newline at end of file
......@@ -32,5 +32,5 @@ finance:
wx:
component:
appId: wxda913f3b6f1439b4
authorizer:
embedded:
appId: wxf187be22c2234300
......@@ -27,5 +27,5 @@ finance:
wx:
component:
appId: wxe6c4979bafd48126
authorizer:
embedded:
appId: wx06a084dcba4f0a05
\ No newline at end of file
......@@ -27,5 +27,5 @@ finance:
wx:
component:
appId: wxfe4c26daa7e85d14
authorizer:
embedded:
appId: wxf187be22c2234300
\ No newline at end of file
......@@ -37,39 +37,39 @@ public class StudioEmbeddedXcxApplyRpService extends
MapperRepoService<Long, StudioEmbeddedXcxApply, StudioEmbeddedXcxApplyMapper> {
public Map<String, StudioEmbeddedXcxApply> mapByStudioIdAndAppId(Long studioId,
String componentAppId, String systemXcxAppId, List<String> appIds) {
return this.listByStudioIdAndAppId(studioId, componentAppId, systemXcxAppId, appIds)
String componentAppId, String embeddedAppId, List<String> appIds) {
return this.listByStudioIdAndAppId(studioId, componentAppId, embeddedAppId, appIds)
.stream().collect(Collectors.toMap(StudioEmbeddedXcxApply::getAppId, e -> e));
}
public List<StudioEmbeddedXcxApply> listByStudioIdAndAppId(Long studioId, String componentAppId,
String systemXcxAppId, List<String> appIds) {
String embeddedAppId, List<String> appIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
wrapper.eq(StudioEmbeddedXcxApply.APP_ID, embeddedAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, appIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
}
public StudioEmbeddedXcxApply getByStudioIdAndAppId(Long studioId, String componentAppId,
String systemXcxAppId, String appId) {
String embeddedAppId, String appId) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.eq(StudioEmbeddedXcxApply.APP_ID, appId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
wrapper.eq(StudioEmbeddedXcxApply.APP_ID, embeddedAppId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, appId);
return Optional.ofNullable(this.baseMapper.selectList(wrapper))
.orElse(new ArrayList<>(1))
.stream().findFirst().orElse(null);
}
public List<StudioEmbeddedXcxApply> listByAppIds(String componentAppId, String systemXcxAppId,
public List<StudioEmbeddedXcxApply> listByAppIds(String componentAppId, String embeddedAppId,
List<String> appIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
wrapper.eq(StudioEmbeddedXcxApply.APP_ID, embeddedAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, appIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
}
}
......@@ -16,13 +16,13 @@ import java.util.stream.Collectors;
*/
public class StudioEmbeddedXcxConvert {
public static StudioEmbeddedXcxApply toEntity(Long studioId, String componentAppId, String systemXcxAppId,
public static StudioEmbeddedXcxApply toEntity(Long studioId, String componentAppId, String embeddedAppId,
String appId) {
StudioEmbeddedXcxApply record = new StudioEmbeddedXcxApply();
record.setId(IdWorker.getId());
record.setComponentAppId(componentAppId);
record.setAuthorizerAppId(systemXcxAppId);
record.setAppId(appId);
record.setAuthorizerAppId(appId);
record.setAppId(embeddedAppId);
record.setStudioId(studioId);
record.setState(EmbededXcxEnum.INIT.getCode());
record.setCreateTime(new Date());
......
......@@ -128,11 +128,17 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Resource(name = "financeThreadPool")
private Executor executor;
/**
* 第三方平台appId
*/
@Value("${wx.component.appId}")
private String wxComponentAppId;
@Value("${wx.authorizer.appId}")
private String authorizerAppId;
/**
* 半屏小程序
*/
@Value("${wx.embedded.appId}")
private String embeddedAppId;
private static final Integer WX_SUCCESS_CODE = 0;
......@@ -262,7 +268,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Override
public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String appId) {
StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAppId(
studioId, wxComponentAppId, authorizerAppId, appId);
studioId, wxComponentAppId, embeddedAppId, appId);
if (null == embeddedXcx) {
return null;
}
......@@ -277,7 +283,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
}
Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAppId(
studioId, wxComponentAppId, authorizerAppId, appIds);
studioId, wxComponentAppId, embeddedAppId, appIds);
appIds.stream()
.filter(appId -> null == existMap.get(appId) || EmbededXcxEnum.isFail(existMap.get(appId).getState()))
.forEach(appId -> {
......@@ -285,13 +291,13 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
StudioEmbeddedXcxApply entity = existMap.get(appId);
if (null == entity) {
entity = StudioEmbeddedXcxConvert.toEntity(studioId, wxComponentAppId, authorizerAppId, appId);
entity = StudioEmbeddedXcxConvert.toEntity(studioId, wxComponentAppId, embeddedAppId, appId);
studioEmbeddedXcxApplyRpService.insert(entity);
} else {
studioEmbeddedXcxApplyRpService.updateById(StudioEmbeddedXcxConvert.toInit(entity));
}
try {
JSONObject result = weXcxService.addEmbeddedXcx(wxComponentAppId, authorizerAppId, appId,
JSONObject result = weXcxService.addEmbeddedXcx(wxComponentAppId, appId, embeddedAppId,
"申请半屏小程序");
Integer code = result.getInteger("errcode");
String message = result.getString("errmsg");
......@@ -317,7 +323,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
}
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAppIds(wxComponentAppId,
authorizerAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
embeddedAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(applies)) {
return;
}
......@@ -363,7 +369,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
int num = 100;
for (int start = 0; start < 10; start++) {
HalfScreenXcxAuthVO vo = weXcxService.listEmbeddedXcx(wxComponentAppId, authorizerAppId, start, num);
HalfScreenXcxAuthVO vo = weXcxService.listEmbeddedXcx(wxComponentAppId, embeddedAppId, 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