From 62ccdc7c0ca98f50059808f0ecdf01907b92879d Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 10 七月 2024 16:14:16 +0800
Subject: [PATCH] 协助提交
---
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 82 ++++++++++++++++++++++++++++++----------
1 files changed, 61 insertions(+), 21 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index 6d97512..d7644e2 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -1,7 +1,6 @@
package com.ruoyi.sy.controller;
import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.annotation.PostConstruct;
@@ -9,9 +8,14 @@
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.sy.param.ArdSyCarParam;
+import com.ruoyi.sy.service.IArdTankAbnormalParkAlarmService;
+import com.ruoyi.sy.vo.ArdSyCarVo;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.gps31.PositionContainer;
import com.ruoyi.sy.gps31.PushClientImplAlarm;
@@ -26,6 +30,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -36,12 +41,11 @@
import com.ruoyi.sy.domain.ArdSyCar;
import com.ruoyi.sy.service.IArdSyCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 涓変竴杞﹁締Controller
- *
+ *
* @author ard
* @date 2023-06-26
*/
@@ -68,22 +72,34 @@
@Autowired
private ISysDeptService sysDeptService;
+ @Autowired
+ private IArdTankAbnormalParkAlarmService ardTankAbnormalParkAlarmService;
+
@Resource
private SYClient sYClient;
private ArdSyCarController ardSyCarController;
+
+ @Value("${syCar.enabled}")
+ private Boolean syCarEnabled;
+
+ @Value("${syCar.userId}")
+ private String userId;
+
+ @Value("${syCar.password}")
+ private String password;
@PostConstruct
public void init(){
ardSyCarController = this;
ardSyCarController.sysConfigService = this.sysConfigService;
ardSyCarController.iArdSyUserService = this.iArdSyUserService;
-
SysConfig config = new SysConfig();
config.setConfigKey("syCarPT");
List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
String syURL = "";
- if(sysConfigResult.size() == 0){
+ //if(sysConfigResult.size() == 0){
+ if(!syCarEnabled){//涓変竴杞﹁締鍔犲叆寮�鍏�
return;
}else{
syURL = sysConfigResult.get(0).getConfigValue();
@@ -95,7 +111,8 @@
{
return;
}
- PushClientImplPosition pushClientImplPosition = new PushClientImplPosition(ip,ardSyUserList.get(0).getUserId(),ardSyUserList.get(0).getPassword());
+ //PushClientImplPosition pushClientImplPosition = new PushClientImplPosition(ip,ardSyUserList.get(0).getUserId(),ardSyUserList.get(0).getPassword());
+ PushClientImplPosition pushClientImplPosition = new PushClientImplPosition(ip,userId,password);
Thread pushClientImplPositionThread = new Thread(pushClientImplPosition);
pushClientImplPositionThread.start();
@@ -107,11 +124,15 @@
ardSyCarService.sendArdSyCarPosition();
}
};
- carPositionTimer.scheduleAtFixedRate(carPositionTask,date,3*1000);//鍚敤
- //杞﹁締瀹炴椂浣嶇疆绾跨▼
- PushClientImplAlarm pushClientImplAlarm = new PushClientImplAlarm(ip,ardSyUserList.get(0).getUserId(),ardSyUserList.get(0).getPassword());
+ //carPositionTimer.scheduleAtFixedRate(carPositionTask,date,3*1000);//寮冪敤
+ //杞﹁締瀹炴椂鎶ヨ绾跨▼
+ //PushClientImplAlarm pushClientImplAlarm = new PushClientImplAlarm(ip,ardSyUserList.get(0).getUserId(),ardSyUserList.get(0).getPassword());
+ PushClientImplAlarm pushClientImplAlarm = new PushClientImplAlarm(ip,userId,password);
Thread pushClientImplAlarmThread = new Thread(pushClientImplAlarm);
pushClientImplAlarmThread.start();
+
+ //鍒犻櫎缁撴潫鏃堕棿涓簄ull鐨勮褰�
+ int result = ardTankAbnormalParkAlarmService.deleteArdTankAbnormalParkAlarmByEndTime();
}
/**
@@ -119,11 +140,13 @@
*/
@PreAuthorize("@ss.hasPermi('sy:syCar:list')")
@GetMapping("/list")
- public TableDataInfo list(ArdSyCar ardSyCar)
+ @ApiOperation("鏌ヨ涓変竴杞﹁締鍒楄〃")
+ public AjaxResult list(ArdSyCarParam ardSyCarParam)
{
- startPage();
- List<ArdSyCar> list = ardSyCarService.selectArdSyCarList(ardSyCar);
- return getDataTable(list);
+ PageHelper.startPage(ardSyCarParam.getPageNum(),ardSyCarParam.getPageSize());
+ String userId = SecurityUtils.getUserId();
+ Map<String,Object> result = ardSyCarService.getArdSyCarAll(userId);
+ return ardSyCarService.ardSyCarList(ardSyCarParam,result);
}
/**
@@ -180,7 +203,7 @@
*/
@PreAuthorize("@ss.hasPermi('sy:syCar:remove')")
@Log(title = "涓変竴杞﹁締", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
+ @DeleteMapping("/{ids}")
@ApiOperation("鍒犻櫎涓変竴杞﹁締")
public AjaxResult remove(@PathVariable String[] ids)
{
@@ -215,7 +238,7 @@
/**
* 鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締
*/
- @PreAuthorize("@ss.hasPermi('sy:syCar:getArdSyCarNoRight')")
+// @PreAuthorize("@ss.hasPermi('sy:syCar:getArdSyCarNoRight')")
@PostMapping("/getArdSyCarNoRight")
@ApiOperation("鑾峰彇鏈寕鎺ユ潈闄愮殑涓変竴杞﹁締")
public Map<String,Object> getArdSyCarNoRight(){
@@ -233,7 +256,7 @@
/**
* 鑾峰彇鍏ㄩ儴鐨勪笁涓�杞﹁締
*/
- @PreAuthorize("@ss.hasPermi('sy:syCar:getArdSyCarAll')")
+// @PreAuthorize("@ss.hasPermi('sy:syCar:getArdSyCarAll')")
@PostMapping("/getArdSyCarAll")
@ApiOperation("鑾峰彇鍏ㄩ儴鐨勪笁涓�杞﹁締")
public Map<String,Object> getArdSyCarAll(){
@@ -251,7 +274,7 @@
/**
* 鑾峰彇鍏ㄩ儴杞﹁締妯″瀷
*/
- @PreAuthorize("@ss.hasPermi('sy:syCar:getAllCarModel')")
+// @PreAuthorize("@ss.hasPermi('sy:syCar:getAllCarModel')")
@PostMapping("/getAllCarModel")
@ApiOperation("鑾峰彇鍏ㄩ儴杞﹁締妯″瀷")
public Map<String,Object> getAllCarModel(){
@@ -285,7 +308,11 @@
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String syURL = sysConfigService.getSYURL();
- return ardSyCarService.allListByUser(ardSyUser,syURL,usersId);
+ //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+ SysUser sysUser = sysUserService.selectUserById(usersId);
+ //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ return ardSyCarService.allListByUser(ardSyUser,syURL,usersId,deptList);
}
@PreAuthorize("@ss.hasPermi('sy:syCar:carList')")
@@ -314,7 +341,7 @@
}
}
- @PreAuthorize("@ss.hasPermi('sy:syCar:carListById')")
+ // @PreAuthorize("@ss.hasPermi('sy:syCar:carListById')")
@PostMapping("/carListById/{id}")
@ApiOperation("鏍规嵁杞﹁締ID鑾峰彇杞﹁締鍒楄〃")
public Results carListById(@PathVariable String id){
@@ -357,7 +384,7 @@
SysUser sysUser = sysUserService.selectUserById(usersId);
Map<String, Map<String,Map<String,Object>>> deptPositionMap = PositionContainer.getDeptPositionMap();
if(deptPositionMap.isEmpty()){
- return Results.succeed();
+ return Results.error("31骞冲彴鏃犺溅杈嗕綅缃繑鍥�");
}else {
// return Results.succeed(deptPositionMap.get(sysUser.getDeptId().toString()).get(map.get("carId")));
return Results.succeed(deptPositionMap.get(sysUser.getDeptId().toString()));
@@ -448,7 +475,7 @@
@GetMapping("getThreeOne")
@ApiOperation("鑾峰彇涓変竴瑙嗛鍦板潃")
public AjaxResult getThreeOne() {
- return AjaxResult.success("鑾峰彇鍦板潃鎴愬姛锛�",sysConfigService.selectConfigByKey("threeOneVideo"));
+ return AjaxResult.success("鑾峰彇鍦板潃鎴愬姛锛�",sysConfigService.getSYVideo());
}
@PreAuthorize("@ss.hasPermi('sy:syCar:getAlarmHPfmCountDetail')")
@@ -466,4 +493,17 @@
return AjaxResult.success(mapDetail);
}
+ @GetMapping("/getOnlineSYCarPosition")
+ @ApiOperation("鍗曞叺绔煡鐪嬪凡閫氳繃瀹℃壒鐨勫湪绾夸笁涓�杞﹁締浣嶇疆")
+ public AjaxResult getOnlineSYCarPosition() {
+ String soilderId = SecurityUtils.getUserId();
+ try{
+ Map<String,Object> result = ardSyCarService.getOnlineSYCarPosition(soilderId);
+ return AjaxResult.success(result);
+ }catch(Exception e){
+ e.printStackTrace();
+ return AjaxResult.error();
+ }
+ }
+
}
--
Gitblit v1.9.3