| | |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.LedCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.LedThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | public class MonitorController { |
| | | |
| | | private static final String[] WEEK = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"}; |
| | | |
| | | private String programMsg; |
| | | |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | |
| | | return R.ok().add(errorMsg); |
| | | } |
| | | |
| | | /** |
| | | * 节目 |
| | | */ |
| | | @GetMapping("/led/program") |
| | | public R monitorProgramShow(@RequestParam("ledId") Integer ledId) { |
| | | String program = ""; |
| | | for (LedSlave slave : slaveProperties.getLed()) { |
| | | if (slave.getStaArr().contains(ledId)) { |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); |
| | | if (null != ledThread) { |
| | | program = ledThread.getProgram().toString(); |
| | | } |
| | | } |
| | | } |
| | | return R.ok().add(program); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 显示节目 |
| | | */ |
| | | @RequestMapping("/led/add/program") |
| | | public R addProgram(Integer ledId, String msg) { |
| | | MessageQueue.offer(SlaveType.Led, ledId, new Task(5, msg)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 移除节目 |
| | | */ |
| | | @RequestMapping("/led/remove/program") |
| | | public R removeProgram(Integer ledId, String msg) { |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |