he2802 2 년 전
부모
커밋
12dbe34636

+ 9 - 3
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -946,14 +946,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             throw new CustomException("该账号不存在!");
         }
         UserPhoneBo phoneBo = JSONObject.parseObject(cacheObject.toString(), UserPhoneBo.class);
-        if(Validator.isEmpty(phoneBo.getTelphone())){
+        if(Validator.isEmpty(phoneBo.getTelphone()) && Validator.isEmpty(phoneBo.getIdNum())){
             throw new CustomException("账号不能为空");
         }
-        User user;
+        User user = null;
         if (StringUtils.isNotBlank(phoneBo.getIdNum())){
             //身份证登入
             user = baseMapper.queryUserByIdNumTenant(phoneBo.getIdNum(), phoneBo.getTenantId());
-        }else {
+        }
+        if (ObjectUtils.isNull(user)){
             user = baseMapper.queryUserByTelphoneTenant(phoneBo.getTelphone(), phoneBo.getTenantId());
         }
 
@@ -974,6 +975,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return baseMapper.getUserByTelNotTenant(telphone);
     }
 
+    @Override
+    public List<User> getUserByIdNumNotTenant(String idNum) {
+        return baseMapper.getUserByIdNumNotTenant(idNum);
+    }
+
     private Long findSubjectId(String subject){
         if(subject!=null){
             String key = "SUB_"+subject;

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/UserGoodsListBo.java

@@ -27,4 +27,5 @@ public class UserGoodsListBo implements Serializable {
     @ApiModelProperty("签名")
     @NotBlank(message = "签名不能为空")
     private String sign;
+
 }

+ 33 - 25
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -1060,13 +1060,15 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
 
     @Override
     public List<UserGoodsListVo> getUserGoodsList(UserGoodsListBo bo) {
-        if (Validator.isEmpty(bo.getTelphone())) {
-            throw new CustomException("参数错误");
+        List<User> users = null;
+        if (StringUtils.isNotBlank(bo.getIdNum())){
+            users = iUserService.getUserByIdNumNotTenant(bo.getIdNum());
+        }
+        if (CollectionUtils.isEmpty(users)){
+            users = iUserService.getUserByTelNotTenant(bo.getTelphone());
         }
-
-        List<User> users = iUserService.getUserByTelNotTenant(bo.getTelphone());
         if (CollectionUtils.isEmpty(users)) {
-            throw new CustomException("通过手机号获取用户信息失败");
+            throw new CustomException("用户信息获取有误:"+JSONObject.toJSONString(bo));
         }
         //获取用户订单商品信息
         List<UserGoodsListVo> voList = new ArrayList<>();
@@ -1079,9 +1081,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             return new ArrayList<>();
         }
 
-        String nowTime = DateUtils.getNowTime().toString()+ToolsUtils.getCharAndNumr(4);
-        voList.forEach(goodsVo -> {
+//        String nowTime = DateUtils.getNowTime().toString()+ToolsUtils.getCharAndNumr(4);
+        for (UserGoodsListVo goodsVo : voList) {
             User user = users.stream().filter(x -> x.getTenantId().equals(goodsVo.getTenantId())).findFirst().orElse(null);
+            Long tenantId = goodsVo.getTenantId();
+            //缓存用户信息key
+            String key = String.format("KQTZ%s",user.getUserId());
             //已学和未学
             Long secLong = 0L;
             Long studyLong = 0L;
@@ -1091,7 +1096,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             subjectStudyRecordQueryBo.setOrderGoodsId(goodsVo.getOrderGoodsId());
             subjectStudyRecordQueryBo.setGradeId(goodsVo.getGradeId());
             subjectStudyRecordQueryBo.setTenantId(goodsVo.getTenantId());
-            Long tenantId = goodsVo.getTenantId();
             List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubjectTenant(subjectStudyRecordQueryBo);
             for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
                 secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
@@ -1133,24 +1137,24 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
             }
             if (goodsVo.getCourseType() == 2) {
                 //题库
-                goodsVo.setToWeAppPagePath("/pages/questionBank/index?skipPort="+nowTime);
+                goodsVo.setToWeAppPagePath("/pages/questionBank/index?skipPort="+key);
             } else if (goodsVo.getCourseType() == 6) {
                 //直播
                 goodsVo.setToWeAppPagePath(String.format("/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s&skipPort=%s",
-                        goodsVo.getOrderGoodsId(), goodsVo.getGoodsId(), goodsVo.getCourseId(),nowTime));
+                        goodsVo.getOrderGoodsId(), goodsVo.getGoodsId(), goodsVo.getCourseId(),key));
             } else {
                 //视频
                 goodsVo.setToWeAppPagePath(String.format("/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s&skipPort=%s",
-                        goodsVo.getCourseId(), goodsVo.getGoodsId(), goodsVo.getOrderGoodsId(), goodsVo.getGradeId(),nowTime));
+                        goodsVo.getCourseId(), goodsVo.getGoodsId(), goodsVo.getOrderGoodsId(), goodsVo.getGradeId(),key));
             }
             UserPhoneBo phoneBo = new UserPhoneBo();
             phoneBo.setTelphone(bo.getTelphone());
             phoneBo.setTenantId(tenantId);
             phoneBo.setIdNum(bo.getIdNum());
-            //缓存用户手机号码 30分钟失效
-            redisCache.setCacheObjectTenant(tenantId+":"+nowTime, JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
 
-        });
+            //缓存用户信息
+            redisCache.setCacheObjectTenant(tenantId+":"+key, JSONObject.toJSONString(phoneBo), 12, TimeUnit.HOURS);
+        }
         return voList;
     }
 
