diff --git a/cash-api/order-server/src/main/java/com/czg/controller/OrderPayController.java b/cash-api/order-server/src/main/java/com/czg/controller/OrderPayController.java
index 18819e02d..b6fd2622e 100644
--- a/cash-api/order-server/src/main/java/com/czg/controller/OrderPayController.java
+++ b/cash-api/order-server/src/main/java/com/czg/controller/OrderPayController.java
@@ -3,6 +3,7 @@ package com.czg.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import com.czg.annotation.Debounce;
+import com.czg.constants.ParamCodeCst;
import com.czg.market.service.OrderInfoService;
import com.czg.order.dto.CheckOrderPay;
import com.czg.order.entity.OrderInfo;
@@ -10,7 +11,6 @@ import com.czg.order.service.OrderInfoCustomService;
import com.czg.resp.CzgResult;
import com.czg.service.order.dto.OrderPayParamDTO;
import com.czg.service.order.service.PayService;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.czg.utils.AssertUtil;
import com.czg.utils.ServletUtil;
@@ -160,7 +160,7 @@ public class OrderPayController {
OrderInfo orderInfo = orderInfoCustomService.checkOrderPay(checkOrderPay);
map.put("payAmount", orderInfo.getOrderAmount());
}
- String baseUrl = paramsService.getSysParamValue(SysParamCodeEnum.SHOP_ORDER_PAY_BASE_URL.getCode());
+ String baseUrl = paramsService.getSysParamValue(ParamCodeCst.System.SHOP_ORDER_PAY_BASE_URL);
String buildUrl = URLUtil.buildQuery(map, Charset.defaultCharset());
String fullUrl = baseUrl.concat("?").concat(buildUrl);
return CzgResult.success(fullUrl);
diff --git a/cash-api/system-server/src/main/java/com/czg/controller/admin/VersionController.java b/cash-api/system-server/src/main/java/com/czg/controller/admin/VersionController.java
index 899b43ed5..006cc92a2 100644
--- a/cash-api/system-server/src/main/java/com/czg/controller/admin/VersionController.java
+++ b/cash-api/system-server/src/main/java/com/czg/controller/admin/VersionController.java
@@ -2,9 +2,9 @@ package com.czg.controller.admin;
import com.aliyun.sts20150401.models.AssumeRoleResponse;
import com.czg.annotation.SaAdminCheckPermission;
+import com.czg.constants.ParamCodeCst;
import com.czg.resp.CzgResult;
import com.czg.system.dto.VersionDTO;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.czg.system.service.VersionService;
import com.czg.validator.group.InsertGroup;
@@ -96,16 +96,16 @@ public class VersionController {
try {
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
- .setAccessKeyId(paramsService.getSysParamValue(SysParamCodeEnum.ALI_OSS_ACCESS_KEY.getCode()))
+ .setAccessKeyId(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ACCESS_KEY))
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
- .setAccessKeySecret(paramsService.getSysParamValue(SysParamCodeEnum.ALI_OSS_ACCESS_SECRET.getCode()));
+ .setAccessKeySecret(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ACCESS_SECRET));
// Endpoint 请参考 https://api.aliyun.com/product/Sts
- config.endpoint = paramsService.getSysParamValue(SysParamCodeEnum.ALI_OSS_ENDPOINT.getCode());
+ config.endpoint = paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ENDPOINT);
com.aliyun.sts20150401.Client client = new com.aliyun.sts20150401.Client(config);
com.aliyun.sts20150401.models.AssumeRoleRequest assumeRoleRequest = new com.aliyun.sts20150401.models.AssumeRoleRequest();
- assumeRoleRequest.setRoleArn(paramsService.getSysParamValue(SysParamCodeEnum.ALI_OSS_ROLE_ARN.getCode()));
+ assumeRoleRequest.setRoleArn(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ROLE_ARN));
assumeRoleRequest.setRoleSessionName("test");
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
// 复制代码运行请自行打印 API 的返回值
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/entity/ShopUser.java b/cash-common/cash-common-service/src/main/java/com/czg/account/entity/ShopUser.java
index 07f91b8c7..961c7c69e 100644
--- a/cash-common/cash-common-service/src/main/java/com/czg/account/entity/ShopUser.java
+++ b/cash-common/cash-common-service/src/main/java/com/czg/account/entity/ShopUser.java
@@ -1,7 +1,7 @@
package com.czg.account.entity;
-import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.annotation.JSONField;
+import com.czg.utils.CzgRandomUtils;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
@@ -199,4 +199,8 @@ public class ShopUser implements Serializable {
// 重新拼接字符串
distributionShops = String.join(",", shopSet);
}
+
+ public static String generateCode() {
+ return CzgRandomUtils.randomNumber(10, true);
+ }
}
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/constants/ParamCodeCst.java b/cash-common/cash-common-service/src/main/java/com/czg/constants/ParamCodeCst.java
new file mode 100644
index 000000000..1f489c5f1
--- /dev/null
+++ b/cash-common/cash-common-service/src/main/java/com/czg/constants/ParamCodeCst.java
@@ -0,0 +1,324 @@
+package com.czg.constants;
+
+/**
+ * 系统参数编码常量类
+ *
+ * @author ww
+ * @date 2025/12/22
+ * @since 1.0.0
+ */
+public interface ParamCodeCst {
+
+ /**
+ * 系统通用配置项
+ *
存放跨业务模块的通用系统配置
+ */
+ class System {
+ /**
+ * 超掌柜支付回调地址
+ * 支付宝/微信支付完成后,支付平台回调我方系统的地址
+ */
+ public static String PAY_CZG_NOTIFY_URL = "pay_czg_notify_url";
+ /**
+ * 排队到号通知
+ */
+ public static String WX_MINI_MSG_CALL_CURRENT = "wx_mini_msg_call_current";
+ /**
+ * 排队即将到号提醒
+ */
+ public static String WX_MINI_MSG_CALL_NEAR = "wx_mini_msg_call_near";
+ /**
+ * 排队提醒
+ */
+ public static String WX_MINI_MSG_CALL_PASS = "wx_mini_msg_call_pass";
+
+ /**
+ * 小程序会员页面地址
+ * 微信小程序中会员中心页面的跳转地址 分享时 使用
+ */
+ public static String WX_MINI_VIP_URL = "wx_mini_vip_url";
+
+ /**
+ * 桌码生成路径
+ * 餐厅桌码图片生成的基础路径/域名
+ */
+ public static String TABLE_CODE_URL = "table_code_url";
+
+ /**
+ * 短信费用
+ * 单条短信发送的成本费用(单位:元)
+ */
+ public static String SMS_FEE = "sms_fee";
+
+ /**
+ * 店铺订单支付BaseUrl
+ * 店铺订单支付页面的基础域名
+ */
+ public static String SHOP_ORDER_PAY_BASE_URL = "shop_order_pay_base_url";
+
+ /**
+ * 平台名称
+ * 系统对外展示的平台名称(如:超掌柜)
+ */
+ public static String PLATE_NAME = "plate_name";
+
+ /**
+ * 超掌柜退款回调地址
+ * 支付平台处理退款后,回调我方系统的地址
+ */
+ public static String PAY_CZG_REFUND_NOTIFY_URL = "pay_czg_refund_notify_url";
+
+ /**
+ * 超掌柜支付域名
+ * 超掌柜支付相关接口的根域名
+ */
+ public static String PAY_CZG_DOMAIN = "pay_czg_domain";
+
+ /**
+ * 叫号页面地址
+ * 餐厅叫号系统的前端页面地址
+ */
+ public static String CALL_PAGE_URL = "call_page_url";
+
+ /**
+ * 微信原生回调地址
+ * 微信原生支付接口的回调地址(区别于超掌柜封装的回调)
+ */
+ public static String NATIVE_NOTIFY_URL = "native_notify_url";
+
+ /**
+ * 公众号关注位置
+ * 公众号关注入口的展示位置,可选值:mine-我的页面、order-订单页面、eat-就餐页面
+ */
+ public static String FOLLOW_INDEX = "follow_index";
+ }
+
+ /**
+ * 微信相关配置项
+ * 包含公众号、小程序、微信支付三大模块的配置
+ */
+ interface Wechat {
+ /**
+ * 微信公众号(银收客)配置项
+ * 银收客公众号相关配置,用于发送订阅消息等场景
+ */
+ class Ac {
+ /**
+ * 商家每日可创建次数
+ * 商家通过公众号创建订单/活动等的每日上限次数
+ */
+ public static String AC_DAY_COUNT = "ac_day_count";
+
+ /**
+ * 微信公众号AppId(银收客主号)
+ * 银收客主体公众号的AppId,用于发送商品/耗材库存等订阅消息
+ * wx_account_app_id
+ */
+ public static String SHOP_WX_AC_APP_ID = "shop_wx_ac_app_id";
+ /**
+ * 微信公众号Secret(银收客主号)
+ * 银收客主体公众号的Secret,用于获取access_token
+ */
+ public static String SHOP_WX_AC_SECRETE = "shop_wx_ac_secrete";
+
+
+ /**
+ * 用户订阅公众号AppId(银收客CZg)
+ * 用户侧订阅的银收客CZg公众号AppId
+ * wechat_ac_appid
+ */
+ public static String USER_WX_AC_APP_ID = "user_wx_ac_app_id";//
+
+ /**
+ * 用户订阅公众号Secret(银收客CZg)
+ * 用户侧订阅的银收客CZg公众号Secret
+ */
+ public static String USER_WX_AC_SECRETE = "user_wx_ac_secrete";//
+ }
+
+ /**
+ * 微信小程序配置项
+ * 包含商家端和用户端小程序的密钥、AppId等配置
+ */
+ class Mini {
+ /**
+ * 商家端小程序AppId
+ * 商家管理端微信小程序的AppId
+ */
+ public static String SHOP_WX_APP_ID = "shop_wx_app_id";
+ /**
+ * 商家端小程序Secret
+ * 商家管理端微信小程序的Secret
+ */
+ public static String SHOP_WX_SECRETE = "shop_wx_secrete";
+
+ /**
+ * 用户微信小程序AppId
+ * 普通用户使用的微信小程序AppId
+ */
+ public static String USER_WX_APP_ID = "user_wx_app_id";
+
+ /**
+ * 用户微信小程序Secret
+ * 普通用户使用的微信小程序Secret
+ */
+ public static String USER_WX_SECRETE = "user_wx_secrete";
+ }
+
+ /**
+ * 微信支付配置项
+ * 微信支付V3接口相关的证书、密钥、商户号等配置
+ */
+ class Pay {
+ /**
+ * 微信API支付证书PEM
+ * 微信支付V3接口所需的api_client_cert.pem证书内容
+ */
+ public static String WX_API_CLIENT_CERT = "wx_api_client_cert";
+
+ /**
+ * 微信API支付证书密钥PEM
+ * 微信支付V3接口所需的api_client_key.pem私钥内容
+ */
+ public static String WX_API_CLIENT_KEY = "wx_api_client_key";
+
+ /**
+ * 微信支付商户号
+ * 微信支付平台分配的商户编号
+ */
+ public static String WX_MCH_ID = "wx_mch_id";
+
+ /**
+ * 微信公钥
+ * 微信支付平台公钥,用于验签回调通知
+ */
+ public static String WX_PUB_KEY = "wx_pub_key";
+
+ /**
+ * 微信公钥ID
+ * 微信支付平台公钥对应的唯一标识,用于V3接口验签
+ */
+ public static String WX_PUB_KEY_ID = "wx_pub_key_id";
+
+ /**
+ * 微信V3密钥
+ * 微信支付V3接口的APIv3密钥,用于加密/解密回调数据
+ */
+ public static String WX_V3_KEY = "wx_v3_key";
+ }
+ }
+
+ /**
+ * 支付宝相关配置项
+ * 包含网页端、小程序端的支付宝配置
+ */
+ interface Alipay {
+ /**
+ * 支付宝网页端配置项
+ * PC/网页端支付宝支付相关配置
+ */
+ class Web {
+ /**
+ * 支付宝网页端AppId
+ * 支付宝开放平台分配的网页应用AppId
+ */
+ public static String ALI_ACCOUNT_APP_ID = "ali_account_app_id";
+
+ /**
+ * 支付宝商户私钥
+ * 商户侧生成的RSA私钥,用于签名请求
+ */
+ public static String ALI_ACCOUNT_PRIVATE_KEY = "ali_account_private_key";
+
+ /**
+ * 支付宝公钥
+ * 支付宝开放平台提供的公钥,用于验签回调通知
+ */
+ public static String ALI_ACCOUNT_PUBLIC_KEY = "ali_account_public_key";
+
+ /**
+ * 阿里AES加密串
+ * 支付宝接口数据加密所需的AES密钥
+ */
+ public static String ALI_ENCRYPT_KEY = "ali_encrypt_key";
+
+ /**
+ * 支付宝网关
+ * 支付宝开放平台接口网关地址(沙箱/生产环境)
+ */
+ public static String ALI_GATEWAY = "ali_gateway";
+ }
+
+ /**
+ * 支付宝小程序配置项
+ * 支付宝小程序支付相关配置
+ */
+ class Mini {
+ /**
+ * 支付宝小程序AppId
+ * 支付宝开放平台分配的小程序AppId
+ */
+ public static String ALI_MINI_APP_ID = "ali_mini_app_id";
+
+ /**
+ * 支付宝小程序支付私钥
+ * 小程序支付专用的商户RSA私钥
+ */
+ public static String ALI_MINI_PRIVATE_KEY = "ali_mini_private_key";
+
+ /**
+ * 支付宝小程序公钥
+ * 支付宝开放平台提供的小程序专用公钥
+ */
+ public static String ALI_MINI_PUBLIC_KEY = "ali_mini_public_key";
+ }
+ }
+
+ /**
+ * 阿里云相关配置项
+ * 包含OSS对象存储、短信服务等阿里云产品配置
+ */
+ class AliYun {
+ /**
+ * 阿里云OSS AccessSecret
+ * 阿里云OSS服务的访问密钥Secret
+ */
+ public static String ALI_OSS_ACCESS_SECRET = "ali_oss_access_secret";
+
+ /**
+ * 阿里云短信模板码
+ * 阿里云短信服务审核通过的模板编号
+ */
+ public static String ALI_SMS_TEMPLATE_CODE = "ali_sms_template_code";
+
+ /**
+ * 阿里云短信Secret
+ * 阿里云短信服务的访问密钥Secret
+ */
+ public static String ALI_SMS_SECRET = "ali_sms_secret";
+
+ /**
+ * 阿里云短信Key
+ * 阿里云短信服务的访问密钥Key
+ */
+ public static String ALI_SMS_KEY = "ali_sms_key";
+
+ /**
+ * 阿里云OSS角色ARN
+ * 阿里云RAM角色的资源描述符,用于临时授权访问OSS
+ */
+ public static String ALI_OSS_ROLE_ARN = "ali_oss_role_arn";
+
+ /**
+ * 阿里云OSS Endpoint
+ * 阿里云OSS服务的地域节点地址
+ */
+ public static String ALI_OSS_ENDPOINT = "ali_oss_endpoint";
+
+ /**
+ * 阿里云OSS AccessKey
+ * 阿里云OSS服务的访问密钥Key
+ */
+ public static String ALI_OSS_ACCESS_KEY = "ali_oss_access_key";
+ }
+}
\ No newline at end of file
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/constants/ShopSwitchTypeEnum.java b/cash-common/cash-common-service/src/main/java/com/czg/constants/ShopSwitchTypeEnum.java
index 4b3d53afe..d46931a7e 100644
--- a/cash-common/cash-common-service/src/main/java/com/czg/constants/ShopSwitchTypeEnum.java
+++ b/cash-common/cash-common-service/src/main/java/com/czg/constants/ShopSwitchTypeEnum.java
@@ -1,6 +1,7 @@
package com.czg.constants;
import com.czg.account.entity.ShopInfo;
+import com.czg.utils.SerializableFunction;
/**
* 店铺 开关枚举
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/system/enums/SysParamCodeEnum.java b/cash-common/cash-common-service/src/main/java/com/czg/system/enums/SysParamCodeEnum.java
deleted file mode 100644
index c6e7a753a..000000000
--- a/cash-common/cash-common-service/src/main/java/com/czg/system/enums/SysParamCodeEnum.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.czg.system.enums;
-
-import lombok.Getter;
-
-/**
- * @author ww
- */
-
-@Getter
-public enum SysParamCodeEnum {
-
-
- // 微信公众号(用户订阅相关)
- WECHAT_AC_SECRETE("wechat_ac_secrete", "用户订阅公众号secret"),
- WECHAT_AC_APPID("wechat_ac_appid", "用户订阅公众号appid"),
-
- // 公众号关注位置
- FOLLOW_INDEX("follow_index", "公众号关注位置 mine-我的 order-订单 eat-就餐"),
-
- // 商家配置
- AC_DAY_COUNT("ac_day_count", "商家每日可创建次数"),
-
- // 短信相关
- SMS_FEE("sms_fee", "短信费用"),
- ALI_SMS_KEY("ali_sms_key", "阿里云短信key"),
- ALI_SMS_TEMPLATE_CODE("ali_sms_template_code", "阿里云短信模板"),
- ALI_SMS_SECRET("ali_sms_secret", "阿里云短信secret"),
-
- // 微信相关(公众号/小程序)
- WX_ACCOUNT_APP_ID("wx_account_app_id", "微信公众号appId"),
- WX_ACCOUNT_SECRETE("wx_account_secrete", "微信公众号密钥"),
- WX_MINI_APP_ID("wx_mini_app_id", "微信小程序appId"),
- WX_MINI_SECRETE("wx_mini_secrete", "微信小程序密钥"),
-
- // 页面地址相关
- WX_MINI_VIP_URL("wx_mini_vip_url", "小程序会员页面地址"),
- TABLE_CODE_URL("table_code_url", "桌码生成路径"),
- CALL_PAGE_URL("call_page_url", "叫号页面地址"),
- SHOP_ORDER_PAY_BASE_URL("shop_order_pay_base_url", "店铺订单支付BaseUrl"),
-
- // 支付相关(超掌柜)
- PAY_CZG_DOMAIN("pay_czg_domain", "超掌柜支付域名"),
- PAY_CZG_NOTIFY_URL("pay_czg_notify_url", "超掌柜支付回调地址"),
- PAY_CZG_REFUND_NOTIFY_URL("pay_czg_refund_notify_url", "超掌柜退款回调地址"),
-
- // 阿里云OSS相关
- ALI_OSS_ACCESS_KEY("ali_oss_access_key", "阿里云oss_ACCESS_KEY"),
- ALI_OSS_ACCESS_SECRET("ali_oss_access_secret", "阿里云oss_secret"),
- ALI_OSS_ENDPOINT("ali_oss_endpoint", "阿里云endpoint"),
- ALI_OSS_ROLE_ARN("ali_oss_role_arn", "阿里云roleArn"),
-
- // 支付宝相关(小程序/网页)
- ALI_MINI_PUBLIC_KEY("ali_mini_public_key", "支付宝小程序公钥"),
- ALI_MINI_PRIVATE_KEY("ali_mini_private_key", "支付宝小程序支付私钥"),
- ALI_MINI_APP_ID("ali_mini_app_id", "支付宝小程序id"),
- ALI_GATEWAY("ali_gateway", "支付宝网关"),
- ALI_ENCRYPT_KEY("ali_encrypt_key", "阿里AES加密串"),
- ALI_ACCOUNT_PUBLIC_KEY("ali_account_public_key", "支付宝网页公钥"),
- ALI_ACCOUNT_PRIVATE_KEY("ali_account_private_key", "支付宝网页私钥"),
- ALI_ACCOUNT_APP_ID("ali_account_app_id", "支付宝网页appid"),
- // 平台信息
- PLATE_NAME("plate_name", "平台名称")
-
- ;
-
- private final String code;
- private final String msg;
-
- SysParamCodeEnum(String code, String msg) {
- this.code = code;
- this.msg = msg;
- }
-}
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/system/service/SysParamsService.java b/cash-common/cash-common-service/src/main/java/com/czg/system/service/SysParamsService.java
index e7d9ca4f4..037790472 100644
--- a/cash-common/cash-common-service/src/main/java/com/czg/system/service/SysParamsService.java
+++ b/cash-common/cash-common-service/src/main/java/com/czg/system/service/SysParamsService.java
@@ -15,6 +15,14 @@ import java.util.List;
*/
public interface SysParamsService extends IService {
+
+ /**
+ * 根据参数类型获取参数
+ *
+ * @param type 参数类型
+ * @return 参数列表
+ */
+ CzgResult> getParamsByType(Integer type);
/**
* 新增参数
*
@@ -41,7 +49,7 @@ public interface SysParamsService extends IService {
/**
* 根据参数编码获取参数
- * {@link com.czg.system.enums.SysParamCodeEnum}
+ * {@link com.czg.constants.ParamCodeCst}
*
* @param code 参数编码
* @return 参数
@@ -49,21 +57,9 @@ public interface SysParamsService extends IService {
CzgResult getParamsByCode(String code);
/**
- * {@link com.czg.system.enums.SysParamCodeEnum}
- */
- SysParams getSysParam(String code);
-
- /**
- * {@link com.czg.system.enums.SysParamCodeEnum}
+ * 根据参数编码获取参数值
+ * {@link com.czg.constants.ParamCodeCst}
*/
String getSysParamValue(String code);
- /**
- * 根据参数类型获取参数
- *
- * @param type 参数类型
- * @return 参数列表
- */
- CzgResult> getParamsByType(Integer type);
-
}
diff --git a/cash-common/cash-common-service/src/main/java/com/czg/constants/SerializableFunction.java b/cash-common/cash-common-tools/src/main/java/com/czg/utils/SerializableFunction.java
similarity index 94%
rename from cash-common/cash-common-service/src/main/java/com/czg/constants/SerializableFunction.java
rename to cash-common/cash-common-tools/src/main/java/com/czg/utils/SerializableFunction.java
index 6c6f4642a..b70ee54d9 100644
--- a/cash-common/cash-common-service/src/main/java/com/czg/constants/SerializableFunction.java
+++ b/cash-common/cash-common-tools/src/main/java/com/czg/utils/SerializableFunction.java
@@ -1,4 +1,4 @@
-package com.czg.constants;
+package com.czg.utils;
import java.io.Serial;
import java.io.Serializable;
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AShopUserServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AShopUserServiceImpl.java
index b4a484e92..757bac807 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AShopUserServiceImpl.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/AShopUserServiceImpl.java
@@ -2,7 +2,6 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.shopuser.*;
import com.czg.account.entity.ShopUser;
@@ -16,15 +15,13 @@ import com.czg.market.entity.MemberLevelConfig;
import com.czg.market.entity.MkShopCouponRecord;
import com.czg.market.entity.SmsPushEventUser;
import com.czg.market.service.MemberLevelConfigService;
-import com.czg.market.service.MkShopConsumeDiscountRecordService;
import com.czg.market.service.MkShopCouponRecordService;
+import com.czg.market.service.OrderInfoService;
import com.czg.market.service.TbMemberConfigService;
import com.czg.market.vo.MemberConfigVO;
import com.czg.order.entity.OrderInfo;
-import com.czg.market.service.OrderInfoService;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopUserMapper;
-import com.czg.system.entity.SysParams;
import com.czg.system.service.SysParamsService;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
@@ -34,7 +31,6 @@ import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
-import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -167,7 +163,7 @@ public class AShopUserServiceImpl implements AShopUserService {
}
ShopUser shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
- shopUser.setCode(generateCode(shopId));
+ shopUser.setCode(ShopUser.generateCode());
shopUser.setSourceShopId(shopId);
shopUser.setUserId(userInfo.getId());
shopUser.setMainShopId(shopInfoService.getMainIdByShopId(shopId));
@@ -216,7 +212,7 @@ public class AShopUserServiceImpl implements AShopUserService {
.limit(1).orderBy(MemberLevelConfig::getExperienceValue, true));
if (config != null) {
shopUserDTO.setNextExperience(config.getExperienceValue() - (shopUser.getExperience() == null ? 0 : shopUser.getExperience()));
- shopUserDTO.setNextExperience(shopUserDTO.getNextExperience() < 0 ? 0: shopUserDTO.getNextExperience());
+ shopUserDTO.setNextExperience(shopUserDTO.getNextExperience() < 0 ? 0 : shopUserDTO.getNextExperience());
shopUserDTO.setNextMemberLevelName(config.getName());
}
return shopUserDTO;
@@ -227,43 +223,4 @@ public class AShopUserServiceImpl implements AShopUserService {
return shopUserService.updateMoney(shopUserEditDTO);
}
- public String generateCode(long shopId) {
- String code = "shop_user_code_val%d".formatted(shopId);
- SysParams sysParam = sysParamsService.getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
-
- if (sysParam == null) {
- SysParams sysParams = new SysParams()
- .setParamValue("1")
- .setParamType(1)
- .setCreateTime(DateUtil.date().toLocalDateTime())
- .setParamCode(code);
- sysParamsService.save(sysParams);
- return generateRandomCode(1);
- }
-
- long parseLong = Long.parseLong(sysParam.getParamValue());
- long l = ++parseLong;
- sysParam.setParamValue(String.valueOf(l));
- sysParamsService.updateById(sysParam);
-
- return generateRandomCode(l);
- }
-
- // 使用Hutool生成十六进制代码并随机填充字母
- private String generateRandomCode(long value) {
- // 生成十六进制代码,确保为10位
- String hexCode = String.format("%010X", value);
-
- // 计算需要补充的字母数量
- int missingLength = 10 - hexCode.length();
- StringBuilder codeBuilder = new StringBuilder(hexCode);
-
- for (int i = 0; i < missingLength; i++) {
- // 生成随机字母
- char randomChar = RandomUtil.randomChar("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- codeBuilder.append(randomChar);
- }
-
- return codeBuilder.toString();
- }
}
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/CallTableServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/CallTableServiceImpl.java
index 26719d8a2..45c97442b 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/CallTableServiceImpl.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/CallTableServiceImpl.java
@@ -11,6 +11,7 @@ import com.czg.account.service.*;
import com.czg.account.vo.CallQueueInfoVO;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst;
+import com.czg.constants.ParamCodeCst;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.czg.service.account.mapper.CallQueueMapper;
@@ -264,7 +265,7 @@ public class CallTableServiceImpl extends ServiceImpl paramsByCode = sysParamsService.getParamsByCode("call_page_url");
+ CzgResult paramsByCode = sysParamsService.getParamsByCode(ParamCodeCst.System.CALL_PAGE_URL);
if (paramsByCode.getData() == null) {
throw new CzgException("页面路径未配置");
}
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java
index f0f08f4d1..f52b91cd7 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java
@@ -13,8 +13,9 @@ import com.czg.account.enums.ShopTypeEnum;
import com.czg.account.service.*;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst;
-import com.czg.constants.SystemConstants;
+import com.czg.constants.ParamCodeCst;
import com.czg.constants.ShopSwitchTypeEnum;
+import com.czg.constants.SystemConstants;
import com.czg.exception.CzgException;
import com.czg.resp.CzgResult;
import com.czg.sa.MyStpLogic;
@@ -38,7 +39,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
@@ -341,7 +341,7 @@ public class ShopInfoServiceImpl extends ServiceImpl i
ShopDetailDTO shopDetailDTO = BeanUtil.copyProperties(shopInfo, ShopDetailDTO.class);
SysUser sysUser = sysUserService.getById(shopInfo.getId());
shopDetailDTO.setAccount(sysUser.getAccount());
- CzgResult shopOrderPayBaseUrl = sysParamsService.getParamsByCode("shop_order_pay_base_url");
+ CzgResult shopOrderPayBaseUrl = sysParamsService.getParamsByCode(ParamCodeCst.System.SHOP_ORDER_PAY_BASE_URL);
shopDetailDTO.setPaymentQrcode(shopOrderPayBaseUrl.getData().getParamValue() + "?shopId=" + id);
BeanUtil.copyProperties(shopConfig, shopDetailDTO);
return shopDetailDTO;
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopTableServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopTableServiceImpl.java
index 9db96ead0..1f49e176e 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopTableServiceImpl.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopTableServiceImpl.java
@@ -18,11 +18,11 @@ import com.czg.account.service.ShopTableAreaService;
import com.czg.account.service.ShopTableCodeService;
import com.czg.account.service.ShopTableService;
import com.czg.account.vo.ShopTableVO;
+import com.czg.constants.ParamCodeCst;
import com.czg.enums.ShopTableStatusEnum;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopTableMapper;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
@@ -195,7 +195,7 @@ public class ShopTableServiceImpl extends ServiceImpl i
private MemberLevelConfigService memberLevelConfigService;
@DubboReference
private TbMemberConfigService memberConfigService;
- @DubboReference
- private SysParamsService sysParamsService;
-
private ShopUser getUserInfo(Long shopUserId) {
ShopUser shopUser = queryChain().eq(ShopUser::getId, shopUserId).one();
if (shopUser == null) {
@@ -114,7 +106,7 @@ public class ShopUserServiceImpl extends ServiceImpl i
if (configVO.getIsOpen().equals(1L)) {
shopUser.setIsMemberPrice(configVO.getIsMemberPrice());
shopUser.setDiscount(memberLevelConfig.getDiscount());
- }else {
+ } else {
shopUser.setIsMemberPrice(0);
shopUser.setDiscount(100);
}
@@ -241,57 +233,16 @@ public class ShopUserServiceImpl extends ServiceImpl i
BeanUtil.copyProperties(shopUserAddDTO, shopUser, "accountPoints", "amount");
BeanUtil.copyProperties(shopUserAddDTO, userInfo);
userInfoService.updateById(userInfo);
- if (cn.hutool.core.util.StrUtil.isBlank(shopUser.getCode())) {
- shopUser.setCode(generateCode(shopId));
+ if (StrUtil.isBlank(shopUser.getCode())) {
+ shopUser.setCode(ShopUser.generateCode());
}
- if (cn.hutool.core.util.StrUtil.isBlank(shopUser.getBirthDay())) {
+ if (StrUtil.isBlank(shopUser.getBirthDay())) {
shopUser.setBirthDay(null);
}
shopUser.setNickName(userInfo.getNickName());
- shopUser.setJoinTime(shopUser.getJoinTime() == null ? DateUtil.date().toLocalDateTime() : shopUser.getJoinTime());
-
-
+ if (shopUser.getJoinTime() == null) {
+ shopUser.setJoinTime(LocalDateTime.now());
+ }
return saveOrUpdate(shopUser);
}
-
-
- public String generateCode(long shopId) {
- String code = "shop_user_code_val%d".formatted(shopId);
- SysParams sysParam = sysParamsService.getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
-
- if (sysParam == null) {
- SysParams sysParams = new SysParams()
- .setParamValue("1")
- .setParamType(1)
- .setCreateTime(DateUtil.date().toLocalDateTime())
- .setParamCode(code);
- sysParamsService.save(sysParams);
- return generateRandomCode(1);
- }
-
- long parseLong = Long.parseLong(sysParam.getParamValue());
- long l = ++parseLong;
- sysParam.setParamValue(String.valueOf(l));
- sysParamsService.updateById(sysParam);
-
- return generateRandomCode(l);
- }
-
- // 使用Hutool生成十六进制代码并随机填充字母
- private String generateRandomCode(long value) {
- // 生成十六进制代码,确保为10位
- String hexCode = String.format("%010X", value);
-
- // 计算需要补充的字母数量
- int missingLength = 10 - hexCode.length();
- StringBuilder codeBuilder = new StringBuilder(hexCode);
-
- for (int i = 0; i < missingLength; i++) {
- // 生成随机字母
- char randomChar = RandomUtil.randomChar("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- codeBuilder.append(randomChar);
- }
-
- return codeBuilder.toString();
- }
}
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java
index 1f041376e..ab6611451 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/UserAuthorizationServiceImpl.java
@@ -10,6 +10,7 @@ import com.czg.account.dto.auth.WechatRawDataDTO;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.UserAuthorizationService;
import com.czg.account.service.UserInfoService;
+import com.czg.constants.ParamCodeCst;
import com.czg.constants.SystemConstants;
import com.czg.enums.UserAuthSourceEnum;
import com.czg.exception.CzgException;
@@ -17,7 +18,6 @@ import com.czg.sa.MyStpLogic;
import com.czg.sa.StpKit;
import com.czg.service.account.util.AlipayUtil;
import com.czg.service.account.util.WechatAuthUtil;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
@@ -120,7 +120,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
userInfoService.initAc(userInfo);
// StpKit.USER.login(userInfo.getId());
StpKit.USER.login(userInfo.getId(), openId, null, null, null, MyStpLogic.LoginType.USER, false, "userMini", false);
- String followIndex = paramsService.getSysParamValue(SysParamCodeEnum.FOLLOW_INDEX.getCode());
+ String followIndex = paramsService.getSysParamValue(ParamCodeCst.System.FOLLOW_INDEX);
return new LoginTokenDTO(StpKit.USER.getTokenValue(), followIndex, userInfo);
}
}
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/AcAccountUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/AcAccountUtil.java
index cd75f94e3..c660189f1 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/util/AcAccountUtil.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/AcAccountUtil.java
@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
+import com.czg.constants.ParamCodeCst;
import com.czg.service.RedisService;
import com.czg.system.service.SysParamsService;
import jakarta.annotation.Resource;
@@ -89,8 +90,8 @@ public class AcAccountUtil {
if (StrUtil.isNotEmpty(accessToken)) {
return accessToken;
}
- String acAppId = paramsService.getSysParamValue("wechat_ac_appid");
- String acSecrete = paramsService.getSysParamValue("wechat_ac_secrete");
+ String acAppId = paramsService.getSysParamValue(ParamCodeCst.Wechat.Ac.USER_WX_AC_APP_ID);
+ String acSecrete = paramsService.getSysParamValue(ParamCodeCst.Wechat.Ac.USER_WX_AC_SECRETE);
String resp = HttpUtil.get(StrUtil.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={}&secret={}", acAppId, acSecrete));
JSONObject respInfo = JSONObject.parseObject(resp);
if (!respInfo.containsKey("access_token")) {
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java
index cbe452409..eec9c74aa 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/AlipayUtil.java
@@ -10,8 +10,7 @@ import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipayEncrypt;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
-import com.czg.resp.CzgResult;
-import com.czg.system.dto.SysParamsDTO;
+import com.czg.constants.ParamCodeCst;
import com.czg.system.service.SysParamsService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -38,20 +37,13 @@ public class AlipayUtil {
*/
@SneakyThrows
public AlipayClient createClient(boolean isAccount) {
- CzgResult aliGateway = sysParamsService.getParamsByCode("ali_gateway");
- CzgResult aliMiniAppId = sysParamsService.getParamsByCode("ali_mini_app_id");
- CzgResult aliMiniPrivateKey = sysParamsService.getParamsByCode("ali_mini_private_key");
- CzgResult aliMiniPublicKey = sysParamsService.getParamsByCode("ali_mini_public_key");
- CzgResult aliAccountAppId = sysParamsService.getParamsByCode("ali_account_app_id");
- CzgResult aliAccountPrivateKey = sysParamsService.getParamsByCode("ali_account_private_key");
- CzgResult aliAccountPublicKey = sysParamsService.getParamsByCode("ali_account_public_key");
- String serverUrl = aliGateway.getData().getParamValue();
- String appId = aliMiniAppId.getData().getParamValue();
- String privateKey = aliMiniPrivateKey.getData().getParamValue();
- String alipayPublicKey = aliMiniPublicKey.getData().getParamValue();
- String accountAppId = aliAccountAppId.getData().getParamValue();
- String accountPrivateKey = aliAccountPrivateKey.getData().getParamValue();
- String accountPublicKey = aliAccountPublicKey.getData().getParamValue();
+ String serverUrl = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Web.ALI_GATEWAY);
+ String appId = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Mini.ALI_MINI_APP_ID);
+ String privateKey = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Mini.ALI_MINI_PRIVATE_KEY);
+ String alipayPublicKey = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Mini.ALI_MINI_PUBLIC_KEY);
+ String accountAppId = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Web.ALI_ACCOUNT_APP_ID);
+ String accountPrivateKey = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Web.ALI_ACCOUNT_PRIVATE_KEY);
+ String accountPublicKey = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Web.ALI_ACCOUNT_PUBLIC_KEY);
AlipayConfig alipayConfig = new AlipayConfig();
//设置网关地址
alipayConfig.setServerUrl(serverUrl);
@@ -100,8 +92,7 @@ public class AlipayUtil {
throw new RuntimeException("加密数据不能为空");
}
try {
- CzgResult aliEncryptKey = sysParamsService.getParamsByCode("ali_encrypt_key");
- String encryptKey = aliEncryptKey.getData().getParamValue();
+ String encryptKey = sysParamsService.getSysParamValue(ParamCodeCst.Alipay.Web.ALI_ENCRYPT_KEY);
log.info("解密前的数据,返回结果:{}", encryptedData);
String resp = AlipayEncrypt.decryptContent(encryptedData, "AES", encryptKey, "UTF-8");
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java
index ede411b10..d8e1a660e 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatAuthUtil.java
@@ -7,10 +7,8 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.czg.config.RedisCst;
-import com.czg.resp.CzgResult;
+import com.czg.constants.ParamCodeCst;
import com.czg.service.RedisService;
-import com.czg.system.dto.SysParamsDTO;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.google.gson.JsonObject;
import jakarta.annotation.Resource;
@@ -58,10 +56,8 @@ public class WechatAuthUtil {
}
public String getAccountOpenId(String code) {
- CzgResult wxAccountAppId = sysParamsService.getParamsByCode("wx_account_app_id");
- CzgResult wxAccountSecrete = sysParamsService.getParamsByCode("wx_account_secrete");
- String accountAppId = wxAccountAppId.getData().getParamValue();
- String accountSecrete = wxAccountSecrete.getData().getParamValue();
+ String accountAppId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Ac.SHOP_WX_AC_APP_ID);
+ String accountSecrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Ac.SHOP_WX_AC_SECRETE);
String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?";
Map requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
@@ -82,10 +78,8 @@ public class WechatAuthUtil {
//获取小程序token
private String getAccessToken() {
- CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id");
- CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete");
- String appId = wxMiniAppId.getData().getParamValue();
- String secrete = wxMiniSecrete.getData().getParamValue();
+ String appId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.USER_WX_APP_ID);
+ String secrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.SHOP_WX_SECRETE);
String url = String.format("%s?grant_type=client_credential&appid=%s&secret=%s", TOKEN_URL, appId, secrete);
String response = HttpUtil.get(url);
com.alibaba.fastjson.JSONObject jsonResponse = com.alibaba.fastjson.JSONObject.parseObject(response);
@@ -109,7 +103,7 @@ public class WechatAuthUtil {
private InputStream fetchQrCode(Map params) {
JsonObject jsonObject = new JsonObject();
//路径
- jsonObject.addProperty("path", sysParamsService.getSysParamValue(SysParamCodeEnum.WX_MINI_VIP_URL.getCode()) + "?shopId=" + params.get("shopId"));
+ jsonObject.addProperty("path", sysParamsService.getSysParamValue(ParamCodeCst.System.WX_MINI_VIP_URL) + "?shopId=" + params.get("shopId"));
//是否需要透明底色,为 true 时,生成透明底色的小程序码
jsonObject.addProperty("is_hyaline", true);
//正式版为 release,体验版为 trial,开发版为 develop
@@ -126,10 +120,8 @@ public class WechatAuthUtil {
public JSONObject getSession(String code) {
- CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete");
- CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id");
- String appId = wxMiniAppId.getData().getParamValue();
- String secrete = wxMiniSecrete.getData().getParamValue();
+ String appId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.USER_WX_APP_ID);
+ String secrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.SHOP_WX_SECRETE);
String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
Map requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatMiniMsgUtil.java b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatMiniMsgUtil.java
index c9ba35790..1cbdac610 100644
--- a/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatMiniMsgUtil.java
+++ b/cash-service/account-service/src/main/java/com/czg/service/account/util/WechatMiniMsgUtil.java
@@ -10,10 +10,10 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.czg.config.RedisCst;
+import com.czg.constants.ParamCodeCst;
import com.czg.resp.CzgResult;
import com.czg.service.RedisService;
import com.czg.system.dto.SysParamsDTO;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.google.gson.JsonObject;
import jakarta.annotation.Resource;
@@ -84,8 +84,8 @@ public class WechatMiniMsgUtil {
}
public void sendCurrentOrNearCallMsg(String shopName, String state, String callNum, String currentNum, String note, String openId, boolean isNear) {
- CzgResult callNear = sysParamsService.getParamsByCode("wx_mini_msg_call_near");
- CzgResult callCurrent = sysParamsService.getParamsByCode("wx_mini_msg_call_current");
+ CzgResult callNear = sysParamsService.getParamsByCode(ParamCodeCst.System.WX_MINI_MSG_CALL_NEAR);
+ CzgResult callCurrent = sysParamsService.getParamsByCode(ParamCodeCst.System.WX_MINI_MSG_CALL_CURRENT);
Map data = new HashMap() {{
put("thing1", new HashMap() {{
@@ -112,7 +112,7 @@ public class WechatMiniMsgUtil {
}
public void sendPassCallMsg(String shopName, String state, String callNum, String currentNum, String note, String openId) {
- CzgResult callPass = sysParamsService.getParamsByCode("wx_mini_msg_call_pass");
+ CzgResult callPass = sysParamsService.getParamsByCode(ParamCodeCst.System.WX_MINI_MSG_CALL_PASS);
Map data = new HashMap() {{
put("thing1", new HashMap() {{
@@ -139,10 +139,8 @@ public class WechatMiniMsgUtil {
}
public String getAccountOpenId(String code) {
- CzgResult wxAccountAppId = sysParamsService.getParamsByCode("wx_account_app_id");
- CzgResult wxAccountSecrete = sysParamsService.getParamsByCode("wx_account_secrete");
- String accountAppId = wxAccountAppId.getData().getParamValue();
- String accountSecrete = wxAccountSecrete.getData().getParamValue();
+ String accountAppId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Ac.SHOP_WX_AC_APP_ID);
+ String accountSecrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Ac.SHOP_WX_AC_SECRETE);
String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?";
Map requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
@@ -167,10 +165,9 @@ public class WechatMiniMsgUtil {
if (StrUtil.isNotEmpty(accessToken)) {
return accessToken;
}
- CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id");
- CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete");
- String appId = wxMiniAppId.getData().getParamValue();
- String secrete = wxMiniSecrete.getData().getParamValue();
+ String appId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.USER_WX_APP_ID);
+ String secrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.SHOP_WX_SECRETE);
+
String url = String.format("%s?grant_type=client_credential&appid=%s&secret=%s", TOKEN_URL, appId, secrete);
String response = HttpUtil.get(url);
JSONObject jsonResponse = JSONObject.parseObject(response);
@@ -197,7 +194,7 @@ public class WechatMiniMsgUtil {
private InputStream fetchQrCode(Map params) {
JsonObject jsonObject = new JsonObject();
//路径
- jsonObject.addProperty("path", sysParamsService.getSysParamValue(SysParamCodeEnum.WX_MINI_VIP_URL.getCode()) + "?shopId=" + params.get("shopId"));
+ jsonObject.addProperty("path", sysParamsService.getSysParamValue(ParamCodeCst.System.WX_MINI_VIP_URL) + "?shopId=" + params.get("shopId"));
//是否需要透明底色,为 true 时,生成透明底色的小程序码
jsonObject.addProperty("is_hyaline", true);
//正式版为 release,体验版为 trial,开发版为 develop
@@ -214,10 +211,8 @@ public class WechatMiniMsgUtil {
public JSONObject getSession(String code) {
- CzgResult wxMiniSecrete = sysParamsService.getParamsByCode("wx_mini_secrete");
- CzgResult wxMiniAppId = sysParamsService.getParamsByCode("wx_mini_app_id");
- String appId = wxMiniAppId.getData().getParamValue();
- String secrete = wxMiniSecrete.getData().getParamValue();
+ String appId = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.USER_WX_APP_ID);
+ String secrete = sysParamsService.getSysParamValue(ParamCodeCst.Wechat.Mini.SHOP_WX_SECRETE);
String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
Map requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/AcPushEventServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/AcPushEventServiceImpl.java
index d2dc47c97..50a14fc25 100644
--- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/AcPushEventServiceImpl.java
+++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/AcPushEventServiceImpl.java
@@ -1,15 +1,14 @@
package com.czg.service.market.service.impl;
import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.service.ShopInfoService;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst;
+import com.czg.constants.ParamCodeCst;
import com.czg.exception.CzgException;
import com.czg.market.dto.AcPushEventDTO;
import com.czg.market.entity.AcPushEvent;
-import com.czg.market.entity.SmsPushEvent;
import com.czg.market.entity.SmsPushEventUser;
import com.czg.market.service.AcPushEventService;
import com.czg.market.service.MkShopCouponRecordService;
@@ -28,7 +27,6 @@ import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
-import java.util.Date;
/**
* 公众号推送任务 服务层实现。
@@ -170,7 +168,7 @@ public class AcPushEventServiceImpl extends ServiceImpl paramsByCode = sysParamsService.getParamsByCode("call_page_url");
+ CzgResult paramsByCode = sysParamsService.getParamsByCode(ParamCodeCst.System.CALL_PAGE_URL);
SysParamsDTO params = paramsByCode.getData();
String callUrl = null;
if (params != null && StrUtil.isNotBlank(params.getParamValue())) {
diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java
index 54b180fee..2a95a3228 100644
--- a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java
+++ b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java
@@ -13,7 +13,8 @@ import com.czg.account.entity.*;
import com.czg.account.service.*;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst;
-import com.czg.constant.TableValueConstant;
+import com.czg.constants.ParamCodeCst;
+import com.czg.constants.PayTypeConstants;
import com.czg.entity.req.*;
import com.czg.entity.resp.*;
import com.czg.enums.ShopUserFlowBizEnum;
@@ -32,7 +33,6 @@ import com.czg.order.entity.OrderDetail;
import com.czg.order.entity.OrderInfo;
import com.czg.order.entity.OrderPayment;
import com.czg.order.enums.PayEnums;
-import com.czg.constants.PayTypeConstants;
import com.czg.order.service.CreditBuyerOrderService;
import com.czg.order.service.OrderDetailService;
import com.czg.order.service.OrderInfoCustomService;
@@ -48,7 +48,6 @@ import com.czg.service.order.dto.VipRefundDTO;
import com.czg.service.order.enums.OrderStatusEnums;
import com.czg.service.order.mapper.OrderPaymentMapper;
import com.czg.service.order.service.PayService;
-import com.czg.system.enums.SysParamCodeEnum;
import com.czg.system.service.SysParamsService;
import com.czg.utils.AssertUtil;
import com.czg.utils.CzgRandomUtils;
@@ -60,8 +59,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.support.TransactionSynchronization;
-import org.springframework.transaction.support.TransactionSynchronizationManager;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -924,7 +921,7 @@ public class PayServiceImpl implements PayService {
private CzgResult