瀏覽代碼

1、系统消息增加个人列表
2、未读数量增加系统消息未读数量

dzx 1 年之前
父節點
當前提交
366541961e

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

@@ -7,8 +7,10 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -26,6 +28,10 @@ import com.xjrsoft.module.oa.vo.*;
 import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.organization.mapper.DepartmentMapper;
 import com.xjrsoft.module.system.entity.File;
+import com.xjrsoft.module.system.entity.SystemUpdateMessage;
+import com.xjrsoft.module.system.entity.SystemUpdateMessageNotice;
+import com.xjrsoft.module.system.service.ISystemUpdateMessageService;
+import com.xjrsoft.module.system.vo.SystemUpdateMessagePageVo;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -55,6 +61,7 @@ public class NewsController {
 
     private DepartmentMapper departmentMapper;
     private INewsRelationConfigService newsRelationConfigService;
+    private final ISystemUpdateMessageService systemUpdateMessageService;
 
     @GetMapping
     @ApiOperation(value = "获取新闻分页")
@@ -450,7 +457,17 @@ public class NewsController {
                 .eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong())
                 .inSql(NewsRelation::getNewsId, "select id from xjr_oa_news where delete_mark = 0 and type_id = 2 and status = 2 and (send_range = 2 or send_range = 3) AND (send_end_date > '" + LocalDateTime.now() + "' OR send_end_date IS NULL)"));
 
-        Long notReadCount = notReadCountNews + notReadCountProclamationToAll + notReadCountProclamation;
+        //公告发给非全体的
+        long systemUpdateMessageCount = systemUpdateMessageService.count(
+                MPJWrappers.<SystemUpdateMessage>lambdaJoin()
+                        .leftJoin(SystemUpdateMessageNotice.class, SystemUpdateMessageNotice::getSystemUpdateMessageId, SystemUpdateMessage::getId)
+                        .eq(SystemUpdateMessageNotice::getUserId, StpUtil.getLoginIdAsLong())
+                        .eq(SystemUpdateMessage::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(SystemUpdateMessage::getStatus, 1)
+                        .eq(SystemUpdateMessageNotice::getStatus, 0)
+        );
+
+        Long notReadCount = notReadCountNews + notReadCountProclamationToAll + notReadCountProclamation + systemUpdateMessageCount;
         return RT.ok(notReadCount);
     }
 }

+ 128 - 2
src/main/java/com/xjrsoft/module/student/service/impl/StudentManagerServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.mapper.BaseClassMapper;
@@ -30,12 +31,19 @@ import com.xjrsoft.module.student.service.IStudentManagerService;
 import com.xjrsoft.module.student.vo.BaseStudentClassVo;
 import com.xjrsoft.module.student.vo.PersonalPortraitPersonalInfoVo;
 import com.xjrsoft.module.student.vo.StudentPersonalInfoVo;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.system.entity.DictionaryItem;
+import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -53,6 +61,8 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
     private final BaseStudentSubsidizeMapper studentbaseManagerBaseStudentSubsidizeMapper;
 
     private final UserRoleRelationMapper userRoleRelationMapper;
+    private final BaseStudentMapper baseStudentMapper;
+    private final DictionarydetailMapper dictionarydetailMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -309,8 +319,6 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
 
     /**
      * 个人财务画像,获取学生个人信息
-     * @param userId
-     * @return
      */
     @Override
     public PersonalPortraitPersonalInfoVo getPersonalInfo(Long userId) {
@@ -334,4 +342,122 @@ public class StudentManagerServiceImpl extends MPJBaseServiceImpl<BaseStudentUse
         }
         return p;
     }