@@ -1253,12 +1257,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         if (ObjectUtils.isNull(goods)) {
             throw new CustomException("商品不存在!");
         }
-        User user;
+        User user = null;
         if (StringUtils.isNotBlank(bo.getIdNum())){
             user = iUserService.queryUserByIdNumTenant(bo.getIdNum(), bo.getTenantId());
-        }else {
+        }
+        if (ObjectUtils.isNull(user)){
             user = iUserService.queryUserByTelphoneTenant(bo.getTelphone(), bo.getTenantId());
         }
+
         if (ObjectUtils.isNull(user)) {
             throw new CustomException("用户不存在!");
         }
@@ -1267,38 +1273,39 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         if (ObjectUtils.isNull(vo)) {
             throw new CustomException("用户没有购买该商品!");
         }
+        //缓存用户信息key
+        String key = String.format("KQTZ%s",user.getUserId());
         //商品课程
         Long courseId = 0L;
         List<Long> courseIds = iGoodsCourseService.getCourseIdsByGoodsAndTenant(bo.getGoodsId(), bo.getTenantId());
         if (CollectionUtils.isNotEmpty(courseIds) && courseIds.size() == 1) {
             courseId = courseIds.get(0);
         }
-        String nowTime = DateUtils.getNowTime().toString()+ToolsUtils.getCharAndNumr(4);
         if (bo.getSkipPort() == 1) {
             //PC端
             if (goods.getGoodsType() == 2) {
                 //题库
-                url = String.format("%sperson-center/my-bank/index?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), nowTime);
+                url = String.format("%sperson-center/my-bank/index?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), key);
             } else if (goods.getGoodsType() == 6) {
                 //直播
-                url = String.format("%sperson-center/my-live?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), nowTime);
+                url = String.format("%sperson-center/my-live?goodsId=%s&skipPort=%s", domain, vo.getGoodsId(), key);
             } else {
                 //视频
-                url = String.format("%smy-course-detail/%s?gradeId=%s&orderGoodsId=%s&skipPort=%s", domain, vo.getGoodsId(), vo.getGradeId(), vo.getOrderGoodsId(), nowTime);
+                url = String.format("%smy-course-detail/%s?gradeId=%s&orderGoodsId=%s&skipPort=%s", domain, vo.getGoodsId(), vo.getGradeId(), vo.getOrderGoodsId(), key);
             }
         } else {
             //H5
             if (goods.getGoodsType() == 2) {
                 //题库
-                url = String.format("%s/pages/questionBank/index?skipPort=%s", domainH5, nowTime);
+                url = String.format("%s/pages/questionBank/index?skipPort=%s", domainH5, key);
             } else if (goods.getGoodsType() == 6) {
                 //直播
                 url = String.format("%s/pages3/live/detail?orderGoodsId=%s&goodsId=%s&gradeId=0&courseId=%s&skipPort=%s",
-                        domainH5, vo.getOrderGoodsId(), vo.getGoodsId(), courseId, nowTime);
+                        domainH5, vo.getOrderGoodsId(), vo.getGoodsId(), courseId, key);
             } else {
                 //视频
                 url = String.format("%s/pages3/polyv/detail?id=%s&goodsId=%s&orderGoodsId=%s&gradeId=%s&skipPort=%s",
-                        domainH5, courseId, vo.getGoodsId(), vo.getOrderGoodsId(), vo.getGradeId(), nowTime);
+                        domainH5, courseId, vo.getGoodsId(), vo.getOrderGoodsId(), vo.getGradeId(), key);
             }
         }
         UserPhoneBo phoneBo = new UserPhoneBo();
@@ -1306,8 +1313,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
         phoneBo.setTenantId(bo.getTenantId());
         phoneBo.setIdNum(bo.getIdNum());
         log.info(String.format("旧系统获取商品学习中心路径:%s(url),%s(tenantId)",url,bo.getTenantId()));
-        //缓存用户手机号码 30分钟失效
-        redisCache.setCacheObjectTenant(bo.getTenantId()+":"+nowTime, JSONObject.toJSONString(phoneBo), 30, TimeUnit.MINUTES);
+
+       //缓存用户信息
+        redisCache.setCacheObjectTenant(bo.getTenantId()+":"+key, JSONObject.toJSONString(phoneBo), 12, TimeUnit.HOURS);
         return url;
     }
 

