对于程序中配置字段,统一管理

This commit is contained in:
wangdawei
2020-05-25 10:45:05 +08:00
parent 200b48dc4e
commit ceb396c91e
27 changed files with 328 additions and 132 deletions

View File

@ -3,12 +3,10 @@ package co.yixiang.listener;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.modules.shop.entity.YxSystemConfig;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;

View File

@ -16,6 +16,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.http.HttpUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
@ -34,6 +35,7 @@ import co.yixiang.modules.user.entity.YxSystemAttachment;
import co.yixiang.modules.user.service.YxSystemAttachmentService;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.SecurityUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -268,11 +270,11 @@ public class StoreBargainController extends BaseController {
Integer bargainId = jsonObject.getInteger("bargainId");
if(ObjectUtil.isNull(bargainId)) return ApiResult.fail("参数有误");
String siteUrl = systemConfigService.getData("site_url");
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
return ApiResult.fail("未配置h5地址");
}
String apiUrl = systemConfigService.getData("api_url");
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}

View File

@ -15,6 +15,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.http.HttpUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
@ -122,11 +123,11 @@ public class StoreCombinationController extends BaseController {
Integer pinkId = jsonObject.getInteger("id");
if(ObjectUtil.isNull(pinkId)) return ApiResult.fail("参数有误");
String siteUrl = systemConfigService.getData("site_url");
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
return ApiResult.fail("未配置h5地址");
}
String apiUrl = systemConfigService.getData("api_url");
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}

View File

@ -41,7 +41,7 @@
// public WxPayMpOrderResult wxPay(String orderId, String openId, String body,
// Integer totalFee,int type) throws WxPayException {
//
// String apiUrl = systemConfigService.getData("api_url");
// String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
// if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
//
// WxPayService wxPayService = WxPayConfiguration.getPayService();
@ -79,7 +79,7 @@
// public WxPayMwebOrderResult wxH5Pay(String orderId, String body,
// Integer totalFee,int type) throws WxPayException {
//
// String apiUrl = systemConfigService.getData("api_url");
// String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
// if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
//
// WxPayService wxPayService = WxPayConfiguration.getPayService();
@ -110,7 +110,7 @@
// * @throws WxPayException
// */
// public void refundOrder(String orderId, Integer totalFee) throws WxPayException {
// String apiUrl = systemConfigService.getData("api_url");
// String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
// if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
//
// WxPayService wxPayService = WxPayConfiguration.getPayService();

View File

@ -16,6 +16,7 @@ import cn.hutool.core.util.StrUtil;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.constant.ShopConstants;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.tools.domain.AlipayConfig;
import co.yixiang.tools.domain.vo.TradeVo;
import co.yixiang.enums.*;
@ -1565,11 +1566,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
@Override
public PriceGroupDTO getOrderPriceGroup(List<YxStoreCartQueryVo> cartInfo) {
String storePostageStr = systemConfigService.getData("store_postage");//邮费基础价
String storePostageStr = systemConfigService.getData(SystemConfigConstants.STORE_POSTAGE);//邮费基础价
Double storePostage = 0d;
if(StrUtil.isNotEmpty(storePostageStr)) storePostage = Double.valueOf(storePostageStr);
String storeFreePostageStr = systemConfigService.getData("store_free_postage");//满额包邮
String storeFreePostageStr = systemConfigService.getData(SystemConfigConstants.STORE_FREE_POSTAGE);//满额包邮
Double storeFreePostage = 0d;
if(StrUtil.isNotEmpty(storeFreePostageStr)) storeFreePostage = Double.valueOf(storeFreePostageStr);

View File

@ -13,12 +13,12 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.PayTypeEnum;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.tools.express.ExpressService;
import co.yixiang.tools.express.dao.ExpressInfo;
@ -129,9 +129,9 @@ public class StoreOrderController extends BaseController {
.beUsableCoupon(uid,priceGroup.getTotalPrice()));
//积分抵扣
OtherDTO other = new OtherDTO();
other.setIntegralRatio(systemConfigService.getData("integral_ratio"));
other.setIntegralFull(systemConfigService.getData("integral_full"));
other.setIntegralMax(systemConfigService.getData("integral_max"));
other.setIntegralRatio(systemConfigService.getData(SystemConfigConstants.INTERGRAL_RATIO));
other.setIntegralFull(systemConfigService.getData(SystemConfigConstants.INTERGRAL_FULL));
other.setIntegralMax(systemConfigService.getData(SystemConfigConstants.INTERGRAL_MAX));
//拼团 砍价 秒杀
int combinationId = 0;
@ -454,9 +454,9 @@ public class StoreOrderController extends BaseController {
//门店
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
String mapKey = RedisUtil.get(RedisKeyEnum.TENGXUN_MAP_KEY.getValue());
String mapKey = RedisUtil.get(SystemConfigConstants.TENGXUN_MAP_KEY);
if(StrUtil.isBlank(mapKey)) return ApiResult.fail("请配置腾讯地图key");
String apiUrl = systemConfigService.getData("api_url");
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}

View File

@ -14,7 +14,6 @@ import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.enums.CommonEnum;
import co.yixiang.enums.ProductEnum;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.shop.entity.YxStoreProduct;
import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
@ -27,18 +26,17 @@ import co.yixiang.modules.shop.web.param.YxStoreProductQueryParam;
import co.yixiang.modules.shop.web.vo.YxStoreProductAttrQueryVo;
import co.yixiang.modules.shop.web.vo.YxStoreProductQueryVo;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.RedisUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ -173,7 +171,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
//门店
productDTO.setSystemStore(systemStoreService.getStoreInfo(latitude,longitude));
productDTO.setMapKey(RedisUtil.get(RedisKeyEnum.TENGXUN_MAP_KEY.getValue()));
productDTO.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey()));
return productDTO;
}

