isc推数据到环境模块,污水取数据,车辆超速
This commit is contained in:
parent
ce242aa50e
commit
c2c38627d7
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.xuyanwu.spring.file.storage.FileStorageService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@ -36,6 +37,8 @@ import com.zhgd.xmgl.modules.car.mapper.CarPassRecordMapper;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarTypeMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.impl.CarInfoServiceImpl;
|
||||
import com.zhgd.xmgl.modules.car.service.impl.CarPassRecordServiceImpl;
|
||||
import com.zhgd.xmgl.modules.environment.entity.DustNoiseData;
|
||||
import com.zhgd.xmgl.modules.environment.service.IDustNoiseDataService;
|
||||
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetData;
|
||||
import com.zhgd.xmgl.modules.frontierprotectionnonet.mapper.FrontierProtectionNoNetDevMapper;
|
||||
import com.zhgd.xmgl.modules.frontierprotectionnonet.service.IFrontierProtectionNoNetDevService;
|
||||
@ -227,6 +230,8 @@ public class HikvisionCall {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
@Autowired
|
||||
private IDustNoiseDataService dustNoiseDataService;
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
@ -426,6 +431,64 @@ public class HikvisionCall {
|
||||
frontierProtectionNoNetDataService.add(data1);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(ability, "event_pe")) {
|
||||
log.info("动环事件");
|
||||
JSONArray eventsJa = paramsJo.getJSONArray("events");
|
||||
if (eventsJa != null) {
|
||||
DustNoiseData data = new DustNoiseData();
|
||||
for (int i = 0; i < eventsJa.size(); i++) {
|
||||
JSONObject eventJo = eventsJa.getJSONObject(i);
|
||||
//{
|
||||
// "data": {
|
||||
// "channel": 5,
|
||||
// "deviceTypeCode": "generalTransducer",
|
||||
// "isAlarm": 0,
|
||||
// "realValue": 49.79999923706055
|
||||
// },
|
||||
// "eventId": "bff12984-7bd4-11ef-8471-e8611f62fd07",
|
||||
// "eventType": 459010,
|
||||
// "happenTime": "2024-09-26T14:58:35.531+08:00",
|
||||
// "srcIndex": "61fa6c9417c4439c81952fff8055be72",
|
||||
// "srcParentIndex": "1833670489a64a0eb5262fd471eb4944",
|
||||
// "srcType": "sensor",
|
||||
// "status": 0,
|
||||
// "timeout": 0
|
||||
// }
|
||||
JSONObject dataJo = eventJo.getJSONObject(DATA);
|
||||
String srcParentIndex = eventJo.getString("srcParentIndex");
|
||||
String happenTime = eventJo.getString("happenTime");
|
||||
Integer eventType = eventJo.getInteger("eventType");
|
||||
Double realValue = NumberUtil.round(dataJo.getDouble("realValue"), 4).doubleValue();
|
||||
switch (eventType) {
|
||||
case 459010:
|
||||
data.setHumidity(realValue);
|
||||
break;
|
||||
case 459009:
|
||||
data.setTemperature(realValue);
|
||||
break;
|
||||
case 459011:
|
||||
data.setWindspeed(realValue);
|
||||
break;
|
||||
case 459023:
|
||||
data.setPressure(realValue);
|
||||
break;
|
||||
case 459028:
|
||||
data.setNoise(realValue);
|
||||
break;
|
||||
|
||||
}
|
||||
data.setDeviceId(srcParentIndex);
|
||||
data.setUploadDate(DateUtil.formatDateTime(DateUtil.parse(happenTime)));
|
||||
data.setPm10(realValue);
|
||||
data.setPm25(realValue);
|
||||
// data.setTsp(realValue);
|
||||
data.setWinddirection("");
|
||||
// data.setVoltage(realValue);
|
||||
// data.setPlateTemperature(realValue);
|
||||
// data.setPlateHumidity(realValue);
|
||||
}
|
||||
dustNoiseDataService.saveDustNoiseData(data);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(ability1, EVENT_IAS)) {
|
||||
addFrontierProtectionNoNetData(jsonObject);
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package com.zhgd.xmgl.modules.car.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendVo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import com.zhgd.xmgl.modules.video.service.IVideoItemService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/carMeasureSpeedBigScreen")
|
||||
@Slf4j
|
||||
@Api(tags = "车辆测速大屏相关Api")
|
||||
public class CarMeasureSpeedBigScreenController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDataService carMeasureSpeedDataService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDevService carMeasureSpeedDevService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IVideoItemService videoItemService;
|
||||
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "分页查询", operDesc = "分页列表查询车辆测速数据信息")
|
||||
@ApiOperation(value = "分页列表查询车辆测速数据信息", notes = "分页列表查询车辆测速数据信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<CarMeasureSpeedData>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDataService.queryPageList(param));
|
||||
}
|
||||
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "", operDesc = "统计设备")
|
||||
@ApiOperation(value = "统计设备", notes = "统计设备", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String")
|
||||
@GetMapping(value = "/countDev")
|
||||
public Result<CarMeasureSpeedDevCountVo> countDev(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDevService.countDev(param));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据项目sn查询启用的的视频列表", notes = "根据项目sn查询启用的的视频列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping("/selectEnableVideoItemList")
|
||||
public Result<Map<String, Object>> selectEnableVideoItemList(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(videoItemService.selectEnableVideoItemList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "一周内超速次数变化趋势分析", notes = "一周内超速次数变化趋势分析", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping("/getExceedSpeedTrend")
|
||||
public Result<List<TrendOneVo>> getExceedSpeedTrend(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(carMeasureSpeedDataService.getExceedSpeedTrend(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "每日车辆数", notes = "每日车辆数", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping("/getCarDaily")
|
||||
public Result<List<TrendOneVo>> getCarDaily(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(carMeasureSpeedDataService.getCarDaily(map));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.zhgd.xmgl.modules.car.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 车辆测速数据
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/carMeasureSpeedData")
|
||||
@Slf4j
|
||||
@Api(tags = "车辆测速数据相关Api")
|
||||
public class CarMeasureSpeedDataController {
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDataService carMeasureSpeedDataService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "分页查询", operDesc = "分页列表查询车辆测速数据信息")
|
||||
@ApiOperation(value = "分页列表查询车辆测速数据信息", notes = "分页列表查询车辆测速数据信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<CarMeasureSpeedData>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDataService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "列表查询", operDesc = "列表查询车辆测速数据信息")
|
||||
@ApiOperation(value = "列表查询车辆测速数据信息", notes = "列表查询车辆测速数据信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<CarMeasureSpeedData>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDataService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param carMeasureSpeedData
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "添加", operDesc = "添加车辆测速数据信息")
|
||||
@ApiOperation(value = "添加车辆测速数据信息", notes = "添加车辆测速数据信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<CarMeasureSpeedData> add(@RequestBody @Validate CarMeasureSpeedData carMeasureSpeedData) {
|
||||
carMeasureSpeedDataService.add(carMeasureSpeedData);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param carMeasureSpeedData
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "编辑", operDesc = "编辑车辆测速数据信息")
|
||||
@ApiOperation(value = "编辑车辆测速数据信息", notes = "编辑车辆测速数据信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<CarMeasureSpeedData> edit(@RequestBody CarMeasureSpeedData carMeasureSpeedData) {
|
||||
carMeasureSpeedDataService.edit(carMeasureSpeedData);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "删除", operDesc = "删除车辆测速数据信息")
|
||||
@ApiOperation(value = "删除车辆测速数据信息", notes = "删除车辆测速数据信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "车辆测速数据ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<CarMeasureSpeedData> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
carMeasureSpeedDataService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速数据管理", operType = "通过id查询", operDesc = "通过id查询车辆测速数据信息")
|
||||
@ApiOperation(value = "通过id查询车辆测速数据信息", notes = "通过id查询车辆测速数据信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "车辆测速数据ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CarMeasureSpeedData> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(carMeasureSpeedDataService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.zhgd.xmgl.modules.car.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 车辆测速设备
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/carMeasureSpeedDev")
|
||||
@Slf4j
|
||||
@Api(tags = "车辆测速设备相关Api")
|
||||
public class CarMeasureSpeedDevController {
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDevService carMeasureSpeedDevService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "分页查询", operDesc = "分页列表查询车辆测速设备信息")
|
||||
@ApiOperation(value = "分页列表查询车辆测速设备信息", notes = "分页列表查询车辆测速设备信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<CarMeasureSpeedDev>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDevService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "列表查询", operDesc = "列表查询车辆测速设备信息")
|
||||
@ApiOperation(value = "列表查询车辆测速设备信息", notes = "列表查询车辆测速设备信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<CarMeasureSpeedDev>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(carMeasureSpeedDevService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param carMeasureSpeedDev
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "添加", operDesc = "添加车辆测速设备信息")
|
||||
@ApiOperation(value = "添加车辆测速设备信息", notes = "添加车辆测速设备信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<CarMeasureSpeedDev> add(@RequestBody @Validate CarMeasureSpeedDev carMeasureSpeedDev) {
|
||||
carMeasureSpeedDevService.add(carMeasureSpeedDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param carMeasureSpeedDev
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "编辑", operDesc = "编辑车辆测速设备信息")
|
||||
@ApiOperation(value = "编辑车辆测速设备信息", notes = "编辑车辆测速设备信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<CarMeasureSpeedDev> edit(@RequestBody CarMeasureSpeedDev carMeasureSpeedDev) {
|
||||
carMeasureSpeedDevService.edit(carMeasureSpeedDev);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "删除", operDesc = "删除车辆测速设备信息")
|
||||
@ApiOperation(value = "删除车辆测速设备信息", notes = "删除车辆测速设备信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "车辆测速设备ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<CarMeasureSpeedDev> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
carMeasureSpeedDevService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "车辆测速设备管理", operType = "通过id查询", operDesc = "通过id查询车辆测速设备信息")
|
||||
@ApiOperation(value = "通过id查询车辆测速设备信息", notes = "通过id查询车辆测速设备信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "车辆测速设备ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<CarMeasureSpeedDev> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(carMeasureSpeedDevService.queryById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.zhgd.xmgl.modules.car.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速数据
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("car_measure_speed_data")
|
||||
@ApiModel(value = "CarMeasureSpeedData实体类", description = "CarMeasureSpeedData")
|
||||
public class CarMeasureSpeedData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 车辆测速数据id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "车辆测速数据id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private java.lang.String devSn;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
private java.lang.String carNumber;
|
||||
/**
|
||||
* 是否超出阈值1是0否
|
||||
*/
|
||||
@ApiModelProperty(value = "是否超出阈值1是0否")
|
||||
private java.lang.Integer isExceed;
|
||||
/**
|
||||
* 当前车速(km/h)
|
||||
*/
|
||||
@ApiModelProperty(value = "当前车速(km/h)")
|
||||
private java.math.BigDecimal currentSpeed;
|
||||
/**
|
||||
* 超出阈值多少
|
||||
*/
|
||||
@ApiModelProperty(value = "超出阈值多少")
|
||||
private java.math.BigDecimal exceedingThreshold;
|
||||
/**
|
||||
* 抓拍图片
|
||||
*/
|
||||
@ApiModelProperty(value = "抓拍图片")
|
||||
private java.lang.String snapshotImage;
|
||||
/**
|
||||
* 上传时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "上传时间")
|
||||
private java.util.Date uploadTime;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 创建时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private java.lang.String deviceName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "合作单位名称")
|
||||
private java.lang.String enterpriseName;
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.zhgd.xmgl.modules.car.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速设备
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("car_measure_speed_dev")
|
||||
@ApiModel(value = "CarMeasureSpeedDev实体类", description = "CarMeasureSpeedDev")
|
||||
public class CarMeasureSpeedDev implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 车辆测速设备id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "车辆测速设备id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private java.lang.String deviceName;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private java.lang.String devSn;
|
||||
/**
|
||||
* 设备地址
|
||||
*/
|
||||
@ApiModelProperty(value = "设备地址")
|
||||
private java.lang.String deviceAddress;
|
||||
/**
|
||||
* 备案时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "备案时间")
|
||||
private java.util.Date recordTime;
|
||||
/**
|
||||
* 阈值
|
||||
*/
|
||||
@ApiModelProperty(value = "阈值")
|
||||
private java.math.BigDecimal threshold;
|
||||
/**
|
||||
* 是否启用,1启用0不启用
|
||||
*/
|
||||
@ApiModelProperty(value = "是否启用,1启用0不启用")
|
||||
private java.lang.Integer enabled;
|
||||
/**
|
||||
* 显示的名字
|
||||
*/
|
||||
@ApiModelProperty(value = "显示的名字")
|
||||
private java.lang.String displayedName;
|
||||
/**
|
||||
* 设备所在经度
|
||||
*/
|
||||
@ApiModelProperty(value = "设备所在经度")
|
||||
private java.lang.String lng;
|
||||
/**
|
||||
* 设备所在纬度
|
||||
*/
|
||||
@ApiModelProperty(value = "设备所在纬度")
|
||||
private java.lang.String lat;
|
||||
/**
|
||||
* 摄像头
|
||||
*/
|
||||
@ApiModelProperty(value = "摄像头")
|
||||
private java.lang.String camera;
|
||||
/**
|
||||
* 报警推送人
|
||||
*/
|
||||
@ApiModelProperty(value = "报警推送人")
|
||||
private java.lang.String alarmPusher;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 创建时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
/**
|
||||
* 上次数据上传时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "上次数据上传时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date lastDataTime;
|
||||
/**
|
||||
* 分包单位ids
|
||||
*/
|
||||
@ApiModelProperty(value = "分包单位ids")
|
||||
private java.lang.String enterpriseIds;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.zhgd.xmgl.modules.car.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CarMeasureSpeedDevCountVo {
|
||||
@ApiModelProperty("设备总数")
|
||||
private Integer total;
|
||||
@ApiModelProperty("设备在线数量")
|
||||
private Integer online;
|
||||
@ApiModelProperty("设备离线率")
|
||||
private BigDecimal offlinePercent;
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.zhgd.xmgl.modules.car.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速数据
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarMeasureSpeedDataMapper extends BaseMapper<CarMeasureSpeedData> {
|
||||
|
||||
/**
|
||||
* 分页列表查询车辆测速数据信息
|
||||
*
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
IPage<CarMeasureSpeedData> queryList(Page<CarMeasureSpeedData> page, @Param(Constants.WRAPPER) QueryWrapper<CarMeasureSpeedData> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询车辆测速数据信息
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<CarMeasureSpeedData> queryList(@Param(Constants.WRAPPER) QueryWrapper<CarMeasureSpeedData> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询车辆测速数据信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CarMeasureSpeedData queryById(String id);
|
||||
|
||||
List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map);
|
||||
|
||||
List<TrendOneVo> getCarDaily(Map<String, Object> map);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.zhgd.xmgl.modules.car.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速设备
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarMeasureSpeedDevMapper extends BaseMapper<CarMeasureSpeedDev> {
|
||||
|
||||
/**
|
||||
* 分页列表查询车辆测速设备信息
|
||||
*
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
IPage<CarMeasureSpeedDev> queryList(Page<CarMeasureSpeedDev> page, @Param(Constants.WRAPPER) QueryWrapper<CarMeasureSpeedDev> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询车辆测速设备信息
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<CarMeasureSpeedDev> queryList(@Param(Constants.WRAPPER) QueryWrapper<CarMeasureSpeedDev> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询车辆测速设备信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CarMeasureSpeedDev queryById(String id);
|
||||
|
||||
CarMeasureSpeedDevCountVo countDev(HashMap<String, Object> param);
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDataMapper">
|
||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData">
|
||||
select * from (
|
||||
select t.*,
|
||||
d.device_name,
|
||||
group_concat(distinct ei.enterprise_name) as enterprise_name
|
||||
from car_measure_speed_data t
|
||||
left join car_measure_speed_dev d on d.dev_sn=t.dev_sn
|
||||
left join enterprise_info ei on find_in_set(ei.id,d.enterprise_ids)
|
||||
group by t.id
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="queryById" resultType="com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData">
|
||||
select * from (
|
||||
select t.*,
|
||||
d.device_name,
|
||||
group_concat(distinct ei.enterprise_name) as enterprise_name
|
||||
from car_measure_speed_data t
|
||||
left join car_measure_speed_dev d on d.dev_sn=t.dev_sn
|
||||
left join enterprise_info ei on find_in_set(ei.id,d.enterprise_ids)
|
||||
group by t.id
|
||||
)t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getExceedSpeedTrend" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
|
||||
select date_format(upload_time, '%Y-%m-%d') x,
|
||||
count(*) y
|
||||
from car_measure_speed_data
|
||||
where project_sn = #{projectSn}
|
||||
<if test="devSn != null and devSn != ''">
|
||||
and dev_sn = #{devSn}
|
||||
</if>
|
||||
and upload_time > date_sub(upload_time, interval 6 day)
|
||||
group by x
|
||||
</select>
|
||||
|
||||
<select id="getCarDaily" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
|
||||
select date_format(upload_time, '%Y-%m-%d') x,
|
||||
count(distinct car_number) y
|
||||
from car_measure_speed_data
|
||||
where project_sn = #{projectSn}
|
||||
<if test="devSn != null and devSn != ''">
|
||||
and dev_sn = #{devSn}
|
||||
</if>
|
||||
and upload_time > date_sub(upload_time, interval 6 day)
|
||||
group by x
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDevMapper">
|
||||
<select id="queryList" resultType="com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev">
|
||||
select * from (
|
||||
select t.*,
|
||||
group_concat(distinct ei.enterprise_name) as enterprise_name
|
||||
from car_measure_speed_dev t
|
||||
left join enterprise_info ei on find_in_set(ei.id,t.enterprise_ids)
|
||||
group by t.id
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="queryById" resultType="com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev">
|
||||
select * from (
|
||||
select t.*,
|
||||
group_concat(distinct ei.enterprise_name) as enterprise_name
|
||||
from car_measure_speed_dev t
|
||||
left join enterprise_info ei on find_in_set(ei.id,t.enterprise_ids)
|
||||
group by t.id
|
||||
)t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
<select id="countDev" resultType="com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo">
|
||||
select
|
||||
count(*) as total,
|
||||
count(*) as online,
|
||||
0 as offlinePercent
|
||||
from
|
||||
car_measure_speed_dev
|
||||
where project_sn = #{projectSn}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zhgd.xmgl.modules.car.service;
|
||||
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速数据
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface ICarMeasureSpeedDataService extends IService<CarMeasureSpeedData> {
|
||||
/**
|
||||
* 分页列表查询车辆测速数据信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<CarMeasureSpeedData> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询车辆测速数据信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<CarMeasureSpeedData> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加车辆测速数据信息
|
||||
*
|
||||
* @param carMeasureSpeedData 车辆测速数据
|
||||
* @return
|
||||
*/
|
||||
void add(CarMeasureSpeedData carMeasureSpeedData);
|
||||
|
||||
/**
|
||||
* 编辑车辆测速数据信息
|
||||
*
|
||||
* @param carMeasureSpeedData 车辆测速数据
|
||||
* @return
|
||||
*/
|
||||
void edit(CarMeasureSpeedData carMeasureSpeedData);
|
||||
|
||||
/**
|
||||
* 根据id删除车辆测速数据信息
|
||||
*
|
||||
* @param id 车辆测速数据的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询车辆测速数据信息
|
||||
*
|
||||
* @param id 车辆测速数据的id
|
||||
* @return
|
||||
*/
|
||||
CarMeasureSpeedData queryById(String id);
|
||||
|
||||
List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map);
|
||||
|
||||
List<TrendOneVo> getCarDaily(Map<String, Object> map);
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.zhgd.xmgl.modules.car.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速设备
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface ICarMeasureSpeedDevService extends IService<CarMeasureSpeedDev> {
|
||||
/**
|
||||
* 分页列表查询车辆测速设备信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<CarMeasureSpeedDev> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询车辆测速设备信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<CarMeasureSpeedDev> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加车辆测速设备信息
|
||||
*
|
||||
* @param carMeasureSpeedDev 车辆测速设备
|
||||
* @return
|
||||
*/
|
||||
void add(CarMeasureSpeedDev carMeasureSpeedDev);
|
||||
|
||||
/**
|
||||
* 编辑车辆测速设备信息
|
||||
*
|
||||
* @param carMeasureSpeedDev 车辆测速设备
|
||||
* @return
|
||||
*/
|
||||
void edit(CarMeasureSpeedDev carMeasureSpeedDev);
|
||||
|
||||
/**
|
||||
* 根据id删除车辆测速设备信息
|
||||
*
|
||||
* @param id 车辆测速设备的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询车辆测速设备信息
|
||||
*
|
||||
* @param id 车辆测速设备的id
|
||||
* @return
|
||||
*/
|
||||
CarMeasureSpeedDev queryById(String id);
|
||||
|
||||
CarMeasureSpeedDevCountVo countDev(HashMap<String, Object> param);
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.zhgd.xmgl.modules.car.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDataMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速数据
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CarMeasureSpeedDataServiceImpl extends ServiceImpl<CarMeasureSpeedDataMapper, CarMeasureSpeedData> implements ICarMeasureSpeedDataService {
|
||||
@Autowired
|
||||
private CarMeasureSpeedDataMapper carMeasureSpeedDataMapper;
|
||||
|
||||
@Override
|
||||
public IPage<CarMeasureSpeedData> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedData> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<CarMeasureSpeedData> page = PageUtil.getPage(param);
|
||||
IPage<CarMeasureSpeedData> pageList = baseMapper.queryList(page, queryWrapper, param);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarMeasureSpeedData> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedData> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(baseMapper.queryList(queryWrapper, param));
|
||||
}
|
||||
|
||||
private QueryWrapper<CarMeasureSpeedData> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedData> queryWrapper = QueryGenerator.initPageQueryWrapper(CarMeasureSpeedData.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(CarMeasureSpeedData::getUploadTime));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<CarMeasureSpeedData> dealList(List<CarMeasureSpeedData> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(CarMeasureSpeedData carMeasureSpeedData) {
|
||||
carMeasureSpeedData.setId(null);
|
||||
baseMapper.insert(carMeasureSpeedData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(CarMeasureSpeedData carMeasureSpeedData) {
|
||||
CarMeasureSpeedData oldCarMeasureSpeedData = baseMapper.selectById(carMeasureSpeedData.getId());
|
||||
if (oldCarMeasureSpeedData == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(carMeasureSpeedData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
CarMeasureSpeedData carMeasureSpeedData = baseMapper.selectById(id);
|
||||
if (carMeasureSpeedData == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarMeasureSpeedData queryById(String id) {
|
||||
CarMeasureSpeedData entity = baseMapper.queryById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map) {
|
||||
//近7天
|
||||
List<TrendOneVo> list = baseMapper.getExceedSpeedTrend(map);
|
||||
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
return TrendOneVo.fillTrendVos(list, days, "MM-dd");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrendOneVo> getCarDaily(Map<String, Object> map) {
|
||||
//近7天
|
||||
List<TrendOneVo> list = baseMapper.getCarDaily(map);
|
||||
List<String> days = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
return TrendOneVo.fillTrendVos(list, days, "MM-dd");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.zhgd.xmgl.modules.car.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.zhgd.xmgl.modules.car.entity.vo.CarMeasureSpeedDevCountVo;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarMeasureSpeedDevMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 车辆测速设备
|
||||
* @author: pds
|
||||
* @date: 2024-09-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CarMeasureSpeedDevServiceImpl extends ServiceImpl<CarMeasureSpeedDevMapper, CarMeasureSpeedDev> implements ICarMeasureSpeedDevService {
|
||||
@Autowired
|
||||
private CarMeasureSpeedDevMapper carMeasureSpeedDevMapper;
|
||||
|
||||
@Override
|
||||
public IPage<CarMeasureSpeedDev> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedDev> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<CarMeasureSpeedDev> page = PageUtil.getPage(param);
|
||||
IPage<CarMeasureSpeedDev> pageList = baseMapper.queryList(page, queryWrapper, param);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarMeasureSpeedDev> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedDev> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(baseMapper.queryList(queryWrapper, param));
|
||||
}
|
||||
|
||||
private QueryWrapper<CarMeasureSpeedDev> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<CarMeasureSpeedDev> queryWrapper = QueryGenerator.initPageQueryWrapper(CarMeasureSpeedDev.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(CarMeasureSpeedDev::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<CarMeasureSpeedDev> dealList(List<CarMeasureSpeedDev> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(CarMeasureSpeedDev carMeasureSpeedDev) {
|
||||
carMeasureSpeedDev.setId(null);
|
||||
baseMapper.insert(carMeasureSpeedDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(CarMeasureSpeedDev carMeasureSpeedDev) {
|
||||
CarMeasureSpeedDev oldCarMeasureSpeedDev = baseMapper.selectById(carMeasureSpeedDev.getId());
|
||||
if (oldCarMeasureSpeedDev == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(carMeasureSpeedDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
CarMeasureSpeedDev carMeasureSpeedDev = baseMapper.selectById(id);
|
||||
if (carMeasureSpeedDev == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarMeasureSpeedDev queryById(String id) {
|
||||
CarMeasureSpeedDev entity = baseMapper.queryById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarMeasureSpeedDevCountVo countDev(HashMap<String, Object> param) {
|
||||
return baseMapper.countDev(param);
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.video.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||
import com.zhgd.xmgl.modules.xz.entity.vo.CountStatusVo;
|
||||
import com.zhgd.xmgl.modules.yunlianwanwu.middle.entity.VideoItemConfigBo;
|
||||
@ -180,4 +181,6 @@ public interface VideoItemMapper extends BaseMapper<VideoItem> {
|
||||
* @return
|
||||
*/
|
||||
List<CountStatusVo> countStatusTrend(Map<String, Object> param);
|
||||
|
||||
List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.video.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||
import com.zhgd.xmgl.modules.xz.entity.vo.CountStatusVo;
|
||||
|
||||
@ -259,4 +260,5 @@ public interface IVideoItemService extends IService<VideoItem> {
|
||||
List<CountStatusVo> countStatusTrend(Map<String, Object> param);
|
||||
|
||||
String searchCameraFromHk(Map<String, Object> param);
|
||||
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.async.AsyncCommon;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||
|
||||
@ -2,26 +2,47 @@ package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.base.HikvisionEventsPictureRq;
|
||||
import com.zhgd.xmgl.call.HikvisionCall;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarInfo;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarInfoApprovalFlow;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedData;
|
||||
import com.zhgd.xmgl.modules.car.entity.CarMeasureSpeedDev;
|
||||
import com.zhgd.xmgl.modules.car.enums.CarInfoCarModuleTypeEnum;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarInfoApprovalFlowMapper;
|
||||
import com.zhgd.xmgl.modules.car.mapper.CarInfoMapper;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDataService;
|
||||
import com.zhgd.xmgl.modules.car.service.ICarMeasureSpeedDevService;
|
||||
import com.zhgd.xmgl.modules.car.service.impl.CarInfoServiceImpl;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.util.HikvisionUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequestMapping("/xmgl/task")
|
||||
@RestController
|
||||
public class CarInfoTask {
|
||||
@Lazy
|
||||
@Autowired
|
||||
HikvisionCall hikvisionCall;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CarInfoServiceImpl carInfoService;
|
||||
@ -34,6 +55,14 @@ public class CarInfoTask {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CarInfoApprovalFlowMapper carInfoApprovalFlowMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RedisRepository redisRepository;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDevService carMeasureSpeedDevService;
|
||||
@Autowired
|
||||
private ICarMeasureSpeedDataService carMeasureSpeedDataService;
|
||||
|
||||
/**
|
||||
* 定时删除/更新过期的车辆,并下发新的预约时间的车辆到海康
|
||||
@ -64,4 +93,76 @@ public class CarInfoTask {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时到海康拉取车辆超速,园区卡口违章事件查询v2
|
||||
*/
|
||||
@Scheduled(cron = "* */2 * * * ?")
|
||||
@SchedulerLock(name = "getCarMeasureSpeedData", lockAtMostFor = 1000 * 60, lockAtLeastFor = 1000 * 60)
|
||||
@RequestMapping("getCarMeasureSpeedData")
|
||||
public void getCarMeasureSpeedData() {
|
||||
String start;
|
||||
String queryTimeKey = "GET_ISC_CAR_MEASURE_SPEED_DATA_TIME";
|
||||
Object o = redisRepository.get(queryTimeKey);
|
||||
if (o != null) {
|
||||
start = o.toString();
|
||||
} else {
|
||||
start = DateUtil.format(DateUtil.offsetDay(new Date(), -1), "yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
||||
}
|
||||
String end = DateUtil.format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
||||
redisRepository.set(queryTimeKey, end);
|
||||
List<Project> projects = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.eq(Project::getSyncHikvision, 1));
|
||||
List<CarMeasureSpeedDev> speedDevs = carMeasureSpeedDevService.list();
|
||||
Map<String, List<CarMeasureSpeedDev>> projectMap = speedDevs.stream().collect(Collectors.groupingBy(CarMeasureSpeedDev::getProjectSn));
|
||||
for (Map.Entry<String, List<CarMeasureSpeedDev>> entry : projectMap.entrySet()) {
|
||||
List<CarMeasureSpeedDev> list = entry.getValue();
|
||||
Map<String, CarMeasureSpeedDev> devMap = list.stream().collect(Collectors.toMap(CarMeasureSpeedDev::getDevSn, Function.identity()));
|
||||
String projectSn = entry.getKey();
|
||||
Optional<Project> hasProject = projects.stream().filter(project -> Objects.equals(project.getProjectSn(), projectSn)).findFirst();
|
||||
if (hasProject.isPresent()) {
|
||||
Project project = hasProject.get();
|
||||
try {
|
||||
JSONObject param = new JSONObject();
|
||||
HikvisionUtil.addPageParamIfAbsent(param);
|
||||
param.put("beginTime", start);
|
||||
param.put("endTime", DateUtil.format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"));
|
||||
param.put("illegalType", 1);
|
||||
JSONObject rsJo = HikvisionUtil.getSpeedDataList(project, param);
|
||||
if (HikvisionUtil.isSuccess(rsJo)) {
|
||||
JSONObject dataJo = HikvisionUtil.getJsonObjectData(rsJo);
|
||||
JSONArray listJa = dataJo.getJSONArray("list");
|
||||
if (CollUtil.isNotEmpty(listJa)) {
|
||||
for (int i = 0; i < listJa.size(); i++) {
|
||||
JSONObject jo = listJa.getJSONObject(i);
|
||||
String monitoringId = jo.getString("monitoringId");
|
||||
CarMeasureSpeedDev dev = devMap.get(monitoringId);
|
||||
if (dev == null) {
|
||||
continue;
|
||||
}
|
||||
String plateNo = jo.getString("plateNo");
|
||||
BigDecimal speed = jo.getBigDecimal("speed");
|
||||
Date time = DateUtil.parse(jo.getString("crossTime"));
|
||||
CarMeasureSpeedData data = new CarMeasureSpeedData();
|
||||
data.setDevSn(monitoringId);
|
||||
data.setCarNumber(plateNo);
|
||||
data.setIsExceed(1);
|
||||
data.setCurrentSpeed(speed);
|
||||
data.setExceedingThreshold(NumberUtil.sub(speed, dev.getThreshold()));
|
||||
String platePicUrl = jo.getString("carPicUri");
|
||||
String svrIndex = jo.getString("aswSyscode");
|
||||
if (StringUtils.isNotBlank(platePicUrl)) {
|
||||
data.setSnapshotImage(hikvisionCall.saveToLocal(HikvisionCall.getHikvisionEventsPicture(new HikvisionEventsPictureRq(svrIndex, platePicUrl), project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret())));
|
||||
}
|
||||
data.setUploadTime(time);
|
||||
data.setProjectSn(dev.getProjectSn());
|
||||
carMeasureSpeedDataService.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("定时到海康拉取车辆超速错误:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
271
src/main/java/com/zhgd/xmgl/task/SewageTask.java
Normal file
271
src/main/java/com/zhgd/xmgl/task/SewageTask.java
Normal file
@ -0,0 +1,271 @@
|
||||
package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.sewage.entity.SewageAlarm;
|
||||
import com.zhgd.xmgl.modules.sewage.entity.SewageData;
|
||||
import com.zhgd.xmgl.modules.sewage.entity.SewageDev;
|
||||
import com.zhgd.xmgl.modules.sewage.service.ISewageAlarmService;
|
||||
import com.zhgd.xmgl.modules.sewage.service.ISewageDataService;
|
||||
import com.zhgd.xmgl.modules.sewage.service.ISewageDevService;
|
||||
import com.zhgd.xmgl.util.RenZhiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("xmgl/task")
|
||||
public class SewageTask {
|
||||
public static final String REDIS_RAIN_ALARM_TASK_START_TIME = "getSewageAlarmTaskStartTime";
|
||||
public static final String DATA_VALUE = "dataValue";
|
||||
public static final String RECORD_TIME = "recordTime";
|
||||
@Resource
|
||||
@Lazy
|
||||
private ISewageDataService sewageDataService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private ISewageAlarmService sewageAlarmService;
|
||||
@Resource
|
||||
@Lazy
|
||||
private ISewageDevService sewageDevService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private RedisRepository redisRepository;
|
||||
|
||||
/**
|
||||
* 获取实时数据
|
||||
*/
|
||||
@Scheduled(cron = "0 */2 * * * ?")
|
||||
@SchedulerLock(name = "getSewageRecordTask", lockAtMostFor = 1000 * 60, lockAtLeastFor = 1000 * 60)
|
||||
@RequestMapping("getSewageRecordTask")
|
||||
public void getSewageRecordTask() {
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getJnrzckAccount, "")
|
||||
.ne(Project::getJnrzckPw, "")
|
||||
);
|
||||
for (Project project : projectList) {
|
||||
try {
|
||||
saveAllRecord(project);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveAllRecord(Project project) {
|
||||
List<SewageDev> devs = sewageDevService.list(new LambdaQueryWrapper<SewageDev>().eq(SewageDev::getProjectSn, project.getProjectSn()));
|
||||
if (CollUtil.isEmpty(devs)) {
|
||||
return;
|
||||
}
|
||||
Map<String, SewageDev> devSnMap = devs.stream().collect(Collectors.toMap(SewageDev::getDevSn, Function.identity()));
|
||||
JSONArray datas = RenZhiUtil.getRealTimeDataByDeviceAddr(StrUtil.join(",", devs.stream().map(SewageDev::getDevSn).collect(Collectors.toList())), project.getJnrzckAccount(), project.getJnrzckPw());
|
||||
if (CollUtil.isEmpty(datas)) {
|
||||
log.info("污水获取实时数据为空,项目名称:{}", project.getProjectName());
|
||||
return;
|
||||
}
|
||||
List<SewageData> records = new ArrayList<>();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject dataJo = datas.getJSONObject(i);
|
||||
JSONArray dataItemJa = dataJo.getJSONArray("dataItem");
|
||||
String deviceAddr = dataJo.getString("deviceAddr");
|
||||
//normal:正常
|
||||
//alarming:报警
|
||||
//preAlarming:预警
|
||||
//offline:离线
|
||||
String deviceStatus = dataJo.getString("deviceStatus");
|
||||
SewageData record = new SewageData();
|
||||
SewageDev dev = devSnMap.get(deviceAddr);
|
||||
if (CollUtil.isNotEmpty(dataItemJa)) {
|
||||
for (int j = 0; j < dataItemJa.size(); j++) {
|
||||
JSONObject itemJo = dataItemJa.getJSONObject(j);
|
||||
Integer nodeId = itemJo.getInteger("nodeId");
|
||||
JSONArray registerItemJa = itemJo.getJSONArray("registerItem");
|
||||
if (nodeId == 7) {
|
||||
//工业 PH、工业 EC
|
||||
record.setPhValue(getDouble(registerItemJa, 0));
|
||||
record.setConductivity(getDouble(registerItemJa, 1));
|
||||
} else if (nodeId == 8) {
|
||||
//水质浊度、水质溶解氧
|
||||
record.setTurbidityValue(getDouble(registerItemJa, 0));
|
||||
record.setDissolvedOxygen(getDouble(registerItemJa, 1));
|
||||
} else if (nodeId == 29) {
|
||||
//实时流量、雷达流量计液位高
|
||||
record.setWaterLevel(Optional.ofNullable(getDouble(registerItemJa, 1)).map(m -> NumberUtil.div(m.doubleValue(), 1000D, 5)).orElse(null));
|
||||
} else if (nodeId == 31) {
|
||||
//累计水量、流速
|
||||
record.setFlowVelocity(Optional.ofNullable(getDouble(registerItemJa, 0)).map(m -> NumberUtil.div(m.doubleValue(), 100D, 5)).orElse(null));
|
||||
}
|
||||
// record.setWaterTemperature(getDouble(registerItemJa, 0));
|
||||
}
|
||||
record.setCreateDate(new Date(dataJo.getLong("timeStamp")));
|
||||
record.setDevSn(deviceAddr);
|
||||
record.setProjectSn(dev.getProjectSn());
|
||||
records.add(record);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
for (SewageData record : records) {
|
||||
try {
|
||||
sewageDataService.add(record);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getString(JSONArray registerItemJa, int index) {
|
||||
return Optional.ofNullable(registerItemJa.getJSONObject(index)).map(o -> o.getString("data")).orElse(null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Double getDouble(JSONArray registerItemJa, int index) {
|
||||
return Optional.ofNullable(registerItemJa.getJSONObject(index)).map(o -> o.getDouble("data")).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警数据
|
||||
*/
|
||||
@Scheduled(cron = "0 */6 * * * ?")
|
||||
@SchedulerLock(name = "getSewageAlarmTask", lockAtMostFor = 1000 * 60 * 5, lockAtLeastFor = 1000 * 60 * 3)
|
||||
@RequestMapping("getSewageAlarmTask")
|
||||
public void getRainAlarmTask() {
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getJnrzckAccount, "")
|
||||
.ne(Project::getJnrzckPw, "")
|
||||
);
|
||||
String start;
|
||||
Object o = redisRepository.get(REDIS_RAIN_ALARM_TASK_START_TIME);
|
||||
if (o != null) {
|
||||
start = o.toString();
|
||||
} else {
|
||||
start = DateUtil.format(DateUtil.offsetMinute(new Date(), -5), "yyyy-MM-dd HH:mm");
|
||||
}
|
||||
String end = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm");
|
||||
redisRepository.set(REDIS_RAIN_ALARM_TASK_START_TIME, end);
|
||||
for (Project project : projectList) {
|
||||
try {
|
||||
saveAllAlarm(project, start, end);
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveAllAlarm(Project project, String start, String end) {
|
||||
List<SewageDev> devs = sewageDevService.list(new LambdaQueryWrapper<SewageDev>().eq(SewageDev::getProjectSn, project.getProjectSn()));
|
||||
if (CollUtil.isEmpty(devs)) {
|
||||
return;
|
||||
}
|
||||
ArrayList<SewageAlarm> alarms = new ArrayList<>();
|
||||
String token = RenZhiUtil.getToken(project.getJnrzckAccount(), project.getJnrzckPw());
|
||||
for (SewageDev dev : devs) {
|
||||
JSONArray dataJa = RenZhiUtil.getAlarmRecordList(dev.getDevSn(), token, -1, start, end);
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (CollUtil.isEmpty(dataJa)) {
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < dataJa.size(); j++) {
|
||||
JSONObject jo = dataJa.getJSONObject(j);
|
||||
String recordId = jo.getString("recordId");
|
||||
SewageAlarm alarm = new SewageAlarm();
|
||||
alarm.setDevSn(jo.getString("deviceAddr"));
|
||||
alarm.setMonitorParam(jo.getString("factorName"));
|
||||
alarm.setMonitorValue(jo.getDouble("dataValue"));
|
||||
alarm.setAlarmDetail(getAlarmContent(jo));
|
||||
alarm.setAlarmTime(new Date(jo.getLong("recordTime")));
|
||||
alarm.setProjectSn(project.getProjectSn());
|
||||
alarm.setAlarmType(getAlarmType(jo));
|
||||
// alarm.setSewageDataId(0L);
|
||||
// alarm.setSewageType(0);
|
||||
alarms.add(alarm);
|
||||
}
|
||||
}
|
||||
sewageAlarmService.saveBatch(alarms);
|
||||
}
|
||||
|
||||
private Integer getAlarmType(JSONObject jo) {
|
||||
if (!Objects.equals(jo.get("alarmLevel"), 2) && !Objects.equals(jo.get("alarmLevel"), 3)) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private String getAlarmContent(JSONObject jo) {
|
||||
/*
|
||||
alarmLevel int 报警级别:
|
||||
25
|
||||
1: 报警(超报警上限)
|
||||
2: 预警(超预警上限)
|
||||
3: 预警(超预警下限)
|
||||
4:报警(超报警下限)
|
||||
-1: 离线报警
|
||||
-2:遥调(开关量)报警
|
||||
dataValue Double 报警值
|
||||
alarmRange String 报警限值
|
||||
*/
|
||||
String factorName = jo.getString("factorName");
|
||||
Integer alarmLevel = jo.getInteger("alarmLevel");
|
||||
if (Objects.equals(alarmLevel, 1) || Objects.equals(alarmLevel, 2) || Objects.equals(alarmLevel, 3) || Objects.equals(alarmLevel, 4)) {
|
||||
return StrUtil.format("{} {},报警值:{},报警限值:{}", factorName, getAlarmLevelStr(alarmLevel), jo.getDouble(DATA_VALUE), jo.getString("alarmRange"));
|
||||
} else {
|
||||
return StrUtil.format("{} {},报警值:{}", factorName, getAlarmLevelStr(alarmLevel), jo.getString(DATA_VALUE));
|
||||
}
|
||||
}
|
||||
|
||||
private String getAlarmLevelStr(Integer alarmLevel) {
|
||||
String s = "";
|
||||
switch (alarmLevel) {
|
||||
case 1:
|
||||
s = "报警(超报警上限)";
|
||||
break;
|
||||
case 2:
|
||||
s = "预警(超预警上限)";
|
||||
break;
|
||||
case 3:
|
||||
s = "预警(超预警下限)";
|
||||
break;
|
||||
case 4:
|
||||
s = "报警(超报警下限)";
|
||||
break;
|
||||
case -1:
|
||||
s = "离线报警";
|
||||
break;
|
||||
case -2:
|
||||
s = "遥调(开关量)报警";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -956,5 +956,20 @@ public class HikvisionUtil {
|
||||
return doPostRtObj(host, path, JSONArray.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
||||
}
|
||||
|
||||
/**
|
||||
* 园区卡口违章事件查询v2
|
||||
*
|
||||
* @param project
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static JSONObject getSpeedDataList(Project project, JSONObject param) throws Exception {
|
||||
final String artemisPath = "/artemis";
|
||||
final String path = artemisPath + "/api/mpc/v2/illegal/events/search";
|
||||
String host = "https://" + project.getArtemisConfigHost();
|
||||
return doPostRtObj(host, path, JSON.toJSONString(param), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@ApiModel(value="${entityName}实体类",description="${entityName}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
<#list originalColumns as po>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@ -30,16 +30,13 @@ public class ${entityName} implements Serializable {
|
||||
<#else>
|
||||
<#if po.fieldType =='java.util.Date'>
|
||||
<#if po.fieldDbType =='date'>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#elseif po.fieldDbType =='datetime'>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
@Excel(name = "${po.filedComment}", width = 15)
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value="${po.filedComment}")
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.HashMap;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
@ -16,4 +20,31 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@Mapper
|
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||
|
||||
/**
|
||||
* 分页列表查询${tableVo.ftlDescription}信息
|
||||
*
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
IPage<${entityName}> queryList(Page<${entityName}> page, @Param(Constants.WRAPPER) QueryWrapper<${entityName}> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询${tableVo.ftlDescription}信息
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<${entityName}> queryList(@Param(Constants.WRAPPER) QueryWrapper<${entityName}> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询${tableVo.ftlDescription}信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
${entityName} queryById(String id);
|
||||
}
|
||||
|
||||
@ -1,5 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
|
||||
</mapper>
|
||||
<select id="queryList" resultType="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
select * from (
|
||||
select t.*
|
||||
from ${tableName} t
|
||||
)t
|
||||
${r"${ew.customSqlSegment}"}
|
||||
</select>
|
||||
<select id="queryById" resultType="${bussiPackage}.${entityPackage}.entity.${entityName}">
|
||||
select * from (
|
||||
select t.*
|
||||
from ${tableName} t
|
||||
)t
|
||||
where t.id = ${r"#{id}"}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -31,7 +31,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
||||
public IPage<${entityName}> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<${entityName}> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<${entityName}> page = PageUtil.getPage(param);
|
||||
IPage<${entityName}> pageList = this.page(page, queryWrapper);
|
||||
IPage<${entityName}> pageList = baseMapper.queryList(page, queryWrapper,param);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
@ -39,7 +39,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
||||
@Override
|
||||
public List<${entityName}> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<${entityName}> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
return dealList(baseMapper.queryList(queryWrapper,param));
|
||||
}
|
||||
|
||||
private QueryWrapper<${entityName}> getQueryWrapper(HashMap<String, Object> param) {
|
||||
@ -78,7 +78,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
||||
|
||||
@Override
|
||||
public ${entityName} queryById(String id) {
|
||||
${entityName} entity = getById(id);
|
||||
${entityName} entity = baseMapper.queryById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#code_generate_project_path
|
||||
#project_path=D:\\demo\\wisdomSite
|
||||
project_path=C:\\Users\\Administrator\\IdeaProjects\\wisdomisite
|
||||
project_path=C:\\Users\\Administrator\\IdeaProjects\\wisdomisite-package
|
||||
#bussi_package[User defined]
|
||||
bussi_package=com.zhgd.xmgl.modules
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user