Commit 7384a7ec authored by KeYong's avatar KeYong

Merge branch 'develop_dl_3.7.1.0' into develop_dl

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java # amos-boot-system-equip/src/main/resources/application-dev.properties # amos-boot-system-equip/src/main/resources/application.properties
parents 28df875d 93b8b0b6
......@@ -1044,4 +1044,25 @@ public class DateUtils {
final LocalDateTime end = LocalDateTime.parse(sdf.format(endTime), DateTimeFormatter.ofPattern(pattern));
return Duration.between(start, end).toDays();
}
public static Map<String,Object> dayComparePrecise(Date fromDate, Date toDate){
Map<String,Object> param = new LinkedHashMap<>();
Calendar from = Calendar.getInstance();
from.setTime(fromDate);
Calendar to = Calendar.getInstance();
to.setTime(toDate);
int fromYear = from.get(Calendar.YEAR);
int fromDay = from.get(Calendar.DAY_OF_YEAR);
int toYear = to.get(Calendar.YEAR);
int toDay = to.get(Calendar.DAY_OF_YEAR);
int year = toYear - fromYear;
int day = toDay - fromDay;
if(day < 0){
day +=365;
year -=1;
}
param.put("year", year);
param.put("day", day);
return param;
}
}
......@@ -10,6 +10,7 @@ import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.entity.ContentType;
......@@ -21,10 +22,12 @@ import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
......@@ -63,12 +66,11 @@ public class HttpContentTypeUtil {
//System.out.println("初始化HttpClientTest~~~开始");
SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
builder.build());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build(), new String[]{ "TLSv1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE);
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register(
"http", PlainConnectionSocketFactory.getSocketFactory()).register(
"https", sslsf).build();
"https", sslsf).register(
"http", PlainConnectionSocketFactory.getSocketFactory()).build();
// 初始化连接管理器
pool = new PoolingHttpClientConnectionManager(
socketFactoryRegistry);
......@@ -124,8 +126,6 @@ public class HttpContentTypeUtil {
// 得到响应实例
HttpEntity entity = response.getEntity();
log.info("==========response=============" + JSON.toJSONString(response));
// 可以获得响应头
// Header[] headers = response.getHeaders(HttpHeaders.CONTENT_TYPE);
// for (Header header : headers) {
......@@ -141,6 +141,7 @@ public class HttpContentTypeUtil {
"HTTP Request is not success, Response code is " + response.getStatusLine().getStatusCode());
}
log.info("调用header:" + JSON.toJSONString(httpPost.getAllHeaders()) + ";\n调用body: " + JSON.toJSONString(httpPost.getEntity()) + ";\n调用返回:" + JSON.toJSONString(entity));
if (HttpStatus.SC_OK == response.getStatusLine().getStatusCode() || HttpStatus.SC_CREATED == response.getStatusLine().getStatusCode()) {
responseContent = EntityUtils.toString(entity, CHARSET_UTF_8);
EntityUtils.consume(entity);
......@@ -602,4 +603,27 @@ public class HttpContentTypeUtil {
}
return sendHttpPost(httpPost);
}
public static String sendHttpPostFormWithHeader(String httpUrl, Map<String, String> params, Map<String, String> headerMap) {
HttpPost httpPost = new HttpPost(httpUrl);// 创建httpPost
try {
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
httpPost.addHeader(entry.getKey(), entry.getValue());
}
log.info("请求头======================" + JSON.toJSONString(httpPost.getAllHeaders()));
// 设置参数
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
if (params != null) {
for (String key: params.keySet()) {
builder.addPart(key, new StringBody(params.get(key), ContentType.create("text/plain", Consts.UTF_8)));
}
HttpEntity entity = builder.build();
log.info("请求体======================" + JSON.toJSONString(entity));
httpPost.setEntity(entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
}
\ No newline at end of file
......@@ -18,4 +18,5 @@ public class SShanMessage {
private String pointId;
private String time;
private String deviceId;
private String eventstatus;
}
......@@ -38,4 +38,7 @@ public interface OrganizationService {
Organization getDetailsById(Long id);
int deleteById(Long id);
Map<String, Object> getSystemOnlineDate(String orgCode);
}
......@@ -159,9 +159,9 @@ public class EquipmentIotMqttReceiveConfig {
mqttReceiveService.handlerMqttIncrementMessage(topic, msg);
} else if (dataType.equals("event") && StringUtil.isNotEmpty(msg)) {
mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg);
}else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){
}else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){ // 遥信遥测信号
mqttReceiveService.handlerMqttRomaMessage(topic,msg);
}else if (dataType.equals("shaoshan") && StringUtil.isNotEmpty(msg)){
}else if (dataType.equals("shaoshan") && StringUtil.isNotEmpty(msg)){ // 告警信号
mqttReceiveService.handlerMqttStationMessage(topic,msg);
}
}
......
......@@ -234,4 +234,6 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
void updateStatusByAlarm();
void clearAlarmData(@Param("equipmentSpecificId") Long equipmentSpecificId);
List<Map<String, Object>> getAlarmDetailByDate(@Param("bizOrgCode") String bizOrgCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sysId") Long sysId);
}
......@@ -98,7 +98,7 @@ public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecif
* @param equipmentIndexId 指标业务id
* @param value 更新的值
*/
void updateIndexValueBatch(@Param("equipmentSpecificId") Long equipmentSpecificId, @Param("list") List<EquipmentSpecificIndex> equipmentSpecificIndices);
void updateIndexValueBatch(@Param("equipmentSpecificId") Long equipmentSpecificId, @Param("list") List<EquipmentSpecificIndex> list);
List<EquipmentIndexVO> getEquipSpecificIndexList(EquipmentIndexVO equipmentIndexVo);
......
......@@ -83,9 +83,9 @@ public interface ISyncDataService {
void syncUpdatedFireFightingSystem(Collection<FireFightingSystem> list);
void syncCreatedSendAlarm(Collection<EquipmentSpecificAlarmLog> list);
void syncCreatedSendAlarm(Collection<EquipmentSpecificAlarmLog> list) throws InterruptedException;
void syncCreatedSendAlarmReport(EquipmentSpecificAlarmLog ent);
void syncCreatedSendAlarmReport(EquipmentSpecificAlarmLog ent) throws InterruptedException;
void syncCreatedBuilding(List<FormInstance> list);
......
......@@ -90,6 +90,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
private FormInstanceMapper formInstanceMapper;
@Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired
private SourceSceneMapper sourceSceneMapper;
@Value("${equipment.fire.systemid}")
private String fireSystemId;
......@@ -1618,6 +1620,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// 系统循环数据填充
ArrayList<Map<String, Object>> systemList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
if (!CollectionUtils.isEmpty(system)) {
// 换流站信息
if (!ObjectUtils.isEmpty(system.get(0).get("stationName"))) {
......@@ -1634,6 +1637,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map> collect = indicatorConfiguration.stream().
filter(item -> item.get("code").equals(String.valueOf(sys.get("typeCode")))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startDate, endDate, Long.valueOf(String.valueOf(sys.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
systemData.put("systemName", ObjectUtils.isEmpty(sys.get("name")) ? "" : String.valueOf(sys.get("name")));
// 系统对应指标
......@@ -1728,15 +1735,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
systemList.add(systemData);
map.put("datalist", systemList);
}
}
} else {
map.put("attachAlarmList", attachAlarmList);
}else {
return null;
}
return map;
}
......@@ -1825,12 +1828,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("time", startDate + "至" + endDate);
// 系统循环数据填充
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
for (Map<String, Object> system : systemList) {
HashMap<String, Object> systemData = new HashMap<>();
List<Map> collect = indicatorConfiguration.stream().
filter(item -> item.get("code").equals(String.valueOf(system.get("typeCode")))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startDate, endDate, Long.valueOf(String.valueOf(system.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
systemData.put("systemName", ObjectUtils.isEmpty(system.get("name")) ? "" : String.valueOf(system.get("name")));
......@@ -1941,14 +1949,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
dataList.add(systemData);
map.put("data", dataList);
}
}
} else {
return null;
map.put("attachAlarmList", attachAlarmList);
}else {
return null;
}
return map;
}
......@@ -2020,14 +2025,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
map.put("station", "");
}
map.put("time", startDate);
// 系统循环数据填充
ArrayList<Map<String, Object>> dataList = new ArrayList<>();
List<Map<String, Object>> attachAlarmList = new ArrayList<>();
for (Map<String, Object> system : systemList) {
HashMap<String, Object> systemData = new HashMap<>();
List<Map> collect = indicatorConfiguration.stream().
filter(item -> item.get("code").equals(String.valueOf(system.get("typeCode")))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(collect)) {
// 附件告警数据
List<Map<String, Object>> sysAlarmList = equipmentSpecificAlarmMapper.getAlarmDetailByDate(bizOrgCode, startDate, endDate, Long.valueOf(String.valueOf(system.get("id"))));
attachAlarmList.addAll(sysAlarmList);
// 系统名称
systemData.put("systemName", ObjectUtils.isEmpty(system.get("name")) ? "" : String.valueOf(system.get("name")));
......@@ -2139,14 +2150,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
dataList.add(systemData);
map.put("data", dataList);
}
}
} else {
return null;
map.put("attachAlarmList", attachAlarmList);
}else {
return null ;
}
return map;
}
......
......@@ -49,7 +49,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -218,6 +217,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private String emergencyDisposalIndicators;
@Value("classpath:/json/systemStateIndex.json")
private Resource systemStateIndex;
@Value("${message.alarm.char}")
private String specialChars;
public static List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey,
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService,
......@@ -618,6 +619,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
action.setAlamContent(action.getEquipmentSpecificName() + action.getEquipmentSpecificIndexName());
}
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.FALSE;
} else {
alarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), action.getTraceId(),
equipmentSpecificAlarmLogService, false, ""));
......@@ -655,7 +657,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
publishDataToCanvas(equipmentSpecificIndexList);
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs);
try {
equipmentAlarmLogsToOtherSystems(alarmLogs);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (equipmentSpecificVo.getEcode() != null) {
String ecode = equipmentSpecificVo.getEcode();
......@@ -717,7 +723,14 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
SShanStationMessage sShanStationMessage = JSON.parseObject(String.valueOf(message), SShanStationMessage.class);
Map<Object, Object> equipmentIndexKeyMap = redisUtils.hmget(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION);
sShanStationMessage.getWarns().forEach(m -> {
String value = m.getEventTextL1().contains("出现") ? TRUE : FALSE;
String value;
if (message.contains("eventtextL1")) {
// 此通道目前专供韶山告警消息value赋值,没必要用配置文件多字段进行逐个判断,所以暂时不修改
value = m.getEventTextL1().contains("出现") ? TRUE : FALSE;
} else {
value = String.valueOf(BeanUtil.judgePropertyContainsChar(m.getEventstatus(), specialChars));
}
if (equipmentIndexKeyMap.get(m.getPointId()) != null) {
EquipmentSpecificIndex equipmentSpeIndex = equipmentSpecificIndexService.getEquipmentSpeIndexByAddress(null, m.getPointId(), null);
if (equipmentSpeIndex == null) {
......@@ -870,6 +883,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
action.setAlamContent(action.getEquipmentSpecificName() + action.getEquipmentSpecificIndexName());
}
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.FALSE;
} else {
alarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), action.getTraceId(),
equipmentSpecificAlarmLogService, false, ""));
......@@ -907,7 +921,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
publishDataToCanvas(equipmentSpecificIndexList);
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs);
try {
equipmentAlarmLogsToOtherSystems(alarmLogs);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (equipmentSpecificVo.getEcode() != null) {
String ecode = equipmentSpecificVo.getEcode();
......@@ -954,6 +972,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
});
}
/**
* 物联数据处理
*
......@@ -1178,6 +1197,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
action.setAlamContent(action.getEquipmentSpecificName() + action.getEquipmentSpecificIndexName());
}
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.FALSE;
} else {
alarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), action.getTraceId(),
equipmentSpecificAlarmLogService, false, ""));
......@@ -1217,7 +1237,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
publishDataToCanvas(equipmentSpecificIndexList);
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs);
try {
equipmentAlarmLogsToOtherSystems(alarmLogs);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (vo.getEcode() != null) {
String ecode = vo.getEcode();
......@@ -1544,6 +1568,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
model.setExtras(equipMap);
}
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
List<String> receive = new ArrayList<>();
receive.add("system");
model.setRecivers(receive);
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.info(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
......@@ -1654,11 +1681,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarm.setStationName(mapd.get("station_name").toString());
}
// equipmentSpecificAlarm.setStationCode(stationCode);
// equipmentSpecificAlarm.setStationName(stationName);
equipmentSpecificAlarms.add(equipmentSpecificAlarm);
return equipmentSpecificAlarms;
}
......@@ -1833,7 +1855,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
*
* @param equipmentAlarmLogs
*/
public void equipmentAlarmLogsToOtherSystems(List<EquipmentSpecificAlarmLog> equipmentAlarmLogs) {
public void equipmentAlarmLogsToOtherSystems(List<EquipmentSpecificAlarmLog> equipmentAlarmLogs) throws InterruptedException {
if (ObjectUtils.isEmpty(equipmentAlarmLogs)) {
return;
}
......@@ -1869,11 +1891,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
}
}
// 向南瑞平台推送报警消息
if (!bool && NRMsgSend) {
syncDataService.syncCreatedSendAlarm(equipmentAlarmLogs);
}
}
// 向南瑞平台推送报警消息
log.info("判断条件bool值为:" + JSON.toJSONString(bool) + ", NRMsgSend值为:" + JSON.toJSONString(NRMsgSend));
if (!bool && NRMsgSend) {
syncDataService.syncCreatedSendAlarm(equipmentAlarmLogs);
}
}
......
......@@ -25,6 +25,7 @@ import com.yeejoin.equipmanage.utils.DcsUtil;
import com.yeejoin.equipmanage.utils.SyncDataUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.nio.client.HttpAsyncClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -397,7 +398,7 @@ public class SyncDataServiceImpl implements ISyncDataService {
}
@Override
public void syncCreatedSendAlarm(Collection<EquipmentSpecificAlarmLog> list) {
public void syncCreatedSendAlarm(Collection<EquipmentSpecificAlarmLog> list) throws InterruptedException {
equipAlarmDataSync((List<EquipmentSpecificAlarmLog>) list);
}
......@@ -420,7 +421,7 @@ public class SyncDataServiceImpl implements ISyncDataService {
}
@Override
public void syncCreatedSendAlarmReport(EquipmentSpecificAlarmLog ent) {
public void syncCreatedSendAlarmReport(EquipmentSpecificAlarmLog ent) throws InterruptedException {
equipAlarmDataSync(Arrays.asList(ent));
}
......@@ -442,8 +443,9 @@ public class SyncDataServiceImpl implements ISyncDataService {
//redisTemplate.opsForValue().set(message.redisKey(), new String(message.message2Bytes()));
}
void equipAlarmDataSync(List<EquipmentSpecificAlarmLog> list) {
void equipAlarmDataSync(List<EquipmentSpecificAlarmLog> list) throws InterruptedException {
if (CollectionUtils.isNotEmpty(list)) {
Thread.sleep(2000);
List<Long> idList = list.stream().filter(x -> x.getBuildId() != null).map(EquipmentSpecificAlarmLog::getId).collect(Collectors.toList());
List<Long> idBNullList = list.stream().filter(x -> x.getBuildId() == null).map(EquipmentSpecificAlarmLog::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(idList) || CollectionUtils.isNotEmpty(idBNullList)) {
......@@ -486,9 +488,11 @@ public class SyncDataServiceImpl implements ISyncDataService {
alarmList.add(map);
}
warnMap.put("warns", alarmList);
logger.info("开始调用平台服务存储告警数据warns:" + JSON.toJSONString(alarmList));
requestVo.setBody(warnMap);
logger.info("===============告警存入header:" + JSON.toJSONString(headerMap) + ";\n==================告警存入body: " + JSON.toJSONString(requestVo));
String s = HttpContentTypeUtil.sendHttpPostJsonWithHeader(sendAlarmUrl, JSON.toJSONString(requestVo), headerMap);
logger.info("===============告警推送联调==================返回数据:" + s);
logger.info("===============告警推送联调返回数据:" + JSON.toJSONString(s));
}
} catch (Exception e) {
logger.error("equipAlarmDataSync告警数据发送接口请求异常:" + e.getMessage());
......
......@@ -30,4 +30,16 @@ public class BeanUtil {
public static void copyPropertiesIgnoreNull(Object src, Object target){
BeanUtils.copyProperties(src, target, getNullPropertyNames(src));
}
public static boolean judgePropertyContainsChar(String sourceStr, String specialStr) {
boolean bool = Boolean.FALSE;
String[] strings = specialStr.split(",");
for (String code : strings) {
if (sourceStr.contains(code)) {
bool = Boolean.TRUE;
break;
}
}
return bool;
}
}
package com.yeejoin.equipmanage.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.equipmanage.common.datasync.vo.AppTokenVo;
import com.yeejoin.equipmanage.common.utils.HttpContentTypeUtil;
......@@ -56,6 +57,7 @@ public class DcsUtil {
private RedisTemplate<String, String> redisTemplate;
public String getDcsToken() throws Exception {
logger.info("开始获取登录token++++++++++++++");
String accessToken = "";
// accessToken = redisTemplate.opsForValue().get(tokenKey);
if (!StringUtils.isNotBlank(accessToken)) {
......@@ -67,7 +69,13 @@ public class DcsUtil {
map.put("scope", scope);
map.put("client_id", clientId);
map.put("client_secret", clientSecret);
String content = HttpContentTypeUtil.doPostForm(gettokenUrl, map);
String content;
if (isHttpsUrl(gettokenUrl)){
content = HttpContentTypeUtil.sendHttpPostFormWithHeader(gettokenUrl, map, headerMap);
} else {
content = HttpContentTypeUtil.doPostForm(gettokenUrl, map);
}
if (StringUtils.isNotBlank(content)) {
AppTokenVo appTokenVo = JSONObject.parseObject(content, AppTokenVo.class);
// accessToken = String.join(" ", appTokenVo.getToken_type(), appTokenVo.getAccess_token());
......@@ -76,6 +84,12 @@ public class DcsUtil {
redisTemplate.opsForValue().set(tokenKey, accessToken, expiresIn);
}
}
logger.info("accessToken 是=====================" + JSON.toJSONString(accessToken));
return accessToken;
}
public static boolean isHttpsUrl(String url) {
String regex = "^https://.*$";
return url.matches(regex);
}
}
\ No newline at end of file
......@@ -252,4 +252,14 @@ public class OrganizationController extends BaseController {
public ResponseModel deleteById(@RequestParam() Long id) {
return ResponseHelper.buildResponse(organizationService.deleteById(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询上线的年日",notes = "查询上线年日")
@GetMapping(value = "/online/date")
@PersonIdentify
public ResponseModel<Map<String, Object>> getSystemOnlineDate(){
ReginParams reginParams =getSelectedOrgInfo();
String companyId = reginParams.getPersonIdentity().getCompanyId();
return ResponseHelper.buildResponse(organizationService.getSystemOnlineDate(companyId));
}
}
......@@ -3,7 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationExportDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.OrganizationUserExportDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Organization;
......@@ -11,6 +15,8 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.OrganizationUser;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.OrganizationUserMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.OrganizationService;
import freemarker.template.utility.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,11 +26,14 @@ import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class OrganizationImpl extends BaseService<Organization, Organization, OrganizationMapper> implements OrganizationService {
@Autowired
......@@ -34,6 +43,8 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or
private OrganizationUserMapper organizationUserMapper;
private static String NAME = "组员信息表第";
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Override
public Page<Map<String, Object>> getOrganizationInfo(Page<Map<String, Object>> page, String bizOrgCode) {
......@@ -270,4 +281,21 @@ public class OrganizationImpl extends BaseService<Organization, Organization, Or
}
return this.baseMapper.deleteById(id);
}
@Override
public Map<String, Object> getSystemOnlineDate(String id) {
try {
OrgUsrFormDto orgUsrFormDto = iOrgUsrService.selectCompanyById(Long.parseLong(id));
if (ObjectUtils.isNotEmpty(orgUsrFormDto)) {
String operationDate = String.valueOf(orgUsrFormDto.getMap().get("operationDate"));
Date beginDate = DateUtils.convertStrToDate(operationDate, DateUtils.DATE_PATTERN);
Date now = DateUtils.getDateNow();
return DateUtils.dayComparePrecise(beginDate, now);
}
} catch (Exception e) {
e.printStackTrace();
log.error("获取系统上线时间失败:{}", e.getMessage());
}
return new HashMap<>(1);
}
}
......@@ -264,6 +264,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public Page<HashMap<String, Object>> getPlanTaskInfoNew(PlanTaskPageParam params) {
if (StringUtils.isEmpty(params.getBeginDate())) {
params.setBeginDate("");
}
if (StringUtils.isEmpty(params.getEndDate())) {
params.setEndDate("");
}
long total = planTaskMapper.countPlanTask(params);
List<HashMap<String, Object>> content = planTaskMapper.getPlanTaskInfo(params);
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, params, total);
......
This diff is collapsed.
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.10.220:3306/equipment?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
......@@ -12,15 +12,14 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain=http://172.16.10.220:9000/
fileserver_domain=http://172.16.11.201:9000/
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.10.220
eureka.instance.hostname= 172.16.11.201
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.10.220:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@172.16.11.201:10001/eureka/
spring.security.user.name=admin
spring.security.user.password=a1234560
security.productApp=STUDIO_APP_MOBILE
......@@ -32,7 +31,7 @@ amos.system.user.product=STUDIO_APP_WEB
#redis
spring.redis.database=1
spring.redis.host=172.16.10.220
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -44,10 +43,10 @@ spring.redis.expire.time=30000
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883
emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.10.220:8083/mqtt
mqtt.scene.host=mqtt://172.16.11.201:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
......@@ -74,7 +73,7 @@ isSendApp=false
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
#\u6570\u5B57\u5316\u5357\u745E\u5E73\u53F0\u63A5\u53E3
dcs.send.message=true
dcs.send.message=false
dcs.client-id=fire_system
dcs.grant-type=client_credentials
dcs.scope=all
......@@ -84,6 +83,8 @@ dcs.x.hw.id=io.cs
dcs.x.hw.appKey=i!YmnHgJ=Ysz8V+O@ZG237inQKfixkQ.-#-P3IlR8fO%.#F!g%35Z#@tp$6G+52v
dcs.url.token=http://198.87.103.158:8001/auth-service/oauth/token
dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#dcs.url.token=https://192.168.4.89/v1/cs/auth-service/oauth/token
#dcs.url.sendalarm=https://192.168.4.89/v1/cs/alarm-service/appalarm/sendalarm
#\u7CFB\u7EDF\u4E0A\u7EBF\u65F6\u95F4
param.system.online.date = 2019-02-12
......@@ -115,7 +116,7 @@ isSendIot=false
#\u62A5\u5E9F\u524D30\u65E5 \u53D1\u8D77\u63D0\u9192
equipment.scrap.day=30
#\u63D0\u9192\u65F6\u95F4
equipment.scrap.cron=0 0 9 * * ?
#?????????????
equipment.pressurepump.start.cron=0 0 0 * * ?
......@@ -179,4 +180,7 @@ spring.kafka.listener.type=batch
kafka.topic=PERSPECTIVE
emq.topic=iot/data/perspective
kafka.alarm.topic=EQUIPMENT_ALARM
iot.async.flag = false
\ No newline at end of file
iot.async.flag = false
# message\u670D\u52A1\u8F6C\u53D1\u544A\u8B66\u4FE1\u53F7\u7279\u6B8A\u5224\u65AD\u5B57\u7B26\u96C6
message.alarm.char=\u51FA\u73B0
......@@ -20,11 +20,12 @@ pagehelper.helper-dialect=mysql
pagehelper.params=count=countSql
pagehelper.reasonable=false
pagehelper.support-methods-arguments=true
#\u8986\u76D6\u76F8\u540C\u540D\u79F0bean
spring.main.allow-bean-definition-overriding=true
#liquibase
spring.liquibase.change-log=classpath:/changelog/changelog-master.xml
spring.liquibase.enabled=true
spring.liquibase.enabled=false
#\u4E0A\u4F20\u6587\u4EF6\u8BBE\u7F6E
spring.servlet.multipart.maxFileSize=100MB
......@@ -45,6 +46,7 @@ iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS
video.fegin.name=VIDEO
idx.feign.name=AMOS-IDX
mcb.feign.name=MCB-SERVER
#\u9879\u76EE\u521D\u59CB\u5316\u753B\u5E03id
morphic.projectSeq=1390314016458514433
......@@ -76,6 +78,7 @@ mqtt.vehicle.topic=${equipManage.name}.vehicle.state
equip.point.equipmentdata.topic=${equipManage.name}.equipment.state
equip.index.topic=${equipManage.name}.equipment.index.state
equip.iot.monitor.topic=team/station/monitor/matrix
# \u7AD9\u7AEFmessage\u76D1\u542C\u4E3B\u9898
equip.message.create.topic=emq.risk.created
# \u4E2D\u5FC3\u7EA7\u76D1\u542C\u4E3B\u9898
......@@ -89,6 +92,7 @@ equip.scene.detail.url=${server.servlet.context-path}/scene/%s/detail/list
equip.point.equipmentdata.url=${server.servlet.context-path}/equipSpecific/getAll?id=
equip.point.speindex.url=${server.servlet.context-path}/fire-fighting-system/getSpeIndex?id=
equip.point.equipmentDetail.url=${server.servlet.context-path}/equipSpecific/getOneCard?id=
#\u7EC4\u6001\u83B7\u53D6\u7CFB\u7EDF\u8BE6\u60C5\u63A5\u53E3\u5730\u5740
firefightingsystem.detail.url=${server.servlet.context-path}/fire-fighting-system/getSystemById?id=
#\u7EC4\u6001\u83B7\u53D6\u5206\u9875\u63A5\u53E3\u5730\u5740
......@@ -134,6 +138,7 @@ redis_car_type_count = carTypeAndCount
redis_equip_type_count = equipTypeAndCount
emergency.disposal.indicators=emergencyDisposalIndicators
# \u6743\u9650\u6807\u8BC6-\u7269\u8054\u88C5\u5907
auth-key-fire-iot-equip=fire_iot-equip_info
......@@ -146,6 +151,7 @@ management.security.enabled=true
management.endpoint.health.show-details=always
spring.security.user.name=admin
spring.security.user.password=a1234560
#\u6BCF\u500B\u7AD9\u8868\u793A
stationCode=LSHLZ1bZAJU645Pgl7
##\u4EE3\u7801\u4E2D\u6709\u90E8\u5206\u903B\u8F91\u51B2\u7A81\u9700\u8981\u5904\u7406 \u4E3A\u533A\u5206\u673A\u573A\u548C\u7535\u529B\u903B\u8F91 \u589E\u52A0\u5F00\u5173 \u82E5\u4E3Atrue \u5219\u4E3A\u673A\u573A\u903B\u8F91 \u4E3Afalse \u5219\u4E3A\u7535\u529B\u903B\u8F91
......@@ -153,4 +159,4 @@ logic=false
#\uFFFD\uFFFD\u057E\uFFFD\u053D\u04F5\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u046F\uFFFD\u8C78kks\uFFFD\uFFFD
power.station.url=http://139.9.169.123:5024/process/DataInterface
#\uFFFD\uFFFD\u057E104\uFFFD\u027C\uFFFD\u0524\uFFFD\uFFFD
power.station.warning=104/data/analysis
\ No newline at end of file
power.station.warning=104/data/analysis
......@@ -23,8 +23,8 @@
CONCAT(sal.create_date) AS time,
IFNULL(a.`code`,' ') AS areaid,
IFNULL(a.`name`,' ') AS areaname,
f.`code` AS stationid,
f.`name` AS stationname,
sal.station_code AS stationid,
sal.station_name AS stationname,
s.`code` AS deviceid,
s.`name` AS devicename,
sal.equipment_specific_code AS partid,
......@@ -33,18 +33,17 @@
IF
( sal.confirm_type = 'FIREALARM', 0, 1 ) AS eventlevel,
-- CONCAT( sal.equipment_specific_name, ' ', sal.equipment_specific_index_name ) AS eventdesc,
CONCAT( '位于', a.`name`, '的', sal.equipment_specific_name, '(', sal.equipment_specific_code, ')在', sal.create_date, '发生', sal.equipment_specific_index_name, ',请相关人员进行核实确认现场情况!') AS eventdesc,
CONCAT(IF(a.`name` IS NOT NULL, CONCAT('位于', a.`name`, '的'), ''), sal.equipment_specific_name, '在', sal.create_date, '发生', sal.equipment_specific_index_name, '事件,请相关人员进行核实确认现场情况!') AS eventdesc,
sal.equipment_specific_index_name AS eventaction,
IF
( sal.confirm_date IS NULL, FALSE, TRUE ) AS isreport ,
( sal.confirm_date IS NULL, FALSE, TRUE ) AS isreport,
CONCAT(sal.confirm_date) AS confirmtime,
sal.alarm_reason AS eventreason
FROM
wl_equipment_specific_alarm_log sal
LEFT JOIN wl_form_instance i ON sal.build_id = i.instance_id
LEFT JOIN wl_area a ON a.id = i.field_value
LEFT JOIN f_fire_fighting_system s ON s.id = IF(LOCATE(',' , sal.system_ids) > 0,SUBSTRING(sal.system_ids,1,LOCATE(',' , sal.system_ids)-1),sal.system_ids),
f_station_info f
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET(s.id, sal.system_ids)
WHERE
i.field_name = "belongAreaId"
<if test="list != null and list.size() >0">
......@@ -71,7 +70,7 @@
IF
( sal.confirm_type = 'FIREALARM', 0, 1 ) AS eventlevel,
-- CONCAT( sal.equipment_specific_name, ' ', sal.equipment_specific_index_name ) AS eventdesc,
CONCAT(sal.equipment_specific_name, '(', sal.equipment_specific_code, ')在', sal.create_date, '发生', sal.equipment_specific_index_name, ',请相关人员进行核实确认现场情况!') AS eventdesc,
CONCAT(sal.equipment_specific_name, '在', sal.create_date, '发生', sal.equipment_specific_index_name, '事件,请相关人员进行核实确认现场情况!') AS eventdesc,
sal.equipment_specific_index_name AS eventaction,
IF
( sal.confirm_date IS NULL, FALSE, TRUE ) AS isreport ,
......@@ -79,8 +78,7 @@
sal.alarm_reason AS eventreason
FROM
wl_equipment_specific_alarm_log sal
LEFT JOIN wl_equipment_specific_alarm sa ON sa.id = sal.equipment_specific_alarm_id
LEFT JOIN f_fire_fighting_system s ON s.id = IF(LOCATE(',' , sal.system_ids) > 0,SUBSTRING(sal.system_ids,1,LOCATE(',' , sal.system_ids)-1),sal.system_ids),
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET(s.id, sal.system_ids),
f_station_info f
<where>
<if test="list != null and list.size() >0">
......
......@@ -1596,4 +1596,28 @@
DELETE FROM wl_equipment_specific_alarm_log WHERE equipment_specific_id = #{equipmentSpecificId};
DELETE FROM wl_equipment_alarm_report_day WHERE equipment_specific_id = #{equipmentSpecificId};
</delete>
<select id="getAlarmDetailByDate" resultType="Map">
SELECT
wlesa.equipment_specific_id,
wlesa.equipment_specific_name AS specificName,
wlesa.location AS location,
wlesa.equipment_specific_index_name,
concat(wlesa.equipment_specific_name, wlesa.equipment_specific_index_name) AS alamContent,
wlesa.frequency AS alarmNum,
DATE_FORMAT(wlesa.create_date, '%Y-%m-%d %H:%i:%s') AS createDate
FROM
`wl_equipment_specific_alarm` `wlesa`
LEFT JOIN f_fire_fighting_system AS sys ON FIND_IN_SET(sys.id, wlesa.system_ids)
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">AND
wlesa.biz_org_code like concat (#{bizOrgCode},'%')
</if>
<if test="startDate!=null">AND wlesa.create_date <![CDATA[>=]]> #{startDate}</if>
<if test="endDate!=null">AND wlesa.create_date <![CDATA[<=]]> #{endDate}</if>
<if test="sysId != null">
AND find_in_set(#{sysId}, wlesa.system_ids)
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -26,10 +26,9 @@
</resultMap>
<update id="updateIndexValueBatch">
<foreach collection="list" item="item" index="index" separator=";">
update wl_equipment_specific_index set
value = #{item.value}
where equipment_specific_id = #{item.equipmentSpecificId}
and equipment_index_id = #{item.equipmentIndexId}
update wl_equipment_specific_index wesi set wesi.`value` = #{item.value}
where wesi.equipment_specific_id = #{item.equipmentSpecificId}
and wesi.equipment_index_id = #{item.equipmentIndexId}
</foreach>
</update>
<select id="getEquipmentSpeIndexBySpeIotCode"
......
......@@ -24,27 +24,33 @@
<!-- )-->
<if test="beginDate!=null and endDate!=null and endDate != '' and beginDate != ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate} AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate=='' and endDate != null and endDate != ''">
AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="beginDate!=null and beginDate != '' and endDate == ''">
and a.begin_Time <![CDATA[>=]]> #{beginDate}
</if>
<if test="beginDate=='' and beginDate != null and endDate == ''">
AND a.begin_Time <![CDATA[>=]]> #{beginDate}
</if>
<if test="status!=null"> and b.is_finish = #{status}</if>
<if test="planId!=null"> and a.plan_id = #{planId}</if>
<if test="routeId!=null"> and a.route_id = #{routeId}</if>
<if test="orgCode!=null">
and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})
</if>
<if test="searchDay!=null and searchDay != '' and searchDay == 1">
and a.`check_date` = curdate()
</if>
<if test="endDate=='' and endDate != null and beginDate == ''">
AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="status!=null"> and b.is_finish = #{status}</if>
<if test="planId!=null"> and a.plan_id = #{planId}</if>
<if test="routeId!=null"> and a.route_id = #{routeId}</if>
<if test="orgCode!=null">
and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})
</if>
<if test="searchDay!=null and searchDay != '' and searchDay == 1">
and a.`check_date` = curdate()
</if>
</where>
order by b.id) t
</select>
......@@ -116,6 +122,13 @@
</if>
<if test="beginDate=='' and beginDate != null and endDate != ''">
AND a.begin_Time <![CDATA[>=]]> #{beginDate}
</if>
<if test="endDate=='' and endDate != null">
AND a.end_Time <![CDATA[<=]]> #{endDate}
</if>
<if test="status!=null"> and b.is_finish = #{status}</if>
<if test="routeId!=null"> and a.route_id = #{routeId}</if>
......
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