提交 7b256207 authored 作者: 吕本才's avatar 吕本才

fix(promotion-service): 删除图片修改

上级 64c108fb
......@@ -164,10 +164,14 @@ public class TemporaryActivityPhotoDaoImpl implements TemporaryActivityPhotoDao
public void deleteListByClockId(Long clockId, Integer taskType) {
// 根据clockId 和图片类型 删除图片
temporaryActivityPhotoMapper.delete(new LambdaQueryWrapper<TemporaryActivityPhotoDO>()
LambdaQueryWrapper<TemporaryActivityPhotoDO> wrapper = new LambdaQueryWrapper<TemporaryActivityPhotoDO>()
.eq(TemporaryActivityPhotoDO::getClockId, clockId)
.eq(TemporaryActivityPhotoDO::getType, taskType)
.eq(TemporaryActivityPhotoDO::getIsDelete, StatusType.VALID.getType()));
.eq(TemporaryActivityPhotoDO::getIsDelete, StatusType.VALID.getType());
TemporaryActivityPhotoDO photodo = new TemporaryActivityPhotoDO();
photodo.setIsDelete(StatusType.INVALID.getType());
temporaryActivityPhotoMapper.update(photodo, wrapper);
}
......
......@@ -10,7 +10,6 @@ import com.wangxiaolu.promotion.domain.activity.dao.TemporaryActivityTaskClockDa
import com.wangxiaolu.promotion.domain.activity.mapper.TemporaryActivityTaskClockMapper;
import com.wangxiaolu.promotion.domain.activity.mapper.entity.TemporaryActivityTaskClockDO;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryActivityTaskWrapperDto;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryPhotoWrapper;
import com.wangxiaolu.promotion.enums.activity.ActivityClockTaskStatus;
import com.wangxiaolu.promotion.enums.activity.ActivityPhotoType;
......@@ -71,7 +70,7 @@ public class TemporaryActivityTaskClockServiceImpl extends ServiceImpl<Temporary
}
// 随机生成 下午5:30~7:30 之间的Date
LocalTime randomTime = LocalTime.of(12, 30, 0).plusMinutes(ThreadLocalRandom.current().nextInt(0, 10));
LocalTime randomTime = LocalTime.of(13, 30, 0).plusMinutes(ThreadLocalRandom.current().nextInt(0, 20));
Date randomDate = DateUtils.parseDateByLocalTime(randomTime);
// 生成
......@@ -180,10 +179,9 @@ public class TemporaryActivityTaskClockServiceImpl extends ServiceImpl<Temporary
temporaryActivityTaskClockDao.update(taskClockDO);
TemporaryClockWrapper wr = new TemporaryClockWrapper();
wr.setId(taskClockDO.getClockId());
TemporaryClockDto clockDto = clockQueryService.findClockInfo(wr);
// TemporaryClockWrapper wr = new TemporaryClockWrapper();
// wr.setId(taskClockDO.getClockId());
// TemporaryClockDto clockDto = clockQueryService.findClockInfo(wr);
TemporaryActivityPhotoDto dto = new TemporaryActivityPhotoDto();
dto.setClockId(taskClockDO.getClockId())
.setTemporaryId(taskClockDO.getTemporaryId())
......
package com.wangxiaolu.promotion.utils;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.wangxiaolu.promotion.common.constant.Constants;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
......@@ -51,7 +47,6 @@ public class WechatAccessTokenUtil {
// 过期则重新获取
String url = String.format(TOKEN_URL, appid, secret);
String response = restTemplate.getForObject(url, String.class);
log.info("获取微信access_token,url:{},response:{}",url,response);
// string 转json
JSONObject json = JSONObject.parseObject( response) ;
......@@ -60,8 +55,9 @@ public class WechatAccessTokenUtil {
int expiresIn = json.getIntValue("expires_in");
// 提前5分钟过期
expireTime = System.currentTimeMillis() + (expiresIn - 300) * 1000;
log.info("获取微信access_token,url:{},response:{}",url,response);
redisCache.addToSeconds(Constants.REDIS_ACCESS_TOKEN,accessToken,expireTime/1000);
redisCache.addToSeconds(Constants.REDIS_ACCESS_TOKEN,accessToken,expiresIn - 300);
return accessToken;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论