|
@@ -0,0 +1,46 @@
|
|
|
|
|
+package com.zksy.base.warning.service;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.zksy.base.warning.domain.WarningParticipant;
|
|
|
|
|
+import com.zksy.base.warning.mapper.WarningParticipantMapper;
|
|
|
|
|
+import com.zksy.common.core.domain.TreeSelect;
|
|
|
|
|
+import com.zksy.common.core.domain.entity.SysDept;
|
|
|
|
|
+import com.zksy.common.exception.ServiceException;
|
|
|
|
|
+import com.zksy.system.mapper.SysDeptMapper;
|
|
|
|
|
+import com.zksy.system.service.ISysDeptService;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/** 预警发布允许跨部门指派,业务候选查询不使用系统用户管理的数据范围。 */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class WarningParticipantService {
|
|
|
|
|
+ private final SysDeptMapper deptMapper;
|
|
|
|
|
+ private final ISysDeptService deptService;
|
|
|
|
|
+ private final WarningParticipantMapper participantMapper;
|
|
|
|
|
+
|
|
|
|
|
+ public WarningParticipantService(SysDeptMapper deptMapper, ISysDeptService deptService,
|
|
|
|
|
+ WarningParticipantMapper participantMapper) {
|
|
|
|
|
+ this.deptMapper = deptMapper;
|
|
|
|
|
+ this.deptService = deptService;
|
|
|
|
|
+ this.participantMapper = participantMapper;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<TreeSelect> departments() {
|
|
|
|
|
+ SysDept query = new SysDept();
|
|
|
|
|
+ query.setStatus("0");
|
|
|
|
|
+ // 直接使用现有 Mapper 查询全部启用部门;只向客户端输出 id/label 树。
|
|
|
|
|
+ return deptService.buildDeptTreeSelect(deptMapper.selectDeptList(query));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public IPage<WarningParticipant> users(int pageNum, int pageSize, Long deptId, String keyword) {
|
|
|
|
|
+ if (deptId != null && deptId <= 0) throw new ServiceException("请选择有效部门");
|
|
|
|
|
+ if (keyword != null) {
|
|
|
|
|
+ keyword = keyword.trim();
|
|
|
|
|
+ if (keyword.length() > 100) throw new ServiceException("搜索关键字不能超过100个字符");
|
|
|
|
|
+ }
|
|
|
|
|
+ Page<WarningParticipant> page = new Page<>(Math.max(1, pageNum), Math.max(1, Math.min(100, pageSize)));
|
|
|
|
|
+ return participantMapper.selectCandidates(page, deptId, keyword);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|