Browse Source

Merge branch 'release_real_200809' of https://git.malls.iformall.com/server/formallProject into release_real_200809

release_toaliyun_real
xhxu 5 years ago
parent
commit
30e3686193
3 changed files with 60 additions and 10 deletions
  1. +57
    -0
      mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java
  2. +1
    -4
      mallinkCApi/src/main/java/com/iformall/controller/BaseController.java
  3. +2
    -6
      mallinkService/src/main/java/com/iformall/domain/po/base/BaseCUserEntity.java

+ 57
- 0
mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java View File

@@ -1,5 +1,8 @@
package com.iformall.config; package com.iformall.config;


import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.po.base.BaseCUserEntity; import com.iformall.domain.po.base.BaseCUserEntity;
@@ -64,6 +67,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, PushLimit> template = new RedisTemplate<String, PushLimit>(); RedisTemplate<String, PushLimit> template = new RedisTemplate<String, PushLimit>();


Jackson2JsonRedisSerializer<PushLimit> j = new Jackson2JsonRedisSerializer<PushLimit>(PushLimit.class); Jackson2JsonRedisSerializer<PushLimit> j = new Jackson2JsonRedisSerializer<PushLimit>(PushLimit.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -81,6 +88,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxScoreRules> template = new RedisTemplate<String, WxScoreRules>(); RedisTemplate<String, WxScoreRules> template = new RedisTemplate<String, WxScoreRules>();


Jackson2JsonRedisSerializer<WxScoreRules> j = new Jackson2JsonRedisSerializer<WxScoreRules>(WxScoreRules.class); Jackson2JsonRedisSerializer<WxScoreRules> j = new Jackson2JsonRedisSerializer<WxScoreRules>(WxScoreRules.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -98,6 +109,12 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxCUser> template = new RedisTemplate<String, WxCUser>(); RedisTemplate<String, WxCUser> template = new RedisTemplate<String, WxCUser>();


Jackson2JsonRedisSerializer<WxCUser> j = new Jackson2JsonRedisSerializer<WxCUser>(WxCUser.class); Jackson2JsonRedisSerializer<WxCUser> j = new Jackson2JsonRedisSerializer<WxCUser>(WxCUser.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -115,6 +132,12 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, BaseCUserEntity> template = new RedisTemplate<String, BaseCUserEntity>(); RedisTemplate<String, BaseCUserEntity> template = new RedisTemplate<String, BaseCUserEntity>();


Jackson2JsonRedisSerializer<BaseCUserEntity> j = new Jackson2JsonRedisSerializer<BaseCUserEntity>(BaseCUserEntity.class); Jackson2JsonRedisSerializer<BaseCUserEntity> j = new Jackson2JsonRedisSerializer<BaseCUserEntity>(BaseCUserEntity.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -132,6 +155,11 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxCUserBasicInfo> template = new RedisTemplate<String, WxCUserBasicInfo>(); RedisTemplate<String, WxCUserBasicInfo> template = new RedisTemplate<String, WxCUserBasicInfo>();


Jackson2JsonRedisSerializer<WxCUserBasicInfo> j = new Jackson2JsonRedisSerializer<WxCUserBasicInfo>(WxCUserBasicInfo.class); Jackson2JsonRedisSerializer<WxCUserBasicInfo> j = new Jackson2JsonRedisSerializer<WxCUserBasicInfo>(WxCUserBasicInfo.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -149,6 +177,11 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxMall> template = new RedisTemplate<String, WxMall>(); RedisTemplate<String, WxMall> template = new RedisTemplate<String, WxMall>();


Jackson2JsonRedisSerializer<WxMall> j = new Jackson2JsonRedisSerializer<WxMall>(WxMall.class); Jackson2JsonRedisSerializer<WxMall> j = new Jackson2JsonRedisSerializer<WxMall>(WxMall.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -166,6 +199,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, List<WxMall>> template = new RedisTemplate<String, List<WxMall>>(); RedisTemplate<String, List<WxMall>> template = new RedisTemplate<String, List<WxMall>>();


Jackson2JsonRedisSerializer<List> j = new Jackson2JsonRedisSerializer<List>(List.class); Jackson2JsonRedisSerializer<List> j = new Jackson2JsonRedisSerializer<List>(List.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -183,6 +220,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>(); RedisTemplate<String, WxCouponCVo> template = new RedisTemplate<String, WxCouponCVo>();


Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class); Jackson2JsonRedisSerializer<WxCouponCVo> j = new Jackson2JsonRedisSerializer<WxCouponCVo>(WxCouponCVo.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);
// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
template.setHashKeySerializer(j); template.setHashKeySerializer(j);
@@ -200,6 +241,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>(); RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();


Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class); Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);


// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
@@ -218,6 +263,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxBuser> template = new RedisTemplate(); RedisTemplate<String, WxBuser> template = new RedisTemplate();


Jackson2JsonRedisSerializer<WxBuser> j = new Jackson2JsonRedisSerializer(WxBuser.class); Jackson2JsonRedisSerializer<WxBuser> j = new Jackson2JsonRedisSerializer(WxBuser.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);


// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
@@ -236,6 +285,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxOrder> template = new RedisTemplate<>(); RedisTemplate<String, WxOrder> template = new RedisTemplate<>();


Jackson2JsonRedisSerializer<WxOrder> j = new Jackson2JsonRedisSerializer(WxOrder.class); Jackson2JsonRedisSerializer<WxOrder> j = new Jackson2JsonRedisSerializer(WxOrder.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);


// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);
@@ -254,6 +307,10 @@ public class RedisConfig extends CachingConfigurerSupport {
RedisTemplate<String, WxAppinfo> template = new RedisTemplate<>(); RedisTemplate<String, WxAppinfo> template = new RedisTemplate<>();


Jackson2JsonRedisSerializer<WxAppinfo> j = new Jackson2JsonRedisSerializer(WxAppinfo.class); Jackson2JsonRedisSerializer<WxAppinfo> j = new Jackson2JsonRedisSerializer(WxAppinfo.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
j.setObjectMapper(om);


// value值的序列化 // value值的序列化
template.setValueSerializer(j); template.setValueSerializer(j);


+ 1
- 4
mallinkCApi/src/main/java/com/iformall/controller/BaseController.java View File

@@ -57,9 +57,6 @@ public class BaseController {
@Autowired @Autowired
private CUserTokenService cUserTokenService; private CUserTokenService cUserTokenService;
@Autowired
private CUserServiceFactory cuserFactory;
@Autowired @Autowired
@Qualifier("cUserBasicInfoRedisTemplate") @Qualifier("cUserBasicInfoRedisTemplate")
RedisTemplate<String, WxCUserBasicInfo> cuserBasicInfoTemplate; RedisTemplate<String, WxCUserBasicInfo> cuserBasicInfoTemplate;
@@ -134,7 +131,7 @@ public class BaseController {
if (baseuser.getRealUser() == null) { if (baseuser.getRealUser() == null) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY); throw new MallinkException(ErrorCode.USER_IS_EMPTY);
} }
WxCUser user = baseuser.getObjectFromMap(WxCUser.class);
WxCUser user = (WxCUser) baseuser.getRealUser();
TenantEntity tenantEntity = getTenantInfo(); TenantEntity tenantEntity = getTenantInfo();
if (user.getTenantId() == null) { if (user.getTenantId() == null) {
user.setTenantId(tenantEntity.getTenantId()); user.setTenantId(tenantEntity.getTenantId());


+ 2
- 6
mallinkService/src/main/java/com/iformall/domain/po/base/BaseCUserEntity.java View File

@@ -32,13 +32,9 @@ public class BaseCUserEntity extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime")
private Date expireTime; private Date expireTime;
@io.swagger.annotations.ApiModelProperty(value="真实对象如wxCUser,因为放到缓存之后,实体会变为map,索性就存map",name="realUser")
@io.swagger.annotations.ApiModelProperty(value="真实对象如wxCUser",name="realUser")
@TableField(exist = false) @TableField(exist = false)
private Map realUser;
public <T> T getObjectFromMap(Class<T> clazz) {
return JSONObject.parseObject(JSONObject.toJSONString(realUser), clazz);
}
private Object realUser;


/** /**
* 是否是会员 * 是否是会员


Loading…
Cancel
Save