Jelajahi Sumber

搜索条件新增

change 3 tahun lalu
induk
melakukan
2be52cb5e0

+ 11 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -96,4 +96,15 @@ public class ScheduleController extends BaseController {
         iScheduleService.UpPlan(bo);
         return AjaxResult.success();
     }
+
+    /**
+     * 计划更新每晚0点更新
+     * @return
+     */
+    @ApiOperation("更新过期时间")
+    @GetMapping("/UpExam")
+    public AjaxResult UpExam(UserQueryBo bo) throws ParseException {
+        iScheduleService.UpExam(bo);
+        return AjaxResult.success();
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -34,4 +34,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
     void updateIssue(UserQueryBo bo) throws ParseException;
 
     void UpPlan(UserQueryBo bo);
+
+    void UpExam(UserQueryBo bo);
 }

+ 69 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -19,7 +19,15 @@ import com.zhongzheng.common.utils.polyv.PolyvUtils;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
+import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
+import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
+import com.zhongzheng.modules.exam.domain.ExamApply;
+import com.zhongzheng.modules.exam.domain.ExamBefore;
 import com.zhongzheng.modules.exam.domain.ExamNumber;
+import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
+import com.zhongzheng.modules.exam.mapper.ExamBeforeMapper;
+import com.zhongzheng.modules.exam.vo.ExamApplyVo;
+import com.zhongzheng.modules.exam.vo.ExamBeforeVo;
 import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
@@ -150,6 +158,12 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Autowired
     private UserPlanMapper userPlanMapper;
 
+    @Autowired
+    private ExamApplyMapper examApplyMapper;
+
+    @Autowired
+    private ExamBeforeMapper examBeforeMapper;
+
     @Value("${aliyun.sms.OpenTheGoodsCode}")
     private String OpenTheGoodsCode;
 
@@ -657,6 +671,61 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         }
     }
 
+    @Override
+    public void UpExam(UserQueryBo bo) {
+        ExamApplyQueryBo examApplyQueryBo = new ExamApplyQueryBo();
+        examApplyQueryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+        List<ExamApplyVo> examApplyVos = examApplyMapper.queryExam(examApplyQueryBo);
+        for (ExamApplyVo examApplyVo : examApplyVos) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
+            calendar.setTimeInMillis(System.currentTimeMillis());
+            if ((examApplyVo.getApplyEndTime()) < calendar.getTimeInMillis()/1000){
+                ExamApply update = new ExamApply();
+                update.setApplyId(examApplyVo.getApplyId());
+                update.setStatus(2);
+                update.setUpdateTime(DateUtils.getNowTime());
+                examApplyMapper.updateById(update);
+            }
+        }
+        ExamBeforeQueryBo examBeforeQueryBo = new ExamBeforeQueryBo();
+        examBeforeQueryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+        List<ExamBeforeVo> examBeforeVos = examBeforeMapper.queryBefore(examBeforeQueryBo);
+        for (ExamBeforeVo examBeforeVo : examBeforeVos) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
+            calendar.setTimeInMillis(System.currentTimeMillis());
+            if ((examBeforeVo.getBeforeEndTime()) < calendar.getTimeInMillis()/1000){
+                ExamBefore update = new ExamBefore();
+                update.setBeforeId(examBeforeVo.getBeforeId());
+                update.setStatus(2);
+                update.setUpdateTime(DateUtils.getNowTime());
+                examBeforeMapper.updateById(update);
+            }
+        }
+
+        UserPlanQueryBo userPlanQueryBo = new UserPlanQueryBo();
+        userPlanQueryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+        List<UserPlanVo> userPlanVos = userPlanService.queryList(userPlanQueryBo);
+        for (UserPlanVo userPlanVo : userPlanVos) {
+            UserPlan userPlan = new UserPlan();
+            userPlan.setPlanId(userPlanVo.getPlanId());
+            userPlan.setUpdateTime(DateUtils.getNowTime());
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
+            calendar.setTimeInMillis(System.currentTimeMillis());
+            if ((userPlanVo.getEndTime()) < calendar.getTimeInMillis()/1000 && userPlanVo.getStatus().equals(1)){
+                if (userPlanVo.getPitchNum().equals(userPlanVo.getStudyNum())){
+                    userPlan.setStatus(2);
+                }else {
+                    userPlan.setStatus(3);
+                }
+                userPlanMapper.updateById(userPlan);
+            }
+
+        }
+    }
+
     //获得可用学习天数
     private static int getDutyDays(Date  startDateStr, Date endDateStr,Long[] longs,Long studyDay)  {
         int result = 0;