From ac3a0a004271af19155da8c1c0c1f443195657f3 Mon Sep 17 00:00:00 2001 From: danmo <775144922@qq.com> Date: Sun, 28 Apr 2024 11:15:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=95=86=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dyj/applet/DyAppletClient.java | 42 +++++ .../dyj/applet/client/AptEAppletClient.java | 58 +++++++ .../domain/query/LimitOpPointQuery.java | 150 ++++++++++++++++++ .../domain/query/OrderCizStatusQuery.java | 81 ++++++++++ .../domain/query/RegisterMaAppQuery.java | 124 +++++++++++++++ .../domain/query/ShopMemberLeaveQuery.java | 89 +++++++++++ .../applet/domain/vo/OrderCizStatusVo.java | 21 +++ .../applet/handler/AbstractAppletHandler.java | 4 + .../dyj/applet/handler/AptEAppletHandler.java | 77 +++++++++ .../dyj/common/enums/DyAppletUrlPathEnum.java | 9 ++ 10 files changed, 655 insertions(+) create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/client/AptEAppletClient.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/LimitOpPointQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/OrderCizStatusQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/RegisterMaAppQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/ShopMemberLeaveQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/vo/OrderCizStatusVo.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/handler/AptEAppletHandler.java diff --git a/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java b/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java index a057be7..509285c 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/DyAppletClient.java @@ -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 limitOpPoint(LimitOpPointQuery query) { + return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).limitOpPoint(query); + } + + /** + * 注册小程序预览图、定制类小程序开发者注册信息 + * + * @param query 入参 + * @return DySimpleResult + */ + public DySimpleResult registerMaApp(RegisterMaAppQuery query) { + return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).registerMaApp(query); + } + + /** + * 查询订单的定制完成状态 + * @param appId 小程序ID + * @param openId 用户ID + * @param orderId 订单ID + * @return DySimpleResult + */ + public DySimpleResult 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 + */ + public DySimpleResult shopMemberLeave(String appId, String openId, Long shopId) { + return new AptEAppletHandler(configuration().getAgentByTenantId(tenantId, clientKey)).shopMemberLeave(appId, openId, shopId); + } /** diff --git a/dy-java-applet/src/main/java/com/dyj/applet/client/AptEAppletClient.java b/dy-java-applet/src/main/java/com/dyj/applet/client/AptEAppletClient.java new file mode 100644 index 0000000..7c7d6d4 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/client/AptEAppletClient.java @@ -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 limitOpPoint(@JSONBody LimitOpPointQuery query); + + /** + * 注册小程序预览图、定制类小程序开发者注册信息 + * + * @param query 入参 + * @return DySimpleResult + */ + @Post(url = "registerMaApp", interceptor = ClientTokenInterceptor.class) + DySimpleResult registerMaApp(@JSONBody RegisterMaAppQuery query); + + /** + * 查询订单的定制完成状态 + * + * @param query 入参 + * @return DySimpleResult + */ + @Post(url = "queryOrderCustomizationStatus", interceptor = ClientTokenInterceptor.class) + DySimpleResult queryOrderCustomizationStatus(@JSONBody OrderCizStatusQuery query); + + /** + * 退会 + * @param query + * @return DySimpleResult + */ + @Post(url = "shopMemberLeave", interceptor = ClientTokenInterceptor.class) + DySimpleResult shopMemberLeave(@JSONBody ShopMemberLeaveQuery query); +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/LimitOpPointQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/LimitOpPointQuery.java new file mode 100644 index 0000000..a87ad97 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/LimitOpPointQuery.java @@ -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; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/OrderCizStatusQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/OrderCizStatusQuery.java new file mode 100644 index 0000000..cd7d362 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/OrderCizStatusQuery.java @@ -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; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RegisterMaAppQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RegisterMaAppQuery.java new file mode 100644 index 0000000..2fb10ff --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/RegisterMaAppQuery.java @@ -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; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ShopMemberLeaveQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ShopMemberLeaveQuery.java new file mode 100644 index 0000000..1d57139 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ShopMemberLeaveQuery.java @@ -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; + } +} + diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/OrderCizStatusVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/OrderCizStatusVo.java new file mode 100644 index 0000000..35c2581 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/OrderCizStatusVo.java @@ -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; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java index 2c87775..9e8013f 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/AbstractAppletHandler.java @@ -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); } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/AptEAppletHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/AptEAppletHandler.java new file mode 100644 index 0000000..055a753 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/AptEAppletHandler.java @@ -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 limitOpPoint(LimitOpPointQuery query) { + baseQuery(query); + return getEAppletClient().limitOpPoint(query); + } + + /** + * 注册小程序预览图、定制类小程序开发者注册信息 + * + * @param query 入参 + * @return DySimpleResult + */ + public DySimpleResult registerMaApp(RegisterMaAppQuery query) { + baseQuery(query); + return getEAppletClient().registerMaApp(query); + } + + /** + * 查询订单的定制完成状态 + * @param appId 小程序ID + * @param openId 用户ID + * @param orderId 订单ID + * @return DySimpleResult + */ + public DySimpleResult 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 + */ + public DySimpleResult 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()); + } +} diff --git a/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java b/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java index e9f1118..afe9a6c 100644 --- a/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java +++ b/dy-java-common/src/main/java/com/dyj/common/enums/DyAppletUrlPathEnum.java @@ -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/"), + /** * 查询用户可用券信息 */