View File

@ -19,6 +19,7 @@ import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.LocationUtils;
import co.yixiang.utils.RedisUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -76,7 +77,7 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<YxSystemStoreMappe
.orderByDesc("id")
.last("limit 1"));
if(yxSystemStore == null) return null;
String mention = RedisUtil.get("store_self_mention");
String mention = RedisUtil.get(ShopKeyUtils.getStoreSelfMention());
if(mention == null || Integer.valueOf(mention) == 2) return null;
YxSystemStoreQueryVo systemStoreQueryVo = storeMap.toDto(yxSystemStore);
if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){

View File

@ -14,12 +14,12 @@ import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.common.api.ApiResult;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.shop.web.param.YxSystemStoreQueryParam;
import co.yixiang.modules.shop.web.vo.YxSystemStoreQueryVo;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
@ -29,7 +29,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@ -84,7 +83,7 @@ public class IndexController {
//滚动
map.put("roll",systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_ROLL_NEWS));
map.put("mapKey",RedisUtil.get(RedisKeyEnum.TENGXUN_MAP_KEY.getValue()));
map.put("mapKey",RedisUtil.get(ShopKeyUtils.getTengXunMapKey()));
return ApiResult.ok(map);
}

View File

@ -13,6 +13,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
@ -122,11 +123,11 @@ public class StoreProductController extends BaseController {
YxStoreProduct storeProduct = storeProductService.getProductInfo(id);
// 海报
String siteUrl = systemConfigService.getData("site_url");
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
return ApiResult.fail("未配置h5地址");
}
String apiUrl = systemConfigService.getData("api_url");
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}
@ -190,11 +191,11 @@ public class StoreProductController extends BaseController {
int uid = SecurityUtils.getUserId().intValue();
ProductDTO productDTO = storeProductService.goodsDetail(id,0,uid,latitude,longitude);
// 海报
// String siteUrl = systemConfigService.getData("site_url");
// String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
// if(StrUtil.isEmpty(siteUrl)){
// return ApiResult.fail("未配置h5地址");
// }
// String apiUrl = systemConfigService.getData("api_url");
// String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
// if(StrUtil.isEmpty(apiUrl)){
// return ApiResult.fail("未配置api地址");
// }

View File

@ -16,12 +16,11 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.constant.ShopConstants;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.order.service.YxStoreOrderService;
@ -46,6 +45,7 @@ import co.yixiang.modules.user.web.dto.PromUserDTO;
import co.yixiang.modules.user.web.param.PromParam;
import co.yixiang.modules.user.web.param.YxUserQueryParam;
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.mp.config.WxMpConfiguration;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
@ -177,9 +177,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
//获取后台分销类型 1 指定分销 2 人人分销
int storeBrokerageStatus = 1;
if(StrUtil.isNotEmpty(systemConfigService.getData("store_brokerage_statu"))){
if(StrUtil.isNotEmpty(systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_STATU))){
storeBrokerageStatus = Integer.valueOf(systemConfigService
.getData("store_brokerage_statu"));
.getData(SystemConfigConstants.STORE_BROKERAGE_STATU));
}
//指定分销 判断 上级是否时推广员 如果不是推广员直接跳转二级返佣
@ -192,7 +192,7 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
}
//获取后台一级返佣比例
String storeBrokerageRatioStr = systemConfigService.getData("store_brokerage_ratio");
String storeBrokerageRatioStr = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_RATIO);
int storeBrokerageRatio = 0;
if(StrUtil.isNotEmpty(storeBrokerageRatioStr)){
storeBrokerageRatio = Integer.valueOf(storeBrokerageRatioStr);
@ -268,9 +268,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
//获取后台分销类型 1 指定分销 2 人人分销
int storeBrokerageStatus = 1;
if(StrUtil.isNotEmpty(systemConfigService.getData("store_brokerage_statu"))){
if(StrUtil.isNotEmpty(systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_STATU))){
storeBrokerageStatus = Integer.valueOf(systemConfigService
.getData("store_brokerage_statu"));
.getData(SystemConfigConstants.STORE_BROKERAGE_STATU));
}
//指定分销 判断 上上级是否时推广员 如果不是推广员直接返回
YxUserQueryVo preUser = getYxUserById(userInfoTwo.getSpreadUid());
@ -282,7 +282,7 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
}
//获取二级返佣比例
String storeBrokerageTwoStr = systemConfigService.getData("store_brokerage_two");
String storeBrokerageTwoStr = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_TWO);
int storeBrokerageTwo = 0;
if(StrUtil.isNotEmpty(storeBrokerageTwoStr)){
storeBrokerageTwo = Integer.valueOf(storeBrokerageTwoStr);
@ -437,7 +437,7 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
//1-指定分销 2-人人分销
int storeBrokerageStatus = Integer.valueOf(systemConfigService
.getData("store_brokerage_statu"));
.getData(SystemConfigConstants.STORE_BROKERAGE_STATU));
//如果是指定分销,如果 推广人不是分销员不能形成关系
if(storeBrokerageStatus == 1 && userInfoT.getIsPromoter() == 0){
return true;
@ -483,7 +483,7 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
userQueryVo.setOrderStatusNum(orderService.orderData((int)id));
userQueryVo.setCouponCount(storeCouponUserService.getUserValidCouponCount((int)id));
//判断分销类型
String statu = systemConfigService.getData("store_brokerage_statu");
String statu = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_STATU);
if(StrUtil.isNotEmpty(statu)){
userQueryVo.setStatu(Integer.valueOf(statu));
}else{
@ -647,8 +647,8 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
String spread = loginParam.getSpread();
try {
//读取redis配置
String appId = RedisUtil.get(RedisKeyEnum.WXAPP_APPID.getValue());
String secret = RedisUtil.get(RedisKeyEnum.WXAPP_SECRET.getValue());
String appId = RedisUtil.get(ShopKeyUtils.getWxAppAppId());
String secret = RedisUtil.get(ShopKeyUtils.getWxAppSecret());
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
throw new ErrorRequestException("请先配置小程序");
}

View File

@ -14,6 +14,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
@ -78,7 +79,7 @@ public class UserBillController extends BaseController {
int uid = SecurityUtils.getUserId().intValue();
//判断分销类型
String statu = systemConfigService.getData("store_brokerage_statu");
String statu = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_STATU);
YxUserQueryVo userQueryVo = yxUserService.getYxUserById(uid);
if(StrUtil.isNotEmpty(statu)){
if(Integer.valueOf(statu) == 1){
@ -124,11 +125,11 @@ public class UserBillController extends BaseController {
public ApiResult<Object> spreadBanner(@RequestParam(value = "",required=false) String from){
int uid = SecurityUtils.getUserId().intValue();
YxUserQueryVo userInfo = yxUserService.getYxUserById(uid);
String siteUrl = systemConfigService.getData("site_url");
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
return ApiResult.fail("未配置h5地址");
}
String apiUrl = systemConfigService.getData("api_url");
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
return ApiResult.fail("未配置api地址");
}

View File

@ -11,6 +11,7 @@ package co.yixiang.modules.user.web.controller;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.user.service.YxUserExtractService;
import co.yixiang.modules.user.service.YxUserService;
@ -61,7 +62,7 @@ public class UserExtractController extends BaseController {
YxUserQueryVo userInfo = userService.getYxUserById(uid);
Map<String,Object> map = new LinkedHashMap<>();
map.put("commissionCount",userInfo.getBrokeragePrice());
map.put("minPrice",systemConfigService.getData("user_extract_min_price"));
map.put("minPrice",systemConfigService.getData(SystemConfigConstants.USER_EXTRACT_MIN_PRICE));
return ApiResult.ok(map);
}

View File

@ -15,6 +15,7 @@ import cn.hutool.core.util.StrUtil;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.constant.ShopConstants;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.BillDetailEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.shop.service.YxSystemConfigService;
@ -84,7 +85,7 @@ public class UserRechargeController extends BaseController {
@ApiOperation(value = "公众号充值/H5充值",notes = "公众号充值/H5充值",response = ApiResult.class)
public ApiResult<Map<String,Object>> add(@Valid @RequestBody RechargeParam param){
int uid = SecurityUtils.getUserId().intValue();
String money = systemConfigService.getData("store_user_min_recharge");
String money = systemConfigService.getData(SystemConfigConstants.STORE_USER_MIN_RECHARGE);
Double newMoney = 0d;
if(StrUtil.isNotEmpty(money)) newMoney = Double.valueOf(money);
if(newMoney > param.getPrice()) throw new ErrorRequestException("充值金额不能低于"+newMoney);

View File

@ -12,6 +12,7 @@ import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.common.api.ApiResult;
import co.yixiang.common.web.controller.BaseController;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.BillDetailEnum;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.modules.order.entity.YxStoreOrder;
@ -72,9 +73,9 @@ public class WechatController extends BaseController {
@ApiOperation(value = "微信分享配置",notes = "微信分享配置")
public ApiResult<Object> share() {
Map<String,Object> map = new LinkedHashMap<>();
map.put("img",systemConfigService.getData("wechat_share_img"));
map.put("title",systemConfigService.getData("wechat_share_title"));
map.put("synopsis",systemConfigService.getData("wechat_share_synopsis"));
map.put("img",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_IMG));
map.put("title",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_TITLE));
map.put("synopsis",systemConfigService.getData(SystemConfigConstants.WECHAT_SHARE_SYNOPSIS));
Map<String,Object> mapt = new LinkedHashMap<>();
mapt.put("data",map);
return ApiResult.ok(mapt);

View File

@ -12,36 +12,25 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.common.api.ApiResult;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.notify.NotifyType;
import co.yixiang.modules.notify.SmsResult;
import co.yixiang.modules.security.rest.param.VerityParam;
import co.yixiang.modules.user.entity.YxUser;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.YxWechatUserService;
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
import co.yixiang.modules.wechat.web.param.BindPhoneParam;
import co.yixiang.modules.wechat.web.param.WxPhoneParam;
import co.yixiang.mp.utils.JsonUtils;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.RedisUtil;
import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.SecurityUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -108,8 +97,8 @@ public class WxMaUserController {
}
//读取redis配置
String appId = RedisUtil.get(RedisKeyEnum.WXAPP_APPID.getValue());
String secret = RedisUtil.get(RedisKeyEnum.WXAPP_SECRET.getValue());
String appId = RedisUtil.get(ShopKeyUtils.getWxAppAppId());
String secret = RedisUtil.get(ShopKeyUtils.getWxAppSecret());
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
throw new ErrorRequestException("请先配置小程序");
}

View File

@ -0,0 +1,49 @@
package co.yixiang.constant;
public class SystemConfigConstants {
//地址配置
public final static String API="api";
public final static String API_URL="api_url";
public final static String SITE_URL="site_url";
public final static String TENGXUN_MAP_KEY="tengxun_map_key";
//业务相关配置
public final static String IMAGEARR="imageArr";
public final static String INTERGRAL_FULL="integral_full";
public final static String INTERGRAL_MAX="integral_max";
public final static String INTERGRAL_RATIO="integral_ratio";
public final static String ORDER_CANCEL_JOB_TIME="order_cancel_job_time";
public final static String STORE_BROKERAGE_OPEN="store_brokerage_open";
public final static String STORE_BROKERAGE_RATIO="store_brokerage_ratio";
public final static String STORE_BROKERAGE_STATU="store_brokerage_statu";
public final static String STORE_BROKERAGE_TWO="store_brokerage_two";
public final static String STORE_FREE_POSTAGE="store_free_postage";
public final static String STORE_POSTAGE="store_postage";
public final static String STORE_SEFL_MENTION="store_self_mention";
public final static String STORE_USER_MIN_RECHARGE="store_user_min_recharge";
public final static String USER_EXTRACT_MIN_PRICE="user_extract_min_price";
//微信相关配置
public final static String WECHAT_APPID="wechat_appid";
public final static String WECHAT_APPSECRET="wechat_appsecret";
public final static String WECHAT_AVATAR="wechat_avatar";
public final static String WECHAT_ENCODE="wechat_encode";
public final static String WECHAT_ENCODINGAESKEY="wechat_encodingaeskey";
public final static String WECHAT_ID="wechat_id";
public final static String WECHAT_NAME="wechat_name";
public final static String WECHAT_QRCODE="wechat_qrcode";
public final static String WECHAT_SHARE_IMG="wechat_share_img";
public final static String WECHAT_SHARE_SYNOPSIS="wechat_share_synopsis";
public final static String WECHAT_SHARE_TITLE="wechat_share_title";
public final static String WECHAT_SOURCEID="wechat_sourceid";
public final static String WECHAT_TOKEN="wechat_token";
public final static String WECHAT_TYPE="wechat_type";
public final static String WXAPP_APPID="wxapp_appId";
public final static String WXAPP_SECRET="wxapp_secret";
public final static String WXPAY_APPID="wxpay_appId";
public final static String WXPAY_KEYPATH="wxpay_keyPath";
public final static String WXPAY_MCHID="wxpay_mchId";
public final static String WXPAY_MCHKEY="wxpay_mchKey";
public final static String WX_NATIVE_APP_APPID="wx_native_app_appId";
}

View File

@ -0,0 +1,156 @@
package co.yixiang.mp.config;
import co.yixiang.constant.ShopConstants;
import co.yixiang.constant.SystemConfigConstants;
/**
* 处理缓存key值的统一入口方面后面扩展
* 例如:多租户就要在每个key后拼接上租户ID只要统一修改这里就可以了
*/
public class ShopKeyUtils {
/**
*扩展值,默认为空, 把这个值追加到所有key值上
*/
private static String getExtendValue(){
String extendValue= "";
return extendValue;
}
//*********************************begin yx_system_config 通用值 *****************************************************
/**
* api_url
*/
public static String getApiUrl(){
String apiUrl= SystemConfigConstants.API_URL;
return apiUrl;
}
/**
* site_url
*/
public static String getSiteUrl(){
String siteUrl= SystemConfigConstants.SITE_URL;
return siteUrl;
}
/**
* 腾讯mapkey tengxun_map_key
*/
public static String getTengXunMapKey(){
String tengxunMapKey= SystemConfigConstants.TENGXUN_MAP_KEY;
return tengxunMapKey;
}
//*********************************begin yx_system_config 业务字段 *****************************************************
/**
* store_self_mention
*/
public static String getStoreSelfMention(){
String storeSelfMention= SystemConfigConstants.STORE_SEFL_MENTION;
return storeSelfMention+getExtendValue();
}
//*********************************begin yx_system_config 微信配置相关字段 *****************************************************
/**
* 微信公众号service
*/
public static String getYshopWeiXinMpSevice(){
String yshopWeiXinMpSevice= ShopConstants.YSHOP_WEIXIN_MP_SERVICE;
return yshopWeiXinMpSevice+getExtendValue();
}
/**
* 微信公众号id
*/
public static String getWechatAppId(){
String wechatAppId= SystemConfigConstants.WECHAT_APPID;
return wechatAppId+getExtendValue();
}
/**
* 微信公众号secret
*/
public static String getWechatAppSecret(){
String wechatAppSecret= SystemConfigConstants.WECHAT_APPSECRET;
return wechatAppSecret+getExtendValue();
}
/**
* 微信公众号验证token
*/
public static String getWechatToken(){
String wechatToken= SystemConfigConstants.WECHAT_TOKEN;
return wechatToken+getExtendValue();
}
/**
* 微信公众号 EncodingAESKey
*/
public static String getWechatEncodingAESKey(){
String wechatEncodingAESKey= SystemConfigConstants.WECHAT_ENCODINGAESKEY;
return wechatEncodingAESKey+getExtendValue();
}
/**
* 微信支付service
*/
public static String getYshopWeiXinPayService(){
String yshopWeiXinPayService= ShopConstants.YSHOP_WEIXIN_PAY_SERVICE;
return yshopWeiXinPayService+getExtendValue();
}
/**
* 商户号
*/
public static String getWxPayMchId(){
String wxPayMchId= SystemConfigConstants.WXPAY_MCHID;
return wxPayMchId+getExtendValue();
}
/**
* 商户秘钥
*/
public static String getWxPayMchKey(){
String wxPayMchKey= SystemConfigConstants.WXPAY_MCHKEY;
return wxPayMchKey+getExtendValue();
}
/**
* 商户证书路径
*/
public static String getWxPayKeyPath(){
String wxPayKeyPath= SystemConfigConstants.WXPAY_KEYPATH;
return wxPayKeyPath+getExtendValue();
}
/**
* 微信支付小程序service
*/
public static String getYshopWeiXinMiniPayService(){
String yshopWeiXinMiniPayService= ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE;
return yshopWeiXinMiniPayService+getExtendValue();
}
/**
* 微信支付app service
*/
public static String getYshopWeiXinAppPayService(){
String yshopWeiXinAppPayService= ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE;
return yshopWeiXinAppPayService+getExtendValue();
}
/**
* 微信小程序id
*/
public static String getWxAppAppId(){
String wxAppAppId= SystemConfigConstants.WXAPP_APPID;
return wxAppAppId+getExtendValue();
}
/**
* 微信小程序秘钥
*/
public static String getWxAppSecret(){
String wxAppSecret= SystemConfigConstants.WXAPP_SECRET;
return wxAppSecret+getExtendValue();
}
/**
* 支付appId
*/
public static String getWxNativeAppAppId(){
String wxNativeAppAppId= SystemConfigConstants.WX_NATIVE_APP_APPID;
return wxNativeAppAppId+getExtendValue();
}
}

View File

@ -5,9 +5,6 @@
*/
package co.yixiang.mp.config;
import cn.hutool.core.util.StrUtil;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.mp.handler.*;
import co.yixiang.utils.RedisUtil;
import com.google.common.collect.Maps;
@ -72,21 +69,21 @@ public class WxMpConfiguration {
*/
public static WxMpService getWxMpService() {
WxMpService wxMpService = mpServices.get(ShopConstants.YSHOP_WEIXIN_MP_SERVICE);
WxMpService wxMpService = mpServices.get(ShopKeyUtils.getYshopWeiXinMpSevice());
//增加一个redis标识
if(wxMpService == null || RedisUtil.get(ShopConstants.YSHOP_WEIXIN_MP_SERVICE) == null) {
if(wxMpService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinMpSevice()) == null) {
WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
configStorage.setAppId(RedisUtil.get(RedisKeyEnum.WECHAT_APPID.getValue()));
configStorage.setSecret(RedisUtil.get(RedisKeyEnum.WECHAT_APPSECRET.getValue()));
configStorage.setToken(RedisUtil.get(RedisKeyEnum.WECHAT_TOKEN.getValue()));
configStorage.setAesKey(RedisUtil.get(RedisKeyEnum.WECHAT_ENCODINGAESKEY.getValue()));
configStorage.setAppId(RedisUtil.get(ShopKeyUtils.getWechatAppId()));
configStorage.setSecret(RedisUtil.get(ShopKeyUtils.getWechatAppSecret()));
configStorage.setToken(RedisUtil.get(ShopKeyUtils.getWechatToken()));
configStorage.setAesKey(RedisUtil.get(ShopKeyUtils.getWechatEncodingAESKey()));
wxMpService = new WxMpServiceImpl();
wxMpService.setWxMpConfigStorage(configStorage);
mpServices.put(ShopConstants.YSHOP_WEIXIN_MP_SERVICE, wxMpService);
routers.put(ShopConstants.YSHOP_WEIXIN_MP_SERVICE, newRouter(wxMpService));
mpServices.put(ShopKeyUtils.getYshopWeiXinMpSevice(), wxMpService);
routers.put(ShopKeyUtils.getYshopWeiXinMpSevice(), newRouter(wxMpService));
//增加标识
RedisUtil.set(ShopConstants.YSHOP_WEIXIN_MP_SERVICE,"yshop");
RedisUtil.set(ShopKeyUtils.getYshopWeiXinMpSevice(),"yshop");
}
return wxMpService;
}
@ -95,16 +92,16 @@ public class WxMpConfiguration {
* 移除WxMpService
*/
public static void removeWxMpService(){
RedisUtil.del(ShopConstants.YSHOP_WEIXIN_MP_SERVICE);
mpServices.remove(ShopConstants.YSHOP_WEIXIN_MP_SERVICE);
routers.remove(ShopConstants.YSHOP_WEIXIN_MP_SERVICE);
RedisUtil.del(ShopKeyUtils.getYshopWeiXinMpSevice());
mpServices.remove(ShopKeyUtils.getYshopWeiXinMpSevice());
routers.remove(ShopKeyUtils.getYshopWeiXinMpSevice());
}
/**
* 获取WxMpMessageRouter
*/
public static WxMpMessageRouter getWxMpMessageRouter() {
WxMpMessageRouter wxMpMessageRouter = routers.get(ShopConstants.YSHOP_WEIXIN_MP_SERVICE);
WxMpMessageRouter wxMpMessageRouter = routers.get(ShopKeyUtils.getYshopWeiXinMpSevice());
return wxMpMessageRouter;
}

View File

@ -5,8 +5,6 @@
*/
package co.yixiang.mp.config;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.mp.handler.RedisHandler;
import co.yixiang.utils.RedisUtil;
import com.github.binarywang.wxpay.config.WxPayConfig;
@ -42,22 +40,22 @@ public class WxPayConfiguration {
* @return
*/
public static WxPayService getPayService() {
WxPayService wxPayService = payServices.get(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE);
if(wxPayService == null || RedisUtil.get(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE) == null) {
WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinPayService());
if(wxPayService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId(RedisUtil.get(RedisKeyEnum.WECHAT_APPID.getValue()));
payConfig.setMchId(RedisUtil.get(RedisKeyEnum.WXPAY_MCHID.getValue()));
payConfig.setMchKey(RedisUtil.get(RedisKeyEnum.WXPAY_MCHKEY.getValue()));
payConfig.setKeyPath(RedisUtil.get(RedisKeyEnum.WXPAY_KEYPATH.getValue()));
payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWechatAppId()));
payConfig.setMchId(RedisUtil.get(ShopKeyUtils.getWxPayMchId()));
payConfig.setMchKey(RedisUtil.get(ShopKeyUtils.getWxPayMchKey()));
payConfig.setKeyPath(RedisUtil.get(ShopKeyUtils.getWxPayKeyPath()));
// 可以指定是否使用沙箱环境
payConfig.setUseSandboxEnv(false);
wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
payServices.put(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE, wxPayService);
payServices.put(ShopKeyUtils.getYshopWeiXinPayService(), wxPayService);
//增加标识
RedisUtil.set(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE,"yshop");
}
RedisUtil.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop");
}
return wxPayService;
}
@ -66,21 +64,21 @@ public class WxPayConfiguration {
* @return
*/
public static WxPayService getWxAppPayService() {
WxPayService wxPayService = payServices.get(ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE);
if(wxPayService == null || RedisUtil.get(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE) == null) {
WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinMiniPayService());
if(wxPayService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId(RedisUtil.get(RedisKeyEnum.WXAPP_APPID.getValue()));
payConfig.setMchId(RedisUtil.get(RedisKeyEnum.WXPAY_MCHID.getValue()));
payConfig.setMchKey(RedisUtil.get(RedisKeyEnum.WXPAY_MCHKEY.getValue()));
payConfig.setKeyPath(RedisUtil.get(RedisKeyEnum.WXPAY_KEYPATH.getValue()));
payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxAppAppId()));
payConfig.setMchId(RedisUtil.get(ShopKeyUtils.getWxPayMchId()));
payConfig.setMchKey(RedisUtil.get(ShopKeyUtils.getWxPayMchKey()));
payConfig.setKeyPath(RedisUtil.get(ShopKeyUtils.getWxPayKeyPath()));
// 可以指定是否使用沙箱环境
payConfig.setUseSandboxEnv(false);
wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
payServices.put(ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE, wxPayService);
payServices.put(ShopKeyUtils.getYshopWeiXinMiniPayService(), wxPayService);
//增加标识
RedisUtil.set(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE,"yshop");
RedisUtil.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop");
}
return wxPayService;
}
@ -90,21 +88,21 @@ public class WxPayConfiguration {
* @return
*/
public static WxPayService getAppPayService() {
WxPayService wxPayService = payServices.get(ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE);
if(wxPayService == null || RedisUtil.get(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE) == null) {
WxPayService wxPayService = payServices.get(ShopKeyUtils.getYshopWeiXinAppPayService());
if(wxPayService == null || RedisUtil.get(ShopKeyUtils.getYshopWeiXinPayService()) == null) {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId(RedisUtil.get(RedisKeyEnum.WX_NATIVE_APP_APPID.getValue()));
payConfig.setMchId(RedisUtil.get(RedisKeyEnum.WXPAY_MCHID.getValue()));
payConfig.setMchKey(RedisUtil.get(RedisKeyEnum.WXPAY_MCHKEY.getValue()));
payConfig.setKeyPath(RedisUtil.get(RedisKeyEnum.WXPAY_KEYPATH.getValue()));
payConfig.setAppId(RedisUtil.get(ShopKeyUtils.getWxNativeAppAppId()));
payConfig.setMchId(RedisUtil.get(ShopKeyUtils.getWxPayMchId()));
payConfig.setMchKey(RedisUtil.get(ShopKeyUtils.getWxPayMchKey()));
payConfig.setKeyPath(RedisUtil.get(ShopKeyUtils.getWxPayKeyPath()));
// 可以指定是否使用沙箱环境
payConfig.setUseSandboxEnv(false);
wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(payConfig);
payServices.put(ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE, wxPayService);
payServices.put(ShopKeyUtils.getYshopWeiXinAppPayService(), wxPayService);
//增加标识
RedisUtil.set(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE,"yshop");
RedisUtil.set(ShopKeyUtils.getYshopWeiXinPayService(),"yshop");
}
return wxPayService;
}
@ -113,12 +111,10 @@ public class WxPayConfiguration {
* 移除WxPayService
*/
public static void removeWxPayService(){
RedisUtil.del(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE);
payServices.remove(ShopConstants.YSHOP_WEIXIN_PAY_SERVICE);
payServices.remove(ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE);
payServices.remove(ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE);
RedisUtil.del(ShopKeyUtils.getYshopWeiXinPayService());
payServices.remove(ShopKeyUtils.getYshopWeiXinPayService());
payServices.remove(ShopKeyUtils.getYshopWeiXinMiniPayService());
payServices.remove(ShopKeyUtils.getYshopWeiXinAppPayService());
}
}

View File

@ -7,6 +7,7 @@ package co.yixiang.mp.service;
import cn.hutool.core.util.StrUtil;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.mp.config.WxPayConfiguration;
import co.yixiang.mp.handler.RedisHandler;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
@ -43,7 +44,7 @@ public class YxMiniPayService {
public WxPayMpOrderResult wxPay(String orderId, String openId, String body,
Integer totalFee,String attach) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getWxAppPayService();
@ -74,7 +75,7 @@ public class YxMiniPayService {
* @throws WxPayException
*/
public void refundOrder(String orderId, Integer totalFee) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getWxAppPayService();

View File

@ -8,6 +8,7 @@ package co.yixiang.mp.service;
import cn.hutool.core.util.StrUtil;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.mp.config.WxPayConfiguration;
import co.yixiang.mp.handler.RedisHandler;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
@ -48,7 +49,7 @@ public class YxPayService {
public WxPayMpOrderResult wxPay(String orderId, String openId, String body,
Integer totalFee,String attach) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getPayService();
@ -83,7 +84,7 @@ public class YxPayService {
public WxPayMwebOrderResult wxH5Pay(String orderId, String body,
Integer totalFee,String attach) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getPayService();
@ -115,7 +116,7 @@ public class YxPayService {
public WxPayAppOrderResult appPay(String orderId, String body,
Integer totalFee, String attach) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getAppPayService();
@ -143,7 +144,7 @@ public class YxPayService {
* @throws WxPayException
*/
public void refundOrder(String orderId, Integer totalFee) throws WxPayException {
String apiUrl = redisHandler.getVal("api_url");
String apiUrl = redisHandler.getVal(ShopKeyUtils.getApiUrl());
if (StrUtil.isBlank(apiUrl)) throw new ErrorRequestException("请配置api地址");
WxPayService wxPayService = WxPayConfiguration.getPayService();

View File

@ -5,6 +5,7 @@
*/
package co.yixiang.mp.service;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.mp.domain.YxWechatTemplate;
import co.yixiang.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,7 +39,7 @@ public class YxTemplateService {
* @param openid
*/
public void rechargeSuccessNotice(String time,String price,String openid){
String siteUrl = RedisUtil.get("site_url");
String siteUrl = RedisUtil.get(ShopKeyUtils.getSiteUrl());
YxWechatTemplate WechatTemplate = templateService.findByTempkey(RECHARGE_SUCCESS_KEY);
Map<String,String> map = new HashMap<>();
map.put("first","您的账户金币发生变动,详情如下:");
@ -59,7 +60,7 @@ public class YxTemplateService {
* @param openid
*/
public void paySuccessNotice(String orderId,String price,String openid){
String siteUrl = RedisUtil.get("site_url");
String siteUrl = RedisUtil.get(ShopKeyUtils.getSiteUrl());
YxWechatTemplate WechatTemplate = templateService.findByTempkey(PAY_SUCCESS_KEY);
Map<String,String> map = new HashMap<>();
map.put("first","您的订单已支付成功,我们会尽快为您发货。");
@ -79,7 +80,7 @@ public class YxTemplateService {
* @param time
*/
public void refundSuccessNotice(String orderId,String price,String openid,String time){
String siteUrl = RedisUtil.get("site_url");
String siteUrl = RedisUtil.get(ShopKeyUtils.getSiteUrl());
YxWechatTemplate WechatTemplate = templateService.findByTempkey(REFUND_SUCCESS_KEY);
Map<String,String> map = new HashMap<>();
map.put("first","您在yshop的订单退款申请被通过钱款将很快还至您的支付账户。");
@ -100,7 +101,7 @@ public class YxTemplateService {
* @param openid
*/
public void deliverySuccessNotice(String orderId,String deliveryName,String deliveryId,String openid){
String siteUrl = RedisUtil.get("site_url");
String siteUrl = RedisUtil.get(ShopKeyUtils.getSiteUrl());
YxWechatTemplate WechatTemplate = templateService.findByTempkey(DELIVERY_SUCCESS_KEY);
Map<String,String> map = new HashMap<>();
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");

View File

@ -6,6 +6,7 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.shop.domain.YxUser;
import co.yixiang.modules.shop.service.YxSystemConfigService;
@ -47,7 +48,7 @@ public class MemberController {
public ResponseEntity getYxUsers(YxUserQueryCriteria criteria, Pageable pageable){
if(ObjectUtil.isNotNull(criteria.getIsPromoter())){
if(criteria.getIsPromoter() == 1){
String key = yxSystemConfigService.findByKey("store_brokerage_statu")
String key = yxSystemConfigService.findByKey(SystemConfigConstants.STORE_BROKERAGE_STATU)
.getValue();
if(Integer.valueOf(key) == 2){
return new ResponseEntity(null,HttpStatus.OK);

View File

@ -6,9 +6,9 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.shop.domain.YxSystemConfig;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.dto.YxSystemConfigQueryCriteria;
@ -18,7 +18,6 @@ import co.yixiang.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cache.annotation.CacheEvict;
@ -67,11 +66,11 @@ public class SystemConfigController {
yxSystemConfigModel.setMenuName(key);
yxSystemConfigModel.setValue(value.toString());
//重新配置微信相关
if(RedisKeyEnum.WECHAT_APPID.getValue().equals(key)){
if(SystemConfigConstants.WECHAT_APPID.equals(key)){
WxMpConfiguration.removeWxMpService();
WxPayConfiguration.removeWxPayService();
}
if( RedisKeyEnum.WXPAY_MCHID.getValue().equals(key) || RedisKeyEnum.WXAPP_APPID.getValue().equals(key)){
if(SystemConfigConstants.WXPAY_MCHID.equals(key) || SystemConfigConstants.WXAPP_APPID.equals(key)){
WxPayConfiguration.removeWxPayService();
}
RedisUtil.set(key,value.toString(),0);

View File

@ -7,15 +7,15 @@ package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.RedisKeyEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.shop.domain.YxSystemStore;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.shop.service.dto.YxSystemStoreDto;
import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.RedisUtil;
import com.alibaba.fastjson.JSON;
@ -80,7 +80,7 @@ public class SystemStoreController {
@ApiOperation("获取经纬度")
@PreAuthorize("@el.check('yxSystemStore:getl')")
public ResponseEntity<Object> create(@Validated @RequestBody String jsonStr){
String key = RedisUtil.get(RedisKeyEnum.TENGXUN_MAP_KEY.getValue());
String key = RedisUtil.get(ShopKeyUtils.getTengXunMapKey());
if(StrUtil.isBlank(key)) throw new BadRequestException("请先配置腾讯地图key");
JSONObject jsonObject = JSON.parseObject(jsonStr);
String addr = jsonObject.getString("addr");

View File

@ -2,6 +2,7 @@ package co.yixiang.modules.monitor.service.impl;
import co.yixiang.modules.monitor.domain.vo.RedisVo;
import co.yixiang.modules.monitor.service.RedisService;
import co.yixiang.mp.config.ShopKeyUtils;
import co.yixiang.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -41,7 +42,7 @@ public class RedisServiceImpl implements RedisService {
|| s.toString().indexOf("user::loadUserByUsername") != -1
|| s.toString().indexOf("wechat") != -1
|| s.toString().indexOf("wxpay") != -1
|| s.toString().indexOf("site_url") != -1) {
|| s.toString().indexOf(ShopKeyUtils.getSiteUrl()) != -1) {
continue;
}
DataType dataType = redisTemplate.type(s.toString());