|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -13,9 +14,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.google.zxing.BarcodeFormat;
|
|
|
+import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
|
+import com.google.zxing.common.BitMatrix;
|
|
|
+import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
+import com.zhongzheng.common.type.EncryptHandler;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.base.domain.UserProfile;
|
|
@@ -60,22 +66,21 @@ import com.zhongzheng.modules.grade.vo.UserPeriodVo;
|
|
|
import com.zhongzheng.modules.order.bo.SpecialQuestionBo;
|
|
|
import com.zhongzheng.modules.order.vo.SpecialQuestionVo;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
+import com.zhongzheng.modules.system.domain.SysTenant;
|
|
|
+import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
|
import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserPhoneBo;
|
|
|
import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
|
|
|
-import com.zhongzheng.modules.user.domain.UserBankRecord;
|
|
|
-import com.zhongzheng.modules.user.domain.UserStudyRecord;
|
|
|
-import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
|
|
|
-import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
|
-import com.zhongzheng.modules.user.service.IUserBankRecordService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserStudyRecordService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
|
+import com.zhongzheng.modules.user.domain.*;
|
|
|
+import com.zhongzheng.modules.user.service.*;
|
|
|
import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserStudyRecordPhotoVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -149,7 +154,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
@Autowired
|
|
|
private IQuestionMerchantService iQuestionMerchantService;
|
|
|
@Autowired
|
|
|
+ private ISysTenantService iSysTenantService;
|
|
|
+ @Autowired
|
|
|
+ private IUserService iUserService;
|
|
|
+ @Autowired
|
|
|
private RedisCache redisCache;
|
|
|
+ @Value("${liveGotoURL}")
|
|
|
+ private String URL_PREFIX;
|
|
|
|
|
|
|
|
|
|
|
@@ -1036,6 +1047,43 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
return baseMapper.getSpecialQuestionCount(bo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getSpecialQuestionSkipCode(Long userId) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ //缓存用户信息key
|
|
|
+ String key = String.format("KQTZ%s",userId);
|
|
|
+ User user = iUserService.getById(userId);
|
|
|
+ Long tenantId = user.getTenantId();
|
|
|
+ SysTenant sysTenant = iSysTenantService.getById(tenantId);
|
|
|
+ //课程
|
|
|
+ String h5Url = String.format("%s%s/pages/questionBank/index?skipPort=%s&sign=1", URL_PREFIX, sysTenant.getHostH5(),key);
|
|
|
+
|
|
|
+ //跳转H5码
|
|
|
+ try {
|
|
|
+ QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
|
|
+ BitMatrix bitMatrix = qrCodeWriter.encode(h5Url, BarcodeFormat.QR_CODE, 120, 120);
|
|
|
+ // 写到输出流
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
+ MatrixToImageWriter.writeToStream(bitMatrix, "jpg", outputStream);
|
|
|
+ //转换为base64
|
|
|
+ Base64.Encoder encoder1 = Base64.getEncoder();
|
|
|
+ String urlBase64 = "data:image/jpeg;base64,"
|
|
|
+ + encoder1.encodeToString(outputStream.toByteArray());
|
|
|
+ map.put("h5Base64",urlBase64);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ UserPhoneBo phoneBo = new UserPhoneBo();
|
|
|
+ phoneBo.setTelphone(EncryptHandler.decrypt(user.getTelphone()));
|
|
|
+ phoneBo.setTenantId(tenantId);
|
|
|
+ phoneBo.setIdNum(EncryptHandler.decrypt(user.getIdCard()));
|
|
|
+
|
|
|
+ //缓存用户信息
|
|
|
+ redisCache.setCacheObjectTenant(tenantId+":"+key, JSONObject.toJSONString(phoneBo), 12, TimeUnit.HOURS);
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
private Long liveTime(Long nowTime, Integer day) {
|
|
|
for (Integer i = 0; i < day; i++) {
|
|
|
Long dayAfter = DateUtils.getDayAfter(nowTime, 1);
|