|
|
@@ -10,6 +10,7 @@ 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.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
@@ -23,6 +24,7 @@ import com.zhongzheng.common.utils.polyv.PolyvUtils;
|
|
|
import com.zhongzheng.modules.alisms.vo.ResultBean;
|
|
|
import com.zhongzheng.modules.bank.domain.Exam;
|
|
|
import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
+import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
import com.zhongzheng.modules.base.service.IProfileTpService;
|
|
|
import com.zhongzheng.modules.base.vo.ProfileTpVo;
|
|
|
import com.zhongzheng.modules.base.vo.UserProfileVo;
|
|
|
@@ -40,6 +42,7 @@ import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseSectionVo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
|
|
|
+import com.zhongzheng.modules.exam.bo.ExamTodayRecordBo;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamApply;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamBefore;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamNumber;
|
|
|
@@ -52,8 +55,10 @@ import com.zhongzheng.modules.exam.vo.ExamNumberVo;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
|
|
|
import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
|
|
|
+import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.BankGoodsExamVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsCourseVo;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
@@ -114,6 +119,7 @@ import com.zhongzheng.modules.user.vo.*;
|
|
|
import com.zhongzheng.modules.wisdom.service.IWisdomService;
|
|
|
import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
|
import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
+import net.polyv.common.v1.util.StringUtils;
|
|
|
import net.polyv.live.v1.entity.channel.playback.LiveChannelVideoListResponse;
|
|
|
import net.polyv.live.v1.entity.channel.playback.LiveListChannelSessionInfoResponse;
|
|
|
import net.polyv.live.v1.entity.channel.playback.LiveListChannelVideoLibraryResponse;
|
|
|
@@ -265,6 +271,18 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
@Autowired
|
|
|
private ICourseSubjectService iCourseSubjectService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserExamSubscriptionService iUserExamSubscriptionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private com.zhongzheng.modules.bank.mapper.QuestionMapper QuestionMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserSpecialExamRecordService iUserSpecialExamRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IClassGradeGoodsService iClassGradeGoodsService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IWxLoginService iWxLoginService;
|
|
|
|
|
|
@@ -307,6 +325,12 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
@Value("${aliyun.sms.longNotStudyTeacherRemind}")
|
|
|
private String longNotStudyTeacherRemind;
|
|
|
|
|
|
+ @Value("${aliyun.sms.todayExamNotRecordWarn}")
|
|
|
+ private String todayExamNotRecordWarn;
|
|
|
+
|
|
|
+ @Value("${aliyun.sms.todayExamNotRecordTeachWarn}")
|
|
|
+ private String todayExamNotRecordTeachWarn;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@@ -791,6 +815,169 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void toDayExamNotRecordWarn() {
|
|
|
+ //获取订阅每日一练消息提醒的用户和商品
|
|
|
+ List<UserExamSubscription> list = iUserExamSubscriptionService
|
|
|
+ .list(new LambdaQueryWrapper<UserExamSubscription>()
|
|
|
+ .eq(UserExamSubscription::getSubscriptionStatus, 1));
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ InformRemindVo informRemindVo = informRemindService.queryById(41L);//学员提醒
|
|
|
+ //需要短信提醒的学员
|
|
|
+ Set<Long> userIds = new HashSet<>();
|
|
|
+ //需求提醒的商品集合
|
|
|
+ List<ExamTodayRecordBo> recordBos = new ArrayList<>();
|
|
|
+ for (UserExamSubscription subscription : list) {
|
|
|
+ //该商品下是否有每日一练试卷
|
|
|
+ List<BankGoodsExamVo> examVos = QuestionMapper.getBankGoodsExamList(subscription.getGoodsId());
|
|
|
+ if (examVos.stream().filter(x -> StringUtils.isNotBlank(x.getPaperName())).anyMatch(item -> item.getPaperName().equals("每日一练"))){
|
|
|
+ //查询学员当天是否打卡
|
|
|
+ int count = iUserSpecialExamRecordService.count(new LambdaQueryWrapper<UserSpecialExamRecord>()
|
|
|
+ .eq(UserSpecialExamRecord::getGoodsId, subscription.getGoodsId())
|
|
|
+ .eq(UserSpecialExamRecord::getUserId, subscription.getUserId())
|
|
|
+ .eq(UserSpecialExamRecord::getRecordTime, DateUtils.getTodayZeroTime()));
|
|
|
+ if (count > 0){
|
|
|
+ //已有打卡记录
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ExamTodayRecordBo bo = new ExamTodayRecordBo();
|
|
|
+ bo.setGoodsId(subscription.getGoodsId());
|
|
|
+ bo.setUserId(subscription.getUserId());
|
|
|
+ recordBos.add(bo);
|
|
|
+ Goods goods = iGoodsService.getById(subscription.getGoodsId());
|
|
|
+ if (informRemindVo.getWayStatus().equals(1)) {
|
|
|
+ //站内信
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(subscription.getUserId());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(41L);
|
|
|
+ informUserAddBo.setSystemStatus(1);
|
|
|
+ informUserAddBo.setRemind("您开通的课程今天每日一练没有打卡,请尽快去学习吧");
|
|
|
+ informUserAddBo.setGoodsId(subscription.getGoodsId());
|
|
|
+ informUserAddBo.setText("您开通《"+goods.getGoodsName()+"》今天每日一练还没有打卡,为了你的学习效果,请尽快去学习吧");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ if (informRemindVo.getNoteStatus().equals(1)) {
|
|
|
+ userIds.add(subscription.getUserId());
|
|
|
+
|
|
|
+ }
|
|
|
+ if (informRemindVo.getGzhTpStatus().equals(1)) {
|
|
|
+ //公众号
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(subscription.getUserId());
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(41L);
|
|
|
+ informUserAddBo.setSystemStatus(4);
|
|
|
+ informUserAddBo.setRemind("您开通的课程今天每日一练没有打卡,请尽快去学习吧");
|
|
|
+ informUserAddBo.setGoodsId(subscription.getGoodsId());
|
|
|
+ informUserAddBo.setText("今天每日一练还没有打卡,为了你的学习效果,请尽快去学习吧");
|
|
|
+ UserVo userVo = iUserService.queryById(subscription.getUserId());
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ if(Validator.isNotEmpty(userVo.getOpenId())){
|
|
|
+ Map<String,String> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("first","今天每日一练还没有打卡,为了你的学习效果,请尽快去学习吧");
|
|
|
+ paramMap.put("keyword1",goods.getGoodsName());
|
|
|
+ paramMap.put("keyword2","未打卡");
|
|
|
+ paramMap.put("pagepath","");
|
|
|
+ iWxLoginService.sendSmallTpMsg(userVo.getOpenId(),paramMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //学员短信提醒
|
|
|
+ if (!CollectionUtils.isEmpty(userIds)){
|
|
|
+ userIds.forEach(item -> {
|
|
|
+ //短信
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(item);
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(41L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("您开通的课程今天每日一练没有打卡,请尽快去学习吧");
|
|
|
+ informUserAddBo.setText("今天每日一练还没有打卡,为了你的学习效果,请尽快去学习吧");
|
|
|
+ UserVo userVo = iUserService.queryById(item);
|
|
|
+ if (Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(),"", todayExamNotRecordWarn))) {
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //教务提醒
|
|
|
+ if (!CollectionUtils.isEmpty(recordBos)){
|
|
|
+ InformRemindVo informRemindTeachVo = informRemindService.queryById(43L);//老师提醒
|
|
|
+ Map<Long, List<ExamTodayRecordBo>> map = recordBos.stream().collect(Collectors.groupingBy(ExamTodayRecordBo::getGoodsId));
|
|
|
+ map.forEach((k,v) -> {
|
|
|
+ //获取班主任信息
|
|
|
+ List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService
|
|
|
+ .list(new LambdaQueryWrapper<ClassGradeGoods>()
|
|
|
+ .eq(ClassGradeGoods::getGoodsId, k));
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(gradeGoods)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<ClassGrade> grades = iClassGradeService.
|
|
|
+ list(new LambdaQueryWrapper<ClassGrade>()
|
|
|
+ .in(ClassGrade::getGradeId, gradeGoods.stream().map(ClassGradeGoods::getGradeId).collect(Collectors.toList()))
|
|
|
+ .eq(ClassGrade::getStatus, 1));
|
|
|
+ List<ClassGrade> gradeList = grades.stream().filter(x -> ObjectUtils.isNotNull(x.getSysUserId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(gradeList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getById(k);
|
|
|
+ for (ClassGrade classGrade : gradeList) {
|
|
|
+ if (informRemindTeachVo.getWayStatus().equals(1)) {
|
|
|
+ //站内信
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(classGrade.getSysUserId());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(43L);
|
|
|
+ informUserAddBo.setSystemStatus(2);
|
|
|
+ informUserAddBo.setRemind("学员学习提醒,请尽快处理");
|
|
|
+ informUserAddBo.setGoodsId(k);
|
|
|
+ informUserAddBo.setText("有"+v.size()+"个学员,开通《"+goods.getGoodsName()+"》今天每日一练还没有打卡,请后台查看未打卡学员信息,尽快与学员沟通");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ if (informRemindTeachVo.getNoteStatus().equals(1)) {
|
|
|
+ SysUser sysUser = iSysUserService.getById(classGrade.getSysUserId());
|
|
|
+ if (StringUtils.isBlank(sysUser.getPhonenumber())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //短信
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(classGrade.getSysUserId());
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(43L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("学员学习提醒,请尽快处理");
|
|
|
+ informUserAddBo.setText("有"+v.size()+"个学员,开通《"+goods.getGoodsName()+"》今天每日一练还没有打卡,请后台查看未打卡学员信息,尽快与学员沟通");
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("num", v.size());
|
|
|
+ param.put("goodsName", goods.getGoodsName());
|
|
|
+ if (Validator.isNotEmpty(IAliSmsService.sendInformSms(sysUser.getPhonenumber(),JSON.toJSONString(param), todayExamNotRecordWarn))) {
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void closeTimeOutOrder() {
|
|
|
OrderQueryBo bo = new OrderQueryBo();
|