yangdamao 2 жил өмнө
parent
commit
ecf6dff081

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

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