Преглед изворни кода

Merge branch 'V1.1' into 围栏-V1.0

Simon пре 1 година
родитељ
комит
f4a65af6fc

+ 52 - 38
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java

@@ -25,13 +25,14 @@ import java.util.stream.Collectors;
 
 /**
  * 数据大屏Controller
- *
+ * 
  * @author zhengjie
  * @date 2023-09-08
  */
 @RestController
 @RequestMapping("/system/display")
-public class TDataDisplayController extends BaseController {
+public class TDataDisplayController extends BaseController
+{
     @Autowired
     private ITShouhuanAlarmListService tShouhuanAlarmListService;
 
@@ -51,11 +52,12 @@ public class TDataDisplayController extends BaseController {
      * 查询SOS预警处理列表
      */
     @GetMapping("/list")
-    public TableDataInfo list(DataAlarmListDto dataAlarmListDto) {
+    public TableDataInfo list(DataAlarmListDto dataAlarmListDto)
+    {
         startPage();
         List<DataAlarmListDto> list = tShouhuanAlarmListService.selectTShouhuanAlarmList(dataAlarmListDto);
         List<AlarmListDto> alarmListDtoList = new ArrayList<>();
-        for (DataAlarmListDto dto : list) {
+        for (DataAlarmListDto dto : list){
             AlarmListDto alarmListDto = new AlarmListDto();
             alarmListDto.setName(dto.getName());
             alarmListDto.setTelno(dto.getTel_one());
@@ -64,16 +66,18 @@ public class TDataDisplayController extends BaseController {
             alarmListDto.setCreatetime(dto.getCreatetime());
             alarmListDtoList.add(alarmListDto);
         }
-        return getDataTable1(alarmListDtoList, tShouhuanAlarmListService.selectTShouhuanAlarmListCount());
+        return getDataTable1(alarmListDtoList,tShouhuanAlarmListService.selectTShouhuanAlarmListCount());
     }
 
     @GetMapping("/count")
-    public AjaxResult count() {
+    public AjaxResult count()
+    {
         return success(tShouhuanAlarmListService.selectTShouhuanAlarmListCount());
     }
 
     @GetMapping("/alarm")
-    public AjaxResult alarm() {
+    public AjaxResult alarm()
+    {
         AlarmStatusDto dto = new AlarmStatusDto();
         dto.setAlarmSOSSolve(tShouhuanAlarmListService.selectTShouhuanAlarmSOSSolve());
         dto.setUn_alarmSOSSolve(tShouhuanAlarmListService.selectTShouhuanAlarmSOS() - tShouhuanAlarmListService.selectTShouhuanAlarmSOSSolve());
@@ -91,20 +95,22 @@ public class TDataDisplayController extends BaseController {
     }
 
     @GetMapping("/percent")
-    public AjaxResult percent() {
+    public AjaxResult percent()
+    {
         AlarmPercentDto dto = new AlarmPercentDto();
-        dto.setAlarmSOS(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmSOSSolve(), tShouhuanAlarmListService.selectTShouhuanAlarmSOS()));
-        dto.setAlarmRail(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmRailSolve(), tShouhuanAlarmListService.selectTShouhuanAlarmRail()));
-        dto.setAlarmFall(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmFallSolve(), tShouhuanAlarmListService.selectTShouhuanAlarmFall()));
+        dto.setAlarmSOS(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmSOSSolve(),tShouhuanAlarmListService.selectTShouhuanAlarmSOS()));
+        dto.setAlarmRail(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmRailSolve(),tShouhuanAlarmListService.selectTShouhuanAlarmRail()));
+        dto.setAlarmFall(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmFallSolve(),tShouhuanAlarmListService.selectTShouhuanAlarmFall()));
         int statusSum = tShouhuanAlarmListService.selectTShouhuanAlarmStatus() + tShouhuanAlarmListService.selectTShouhuanAlarmStatusSolve();
-        dto.setAlarmStauts(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmStatus(), statusSum));
+        dto.setAlarmStauts(checkPercent(tShouhuanAlarmListService.selectTShouhuanAlarmStatus(),statusSum));
         int alarmAll = tShouhuanAlarmListService.selectTShouhuanAlarmSOSSolve() + tShouhuanAlarmListService.selectTShouhuanAlarmRailSolve() + tShouhuanAlarmListService.selectTShouhuanAlarmRailSolve() + tShouhuanAlarmListService.selectTShouhuanAlarmFallSolve() + tShouhuanAlarmListService.selectTShouhuanAlarmOtherSolve();
-        dto.setAlarmAll(checkPercent(alarmAll, tShouhuanAlarmListService.selectTShouhuanAlarmListCount()));
+        dto.setAlarmAll(checkPercent(alarmAll,tShouhuanAlarmListService.selectTShouhuanAlarmListCount()));
         return success(dto);
     }
 
     @GetMapping("/deviceView")
-    public AjaxResult deviceView() {
+    public AjaxResult deviceView()
+    {
         DeviceViewDto dto = new DeviceViewDto();
         dto.setDeviceCount(tShouhuanAlarmListService.selectTShouhuanAlarmStatus() + tShouhuanAlarmListService.selectTShouhuanAlarmStatusSolve());
         dto.setDeviceOnline(tShouhuanAlarmListService.selectTShouhuanAlarmStatus());
@@ -114,37 +120,40 @@ public class TDataDisplayController extends BaseController {
     }
 
     @GetMapping("/deviceType")
-    public AjaxResult deviceType() {
+    public AjaxResult deviceType()
+    {
         Integer total = tDeviceListService.selectDeviceListCount();
         List<DeviceTypeDto> deviceListDto = tDeviceListService.selectDeviceListDto();
-        for (DeviceTypeDto listDto : deviceListDto) {
+        for (DeviceTypeDto listDto : deviceListDto){
             listDto.setDeviceStr(checkDeviceType(listDto.getDevice_model()));
-            listDto.setDevicePercent(checkPercent(listDto.getCount(), total));
+            listDto.setDevicePercent(checkPercent(listDto.getCount(),total));
         }
         AjaxResult ajax = new AjaxResult();
-        ajax.put("list", deviceListDto);
+        ajax.put("list",deviceListDto);
         ajax.put("total", total);
-        return AjaxResult.success("操作成功", ajax);
+        return AjaxResult.success("操作成功",ajax);
     }
 
     @GetMapping("/userAgeAll")
-    public AjaxResult userAgeAll() {
+    public AjaxResult userAgeAll()
+    {
         Integer total = userProfileService.selectuserAgeCount();
         List<UserAgeDto> dtoList = userProfileService.selectuserAgeDto();
         AjaxResult ajax = new AjaxResult();
-        ajax.put("list", dtoList);
+        ajax.put("list",dtoList);
         ajax.put("total", total);
-        return AjaxResult.success("操作成功", ajax);
+        return AjaxResult.success("操作成功",ajax);
     }
 
     @GetMapping("/mapGpsView")
-    public AjaxResult mapGpsView() {
+    public AjaxResult mapGpsView()
+    {
         List<MapGpsDto> dtoList = itShouhuanInfoService.selectMapGpsView();
         AjaxResult ajax = new AjaxResult();
         ajax.put("lnglat", dtoList);
         AjaxResult ajax1 = new AjaxResult();
-        ajax1.put("pointList", ajax);
-        return AjaxResult.success("操作成功", ajax1);
+        ajax1.put("pointList",ajax);
+        return AjaxResult.success("操作成功",ajax1);
     }
 
     @GetMapping("/mapGpsViewV2")
@@ -175,7 +184,8 @@ public class TDataDisplayController extends BaseController {
      * 用户新增
      */
     @GetMapping("/addUser")
-    public AjaxResult addUser() {
+    public AjaxResult addUser()
+    {
         List<AddUserDto> dtoList = userProfileService.selectAddUser();
         return success(dtoList);
     }
@@ -184,15 +194,17 @@ public class TDataDisplayController extends BaseController {
      * 设备新增
      */
     @GetMapping("/addDevice")
-    public AjaxResult addDevice() {
+    public AjaxResult addDevice()
+    {
         List<AddDeviceDto> dtoList = tDeviceListService.selectAddDevice();
         return success(dtoList);
     }
 
     @GetMapping("/alarmStatusList")
-    public AjaxResult alarmStatusList() {
+    public AjaxResult alarmStatusList()
+    {
         List<AlarmStatusListDto> dtoList = tShouhuanAlarmListService.selectAlarmStatusListDto();
-        for (AlarmStatusListDto dto : dtoList) {
+        for (AlarmStatusListDto dto : dtoList){
             dto.setAlarm_msg(tDeviceListService.checkMessage(dto.getAlarm_type()));
         }
         return success(dtoList);
@@ -202,7 +214,8 @@ public class TDataDisplayController extends BaseController {
      * 设备总览
      */
     @GetMapping("/deviceOver")
-    public AjaxResult deviceOver() {
+    public AjaxResult deviceOver()
+    {
         DeviceOverDto dto = new DeviceOverDto();
         dto.setBindDevice(tDeviceListService.selectDeviceListCount());
         dto.setBindUser(tDeviceListService.selectTDeviceListBandUser());
@@ -214,10 +227,11 @@ public class TDataDisplayController extends BaseController {
      * 查询SOS预警处理列表
      */
     @GetMapping("/alarmList")
-    public AjaxResult alarmList(DataAlarmListDto dataAlarmListDto) {
+    public AjaxResult alarmList(DataAlarmListDto dataAlarmListDto)
+    {
         List<DataAlarmListDto> list = tShouhuanAlarmListService.selectTShouhuanAlarmList(dataAlarmListDto);
         List<MessageAlarmListDto> messageAlarmListDtoList = new ArrayList<>();
-        for (DataAlarmListDto dto : list) {
+        for (DataAlarmListDto dto : list){
             MessageAlarmListDto alarmListDto = new MessageAlarmListDto();
             alarmListDto.setName(dto.getName());
             alarmListDto.setAlarm_msg(tDeviceListService.checkMessage(dto.getAlarm_type()));
@@ -233,13 +247,13 @@ public class TDataDisplayController extends BaseController {
     }
 
 
+
     /**
      * 逆地理编码
-     *
      * @param location
      * @return
      */
-    public String getCounterLocation(String location) {
+    public String getCounterLocation(String location){
 
         Map<String, String> params = new HashMap<>();
         params.put("location", location);
@@ -253,15 +267,15 @@ public class TDataDisplayController extends BaseController {
     /**
      * 计算百分比
      */
-    public String checkPercent(int num1, int num2) {
+    public String checkPercent(int num1, int num2){
         NumberFormat numberFormat = NumberFormat.getInstance();
         numberFormat.setMaximumFractionDigits(2);
-        String result = numberFormat.format((float) num1 / (float) num2 * 100);
+        String result = numberFormat.format((float)num1/(float)num2*100);
         return result;
     }
 
-    public String checkDeviceType(Integer device_model) {
-        switch (device_model) {
+    public String checkDeviceType(Integer device_model){
+        switch (device_model){
             case 0:
                 return "S8";
             case 1:

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -56,9 +56,9 @@ spring:
     # 测试环境
     #    active: test
     # 开发环境
-    active: dev
+#    active: dev
     # 生产环境
-#    active: druid
+    active: druid
 
   # 文件上传
   servlet: