打印日志
This commit is contained in:
parent
7749a200da
commit
4016e642df
@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,6 +28,7 @@ import lombok.experimental.Accessors;
|
|||||||
@TableName(value = "project_jqm_dev")
|
@TableName(value = "project_jqm_dev")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ApiModel(value = "ProjectJqmDev实体类", description = "ProjectJqmDev")
|
@ApiModel(value = "ProjectJqmDev实体类", description = "ProjectJqmDev")
|
||||||
|
@ToString
|
||||||
public class ProjectJqmDev {
|
public class ProjectJqmDev {
|
||||||
/**
|
/**
|
||||||
* 金钱猫设备id
|
* 金钱猫设备id
|
||||||
|
|||||||
@ -95,14 +95,14 @@ public class JinqianmaoTask {
|
|||||||
|
|
||||||
public void getProjectNameNumberMap() {
|
public void getProjectNameNumberMap() {
|
||||||
List<CompanyConfig> companyConfigs = companyConfigMapper.selectList(new QueryWrapper<>());
|
List<CompanyConfig> companyConfigs = companyConfigMapper.selectList(new QueryWrapper<>());
|
||||||
for (CompanyConfig companyConfig:companyConfigs){
|
for (CompanyConfig companyConfig : companyConfigs) {
|
||||||
JSONObject jsonInfo = new JSONObject();
|
JSONObject jsonInfo = new JSONObject();
|
||||||
jsonInfo.put("StartIndex", 0);
|
jsonInfo.put("StartIndex", 0);
|
||||||
jsonInfo.put("Count", 10000);
|
jsonInfo.put("Count", 10000);
|
||||||
HttpResponse httpResponse = HttpRequest.post(getUrl("getProjectList",companyConfig.getUrl(),companyConfig.getAk(),companyConfig.getSecret()))
|
String url = getUrl("getProjectList", companyConfig.getUrl(), companyConfig.getAk(), companyConfig.getSecret());
|
||||||
.body(jsonInfo.toJSONString())
|
String body = jsonInfo.toJSONString();
|
||||||
.timeout(5 * 60 * 1000)
|
log.info("getProjectNameNumberMap()调用http:getProjectList,url:{},body:{}", url, body);
|
||||||
.execute();
|
HttpResponse httpResponse = HttpRequest.post(url).body(body).timeout(5 * 60 * 1000).execute();
|
||||||
log.info("请求第三方接口getProjectList响应体:{}", httpResponse);
|
log.info("请求第三方接口getProjectList响应体:{}", httpResponse);
|
||||||
if (httpResponse.getStatus() == HttpStatus.HTTP_OK && httpResponse.body() != null) {
|
if (httpResponse.getStatus() == HttpStatus.HTTP_OK && httpResponse.body() != null) {
|
||||||
JSONObject projectListData = JSON.parseObject(httpResponse.body());
|
JSONObject projectListData = JSON.parseObject(httpResponse.body());
|
||||||
@ -119,6 +119,7 @@ public class JinqianmaoTask {
|
|||||||
nameIdList.add(nameIdMap);
|
nameIdList.add(nameIdMap);
|
||||||
}
|
}
|
||||||
nameIdList.forEach(nameIdMap -> projectService.update(Wrappers.<Project>lambdaUpdate().set(Project::getProjectNumber, nameIdMap.get("id")).eq(Project::getProjectName, nameIdMap.get("name"))));
|
nameIdList.forEach(nameIdMap -> projectService.update(Wrappers.<Project>lambdaUpdate().set(Project::getProjectNumber, nameIdMap.get("id")).eq(Project::getProjectName, nameIdMap.get("name"))));
|
||||||
|
log.info("getProjectNameNumberMap()的nameIdList:{}", nameIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +129,6 @@ public class JinqianmaoTask {
|
|||||||
public void saveJqmDev() {
|
public void saveJqmDev() {
|
||||||
List<CompanyConfig> companyConfigs = companyConfigMapper.selectList(new QueryWrapper<>());
|
List<CompanyConfig> companyConfigs = companyConfigMapper.selectList(new QueryWrapper<>());
|
||||||
for (CompanyConfig companyConfig:companyConfigs){
|
for (CompanyConfig companyConfig:companyConfigs){
|
||||||
|
|
||||||
List<Project> projectList = projectService.list(Wrappers.<Project>lambdaQuery().isNotNull(Project::getProjectNumber));
|
List<Project> projectList = projectService.list(Wrappers.<Project>lambdaQuery().isNotNull(Project::getProjectNumber));
|
||||||
JSONObject jsonInfo = new JSONObject();
|
JSONObject jsonInfo = new JSONObject();
|
||||||
jsonInfo.put("StartIndex", 0);
|
jsonInfo.put("StartIndex", 0);
|
||||||
@ -136,21 +136,18 @@ public class JinqianmaoTask {
|
|||||||
|
|
||||||
for (Project project : projectList) {
|
for (Project project : projectList) {
|
||||||
String projectNumber = project.getProjectNumber();
|
String projectNumber = project.getProjectNumber();
|
||||||
|
|
||||||
jsonInfo.put("proId", projectNumber);
|
jsonInfo.put("proId", projectNumber);
|
||||||
String url = getUrl("getDevList", companyConfig.getUrl(), companyConfig.getAk(), companyConfig.getSecret());
|
String url = getUrl("getDevList", companyConfig.getUrl(), companyConfig.getAk(), companyConfig.getSecret());
|
||||||
HttpResponse httpResponse = HttpRequest.post(url)
|
String body = jsonInfo.toJSONString();
|
||||||
.body(jsonInfo.toJSONString())
|
log.info("saveJqmDev()调用http:url:{};body:{}", url, body);
|
||||||
.timeout(5 * 60 * 1000)
|
HttpResponse httpResponse = HttpRequest.post(url).body(body).timeout(5 * 60 * 1000).execute();
|
||||||
.execute();
|
|
||||||
log.info("saveJqmDev()的url:{}", url);
|
|
||||||
log.info("saveJqmDev()的body:{}", jsonInfo.toJSONString());
|
|
||||||
log.info("请求第三方接口getDevList响应体:{}", httpResponse);
|
log.info("请求第三方接口getDevList响应体:{}", httpResponse);
|
||||||
if (httpResponse.getStatus() == HttpStatus.HTTP_OK && httpResponse.body() != null) {
|
if (httpResponse.getStatus() == HttpStatus.HTTP_OK && httpResponse.body() != null) {
|
||||||
JSONObject response = JSON.parseObject(httpResponse.body());
|
JSONObject response = JSON.parseObject(httpResponse.body());
|
||||||
log.info("请求第三方接口getDevList响应体Data:{}", response.getJSONObject("data"));
|
log.info("请求第三方接口getDevList响应体Data:{}", response.getJSONObject("data"));
|
||||||
if (response.getJSONObject("data") != null) {
|
if (response.getJSONObject("data") != null) {
|
||||||
JSONArray devList = response.getJSONObject("data").getJSONArray("data");
|
JSONArray devList = response.getJSONObject("data").getJSONArray("data");
|
||||||
|
log.debug("devList:{}", devList);
|
||||||
if (CollUtil.isNotEmpty(devList)) {
|
if (CollUtil.isNotEmpty(devList)) {
|
||||||
List<ProjectJqmDev> projectJqmDevList = new LinkedList<>();
|
List<ProjectJqmDev> projectJqmDevList = new LinkedList<>();
|
||||||
String date = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN);
|
String date = DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN);
|
||||||
@ -164,7 +161,7 @@ public class JinqianmaoTask {
|
|||||||
ProjectJqmDev projectJqmDev = projectJqmDevService.getOne(Wrappers.lambdaQuery(ProjectJqmDev.class)
|
ProjectJqmDev projectJqmDev = projectJqmDevService.getOne(Wrappers.lambdaQuery(ProjectJqmDev.class)
|
||||||
.eq(ProjectJqmDev::getDevSn, devId).eq(ProjectJqmDev::getProjectNumber, projectNumber));
|
.eq(ProjectJqmDev::getDevSn, devId).eq(ProjectJqmDev::getProjectNumber, projectNumber));
|
||||||
|
|
||||||
Integer curFloor = getCurFloor(projectNumber, devId,companyConfig.getUrl(),companyConfig.getAk(),companyConfig.getSecret());
|
Integer curFloor = getCurFloor(projectNumber, devId, companyConfig.getUrl(), companyConfig.getAk(), companyConfig.getSecret());
|
||||||
if (projectJqmDev != null) {
|
if (projectJqmDev != null) {
|
||||||
if (!Objects.equals(curFloor, projectJqmDev.getLastFloorCount())) {
|
if (!Objects.equals(curFloor, projectJqmDev.getLastFloorCount())) {
|
||||||
asyncCommon.sendMqAndApp("楼层变动通知", "设备:" + devName + "的楼层发生变动,请及时进行巡检!", "楼层变动通知", project.getProjectSn(), "/pages/projectEnd/projectIndex/projectIndex");
|
asyncCommon.sendMqAndApp("楼层变动通知", "设备:" + devName + "的楼层发生变动,请及时进行巡检!", "楼层变动通知", project.getProjectSn(), "/pages/projectEnd/projectIndex/projectIndex");
|
||||||
@ -181,6 +178,7 @@ public class JinqianmaoTask {
|
|||||||
projectJqmDevList.add(new ProjectJqmDev(null, projectNumber, project.getProjectSn(), project.getProjectName(), devId, devName, devType, devStatus, curFloor, date, date));
|
projectJqmDevList.add(new ProjectJqmDev(null, projectNumber, project.getProjectSn(), project.getProjectName(), devId, devName, devType, devStatus, curFloor, date, date));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.debug("saveBatch:projectJqmDevList:{}", projectJqmDevList);
|
||||||
projectJqmDevService.saveBatch(projectJqmDevList);
|
projectJqmDevService.saveBatch(projectJqmDevList);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user