Commit 3d285938 authored by KeYong's avatar KeYong

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

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/vo/SendToMsgRiskEquipInfoVo.java
parents ba5f7352 e3daa23e
......@@ -17,5 +17,7 @@ public class RiskDataVo {
private String indexValue;
private String traceId;
private RiskBizInfoVo bizInfo;
}
......@@ -25,6 +25,8 @@ public class SendToMsgRiskEquipInfoVo {
private String bizOrgCode;
private String traceId;
// 指标告警状态
private Boolean reportIsAlarm;
......
......@@ -414,6 +414,17 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success();
}
@GetMapping(value = "/status/checkInput")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "idx修改巡检项对应装备二维码状态", notes = "idx修改巡检项对应装备二维码状态")
public ResponseModel updateEquipSpecificStatusByCheckInput( String id){
//查询 巡检项所绑定装备
String equipId = equipmentSpecificSerivce.updateEquipSpecificStatusByCheckInput(id);
//修改装备二维码状态为合格 此处为0代表绿色 是idx只有在合格是才会触发此接口
equipmentSpecificSerivce.updateEquipSpecificStatus("0", equipId);
return CommonResponseUtil.success();
}
@GetMapping(value = "/info/paomo")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标")
......
......@@ -66,28 +66,29 @@ public class CarIotNewListener extends EmqxListener {
String iotCode = measurement + deviceName;
JSONObject jsonObject = JSONObject.parseObject(message.toString());
if (jsonObject.containsKey("FireCar_Longitude")) {
this.updateCarLocation(jsonObject,iotCode);
//如果map中已经存在该设备或者该设备有但是线程已经执行了
if ((!deviceInfo.containsKey(topic)) || (deviceInfo.containsKey(topic) && deviceInfo.get(topic) == null)) {
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(topic, threadCar);
if ((!deviceInfo.containsKey(iotCode)) || (deviceInfo.containsKey(iotCode) && deviceInfo.get(iotCode) == null)) {
ThreadCar threadCar = new ThreadCar(iotCode, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(iotCode, threadCar);
threadCar.start();
}
String coordinate = jsonObject.getDoubleValue("FireCar_Longitude") + String.valueOf(jsonObject.getDoubleValue("FireCar_Latitude"));
if (!deviceLastInfo.containsKey(topic)) {
deviceLastInfo.put(topic, coordinate);
if (!deviceLastInfo.containsKey(iotCode)) {
deviceLastInfo.put(iotCode, coordinate);
}
Long currentTime = new Date().getTime();
Long endTime = jsonObject.getLong("time");
// if ((startTime - endTime) <= 600000) {
if (((currentTime - endTime) <= clipping_time) && (!deviceLastInfo.get(topic).equals(coordinate))) {
if (((currentTime - endTime) <= clipping_time) && (!deviceLastInfo.get(iotCode).equals(coordinate))) {
try {
deviceInfo.get(topic).interrupt();
deviceInfo.get(iotCode).interrupt();
} catch (Exception e) {
}
ThreadCar threadCar = new ThreadCar(topic, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(topic, threadCar);
ThreadCar threadCar = new ThreadCar(iotCode, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(iotCode, threadCar);
//更新车辆的最新坐标数据
deviceLastInfo.put(topic, coordinate);
deviceLastInfo.put(iotCode, coordinate);
threadCar.start();
}
if (iWlCarMileageService.getUncompleteMileagByIotCode(iotCode)) {
......@@ -162,5 +163,37 @@ public class CarIotNewListener extends EmqxListener {
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8);
return calendar.getTime();
}
public void updateCarLocation(JSONObject jsonObject, String iotCode) {
if (jsonObject.containsKey("FireCar_Longitude") && jsonObject.containsKey("FireCar_Latitude")) {
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction");
// 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
sendObj.put("id", String.valueOf(car.getId()));
sendObj.put("direction", direction);
sendObj.put("longitude", String.valueOf(startLongitude));
sendObj.put("latitude", String.valueOf(startLatitude));
sendObj.put("carNum", car.getCarNum());
sendObj.put("bizOrgName", car.getBizOrgName());
sendArr.add(sendObj);
MqttMessage mqttMessage = new MqttMessage();
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
iCarService.updateById(car);
System.out.println("-----------推送车辆位置消息到到地图成功--------");
try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
} catch (MqttException e) {
throw new RuntimeException(e);
}
}
}
}
}
......@@ -262,4 +262,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
void updateEquipSpecificStatus(String status,String id);
String updateEquipSpecificStatusByCheckInput(String id);
}
......@@ -286,4 +286,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
Map<String,Object> getStationCode(Long id);
void updateEquipSpecificStatus(String status, String id);
String updateEquipSpecificStatusByCheckInput( String id);
}
......@@ -2098,4 +2098,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public void updateEquipSpecificStatus(String status, String id){
equipmentSpecificMapper.updateEquipSpecificStatus(status,id);
}
@Override
public String updateEquipSpecificStatusByCheckInput( String id){
return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id);
}
}
......@@ -1531,6 +1531,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
detailsVos.add(dynamicDetailsVo);
infoVo.setDynamicDetails(detailsVos);
dataVo.setBizInfo(infoVo);
dataVo.setTraceId(detailVo.getEquipInfo().getTraceId());
mqttSendGateway.sendToMqtt(riskTopic, JSON.toJSONString(dataVo));
}
......
......@@ -113,7 +113,6 @@ public class ThreadCar extends Thread {
}
last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
iWlCarMileageService.updateById(last);
this.pushCarInfoToMap(jsonObject, topic);
System.out.println("============================================================更新结束坐标成功==========:"+topic);
this.interrupt();
}
......@@ -124,37 +123,5 @@ public class ThreadCar extends Thread {
}
}
public void pushCarInfoToMap(JSONObject jsonObject, String iotCode) {
if (jsonObject.containsKey("FireCar_Longitude") && jsonObject.containsKey("FireCar_Latitude")) {
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction");
// 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
sendObj.put("id", String.valueOf(car.getId()));
sendObj.put("direction", direction);
sendObj.put("longitude", String.valueOf(startLongitude));
sendObj.put("latitude", String.valueOf(startLatitude));
sendObj.put("carNum", car.getCarNum());
sendObj.put("bizOrgName", car.getBizOrgName());
sendArr.add(sendObj);
MqttMessage mqttMessage = new MqttMessage();
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
iCarService.updateById(car);
try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
} catch (MqttException e) {
throw new RuntimeException(e);
}
}
}
}
}
......@@ -295,8 +295,8 @@ public class CheckController extends AbstractBaseController {
equipInfoVo.setCode(String.valueOf(map.get("item_no")));
equipInfoVo.setBizOrgCode(String.valueOf(map.get("biz_org_code")));
equipInfoVo.setBizOrgName(String.valueOf(map.get("biz_org_name")));
if (map.containsKey("equipId")){
equipInfoVo.setEquipId(map.get("equipId").toString());
if (map.containsKey("traceId")){
equipInfoVo.setTraceId(map.get("traceId").toString());
}
alarmInfoVo.setKey(String.valueOf(map.get("inputItem")));
alarmInfoVo.setValue(String.valueOf(map.get("input_value")));
......
......@@ -23,7 +23,9 @@ public class SendToMsgRiskEquipInfoVo {
private String bizOrgCode;
private String equipId;
private String traceId;
// 指标告警状态
private Boolean reportIsAlarm;
......
......@@ -47,7 +47,7 @@ public interface EquipFeign {
FeignClientResult getBuildingTreeOne(@RequestParam(value = "instanceId", required = true) String instanceId);
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/status/equip", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult updateEquipSpecificStatus(String status, String id);
FeignClientResult updateEquipSpecificStatus(@RequestParam(value = "status", required = true) String status,@RequestParam(value = "id", required = true) String id);
}
......@@ -2324,7 +2324,17 @@
</select>
<update id="updateEquipSpecificStatus">
update wl_equipment_specific set equip_status = #{} where id = #{id}
update wl_equipment_specific set equip_status = #{status} where id = #{id}
</update>
<select id="updateEquipSpecificStatusByCheckInput" resultType="java.lang.String">
SELECT
ppc.equipment_id
FROM
p_check_input ci
LEFT JOIN `p_point_classify` ppc ON ci .point_classify_id = ppc.id
WHERE ci.id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -2184,27 +2184,24 @@
ii.item_no,
ii.NAME inputItem,
ci.input_value,
CASE ci.is_ok
CASE
ci.is_ok
WHEN 1 THEN
'合格'
WHEN 2 THEN
'不合格'
ELSE
'漏检'
'不合格' ELSE '漏检'
END AS is_ok,
ii.biz_org_code,
ii.biz_org_name,
ci.score,
ppc.equipment_id
ci.score ,
ci.id as traceId
FROM
p_check c,
p_check_input ci,
p_input_item ii,
p_point_classify ppc
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item ii ON ii.id = ci.input_id
LEFT JOIN p_point_classify ppc on ci.point_classify_id = ppc.id
WHERE
c.id = ci.check_id
AND ii.id = ci.input_id
AND c.id = #{checkId}
c.id = #{checkId}
ORDER BY
ci.order_no
</select>
......
......@@ -27,16 +27,16 @@
{
"code": "xf",
"emqTopic": "emq.xf.created",
"akkaTopic": "JKXT2BP-XF-Topic"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "risk",
"emqTopic": "emq.risk.created",
"akkaTopic": "JKXT2BP-RISK-Topic"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "JKXT2BP-RISK-Topic"
"akkaTopic": "JKXT2BP-XFYY-Topic"
}
]
\ No newline at end of file
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