Kaynağa Gözat

报考数据绑定前培

he2802 3 yıl önce
ebeveyn
işleme
69562ec135

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

@@ -129,4 +129,15 @@ public class ScheduleController extends BaseController {
         iScheduleService.UpExamNum(bo);
         return AjaxResult.success();
     }
+
+    /**
+     * 报考数据绑定前培
+     * @return
+     */
+    @ApiOperation("报考数据绑定前培")
+    @GetMapping("/bindBefore")
+    public AjaxResult bindBefore(UserQueryBo bo){
+        iScheduleService.bindBefore(bo);
+        return AjaxResult.success();
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamBeforeMapper.java

@@ -32,4 +32,6 @@ public interface ExamBeforeMapper extends BaseMapper<ExamBefore> {
     Long verifyInfo(Long goodsId);
 
     ExamBeforeVo verifyExamBeforeVo(ExamBeforeQueryBo examBeforeQueryBo);
+
+    List<ExamBeforeVo> queryBindBefore(ExamBeforeQueryBo examBeforeQueryBo);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamBeforeVo.java

@@ -93,4 +93,7 @@ public class ExamBeforeVo {
 
 	@ApiModelProperty("商品Id")
 	private Long[] goodsId;
+
+	@ApiModelProperty("报考ID")
+	private Long subscribeId;
 }

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

@@ -40,4 +40,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
     void UpGoods(UserQueryBo bo);
 
     void UpExamNum(UserQueryBo bo);
+
+    void bindBefore(UserQueryBo bo);
 }

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

@@ -2,12 +2,14 @@ package com.zhongzheng.modules.schedule.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSON;
 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.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -19,6 +21,7 @@ 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.course.domain.CourseBusiness;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
 import com.zhongzheng.modules.exam.domain.ExamApply;
@@ -713,6 +716,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 update.setBeforeId(examBeforeVo.getBeforeId());
                 update.setStatus(2);
                 update.setUpdateTime(DateUtils.getNowTime());
+                //更新前培过期
                 examBeforeMapper.updateById(update);
             }
         }
@@ -802,6 +806,21 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         }*/
     }
 
+    @Override
+    public void bindBefore(UserQueryBo bo) {
+        List<ExamBeforeVo> list = examBeforeMapper.queryBindBefore(new ExamBeforeQueryBo());
+        if(Validator.isNotEmpty(list)){
+            for(ExamBeforeVo vo : list){
+                //报考数据绑定前培
+                LambdaUpdateWrapper<UserSubscribe> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(UserSubscribe::getSubscribeId, vo.getSubscribeId());
+                objectLambdaUpdateWrapper.set(UserSubscribe::getBeforeId, vo.getBeforeId());
+                objectLambdaUpdateWrapper.set(UserSubscribe::getUpdateTime,DateUtils.getNowTime());
+                iUserSubscribeService.update(null, objectLambdaUpdateWrapper);
+            }
+        }
+    }
+
     //获得可用学习天数
     private static int getDutyDays(Date  startDateStr, Date endDateStr,Long[] longs,Long studyDay)  {
         int result = 0;

+ 5 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -130,7 +130,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             User user = iUserService.getOne(new LambdaQueryWrapper<User>()
                     .eq(User::getIdCard,info.getIdCard()).last("limit 1"));
             if(Validator.isEmpty(user)){
-                throw new CustomException("学员:"+info.getUserName()+"-"+info.getIdCard()+"不存在没有符合导出的数据,,请先处理再继续操作");
+                throw new CustomException("学员:"+info.getIdCard()+"不存在没有符合导出的数据,,请先处理再继续操作");
             }
         }
         return list;
@@ -142,7 +142,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             User user = iUserService.getOne(new LambdaQueryWrapper<User>()
                     .eq(User::getIdCard,info.getIdCard()).last("limit 1"));
             if(Validator.isEmpty(user)){
-                throw new CustomException("学员:"+info.getUserName()+"-"+info.getIdCard()+"不存在,请先处理再继续操作");
+                throw new CustomException("学员:"+info.getIdCard()+"不存在,请先处理再继续操作");
             }
             UserSubscribe userSubscribe = this.getOne(new LambdaQueryWrapper<UserSubscribe>()
                     .eq(UserSubscribe::getSubscribeStatus,1)
@@ -150,7 +150,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                     .eq(UserSubscribe::getApplySiteAddress,bo.getApplySiteAddress())
                     .eq(UserSubscribe::getUserId,user.getUserId()).last("limit 1"));
             if(Validator.isEmpty(userSubscribe)){
-                throw new CustomException("学员:"+info.getUserName()+"-"+info.getIdCard()+"没有符合导出的数据,请先处理再继续操作");
+                throw new CustomException("学员:"+info.getIdCard()+"没有符合导出的数据,请先处理再继续操作");
             }
         }
         return bo.getList();
@@ -316,7 +316,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             }
             update.setExamStatus(bo.getExamStatus());
             update.setRemark(bo.getRemark());
-            update.setBeforeId(bo.getBeforeId());
+     //       update.setBeforeId(bo.getBeforeId());
             update.setBeforeStatus(bo.getBeforeStatus());
             if (bo.getBeforeStatus() != null && bo.getBeforeStatus().equals(1)){
                 if(Validator.isEmpty(userSubscribeVo.getBeforeStatus())||userSubscribeVo.getBeforeStatus().equals(0)){
@@ -396,7 +396,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             }
             update.setExamStatus(editBo.getExamStatus());
             update.setRemark(editBo.getRemark());
-            update.setBeforeId(editBo.getBeforeId());
+    //        update.setBeforeId(editBo.getBeforeId());
             update.setBeforeStatus(editBo.getBeforeStatus());
             if (editBo.getBeforeStatus() != null && editBo.getBeforeStatus().equals(1)){
                 if(Validator.isEmpty(userSubscribeVo.getBeforeStatus())||userSubscribeVo.getBeforeStatus().equals(0)){

+ 17 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamBeforeMapper.xml

@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="projectName" column="project_name"/>
         <result property="people" column="people"/>
         <result property="businessName" column="business_name"/>
+        <result property="subscribeId" column="subscribe_id"/>
     </resultMap>
 
 
@@ -170,4 +171,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         order by eb.create_time desc
     </select>
+
+    <select id="queryBindBefore" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultMap="ExamBeforeVo">
+        SELECT
+            us.subscribe_id,
+            b.before_id
+        FROM
+            user_subscribe us
+                LEFT JOIN exam_before_goods bg ON us.goods_id = bg.goods_id
+                LEFT JOIN exam_before b ON bg.before_id = b.before_id
+                AND b.`status` = 1
+        WHERE
+            us.subscribe_status = 1
+          AND us.exam_status = 0
+          AND us.before_id IS NULL
+          AND b.before_id > 0
+    </select>
 </mapper>