bug修复
This commit is contained in:
parent
9a64889d07
commit
d4b4980ac4
@ -267,8 +267,6 @@ public class Project implements Serializable {
|
||||
private String jzgProjectCode;
|
||||
@ApiModelProperty(value = "金筑工访问host")
|
||||
private String jzgHost;
|
||||
@ApiModelProperty(value = "携稳url")
|
||||
private String xiwonUrl;
|
||||
/**
|
||||
* 弃用,使用xiwonUrl
|
||||
*/
|
||||
@ -295,6 +293,10 @@ public class Project implements Serializable {
|
||||
private String bimCommandCenterUrl;
|
||||
@ApiModelProperty(value = "天气信息")
|
||||
private String weatherInfo;
|
||||
@ApiModelProperty(value = "济南仁智测控账号")
|
||||
private String jnrzckAccount;
|
||||
@ApiModelProperty(value = "济南仁智测控密码")
|
||||
private String jnrzckPw;
|
||||
|
||||
/**
|
||||
* runde平台token
|
||||
|
||||
@ -66,8 +66,6 @@ public class ElectricalTask {
|
||||
log.info("获取最新电量使用情况 每5分钟触发任务");
|
||||
if (StringUtils.isNotBlank(url)) {
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getXiwonUrl, "")
|
||||
.isNotNull(Project::getXiwonUrl)
|
||||
.ne(Project::getXiwonAppId, "")
|
||||
.isNotNull(Project::getXiwonAppId)
|
||||
.ne(Project::getXiwonAppSecret, "")
|
||||
|
||||
@ -2,16 +2,19 @@ package com.zhgd.xmgl.task;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.util.HuaWeiMessageUtils;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardContinuityAlarm;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardDev;
|
||||
import com.zhgd.xmgl.modules.standard.mapper.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.util.StandardDevUtil;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
@ -55,6 +58,8 @@ public class StandardDevTask {
|
||||
private StandardAlarmMapper standardAlarmMapper;
|
||||
@Autowired
|
||||
private StandardDevRealTimeDataMapper standardDevRealTimeDataMapper;
|
||||
@Autowired
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Value("${isGetStandardData}")
|
||||
private boolean isGetStandardData;
|
||||
@ -133,6 +138,7 @@ public class StandardDevTask {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1小时报警推送
|
||||
*/
|
||||
@ -184,6 +190,7 @@ public class StandardDevTask {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 3小时报警推送
|
||||
*/
|
||||
@ -202,6 +209,7 @@ public class StandardDevTask {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 12小时报警推送
|
||||
*/
|
||||
@ -266,17 +274,23 @@ public class StandardDevTask {
|
||||
*/
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
@SchedulerLock(name = "getStandardData", lockAtMostFor = 1000 * 60 * 2, lockAtLeastFor = 1000 * 60 * 1)
|
||||
@GetMapping("/getStandardData")
|
||||
@GetMapping("/task/getStandardData")
|
||||
public void getStandardData() {
|
||||
if (isGetStandardData) {
|
||||
try {
|
||||
log.info("------------拉取执行标样室时数据任务开始---------");
|
||||
QueryWrapper<StandardDev> queryWrapper = new QueryWrapper<>();
|
||||
List<Project> projectList = projectMapper.selectList(new LambdaQueryWrapper<Project>()
|
||||
.ne(Project::getJnrzckAccount, "")
|
||||
.isNotNull(Project::getJnrzckAccount)
|
||||
.ne(Project::getJnrzckPw, "")
|
||||
.isNotNull(Project::getJnrzckPw)
|
||||
);
|
||||
for (Project project : projectList) {
|
||||
LambdaQueryWrapper<StandardDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StandardDev::getProjectSn, project.getProjectSn());
|
||||
List<StandardDev> list = standardDevMapper.selectList(queryWrapper);
|
||||
if (list != null && list.size() > 0) {
|
||||
JSONArray array = StandardDevUtil.getDeviceData("");
|
||||
JSONArray array = StandardDevUtil.getDeviceData("", project.getJnrzckAccount(), project.getJnrzckPw());
|
||||
for (StandardDev dev : list) {
|
||||
|
||||
List<Double> temperatureList = new ArrayList<>();
|
||||
List<Double> humidityList = new ArrayList<>();
|
||||
if (array != null && array.size() > 0) {
|
||||
@ -332,12 +346,12 @@ public class StandardDevTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("------------拉取执行标样室时数据任务结束---------");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -24,18 +24,18 @@ public class StandardDevUtil {
|
||||
|
||||
//账户
|
||||
//public static final String loginName = "t210127lekd";
|
||||
public static final String loginName = "2023wenshiduceshi";
|
||||
//public static final String loginName = "2023wenshiduceshi";
|
||||
//密码
|
||||
//public static final String password = "t210127lekd";
|
||||
public static final String password = "2023wenshiduceshi";
|
||||
//public static final String password = "2023wenshiduceshi";
|
||||
//public static final String url = "http://iot.0531yun.cn/wsjc";
|
||||
public static final String url = "https://www.0531yun.com";
|
||||
private static String userId = "";
|
||||
|
||||
public static String getLoginUserId() {
|
||||
public static String getLoginUserId(String jnrzckAccount, String jnrzckPw) {
|
||||
Map<String, String> param = new HashMap<>();
|
||||
param.put("loginName", loginName);
|
||||
param.put("password", password);
|
||||
param.put("loginName", jnrzckAccount);
|
||||
param.put("password", jnrzckPw);
|
||||
String urlString = url + "/app/Login";
|
||||
String body = JSONUtil.toJsonStr(param);
|
||||
log.info("url:{},body:{}", urlString, body);
|
||||
@ -52,10 +52,8 @@ public class StandardDevUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONArray getDeviceData(String groupId) {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
userId = getLoginUserId();
|
||||
}
|
||||
public static JSONArray getDeviceData(String groupId, String jnrzckAccount, String jnrzckPw) {
|
||||
userId = getLoginUserId(jnrzckAccount, jnrzckPw);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("groupId", groupId);
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
@ -82,7 +80,5 @@ public class StandardDevUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
getLoginUserId();
|
||||
getDeviceData("");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user