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) {
ReginParams reginParams = getSelectedOrgInfo(); if (StringUtils.isBlank(bizOrgCode)) {
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode(); ReginParams reginParams = getSelectedOrgInfo();
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);
......
...@@ -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;
...@@ -139,10 +140,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -139,10 +140,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired @Autowired
private JCSRemoteService jcsRemoteService; private JCSRemoteService jcsRemoteService;
@Autowired @Autowired
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
private VideoMapper videoMapper; private VideoMapper videoMapper;
...@@ -2397,7 +2398,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2397,7 +2398,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getStationStatusStatistics(); return fireFightingSystemMapper.getStationStatusStatistics();
} }
@Override @Override
public void resetMorphic() { public void resetMorphic() {
try { try {
...@@ -2440,15 +2441,15 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2440,15 +2441,15 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
videoInScene = "".equals(videoInScene) ? action.getSequenceNbr().toString() videoInScene = "".equals(videoInScene) ? action.getSequenceNbr().toString()
: videoInScene + "," + action.getSequenceNbr(); : videoInScene + "," + action.getSequenceNbr();
} }
} }
parse.setChildren(newPointList); parse.setChildren(newPointList);
System.out.println("parse="+JSONObject.toJSONString(parse)); System.out.println("parse="+JSONObject.toJSONString(parse));
resourceDTO.setContent(JSONObject.toJSONString(parse)); resourceDTO.setContent(JSONObject.toJSONString(parse));
System.out.println("resourceDTO="+JSONObject.toJSONString(resourceDTO)); System.out.println("resourceDTO="+JSONObject.toJSONString(resourceDTO));
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO)); FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
sourceScene.setPointInScene(pointInScene); sourceScene.setPointInScene(pointInScene);
sourceScene.setVideoInScene(videoInScene); sourceScene.setVideoInScene(videoInScene);
System.out.println("sourceScene="+JSONObject.toJSONString(sourceScene)); System.out.println("sourceScene="+JSONObject.toJSONString(sourceScene));
...@@ -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) {
ReginParams reginParams = getSelectedOrgInfo(); if (StringUtils.isBlank(bizOrgCode)) {
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode(); ReginParams reginParams = getSelectedOrgInfo();
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