diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java index 000e542..24d4fdd 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java @@ -1,8 +1,10 @@ package com.hxhq.business.controller; +import com.hxhq.business.domain.Notice; import com.hxhq.business.dto.study.StudyListDto; import com.hxhq.business.enums.study.StudyTypeEnum; import com.hxhq.business.form.study.StudySearchForm; +import com.hxhq.business.service.INoticeService; import com.hxhq.business.service.IStudyService; import com.hxhq.common.core.web.controller.BaseController; import com.hxhq.common.core.web.domain.AjaxResult; @@ -26,6 +28,8 @@ public class HomeController extends BaseController { @Autowired private IStudyService studyService; + @Autowired + private INoticeService noticeService; /** * 查询首页数量 @@ -36,4 +40,17 @@ public class HomeController extends BaseController { return AjaxResult.success(studyService.queryHomeCount()); } + + /** + * 查询试验列表 + */ + @GetMapping("/noticeList") + @RequiresPermissions("business:study:list") + public TableDataInfo noticeService() + { + startPage(); + List list = noticeService.queryList(); + TableDataInfo table = getDataTable(list); + return table; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Notice.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Notice.java new file mode 100644 index 0000000..8a11113 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Notice.java @@ -0,0 +1,97 @@ +package com.hxhq.business.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.hxhq.common.core.domain.MpBaseEntity; + + +/** + * 系统通知对象 t_notice + * + * @author hxhq + * @date 2026-01-16 + */ +@TableName("t_notice") +public class Notice extends MpBaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 通知人id */ + private Long userId; + + /** 通知人姓名 */ + private String userName; + + /** 标题 */ + private String title; + + /** 内容 */ + private String content; + + /** 状态1已发送,10已阅读 */ + private Integer status; + + /** 跳转地址 */ + private String url; + + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getUserName() + { + return userName; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + public void setUrl(String url) + { + this.url = url; + } + + public String getUrl() + { + return url; + } + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/NoticeMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/NoticeMapper.java new file mode 100644 index 0000000..44a38e4 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/NoticeMapper.java @@ -0,0 +1,14 @@ +package com.hxhq.business.mapper; + +import com.hxhq.business.domain.Notice; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +/** + * 系统通知Mapper接口 + * + * @author hxhq + * @date 2026-01-16 + */ +public interface NoticeMapper extends BaseMapper +{ + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/INoticeService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/INoticeService.java new file mode 100644 index 0000000..232b953 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/INoticeService.java @@ -0,0 +1,46 @@ +package com.hxhq.business.service; + +import java.util.List; +import com.hxhq.business.domain.Notice; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 系统通知Service接口 + * + * @author hxhq + * @date 2026-01-16 + */ +public interface INoticeService extends IService +{ + /** + * 查询系统通知列表 + * + * @return 系统通知集合 + */ + List queryList(); + + /** + * 保存 + * @param title + * @param userId + * @param url + */ + void save(String title,Long userId,String url); + + /** + * 批量保存试验方法 + * @param title + * @param userIdList + * @param url + */ + void saveBatch(String title,List userIdList, String url); + + /** + * 新增试验方便保存 + * @param studyId + * @param studySubjectId + * @param createUserId + */ + void saveStudyMethod(Long studyId,Long studySubjectId,Long createUserId); + +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/NoticeServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/NoticeServiceImpl.java new file mode 100644 index 0000000..5ec0ba4 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/NoticeServiceImpl.java @@ -0,0 +1,97 @@ +package com.hxhq.business.service.impl; + +import java.util.ArrayList; +import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hxhq.business.domain.Study; +import com.hxhq.business.domain.StudySubject; +import com.hxhq.business.dto.select.DeptUserTreeDto; +import com.hxhq.business.enums.study.StudyTypeEnum; +import com.hxhq.business.service.IStudyService; +import com.hxhq.business.service.IStudySubjectService; +import com.hxhq.common.core.exception.ServiceException; +import com.hxhq.common.core.utils.DateUtils; +import com.hxhq.common.core.web.domain.AjaxResult; +import com.hxhq.common.security.utils.SecurityUtils; +import com.hxhq.system.mapper.SysUserMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hxhq.business.mapper.NoticeMapper; +import com.hxhq.business.domain.Notice; +import com.hxhq.business.service.INoticeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * 系统通知Service业务层处理 + * + * @author hxhq + * @date 2026-01-16 + */ +@Service +public class NoticeServiceImpl extends ServiceImpl implements INoticeService +{ + @Autowired + private SysUserMapper userMapper; + @Autowired + private IStudyService studyService; + @Autowired + private IStudySubjectService studySubjectService; + + /** + * 查询系统通知列表 + * + * @return 系统通知 + */ + @Override + public List queryList() + { + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.eq("user_id", SecurityUtils.getUserId()); + queryWrapper.orderByDesc("id"); + return this.list(queryWrapper); + } + + @Override + public void save(String title, Long userId, String url) { + Notice notice = new Notice(); + notice.setTitle(title); + notice.setUserId(userId); + notice.setUrl(url); + save(notice); + } + + @Override + public void saveBatch(String title, List userIdList, String url) { + List list = new ArrayList<>(); + for(Long userId : userIdList){ + Notice notice = new Notice(); + notice.setTitle(title); + notice.setUserId(userId); + notice.setUrl(url); + list.add(notice); + } + saveBatch(list); + } + + @Override + public void saveStudyMethod(Long studyId, Long studySubjectId, Long createUserId) { + Study study = studyService.getById(studyId); + if(study==null){ + throw new ServiceException("信息不存在"); + } + StudySubject studySubject = null; + if(study.getType().equals(StudyTypeEnum.sy.getValue())){ + studySubject = studySubjectService.getById(studySubjectId); + if(studySubject==null){ + throw new ServiceException("学科不存在"); + } + } + String title = "您参与的【"+study.getName()+"("+study.getSn()+")】【"+(study.getType().equals(StudyTypeEnum.sy.getValue())?studySubject.getDeptName():study.getDeptName())+"】有新试验方法,请进入试验的对应学科进行阅读"; + //试验学科内部的人+非试验部门内的人+麻精药不用判断(只需要判断有审核按钮) + List userIdList = userMapper.selectStudyMethodUserIdExcludeCreate(studyId, study.getType().equals(StudyTypeEnum.sy.getValue())?studySubjectId:null,study.getType().equals(StudyTypeEnum.fsy.getValue())?study.getDeptId():null,createUserId); + if(userIdList.size()>0){ + saveBatch(title,userIdList,null); + } + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index cf60a19..d48e8d3 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -9,6 +9,7 @@ import com.hxhq.business.enums.study.StudyMethodStatusEnum; import com.hxhq.business.form.study.StudyMethodForm; import com.hxhq.business.form.study.StudyMethodReadForm; import com.hxhq.business.form.study.StudyMethodSearchForm; +import com.hxhq.business.service.INoticeService; import com.hxhq.business.service.IStudyMethodReadService; import com.hxhq.common.core.exception.ServiceException; import com.hxhq.common.security.utils.SecurityUtils; @@ -38,6 +39,8 @@ public class StudyMethodServiceImpl extends ServiceImpl depts = userService.selectStudyUser(study.getType().equals(StudyTypeEnum.sy.getValue())?studyId:null,study.getType().equals(StudyTypeEnum.sy.getValue())?studySubjectId:null,study.getDeptId(),permit); + List depts = userService.selectStudyUser(study.getType().equals(StudyTypeEnum.sy.getValue())?studyId:null,study.getType().equals(StudyTypeEnum.sy.getValue())?studySubjectId:null,study.getType().equals(StudyTypeEnum.fsy.getValue())?study.getDeptId():null,permit); return success(depts); } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysUserMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysUserMapper.java index 5106301..aa2f0b1 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysUserMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/mapper/SysUserMapper.java @@ -171,4 +171,12 @@ public interface SysUserMapper * @return */ List selectStudyUser(@Param("studyId") Long studyId, @Param("studySubjectId") Long studySubjectId,@Param("deptId") Long deptId, @Param("permit") String permit); + + /** + * 获取新增试验方法需要通知的用户ID + * @param studyId + * @param studySubjectId + * @return + */ + List selectStudyMethodUserIdExcludeCreate(@Param("studyId") Long studyId, @Param("studySubjectId") Long studySubjectId,@Param("deptId") Long deptId,@Param("createUserId") Long createUserId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java index da1651b..3b1da28 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java @@ -235,7 +235,7 @@ public interface ISysUserService List selectDeptAndUser(); /** - * 试验人员列表 + * 试验人员列表(选审核人用) * @param studyId * @param studySubjectId * @param permit diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/NoticeMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/NoticeMapper.xml new file mode 100644 index 0000000..d937658 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/NoticeMapper.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysUserMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysUserMapper.xml index 52ae269..42c607e 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -261,17 +261,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT u.`user_id` AS id,u.`user_name` AS nameEn,u.`nick_name` AS `name` FROM `sys_user` u WHERE del_flag='0' AND u.`user_id`<>1 - -- 试验下 - - AND - ( - u.`user_id` IN(SELECT leader FROM `t_study` WHERE del_flag='0' AND id=#{studyId}) - OR - u.`user_id` IN(SELECT leader FROM `t_study_subject` WHERE del_flag='0' AND study_id=#{studyId}) - OR - u.`user_id` IN(SELECT user_id FROM `t_study_subject_user` WHERE del_flag='0' AND study_id=#{studyId}) - ) - + -- 试验下-有studySubjectId就不需要 + + + + + + + + + + -- 学科下 @@ -300,4 +300,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file