he2802 2 years ago
parent
commit
653bec743c
19 changed files with 148 additions and 36 deletions
  1. 1 1
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/common/CommonController.java
  2. 10 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java
  3. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseService.java
  4. 56 8
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java
  5. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java
  6. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamSiteMapper.java
  7. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java
  8. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamSiteService.java
  9. 22 24
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java
  10. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamSiteServiceImpl.java
  11. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamApplyUserDetailVo.java
  12. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java
  13. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderAddBo.java
  14. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Order.java
  15. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/SpecialQuestionVo.java
  16. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java
  17. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml
  18. 11 1
      zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml
  19. 9 0
      zhongzheng-system/src/main/resources/mapper/modules/exam/ExamSiteMapper.xml

+ 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);
     }
 

+ 10 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/course/CourseController.java

@@ -88,6 +88,16 @@ public class CourseController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 获取题库H5跳转码
+     */
+    @ApiOperation("获取题库H5跳转码")
+    @GetMapping("/special/question/skip/code")
+    public AjaxResult getSpecialQuestionSkipCode() {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        return AjaxResult.success(iCourseService.getSpecialQuestionSkipCode(loginUser.getUser().getUserId()));
+    }
+
     /**
      * 查询用户是否拥有(山东题库)
      */

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseService.java

@@ -21,6 +21,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 课程Service接口
@@ -108,4 +109,5 @@ public interface ICourseService extends IService<Course> {
 
     Long getSpecialQuestionCount(SpecialQuestionBo bo);
 
+	Map<String,String> getSpecialQuestionSkipCode(Long userId);
 }

+ 56 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 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.CollectionUtils;
@@ -13,9 +14,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.base.domain.UserProfile;
@@ -60,22 +66,21 @@ import com.zhongzheng.modules.grade.vo.UserPeriodVo;
 import com.zhongzheng.modules.order.bo.SpecialQuestionBo;
 import com.zhongzheng.modules.order.vo.SpecialQuestionVo;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import com.zhongzheng.modules.system.domain.SysTenant;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
+import com.zhongzheng.modules.user.bo.UserPhoneBo;
 import com.zhongzheng.modules.user.bo.UserPlanQueryBo;
-import com.zhongzheng.modules.user.domain.UserBankRecord;
-import com.zhongzheng.modules.user.domain.UserStudyRecord;
-import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
-import com.zhongzheng.modules.user.domain.UserSubscribe;
-import com.zhongzheng.modules.user.service.IUserBankRecordService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordService;
-import com.zhongzheng.modules.user.service.IUserSubscribeService;
+import com.zhongzheng.modules.user.domain.*;
+import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserStudyRecordPhotoVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.ByteArrayOutputStream;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -149,7 +154,13 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
     @Autowired
     private IQuestionMerchantService iQuestionMerchantService;
     @Autowired
+    private ISysTenantService iSysTenantService;
+    @Autowired
+    private IUserService iUserService;
+    @Autowired
     private RedisCache redisCache;
+    @Value("${liveGotoURL}")
+    private String URL_PREFIX;
 
 
 
@@ -1036,6 +1047,43 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         return baseMapper.getSpecialQuestionCount(bo);
     }
 
+    @Override
+    public Map<String, String> getSpecialQuestionSkipCode(Long userId) {
+        Map<String, String> map = new HashMap<>();
+        //缓存用户信息key
+        String key = String.format("KQTZ%s",userId);
+        User user = iUserService.getById(userId);
+        Long tenantId = user.getTenantId();
+        SysTenant sysTenant = iSysTenantService.getById(tenantId);
+        //课程
+        String h5Url = String.format("%s%s/pages/questionBank/index?skipPort=%s&sign=1", URL_PREFIX, sysTenant.getHostH5(),key);
+
+        //跳转H5码
+        try {
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            BitMatrix bitMatrix = qrCodeWriter.encode(h5Url, BarcodeFormat.QR_CODE, 120, 120);
+            // 写到输出流
+            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+            MatrixToImageWriter.writeToStream(bitMatrix, "jpg", outputStream);
+            //转换为base64
+            Base64.Encoder encoder1 = Base64.getEncoder();
+            String urlBase64 = "data:image/jpeg;base64,"
+                    + encoder1.encodeToString(outputStream.toByteArray());
+            map.put("h5Base64",urlBase64);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        UserPhoneBo phoneBo = new UserPhoneBo();
+        phoneBo.setTelphone(EncryptHandler.decrypt(user.getTelphone()));
+        phoneBo.setTenantId(tenantId);
+        phoneBo.setIdNum(EncryptHandler.decrypt(user.getIdCard()));
+
+        //缓存用户信息
+        redisCache.setCacheObjectTenant(tenantId+":"+key, JSONObject.toJSONString(phoneBo), 12, TimeUnit.HOURS);
+
+        return map;
+    }
+
     private Long liveTime(Long nowTime, Integer day) {
         for (Integer i = 0; i < day; i++) {
             Long dayAfter = DateUtils.getDayAfter(nowTime, 1);

+ 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;
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -598,6 +598,13 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             classGradeVo.setClassEndTime(update.getClassEndTime());
             sendClassSMS(classGradeVo);
         }
+        if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") &&
+                StringUtils.isNotBlank(goods.getSevenYear()) && Arrays.asList("2021","2022").contains(goods.getSevenYear())){
+            //七大员继教2021  2022年班级不开班
+            update.setClassStatus(0);
+            update.setInterfacePushId(null);
+            update.setInterfacePeriodId(null);
+        }
         this.updateById(update);
         if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") && StringUtils.isNotBlank(classGradeVo.getSevenCode())){
             List<ClassGrade> list = list(new LambdaQueryWrapper<ClassGrade>()

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderAddBo.java

@@ -108,4 +108,8 @@ public class OrderAddBo {
 
     @ApiModelProperty("旧客户ID")
     private String oldCustomerId;
+
+    /** 培训计划ID */
+    @ApiModelProperty("计划ID")
+    private Integer planId;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/Order.java

@@ -184,5 +184,7 @@ private static final long serialVersionUID=1L;
     private BigDecimal instCost;
     /** 运营类型:1代运营 2独立运营 */
     private Integer operationType;
+    /** 培训计划ID */
+    private Integer planId;
 
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/SpecialQuestionVo.java

@@ -65,4 +65,9 @@ public class SpecialQuestionVo implements Serializable {
     @ApiModelProperty("预约状态")
     private Integer subscribeStatus;
 
+    @ApiModelProperty("跳转H5")
+    private String h5Url;
+
+    private Long tenantId;
+
 }

+ 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){

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -900,6 +900,7 @@
             g.business_id,
             g.major_id,
             g.goods_name,
+            g.tenant_id,
             CONCAT( cb.business_name, cpt.project_name ) AS businessName,
             og.service_start_time,
             og.service_end_time

+ 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>