|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.google.zxing.BarcodeFormat;
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
+import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
@@ -54,6 +55,7 @@ import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
import java.util.*;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -78,6 +80,9 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
@Autowired
|
|
|
private IUserStudyRecordService iUserStudyRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
|
|
|
@Value("${certificate.host}")
|
|
|
private String CERTIFICATE_HOST;
|
|
@@ -144,6 +149,12 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
*/
|
|
|
@Override
|
|
|
public String makeCertificatePhoto(ClassGradeUserQueryBo bo) {
|
|
|
+ String key = "Certificate-"+bo.getGoodsId()+"-"+bo.getUserId();
|
|
|
+ Long value = redisCache.getCacheObject(key);
|
|
|
+ if(Validator.isNotEmpty(value)){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ redisCache.setCacheObject(key,1L,1, TimeUnit.MINUTES);//1分钟
|
|
|
if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())){
|
|
|
throw new CustomException("数据错误");
|
|
|
}
|
|
@@ -159,8 +170,6 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
|
|
|
//获取章列表
|
|
|
List<CourseChapterVo> chapterList = iClassGradeUserService.findChapterList(bo);
|
|
|
UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
- System.out.println("培训开始时间");
|
|
|
- System.out.println(studyRecordVo.getFirstStartTime());
|
|
|
if(Validator.isNotEmpty(goodsVo.getCertificateIds())){
|
|
|
String[] s = goodsVo.getCertificateIds().split(",");
|
|
|
List<Long> tpIds = new ArrayList<>();
|