From dec2e65f7d3917e8843564dc26184f9be7c48af3 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期一, 29 一月 2024 09:05:12 +0800
Subject: [PATCH] 向pc端转发三一车辆位置申请提交
---
ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java | 2 ++
ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java | 26 ++++++++++++++++++++++++++
ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml | 8 ++++++++
3 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
index d5a1f0e..c42c7d0 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java
@@ -78,4 +78,6 @@
public List<Map<String,Object>> selectArdAppApplicationBySoilderIdFalse(String soilderId);
public int updateSoilderCheckByCommanderIdAndSoilderIdAndType(@Param("soilderId")String soilderId,@Param("commanderId")String commanderId,@Param("applicationType")String applicationType);
+
+ public Map<String,Object> selectSYCarApplicationByPCIdAndSoilderId(@Param("commanderId")String commanderId,@Param("usersId")String usersId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
index f259cdf..496e44a 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
@@ -2,7 +2,10 @@
import java.util.*;
+import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.utils.websocket.util.WebSocketUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -14,6 +17,9 @@
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
+import javax.websocket.Session;
+
+import static com.ruoyi.utils.websocket.util.WebSocketUtils.ONLINE_USER_SESSIONS;
/**
* 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆Service涓氬姟灞傚鐞�
@@ -25,6 +31,9 @@
public class ArdAppApplicationServiceImpl implements IArdAppApplicationService {
@Resource
private ArdAppApplicationMapper ardAppApplicationMapper;
+
+ @Resource
+ private SysRoleMapper sysRoleMapper;
private Map<String,Thread> threadMap = new HashMap();
@@ -182,6 +191,23 @@
resultSingle = ardAppApplicationMapper.insertArdAppApplication(ardAppApplication);
result = result + resultSingle;
}
+ //鍔犲叆缁檖c绔痺ebsocket杞彂
+ List<SysRole> sysRoleList = sysRoleMapper.selectRolePermissionByUserId(commanderId);
+ for(SysRole sysRole : sysRoleList){
+ if(!sysRole.getRoleKey().equals("appLeader")){
+ Map<String,Object> resultMap = ardAppApplicationMapper.selectSYCarApplicationByPCIdAndSoilderId(commanderId,usersId);
+ Map<String,Map<String,Object>> msg = new HashMap();
+ msg.put("60000",resultMap);
+ for(String id : ONLINE_USER_SESSIONS.keySet()){
+ if(id.startsWith(commanderId)){
+ Session session = ONLINE_USER_SESSIONS.get(id);
+ WebSocketUtils.sendMessage(session,msg);
+ break;
+ }
+ }
+ break;//涓�涓猵c绔敤鎴峰彲鑳芥寕鎺ュ涓鑹诧紝姣忎釜pc绔彧杞彂涓�娆�
+ }
+ }
}
return result;
}
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
index 4e3790c..30e6188 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml
@@ -144,4 +144,12 @@
update ard_app_application set soilder_check = 'true'
where commander_id = #{commanderId} and soilder_id = #{soilderId} and application_type = #{applicationType}
</update>
+
+ <select id="selectSYCarApplicationByPCIdAndSoilderId" parameterType="java.lang.String" resultType="java.util.Map">
+ select aaa.soilder_id as "soilderId",aaa.commander_id as "commanderId",
+ aaa.reason,aaa.begin,aaa.state,aaa.application_type as "applicationType",
+ su.user_name as "userName",su.nick_name as "nickName" from ard_app_application aaa
+ inner join sys_user su on aaa.soilder_id = su.user_id
+ where commander_id = #{commanderId} and soilder_id = #{usersId} and application_type = 'SYCar'
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3