package com.gzlh.api; import cn.hutool.core.thread.ThreadUtil; import com.gzlh.bus.SysConfig; import com.gzlh.config.ModuleEnum; import com.gzlh.bus.EventBus; import com.gzlh.config.SystemObject; import com.gzlh.config.dto.SerialSetting; import com.gzlh.device.electron.job.ElectronReadJob; import com.gzlh.device.led.event.LedDefaultEvent; import com.gzlh.device.led.utils.LedOptions; import com.gzlh.utils.ResultJson; import com.gzlh.device.weighbridge.event.WeighbridgeEvent; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController @RequestMapping("open") public class OpenApi { @Resource EventBus eventBus; @RequestMapping("test") public ResultJson test(String msg,String line,String showType,String color){ eventBus.startEvent(ModuleEnum.LED_MODULE.getModuleEn()+"."+ LedDefaultEvent.READ); eventBus.startEvent(ModuleEnum.WEIGHBRIDGE_MODULE.getModuleEn()+"."+ WeighbridgeEvent.READ); System.out.println(); SerialSetting.LedDTO ledDTO= SysConfig.serialSetting.getLed(); LedOptions ledOptions=new LedOptions(); ledOptions.setLine(line).setShowType(showType).setColor(color); SystemObject.ledFactory.handler(ledDTO.getBrand()).sendMsg(msg,ledOptions); return ResultJson.success(); } @RequestMapping("electron") public ResultJson test(String msg){ ElectronReadJob job= new ElectronReadJob("4002FEC0"); ThreadUtil.execute(job); return ResultJson.success(); } }