修复缓存
This commit is contained in:
@@ -42,22 +42,22 @@ spring:
|
||||
test-on-return: false
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/ruoyi-vue-pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
username: root
|
||||
password: root
|
||||
slave: # 模拟从库,可根据自己需要修改
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/ruoyi-vue-pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
username: root
|
||||
password: root
|
||||
bxg: # 农场数据源
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
username: root
|
||||
password: root
|
||||
erp: # 进销存
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
username: root
|
||||
password: root
|
||||
@@ -239,4 +239,11 @@ dubbo:
|
||||
consumer:
|
||||
check: false
|
||||
application:
|
||||
name: zsw-farm
|
||||
name: zsw-farm
|
||||
|
||||
bxg:
|
||||
shop:
|
||||
API_URL: http://192.168.10.129:48080/bxgApp
|
||||
SITE_URL: http://192.168.10.129:48080/bxgApp
|
||||
UNI_SITE_URL: http://192.168.10.129:48080/bxgApp
|
||||
ADMIN_API_URL: http://192.168.10.129:48080/bxg
|
||||
@@ -244,4 +244,11 @@ dubbo:
|
||||
consumer:
|
||||
check: false
|
||||
application:
|
||||
name: zsw-farm
|
||||
name: zsw-farm
|
||||
|
||||
bxg:
|
||||
shop:
|
||||
API_URL: https://farm.lotus-wallet.com/bxgApp
|
||||
SITE_URL: http://project.lotus-wallet.com/
|
||||
UNI_SITE_URL: https://farm.lotus-wallet.com/bxgApp
|
||||
ADMIN_API_URL: https://farm.lotus-wallet.com/bxg
|
||||
+1
-1
Submodule yudao-ui-admin updated: 9cc97d7585...c7b0740fa3
@@ -9,6 +9,7 @@
|
||||
package co.yixiang.app.common.util;
|
||||
|
||||
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import com.aliyuncs.CommonRequest;
|
||||
import com.aliyuncs.CommonResponse;
|
||||
@@ -20,6 +21,7 @@ import com.aliyuncs.profile.DefaultProfile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassName 阿里云短信
|
||||
@@ -30,11 +32,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SmsUtils {
|
||||
|
||||
private static RedisUtils redisUtils;
|
||||
|
||||
private static YxSystemConfigService systemConfigService;
|
||||
@Autowired
|
||||
public SmsUtils(RedisUtils redisUtils){
|
||||
SmsUtils.redisUtils = redisUtils;
|
||||
public SmsUtils(YxSystemConfigService systemConfigService){
|
||||
SmsUtils.systemConfigService = systemConfigService;
|
||||
}
|
||||
/**
|
||||
* 发送短信
|
||||
@@ -42,11 +43,11 @@ public class SmsUtils {
|
||||
* @param templateParam 短信模板变量对应的实际值,JSON格式
|
||||
*/
|
||||
public static void sendSms(String phoneNumbers, String templateParam) throws ClientException {
|
||||
String regionId = redisUtils.getY("sms_region");
|
||||
String accessKeyId = redisUtils.getY("sms_access_key");
|
||||
String accessKeySecret = redisUtils.getY("sms_access_secret");
|
||||
String sign = redisUtils.getY("sms_sign");
|
||||
String templateId = redisUtils.getY("sms_templateId");
|
||||
String regionId = systemConfigService.getData("sms_region");
|
||||
String accessKeyId = systemConfigService.getData("sms_access_key");
|
||||
String accessKeySecret = systemConfigService.getData("sms_access_secret");
|
||||
String sign = systemConfigService.getData("sms_sign");
|
||||
String templateId = systemConfigService.getData("sms_templateId");
|
||||
DefaultProfile profile = DefaultProfile.getProfile(
|
||||
regionId,
|
||||
accessKeyId,
|
||||
|
||||
@@ -106,8 +106,7 @@ public class LetterAppAuthController {
|
||||
@ApiOperation(value = "小程序获取用户信息", notes = "小程序获取用户信息")
|
||||
public ApiResult<YxUser> loginAuth(@Validated @RequestBody LoginParam loginParam) {
|
||||
Long uid = LocalUser.getUidByToken();
|
||||
String sessionKey = redisUtil.getY(ShopConstants.ZSW_MINI_SESSION_KET + uid);
|
||||
YxUser yxUser = authService.loginAuth(loginParam, uid, sessionKey);
|
||||
YxUser yxUser = authService.loginAuth(loginParam, uid);
|
||||
return ApiResult.ok(yxUser).setMsg("获取成功");
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import co.yixiang.modules.mp.config.WxMaConfiguration;
|
||||
import co.yixiang.modules.mp.config.WxMpConfiguration;
|
||||
import co.yixiang.modules.shop.domain.YxSystemAttachment;
|
||||
import co.yixiang.modules.shop.service.YxSystemAttachmentService;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
||||
@@ -32,6 +33,7 @@ import co.yixiang.modules.user.vo.OnlineUser;
|
||||
import co.yixiang.utils.*;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
@@ -62,6 +64,7 @@ public class AppAuthService {
|
||||
private final RedisUtils redisUtils;
|
||||
private static Integer expiredTimeIn;
|
||||
private final YxSystemAttachmentService systemAttachmentService;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
|
||||
@Value("${bxg.security.token-expired-in}")
|
||||
public void setExpiredTimeIn(Integer expiredTimeIn) {
|
||||
@@ -74,26 +77,22 @@ public class AppAuthService {
|
||||
*
|
||||
* @param loginParam loginParam
|
||||
* @param uid
|
||||
* @param sessionKey
|
||||
* @param
|
||||
* @return long
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxUser loginAuth(LoginParam loginParam,Long uid,String sessionKey) {
|
||||
// String code = loginParam.getCode();
|
||||
public YxUser loginAuth(LoginParam loginParam,Long uid) {
|
||||
String code = loginParam.getCode();
|
||||
String encryptedData = loginParam.getEncryptedData();
|
||||
String iv = loginParam.getIv();
|
||||
String spread = loginParam.getSpread();
|
||||
//读取redis配置
|
||||
String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret());
|
||||
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
|
||||
throw new YshopException("请先配置小程序");
|
||||
}
|
||||
|
||||
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
|
||||
//WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
|
||||
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
|
||||
|
||||
WxMaUserInfo wxMpUser = wxMaService.getUserService()
|
||||
.getUserInfo(sessionKey, encryptedData, iv);
|
||||
.getUserInfo(session.getSessionKey(), encryptedData, iv);
|
||||
|
||||
YxUser yxUser = userService.getById(uid);
|
||||
//过滤掉表情
|
||||
@@ -134,8 +133,8 @@ public class AppAuthService {
|
||||
String spread = loginParam.getSpread();
|
||||
try {
|
||||
//读取redis配置
|
||||
String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret());
|
||||
String appId = systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
|
||||
String secret = systemConfigService.getData(ShopKeyUtils.getWxAppSecret());
|
||||
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
|
||||
throw new YshopException("请先配置小程序");
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class CreatShareProductService {
|
||||
public YxStoreOrderQueryVo handleQrcode(YxStoreOrderQueryVo storeOrder,String path){
|
||||
//门店
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
|
||||
String mapKey = redisUtils.getY(SystemConfigConstants.TENGXUN_MAP_KEY);
|
||||
String mapKey = systemConfigService.getData(SystemConfigConstants.TENGXUN_MAP_KEY);
|
||||
if(StrUtil.isBlank(mapKey)) {
|
||||
throw new YshopException("请配置腾讯地图key");
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class OrderSupplyService {
|
||||
} else if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
map.put("status","WECHAT_PAY");
|
||||
WxPayMpOrderResult wxPayMpOrderResult = (WxPayMpOrderResult)weixinPayService
|
||||
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"小程序商品购买");
|
||||
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"小程序订单");
|
||||
jsConfig.put("appId",wxPayMpOrderResult.getAppId());
|
||||
jsConfig.put("timeStamp",wxPayMpOrderResult.getTimeStamp());
|
||||
jsConfig.put("paySign",wxPayMpOrderResult.getPaySign());
|
||||
|
||||
@@ -24,6 +24,7 @@ import co.yixiang.modules.product.vo.YxSystemStoreQueryVo;
|
||||
import co.yixiang.modules.shop.domain.YxAppVersion;
|
||||
import co.yixiang.app.modules.shop.param.YxSystemStoreQueryParam;
|
||||
import co.yixiang.modules.shop.service.YxAppVersionService;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.shop.vo.AppCheckVersion;
|
||||
@@ -72,7 +73,7 @@ public class BxgIndexController {
|
||||
private final YxStoreSeckillService storeSeckillService;
|
||||
private final YxWechatLiveService wechatLiveService;
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
private final StoreCanvasService storeCanvasService;
|
||||
|
||||
@GetMapping("/getCanvas")
|
||||
@@ -95,7 +96,7 @@ public class BxgIndexController {
|
||||
.combinationList(storeCombinationService.getList(1,8).getStoreCombinationQueryVos())
|
||||
.firstList(storeProductService.getList(1,6,ProductEnum.TYPE_3.getValue()))
|
||||
.likeInfo(storeProductService.getList(1,80,ProductEnum.TYPE_2.getValue()))
|
||||
.mapKey(redisUtils.get(ShopKeyUtils.getTengXunMapKey()).toString())
|
||||
.mapKey(systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()))
|
||||
.menus(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_MENUS))
|
||||
.roll(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_ROLL_NEWS))
|
||||
.seckillList(storeSeckillService.getList(1, 4))
|
||||
|
||||
+5
-3
@@ -19,6 +19,7 @@ import co.yixiang.app.modules.wechat.rest.param.WxPhoneParam;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.logging.aop.log.AppLog;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.mp.config.WxMaConfiguration;
|
||||
@@ -47,6 +48,7 @@ import java.util.Map;
|
||||
public class WxMaUserController {
|
||||
|
||||
private final YxUserService userService;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@AppLog(value = "公众号绑定手机号", type = 1)
|
||||
@@ -84,15 +86,15 @@ public class WxMaUserController {
|
||||
}
|
||||
|
||||
//读取redis配置
|
||||
String appId = redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
String secret = redisUtils.getY(ShopKeyUtils.getWxAppSecret());
|
||||
String appId = systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
|
||||
String secret = systemConfigService.getData(ShopKeyUtils.getWxAppSecret());
|
||||
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
|
||||
throw new YshopException("请先配置小程序");
|
||||
}
|
||||
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
|
||||
String phone = "";
|
||||
try {
|
||||
String sessionKey = redisUtils.getY(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
|
||||
String sessionKey = systemConfigService.getData(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
|
||||
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
|
||||
.getPhoneNoInfo(sessionKey, param.getEncryptedData(), param.getIv());
|
||||
phone = phoneNoInfo.getPhoneNumber();
|
||||
|
||||
@@ -6,8 +6,10 @@ import co.yixiang.modules.canvas.domain.StoreCanvas;
|
||||
import co.yixiang.modules.canvas.service.StoreCanvasService;
|
||||
import co.yixiang.modules.shop.domain.YxSystemConfig;
|
||||
import co.yixiang.modules.shop.domain.YxSystemGroupData;
|
||||
import co.yixiang.modules.shop.domain.YxSystemStore;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.tools.domain.QiniuConfig;
|
||||
import co.yixiang.tools.service.QiniuConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -41,6 +43,8 @@ public class TenantInitAspect {
|
||||
private QiniuConfigService qiniuConfigService;
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
@Autowired
|
||||
private YxSystemStoreService storeService;
|
||||
|
||||
@Pointcut("execution(* cn.iocoder.yudao.module.system.service.tenant.TenantService.createTenant(..))")
|
||||
public void tenantInit(){}
|
||||
@@ -71,6 +75,9 @@ public class TenantInitAspect {
|
||||
});
|
||||
TenantContextHolder.apply(tenantId,()->systemConfigService.saveBatch(configs));
|
||||
|
||||
YxSystemStore store = TenantContextHolder.apply(0L,()->storeService.getById(1));
|
||||
store.setId(null);
|
||||
TenantContextHolder.apply(tenantId,()->storeService.save(store));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -177,6 +177,5 @@ public interface ShopConstants {
|
||||
|
||||
/**公众号二维码*/
|
||||
String WECHAT_FOLLOW_IMG="wechat_follow_img";
|
||||
/**后台api地址*/
|
||||
String ADMIN_API_URL="admin_api_url";
|
||||
|
||||
}
|
||||
|
||||
+4
-1
@@ -44,6 +44,7 @@ import co.yixiang.modules.product.service.dto.FromatDetailDto;
|
||||
import co.yixiang.modules.product.service.dto.ProductFormatDto;
|
||||
import co.yixiang.modules.product.service.dto.ProductResultDto;
|
||||
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
||||
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
@@ -99,6 +100,8 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
||||
|
||||
@Autowired
|
||||
private YxStoreProductService storeProductService;
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +143,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
||||
storeCombinationVo.setReplyChance(replyService.replyPer(storeCombinationQueryVo.getProductId()));
|
||||
|
||||
//获取运费模板名称
|
||||
String storeFreePostage = redisUtils.getY("store_free_postage");
|
||||
String storeFreePostage = systemConfigService.getData("store_free_postage");
|
||||
String tempName = "";
|
||||
if(StrUtil.isBlank(storeFreePostage)
|
||||
|| !NumberUtil.isNumber(storeFreePostage)
|
||||
|
||||
+4
-1
@@ -34,6 +34,7 @@ import co.yixiang.modules.product.service.dto.FromatDetailDto;
|
||||
import co.yixiang.modules.product.service.dto.ProductFormatDto;
|
||||
import co.yixiang.modules.product.service.dto.ProductResultDto;
|
||||
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
||||
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
@@ -79,6 +80,8 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
|
||||
@Autowired
|
||||
private YxShippingTemplatesService shippingTemplatesService;
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
/**
|
||||
* 产品详情
|
||||
@@ -101,7 +104,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
//获取商品sku
|
||||
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(storeSeckill.getProductId());
|
||||
//获取运费模板名称
|
||||
String storeFreePostage = redisUtils.getY("store_free_postage");
|
||||
String storeFreePostage = systemConfigService.getData("store_free_postage");
|
||||
String tempName = "";
|
||||
if(StrUtil.isBlank(storeFreePostage)
|
||||
|| !NumberUtil.isNumber(storeFreePostage)
|
||||
|
||||
@@ -14,6 +14,8 @@ import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.constant.SystemConfigConstants;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
import co.yixiang.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.tools.domain.QiniuContent;
|
||||
import co.yixiang.tools.service.LocalStorageService;
|
||||
import co.yixiang.tools.service.QiNiuService;
|
||||
@@ -46,6 +48,7 @@ public class StoreCanvasController {
|
||||
private final LocalStorageService localStorageService;
|
||||
private final QiNiuService qiNiuService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
|
||||
|
||||
@PostMapping("/saveCanvas")
|
||||
@@ -62,11 +65,8 @@ public class StoreCanvasController {
|
||||
@RequestParam(defaultValue = "") String type,
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
|
||||
String localUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL);
|
||||
if(StrUtil.isBlank(type)){
|
||||
localUrl = redisUtils.getY(SystemConfigConstants.API_URL) + "/api";
|
||||
}
|
||||
String mode = redisUtils.getY(SystemConfigConstants.FILE_STORE_MODE);
|
||||
String localUrl = BxgConstans.ADMIN_API_URL;
|
||||
String mode = systemConfigService.getData(SystemConfigConstants.FILE_STORE_MODE);
|
||||
StringBuilder url = new StringBuilder();
|
||||
if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地
|
||||
if(StrUtil.isBlank(localUrl)){
|
||||
|
||||
@@ -4,7 +4,9 @@ import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.annotation.AnonymousAccess;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.modules.mp.config.WxMpConfiguration;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.utils.RecodeUtil;
|
||||
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
@@ -41,6 +43,7 @@ import java.net.URLEncoder;
|
||||
public class QrCodeController {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
/**
|
||||
* 生成微信图片二维码
|
||||
*
|
||||
@@ -51,10 +54,7 @@ public class QrCodeController {
|
||||
@AnonymousAccess
|
||||
@GetMapping("/qrcode")
|
||||
public void qrcode(HttpServletRequest request, HttpServletResponse response, @RequestParam("key") String key) {
|
||||
String adminApiUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL);
|
||||
if(StrUtil.isBlank(adminApiUrl)){
|
||||
throw new BadRequestException("请配置后台-->商城配置-->商城系统配置-->后台Api地址");
|
||||
}
|
||||
String adminApiUrl = BxgConstans.ADMIN_API_URL;
|
||||
final WxMpService wxService = WxMpConfiguration.getWxMpService();
|
||||
if (wxService == null) {
|
||||
throw new IllegalArgumentException("未找到对应配置的服务,请核实!");
|
||||
@@ -71,7 +71,7 @@ public class QrCodeController {
|
||||
@AnonymousAccess
|
||||
@GetMapping("/wechatCode")
|
||||
public ResponseEntity wechatCode() {
|
||||
String wechatFollowImg = redisUtils.getY(ShopConstants.WECHAT_FOLLOW_IMG);
|
||||
String wechatFollowImg = systemConfigService.getData(ShopConstants.WECHAT_FOLLOW_IMG);
|
||||
if(StrUtil.isBlank(wechatFollowImg)){
|
||||
throw new BadRequestException("请配置后台-->微信管理-->公众号配置->关注二维码");
|
||||
}
|
||||
|
||||
@@ -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.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.ShopKeyUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -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(ShopKeyUtils.getSiteUrl()) != -1) {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
DataType dataType = redisTemplate.type(s.toString());
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package co.yixiang.modules.mp.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class BxgConstans {
|
||||
|
||||
public static String API_URL;
|
||||
public static String SITE_URL;
|
||||
public static String ADMIN_API_URL;
|
||||
|
||||
@Value("${bxg.shop.API_URL}")
|
||||
public void setApiUrl(String apiUrl) {
|
||||
API_URL = apiUrl;
|
||||
}
|
||||
|
||||
@Value("${bxg.shop.SITE_URL}")
|
||||
public void setSiteUrl(String siteUrl) {
|
||||
SITE_URL = siteUrl;
|
||||
}
|
||||
|
||||
@Value("${bxg.shop.ADMIN_API_URL}")
|
||||
public void setAdminApiUrl(String adminApiUrl) {
|
||||
ADMIN_API_URL = adminApiUrl;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
|
||||
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
|
||||
import co.yixiang.constant.SystemConfigConstants;
|
||||
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import co.yixiang.utils.ShopKeyUtils;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -25,13 +26,14 @@ public class WxMaConfiguration {
|
||||
private static Map<String, WxMaMessageRouter> routers = Maps.newHashMap();
|
||||
private static RedisUtils redisUtils;
|
||||
private static WxMaMessageHandler wxMaMessageHandler;
|
||||
|
||||
private static YxSystemConfigService systemConfigService;
|
||||
public static WxMaMessageRouter getRouter(String appid) {
|
||||
return routers.get(appid);
|
||||
}
|
||||
@Autowired
|
||||
public WxMaConfiguration(RedisUtils redisUtils) {
|
||||
public WxMaConfiguration(RedisUtils redisUtils,YxSystemConfigService systemConfigService) {
|
||||
WxMaConfiguration.redisUtils = redisUtils;
|
||||
WxMaConfiguration.systemConfigService = systemConfigService;
|
||||
}
|
||||
|
||||
public static WxMaService getWxMaService() {
|
||||
@@ -40,16 +42,16 @@ public class WxMaConfiguration {
|
||||
if(wxMaService == null || redisUtils.get(ShopKeyUtils.getYshopWeiXinMaSevice()) == null){
|
||||
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
|
||||
config.setMsgDataFormat("JSON");
|
||||
config.setAppid(redisUtils.get(ShopKeyUtils.getWxAppAppId()).toString());
|
||||
config.setSecret(redisUtils.get(ShopKeyUtils.getWxAppSecret()).toString());
|
||||
config.setToken(redisUtils.get(ShopKeyUtils.getWechatMaToken()).toString());
|
||||
config.setAesKey(redisUtils.get(ShopKeyUtils.getWechatMaEncodingAESKey()).toString());
|
||||
config.setAppid(systemConfigService.getData(ShopKeyUtils.getWxAppAppId()));
|
||||
config.setSecret(systemConfigService.getData(ShopKeyUtils.getWxAppSecret()));
|
||||
config.setToken(systemConfigService.getData(ShopKeyUtils.getWechatMaToken()));
|
||||
config.setAesKey(systemConfigService.getData(ShopKeyUtils.getWechatMaEncodingAESKey()));
|
||||
wxMaService = new WxMaServiceImpl();
|
||||
wxMaService.setWxMaConfig(config);
|
||||
maServices.put(ShopKeyUtils.getYshopWeiXinMaSevice(), wxMaService);
|
||||
routers.put(ShopKeyUtils.getYshopWeiXinMaSevice(), newRouter(wxMaService));
|
||||
//增加标识
|
||||
redisUtils.set(ShopKeyUtils.getYshopWeiXinMaSevice(),"yshop");
|
||||
redisUtils.set(ShopKeyUtils.getYshopWeiXinMaSevice(),"zsw");
|
||||
|
||||
}
|
||||
return wxMaService;
|
||||
|
||||
@@ -7,6 +7,7 @@ package co.yixiang.modules.mp.config;
|
||||
|
||||
import co.yixiang.enums.PayMethodEnum;
|
||||
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import co.yixiang.utils.ShopKeyUtils;
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
@@ -31,10 +32,11 @@ public class WxPayConfiguration {
|
||||
private static Map<String, WxPayService> payServices = Maps.newHashMap();
|
||||
|
||||
private static RedisUtils redisUtils;
|
||||
|
||||
private static YxSystemConfigService systemConfigService;
|
||||
@Autowired
|
||||
public WxPayConfiguration(RedisUtils redisUtils) {
|
||||
public WxPayConfiguration(RedisUtils redisUtils,YxSystemConfigService systemConfigService) {
|
||||
WxPayConfiguration.redisUtils = redisUtils;
|
||||
WxPayConfiguration.systemConfigService = systemConfigService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,19 +50,19 @@ public class WxPayConfiguration {
|
||||
WxPayConfig payConfig = new WxPayConfig();
|
||||
switch (payMethodEnum){
|
||||
case WECHAT:
|
||||
payConfig.setAppId(redisUtils.getY(ShopKeyUtils.getWechatAppId()));
|
||||
payConfig.setAppId(systemConfigService.getData(ShopKeyUtils.getWechatAppId()));
|
||||
break;
|
||||
case WXAPP:
|
||||
payConfig.setAppId(redisUtils.get(ShopKeyUtils.getWxAppAppId()).toString());
|
||||
payConfig.setAppId(systemConfigService.getData(ShopKeyUtils.getWxAppAppId()));
|
||||
break;
|
||||
case APP:
|
||||
payConfig.setAppId(redisUtils.get(ShopKeyUtils.getWxNativeAppAppId()).toString());
|
||||
payConfig.setAppId(systemConfigService.getData(ShopKeyUtils.getWxNativeAppAppId()));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
payConfig.setMchId(redisUtils.getY(ShopKeyUtils.getWxPayMchId()));
|
||||
payConfig.setMchKey(redisUtils.getY(ShopKeyUtils.getWxPayMchKey()));
|
||||
payConfig.setKeyPath(redisUtils.getY(ShopKeyUtils.getWxPayKeyPath()));
|
||||
payConfig.setMchId(systemConfigService.getData(ShopKeyUtils.getWxPayMchId()));
|
||||
payConfig.setMchKey(systemConfigService.getData(ShopKeyUtils.getWxPayMchKey()));
|
||||
payConfig.setKeyPath(systemConfigService.getData(ShopKeyUtils.getWxPayKeyPath()));
|
||||
// 可以指定是否使用沙箱环境
|
||||
payConfig.setUseSandboxEnv(false);
|
||||
wxPayService = new WxPayServiceImpl();
|
||||
|
||||
@@ -19,6 +19,7 @@ import co.yixiang.enums.BillDetailEnum;
|
||||
import co.yixiang.enums.OrderInfoEnum;
|
||||
import co.yixiang.enums.PayMethodEnum;
|
||||
import co.yixiang.enums.PayTypeEnum;
|
||||
import co.yixiang.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
import co.yixiang.modules.order.vo.YxStoreOrderQueryVo;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
@@ -38,6 +39,7 @@ import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -126,7 +128,7 @@ public class WeixinPayService {
|
||||
orderRequest.setOutTradeNo(orderId);
|
||||
orderRequest.setTotalFee(payPrice);
|
||||
orderRequest.setSpbillCreateIp(IpUtil.getLocalIP());
|
||||
orderRequest.setNotifyUrl(this.getApiUrl() + "/bxgApp/wechat/notify/"+ TenantContextHolder.getTenantId().toString());
|
||||
orderRequest.setNotifyUrl(BxgConstans.API_URL + "/bxgApp/wechat/notify/"+ TenantContextHolder.getTenantId().toString());
|
||||
orderRequest.setBody(body);
|
||||
orderRequest.setAttach(attach);
|
||||
|
||||
@@ -184,7 +186,7 @@ public class WeixinPayService {
|
||||
wxPayRefundRequest.setOutRefundNo(orderSn);
|
||||
//退款金额
|
||||
wxPayRefundRequest.setRefundFee(refundFee);
|
||||
wxPayRefundRequest.setNotifyUrl(this.getApiUrl() + "/bxgApp/notify/refund/"+ TenantContextHolder.getTenantId().toString());
|
||||
wxPayRefundRequest.setNotifyUrl(BxgConstans.API_URL + "/bxgApp/notify/refund/"+ TenantContextHolder.getTenantId().toString());
|
||||
try {
|
||||
wxPayService.refundV2(wxPayRefundRequest);
|
||||
} catch (WxPayException e) {
|
||||
@@ -217,18 +219,4 @@ public class WeixinPayService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回H5 url
|
||||
* @return url
|
||||
*/
|
||||
private String getApiUrl(){
|
||||
String apiUrl = redisUtils.getY(ShopKeyUtils.getApiUrl());
|
||||
if(StrUtil.isBlank(apiUrl)){
|
||||
throw new YshopException("请配置移动端api地址");
|
||||
}
|
||||
return apiUrl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
import co.yixiang.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.modules.mp.config.WxMpConfiguration;
|
||||
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.service.dto.WechatUserDto;
|
||||
@@ -49,8 +51,8 @@ public class WeixinTemplateService {
|
||||
@Autowired
|
||||
private YxWechatTemplateService yxWechatTemplateService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
/**
|
||||
* 充值成功通知
|
||||
@@ -73,7 +75,7 @@ public class WeixinTemplateService {
|
||||
map.put("remark", ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendWxMpTemplateMessage( openid, tempId, this.getSiteUrl()+"/user/account",map);
|
||||
this.sendWxMpTemplateMessage( openid, tempId, BxgConstans.SITE_URL +"/user/account",map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +102,7 @@ public class WeixinTemplateService {
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||
this.sendWxMpTemplateMessage( openid,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +121,13 @@ public class WeixinTemplateService {
|
||||
map.put("keyword2",price);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
String appId=systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
if(StrUtil.isBlank(appId)){
|
||||
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||
this.sendWxMpTemplateMessage( openId,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map);
|
||||
}else{
|
||||
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
|
||||
miniProgram.setAppid(redisUtils.getY(ShopKeyUtils.getWxAppAppId()));
|
||||
miniProgram.setAppid(systemConfigService.getData(ShopKeyUtils.getWxAppAppId()));
|
||||
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
|
||||
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
|
||||
}
|
||||
@@ -160,7 +162,7 @@ public class WeixinTemplateService {
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||
this.sendWxMpTemplateMessage( openid,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,13 +183,13 @@ public class WeixinTemplateService {
|
||||
map.put("keyword3", time);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
String appId=systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
if(StrUtil.isBlank(appId)){
|
||||
this.sendWxMpTemplateMessage( openId,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||
this.sendWxMpTemplateMessage( openId,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map);
|
||||
}else{
|
||||
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
|
||||
miniProgram.setAppid(redisUtils.getY(ShopKeyUtils.getWxAppAppId()));
|
||||
miniProgram.setAppid(systemConfigService.getData(ShopKeyUtils.getWxAppAppId()));
|
||||
miniProgram.setPagePath("pages/orderAdmin/AdminOrder/index?oid=" + orderId);
|
||||
this.sendWxMpTemplateMessageToWx(openId, tempId, miniProgram, map);
|
||||
}
|
||||
@@ -218,7 +220,7 @@ public class WeixinTemplateService {
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendWxMpTemplateMessage( openid,tempId, this.getSiteUrl()+"/order/detail/"+orderId,map);
|
||||
this.sendWxMpTemplateMessage( openid,tempId, BxgConstans.SITE_URL+"/order/detail/"+orderId,map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,17 +294,6 @@ public class WeixinTemplateService {
|
||||
return yxWechatTemplate.getTempid();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回H5 url
|
||||
* @return url
|
||||
*/
|
||||
private String getSiteUrl(){
|
||||
String apiUrl = redisUtils.getY(ShopKeyUtils.getSiteUrl());
|
||||
if(StrUtil.isBlank(apiUrl)){
|
||||
return "";
|
||||
}
|
||||
return apiUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取openid
|
||||
|
||||
+4
-3
@@ -49,6 +49,7 @@ import co.yixiang.modules.product.vo.ProductVo;
|
||||
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
|
||||
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
|
||||
import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
||||
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
||||
@@ -104,7 +105,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
@Autowired
|
||||
private YxShippingTemplatesService shippingTemplatesService;
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -336,7 +337,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
productVo.setReplyChance(replyPer);
|
||||
|
||||
//获取运费模板名称
|
||||
String storeFreePostage = redisUtils.getY("store_free_postage");
|
||||
String storeFreePostage = systemConfigService.getData("store_free_postage");
|
||||
String tempName = "";
|
||||
if (StrUtil.isBlank(storeFreePostage)
|
||||
|| !NumberUtil.isNumber(storeFreePostage)
|
||||
@@ -361,7 +362,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
//门店
|
||||
productVo.setSystemStore(systemStoreService.getStoreInfo(latitude, longitude));
|
||||
productVo.setMapKey(redisUtils.getY(ShopKeyUtils.getTengXunMapKey()));
|
||||
productVo.setMapKey(systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()));
|
||||
if (uid.longValue() > 0) {
|
||||
//添加足迹
|
||||
YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>()
|
||||
|
||||
@@ -12,6 +12,7 @@ import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.aop.ForbidSubmit;
|
||||
import co.yixiang.modules.shop.domain.YxSystemStore;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemStoreDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria;
|
||||
@@ -53,12 +54,12 @@ public class SystemStoreController {
|
||||
|
||||
private final YxSystemStoreService yxSystemStoreService;
|
||||
private final IGenerator generator;
|
||||
private final RedisUtils redisUtils;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
|
||||
public SystemStoreController(YxSystemStoreService yxSystemStoreService, IGenerator generator, RedisUtils redisUtils) {
|
||||
public SystemStoreController(YxSystemStoreService yxSystemStoreService, IGenerator generator, YxSystemConfigService systemConfigService) {
|
||||
this.yxSystemStoreService = yxSystemStoreService;
|
||||
this.generator = generator;
|
||||
this.redisUtils = redisUtils;
|
||||
this.systemConfigService = systemConfigService;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +96,7 @@ public class SystemStoreController {
|
||||
String addr = jsonObject.getString("addr");
|
||||
|
||||
|
||||
String key = redisUtils.getY(ShopKeyUtils.getTengXunMapKey());
|
||||
String key = systemConfigService.getData(ShopKeyUtils.getTengXunMapKey());
|
||||
if (StrUtil.isBlank(key)) {
|
||||
throw new BadRequestException("请先配置腾讯地图key");
|
||||
}
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
import co.yixiang.modules.product.vo.YxSystemStoreQueryVo;
|
||||
import co.yixiang.modules.shop.domain.YxSystemStore;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemStoreDto;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemStoreQueryCriteria;
|
||||
@@ -54,7 +55,7 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<SystemStoreMapper,
|
||||
|
||||
private final IGenerator generator;
|
||||
private final SystemStoreMapper systemStoreMapper;
|
||||
private final RedisUtils redisUtils;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
|
||||
@Override
|
||||
public YxSystemStoreQueryVo getYxSystemStoreById(int id){
|
||||
@@ -99,7 +100,7 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<SystemStoreMapper,
|
||||
if(yxSystemStore == null) {
|
||||
return null;
|
||||
}
|
||||
String mention = redisUtils.getY(ShopKeyUtils.getStoreSelfMention());
|
||||
String mention = systemConfigService.getData(ShopKeyUtils.getStoreSelfMention());
|
||||
if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.constant.ShopConstants;
|
||||
import co.yixiang.constant.SystemConfigConstants;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
import co.yixiang.modules.mp.config.BxgConstans;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.tools.domain.QiniuContent;
|
||||
import co.yixiang.tools.service.LocalStorageService;
|
||||
import co.yixiang.tools.service.QiNiuService;
|
||||
@@ -42,13 +44,13 @@ public class UploadController {
|
||||
|
||||
private final LocalStorageService localStorageService;
|
||||
private final QiNiuService qiNiuService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
|
||||
public UploadController(LocalStorageService localStorageService, QiNiuService qiNiuService,
|
||||
RedisUtils redisUtils) {
|
||||
YxSystemConfigService systemConfigService) {
|
||||
this.localStorageService = localStorageService;
|
||||
this.qiNiuService = qiNiuService;
|
||||
this.redisUtils = redisUtils;
|
||||
this.systemConfigService = systemConfigService;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +60,8 @@ public class UploadController {
|
||||
@RequestParam(defaultValue = "") String type,
|
||||
@RequestParam("file") MultipartFile[] files) {
|
||||
|
||||
String localUrl = redisUtils.getY(ShopConstants.ADMIN_API_URL);
|
||||
if(StrUtil.isBlank(type)){
|
||||
localUrl = redisUtils.getY(SystemConfigConstants.API_URL) + "/api";
|
||||
}
|
||||
String mode = redisUtils.getY(SystemConfigConstants.FILE_STORE_MODE);
|
||||
String localUrl = BxgConstans.ADMIN_API_URL;
|
||||
String mode = systemConfigService.getData(SystemConfigConstants.FILE_STORE_MODE);
|
||||
StringBuilder url = new StringBuilder();
|
||||
if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地
|
||||
if(StrUtil.isBlank(localUrl)){
|
||||
|
||||
@@ -174,10 +174,6 @@ public class RedisUtils {
|
||||
}
|
||||
String tarKey = buildCacheKey(key);
|
||||
Object rs = redisTemplate.opsForValue().get(tarKey);
|
||||
if (ObjectUtil.isEmpty(rs)){
|
||||
rs = systemConfigService.getData(key);
|
||||
redisTemplate.opsForValue().set(tarKey,rs);
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
@@ -189,8 +185,7 @@ public class RedisUtils {
|
||||
String tarKey = buildCacheKey(key);
|
||||
Object rs = redisTemplate.opsForValue().get(tarKey);
|
||||
if (ObjectUtil.isEmpty(rs)){
|
||||
rs = systemConfigService.getData(key);
|
||||
redisTemplate.opsForValue().set(tarKey,rs);
|
||||
return null;
|
||||
}
|
||||
return rs.toString();
|
||||
}
|
||||
|
||||
@@ -18,18 +18,7 @@ public class ShopKeyUtils {
|
||||
|
||||
//*********************************begin yx_system_config 通用值 *****************************************************
|
||||
|
||||
/**
|
||||
* api_url
|
||||
*/
|
||||
public static String getApiUrl(){
|
||||
return SystemConfigConstants.API_URL;
|
||||
}
|
||||
/**
|
||||
* site_url
|
||||
*/
|
||||
public static String getSiteUrl(){
|
||||
return SystemConfigConstants.SITE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 腾讯mapkey tengxun_map_key
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user