优化项目启动速度,海报为app添加参数
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
package co.yixiang.listener;
|
||||
|
||||
import co.yixiang.enums.RedisKeyEnum;
|
||||
import co.yixiang.modules.shop.entity.YxSystemConfig;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@ -17,6 +19,7 @@ import java.util.stream.Stream;
|
||||
/**
|
||||
* api服务启动初始化reids
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class RedisKeyInitialization {
|
||||
@ -28,13 +31,25 @@ public class RedisKeyInitialization {
|
||||
|
||||
@PostConstruct
|
||||
public void redisKeyInitialization(){
|
||||
List<RedisKeyEnum> redisKeyEnums = Stream.of(RedisKeyEnum.values()).collect(Collectors.toList());
|
||||
for (RedisKeyEnum redisKeyEnum : redisKeyEnums) {
|
||||
Object redisKey = redisTemplate.opsForValue().get(redisKeyEnum.getValue());
|
||||
if(redisKey == null){
|
||||
String dbKey = systemConfigService.getData(redisKeyEnum.getValue());
|
||||
redisTemplate.opsForValue().set(redisKeyEnum.getValue(),dbKey);
|
||||
}
|
||||
try {
|
||||
List<RedisKeyEnum> redisKeyEnums = Stream.of(RedisKeyEnum.values()).collect(Collectors.toList());
|
||||
List<YxSystemConfig> systemConfigs = systemConfigService.list();
|
||||
for (RedisKeyEnum redisKeyEnum : redisKeyEnums) {
|
||||
Object redisKey = redisTemplate.opsForValue().get(redisKeyEnum.getValue());
|
||||
if(redisKey == null){
|
||||
String dbKey = "";
|
||||
for (YxSystemConfig systemConfig : systemConfigs) {
|
||||
if(systemConfig.getMenuName().equals(redisKeyEnum.getValue())){
|
||||
dbKey = systemConfig.getValue();
|
||||
}
|
||||
}
|
||||
redisTemplate.opsForValue().set(redisKeyEnum.getValue(),dbKey);
|
||||
}
|
||||
}
|
||||
log.info("---------------redisKey初始化成功---------------");
|
||||
}catch (Exception e){
|
||||
log.info("redisKey初始化失败: {}",e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -259,10 +259,10 @@ public class StoreBargainController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
* 砍价海报
|
||||
*/
|
||||
@PostMapping("/bargain/poster")
|
||||
@ApiOperation(value = "拼团海报",notes = "拼团海报")
|
||||
@ApiOperation(value = "砍价海报",notes = "砍价海报")
|
||||
public ApiResult<Object> poster(@RequestBody String jsonStr){
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
Integer bargainId = jsonObject.getInteger("bargainId");
|
||||
@ -310,7 +310,12 @@ public class StoreBargainController extends BaseController {
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userType.equals(AppFromEnum.ROUNTINE.getValue())){
|
||||
siteUrl = siteUrl+"/bargain/";
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid, 180, 180,
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid+"&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
if(userType.equals(AppFromEnum.APP.getValue())){
|
||||
siteUrl = siteUrl+"/bargain/";
|
||||
QrCodeUtil.generate(siteUrl+"?bargainId="+bargainId+"&uid="+uid+"&spread="+uid+"&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else{
|
||||
QrCodeUtil.generate(siteUrl+"/activity/dargain_detail/"+bargainId+"/"+uid+"?spread="+uid, 180, 180,
|
||||
|
@ -151,9 +151,15 @@ public class StoreCombinationController extends BaseController {
|
||||
File file = FileUtil.mkdir(new File(fileDir));
|
||||
if(userType.equals(AppFromEnum.ROUNTINE.getValue())){
|
||||
siteUrl = siteUrl+"/pink/";
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid, 180, 180,
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else{
|
||||
}
|
||||
if(userType.equals(AppFromEnum.APP.getValue())){
|
||||
siteUrl = siteUrl+"/pink/";
|
||||
QrCodeUtil.generate(siteUrl+"?pinkId="+pinkId+"&spread="+uid+"&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
else{
|
||||
QrCodeUtil.generate(siteUrl+"/activity/group_rule/"+pinkId+"?spread="+uid, 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
|
@ -148,7 +148,14 @@ public class StoreProductController extends BaseController {
|
||||
//h5地址
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid, 180, 180,
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid+"&codeType="+AppFromEnum.ROUNTINE.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}
|
||||
if(userType.equals(AppFromEnum.APP.getValue())){
|
||||
//h5地址
|
||||
siteUrl = siteUrl+"/product/";
|
||||
//生成二维码
|
||||
QrCodeUtil.generate(siteUrl+"?productId="+id+"&spread="+uid+"&codeType="+AppFromEnum.APP.getValue(), 180, 180,
|
||||
FileUtil.file(fileDir+name));
|
||||
}else{//如果类型是h5
|
||||
//生成二维码
|
||||
|
Reference in New Issue
Block a user