helixiao 1 tahun lalu
induk
melakukan
04ced2a50e

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

@@ -255,6 +255,11 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
         AppGeographyHistoryInfoVo appGeographyHistoryInfoVo = new AppGeographyHistoryInfoVo();
         if (StringUtils.isEmpty(startTime) || startTime.equals(endTime)) {
 
+            if (StringUtils.isNullOrEmpty(startTime)) {
+                Date date = new Date();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                startTime = simpleDateFormat.format(date);
+            }
             QueryWrapper<SysGeographyPositionRecord> queryWrapper = new QueryWrapper<>();
             // 指定 COUNT(DISTINCT user_id) 查询
             queryWrapper.select("COUNT(DISTINCT user_id) AS total")
@@ -264,11 +269,6 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
             Map<String, Object> result = sysGeographyPositionRecordService.getMap(queryWrapper);
             Long total = (Long) result.get("total");
             appGeographyHistoryInfoVo.setOnlineNum(total);
-            if (StringUtils.isNullOrEmpty(startTime)) {
-                Date date = new Date();
-                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                startTime = simpleDateFormat.format(date);
-            }
             List<PcAddressHistoryTimeVo> geographyPosition = sysGeographyPositionRecordMapper.getGeographyPosition(startTime,source);
             appGeographyHistoryInfoVo.setList(geographyPosition);
 

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

@@ -214,6 +214,11 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
     public PcAddressHistoryInfoVo getPcAddress(String startTime, String endTime, String source) {
         PcAddressHistoryInfoVo pcAddressHistoryInfoVo = new PcAddressHistoryInfoVo();
         if (StringUtils.isEmpty(startTime) || startTime.equals(endTime)) {
+            if (StringUtils.isNullOrEmpty(startTime)) {
+                Date date = new Date();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                startTime = simpleDateFormat.format(date);
+            }
             QueryWrapper<SysPcAddressHistory> queryWrapper = new QueryWrapper<>();
             // 指定 COUNT(DISTINCT user_id) 查询
             queryWrapper.select("COUNT(DISTINCT user_id) AS total")
@@ -223,11 +228,6 @@ 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(startTime)) {
-                Date date = new Date();
-                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                startTime = simpleDateFormat.format(date);
-            }
 
             List<PcAddressHistoryTimeVo> pcAddress = sysPcAddressHistoryMapper.getPcAddress(startTime,source);
             pcAddressHistoryInfoVo.setList(pcAddress);