Commit 84970b15 by 程裕兵

feat:添加半屏小程序

parent 15762201
...@@ -36,40 +36,40 @@ import org.springframework.stereotype.Service; ...@@ -36,40 +36,40 @@ import org.springframework.stereotype.Service;
public class StudioEmbeddedXcxApplyRpService extends public class StudioEmbeddedXcxApplyRpService extends
MapperRepoService<Long, StudioEmbeddedXcxApply, StudioEmbeddedXcxApplyMapper> { MapperRepoService<Long, StudioEmbeddedXcxApply, StudioEmbeddedXcxApplyMapper> {
public Map<String, StudioEmbeddedXcxApply> mapByStudioIdAndAuthorizerAppId(Long studioId, public Map<String, StudioEmbeddedXcxApply> mapByStudioIdAndAppId(Long studioId,
String componentAppId, String systemXcxAppId, List<String> authorizerAppIds) { String componentAppId, String systemXcxAppId, List<String> appIds) {
return this.listByStudioIdAndAuthorizerAppId(studioId, componentAppId, systemXcxAppId, authorizerAppIds) return this.listByStudioIdAndAppId(studioId, componentAppId, systemXcxAppId, appIds)
.stream().collect(Collectors.toMap(StudioEmbeddedXcxApply::getAppId, e -> e)); .stream().collect(Collectors.toMap(StudioEmbeddedXcxApply::getAppId, e -> e));
} }
public List<StudioEmbeddedXcxApply> listByStudioIdAndAuthorizerAppId(Long studioId, String componentAppId, public List<StudioEmbeddedXcxApply> listByStudioIdAndAppId(Long studioId, String componentAppId,
String systemXcxAppId, List<String> authorizerAppIds) { String systemXcxAppId, List<String> appIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>(); QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId); wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId); wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId); wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppIds); wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1)); return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
} }
public StudioEmbeddedXcxApply getByStudioIdAndAuthorizerAppId(Long studioId, String componentAppId, public StudioEmbeddedXcxApply getByStudioIdAndAppId(Long studioId, String componentAppId,
String systemXcxAppId, String authorizerAppId) { String systemXcxAppId, String appId) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>(); QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId); wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId); wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId); wrapper.eq(StudioEmbeddedXcxApply.APP_ID, appId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppId); wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)) return Optional.ofNullable(this.baseMapper.selectList(wrapper))
.orElse(new ArrayList<>(1)) .orElse(new ArrayList<>(1))
.stream().findFirst().orElse(null); .stream().findFirst().orElse(null);
} }
public List<StudioEmbeddedXcxApply> listByAuthorizerAppIds(String componentAppId, String systemXcxAppId, public List<StudioEmbeddedXcxApply> listByAppIds(String componentAppId, String systemXcxAppId,
List<String> authorizerAppIds) { List<String> appIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>(); QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId); wrapper.eq(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId); wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppIds); wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1)); return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
} }
} }
...@@ -17,12 +17,12 @@ import java.util.stream.Collectors; ...@@ -17,12 +17,12 @@ import java.util.stream.Collectors;
public class StudioEmbeddedXcxConvert { public class StudioEmbeddedXcxConvert {
public static StudioEmbeddedXcxApply toEntity(Long studioId, String componentAppId, String systemXcxAppId, public static StudioEmbeddedXcxApply toEntity(Long studioId, String componentAppId, String systemXcxAppId,
String authorizerAppId) { String appId) {
StudioEmbeddedXcxApply record = new StudioEmbeddedXcxApply(); StudioEmbeddedXcxApply record = new StudioEmbeddedXcxApply();
record.setId(IdWorker.getId()); record.setId(IdWorker.getId());
record.setComponentAppId(componentAppId); record.setComponentAppId(componentAppId);
record.setAppId(systemXcxAppId); record.setAuthorizerAppId(systemXcxAppId);
record.setAuthorizerAppId(authorizerAppId); record.setAppId(appId);
record.setStudioId(studioId); record.setStudioId(studioId);
record.setState(EmbededXcxEnum.INIT.getCode()); record.setState(EmbededXcxEnum.INIT.getCode());
record.setCreateTime(new Date()); record.setCreateTime(new Date());
......
...@@ -257,10 +257,10 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -257,10 +257,10 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
} }
@Override @Override
public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String authorizerAppId) { public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String appId) {
String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null); String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAuthorizerAppId( StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAppId(
studioId, wxComponentAppId, systemAppId, authorizerAppId); studioId, wxComponentAppId, systemAppId, appId);
if (null == embeddedXcx) { if (null == embeddedXcx) {
return null; return null;
} }
...@@ -269,8 +269,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -269,8 +269,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Async("financeThreadPool") @Async("financeThreadPool")
@Override @Override
public void bindEmbeddedXcx(Long studioId, List<String> authorizerAppIds) { public void bindEmbeddedXcx(Long studioId, List<String> appIds) {
if (CollectionUtil.isEmpty(authorizerAppIds)) { if (CollectionUtil.isEmpty(appIds)) {
return; return;
} }
String systemXcxAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null); String systemXcxAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
...@@ -278,9 +278,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -278,9 +278,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
return; return;
} }
Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAuthorizerAppId( Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAppId(
studioId, wxComponentAppId, systemXcxAppId, authorizerAppIds); studioId, wxComponentAppId, systemXcxAppId, appIds);
authorizerAppIds.stream() appIds.stream()
.filter(appId -> null == existMap.get(appId) || EmbededXcxEnum.isFail(existMap.get(appId).getState())) .filter(appId -> null == existMap.get(appId) || EmbededXcxEnum.isFail(existMap.get(appId).getState()))
.forEach(appId -> { .forEach(appId -> {
log.info("bind embedded xcx {}, {}", studioId, appId); log.info("bind embedded xcx {}, {}", studioId, appId);
...@@ -321,7 +321,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService { ...@@ -321,7 +321,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
return; return;
} }
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAuthorizerAppIds( List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAppIds(
wxComponentAppId, systemAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList())); wxComponentAppId, systemAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(applies)) { if (CollectionUtil.isEmpty(applies)) {
return; return;
......
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