From 5222ad895da6f54438dd75d14977cb237084ffe3 Mon Sep 17 00:00:00 2001 From: 353259576 <1048058229@qq.com> Date: Tue, 9 Jul 2024 16:42:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=A4=E6=98=93=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=94=9F=E6=B4=BB=E6=9C=8D=E5=8A=A1=E4=BA=A4=E6=98=93=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=9A=E9=A2=84=E4=B8=8B=E5=8D=95=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E5=8F=91=E8=B5=B7=E4=B8=8B=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dyj/applet/DyAppletClient.java | 9 + .../client/IndustryTransactionClient.java | 11 + .../domain/IndustryOrderGoodsBookInfo.java | 56 ++++ .../applet/domain/IndustryOrderGoodsInfo.java | 181 +++++++++++ .../applet/domain/IndustryOrderGoodsPage.java | 39 +++ .../domain/IndustryOrderItemOrderDetail.java | 35 +++ .../domain/IndustryOrderItemOrderInfo.java | 51 ++++ .../domain/IndustryOrderOrderEntrySchema.java | 40 +++ .../applet/domain/IndustryOrderValidTime.java | 55 ++++ .../query/PreCreateIndustryOrderQuery.java | 281 ++++++++++++++++++ .../domain/vo/PreCreateIndustryOrderVo.java | 83 ++++++ .../handler/IndustryTransactionHandler.java | 16 + .../dyj/common/enums/DyAppletUrlPathEnum.java | 5 + .../dyj/examples/applet/TransactionTest.java | 13 + 14 files changed, 875 insertions(+) create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsBookInfo.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsInfo.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsPage.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderDetail.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderInfo.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderOrderEntrySchema.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderValidTime.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/PreCreateIndustryOrderQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/vo/PreCreateIndustryOrderVo.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 b0c8278..ee250ee 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 @@ -2076,6 +2076,15 @@ public class DyAppletClient extends BaseClient { return new IndustryTransactionHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryIndustryOrderCps(body); } + /** + * 生活服务交易系统->预下单->开发者发起下单 + * @param body + * @return + */ + public DySimpleResult preCreateIndustryOrder(PreCreateIndustryOrderQuery body){ + return new IndustryTransactionHandler(configuration().getAgentByTenantId(tenantId, clientKey)).preCreateIndustryOrder(body); + } + /** * 获取抖音号绑定所需的资质模版列表 * diff --git a/dy-java-applet/src/main/java/com/dyj/applet/client/IndustryTransactionClient.java b/dy-java-applet/src/main/java/com/dyj/applet/client/IndustryTransactionClient.java index 7a4bfcd..2ae6adb 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/client/IndustryTransactionClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/client/IndustryTransactionClient.java @@ -3,13 +3,16 @@ 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.PreCreateIndustryOrderQuery; import com.dyj.applet.domain.query.QueryIndustryOrderCpsQuery; import com.dyj.applet.domain.query.QueryIndustryOrderQuery; import com.dyj.applet.domain.query.QueryIndustryItemOrderInfoQuery; +import com.dyj.applet.domain.vo.PreCreateIndustryOrderVo; import com.dyj.applet.domain.vo.QueryIndustryCpsVo; import com.dyj.applet.domain.vo.QueryIndustryOrderVo; import com.dyj.applet.domain.vo.QueryIndustryItemOrderInfoVo; import com.dyj.common.domain.DataAndExtraVo; +import com.dyj.common.domain.DySimpleResult; import com.dyj.common.interceptor.ClientTokenInterceptor; /** @@ -42,4 +45,12 @@ public interface IndustryTransactionClient { */ @Post(value = "${queryIndustryOrderCps}", interceptor = ClientTokenInterceptor.class) DataAndExtraVo queryIndustryOrderCps(@JSONBody QueryIndustryOrderCpsQuery body); + + /** + * 生活服务交易系统->预下单->开发者发起下单 + * @param body + * @return + */ + @Post(value = "${preCreateIndustryOrder}", interceptor = ClientTokenInterceptor.class) + DySimpleResult preCreateIndustryOrder(@JSONBody PreCreateIndustryOrderQuery body); } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsBookInfo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsBookInfo.java new file mode 100644 index 0000000..d0ec4e4 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsBookInfo.java @@ -0,0 +1,56 @@ +package com.dyj.applet.domain; + +/** + * 预约信息 + */ +public class IndustryOrderGoodsBookInfo { + + /** + * 预约类型, + * 1:不需要预约 + * 2:在线预约 + */ + private Integer book_type; + + /** + * 取消政策, + * 1:预约后不可取消 + * 2:预约后可取消 + * 3:预约中可取消,预约成功须提前 x 小时取消 + * 选填 + */ + private Integer cancel_policy; + + /** + * 提前取消的小时限制 + * 选填 + */ + private Integer cancel_advance_hour; + + public Integer getBook_type() { + return book_type; + } + + public IndustryOrderGoodsBookInfo setBook_type(Integer book_type) { + this.book_type = book_type; + return this; + } + + public Integer getCancel_policy() { + return cancel_policy; + } + + public IndustryOrderGoodsBookInfo setCancel_policy(Integer cancel_policy) { + this.cancel_policy = cancel_policy; + return this; + } + + public Integer getCancel_advance_hour() { + return cancel_advance_hour; + } + + public IndustryOrderGoodsBookInfo setCancel_advance_hour(Integer cancel_advance_hour) { + this.cancel_advance_hour = cancel_advance_hour; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsInfo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsInfo.java new file mode 100644 index 0000000..98cd16a --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsInfo.java @@ -0,0 +1,181 @@ +package com.dyj.applet.domain; + +/** + * 商品信息 + */ +public class IndustryOrderGoodsInfo { + + /** + * 商品图片链接,长度 <= 512 byte + * 注意:非 POI 商品必传 + */ + private String goods_image; + + /** + * 商品标题/商品名称,长度 <= 256 byte + * 注意:非 POI 商品必传 + */ + private String goods_title; + + /** + * 商品标签,最多设置三个标签,例如:随时退|免预约|提前3日预约(“|”是中文类型),详见 pay-button 支付 的 type 的合法值 部分,注意不是 good-type 的合法值。 + * 注意:非 POI 商品必传 + */ + private String labels; + + /** + * 使用规则,如 “周一至周日可用”、“周一至周五可用”、“非节假日可用”,默认“周一至周日可用” + */ + private String date_rule; + + /** + * 商品价格,单位(分) + * 注意:非 POI 商品必传 + */ + private Long price; + + /** + * 商品数量 + */ + private Integer quantity; + + /** + * 商品 id + */ + private String goods_id; + + /** + * 商品 id 类别, + * POI 商品传 1 + * 非 POI 商品传 2 + */ + private Integer goods_id_type; + + /** + * 商品详情页 + */ + private IndustryOrderGoodsPage goods_page; + + /** + * 券的有效期 + */ + private IndustryOrderValidTime order_valid_time; + + /** + * 折扣金额,单位分 + */ + private Long discount_amount; + + /** + * 预约信息 + */ + private IndustryOrderGoodsBookInfo goods_book_info; + + public String getGoods_image() { + return goods_image; + } + + public IndustryOrderGoodsInfo setGoods_image(String goods_image) { + this.goods_image = goods_image; + return this; + } + + public String getGoods_title() { + return goods_title; + } + + public IndustryOrderGoodsInfo setGoods_title(String goods_title) { + this.goods_title = goods_title; + return this; + } + + public String getLabels() { + return labels; + } + + public IndustryOrderGoodsInfo setLabels(String labels) { + this.labels = labels; + return this; + } + + public String getDate_rule() { + return date_rule; + } + + public IndustryOrderGoodsInfo setDate_rule(String date_rule) { + this.date_rule = date_rule; + return this; + } + + public Long getPrice() { + return price; + } + + public IndustryOrderGoodsInfo setPrice(Long price) { + this.price = price; + return this; + } + + public Integer getQuantity() { + return quantity; + } + + public IndustryOrderGoodsInfo setQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + public String getGoods_id() { + return goods_id; + } + + public IndustryOrderGoodsInfo setGoods_id(String goods_id) { + this.goods_id = goods_id; + return this; + } + + public Integer getGoods_id_type() { + return goods_id_type; + } + + public IndustryOrderGoodsInfo setGoods_id_type(Integer goods_id_type) { + this.goods_id_type = goods_id_type; + return this; + } + + public IndustryOrderGoodsPage getGoods_page() { + return goods_page; + } + + public IndustryOrderGoodsInfo setGoods_page(IndustryOrderGoodsPage goods_page) { + this.goods_page = goods_page; + return this; + } + + public IndustryOrderValidTime getOrder_valid_time() { + return order_valid_time; + } + + public IndustryOrderGoodsInfo setOrder_valid_time(IndustryOrderValidTime order_valid_time) { + this.order_valid_time = order_valid_time; + return this; + } + + public Long getDiscount_amount() { + return discount_amount; + } + + public IndustryOrderGoodsInfo setDiscount_amount(Long discount_amount) { + this.discount_amount = discount_amount; + return this; + } + + public IndustryOrderGoodsBookInfo getGoods_book_info() { + return goods_book_info; + } + + public IndustryOrderGoodsInfo setGoods_book_info(IndustryOrderGoodsBookInfo goods_book_info) { + this.goods_book_info = goods_book_info; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsPage.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsPage.java new file mode 100644 index 0000000..aac8e75 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderGoodsPage.java @@ -0,0 +1,39 @@ +package com.dyj.applet.domain; + +/** + * 商品详情页 + */ +public class IndustryOrderGoodsPage { + + /** + * 订单详情页跳转路径,没有前导的“/”,长度 <= 512byte + */ + private String path; + + /** + * 订单详情页路径参数,自定义的 json 结构, + * 序列化成字符串存入该字段,平台不限制, + * 但是写入的内容需要能够保证生成访问订单详情的 schema 能正确跳转到小程序内部的订单详情页, + * 长度 <= 512byte + * 选填 + */ + private String params; + + public String getPath() { + return path; + } + + public IndustryOrderGoodsPage setPath(String path) { + this.path = path; + return this; + } + + public String getParams() { + return params; + } + + public IndustryOrderGoodsPage setParams(String params) { + this.params = params; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderDetail.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderDetail.java new file mode 100644 index 0000000..b1fd54e --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderDetail.java @@ -0,0 +1,35 @@ +package com.dyj.applet.domain; + +/** + * 商品 item_order 详细信息 + */ +public class IndustryOrderItemOrderDetail { + + /** + * item 单 id + */ + private String item_order_id; + + /** + * 商品优惠后价格 + */ + private Long price; + + public String getItem_order_id() { + return item_order_id; + } + + public IndustryOrderItemOrderDetail setItem_order_id(String item_order_id) { + this.item_order_id = item_order_id; + return this; + } + + public Long getPrice() { + return price; + } + + public IndustryOrderItemOrderDetail setPrice(Long price) { + this.price = price; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderInfo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderInfo.java new file mode 100644 index 0000000..212adbd --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderItemOrderInfo.java @@ -0,0 +1,51 @@ +package com.dyj.applet.domain; + +import java.util.List; + +/** + * 商品 item_order 信息 + */ +public class IndustryOrderItemOrderInfo { + + /** + * 商品 id + */ + private String goods_id; + + /** + * item_order_id 列表,id 个数与下单时对应 goods_id 的 quantity 一致 + */ + private List item_order_id_list; + + /** + * 商品 item_order 详细信息 + */ + private List item_order_detail; + + public String getGoods_id() { + return goods_id; + } + + public IndustryOrderItemOrderInfo setGoods_id(String goods_id) { + this.goods_id = goods_id; + return this; + } + + public List getItem_order_id_list() { + return item_order_id_list; + } + + public IndustryOrderItemOrderInfo setItem_order_id_list(List item_order_id_list) { + this.item_order_id_list = item_order_id_list; + return this; + } + + public List getItem_order_detail() { + return item_order_detail; + } + + public IndustryOrderItemOrderInfo setItem_order_detail(List item_order_detail) { + this.item_order_detail = item_order_detail; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderOrderEntrySchema.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderOrderEntrySchema.java new file mode 100644 index 0000000..3ddfa06 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderOrderEntrySchema.java @@ -0,0 +1,40 @@ +package com.dyj.applet.domain; + +/** + * 订单详情页信息 + */ +public class IndustryOrderOrderEntrySchema { + + /** + * 订单详情页跳转路径,没有前导的“/”,长度 <= 512byte + */ + private String path; + + /** + * 订单详情页路径参数,自定义的 json 结构, + * 序列化成字符串存入该字段, + * 平台不限制, + * 但是写入的内容需要能够保证生成访问订单详情的 schema 能正确跳转到小程序内部的订单详情页, + * 长度 <= 512byte + * 选填 + */ + private String params; + + public String getPath() { + return path; + } + + public IndustryOrderOrderEntrySchema setPath(String path) { + this.path = path; + return this; + } + + public String getParams() { + return params; + } + + public IndustryOrderOrderEntrySchema setParams(String params) { + this.params = params; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderValidTime.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderValidTime.java new file mode 100644 index 0000000..1a1c705 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/IndustryOrderValidTime.java @@ -0,0 +1,55 @@ +package com.dyj.applet.domain; + +/** + * 券的有效期 + */ +public class IndustryOrderValidTime { + + /** + * 券的有效期开始时间,单位毫秒,须大于 0 选填 + */ + private Long valid_start_time; + + /** + * 券的有效期结束时间,单位毫秒,须大于 0,且须大于 valid_start_time 和当前时间 选填 + */ + private Long valid_end_time; + + /** + * a.券的相对有效时间,单位毫秒,须大于 0 + * b.与 valid_start_time、valid_end_time 组合,至少回传一个,否则会下单失败 + * c.都合法优先使用 valid_start_time、valid_end_time 组合 + * d.当 valid_duration 有效时, + * 券的有效期开始时间 S = 订单支付完成时间 + * 券的有效期结束时间 E = 1 天 + 向下按天截断(S + valid_duration))。 + * 选填 + */ + private Long valid_duration; + + public Long getValid_start_time() { + return valid_start_time; + } + + public IndustryOrderValidTime setValid_start_time(Long valid_start_time) { + this.valid_start_time = valid_start_time; + return this; + } + + public Long getValid_end_time() { + return valid_end_time; + } + + public IndustryOrderValidTime setValid_end_time(Long valid_end_time) { + this.valid_end_time = valid_end_time; + return this; + } + + public Long getValid_duration() { + return valid_duration; + } + + public IndustryOrderValidTime setValid_duration(Long valid_duration) { + this.valid_duration = valid_duration; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/PreCreateIndustryOrderQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/PreCreateIndustryOrderQuery.java new file mode 100644 index 0000000..d2383de --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/PreCreateIndustryOrderQuery.java @@ -0,0 +1,281 @@ +package com.dyj.applet.domain.query; + +import com.dyj.applet.domain.IndustryOrderGoodsInfo; +import com.dyj.applet.domain.IndustryOrderOrderEntrySchema; +import com.dyj.common.domain.query.UserInfoQuery; + +import java.util.List; + +/** + * 生活服务交易系统->预下单->开发者发起下单查询值 + */ +public class PreCreateIndustryOrderQuery extends UserInfoQuery { + + /** + * 商品信息 + */ + private List goods_list; + + /** + * 订单总价,单位分 + */ + private Long total_amount; + + /** + * 用户手机号,长度 <= 128 byte + */ + private String phone_num; + + /** + * 用户姓名,长度 <= 64 byte + */ + private String contact_name; + + /** + * 下单备注信息,长度 <= 2048byte + */ + private String extra; + + /** + * 支付结果通知地址,必须是 HTTPS 类型。 + * 若不填,默认使用在行业模板配置-消息通知的支付结果通知地址。 + */ + private String pay_notify_url; + + /** + * 开发者的单号,长度 <= 64 byte + */ + private String out_order_no; + + /** + * 支付超时时间,单位秒,例如 300 表示 300 秒后过期;不传或传 0 会使用默认值 300。 + */ + private Long pay_expire_seconds; + + /** + * 订单详情页信息 + */ + private IndustryOrderOrderEntrySchema order_entry_schema; + + /** + * 开发者自定义透传字段,不支持二进制,长度 <= 2048 byte + */ + private String cp_extra; + + /** + * 折扣金额,单位分 + */ + private Long discount_amount; + + public List getGoods_list() { + return goods_list; + } + + public PreCreateIndustryOrderQuery setGoods_list(List goods_list) { + this.goods_list = goods_list; + return this; + } + + public Long getTotal_amount() { + return total_amount; + } + + public PreCreateIndustryOrderQuery setTotal_amount(Long total_amount) { + this.total_amount = total_amount; + return this; + } + + public String getPhone_num() { + return phone_num; + } + + public PreCreateIndustryOrderQuery setPhone_num(String phone_num) { + this.phone_num = phone_num; + return this; + } + + public String getContact_name() { + return contact_name; + } + + public PreCreateIndustryOrderQuery setContact_name(String contact_name) { + this.contact_name = contact_name; + return this; + } + + public String getExtra() { + return extra; + } + + public PreCreateIndustryOrderQuery setExtra(String extra) { + this.extra = extra; + return this; + } + + public String getPay_notify_url() { + return pay_notify_url; + } + + public PreCreateIndustryOrderQuery setPay_notify_url(String pay_notify_url) { + this.pay_notify_url = pay_notify_url; + return this; + } + + public String getOut_order_no() { + return out_order_no; + } + + public PreCreateIndustryOrderQuery setOut_order_no(String out_order_no) { + this.out_order_no = out_order_no; + return this; + } + + public Long getPay_expire_seconds() { + return pay_expire_seconds; + } + + public PreCreateIndustryOrderQuery setPay_expire_seconds(Long pay_expire_seconds) { + this.pay_expire_seconds = pay_expire_seconds; + return this; + } + + public IndustryOrderOrderEntrySchema getOrder_entry_schema() { + return order_entry_schema; + } + + public PreCreateIndustryOrderQuery setOrder_entry_schema(IndustryOrderOrderEntrySchema order_entry_schema) { + this.order_entry_schema = order_entry_schema; + return this; + } + + public String getCp_extra() { + return cp_extra; + } + + public PreCreateIndustryOrderQuery setCp_extra(String cp_extra) { + this.cp_extra = cp_extra; + return this; + } + + public Long getDiscount_amount() { + return discount_amount; + } + + public PreCreateIndustryOrderQuery setDiscount_amount(Long discount_amount) { + this.discount_amount = discount_amount; + return this; + } + + public static PreCreateIndustryOrderQueryBuilder builder() { + return new PreCreateIndustryOrderQueryBuilder(); + } + + public static final class PreCreateIndustryOrderQueryBuilder { + private List goods_list; + private Long total_amount; + private String phone_num; + private String contact_name; + private String extra; + private String pay_notify_url; + private String out_order_no; + private Long pay_expire_seconds; + private IndustryOrderOrderEntrySchema order_entry_schema; + private String cp_extra; + private Long discount_amount; + private String open_id; + private Integer tenantId; + private String clientKey; + + private PreCreateIndustryOrderQueryBuilder() { + } + + public PreCreateIndustryOrderQueryBuilder goodsList(List goodsList) { + this.goods_list = goodsList; + return this; + } + + public PreCreateIndustryOrderQueryBuilder totalAmount(Long totalAmount) { + this.total_amount = totalAmount; + return this; + } + + public PreCreateIndustryOrderQueryBuilder phoneNum(String phoneNum) { + this.phone_num = phoneNum; + return this; + } + + public PreCreateIndustryOrderQueryBuilder contactName(String contactName) { + this.contact_name = contactName; + return this; + } + + public PreCreateIndustryOrderQueryBuilder extra(String extra) { + this.extra = extra; + return this; + } + + public PreCreateIndustryOrderQueryBuilder pay_notify_url(String pay_notify_url) { + this.pay_notify_url = pay_notify_url; + return this; + } + + public PreCreateIndustryOrderQueryBuilder outOrderNo(String outOrderNo) { + this.out_order_no = outOrderNo; + return this; + } + + public PreCreateIndustryOrderQueryBuilder payExpireSeconds(Long payExpireSeconds) { + this.pay_expire_seconds = payExpireSeconds; + return this; + } + + public PreCreateIndustryOrderQueryBuilder orderEntrySchema(IndustryOrderOrderEntrySchema orderEntrySchema) { + this.order_entry_schema = orderEntrySchema; + return this; + } + + public PreCreateIndustryOrderQueryBuilder cpExtra(String cpExtra) { + this.cp_extra = cpExtra; + return this; + } + + public PreCreateIndustryOrderQueryBuilder discountAmount(Long discountAmount) { + this.discount_amount = discountAmount; + return this; + } + + public PreCreateIndustryOrderQueryBuilder openId(String openId) { + this.open_id = openId; + return this; + } + + public PreCreateIndustryOrderQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + + public PreCreateIndustryOrderQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public PreCreateIndustryOrderQuery build() { + PreCreateIndustryOrderQuery preCreateIndustryOrderQuery = new PreCreateIndustryOrderQuery(); + preCreateIndustryOrderQuery.setGoods_list(goods_list); + preCreateIndustryOrderQuery.setTotal_amount(total_amount); + preCreateIndustryOrderQuery.setPhone_num(phone_num); + preCreateIndustryOrderQuery.setContact_name(contact_name); + preCreateIndustryOrderQuery.setExtra(extra); + preCreateIndustryOrderQuery.setPay_notify_url(pay_notify_url); + preCreateIndustryOrderQuery.setOut_order_no(out_order_no); + preCreateIndustryOrderQuery.setPay_expire_seconds(pay_expire_seconds); + preCreateIndustryOrderQuery.setOrder_entry_schema(order_entry_schema); + preCreateIndustryOrderQuery.setCp_extra(cp_extra); + preCreateIndustryOrderQuery.setDiscount_amount(discount_amount); + preCreateIndustryOrderQuery.setOpen_id(open_id); + preCreateIndustryOrderQuery.setTenantId(tenantId); + preCreateIndustryOrderQuery.setClientKey(clientKey); + return preCreateIndustryOrderQuery; + } + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/PreCreateIndustryOrderVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/PreCreateIndustryOrderVo.java new file mode 100644 index 0000000..85c9fba --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/PreCreateIndustryOrderVo.java @@ -0,0 +1,83 @@ +package com.dyj.applet.domain.vo; + +import com.dyj.applet.domain.IndustryOrderItemOrderDetail; +import com.dyj.applet.domain.IndustryOrderItemOrderInfo; +import com.dyj.common.domain.vo.BaseVo; + +import java.util.List; + +/** + * 生活服务交易系统->预下单->开发者发起下单返回值 + */ +public class PreCreateIndustryOrderVo extends BaseVo { + + /** + * 抖音开平侧生成的订单号 + */ + private String order_id; + + /** + * 开发者系统生成的订单号 + */ + private String out_order_no; + + /** + * 调起收银台的支付订单号 + */ + private String pay_order_id; + + /** + * 调起收银台的 token + */ + private String pay_order_token; + + /** + * 商品 item_order 信息 + */ + private List item_order_info_list; + + public String getOrder_id() { + return order_id; + } + + public PreCreateIndustryOrderVo setOrder_id(String order_id) { + this.order_id = order_id; + return this; + } + + public String getOut_order_no() { + return out_order_no; + } + + public PreCreateIndustryOrderVo setOut_order_no(String out_order_no) { + this.out_order_no = out_order_no; + return this; + } + + public String getPay_order_id() { + return pay_order_id; + } + + public PreCreateIndustryOrderVo setPay_order_id(String pay_order_id) { + this.pay_order_id = pay_order_id; + return this; + } + + public String getPay_order_token() { + return pay_order_token; + } + + public PreCreateIndustryOrderVo setPay_order_token(String pay_order_token) { + this.pay_order_token = pay_order_token; + return this; + } + + public List getItem_order_info_list() { + return item_order_info_list; + } + + public PreCreateIndustryOrderVo setItem_order_info_list(List item_order_info_list) { + this.item_order_info_list = item_order_info_list; + return this; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/IndustryTransactionHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/IndustryTransactionHandler.java index 5834a87..b51de7e 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/handler/IndustryTransactionHandler.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/IndustryTransactionHandler.java @@ -1,14 +1,19 @@ package com.dyj.applet.handler; import com.dtflys.forest.annotation.JSONBody; +import com.dtflys.forest.annotation.Post; +import com.dyj.applet.domain.query.PreCreateIndustryOrderQuery; import com.dyj.applet.domain.query.QueryIndustryOrderCpsQuery; import com.dyj.applet.domain.query.QueryIndustryOrderQuery; import com.dyj.applet.domain.query.QueryIndustryItemOrderInfoQuery; +import com.dyj.applet.domain.vo.PreCreateIndustryOrderVo; import com.dyj.applet.domain.vo.QueryIndustryCpsVo; import com.dyj.applet.domain.vo.QueryIndustryOrderVo; import com.dyj.applet.domain.vo.QueryIndustryItemOrderInfoVo; import com.dyj.common.config.AgentConfiguration; import com.dyj.common.domain.DataAndExtraVo; +import com.dyj.common.domain.DySimpleResult; +import com.dyj.common.interceptor.ClientTokenInterceptor; /** * 交易系统 生活服务交易系统 @@ -48,4 +53,15 @@ public class IndustryTransactionHandler extends AbstractAppletHandler{ baseQuery(body); return getIndustryOpenTransactionClient().queryIndustryOrderCps(body); } + + + /** + * 生活服务交易系统->预下单->开发者发起下单 + * @param body + * @return + */ + public DySimpleResult preCreateIndustryOrder(PreCreateIndustryOrderQuery body){ + baseQuery(body); + return getIndustryOpenTransactionClient().preCreateIndustryOrder(body); + } } 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 e25fb8e..9c0c5c1 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 @@ -480,6 +480,11 @@ public enum DyAppletUrlPathEnum { * 生活服务交易系统->查询 CPS 信息 */ QUERY_INDUSTRY_ORDER_CPS("queryIndustryOrderCps", "/api/apps/trade/v2/order/query_cps"), + + /** + * 生活服务交易系统->预下单->开发者发起下单 + */ + PRE_CREATE_INDUSTRY_ORDER("preCreateIndustryOrder", "/api/apps/trade/v2/order/create_order"), ; diff --git a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/applet/TransactionTest.java b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/applet/TransactionTest.java index 148b52f..9e836ee 100644 --- a/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/applet/TransactionTest.java +++ b/dy-java-examples/dy-java-examples-springboot/src/test/java/com/dyj/examples/applet/TransactionTest.java @@ -388,4 +388,17 @@ public class TransactionTest { ); } + /** + * 生活服务交易系统->预下单->开发者发起下单 + */ + @Test + public void preCreateIndustryOrder(){ + DyAppletClient dyAppletClient = new DyAppletClient(); + System.out.println( + JSON.toJSONString( + dyAppletClient.preCreateIndustryOrder(PreCreateIndustryOrderQuery.builder().build()) + ) + ); + } + } From 06b81a88a59ab3fbb519910242af66b5002022ba Mon Sep 17 00:00:00 2001 From: danmo <775144922@qq.com> Date: Fri, 12 Jul 2024 16:20:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dyj/applet/DyAppletClient.java | 41 +++++++ .../applet/client/AptCapacityBindClient.java | 46 +++++++- .../dyj/applet/domain/CapacityApplyInfo.java | 71 +++++++++++++ .../domain/query/ApplyCapacityQuery.java | 100 ++++++++++++++++++ .../domain/vo/CapacityApplyStatusVo.java | 33 ++++++ .../handler/AptCapacityBindHandler.java | 52 ++++++++- 6 files changed, 335 insertions(+), 8 deletions(-) create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/CapacityApplyInfo.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/query/ApplyCapacityQuery.java create mode 100644 dy-java-applet/src/main/java/com/dyj/applet/domain/vo/CapacityApplyStatusVo.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 ee250ee..d682eee 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 @@ -2291,4 +2291,45 @@ public class DyAppletClient extends BaseClient { public DySimpleResult deleteTpSimpleQrBind(String qrUrl) { return new AptSimpleQrCodeBindHandler(configuration().getAgentByTenantId(tenantId, clientKey)).deleteTpSimpleQrBind(qrUrl); } + + + /** + * 查询页面结构自定义能力申请状态 + * + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + public DySimpleResult queryApplyStatus(String capacityKey){ + return new AptCapacityBindHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryApplyStatus(capacityKey); + } + + + /** + * 查询页面结构自定义能力申请状态(服务商代调用) + * + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + public DySimpleResult queryTpApplyStatus(String capacityKey){ + return new AptCapacityBindHandler(configuration().getAgentByTenantId(tenantId, clientKey)).queryTpApplyStatus(capacityKey); + } + + /** + * 申请页面结构自定义能力 + * + * @param query 请求参数 + * @return DySimpleResult + */ + public DySimpleResult applyCapacity(ApplyCapacityQuery query){ + return new AptCapacityBindHandler(configuration().getAgentByTenantId(tenantId, clientKey)).applyCapacity(query); + } + + /** + * 申请页面结构自定义能力(服务商代调用) + * + * @return DySimpleResult + */ + public DySimpleResult tpApplyCapacity(ApplyCapacityQuery query){ + return new AptCapacityBindHandler(configuration().getAgentByTenantId(tenantId, clientKey)).tpApplyCapacity(query); + } } \ No newline at end of file diff --git a/dy-java-applet/src/main/java/com/dyj/applet/client/AptCapacityBindClient.java b/dy-java-applet/src/main/java/com/dyj/applet/client/AptCapacityBindClient.java index a6dfb0a..dfdd6a1 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/client/AptCapacityBindClient.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/client/AptCapacityBindClient.java @@ -1,13 +1,12 @@ package com.dyj.applet.client; import com.dtflys.forest.annotation.*; +import com.dyj.applet.domain.query.ApplyCapacityQuery; import com.dyj.applet.domain.query.BindAwemeRelaionQuery; -import com.dyj.applet.domain.vo.AwemeBindTemplateInfoVo; -import com.dyj.applet.domain.vo.AwemeBindTemplateListVo; -import com.dyj.applet.domain.vo.AwemeRelationBindQrcodeVo; -import com.dyj.applet.domain.vo.AwemeRelationListVo; +import com.dyj.applet.domain.vo.*; import com.dyj.common.domain.DySimpleResult; import com.dyj.common.domain.query.BaseQuery; +import com.dyj.common.interceptor.AppV2TokenHeaderInterceptor; import com.dyj.common.interceptor.ClientTokenInterceptor; import com.dyj.common.interceptor.TpV2AuthTokenHeaderInterceptor; @@ -101,4 +100,43 @@ public interface AptCapacityBindClient { */ @Post(value = "/api/apps/v1/capacity/unbind_aweme_relation/", interceptor = TpV2AuthTokenHeaderInterceptor.class) DySimpleResult unbindAwemeRelation(@Var("query") BaseQuery query, @JSONBody("aweme_id") String awemeId, @JSONBody("type") String type); + + /** + * 查询页面结构自定义能力申请状态 + * + * @param query 应用信息 + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + @Get(value = "${ttDomain}/api/apps/v1/capacity/query_apply_status", interceptor = AppV2TokenHeaderInterceptor.class) + DySimpleResult queryApplyStatus(@Var("query") BaseQuery query, @Query("capacity_key") String capacityKey); + + + /** + * 查询页面结构自定义能力申请状态(服务商代调用) + * + * @param query 应用信息 + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + @Get(value = "${ttDomain}/api/apps/v1/capacity/query_apply_status", interceptor = TpV2AuthTokenHeaderInterceptor.class) + DySimpleResult queryTpApplyStatus(@Var("query") BaseQuery query, @Query("capacity_key") String capacityKey); + + /** + * 申请页面结构自定义能力 + * + * @param query 请求参数 + * @return DySimpleResult + */ + @Post(value = "${ttDomain}/api/apps/v1/capacity/apply_capacity", interceptor = AppV2TokenHeaderInterceptor.class) + DySimpleResult applyCapacity(@JSONBody ApplyCapacityQuery query); + + /** + * 申请页面结构自定义能力(服务商代调用) + * + * @param query 请求参数 + * @return DySimpleResult + */ + @Post(value = "${ttDomain}/api/apps/v1/capacity/apply_capacity", interceptor = TpV2AuthTokenHeaderInterceptor.class) + DySimpleResult tpApplyCapacity(@JSONBody ApplyCapacityQuery query); } diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/CapacityApplyInfo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/CapacityApplyInfo.java new file mode 100644 index 0000000..9f540f3 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/CapacityApplyInfo.java @@ -0,0 +1,71 @@ +package com.dyj.applet.domain; + +import java.util.List; + +/** + * @author danmo + * @date 2024-07-12 11:49 + **/ +public class CapacityApplyInfo { + + /** + * 使用场景描述 + */ + private String scene_desc; + + /** + * 场景示例图列表,使用上传素材接口获取到的路径 + */ + private List img_uri_list; + + public static CapacityApplyInfoBuilder builder() { + return new CapacityApplyInfoBuilder(); + } + + public static class CapacityApplyInfoBuilder { + /** + * 使用场景描述 + */ + private String sceneDesc; + + /** + * 场景示例图列表,使用上传素材接口获取到的路径 + */ + private List imgUriList; + + + + public CapacityApplyInfoBuilder sceneDesc(String sceneDesc) { + this.sceneDesc = sceneDesc; + return this; + } + + public CapacityApplyInfoBuilder imgUriList(List imgUriList) { + this.imgUriList = imgUriList; + return this; + } + + public CapacityApplyInfo build() { + CapacityApplyInfo capacityApplyInfo = new CapacityApplyInfo(); + capacityApplyInfo.setScene_desc(sceneDesc); + capacityApplyInfo.setImg_uri_list(imgUriList); + return capacityApplyInfo; + } + } + + public String getScene_desc() { + return scene_desc; + } + + public void setScene_desc(String scene_desc) { + this.scene_desc = scene_desc; + } + + public List getImg_uri_list() { + return img_uri_list; + } + + public void setImg_uri_list(List img_uri_list) { + this.img_uri_list = img_uri_list; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ApplyCapacityQuery.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ApplyCapacityQuery.java new file mode 100644 index 0000000..fe73ccf --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/query/ApplyCapacityQuery.java @@ -0,0 +1,100 @@ +package com.dyj.applet.domain.query; + +import com.dyj.applet.domain.CapacityApplyInfo; +import com.dyj.common.domain.query.BaseQuery; + +/** + * @author danmo + * @date 2024-07-12 11:47 + **/ +public class ApplyCapacityQuery extends BaseQuery { + + private String capacityKey; + + private String apply_reason; + + private CapacityApplyInfo apply_info; + + public static ApplyCapacityQueryBuilder builder() + { + return new ApplyCapacityQueryBuilder(); + } + + public static final class ApplyCapacityQueryBuilder { + + /** + * 固定值“ma.component.page_layout_custom” + */ + private String capacityKey; + + /** + * 申请能力的原因 + */ + private String applyReason; + + private CapacityApplyInfo applyInfo; + + private Integer tenantId; + + private String clientKey; + + public ApplyCapacityQueryBuilder capacityKey(String capacityKey) { + this.capacityKey = capacityKey; + return this; + } + + public ApplyCapacityQueryBuilder applyReason(String applyReason) { + this.applyReason = applyReason; + return this; + } + + public ApplyCapacityQueryBuilder applyInfo(CapacityApplyInfo applyInfo) { + this.applyInfo = applyInfo; + return this; + } + + public ApplyCapacityQueryBuilder tenantId(Integer tenantId) { + this.tenantId = tenantId; + return this; + } + + public ApplyCapacityQueryBuilder clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + public ApplyCapacityQuery build() { + ApplyCapacityQuery applyCapacityQuery = new ApplyCapacityQuery(); + applyCapacityQuery.setCapacityKey(capacityKey); + applyCapacityQuery.setApply_reason(applyReason); + applyCapacityQuery.setApply_info(applyInfo); + applyCapacityQuery.setTenantId(tenantId); + applyCapacityQuery.setClientKey(clientKey); + return applyCapacityQuery; + } + } + + public String getCapacityKey() { + return capacityKey; + } + + public void setCapacityKey(String capacityKey) { + this.capacityKey = capacityKey; + } + + public String getApply_reason() { + return apply_reason; + } + + public void setApply_reason(String apply_reason) { + this.apply_reason = apply_reason; + } + + public CapacityApplyInfo getApply_info() { + return apply_info; + } + + public void setApply_info(CapacityApplyInfo apply_info) { + this.apply_info = apply_info; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/CapacityApplyStatusVo.java b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/CapacityApplyStatusVo.java new file mode 100644 index 0000000..c7b5673 --- /dev/null +++ b/dy-java-applet/src/main/java/com/dyj/applet/domain/vo/CapacityApplyStatusVo.java @@ -0,0 +1,33 @@ +package com.dyj.applet.domain.vo; + +/** + * @author danmo + * @date 2024-07-12 11:43 + **/ +public class CapacityApplyStatusVo { + + /** + * 能力状态。1-申请中;2-申请成功;3-申请拒绝;4-能力关闭;5-能力封禁;6-可申请但未申请;7-不可申请 + */ + private Integer status; + /** + * 无法获得能力的原因。 + */ + private String reason; + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } +} diff --git a/dy-java-applet/src/main/java/com/dyj/applet/handler/AptCapacityBindHandler.java b/dy-java-applet/src/main/java/com/dyj/applet/handler/AptCapacityBindHandler.java index 7ff7464..c83f753 100644 --- a/dy-java-applet/src/main/java/com/dyj/applet/handler/AptCapacityBindHandler.java +++ b/dy-java-applet/src/main/java/com/dyj/applet/handler/AptCapacityBindHandler.java @@ -1,13 +1,14 @@ package com.dyj.applet.handler; +import com.dtflys.forest.annotation.*; +import com.dyj.applet.domain.query.ApplyCapacityQuery; import com.dyj.applet.domain.query.BindAwemeRelaionQuery; -import com.dyj.applet.domain.vo.AwemeBindTemplateInfoVo; -import com.dyj.applet.domain.vo.AwemeBindTemplateListVo; -import com.dyj.applet.domain.vo.AwemeRelationBindQrcodeVo; -import com.dyj.applet.domain.vo.AwemeRelationListVo; +import com.dyj.applet.domain.vo.*; import com.dyj.common.config.AgentConfiguration; import com.dyj.common.domain.DySimpleResult; import com.dyj.common.domain.query.BaseQuery; +import com.dyj.common.interceptor.AppV2TokenHeaderInterceptor; +import com.dyj.common.interceptor.TpV2AuthTokenHeaderInterceptor; import java.util.List; @@ -100,4 +101,47 @@ public class AptCapacityBindHandler extends AbstractAppletHandler { public DySimpleResult unbindAwemeRelation(BaseQuery query, String awemeId, String type) { return getCapacityBindClient().unbindAwemeRelation(query, awemeId, type); } + + + /** + * 查询页面结构自定义能力申请状态 + * + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + public DySimpleResult queryApplyStatus(String capacityKey){ + return getCapacityBindClient().queryApplyStatus(baseQuery(), capacityKey); + } + + + /** + * 查询页面结构自定义能力申请状态(服务商代调用) + * + * @param capacityKey 应用信息 + * @return DySimpleResult + */ + public DySimpleResult queryTpApplyStatus(String capacityKey){ + return getCapacityBindClient().queryTpApplyStatus(baseQuery(), capacityKey); + } + + /** + * 申请页面结构自定义能力 + * + * @param query 请求参数 + * @return DySimpleResult + */ + public DySimpleResult applyCapacity(ApplyCapacityQuery query){ + baseQuery(query); + return getCapacityBindClient().applyCapacity(query); + } + + /** + * 申请页面结构自定义能力(服务商代调用) + * + * @return DySimpleResult + */ + public DySimpleResult tpApplyCapacity(ApplyCapacityQuery query){ + baseQuery(query); + return getCapacityBindClient().tpApplyCapacity(query); + } }