日志清理
This commit is contained in:
@@ -423,9 +423,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + phase + "反馈:"+data);
|
||||
|
||||
} else if (phase == 0x30) {
|
||||
data = AgvService.sendAgvOneModeInst(143, index, 0);
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + phase + "反馈:"+data);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + phase + "反馈:"+data);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mongodb.client.MongoCollection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.Document;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.index.IndexOperations;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 自动清理大于十五天的日志
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AutoCleanUpLogs {
|
||||
|
||||
private final MongoTemplate mongoTemplate;
|
||||
|
||||
public void run() throws Exception {
|
||||
try {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
JSONArray array = wo.query().getResultJSONArray(0);
|
||||
Date now = DateUtil.parse(DateUtil.now());
|
||||
DateTime dateTime = DateUtil.offsetDay(now, -15);
|
||||
String formatDateTime = DateUtil.formatDateTime(dateTime);
|
||||
Query query = new Query().addCriteria(Criteria.where("create_time").lte(formatDateTime));
|
||||
if (array.size() > 0){
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject jsonObject = array.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
mongoTemplate.remove(query,device_code);
|
||||
}
|
||||
System.out.println("设备日志清除成功---------------------");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,6 @@ public class AutoCreateAGVOneInst {
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status("1");
|
||||
acsTask.setTask_type("2");
|
||||
acsTask.setLink_num(link_no);
|
||||
taskserver.update(acsTask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user