| | |
| | | params.put("bearing", ardAppPosition.getBearing()); |
| | | sysUser.setParams(params); |
| | | } |
| | | Boolean online = rongCloudService.checkOnline(sysUser.getUserId()); |
| | | if(online) |
| | | if(sysUser.getAppOnlineState().equals("1")) |
| | | { |
| | | onLineList.add(sysUser); |
| | | } |
| | |
| | | // åå§å®æ¶ä»»å¡ï¼æ ¹æ®ç¨æ·è®¾ç½®çé¢ç宿æ¨é宿¶ä½ç½®ä¿¡æ¯ |
| | | public static void initPushTask(String userId, Session session, int pushFrequency) { |
| | | initDataMap.put(userId, getAppPositionList()); |
| | | List<ArdAppPosition> appPositionList = initDataMap.get(userId); |
| | | if (appPositionList.size() == 0) { |
| | | return; |
| | | } |
| | | // å¯å¨æ°ç宿¶ä»»å¡ |
| | | if (pushFrequency > 0) { |
| | | scheduler.scheduleAtFixedRate(() -> { |
| | | List<ArdAppPosition> appPositionList = initDataMap.get(userId); |
| | | if (appPositionList.size() > 0) { |
| | | Map newMap = new HashMap<>(); |
| | | newMap.put("50000", appPositionList); |
| | | WebSocketUtils.sendMessage(session, newMap); |
| | | } |
| | | }, 0, pushFrequency, TimeUnit.MILLISECONDS); |
| | | } |
| | | } |
| | |
| | | stopLocationPushTask(session); |
| | | // å¯å¨æ°ç宿¶ä»»å¡ |
| | | if (pushFrequency > 0) { |
| | | ScheduledFuture<?> task = scheduler.scheduleAtFixedRate(() -> { |
| | | List<ArdAppPosition> appPositionList = getAppPositionList().stream() |
| | | .filter(obj -> obj.getUserId().equals(guideUserId)) |
| | | .collect(Collectors.toList()); |
| | | if (appPositionList.size() == 0) { |
| | | return; |
| | | } |
| | | ScheduledFuture<?> task = scheduler.scheduleAtFixedRate(() -> { |
| | | Map newMap = new HashMap<>(); |
| | | newMap.put("50000", appPositionList); |
| | | WebSocketUtils.sendMessage(session, newMap); |
| | |
| | | //è·åææappç¨æ· |
| | | List<SysUser> list = sysUserService.selectAllAppUserList(new SysUser()); |
| | | for (SysUser sysUser : list) { |
| | | if(sysUser.getAppOnlineState().equals(0)) |
| | | {continue; } |
| | | IArdAppPositionService ardAppPositionService = SpringUtils.getBean(IArdAppPositionService.class); |
| | | ArdAppPosition ardAppPosition = ardAppPositionService.selectLastArdAppPositionByUserId(sysUser.getUserId()); |
| | | ArdAppPositions.add(ardAppPosition); |
| | |
| | | */ |
| | | private String appUserType; |
| | | /** |
| | | * appç¨æ·å¨çº¿ç¶æ |
| | | * 0-离线 1-å¨çº¿ |
| | | */ |
| | | private String appOnlineState; |
| | | /** |
| | | * å
³èæ¥è¦ç±»åç» |
| | | */ |
| | | private List<String> commands; |
| | |
| | | |
| | | } |
| | | |
| | | public String getAppOnlineState() { |
| | | return appOnlineState; |
| | | } |
| | | |
| | | public void setAppOnlineState(String appOnlineState) { |
| | | this.appOnlineState = appOnlineState; |
| | | } |
| | | |
| | | public String getAppUserType() { |
| | | return appUserType; |
| | | } |
| | |
| | | role.getRoleId())); |
| | | } else if (DATA_SCOPE_DEPT.equals(dataScope)) { |
| | | sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); |
| | | } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {//" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or '{}'= any(string_to_array(ancestors,',') ))", |
| | | } else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { |
| | | sqlString.append(StringUtils.format( |
| | | " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE CAST ( {} AS VARCHAR ) = ANY ( string_to_array( ancestors, ',' )))", |
| | | deptAlias, user.getDeptId())); |
| | | " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or CAST ( {} AS VARCHAR ) = ANY ( string_to_array( ancestors, ',' )))", |
| | | deptAlias, user.getDeptId(),user.getDeptId())); |
| | | } else if (DATA_SCOPE_SELF.equals(dataScope)) { |
| | | if (StringUtils.isNotBlank(userAlias)) { |
| | | sqlString.append(StringUtils.format(" OR {}.user_id = '{}' ", userAlias, user.getUserId())); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quartz.task; |
| | | |
| | | import com.ruoyi.app.position.domain.ArdAppPosition; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.rongcloud.service.RongCloudService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: èäºä»»å¡ç±» |
| | | * @ClassName: RongCloudTask |
| | | * @Author: åèä¹ |
| | | * @Date: 2023å¹´07æ28æ¥13:18:22 |
| | | * @Version: 1.0 |
| | | **/ |
| | | @Component("RongCloudTask") |
| | | public class RongCloudTask { |
| | | |
| | | @Resource |
| | | ISysUserService sysUserService; |
| | | @Resource |
| | | RongCloudService rongCloudService; |
| | | |
| | | public void getAppUserOnlineStateTask() |
| | | { |
| | | List<SysUser> SysUserList = sysUserService.selectAllAppUserList(new SysUser()); |
| | | if(SysUserList.size()>0) { |
| | | for (SysUser sysUser : SysUserList) { |
| | | Boolean online = rongCloudService.checkOnline(sysUser.getUserId()); |
| | | if (online) { |
| | | sysUser.setAppOnlineState("1"); |
| | | } else { |
| | | sysUser.setAppOnlineState("0"); |
| | | } |
| | | sysUserService.updateUser(sysUser); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <result property="cameraPriority" column="camera_priority"/> |
| | | <result property="rongCloudToken" column="rong_cloud_token"/> |
| | | <result property="appUserType" column="app_user_type"/> |
| | | <result property="appOnlineState" column="app_online_state"/> |
| | | <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.camera_priority, |
| | | u.rong_cloud_token, |
| | | u.app_user_type, |
| | | u.app_online_state, |
| | | u.remark, |
| | | d.dept_id, |
| | | d.parent_id, |
| | |
| | | <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> |
| | | <if test="appOnlineState != null">app_online_state = #{appOnlineState},</if> |
| | | update_time = now() |
| | | </set> |
| | | where user_id = #{userId} |