change vor 3 Jahren
Ursprung
Commit
9f39d916d0

+ 5 - 4
zhongzheng-api/src/main/java/com/zhongzheng/controller/plan/UserPlanController.java

@@ -49,8 +49,7 @@ public class UserPlanController extends BaseController {
     private final IUserPlanService iUserPlanService;
 
 
-    @Autowired
-    private WxTokenService wxTokenService;
+    private final WxTokenService wxTokenService;
     /**
      * 查询学习计划列表
      */
@@ -99,6 +98,8 @@ public class UserPlanController extends BaseController {
     @ApiOperation("获得展示的日历学习计划,不添加到数据库")
     @GetMapping("/listPlan")
     public AjaxResult<UserPlanVo> listPlan(UserPlanEditBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
         UserPlanVo list = iUserPlanService.listPlan(bo);
         return AjaxResult.success(list);
     }
@@ -106,10 +107,10 @@ public class UserPlanController extends BaseController {
     /**
      * 查询学习计划列表
      */
-  /*  @ApiOperation("查询学员拥有商品能生成学习计划的商品")
+ /*   @ApiOperation("查询学员拥有商品能生成学习计划的商品")
     @GetMapping("/listGoods")
     public TableDataInfo<GoodsVo> listGoods(UserPlanQueryBo bo) {
-        ClientLoginUser loginUser = WxTokenService.getLoginUser(ServletUtils.getRequest());
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
         List<GoodsVo> list = iUserPlanService.listGoods(bo);
         return getDataTable(list);

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -98,6 +98,10 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         ExamApply update = BeanUtil.toBean(bo, ExamApply.class);
         if (bo.getStatus() == 1){
             List<Long> contGoodsId = baseMapper.countGoods(bo.getApplyId());
+            List<ExamApplySiteVo> examApplySite = baseMapper.addressExam(bo.getApplyId(),1L);
+            if (CollectionUtils.isEmpty(examApplySite)){
+                throw new RuntimeException("请先设置考试地点和时间");
+            }
             if (CollectionUtils.isNotEmpty(contGoodsId)){
                 String goodsName ="";
                 for (Long goodsId : contGoodsId) {
@@ -107,6 +111,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                     goodsName.concat(examNumberGoodsVos.get(0).getGoodsName()+",");
                 }
                 throw new RuntimeException(goodsName+"已被其他进行中的考试计划使用,请修改,再启用");
+            }else {
+                throw new RuntimeException("请先设置适用商品");
             }
         }
         validEntityBeforeSave(update);

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserPlanServiceImpl.java

@@ -130,10 +130,10 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
      * @param bo 实体类数据
      */
     private void validEntityPlanBeforeSave(UserPlanEditBo bo){
-        //判断是否课程已被生成过课程
+        //判断是否商品已被生成过课程
         Integer rank = baseMapper.selectCountGoods(bo);
         if (rank > 0){
-            throw new IllegalArgumentException("您当前商品的拥有计划,请到计划修改上修改计划");
+            throw new IllegalArgumentException("此网课学习计划正在进行中,若想再次制定请将计划完成或删除");
         }
 
     }

+ 16 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserPlanMapper.xml

@@ -90,4 +90,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and og.pay_status in(2,3)
           and g.goods_type =1
     </select>
+    <select id="selectCountGoods" parameterType="com.zhongzheng.modules.user.bo.UserPlanEditBo"  resultType="INTEGER">
+        SELECT
+        COUNT(up.plan_id)
+        FROM
+        user_plan up
+        LEFT JOIN user_plan_goods upg ON up.plan_id = upg.plan_id
+        <if test="goodsId != null and goodsId !=''">
+            and c.source_id in
+            <foreach collection="goodsId" open="(" separator="," close=")" item="goodsId">
+                #{goodsId}
+            </foreach>
+        </if>
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+    </select>
 </mapper>