Jelajahi Sumber

预约考试地点展示

change 4 tahun lalu
induk
melakukan
b9cc50e113

+ 17 - 9
zhongzheng-api/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java

@@ -5,14 +5,14 @@ import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.service.IExamApplyGoodsService;
 import com.zhongzheng.modules.exam.service.IExamApplyService;
 import com.zhongzheng.modules.exam.service.IExamApplySiteService;
-import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
-import com.zhongzheng.modules.exam.vo.ExamApplyVo;
-import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
-import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
+import com.zhongzheng.modules.exam.vo.*;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -40,12 +40,16 @@ public class ExamApplyController extends BaseController {
 
     private final IExamApplyGoodsService iExamApplyGoodsService;
 
+    private final WxTokenService wxTokenService;
+
     /**
      * 获取考试安排详细信息
      */
     @ApiOperation("点击预约报考按钮")
     @GetMapping("/subscribe")
     public AjaxResult<ExamUserApplyVo> subscribe(ExamApplyQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
         ExamUserApplyVo examUserApplyVo = iExamApplyService.subscribe(bo);
         return AjaxResult.success(examUserApplyVo);
     }
@@ -56,6 +60,8 @@ public class ExamApplyController extends BaseController {
     @ApiOperation("预约报考下一步按钮 1 进入有前陪有考试地点得预约考试  2进入无前陪有考试地点预约考试 3无考试次数购买商品")
     @GetMapping("/subscribeNext")
     public AjaxResult<Long> subscribeNext(ExamApplyQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
         Long count = iExamApplyService.subscribeNext(bo);
         return AjaxResult.success(count);
     }
@@ -64,12 +70,14 @@ public class ExamApplyController extends BaseController {
     /**
      * 获取考试安排详细信息
      */
-/*    @ApiOperation("预约报考下一步按钮 1 进入有前陪有考试地点得预约考试  2进入无前陪有考试地点预约考试 3无考试次数购买商品")
-    @GetMapping("/subscribeNext")
-    public AjaxResult<Long> subscribeNext(ExamApplyQueryBo bo) {
-        Long count = iExamApplyService.subscribeNext(bo);
+    @ApiOperation("获得考试的考试地点")
+    @GetMapping("/subscribeApplySite")
+    public AjaxResult<List<ExamUserApplySiteVo>> subscribeApplySite(ExamApplyQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        List<ExamUserApplySiteVo> count = iExamApplyService.subscribeApplySite(bo);
         return AjaxResult.success(count);
-    }*/
+    }
 
 
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -46,4 +46,8 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
     Integer residueSubscribeNext(ExamApplyQueryBo bo);
 
     Integer beforeSubscribeNext(ExamApplyQueryBo bo);
+
+    List<ExamUserApplySiteVo> subscribeApplySite(ExamApplyQueryBo bo);
+
+    List<ExamUserApplySiteTimeVo> subscribeApplySiteTime(Long id);
 }

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

@@ -2,14 +2,11 @@ package com.zhongzheng.modules.exam.service;
 
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
 import com.zhongzheng.modules.exam.domain.ExamApply;
-import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
-import com.zhongzheng.modules.exam.vo.ExamApplyVo;
+import com.zhongzheng.modules.exam.vo.*;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamApplyAddBo;
 import com.zhongzheng.modules.exam.bo.ExamApplyEditBo;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
-import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 
 import java.util.Collection;
 import java.util.List;
@@ -63,4 +60,6 @@ public interface IExamApplyService extends IService<ExamApply> {
 	ExamUserApplyVo subscribe(ExamApplyQueryBo bo);
 
     Long subscribeNext(ExamApplyQueryBo bo);
+
+    List<ExamUserApplySiteVo> subscribeApplySite(ExamApplyQueryBo bo);
 }

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

@@ -2,11 +2,13 @@ package com.zhongzheng.modules.exam.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
 import com.zhongzheng.modules.exam.vo.*;
+import com.zhongzheng.modules.user.vo.CalendarStudyVo;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -207,4 +209,19 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         }
         return 2L;
     }
+
+    @Override
+    public List<ExamUserApplySiteVo> subscribeApplySite(ExamApplyQueryBo bo) {
+        List<ExamUserApplySiteVo> examUserApplySiteVos= baseMapper.subscribeApplySite(bo);
+        //获得详细地址查看是否满员
+        for (ExamUserApplySiteVo examUserApplySiteVo : examUserApplySiteVos) {
+            List<ExamUserApplySiteTimeVo> examApplySiteTime = baseMapper.subscribeApplySiteTime(examUserApplySiteVo.getId());
+            for (ExamUserApplySiteTimeVo examUserApplySiteTimeVo : examApplySiteTime) {
+                List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVos = JSONObject.parseArray(examUserApplySiteTimeVo.getSiteTime(), ExamApplySiteTimeTwoVo.class);
+                examUserApplySiteTimeVo.setExamApplySiteTimeTwoVo(examApplySiteTimeTwoVos);
+            }
+            examUserApplySiteVo.setExamUserApplySiteTime(examApplySiteTime);
+        }
+        return examUserApplySiteVos;
+    }
 }

