|
@@ -32,9 +32,7 @@ public class ControlService {
|
|
|
List<Map<String, Object>> serviceInfos = DATA_BASE.query(Config.getCenterConnectionStr(), SERVICEINFO_WHERE_CONTAINERCODE, containerCode);
|
|
|
// 循环启动
|
|
|
|
|
|
- Map<String, List<Map<String, Object>>> results = serviceInfos.stream()
|
|
|
- .map(it -> stop(it.get(SERVICE_ID).toString(), containerCode))
|
|
|
- .collect(Collectors.groupingBy(it -> it.get(CODE).toString()));
|
|
|
+ Map<String, List<Map<String, Object>>> results = serviceInfos.stream().map(it -> stop(it.get(SERVICE_ID).toString(), containerCode)).collect(Collectors.groupingBy(it -> it.get(CODE).toString()));
|
|
|
return UniReturnUtil.success(results);
|
|
|
} catch (Exception e) {
|
|
|
return UniReturnUtil.fail(e);
|
|
@@ -46,9 +44,7 @@ public class ControlService {
|
|
|
// 查询服务类型为主动采集的服务
|
|
|
try {
|
|
|
List<Map<String, Object>> serviceInfos = DATA_BASE.query(Config.getCenterConnectionStr(), SERVICEINFO_WHERE_CONTAINERCODE, containerCode);
|
|
|
- Map<String, List<Map<String, Object>>> results = serviceInfos.stream()
|
|
|
- .map(it -> start(it.get(SERVICE_ID).toString(), containerCode))
|
|
|
- .collect(Collectors.groupingBy(it -> it.get(CODE).toString()));
|
|
|
+ Map<String, List<Map<String, Object>>> results = serviceInfos.stream().map(it -> start(it.get(SERVICE_ID).toString(), containerCode)).collect(Collectors.groupingBy(it -> it.get(CODE).toString()));
|
|
|
return UniReturnUtil.success(results);
|
|
|
} catch (Exception e) {
|
|
|
return UniReturnUtil.fail(e);
|
|
@@ -101,8 +97,12 @@ public class ControlService {
|
|
|
|
|
|
boolean isCancel = Objects.equals(cancel.get(CODE), "0");
|
|
|
try {
|
|
|
- if (isCancel)
|
|
|
+ if (isCancel) {
|
|
|
+ DataBase.columns.clear();
|
|
|
+ DataBase.cacheDatas.clear();
|
|
|
+ DataBase.cacheConfigList.clear();
|
|
|
updateServiceState(serviceId, containerCode, "0");
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
return UniReturnUtil.fail(e);
|
|
|
}
|
|
@@ -120,26 +120,17 @@ public class ControlService {
|
|
|
result = DATA_BASE.query(Config.getCenterConnectionStr(), "select containerid from container where containercode=?", containerCode);
|
|
|
Object containerid = result.isEmpty() ? null : result.get(0).get("containerid");
|
|
|
|
|
|
- DATA_BASE.update(Config.getCenterConnectionStr(), "insert into servicestate(serviceid,starttime,containercode,runstate,workpath,servicename,containerid) values (?,?,?,'1',?,?,?)",
|
|
|
- serviceId,
|
|
|
- DataFormatUtil.toString(LocalDateTime.now()),
|
|
|
- containerCode,
|
|
|
- new File(".").getAbsolutePath(), servicename, containerid);
|
|
|
+ DATA_BASE.update(Config.getCenterConnectionStr(), "insert into servicestate(serviceid,starttime,containercode,runstate,workpath,servicename,containerid) values (?,?,?,'1',?,?,?)", serviceId, DataFormatUtil.toString(LocalDateTime.now()), containerCode, new File(".").getAbsolutePath(), servicename, containerid);
|
|
|
} else {
|
|
|
String serviceStateId = mapList.get(0).get("servicestateid").toString();
|
|
|
- DATA_BASE.update(Config.getCenterConnectionStr(), "update servicestate set starttime=?,runstate='1',workpath = ? where servicestateid = ? and containercode =?",
|
|
|
- DataFormatUtil.toString(LocalDateTime.now()),
|
|
|
- new File(".").getAbsolutePath(),
|
|
|
- serviceStateId, containerCode);
|
|
|
+ DATA_BASE.update(Config.getCenterConnectionStr(), "update servicestate set starttime=?,runstate='1',workpath = ? where servicestateid = ? and containercode =?", DataFormatUtil.toString(LocalDateTime.now()), new File(".").getAbsolutePath(), serviceStateId, containerCode);
|
|
|
}
|
|
|
} else {
|
|
|
List<Map<String, Object>> mapList = DATA_BASE.query(Config.getCenterConnectionStr(), "select servicestateid, runstate from servicestate where stoptime is null and serviceid=? and containercode=? order by servicestateid desc", serviceId, containerCode);
|
|
|
|
|
|
if (!mapList.isEmpty()) {
|
|
|
String serviceStateId = mapList.get(0).get("servicestateid").toString();
|
|
|
- DATA_BASE.update(Config.getCenterConnectionStr(), "update servicestate set stoptime=?,runstate='0' where servicestateid = ? and containercode =?",
|
|
|
- DataFormatUtil.toString(LocalDateTime.now()),
|
|
|
- serviceStateId, containerCode);
|
|
|
+ DATA_BASE.update(Config.getCenterConnectionStr(), "update servicestate set stoptime=?,runstate='0' where servicestateid = ? and containercode =?", DataFormatUtil.toString(LocalDateTime.now()), serviceStateId, containerCode);
|
|
|
}
|
|
|
}
|
|
|
}
|