lyhzzz 2 hete
szülő
commit
9b953a697b
22 módosított fájl, 473 hozzáadás és 805 törlés
  1. 0 1
      src/main/java/com/fdkankan/manage/common/FilePath.java
  2. 0 1
      src/main/java/com/fdkankan/manage/common/OssPath.java
  3. 2 0
      src/main/java/com/fdkankan/manage/config/ManageConfig.java
  4. 43 55
      src/main/java/com/fdkankan/manage/controller/DataController.java
  5. 5 0
      src/main/java/com/fdkankan/manage/entity/DistrictCode.java
  6. 2 1
      src/main/java/com/fdkankan/manage/httpClient/service/FdkkService.java
  7. 9 40
      src/main/java/com/fdkankan/manage/mapper/IDataMapper.java
  8. 7 10
      src/main/java/com/fdkankan/manage/service/IDataService.java
  9. 7 1
      src/main/java/com/fdkankan/manage/service/IDistrictCodeService.java
  10. 2 4
      src/main/java/com/fdkankan/manage/service/IScenePlusService.java
  11. 1 1
      src/main/java/com/fdkankan/manage/service/ISysRoleService.java
  12. 113 437
      src/main/java/com/fdkankan/manage/service/impl/DataService.java
  13. 40 0
      src/main/java/com/fdkankan/manage/service/impl/DistrictCodeServiceImpl.java
  14. 1 0
      src/main/java/com/fdkankan/manage/service/impl/ScenePlusServiceImpl.java
  15. 6 4
      src/main/java/com/fdkankan/manage/service/impl/SysRoleServiceImpl.java
  16. 18 0
      src/main/java/com/fdkankan/manage/util/Dateutils.java
  17. 44 0
      src/main/java/com/fdkankan/manage/vo/request/SceneTotalParam.java
  18. 50 0
      src/main/java/com/fdkankan/manage/vo/response/ExportSceneList.java
  19. 20 0
      src/main/java/com/fdkankan/manage/vo/response/GroupByCountVo.java
  20. 24 3
      src/main/java/com/fdkankan/manage/vo/response/SceneTotalVo.java
  21. 11 0
      src/main/java/com/fdkankan/manage/vo/response/SceneTrendVoList.java
  22. 68 247
      src/main/resources/mapper/manage/DataMapper.xml

+ 0 - 1
src/main/java/com/fdkankan/manage/common/FilePath.java

@@ -4,7 +4,6 @@ public class FilePath {
     public static String appLocalPath = "/home/backend/4dkankan_v4/manage/uploadAppTmp/";
     public static String cameraVersionLocalPath = "/home/backend/4dkankan_v4/manage/cameraVersion/";
     public static String sdkLocalPath = "/home/backend/4dkankan_v4/manage/spaceSdk/";
-
     public static String appOssPath = "apps/customApp/";
 
 }

+ 0 - 1
src/main/java/com/fdkankan/manage/common/OssPath.java

