Commit fab00c3f by 程裕兵

feat:添加半屏小程序

parent 48f3a19a
......@@ -38,7 +38,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class StudioEmbeddedXcxApply implements Serializable {
private static final long serialVersionUID = 4288943338021568638L;
private static final long serialVersionUID = -4415580599984265484L;
/**
* 备注: 主键 是否允许为null: NO
......@@ -47,32 +47,32 @@ public class StudioEmbeddedXcxApply implements Serializable {
private Long id;
/**
* 备注: 品牌ID 是否允许为null: YES
*/
private Long brandId;
/**
* 备注: 场馆ID 是否允许为null: YES
*/
private Long studioId;
/**
* 备注: 小程序appId 是否允许为null: YES
* 备注: 第三方平台appId 是否允许为null: YES
*/
private String appId;
private String componentAppId;
/**
* 备注: 授权方appId 是否允许为null: YES
* 备注: 授权方appId(专属小程序) 是否允许为null: YES
*/
private String authorizerAppId;
/**
* 备注: 支付小程序appId 是否允许为null: YES
*/
private String appId;
/**
* 备注: 状态 是否允许为null: YES
*/
private String state;
/**
* 失败原因
* 备注: 失败原因 是否允许为null: YES
*/
private String message;
......@@ -89,14 +89,14 @@ public class StudioEmbeddedXcxApply implements Serializable {
public static final String ID = "id";
public static final String BRAND_ID = "brand_id";
public static final String STUDIO_ID = "studio_id";
public static final String APP_ID = "app_id";
public static final String COMPONENT_APP_ID = "component_app_id";
public static final String AUTHORIZER_APP_ID = "authorizer_app_id";
public static final String APP_ID = "app_id";
public static final String STATE = "state";
public static final String MESSAGE = "message";
......
......@@ -17,7 +17,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, brand_id, studio_id, app_id, authorizer_app_id, state, message, create_time, update_time
id, studio_id, component_app_id, authorizer_app_id, app_id, state, message, create_time, update_time
</sql>
</mapper>
......@@ -15,13 +15,10 @@
package com.jiejing.fitness.finance.repository.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.jiejing.fitness.enums.finance.EmbededXcxEnum;
import com.jiejing.fitness.finance.repository.entity.StudioEmbeddedXcxApply;
import com.jiejing.fitness.finance.repository.mapper.StudioEmbeddedXcxApplyMapper;
import com.jiejing.mbp.MapperRepoService;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
......@@ -39,36 +36,40 @@ import org.springframework.stereotype.Service;
public class StudioEmbeddedXcxApplyRpService extends
MapperRepoService<Long, StudioEmbeddedXcxApply, StudioEmbeddedXcxApplyMapper> {
public Map<String, StudioEmbeddedXcxApply> mapByStudioIdAndAppId(Long studioId, List<String> appIds) {
return this.listByStudioIdAndAppId(studioId, appIds).stream()
.collect(Collectors.toMap(StudioEmbeddedXcxApply::getAppId, e -> e));
public Map<String, StudioEmbeddedXcxApply> mapByStudioIdAndAuthorizerAppId(Long studioId,
String componentAppId, String systemXcxAppId, List<String> authorizerAppIds) {
return this.listByStudioIdAndAuthorizerAppId(studioId, componentAppId, systemXcxAppId, authorizerAppIds)
.stream().collect(Collectors.toMap(StudioEmbeddedXcxApply::getAppId, e -> e));
}
public List<StudioEmbeddedXcxApply> listByStudioIdAndAppId(Long studioId, List<String> appIds) {
public List<StudioEmbeddedXcxApply> listByStudioIdAndAuthorizerAppId(Long studioId, String componentAppId,
String systemXcxAppId, List<String> authorizerAppIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
}
public StudioEmbeddedXcxApply getByStudioIdAndAppId(Long studioId, String appId) {
public StudioEmbeddedXcxApply getByStudioIdAndAuthorizerAppId(Long studioId, String componentAppId,
String systemXcxAppId, String authorizerAppId) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
wrapper.eq(StudioEmbeddedXcxApply.APP_ID, appId);
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId);
wrapper.eq(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppId);
return Optional.ofNullable(this.baseMapper.selectList(wrapper))
.orElse(new ArrayList<>(1))
.stream().findFirst().orElse(null);
}
public List<StudioEmbeddedXcxApply> listByStudioId(Long studioId) {
public List<StudioEmbeddedXcxApply> listByAuthorizerAppIds(String componentAppId, String systemXcxAppId,
List<String> authorizerAppIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioEmbeddedXcxApply.STUDIO_ID, studioId);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
}
public List<StudioEmbeddedXcxApply> listByAppIds(List<String> appIds) {
QueryWrapper<StudioEmbeddedXcxApply> wrapper = new QueryWrapper<>();
wrapper.in(StudioEmbeddedXcxApply.APP_ID, appIds);
wrapper.in(StudioEmbeddedXcxApply.COMPONENT_APP_ID, componentAppId);
wrapper.in(StudioEmbeddedXcxApply.APP_ID, systemXcxAppId);
wrapper.in(StudioEmbeddedXcxApply.AUTHORIZER_APP_ID, authorizerAppIds);
return Optional.ofNullable(this.baseMapper.selectList(wrapper)).orElse(new ArrayList<>(1));
}
}
......@@ -238,9 +238,10 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
}
@Override
public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String appId) {
StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAppId(studioId,
appId);
public StudioEmbeddedXcxVO getEmbeddedXcx(Long studioId, String authorizerAppId) {
String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
StudioEmbeddedXcxApply embeddedXcx = studioEmbeddedXcxApplyRpService.getByStudioIdAndAuthorizerAppId(
studioId, wxComponentAppId, systemAppId, authorizerAppId);
if (null == embeddedXcx) {
return null;
}
......@@ -249,8 +250,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Async("financeThreadPool")
@Override
public void bindEmbeddedXcx(Long studioId, List<String> appIds) {
if (CollectionUtil.isEmpty(appIds)) {
public void bindEmbeddedXcx(Long studioId, List<String> authorizerAppIds) {
if (CollectionUtil.isEmpty(authorizerAppIds)) {
return;
}
String systemXcxAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
......@@ -258,9 +259,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
return;
}
Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAppId(
studioId, appIds);
appIds.stream()
Map<String, StudioEmbeddedXcxApply> existMap = studioEmbeddedXcxApplyRpService.mapByStudioIdAndAuthorizerAppId(
studioId, wxComponentAppId, systemXcxAppId, authorizerAppIds);
authorizerAppIds.stream()
.filter(appId -> null == existMap.get(appId))
.forEach(appId -> {
log.info("bind embedded xcx {}, {}", studioId, appId);
......@@ -294,8 +295,9 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
return;
}
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAppIds(
list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
String systemAppId = this.listSystemXcxAppIds().stream().findFirst().orElse(null);
List<StudioEmbeddedXcxApply> applies = studioEmbeddedXcxApplyRpService.listByAuthorizerAppIds(
wxComponentAppId, systemAppId, list.stream().map(AuthXcxInfo::getAppId).collect(Collectors.toList()));
if (CollectionUtil.isEmpty(applies)) {
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