|
|
@@ -2,8 +2,11 @@ package com.github.zuihou.business.productionReadyCenter.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.beust.jcommander.internal.Lists;
|
|
|
import com.github.zuihou.authority.service.auth.UserService;
|
|
|
import com.github.zuihou.authority.strategy.DataScopeContext;
|
|
|
import com.github.zuihou.base.request.PageParams;
|
|
|
@@ -24,6 +27,7 @@ import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogServ
|
|
|
import com.github.zuihou.business.util.DynamicRabbitMq;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
+import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.auth.DataScope;
|
|
|
@@ -31,12 +35,14 @@ import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.exception.BizException;
|
|
|
+import com.github.zuihou.utils.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -81,6 +87,7 @@ public class AAutoNodeLogServiceImpl extends SuperServiceImpl<AAutoNodeLogMapper
|
|
|
@Resource
|
|
|
private DynamicRabbitMq dynamicRabbitMq;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<AAutoNodeLog> pageList(IPage page, LbqWrapper<AAutoNodeLog> wrapper, String instructionName) {
|
|
|
return baseMapper.pageList(page,wrapper, new DataScope(), instructionName);
|
|
|
@@ -265,4 +272,33 @@ public class AAutoNodeLogServiceImpl extends SuperServiceImpl<AAutoNodeLogMapper
|
|
|
public List<Map> getErrList(Map params) {
|
|
|
return baseMapper.getErrList(params);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void synLineWarn(String ips) {
|
|
|
+ //CCS调用产线警报内容
|
|
|
+ String hostSystemUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS) ? "" : ((Map<String, String>) msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.HOSTSYSTEMURL).toString());
|
|
|
+ String lineWarnUrl = hostSystemUrl + "/api/GetLineWarn";
|
|
|
+ JSONObject jsonParam = new JSONObject();
|
|
|
+ jsonParam.put("url", ips);
|
|
|
+ String results = msgUtil.httpForPost(lineWarnUrl, jsonParam.toJSONString());
|
|
|
+
|
|
|
+ if(!results.contains("imcsTOccsEnable")){
|
|
|
+ JSONArray jsonArray = JSON.parseArray(results);
|
|
|
+ List<AAutoNodeLog> addLogs = Lists.newArrayList();
|
|
|
+ for(Object obj : jsonArray){
|
|
|
+ JSONObject jsonObject = (JSONObject)obj;
|
|
|
+ int count = aAutoNodeLogService.count(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getMethod, "GlobalException").eq(AAutoNodeLog::getStatus, "0").geHeader(AAutoNodeLog::getExecuteTime, LocalDate.now()).leFooter(AAutoNodeLog::getExecuteTime, LocalDate.now()));
|
|
|
+ if(count == 0){
|
|
|
+ AAutoNodeLog aAutoNodeLog = AAutoNodeLog.builder().status("0").manual("1").exeStatus("2").method("GlobalException").executeTime(new Date())
|
|
|
+ .exeResult("0").feedback("["+ jsonObject.getString("ip") +"] "+ jsonObject.getString("alertMsg"))
|
|
|
+ .build();
|
|
|
+ addLogs.add(aAutoNodeLog);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(addLogs.size()>0) {
|
|
|
+ aAutoNodeLogService.saveBatch(addLogs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //非空判断是否本地存储
|
|
|
+ }
|
|
|
}
|