| | |
| | | List<SysUser> list = sysUserService.selectUserList(user); |
| | | return AjaxResult.success(list); |
| | | } |
| | | /** |
| | | * 获取所有app用户 |
| | | */ |
| | | @ApiOperation("获取所有app用户") |
| | | @GetMapping("/getAppUserlist") |
| | | public AjaxResult getAppUserlist(Long deptId) |
| | | { |
| | | SysUser user=new SysUser(); |
| | | user.setDeptId(deptId); |
| | | List<SysUser> list = sysUserService.selectAppUserList(user); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取所有app用户 |
| | |
| | | { |
| | | SysUser user=new SysUser(); |
| | | user.setDeptId(deptId); |
| | | List<SysUser> list = sysUserService.selectAppUserList(user); |
| | | List<SysUser> list = sysUserService.selectAllAppUserList(user); |
| | | List<SysUser> onLineList=new ArrayList<>(); |
| | | List<SysUser> offLineList=new ArrayList<>(); |
| | | for(SysUser sysUser:list) |
| | |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | |
| | | import javax.websocket.Session; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | //app位置上传 |
| | | public static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(20); |
| | | public static final Map<Session, ScheduledFuture<?>> taskMap = new HashMap<>(); |
| | | public static final Map<Session, Map> defaultDataMap = new HashMap<>();//默认会话发送数据map |
| | | public static final Map<Session, Map<String, ArdAppPosition>> defaultDataMap = new HashMap<>();//默认会话发送数据map |
| | | |
| | | // 初始定时任务,根据用户设置的频率定期推送实时位置信息 |
| | | public static void initPushTask(Session session, int pushFrequency) { |
| | | // 启动新的定时任务 |
| | | if (pushFrequency > 0) { |
| | | scheduler.scheduleAtFixedRate(() -> { |
| | | Map map = defaultDataMap.get(session); |
| | | WebSocketUtils.sendMessage(session, map); |
| | | Map<String, ArdAppPosition> map = defaultDataMap.get(session); |
| | | Map newMap = new HashMap<>(); |
| | | List<ArdAppPosition> positionList = new ArrayList<>(); |
| | | for (String key : map.keySet()) { |
| | | positionList.add(map.get(key)); |
| | | } |
| | | newMap.put("50000", positionList); |
| | | WebSocketUtils.sendMessage(session, newMap); |
| | | }, 0, pushFrequency, TimeUnit.MILLISECONDS); |
| | | } |
| | | } |
| | | |
| | | // 新的定时任务,根据用户设置的频率定期推送实时位置信息 |
| | | public static void startLocationPushTask(String userId, Session session, int pushFrequency) { |
| | | // 取消之前设置的定时任务 |
| | |
| | | taskMap.put(session, task); // 存储新的定时任务 |
| | | } |
| | | } |
| | | |
| | | public static ScheduledFuture<?> ScheduledFutureTask(Session session, String userId, Integer pushFrequency) { |
| | | return scheduler.scheduleAtFixedRate(() -> { |
| | | ArdAppPosition ardAppPosition = getAppPositionList().get(userId); |
| | | Map<String, ArdAppPosition> DataMap = new HashMap<>(); |
| | | DataMap.put(userId,ardAppPosition); |
| | | WebSocketUtils.sendMessage(session, DataMap); |
| | | Map newMap = new HashMap<>(); |
| | | List<ArdAppPosition> positionList = new ArrayList<>(); |
| | | for (String key : DataMap.keySet()) { |
| | | positionList.add(DataMap.get(key)); |
| | | } |
| | | newMap.put("50000", positionList); |
| | | WebSocketUtils.sendMessage(session, newMap); |
| | | }, 0, pushFrequency, TimeUnit.MILLISECONDS); |
| | | } |
| | | |
| | | //取消定时任务 |
| | | public static void stopLocationPushTask(Session session) { |
| | | ScheduledFuture<?> scheduledTask = taskMap.get(session); |
| | |
| | | scheduledTask.cancel(false); |
| | | } |
| | | } |
| | | |
| | | //查询所有app用户的位置信息 |
| | | public static Map<String,ArdAppPosition> getAppPositionList() |
| | | { |
| | | public static Map<String, ArdAppPosition> getAppPositionList() { |
| | | Map<String,ArdAppPosition> userMap=new HashMap<>(); |
| | | ISysUserService sysUserService = SpringUtils.getBean(ISysUserService.class); |
| | | //获取所有app用户 |
| | | List<SysUser> list = sysUserService.selectAppUserListNoDataScope(new SysUser()); |
| | | for(SysUser sysUser:list) |
| | | { |
| | | List<SysUser> list = sysUserService.selectAllocatedList(new SysUser()); |
| | | for (SysUser sysUser : list) { |
| | | IArdAppPositionService ardAppPositionService = SpringUtils.getBean(IArdAppPositionService.class); |
| | | ArdAppPosition ardAppPosition = ardAppPositionService.selectLastArdAppPositionByUserId(sysUser.getUserId()); |
| | | userMap.put(sysUser.getUserId(),ardAppPosition); |
| | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.alarm.steal.domain.ArdAlarmStealelec; |
| | | import com.ruoyi.app.task.domain.ArdAppTaskDetail; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.catalina.security.SecurityUtil; |
| | |
| | | public class ArdAppTaskController extends BaseController { |
| | | @Autowired |
| | | private IArdAppTaskService ardAppTaskService; |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | /** |
| | | * 查询app任务管理列表 |
| | | */ |
| | |
| | | public AjaxResult getTaskDetailInfo(@PathVariable("id") String id) { |
| | | return success(ardAppTaskService.selectArdAppTaskDetailById(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | cd %~dp0 |
| | | |
| | | webrtc-streamer.exe -o |
| | | start /b webrtc-streamer.exe -o |
| | |
| | | * 用户融云token |
| | | */ |
| | | private String rongCloudToken; |
| | | |
| | | /** |
| | | * app用户类型 |
| | | * 0-app指挥端 1-app单兵端 空-pc端 |
| | | */ |
| | | private String appUserType; |
| | | /** |
| | | * 关联报警类型组 |
| | | */ |
| | | private List<String> commands; |
| | | |
| | | public SysUser() { |
| | | |
| | | } |
| | | |
| | | public String getAppUserType() { |
| | | return appUserType; |
| | | } |
| | | |
| | | public void setAppUserType(String appUserType) { |
| | | this.appUserType = appUserType; |
| | | } |
| | | |
| | | public List<String> getCommands() { |
| | |
| | | |
| | | public static boolean isAdmin(String userId) { |
| | | return userId != null && userId.equals("1"); |
| | | } |
| | | |
| | | /** |
| | | * 是否app指挥端 |
| | | */ |
| | | public boolean isAppLeader() { |
| | | return isAppLeader(this.userId); |
| | | } |
| | | |
| | | public boolean isAppLeader(String userId) { |
| | | List<SysRole> roles = this.getRoles(); |
| | | if(roles==null) |
| | | {return false;} |
| | | boolean appLeader = roles.stream().anyMatch(sysRole -> sysRole.getRoleKey().contains("appLeader")); |
| | | return userId != null && appLeader; |
| | | } |
| | | |
| | | public Long getDeptId() { |
| | |
| | | { |
| | | SysUser currentUser = loginUser.getUser(); |
| | | // 如果是超级管理员,则不过滤数据;如果是app指挥端,则不过滤数据; |
| | | if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()&& !currentUser.isAppLeader()) |
| | | if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) |
| | | { |
| | | String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext()); |
| | | dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), |
| | |
| | | * @param sysUser APP用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public List<SysUser> selectAppUserList(SysUser sysUser); |
| | | public List<SysUser> selectAllAppUserList(SysUser sysUser); |
| | | /** |
| | | * 根据条件分页查询已配用户角色列表 |
| | | * |
| | |
| | | public List<SysUser> selectUserList(SysUser user); |
| | | |
| | | /** |
| | | * 根据条件分页查询APP用户列表 |
| | | * 获取App单兵和指挥端用户列表 |
| | | * |
| | | * @param user APP用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | public List<SysUser> selectAppUserList(SysUser user); |
| | | public List<SysUser> selectAppUserListNoDataScope(SysUser user); |
| | | public List<SysUser> selectAllAppUserList(SysUser user); |
| | | |
| | | /** |
| | | * 根据条件分页查询已分配用户角色列表 |
| | | * |
| | |
| | | public List<SysUser> selectUserList(SysUser user) { |
| | | return userMapper.selectUserList(user); |
| | | } |
| | | /** |
| | | * 获取App单兵和指挥端用户列表 |
| | | * |
| | | * @param user APP用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u") |
| | | public List<SysUser> selectAppUserList(SysUser user) { |
| | | return userMapper.selectAppUserList(user); |
| | | } |
| | | @Override |
| | | public List<SysUser> selectAppUserListNoDataScope(SysUser user) { |
| | | return userMapper.selectAppUserList(user); |
| | | public List<SysUser> selectAllAppUserList(SysUser user) { |
| | | return userMapper.selectAllAppUserList(user); |
| | | } |
| | | /** |
| | | * 根据条件分页查询已分配用户角色列表 |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="cameraPriority" column="camera_priority"/> |
| | | <result property="rongCloudToken" column="rong_cloud_token"/> |
| | | <result property="appUserType" column="app_user_type"/> |
| | | <result property="remark" column="remark"/> |
| | | <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
| | |
| | | u.create_time, |
| | | u.camera_priority, |
| | | u.rong_cloud_token, |
| | | u.app_user_type, |
| | | u.remark, |
| | | d.dept_id, |
| | | d.parent_id, |
| | |
| | | </sql> |
| | | |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | -- select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, |
| | | -- u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.camera_priority,u.rong_cloud_token, d.dept_name, d.leader from sys_user u |
| | | -- left join sys_dept d on u.dept_id = d.dept_id |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' |
| | | <if test="userId != null and userId != ''"> |
| | |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | AND u.create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD') |
| | | </if> |
| | | <if test="deptId != null and deptId != 0"> |
| | | AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE cast(#{deptId} as |
| | | varchar) = any(string_to_array(ancestors,',')) )) |
| | | </if> |
| | | <if test="appUserType!=null and appUserType!=''"> AND u.app_user_type = #{appUserType}</if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | </select> |
| | | <select id="selectAppUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | <select id="selectAllAppUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' |
| | | and LOWER(r.role_name) like '%app%' |
| | | <if test="deptId != null and deptId != 0"> |
| | | AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE cast(#{deptId} as |
| | | varchar) = any(string_to_array(ancestors,',')) )) |
| | | </if> |
| | | where u.del_flag = '0' and u.app_user_type in('0','1') |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | </select> |
| | |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="cameraPriority != null">camera_priority,</if> |
| | | <if test="appUserType != null and appUserType != ''">app_user_type,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="cameraPriority != null">#{cameraPriority},</if> |
| | | <if test="appUserType != null">#{appUserType},</if> |
| | | now() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="cameraPriority != null">camera_priority = #{cameraPriority},</if> |
| | | <if test="rongCloudToken != null">rong_cloud_token = #{rongCloudToken},</if> |
| | | <if test="appUserType != null">app_user_type = #{appUserType},</if> |
| | | update_time = now() |
| | | </set> |
| | | where user_id = #{userId} |