+ 5 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplySiteTimeTwoVo.java

@@ -17,11 +17,14 @@ public class ExamApplySiteTimeTwoVo {
 
 
     @ApiModelProperty("开始时间")
-    private Long startTime;
+    private String startTime;
     /** 更新时间 */
     @ApiModelProperty("结束时间")
-    private Long endTime;
+    private String endTime;
 
     @ApiModelProperty("人数上限")
     private Long num;
+
+    @ApiModelProperty("报名人数")
+    private Long registration;
 }

+ 44 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamUserApplySiteTimeVo.java

@@ -0,0 +1,44 @@
+package com.zhongzheng.modules.exam.vo;
+
+import com.zhongzheng.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 考试安排地点绑定时间视图对象 mall_package
+ *
+ * @author ruoyi
+ * @date 2021-12-07
+ */
+@Data
+@ApiModel("考试安排地点绑定时间视图对象")
+public class ExamUserApplySiteTimeVo {
+	private static final long serialVersionUID = 1L;
+
+	/** $pkColumn.columnComment */
+	@ApiModelProperty("$pkColumn.columnComment")
+	private Long id;
+
+	/** $column.columnComment */
+	@Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+	@ApiModelProperty("$column.columnComment")
+	private Long applySiteId;
+	/** 时间的json */
+	@Excel(name = "时间的json")
+	@ApiModelProperty("时间的json")
+	private String siteTime;
+	/** 考试日期 */
+	@Excel(name = "考试日期")
+	@ApiModelProperty("考试日期")
+	private Long examTime;
+
+	/** 考试日期 */
+	@Excel(name = "选择考试时间段")
+	@ApiModelProperty("选择考试时间段")
+	private List<ExamApplySiteTimeTwoVo> examApplySiteTimeTwoVo;
+
+}

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamUserApplySiteVo.java

@@ -46,5 +46,5 @@ public class ExamUserApplySiteVo {
 	private Long people;
 
 	@ApiModelProperty("考试地点时间")
-	private List<ExamApplySiteTimeVo> examApplySiteTime;
+	private List<ExamUserApplySiteTimeVo> examUserApplySiteTime;
 }

+ 7 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -282,11 +282,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
      */
     private void validEntityBeforeSave(Goods entity){
         //TODO 做一些数据校验,如唯一约束
-        if(entity.getStatus()==0&&entity.getGoodsStatus()==1){
-            throw new CustomException("无效商品不允许上架");
-        }
-        if((entity.getValidityEndTime()<DateUtils.getNowTime())&&entity.getGoodsStatus()==1){
-            throw new CustomException("过期商品不允许上架");
+        if (entity.getStatus() !=-1) {
+            if (entity.getStatus() == 0 && entity.getGoodsStatus() == 1) {
+                throw new CustomException("无效商品不允许上架");
+            }
+            if ((entity.getValidityEndTime() < DateUtils.getNowTime()) && entity.getGoodsStatus() == 1) {
+                throw new CustomException("过期商品不允许上架");
+            }
         }
     }
 

+ 31 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -64,6 +64,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="siteAddress" column="site_address"/>
         <result property="people" column="people"/>
     </resultMap>
+    <resultMap type="com.zhongzheng.modules.exam.vo.ExamUserApplySiteVo" id="ExamUserApplySiteVo">
+        <result property="id" column="id"/>
+        <result property="siteId" column="site_id"/>
+        <result property="applyId" column="apply_id"/>
+        <result property="status" column="status"/>
+        <result property="siteAddress" column="site_address"/>
+        <result property="people" column="people"/>
+    </resultMap>
 
     <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplySiteTimeVo" id="ExamApplySiteTimeVo">
         <result property="id" column="id"/>
@@ -72,6 +80,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="examTime" column="exam_time"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.exam.vo.ExamUserApplySiteTimeVo" id="ExamUserApplySiteTimeVo">
+        <result property="id" column="id"/>
+        <result property="applySiteId" column="apply_site_id"/>
+        <result property="siteTime" column="site_time"/>
+        <result property="examTime" column="exam_time"/>
+    </resultMap>
+
     <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo" resultMap="ExamNumberGoodsVoResult">
         SELECT
         goods_id,
@@ -286,4 +301,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             ebg.goods_id =3
           and eb.`status`=1
     </select>
+
+    <select id="subscribeApplySite" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultMap="ExamUserApplySiteVo">
+        SELECT
+            eas.apply_id,
+            eas.id,
+            es.*
+        FROM
+            exam_apply_site eas
+                LEFT JOIN exam_site es ON es.site_id = eas.site_id
+        WHERE
+            eas.apply_id = #{applyId}
+    </select>
+
+    <select id="subscribeApplySiteTime" parameterType="Long" resultMap="ExamUserApplySiteTimeVo">
+        SELECT * FROM exam_apply_site_time east where east.apply_site_id = #{id}
+    </select>
 </mapper>