| | |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "mac", value = "设备mac", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "time1", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time2", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String") |
| | | }) |
| | | public ResultMessage carTrajectory(HttpServletRequest request) { |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("time2")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<Map<String, Object>> response = specialDeviceService.carTrajectory(params); |
| | | List<Map<String, Object>> response = specialDeviceService.carTrajectory(params,true); |
| | | return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response); |
| | | } |
| | | |
| | | @GetMapping("carTrajectoryNewAvg") |
| | | @ApiOperation(value = "走航车轨迹均值", notes = "走航车轨迹均值") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "mac", value = "设备mac", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time1", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time2", value = "时间,2021-08-18", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "type", required = true, paramType = "query", dataType = "String") |
| | | }) |
| | | public ResultMessage carTrajectoryNewAvg(HttpServletRequest request) { |
| | | Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); |
| | | if (!params.containsKey("mac") || !params.containsKey("time1")|| !params.containsKey("time2")|| !params.containsKey("type")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<Map<String, Object>> response = specialDeviceService.carTrajectory(params,false); |
| | | return ObjectUtils.isEmpty(response) ? ResultMessage.ok() : ResultMessage.ok(response); |
| | | } |
| | | |
| | | /** |
| | | * 走航车日报 |
| | |
| | | List<Map<String, Object>> selectCruisers(); |
| | | |
| | | //走航车轨迹 |
| | | List<Map<String, Object>> carTrajectory(Map<String, Object> params); |
| | | List<Map<String, Object>> carTrajectory(Map<String, Object> params,boolean type); |
| | | |
| | | |
| | | /** |
| | | * @Description: 根据mac号获取无人机数据 |
| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> carTrajectory(Map<String, Object> params) { |
| | | public List<Map<String, Object>> carTrajectory(Map<String, Object> params,boolean type) { |
| | | params.put("dateFormat", "%Y-%m-%d %H:%i:%s"); |
| | | Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo(); |
| | | Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization"); |
| | |
| | | if (lon < 70 || lon > 150 || lat < 20 || lat > 60) { |
| | | return true; |
| | | } |
| | | if(type){ |
| | | o.putAll(value); |
| | | }else { |
| | | |
| | | } |
| | | |
| | | return false; |
| | | }); |
| | | /*for (Map<String, Object> map:data) { |
| | |
| | | }*/ |
| | | return filterData(data); |
| | | } |
| | | |
| | | @Override |
| | | public SpecialDevice getSpecialDeviceMapByMac(String mac) { |
| | | QueryWrapper<SpecialDevice> queryWrapper = new QueryWrapper(); |
| | |
| | | String time2 = params.get("time2").toString(); |
| | | String rsTime = getTime(time1, time2); |
| | | list.add(rsTime); |
| | | List<Map<String, Object>> maps = specialDeviceService.carTrajectory(params); |
| | | List<Map<String, Object>> maps = specialDeviceService.carTrajectory(params,false); |
| | | if (ObjectUtils.isEmpty(maps)){ |
| | | return null; |
| | | } |
| | |
| | | map.put("time1",time3); |
| | | map.put("time2",time4); |
| | | map.put("mac",mac); |
| | | List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map); |
| | | List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false); |
| | | if (ObjectUtils.isEmpty(maps1)){ |
| | | return null; |
| | | } |
| | |
| | | map.put("time1",time5); |
| | | map.put("time2",time6); |
| | | map.put("mac",mac); |
| | | List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map); |
| | | List<Map<String, Object>> maps1 = specialDeviceService.carTrajectory(map,false); |
| | | if (ObjectUtils.isEmpty(maps1)){ |
| | | return null; |
| | | } |
| | |
| | | result.add(map); |
| | | } |
| | | } |
| | | |
| | | |
| | | return result; |
| | | } |
| | | //范围取均值 |
| | | private List<Map<String, Object>> filterData(List<Map<String, Object>> data, List<Map<String, Object>> result) { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | |
| | | Map<String,List<Object>> map = new HashMap<>(); |
| | | result.forEach(it->map.put(it.get(Constants.SENSOR_CODE_LON).toString()+ "_"+Constants.SENSOR_CODE_LAT.toString(),Arrays.asList(it))); |
| | | // 坐标在50 以内分组 |
| | | for (Map<String, Object> mapData : data) { |
| | | for (Map.Entry<String, List<Object>> entry : map.entrySet()) { |
| | | double lng1 = Double.parseDouble(mapData.get(Constants.SENSOR_CODE_LON).toString()); |
| | | double lat1 = Double.parseDouble(mapData.get(Constants.SENSOR_CODE_LAT).toString()); |
| | | String[] mapKey = entry.getKey().split("_"); |
| | | List<Object> mapValue = entry.getValue(); |
| | | double lng2 = Double.parseDouble(mapKey[0]); |
| | | double lat2 = Double.parseDouble(mapKey[1]); |
| | | double distance = GeodesyUtils.getDistance(lat1, lng1, lat2, lng2); |
| | | if (distance < dis) { |
| | | mapValue.add(mapData); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | include: bulletin, specialCity, announcement |
| | | application: |
| | | name: screen-manage |
| | | name: screen-api |
| | | redis: |
| | | host: r-bp1xdlb9wfc6zt0msppd.redis.rds.aliyuncs.com |
| | | port: 6379 |
| | |
| | | max-wait: 30000 |
| | | max-idle: 64 |
| | | min-idle: 32 |
| | | |
| | | datasource: |
| | | minIdle: 1 |
| | | time-between-eviction-runs-millis: 60000 |
| | |
| | | filters: stat |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | max-wait: 60000 |
| | | url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://rm-bp1pr3rx9m3fnkwsk8o2.mysql.rds.aliyuncs.com:3306/moral?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: moral_123456 |
| | | test-on-borrow: false |
| | |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | max-conn-lifetime-millis: 20 |
| | | test-on-return: false |
| | | |
| | | servlet: |
| | | multipart: |
| | | enabled: true |
| | | max-file-size: 10MB |
| | | max-request-size: 10MB |
| | | |
| | | mybatis-plus: |
| | | mapper-locations: classpath:mapper/*.xml |
| | |
| | | |
| | | kafka: |
| | | listener: |
| | | # 自动提交关闭,需要设置手动消息确认 |
| | | ack-mode: manual_immediate |
| | | consumer: |
| | | auto: |
| | | offset: |
| | | reset: latest |
| | | # 在侦听器容器中运行的线程数,一般设置为 机器数*分区数 |
| | | concurrency: 3 |
| | | # 是否自动提交偏移量,默认值是true,为了避免出现重复数据和数据丢失,可以把它设置为false,然后手动提交偏移量 |
| | | enable: |
| | | auto: |
| | | commit: false |
| | |
| | | buffer: |
| | | memory: 40960 |
| | | linger: 1 |
| | | # 发生错误后,消息重发的次数。 |
| | | retries: 0 |
| | | servers: 47.99.145.48:9092,47.111.116.38:9092,47.111.124.159:9092 |
| | | groupId: |
| | | second-data: SecondsDataGroup1 |
| | | cruiser-data: cruiserDataGroup1 |
| | | mvc: |
| | | interceptor: |
| | | exclude: |
| | |
| | | - /swagger-ui.html/** |
| | | - /webjars/** |
| | | - /verificationCode/** |
| | | - /static/** |
| | | - /file/** |
| | | |
| | | |
| | | AES: |
| | | KEY: |