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;
import com.yeejoin.equipmanage.service.IFireResourceSupervisionService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -29,9 +32,11 @@ public class FireResourceSupervisionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防系统、监测部件、消防车辆统计信息查询", notes = "聚合接口: 消防系统、监测部件、消防车辆统计信息查询")
@RequestMapping(value = "/stats", method = RequestMethod.GET)
public ResponseModel<Object> stats() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
public ResponseModel<Object> stats(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtils.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
FireResourceStatsDTO fireSystemStats = iFireResourceSupervisionService.getFireSystemStats(bizOrgCode);
FireResourceStatsDTO monitorComponentStats = iFireResourceSupervisionService.getMonitorComponentStats(bizOrgCode);
FireResourceStatsDTO fireCarStats = iFireResourceSupervisionService.getFireCarStats(bizOrgCode);
......
......@@ -56,6 +56,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
......@@ -139,10 +140,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
private JCSRemoteService jcsRemoteService;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private VideoMapper videoMapper;
......@@ -2397,7 +2398,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getStationStatusStatistics();
}
@Override
public void resetMorphic() {
try {
......@@ -2440,15 +2441,15 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
videoInScene = "".equals(videoInScene) ? action.getSequenceNbr().toString()
: videoInScene + "," + action.getSequenceNbr();
}
}
parse.setChildren(newPointList);
System.out.println("parse="+JSONObject.toJSONString(parse));
resourceDTO.setContent(JSONObject.toJSONString(parse));
System.out.println("resourceDTO="+JSONObject.toJSONString(resourceDTO));
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
sourceScene.setPointInScene(pointInScene);
sourceScene.setVideoInScene(videoInScene);
System.out.println("sourceScene="+JSONObject.toJSONString(sourceScene));
......@@ -2474,8 +2475,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
BigDecimal redNum = new BigDecimal(String.valueOf(resultMap.get("redCode")));
BigDecimal yellowNum = new BigDecimal(String.valueOf(resultMap.get("yellowCode")));
BigDecimal errorNum = redNum.add(yellowNum);
BigDecimal ratePercent = errorNum.divide(total, 2, BigDecimal.ROUND_HALF_UP);
map.put("ratePercent", ratePercent + "%");
if (total.compareTo(BigDecimal.ZERO) == 0) {
map.put("ratePercent", "0%");
} else {
BigDecimal ratePercent = errorNum.divide(total, 2, RoundingMode.HALF_UP);
map.put("ratePercent", ratePercent.multiply(new BigDecimal(100)) + "%");
}
return map;
}
......
......@@ -13,6 +13,8 @@ import com.yeejoin.equipmanage.utils.CarUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.jfree.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -23,27 +25,25 @@ import java.util.List;
import java.util.Timer;
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 IotFeign iotFeign;
private String topic;
private Long clippingTime;
ICarService iCarService;
private EmqKeeper emqkeeper;
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.jsonObject = jsonObject;
this.iWlCarMileageService = iWlCarMileageService;
this.iotFeign = iotFeign;
this.iCarService = iCarService;
this.emqkeeper = emqkeeper;
this.clippingTime = clippingTime;
}
@Override
public void run() {
//toDo
......@@ -51,7 +51,8 @@ public class ThreadCar extends Thread {
JSONObject lastObj = null;
WlCarMileage last = null;
try {
Log.info("-------------------------" + this.topic + "结束坐标开始计时------------------------------");
Long startTime = System.currentTimeMillis();
logger.info("=============================================" + topic + "结束坐标开始计时=======================================");
this.sleep(clippingTime);
//业务处理
//如果十分钟没有坐标,则需要设置结束标记
......@@ -67,7 +68,6 @@ public class ThreadCar extends Thread {
last.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list = result.getResult();
if (list != null && list.size() > 0) {
// 过滤空坐标
List<Object> filterList = new ArrayList<Object>();
for (int i = 0; i < list.size(); i++) {
......@@ -82,8 +82,6 @@ public class ThreadCar extends Thread {
}
}
}
// JSONObject lastObj =
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if (lastObj == null) {
lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", last.getStartLongitude());
......@@ -117,13 +115,18 @@ public class ThreadCar extends Thread {
}
last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
iWlCarMileageService.updateById(last);
Log.info("============================================================更新结束坐标成功==========:"+topic);
this.interrupt();
Long lastTime = System.currentTimeMillis();
logger.info("--------------"+topic+"结束坐标成功::花费时间===="+String.valueOf((lastTime-startTime)/60000)+"-------------------------");
logger.info("============================================================更新结束坐标成功==============================================:"+topic);
}
} catch (Exception exception) {
if (last != null) {
logger.info("---异常时获取到的获取last信息::"+JSONObject.toJSONString(last));
iWlCarMileageService.updateById(last);
}
}finally {
logger.info("销毁车辆倒计时线程::topic_"+topic);
this.interrupt();
}
}
......
......@@ -14,6 +14,8 @@ import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl;
import com.yeejoin.equipmanage.utils.CarUtils;
import liquibase.pro.packaged.E;
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.Value;
import org.springframework.stereotype.Component;
......@@ -28,6 +30,7 @@ import java.util.List;
@Component
public class ThreadCarMileageTreatment extends Thread {
Logger logger = LoggerFactory.getLogger(ThreadCarMileageTreatment.class);
@Autowired
private WlCarMileageServiceImpl wlCarMileageServiceImpl;
......@@ -40,7 +43,7 @@ public class ThreadCarMileageTreatment extends Thread {
@Override
public void run() {
Log.info("----------------------------------------------------开始处理未结束里程---------------------------------");
logger.info("----------------------------------------------------开始处理未结束里程---------------------------------");
HashMap<String, String> hashMap = new HashMap<>();
//toDo
WlCarMileage last = null;
......@@ -82,7 +85,7 @@ public class ThreadCarMileageTreatment extends Thread {
lastObj = Obj;
}
}
Log.info("----------------------------------------lastobj----------------------"+lastObj.toJSONString());
logger.info("----------------------------------------lastobj----------------------"+lastObj.toJSONString());
if (lastObj == null) {
lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", last.getStartLongitude());
......@@ -113,7 +116,7 @@ public class ThreadCarMileageTreatment extends Thread {
end.getDoubleValue("FireCar_Longitude"));
}
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);
}
}
......
......@@ -5,11 +5,14 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.service.IFireResourceSupervisionService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -26,9 +29,11 @@ public class FireResourceSupervisionController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "驻站消防员、运维人员统计信息查询", notes = "驻站消防员、运维人员统计信息查询")
@RequestMapping(value = "/stats", method = RequestMethod.GET)
public ResponseModel<Object> stats() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
public ResponseModel<Object> stats(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isBlank(bizOrgCode)) {
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);
return ResponseHelper.buildResponse(personnelStats);
}
......
......@@ -38,8 +38,11 @@ public class ControlScreenController extends AbstractBaseController {
@GetMapping("/statics")
@ApiOperation(value = "消防运维信息")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public CommonResponse getStatics(@RequestParam(required = false) String companyCode) {
return CommonResponseUtil.success(iPlanTaskService.getStatics(companyCode));
public CommonResponse getStatics(
@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 {
}
@Override
public List<Map<String, Object>> getStatics(String companyCode) {
String bizOrgCode = null;
if (StringUtil.isNotEmpty(companyCode)) {
public List<Map<String, Object>> getStatics(String companyCode, String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode) && StringUtil.isNotEmpty(companyCode)) {
bizOrgCode = planTaskMapper.queryByCompanyCode(companyCode);
}
return planTaskMapper.getStatics(bizOrgCode);
......
......@@ -187,7 +187,7 @@ public interface IPlanTaskService {
*/
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