Browse Source

Merge remote-tracking branch 'origin/dev' into dev

fanxp 1 year ago
parent
commit
bb00ae0bc7

+ 1 - 1
src/main/java/com/xjrsoft/common/sms/SmsCtcc.java

@@ -70,7 +70,7 @@ public class SmsCtcc {
         String content = String.format("验证码为%s,有效时间为%d分钟,请勿将验证码泄露给其他人。", code, 2);
 //        JSONObject result = send(mobile, content);
 //        if (result.getInt("status") == 1) {
-//            redisUtil.set(key, code, 120L);
+            redisUtil.set(key, code, 120L);
 //        }
 //        return result;
         return null;

+ 1 - 0
src/main/java/com/xjrsoft/module/base/service/IBaseClassService.java

@@ -8,4 +8,5 @@ import java.util.List;
 
 public interface IBaseClassService extends MPJBaseService<BaseClass> {
     List<UserStudentVo> getStudents(long id);
+    UserStudentVo getClassInfo(long id);
 }

+ 26 - 0
src/main/java/com/xjrsoft/module/base/service/impl/BaseClassServiceImpl.java

@@ -24,6 +24,11 @@ public class BaseClassServiceImpl extends MPJBaseServiceImpl<BaseClassMapper, Ba
 
     private final IUserStudentService userStudentService;
 
+    /**
+     * 获取家长关联的学生 id 是家长的ID
+     * @param id
+     * @return
+     */
     public List<UserStudentVo> getStudents(long id) {
         List<Long> studentIds = userStudentService.list(Wrappers.lambdaQuery(UserStudent.class)
                         .eq(UserStudent::getUserId, id))
@@ -39,10 +44,31 @@ public class BaseClassServiceImpl extends MPJBaseServiceImpl<BaseClassMapper, Ba
                     .selectAs(BaseClass::getName, UserStudentVo::getClassName)
                     .selectAs(BaseStudentUser::getName, UserStudentVo::getStudentName)
                     .selectAs(BaseStudentUser::getId, UserStudentVo::getStudentId)
+                    .selectAs(BaseStudentSchoolRoll::getClassId, UserStudentVo::getClassId)
                     .selectAs(BaseStudentUser::getAvatar, UserStudentVo::getAvatar);
 
             list = selectJoinList(UserStudentVo.class, queryWrapper);
         }
         return list;
     }
+
+    /**
+     * 获取学生的班级信息
+     * @param id
+     * @return
+     */
+    public UserStudentVo getClassInfo(long id) {
+        MPJLambdaWrapper<BaseClass> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper
+                .disableSubLogicDel()
+                .rightJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getClassId, BaseStudent::getId)
+                .innerJoin(BaseStudentUser.class, BaseStudentUser::getId, BaseStudentSchoolRoll::getUserId)
+                .eq(BaseStudentSchoolRoll::getUserId, id)
+                .selectAs(BaseClass::getName, UserStudentVo::getClassName)
+                .selectAs(BaseStudentUser::getName, UserStudentVo::getStudentName)
+                .selectAs(BaseStudentUser::getId, UserStudentVo::getStudentId)
+                .selectAs(BaseStudentSchoolRoll::getClassId, UserStudentVo::getClassId)
+                .selectAs(BaseStudentUser::getAvatar, UserStudentVo::getAvatar);
+        return selectJoinOne(UserStudentVo.class, queryWrapper);
+    }
 }

