This commit is contained in:
zds
2022-11-23 16:06:00 +08:00
parent be8d1d4e6b
commit 656161160b
2 changed files with 33 additions and 3 deletions

View File

@@ -531,13 +531,43 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
public JSONObject getTodayTask() {
JSONObject resultJson = new JSONObject();
JSONObject resultData = new JSONObject();
WQLObject EM_BI_DeviceRepairRequest = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "4");
JSONArray resultJSONArray = WQL.getWO("TASK_AUTOWEBSOCKETTSK").addParamMap(map).process().getResultJSONArray(0);
resultData.put("device_group_arr", resultJSONArray);
JSONArray ja = new JSONArray();
for(int i=0;i<resultJSONArray.size();i++){
JSONObject jo = resultJSONArray.getJSONObject(i);
String repair_code = jo.getString("repair_code");
jo.put("needCast","0");
if(repair_code.contains("BXD")){
String id = jo.getString("id");
JSONObject jonow = EM_BI_DeviceRepairRequest.query("request_id='"+id+"'").uniqueResult(0);
if(jonow!=null){
String process_id = jonow.getString("process_id");
String warn_time = jonow.getString("warn_time");
if(StrUtil.isEmpty(process_id)){
if(StrUtil.isEmpty(warn_time)){
jo.put("needCast","1");
}else{
Date warn_date = DateUtil.parse(warn_time);
//毫秒数 = 当前时间-上次播报时间
long ms = DateUtil.betweenMs(DateUtil.date(),warn_date);
// 10*60*1000 10分钟
long min_10 = 10*60*1000;
if(ms >= min_10){
jo.put("needCast","1");
}
}
}
}
}
ja.add(jo);
}
resultData.put("device_group_arr", ja);
resultJson.put("srb", resultData);
resultJson.put("code", "1");

View File

@@ -315,7 +315,7 @@
SELECT
st.request_id AS id,
IF(process_id IS NULL AND IF(warn_time IS NULL,CURDATE(),warn_time)<SUBTIME(NOW(),'0:10:0'),TRUE,FALSE) AS needCast,
false AS needCast,
st.create_time AS input_time,
st.request_code AS repair_code,
class.class_name AS maintenancecycle,