yangdamao 2 жил өмнө
parent
commit
2295cf52e8

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

@@ -352,7 +352,7 @@ public class CommonController extends BaseController {
     @ApiOperation("获取某场考试信息")
     @PostMapping("common/apply/detail")
     public AjaxResult examApplyDetail(@RequestBody ExamApplyDetailBo bo) {
-        List<ExamApplyDetailVo> voList = iExamApplyService.examApplyDetail(bo);
+        ExamApplyDetailVo voList = iExamApplyService.examApplyDetail(bo);
         return AjaxResult.success(voList);
     }
 

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

@@ -94,4 +94,7 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
     UserSubscribe getHaveSubscribe(ExamApplyQueryBo queryBo);
 
     List<UserProfile> getUserProfileList(@Param("idCard") String idCard,@Param("businessName") String businessName,@Param("post") String post);
+
+    @InterceptorIgnore(tenantLine = "true")
+    ExamApply getEntityById(Long applyId);
 }

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

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.exam.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.modules.exam.domain.ExamSite;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -12,4 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface ExamSiteMapper extends BaseMapper<ExamSite> {
 
     Integer selectCountSite(Long siteId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    ExamSite getEntityById(Long siteId);
 }

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

@@ -90,7 +90,7 @@ public interface IExamApplyService extends IService<ExamApply> {
 
 	void examApplyResult(ExamApplyResultBo bo);
 
-    List<ExamApplyDetailVo> examApplyDetail(ExamApplyDetailBo bo);
+    ExamApplyDetailVo examApplyDetail(ExamApplyDetailBo bo);
 
 	ExamBeforeKnowVo getBeforeKnow();
 

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamSiteService.java

@@ -52,4 +52,6 @@ public interface IExamSiteService extends IService<ExamSite> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    ExamSite getEntityById(Long siteId);
 }

+ 22 - 24
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -969,34 +969,32 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
     }
 
     @Override
-    public List<ExamApplyDetailVo> examApplyDetail(ExamApplyDetailBo bo) {
+    public ExamApplyDetailVo examApplyDetail(ExamApplyDetailBo bo) {
         List<ExamApplyDetailVo> vo = baseMapper.getExamInfo(bo);
         if (CollectionUtils.isEmpty(vo)){
-            return new ArrayList<>();
+            return new ExamApplyDetailVo();
         }
+        ExamApplyDetailVo detailVo = vo.stream().findFirst().get();
         //获取考试学员
-        vo.forEach(item -> {
-            //考场名称和考试名称
-            ExamSite site = iExamSiteService.getById(item.getSiteId());
-            if (ObjectUtils.isNotNull(site)){
-                item.setSiteName(site.getSiteAddress());
-            }
-            ExamApply examApply = getById(item.getApplyId());
-            if (ObjectUtils.isNotNull(examApply)){
-                item.setApplyName(examApply.getApplyName());
-            }
-            List<ExamApplyUserDetailVo> examUserInfo = baseMapper.getExamUserInfo(item);
-            if (CollectionUtils.isNotEmpty(examUserInfo)){
-                examUserInfo.forEach(user -> {
-                    //身份证隐藏
-                    String decrypt = EncryptHandler.decrypt(user.getIdCard());
-//                    String content = decrypt.replaceAll("(\\d{4})\\d{10}(\\w{4})", "$1****$2");
-                    user.setIdCard(decrypt);
-                });
-                item.setUserDetailVos(examUserInfo);
-            }
-        });
-        return vo;
+        //考场名称和考试名称
+        ExamSite site = iExamSiteService.getEntityById(detailVo.getSiteId());
+        if (ObjectUtils.isNotNull(site)){
+            detailVo.setSiteName(site.getSiteAddress());
+        }
+        ExamApply examApply = baseMapper.getEntityById(detailVo.getApplyId());
+        if (ObjectUtils.isNotNull(examApply)){
+            detailVo.setApplyName(examApply.getApplyName());
+        }
+        List<ExamApplyUserDetailVo> examUserInfo = baseMapper.getExamUserInfo(detailVo);
+        if (CollectionUtils.isNotEmpty(examUserInfo)){
+            examUserInfo.forEach(user -> {
+                //身份证隐藏
+                String decrypt = EncryptHandler.decrypt(user.getIdCard());
+                user.setIdCard(decrypt);
+            });
+            detailVo.setUserDetailVos(examUserInfo);
+        }
+        return detailVo;
     }
 
     @Override

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamSiteServiceImpl.java

@@ -156,4 +156,9 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteMapper, ExamSite> i
         }
         return this.removeByIds(ids);
     }
+
+    @Override
+    public ExamSite getEntityById(Long siteId) {
+        return baseMapper.getEntityById(siteId);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyUserDetailVo.java

@@ -17,4 +17,6 @@ public class ExamApplyUserDetailVo implements Serializable {
     private Integer seatNum;
     @ApiModelProperty("身份证")
     private String idCard;
+    @ApiModelProperty("头像")
+    private String imageUrl;
 }

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

@@ -774,7 +774,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         }
 
         //考试前7个工作日不可取消预约
-        Long examTime = update.getApplySiteExamTime();
+        Long examTime = userSubscribeVo.getApplySiteExamTime();
         //向前推7个工作日
         Long applyEndTime = getApplyEndTime(examTime, 7);
         if (DateUtils.getNowTime() >= applyEndTime){

+ 11 - 1
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -299,6 +299,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and us.order_goods_id = #{orderGoodsId}
     </select>
 
+    <select id="getEntityById" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.exam.domain.ExamApply">
+        SELECT
+            *
+        FROM
+            exam_apply
+        WHERE
+            apply_id = #{applyId}
+    </select>
+
     <select id="getUserProfileList" parameterType="java.lang.String" resultType="com.zhongzheng.modules.base.domain.UserProfile">
         SELECT
             up.*
@@ -612,7 +621,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
             us.seat_number AS seatNum,
             u.realname AS userName,
-            u.id_card AS idCard
+            u.id_card AS idCard,
+            u.avatar
         FROM
             user_subscribe us
                 LEFT JOIN `user` u ON us.user_id = u.user_id

+ 9 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamSiteMapper.xml

@@ -28,4 +28,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             eas.site_id = #{siteId}
           AND ea.`status` != -1
     </select>
+
+    <select id="getEntityById" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.exam.domain.ExamSite">
+        SELECT
+           *
+        FROM
+            exam_site
+        WHERE
+            site_id = #{siteId}
+    </select>
 </mapper>