Jelajahi Sumber

查看站点传递siteid

yq 4 tahun lalu
induk
melakukan
5f5db17af9

+ 2 - 1
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/HadSiteStaticMapper.java

@@ -21,5 +21,6 @@ public interface HadSiteStaticMapper extends CrudMapper<HadSiteStatic> {
 
     Double selectCount(@Param("userId") Integer userId,
                         @Param("startTime") Date startTime,
-                        @Param("endTime") Date endTime);
+                        @Param("endTime") Date endTime,
+                       @Param("siteId") Integer siteId);
 }

+ 3 - 0
fiveep-persistence/src/main/resources/mapper/mysql/HadSiteStaticMapper.xml

@@ -27,6 +27,9 @@
                 <if test="userId != null and userId != 0">
                     and us.user_id = #{userId}
                 </if>
+                <if test="siteId != null and siteId != 0">
+                    and us.site_id = #{siteId}
+                </if>
                 <if test="startTime != null and endTime != null">
                     and hs.had_time between #{startTime} and #{endTime}
                 </if>

+ 3 - 1
fiveep-service/src/main/java/com/bizmatics/service/HadSiteStaticService.java

@@ -24,5 +24,7 @@ public interface HadSiteStaticService extends CrudService<HadSiteStatic> {
 
 
 
-     Double getCount(Integer userId, Date startTime, Date endTime);
+     Double getCount(Integer userId, Date startTime, Date endTime,Integer siteId);
+
+
 }

+ 2 - 2
fiveep-service/src/main/java/com/bizmatics/service/impl/HadSiteStaticServiceImpl.java

@@ -43,7 +43,7 @@ public class HadSiteStaticServiceImpl extends AbstractCrudService<HadSiteStaticM
     }
 
     @Override
-    public Double getCount(Integer userId, Date startTime, Date endTime) {
-        return baseMapper.selectCount(userId,startTime,endTime);
+    public Double getCount(Integer userId, Date startTime, Date endTime,Integer siteId) {
+        return baseMapper.selectCount(userId,startTime,endTime,siteId);
     }
 }

+ 11 - 11
fiveep-service/src/main/java/com/bizmatics/service/impl/HtAnalogDataServiceImpl.java

@@ -38,9 +38,9 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         HadCountVO hadCountVO = new HadCountVO();
         Integer userId = SessionLocal.getUserId();
         Date date = new Date();
-        hadCountVO.setDayCount(hadSiteStaticService.getCount(userId,DateUtils.getDayStartTime(date),date));
-        hadCountVO.setMonthCount(hadSiteStaticService.getCount(userId, DateUtils.getFirstDayOfMonth(date), date));
-        hadCountVO.setYearCount(hadSiteStaticService.getCount(userId,DateUtils.getBeginDayOfYear(date),date));
+        hadCountVO.setDayCount(hadSiteStaticService.getCount(userId,DateUtils.getDayStartTime(date),date,null));
+        hadCountVO.setMonthCount(hadSiteStaticService.getCount(userId, DateUtils.getFirstDayOfMonth(date), date,null));
+        hadCountVO.setYearCount(hadSiteStaticService.getCount(userId,DateUtils.getBeginDayOfYear(date),date,null));
         return hadCountVO;
     }
 
@@ -72,7 +72,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         for (int i = 2; i < 24 ; i+=2) {
             //结束时间
             Date hours = DateUtils.setHours(startTime, i);
-            objects.add(hadSiteStaticService.getCount(userId,startTime,hours));
+            objects.add(hadSiteStaticService.getCount(userId,startTime,hours,null));
             startTime = hours;
             dates.add(DateUtils.getTime(hours));
         }
@@ -121,7 +121,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
             Date setDays = DateUtils.setDays(date, i);
             Date dayStartTime = DateUtils.getDayStartTime(setDays);
             Date dayEndTime = DateUtils.getDayEndTime(setDays);
-            objects.add(hadSiteStaticService.getCount(userId,dayStartTime,dayEndTime));
+            objects.add(hadSiteStaticService.getCount(userId,dayStartTime,dayEndTime,null));
             dateList.add(DateUtils.getDay(setDays));
         }
         return CommonIcoVO.builder().name(name).list(objects).listDate(dateList).build();
@@ -138,12 +138,12 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         //当年开始时间
         Date firstDayOfYear = DateUtils.getBeginDayOfYear(date);
         HadCountVO hadCountVO = new HadCountVO();
-        hadCountVO.setDayCount(hadSiteStaticService.getCount(userId,DateUtils.getDayStartTime(date),date));
-        hadCountVO.setMonthCount(hadSiteStaticService.getCount(userId, DateUtils.getFirstDayOfMonth(date), date));
-        hadCountVO.setYearCount(hadSiteStaticService.getCount(userId,DateUtils.getBeginDayOfYear(date),date));
-        hadCountVO.setLastDayCount(hadSiteStaticService.getCount(userId, DateUtils.addDays(firstDayOfDate, -1), DateUtils.addDays(date, -1)));
-        hadCountVO.setLastMonthCount(hadSiteStaticService.getCount(userId, DateUtils.addMonths(firstDayOfMonth, -1), DateUtils.addMonths(date, -1)));
-        hadCountVO.setLastYearCount(hadSiteStaticService.getCount(userId, DateUtils.addYears(firstDayOfYear, -1), DateUtils.addYears(date, -1)));
+        hadCountVO.setDayCount(hadSiteStaticService.getCount(userId,DateUtils.getDayStartTime(date),date,siteId));
+        hadCountVO.setMonthCount(hadSiteStaticService.getCount(userId, DateUtils.getFirstDayOfMonth(date), date,siteId));
+        hadCountVO.setYearCount(hadSiteStaticService.getCount(userId,DateUtils.getBeginDayOfYear(date),date,siteId));
+        hadCountVO.setLastDayCount(hadSiteStaticService.getCount(userId, DateUtils.addDays(firstDayOfDate, -1), DateUtils.addDays(date, -1),siteId));
+        hadCountVO.setLastMonthCount(hadSiteStaticService.getCount(userId, DateUtils.addMonths(firstDayOfMonth, -1), DateUtils.addMonths(date, -1),siteId));
+        hadCountVO.setLastYearCount(hadSiteStaticService.getCount(userId, DateUtils.addYears(firstDayOfYear, -1), DateUtils.addYears(date, -1),siteId));
         hadCountVO.setDayRadio(Optional.ofNullable(hadCountVO.getDayCount())
                 .filter(dayCount -> 0.00 != dayCount)
                 .map(dayCount -> Arith.div(hadCountVO.getLastDayCount(), dayCount))