Commit fab00c3f by 程裕兵

feat:添加半屏小程序

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