From c6240b23b59cf10996e4962c7c98d321a751fc8f Mon Sep 17 00:00:00 2001 From: tangqian Date: Mon, 19 Jun 2023 18:05:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=95=86=E6=88=B7=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/request/member/RefundRequest.java | 9 ++- .../request/order/StatementAllRequest.java | 2 + .../request/order/StatementPageRequest.java | 2 + .../recharge/RechargeOrderController.java | 26 ++++--- .../recharge/vo/RechargeOrderUpdateReqVO.java | 5 +- .../admin/recharge/vo/TenantListVo.java | 21 ++++++ .../admin/statement/StatementController.java | 9 ++- .../dataobject/recharge/RechargeOrderDO.java | 26 +++++++ .../dal/mysql/order/StoreOrderMapper.java | 10 ++- .../shop/service/order/StoreOrderService.java | 6 ++ .../order/impl/StoreOrderServiceImpl.java | 36 ++++++++-- .../recharge/RechargeOrderServiceImpl.java | 4 +- .../mapper/order/StoreOrderMapper.xml | 71 ++++++++++++------- .../mapper/recharge/RechargeOrderMapper.xml | 3 + .../admin/promoter/PromoterController.java | 2 + .../module/system/api/tenant/TenantApi.java | 2 + .../system/api/tenant/dto/TenantPageDTO.java | 1 + .../system/api/tenant/TenantApiImpl.java | 7 ++ .../tenant/vo/tenant/TenantPageReqVO.java | 2 + .../system/dal/mysql/tenant/TenantMapper.java | 1 + .../system/service/tenant/TenantService.java | 3 + .../service/tenant/TenantServiceImpl.java | 21 ++++++ 22 files changed, 224 insertions(+), 45 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/TenantListVo.java diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/member/RefundRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/member/RefundRequest.java index 984f8988a..51f60389a 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/member/RefundRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/member/RefundRequest.java @@ -29,5 +29,12 @@ public class RefundRequest implements Serializable { @Schema(description = "退款类型1:同意退款,2:拒绝退款、3:发起退款") @NotNull(message = "退款类型不能为空") private Integer type; - + @Schema(description = "退款类型") + private Integer refundType; + @Schema(description = "退款类型名称") + private String refundName; + @Schema(description = "会员退款理由") + private String memberReason; + @Schema(description = "管理员理由") + private String adminReason; } diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementAllRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementAllRequest.java index 7fe91d304..1bbcdb939 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementAllRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementAllRequest.java @@ -35,4 +35,6 @@ public class StatementAllRequest implements Serializable { @Schema(description = "1、当日2、上周3、上月4、累计") private String type; + private Long tenantId; + } diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementPageRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementPageRequest.java index 1776932af..745bc9784 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementPageRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/StatementPageRequest.java @@ -27,4 +27,6 @@ public class StatementPageRequest extends PageParam { @Schema(description = "结束执行时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime endTime; + + private Long tenantId; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java index 3fa254e75..377bd9094 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/RechargeOrderController.java @@ -13,7 +13,9 @@ import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderInfoService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + import javax.annotation.Resource; + import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; import io.swagger.v3.oas.annotations.tags.Tag; @@ -28,11 +30,13 @@ import java.io.IOException; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; + import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; @@ -112,7 +116,7 @@ public class RechargeOrderController { @PreAuthorize("@ss.hasPermission('shop:recharge-order:query')") @TenantIgnore public CommonResult> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) { - if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){ + if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) { pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); } PageResult pageResult = rechargeOrderService.getRechargeOrderPage(pageVO); @@ -124,7 +128,7 @@ public class RechargeOrderController { @PreAuthorize("@ss.hasPermission('shop:recharge-order:query')") @TenantIgnore public CommonResult> getRechargeOrderPage(@RequestBody PromoterDrawReqVO pageVO) { - if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){ + if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) { pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); } PageResult pageResult = rechargeOrderService.findPromoterDrawPage(pageVO); @@ -137,7 +141,7 @@ public class RechargeOrderController { @OperateLog(type = EXPORT) @TenantIgnore public void getRechargeOrderExcel(@Valid PromoterDrawReqExcelVO excelVO, HttpServletResponse response) throws IOException { - if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){ + if (!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())) { excelVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); } List list = rechargeOrderService.findPromoterDrawExcel(excelVO); @@ -151,7 +155,7 @@ public class RechargeOrderController { @OperateLog(type = EXPORT) @TenantIgnore public void exportRechargeOrderExcel(@Valid RechargeOrderExportReqVO exportReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { List list = rechargeOrderService.findListExcel(exportReqVO); ArrayList s = new ArrayList<>(); list.forEach(x -> { @@ -162,6 +166,7 @@ public class RechargeOrderController { Excel.orderExport(response, list, infoList); } + @TenantIgnore @PreAuthenticated @Operation(summary = "退款") @@ -169,25 +174,28 @@ public class RechargeOrderController { @PreAuthorize("@ss.hasPermission('shop:recharge-order:refund')") public CommonResult memberRefund(@Valid @RequestBody RefundRequest request, HttpServletRequest servletRequest) throws Exception { log.info("memberRefund会员退款===>{}", request); - Object obj=null; + Object obj = null; //直接退款 - if(request.getType()==3){ + if (request.getType() == 3) { RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO(); vo.setId(request.getOrderId()); vo.setRefundStatus(3); + vo.setAdminReason(request.getAdminReason()); rechargeOrderService.updateRechargeOrderStatus(vo); obj = storeOrderService.memberRefund(request, servletRequest); - //拒绝退款 - }else if(request.getType()==2){ + //拒绝退款 + } else if (request.getType() == 2) { RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO(); vo.setId(request.getOrderId()); vo.setRefundStatus(4); + vo.setAdminReason(request.getAdminReason()); rechargeOrderService.updateRechargeOrderStatus(vo); //同意 - }else if(request.getType()==1){ + } else if (request.getType() == 1) { RechargeOrderUpdateReqVO vo = new RechargeOrderUpdateReqVO(); vo.setId(request.getOrderId()); vo.setRefundStatus(3); + vo.setAdminReason(request.getAdminReason()); rechargeOrderService.updateRechargeOrderStatus(vo); obj = storeOrderService.memberRefund(request, servletRequest); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeOrderUpdateReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeOrderUpdateReqVO.java index 25ff67c5d..def8575ca 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeOrderUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RechargeOrderUpdateReqVO.java @@ -14,5 +14,8 @@ public class RechargeOrderUpdateReqVO extends RechargeOrderBaseVO { @Schema(description = "订单ID", required = true, example = "17164") @NotNull(message = "订单ID不能为空") private Long id; - + /** + * 管理员理由 + */ + private String adminReason; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/TenantListVo.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/TenantListVo.java new file mode 100644 index 000000000..899bf5aea --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/TenantListVo.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + * @Title:TenantListVo + * @Description: TODO + * @author: tangqian + * @date: 2023/6/19 10:29 + * @version: V1.0.0 + */ +@Getter +@Setter +public class TenantListVo implements Serializable { + private static final long serialVersionUID = 8280705984308676562L; + private Long id; + private String name; +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java index 6c5879602..29cb8540c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsExcelVO; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo; import cn.iocoder.yudao.module.shop.request.order.StatementAllRequest; import cn.iocoder.yudao.module.shop.request.order.StatementPageRequest; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; @@ -74,7 +75,7 @@ public class StatementController { if (!CollectionUtils.isEmpty(statistics.getList())) { statistics.getList().forEach(e -> { StatisticsExcelVO vo = new StatisticsExcelVO(); - BeanUtils.copyProperties(e,vo); + BeanUtils.copyProperties(e, vo); list.add(vo); }); } @@ -82,4 +83,10 @@ public class StatementController { ExcelUtils.write(response, "导出数据统计(根据租户统计).xls", "数据", StatisticsExcelVO.class, list); } + @Operation(summary = "获取租户") + @RequestMapping(value = "/getTenantList", method = RequestMethod.GET) + @TenantIgnore + public CommonResult> getTenantList() { + return CommonResult.success(storeOrderService.getTenantList()); + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderDO.java index a4674ece1..e21109e97 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/recharge/RechargeOrderDO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.shop.dal.dataobject.recharge; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; import java.math.BigDecimal; @@ -180,4 +181,29 @@ public class RechargeOrderDO extends TenantBaseDO { */ private Long deptId; + // 用于微信支付成功回调失败-补单逻辑 + /** + * 补单标记 + */ + private Integer isReplenishment; + /** + * 补单标记说明 + */ + private String replenishmentName; + /** + * 退款类型 + */ + private Integer refundType; + /** + * 退款类型名称 + */ + private String refundName; + /** + * 会员退款理由 + */ + private String memberReason; + /** + * 管理员理由 + */ + private String adminReason; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java index 89604ff3e..5fee04d04 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java @@ -48,6 +48,7 @@ public interface StoreOrderMapper extends BaseMapperX { /** * 核销详情 月数据 + * * @param request 分页和日期 * @return 月数据 */ @@ -55,6 +56,7 @@ public interface StoreOrderMapper extends BaseMapperX { /** * 订单统计详情 price + * * @param pram 时间区间参数 * @return 月数据 */ @@ -62,6 +64,7 @@ public interface StoreOrderMapper extends BaseMapperX { /** * 订单统计详情 订单量 + * * @param pram 时间区间参数 * @return 月数据 */ @@ -69,12 +72,13 @@ public interface StoreOrderMapper extends BaseMapperX { /** * 获取佣金相关数据 - * @param uid 用户uid + * + * @param uid 用户uid * @param spreadId 推广人uid */ OrderBrokerageData getBrokerageData(@Param("uid") Long uid, @Param("spreadId") Integer spreadId); - BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate")LocalDateTime endDate,@Param("promoterId") Long promoterId); + BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("promoterId") Long promoterId); - List statisticsAll(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime); + List statisticsAll(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("tenantId") Long tenantId); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java index 1e4b4dcd0..25ff6bcb2 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java @@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.shop.service.order; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest; import cn.iocoder.yudao.module.shop.request.member.OrderPayRequest; import cn.iocoder.yudao.module.shop.request.member.RefundRequest; @@ -408,4 +410,8 @@ public interface StoreOrderService extends IService { StatementAllReqVo statisticsAll(StatementAllRequest request); PageInfo statistics(StatementPageRequest request); + + List getTenantList(); + + void addPhone(RechargeOrderDO orderDO, String outTradeNo); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 9dda4357b..e28daade5 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqDataVo; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.TenantListVo; import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd; import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; @@ -97,6 +98,8 @@ import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; + /** * StoreOrderServiceImpl 接口实现 * +---------------------------------------------------------------------- @@ -167,6 +170,7 @@ public class StoreOrderServiceImpl extends ServiceImpl params = new HashMap(); Map requestParams = request.getParameterMap(); for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) { @@ -1427,6 +1431,9 @@ public class StoreOrderServiceImpl extends ServiceImpl 0; } @@ -1463,7 +1470,7 @@ public class StoreOrderServiceImpl extends ServiceImpl dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime()); + List dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime(), request.getTenantId()); if (!CollectionUtils.isEmpty(dataVos)) { reqVo.setTotalMoney(BigDecimal.valueOf(dataVos.stream().filter(x -> x.getRefundStatus() != 2).mapToDouble(StatementAllReqDataVo::getPrice).sum())); reqVo.setTotalNum(dataVos.size()); @@ -1482,13 +1489,14 @@ public class StoreOrderServiceImpl extends ServiceImpl tenantPage = tenantApi.getTenantPage(pageDTO); if (!CollectionUtils.isEmpty(tenantPage.getList())) { page.setTotal(tenantPage.getTotal()); - List dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime()); + List dataVos = mapper.statisticsAll(request.getStartTime(), request.getEndTime(), null); Map> collect = dataVos.stream().collect(Collectors.groupingBy(StatementAllReqDataVo::getTenantId)); List vos = new ArrayList<>(); - tenantPage.getList().forEach(e->{ + tenantPage.getList().forEach(e -> { List dataVos1 = collect.get(e.getId()); StatisticsPageVo vo = new StatisticsPageVo(); if (!CollectionUtils.isEmpty(dataVos1)) { @@ -1508,6 +1516,26 @@ public class StoreOrderServiceImpl extends ServiceImpl getTenantList() { + Long tenantId = TenantContextHolder.getTenantId(); + List tenantList = tenantApi.getTenantList(tenantId.equals(1L) ? null : tenantId); + List list = new ArrayList<>(); + if (!CollectionUtils.isEmpty(tenantList)) { + tenantList.forEach(e -> { + TenantListVo vo = new TenantListVo(); + BeanUtils.copyProperties(e, vo); + list.add(vo); + }); + } + return list; + } + + @Override + public void addPhone(RechargeOrderDO orderDO, String outTradeNo) { + addPhoneRecord(orderDO, outTradeNo); + } + private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user, PromoterDTO promoterDTO) { Long tenantId = TenantContextHolder.getTenantId(); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java index 08a3487b9..3d8b37614 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/recharge/RechargeOrderServiceImpl.java @@ -125,7 +125,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { public PageResult getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO) { Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); Long tenantId = TenantContextHolder.getTenantId(); - pageReqVO.setTenantId(tenantId); + pageReqVO.setTenantId(null != pageReqVO.getTenantId() ? pageReqVO.getTenantId() : tenantId); rechargeOrderMapper.findListPage(page, pageReqVO); return new PageResult<>(page.getRecords(), page.getTotal()); @@ -204,7 +204,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService { @Override public List findListExcel(RechargeOrderExportReqVO data) { Long tenantId = TenantContextHolder.getTenantId(); - data.setTenantId(tenantId); + data.setTenantId(null != data.getTenantId() ? data.getTenantId() : tenantId); return rechargeOrderMapper.findListExcel(data); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml index 2c43a9f54..342179396 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml @@ -3,15 +3,25 @@ - - - @@ -48,8 +66,10 @@ SELECT - info.recharge_order_id as orderId, - ord.id, - ord.paid, - ord.refund_status, - info.price, - ord.tenant_id + info.recharge_order_id as orderId, + ord.id, + ord.paid, + ord.refund_status, + info.price, + ord.tenant_id FROM - `cy_recharge_order_info` info - LEFT JOIN cy_recharge_order ord ON info.recharge_order_id = ord.id + `cy_recharge_order_info` info + LEFT JOIN cy_recharge_order ord ON info.recharge_order_id = ord.id WHERE - ord.paid != 0 + ord.paid != 0 and info.create_time >= #{startTime} and info.create_time < #{endTime} + + and info.tenant_id =#{tenantId} + diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml index 5055e3743..dc4763715 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml @@ -236,6 +236,9 @@ and a.order_id like CONCAT('%',#{data.orderId},'%') + + and a.refund_status =#{data.refundStatus} + and a.paid =#{data.paid} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java index ec599deed..3321c1948 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/PromoterController.java @@ -151,6 +151,7 @@ public class PromoterController { @Operation(summary = "导出所有推广员 Excel") @OperateLog(type = EXPORT) @TenantIgnore + @PreAuthorize("@ss.hasPermission('member:promoter:allExcel')") public void allExportExcel(@Valid PromoterPageReqVO pageVO, HttpServletResponse response) throws IOException { PageResult pageResult = promoterService.getPromoterPage(pageVO); @@ -168,6 +169,7 @@ public class PromoterController { @PutMapping("/tenantIgnoreUpdate") @Operation(summary = "排除祖父更新推广员") + @PreAuthorize("@ss.hasPermission('member:promoter:allUpdate')") @TenantIgnore public CommonResult updateByPromoter(@Valid @RequestBody PromoterUpdateReqVO updateReqVO) { promoterService.updatePromoter(updateReqVO); diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java index 1443c4a71..96bc80b5a 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApi.java @@ -30,4 +30,6 @@ public interface TenantApi { TenantDTO getTenant(Long id); PageResult getTenantPage(TenantPageDTO pageDTO); + + List getTenantList(Long aLong); } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/dto/TenantPageDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/dto/TenantPageDTO.java index 2da02bbde..4f6906bb7 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/dto/TenantPageDTO.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/tenant/dto/TenantPageDTO.java @@ -16,4 +16,5 @@ public class TenantPageDTO { private String name; private Integer pageNo = PAGE_NO; private Integer pageSize = PAGE_SIZE; + private Long tenantId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApiImpl.java index 44ac439b9..e274ff3a6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/tenant/TenantApiImpl.java @@ -62,4 +62,11 @@ public class TenantApiImpl implements TenantApi { } return pageResult; } + + @Override + public List getTenantList(Long tenantId) + { + + return tenantService.findByTenantId(tenantId); + } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java index de547fff7..faec9f7ac 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java @@ -48,4 +48,6 @@ public class TenantPageReqVO extends PageParam { @Schema(description = "创建时间") private LocalDateTime[] createTime; + private Long tenantId; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java index c0dcc005a..28ac50619 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java @@ -20,6 +20,7 @@ public interface TenantMapper extends BaseMapperX { default PageResult selectPage(TenantPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(TenantDO::getId,reqVO.getTenantId()) .likeIfPresent(TenantDO::getName, reqVO.getName()) .likeIfPresent(TenantDO::getContactName, reqVO.getContactName()) .likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile()) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java index f2726fedc..66415fcf8 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.tenant; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*; import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler; @@ -135,4 +136,6 @@ public interface TenantService { * @param id 租户编号 */ void validTenant(Long id); + + List findByTenantId(Long tenantId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java index 8f96175b3..340c69aff 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java @@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.tenant.config.TenantProperties; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; +import cn.iocoder.yudao.module.system.api.tenant.dto.TenantDTO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO; @@ -30,7 +31,10 @@ import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler; import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -38,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Set; @@ -97,6 +102,22 @@ public class TenantServiceImpl implements TenantService { } } + @Override + public List findByTenantId(Long tenantId) { + List list = new ArrayList<>(); + LambdaQueryWrapper lw = new LambdaQueryWrapper<>(); + lw.eq(null != tenantId, TenantDO::getId,tenantId); + List tenantDOS = tenantMapper.selectList(lw); + if (!org.springframework.util.CollectionUtils.isEmpty(tenantDOS)) { + tenantDOS.forEach(e->{ + TenantDTO tenantDTO = new TenantDTO(); + BeanUtils.copyProperties(e,tenantDTO); + list.add(tenantDTO); + }); + } + return list; + } + @Override @Transactional(rollbackFor = Exception.class) public Long createTenant(TenantCreateReqVO createReqVO) { From 0f36f07dc3689fe968042a9cddcbff688c97d978 Mon Sep 17 00:00:00 2001 From: tangqian Date: Mon, 19 Jun 2023 18:06:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=95=86=E6=88=B7=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/shop/task/ReplenishmentTask.java | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/task/ReplenishmentTask.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/task/ReplenishmentTask.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/task/ReplenishmentTask.java new file mode 100644 index 000000000..73be6d6dd --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/task/ReplenishmentTask.java @@ -0,0 +1,288 @@ +package cn.iocoder.yudao.module.shop.task; + +import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; +import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper; +import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; + +/** + * @Title:ReplenishmentTask + * @Description: 会员充值补单定时任务 + * @author: tangqian + * @date: 2023/6/19 11:33 + * @version: V1.0.0 + */ +@Component +@Slf4j +public class ReplenishmentTask { + @Autowired + private WxPayProperties properties; + @Autowired + private RechargeOrderMapper rechargeOrderMapper; + @Autowired + private StoreOrderService storeOrderService; + + /** + * 每天上午8点和下午3点执行补单计划 + */ +// @Scheduled(cron = "0 0 8,15 * * ?") + @TenantIgnore + public void replenishmentTask() { + /** + * 1.扫描表里面未付款的订单 + * 2.根据订单号查询微信支付结果 + * 3.处理相关逻辑c + */ + List orderDOS = rechargeOrderMapper.selectList(Wrappers.lambdaQuery() + .eq(RechargeOrderDO::getPaid, 0) + .eq(RechargeOrderDO::getIsReplenishment, 0)); + if (!CollectionUtils.isEmpty(orderDOS)) { + orderDOS.forEach(e -> { + execute(e.getOrderId()); + }); + } + } + + public void execute(String outTradeNo) { + RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.lambdaQuery().eq(RechargeOrderDO::getOrderId, outTradeNo)); + if (null == orderDO) { + log.info("订单号:{}未查询数据", outTradeNo); + return; + } + String appId = properties.getAppId(); + String mchId = properties.getMchId(); + // 生成随机字符串 + String nonceStr = generateNonceStr(); + // 商户密钥 + String key = properties.getMchKey(); + + // 构建请求参数 + Map params = new HashMap<>(); + params.put("appid", appId); + params.put("mch_id", mchId); + params.put("out_trade_no", outTradeNo); + params.put("nonce_str", nonceStr); + // 生成签名 + String sign = generateSign(params, key); + params.put("sign", sign); + + // 发起HTTP请求 + String requestUrl = "https://api.mch.weixin.qq.com/pay/orderquery"; + String response = sendRequest(requestUrl, mapToXml(params)); + log.info("根据订单编号:{},查询微信支付结果出参:{}", outTradeNo, response); + Map map = parseResponse(response); + if ("SUCCESS".equals(map.get("trade_state")) && "SUCCESS".equals(map.get("result_code"))) { + // 修改订单状态 +// orderDO.setPaid(1); +// orderDO.setIsReplenishment(1); +// orderDO.setReplenishmentName(map.toString()); +// rechargeOrderMapper.updateById(orderDO); +// // 写入 充值档位记录表 +// storeOrderService.addPhone(orderDO, outTradeNo); + } + } + + + /** + * 解析出参 + * + * @param response + */ + private static Map parseResponse(String response) { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + ByteArrayInputStream input = new ByteArrayInputStream(response.getBytes("UTF-8")); + Document document = builder.parse(input); + + Element root = document.getDocumentElement(); + NodeList nodeList = root.getChildNodes(); + Map map = new HashMap<>(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node; + String tagName = element.getTagName(); + String textContent = element.getTextContent(); + map.put(tagName, textContent); + } + } + log.info("出参结果:{}", map.toString()); + return map; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 生成随机字符串 + * + * @return + */ + private static String generateNonceStr() { + return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32); + } + + /** + * 生成签名 + * + * @param params 相关参数 + * @param key 商户密钥 + * @return + */ + private static String generateSign(Map params, String key) { + List keys = new ArrayList<>(params.keySet()); + Collections.sort(keys); + StringBuilder sb = new StringBuilder(); + for (String k : keys) { + String v = params.get(k); + if (v != null && !v.isEmpty()) { + sb.append(k).append("=").append(v).append("&"); + } + } + sb.append("key=").append(key); + return md5(sb.toString()).toUpperCase(); + } + + /** + * 发送HTTP请求 + * + * @param url + * @param data + * @return + */ + private static String sendRequest(String url, String data) { + // 使用Java的HTTP请求库发送POST请求,这里需要根据你使用的具体库进行实现 + // 示例代码中的sendPostRequest方法是一个自定义的方法,你需要使用适合你的HTTP请求库进行替换 + return sendPostRequest(url, data); + } + + + /** + * Map转换为XML格式 + * + * @param map + * @return + */ + private static String mapToXml(Map map) { + StringBuilder sb = new StringBuilder(); + sb.append(""); + for (Map.Entry entry : map.entrySet()) { + sb.append("<").append(entry.getKey()).append(">"); + sb.append(""); + sb.append(""); + } + sb.append(""); + return sb.toString(); + } + + public static String md5(String input) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] messageDigest = md.digest(input.getBytes()); + + // Convert byte array to hexadecimal string + StringBuilder hexString = new StringBuilder(); + for (byte b : messageDigest) { + String hex = Integer.toHexString(0xFF & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + return hexString.toString(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + return null; + } + } + + private static String sendPostRequest(String url, String data) { + try { + URL requestUrl = new URL(url); + HttpURLConnection connection = (HttpURLConnection) requestUrl.openConnection(); + connection.setRequestMethod("POST"); + connection.setDoOutput(true); + + // 设置请求头 + connection.setRequestProperty("Content-Type", "application/xml;charset=UTF-8"); + + // 发送请求数据 + OutputStream outputStream = connection.getOutputStream(); + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8")); + writer.write(data); + writer.flush(); + writer.close(); + outputStream.close(); + + // 获取响应数据 + int responseCode = connection.getResponseCode(); + InputStream inputStream; + if (responseCode >= 200 && responseCode < 300) { + inputStream = connection.getInputStream(); + } else { + inputStream = connection.getErrorStream(); + } + + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + StringBuilder response = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + response.append(line); + } + reader.close(); + inputStream.close(); + + connection.disconnect(); + + return response.toString(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + +// public static void main(String[] args) { +// String appId = "wx7e503d9cded34c07"; +// String mchId = "1641073271"; +// String nonceStr = generateNonceStr(); // 生成随机字符串 +// String key = "cyywl123456cyywl654321cyywl12345"; // 商户密钥 +// +// // 构建请求参数 +// Map params = new HashMap<>(); +// params.put("appid", appId); +// params.put("mch_id", mchId); +// params.put("out_trade_no", "MEMBER_16700496905020866571"); +// params.put("nonce_str", nonceStr); +// String sign = generateSign(params, key); // 生成签名 +// params.put("sign", sign); +// +// // 发起HTTP请求 +// String requestUrl = "https://api.mch.weixin.qq.com/pay/orderquery"; +// String response = sendRequest(requestUrl, mapToXml(params)); +// System.out.println(response); +// parseResponse(response); +// } +}