电商小程序功能接口提交

This commit is contained in:
danmo 2024-04-28 11:15:05 +08:00
parent 6b0720a15d
commit ac3a0a0042
10 changed files with 655 additions and 0 deletions

View File

@ -610,6 +610,48 @@ public class DyAppletClient extends BaseClient {
return new AptTaskHandler(configuration().getAgentByTenantId(tenantId, clientKey)).writeOffVideoTask(openId, taskId);
}
/**
* 注册小程序积分阈值
*
* @param query 入参
* @return DySimpleResult
*/
public DySimpleResult<BaseVo> limitOpPoint(LimitOpPointQuery query) {
return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).limitOpPoint(query);
}
/**
* 注册小程序预览图定制类小程序开发者注册信息
*
* @param query 入参
* @return DySimpleResult<BaseVo>
*/
public DySimpleResult<BaseVo> registerMaApp(RegisterMaAppQuery query) {
return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).registerMaApp(query);
}
/**
* 查询订单的定制完成状态
* @param appId 小程序ID
* @param openId 用户ID
* @param orderId 订单ID
* @return DySimpleResult<OrderCizStatusVo>
*/
public DySimpleResult<OrderCizStatusVo> queryOrderCustomizationStatus(String appId, String openId, String orderId) {
return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryOrderCustomizationStatus(appId, openId, orderId);
}
/**
* 退会
* 店铺会员退出
* @param appId 小程序ID
* @param openId 用户ID
* @param shopId 会员ID
* @return DySimpleResult<BaseVo>
*/
public DySimpleResult<BaseVo> shopMemberLeave(String appId, String openId, Long shopId) {
return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).shopMemberLeave(appId, openId, shopId);
}
/**

View File

@ -0,0 +1,58 @@
package com.dyj.applet.client;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.Post;
import com.dyj.applet.domain.query.LimitOpPointQuery;
import com.dyj.applet.domain.query.OrderCizStatusQuery;
import com.dyj.applet.domain.query.RegisterMaAppQuery;
import com.dyj.applet.domain.query.ShopMemberLeaveQuery;
import com.dyj.applet.domain.vo.OrderCizStatusVo;
import com.dyj.common.domain.DySimpleResult;
import com.dyj.common.domain.vo.BaseVo;
import com.dyj.common.interceptor.ClientTokenInterceptor;
/**
* 电商小程序
*
* @author danmo
* @date 2024-04-28 10:17
**/
@BaseRequest(baseURL = "${domain}")
public interface AptEAppletClient {
/**
* 注册小程序积分阈值
*
* @param query 入参
* @return DySimpleResult
*/
@Post(url = "limitOpPoint", interceptor = ClientTokenInterceptor.class)
DySimpleResult<BaseVo> limitOpPoint(@JSONBody LimitOpPointQuery query);
/**
* 注册小程序预览图定制类小程序开发者注册信息
*
* @param query 入参
* @return DySimpleResult
*/
@Post(url = "registerMaApp", interceptor = ClientTokenInterceptor.class)
DySimpleResult<BaseVo> registerMaApp(@JSONBody RegisterMaAppQuery query);
/**
* 查询订单的定制完成状态
*
* @param query 入参
* @return DySimpleResult<OrderCizStatusVo>
*/
@Post(url = "queryOrderCustomizationStatus", interceptor = ClientTokenInterceptor.class)
DySimpleResult<OrderCizStatusVo> queryOrderCustomizationStatus(@JSONBody OrderCizStatusQuery query);
/**
* 退会
* @param query
* @return DySimpleResult<BaseVo>
*/
@Post(url = "shopMemberLeave", interceptor = ClientTokenInterceptor.class)
DySimpleResult<BaseVo> shopMemberLeave(@JSONBody ShopMemberLeaveQuery query);
}

View File

