|
|
|
@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.sql.Time;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -269,10 +270,10 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
span2 = span;
|
|
|
|
|
}
|
|
|
|
|
int indexOri = index;
|
|
|
|
|
int indexAdd = indexOri+1;
|
|
|
|
|
int indexAddT = indexAdd+1;
|
|
|
|
|
String string = "--hour"+indexOri+"="+ startHour + "\t" + "--min"+indexOri+"=" + startMin + "\t" + "--preset"+indexOri+"=255 --hour="+(indexAdd)+"=" + endTimeHour + "\t" + "--min"+(indexAdd)+"=" + endTimeMin + "\t"
|
|
|
|
|
+ "--preset"+(indexAdd)+"=255 --hour"+indexAddT+"=" + span1 + "\t" + "--min"+indexAddT+"=" + span2 + "\t" + "--preset"+indexAddT+"=255";
|
|
|
|
|
int indexAdd = indexOri + 1;
|
|
|
|
|
int indexAddT = indexAdd + 1;
|
|
|
|
|
String string = "--hour" + indexOri + "=" + startHour + "\t" + "--min" + indexOri + "=" + startMin + "\t" + "--preset" + indexOri + "=255 --hour=" + (indexAdd) + "=" + endTimeHour + "\t" + "--min" + (indexAdd) + "=" + endTimeMin + "\t"
|
|
|
|
|
+ "--preset" + (indexAdd) + "=255 --hour" + indexAddT + "=" + span1 + "\t" + "--min" + indexAddT + "=" + span2 + "\t" + "--preset" + indexAddT + "=255";
|
|
|
|
|
timestr.append(string);
|
|
|
|
|
index++;
|
|
|
|
|
}
|
|
|
|
@ -280,7 +281,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
ArrayList<GetScheduleRequestIdListModel.RequestBean> requestIdList = new ArrayList<>();
|
|
|
|
|
for (int x = 0; x < terminalsList.size(); x++) {
|
|
|
|
|
ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
|
|
|
|
|
String cmd = Constants.CMD + "schedule --group="+dtoList.size()+"--flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
|
|
|
|
|
String cmd = Constants.CMD + "schedule --group=" + dtoList.size() + "--flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
|
|
|
|
|
timestr.toString();
|
|
|
|
|
ProcessExecUtils.exec(cmd);
|
|
|
|
|
int requestId = Integer.parseInt(Constants.REQUEST_ID.toString());
|
|
|
|
@ -316,11 +317,22 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public ServiceBody<String> checkScheldule(RequestIdListVo vo) {
|
|
|
|
|
public ServiceBody<ScheduleRequestIdListModel> checkScheldule(RequestIdListVo vo) {
|
|
|
|
|
/*
|
|
|
|
|
* 当定时任务或者用户主动查询下发状态时
|
|
|
|
|
* */
|
|
|
|
|
List<Integer> requestidlist = vo.getList();
|
|
|
|
|
ScheduleRequestIdListModel model = new ScheduleRequestIdListModel();
|
|
|
|
|
List<Integer> requestidlist = new ArrayList<>();
|
|
|
|
|
List<RequestIdListVo.RequestBean> list = vo.getList();
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
return Asserts.error("查询数据不能缺少");
|
|
|
|
|
}
|
|
|
|
|
for (RequestIdListVo.RequestBean it : list) {
|
|
|
|
|
requestidlist.add(it.getRequestid());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isEmpty(requestidlist)) {
|
|
|
|
|
return Asserts.error("查询编号列表缺少");
|
|
|
|
|
}
|
|
|
|
|
List<RequestResults> resultsList = requestResultsDao.selectByRequestIdList(requestidlist);
|
|
|
|
|
/*
|
|
|
|
|
* 如果下发成功
|
|
|
|
@ -328,8 +340,31 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
* 2,将装置关联拍照时间正式表改为临时表的对应状态
|
|
|
|
|
* 3,将装置自身detial表插入新数据
|
|
|
|
|
* */
|
|
|
|
|
ArrayList<ScheduleRequestIdListModel.RequestStatusBean> modellist = new ArrayList<>();
|
|
|
|
|
if (CollectionUtil.isEmpty(resultsList)) {
|
|
|
|
|
return Asserts.success("尚未查询到下发数据");
|
|
|
|
|
for (RequestIdListVo.RequestBean it : list) {
|
|
|
|
|
ScheduleRequestIdListModel.RequestStatusBean requestBean = new ScheduleRequestIdListModel.RequestStatusBean();
|
|
|
|
|
requestBean.setRequestid(it.getRequestid());
|
|
|
|
|
requestBean.setChannelid(it.getChannelid());
|
|
|
|
|
requestBean.setTermid(it.getTermid());
|
|
|
|
|
requestBean.setStatus(CommonStatus.DELETE.value());
|
|
|
|
|
modellist.add(requestBean);
|
|
|
|
|
}
|
|
|
|
|
model.setList(modellist);
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
} else {
|
|
|
|
|
for (RequestIdListVo.RequestBean it : list) {
|
|
|
|
|
for (int i = 0; i < resultsList.size(); i++) {
|
|
|
|
|
if (it.getRequestid().intValue() == requestidlist.get(i).intValue()) {
|
|
|
|
|
ScheduleRequestIdListModel.RequestStatusBean requestBean = new ScheduleRequestIdListModel.RequestStatusBean();
|
|
|
|
|
requestBean.setRequestid(it.getRequestid());
|
|
|
|
|
requestBean.setChannelid(it.getChannelid());
|
|
|
|
|
requestBean.setTermid(it.getTermid());
|
|
|
|
|
requestBean.setStatus(CommonStatus.EFFECTIVE.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model.setList(modellist);
|
|
|
|
|
}
|
|
|
|
|
terminalSchedulesTempDao.updateStatusByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value(), new Date());
|
|
|
|
|
|
|
|
|
@ -369,8 +404,13 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
terminalScheduleDetailsDao.deleteByTermidAndChannelIdList(terminalSchedules);
|
|
|
|
|
terminalScheduleDetailsDao.insertList(terminalScheduleDetails, date, date);
|
|
|
|
|
int i = requestResultsDao.updateByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value());//根据requestid将结果表中的状态修改为已下发
|
|
|
|
|
|
|
|
|
|
ScheduleRequestIdListModel.RequestStatusBean requestBean = new ScheduleRequestIdListModel.RequestStatusBean();
|
|
|
|
|
// for (RequestIdListVo.RequestBean it : list) {
|
|
|
|
|
// requestBean.setStatus();
|
|
|
|
|
// }
|
|
|
|
|
if (i != 0) {
|
|
|
|
|
return Asserts.success("下发成功");
|
|
|
|
|
return Asserts.success(model);
|
|
|
|
|
} else {
|
|
|
|
|
return Asserts.error("关联失败");
|
|
|
|
|
}
|
|
|
|
@ -383,7 +423,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
|
|
|
|
|
* 当定时任务或者用户主动查询下发状态时
|
|
|
|
|
* */
|
|
|
|
|
List<Integer> requestidlist = new ArrayList<>();
|
|
|
|
|
List<RequestResults> resultsList = requestResultsDao.selectByTypeAndStatus(scheduletype, clientid,255, null);
|
|
|
|
|
List<RequestResults> resultsList = requestResultsDao.selectByTypeAndStatus(scheduletype, clientid, 255, null);
|
|
|
|
|
/*
|
|
|
|
|
* 如果下发成功
|
|
|
|
|
* 1,将临时表中的数据状态改成1下发成功状态
|
|
|
|
|