diff --git a/framework/src/main/java/cn/lili/cache/config/redis/RedisConfig.java b/framework/src/main/java/cn/lili/cache/config/redis/RedisConfig.java index 0551f26b..8af75596 100644 --- a/framework/src/main/java/cn/lili/cache/config/redis/RedisConfig.java +++ b/framework/src/main/java/cn/lili/cache/config/redis/RedisConfig.java @@ -11,7 +11,6 @@ import org.redisson.config.ClusterServersConfig; import org.redisson.config.Config; import org.redisson.config.SentinelServersConfig; import org.redisson.config.SingleServerConfig; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -56,13 +55,11 @@ import java.util.Map; public class RedisConfig extends CachingConfigurerSupport { + private static final String REDIS_PREFIX = "redis://"; + @Value("${lili.cache.timeout:7200}") private Integer timeout; - @Autowired - private RedisProperties redisProperties; - - /** * 当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器 * @@ -101,7 +98,7 @@ public class RedisConfig extends CachingConfigurerSupport { public RedisTemplate redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) { RedisTemplate template = new RedisTemplate<>(); //使用fastjson序列化 - FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); + FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); //value值的序列化采用fastJsonRedisSerializer template.setValueSerializer(fastJsonRedisSerializer); template.setHashValueSerializer(fastJsonRedisSerializer); @@ -113,7 +110,7 @@ public class RedisConfig extends CachingConfigurerSupport { } @Bean(destroyMethod = "shutdown") - public RedissonClient redisson() { + public RedissonClient redisson(RedisProperties redisProperties) { Config config = new Config(); if (redisProperties.getSentinel() != null && !redisProperties.getSentinel().getNodes().isEmpty()) { // 哨兵模式 @@ -121,7 +118,7 @@ public class RedisConfig extends CachingConfigurerSupport { sentinelServersConfig.setMasterName(redisProperties.getSentinel().getMaster()); List sentinelAddress = new ArrayList<>(); for (String node : redisProperties.getCluster().getNodes()) { - sentinelAddress.add("redis://" + node); + sentinelAddress.add(REDIS_PREFIX + node); } sentinelServersConfig.setSentinelAddresses(sentinelAddress); if (CharSequenceUtil.isNotEmpty(redisProperties.getSentinel().getPassword())) { @@ -132,7 +129,7 @@ public class RedisConfig extends CachingConfigurerSupport { ClusterServersConfig clusterServersConfig = config.useClusterServers(); List clusterNodes = new ArrayList<>(); for (String node : redisProperties.getCluster().getNodes()) { - clusterNodes.add("redis://" + node); + clusterNodes.add(REDIS_PREFIX + node); } clusterServersConfig.setNodeAddresses(clusterNodes); if (CharSequenceUtil.isNotEmpty(redisProperties.getPassword())) { @@ -140,7 +137,7 @@ public class RedisConfig extends CachingConfigurerSupport { } } else { SingleServerConfig singleServerConfig = config.useSingleServer(); - singleServerConfig.setAddress("redis://" + redisProperties.getHost() + ":" + redisProperties.getPort()); + singleServerConfig.setAddress(REDIS_PREFIX + redisProperties.getHost() + ":" + redisProperties.getPort()); if (CharSequenceUtil.isNotEmpty(redisProperties.getPassword())) { singleServerConfig.setPassword(redisProperties.getPassword()); } diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java index 1ea33779..e910a6c7 100644 --- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java @@ -89,6 +89,7 @@ public class ConnectServiceImpl extends ServiceImpl impl } return memberTokenGenerate.createToken(member, longTerm); } catch (NoPermissionException e) { + log.error("联合登陆失败:", e); throw e; } } @@ -121,7 +122,7 @@ public class ConnectServiceImpl extends ServiceImpl impl @Override public void bind(String unionId, String type) { - AuthUser authUser = UserContext.getCurrentUser(); + AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser()); Connect connect = new Connect(authUser.getId(), unionId, type); this.save(connect); } @@ -160,6 +161,7 @@ public class ConnectServiceImpl extends ServiceImpl impl @Override + @Transactional public Token miniProgramAutoLogin(WechatMPLoginParams params) { Object cacheData = cache.get(CachePrefix.WECHAT_SESSION_PARAMS.getPrefix() + params.getUuid()); @@ -186,8 +188,8 @@ public class ConnectServiceImpl extends ServiceImpl impl /** * 通过微信返回等code 获取openid 等信息 * - * @param code - * @return + * @param code 微信code + * @return 微信返回的信息 */ public JSONObject getConnect(String code) { WechatConnectSettingItem setting = getWechatMPSetting(); @@ -208,11 +210,12 @@ public class ConnectServiceImpl extends ServiceImpl impl * @param params 微信小程序自动登录参数 * @param openId 微信openid * @param unionId 微信unionid - * @return + * @return token */ @Transactional(rollbackFor = Exception.class) public Token phoneMpBindAndLogin(String sessionKey, WechatMPLoginParams params, String openId, String unionId) { - String encryptedData = params.getEncryptedData(), iv = params.getIv(); + String encryptedData = params.getEncryptedData(); + String iv = params.getIv(); JSONObject userInfo = this.getUserInfo(encryptedData, sessionKey, iv); log.info("联合登陆返回:{}", userInfo.toString()); String phone = (String) userInfo.get("purePhoneNumber"); @@ -259,9 +262,9 @@ public class ConnectServiceImpl extends ServiceImpl impl * 这样,微信小程序注册之后,其他app 公众号页面,都可以实现绑定自动登录功能 *

* - * @param openId - * @param unionId - * @param member + * @param openId 微信openid + * @param unionId 微信unionid + * @param member 会员 */ private void bindMpMember(String openId, String unionId, Member member) { @@ -272,7 +275,7 @@ public class ConnectServiceImpl extends ServiceImpl impl lambdaQueryWrapper.eq(Connect::getUnionId, unionId); lambdaQueryWrapper.eq(Connect::getUnionType, ConnectEnum.WECHAT.name()); List connects = this.list(lambdaQueryWrapper); - if (connects.size() == 0) { + if (connects.isEmpty()) { Connect connect = new Connect(); connect.setUnionId(unionId); connect.setUserId(member.getId()); @@ -281,7 +284,7 @@ public class ConnectServiceImpl extends ServiceImpl impl } }//如果openid 不为空 则为账号绑定openid if (CharSequenceUtil.isNotEmpty(openId)) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper(); + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(Connect::getUnionId, openId); lambdaQueryWrapper.eq(Connect::getUnionType, ConnectEnum.WECHAT_MP_OPEN_ID.name()); List connects = this.list(lambdaQueryWrapper); diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java index 8818ad4a..c61792aa 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java @@ -24,6 +24,7 @@ public class ManagerMemberEditDTO { @ApiModelProperty(value = "会员用户名,用户名不能进行修改", required = true) @NotNull(message = "会员用户名不能为空") private String id; + @ApiModelProperty(value = "会员用户名,用户名不能进行修改", required = true) @NotNull(message = "会员用户名不能为空") private String username; @@ -48,7 +49,7 @@ public class ManagerMemberEditDTO { private Integer sex; @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") - @DateTimeFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "会员生日") private Date birthday; diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index b6211c3c..ca00f595 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -811,10 +811,10 @@ public class OrderServiceImpl extends ServiceImpl implements List list = this.getPintuanOrder(pintuanId, parentOrderSn); int count = list.size(); if (count == 1) { - //如果为开团订单,则发布一个一小时的延时任务,时间到达后,如果未成团则自动结束(未开启虚拟成团的情况下) + //如果为开团订单,则发布一个24小时的延时任务,时间到达后,如果未成团则自动结束(未开启虚拟成团的情况下) PintuanOrderMessage pintuanOrderMessage = new PintuanOrderMessage(); //开团结束时间 - long startTime = DateUtil.offsetMinute(new Date(), 2).getTime(); + long startTime = DateUtil.offsetHour(new Date(), 24).getTime(); pintuanOrderMessage.setOrderSn(parentOrderSn); pintuanOrderMessage.setPintuanId(pintuanId); TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.PROMOTION_EXECUTOR, diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java index 4edd344a..6750104b 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/PintuanServiceImpl.java @@ -299,7 +299,7 @@ public class PintuanServiceImpl extends AbstractPromotionsServiceImpl