+
+    @Override
+    public Boolean importStudentData(List<Map<Integer, Object>> excelDataList) {
+        //查询所有学生的用户信息,组装起来备用
+        List<BaseStudentUser> studentUsers = this.selectJoinList(BaseStudentUser.class,
+            new MPJLambdaWrapper<BaseStudentUser>()
+            .leftJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentUser::getId)
+        );
+        Map<String, BaseStudentUser> studentUserMap = new HashMap<>();
+        for (BaseStudentUser studentUser : studentUsers) {
+            studentUserMap.put(studentUser.getCredentialNumber(), studentUser);
+        }
+        //查询所有的学生信息,组装起来备用
+        List<BaseStudent> baseStudents = baseStudentMapper.selectJoinList(BaseStudent.class,
+            new MPJLambdaWrapper<BaseStudent>()
+            .leftJoin(BaseStudentUser.class, BaseStudentUser::getId, BaseStudent::getUserId)
+        );
+        Map<Long, BaseStudent> baseStudentMap = new HashMap<>();
+        for (BaseStudent studentUser : baseStudents) {
+            baseStudentMap.put(studentUser.getUserId(), studentUser);
+        }
+        //查询所用到的字典
+        Map<String, String> dictionary = initDictionary();
+
+        List<BaseStudentUser> updateStudentUserList = new ArrayList();
+        List<BaseStudent> updateBaseStudentList = new ArrayList();
+        for (Map<Integer, Object> dataMaps : excelDataList) {
+            String credentialNumber = dataMaps.get(0).toString();//身份证号
+            //已存在,更新
+            BaseStudentUser user;
+            BaseStudent baseStudent;
+            if(studentUserMap.containsKey(credentialNumber)){
+                //更新用户数据
+                user = studentUserMap.get(credentialNumber);
+                baseStudent = baseStudentMap.get(user.getId());
+
+                updateStudentUserList.add(user);
+                updateBaseStudentList.add(baseStudent);
+            }else{
+                user = new BaseStudentUser();
+                baseStudent = new BaseStudent();
+            }
+            //设置字段值
+            if(dataMaps.get(1).toString() != null && "".equals(dataMaps.get(1).toString())){
+                baseStudent.setStudentId(dataMaps.get(1).toString());//学号
+            }
+            if(dataMaps.get(3).toString() != null && "".equals(dataMaps.get(3).toString())){
+                user.setName(dataMaps.get(3).toString());//姓名
+            }
+            if(dataMaps.get(4).toString() != null && "".equals(dataMaps.get(4).toString())){
+                user.setGender(GenderDictionaryEnum.getCode(dataMaps.get(4).toString()));//性别
+            }
+            if(dataMaps.get(5).toString() != null && "".equals(dataMaps.get(5).toString())){
+                user.setMobile(dataMaps.get(5).toString());//手机号
+            }
+            if(dataMaps.get(6).toString() != null && "".equals(dataMaps.get(6).toString())){
+                user.setEmail(dataMaps.get(6).toString());//邮箱
+            }
+            if(dataMaps.get(7).toString() != null && "".equals(dataMaps.get(7).toString())){
+                baseStudent.setAsName(dataMaps.get(7).toString());//别名
+            }
+            if(dataMaps.get(8).toString() != null && "".equals(dataMaps.get(8).toString())){
+                baseStudent.setEnName(dataMaps.get(8).toString());//英文名
+            }
+            if(dataMaps.get(9).toString() != null && "".equals(dataMaps.get(9).toString())){
+                baseStudent.setPyName(dataMaps.get(9).toString());//姓名拼音
+            }
+            if(dataMaps.get(10).toString() != null && "".equals(dataMaps.get(10).toString())){
+                baseStudent.setPyName(dataMaps.get(10).toString());//曾用名
+            }
+            if(dataMaps.get(11).toString() != null && "".equals(dataMaps.get(11).toString())){
+                user.setCredentialType(dictionary.get(dataMaps.get(11).toString()));//证件类型
+            }
+            if(dataMaps.get(12).toString() != null && "".equals(dataMaps.get(12).toString())){
+                LocalDateTime birthday = LocalDateTime.parse(dataMaps.get(12).toString());
+                user.setBirthDate(birthday);//出生日期
+                baseStudent.setDayOfBirth(birthday);//出生日期
+            }
+            if(dataMaps.get(13).toString() != null && "".equals(dataMaps.get(13).toString())){
+                baseStudent.setBirthType(dictionary.get(dataMaps.get(13).toString()));//生日类型
+            }
+            if(dataMaps.get(14).toString() != null && "".equals(dataMaps.get(14).toString())){
+                baseStudent.setNation(dictionary.get(dataMaps.get(14).toString()));//民族
+            }
+            if(dataMaps.get(15).toString() != null && "".equals(dataMaps.get(15).toString())){
+                baseStudent.setNation(dictionary.get(dataMaps.get(15).toString()));//血型
+            }
+
+
+            if(studentUserMap.containsKey(credentialNumber)){
+                updateStudentUserList.add(user);
+                updateBaseStudentList.add(baseStudent);
+            }else{
+                user = new BaseStudentUser();
+                baseStudent = new BaseStudent();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 初始化字典信息
+     * 身份证类型、
+     */
+    private Map<String, String> initDictionary(){
+        List<String> codeList = new ArrayList<>();
+        codeList.add("credential_type");codeList.add("nation");
+        codeList.add("blood_type");
+        List<DictionaryDetail> detailList = dictionarydetailMapper.selectJoinList(DictionaryDetail.class,
+            new MPJLambdaWrapper<DictionaryDetail>()
+            .leftJoin(DictionaryItem.class, DictionaryItem::getId, DictionaryDetail::getItemId)
+        );
+        Map<String, String> resultMap = new HashMap<>();
+        for (DictionaryDetail dictionaryDetail : detailList) {
+            resultMap.put(dictionaryDetail.getName(), dictionaryDetail.getCode());
+        }
+        return resultMap;
+    }
 }

+ 20 - 1
src/main/java/com/xjrsoft/module/system/controller/SystemUpdateMessageController.java

@@ -1,11 +1,16 @@
 package com.xjrsoft.module.system.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.yulichang.toolkit.MPJWrappers;
+import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.student.entity.BaseStudentCadre;
 import com.xjrsoft.module.system.dto.AddSystemUpdateMessageDto;
 import com.xjrsoft.module.system.dto.SystemUpdateMessagePageDto;
 import com.xjrsoft.module.system.dto.SystemUpdateMessageReleaseDto;
@@ -95,7 +100,6 @@ public class SystemUpdateMessageController {
     @SaCheckPermission("systemupdatemessage:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
         return RT.ok(systemUpdateMessageService.removeBatchByIds(ids));
-
     }
 
     @GetMapping(value = "/release")
@@ -137,4 +141,19 @@ public class SystemUpdateMessageController {
         return RT.ok(isSuccess);
     }
 
+    @GetMapping(value = "/personal-page")
+    @ApiOperation(value="个人系统消息列表(分页)")
+    @SaCheckPermission("systemupdatemessage:detail")
+    public RT<PageOutput<SystemUpdateMessagePageVo>> personalPage(@Valid SystemUpdateMessagePageDto dto){
+        IPage<SystemUpdateMessagePageVo> page = systemUpdateMessageService.selectJoinListPage(ConventPage.getPage(dto), SystemUpdateMessagePageVo.class,
+            MPJWrappers.<SystemUpdateMessage>lambdaJoin()
+            .leftJoin(SystemUpdateMessageNotice.class, SystemUpdateMessageNotice::getSystemUpdateMessageId, SystemUpdateMessage::getId)
+            .eq(SystemUpdateMessageNotice::getUserId, StpUtil.getLoginIdAsLong())
+            .eq(SystemUpdateMessage::getDeleteMark, DeleteMark.NODELETE.getCode())
+            .eq(SystemUpdateMessage::getStatus, 1)
+        );
+        PageOutput<SystemUpdateMessagePageVo> pageOutput = ConventPage.getPageOutput(page, SystemUpdateMessagePageVo.class);
+        return RT.ok(pageOutput);
+    }
+
 }

+ 3 - 30
src/main/java/com/xjrsoft/module/system/vo/SystemUpdateMessagePageVo.java

@@ -26,36 +26,6 @@ public class SystemUpdateMessagePageVo {
     @ApiModelProperty("")
     private String id;
     /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Long createUserId;
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Date createDate;
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Long modifyUserId;
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Date modifyDate;
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Integer deleteMark;
-    /**
-    * 
-    */
-    @ApiModelProperty("")
-    private Integer enabledMark;
-    /**
     * 发送范围(1:全体师生,2:全体教职工)
     */
     @ApiModelProperty("发送范围(1:全体师生,2:全体教职工)")
@@ -81,4 +51,7 @@ public class SystemUpdateMessagePageVo {
     @ApiModelProperty("状态(0:未发布 1:已发布)")
     private Integer status;
 
+    @ApiModelProperty("发布时间")
+    private LocalDateTime releaseDate;
+
 }