| | |
| | | package com.zy.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.entity.LocDetl; |
| | | import com.zy.entity.dto.AxisBean; |
| | | import com.zy.entity.dto.WorkChartAxis; |
| | | import com.zy.entity.vo.LocChartPie; |
| | |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.service.LocDetlService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | private ReportQueryMapper reportQueryMapper; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | @GetMapping(value = "/locDetl/pda/statisticalModel") |
| | | public R statisticalModel() { |
| | | EntityWrapper<LocDetl> locDetlEntityWrapper = new EntityWrapper<>(); |
| | | locDetlEntityWrapper.setSqlSelect("model,COUNT(*) as modelCount").groupBy("model"); |
| | | List<Map<String, Object>> selectMap = locDetlService.selectMaps(locDetlEntityWrapper); |
| | | return R.ok(selectMap); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前时间 |
| | |
| | | * 获取其他信息 |
| | | */ |
| | | @GetMapping("/other") |
| | | public R monitorOther(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") Integer sta) { |
| | | public R monitorOther(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") String ledIdString) { |
| | | Integer ledId = 0; |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | for (Integer staNo : led.getStaArr()) { |
| | | if (staNo.equals(sta)) { |
| | | ledId = led.getId(); |
| | | break; |
| | | String[] ledIds = ledIdString.split(","); |
| | | for (String id : ledIds) { |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | for (Integer staNo : led.getStaArr()) { |
| | | if (staNo.equals(Integer.parseInt(id))) { |
| | | ledId = led.getId(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | * 获取其他信息 |
| | | */ |
| | | @GetMapping("/led") |
| | | public R monitorLed(@RequestParam("ledId") Integer ledId) { |
| | | public R monitorLed(@RequestParam("ledId") String ledIdString) { |
| | | String[] ledIds = ledIdString.split(","); |
| | | String ledContent = ""; |
| | | List<LedCommand> commandList = null; |
| | | for (LedSlave slave : slaveProperties.getLed()) { |
| | | if (slave.getStaArr().contains(ledId)) { |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); |
| | | if (null != ledThread) { |
| | | ledContent = ledThread.getStringBuffer().toString(); |
| | | commandList = ledThread.getCommandList(); |
| | | for(String ledId: ledIds) { |
| | | |
| | | for (LedSlave slave : slaveProperties.getLed()) { |
| | | if (slave.getStaArr().contains(Integer.parseInt(ledId))) { |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); |
| | | if (null != ledThread) { |
| | | ledContent = ledThread.getStringBuffer().toString(); |
| | | commandList = ledThread.getCommandList(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok().add(commandList); |
| | | } |
| | | |
| | |
| | | * 异常通知 |
| | | */ |
| | | @GetMapping("/led/error") |
| | | public R monitorLedError(@RequestParam("ledId") Integer ledId) { |
| | | public R monitorLedError(@RequestParam("ledId") String ledIdString) { |
| | | String errorMsg = ""; |
| | | for (LedSlave slave : slaveProperties.getLed()) { |
| | | if (slave.getStaArr().contains(ledId)) { |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); |
| | | if (null != ledThread) { |
| | | errorMsg = ledThread.getErrorMsg().toString(); |
| | | String[] ledIds = ledIdString.split(","); |
| | | for(String ledId: ledIds) { |
| | | for (LedSlave slave : slaveProperties.getLed()) { |
| | | if (slave.getStaArr().contains(Integer.parseInt(ledId))) { |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); |
| | | if (null != ledThread) { |
| | | errorMsg = ledThread.getErrorMsg().toString(); |
| | | } |
| | | } |
| | | } |
| | | } |