Commit c4a52869 authored by suhuiguang's avatar suhuiguang

1.维保周期

parent dbd1a819
...@@ -41,6 +41,7 @@ import com.yeejoin.amos.maintenance.core.util.DateUtil; ...@@ -41,6 +41,7 @@ import com.yeejoin.amos.maintenance.core.util.DateUtil;
import com.yeejoin.amos.maintenance.core.util.StringUtil; import com.yeejoin.amos.maintenance.core.util.StringUtil;
import com.yeejoin.amos.maintenance.dao.entity.*; import com.yeejoin.amos.maintenance.dao.entity.*;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService; import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import com.yeejoin.amos.maintenance.mqtt.MqttGateway;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils; import org.apache.cxf.common.util.CollectionUtils;
import org.assertj.core.util.Sets; import org.assertj.core.util.Sets;
...@@ -101,9 +102,15 @@ public class CheckServiceImpl implements ICheckService { ...@@ -101,9 +102,15 @@ public class CheckServiceImpl implements ICheckService {
@Autowired @Autowired
IPointDao iPointDao; IPointDao iPointDao;
@Autowired
MqttGateway mqttGateway;
@Value("${file.url}") @Value("${file.url}")
private String fileUrl; private String fileUrl;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
@Override @Override
public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) { public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param); long total = checkMapper.countCheckInfoData(param);
...@@ -236,7 +243,14 @@ public class CheckServiceImpl implements ICheckService { ...@@ -236,7 +243,14 @@ public class CheckServiceImpl implements ICheckService {
} }
planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(), recordParam.getPlanTaskId(), mtUserSeq); planTaskDetailMapper.finishTaskDetail(Long.parseLong(detail.get("planTaskDetailId").toString()), recordParam.getPointId(), recordParam.getPlanTaskId(), mtUserSeq);
//6.返回不合格记录 //6.消息广播最近维保日期
if(StringUtil.isNotEmpty(point.getOriginalId())){
JSONObject jsonObject = new JSONObject();
jsonObject.put("facilityId",point.getOriginalId());
jsonObject.put("checkTime",check.getCheckTime());
mqttGateway.publish(CHECK_UPDATE_TOPIC,jsonObject.toJSONString());
}
//7.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList); return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) { } catch (Exception e) {
throw new Exception(e.getMessage()); throw new Exception(e.getMessage());
......
package com.yeejoin.amos.maintenance.mqtt; package com.yeejoin.amos.maintenance.mqtt;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
/**
* @author DELL
*/
@Component @Component
public class WebMqttComponent { @Slf4j
@Autowired public class MqttGateway {
@Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
public void publish(String topic, String jsonStr) { public void publish(String topic, String jsonStr) {
try { try {
this.emqKeeper.getMqttClient().publish(topic, jsonStr.getBytes(), 1, false); this.emqKeeper.getMqttClient().publish(topic, jsonStr.getBytes(), 1, false);
} catch (MqttPersistenceException e) { } catch (MqttException e) {
e.printStackTrace(); log.error("消息发送失败:{}、{}、{}", e.getMessage(), topic, jsonStr);
} catch (MqttException e) { }
e.printStackTrace(); }
}
}
} }
...@@ -14,7 +14,7 @@ import com.yeejoin.amos.maintenance.common.enums.*; ...@@ -14,7 +14,7 @@ import com.yeejoin.amos.maintenance.common.enums.*;
import com.yeejoin.amos.maintenance.core.async.AsyncTask; import com.yeejoin.amos.maintenance.core.async.AsyncTask;
import com.yeejoin.amos.maintenance.dao.entity.*; import com.yeejoin.amos.maintenance.dao.entity.*;
import com.yeejoin.amos.maintenance.feign.RemoteSecurityService; import com.yeejoin.amos.maintenance.feign.RemoteSecurityService;
import com.yeejoin.amos.maintenance.mqtt.WebMqttComponent; import com.yeejoin.amos.maintenance.mqtt.MqttGateway;
import org.quartz.Job; import org.quartz.Job;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -76,7 +76,7 @@ public class JobService implements IJobService { ...@@ -76,7 +76,7 @@ public class JobService implements IJobService {
@Value("${amosRefresh.patrol.topic}") @Value("${amosRefresh.patrol.topic}")
private String patrolTopic; private String patrolTopic;
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private MqttGateway webMqttComponent;
@Override @Override
@Transactional @Transactional
......
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