+ 6 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -1154,7 +1154,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             result.forEach(item -> {
                 String date = "yyyy-MM-dd HH:mm:ss";
                 item.setOrderTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(),date));
-                item.setCreateTime(DateUtils.timestampToDateFormat(item.getCreateTimeLong(),date));
+                item.setCreateTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(),date));
                 item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(),date));
                 //机构名称
                 SysTenant tenant = sysTenantService.getById(item.getTenantId());
@@ -1165,8 +1165,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 UserStudyRecord startRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(),item.getGradeId(),"ASC");
                 if (ObjectUtils.isNotNull(startRecord)){
                     item.setBeginTime(DateUtils.timestampToDateFormat(startRecord.getCreateTime(),date));
-                    UserStudyRecord endRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(),item.getGradeId(),"DESC");
-                    item.setApplyTime(DateUtils.timestampToDateFormat(endRecord.getCreateTime(),date));
+                    item.setApplyTime(DateUtils.timestampToDateFormat(item.getApplyTimeLong(),date));
                 }
                 //科目名称
                 if(StringUtils.isNotBlank(item.getSubjectIds())){
@@ -1174,18 +1173,17 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                     item.setMajorName(courseSubjectList.stream().filter(x -> StringUtils.isNotBlank(x.getSubjectName())).map(CourseSubject::getSubjectName).collect(Collectors.joining(",")));
                 }
                 if (ObjectUtils.isNull(item.getReportStatu())){
-
+                    item.setReportStatu(0);
+                }
+                if (ObjectUtils.isNull(item.getStudyQueueStatus())){
+                    item.setStudyQueueStatus(0);
                 }
             });
         }
         //旧系统二建/二造班级学员信息
         bo.setClassNo(bo.getOfficialName());
-//        Map<String, String> params = new HashMap<>();
         Long nowTime = DateUtils.getNowTime();
         String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
-//        params.put("stamp", nowTime.toString());
-//        params.put("sign", sign);
-//        params.put("jsonstr", JSONObject.toJSONString(bo));
         bo.setSign(sign);
         bo.setStamp(nowTime);
         JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(bo));

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassNpUserInfoVo.java

@@ -109,4 +109,6 @@ public class ClassNpUserInfoVo implements Serializable {
     /// 完成学习时间
     @ApiModelProperty("完成学习时间")
     private String applyTime;
+
+    private Long applyTimeLong;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserMapper.java

@@ -55,4 +55,7 @@ public interface UserMapper extends BaseMapper<User> {
 
     @InterceptorIgnore(tenantLine = "true")
     User queryUserByIdNumTenant(@Param("idNum") String idNum,@Param("tenantId")  Long tenantId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<User> getUserByIdNumNotTenant(@Param("idNum")String idNum);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserService.java

@@ -123,4 +123,6 @@ public interface IUserService extends IService<User> {
 
     List<User> getUserByTelNotTenant(String telphone);
 
+	List<User> getUserByIdNumNotTenant(String idNum);
+
 }

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -918,6 +918,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             cgu.official_status_time as doTimeLong,
             cgu.official_status as reportStatu,
             cgu.period_plush as studyQueueStatus,
+            cgu.period_wait_time as applyTimeLong,
             u.user_id,
             cg.grade_id,
             g.subject_ids

+ 9 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserMapper.xml

@@ -437,6 +437,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             telphone = #{telphone} AND status = 1
     </select>
 
+    <select id="getUserByIdNumNotTenant" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
+        SELECT
+            *
+        FROM
+            `user`
+        WHERE
+            id_card = #{idNum} AND status = 1
+    </select>
+
     <select id="queryUserByIdNumTenant" parameterType="map" resultMap="UserResult">
         SELECT
             *