|
|
@@ -36,7 +36,9 @@ import com.xjrsoft.module.oa.service.INewsRelationService;
|
|
|
import com.xjrsoft.module.oa.service.INewsService;
|
|
|
import com.xjrsoft.module.oa.vo.*;
|
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
|
-import com.xjrsoft.module.organization.entity.*;
|
|
|
+import com.xjrsoft.module.organization.entity.Department;
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
import com.xjrsoft.module.organization.mapper.DepartmentMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserMapper;
|
|
|
@@ -53,7 +55,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -104,7 +105,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
List<NewsGradeClassTreeVo> treeVoList = new ArrayList<NewsGradeClassTreeVo>();
|
|
|
|
|
|
//虚拟父级
|
|
|
- treeVoList.add(new NewsGradeClassTreeVo(){{
|
|
|
+ treeVoList.add(new NewsGradeClassTreeVo() {{
|
|
|
setId(666666L);
|
|
|
setName("班级");
|
|
|
}});
|
|
|
@@ -118,7 +119,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
.leftJoin(BaseGrade.class, BaseGrade::getId, BaseClass::getGradeId);
|
|
|
List<BaseGrade> gradeList = baseClassMapper.selectJoinList(BaseGrade.class, queryGrade);
|
|
|
gradeList.forEach((node) -> {
|
|
|
- treeVoList.add(new NewsGradeClassTreeVo(){{
|
|
|
+ treeVoList.add(new NewsGradeClassTreeVo() {{
|
|
|
setId(node.getId());
|
|
|
setName(node.getName());
|
|
|
setParentId(666666L);
|
|
|
@@ -129,7 +130,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
List<BaseClass> classList = baseClassMapper.selectList(new QueryWrapper<BaseClass>());
|
|
|
//获取班级荣誉中出现的学期下的所有班级作为树的子级
|
|
|
classList.forEach((node) -> {
|
|
|
- treeVoList.add(new NewsGradeClassTreeVo(){{
|
|
|
+ treeVoList.add(new NewsGradeClassTreeVo() {{
|
|
|
setId(node.getId());
|
|
|
setName(node.getName());
|
|
|
setParentId(node.getGradeId());
|
|
|
@@ -163,41 +164,41 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
for (AddNewsRelationDto relationDto : addProclamationDto.getRelationList()) {
|
|
|
if (relationDto.getRelationType() == 1) {
|
|
|
Department department = departmentMapper.selectById(relationDto.getRelationId());
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(department != null){
|
|
|
+ if (department != null) {
|
|
|
setRelationName(department.getName());
|
|
|
}
|
|
|
}});
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 2) {
|
|
|
+ if (relationDto.getRelationType() == 2) {
|
|
|
XjrUser xjrUser = xjrUserMapper.selectById(relationDto.getRelationId());
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(xjrUser != null){
|
|
|
+ if (xjrUser != null) {
|
|
|
setRelationName(xjrUser.getName());
|
|
|
}
|
|
|
}});
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 3) {
|
|
|
+ if (relationDto.getRelationType() == 3) {
|
|
|
BaseClass baseClass = baseClassMapper.selectById(relationDto.getRelationId());
|
|
|
BaseGrade baseGrade = null;
|
|
|
- if(baseClass == null){
|
|
|
+ if (baseClass == null) {
|
|
|
baseGrade = baseGradeMapper.selectById(relationDto.getRelationId());
|
|
|
}
|
|
|
BaseGrade finalBaseGrade = baseGrade;
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(baseClass != null){
|
|
|
+ if (baseClass != null) {
|
|
|
setRelationName(baseClass.getName());
|
|
|
}
|
|
|
- if(finalBaseGrade != null){
|
|
|
+ if (finalBaseGrade != null) {
|
|
|
setRelationName(finalBaseGrade.getName());
|
|
|
}
|
|
|
}});
|
|
|
@@ -215,20 +216,20 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
.selectAs(Department::getName, ProclamationVo::getSendDeptIdCN)
|
|
|
.select(News.class, x -> VoToColumnUtil.fieldsToColumns(ProclamationVo.class).contains(x.getProperty()))
|
|
|
.leftJoin(Department.class, Department::getId, News::getSendDeptId)
|
|
|
- .eq(News::getId , id);
|
|
|
+ .eq(News::getId, id);
|
|
|
ProclamationVo proclamationVo = this.selectJoinOne(ProclamationVo.class, queryWrapperNews);
|
|
|
if (proclamationVo == null) {
|
|
|
- return null;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
//添加阅读关系集合
|
|
|
List<NewsRelationConfigVo> newsRelationConfigVoList = new ArrayList<>();
|
|
|
//公告在草稿状态还没有阅读状态,只有阅读关系
|
|
|
- if(proclamationVo.getStatus() == 1){
|
|
|
+ if (proclamationVo.getStatus() == 1) {
|
|
|
MPJLambdaWrapper<NewsRelationConfig> queryWrapperNewsRelationConfig = new MPJLambdaWrapper<>();
|
|
|
queryWrapperNewsRelationConfig
|
|
|
.select(NewsRelationConfig.class, x -> VoToColumnUtil.fieldsToColumns(NewsRelationConfigVo.class).contains(x.getProperty()))
|
|
|
- .eq(NewsRelationConfig::getNewsId , proclamationVo.getId());
|
|
|
+ .eq(NewsRelationConfig::getNewsId, proclamationVo.getId());
|
|
|
newsRelationConfigVoList = newsRelationConfigMapper.selectJoinList(NewsRelationConfigVo.class, queryWrapperNewsRelationConfig);
|
|
|
}
|
|
|
proclamationVo.setNewsRelationConfigVoList(newsRelationConfigVoList);
|
|
|
@@ -236,22 +237,22 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
//添加阅读状态集合
|
|
|
List<NewsRelationVo> newsRelationVoList = new ArrayList<>();
|
|
|
//公告在发布状态或下架状态
|
|
|
- if(proclamationVo.getStatus() == 2 || proclamationVo.getStatus() == 3){
|
|
|
+ if (proclamationVo.getStatus() == 2 || proclamationVo.getStatus() == 3) {
|
|
|
MPJLambdaWrapper<NewsRelation> queryWrapper = new MPJLambdaWrapper<>();
|
|
|
queryWrapper
|
|
|
.select(NewsRelation::getId)
|
|
|
- .selectAs(XjrUser::getName,NewsRelationVo::getUserName)
|
|
|
+ .selectAs(XjrUser::getName, NewsRelationVo::getUserName)
|
|
|
.select(NewsRelation.class, x -> VoToColumnUtil.fieldsToColumns(NewsRelationVo.class).contains(x.getProperty()))
|
|
|
- .leftJoin(XjrUser.class,XjrUser::getId,NewsRelation::getUserId)
|
|
|
- .eq(NewsRelation::getNewsId , proclamationVo.getId())
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, NewsRelation::getUserId)
|
|
|
+ .eq(NewsRelation::getNewsId, proclamationVo.getId())
|
|
|
.disableSubLogicDel();
|
|
|
//当是发布人点击了该公告可以看到其下所有人的回复
|
|
|
- if(ObjectUtil.isNotNull(proclamationVo.getCreateUserId()) && StpUtil.getLoginIdAsLong() == proclamationVo.getCreateUserId()) {
|
|
|
+ if (ObjectUtil.isNotNull(proclamationVo.getCreateUserId()) && StpUtil.getLoginIdAsLong() == proclamationVo.getCreateUserId()) {
|
|
|
newsRelationVoList = newsRelationService.selectJoinList(NewsRelationVo.class, queryWrapper);
|
|
|
- }else {//当不是发布人点击了该公告只能看到自己的回复
|
|
|
- queryWrapper.eq(NewsRelation::getUserId , StpUtil.getLoginIdAsLong());
|
|
|
+ } else {//当不是发布人点击了该公告只能看到自己的回复
|
|
|
+ queryWrapper.eq(NewsRelation::getUserId, StpUtil.getLoginIdAsLong());
|
|
|
NewsRelationVo newsRelationVo = newsRelationService.selectJoinOne(NewsRelationVo.class, queryWrapper);
|
|
|
- if(ObjectUtil.isNotNull(newsRelationVo)){
|
|
|
+ if (ObjectUtil.isNotNull(newsRelationVo)) {
|
|
|
newsRelationVoList.add(newsRelationVo);
|
|
|
}
|
|
|
}
|
|
|
@@ -309,7 +310,8 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
.or()
|
|
|
.eq(News::getSendRange, 2)
|
|
|
.orderByDesc(News::getReleaseTime)
|
|
|
- .disableSubLogicDel();;
|
|
|
+ .disableSubLogicDel();
|
|
|
+ ;
|
|
|
IPage<ProclamationPageVo> page = this.selectJoinListPage(ConventPage.getPage(dto), ProclamationPageVo.class, queryNews);
|
|
|
return page;
|
|
|
}
|
|
|
@@ -331,7 +333,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
|
|
|
xjrNews.setStatus(changeNewsDto.getStatus());
|
|
|
//发布公告,将阅读关系中选择的阅读人添加到关系表
|
|
|
- if(xjrNews.getStatus() == 2){
|
|
|
+ if (xjrNews.getStatus() == 2) {
|
|
|
//将发布时间改为当前时间
|
|
|
xjrNews.setReleaseTime(LocalDateTime.now());
|
|
|
//将张贴时间改为当前时间
|
|
|
@@ -339,96 +341,158 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
xjrNews.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
xjrNews.setModifyDate(LocalDateTime.now());
|
|
|
|
|
|
- LambdaQueryWrapper<NewsRelationConfig> queryConfig = new LambdaQueryWrapper<>();
|
|
|
- queryConfig
|
|
|
- .eq(NewsRelationConfig::getNewsId, xjrNews.getId());
|
|
|
- List<NewsRelationConfig> newsRelationConfigList = newsRelationConfigMapper.selectList(queryConfig);
|
|
|
-
|
|
|
- HashMap<Long, XjrUser> userMap = new HashMap<>();
|
|
|
- if(xjrNews.getSendRange() == 3){
|
|
|
- //遍历所有关系配置
|
|
|
- for (NewsRelationConfig newsRelationConfig : newsRelationConfigList) {
|
|
|
- //阅读关系是部门
|
|
|
- if(newsRelationConfig.getRelationType() == 1){
|
|
|
- // 获取部门下的人员添加
|
|
|
- Long deptId = newsRelationConfig.getRelationId();
|
|
|
- MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
- queryUser
|
|
|
- .leftJoin(UserDeptRelation.class,UserDeptRelation::getUserId,XjrUser::getId)
|
|
|
- .leftJoin(Department.class,Department::getId,UserDeptRelation::getDeptId)
|
|
|
- .eq(Department::getId,deptId);
|
|
|
- List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
|
|
|
- for (XjrUser user: userList) {
|
|
|
- if(!userMap.containsKey(user.getId())){
|
|
|
- userMap.put(user.getId(),user);
|
|
|
- newsRelationMapper.insert(new NewsRelation(){{
|
|
|
- setNewsId(xjrNews.getId());
|
|
|
- setUserId(user.getId());
|
|
|
- setReadMark(0);
|
|
|
- setCreateDate(LocalDateTime.now());
|
|
|
- }});
|
|
|
+ if (xjrNews.getSendRange() == 3) {
|
|
|
+ //查出当前公告的关系配置
|
|
|
+ //部门
|
|
|
+ LambdaQueryWrapper<NewsRelationConfig> queryDeptList = new LambdaQueryWrapper<>();
|
|
|
+ queryDeptList
|
|
|
+ .eq(NewsRelationConfig::getNewsId, xjrNews.getId())
|
|
|
+ .eq(NewsRelationConfig::getRelationType, 1);
|
|
|
+ List<NewsRelationConfig> deptList = newsRelationConfigMapper.selectList(queryDeptList);
|
|
|
+ List<Long> deptIdList = new ArrayList<>();
|
|
|
+ for (NewsRelationConfig newsRelationConfig : deptList) {
|
|
|
+ deptIdList.add(newsRelationConfig.getRelationId());
|
|
|
+ }
|
|
|
+
|
|
|
+ //人员
|
|
|
+ LambdaQueryWrapper<NewsRelationConfig> queryPersonalList = new LambdaQueryWrapper<>();
|
|
|
+ queryPersonalList
|
|
|
+ .eq(NewsRelationConfig::getNewsId, xjrNews.getId())
|
|
|
+ .eq(NewsRelationConfig::getRelationType, 2);
|
|
|
+ List<NewsRelationConfig> personalList = newsRelationConfigMapper.selectList(queryPersonalList);
|
|
|
+ List<Long> personalIdList = new ArrayList<>();
|
|
|
+ for (NewsRelationConfig newsRelationConfig : personalList) {
|
|
|
+ personalIdList.add(newsRelationConfig.getRelationId());
|
|
|
+ }
|
|
|
+
|
|
|
+ //班级
|
|
|
+ LambdaQueryWrapper<NewsRelationConfig> queryClassList = new LambdaQueryWrapper<>();
|
|
|
+ queryClassList
|
|
|
+ .eq(NewsRelationConfig::getNewsId, xjrNews.getId())
|
|
|
+ .eq(NewsRelationConfig::getRelationType, 3);
|
|
|
+ List<NewsRelationConfig> classList = newsRelationConfigMapper.selectList(queryClassList);
|
|
|
+ List<Long> classIdList = new ArrayList<>();
|
|
|
+ for (NewsRelationConfig newsRelationConfig : classList) {
|
|
|
+ classIdList.add(newsRelationConfig.getRelationId());
|
|
|
+ }
|
|
|
+
|
|
|
+ //对人员进行筛选,避免重复添加
|
|
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
+ if (personalIdList != null) {
|
|
|
+ //获取人员的班级或者部门
|
|
|
+ List<DeptIdOrClassIdVo> deptIdOrClassIdVoList = newsMapper.getDeptIdOrClassId(personalIdList);
|
|
|
+ for (DeptIdOrClassIdVo deptIdOrClassIdVo : deptIdOrClassIdVoList) {
|
|
|
+ if (deptIdOrClassIdVo.getClassId() != null) {//有班级是学生
|
|
|
+ if (!classIdList.contains(deptIdOrClassIdVo.getClassId())) {
|
|
|
+ userIdList.add(deptIdOrClassIdVo.getUserId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!deptIdList.contains(deptIdOrClassIdVo.getDeptId())) {
|
|
|
+ userIdList.add(deptIdOrClassIdVo.getUserId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //阅读关系是人员
|
|
|
- if(newsRelationConfig.getRelationType() == 2){
|
|
|
- if(!userMap.containsKey(newsRelationConfig.getRelationId())){
|
|
|
- userMap.put(newsRelationConfig.getRelationId(),new XjrUser(){{
|
|
|
- setId(newsRelationConfig.getRelationId());
|
|
|
- }});
|
|
|
- newsRelationMapper.insert(new NewsRelation(){{
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加部门人员
|
|
|
+ if (deptIdList != null) {
|
|
|
+ newsRelationMapper.insertDeptUser(xjrNews.getId(), deptIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加部门人员
|
|
|
+ if (classIdList != null) {
|
|
|
+ newsRelationMapper.insertClassUser(xjrNews.getId(), classIdList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加部门人员
|
|
|
+ if (userIdList != null) {
|
|
|
+ newsRelationMapper.insertPersonl(xjrNews.getId(), userIdList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //遍历所有关系配置
|
|
|
+ /* for (NewsRelationConfig newsRelationConfig : newsRelationConfigList) {
|
|
|
+ //阅读关系是部门
|
|
|
+ if (newsRelationConfig.getRelationType() == 1) {
|
|
|
+ // 获取部门下的人员添加
|
|
|
+ Long deptId = newsRelationConfig.getRelationId();
|
|
|
+ MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
+ queryUser
|
|
|
+ .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(Department.class, Department::getId, UserDeptRelation::getDeptId)
|
|
|
+ .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
|
|
|
+ .eq(Department::getId, deptId)
|
|
|
+ .eq(Role::getId, 2);
|
|
|
+ List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryUser);
|
|
|
+ for (XjrUser user : userList) {
|
|
|
+ if (!userMap.containsKey(user.getId())) {
|
|
|
+ userMap.put(user.getId(), user);
|
|
|
+ newsRelationMapper.insert(new NewsRelation() {{
|
|
|
setNewsId(xjrNews.getId());
|
|
|
- setUserId(newsRelationConfig.getRelationId());
|
|
|
+ setUserId(user.getId());
|
|
|
setReadMark(0);
|
|
|
setCreateDate(LocalDateTime.now());
|
|
|
}});
|
|
|
}
|
|
|
}
|
|
|
- //阅读关系是班级
|
|
|
- if(newsRelationConfig.getRelationType() == 3){
|
|
|
- // 获取班级下的人员添加
|
|
|
- Long classId = newsRelationConfig.getRelationId();
|
|
|
- MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
- queryUser
|
|
|
- .leftJoin(BaseStudentSchoolRoll.class,BaseStudentSchoolRoll::getUserId,XjrUser::getId)
|
|
|
- .eq(BaseStudentSchoolRoll::getClassId,classId);
|
|
|
- List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
|
|
|
- for (XjrUser user: userList) {
|
|
|
- if(!userMap.containsKey(user.getId())){
|
|
|
- userMap.put(user.getId(),user);
|
|
|
- newsRelationMapper.insert(new NewsRelation(){{
|
|
|
- setNewsId(xjrNews.getId());
|
|
|
- setUserId(user.getId());
|
|
|
- setReadMark(0);
|
|
|
- setCreateDate(LocalDateTime.now());
|
|
|
- }});
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
- if(xjrNews.getSendRange() == 1){
|
|
|
- MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
- queryUser
|
|
|
- .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
|
|
|
- .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
|
|
|
- .eq(Role::getId,2);
|
|
|
- List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
|
|
|
- for (XjrUser user: userList) {
|
|
|
- if(!userMap.containsKey(user.getId())){
|
|
|
- userMap.put(user.getId(),user);
|
|
|
- newsRelationMapper.insert(new NewsRelation(){{
|
|
|
+ //阅读关系是人员
|
|
|
+ if (newsRelationConfig.getRelationType() == 2) {
|
|
|
+ if (!userMap.containsKey(newsRelationConfig.getRelationId())) {
|
|
|
+ userMap.put(newsRelationConfig.getRelationId(), new XjrUser() {{
|
|
|
+ setId(newsRelationConfig.getRelationId());
|
|
|
+ }});
|
|
|
+ newsRelationMapper.insert(new NewsRelation() {{
|
|
|
setNewsId(xjrNews.getId());
|
|
|
- setUserId(user.getId());
|
|
|
+ setUserId(newsRelationConfig.getRelationId());
|
|
|
setReadMark(0);
|
|
|
setCreateDate(LocalDateTime.now());
|
|
|
}});
|
|
|
}
|
|
|
}
|
|
|
+ //阅读关系是班级
|
|
|
+ if (newsRelationConfig.getRelationType() == 3) {
|
|
|
+ // 获取班级下的人员添加
|
|
|
+ Long classId = newsRelationConfig.getRelationId();
|
|
|
+ MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
+ queryUser
|
|
|
+ .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
|
|
|
+ .eq(BaseStudentSchoolRoll::getClassId, classId);
|
|
|
+ List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryUser);
|
|
|
+ for (XjrUser user : userList) {
|
|
|
+ if (!userMap.containsKey(user.getId())) {
|
|
|
+ userMap.put(user.getId(), user);
|
|
|
+ newsRelationMapper.insert(new NewsRelation() {{
|
|
|
+ setNewsId(xjrNews.getId());
|
|
|
+ setUserId(user.getId());
|
|
|
+ setReadMark(0);
|
|
|
+ setCreateDate(LocalDateTime.now());
|
|
|
+ }});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ if (xjrNews.getSendRange() == 2) {
|
|
|
+// MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
+// queryUser
|
|
|
+// .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
|
|
|
+// .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId)
|
|
|
+// .eq(Role::getId, 2);
|
|
|
+// List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryUser);
|
|
|
+// for (XjrUser user : userList) {
|
|
|
+// newsRelationMapper.insert(new NewsRelation() {{
|
|
|
+// setNewsId(xjrNews.getId());
|
|
|
+// setUserId(user.getId());
|
|
|
+// setReadMark(0);
|
|
|
+// setCreateDate(LocalDateTime.now());
|
|
|
+// }});
|
|
|
+// }
|
|
|
+ newsRelationMapper.insertAllTeaStaff(xjrNews.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(xjrNews.getStatus() == 3){
|
|
|
+ if (xjrNews.getStatus() == 3) {
|
|
|
//应该将关系配置表和关系表的数据设置为删除
|
|
|
}
|
|
|
return this.updateById(xjrNews);
|
|
|
@@ -458,35 +522,35 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
if (relationDto.getRelationType() == 1) {
|
|
|
Department department = departmentMapper.selectById(relationDto.getRelationId());
|
|
|
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(department != null){
|
|
|
+ if (department != null) {
|
|
|
setRelationName(department.getName());
|
|
|
}
|
|
|
}});
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 2) {
|
|
|
+ if (relationDto.getRelationType() == 2) {
|
|
|
XjrUser xjrUser = xjrUserMapper.selectById(relationDto.getRelationId());
|
|
|
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(xjrUser != null){
|
|
|
+ if (xjrUser != null) {
|
|
|
setRelationName(xjrUser.getName());
|
|
|
}
|
|
|
}});
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 3) {
|
|
|
+ if (relationDto.getRelationType() == 3) {
|
|
|
BaseClass baseClass = baseClassMapper.selectById(relationDto.getRelationId());
|
|
|
|
|
|
- newsRelationConfigMapper.insert(new NewsRelationConfig(){{
|
|
|
+ newsRelationConfigMapper.insert(new NewsRelationConfig() {{
|
|
|
setNewsId(news.getId());
|
|
|
setRelationId(relationDto.getRelationId());
|
|
|
setRelationType(relationDto.getRelationType());
|
|
|
- if(baseClass != null){
|
|
|
+ if (baseClass != null) {
|
|
|
setRelationName(baseClass.getName());
|
|
|
}
|
|
|
}});
|
|
|
@@ -544,33 +608,33 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
Long deptId = relationDto.getRelationId();
|
|
|
MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
queryUser
|
|
|
- .leftJoin(UserDeptRelation.class,UserDeptRelation::getUserId,XjrUser::getId)
|
|
|
- .leftJoin(Department.class,Department::getId,UserDeptRelation::getDeptId)
|
|
|
- .eq(Department::getId,deptId);
|
|
|
- List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
|
|
|
- for (XjrUser user: userList) {
|
|
|
+ .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(Department.class, Department::getId, UserDeptRelation::getDeptId)
|
|
|
+ .eq(Department::getId, deptId);
|
|
|
+ List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryUser);
|
|
|
+ for (XjrUser user : userList) {
|
|
|
newsRelation.setUserId(user.getId());
|
|
|
newsRelationMapper.insert(newsRelation);
|
|
|
}
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 2) {
|
|
|
+ if (relationDto.getRelationType() == 2) {
|
|
|
newsRelation.setUserId(relationDto.getRelationId());
|
|
|
newsRelationMapper.insert(newsRelation);
|
|
|
}
|
|
|
- if (relationDto.getRelationType() == 3) {
|
|
|
+ if (relationDto.getRelationType() == 3) {
|
|
|
// 获取班级下的人员添加
|
|
|
Long deptId = relationDto.getRelationId();
|
|
|
MPJLambdaWrapper<XjrUser> queryUser = new MPJLambdaWrapper<>();
|
|
|
queryUser
|
|
|
- .leftJoin(UserDeptRelation.class,UserDeptRelation::getUserId,XjrUser::getId)
|
|
|
- .leftJoin(Department.class,Department::getId,UserDeptRelation::getDeptId)
|
|
|
- .eq(Department::getId,deptId);
|
|
|
- List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class,queryUser);
|
|
|
+ .leftJoin(UserDeptRelation.class, UserDeptRelation::getUserId, XjrUser::getId)
|
|
|
+ .leftJoin(Department.class, Department::getId, UserDeptRelation::getDeptId)
|
|
|
+ .eq(Department::getId, deptId);
|
|
|
+ List<XjrUser> userList = xjrUserMapper.selectJoinList(XjrUser.class, queryUser);
|
|
|
List<Long> userIdList = new ArrayList<>();
|
|
|
- for (XjrUser user: userList) {
|
|
|
+ for (XjrUser user : userList) {
|
|
|
userIdList.add(user.getId());
|
|
|
}
|
|
|
- for (Long userId: userIdList) {
|
|
|
+ for (Long userId : userIdList) {
|
|
|
newsRelation.setUserId(userId);
|
|
|
newsRelationMapper.insert(newsRelation);
|
|
|
}
|
|
|
@@ -579,7 +643,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
|
|
|
}
|
|
|
|
|
|
//添加新闻和公告的时候,如果状态是2,表示新闻和公告实时发布了,张贴开始时间就应该是发布时间需要发送消息
|
|
|
- if(ObjectUtil.isNotNull(addNewsDto.getStatus()) && addNewsDto.getStatus() == 2){
|
|
|
+ if (ObjectUtil.isNotNull(addNewsDto.getStatus()) && addNewsDto.getStatus() == 2) {
|
|
|
SendMessage(news.getId());
|
|
|
}
|
|
|
|