Selaa lähdekoodia

小程序数据统计-电梯数据统计

黄远 5 vuotta sitten
vanhempi
commit
85bbc826bc

+ 1 - 0
lift-batch-service/src/main/java/cn/com/ty/lift/batch/applet/dao/model/request/LiftDataRequest.java

@@ -9,4 +9,5 @@ import lombok.Data;
  */
 @Data
 public class LiftDataRequest extends CommonRequest {
+    private int year;
 }

+ 0 - 2
lift-batch-service/src/main/java/cn/com/ty/lift/batch/applet/service/LiftDataService.java

@@ -63,8 +63,6 @@ public class LiftDataService {
         Map<Integer, List<Long>> liftStatusToNums = initLiftStatusToNums(liftDataRequest);
         //从redis中获取当前公司总的电梯信息
         List<LiftDataModel> companyTotalLiftDataList = getLiftDataModels(liftDataRequest);
-        //设置时间段
-        DataStatisticsUtil.setBeginYearToNow(liftDataRequest);
         //从redis中获取当前公司时间段之内的电梯信息
         List<LiftDataModel> liftDataModelList = getNewLiftData(companyTotalLiftDataList, liftDataRequest);
         if ((companyTotalLiftDataList != null && companyTotalLiftDataList.size() > 0)) {

+ 33 - 0
lift-batch-service/src/main/java/cn/com/ty/lift/batch/applet/util/DataStatisticsUtil.java

@@ -57,6 +57,26 @@ public class DataStatisticsUtil {
         return LocalDateTime.of(LocalDateTime.now().getYear(), 1, 1, 0, 0, 0);
     }
 
+    /**
+     * @param
+     * @return
+     * @description 获取当前年份的最开始的时间
+     * @date 2020/2/4 3:37 下午
+     */
+    public static LocalDateTime getYearFirstTime(int year) {
+        return LocalDateTime.of(year, 1, 1, 0, 0, 0);
+    }
+
+    /**
+     * @param
+     * @return
+     * @description 获取指定年的最后一天
+     * @date 2020/5/25 11:13 上午
+     */
+    public static LocalDateTime getYearLastTime(int year) {
+        return LocalDateTime.of(year, 12, 31, 0, 0, 0);
+    }
+
     /**
      * @param localDateTime 时间数据
      * @return
@@ -129,6 +149,19 @@ public class DataStatisticsUtil {
         commonRequest.setEndTimeDate(LocalDateTime.now());
     }
 
+    /**
+     * @param
+     * @return
+     * @description 给请求类设置年初到现在的时间
+     * @date 2020/2/7 3:51 下午
+     */
+    public static void setBeginYearToNow(int year, CommonRequest commonRequest) {
+        //年初时间
+        commonRequest.setStartTimeDate(getYearFirstTime(year));
+        //当前时间
+        commonRequest.setEndTimeDate(LocalDateTime.now());
+    }
+
     /**
      * @param bigDecimalValue
      * @return

+ 0 - 3
lift-batch-service/src/main/resources/mapper/LiftDataMapper.xml

@@ -34,9 +34,6 @@
             true
         and
             pclr.mt_company_id = #{mtCompanyId}
-        <if test="startTimeDate != null and startTimeDate != ''">
-
-        </if>
     </select>
 
 </mapper>

+ 2 - 1
lift-system-service/src/main/resources/mapper/UserAccountMapper.xml

@@ -73,13 +73,14 @@
     </sql>
 
     <!-- 查询物业用户列表 -->
-    <select id="getProjectUserList" parameterType="cn.com.ty.lift.system.user.dao.entity.model.ProjectUser"
+    <select id="getProjectUserList" parameterType="cn.com.ty.lift.system.user.dao.entity.model.PropertyUserRequest"
             resultType="cn.com.ty.lift.system.user.dao.entity.model.ProjectUser">
         select
         project_id as projectId,
         user_id as userId,
         user_role as userRole
         <include refid="projectUserQueryCondition"/>
+        limit #{pageNum}, #{pageSize}
     </select>
 
     <!-- 查询物业用户条数 -->