| | |
| | | import com.core.common.R; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.enums.CommandStatusType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CommandPackage; |
| | |
| | | return R.error("指令不存在"); |
| | | } |
| | | |
| | | commandInfo.setCommandStatus(2);//执行状态 |
| | | commandInfo.setCommandStatus(CommandStatusType.EXECUTE.id);//执行状态 |
| | | commandInfo.setExecuteTime(new Date()); |
| | | if (commandInfoService.updateById(commandInfo)) { |
| | | //将指令进行投递 |
| | |
| | | switch (type) { |
| | | case Crn: |
| | | CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | MessageQueue.offer(type, crnCommand.getCrnNo(), new Task(2, crnCommand)); |
| | | MessageQueue.offer(type, crnCommand.getCrnNo(), new Task(5, crnCommand)); |
| | | break; |
| | | case Devp: |
| | | StaProtocol staProtocol = JSON.parseObject(commandPackage.getCommand().toString(), StaProtocol.class); |
| | | MessageQueue.offer(type, staProtocol.getSiteId(), new Task(2, staProtocol)); |
| | | MessageQueue.offer(type, staProtocol.getSiteId(), new Task(3, staProtocol)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | return R.error("指令不存在"); |
| | | } |
| | | |
| | | commandInfo.setCommandStatus(3);//完成状态 |
| | | commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//完成状态 |
| | | commandInfo.setCompleteTime(new Date()); |
| | | commandInfoService.updateById(commandInfo); |
| | | return R.ok(); |