fix
This commit is contained in:
@@ -111,7 +111,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InstructionDto> queryAll(InstructionQueryParam query){
|
||||
public List<InstructionDto> queryAll(InstructionQueryParam query) {
|
||||
return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateById(InstructionDto resources){
|
||||
public int updateById(InstructionDto resources) {
|
||||
InstructionMybatis entity = ConvertUtil.convert(resources, InstructionMybatis.class);
|
||||
int ret = instructionMapper.updateById(entity);
|
||||
// delCaches(resources.id);
|
||||
@@ -137,14 +137,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int removeByIds(Set<String> ids){
|
||||
public int removeByIds(Set<String> ids) {
|
||||
// delCaches(ids);
|
||||
return instructionMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int removeById(String id){
|
||||
public int removeById(String id) {
|
||||
Set<String> set = new HashSet<>(1);
|
||||
set.add(id);
|
||||
return this.removeByIds(set);
|
||||
@@ -176,7 +176,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.eq(InstructionMybatis::getIs_delete, "0")
|
||||
.list();
|
||||
// List list = this.queryAll("instruction_status <2 and is_delete =0");
|
||||
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list,Instruction.class));
|
||||
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list, Instruction.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,20 +192,20 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
IPage<InstructionMybatis> queryPage = PageUtil.toMybatisPage(page);
|
||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(InstructionMybatis::getIs_delete,0);
|
||||
wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code));
|
||||
wrapper.like(StringUtils.isNotBlank(vehicle_code),InstructionMybatis::getVehicle_code,vehicle_code);
|
||||
wrapper.eq(StringUtils.isNotBlank(material_type),InstructionMybatis::getMaterial,material_type);
|
||||
wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status);
|
||||
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
||||
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
||||
wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code));
|
||||
wrapper.like(StringUtils.isNotBlank(vehicle_code), InstructionMybatis::getVehicle_code, vehicle_code);
|
||||
wrapper.eq(StringUtils.isNotBlank(material_type), InstructionMybatis::getMaterial, material_type);
|
||||
wrapper.eq(StringUtils.isNotBlank(status), InstructionMybatis::getInstruction_status, status);
|
||||
wrapper.and(StringUtils.isNotBlank(point_code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code));
|
||||
wrapper.eq(StringUtils.isNotBlank(instruction_type), InstructionMybatis::getInstruction_type, instruction_type);
|
||||
if (!StrUtil.isEmpty(is_over)) {
|
||||
if (StrUtil.equals(is_over,"1")){
|
||||
wrapper.ge(InstructionMybatis::getInstruction_status,2);
|
||||
}else{
|
||||
wrapper.lt(InstructionMybatis::getInstruction_status,2);
|
||||
if (StrUtil.equals(is_over, "1")) {
|
||||
wrapper.ge(InstructionMybatis::getInstruction_status, 2);
|
||||
} else {
|
||||
wrapper.lt(InstructionMybatis::getInstruction_status, 2);
|
||||
}
|
||||
}
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||
return json;
|
||||
}
|
||||
@@ -224,32 +224,32 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
||||
if (!StrUtil.isEmpty(code)) {
|
||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code));
|
||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code));
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
wrapper.like(InstructionMybatis::getVehicle_code,vehicle_code);
|
||||
wrapper.like(InstructionMybatis::getVehicle_code, vehicle_code);
|
||||
}
|
||||
if (!StrUtil.isEmpty(material_type)) {
|
||||
wrapper.eq(InstructionMybatis::getMaterial,material_type);
|
||||
wrapper.eq(InstructionMybatis::getMaterial, material_type);
|
||||
}
|
||||
if (!StrUtil.isEmpty(status)) {
|
||||
wrapper.eq(InstructionMybatis::getInstruction_status,status);
|
||||
wrapper.eq(InstructionMybatis::getInstruction_status, status);
|
||||
}
|
||||
if (!StrUtil.isEmpty(point_code)) {
|
||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
||||
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code));
|
||||
}
|
||||
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||
wrapper.between(InstructionMybatis::getCreate_time,create_time,end_time);
|
||||
wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time);
|
||||
}
|
||||
wrapper.orderByDesc(InstructionMybatis::getCreate_time);
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getByTaskId(String id) {
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getTask_id, id)
|
||||
.list();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -275,9 +275,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> queryAll(Map whereJson) {
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.list();
|
||||
return ConvertUtil.convertList(insList,Instruction.class);
|
||||
return ConvertUtil.convertList(insList, Instruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,10 +285,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||
// List<Instruction> list = arr.toJavaList(Instruction.class);
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, "2")
|
||||
.list();
|
||||
return ConvertUtil.convertList(insList,Instruction.class);
|
||||
return ConvertUtil.convertList(insList, Instruction.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -302,13 +302,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getInstruction_code, code)
|
||||
.one();
|
||||
if(ObjectUtil.isEmpty(ins)){
|
||||
if (ObjectUtil.isEmpty(ins)) {
|
||||
return null;
|
||||
}
|
||||
return ConvertUtil.convert(ins,Instruction.class);
|
||||
return ConvertUtil.convert(ins, Instruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,13 +317,13 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getTask_code, code)
|
||||
.one();
|
||||
if(ObjectUtil.isEmpty(ins)){
|
||||
if (ObjectUtil.isEmpty(ins)) {
|
||||
return null;
|
||||
}
|
||||
return ConvertUtil.convert(ins,Instruction.class);
|
||||
return ConvertUtil.convert(ins, Instruction.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,11 +352,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// return null;
|
||||
|
||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InstructionMybatis::getTask_id,id);
|
||||
wrapper.apply(StringUtils.isNotBlank(wherecaluse),wherecaluse);
|
||||
wrapper.eq(InstructionMybatis::getTask_id, id);
|
||||
wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse);
|
||||
InstructionMybatis ins = instructionMapper.selectOne(wrapper);
|
||||
if (ObjectUtil.isNotEmpty(ins)) {
|
||||
return ConvertUtil.convert(ins,Instruction.class);
|
||||
return ConvertUtil.convert(ins, Instruction.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -412,8 +412,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
}
|
||||
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setStart_parent_code(task.getStart_parent_code());
|
||||
@@ -452,7 +452,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
}else if(StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
} else if (StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
|
||||
if (!ObjectUtils.isEmpty(result)) {
|
||||
@@ -569,7 +569,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
}else if(StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
} else if (StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
|
||||
if (!ObjectUtils.isEmpty(result)) {
|
||||
@@ -630,11 +630,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// + dto.getTask_id()
|
||||
// + "'")
|
||||
// .uniqueResult(0);
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, 3)
|
||||
.eq(InstructionMybatis::getNext_point_code,dto.getNext_point_code())
|
||||
.eq(InstructionMybatis::getStart_point_code,dto.getStart_point_code())
|
||||
.eq(InstructionMybatis::getTask_id,dto.getTask_id())
|
||||
.eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code())
|
||||
.eq(InstructionMybatis::getStart_point_code, dto.getStart_point_code())
|
||||
.eq(InstructionMybatis::getTask_id, dto.getTask_id())
|
||||
.one();
|
||||
|
||||
|
||||
@@ -829,7 +829,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id,insttaskid)
|
||||
.eq(Task::getTask_id, insttaskid)
|
||||
.one();
|
||||
// =0 则不用再次请求
|
||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||
@@ -864,7 +864,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id,insttaskid)
|
||||
.eq(Task::getTask_id, insttaskid)
|
||||
.one();
|
||||
// =0 则不用再次请求
|
||||
if (StrUtil.equals(task.getRequest_again(), "0")) {
|
||||
@@ -918,7 +918,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
||||
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
||||
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id,dto.getTask_id())
|
||||
.eq(Task::getTask_id, dto.getTask_id())
|
||||
.one();
|
||||
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||
@@ -1021,10 +1021,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// } else {
|
||||
flag = true;
|
||||
// }
|
||||
}else {
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
if (StrUtil.equals(entity.getInstruction_type(), "4")||
|
||||
if (StrUtil.equals(entity.getInstruction_type(), "4") ||
|
||||
StrUtil.equals(entity.getInstruction_type(), "3")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
zheDaAgvService.deleteZDAgvInst(entity.getInstruction_code());
|
||||
@@ -1142,6 +1142,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Override
|
||||
public void cancelNOSendAgv(String id) throws Exception {
|
||||
// flag= true时取消指令
|
||||
boolean flag = false;
|
||||
InstructionDto entity = this.findById(id);
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
@@ -1150,16 +1151,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.isEmpty(entity.getRoute_plan_code())) {
|
||||
entity.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("3");
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@@ -1195,8 +1194,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
log.debug("地址对应设备未找到");
|
||||
return;
|
||||
}
|
||||
|
||||
removeByCodeFromCache(entity.getInstruction_code());
|
||||
taskService.cancel(entity.getTask_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1533,7 +1532,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public void init(String id) {
|
||||
InstructionDto inst = this.findById(id);
|
||||
InstructionDto inst = this.findById(id);
|
||||
if (inst == null) {
|
||||
throw new BadRequestException("指令不存在或已删除");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user