@ -0,0 +1,150 @@
package com.dyj.applet.domain.query;
import com.dyj.common.domain.query.BaseQuery;
/**
* @author danmo
* @date 2024-04-28 10:35
**/
public class LimitOpPointQuery extends BaseQuery {
/**
* 小程序ID
*/
private String app_id;
/**
* 操作类型
* 1-新增或者更新
* 2-删除
*/
private Integer op_type;
/**
* 单日单用户增加积分次数上限不能小于0
*/
private Long daily_add_count;
/**
* 单日单用户减少积分次数上限不能小于0
*/
private Long daily_deduct_count;
/**
* 单次增加积分上限不能小于0
*/
private Long single_add_limit;
/**
* 单次减少积分上限不能小于0
*/
private Long single_deduct_limit;
public static LimitOpPointQueryBuilder builder() {
return new LimitOpPointQueryBuilder();
}
public static class LimitOpPointQueryBuilder {
private String appId;
private Integer opType;
private Long dailyAddCount;
private Long dailyDeductCount;
private Long singleAddLimit;
private Long singleDeductLimit;
private Integer tenantId;
private String clientKey;
public LimitOpPointQueryBuilder appId(String appId) {
this.appId = appId;
return this;
}
public LimitOpPointQueryBuilder opType(Integer opType) {
this.opType = opType;
return this;
}
public LimitOpPointQueryBuilder dailyAddCount(Long dailyAddCount) {
this.dailyAddCount = dailyAddCount;
return this;
}
public LimitOpPointQueryBuilder dailyDeductCount(Long dailyDeductCount) {
this.dailyDeductCount = dailyDeductCount;
return this;
}
public LimitOpPointQueryBuilder singleAddLimit(Long singleAddLimit) {
this.singleAddLimit = singleAddLimit;
return this;
}
public LimitOpPointQueryBuilder singleDeductLimit(Long singleDeductLimit) {
this.singleDeductLimit = singleDeductLimit;
return this;
}
public LimitOpPointQueryBuilder tenantId(Integer tenantId) {
this.tenantId = tenantId;
return this;
}
public LimitOpPointQueryBuilder clientKey(String clientKey) {
this.clientKey = clientKey;
return this;
}
public LimitOpPointQuery build() {
LimitOpPointQuery limitOpPointQuery = new LimitOpPointQuery();
limitOpPointQuery.setApp_id(appId);
limitOpPointQuery.setOp_type(opType);
limitOpPointQuery.setDaily_add_count(dailyAddCount);
limitOpPointQuery.setDaily_deduct_count(dailyDeductCount);
limitOpPointQuery.setSingle_add_limit(singleAddLimit);
limitOpPointQuery.setSingle_deduct_limit(singleDeductLimit);
limitOpPointQuery.setTenantId(tenantId);
limitOpPointQuery.setClientKey(clientKey);
return limitOpPointQuery;
}
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public Integer getOp_type() {
return op_type;
}
public void setOp_type(Integer op_type) {
this.op_type = op_type;
}
public Long getDaily_add_count() {
return daily_add_count;
}
public void setDaily_add_count(Long daily_add_count) {
this.daily_add_count = daily_add_count;
}
public Long getDaily_deduct_count() {
return daily_deduct_count;
}
public void setDaily_deduct_count(Long daily_deduct_count) {
this.daily_deduct_count = daily_deduct_count;
}
public Long getSingle_add_limit() {
return single_add_limit;
}
public void setSingle_add_limit(Long single_add_limit) {
this.single_add_limit = single_add_limit;
}
public Long getSingle_deduct_limit() {
return single_deduct_limit;
}
public void setSingle_deduct_limit(Long single_deduct_limit) {
this.single_deduct_limit = single_deduct_limit;
}
}

View File

@ -0,0 +1,81 @@
package com.dyj.applet.domain.query;
import com.dyj.common.domain.query.BaseQuery;
/**
* @author danmo
* @date 2024-04-28 10:51
**/
public class OrderCizStatusQuery extends BaseQuery {
private String app_id;
private String open_id;
private String order_id;
public static OrderCizStatusQueryBuilder builder() {
return new OrderCizStatusQueryBuilder();
}
public static class OrderCizStatusQueryBuilder {
private String appId;
private String openId;
private String orderId;
private Integer tenantId;
private String clientKey;
public OrderCizStatusQueryBuilder appId(String appId) {
this.appId = appId;
return this;
}
public OrderCizStatusQueryBuilder openId(String openId) {
this.openId = openId;
return this;
}
public OrderCizStatusQueryBuilder orderId(String orderId) {
this.orderId = orderId;
return this;
}
public OrderCizStatusQueryBuilder tenantId(Integer tenantId) {
this.tenantId = tenantId;
return this;
}
public OrderCizStatusQueryBuilder clientKey(String clientKey) {
this.clientKey = clientKey;
return this;
}
public OrderCizStatusQuery build() {
OrderCizStatusQuery orderCizStatusQuery = new OrderCizStatusQuery();
orderCizStatusQuery.setApp_id(appId);
orderCizStatusQuery.setOpen_id(openId);
orderCizStatusQuery.setOrder_id(orderId);
orderCizStatusQuery.setTenantId(tenantId);
orderCizStatusQuery.setClientKey(clientKey);
return orderCizStatusQuery;
}
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public String getOpen_id() {
return open_id;
}
public void setOpen_id(String open_id) {
this.open_id = open_id;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
}

View File

@ -0,0 +1,124 @@
package com.dyj.applet.domain.query;
import com.dyj.common.domain.query.BaseQuery;
/**
* @author danmo
* @date 2024-04-28 10:43
**/
public class RegisterMaAppQuery extends BaseQuery {
/**
* 小程序ID
*/
private String app_id;
/**
* 定制商品
* 1-定制商品
* 2-会员营销
* 3-加购导购
* 4-权益互动
* 5-购后课程
*/
private Integer ecom_microapp_type;
private String callback_url;
private String extra;
private String preview_photo_url;
public static RegisterMaAppQueryBuilder builder() {
return new RegisterMaAppQueryBuilder();
}
public static class RegisterMaAppQueryBuilder {
private String appId;
private Integer ecomMicroappType;
private String callbackUrl;
private String extra;
private String previewPhotoUrl;
private Integer tenantId;
private String clientKey;
public RegisterMaAppQueryBuilder appId(String appId) {
this.appId = appId;
return this;
}
public RegisterMaAppQueryBuilder ecomMicroappType(Integer ecomMicroappType) {
this.ecomMicroappType = ecomMicroappType;
return this;
}
public RegisterMaAppQueryBuilder callbackUrl(String callbackUrl) {
this.callbackUrl = callbackUrl;
return this;
}
public RegisterMaAppQueryBuilder extra(String extra) {
this.extra = extra;
return this;
}
public RegisterMaAppQueryBuilder previewPhotoUrl(String previewPhotoUrl) {
this.previewPhotoUrl = previewPhotoUrl;
return this;
}
public RegisterMaAppQueryBuilder tenantId(Integer tenantId) {
this.tenantId = tenantId;
return this;
}
public RegisterMaAppQueryBuilder clientKey(String clientKey) {
this.clientKey = clientKey;
return this;
}
public RegisterMaAppQuery build() {
RegisterMaAppQuery registerMaAppQuery = new RegisterMaAppQuery();
registerMaAppQuery.setApp_id(appId);
registerMaAppQuery.setEcom_microapp_type(ecomMicroappType);
registerMaAppQuery.setCallback_url(callbackUrl);
registerMaAppQuery.setExtra(extra);
registerMaAppQuery.setPreview_photo_url(previewPhotoUrl);
registerMaAppQuery.setTenantId(tenantId);
registerMaAppQuery.setClientKey(clientKey);
return registerMaAppQuery;
}
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public Integer getEcom_microapp_type() {
return ecom_microapp_type;
}
public void setEcom_microapp_type(Integer ecom_microapp_type) {
this.ecom_microapp_type = ecom_microapp_type;
}
public String getCallback_url() {
return callback_url;
}
public void setCallback_url(String callback_url) {
this.callback_url = callback_url;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public String getPreview_photo_url() {
return preview_photo_url;
}
public void setPreview_photo_url(String preview_photo_url) {
this.preview_photo_url = preview_photo_url;
}
}

View File

@ -0,0 +1,89 @@
package com.dyj.applet.domain.query;
import com.dyj.common.domain.query.BaseQuery;
/**
* @author danmo
* @date 2024-04-28 10:56
**/
public class ShopMemberLeaveQuery extends BaseQuery {
private String app_id;
private String open_id;
private Long shop_id;
public static ShopMemberLeaveQueryBuilder builder() {
return new ShopMemberLeaveQueryBuilder();
}
public static class ShopMemberLeaveQueryBuilder {
private String appId;
private String openId;
private Long shopId;
private Integer tenantId;
private String clientKey;
public ShopMemberLeaveQueryBuilder appId(String appId) {
this.appId = appId;
return this;
}
public ShopMemberLeaveQueryBuilder openId(String openId) {
this.openId = openId;
return this;
}
public ShopMemberLeaveQueryBuilder shopId(Long shopId) {
this.shopId = shopId;
return this;
}
public ShopMemberLeaveQueryBuilder tenantId(Integer tenantId) {
this.tenantId = tenantId;
return this;
}
public ShopMemberLeaveQueryBuilder clientKey(String clientKey) {
this.clientKey = clientKey;
return this;
}
public ShopMemberLeaveQuery build() {
ShopMemberLeaveQuery shopMemberLeaveQuery = new ShopMemberLeaveQuery();
shopMemberLeaveQuery.setApp_id(appId);
shopMemberLeaveQuery.setOpen_id(openId);
shopMemberLeaveQuery.setShop_id(shopId);
shopMemberLeaveQuery.setTenantId(tenantId);
shopMemberLeaveQuery.setClientKey(clientKey);
return shopMemberLeaveQuery;
}
}
public String getApp_id() {
return app_id;
}
public void setApp_id(String app_id) {
this.app_id = app_id;
}
public String getOpen_id() {
return open_id;
}
public void setOpen_id(String open_id) {
this.open_id = open_id;
}
public Long getShop_id() {
return shop_id;
}
public void setShop_id(Long shop_id) {
this.shop_id = shop_id;
}
}

View File

@ -0,0 +1,21 @@
package com.dyj.applet.domain.vo;
/**
* @author danmo
* @date 2024-04-28 10:54
**/
public class OrderCizStatusVo {
/**
* 定制状态0-已定制完成 1-未定制完成 2-未知
*/
private Integer success_code;
public Integer getSuccess_code() {
return success_code;
}
public void setSuccess_code(Integer success_code) {
this.success_code = success_code;
}
}

View File

@ -58,6 +58,10 @@ public abstract class AbstractAppletHandler {
return SpringUtils.getBean(PromotionCouponClient.class);
}
protected AptEAppletClient getEAppletClient() {
return SpringUtils.getBean(AptEAppletClient.class);
}
protected BaseQuery baseQuery(){
return baseQuery(null);
}

View File

@ -0,0 +1,77 @@
package com.dyj.applet.handler;
import com.dyj.applet.domain.query.LimitOpPointQuery;
import com.dyj.applet.domain.query.OrderCizStatusQuery;
import com.dyj.applet.domain.query.RegisterMaAppQuery;
import com.dyj.applet.domain.query.ShopMemberLeaveQuery;
import com.dyj.applet.domain.vo.OrderCizStatusVo;
import com.dyj.common.config.AgentConfiguration;
import com.dyj.common.domain.DySimpleResult;
import com.dyj.common.domain.vo.BaseVo;
/**
* @author danmo
* @date 2024-04-28 11:00
**/
public class AptEAppletHandler extends AbstractAppletHandler {
public AptEAppletHandler(AgentConfiguration agentConfiguration) {
super(agentConfiguration);
}
/**
* 注册小程序积分阈值
*
* @param query 入参
* @return DySimpleResult
*/
public DySimpleResult<BaseVo> limitOpPoint(LimitOpPointQuery query) {
baseQuery(query);
return getEAppletClient().limitOpPoint(query);
}
/**
* 注册小程序预览图定制类小程序开发者注册信息
*
* @param query 入参
* @return DySimpleResult<BaseVo>
*/
public DySimpleResult<BaseVo> registerMaApp(RegisterMaAppQuery query) {
baseQuery(query);
return getEAppletClient().registerMaApp(query);
}
/**
* 查询订单的定制完成状态
* @param appId 小程序ID
* @param openId 用户ID
* @param orderId 订单ID
* @return DySimpleResult<OrderCizStatusVo>
*/
public DySimpleResult<OrderCizStatusVo> queryOrderCustomizationStatus(String appId, String openId, String orderId) {
return getEAppletClient().queryOrderCustomizationStatus(OrderCizStatusQuery.builder()
.appId(appId)
.openId(openId)
.orderId(orderId)
.tenantId(agentConfiguration.getTenantId())
.clientKey(agentConfiguration.getClientKey())
.build());
}
/**
* 退会
* 店铺会员退出
* @param appId 小程序ID
* @param openId 用户ID
* @param shopId 会员ID
* @return DySimpleResult<BaseVo>
*/
public DySimpleResult<BaseVo> shopMemberLeave(String appId, String openId, Long shopId) {
return getEAppletClient().shopMemberLeave(ShopMemberLeaveQuery.builder()
.appId(appId)
.openId(openId)
.shopId(shopId)
.tenantId(agentConfiguration.getTenantId())
.clientKey(agentConfiguration.getClientKey())
.build());
}
}

View File

@ -110,6 +110,15 @@ public enum DyAppletUrlPathEnum {
//核销视频任务
WRITE_OFF_VIDEO_TASK("writeOffVideoTask","/api/apps/v2/task/writeoff_video/"),
//注册小程序积分阈值
LIMIT_OP_POINT("limitOpPoint","/api/ecom/v1/config/limit_op_point/"),
//注册小程序预览图定制类小程序开发者注册信息
REGISTER_MA_APP("registerMaApp","/api/ecom/v1/config/register_ma_app/"),
//查询订单的定制完成状态
QUERY_ORDER_CUSTOMIZATION_STATUS("queryOrderCustomizationStatus", "/api/ecom/v1/customization/query_status/"),
//退会
SHOP_MEMBER_LEAVE("shopMemberLeave","/api/ecom/v1/shop_member/leave/"),
/**
* 查询用户可用券信息
*/