@@ -12,7 +12,6 @@ public class OssPath {
     public final static String default_head ="manage/user/newHead.png";
 
     public final static String MANAGE_MODEL_FILE_PATH = "manage/media-library/%s";
-
     public final static String SCENE_BUILD_LOG_PATH = "build_log/%s/%s-log.zip";
     public final static String UPLOAD_SCENE_PATH = "manage/upload/scene/";
 

+ 2 - 0
src/main/java/com/fdkankan/manage/config/ManageConfig.java

@@ -29,6 +29,8 @@ public class ManageConfig {
     private String serverUrl;
     @Value("${queue.scene.copy:ucenter-copy-scene}")
     private String copySceneQueue;
+    @Value("${platform.version:2.2.0}")
+    private String platformVersion;
     public List<String> getNumList(){
         if(StringUtils.isNotBlank(this.shareScenes)){
             String[] split = shareScenes.split(",");

+ 43 - 55
src/main/java/com/fdkankan/manage/controller/DataController.java

@@ -2,96 +2,84 @@ package com.fdkankan.manage.controller;
 
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.service.IDataService;
-import com.fdkankan.manage.service.ISysRoleService;
+import com.fdkankan.manage.service.IDistrictCodeService;
+import com.fdkankan.manage.vo.request.SceneTotalParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 统计分析
  */
 @RestController
 @RequestMapping("/service/manage/data")
-public class DataController {
+public class DataController extends BaseController{
 
     @Autowired
     IDataService dataService;
     @Autowired
-    ISysRoleService sysRoleService;
+    IDistrictCodeService districtCodeService;
 
     /**
-     * 用户数据总览
+     * 场景数据总览
      */
-    @GetMapping("/userTotal")
-    public ResultData userTotal(){
-        return ResultData.ok(dataService.getUserTotal());
+    @PostMapping("/sceneTotal")
+    public ResultData sceneTotal(@RequestBody SceneTotalParam param){
+        return ResultData.ok(dataService.sceneTotal(param));
     }
 
     /**
-     * 场景数据总览
+     * 获取全部地区
      */
-    @GetMapping("/sceneTotal")
-    public ResultData sceneTotal(){
-        return ResultData.ok(dataService.sceneTotal());
+    @GetMapping("/getDistrict")
+    public ResultData getDistrict(){
+        return ResultData.ok(districtCodeService.treeList());
     }
 
     /**
-     * 订单数据总览
+     * 获取全部警种
      */
-    @GetMapping("/orderTotal")
-    public ResultData orderTotal(){
-        return ResultData.ok(dataService.orderTotal());
+    @GetMapping("/getJyType")
+    public ResultData getJyType(){
+        return ResultData.ok();
     }
 
     /**
-     *统计近半年新增用户数趋势
-     * @param type  0:日 ,1:周,2:月
-     * @param dataType 0 新增,1累加 ,2活跃度趋势
+     * 采集趋势
      */
-    @GetMapping("/userTrend")
-    public ResultData userTrend(@RequestParam(required = false,defaultValue = "0") Integer type,
-                                @RequestParam(required = false,defaultValue = "0") Integer dataType,
-                                @RequestParam(required = false) String startTime,
-                                @RequestParam(required = false) String endTime){
-        return ResultData.ok(dataService.userTrend(type,dataType,startTime,endTime));
+    @PostMapping("/sceneTrend")
+    public ResultData sceneTrend(@RequestBody SceneTotalParam param){
+        return ResultData.ok(dataService.sceneTrend(param));
     }
+
     /**
-     *统计近半年新线上订单趋势
-     * @param type  0:日 ,1:周,2:月
+     * 警种分布
      */
-    @GetMapping("/orderTrend")
-    public ResultData orderTrend(@RequestParam(required = false,defaultValue = "0") Integer type,
-                                 @RequestParam(required = false,defaultValue = "0") Integer dataType,
-                                 @RequestParam(required = false) String startTime,
-                                 @RequestParam(required = false) String endTime){
-        return ResultData.ok(dataService.orderTrend(type,dataType,startTime,endTime));
+    @PostMapping("/jyScatter")
+    public ResultData jyScatter(@RequestBody SceneTotalParam param){
+        return ResultData.ok();
     }
+
     /**
-     *统计近半年场景新增趋势
-     * @param type  0:日 ,1:周,2:月
-     * @param dataType 0 新增,1累加
+     * 地区分布
      */
-    @GetMapping("/sceneTrend")
-    public ResultData sceneTrend(@RequestParam(required = false,defaultValue = "0") Integer type,
-                                 @RequestParam(required = false,defaultValue = "0") Integer dataType,
-                                 @RequestParam(required = false) String startTime,
-                                 @RequestParam(required = false) String endTime){
-        return ResultData.ok(dataService.sceneTrend(type,dataType,startTime,endTime));
+    @PostMapping("/districtScatter")
+    public ResultData districtScatter(@RequestBody SceneTotalParam param){
+        return ResultData.ok(dataService.districtScatter(param));
     }
+
     /**
-     *相机出库数量统计
-     * @param type  0:日 ,1:周,2:月
+     * 设置权限
      */
-    @GetMapping("/cameraTrend")
-    public ResultData sceneTrend(@RequestParam(required = false,defaultValue = "0") Integer type,
-                                 @RequestParam(required = false) String startTime,
-                                 @RequestParam(required = false) String endTime){
-        return ResultData.ok(dataService.cameraTrend(type,startTime,endTime));
+    @PostMapping("/setDataAuth")
+    public ResultData setDataAuth(@RequestBody SceneTotalParam param){
+        return ResultData.ok();
     }
 
-
-
-
+    /**
+     * 导出场景数据
+     */
+    @PostMapping("/exportSceneList")
+    public void exportSceneList(@RequestBody SceneTotalParam param){
+        dataService.exportSceneList(param,request,response);
+    }
 }

+ 5 - 0
src/main/java/com/fdkankan/manage/entity/DistrictCode.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
+import java.util.List;
+
 import lombok.Getter;
 import lombok.Setter;
 
@@ -38,5 +40,8 @@ public class DistrictCode implements Serializable {
     @TableField("parent_code")
     private String parentCode;
 
+    @TableField(exist = false)
+    private List<DistrictCode> childrenList;
+
 
 }

+ 2 - 1
src/main/java/com/fdkankan/manage/httpClient/service/FdkkService.java

@@ -101,7 +101,8 @@ public class FdkkService {
             JSONObject jsonObject = JSON.parseObject(sceneJsonStr);
             //校验版本
             String offlineVersion = jsonObject.getString("offlineVersion");
-            String platformVersion = "2.2.0";//从数据中获取
+
+            String platformVersion = manageConfig.getPlatformVersion();//从数据中获取
             if (offlineVersion == null || platformVersion == null) {
                 throw new BusinessException(ResultCode.UPLOAD_SCENE_ERROR4);
             }

+ 9 - 40
src/main/java/com/fdkankan/manage/mapper/IDataMapper.java

@@ -1,9 +1,7 @@
 package com.fdkankan.manage.mapper;
 
-import com.fdkankan.manage.vo.response.DataGroupByCount;
-import com.fdkankan.manage.vo.response.DataGroupBySum;
-import com.fdkankan.manage.vo.response.OrderDataGroupByCount;
-import com.fdkankan.manage.vo.response.SceneDataGroupByCount;
+import com.fdkankan.manage.vo.request.SceneTotalParam;
+import com.fdkankan.manage.vo.response.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -12,46 +10,17 @@ import java.util.List;
 @Mapper
 public interface IDataMapper {
 
-    List<DataGroupByCount> userDataGroupBy(@Param("tb") String tb,@Param("dateFormat")String dateFormat,
-                                           @Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupBySum> userDataSumGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                            @Param("startTime")String startTime, @Param("endTime")String endTime);
 
-    Long totalUserCount(@Param("tb") String tb,@Param("type")Integer type);
-    Long totalUserCount(@Param("tb") String tb,@Param("type")Integer type,@Param("userIds") List<Long> userIds);
+    Long totalSceneCount(@Param("param")SceneTotalParam param);
 
-    Long preMonthAddCount(@Param("tb") String tb,@Param("type")Integer type);
-    Long preMonthAddCount(@Param("tb") String tb,@Param("type")Integer type,@Param("userIds") List<Long> userIds);
+    Long totalUserCount(@Param("param") SceneTotalParam param);
 
-    Long todayAddCount(@Param("tb") String tb,@Param("type")Integer type);
-    Long todayAddCount(@Param("tb") String tb,@Param("type")Integer type,@Param("userIds") List<Long> userIds);
-
-    Long todayActiveCount();
-
-    List<DataGroupByCount> userDataGroupByWeek(@Param("tb") String tb, @Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupBySum> userDataSumGroupByWeek(@Param("tb") String tb, @Param("startTime")String startTime,@Param("endTime")String endTime);
-
-    List<DataGroupByCount> sceneGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                        @Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupByCount> sceneGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                        @Param("startTime")String startTime,@Param("endTime")String endTime,@Param("userIds") List<Long> userIds,@Param("threeCamType")String threeCamType);
-
-    List<DataGroupByCount> sceneGroupByWeek(@Param("tb") String tb,@Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupByCount> sceneGroupByWeek(@Param("tb") String tb,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("userIds") List<Long> userIds,@Param("threeCamType")String threeCamType);
-
-    List<DataGroupByCount> sceneObjGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                           @Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupByCount> sceneObjGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                           @Param("startTime")String startTime,@Param("endTime")String endTime,@Param("userIds") List<Long> userIds,@Param("threeCamType")String threeCamType);
-
-    List<DataGroupByCount> sceneObjGroupByWeek(@Param("tb") String tb,@Param("startTime")String startTime,@Param("endTime")String endTime);
-    List<DataGroupByCount> sceneObjGroupByWeek(@Param("tb") String tb,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("userIds") List<Long> userIds,@Param("threeCamType")String threeCamType);
-
-    List<DataGroupByCount> sceneOutTimeGroupBy(@Param("tb") String tb, @Param("dateFormat")String dateFormat,
-                                        @Param("startTime")String startTime,@Param("endTime")String endTime);
-
-    List<DataGroupByCount> sceneOutTimeGroupByWeek(@Param("tb") String tb,@Param("startTime")String startTime,@Param("endTime")String endTime);
+    List<GroupByCount> totalSceneUserCount(@Param("param")SceneTotalParam param);
 
+    List<GroupByCountVo> getSceneGroupByDay(@Param("param")SceneTotalParam param);
+    List<GroupByCountVo> getUserGroupByDay(@Param("param")SceneTotalParam param);
 
+    List<GroupByCountVo> getSceneGroupByDistrict(@Param("param")SceneTotalParam param);
 
+    List<ExportSceneList> getExPortSceneList(@Param("param")SceneTotalParam param);
 }

+ 7 - 10
src/main/java/com/fdkankan/manage/service/IDataService.java

@@ -1,23 +1,20 @@
 package com.fdkankan.manage.service;
 
+import com.fdkankan.manage.vo.request.SceneTotalParam;
 import com.fdkankan.manage.vo.response.*;
 
-import java.util.HashMap;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 public interface IDataService {
 
-    UserTotalVo getUserTotal();
 
-    SceneTotalVo sceneTotal();
+    SceneTotalVo sceneTotal(SceneTotalParam param);
 
-    OrderTotalVo orderTotal();
+    List<SceneTrendVoList>  sceneTrend(SceneTotalParam param);
 
-    List<DataGroupByCount> userTrend(Integer type,Integer dataType,String startTime,String endTime);
+    Object districtScatter(SceneTotalParam param);
 
-    HashMap<String, Object> orderTrend(Integer type,Integer dataType,String startTime,String endTime);
-
-    HashMap<String, List<DataGroupByCount>> sceneTrend(Integer type,Integer dataType,String startTime,String endTime);
-
-    HashMap<String, Object> cameraTrend(Integer type, String startTime, String endTime);
+    void exportSceneList(SceneTotalParam param, HttpServletRequest req, HttpServletResponse resp);
 }

+ 7 - 1
src/main/java/com/fdkankan/manage/service/IDistrictCodeService.java

@@ -3,6 +3,9 @@ package com.fdkankan.manage.service;
 import com.fdkankan.manage.entity.DistrictCode;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -15,4 +18,7 @@ public interface IDistrictCodeService extends IService<DistrictCode> {
 
     DistrictCode getByCode(String districtCode);
 
-    }
+    List<DistrictCode> treeList();
+
+    HashMap<String, DistrictCode> getByCodeList(List<String> districtCodeList);
+}

+ 2 - 4
src/main/java/com/fdkankan/manage/service/IScenePlusService.java

@@ -7,10 +7,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.manage.entity.UserShareParam;
 import com.fdkankan.manage.vo.request.AllShareParam;
 import com.fdkankan.manage.vo.request.SceneParam;
-import com.fdkankan.manage.vo.response.SceneVo;
-import com.fdkankan.manage.vo.response.SceneVoSimp;
-import com.fdkankan.manage.vo.response.UserAuthSceneVo;
-import com.fdkankan.manage.vo.response.UserShareSceneVo;
+import com.fdkankan.manage.vo.request.SceneTotalParam;
+import com.fdkankan.manage.vo.response.*;
 
 import java.util.ArrayList;
 import java.util.HashMap;

+ 1 - 1
src/main/java/com/fdkankan/manage/service/ISysRoleService.java

@@ -25,5 +25,5 @@ public interface ISysRoleService extends IService<SysRole> {
     void giveMenu(SysRoleMenuParam param);
 
     Boolean isAdmin();
-    Boolean isAdmin(Long roleId);
+    Boolean isSuperAdmin();
 }

+ 113 - 437
src/main/java/com/fdkankan/manage/service/impl/DataService.java

@@ -1,481 +1,157 @@
 package com.fdkankan.manage.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.manage.common.FilePath;
+import com.fdkankan.manage.entity.DistrictCode;
 import com.fdkankan.manage.entity.JyUser;
-import com.fdkankan.manage.entity.User;
 import com.fdkankan.manage.mapper.IDataMapper;
 import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.util.Dateutils;
+import com.fdkankan.manage.vo.request.SceneTotalParam;
 import com.fdkankan.manage.vo.response.*;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.Count;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class DataService implements IDataService {
 
-    static String dayFormat = "%Y-%m-%d";
-    static String mouthFormat = "%Y-%m";
-    static String yearFormat = "%Y";
-
    @Autowired
     IDataMapper dataMapper;
-    @Autowired
-    IUserService userService;
-    @Autowired
-    ISceneProService sceneProService;
-    @Autowired
-    IJyUserPlatformService jyUserPlatformService;
-    @Autowired
-    IJyUserService jyUserService;
-
+   @Autowired
+   IJyUserPlatformService userPlatformService;
+   @Autowired
+   IJyUserService jyUserService;
+   @Autowired
+   ISysRoleService sysRoleService;
+   @Autowired
+   IDistrictCodeService districtCodeService;
+   @Autowired
+   IScenePlusService scenePlusService;
+
+
+   private JyUser commonSetParam(SceneTotalParam param){
+       Long sysUserId = Long.valueOf(StpUtil.getLoginId().toString());
+       Integer loginPlatformId = userPlatformService.getLoginPlatformId();
+       JyUser jyUser = jyUserService.getBySysId(sysUserId);
+       if(!sysRoleService.isSuperAdmin()){
+           Boolean flag = sysRoleService.isAdmin();
+           if(!flag){
+               param.setUserId(jyUser.getUserId());
+           }else {
+               param.setPlatformId(loginPlatformId);
+           }
+       }
+       return jyUser;
+   }
     @Override
-    public UserTotalVo getUserTotal() {
-        UserTotalVo totalVo = new UserTotalVo();
-        Long totalUserCount = dataMapper.totalUserCount("t_user",0);
-        Long preMonthAddCount = dataMapper.preMonthAddCount("t_user",0);
-        Long todayAddCount = dataMapper.todayAddCount("t_user",0);
-        Long todayActiveCount = dataMapper.todayActiveCount();
+    public SceneTotalVo sceneTotal(SceneTotalParam param) {
+        JyUser jyUser = commonSetParam(param);
 
-        totalVo.setTotalUserCount(totalUserCount);
-        totalVo.setPreMonthAddCount(preMonthAddCount);
-        totalVo.setTodayAddCount(todayAddCount);
-        totalVo.setTodayActiveCount(todayActiveCount);
-        return totalVo;
-    }
-
-    @Override
-    public SceneTotalVo sceneTotal() {
-        Integer loginPlatformId = jyUserPlatformService.getLoginPlatformId();
-        List<Long> userIds = new ArrayList<>();
-        if(loginPlatformId != null) {
-            userIds = jyUserService.getByUserIdPlatform(loginPlatformId);
-        }else {
-            JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
-            if(jyUser == null){
-                return new SceneTotalVo();
-            }
-            userIds.add(jyUser.getUserId());
-        }
         SceneTotalVo totalVo = new SceneTotalVo();
-        Long totalSceneCount = dataMapper.totalUserCount("t_scene_pro",1,userIds) + dataMapper.totalUserCount("t_scene_plus",0,userIds);
-        Long preMonthAddCount = dataMapper.preMonthAddCount("t_scene_pro",1,userIds) + dataMapper.preMonthAddCount("t_scene_plus",0,userIds);
-        Long todayAddCount = dataMapper.todayAddCount("t_scene_pro",1,userIds) + dataMapper.todayAddCount("t_scene_plus",0,userIds);
+        Long totalSceneCount = dataMapper.totalSceneCount(param);
 
-        totalVo.setTotalSceneCount(totalSceneCount);
-        totalVo.setPreMonthAddCount(preMonthAddCount);
-        totalVo.setTodayAddCount(todayAddCount);
-        return totalVo;
-    }
+        param.setStartTime(Dateutils.getStartTime(Dateutils.getDaysAgoStr(30)));
+        param.setEndTime(Dateutils.getEndTime(Dateutils.getDaysAgoStr(30)));
+        Long preMonthAddCount = dataMapper.totalSceneCount(param);
 
-    @Override
-    public OrderTotalVo orderTotal() {
-        Long preMonthPowCount = dataMapper.preMonthAddCount("t_increment_order",2);
-        Long preMonthDownCount = dataMapper.preMonthAddCount("t_download_order",2);
-        Long preMonthPartCount = dataMapper.preMonthAddCount("t_order",3);
-        OrderTotalVo totalVo = new OrderTotalVo();
-        totalVo.setPreMonThPowCount(preMonthPowCount);
-        totalVo.setPreMonThDownCount(preMonthDownCount);
-        totalVo.setPreMonThPartCount(preMonthPartCount);
-
-        return totalVo;
-    }
-
-
-    @Override
-    public List<DataGroupByCount> userTrend(Integer type,Integer dataType,String startTime,String endTime) {
-        startTime = Dateutils.formatStartTime(startTime);
-        endTime = Dateutils.formatEndTime(endTime);
-
-        List<DataGroupByCount> dataList = new ArrayList<>();
-        List<DataGroupByCount> result = new ArrayList<>();
-        int rule = Dateutils.DAY;
-        String tb = "t_user";
-        if(dataType == 2){
-            tb = "t_login_log";
-        }
-        switch (type){
-            case 0 :
-                dataList = dataMapper.userDataGroupBy(tb, dayFormat, startTime, endTime);
-                break;
-            case 1 :
-                rule = Dateutils.WEEK;
-                dataList = dataMapper.userDataGroupByWeek(tb,startTime,endTime);
-                break;
-            case 2 :
-                rule = Dateutils.MONTH;
-                dataList =  dataMapper.userDataGroupBy(tb,mouthFormat,startTime,endTime);
-                break;
-        }
-        Long totalCount = 0L;
-        if(dataType == 1){          //累加
-            LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
-            wrapper.lt(User::getCreateTime,startTime);
-            totalCount = userService.count(wrapper);
-        }
-        //查询从开始时间到结束时间为止所有天数,月份,不存在结果补零
-        HashMap<String,Long> map = new HashMap<>();
-        dataList.forEach(entity -> map.put(entity.getGroupKey(),entity.getCount()));
-        List<String> dates = Dateutils.findDatesStr(Dateutils.getDate(startTime), Dateutils.getDate(endTime),rule );
+        param.setStartTime(Dateutils.getStartTime(Dateutils.getDaysAgoStr(0)));
+        param.setEndTime(Dateutils.getEndTime(Dateutils.getDaysAgoStr(0)));
+        Long todayAddCount = dataMapper.totalSceneCount(param);
+        Long totalUserCount = dataMapper.totalUserCount(param);
+        Integer totalSceneUserCount = dataMapper.totalSceneUserCount(param).size();
 
-        setListData(result,map,dates,dataType,totalCount);
+        param.setUserId(jyUser.getUserId());
+        Long userSceneCount = dataMapper.totalSceneCount(param);
 
-        return result;
+        totalVo.setTotalSceneCount(totalSceneCount);
+        totalVo.setTimeSceneCount(preMonthAddCount);
+        totalVo.setTodaySceneCount(todayAddCount);
+        totalVo.setTotalUserCount(totalUserCount);
+        totalVo.setTotalSceneUserCount(Long.valueOf(totalSceneUserCount));
+        totalVo.setUserSceneCount(userSceneCount);
+        return totalVo;
     }
 
     @Override
-    public HashMap<String, Object> orderTrend(Integer type,Integer dataType,String startTime,String endTime) {
-        startTime = Dateutils.formatStartTime(startTime);
-        endTime = Dateutils.formatEndTime(endTime);
-
-        HashMap<String,Object> map = new HashMap<>();
-        if(dataType == 1){
-            return getAmountSumOrder(map,type,startTime,endTime);
-        }
-        List<DataGroupByCount> incrementOrderList = new ArrayList<>();
-        List<DataGroupByCount> downOrderList = new ArrayList<>();
-        List<DataGroupByCount> partOrderList = new ArrayList<>();
-        List<DataGroupByCount> incrementOrderResultList = new ArrayList<>();
-        List<DataGroupByCount> downOrderResultList = new ArrayList<>();
-        List<DataGroupByCount> partOrderResultList = new ArrayList<>();
-        int rule = Dateutils.DAY;
-        switch (type){
-            case 0 :
-                incrementOrderList = dataMapper.userDataGroupBy("t_increment_order",dayFormat,startTime,endTime);
-                downOrderList = dataMapper.userDataGroupBy("t_download_order",dayFormat,startTime,endTime);
-                partOrderList = dataMapper.userDataGroupBy("t_order",dayFormat,startTime,endTime);
-                break;
-            case 1 :
-                rule = Dateutils.WEEK;
-                incrementOrderList = dataMapper.userDataGroupByWeek("t_increment_order",startTime,endTime);
-                downOrderList = dataMapper.userDataGroupByWeek("t_download_order",startTime,endTime);
-                partOrderList = dataMapper.userDataGroupByWeek("t_order",startTime,endTime);
-                break;
-            case 2 :
-                rule = Dateutils.MONTH;
-                incrementOrderList = dataMapper.userDataGroupBy("t_increment_order",mouthFormat,startTime,endTime);
-                downOrderList = dataMapper.userDataGroupBy("t_download_order",mouthFormat,startTime,endTime);
-                partOrderList = dataMapper.userDataGroupBy("t_order",mouthFormat,startTime,endTime);
-                break;
-        }
-        //查询从开始时间到结束时间为止所有天数,月份,不存在结果补零
-        HashMap<String,Long> incrementMap = new HashMap<>();
-        HashMap<String,Long> downOrderMap = new HashMap<>();
-        HashMap<String,Long> partMap = new HashMap<>();
-        incrementOrderList.forEach(entity -> incrementMap.put(entity.getGroupKey(),entity.getCount()));
-        downOrderList.forEach(entity -> downOrderMap.put(entity.getGroupKey(),entity.getCount()));
-        partOrderList.forEach(entity -> partMap.put(entity.getGroupKey(),entity.getCount()));
-
-        List<String> dates = Dateutils.findDatesStr(Dateutils.getDate(startTime), Dateutils.getDate(endTime),rule );
-        for (String date : dates) {
-            DataGroupByCount groupByCount = new DataGroupByCount();
-            groupByCount.setGroupKey(date);
-            groupByCount.setCount(incrementMap.get(date)== null ?0 :incrementMap.get(date));
-            incrementOrderResultList.add(groupByCount);
-
-            DataGroupByCount groupByCount2 = new DataGroupByCount();
-            groupByCount2.setGroupKey(date);
-            groupByCount2.setCount(downOrderMap.get(date)== null ?0 :downOrderMap.get(date));
-            downOrderResultList.add(groupByCount2);
+    public  List<SceneTrendVoList>  sceneTrend(SceneTotalParam param) {
+        commonSetParam(param);
 
-            DataGroupByCount groupByCount3 = new DataGroupByCount();
-            groupByCount3.setGroupKey(date);
-            groupByCount3.setCount(partMap.get(date)== null ?0 :partMap.get(date));
-            partOrderResultList.add(groupByCount3);
-        }
-        map.put("incrementOrder",incrementOrderResultList);
-        map.put("downOrder",downOrderResultList);
-        map.put("partOrder",partOrderResultList);
-        return map;
+        List<String> datesStr = new ArrayList<>();
+        if(param.getTimeList() == null || param.getTimeList().isEmpty()){
+            datesStr = Dateutils.findDatesStr(Dateutils.getAddTime(-30, Dateutils.DAY), new Date(), Dateutils.DAY);
+        }else {
+            datesStr =  Dateutils.findDatesStr(Dateutils.getDate(param.getStartTime()),Dateutils.getDate(param.getEndTime()),Dateutils.DAY);
+        }
+        HashMap<String,Long> sceneMap = new HashMap<>();
+        HashMap<String,Long> userMap = new HashMap<>();
+        datesStr.forEach(e ->sceneMap.put(e,0L));
+        datesStr.forEach(e ->userMap.put(e,0L));
+
+        List<GroupByCountVo> groupByCounts = dataMapper.getSceneGroupByDay(param);
+        groupByCounts.forEach(e ->sceneMap.put(e.getGroupKey(),e.getTotalCount()));
+
+        List<GroupByCountVo> userCount = dataMapper.getUserGroupByDay(param);
+        userCount.forEach(e ->userMap.put(e.getGroupKey(),userMap.get(e.getGroupKey() +1)));
+
+        List<GroupByCountVo> sceneList = new ArrayList<>();
+        for (String key : sceneMap.keySet()) {
+            sceneList.add(new GroupByCountVo(key,sceneMap.get(key)));
+        }
+        List<GroupByCountVo> userList = new ArrayList<>();
+        for (String key : userMap.keySet()) {
+            userList.add(new GroupByCountVo(key,userMap.get(key)));
+        }
+
+        List<SceneTrendVoList> reList = new ArrayList<>();
+        SceneTrendVoList sceneTrendVoList = new SceneTrendVoList();
+        sceneTrendVoList.setType("scene");
+        sceneTrendVoList.setList(sceneList);
+        reList.add(sceneTrendVoList);
+        SceneTrendVoList sceneTrendVoList2 = new SceneTrendVoList();
+        sceneTrendVoList2.setType("user");
+        sceneTrendVoList2.setList(userList);
+        reList.add(sceneTrendVoList2);
+        return reList;
     }
 
-    private HashMap<String, Object> getAmountSumOrder(HashMap<String,Object> map,Integer type, String startTime, String endTime) {
-        List<DataGroupBySum> incrementOrderList = new ArrayList<>();
-        List<DataGroupBySum> downOrderList = new ArrayList<>();
-        List<DataGroupBySum> partOrderList = new ArrayList<>();
-        List<DataGroupBySum> incrementOrderResultList = new ArrayList<>();
-        List<DataGroupBySum> downOrderResultList = new ArrayList<>();
-        List<DataGroupBySum> partOrderResultList = new ArrayList<>();
-        int rule = Dateutils.DAY;
-        switch (type){
-            case 0 :
-                incrementOrderList = dataMapper.userDataSumGroupBy("t_increment_order",dayFormat,startTime,endTime);
-                downOrderList = dataMapper.userDataSumGroupBy("t_download_order",dayFormat,startTime,endTime);
-                partOrderList = dataMapper.userDataSumGroupBy("t_order",dayFormat,startTime,endTime);
-                break;
-            case 1 :
-                rule = Dateutils.WEEK;
-                incrementOrderList = dataMapper.userDataSumGroupByWeek("t_increment_order",startTime,endTime);
-                downOrderList = dataMapper.userDataSumGroupByWeek("t_download_order",startTime,endTime);
-                partOrderList = dataMapper.userDataSumGroupByWeek("t_order",startTime,endTime);
-                break;
-            case 2 :
-                rule = Dateutils.MONTH;
-                incrementOrderList = dataMapper.userDataSumGroupBy("t_increment_order",mouthFormat,startTime,endTime);
-                downOrderList = dataMapper.userDataSumGroupBy("t_download_order",mouthFormat,startTime,endTime);
-                partOrderList = dataMapper.userDataSumGroupBy("t_order",mouthFormat,startTime,endTime);
-                break;
-        }
-        //查询从开始时间到结束时间为止所有天数,月份,不存在结果补零
-        HashMap<String,String> incrementMap = new HashMap<>();
-        HashMap<String,String> downOrderMap = new HashMap<>();
-        HashMap<String,String> partMap = new HashMap<>();
-        incrementOrderList.forEach(entity -> incrementMap.put(entity.getGroupKey(),entity.getCount()));
-        downOrderList.forEach(entity -> downOrderMap.put(entity.getGroupKey(),entity.getCount()));
-        partOrderList.forEach(entity -> partMap.put(entity.getGroupKey(),entity.getCount()));
-
-        List<String> dates = Dateutils.findDatesStr(Dateutils.getDate(startTime), Dateutils.getDate(endTime),rule );
-        for (String date : dates) {
-            DataGroupBySum groupByCount = new DataGroupBySum();
-            groupByCount.setGroupKey(date);
-            groupByCount.setCount(incrementMap.get(date)== null ?"0" :incrementMap.get(date));
-            incrementOrderResultList.add(groupByCount);
-
-            DataGroupBySum groupByCount2 = new DataGroupBySum();
-            groupByCount2.setGroupKey(date);
-            groupByCount2.setCount(downOrderMap.get(date)== null ?"0" :downOrderMap.get(date));
-            downOrderResultList.add(groupByCount2);
-
-            DataGroupBySum groupByCount3 = new DataGroupBySum();
-            groupByCount3.setGroupKey(date);
-            groupByCount3.setCount(partMap.get(date)== null ?"0" :partMap.get(date));
-            partOrderResultList.add(groupByCount3);
-        }
-        map.put("incrementOrder",incrementOrderResultList);
-        map.put("downOrder",downOrderResultList);
-        map.put("partOrder",partOrderResultList);
-        return map;
-    }
 
     @Override
-    public HashMap<String, List<DataGroupByCount>> sceneTrend(Integer type,Integer dataType,String startTime,String endTime) {
-        startTime = Dateutils.formatStartTime(startTime);
-        endTime = Dateutils.formatEndTime(endTime);
-
-        Integer loginPlatformId = jyUserPlatformService.getLoginPlatformId();
-        List<Long> userIds = new ArrayList<>();
-        if(loginPlatformId != null) {
-            userIds = jyUserService.getByUserIdPlatform(loginPlatformId);
-        }else {
-            JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
-            if(jyUser == null){
-                return new HashMap<>();
-            }
-            userIds.add(jyUser.getUserId());
-        }
-
-        HashMap<String,List<DataGroupByCount>> map = new HashMap<>();
-        List<DataGroupByCount> kkList = new ArrayList<>();
-        List<DataGroupByCount> kjList = new ArrayList<>();
-        List<DataGroupByCount> ssList = new ArrayList<>();
-        List<DataGroupByCount> ssObjList = new ArrayList<>();
-        List<DataGroupByCount> sgList = new ArrayList<>();
-        List<DataGroupByCount> sgObjList = new ArrayList<>();
-        List<DataGroupByCount> yzlList = new ArrayList<>();
+    public Object districtScatter(SceneTotalParam param) {
+        commonSetParam(param);
 
-        List<DataGroupByCount> proList = new ArrayList<>();
-        List<DataGroupByCount> plusList = new ArrayList<>();
-        List<DataGroupByCount> proObjList = new ArrayList<>();
-        List<DataGroupByCount> plusObjList = new ArrayList<>();
-        List<DataGroupByCount> yzlDataList = new ArrayList<>();
-        int rule = Dateutils.DAY;
-        switch (type){
-            case 0 :
-                proList = dataMapper.sceneGroupBy("t_scene_pro",dayFormat,startTime,endTime,userIds,null);
-                plusList = dataMapper.sceneGroupBy("t_scene_plus",dayFormat,startTime,endTime,userIds,null);
-                proObjList = dataMapper.sceneObjGroupBy("t_scene_pro",dayFormat,startTime,endTime,userIds,null);
-                plusObjList = dataMapper.sceneObjGroupBy("t_scene_plus",dayFormat,startTime,endTime,userIds,null);
-                yzlDataList = dataMapper.sceneGroupBy("t_scene_plus",dayFormat,startTime,endTime,userIds,"yzl");
-                break;
-            case 1 :
-                rule = Dateutils.WEEK;
-                proList = dataMapper.sceneGroupByWeek("t_scene_pro",startTime,endTime,userIds,null);
-                plusList = dataMapper.sceneGroupByWeek("t_scene_plus",startTime,endTime,userIds,null);
-                proObjList = dataMapper.sceneObjGroupByWeek("t_scene_pro",startTime,endTime,userIds,null);
-                plusObjList = dataMapper.sceneObjGroupByWeek("t_scene_plus",startTime,endTime,userIds,null);
-                yzlDataList = dataMapper.sceneGroupByWeek("t_scene_plus",startTime,endTime,userIds,"yzl");
-                break;
-            case 2 :
-                rule = Dateutils.MONTH;
-                proList = dataMapper.sceneGroupBy("t_scene_pro",mouthFormat,startTime,endTime,userIds,null);
-                plusList = dataMapper.sceneGroupBy("t_scene_plus",mouthFormat,startTime,endTime,userIds,null);
-                proObjList = dataMapper.sceneObjGroupBy("t_scene_pro",mouthFormat,startTime,endTime,userIds,null);
-                plusObjList = dataMapper.sceneObjGroupBy("t_scene_plus",mouthFormat,startTime,endTime,userIds,null);
-                yzlDataList = dataMapper.sceneGroupBy("t_scene_plus",mouthFormat,startTime,endTime,userIds,"yzl");
-                break;
-        }
-        HashMap<String, Long> kkMap = new HashMap<>();
-        HashMap<String, Long> kjMap = new HashMap<>();
-        HashMap<String, Long> ssMap = new HashMap<>();
-        HashMap<String, Long> ssObjMap = new HashMap<>();
-        HashMap<String, Long> sgMap = new HashMap<>();
-        HashMap<String, Long> sgObjMap = new HashMap<>();
-        HashMap<String, Long> yzlMap = new HashMap<>();
-        for (DataGroupByCount dataGroupByCount : proList) {
-            if(dataGroupByCount.getGroupKey2().equals("3")){    //看见
-                kjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("4")){    //深时
-                ssMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("5")){    //深时
-                sgMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(Arrays.asList("1","2","12","13","14").contains(dataGroupByCount.getGroupKey2())){    //看看
-                kkMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-        }
-        for (DataGroupByCount dataGroupByCount : plusList) {
-            if(dataGroupByCount.getGroupKey2().equals("3")){    //看见
-                kjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("4")){    //深时
-                ssMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("5")){    //深时
-                sgMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(Arrays.asList("1","2","12","13","14").contains(dataGroupByCount.getGroupKey2())){    //看看
-                kkMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-        }
-        for (DataGroupByCount dataGroupByCount : proObjList) {
-            if(dataGroupByCount.getGroupKey2().equals("4")){    //深时
-                ssObjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
+        List<GroupByCountVo>  dataList = dataMapper.getSceneGroupByDistrict(param);
+        List<String> districtCodeList = dataList.stream().map(GroupByCountVo::getGroupKey).collect(Collectors.toList());
+        HashMap<String, DistrictCode> map = districtCodeService.getByCodeList(districtCodeList);
+        for (GroupByCountVo groupByCountVo : dataList) {
+            if(groupByCountVo.getGroupKey() == null){
+                groupByCountVo.setGroupKey("unknown");
+                groupByCountVo.setGroupName("unknown");
             }
-            if(dataGroupByCount.getGroupKey2().equals("5")){    //深时
-                sgObjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
+            DistrictCode districtCode = map.get(groupByCountVo.getGroupKey());
+            if(districtCode != null){
+                groupByCountVo.setGroupName(districtCode.getName());
             }
         }
-        for (DataGroupByCount dataGroupByCount : plusObjList) {
-            if(dataGroupByCount.getGroupKey2().equals("4")){    //深时
-                ssObjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("5")){    //深时
-                sgObjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-        }
-        for (DataGroupByCount dataGroupByCount : yzlDataList) {
-            yzlMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-        }
-        Long kkCount = 0L;
-        Long KjCount = 0L;
-        Long ssCount = 0L;
-        Long ssObjCount = 0L;
-        Long sgCount = 0L;
-        Long sgObjCount = 0L;
-        Long yzlCount = 0L;
-        if(dataType == 1){
-            kkCount = sceneProService.getKkCount(Arrays.asList("1","2","12","13","14"),startTime,userIds,null);
-            KjCount = sceneProService.getKkCount(Arrays.asList("3"),startTime,userIds,null);
-            ssCount = sceneProService.getSsCount(Arrays.asList("4"),startTime,userIds);
-            ssObjCount = sceneProService.getSsObjCount(Arrays.asList("4"),startTime,userIds);
-            sgCount = sceneProService.getSsCount(Arrays.asList("5"),startTime,userIds);
-            sgObjCount = sceneProService.getSsObjCount(Arrays.asList("5"),startTime,userIds);
-            yzlCount = sceneProService.getKkCount(Arrays.asList("1"),startTime,userIds,"yzl");
-        }
-        List<String> dates = Dateutils.findDatesStr(Dateutils.getDate(startTime), Dateutils.getDate(endTime),rule );
-        setListData(kkList,kkMap,dates,dataType,kkCount);
-        setListData(kjList,kjMap,dates,dataType,KjCount);
-        setListData(ssList,ssMap,dates,dataType,ssCount);
-        setListData(ssObjList,ssObjMap,dates,dataType,ssObjCount);
-
-        setListData(sgList,sgMap,dates,dataType,sgCount);
-        setListData(sgObjList,sgObjMap,dates,dataType,sgObjCount);
-        setListData(yzlList,yzlMap,dates,dataType,yzlCount);
 
-        map.put("kkList",kkList);
-        map.put("kjList",kjList);
-        map.put("ssList",ssList);
-        map.put("ssobjList",ssObjList);
-        map.put("sgList",sgList);
-        map.put("sgobjList",sgObjList);
-        map.put("yzlList",yzlList);
-        return map;
-    }
-
-
-    private void setListData(List<DataGroupByCount> kkList, HashMap<String, Long> kkMap, List<String> dates,Integer dataType,Long totalCount) {
-        for (String key : dates) {
-            DataGroupByCount newCount = new DataGroupByCount();
-            newCount.setGroupKey(key);
-            Long count = kkMap.get(key) == null ? 0L : kkMap.get(key);
-            if(dataType == 1){
-                count += totalCount;
-                totalCount = count;
-            }
-            newCount.setCount(count);
-            kkList.add(newCount);
-        }
-    }
-    private void setListData(List<DataGroupByCount> kkList, HashMap<String, Long> kkMap, List<String> dates) {
-        for (String key : dates) {
-            DataGroupByCount newCount = new DataGroupByCount();
-            newCount.setGroupKey(key);
-            Long count = kkMap.get(key) == null ? 0L : kkMap.get(key);
-            newCount.setCount(count);
-            kkList.add(newCount);
-        }
+        return dataList;
     }
 
+    @Autowired
+    IExcelService excelService;
     @Override
-    public HashMap<String, Object> cameraTrend(Integer type, String startTime, String endTime) {
-        startTime = Dateutils.formatStartTime(startTime);
-        endTime = Dateutils.formatEndTime(endTime);
-
-        HashMap<String,Object> map = new HashMap<>();
-        List<DataGroupByCount> allList = new ArrayList<>();
-        List<DataGroupByCount> kkList = new ArrayList<>();
-        List<DataGroupByCount> kjList = new ArrayList<>();
-        List<DataGroupByCount> ssList = new ArrayList<>();
-        List<DataGroupByCount> sgList = new ArrayList<>();
-        int rule = Dateutils.DAY;
-        switch (type){
-            case 0 :
-                allList = dataMapper.sceneOutTimeGroupBy("t_camera_detail",dayFormat,startTime,endTime);
-                break;
-            case 1 :
-                rule = Dateutils.WEEK;
-                allList = dataMapper.sceneOutTimeGroupByWeek("t_camera_detail",startTime,endTime);
-                break;
-            case 2 :
-                rule = Dateutils.MONTH;
-                allList = dataMapper.sceneOutTimeGroupBy("t_camera_detail",mouthFormat,startTime,endTime);
-                break;
-        }
-        HashMap<String, Long> kkMap = new HashMap<>();
-        HashMap<String, Long> kjMap = new HashMap<>();
-        HashMap<String, Long> ssMap = new HashMap<>();
-        HashMap<String, Long> sgMap = new HashMap<>();
-        for (DataGroupByCount dataGroupByCount : allList) {
-            if(dataGroupByCount.getGroupKey2().equals("9")){    //看见
-                kjMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("10")){    //深时
-                ssMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(dataGroupByCount.getGroupKey2().equals("11")){    //深时
-                sgMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
-            if(Arrays.asList("1").contains(dataGroupByCount.getGroupKey2())){    //看看
-                kkMap.merge(dataGroupByCount.getGroupKey(),dataGroupByCount.getCount(), Long:: sum);
-            }
+    public void exportSceneList(SceneTotalParam param, HttpServletRequest req, HttpServletResponse resp) {
+        commonSetParam(param);
+        List<ExportSceneList> exportSceneLists = dataMapper.getExPortSceneList(param);
+        try {
+            excelService.commonExport(req,resp,"场景数据",exportSceneLists, ExportSceneList.class);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
-        List<String> dates = Dateutils.findDatesStr(Dateutils.getDate(startTime), Dateutils.getDate(endTime),rule );
-        setListData(kkList,kkMap,dates);
-        setListData(kjList,kjMap,dates);
-        setListData(ssList,ssMap,dates);
-        setListData(sgList,sgMap,dates);
-
-        map.put("kkList",kkList);
-        map.put("kjList",kjList);
-        map.put("ssList",ssList);
-        map.put("sgList",sgList);
-        return map;
     }
 }

+ 40 - 0
src/main/java/com/fdkankan/manage/service/impl/DistrictCodeServiceImpl.java

@@ -5,9 +5,13 @@ import com.fdkankan.manage.entity.DistrictCode;
 import com.fdkankan.manage.mapper.IDistrictCodeMapper;
 import com.fdkankan.manage.service.IDistrictCodeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -31,4 +35,40 @@ public class DistrictCodeServiceImpl extends ServiceImpl<IDistrictCodeMapper, Di
         return list.get(0);
     }
 
+    @Override
+    public HashMap<String, DistrictCode> getByCodeList(List<String> districtCodeList) {
+        HashMap<String, DistrictCode> map = new HashMap<>();
+        if(districtCodeList == null || districtCodeList.isEmpty()){
+            return map;
+        }
+        LambdaQueryWrapper<DistrictCode> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(DistrictCode::getCode,districtCodeList);
+        List<DistrictCode> list = this.list(wrapper);
+        list.forEach(e -> map.put(e.getCode(),e));
+        return map;
+    }
+
+    @Override
+    public List<DistrictCode> treeList() {
+        List<DistrictCode> reList = new ArrayList<>();
+        List<DistrictCode> list = this.list();
+        if(list.isEmpty()){
+            return reList;
+        }
+        HashMap<String,DistrictCode> map = new HashMap<>();
+        list.forEach(e ->map.put(e.getCode(),e));
+        reList = list.stream().filter(e -> e.getParentCode().equals("XZQHDM")).collect(Collectors.toList());
+        getVoList(reList,list);
+        return reList;
+    }
+
+    private List<DistrictCode> getVoList (List<DistrictCode> oneList,List<DistrictCode> allList ){
+        List<DistrictCode> voList = new ArrayList<>();
+        for (DistrictCode districtCode : oneList) {
+            List<DistrictCode> twoList = allList.stream().filter(e -> e.getParentCode() !=null && e.getParentCode().equals(districtCode.getCode())).collect(Collectors.toList());
+            districtCode.setChildrenList(getVoList(twoList,allList));
+            voList.add(districtCode);
+        }
+        return voList;
+    }
 }

+ 1 - 0
src/main/java/com/fdkankan/manage/service/impl/ScenePlusServiceImpl.java

@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.manage.util.ShellUtil;
 import com.fdkankan.manage.vo.request.AllShareParam;
 import com.fdkankan.manage.vo.request.SceneParam;
+import com.fdkankan.manage.vo.request.SceneTotalParam;
 import com.fdkankan.manage.vo.response.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;

+ 6 - 4
src/main/java/com/fdkankan/manage/service/impl/SysRoleServiceImpl.java

@@ -99,10 +99,12 @@ public class SysRoleServiceImpl extends ServiceImpl<ISysRoleMapper, SysRole> imp
         return false;
     }
     @Override
-    public Boolean isAdmin(Long roleId) {
-        SysRole byId = this.getById(roleId);
-        if(byId != null && byId.getRoleType().contains("admin")){
-            return true;
+    public Boolean isSuperAdmin() {
+        List<String> roleList = StpUtil.getRoleList();
+        for (String roleType : roleList) {
+            if(roleType.contains("super-admin")){
+                return true;
+            }
         }
         return false;
     }

+ 18 - 0
src/main/java/com/fdkankan/manage/util/Dateutils.java

@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAdjusters;
 import java.util.ArrayList;
@@ -111,6 +112,13 @@ public class Dateutils {
         return c.getTime();
     }
 
+    public static Date getAddTime(Integer day,Integer rule) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(new Date());
+        c.add(rule, day);
+        return c.getTime();
+    }
+
     public static  String getLastMonTh(Date date){
         Calendar ca = Calendar.getInstance();
         ca.setTime(date);
@@ -158,4 +166,14 @@ public class Dateutils {
         return endTime +" 23:59:59";
     }
 
+    // 获取30天前的时间
+    public static LocalDateTime getDaysAgo(Integer day) {
+        return LocalDateTime.now().minusDays(day);
+    }
+    public static String getDaysAgoStr(Integer day) {
+        return getDaysAgo(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+    }
+    public static void main(String[] args) {
+        System.out.println();
+    }
 }

+ 44 - 0
src/main/java/com/fdkankan/manage/vo/request/SceneTotalParam.java

@@ -0,0 +1,44 @@
+package com.fdkankan.manage.vo.request;
+
+import com.fdkankan.manage.util.Dateutils;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+
+@Data
+public class SceneTotalParam {
+    private Long userId;
+    private Integer platformId;
+    private Integer cameraType;
+    private String startTime;
+    private String endTime;
+
+
+    private String districtCode;
+    private List<String> districtCodeList;
+    private String jyType;
+    private List<String> timeList;
+
+    public String getStartTime() {
+        if(StringUtils.isBlank(startTime) && timeList != null && timeList.size() >0){
+            return Dateutils.getStartTime(timeList.get(0));
+        }
+        if(StringUtils.isNotBlank(startTime)){
+
+            return Dateutils.getStartTime(startTime);
+        }
+        return startTime;
+    }
+
+    public String getEndTime() {
+        if(StringUtils.isBlank(endTime) && timeList != null && timeList.size() >1){
+            return Dateutils.getEndTime(timeList.get(1));
+        }
+        if(StringUtils.isNotBlank(endTime)){
+
+            return Dateutils.getEndTime(endTime);
+        }
+        return endTime;
+    }
+}

+ 50 - 0
src/main/java/com/fdkankan/manage/vo/response/ExportSceneList.java

@@ -0,0 +1,50 @@
+package com.fdkankan.manage.vo.response;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+@Data
+public class ExportSceneList {
+
+    @ExcelProperty("标题")
+    private String title;
+
+    @ExcelProperty("民警姓名")
+    private String ryNickName;
+
+    @ExcelProperty("民警编号")
+    private String ryNo;
+
+    @ExcelProperty("警种")
+    private String jyType;
+
+    @ExcelProperty("民警所在单位")
+    private String jyDept;
+
+    @ExcelProperty("拍摄设备码")
+    private String snCode;
+
+    @ExcelProperty("拍摄时间")
+    private String createTime;
+
+    @ExcelProperty("勘验号")
+    private String kno;
+
+    @ExcelProperty("警情编号")
+    private String jqNo;
+
+    @ExcelProperty("案件编号")
+    private String caseNo;
+
+    @ExcelProperty("案件地址")
+    private String caseAddress;
+
+    @ExcelProperty("案件类型")
+    private String caseType;
+
+    @ExcelProperty("扫描点位数")
+    private String shootCount;
+
+    @ExcelProperty("勘验时间")
+    private String crimeTime;
+}

+ 20 - 0
src/main/java/com/fdkankan/manage/vo/response/GroupByCountVo.java

@@ -0,0 +1,20 @@
+package com.fdkankan.manage.vo.response;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GroupByCountVo {
+    private String groupKey;
+    private Long totalCount;
+    private String groupName;
+
+
+    public GroupByCountVo(String groupKey, Long totalCount) {
+        this.groupKey = groupKey;
+        this.totalCount = totalCount;
+    }
+}

+ 24 - 3
src/main/java/com/fdkankan/manage/vo/response/SceneTotalVo.java

@@ -4,7 +4,28 @@ import lombok.Data;
 
 @Data
 public class SceneTotalVo {
-    private Long totalSceneCount = 0L;         //累计场景数量数
-    private Long preMonthAddCount = 0L;       //上月新增用户
-    private Long todayAddCount = 0L;          //今日新增用户
+    /**
+     * 场景总数
+     */
+    private Long totalSceneCount = 0L;
+    /**
+     * 登录用户场景数
+     */
+    private Long userSceneCount = 0L;
+    /**
+     * 30日场景数
+     */
+    private Long timeSceneCount = 0L;
+    /**
+     * 30日场景数
+     */
+    private Long todaySceneCount = 0L;
+    /**
+     * 采集用户数
+     */
+    private Long totalSceneUserCount = 0L;
+    /**
+     * 总用户数
+     */
+    private Long totalUserCount = 0L;
 }

+ 11 - 0
src/main/java/com/fdkankan/manage/vo/response/SceneTrendVoList.java

@@ -0,0 +1,11 @@
+package com.fdkankan.manage.vo.response;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SceneTrendVoList {
+    private String type;
+    private List<GroupByCountVo> list;
+}

+ 68 - 247
src/main/resources/mapper/manage/DataMapper.xml

@@ -2,277 +2,98 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.manage.mapper.IDataMapper">
 
-    <select id="userDataGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT DATE_FORMAT(create_time,#{dateFormat}) AS groupKey, count(id) AS count FROM ${tb} WHERE rec_status = 'A'
-           and create_time between #{startTime} and #{endTime}
-        <include refid="tbWhereSql"></include>
-        GROUP BY groupKey
-    </select>
-
-    <select id="userDataSumGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupBySum">
-        SELECT DATE_FORMAT(create_time,#{dateFormat}) AS groupKey,
-        <if test="tb == 't_order'">
-            sum(total_amount) AS count
-        </if>
-        <if test="tb != 't_order'">
-            sum(amount) AS count
-        </if>
-        FROM ${tb} WHERE rec_status = 'A'
-        and create_time between #{startTime} and #{endTime}
-        <include refid="tbWhereSql"></include>
-        GROUP BY groupKey
-    </select>
 
-    <select id="userDataGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT groupKey ,count(1) as count FROM (
-               select date_format(date_add(create_time,interval-(weekday(create_time ))day),'%Y-%m-%d')  as groupKey
-                from ${tb}
-               WHERE rec_status = 'A'
-                 and create_time between #{startTime} and #{endTime}
-                <include refid="tbWhereSql"></include>
-         ) as tb GROUP BY groupKey
+    <select id="totalSceneCount" resultType="java.lang.Long">
+        SELECT count(1) from t_scene_plus s
+                         left join jy_user jy on s.user_id = jy.user_id
+                        left join t_camera_detail d on s.camera_id = d.camera_id
+        <include refid="commonWhere"></include>
     </select>
-    <select id="userDataSumGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupBySum">
-        SELECT groupKey ,sum(amount) as count FROM (
-               select
-
-        <if test="tb == 't_order'">
-            total_amount as amount
+    <select id="totalUserCount" resultType="java.lang.Long">
+        select count(1) from jy_user
+        where rec_status = 'A'
+        <if test="param.userId != null">
+            and user_id =#{param.userId}
         </if>
-        <if test="tb != 't_order'">
-            amount
+        <if test="param.platformId != null">
+            and platfrom_id =#{param.platformId}
         </if>
-            ,date_format(date_add(create_time,interval-(weekday(create_time ))day),'%Y-%m-%d')  as groupKey
-                from ${tb}
-               WHERE rec_status = 'A'
-                 and create_time between #{startTime} and #{endTime}
-                <include refid="tbWhereSql"></include>
-         ) as tb GROUP BY groupKey
     </select>
-
-
-    <sql id="typeSQL">
-        <if test="type == 1">
-            and is_upgrade = 0
-        </if>
-        <if test="type == 2">
-            and pay_status = 1
+    <select id="totalSceneUserCount" resultType="com.fdkankan.manage.vo.response.GroupByCount">
+        SELECT s.user_id as id,count(1) as count from t_scene_plus s
+        left join jy_user jy on s.user_id = jy.user_id
+        left join t_camera_detail d on s.camera_id = d.camera_id
+        where s.rec_status = 'A'
+        <if test="param.userId != null">
+            and s.user_id =#{param.userId}
         </if>
-        <if test="type == 3">
-            and payment_status = 'paid'
-        </if>
-    </sql>
-    <sql id="tbWhereSql">
-        <if test="tb == 't_increment_order' || tb == 't_download_order'">
-            and pay_status = 1
+        <if test="param.platformId != null">
+            and jy.platfrom_id =#{param.platformId}
         </if>
-        <if test="tb == 't_order' ">
-            and payment_status = 'paid'
-        </if>
-    </sql>
-
-    <select id="totalUserCount" resultType="java.lang.Long">
-        select  count(id) from ${tb} where rec_status = 'A'
-        <include refid="typeSQL"></include>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
+        <if test="param.cameraType!=null ">
+            and d.type = #{param.cameraType}
         </if>
+        GROUP BY s.user_id
     </select>
 
-    <select id="preMonthAddCount" resultType="java.lang.Long">
-        SELECT count(id) FROM ${tb}
-        WHERE rec_status = 'A' and date_format(create_time, '%Y %m') = date_format(DATE_SUB(curdate(), INTERVAL 1 MONTH),'%Y %m')
-        <include refid="typeSQL"></include>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
-        </if>
-    </select>
+    <select id="getSceneGroupByDay" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
+        SELECT DATE(s.create_time) as groupKey,count(1) as totalCount from t_scene_plus s
+        left join jy_user jy on s.user_id = jy.user_id
+        left join t_camera_detail d on s.camera_id = d.camera_id
+        <include refid="commonWhere"></include>
+        GROUP BY  DATE(s.create_time)
 
-    <select id="todayAddCount" resultType="java.lang.Long">
-        SELECT count(id) FROM ${tb}
-        WHERE rec_status = 'A' and DATEDIFF(create_time,NOW())=0
-        <include refid="typeSQL"></include>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
-        </if>
     </select>
 
-    <select id="todayActiveCount" resultType="java.lang.Long">
-        SELECT count(distinct user_name) FROM t_login_log
-        WHERE rec_status = 'A' and DATEDIFF(create_time,NOW())=0
+    <select id="getUserGroupByDay" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
+        SELECT DATE(s.create_time) as groupKey,s.user_id,count(1) as totalCount from t_scene_plus s
+        left join jy_user jy on s.user_id = jy.user_id
+        left join t_camera_detail d on s.camera_id = d.camera_id
+        <include refid="commonWhere"></include>
+        GROUP BY  DATE(s.create_time), s.user_id
     </select>
-
-    <select id="sceneGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT DATE_FORMAT(create_time,#{dateFormat}) AS groupKey, count(id) AS count ,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source as groupKey2
-        </if>
-        <if test="tb == 't_camera_detail'">
-            type as groupKey2
-        </if>
-        FROM ${tb}
-        WHERE rec_status = 'A'
-          <if test="tb == 't_scene_pro'">
-              AND is_upgrade = 0
-          </if>
-        <if test="threeCamType !=null and threeCamType != ''">
-            AND three_cam_type is not null
-        </if>
-        <if test="threeCamType == null">
-            AND three_cam_type is  null
-        </if>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
-        </if>
-        and create_time between #{startTime} and #{endTime}
-        GROUP BY groupKey ,groupKey2
+    <select id="getSceneGroupByDistrict" resultType="com.fdkankan.manage.vo.response.GroupByCountVo">
+        SELECT s.district_code as groupKey,count(1) as totalCount from t_scene_plus s
+        left join jy_user jy on s.user_id = jy.user_id
+        left join t_camera_detail d on s.camera_id = d.camera_id
+        <include refid="commonWhere"></include>
+        GROUP BY  s.district_code
     </select>
-
-    <select id="sceneGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT groupKey ,count(1) as count,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source as groupKey2
-        </if>
-        <if test="tb == 't_camera_detail'">
-            type as groupKey2
-        </if>
-        FROM (
-        select date_format(date_add(create_time,interval-(weekday(create_time ))day),'%Y-%m-%d')  as groupKey,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source
-        </if>
-        <if test="tb == 't_camera_detail'">
-            type
-        </if>
-        from ${tb}
-        WHERE rec_status = 'A'
-        <if test="tb == 't_scene_pro'">
-            AND is_upgrade = 0
-        </if>
-        <if test="threeCamType !=null and threeCamType != ''">
-            AND three_cam_type is not null
-        </if>
-        <if test="threeCamType == null">
-            AND three_cam_type is  null
-        </if>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
-        </if>
-        and create_time between #{startTime} and #{endTime}
-        ) as tb GROUP BY groupKey,groupKey2
-    </select>
-
-
-
-    <select id="sceneObjGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT DATE_FORMAT( p.create_time,#{dateFormat}) AS groupKey, count(p.id) AS count , scene_source as groupKey2
-        FROM ${tb} p
-        <if test="tb == 't_scene_plus'">
-            LEFT JOIN t_scene_plus_ext e on p.id = e.plus_id
-        </if>
-        WHERE p.rec_status = 'A'    and is_obj = 1
-        <if test="tb == 't_scene_pro'">
-            AND is_upgrade = 0
-        </if>
-        <if test="threeCamType !=null and threeCamType != ''">
-            AND p.three_cam_type is not null
-        </if>
-        <if test="threeCamType == null">
-            AND p.three_cam_type is  null
-        </if>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
+    <select id="getExPortSceneList" resultType="com.fdkankan.manage.vo.response.ExportSceneList">
+        select s.title,jy.ry_nick_name,jy.ry_no,a.sn_code, s.create_time ,e.shoot_count,s.k_no
+        from t_scene_plus s LEFT JOIN t_scene_plus_ext e on s.id =e.plus_id
+        left join jy_user jy on s.user_id = jy.user_id
+        left join t_camera a on s.camera_id = a.id
+        left join t_camera_detail d on s.camera_id = d.camera_id
+       <include refid="commonWhere"></include>
+        <if test="param.districtCodeList!=null and param.districtCodeList.size >0">
+            and s.district_code in
+            <foreach item="districtCode" collection="param.districtCodeList" open="(" separator="," close=")">
+                #{districtCode}
             </foreach>
         </if>
-        and p.create_time between #{startTime} and #{endTime}
-        GROUP BY groupKey ,groupKey2
     </select>
 
-    <select id="sceneObjGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT groupKey ,count(1) as count,  scene_source as groupKey2
-        FROM (
-        select date_format(date_add(p.create_time,interval-(weekday(p.create_time ))day),'%Y-%m-%d')  as groupKey,scene_source
-        from ${tb} p
-        <if test="tb == 't_scene_plus'">
-            LEFT JOIN t_scene_plus_ext e on p.id = e.plus_id
-        </if>
-        WHERE p.rec_status = 'A' and is_obj = 1
-        <if test="tb == 't_scene_pro'">
-            AND is_upgrade = 0
-        </if>
-        <if test="threeCamType !=null and threeCamType != ''">
-            AND p.three_cam_type is not null
-        </if>
-        <if test="threeCamType == null">
-            AND p.three_cam_type is  null
-        </if>
-        <if test="userIds != null and userIds.size >0">
-            and user_id in
-            <foreach item="userId" collection="userIds" open="(" separator="," close=")">
-                #{userId}
-            </foreach>
-        </if>
-        and p.create_time between #{startTime} and #{endTime}
-        ) as tb GROUP BY groupKey,groupKey2
-    </select>
 
-    <select id="sceneOutTimeGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT DATE_FORMAT(out_time,#{dateFormat}) AS groupKey, count(id) AS count ,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source as groupKey2
+    <sql id="commonWhere">
+        where s.rec_status = 'A'
+        <if test="param.userId != null">
+            and s.user_id =#{param.userId}
         </if>
-        <if test="tb == 't_camera_detail'">
-            type as groupKey2
+        <if test="param.platformId != null">
+            and jy.platfrom_id =#{param.platformId}
         </if>
-        FROM ${tb}
-        WHERE rec_status = 'A'
-        <if test="tb == 't_scene_pro'">
-            AND is_upgrade = 0
+        <if test="param.startTime != null and param.startTime!=''">
+            and s.create_time &gt;=#{param.startTime}
         </if>
-        and out_time between #{startTime} and #{endTime}
-        GROUP BY groupKey ,groupKey2
-    </select>
-
-    <select id="sceneOutTimeGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupByCount">
-        SELECT groupKey ,count(1) as count,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source as groupKey2
-        </if>
-        <if test="tb == 't_camera_detail'">
-            type as groupKey2
-        </if>
-        FROM (
-        select date_format(date_add(out_time,interval-(weekday(out_time ))day),'%Y-%m-%d')  as groupKey,
-        <if test="tb == 't_scene_pro' or tb == 't_scene_plus' ">
-            scene_source
+        <if test="param.endTime != null and param.endTime!=''">
+            and s.create_time &lt;=#{param.endTime}
         </if>
-        <if test="tb == 't_camera_detail'">
-            type
+        <if test="param.districtCode!=null and param.districtCode != ''">
+            and s.district_code = #{param.districtCode}
         </if>
-        from ${tb}
-        WHERE rec_status = 'A'
-        <if test="tb == 't_scene_pro'">
-            AND is_upgrade = 0
+        <if test="param.cameraType!=null ">
+            and d.type = #{param.cameraType}
         </if>
-        and out_time between #{startTime} and #{endTime}
-        ) as tb GROUP BY groupKey,groupKey2
-    </select>
-
+    </sql>
 </mapper>