diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java index c16336992..03e911160 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java @@ -9,7 +9,10 @@ import com.alibaba.ttl.TransmittableThreadLocal; * @author 芋道源码 */ public class TenantContextHolder { - + /** + * 套餐编号 - 系统 + */ + public static final Long ID_SYSTEM = 1L; /** * 当前租户编号 */ diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/vo/order/WxPayJsResultVo.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/vo/order/WxPayJsResultVo.java index 60b2a1793..7ea745ff4 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/vo/order/WxPayJsResultVo.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/vo/order/WxPayJsResultVo.java @@ -49,4 +49,6 @@ public class WxPayJsResultVo { @Schema(description = "拉起收银台的ticket", required = true) private String ticket; + @Schema(description = "", required = true) + private String packageValue; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/product/StoreProductController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/product/StoreProductController.java index ee8b57293..f47d25f78 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/product/StoreProductController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/product/StoreProductController.java @@ -52,7 +52,7 @@ public class StoreProductController { * @param request 搜索条件 * @param pageParamRequest 分页参数 */ -// @PreAuthorize("@ss.hasPermission('admin:product:list')") + @PreAuthorize("@ss.hasPermission('admin:product:list')") @Operation(summary = "分页列表") //配合swagger使用 @RequestMapping(value = "/list", method = RequestMethod.GET) public CommonResult> getList(@Validated StoreProductSearchRequest request, @@ -64,7 +64,7 @@ public class StoreProductController { * 新增商品 * @param request 新增参数 */ -// @PreAuthorize("@ss.hasPermission('admin:product:save')") + @PreAuthorize("@ss.hasPermission('admin:product:save')") @Operation(summary = "新增商品") @RequestMapping(value = "/save", method = RequestMethod.POST) public CommonResult save(@RequestBody @Validated StoreProductAddRequest request) { @@ -79,7 +79,7 @@ public class StoreProductController { * 删除商品表 * @param id Integer */ -// @PreAuthorize("@ss.hasPermission('admin:product:delete')") + @PreAuthorize("@ss.hasPermission('admin:product:delete')") @Operation(summary = "删除") @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) public CommonResult delete(@RequestBody @PathVariable Integer id, @RequestParam(value = "type", required = false, defaultValue = "recycle")String type) { @@ -99,7 +99,7 @@ public class StoreProductController { * 恢复已删除商品表 * @param id Integer */ -// @PreAuthorize("@ss.hasPermission('admin:product:restore')") + @PreAuthorize("@ss.hasPermission('admin:product:restore')") @Operation(summary = "恢复商品") @RequestMapping(value = "/restore/{id}", method = RequestMethod.GET) public CommonResult restore(@RequestBody @PathVariable Integer id) { @@ -114,7 +114,7 @@ public class StoreProductController { * 商品修改 * @param storeProductRequest 商品参数 */ -// @PreAuthorize("@ss.hasPermission('admin:product:update')") + @PreAuthorize("@ss.hasPermission('admin:product:update')") @Operation(summary = "商品修改") @RequestMapping(value = "/update", method = RequestMethod.POST) public CommonResult update(@RequestBody @Validated StoreProductAddRequest storeProductRequest) { @@ -129,7 +129,7 @@ public class StoreProductController { * 商品详情 * @param id 商品id */ -// @PreAuthorize("@ss.hasPermission('admin:product:info')") + @PreAuthorize("@ss.hasPermission('admin:product:info')") @Operation(summary = "商品详情") @RequestMapping(value = "/info/{id}", method = RequestMethod.GET) public CommonResult info(@PathVariable Integer id) { @@ -139,7 +139,7 @@ public class StoreProductController { /** * 商品tabs表头数据 */ -// @PreAuthorize("@ss.hasPermission('admin:product:tabs:headers')") + @PreAuthorize("@ss.hasPermission('admin:product:tabs:headers')") @Operation(summary = "商品表头数量") @RequestMapping(value = "/tabs/headers", method = RequestMethod.GET) public CommonResult> getTabsHeader() { @@ -149,7 +149,7 @@ public class StoreProductController { /** * 上架 */ -// @PreAuthorize("@ss.hasPermission('admin:product:up')") + @PreAuthorize("@ss.hasPermission('admin:product:up')") @Operation(summary = "上架") @RequestMapping(value = "/putOnShell/{id}", method = RequestMethod.GET) public CommonResult putOn(@PathVariable Integer id) { @@ -163,7 +163,7 @@ public class StoreProductController { /** * 下架 */ -// @PreAuthorize("@ss.hasPermission('admin:product:down')") + @PreAuthorize("@ss.hasPermission('admin:product:down')") @Operation(summary = "下架") @RequestMapping(value = "/offShell/{id}", method = RequestMethod.GET) public CommonResult offShell(@PathVariable Integer id) { 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 c970237ea..974b8e9ad 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 @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.shop.controller.admin.recharge; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.shop.controller.admin.recharge.method.Excel; import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO; @@ -102,6 +103,9 @@ public class RechargeOrderController { @PreAuthorize("@ss.hasPermission('shop:recharge-order:query')") @TenantIgnore public CommonResult> getRechargeOrderPage(@Valid RechargeOrderPageReqVO pageVO) { + if(!TenantContextHolder.ID_SYSTEM.equals(TenantContextHolder.getRequiredTenantId())){ + pageVO.setTenantId(TenantContextHolder.getRequiredTenantId()); + } pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); PageResult pageResult = rechargeOrderService.getRechargeOrderPage(pageVO); return success(pageResult); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java index 6de13cf77..20fff088c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java @@ -245,25 +245,29 @@ public class OrderPayServiceImpl implements OrderPayService { // 微信支付,调用微信预下单,返回拉起微信支付需要的信息 if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT)) { // 预下单 - Map unifiedorder = unifiedorder(storeOrder, ip, orderPayRequest.getOpenid()); + WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = unifiedorder(storeOrder, ip, orderPayRequest.getOpenid()); + WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService(); + WxPayUnifiedOrderV3Result.JsapiResult jsapiResult = wxPayUnifiedOrderV3Result.getPayInfo(TradeTypeEnum.JSAPI, payProperties.getAppId(), payProperties.getMchId(), wxPayService.getConfig().getPrivateKey()); response.setStatus(true); WxPayJsResultVo vo = new WxPayJsResultVo(); - vo.setAppId(unifiedorder.get("appId")); - vo.setNonceStr(unifiedorder.get("nonceStr")); - vo.setPackages(unifiedorder.get("package")); - vo.setSignType(unifiedorder.get("signType")); - vo.setTimeStamp(unifiedorder.get("timeStamp")); - vo.setPaySign(unifiedorder.get("paySign")); + + vo.setAppId(/*unifiedorder.get("appId")*/jsapiResult.getAppId()); + vo.setNonceStr(/*unifiedorder.get("nonceStr")*/jsapiResult.getNonceStr()); +// vo.setPackages(unifiedorder.get("package")); + vo.setPackageValue(jsapiResult.getPackageValue()); + vo.setSignType(/*unifiedorder.get("signType")*/jsapiResult.getSignType()); + vo.setTimeStamp(/*unifiedorder.get("timeStamp")*/jsapiResult.getTimeStamp()); + vo.setPaySign(/*unifiedorder.get("paySign")*/jsapiResult.getPaySign()); if (storeOrder.getIsChannel() == 2) { - vo.setMwebUrl(unifiedorder.get("mweb_url")); + vo.setMwebUrl(wxPayUnifiedOrderV3Result.getH5Url()); response.setPayType(PayConstants.PAY_CHANNEL_WE_CHAT_H5); } - if (storeOrder.getIsChannel() == 4 || storeOrder.getIsChannel() == 5) { - vo.setPartnerid(unifiedorder.get("partnerid")); - } +// if (storeOrder.getIsChannel() == 4 || storeOrder.getIsChannel() == 5) { +// vo.setPartnerid(unifiedorder.get("partnerid")); +// } // 更新商户订单号 - storeOrder.setOutTradeNo(unifiedorder.get("outTradeNo")); - storeOrderService.updateById(storeOrder); +// storeOrder.setOutTradeNo(unifiedorder.get("outTradeNo")); +// storeOrderService.updateById(storeOrder); response.setJsConfig(vo); return response; } @@ -287,7 +291,7 @@ public class OrderPayServiceImpl implements OrderPayService { * @param ip ip * @return 预下单返回对象 */ - private Map unifiedorder(StoreOrder storeOrder, String ip,String openid) { + private WxPayUnifiedOrderV3Result unifiedorder(StoreOrder storeOrder, String ip,String openid) { // 获取用户openId // 根据订单支付类型来判断获取公众号openId还是小程序openId @@ -316,7 +320,7 @@ public class OrderPayServiceImpl implements OrderPayService { // 预下单(统一下单) //CreateOrderResponseVo responseVo = wechatNewService.payUnifiedorder(unifiedorderVo); // 组装前端预下单参数 - Map map = new HashMap<>(); +// Map map = new HashMap<>(); // map.put("appId", unifiedorderVo.getAppid()); // map.put("nonceStr", unifiedorderVo.getAppid()); // map.put("package", "prepay_id=".concat(responseVo.getPrepayId())); @@ -348,11 +352,12 @@ public class OrderPayServiceImpl implements OrderPayService { wxPayRequest.setTimeExpire(formatLocalDateTime(LocalDateTime.now().plusMinutes(30), "yyyyMMddHHmmss")); try { WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest); - map.put("mweb_url",wxPayUnifiedOrderV3Result.getH5Url()); +// map.put("mweb_url",wxPayUnifiedOrderV3Result.getH5Url()); + return wxPayUnifiedOrderV3Result; } catch (Exception e) { e.getMessage(); } - return map; + return null; } public static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) { return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java index 7c9c6ab85..0660a03c5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*; import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert; import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO; @@ -96,7 +97,16 @@ public class TenantController { PageResult pageResult = tenantService.getTenantPage(pageVO); return success(TenantConvert.INSTANCE.convertPage(pageResult)); } - + @GetMapping("/list") + @Operation(summary = "获取所有商户") + public CommonResult> list(@Valid TenantExportReqVO pageVO) { + List pageResult = null; + if(!TenantContextHolder.ID_SYSTEM.equals(TenantContextHolder.getRequiredTenantId())){ + pageVO.setTenantId(TenantContextHolder.getRequiredTenantId()); + } + pageResult = tenantService.getTenantList(pageVO); + return success(TenantConvert.INSTANCE.convertList(pageResult)); + } @GetMapping("/export-excel") @Operation(summary = "导出租户 Excel") @PreAuthorize("@ss.hasPermission('system:tenant:export')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java index 706337276..363ca615b 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java @@ -14,6 +14,8 @@ public class TenantExportReqVO { @Schema(description = "租户名", example = "芋道") private String name; + @Schema(description = "tenantId", example = "芋道") + private Long tenantId; @Schema(description = "联系人", example = "芋艿") private String contactName; 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 611e3af0e..c0dcc005a 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 @@ -36,6 +36,7 @@ public interface TenantMapper extends BaseMapperX { .likeIfPresent(TenantDO::getContactName, reqVO.getContactName()) .likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile()) .eqIfPresent(TenantDO::getStatus, reqVO.getStatus()) + .eqIfPresent(TenantDO::getId, reqVO.getTenantId()) .betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TenantDO::getId)); } diff --git a/yudao-server/src/main/resources/application-prod.yaml b/yudao-server/src/main/resources/application-prod.yaml index 87f3a7fa6..c2f92cfe7 100644 --- a/yudao-server/src/main/resources/application-prod.yaml +++ b/yudao-server/src/main/resources/application-prod.yaml @@ -235,10 +235,10 @@ wx: useRedis: false defaultContent: \u60A8\u597D\uFF0C\u6709\u4EC0\u4E48\u95EE\u9898\uFF1F redisConfig: - host: 117.33.142.185 # 地址 - port: 6369 # 端口 + host: 47.109.92.244 # 地址 + port: 6399 # 端口 database: 16 # 数据库索引 - password: 20221122@dev # 密码,建议生产环境开启 + password: cyywl123.. # 密码,建议生产环境开启 phone: query-url: http://cy-phone-bill-inquiry-server:4006/cyywl-phone-query-api/ token: eyIwLnR5cCI6IkpXVCIsImFsZyI6IkhTNTEyIn0 \ No newline at end of file