Commit f86bb31e authored by KeYong's avatar KeYong

Merge branch 'develop_dl' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl

parents 92fdfc42 19bbf0cc
...@@ -6,11 +6,14 @@ import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO; ...@@ -6,11 +6,14 @@ import com.yeejoin.equipmanage.common.entity.dto.FireResourceStatsDTO;
import com.yeejoin.equipmanage.service.IFireResourceSupervisionService; import com.yeejoin.equipmanage.service.IFireResourceSupervisionService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -29,9 +32,11 @@ public class FireResourceSupervisionController extends BaseController { ...@@ -29,9 +32,11 @@ public class FireResourceSupervisionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防系统、监测部件、消防车辆统计信息查询", notes = "聚合接口: 消防系统、监测部件、消防车辆统计信息查询") @ApiOperation(httpMethod = "GET", value = "消防系统、监测部件、消防车辆统计信息查询", notes = "聚合接口: 消防系统、监测部件、消防车辆统计信息查询")
@RequestMapping(value = "/stats", method = RequestMethod.GET) @RequestMapping(value = "/stats", method = RequestMethod.GET)
public ResponseModel<Object> stats() { public ResponseModel<Object> stats(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode(); bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
FireResourceStatsDTO fireSystemStats = iFireResourceSupervisionService.getFireSystemStats(bizOrgCode); FireResourceStatsDTO fireSystemStats = iFireResourceSupervisionService.getFireSystemStats(bizOrgCode);
FireResourceStatsDTO monitorComponentStats = iFireResourceSupervisionService.getMonitorComponentStats(bizOrgCode); FireResourceStatsDTO monitorComponentStats = iFireResourceSupervisionService.getMonitorComponentStats(bizOrgCode);
FireResourceStatsDTO fireCarStats = iFireResourceSupervisionService.getFireCarStats(bizOrgCode); FireResourceStatsDTO fireCarStats = iFireResourceSupervisionService.getFireCarStats(bizOrgCode);
......
package com.yeejoin.equipmanage.listener; package com.yeejoin.equipmanage.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car; import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage; import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.service.ICarService; import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService; import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl;
import com.yeejoin.equipmanage.thread.ThreadCar; import com.yeejoin.equipmanage.thread.ThreadCar;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener; import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.text.ParseException; import java.text.ParseException;
...@@ -32,6 +32,7 @@ import java.util.*; ...@@ -32,6 +32,7 @@ import java.util.*;
@Component @Component
public class CarIotNewListener extends EmqxListener { public class CarIotNewListener extends EmqxListener {
Logger logger = LoggerFactory.getLogger(CarIotNewListener.class);
@Autowired @Autowired
private IWlCarMileageService iWlCarMileageService; private IWlCarMileageService iWlCarMileageService;
...@@ -41,7 +42,7 @@ public class CarIotNewListener extends EmqxListener { ...@@ -41,7 +42,7 @@ public class CarIotNewListener extends EmqxListener {
@Autowired @Autowired
private IotFeign iotFeign; private IotFeign iotFeign;
@Value("${mileage.clippingtime}") @Value("${mileage.clippingtime:600000}")
private Long clipping_time; private Long clipping_time;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404"; private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
...@@ -53,46 +54,54 @@ public class CarIotNewListener extends EmqxListener { ...@@ -53,46 +54,54 @@ public class CarIotNewListener extends EmqxListener {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 用于根据topicId 也就是物联设备id 存储对应的线程来进行计时 // 用于根据topicId 也就是物联设备id 存储对应的线程来进行计时
private static HashMap<String, ThreadCar> deviceInfo = new HashMap(); private static final HashMap<String, ThreadCar> deviceInfo = new HashMap();
private static HashMap<String, String> deviceLastInfo = new HashMap(); private static final HashMap<String, String> deviceLastInfo = new HashMap();
@Override @Override
public void processMessage(String topic, MqttMessage message) throws Exception { public void processMessage(String topic, MqttMessage message) throws Exception {
System.out.println(topic); logger.info("----收到物联消息::topic---------------" + topic);
System.out.println(message); logger.info("----收到物联消息::message---------------" + message);
String measurement = topic.split("/")[0]; String measurement = topic.split("/")[0];
String deviceName = topic.split("/")[1]; String deviceName = topic.split("/")[1];
String iotCode = measurement + deviceName; String iotCode = measurement + deviceName;
JSONObject jsonObject = JSONObject.parseObject(message.toString()); JSONObject jsonObject = JSONObject.parseObject(message.toString());
//通过消息存电量到扩展字段2 //通过消息存电量到扩展字段2
this.updateEquipBattery(jsonObject,iotCode); this.updateEquipBattery(jsonObject, iotCode);
if (jsonObject.containsKey("FireCar_Longitude")) { logger.info("当前设备信息info" + JSON.toJSONString(deviceInfo));
//判断是否有效数据
if (!ObjectUtils.isEmpty(jsonObject.containsKey("FireCar_Longitude"))&&!ObjectUtils.isEmpty(jsonObject.containsKey("FireCar_Latitude"))) {
this.updateCarLocation(jsonObject, iotCode); this.updateCarLocation(jsonObject, iotCode);
//如果map中已经存在该设备或者该设备有但是线程已经执行了 //如果map中已经存在该设备或者该设备有但是线程已经执行了
if ((!deviceInfo.containsKey(iotCode)) || (deviceInfo.containsKey(iotCode) && deviceInfo.get(iotCode) == null)) { //存储上报上来的经纬度信息
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time); String coordinate = jsonObject.getDoubleValue("FireCar_Longitude") + String.valueOf(jsonObject.getDoubleValue("FireCar_Latitude"));
if ((!deviceInfo.containsKey(iotCode))) {
logger.info("topic---------------------" + topic + "开启计时线程");
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, clipping_time);
deviceInfo.put(iotCode, threadCar); deviceInfo.put(iotCode, threadCar);
threadCar.start(); threadCar.start();
} }
String coordinate = jsonObject.getDoubleValue("FireCar_Longitude") + String.valueOf(jsonObject.getDoubleValue("FireCar_Latitude"));
if (!deviceLastInfo.containsKey(iotCode)) { if (!deviceLastInfo.containsKey(iotCode)) {
deviceLastInfo.put(iotCode, coordinate); deviceLastInfo.put(iotCode, coordinate);
} }
Long currentTime = new Date().getTime(); //获取打不过全部系统时间
Long currentTime = System.currentTimeMillis();
//获取上报的时间
Long endTime = jsonObject.getLong("time"); Long endTime = jsonObject.getLong("time");
// if ((startTime - endTime) <= 600000) { //如果当前时间减去上报时间大小于配置的时间并且之前没包含上报的数据
if (((currentTime - endTime) <= clipping_time) && (!deviceLastInfo.get(iotCode).equals(coordinate))) { if (((currentTime - endTime) < clipping_time) && (!deviceLastInfo.get(iotCode).equals(coordinate))) {
try { try {
//销毁线程后移除
deviceInfo.get(iotCode).interrupt(); deviceInfo.get(iotCode).interrupt();
deviceInfo.remove(iotCode);
} catch (Exception e) { } catch (Exception e) {
} }
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time); logger.info("topic---------------------" + topic + "开启计时线程");
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, clipping_time);
deviceInfo.put(iotCode, threadCar); deviceInfo.put(iotCode, threadCar);
//更新车辆的最新坐标数据 //更新车辆的最新坐标数据
deviceLastInfo.put(iotCode, coordinate); deviceLastInfo.put(iotCode, coordinate);
threadCar.start(); threadCar.start();
}
if (iWlCarMileageService.getUncompleteMileagByIotCode(iotCode)) { if (iWlCarMileageService.getUncompleteMileagByIotCode(iotCode)) {
WlCarMileage wlCarMileage = new WlCarMileage(); WlCarMileage wlCarMileage = new WlCarMileage();
wlCarMileage.setIotCode(iotCode); wlCarMileage.setIotCode(iotCode);
...@@ -105,10 +114,11 @@ public class CarIotNewListener extends EmqxListener { ...@@ -105,10 +114,11 @@ public class CarIotNewListener extends EmqxListener {
wlCarMileage.setStartLatitude(startLatitude); wlCarMileage.setStartLatitude(startLatitude);
// Date startTime = UTCToCST(); // Date startTime = UTCToCST();
//时间值被mysql自动转换 //时间值被mysql自动转换
Date startTime = new Date((jsonObject.getLong("time")/1000)*1000); Date startTime = new Date((jsonObject.getLong("time") / 1000) * 1000);
wlCarMileage.setStartTime(startTime); wlCarMileage.setStartTime(startTime);
wlCarMileage.setStartName(getAddress(startLongitude, startLatitude)); wlCarMileage.setStartName(getAddress(startLongitude, startLatitude));
wlCarMileage.setStartSpeed(Double.valueOf(jsonObject.getDoubleValue("FireCar_Speed")).intValue()); wlCarMileage.setStartSpeed(Double.valueOf(jsonObject.getDoubleValue("FireCar_Speed")).intValue());
logger.info("新增数据信息如下::"+JSONObject.toJSONString(wlCarMileage));
try { try {
iWlCarMileageService.save(wlCarMileage); iWlCarMileageService.save(wlCarMileage);
} catch (Exception e) { } catch (Exception e) {
...@@ -118,6 +128,7 @@ public class CarIotNewListener extends EmqxListener { ...@@ -118,6 +128,7 @@ public class CarIotNewListener extends EmqxListener {
} }
} }
} }
}
public String getAddress(double longitude, double lantitude) { public String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_URL); StringBuilder api = new StringBuilder(GUIDE_URL);
...@@ -140,7 +151,7 @@ public class CarIotNewListener extends EmqxListener { ...@@ -140,7 +151,7 @@ public class CarIotNewListener extends EmqxListener {
JSONObject regeocode = object.getJSONObject("regeocode"); JSONObject regeocode = object.getJSONObject("regeocode");
String address = regeocode.getString("formatted_address"); String address = regeocode.getString("formatted_address");
if ("[]".equals(address)) { if ("[]".equals(address)) {
System.out.println("===============无效坐标:" + longitude + "," + lantitude); logger.info("===============无效坐标:" + longitude + "," + lantitude);
address = "无效坐标"; address = "无效坐标";
} }
res = new StringBuilder(address); res = new StringBuilder(address);
...@@ -191,7 +202,7 @@ public class CarIotNewListener extends EmqxListener { ...@@ -191,7 +202,7 @@ public class CarIotNewListener extends EmqxListener {
car.setLongitude(startLongitude); car.setLongitude(startLongitude);
car.setLatitude(startLatitude); car.setLatitude(startLatitude);
iCarService.updateById(car); iCarService.updateById(car);
System.out.println("-----------推送车辆位置消息到到地图成功--------"); logger.info("-----------推送车辆位置消息到到地图成功--------");
try { try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage); emqkeeper.getMqttClient().publish("car/location", mqttMessage);
} catch (MqttException e) { } catch (MqttException e) {
...@@ -218,7 +229,7 @@ public class CarIotNewListener extends EmqxListener { ...@@ -218,7 +229,7 @@ public class CarIotNewListener extends EmqxListener {
if (car != null && power != 0) { if (car != null && power != 0) {
car.setExtra2(power.toString()); car.setExtra2(power.toString());
iCarService.updateById(car); iCarService.updateById(car);
System.out.println("-----------更新车辆设备电池电量成功--------"); logger.info("-----------更新车辆设备电池电量成功--------");
} }
} }
} }
...@@ -56,6 +56,7 @@ import java.io.File; ...@@ -56,6 +56,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
...@@ -2474,8 +2475,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2474,8 +2475,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
BigDecimal redNum = new BigDecimal(String.valueOf(resultMap.get("redCode"))); BigDecimal redNum = new BigDecimal(String.valueOf(resultMap.get("redCode")));
BigDecimal yellowNum = new BigDecimal(String.valueOf(resultMap.get("yellowCode"))); BigDecimal yellowNum = new BigDecimal(String.valueOf(resultMap.get("yellowCode")));
BigDecimal errorNum = redNum.add(yellowNum); BigDecimal errorNum = redNum.add(yellowNum);
BigDecimal ratePercent = errorNum.divide(total, 2, BigDecimal.ROUND_HALF_UP); if (total.compareTo(BigDecimal.ZERO) == 0) {
map.put("ratePercent", ratePercent + "%"); map.put("ratePercent", "0%");
} else {
BigDecimal ratePercent = errorNum.divide(total, 2, RoundingMode.HALF_UP);
map.put("ratePercent", ratePercent.multiply(new BigDecimal(100)) + "%");
}
return map; return map;
} }
......
...@@ -13,6 +13,8 @@ import com.yeejoin.equipmanage.utils.CarUtils; ...@@ -13,6 +13,8 @@ import com.yeejoin.equipmanage.utils.CarUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.jfree.util.Log; import org.jfree.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -23,27 +25,25 @@ import java.util.List; ...@@ -23,27 +25,25 @@ import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class ThreadCar extends Thread { public class
ThreadCar extends Thread {
Logger logger = LoggerFactory.getLogger(ThreadCar.class);
private IWlCarMileageService iWlCarMileageService; private IWlCarMileageService iWlCarMileageService;
private IotFeign iotFeign; private IotFeign iotFeign;
private String topic; private String topic;
private Long clippingTime; private Long clippingTime;
ICarService iCarService; ICarService iCarService;
private EmqKeeper emqkeeper;
private JSONObject jsonObject; private JSONObject jsonObject;
public ThreadCar(String topic, JSONObject jsonObject, IWlCarMileageService iWlCarMileageService, IotFeign iotFeign, ICarService iCarService, EmqKeeper emqkeeper, Long clippingTime) { public ThreadCar(String topic, JSONObject jsonObject, IWlCarMileageService iWlCarMileageService, IotFeign iotFeign, ICarService iCarService, Long clippingTime) {
this.topic = topic; this.topic = topic;
this.jsonObject = jsonObject; this.jsonObject = jsonObject;
this.iWlCarMileageService = iWlCarMileageService; this.iWlCarMileageService = iWlCarMileageService;
this.iotFeign = iotFeign; this.iotFeign = iotFeign;
this.iCarService = iCarService; this.iCarService = iCarService;
this.emqkeeper = emqkeeper;
this.clippingTime = clippingTime; this.clippingTime = clippingTime;
} }
@Override @Override
public void run() { public void run() {
//toDo //toDo
...@@ -51,7 +51,8 @@ public class ThreadCar extends Thread { ...@@ -51,7 +51,8 @@ public class ThreadCar extends Thread {
JSONObject lastObj = null; JSONObject lastObj = null;
WlCarMileage last = null; WlCarMileage last = null;
try { try {
Log.info("-------------------------" + this.topic + "结束坐标开始计时------------------------------"); Long startTime = System.currentTimeMillis();
logger.info("=============================================" + topic + "结束坐标开始计时=======================================");
this.sleep(clippingTime); this.sleep(clippingTime);
//业务处理 //业务处理
//如果十分钟没有坐标,则需要设置结束标记 //如果十分钟没有坐标,则需要设置结束标记
...@@ -67,7 +68,6 @@ public class ThreadCar extends Thread { ...@@ -67,7 +68,6 @@ public class ThreadCar extends Thread {
last.getStartTime(), new Date(new Date().getTime() + 2000)); last.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list = result.getResult(); List<Object> list = result.getResult();
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
// 过滤空坐标 // 过滤空坐标
List<Object> filterList = new ArrayList<Object>(); List<Object> filterList = new ArrayList<Object>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
...@@ -82,8 +82,6 @@ public class ThreadCar extends Thread { ...@@ -82,8 +82,6 @@ public class ThreadCar extends Thread {
} }
} }
} }
// JSONObject lastObj =
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if (lastObj == null) { if (lastObj == null) {
lastObj = new JSONObject(); lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", last.getStartLongitude()); lastObj.put("FireCar_Longitude", last.getStartLongitude());
...@@ -117,13 +115,18 @@ public class ThreadCar extends Thread { ...@@ -117,13 +115,18 @@ public class ThreadCar extends Thread {
} }
last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()); last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
iWlCarMileageService.updateById(last); iWlCarMileageService.updateById(last);
Log.info("============================================================更新结束坐标成功==========:"+topic); Long lastTime = System.currentTimeMillis();
this.interrupt(); logger.info("--------------"+topic+"结束坐标成功::花费时间===="+String.valueOf((lastTime-startTime)/60000)+"-------------------------");
logger.info("============================================================更新结束坐标成功==============================================:"+topic);
} }
} catch (Exception exception) { } catch (Exception exception) {
if (last != null) { if (last != null) {
logger.info("---异常时获取到的获取last信息::"+JSONObject.toJSONString(last));
iWlCarMileageService.updateById(last); iWlCarMileageService.updateById(last);
} }
}finally {
logger.info("销毁车辆倒计时线程::topic_"+topic);
this.interrupt();
} }
} }
......
...@@ -14,6 +14,8 @@ import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl; ...@@ -14,6 +14,8 @@ import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl;
import com.yeejoin.equipmanage.utils.CarUtils; import com.yeejoin.equipmanage.utils.CarUtils;
import liquibase.pro.packaged.E; import liquibase.pro.packaged.E;
import org.jfree.util.Log; import org.jfree.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -28,6 +30,7 @@ import java.util.List; ...@@ -28,6 +30,7 @@ import java.util.List;
@Component @Component
public class ThreadCarMileageTreatment extends Thread { public class ThreadCarMileageTreatment extends Thread {
Logger logger = LoggerFactory.getLogger(ThreadCarMileageTreatment.class);
@Autowired @Autowired
private WlCarMileageServiceImpl wlCarMileageServiceImpl; private WlCarMileageServiceImpl wlCarMileageServiceImpl;
...@@ -40,7 +43,7 @@ public class ThreadCarMileageTreatment extends Thread { ...@@ -40,7 +43,7 @@ public class ThreadCarMileageTreatment extends Thread {
@Override @Override
public void run() { public void run() {
Log.info("----------------------------------------------------开始处理未结束里程---------------------------------"); logger.info("----------------------------------------------------开始处理未结束里程---------------------------------");
HashMap<String, String> hashMap = new HashMap<>(); HashMap<String, String> hashMap = new HashMap<>();
//toDo //toDo
WlCarMileage last = null; WlCarMileage last = null;
...@@ -82,7 +85,7 @@ public class ThreadCarMileageTreatment extends Thread { ...@@ -82,7 +85,7 @@ public class ThreadCarMileageTreatment extends Thread {
lastObj = Obj; lastObj = Obj;
} }
} }
Log.info("----------------------------------------lastobj----------------------"+lastObj.toJSONString()); logger.info("----------------------------------------lastobj----------------------"+lastObj.toJSONString());
if (lastObj == null) { if (lastObj == null) {
lastObj = new JSONObject(); lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", last.getStartLongitude()); lastObj.put("FireCar_Longitude", last.getStartLongitude());
...@@ -113,7 +116,7 @@ public class ThreadCarMileageTreatment extends Thread { ...@@ -113,7 +116,7 @@ public class ThreadCarMileageTreatment extends Thread {
end.getDoubleValue("FireCar_Longitude")); end.getDoubleValue("FireCar_Longitude"));
} }
last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()); last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
Log.info("----------------------------------------last----------------------"+lastObj.toJSONString()); logger.info("----------------------------------------last----------------------"+lastObj.toJSONString());
// wlCarMileageServiceImpl.updateById(last); // wlCarMileageServiceImpl.updateById(last);
} }
} }
......
...@@ -5,11 +5,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -5,11 +5,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.service.IFireResourceSupervisionService; import com.yeejoin.amos.boot.module.jcs.api.service.IFireResourceSupervisionService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -26,9 +29,11 @@ public class FireResourceSupervisionController extends BaseController { ...@@ -26,9 +29,11 @@ public class FireResourceSupervisionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "驻站消防员、运维人员统计信息查询", notes = "驻站消防员、运维人员统计信息查询") @ApiOperation(httpMethod = "GET", value = "驻站消防员、运维人员统计信息查询", notes = "驻站消防员、运维人员统计信息查询")
@RequestMapping(value = "/stats", method = RequestMethod.GET) @RequestMapping(value = "/stats", method = RequestMethod.GET)
public ResponseModel<Object> stats() { public ResponseModel<Object> stats(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode(); bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Map<String, Map<String, Number>> personnelStats = iFireResourceSupervisionService.getPersonnelStats(bizOrgCode); Map<String, Map<String, Number>> personnelStats = iFireResourceSupervisionService.getPersonnelStats(bizOrgCode);
return ResponseHelper.buildResponse(personnelStats); return ResponseHelper.buildResponse(personnelStats);
} }
......
...@@ -38,8 +38,11 @@ public class ControlScreenController extends AbstractBaseController { ...@@ -38,8 +38,11 @@ public class ControlScreenController extends AbstractBaseController {
@GetMapping("/statics") @GetMapping("/statics")
@ApiOperation(value = "消防运维信息") @ApiOperation(value = "消防运维信息")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public CommonResponse getStatics(@RequestParam(required = false) String companyCode) { public CommonResponse getStatics(
return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode)); @RequestParam(required = false) String companyCode,
@RequestParam(required = false) String bizOrgCode
) {
return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode, bizOrgCode));
} }
} }
...@@ -2029,9 +2029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -2029,9 +2029,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
@Override @Override
public List<Map<String, Object>> getStatics(String companyCode) { public List<Map<String, Object>> getStatics(String companyCode, String bizOrgCode) {
String bizOrgCode = null; if (StringUtils.isEmpty(bizOrgCode) && StringUtil.isNotEmpty(companyCode)) {
if (StringUtil.isNotEmpty(companyCode)) {
bizOrgCode = planTaskMapper.queryByCompanyCode(companyCode); bizOrgCode = planTaskMapper.queryByCompanyCode(companyCode);
} }
return planTaskMapper.getStatics(bizOrgCode); return planTaskMapper.getStatics(bizOrgCode);
......
...@@ -187,7 +187,7 @@ public interface IPlanTaskService { ...@@ -187,7 +187,7 @@ public interface IPlanTaskService {
*/ */
List<Map<String,Object>> firePatrolStatics(String bizOrgCode); List<Map<String,Object>> firePatrolStatics(String bizOrgCode);
List<Map<String,Object>> getStatics(String companyCode); List<Map<String,Object>> getStatics(String companyCode, String bizOrgCode);
/** /**
* 计划执行查询 * 计划执行查询
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment