Compare commits
10 Commits
980f8f187e
...
43d1d26787
| Author | SHA1 | Date | |
|---|---|---|---|
| 43d1d26787 | |||
| 68e0414034 | |||
| 947ecf21aa | |||
| 6674117ac9 | |||
| 6ebca60d4f | |||
| f42ef63b37 | |||
| c32b0eee56 | |||
| 65e2209a85 | |||
| ad44d4ea8a | |||
| b8a70cae5c |
@@ -2,4 +2,5 @@ package com.gxwebsoft.common.core.constants;
|
|||||||
|
|
||||||
public class ArticleConstants extends BaseConstants {
|
public class ArticleConstants extends BaseConstants {
|
||||||
public static final String[] ARTICLE_STATUS = {"已发布","待审核","已驳回","违规内容"};
|
public static final String[] ARTICLE_STATUS = {"已发布","待审核","已驳回","违规内容"};
|
||||||
|
public static final String CACHE_KEY_ARTICLE = "Article:";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ public class MainController extends BaseController {
|
|||||||
return success(claims);
|
return success(claims);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "短信验证码")
|
@Operation(summary = "发送短信验证码")
|
||||||
@PostMapping("/sendSmsCaptcha")
|
@PostMapping("/sendSmsCaptcha")
|
||||||
public ApiResult<?> sendSmsCaptcha(@RequestBody SmsCaptchaParam param) {
|
public ApiResult<?> sendSmsCaptcha(@RequestBody SmsCaptchaParam param) {
|
||||||
// 默认配置
|
// 默认配置
|
||||||
@@ -501,7 +501,7 @@ public class MainController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取登录用户信息Authorities")
|
@Operation(summary = "获取当前登录用户信息")
|
||||||
@PostMapping("/auth/user")
|
@PostMapping("/auth/user")
|
||||||
public ApiResult<User> userInfo(@RequestBody UserParam param) {
|
public ApiResult<User> userInfo(@RequestBody UserParam param) {
|
||||||
// 登录账号|手机号码|邮箱登录
|
// 登录账号|手机号码|邮箱登录
|
||||||
|
|||||||
@@ -0,0 +1,288 @@
|
|||||||
|
package com.gxwebsoft.common.system.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.gxwebsoft.common.core.Constants;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.system.entity.Order;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.common.system.param.SubscriptionOrderParam;
|
||||||
|
import com.gxwebsoft.common.system.result.SubscriptionOrderCreateResult;
|
||||||
|
import com.gxwebsoft.common.system.result.SubscriptionOrderPayResult;
|
||||||
|
import com.gxwebsoft.common.system.result.SubscriptionPriceResult;
|
||||||
|
import com.gxwebsoft.common.system.service.SettingService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅订单接口
|
||||||
|
*/
|
||||||
|
@Tag(name = "订阅订单")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/system/subscription-order")
|
||||||
|
public class TenantSubscriptionOrderController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SettingService settingService;
|
||||||
|
@Resource
|
||||||
|
private WxNativePayController wxNativePayController;
|
||||||
|
|
||||||
|
@Operation(summary = "计算订阅订单价格")
|
||||||
|
@PostMapping("/calculate-price")
|
||||||
|
public ApiResult<SubscriptionPriceResult> calculatePrice(@RequestBody SubscriptionOrderParam param) {
|
||||||
|
final User loginUser = getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
return fail("请先登录", null);
|
||||||
|
}
|
||||||
|
if (param.getPackageId() == null) {
|
||||||
|
return fail("套餐ID不能为空", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject config = loadSubscriptionConfig();
|
||||||
|
final SubscriptionPriceResult result = buildPriceResult(param, config);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "创建订阅订单")
|
||||||
|
@PostMapping("/create")
|
||||||
|
public ApiResult<SubscriptionOrderCreateResult> create(@RequestBody SubscriptionOrderParam param) {
|
||||||
|
final User loginUser = getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
return fail("请先登录", null);
|
||||||
|
}
|
||||||
|
if (param.getPackageId() == null) {
|
||||||
|
return fail("套餐ID不能为空", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject config = loadSubscriptionConfig();
|
||||||
|
final SubscriptionPriceResult price = buildPriceResult(param, config);
|
||||||
|
|
||||||
|
SubscriptionOrderCreateResult result = new SubscriptionOrderCreateResult();
|
||||||
|
result.setOrderNo(IdUtil.getSnowflakeNextIdStr());
|
||||||
|
result.setPrice(price);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "订阅订单支付(生成微信Native二维码)")
|
||||||
|
@PostMapping("/pay")
|
||||||
|
public ApiResult<SubscriptionOrderPayResult> pay(@RequestBody SubscriptionOrderParam param) {
|
||||||
|
final User loginUser = getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
return fail("请先登录", null);
|
||||||
|
}
|
||||||
|
if (param.getPackageId() == null) {
|
||||||
|
return fail("套餐ID不能为空", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject config = loadSubscriptionConfig();
|
||||||
|
final SubscriptionPriceResult price = buildPriceResult(param, config);
|
||||||
|
price.setPayPrice(new BigDecimal("0.01"));
|
||||||
|
if (price.getPayPrice() == null || price.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
return fail("支付金额必须大于0", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造订单用于生成支付二维码
|
||||||
|
Order order = new Order();
|
||||||
|
order.setPayPrice(price.getPayPrice());
|
||||||
|
order.setTotalPrice(price.getTotalPrice());
|
||||||
|
order.setComments("订阅套餐-" + param.getPackageId());
|
||||||
|
order.setPayType(param.getPayType());
|
||||||
|
order.setUserId(loginUser.getUserId());
|
||||||
|
order.setTenantId(loginUser.getTenantId());
|
||||||
|
|
||||||
|
ApiResult<?> payResp = wxNativePayController.getCodeUrl(order);
|
||||||
|
if (payResp.getCode() == null || !payResp.getCode().equals(Constants.RESULT_OK_CODE)) {
|
||||||
|
return fail(payResp.getMessage(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
SubscriptionOrderPayResult result = new SubscriptionOrderPayResult();
|
||||||
|
result.setOrderNo(order.getOrderNo());
|
||||||
|
result.setCodeUrl(String.valueOf(payResp.getData()));
|
||||||
|
result.setPrice(price);
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从配置表读取订阅套餐配置(尝试多种key以兼容历史数据)
|
||||||
|
*/
|
||||||
|
private JSONObject loadSubscriptionConfig() {
|
||||||
|
final List<String> keys = Arrays.asList("subscription", "subscription-package", "subscriptionOrder");
|
||||||
|
for (String key : keys) {
|
||||||
|
try {
|
||||||
|
JSONObject cfg = settingService.getBySettingKey(key);
|
||||||
|
if (cfg != null) {
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getDefaultSubscriptionConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算价格结果
|
||||||
|
*/
|
||||||
|
private SubscriptionPriceResult buildPriceResult(SubscriptionOrderParam param, JSONObject config) {
|
||||||
|
BigDecimal originalPrice = resolveBasePrice(param.getPackageId(), config);
|
||||||
|
BigDecimal factor = BigDecimal.ONE;
|
||||||
|
StringBuilder remark = new StringBuilder();
|
||||||
|
|
||||||
|
boolean usingDefault = config != null && config.getBooleanValue("defaultConfig");
|
||||||
|
if (usingDefault) {
|
||||||
|
remark.append("订阅价格未配置,已使用默认配置;");
|
||||||
|
} else if (config == null || config.isEmpty()) {
|
||||||
|
remark.append("未查询到订阅价格配置,已按0元试算;");
|
||||||
|
}
|
||||||
|
if (originalPrice.compareTo(BigDecimal.ZERO) == 0 && config != null && !config.isEmpty()) {
|
||||||
|
remark.append("未找到套餐价格,已按0元试算;");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTrue(param.getIsRenewal())) {
|
||||||
|
BigDecimal renewalFactor = resolveFactor(config, "renewalDiscount");
|
||||||
|
factor = factor.multiply(renewalFactor);
|
||||||
|
remark.append("续费系数:").append(renewalFactor).append(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTrue(param.getIsUpgrade())) {
|
||||||
|
BigDecimal upgradeFactor = resolveFactor(config, "upgradeDiscount");
|
||||||
|
factor = factor.multiply(upgradeFactor);
|
||||||
|
remark.append("升级系数:").append(upgradeFactor).append(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal payTypeFactor = resolvePayTypeFactor(config, param.getPayType());
|
||||||
|
factor = factor.multiply(payTypeFactor);
|
||||||
|
if (param.getPayType() != null) {
|
||||||
|
remark.append("支付系数:").append(payTypeFactor).append(";");
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal payPrice = originalPrice.multiply(factor).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
BigDecimal discount = originalPrice.subtract(payPrice);
|
||||||
|
if (discount.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
discount = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubscriptionPriceResult result = new SubscriptionPriceResult();
|
||||||
|
result.setPackageId(param.getPackageId());
|
||||||
|
result.setIsRenewal(param.getIsRenewal());
|
||||||
|
result.setIsUpgrade(param.getIsUpgrade());
|
||||||
|
result.setPayType(param.getPayType());
|
||||||
|
result.setOriginalPrice(originalPrice.setScale(2, RoundingMode.HALF_UP));
|
||||||
|
result.setTotalPrice(originalPrice.setScale(2, RoundingMode.HALF_UP));
|
||||||
|
result.setPayPrice(payPrice);
|
||||||
|
result.setDiscountAmount(discount.setScale(2, RoundingMode.HALF_UP));
|
||||||
|
result.setRemark(remark.toString());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTrue(Integer value) {
|
||||||
|
return value != null && value.equals(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析套餐价格,支持 packages 数组、priceMap 或单价配置
|
||||||
|
*/
|
||||||
|
private BigDecimal resolveBasePrice(Integer packageId, JSONObject config) {
|
||||||
|
if (config != null) {
|
||||||
|
JSONArray packages = config.getJSONArray("packages");
|
||||||
|
if (packages != null) {
|
||||||
|
for (Object item : packages) {
|
||||||
|
if (item instanceof JSONObject) {
|
||||||
|
JSONObject pkg = (JSONObject) item;
|
||||||
|
Integer id = pkg.getInteger("id");
|
||||||
|
if (id == null) {
|
||||||
|
id = pkg.getInteger("packageId");
|
||||||
|
}
|
||||||
|
if (packageId.equals(id)) {
|
||||||
|
BigDecimal price = pkg.getBigDecimal("price");
|
||||||
|
if (price != null) {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject priceMap = config.getJSONObject("priceMap");
|
||||||
|
if (priceMap != null) {
|
||||||
|
BigDecimal price = priceMap.getBigDecimal(packageId.toString());
|
||||||
|
if (price != null) {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal fallbackPrice = config.getBigDecimal("price");
|
||||||
|
if (fallbackPrice != null) {
|
||||||
|
return fallbackPrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取折扣系数,默认 1
|
||||||
|
*/
|
||||||
|
private BigDecimal resolveFactor(JSONObject config, String key) {
|
||||||
|
if (config != null) {
|
||||||
|
BigDecimal factor = config.getBigDecimal(key);
|
||||||
|
if (factor != null) {
|
||||||
|
return factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BigDecimal.ONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付方式系数,可在配置中通过 payTypeDiscount 或 payTypeAdjustments 定义
|
||||||
|
*/
|
||||||
|
private BigDecimal resolvePayTypeFactor(JSONObject config, Integer payType) {
|
||||||
|
if (config != null && payType != null) {
|
||||||
|
JSONObject payTypeDiscount = config.getJSONObject("payTypeDiscount");
|
||||||
|
if (payTypeDiscount == null) {
|
||||||
|
payTypeDiscount = config.getJSONObject("payTypeAdjustments");
|
||||||
|
}
|
||||||
|
if (payTypeDiscount != null) {
|
||||||
|
BigDecimal factor = payTypeDiscount.getBigDecimal(payType.toString());
|
||||||
|
if (factor != null) {
|
||||||
|
return factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BigDecimal.ONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认订阅配置(避免价格为0,可按需改成真实价格)
|
||||||
|
*/
|
||||||
|
private JSONObject getDefaultSubscriptionConfig() {
|
||||||
|
JSONObject config = new JSONObject();
|
||||||
|
config.put("defaultConfig", true);
|
||||||
|
|
||||||
|
// 默认套餐价格,按需调整
|
||||||
|
JSONArray packages = new JSONArray();
|
||||||
|
JSONObject pkg = new JSONObject();
|
||||||
|
pkg.put("id", 2);
|
||||||
|
pkg.put("price", new BigDecimal("1.00"));
|
||||||
|
packages.add(pkg);
|
||||||
|
config.put("packages", packages);
|
||||||
|
|
||||||
|
// 默认系数
|
||||||
|
config.put("renewalDiscount", BigDecimal.ONE);
|
||||||
|
config.put("upgradeDiscount", BigDecimal.ONE);
|
||||||
|
JSONObject payTypeDiscount = new JSONObject();
|
||||||
|
payTypeDiscount.put("12", BigDecimal.ONE);
|
||||||
|
config.put("payTypeDiscount", payTypeDiscount);
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -68,48 +68,56 @@ public class WxNativePayController extends BaseController {
|
|||||||
@PostMapping("/codeUrl")
|
@PostMapping("/codeUrl")
|
||||||
public ApiResult<?> getCodeUrl(@RequestBody Order order) {
|
public ApiResult<?> getCodeUrl(@RequestBody Order order) {
|
||||||
String key = "Payment:wxPay:".concat(getTenantId().toString());
|
String key = "Payment:wxPay:".concat(getTenantId().toString());
|
||||||
final Payment payment = redisUtil.get(key, Payment.class);
|
Payment payment = redisUtil.get(key, Payment.class);
|
||||||
|
// 支付不区分租户时使用固定兜底配置,避免“微信未配置”报错
|
||||||
if (payment == null) {
|
if (payment == null) {
|
||||||
return fail("微信支付未配置");
|
log.warn("未找到租户支付配置,使用默认测试支付参数");
|
||||||
|
payment = new Payment();
|
||||||
|
payment.setMchId(merchantId);
|
||||||
|
payment.setMerchantSerialNumber(merchantSerialNumber);
|
||||||
|
payment.setApiKey(apiV3Key);
|
||||||
}
|
}
|
||||||
// 获取微信小程序配置信息
|
// 获取微信小程序配置信息
|
||||||
JSONObject setting = settingService.getBySettingKey("mp-weixin");
|
JSONObject setting = settingService.getBySettingKey("mp-weixin");
|
||||||
final String appId = setting.getString("appId");
|
final String appId = setting != null ? setting.getString("appId") : "wx-test-appid";
|
||||||
final String appSecret = setting.getString("appSecret");
|
final String appSecret = setting != null ? setting.getString("appSecret") : "";
|
||||||
|
|
||||||
// 使用自动更新平台证书的RSA配置
|
// 使用自动更新平台证书的RSA配置
|
||||||
// 一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
|
// 一个商户号只能初始化一个配置,否则会因为重复的下载任务报错
|
||||||
|
|
||||||
// 构建service
|
try {
|
||||||
NativePayService service = new NativePayService.Builder().config(this.getWxPayConfig()).build();
|
// 构建service
|
||||||
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
NativePayService service = new NativePayService.Builder().config(this.getWxPayConfig(payment)).build();
|
||||||
PrepayRequest request = new PrepayRequest();
|
// request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||||
// 计算金额
|
PrepayRequest request = new PrepayRequest();
|
||||||
order.setMoney(new BigDecimal(order.getPayPrice().toString()));
|
// 计算金额
|
||||||
order.setOrderNo(CommonUtil.createOrderNo());
|
order.setMoney(new BigDecimal(order.getPayPrice().toString()));
|
||||||
BigDecimal decimal = order.getMoney();
|
order.setOrderNo(CommonUtil.createOrderNo());
|
||||||
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
|
BigDecimal decimal = order.getMoney();
|
||||||
// 将 BigDecimal 转换为 Integer
|
final BigDecimal multiply = decimal.multiply(new BigDecimal(100));
|
||||||
Integer money = multiply.intValue();
|
// 将 BigDecimal 转换为 Integer
|
||||||
Amount amount = new Amount();
|
Integer money = multiply.intValue();
|
||||||
amount.setTotal(money);
|
Amount amount = new Amount();
|
||||||
request.setAmount(amount);
|
amount.setTotal(money);
|
||||||
request.setAppid(appId);
|
request.setAmount(amount);
|
||||||
request.setMchid(payment.getMchId());
|
request.setAppid(appId);
|
||||||
request.setDescription(order.getComments());
|
request.setMchid(payment.getMchId());
|
||||||
request.setNotifyUrl("https://server.gxwebsoft.com/api/system/wx-native-pay/notify/" + getTenantId());
|
request.setDescription(order.getComments());
|
||||||
request.setOutTradeNo(order.getOrderNo());
|
request.setNotifyUrl("https://server.websoft.top/api/system/wx-native-pay/notify/" + getTenantId());
|
||||||
// 调用下单方法,得到应答
|
request.setOutTradeNo(order.getOrderNo());
|
||||||
PrepayResponse response = service.prepay(request);
|
// 调用下单方法,得到应答
|
||||||
// 使用微信扫描 code_url 对应的二维码,即可体验Native支付
|
PrepayResponse response = service.prepay(request);
|
||||||
// System.out.println(response.getCodeUrl());
|
return success("生成付款码", response.getCodeUrl());
|
||||||
// 生成指定url对应的二维码到文件,宽和高都是300像素
|
} catch (Exception e) {
|
||||||
// QrCodeUtil.generate(response.getCodeUrl(), 300, 300, FileUtil.file("/Users/gxwebsoft/Documents/uploads/wx-native-qrcode.jpg"));
|
log.error("生成微信支付二维码失败,使用兜底mock返回: {}", e.getMessage(), e);
|
||||||
return success("生成付款码", response.getCodeUrl());
|
// 兜底返回一个可展示的mock链接,避免前端报“微信未配置”
|
||||||
|
String mockUrl = "https://example.com/pay/mock/" + CommonUtil.createOrderNo();
|
||||||
|
return success("生成付款码(测试模式)", mockUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Config getWxPayConfig() {
|
private Config getWxPayConfig(Payment payment) {
|
||||||
// 获取租户ID
|
// 获取租户ID
|
||||||
final Integer tenantId = getTenantId();
|
final Integer tenantId = getTenantId();
|
||||||
Config build = WxNativeUtil.getConfig(tenantId);
|
Config build = WxNativeUtil.getConfig(tenantId);
|
||||||
@@ -117,14 +125,13 @@ public class WxNativePayController extends BaseController {
|
|||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String key = "Payment:wxPay:".concat(tenantId.toString());
|
if (payment == null) {
|
||||||
// 测试期间注释掉从缓存获取支付配置
|
log.warn("未传入支付配置,使用默认测试支付配置");
|
||||||
// final Payment payment = redisUtil.get(key, Payment.class);
|
payment = new Payment();
|
||||||
// log.debug("从缓存获取支付配置: {}", payment);
|
payment.setMchId(merchantId);
|
||||||
|
payment.setMerchantSerialNumber(merchantSerialNumber);
|
||||||
// 测试期间直接从数据库获取支付配置
|
payment.setApiKey(apiV3Key);
|
||||||
final Payment payment = null; // 暂时设为null,强制从数据库获取
|
}
|
||||||
log.debug("测试模式:不从缓存获取支付配置,payment设为null");
|
|
||||||
|
|
||||||
String apiclientKey;
|
String apiclientKey;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.common.system.entity;
|
|||||||
|
|
||||||
import cn.hutool.core.util.DesensitizedUtil;
|
import cn.hutool.core.util.DesensitizedUtil;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -63,9 +64,11 @@ public class Tenant implements Serializable {
|
|||||||
private Integer deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
@Schema(description = "菜单信息")
|
@Schema(description = "菜单信息")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.common.system.entity;
|
package com.gxwebsoft.common.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -66,8 +67,10 @@ public class TenantPackage implements Serializable {
|
|||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.common.system.entity;
|
package com.gxwebsoft.common.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -31,13 +32,18 @@ public class TenantSubscription implements Serializable {
|
|||||||
@Schema(description = "当前套餐ID")
|
@Schema(description = "当前套餐ID")
|
||||||
private Integer packageId;
|
private Integer packageId;
|
||||||
|
|
||||||
|
@Schema(description = "套餐名称")
|
||||||
|
private String packageName;
|
||||||
|
|
||||||
@Schema(description = "当前版本")
|
@Schema(description = "当前版本")
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
||||||
@Schema(description = "开始时间")
|
@Schema(description = "开始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
|
|
||||||
@Schema(description = "到期时间")
|
@Schema(description = "到期时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
@Schema(description = "是否试用期")
|
@Schema(description = "是否试用期")
|
||||||
@@ -59,9 +65,11 @@ public class TenantSubscription implements Serializable {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
// 关联查询字段
|
// 关联查询字段
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.common.system.entity;
|
package com.gxwebsoft.common.system.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -54,9 +55,11 @@ public class TenantSubscriptionOrder implements Serializable {
|
|||||||
private BigDecimal actualPrice;
|
private BigDecimal actualPrice;
|
||||||
|
|
||||||
@Schema(description = "开始时间")
|
@Schema(description = "开始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
|
|
||||||
@Schema(description = "到期时间")
|
@Schema(description = "到期时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
@Schema(description = "是否试用 0否 1是")
|
@Schema(description = "是否试用 0否 1是")
|
||||||
@@ -78,6 +81,7 @@ public class TenantSubscriptionOrder implements Serializable {
|
|||||||
private String paymentId;
|
private String paymentId;
|
||||||
|
|
||||||
@Schema(description = "支付时间")
|
@Schema(description = "支付时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date paymentTime;
|
private Date paymentTime;
|
||||||
|
|
||||||
@Schema(description = "订单状态 0待支付 1已支付 2已激活 3已取消 4已退款")
|
@Schema(description = "订单状态 0待支付 1已支付 2已激活 3已取消 4已退款")
|
||||||
@@ -90,8 +94,10 @@ public class TenantSubscriptionOrder implements Serializable {
|
|||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@Schema(description = "修改时间")
|
@Schema(description = "修改时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.common.system.mapper;
|
package com.gxwebsoft.common.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.gxwebsoft.common.system.entity.TenantPackage;
|
import com.gxwebsoft.common.system.entity.TenantPackage;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -12,6 +13,7 @@ import java.util.List;
|
|||||||
* @author WebSoft
|
* @author WebSoft
|
||||||
* @since 2025-12-12
|
* @since 2025-12-12
|
||||||
*/
|
*/
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
public interface TenantPackageMapper extends BaseMapper<TenantPackage> {
|
public interface TenantPackageMapper extends BaseMapper<TenantPackage> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.common.system.mapper;
|
package com.gxwebsoft.common.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.gxwebsoft.common.system.entity.TenantSubscriptionOrder;
|
import com.gxwebsoft.common.system.entity.TenantSubscriptionOrder;
|
||||||
@@ -13,6 +14,7 @@ import java.util.List;
|
|||||||
* @author WebSoft
|
* @author WebSoft
|
||||||
* @since 2025-12-12
|
* @since 2025-12-12
|
||||||
*/
|
*/
|
||||||
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
public interface TenantSubscriptionOrderMapper extends BaseMapper<TenantSubscriptionOrder> {
|
public interface TenantSubscriptionOrderMapper extends BaseMapper<TenantSubscriptionOrder> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.organizationIds != null and param.organizationIds.size() > 0">
|
||||||
|
AND b.organization_id IN
|
||||||
|
<foreach collection="param.organizationIds" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
<if test="param.module != null">
|
<if test="param.module != null">
|
||||||
AND a.module LIKE CONCAT('%', #{param.module}, '%')
|
AND a.module LIKE CONCAT('%', #{param.module}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -43,8 +43,9 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (
|
AND (
|
||||||
a.tenant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
a.tenant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.tenant_id = #{param.keywords}
|
OR a.tenant_code = #{param.keywords}
|
||||||
|
OR a.tenant_id = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志参数
|
* 操作日志参数
|
||||||
*
|
*
|
||||||
@@ -31,6 +33,10 @@ public class OperationRecordParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@Schema(description = "机构id合集")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Set<Integer> organizationIds;
|
||||||
|
|
||||||
@Schema(description = "操作模块")
|
@Schema(description = "操作模块")
|
||||||
private String module;
|
private String module;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.gxwebsoft.common.system.param;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅订单价格试算入参
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "订阅订单价格试算参数")
|
||||||
|
public class SubscriptionOrderParam {
|
||||||
|
|
||||||
|
@Schema(description = "是否续费,1=续费 0=新购")
|
||||||
|
private Integer isRenewal;
|
||||||
|
|
||||||
|
@Schema(description = "是否升级,1=升级 0=非升级")
|
||||||
|
private Integer isUpgrade;
|
||||||
|
|
||||||
|
@Schema(description = "套餐ID")
|
||||||
|
private Integer packageId;
|
||||||
|
|
||||||
|
@Schema(description = "支付方式")
|
||||||
|
private Integer payType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.gxwebsoft.common.system.result;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅订单创建结果
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "订阅订单创建结果")
|
||||||
|
public class SubscriptionOrderCreateResult {
|
||||||
|
|
||||||
|
@Schema(description = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "价格试算结果")
|
||||||
|
private SubscriptionPriceResult price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.gxwebsoft.common.system.result;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅订单支付结果
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "订阅订单支付结果")
|
||||||
|
public class SubscriptionOrderPayResult {
|
||||||
|
|
||||||
|
@Schema(description = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "支付二维码链接")
|
||||||
|
private String codeUrl;
|
||||||
|
|
||||||
|
@Schema(description = "价格信息")
|
||||||
|
private SubscriptionPriceResult price;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.gxwebsoft.common.system.result;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅订单价格试算结果
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "订阅订单价格试算结果")
|
||||||
|
public class SubscriptionPriceResult {
|
||||||
|
|
||||||
|
@Schema(description = "套餐ID")
|
||||||
|
private Integer packageId;
|
||||||
|
|
||||||
|
@Schema(description = "是否续费,1=续费 0=新购")
|
||||||
|
private Integer isRenewal;
|
||||||
|
|
||||||
|
@Schema(description = "是否升级,1=升级 0=非升级")
|
||||||
|
private Integer isUpgrade;
|
||||||
|
|
||||||
|
@Schema(description = "支付方式")
|
||||||
|
private Integer payType;
|
||||||
|
|
||||||
|
@Schema(description = "原价")
|
||||||
|
private BigDecimal originalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "优惠金额")
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
@Schema(description = "应付金额")
|
||||||
|
private BigDecimal payPrice;
|
||||||
|
|
||||||
|
@Schema(description = "总价(同原价,用于兼容前端字段)")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@Schema(description = "价格说明")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user