Jelajahi Sumber

Merge remote-tracking branch 'origin/test' into test

wks 2 tahun lalu
induk
melakukan
90a650c2a7

+ 1 - 5
src/main/java/com/ydtech/modules/admin/controller/SysPcAddressController.java

@@ -105,11 +105,7 @@ public class SysPcAddressController extends BaseController{
     @GetMapping("/getPcAddress")
     @ApiOperation(value = "历史在线人数")
     public HttpResult<PcAddressHistoryInfoVo> getPcAddress(@RequestParam(value = "dates",required = false) String dates) {
-        if (StringUtils.isNullOrEmpty(dates)) {
-            Date date = new Date();
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            dates = simpleDateFormat.format(date);
-        }
+
         return HttpResult.ok("success", this.sysPcAddressService.getPcAddress(dates));
     }
 

+ 1 - 5
src/main/java/com/ydtech/modules/admin/controller/websocket/SysGeographyPositionController.java

@@ -81,11 +81,7 @@ public class SysGeographyPositionController {
     @GetMapping("/getGeographyPosition")
     @ApiOperation(value = "历史在线人数")
     public HttpResult<PcAddressHistoryInfoVo> getGeographyPosition(@RequestParam(value = "dates",required = false) String dates) {
-        if (StringUtils.isNullOrEmpty(dates)) {
-            Date date = new Date();
-            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-            dates = simpleDateFormat.format(date);
-        }
+
         return HttpResult.ok("success", this.sysGeographyPositionService.getGeographyPosition(dates));
     }
 

+ 8 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysGeographyPositionServiceImpl.java

@@ -24,6 +24,7 @@ import com.ydtech.utils.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -224,8 +225,6 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
     @Override
     public PcAddressHistoryInfoVo getGeographyPosition(String dates) {
         PcAddressHistoryInfoVo pcAddressHistoryInfoVo = new PcAddressHistoryInfoVo();
-        List<PcAddressHistoryTimeVo> geographyPosition = sysGeographyPositionRecordMapper.getGeographyPosition(dates);
-        pcAddressHistoryInfoVo.setList(geographyPosition);
         QueryWrapper<SysGeographyPositionRecord> queryWrapper = new QueryWrapper<>();
         // 指定 COUNT(DISTINCT user_id) 查询
         queryWrapper.select("COUNT(DISTINCT user_id) AS total").likeRight(StringUtils.isNotEmpty(dates), "create_time", dates)
@@ -233,6 +232,13 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
         Map<String, Object> result = sysGeographyPositionRecordService.getMap(queryWrapper);
         Long total = (Long) result.get("total");
         pcAddressHistoryInfoVo.setOnlineNum(total);
+        if (StringUtils.isNullOrEmpty(dates)) {
+            Date date = new Date();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            dates = simpleDateFormat.format(date);
+        }
+        List<PcAddressHistoryTimeVo> geographyPosition = sysGeographyPositionRecordMapper.getGeographyPosition(dates);
+        pcAddressHistoryInfoVo.setList(geographyPosition);
         return pcAddressHistoryInfoVo;
     }
 

+ 8 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysPcAddressServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -202,8 +203,6 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
     @Override
     public PcAddressHistoryInfoVo getPcAddress(String dates) {
         PcAddressHistoryInfoVo pcAddressHistoryInfoVo = new PcAddressHistoryInfoVo();
-        List<PcAddressHistoryTimeVo> pcAddress = sysPcAddressHistoryMapper.getPcAddress(dates);
-        pcAddressHistoryInfoVo.setList(pcAddress);
         QueryWrapper<SysPcAddressHistory> queryWrapper = new QueryWrapper<>();
         // 指定 COUNT(DISTINCT user_id) 查询
         queryWrapper.select("COUNT(DISTINCT user_id) AS total").likeRight(StringUtils.isNotEmpty(dates), "operation_time", dates)
@@ -211,6 +210,13 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
         Map<String, Object> result = sysPcAddressHistoryService.getMap(queryWrapper);
         Long total = (Long) result.get("total");
         pcAddressHistoryInfoVo.setOnlineNum(total);
+        if (StringUtils.isNullOrEmpty(dates)) {
+            Date date = new Date();
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            dates = simpleDateFormat.format(date);
+        }
+        List<PcAddressHistoryTimeVo> pcAddress = sysPcAddressHistoryMapper.getPcAddress(dates);
+        pcAddressHistoryInfoVo.setList(pcAddress);
 
         return pcAddressHistoryInfoVo;
     }