Просмотр исходного кода

Merge tag 'refs/tags/jenkins-back-end-2837' into release

dev
release_toaliyun_real
Stormeye Wu 6 лет назад
Родитель
Сommit
ffb7ab85eb
16 измененных файлов: 251 добавлений и 3 удалений
  1. +20
    -0
      mallinkAdmin/src/main/java/com/iformall/config/RedisConfig.java
  2. +2
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
  3. +19
    -0
      mallinkBApi/src/main/java/com/iformall/config/RedisConfig.java
  4. +19
    -0
      mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java
  5. +19
    -0
      mallinkCallback/src/main/java/com/iformall/config/RedisConfig.java
  6. +18
    -0
      mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java
  7. +18
    -0
      mallinkPosApi/src/main/java/com/iformall/config/RedisConfig.java
  8. +19
    -0
      mallinkSchedule/src/main/java/com/iformall/config/RedisConfig.java
  9. +34
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumTargetAd.java
  10. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  11. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  12. +39
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  13. +1
    -1
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  14. +1
    -1
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml
  15. +19
    -0
      mallinkSysAdmin/src/main/java/com/iformall/config/RedisConfig.java
  16. +19
    -0
      mallinkWebSocketServer/src/main/java/com/iformall/config/RedisConfig.java

+ 20
- 0
mallinkAdmin/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -160,4 +162,22 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}


@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 2
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java Просмотреть файл

@@ -67,7 +67,6 @@ public class WxCouponChannelController extends BaseController {
return new ResultData(page);
}


@ApiOperation("根据id更新接口")
@PostMapping("update")
@SystemControllerLog(description = "券投放-更新")
@@ -92,6 +91,8 @@ public class WxCouponChannelController extends BaseController {
return resultData;
}



@ApiOperation("根据id查询接口")
@GetMapping("/findById")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)


+ 19
- 0
mallinkBApi/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -122,4 +124,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 19
- 0
mallinkCApi/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,10 +1,12 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -140,4 +142,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 19
- 0
mallinkCallback/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -160,4 +162,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 18
- 0
mallinkMQConsumer/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -144,4 +146,20 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 18
- 0
mallinkPosApi/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -122,4 +124,20 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}
}

+ 19
- 0
mallinkSchedule/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -145,4 +147,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 34
- 0
mallinkService/src/main/java/com/iformall/enums/EnumTargetAd.java Просмотреть файл

@@ -0,0 +1,34 @@
package com.iformall.enums;

public enum EnumTargetAd {


LIST(1, "列表"),
BUG(2, "显示抢购"),
;

public static EnumTargetAd getEnum(Integer code) {
for (EnumTargetAd value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumTargetAd(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java Просмотреть файл

@@ -7,8 +7,10 @@ import com.iformall.domain.po.WxTopic;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponChannelVo;
import com.iformall.domain.po.WxCouponChannel;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

@CacheNamespace
public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, String> {

List<WxCouponChannel> findList(WxCouponChannel wxCouponChannel);


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java Просмотреть файл

@@ -5,9 +5,11 @@ import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxTopic;
import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponStatisVo;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;
import com.iformall.domain.po.WxCoupon;

@CacheNamespace
public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<WxCouponStatisVo> findPressData(WxCoupon wxCoupon);
List<WxCouponStatisVo> findCouponData(WxCoupon wxCoupon);


+ 39
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -21,9 +21,13 @@ import com.iformall.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Service
@@ -46,6 +50,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
QrCodeService qrCodeService;
@Autowired
WxCardInfoMapper wxCardInfoMapper;
@Autowired
@Qualifier("couponChannelRedisTemplate")
RedisTemplate<String, PageInfo<WxCouponChannelVo>> cdRedisTemplate;

/**
* B端业务端
@@ -111,9 +118,23 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
record.setUpdateDate(new Date());
wxCouponChannelMapper.updateByPrimaryKeySelective(record);
}

//清除缓存
clearCache(record.getTenantId());
return new ResultData();
}

/**
* 清除c端首页卷列表缓存
* @param tenantId
*/
public void clearCache(String tenantId){
for (int i = 1; i <=20 ; i++) {
String key = "couponChannelList_"+tenantId+"_" + i + ":";
cdRedisTemplate.delete(key);
}
}

@Override
public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) {
List<WxCouponChannelAddVo> errorList = new ArrayList<>();
@@ -284,6 +305,24 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
*/
@Override
public PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize) {
PageInfo<WxCouponChannelVo> pageInfo;
//首页走缓存
if(EnumTargetAd.LIST.getCode().equals(record.getTargetAd()) && new Integer(6).equals(pageSize) && pageIndex.intValue() <=20 ) {
logger.info("---------chache");
String key = "couponChannelList_"+record.getTenantId()+"_" + pageIndex + ":";
ValueOperations<String, PageInfo<WxCouponChannelVo>> operations = cdRedisTemplate.opsForValue();
boolean hasKey = cdRedisTemplate.hasKey(key);
if (hasKey) {
pageInfo = operations.get(key);
logger.info("---------get:{}",pageInfo.getList().size());
}else{
pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoList(record));
}
//插入缓存
operations.set(key, pageInfo, 3600, TimeUnit.SECONDS);
return pageInfo;
}

return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponChannelMapper.findVoList(record));
}



+ 1
- 1
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -180,7 +180,7 @@

</resultMap>

<select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap">
<select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap" useCache="true">
select <include refid="CouponChannelVoColumns" />
from wx_coupon_channel cc
left join wx_coupon c on cc.coupon_id = c.id


+ 1
- 1
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Просмотреть файл

@@ -464,7 +464,7 @@
from wx_order o
inner join wx_merchant_b_user bu on bu.id = o.product_id
inner join wx_merchant m on m.id = bu.merchant_id
where m.`id` = #{merchantId} and o.`type` = 1
where m.`id` = #{merchantId} and o.`type` = 1 and o.`order_status` = 1
<if test=" null != startTime and null != endTime">
and o.`create_date` BETWEEN #{startTime} and #{endTime}
</if>


+ 19
- 0
mallinkSysAdmin/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -160,4 +162,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

+ 19
- 0
mallinkWebSocketServer/src/main/java/com/iformall/config/RedisConfig.java Просмотреть файл

@@ -1,9 +1,11 @@
package com.iformall.config;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.PushLimit;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.vo.WxCouponChannelVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
@@ -144,4 +146,21 @@ public class RedisConfig extends CachingConfigurerSupport {
return template;
}

@Bean("couponChannelRedisTemplate")
public RedisTemplate<String, PageInfo<WxCouponChannelVo>> getCouponChannelRedisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, PageInfo<WxCouponChannelVo>> template = new RedisTemplate<>();

Jackson2JsonRedisSerializer<PageInfo> j = new Jackson2JsonRedisSerializer<PageInfo>(PageInfo.class);
// value值的序列化
template.setValueSerializer(j);
template.setHashKeySerializer(j);

// key的序列化
template.setKeySerializer(new StringRedisSerializer());
template.setHashKeySerializer(new StringRedisSerializer());

template.setConnectionFactory(connectionFactory);
return template;
}

}

Загрузка…
Отмена
Сохранить