he2802 3 năm trước cách đây
mục cha
commit
8e80d7f9a9

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/ClassGradeController.java

@@ -513,6 +513,6 @@ public class ClassGradeController extends BaseController {
     public AjaxResult<Void> lockPeriodStatus(@RequestBody UserPeriodEditBo bo) {
         String key = "LockPeriod_"+bo.getGradeId()+"-"+bo.getUserId();
         String username = redisCache.getCacheObject(key);
-        return toAjax(Validator.isNotEmpty(username) ? 1 : 0);
+        return AjaxResult.success(username);
     }
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -568,6 +568,7 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         params.put("ksrq",DateUtils.timestampToDate(firstVo.getFirstStartTime()));
         params.put("jsrq",DateUtils.timestampToDate(userVo.getPeriodWaitTime()));
         String  dataTxt = params.get("zh")+params.get("bh")+params.get("xm")+params.get("sfz")+params.get("ksrq")+params.get("jsrq");
+        System.out.println(dataTxt+"学时");
         String encrypted = dataSign(dataTxt,OFFICIALPUSH_TOKEN);
         params.put("SignMsg",encrypted);
         String respone = "";

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/UserPeriodServiceImpl.java

@@ -18,8 +18,10 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
+import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
+import com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo;
 import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
@@ -93,6 +95,9 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private ClassGradeUserMapper classGradeUserMapper;
+
     @Autowired
     private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
 
@@ -285,6 +290,22 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
         objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, classGradeUser.getId());
         objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodStatus, 1);
         objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime,DateUtils.getNowTime());
+        objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodTime,DateUtils.getNowTime());
+        //判断结业
+        long nowTime = System.currentTimeMillis()/1000;
+        ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
+        queryBo.setGradeId(bo.getGradeId());
+        queryBo.setUserId(bo.getUserId());
+        ClassPeriodStudentVo classPeriodStudentVo = classGradeUserMapper.userPeriodStatus(queryBo);
+        if(Validator.isEmpty(classPeriodStudentVo.getClassStartTime())){
+            //没设置永久有效
+            objectLambdaUpdateWrapper.set(ClassGradeUser::getFinishStatus,1);
+        }
+        if(Validator.isNotEmpty(classPeriodStudentVo.getClassEndTime())&&Validator.isNotEmpty(classPeriodStudentVo.getClassStartTime())){
+            if(nowTime<classPeriodStudentVo.getClassEndTime()&&nowTime>classPeriodStudentVo.getClassStartTime()){
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getFinishStatus,1);
+            }
+        }
         iClassGradeUserService.update(null, objectLambdaUpdateWrapper);
         ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
         classGradeUserQueryBo.setUserId(bo.getUserId());