Browse Source

add 二审打回

he2802 3 years ago
parent
commit
d6fd40f801

+ 6 - 2
zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java

@@ -176,10 +176,14 @@ public class CommonController
     @PostMapping("common/rollback/period")
     public AjaxResult<Void> rollbackPeriod(@RequestBody RollBackPeriodBo bo)
     {
-        String sign = bo.getStamp().toString()+"pubilc2022";
+        /*String sign = bo.getStamp().toString()+"pubilc2022";
         if(!bo.getSign().equals(ToolsUtils.EncoderByMd5(sign))){
             return AjaxResult.error("签名错误");
-        }
+        }*/
+        UserPeriodEditBo queryBo = new UserPeriodEditBo();
+        queryBo.setRollBackPlat(2);
+        queryBo.setOrderGoodsId(bo.getOrderGoodsId());
+        iUserPeriodService.confirmRollbackPeriod(queryBo);
         return AjaxResult.success();
     }
 

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/UserPeriodEditBo.java

@@ -79,4 +79,7 @@ public class UserPeriodEditBo {
     @ApiModelProperty("订单商品ID")
     private Long orderGoodsId;
 
+    @ApiModelProperty("打回操作平台 1自有系统 2老系统")
+    private Integer rollBackPlat;
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IUserPeriodService.java

@@ -60,6 +60,8 @@ public interface IUserPeriodService extends IService<UserPeriod> {
 
 	Boolean confirmPeriod(UserPeriodEditBo bo);
 
+	Boolean confirmRollbackPeriod(UserPeriodEditBo bo);
+
 	Boolean rollbackPeriod(UserPeriodEditBo bo);
 
 	Long todayStudySectionNum(UserPeriodQueryBo bo);

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

@@ -442,6 +442,59 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
         return true;
     }
 
+    @Override
+    public Boolean confirmRollbackPeriod(UserPeriodEditBo bo) {
+        if(Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("参数错误");
+        }
+        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                .eq(ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
+                .last("limit 1"));
+        OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderGoodsId,bo.getOrderGoodsId()).last("limit 1"));
+        if(Validator.isEmpty(classGradeUser)||Validator.isEmpty(orderGoods)){
+            throw new CustomException("数据错误");
+        }
+        bo.setGoodsId(orderGoods.getGoodsId());
+        CourseEducationType educationType = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getStatus, 1).eq(CourseEducationType::getEducationName,"继续教育").last("limit 1"));
+        CourseProjectType projectType = iCourseProjectTypeService.getOne(new LambdaQueryWrapper<CourseProjectType>().eq(CourseProjectType::getStatus, 1).eq(CourseProjectType::getEducationId,educationType.getId()).eq(CourseProjectType::getProjectName,"建造师").last("limit 1"));
+        CourseBusiness business = iCourseBusinessService.getOne(new LambdaQueryWrapper<CourseBusiness>().eq(CourseBusiness::getStatus, 1).eq(CourseBusiness::getProjectId,projectType.getId()).eq(CourseBusiness::getBusinessName,"二级").last("limit 1"));
+
+        GoodsVo goodsVo = iGoodsService.queryById(bo.getGoodsId());
+        if(goodsVo.getBusinessId().longValue()!=business.getId().longValue()){
+            throw new CustomException("非继续二建无法打回");
+        }
+        //查询此人学时审核是否有权限,老系统不进行权限校验
+        if (bo.getRollBackPlat()!=2) {
+            LoginUser loginUser = SecurityUtils.getLoginUser();
+            if(!loginUser.getUser().isAdmin()){
+                if (baseMapper.selectCountConfirmPeriod(loginUser.getUser().getUserId(), bo.getGoodsId()) < 1) {
+                    throw new CustomException("您没有打回权限");
+                }
+            }
+        }
+        LambdaUpdateWrapper<ClassGradeUser> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+        objectLambdaUpdateWrapper.eq(ClassGradeUser::getId, classGradeUser.getId());
+        objectLambdaUpdateWrapper.set(ClassGradeUser::getPeriodStatus, 3);
+        objectLambdaUpdateWrapper.set(ClassGradeUser::getUpdateTime, 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, 0);
+        }
+        if (Validator.isNotEmpty(classPeriodStudentVo.getClassEndTime()) && Validator.isNotEmpty(classPeriodStudentVo.getClassStartTime())) {
+            if (nowTime < classPeriodStudentVo.getClassEndTime() && nowTime > classPeriodStudentVo.getClassStartTime()) {
+                objectLambdaUpdateWrapper.set(ClassGradeUser::getFinishStatus, 0);
+            }
+        }
+        iClassGradeUserService.update(null, objectLambdaUpdateWrapper);
+        return true;
+    }
+
     @Override
     public SyncUserCourseStudyRec syncStudyLogToOld(UserPeriodEditBo bo) {
         CourseEducationType educationType = iCourseEducationTypeService.getOne(new LambdaQueryWrapper<CourseEducationType>().eq(CourseEducationType::getStatus, 1).eq(CourseEducationType::getEducationName,"继续教育").last("limit 1"));

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodUserVo.java

@@ -132,4 +132,7 @@ public class ClassPeriodUserVo {
 
 	@ApiModelProperty("学时")
 	private Long classHours;
+
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -144,6 +144,7 @@
         <result property="goodsName" column="goods_name"/>
         <result property="className" column="class_name"/>
         <result property="classHours" column="class_hours"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
@@ -590,6 +591,7 @@
         u.id_card_img1,
         u.id_card_img2,
         cgu.period_status,
+        cgu.order_goods_id,
         (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
         class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type in (1,3) ) as exam_num,
         (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id, ubr.exam_id) FROM user_bank_record ubr  where ubr.`status` = 1 and ubr.`type` in (1,3) and ubr.report_status =1 and ubr.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.current_status=1) as record_num,