app端调整
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.framework.mybatis.core.handler;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
@@ -40,11 +41,11 @@ public class DefaultDBFieldHandler implements MetaObjectHandler {
|
||||
|
||||
Long userId = WebFrameworkUtils.getLoginUserId();
|
||||
// 当前登录用户不为空,创建人为空,则当前登录用户为创建人
|
||||
if (metaObject.hasSetter("creator")) {
|
||||
if (metaObject.hasSetter("creator") && ObjectUtil.isNotEmpty(userId)) {
|
||||
this.setFieldValByName("creator", userId.toString(), metaObject);
|
||||
}
|
||||
|
||||
if (metaObject.hasSetter("updater")) {
|
||||
if (metaObject.hasSetter("updater") && ObjectUtil.isNotEmpty(userId)) {
|
||||
this.setFieldValByName("updater", userId.toString(), metaObject);
|
||||
}
|
||||
|
||||
|
||||
+111
-8
@@ -1,16 +1,33 @@
|
||||
package cn.iocoder.yudao.framework.redis.config;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Redis 配置类
|
||||
*/
|
||||
@Configuration
|
||||
public class YudaoRedisAutoConfiguration {
|
||||
@Slf4j
|
||||
public class YudaoRedisAutoConfiguration extends CachingConfigurerSupport {
|
||||
|
||||
/**
|
||||
* 创建 RedisTemplate Bean,使用 JSON 序列化方式
|
||||
@@ -19,15 +36,101 @@ public class YudaoRedisAutoConfiguration {
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
// 创建 RedisTemplate 对象
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
//序列化
|
||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
|
||||
// value值的序列化采用fastJsonRedisSerializer
|
||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
// key的序列化采用StringRedisSerializer
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.setHashKeySerializer(new StringRedisSerializer());
|
||||
// 设置 RedisConnection 工厂。😈 它就是实现多种 Java Redis 客户端接入的秘密工厂。感兴趣的胖友,可以自己去撸下。
|
||||
template.setConnectionFactory(factory);
|
||||
// 使用 String 序列化方式,序列化 KEY 。
|
||||
template.setKeySerializer(RedisSerializer.string());
|
||||
template.setHashKeySerializer(RedisSerializer.string());
|
||||
// 使用 JSON 序列化方式(库是 Jackson ),序列化 VALUE 。
|
||||
template.setValueSerializer(RedisSerializer.json());
|
||||
template.setHashValueSerializer(RedisSerializer.json());
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义缓存key生成策略,默认将使用该策略
|
||||
*/
|
||||
@Bean
|
||||
@Override
|
||||
public KeyGenerator keyGenerator() {
|
||||
return (target, method, params) -> {
|
||||
Map<String,Object> container = new HashMap<>(3);
|
||||
Class<?> targetClassClass = target.getClass();
|
||||
// 类地址
|
||||
container.put("class",targetClassClass.toGenericString());
|
||||
// 方法名称
|
||||
container.put("methodName",method.getName());
|
||||
// 包名称
|
||||
container.put("package",targetClassClass.getPackage());
|
||||
// 参数列表
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
container.put(String.valueOf(i),params[i]);
|
||||
}
|
||||
// 转为JSON字符串
|
||||
String jsonString = JSONUtil.toJsonStr(container);
|
||||
// 做SHA256 Hash计算,得到一个SHA256摘要作为Key
|
||||
return SecureUtil.sha256(jsonString);
|
||||
// return DigestUtils.sha256Hex(jsonString);
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public CacheErrorHandler errorHandler() {
|
||||
// 异常处理,当Redis发生异常时,打印日志,但是程序正常走
|
||||
log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
|
||||
return new CacheErrorHandler() {
|
||||
@Override
|
||||
public void handleCacheGetError(RuntimeException e, Cache cache, Object key) {
|
||||
log.error("Redis occur handleCacheGetError:key -> [{}]", key, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) {
|
||||
log.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) {
|
||||
log.error("Redis occur handleCacheEvictError:key -> [{}]", key, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCacheClearError(RuntimeException e, Cache cache) {
|
||||
log.error("Redis occur handleCacheClearError:", e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StringRedisSerializer implements RedisSerializer<Object> {
|
||||
|
||||
private final Charset charset;
|
||||
|
||||
StringRedisSerializer() {
|
||||
this(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private StringRedisSerializer(Charset charset) {
|
||||
Assert.notNull(charset, "Charset must not be null!");
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deserialize(byte[] bytes) {
|
||||
return (bytes == null ? null : new String(bytes, charset));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(Object object) {
|
||||
String string = JSONUtil.toJsonStr(object);
|
||||
if (StrUtil.isBlank(string)) {
|
||||
return null;
|
||||
}
|
||||
string = string.replace("\"", "");
|
||||
return string.getBytes(charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -22,6 +22,7 @@ import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -86,8 +87,11 @@ public class YudaoSecurityAutoConfiguration {
|
||||
* Token 认证过滤器 Bean
|
||||
*/
|
||||
@Bean
|
||||
public JWTAuthenticationTokenFilter authenticationTokenFilter(MultiUserDetailsAuthenticationProvider authenticationProvider,
|
||||
public JWTAuthenticationTokenFilter authenticationTokenFilter(
|
||||
HttpServletRequest request,
|
||||
MultiUserDetailsAuthenticationProvider authenticationProvider,
|
||||
GlobalExceptionHandler globalExceptionHandler) {
|
||||
|
||||
return new JWTAuthenticationTokenFilter(securityProperties, authenticationProvider, globalExceptionHandler);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -132,7 +132,7 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
|
||||
.antMatchers("/common/**").permitAll()
|
||||
|
||||
// 忽略宝享购全部
|
||||
// .antMatchers("/bxgApp/**","/bxg/**").hasAnyRole()
|
||||
.antMatchers("/bxgApp/**").permitAll()
|
||||
|
||||
// ②:每个项目的自定义规则
|
||||
.and().authorizeRequests(registry -> // 下面,循环设置自定义规则
|
||||
@@ -142,8 +142,8 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
|
||||
.anyRequest().authenticated()
|
||||
;
|
||||
|
||||
// 添加 JWT Filter
|
||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
// // 添加 JWT Filter
|
||||
// httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
private String buildAdminApi(String url) {
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public class JWTAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
@SuppressWarnings("NullableProblems")
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
String token = SecurityFrameworkUtils.obtainAuthorization(request, securityProperties.getTokenHeader());
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
try {
|
||||
|
||||
@@ -36,6 +36,8 @@ spring:
|
||||
db-history-used: true # activiti7 默认 false 不生成历史信息表,需手动设置开启
|
||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
# 工作流 Flowable 配置
|
||||
flowable:
|
||||
@@ -123,6 +125,7 @@ yudao:
|
||||
- infra_job
|
||||
- infra_job_log
|
||||
- infra_job_log
|
||||
- yx_system_city
|
||||
sms-code: # 短信验证码相关的配置项
|
||||
expire-times: 10m
|
||||
send-frequency: 1m
|
||||
|
||||
+12
-10
@@ -20,8 +20,11 @@ import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import com.auth0.jwt.interfaces.Claim;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
@@ -35,14 +38,13 @@ import java.util.Optional;
|
||||
* @author hupeng
|
||||
* @date 2020-04-30
|
||||
*/
|
||||
public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PermissionInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Autowired
|
||||
private YxUserService userService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
public PermissionInterceptor() {
|
||||
super();
|
||||
}
|
||||
@@ -74,10 +76,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
String uName = map.get("uName").asString();
|
||||
|
||||
//检测用户是否被踢出
|
||||
if (redisUtils.get(ShopConstants.YSHOP_APP_LOGIN_USER + uName + ":" + token) == null) {
|
||||
throw new UnAuthenticatedException(ApiCode.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
boolean valid = this.hasPermission(authCheck.get(), map);
|
||||
if(valid){
|
||||
this.setToThreadLocal(map);
|
||||
@@ -86,6 +85,7 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
}
|
||||
|
||||
private void setToThreadLocal(Map<String,Claim> map) {
|
||||
log.info("map:{}",map);
|
||||
Integer uid = map.get("uid").asInt();
|
||||
Integer scope = map.get("scope").asInt();
|
||||
YxUser user = userService.getById(uid);
|
||||
@@ -104,17 +104,19 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
super.postHandle(request, response, handler, modelAndView);
|
||||
// postHandle(request,response,handler,modelAndView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
LocalUser.clear();
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
// super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
|
||||
|
||||
private Optional<AuthCheck> getAuthCheck(Object handler) {
|
||||
if (handler instanceof HandlerMethod) {
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class AppStoreSeckillController {
|
||||
SeckillConfigVo seckillConfigVo = new SeckillConfigVo();
|
||||
|
||||
YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria();
|
||||
queryCriteria.setGroupName(ShopConstants.YSHOP_SECKILL_TIME);
|
||||
queryCriteria.setGroupName(ShopConstants.ZSW_SECKILL_TIME);
|
||||
queryCriteria.setStatus(1);
|
||||
List<YxSystemGroupData> yxSystemGroupDataList = yxSystemGroupDataService.queryAll(queryCriteria);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class LetterAppAuthController {
|
||||
@ApiOperation(value = "小程序获取用户信息", notes = "小程序获取用户信息")
|
||||
public ApiResult<YxUser> loginAuth(@Validated @RequestBody LoginParam loginParam) {
|
||||
Long uid = LocalUser.getUidByToken();
|
||||
String sessionKey = redisUtil.get(ShopConstants.YSHOP_MINI_SESSION_KET+ uid).toString();
|
||||
String sessionKey = redisUtil.get(ShopConstants.ZSW_MINI_SESSION_KET + uid).toString();
|
||||
YxUser yxUser = authService.loginAuth(loginParam, uid, sessionKey);
|
||||
return ApiResult.ok(yxUser).setMsg("获取成功");
|
||||
|
||||
@@ -286,10 +286,10 @@ public class LetterAppAuthController {
|
||||
if (ObjectUtil.isNotNull(redisUtil.get(codeKey))) {
|
||||
return ApiResult.fail("10分钟内有效:" + redisUtil.get(codeKey).toString());
|
||||
}
|
||||
String code = RandomUtil.randomNumbers(ShopConstants.YSHOP_SMS_SIZE);
|
||||
String code = RandomUtil.randomNumbers(ShopConstants.ZSW_SMS_SIZE);
|
||||
|
||||
//redis存储
|
||||
redisUtil.set(codeKey, code, ShopConstants.YSHOP_SMS_REDIS_TIME);
|
||||
redisUtil.set(codeKey, code, ShopConstants.ZSW_SMS_REDIS_TIME);
|
||||
|
||||
String enable = redisUtil.getY("sms_enable");
|
||||
if (ShopCommonEnum.ENABLE_2.getValue().toString().equals(enable)) {
|
||||
|
||||
@@ -11,6 +11,7 @@ package co.yixiang.app.modules.order.rest;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import co.yixiang.api.ApiResult;
|
||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.app.common.aop.NoRepeatSubmit;
|
||||
@@ -20,6 +21,7 @@ import co.yixiang.app.modules.order.param.ExpressParam;
|
||||
import co.yixiang.app.modules.services.CreatShareProductService;
|
||||
import co.yixiang.app.modules.services.OrderSupplyService;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
|
||||
import co.yixiang.constant.SystemConfigConstants;
|
||||
import co.yixiang.enums.*;
|
||||
import co.yixiang.logging.aop.log.AppLog;
|
||||
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
||||
@@ -37,6 +39,7 @@ import co.yixiang.modules.order.vo.ComputeVo;
|
||||
import co.yixiang.modules.order.vo.ConfirmOrderVo;
|
||||
import co.yixiang.modules.order.vo.OrderCartInfoVo;
|
||||
import co.yixiang.modules.order.vo.YxStoreOrderQueryVo;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.tools.express.ExpressService;
|
||||
import co.yixiang.tools.express.config.ExpressAutoConfiguration;
|
||||
@@ -48,12 +51,17 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.validation.Valid;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -271,6 +279,7 @@ public class AppStoreOrderController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单收货
|
||||
*/
|
||||
|
||||
+32
-47
@@ -42,6 +42,7 @@ 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.utils.QrCodeutil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -49,10 +50,14 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.FontFormatException;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -79,6 +84,7 @@ public class AppStoreProductController {
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
private final YxSystemAttachmentService systemAttachmentService;
|
||||
private final CreatShareProductService creatShareProductService;
|
||||
private final QrCodeutil qrCodeutil;
|
||||
private String path = "";
|
||||
|
||||
|
||||
@@ -133,12 +139,12 @@ public class AppStoreProductController {
|
||||
*/
|
||||
@AppLog(value = "商品详情海报", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/product/poster/{id}")
|
||||
@GetMapping(value = "/product/poster/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "商品ID", paramType = "query", dataType = "int")
|
||||
})
|
||||
@ApiOperation(value = "商品详情海报",notes = "商品详情海报")
|
||||
public ApiResult<String> prodoctPoster(@PathVariable Integer id,@RequestParam(value = "from",defaultValue = "h5") String from) throws IOException, FontFormatException {
|
||||
public ApiResult<String> prodoctPoster(@PathVariable Integer id, @RequestParam(value = "from",defaultValue = "h5") String from) throws IOException, FontFormatException {
|
||||
YxUser userInfo = LocalUser.getUser();
|
||||
|
||||
long uid = userInfo.getUid();
|
||||
@@ -147,59 +153,38 @@ public class AppStoreProductController {
|
||||
// 海报
|
||||
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
|
||||
if(StrUtil.isEmpty(siteUrl)){
|
||||
return ApiResult.fail("未配置h5地址");
|
||||
throw new YshopException("未配置h5地址");
|
||||
}
|
||||
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
|
||||
if(StrUtil.isEmpty(apiUrl)){
|
||||
return ApiResult.fail("未配置api地址");
|
||||
throw new YshopException("未配置api地址");
|
||||
}
|
||||
String name = id+"_"+uid + "_"+from+"_product_detail_wap.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String sepa = File.separator;
|
||||
String fileDir = path+"qrcode"+ sepa;
|
||||
String qrcodeUrl = "";
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
//如果类型是小程序
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else if(AppFromEnum.APP.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
//如果类型是h5
|
||||
}else if(AppFromEnum.H5.getValue().equals(from)){
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"/detail/"+id+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else {
|
||||
//生成二维码
|
||||
String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL);
|
||||
siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL;
|
||||
QrCodeUtil.generate(siteUrl+"/pages/shop/GoodsCon/index?id="+id+"&spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)),
|
||||
fileDir+name,"qrcode/"+name);
|
||||
|
||||
qrcodeUrl = apiUrl + "/api/file/qrcode/"+name;
|
||||
}else{
|
||||
qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir();
|
||||
String text ;
|
||||
//如果类型是小程序
|
||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
text = siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.ROUNTINE.getValue();
|
||||
}
|
||||
String spreadPicName = id+"_"+uid + "_"+from+"_product_user_spread.jpg";
|
||||
String spreadPicPath = fileDir+spreadPicName;
|
||||
String rr = creatShareProductService.creatProductPic(storeProduct,qrcodeUrl,
|
||||
spreadPicName,spreadPicPath,apiUrl);
|
||||
return ApiResult.ok(rr);
|
||||
else if(AppFromEnum.APP.getValue().equals(from)){
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
text = siteUrl+"?id="+id+"&spread="+uid+"&pageType=good&codeType="+AppFromEnum.APP.getValue();
|
||||
//如果类型是h5
|
||||
}else if(AppFromEnum.H5.getValue().equals(from)){
|
||||
//生成二维码
|
||||
text = siteUrl+"/detail/"+id+"?spread="+uid;
|
||||
}else {
|
||||
//生成二维码
|
||||
String uniUrl = systemConfigService.getData(SystemConfigConstants.UNI_SITE_URL);
|
||||
siteUrl = StrUtil.isNotBlank(uniUrl) ? uniUrl : ShopConstants.DEFAULT_UNI_H5_URL;
|
||||
text = siteUrl+"/pages/shop/GoodsCon/index?id="+id+"&spread="+uid;
|
||||
}
|
||||
String url = qrCodeutil.generateQrUrlBase64(text);
|
||||
return ApiResult.ok(url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 普通商品详情
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package co.yixiang.app.modules.product.rest;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.codec.Base64Decoder;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/qrcode")
|
||||
public class ImageController {
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@ApiOperation(value = "二维码生成~")
|
||||
@GetMapping(
|
||||
value = "/image/{code}.png",
|
||||
produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_GIF_VALUE, MediaType.IMAGE_PNG_VALUE}
|
||||
)
|
||||
public byte[] orderCode(@PathVariable String code){
|
||||
// 判断是否是base64
|
||||
String pass = Base64Decoder.decodeStr(code);
|
||||
//
|
||||
if (code.equals(Base64.encode(pass))){
|
||||
code = pass;
|
||||
}
|
||||
|
||||
BufferedImage img = QrCodeUtil.generate(code, 180, 180);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ImageIO.write(img,"png",out);
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class AppAuthService {
|
||||
this.userService.updateById(yxUser);
|
||||
}
|
||||
this.userService.setSpread(spread, yxUser.getUid());
|
||||
redisUtils.set(ShopConstants.YSHOP_MINI_SESSION_KET + yxUser.getUid(), session.getSessionKey());
|
||||
redisUtils.set(ShopConstants.ZSW_MINI_SESSION_KET + yxUser.getUid(), session.getSessionKey());
|
||||
return yxUser;
|
||||
} catch (WxErrorException e) {
|
||||
e.printStackTrace();
|
||||
@@ -300,7 +300,7 @@ public class AppAuthService {
|
||||
.nickname(account)
|
||||
.password(SecureUtil.md5(param.getPassword()))
|
||||
.phone(account)
|
||||
.avatar(ShopConstants.YSHOP_DEFAULT_AVATAR)
|
||||
.avatar(ShopConstants.ZSW_DEFAULT_AVATAR)
|
||||
.addIp(ip)
|
||||
.lastIp(ip)
|
||||
.userType(AppFromEnum.H5.getValue())
|
||||
@@ -339,7 +339,7 @@ public class AppAuthService {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
redisUtils.set(ShopConstants.YSHOP_APP_LOGIN_USER +onlineUser.getUserName() + ":" + token, onlineUser, AppAuthService.expiredTimeIn);
|
||||
redisUtils.set(ShopConstants.ZSW_APP_LOGIN_USER +onlineUser.getUserName() + ":" + token, onlineUser, AppAuthService.expiredTimeIn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -372,7 +372,7 @@ public class AppAuthService {
|
||||
* @param key /
|
||||
*/
|
||||
public void kickOut(String userName, String key) throws Exception {
|
||||
key = ShopConstants.YSHOP_APP_LOGIN_USER + userName + ":" + EncryptUtils.desDecrypt(key);
|
||||
key = ShopConstants.ZSW_APP_LOGIN_USER + userName + ":" + EncryptUtils.desDecrypt(key);
|
||||
redisUtils.del(key);
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public class AppAuthService {
|
||||
* @param token /
|
||||
*/
|
||||
public void logout(String userName, String token) {
|
||||
String key = ShopConstants.YSHOP_APP_LOGIN_USER + userName + ":" + token;
|
||||
String key = ShopConstants.ZSW_APP_LOGIN_USER + userName + ":" + token;
|
||||
redisUtils.del(key);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ public class AppAuthService {
|
||||
*/
|
||||
private List<OnlineUser> getAll(String uName) {
|
||||
List<String> keys = null;
|
||||
keys = redisUtils.scan(ShopConstants.YSHOP_APP_LOGIN_USER + uName + ":" + "*");
|
||||
keys = redisUtils.scan(ShopConstants.ZSW_APP_LOGIN_USER + uName + ":" + "*");
|
||||
|
||||
Collections.reverse(keys);
|
||||
List<OnlineUser> onlineUsers = new ArrayList<>();
|
||||
|
||||
+5
-16
@@ -37,6 +37,7 @@ import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||
import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
|
||||
import co.yixiang.utils.QrCodeutil;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -77,7 +78,7 @@ public class CreatShareProductService {
|
||||
private final YxSystemStoreService systemStoreService;
|
||||
private final YxSystemConfigService systemConfigService;
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
private final QrCodeutil qrCodeutil;
|
||||
/**
|
||||
* 返回门店信息与二维码
|
||||
* @param storeOrder 订单
|
||||
@@ -95,21 +96,9 @@ public class CreatShareProductService {
|
||||
throw new YshopException("未配置api地址");
|
||||
}
|
||||
//生成二维码
|
||||
String name = storeOrder.getVerifyCode()+"_yshop.jpg";
|
||||
YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String fileDir = path+"qrcode"+ File.separator;
|
||||
String qrcodeUrl = "";
|
||||
if(ObjectUtil.isNull(attachment)){
|
||||
//生成二维码
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
QrCodeUtil.generate(storeOrder.getVerifyCode(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
systemAttachmentService.attachmentAdd(name,String.valueOf(FileUtil.size(file)),
|
||||
fileDir+name,"qrcode/"+name);
|
||||
qrcodeUrl = apiUrl + "/api/file/qrcode/"+name;
|
||||
}else{
|
||||
qrcodeUrl = apiUrl + "/api/file/" + attachment.getSattDir();
|
||||
}
|
||||
// String name = storeOrder.getVerifyCode()+"_yshop.jpg";
|
||||
// YxSystemAttachment attachment = systemAttachmentService.getInfo(name);
|
||||
String qrcodeUrl = qrCodeutil.generateQrStr(storeOrder.getVerifyCode());
|
||||
storeOrder.setCode(qrcodeUrl);
|
||||
storeOrder.setMapKey(mapKey);
|
||||
storeOrder.setSystemStore(systemStoreService.getYxSystemStoreById(storeOrder.getStoreId()));
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package co.yixiang.app.modules.shop.rest;
|
||||
|
||||
public class CallStack {
|
||||
|
||||
public static void printCallStatck() {
|
||||
Throwable ex = new Throwable();
|
||||
StackTraceElement[] stackElements = ex.getStackTrace();
|
||||
if (stackElements != null) {
|
||||
for (int i = 0; i < stackElements.length; i++) {
|
||||
System.out.print(stackElements[i].getClassName()+"/t");
|
||||
System.out.print(stackElements[i].getFileName()+"/t");
|
||||
System.out.print(stackElements[i].getLineNumber()+"/t");
|
||||
System.out.println(stackElements[i].getMethodName());
|
||||
System.out.println("-----------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,20 +84,20 @@ public class IndexController {
|
||||
return new ResponseEntity<>(canvas, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY)
|
||||
@Cacheable(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY)
|
||||
@GetMapping("/index")
|
||||
@ApiOperation(value = "首页数据",notes = "首页数据")
|
||||
public ApiResult<IndexVo> index(){
|
||||
IndexVo indexVo = IndexVo.builder()
|
||||
.banner(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_BANNER))
|
||||
.banner(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER))
|
||||
.bastList(storeProductService.getList(1,6, ProductEnum.TYPE_1.getValue()))
|
||||
.benefit(storeProductService.getList(1,100,ProductEnum.TYPE_4.getValue()))
|
||||
.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())
|
||||
.menus(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_MENUS))
|
||||
.roll(systemGroupDataService.getDatas(ShopConstants.YSHOP_HOME_ROLL_NEWS))
|
||||
.menus(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_MENUS))
|
||||
.roll(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_ROLL_NEWS))
|
||||
.seckillList(storeSeckillService.getList(1, 4))
|
||||
.liveList(wechatLiveService.getList(1,4,0))
|
||||
.build();
|
||||
@@ -107,7 +107,7 @@ public class IndexController {
|
||||
@GetMapping("/search/keyword")
|
||||
@ApiOperation(value = "热门搜索关键字获取",notes = "热门搜索关键字获取")
|
||||
public ApiResult<List<String>> search(){
|
||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.YSHOP_HOT_SEARCH);
|
||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.ZSW_HOT_SEARCH);
|
||||
List<String> stringList = new ArrayList<>();
|
||||
for (JSONObject object : list) {
|
||||
stringList.add(object.getString("title"));
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -19,7 +20,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("首页数据")
|
||||
public class IndexVo {
|
||||
public class IndexVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("banner")
|
||||
private List<JSONObject> banner;
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class AppUserRechargeController {
|
||||
@ApiOperation(value = "充值方案",notes = "充值方案",response = ApiResult.class)
|
||||
public ApiResult<Object> getWays(){
|
||||
YxSystemGroupDataQueryCriteria queryCriteria = new YxSystemGroupDataQueryCriteria();
|
||||
queryCriteria.setGroupName(ShopConstants.YSHOP_RECHARGE_PRICE_WAYS);
|
||||
queryCriteria.setGroupName(ShopConstants.ZSW_RECHARGE_PRICE_WAYS);
|
||||
queryCriteria.setStatus(ShopCommonEnum.IS_STATUS_1.getValue());
|
||||
List<YxSystemGroupData> yxSystemGroupDataList = systemGroupDataService.queryAll(queryCriteria);
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class LetterAppUserController {
|
||||
@ApiOperation(value = "获取个人中心菜单",notes = "获取个人中心菜单")
|
||||
public ApiResult<Map<String,Object>> userMenu(){
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("routine_my_menus",systemGroupDataService.getDatas(ShopConstants.YSHOP_MY_MENUES));
|
||||
map.put("routine_my_menus",systemGroupDataService.getDatas(ShopConstants.ZSW_MY_MENUES));
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class LetterAppUserController {
|
||||
@GetMapping("/sign/config")
|
||||
@ApiOperation(value = "签到配置",notes = "签到配置")
|
||||
public ApiResult<Object> signConfig(){
|
||||
return ApiResult.ok(systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM));
|
||||
return ApiResult.ok(systemGroupDataService.getDatas(ShopConstants.ZSW_SIGN_DAY_NUM));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ public class UserAddressController {
|
||||
private final YxSystemCityService systemCityService;
|
||||
|
||||
|
||||
@Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_CITY_KEY)
|
||||
@Cacheable(cacheNames = ShopConstants.ZSW_REDIS_CITY_KEY)
|
||||
@GetMapping("/city_list")
|
||||
@ApiOperation(value = "城市列表",notes = "城市列表")
|
||||
public ApiResult<List<CityVo>> getTest() {
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class WxMaUserController {
|
||||
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
|
||||
String phone = "";
|
||||
try {
|
||||
String sessionKey = redisUtils.get(ShopConstants.YSHOP_MINI_SESSION_KET+ user.getUid()).toString();
|
||||
String sessionKey = redisUtils.get(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid()).toString();
|
||||
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
|
||||
.getPhoneNoInfo(sessionKey, param.getEncryptedData(), param.getIv());
|
||||
phone = phoneNoInfo.getPhoneNumber();
|
||||
|
||||
@@ -2,6 +2,7 @@ package co.yixiang.config;
|
||||
|
||||
import co.yixiang.app.common.interceptor.PermissionInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
@@ -13,16 +14,16 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@Slf4j
|
||||
public class MvcConfigure implements WebMvcConfigurer {
|
||||
|
||||
public HandlerInterceptor getPermissionInterceptor() {
|
||||
return new PermissionInterceptor();
|
||||
}
|
||||
@Autowired
|
||||
private PermissionInterceptor interceptor;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(this.getPermissionInterceptor())
|
||||
registry.addInterceptor(interceptor)
|
||||
.addPathPatterns("/bxgApp/**");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||
// 给电商的全部接口增加前缀
|
||||
@@ -31,4 +32,6 @@ public class MvcConfigure implements WebMvcConfigurer {
|
||||
configurer.addPathPrefix("/admin-api/bxg",aClass -> aClass.getPackage().getName().startsWith("co.yixiang"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,36 +37,36 @@ public interface ShopConstants {
|
||||
/**
|
||||
* 微信支付service
|
||||
*/
|
||||
String YSHOP_WEIXIN_PAY_SERVICE = "yshop_weixin_pay_service";
|
||||
String ZSW_WEIXIN_PAY_SERVICE = "zsw_weixin_pay_service";
|
||||
|
||||
/**
|
||||
* 微信支付小程序service
|
||||
*/
|
||||
String YSHOP_WEIXIN_MINI_PAY_SERVICE = "yshop_weixin_mini_pay_service";
|
||||
String ZSW_WEIXIN_MINI_PAY_SERVICE = "zsw_weixin_mini_pay_service";
|
||||
|
||||
/**
|
||||
* 微信支付app service
|
||||
*/
|
||||
String YSHOP_WEIXIN_APP_PAY_SERVICE = "yshop_weixin_app_pay_service";
|
||||
String ZSW_WEIXIN_APP_PAY_SERVICE = "zsw_weixin_app_pay_service";
|
||||
|
||||
/**
|
||||
* 微信公众号service
|
||||
*/
|
||||
String YSHOP_WEIXIN_MP_SERVICE = "yshop_weixin_mp_service";
|
||||
String ZSW_WEIXIN_MP_SERVICE = "zsw_weixin_mp_service";
|
||||
/**
|
||||
* 微信小程序service
|
||||
*/
|
||||
String YSHOP_WEIXIN_MA_SERVICE = "yshop_weixin_ma_service";
|
||||
String ZSW_WEIXIN_MA_SERVICE = "zsw_weixin_ma_service";
|
||||
|
||||
/**
|
||||
* 商城默认密码
|
||||
*/
|
||||
String YSHOP_DEFAULT_PWD = "123456";
|
||||
String ZSW_DEFAULT_PWD = "123456";
|
||||
|
||||
/**
|
||||
* 商城默认注册图片
|
||||
*/
|
||||
String YSHOP_DEFAULT_AVATAR = "https://image.dayouqiantu.cn/5e79f6cfd33b6.png";
|
||||
String ZSW_DEFAULT_AVATAR = "";
|
||||
|
||||
/**
|
||||
* 腾讯地图地址解析
|
||||
@@ -76,104 +76,104 @@ public interface ShopConstants {
|
||||
/**
|
||||
* redis首页键
|
||||
*/
|
||||
String YSHOP_REDIS_INDEX_KEY = "yshop:index_data";
|
||||
String ZSW_REDIS_INDEX_KEY = "zsw:index_data";
|
||||
|
||||
/**
|
||||
* 配置列表缓存
|
||||
*/
|
||||
String YSHOP_REDIS_CONFIG_DATAS = "yshop:config_datas";
|
||||
String ZSW_REDIS_CONFIG_DATAS = "zsw:config_datas";
|
||||
|
||||
/**
|
||||
* 充值方案
|
||||
*/
|
||||
String YSHOP_RECHARGE_PRICE_WAYS = "yshop_recharge_price_ways";
|
||||
String ZSW_RECHARGE_PRICE_WAYS = "zsw_recharge_price_ways";
|
||||
/**
|
||||
* 首页banner
|
||||
*/
|
||||
String YSHOP_HOME_BANNER = "yshop_home_banner";
|
||||
String ZSW_HOME_BANNER = "zsw_home_banner";
|
||||
/**
|
||||
* 首页菜单
|
||||
*/
|
||||
String YSHOP_HOME_MENUS = "yshop_home_menus";
|
||||
String ZSW_HOME_MENUS = "zsw_home_menus";
|
||||
/**
|
||||
* 首页滚动新闻
|
||||
*/
|
||||
String YSHOP_HOME_ROLL_NEWS = "yshop_home_roll_news";
|
||||
String ZSW_HOME_ROLL_NEWS = "zsw_home_roll_news";
|
||||
/**
|
||||
* 热门搜索
|
||||
*/
|
||||
String YSHOP_HOT_SEARCH = "yshop_hot_search";
|
||||
String ZSW_HOT_SEARCH = "zsw_hot_search";
|
||||
/**
|
||||
* 个人中心菜单
|
||||
*/
|
||||
String YSHOP_MY_MENUES = "yshop_my_menus";
|
||||
String ZSW_MY_MENUES = "zsw_my_menus";
|
||||
/**
|
||||
* 秒杀时间段
|
||||
*/
|
||||
String YSHOP_SECKILL_TIME = "yshop_seckill_time";
|
||||
String ZSW_SECKILL_TIME = "zsw_seckill_time";
|
||||
/**
|
||||
* 签到天数
|
||||
*/
|
||||
String YSHOP_SIGN_DAY_NUM = "yshop_sign_day_num";
|
||||
String ZSW_SIGN_DAY_NUM = "zsw_sign_day_num";
|
||||
|
||||
/**
|
||||
* 打印机配置
|
||||
*/
|
||||
String YSHOP_ORDER_PRINT_COUNT = "order_print_count";
|
||||
String ZSW_ORDER_PRINT_COUNT = "order_print_count";
|
||||
/**
|
||||
* 飞蛾用户信息
|
||||
*/
|
||||
String YSHOP_FEI_E_USER = "fei_e_user";
|
||||
String ZSW_FEI_E_USER = "fei_e_user";
|
||||
/**
|
||||
* 飞蛾用户密钥
|
||||
*/
|
||||
String YSHOP_FEI_E_UKEY= "fei_e_ukey";
|
||||
String ZSW_FEI_E_UKEY= "fei_e_ukey";
|
||||
|
||||
/**
|
||||
* 打印机配置
|
||||
*/
|
||||
String YSHOP_ORDER_PRINT_COUNT_DETAIL = "order_print_count_detail";
|
||||
String ZSW_ORDER_PRINT_COUNT_DETAIL = "order_print_count_detail";
|
||||
|
||||
/**
|
||||
* 短信验证码长度
|
||||
*/
|
||||
int YSHOP_SMS_SIZE = 6;
|
||||
int ZSW_SMS_SIZE = 6;
|
||||
|
||||
/**
|
||||
* 短信缓存时间
|
||||
*/
|
||||
long YSHOP_SMS_REDIS_TIME = 600L;
|
||||
long ZSW_SMS_REDIS_TIME = 600L;
|
||||
|
||||
//零标识
|
||||
String YSHOP_ZERO = "0";
|
||||
String ZSW_ZERO = "0";
|
||||
|
||||
//业务标识标识
|
||||
String YSHOP_ONE = "1";
|
||||
String ZSW_ONE = "1";
|
||||
|
||||
//目前完成任务数量是3
|
||||
Long TASK_FINISH_COUNT = 3L;
|
||||
|
||||
int YSHOP_ONE_NUM = 1;
|
||||
int ZSW_ONE_NUM = 1;
|
||||
|
||||
String YSHOP_ORDER_CACHE_KEY = "yshop:order";
|
||||
String ZSW_ORDER_CACHE_KEY = "zsw:order";
|
||||
|
||||
long YSHOP_ORDER_CACHE_TIME = 600L;
|
||||
long ZSW_ORDER_CACHE_TIME = 600L;
|
||||
|
||||
String WECHAT_MENUS = "wechat_menus";
|
||||
|
||||
String YSHOP_EXPRESS_SERVICE = "yshop_express_service";
|
||||
String ZSW_EXPRESS_SERVICE = "zsw_express_service";
|
||||
|
||||
String YSHOP_REDIS_SYS_CITY_KEY = "yshop:city_list";
|
||||
String ZSW_REDIS_SYS_CITY_KEY = "zsw:city_list";
|
||||
|
||||
String YSHOP_REDIS_CITY_KEY = "yshop:city";
|
||||
String ZSW_REDIS_CITY_KEY = "zsw:city";
|
||||
|
||||
String YSHOP_APP_LOGIN_USER = "app-online-token:";
|
||||
String ZSW_APP_LOGIN_USER = "app-online-token:";
|
||||
|
||||
String YSHOP_WECHAT_PUSH_REMARK = "yshop为您服务!";
|
||||
String ZSW_WECHAT_PUSH_REMARK = "回乡欢迎您!";
|
||||
|
||||
String DEFAULT_UNI_H5_URL = "https://h5.yixiang.co";
|
||||
String DEFAULT_UNI_H5_URL = "https://www.lotus-wallet.com";
|
||||
|
||||
String YSHOP_MINI_SESSION_KET = "yshop:session_key:";
|
||||
String ZSW_MINI_SESSION_KET = "zsw:session_key:";
|
||||
|
||||
/**公众号二维码*/
|
||||
String WECHAT_FOLLOW_IMG="wechat_follow_img";
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package co.yixiang.listener;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantServiceImpl;
|
||||
import co.yixiang.modules.shop.domain.YxSystemConfig;
|
||||
import co.yixiang.modules.shop.domain.YxSystemGroupData;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria;
|
||||
import co.yixiang.utils.RedisUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import jodd.util.MapEntry;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RedisKeyInitialization implements CommandLineRunner {
|
||||
|
||||
@Resource
|
||||
private TenantServiceImpl tenantService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
@Autowired
|
||||
private YxSystemGroupDataService systemGroupDataService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
Map<Long, TenantDO> tenantCache = tenantService.getTenantCache();
|
||||
TenantContextHolder.setTenantId(0L);
|
||||
|
||||
// 配置模版
|
||||
List<YxSystemConfig> configTemplateList = systemConfigService.queryAll(null);
|
||||
// 商城数据
|
||||
List<YxSystemGroupData> groupDataTemplateList = systemGroupDataService.queryAll(null);
|
||||
|
||||
for ( Map.Entry <Long,TenantDO> entry : tenantCache.entrySet()){
|
||||
TenantDO tenant = entry.getValue();
|
||||
TenantContextHolder.setTenantId(tenant.getId());
|
||||
|
||||
// 处理系统设置
|
||||
List<YxSystemConfig> configs = systemConfigService.queryAll(null);
|
||||
List<String> configsName = configs.stream()
|
||||
.map(YxSystemConfig::getMenuName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 准备配置模版 将已经有的剔除 没有的准备插入数据库
|
||||
List<YxSystemConfig> rsT = ObjectUtil.clone(configTemplateList);
|
||||
if (ObjectUtil.isNotEmpty(configsName)) {
|
||||
rsT.removeIf(r -> configsName.contains(r.getMenuName()));
|
||||
}
|
||||
// 清除id
|
||||
rsT.forEach(r-> r.setId(null));
|
||||
systemConfigService.saveBatch(rsT);
|
||||
|
||||
// 处理系统配置
|
||||
List<YxSystemGroupData> groupDatas = systemGroupDataService.queryAll(
|
||||
new YxSystemGroupDataQueryCriteria().setStatus(1));
|
||||
List<String> groupDatasNames = groupDatas.stream()
|
||||
.map(YxSystemGroupData::getGroupName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<YxSystemGroupData> rsD = ObjectUtil.clone(groupDataTemplateList);
|
||||
if (ObjectUtil.isNotEmpty(groupDatasNames)) {
|
||||
rsD.removeIf(r -> groupDatasNames.contains(r.getGroupName()));
|
||||
}
|
||||
rsD.forEach(r-> r.setId(null));
|
||||
systemGroupDataService.saveBatch(rsD);
|
||||
|
||||
// 重新读取
|
||||
configs = systemConfigService.queryAll(null);
|
||||
|
||||
for (YxSystemConfig config: configs) {
|
||||
redisUtils.set(config.getMenuName(),config.getValue());
|
||||
}
|
||||
|
||||
log.info("租户:{} 配置和缓存处理完成。。。",tenant.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -85,7 +85,7 @@ public class StoreCombinationController {
|
||||
return new ResponseEntity<>(yxStoreCombinationService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@Log("新增拼团")
|
||||
@ApiOperation(value = "新增拼团")
|
||||
@PostMapping(value = "/yxStoreCombination")
|
||||
@@ -167,7 +167,7 @@ public class StoreCombinationController {
|
||||
productDto.setAttr(productFormatDto);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@Log("修改拼团")
|
||||
@ApiOperation(value = "新增/修改拼团")
|
||||
@PutMapping(value = "/yxStoreCombination")
|
||||
@@ -181,7 +181,7 @@ public class StoreCombinationController {
|
||||
}
|
||||
|
||||
}
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ForbidSubmit
|
||||
@ApiOperation(value = "开启关闭")
|
||||
@PostMapping(value = "/yxStoreCombination/onsale/{id}")
|
||||
@@ -191,7 +191,7 @@ public class StoreCombinationController {
|
||||
yxStoreCombinationService.onSale(id,status);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ForbidSubmit
|
||||
@Log("删除拼团")
|
||||
@ApiOperation(value = "删除拼团")
|
||||
|
||||
@@ -77,7 +77,7 @@ public class StoreSeckillController {
|
||||
}
|
||||
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@Log("发布")
|
||||
@ApiOperation(value = "发布")
|
||||
@PutMapping(value = "/yxStoreSeckill")
|
||||
@@ -91,7 +91,7 @@ public class StoreSeckillController {
|
||||
}
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@ForbidSubmit
|
||||
@Log("删除")
|
||||
@ApiOperation(value = "删除")
|
||||
@@ -102,7 +102,7 @@ public class StoreSeckillController {
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@Log("新增秒杀")
|
||||
@ApiOperation(value = "新增秒杀")
|
||||
@PostMapping(value = "/yxStoreSeckill")
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
||||
public List<StoreCouponUserVo> beUsableCouponList(Long uid,String cartIds) {
|
||||
|
||||
Map<String, Object> cartGroup = yxStoreCartService.getUserProductCartList(uid,
|
||||
cartIds, ShopConstants.YSHOP_ONE_NUM);
|
||||
cartIds, ShopConstants.ZSW_ONE_NUM);
|
||||
|
||||
List<YxStoreCartQueryVo> cartInfo = (List<YxStoreCartQueryVo>)cartGroup.get("valid");
|
||||
|
||||
|
||||
@@ -56,22 +56,22 @@ public class YxStoreBargainQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "砍价产品名称")
|
||||
private String storeName;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "砍价金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "砍价商品最低价")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@ApiModelProperty(value = "每次购买的砍价产品数量")
|
||||
private Integer num;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "用户每次砍价的最大金额")
|
||||
private BigDecimal bargainMaxPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "用户每次砍价的最小金额")
|
||||
private BigDecimal bargainMinPrice;
|
||||
|
||||
@@ -90,14 +90,14 @@ public class YxStoreBargainQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "砍价活动简介")
|
||||
private String info;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "成本价")
|
||||
private BigDecimal cost;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "邮费")
|
||||
private BigDecimal postage;
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ public class YxStoreCombinationQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "简介")
|
||||
private String info;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class YxStoreCombinationQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "是否包邮1是0否")
|
||||
private Integer isPostage;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "邮费")
|
||||
private BigDecimal postage;
|
||||
|
||||
|
||||
@@ -51,15 +51,15 @@ public class YxStoreSeckillQueryVo implements Serializable{
|
||||
|
||||
}
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "成本")
|
||||
private BigDecimal cost;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
@ApiModelProperty(value = "原价")
|
||||
private BigDecimal otPrice;
|
||||
|
||||
|
||||
@@ -54,17 +54,17 @@ public class YxStoreCartQueryVo implements Serializable {
|
||||
private YxStoreProductQueryVo productInfo;
|
||||
|
||||
@ApiModelProperty(value = "成本价")
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
private Double costPrice;
|
||||
|
||||
@ApiModelProperty(value = "真实价格")
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
private Double truePrice;
|
||||
|
||||
@ApiModelProperty(value = "真实库存")
|
||||
private Integer trueStock;
|
||||
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
@ApiModelProperty(value = "vip真实价格")
|
||||
private Double vipTruePrice;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class StoreCategoryController {
|
||||
@Log("新增商品分类")
|
||||
@ApiOperation(value = "新增商品分类")
|
||||
@PostMapping(value = "/yxStoreCategory")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){
|
||||
if(resources.getPid() != null && resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) {
|
||||
@@ -100,7 +100,7 @@ public class StoreCategoryController {
|
||||
@ForbidSubmit
|
||||
@Log("修改商品分类")
|
||||
@ApiOperation(value = "修改商品分类")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@PutMapping(value = "/yxStoreCategory")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){
|
||||
@@ -125,7 +125,7 @@ public class StoreCategoryController {
|
||||
@ForbidSubmit
|
||||
@Log("删除商品分类")
|
||||
@ApiOperation(value = "删除商品分类")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@DeleteMapping(value = "/yxStoreCategory/{id}")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable String id){
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TemplateListener implements SmartApplicationListener {
|
||||
, templateBean.getPrice(), templateBean.getUid());
|
||||
/**************给客服发送消息**************/
|
||||
try {
|
||||
List<YxStoreCustomer> yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.YSHOP_ONE_NUM).list();
|
||||
List<YxStoreCustomer> yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.ZSW_ONE_NUM).list();
|
||||
yxStoreCustomers.forEach(msg -> {
|
||||
if (StrUtil.isNotBlank(msg.getOpenId())) {
|
||||
weixinTemplateService.paySuccessNoticeToKefu(templateBean.getOrderId()
|
||||
@@ -166,7 +166,7 @@ public class TemplateListener implements SmartApplicationListener {
|
||||
templateBean.getUid(), templateBean.getTime());
|
||||
/**************给客服发送消息**************/
|
||||
try {
|
||||
List<YxStoreCustomer> yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.YSHOP_ONE_NUM).list();
|
||||
List<YxStoreCustomer> yxStoreCustomers = yxStoreCustomerService.lambdaQuery().eq(YxStoreCustomer::getIsEnable, ShopConstants.ZSW_ONE_NUM).list();
|
||||
yxStoreCustomers.forEach(msg -> {
|
||||
if (StrUtil.isNotBlank(msg.getOpenId())) {
|
||||
weixinTemplateService.refundSuccessNoticeToKefu("尊敬的客服,您有新的退款申请待处理!",templateBean.getOrderId()
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WeiXinSubscribeService {
|
||||
map.put("keyword1","充值");
|
||||
map.put("keyword2",time);
|
||||
map.put("keyword3",price);
|
||||
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
map.put("remark", ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.RECHARGE_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendSubscribeMsg( openid, tempId, "/user/account",map);
|
||||
@@ -103,7 +103,7 @@ public class WeiXinSubscribeService {
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword2",price);
|
||||
map.put("keyword3", time);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||
@@ -131,7 +131,7 @@ public class WeiXinSubscribeService {
|
||||
map.put("keyword2",deliveryName);
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword3",deliveryId);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.DELIVERY_SUCCESS.getValue());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
this.sendSubscribeMsg( openid,tempId, "/order/detail/"+orderId,map);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class WeixinTemplateService {
|
||||
map.put("keyword1","充值");
|
||||
map.put("keyword2",time);
|
||||
map.put("keyword3",price);
|
||||
map.put("remark", ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
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);
|
||||
@@ -97,7 +97,7 @@ public class WeixinTemplateService {
|
||||
//订单号
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword2",price);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
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);
|
||||
@@ -117,7 +117,7 @@ public class WeixinTemplateService {
|
||||
map.put("first", "尊敬的客服,您有新订单了");
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword2",price);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.PAY_SUCCESS.getValue());
|
||||
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
@@ -157,7 +157,7 @@ public class WeixinTemplateService {
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword2",price);
|
||||
map.put("keyword3", time);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
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);
|
||||
@@ -179,7 +179,7 @@ public class WeixinTemplateService {
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword2",price);
|
||||
map.put("keyword3", time);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
map.put("remark",ShopConstants.ZSW_WECHAT_PUSH_REMARK);
|
||||
String tempId = this.getTempId(WechatTempateEnum.REFUND_SUCCESS.getValue());
|
||||
String appId=redisUtils.getY(ShopKeyUtils.getWxAppAppId());
|
||||
if(StrUtil.isNotBlank(tempId)) {
|
||||
@@ -215,7 +215,7 @@ public class WeixinTemplateService {
|
||||
map.put("keyword2",deliveryName);
|
||||
map.put("keyword1",orderId);
|
||||
map.put("keyword3",deliveryId);
|
||||
map.put("remark",ShopConstants.YSHOP_WECHAT_PUSH_REMARK);
|
||||
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);
|
||||
|
||||
@@ -14,21 +14,21 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class PriceGroupDto {
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal costPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal storeFreePostage;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal storePostage;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payIntegral;
|
||||
}
|
||||
|
||||
+9
-9
@@ -200,7 +200,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
public ConfirmOrderVo confirmOrder(YxUser yxUser, String cartIds) {
|
||||
Long uid = yxUser.getUid();
|
||||
Map<String, Object> cartGroup = yxStoreCartService.getUserProductCartList(uid,
|
||||
cartIds, ShopConstants.YSHOP_ONE_NUM);
|
||||
cartIds, ShopConstants.ZSW_ONE_NUM);
|
||||
if (ObjectUtil.isNotEmpty(cartGroup.get("invalid"))) {
|
||||
throw new YshopException("有失效的商品请重新提交");
|
||||
}
|
||||
@@ -334,7 +334,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
|
||||
BigDecimal couponPrice = BigDecimal.ZERO;
|
||||
if (StrUtil.isNotBlank(couponId) && !ShopConstants.YSHOP_ZERO.equals(couponId)) {//使用优惠券
|
||||
if (StrUtil.isNotBlank(couponId) && !ShopConstants.ZSW_ZERO.equals(couponId)) {//使用优惠券
|
||||
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId), uid);
|
||||
if (couponUser == null) {
|
||||
throw new YshopException("使用优惠劵失败");
|
||||
@@ -350,7 +350,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
// 积分抵扣
|
||||
BigDecimal deductionPrice = BigDecimal.ZERO; //积分抵扣金额
|
||||
double usedIntegral = 0; //使用了多少积分
|
||||
if (StrUtil.isNotBlank(useIntegral) && ShopConstants.YSHOP_ONE.equals(useIntegral)
|
||||
if (StrUtil.isNotBlank(useIntegral) && ShopConstants.ZSW_ONE.equals(useIntegral)
|
||||
&& userInfo.getIntegral().intValue() > 0) {
|
||||
Double integralMax = Double.valueOf(cacheDTO.getOther().getIntegralMax());
|
||||
BigDecimal integralFull = new BigDecimal(cacheDTO.getOther().getIntegralFull());
|
||||
@@ -399,7 +399,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
* @return YxStoreOrder
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
public YxStoreOrder createOrder(YxUser userInfo, String key, OrderParam param) {
|
||||
|
||||
ComputeVo computeVo = this.computedOrder(userInfo, key, param.getCouponId(),
|
||||
@@ -946,7 +946,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
* @param orderId 单号
|
||||
* @param uid uid
|
||||
*/
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@Override
|
||||
public void takeOrder(String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid);
|
||||
@@ -1899,7 +1899,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
* @return CacheDto
|
||||
*/
|
||||
private CacheDto getCacheOrderInfo(Long uid, String key) {
|
||||
Object obj = redisUtils.get(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key);
|
||||
Object obj = redisUtils.get(ShopConstants.ZSW_ORDER_CACHE_KEY + uid + key);
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1914,7 +1914,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
* @param key key
|
||||
*/
|
||||
private void delCacheOrderInfo(Long uid, String key) {
|
||||
redisUtils.del(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key);
|
||||
redisUtils.del(ShopConstants.ZSW_ORDER_CACHE_KEY + uid + key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1932,9 +1932,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
cacheDTO.setCartInfo(cartInfo);
|
||||
cacheDTO.setPriceGroup(priceGroup);
|
||||
cacheDTO.setOther(other);
|
||||
redisUtils.set(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key,
|
||||
redisUtils.set(ShopConstants.ZSW_ORDER_CACHE_KEY + uid + key,
|
||||
JSON.toJSONString(cacheDTO),
|
||||
ShopConstants.YSHOP_ORDER_CACHE_TIME);
|
||||
ShopConstants.ZSW_ORDER_CACHE_TIME);
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,23 +21,23 @@ import java.math.BigDecimal;
|
||||
@AllArgsConstructor
|
||||
public class ComputeVo implements Serializable {
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal couponPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal deductionPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payPostage;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
private Double usedIntegral; //使用了多少积分
|
||||
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payIntegral;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class OrderDataVo implements Serializable {
|
||||
private Integer count;
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
private Double price;
|
||||
private String time;
|
||||
}
|
||||
|
||||
+4
-4
@@ -68,17 +68,17 @@ public class YxStoreProductAttrValue implements Serializable {
|
||||
|
||||
/** 属性金额 */
|
||||
@ApiModelProperty(value = "属性金额")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal price;
|
||||
|
||||
/** 拼团属性对应的金额 */
|
||||
@ApiModelProperty(value = "拼团属性对应的金额")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal pinkPrice;
|
||||
|
||||
/** 秒杀属性对应的金额 */
|
||||
@ApiModelProperty(value = "秒杀属性对应的金额")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal seckillPrice;
|
||||
|
||||
/** 图片 */
|
||||
@@ -94,7 +94,7 @@ public class YxStoreProductAttrValue implements Serializable {
|
||||
|
||||
/** 成本价 */
|
||||
@ApiModelProperty(value = "成本价")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal cost;
|
||||
|
||||
/** 商品条码 */
|
||||
|
||||
@@ -17,7 +17,6 @@ import co.yixiang.logging.aop.log.Log;
|
||||
import co.yixiang.modules.aop.ForbidSubmit;
|
||||
import co.yixiang.modules.category.domain.YxStoreCategory;
|
||||
import co.yixiang.modules.category.service.YxStoreCategoryService;
|
||||
import co.yixiang.modules.category.service.dto.YxStoreCategoryDto;
|
||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||
import co.yixiang.modules.product.domain.YxStoreProductAttrResult;
|
||||
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
||||
@@ -35,7 +34,6 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.common.collect.Maps;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -44,7 +42,6 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -106,7 +103,7 @@ public class StoreProductController {
|
||||
@ForbidSubmit
|
||||
@Log("新增/修改商品")
|
||||
@ApiOperation(value = "新增/修改商品")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@PostMapping(value = "/yxStoreProduct/addOrSave")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody StoreProductDto storeProductDto){
|
||||
@@ -118,7 +115,7 @@ public class StoreProductController {
|
||||
@ForbidSubmit
|
||||
@Log("删除商品")
|
||||
@ApiOperation(value = "删除商品")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@DeleteMapping(value = "/yxStoreProduct/{id}")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
@@ -129,7 +126,7 @@ public class StoreProductController {
|
||||
|
||||
|
||||
@ApiOperation(value = "商品上架/下架")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@PostMapping(value = "/yxStoreProduct/onsale/{id}")
|
||||
public ResponseEntity onSale(@PathVariable Long id,@RequestBody String jsonStr){
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
|
||||
+2
-2
@@ -237,7 +237,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
}
|
||||
//多字段模糊查询分类搜索
|
||||
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
|
||||
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getSid())) {
|
||||
wrapper.eq(YxStoreProduct::getCateId, productQueryParam.getSid());
|
||||
}
|
||||
//关键字搜索
|
||||
@@ -253,7 +253,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
}
|
||||
//新品搜索
|
||||
if (StrUtil.isNotBlank(productQueryParam.getNews()) &&
|
||||
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())) {
|
||||
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getNews())) {
|
||||
wrapper.eq(YxStoreProduct::getIsNew, ShopCommonEnum.IS_NEW_1.getValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -80,19 +80,19 @@ public class YxStoreProductQueryVo implements Serializable {
|
||||
private String cateId;
|
||||
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "会员价格")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
@ApiModelProperty(value = "市场价")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal otPrice;
|
||||
|
||||
@ApiModelProperty(value = "邮费")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal postage;
|
||||
|
||||
@ApiModelProperty(value = "单位名")
|
||||
@@ -114,7 +114,7 @@ public class YxStoreProductQueryVo implements Serializable {
|
||||
private Integer isPostage;
|
||||
|
||||
@ApiModelProperty(value = "成本价")
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
//@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal cost;
|
||||
|
||||
@ApiModelProperty(value = "秒杀状态 0 未开启 1已开启")
|
||||
|
||||
+2
-2
@@ -46,14 +46,14 @@ public class YxStoreProductRelationQueryVo implements Serializable {
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "原价")
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
private Double otPrice;
|
||||
|
||||
@ApiModelProperty(value = "父ID")
|
||||
private Integer pid;
|
||||
|
||||
@ApiModelProperty(value = "产品价格")
|
||||
@JsonSerialize(using = DoubleSerializer.class)
|
||||
//@JsonSerialize(using = DoubleSerializer.class)
|
||||
private Double price;
|
||||
|
||||
@ApiModelProperty(value = "产品销量")
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SystemConfigController {
|
||||
@Log("新增或修改")
|
||||
@ApiOperation(value = "新增或修改")
|
||||
@PostMapping(value = "/yxSystemConfig")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSYSTEMCONFIG_ALL','YXSYSTEMCONFIG_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
@@ -87,7 +87,7 @@ public class SystemConfigController {
|
||||
WxPayConfiguration.removeWxPayService();
|
||||
}
|
||||
if(SystemConfigConstants.EXP_APPID.equals(key)){
|
||||
redisUtils.del(ShopConstants.YSHOP_EXPRESS_SERVICE);
|
||||
redisUtils.del(ShopConstants.ZSW_EXPRESS_SERVICE);
|
||||
}
|
||||
redisUtils.set(key,value.toString(),0);
|
||||
if(ObjectUtil.isNull(yxSystemConfig)){
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static co.yixiang.constant.ShopConstants.YSHOP_SECKILL_TIME;
|
||||
import static co.yixiang.constant.ShopConstants.ZSW_SECKILL_TIME;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
@@ -66,7 +66,7 @@ public class SystemGroupDataController {
|
||||
@Log("新增数据配置")
|
||||
@ApiOperation(value = "新增数据配置")
|
||||
@PostMapping(value = "/yxSystemGroupData")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
@@ -80,7 +80,7 @@ public class SystemGroupDataController {
|
||||
yxSystemGroupData.setSort(jsonObject.getInteger("sort"));
|
||||
|
||||
List<YxSystemGroupData> yxSeckillTime = yxSystemGroupDataService.list(Wrappers.<YxSystemGroupData>lambdaQuery()
|
||||
.eq(YxSystemGroupData::getGroupName, YSHOP_SECKILL_TIME));
|
||||
.eq(YxSystemGroupData::getGroupName, ZSW_SECKILL_TIME));
|
||||
if (yxSystemGroupData.getStatus() == 1) {
|
||||
yxSeckillTime.forEach(item -> {
|
||||
Map map = JSONUtil.toBean(item.getValue(), Map.class);
|
||||
@@ -97,7 +97,7 @@ public class SystemGroupDataController {
|
||||
@Log("修改数据配置")
|
||||
@ApiOperation(value = "修改数据配置")
|
||||
@PutMapping(value = "/yxSystemGroupData")
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY, allEntries = true)
|
||||
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT')")
|
||||
public ResponseEntity update(@RequestBody String jsonStr) {
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class ShippingTemplatesController {
|
||||
/**
|
||||
* 获取城市列表
|
||||
*/
|
||||
@Cacheable(cacheNames = ShopConstants.YSHOP_REDIS_SYS_CITY_KEY)
|
||||
@Cacheable(cacheNames = ShopConstants.ZSW_REDIS_SYS_CITY_KEY)
|
||||
@GetMapping("/citys")
|
||||
public ResponseEntity<Object> cityList()
|
||||
{
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
*/
|
||||
@Override
|
||||
public int sign(YxUser yxUser) {
|
||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM);
|
||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.ZSW_SIGN_DAY_NUM);
|
||||
if(ObjectUtil.isNull(list) || list.isEmpty()) {
|
||||
throw new YshopException("请先配置签到天数");
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class YxWechatLiveController {
|
||||
return new ResponseEntity<>(yxWechatLiveService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ForbidSubmit
|
||||
@PostMapping
|
||||
@Log("新增wxlive")
|
||||
@@ -88,7 +88,7 @@ public class YxWechatLiveController {
|
||||
return new ResponseEntity<>(yxWechatLiveService.addGoods(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ForbidSubmit
|
||||
@PutMapping
|
||||
@Log("修改wxlive")
|
||||
@@ -99,7 +99,7 @@ public class YxWechatLiveController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ForbidSubmit
|
||||
@Log("删除wxlive")
|
||||
@ApiOperation("删除wxlive")
|
||||
@@ -112,7 +112,7 @@ public class YxWechatLiveController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY,allEntries = true)
|
||||
@CacheEvict(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY,allEntries = true)
|
||||
@ApiOperation("同步数据")
|
||||
@GetMapping("/synchro")
|
||||
public ResponseEntity<Object> synchroWxOlLive() {
|
||||
|
||||
@@ -3,6 +3,8 @@ package co.yixiang.serializer;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
@@ -11,14 +13,28 @@ import java.text.DecimalFormat;
|
||||
/**
|
||||
* @author :LionCity
|
||||
* @date :Created in 2020-05-30 14:12
|
||||
* @description:
|
||||
* @description:a
|
||||
* @modified By:
|
||||
* @version:
|
||||
*/
|
||||
@Slf4j
|
||||
public class BigDecimalSerializer extends JsonSerializer<BigDecimal> {
|
||||
|
||||
@Override
|
||||
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException {
|
||||
if (value != null && !"".equals(value)) {
|
||||
log.info("value1:{}",value);
|
||||
if (value != null) {
|
||||
DecimalFormat df2 =new DecimalFormat("0.00");
|
||||
gen.writeString(df2.format(value));
|
||||
} else {
|
||||
gen.writeString(value + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWithType(BigDecimal value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
|
||||
log.info("value2:{}",value);
|
||||
if (value != null) {
|
||||
DecimalFormat df2 =new DecimalFormat("0.00");
|
||||
gen.writeString(df2.format(value));
|
||||
} else {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ExpressAutoConfiguration {
|
||||
}
|
||||
|
||||
public static ExpressService expressService() {
|
||||
ExpressService expressService = (ExpressService)redisUtil.get(ShopConstants.YSHOP_EXPRESS_SERVICE);
|
||||
ExpressService expressService = (ExpressService)redisUtil.get(ShopConstants.ZSW_EXPRESS_SERVICE);
|
||||
if(expressService != null) {
|
||||
return expressService;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class ExpressAutoConfiguration {
|
||||
}
|
||||
ExpressService service = new ExpressService();
|
||||
service.setProperties(properties);
|
||||
redisUtil.set(ShopConstants.YSHOP_EXPRESS_SERVICE,service);
|
||||
redisUtil.set(ShopConstants.ZSW_EXPRESS_SERVICE,service);
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package co.yixiang.utils;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.EnableSpringUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.YshopException;
|
||||
import co.yixiang.constant.SystemConfigConstants;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QrCodeutil {
|
||||
|
||||
@Autowired
|
||||
private YxSystemConfigService systemConfigService;
|
||||
|
||||
/**
|
||||
* 这个是生成单纯的内容二维码
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String generateQrStr(String code){
|
||||
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
|
||||
if(StrUtil.isEmpty(apiUrl)){
|
||||
throw new YshopException("未配置api地址");
|
||||
}
|
||||
return apiUrl + "/bxgApp/qrcode/image/"+code+".png";
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个是生成带跳转的URL
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String generateQrUrlBase64(String code){
|
||||
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
|
||||
if(StrUtil.isEmpty(apiUrl)){
|
||||
throw new YshopException("未配置api地址");
|
||||
}
|
||||
|
||||
String xcode = Base64.encode(code);
|
||||
return apiUrl + "/bxgApp/qrcode/image/"+xcode+".png";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
package co.yixiang.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import com.mchange.v2.net.LocalHostManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
@@ -17,26 +20,24 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author /
|
||||
*/
|
||||
@Component
|
||||
@SuppressWarnings({"unchecked","all"})
|
||||
public class RedisUtils {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
// =============================commonold============================
|
||||
|
||||
/**
|
||||
* 指定缓存失效时间
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
*/
|
||||
public boolean expire(String key, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
if (time > 0) {
|
||||
stringRedisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||
@@ -54,6 +55,7 @@ public class RedisUtils {
|
||||
* @return 时间(秒) 返回0代表为永久有效
|
||||
*/
|
||||
public long getExpire(String key) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@@ -63,6 +65,7 @@ public class RedisUtils {
|
||||
* @return /
|
||||
*/
|
||||
public List<String> scan(String pattern) {
|
||||
pattern = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),pattern);
|
||||
ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
|
||||
RedisConnectionFactory factory = stringRedisTemplate.getConnectionFactory();
|
||||
RedisConnection rc = Objects.requireNonNull(factory).getConnection();
|
||||
@@ -87,6 +90,7 @@ public class RedisUtils {
|
||||
* @return /
|
||||
*/
|
||||
public List<String> findKeysForPage(String patternKey, int page, int size) {
|
||||
patternKey = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),patternKey);
|
||||
ScanOptions options = ScanOptions.scanOptions().match(patternKey).build();
|
||||
RedisConnectionFactory factory = stringRedisTemplate.getConnectionFactory();
|
||||
RedisConnection rc = Objects.requireNonNull(factory).getConnection();
|
||||
@@ -123,6 +127,7 @@ public class RedisUtils {
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
try {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -137,9 +142,14 @@ public class RedisUtils {
|
||||
public void del(String... key) {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
stringRedisTemplate.delete(key[0]);
|
||||
stringRedisTemplate.delete(StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key[0]));
|
||||
} else {
|
||||
stringRedisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
|
||||
stringRedisTemplate.delete(
|
||||
CollectionUtils
|
||||
.arrayToList(key)
|
||||
.stream()
|
||||
.map(s-> StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),s))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,11 +162,13 @@ public class RedisUtils {
|
||||
* @return 值
|
||||
*/
|
||||
public Object get(String key) {
|
||||
return key == null ? null : stringRedisTemplate.opsForValue().get(key);
|
||||
return key == null ? null : stringRedisTemplate.opsForValue().get(StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key));
|
||||
}
|
||||
|
||||
public String getY(String key){
|
||||
return key == null || !stringRedisTemplate.hasKey(key) ? "" : stringRedisTemplate.opsForValue().get(key).toString();
|
||||
return key == null || !stringRedisTemplate.hasKey(StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key))
|
||||
? ""
|
||||
: stringRedisTemplate.opsForValue().get(StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key)).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,8 +177,8 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public List<Object> multiGet(List<String> keys) {
|
||||
Object obj = stringRedisTemplate.opsForValue().multiGet(keys);
|
||||
return null;
|
||||
keys = keys.stream().map(s-> StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),s)).collect(Collectors.toList());
|
||||
return stringRedisTemplate.opsForValue().multiGet(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +188,7 @@ public class RedisUtils {
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean set(String key, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
@@ -193,6 +206,7 @@ public class RedisUtils {
|
||||
* @return true成功 false 失败
|
||||
*/
|
||||
public boolean set(String key, Object value, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
if (time > 0) {
|
||||
stringRedisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||
@@ -215,6 +229,7 @@ public class RedisUtils {
|
||||
* @return true成功 false 失败
|
||||
*/
|
||||
public boolean set(String key, String value, long time, TimeUnit timeUnit) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
if (time > 0) {
|
||||
stringRedisTemplate.opsForValue().set(key, value, time, timeUnit);
|
||||
@@ -237,6 +252,7 @@ public class RedisUtils {
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.opsForHash().get(key, item);
|
||||
}
|
||||
|
||||
@@ -246,6 +262,7 @@ public class RedisUtils {
|
||||
* @return 对应的多个键值
|
||||
*/
|
||||
public Map<Object, Object> hmget(String key) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.opsForHash().entries(key);
|
||||
|
||||
}
|
||||
@@ -257,6 +274,7 @@ public class RedisUtils {
|
||||
* @return true 成功 false 失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
@@ -274,6 +292,7 @@ public class RedisUtils {
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForHash().putAll(key, map);
|
||||
if (time > 0) {
|
||||
@@ -295,6 +314,7 @@ public class RedisUtils {
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
@@ -314,6 +334,7 @@ public class RedisUtils {
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForHash().put(key, item, value);
|
||||
if (time > 0) {
|
||||
@@ -333,6 +354,7 @@ public class RedisUtils {
|
||||
* @param item 项 可以使多个 不能为null
|
||||
*/
|
||||
public void hdel(String key, Object... item) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
stringRedisTemplate.opsForHash().delete(key, item);
|
||||
}
|
||||
|
||||
@@ -344,6 +366,7 @@ public class RedisUtils {
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hHasKey(String key, String item) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.opsForHash().hasKey(key, item);
|
||||
}
|
||||
|
||||
@@ -356,6 +379,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public double hincr(String key, String item, double by) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.opsForHash().increment(key, item, by);
|
||||
}
|
||||
|
||||
@@ -368,6 +392,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public double hdecr(String key, String item, double by) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
return stringRedisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
@@ -380,6 +405,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public Set<Object> sGet(String key) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForSet().members(key);
|
||||
} catch (Exception e) {
|
||||
@@ -396,6 +422,7 @@ public class RedisUtils {
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean sHasKey(String key, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForSet().isMember(key, value);
|
||||
} catch (Exception e) {
|
||||
@@ -412,6 +439,7 @@ public class RedisUtils {
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSet(String key, Object... values) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForSet().add(key, values);
|
||||
} catch (Exception e) {
|
||||
@@ -428,6 +456,7 @@ public class RedisUtils {
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSetAndTime(String key, long time, Object... values) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
Long count = stringRedisTemplate.opsForSet().add(key, values);
|
||||
if (time > 0) {
|
||||
@@ -446,6 +475,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public long sGetSetSize(String key) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForSet().size(key);
|
||||
} catch (Exception e) {
|
||||
@@ -461,6 +491,7 @@ public class RedisUtils {
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long setRemove(String key, Object... values) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
Long count = stringRedisTemplate.opsForSet().remove(key, values);
|
||||
return count;
|
||||
@@ -480,6 +511,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public List<Object> lGet(String key, long start, long end) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForList().range(key, start, end);
|
||||
} catch (Exception e) {
|
||||
@@ -494,6 +526,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public long lGetListSize(String key) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForList().size(key);
|
||||
} catch (Exception e) {
|
||||
@@ -509,6 +542,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public Object lGetIndex(String key, long index) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForList().index(key, index);
|
||||
} catch (Exception e) {
|
||||
@@ -524,6 +558,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
@@ -541,6 +576,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForList().rightPush(key, value);
|
||||
if (time > 0) {
|
||||
@@ -560,6 +596,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForList().rightPushAll(key, value);
|
||||
return true;
|
||||
@@ -577,6 +614,7 @@ public class RedisUtils {
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value, long time) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForList().rightPushAll(key, value);
|
||||
if (time > 0) {
|
||||
@@ -597,6 +635,7 @@ public class RedisUtils {
|
||||
* @return /
|
||||
*/
|
||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
stringRedisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
@@ -614,6 +653,7 @@ public class RedisUtils {
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long lRemove(String key, long count, Object value) {
|
||||
key = StrUtil.format("{}_{}",TenantContextHolder.getTenantId(),key);
|
||||
try {
|
||||
return stringRedisTemplate.opsForList().remove(key, count, value);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ShopKeyUtils {
|
||||
* 微信公众号service
|
||||
*/
|
||||
public static String getYshopWeiXinMpSevice(){
|
||||
String yshopWeiXinMpSevice= ShopConstants.YSHOP_WEIXIN_MP_SERVICE;
|
||||
String yshopWeiXinMpSevice= ShopConstants.ZSW_WEIXIN_MP_SERVICE;
|
||||
return yshopWeiXinMpSevice+getExtendValue();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ShopKeyUtils {
|
||||
* 微信支付service
|
||||
*/
|
||||
public static String getYshopWeiXinPayService(){
|
||||
String yshopWeiXinPayService= ShopConstants.YSHOP_WEIXIN_PAY_SERVICE;
|
||||
String yshopWeiXinPayService= ShopConstants.ZSW_WEIXIN_PAY_SERVICE;
|
||||
return yshopWeiXinPayService+getExtendValue();
|
||||
}
|
||||
/**
|
||||
@@ -120,14 +120,14 @@ public class ShopKeyUtils {
|
||||
* 微信支付小程序service
|
||||
*/
|
||||
public static String getYshopWeiXinMiniPayService(){
|
||||
String yshopWeiXinMiniPayService= ShopConstants.YSHOP_WEIXIN_MINI_PAY_SERVICE;
|
||||
String yshopWeiXinMiniPayService= ShopConstants.ZSW_WEIXIN_MINI_PAY_SERVICE;
|
||||
return yshopWeiXinMiniPayService+getExtendValue();
|
||||
}
|
||||
/**
|
||||
* 微信支付app service
|
||||
*/
|
||||
public static String getYshopWeiXinAppPayService(){
|
||||
String yshopWeiXinAppPayService= ShopConstants.YSHOP_WEIXIN_APP_PAY_SERVICE;
|
||||
String yshopWeiXinAppPayService= ShopConstants.ZSW_WEIXIN_APP_PAY_SERVICE;
|
||||
return yshopWeiXinAppPayService+getExtendValue();
|
||||
}
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ public class ShopKeyUtils {
|
||||
* @return
|
||||
*/
|
||||
public static String getYshopWeiXinMaSevice() {
|
||||
String yshopWeiXinMaSevice= ShopConstants.YSHOP_WEIXIN_MA_SERVICE;
|
||||
String yshopWeiXinMaSevice= ShopConstants.ZSW_WEIXIN_MA_SERVICE;
|
||||
return yshopWeiXinMaSevice+getExtendValue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user