+ 3 - 1
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.oa.controller;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -73,7 +74,8 @@ public class NewsController {
     public R box(NewsPageDto dto) {
         MPJLambdaWrapper<News> wrapper = MPJWrappers.<News>lambdaJoin()
                 .distinct()
-                .eq(News::getTypeId, dto.getType())
+                .eq(ObjectUtil.isNotEmpty(dto.getType()) && dto.getType() > 0, News::getTypeId, dto.getType())
+                .eq(ObjectUtil.isNotEmpty(dto.getClassId()) && dto.getClassId() > 0, News::getClassId, dto.getClassId())
                 .like(StrUtil.isNotBlank(dto.getKeyword()), News::getFullHead, dto.getKeyword())
                 .leftJoin(NewsRelation.class, onWrapper -> onWrapper.eq(NewsRelation::getNewsId, News::getId).eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong()))
                 .selectAs(NewsRelation::getId, NewsPageVo::getReadId)

+ 3 - 1
src/main/java/com/xjrsoft/module/oa/dto/NewsPageDto.java

@@ -17,7 +17,9 @@ import javax.validation.constraints.NotNull;
 public class NewsPageDto extends PageInput {
 
     @ApiModelProperty(value = "类型(1-新闻2-公告)")
-    @Min(value = 1, message = "类型必须大于0")
     @NotNull(message = "类型不能为空!")
     private Integer type;
+
+    @ApiModelProperty("班级(base_class)")
+    private Long classId;
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/oa/vo/NewsPageVo.java

@@ -118,4 +118,10 @@ public class NewsPageVo {
      */
     @ApiModelProperty("已读数据id,该字段有值说明已读")
     private Long readId;
+
+    /**
+     * 班级(base_class)
+     */
+    @ApiModelProperty("班级(base_class)")
+    private Long classId;
 }

+ 3 - 0
src/main/java/com/xjrsoft/module/oa/vo/NewsVo.java

@@ -60,4 +60,7 @@ public class NewsVo {
     @ApiModelProperty("备注")
     private String remark;
 
+    @ApiModelProperty("班级(base_class)")
+    private Long classId;
+
 }

+ 8 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -220,11 +220,19 @@ public class UserController {
             vo.setPosts(userPostVoList);
         }
 
+        // 家长
         List<UserStudentVo> list = baseClassService.getStudents(user.getId());
         if (list != null) {
             vo.setStudents(list);
         }
 
+        // 学生
+        UserStudentVo userStudentVo = baseClassService.getClassInfo(user.getId());
+        if (userStudentVo != null) {
+            vo.setClassId(userStudentVo.getClassId());
+            vo.setClassName(userStudentVo.getClassName());
+        }
+
         return R.ok(vo);
     }
 

+ 11 - 0
src/main/java/com/xjrsoft/module/organization/vo/UserInfoVo.java

@@ -76,6 +76,17 @@ public class UserInfoVo {
      */
     private String homePath;
 
+    /**
+     * 班级
+     */
+    private Long classId;
+
+    /**
+     * 班级名称
+     */
+
+    private String className;
+
 
     /**
      * 所有部门信息

+ 1 - 0
src/main/java/com/xjrsoft/module/organization/vo/UserStudentVo.java

@@ -8,4 +8,5 @@ public class UserStudentVo extends UserStudentUpdateDto {
     private String studentName;
     private String className;
     private String avatar;
+    private Long classId;
 }

+ 1 - 3
src/main/java/com/xjrsoft/module/personnel/controller/FaceManagementController.java

@@ -81,9 +81,7 @@ public class FaceManagementController {
     @ApiOperation(value = "根据当前用户查询人脸信息")
     @SaCheckPermission("facemanager:detail")
     public R detail() {
-        SaSession tokenSession = StpUtil.getTokenSession();
-        User user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new User());
-        FaceManagement faceManagement = faceManagementService.getOneDeep(Wrappers.lambdaQuery(FaceManagement.class).eq(FaceManagement::getUserId, user.getId()));
+        FaceManagement faceManagement = faceManagementService.getOneDeep(Wrappers.lambdaQuery(FaceManagement.class).eq(FaceManagement::getUserId, StpUtil.getLoginIdAsLong()));
         if (faceManagement == null) {
             return R.error("找不到此数据!");
         }

+ 1 - 0
src/main/resources/application-dev.yml

@@ -65,6 +65,7 @@ xjrsoft:
       - /ureport/**
       - /system/captcha    # 验证码
       - /system/imgcaptcha #图形验证码
+      - /system/loginCaptcha # 手机验证登录
       - /system/login      # 登录接口
       - /system/logout     # 登出接口
       - /camunda/**        # camunda工作台