opt:1.手持功能修改
This commit is contained in:
@@ -18,7 +18,8 @@ public enum TaskStatusEnum {
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
CANCEL("3", "CANCEL", "取消"),
|
||||
FORCED_COMPLETION("4", "", "强制完成"),
|
||||
WAITING_FOR_EXECUTION("4", "", "等待执行中"),
|
||||
FORCED_COMPLETION("5", "", "强制完成"),
|
||||
ERROR("99", "ERROR", "异常");
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,8 +84,8 @@ public class HandServiceImpl implements HandService {
|
||||
String device_name = device.getDevice_name();
|
||||
BigDecimal seq_num = device.getSeq_num();
|
||||
jo.put("device_id", device_id);
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("device_name", device_name);
|
||||
jo.put("value", device_code);
|
||||
jo.put("text", device_name);
|
||||
jo.put("seq_num", seq_num);
|
||||
data.add(jo);
|
||||
}
|
||||
@@ -115,39 +115,39 @@ public class HandServiceImpl implements HandService {
|
||||
String start_device_code2 = "";
|
||||
String next_device_code2 = "";
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
|
||||
String s = start_device_code.substring(start_device_code.length() - 1);
|
||||
if (StrUtil.equals("K", s)) {
|
||||
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "M";
|
||||
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "M";
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}else{
|
||||
throw new BadRequestException("起点设备名称不符");
|
||||
}
|
||||
} else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
|
||||
String s = start_device_code.substring(start_device_code.length() - 1);
|
||||
String n = next_device_code.substring(next_device_code.length() - 1);
|
||||
if (StrUtil.equals("M", s) && StrUtil.equals("M", n)) {
|
||||
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "K";
|
||||
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}else if(StrUtil.equals("S", n) && StrUtil.equals("M", s)){
|
||||
start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "X";
|
||||
next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||
jo.put("start_device_code2", start_device_code2);
|
||||
jo.put("next_device_code2", next_device_code2);
|
||||
jo.put("start_point_code2", start_device_code2);
|
||||
jo.put("next_point_code2", next_device_code2);
|
||||
}else{
|
||||
throw new BadRequestException("起点设备名称不符");
|
||||
}
|
||||
}
|
||||
// if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
|
||||
// String s = start_device_code.substring(start_device_code.length() - 1);
|
||||
// if (StrUtil.equals("K", s)) {
|
||||
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "M";
|
||||
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "M";
|
||||
// jo.put("start_device_code2", start_device_code2);
|
||||
// jo.put("next_device_code2", next_device_code2);
|
||||
// jo.put("start_point_code2", start_device_code2);
|
||||
// jo.put("next_point_code2", next_device_code2);
|
||||
// }else{
|
||||
// throw new BadRequestException("起点设备名称不符");
|
||||
// }
|
||||
// } else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
|
||||
// String s = start_device_code.substring(start_device_code.length() - 1);
|
||||
// String n = next_device_code.substring(next_device_code.length() - 1);
|
||||
// if (StrUtil.equals("M", s) && StrUtil.equals("M", n)) {
|
||||
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "K";
|
||||
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||
// jo.put("start_device_code2", start_device_code2);
|
||||
// jo.put("next_device_code2", next_device_code2);
|
||||
// jo.put("start_point_code2", start_device_code2);
|
||||
// jo.put("next_point_code2", next_device_code2);
|
||||
// }else if(StrUtil.equals("S", n) && StrUtil.equals("M", s)){
|
||||
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "X";
|
||||
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||
// jo.put("start_device_code2", start_device_code2);
|
||||
// jo.put("next_device_code2", next_device_code2);
|
||||
// jo.put("start_point_code2", start_device_code2);
|
||||
// jo.put("next_point_code2", next_device_code2);
|
||||
// }else{
|
||||
// throw new BadRequestException("起点设备名称不符");
|
||||
// }
|
||||
// }
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code2);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code2);
|
||||
if(StrUtil.isAllNotEmpty(start_device_code2,next_device_code2) && ObjectUtil.isAllEmpty(startDevice,nextDevice)){
|
||||
@@ -199,8 +199,8 @@ public class HandServiceImpl implements HandService {
|
||||
String region_code = dict.getValue();
|
||||
String region_name = dict.getLabel();
|
||||
jo.put("region_id", region_id);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("region_name", region_name);
|
||||
jo.put("value", region_code);
|
||||
jo.put("text", region_name);
|
||||
data.add(jo);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
@@ -327,24 +327,30 @@ public class HandServiceImpl implements HandService {
|
||||
String next_point = dto.getNext_devicecode();
|
||||
|
||||
List<Task> list;
|
||||
if (StrUtil.isEmpty(key)&&StrUtil.isEmpty(start_point)&&StrUtil.isEmpty(next_point)){
|
||||
list = taskserver.lambdaQuery()
|
||||
.orderByDesc(Task::getCreate_time)
|
||||
.lt(Task::getTask_status, "2")
|
||||
.list();
|
||||
}else {
|
||||
list = taskserver.lambdaQuery()
|
||||
.like(Task::getStart_device_code, start_point)
|
||||
.like(Task::getNext_device_code, next_point)
|
||||
.lt(Task::getTask_status, "2")
|
||||
.eq(Task::getTask_code, key)
|
||||
.or()
|
||||
.eq(Task::getVehicle_code, key)
|
||||
.or()
|
||||
.eq(Task::getTask_id, key)
|
||||
.orderByDesc(Task::getCreate_time)
|
||||
.list();
|
||||
}
|
||||
list = taskserver.lambdaQuery()
|
||||
.orderByDesc(Task::getCreate_time)
|
||||
.eq(Task::getTask_status, "1")
|
||||
.or()
|
||||
.eq(Task::getTask_status, "4")
|
||||
.list();
|
||||
// if (StrUtil.isEmpty(key)&&StrUtil.isEmpty(start_point)&&StrUtil.isEmpty(next_point)){
|
||||
// list = taskserver.lambdaQuery()
|
||||
// .orderByDesc(Task::getCreate_time)
|
||||
// .lt(Task::getTask_status, "2")
|
||||
// .list();
|
||||
// }else {
|
||||
// list = taskserver.lambdaQuery()
|
||||
// .like(Task::getStart_device_code, start_point)
|
||||
// .like(Task::getNext_device_code, next_point)
|
||||
// .lt(Task::getTask_status, "2")
|
||||
// .eq(Task::getTask_code, key)
|
||||
// .or()
|
||||
// .eq(Task::getVehicle_code, key)
|
||||
// .or()
|
||||
// .eq(Task::getTask_id, key)
|
||||
// .orderByDesc(Task::getCreate_time)
|
||||
// .list();
|
||||
// }
|
||||
// if (CollectionUtil.isEmpty(list)){
|
||||
// throw new BadRequestException("没有指令存在!");
|
||||
// }
|
||||
@@ -435,14 +441,20 @@ public class HandServiceImpl implements HandService {
|
||||
//强制完成
|
||||
Instruction instruction = instructionService.findByTaskid(task_uuid, "instruction_status <2 ");
|
||||
if (instruction!=null){
|
||||
resultJson.put("message", "有指令未完成!");
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
try {
|
||||
instructionService.finish(instruction.getInstruction_id());
|
||||
} catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
resultJson.put("message", "完成任务失败:"+e);
|
||||
resultJson.put("data", data);
|
||||
return resultJson;
|
||||
}
|
||||
}else {
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task_uuid);
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskserver.finish(task_uuid);
|
||||
}
|
||||
TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||
taskIdAndStatusDTO.setTask_id(task_uuid);
|
||||
taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
taskserver.finish(task_uuid);
|
||||
}
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", data);
|
||||
|
||||
Reference in New Issue
Block a user