change 3 lat temu
rodzic
commit
2737022a77

+ 12 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamBeforeController.java

@@ -6,6 +6,7 @@ import java.util.Arrays;
 import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.service.IExamBeforeGoodsService;
 import com.zhongzheng.modules.exam.service.IExamBeforeUrlService;
+import com.zhongzheng.modules.exam.vo.ExamApplyVo;
 import com.zhongzheng.modules.exam.vo.ExamBeforeUrlVo;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
 import lombok.RequiredArgsConstructor;
@@ -127,4 +128,15 @@ public class ExamBeforeController extends BaseController {
         return toAjax(iExamBeforeGoodsService.insertByAddBo(bo) ? 1 : 0);
     }
 
+    /**
+     * 获取考试地点 考培地点
+     */
+    @ApiOperation("查看前陪绑定商品")
+    @PreAuthorize("@ss.hasPermi('system:apply:query')")
+    @GetMapping("/goodsInfo")
+    public AjaxResult<ExamBeforeVo> getGoodsInfo(ExamBeforeQueryBo bo) {
+        ExamBeforeVo examBeforeVo = iExamBeforeService.getGoodsInfo(bo);
+        return  AjaxResult.success(examBeforeVo);
+    }
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/ExamBeforeQueryBo.java

@@ -37,6 +37,9 @@ public class ExamBeforeQueryBo extends BaseEntity {
 	private String isAsc;
 
 
+	/** 前陪ID */
+	@ApiModelProperty("前陪ID")
+	private Long beforeId;
 	/** 编码 */
 	@ApiModelProperty("编码")
 	private String code;

+ 3 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamBeforeService.java

@@ -1,11 +1,8 @@
 package com.zhongzheng.modules.exam.service;
 
-import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
+import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.domain.ExamBefore;
 import com.zhongzheng.modules.exam.vo.ExamBeforeVo;
-import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
-import com.zhongzheng.modules.exam.bo.ExamBeforeAddBo;
-import com.zhongzheng.modules.exam.bo.ExamBeforeEditBo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
 
@@ -53,4 +50,6 @@ public interface IExamBeforeService extends IService<ExamBefore> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     List<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo);
+
+    ExamBeforeVo getGoodsInfo(ExamBeforeQueryBo bo);
 }

+ 16 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamBeforeServiceImpl.java

@@ -3,16 +3,13 @@ package com.zhongzheng.modules.exam.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
+import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
-import com.zhongzheng.modules.exam.bo.ExamBeforeAddBo;
-import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
-import com.zhongzheng.modules.exam.bo.ExamBeforeEditBo;
 import com.zhongzheng.modules.exam.domain.ExamBefore;
 import com.zhongzheng.modules.exam.mapper.ExamBeforeMapper;
 import com.zhongzheng.modules.exam.vo.ExamBeforeVo;
@@ -111,4 +108,19 @@ public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBef
     public List<ExamNumberGoodsVo> listGoods(ExamNumberGoodsQueryBo bo) {
         return baseMapper.listGoods(bo);
     }
+
+    @Override
+    public ExamBeforeVo getGoodsInfo(ExamBeforeQueryBo bo) {
+        ExamBeforeVo examBeforeVo = baseMapper.selectByBefore(bo.getBeforeId());
+        List<ExamNumberGoodsVo> examNumberGoodsVos = baseMapper.examNumberGoodsVos(bo.getBeforeId());
+        examBeforeVo.setExamNumberGoods(examNumberGoodsVos);
+        //初始化需要得到的数组
+        Long[] array = new Long[examNumberGoodsVos.size()];
+        //使用for循环得到数组
+        for(int i = 0; i < examNumberGoodsVos.size();i++){
+            array[i] = examNumberGoodsVos.get(i).getGoodsId();
+        }
+        examBeforeVo.setGoodsId(array);
+        return examBeforeVo;
+    }
 }

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

@@ -78,8 +78,9 @@ public class ExamBeforeVo {
 	@ApiModelProperty("项目ID")
 	private Long projectId;
 
-	/** 链接地址 */
-	@Excel(name = "商品ID")
-	@ApiModelProperty("商品ID")
+	@ApiModelProperty("商品")
 	private List<ExamNumberGoodsVo> examNumberGoods;
+
+	@ApiModelProperty("商品Id")
+	private Long[] goodsId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserPlanEditBo.java

@@ -72,5 +72,9 @@ public class UserPlanEditBo {
     @ApiModelProperty("已学习节数")
     private Long studyNum;
 
+    /** 生成计划的课程 */
+    @ApiModelProperty("生成计划的课程")
+    private Long[] courseId;
+
 
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserPlanMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.user.mapper;
 
+import com.zhongzheng.modules.user.bo.UserPlanEditBo;
 import com.zhongzheng.modules.user.domain.UserPlan;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -11,4 +12,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface UserPlanMapper extends BaseMapper<UserPlan> {
 
+    Integer selectCountCourse(UserPlanEditBo bo);
 }

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

@@ -1,6 +1,8 @@
 package com.zhongzheng.modules.user.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 com.zhongzheng.common.utils.DateUtils;
 import org.springframework.stereotype.Service;
@@ -16,6 +18,7 @@ import com.zhongzheng.modules.user.mapper.UserPlanMapper;
 import com.zhongzheng.modules.user.vo.UserPlanVo;
 import com.zhongzheng.modules.user.service.IUserPlanService;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -109,6 +112,21 @@ public class UserPlanServiceImpl extends ServiceImpl<UserPlanMapper, UserPlan> i
 
     @Override
     public UserPlanVo listPlan(UserPlanEditBo bo) {
+
         return null;
     }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param bo 实体类数据
+     */
+    private void validEntityPlanBeforeSave(UserPlanEditBo bo){
+        //判断是否课程已被生成过课程
+        Integer rank = baseMapper.selectCountCourse(bo);
+        if (rank > 0){
+            throw new IllegalArgumentException("您当前有课程的计划,请到计划修改上修改计划");
+        }
+
+    }
 }

+ 14 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserPlanMapper.xml

@@ -21,5 +21,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="studyNum" column="study_num"/>
     </resultMap>
 
-
+    <select id="selectCountCourse" parameterType="com.zhongzheng.modules.user.bo.UserPlanEditBo"  resultType="int">
+        SELECT COUNT(c.source_id)
+        FROM user_plan_cource c LEFT JOIN user_plan u ON u.plan_id = c.plan_id
+        WHERE 1=1 and u.status=1
+        <if test="courseId != null and courseId !=''">
+            and c.source_id in
+            <foreach collection="courseId" open="(" separator="," close=")" item="courseId">
+                #{courseId}
+            </foreach>
+        </if>
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+    </select>
 </mapper>