|
|
|
@ -7,14 +7,8 @@ import com.ruoyi.business.domain.vo.HumanVehicleStatisticsVo;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.utils.StringKit;
|
|
|
|
|
import com.ruoyi.database.domain.TransitImpUserRecord;
|
|
|
|
|
import com.ruoyi.database.domain.TransitImpVehicleRecord;
|
|
|
|
|
import com.ruoyi.database.domain.TransitUserRecord;
|
|
|
|
|
import com.ruoyi.database.domain.TransitVehicleRecord;
|
|
|
|
|
import com.ruoyi.database.service.TransitImpUserRecordService;
|
|
|
|
|
import com.ruoyi.database.service.TransitImpVehicleRecordService;
|
|
|
|
|
import com.ruoyi.database.service.TransitUserRecordService;
|
|
|
|
|
import com.ruoyi.database.service.TransitVehicleRecordService;
|
|
|
|
|
import com.ruoyi.database.domain.*;
|
|
|
|
|
import com.ruoyi.database.service.*;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@ -23,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.TreeMap;
|
|
|
|
|
|
|
|
|
@ -42,27 +37,35 @@ public class PerceptionDeviceController extends BaseController {
|
|
|
|
|
private final TransitImpVehicleRecordService vehicleRecordService;
|
|
|
|
|
private final TransitVehicleRecordService transitVehicleRecordService;
|
|
|
|
|
private final TransitUserRecordService transitUserRecordService;
|
|
|
|
|
private final DevopsDeviceInfoService devopsDeviceInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/humanVehicleStatistics")
|
|
|
|
|
@ApiOperation("人车统计")
|
|
|
|
|
public AjaxResult overviewResources() {
|
|
|
|
|
try {
|
|
|
|
|
// 人流量统计
|
|
|
|
|
String todayDateString = DateUtil.today();
|
|
|
|
|
QueryWrapper<TransitImpUserRecord> userQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
userQueryWrapper.eq("DATE(partition_field)", todayDateString);
|
|
|
|
|
int userCount = userRecordService.count(userQueryWrapper);
|
|
|
|
|
//车流量统计
|
|
|
|
|
QueryWrapper<TransitImpVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
vehicleQueryWrapper.eq("DATE(partition_field)", todayDateString);
|
|
|
|
|
int vehicleCount = vehicleRecordService.count(vehicleQueryWrapper);
|
|
|
|
|
|
|
|
|
|
HumanVehicleStatisticsVo bean = new HumanVehicleStatisticsVo();
|
|
|
|
|
bean.setUserCount(StringKit.toString(userCount));
|
|
|
|
|
bean.setVehicleCount(StringKit.toString(vehicleCount));
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success(bean);
|
|
|
|
|
// // 人流量统计
|
|
|
|
|
// String todayDateString = DateUtil.today();
|
|
|
|
|
// QueryWrapper<TransitImpUserRecord> userQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// userQueryWrapper.eq("DATE(partition_field)", todayDateString);
|
|
|
|
|
// int userCount = userRecordService.count(userQueryWrapper);
|
|
|
|
|
// //车流量统计
|
|
|
|
|
// QueryWrapper<TransitImpVehicleRecord> vehicleQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
// vehicleQueryWrapper.eq("DATE(partition_field)", todayDateString);
|
|
|
|
|
// int vehicleCount = vehicleRecordService.count(vehicleQueryWrapper);
|
|
|
|
|
//
|
|
|
|
|
// HumanVehicleStatisticsVo bean = new HumanVehicleStatisticsVo();
|
|
|
|
|
// bean.setUserCount(StringKit.toString(userCount));
|
|
|
|
|
// bean.setVehicleCount(StringKit.toString(vehicleCount));
|
|
|
|
|
//
|
|
|
|
|
// return AjaxResult.success(bean);
|
|
|
|
|
|
|
|
|
|
Integer userCount = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getDeviceType, 1).count();
|
|
|
|
|
Integer vehicleCount = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getDeviceType, 2).count();
|
|
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
|
|
|
map.put("userCount",userCount);
|
|
|
|
|
map.put("vehicleCount",vehicleCount);
|
|
|
|
|
return AjaxResult.success(map);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.info(StringKit.toString(e));
|
|
|
|
|
return AjaxResult.error("请求失败,请联系管理员");
|
|
|
|
|