| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.sy.domain.ArdTankLock; |
| | | import com.ruoyi.sy.gps31.PushClientImplSerialPort; |
| | | import com.ruoyi.sy.param.ArdSyCarParam; |
| | | import com.ruoyi.sy.service.IArdTankAbnormalParkAlarmService; |
| | | import com.ruoyi.sy.service.impl.ArdTankLockServiceImpl; |
| | | import com.ruoyi.sy.vo.ArdSyCarVo; |
| | | import com.ruoyi.sy.domain.ArdSyUser; |
| | | import com.ruoyi.sy.gps31.PositionContainer; |
| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.impl.SysConfigServiceImpl; |
| | | import com.ruoyi.utils.forest.SYClient; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Value("${syCar.password}") |
| | | private String password; |
| | | |
| | | private Timer lockStateTimer; |
| | | |
| | | @PostConstruct |
| | | public void init(){ |
| | | ardSyCarController = this; |
| | |
| | | PushClientImplAlarm pushClientImplAlarm = new PushClientImplAlarm(ip,userId,password); |
| | | Thread pushClientImplAlarmThread = new Thread(pushClientImplAlarm); |
| | | pushClientImplAlarmThread.start(); |
| | | |
| | | //串口线程 |
| | | PushClientImplSerialPort pushClientImplSerialPort = new PushClientImplSerialPort(ip,userId,password); |
| | | Thread pushClientImplSerialPortThread = new Thread(pushClientImplSerialPort); |
| | | pushClientImplSerialPortThread.start(); |
| | | |
| | | //删除结束时间为null的记录 |
| | | int result = ardTankAbnormalParkAlarmService.deleteArdTankAbnormalParkAlarmByEndTime(); |
| | | |
| | | this.lockStateTimer = new Timer();//定时获取各个锁的状态 |
| | | TimerTask lockStateTask =new TimerTask(){ |
| | | @Override |
| | | public void run(){ |
| | | Thread thread = new Thread(){ |
| | | @Override |
| | | public void run() { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey("syCarPT"); |
| | | List<SysConfig> sysConfigResult = ((SysConfigServiceImpl) SpringUtils.getBean("sysConfigServiceImpl")).selectConfigList(config); |
| | | String syURL = ""; |
| | | |
| | | if(sysConfigResult.size() == 0){ |
| | | return; |
| | | }else{ |
| | | syURL = sysConfigResult.get(0).getConfigValue(); |
| | | } |
| | | String passwordMd5 = DigestUtils.md5Hex(password); |
| | | Map<String, Object> LogInResult = sYClient.logIn(syURL, passwordMd5, userId); |
| | | String sessionId = (String) LogInResult.get("sessionId"); |
| | | |
| | | String finalSyURL = syURL; |
| | | |
| | | List<ArdTankLock> result = ((ArdTankLockServiceImpl)SpringUtils.getBean("ardTankLockServiceImpl")).getArdTankLockAll();//查询全部电磁锁 |
| | | for(ArdTankLock ardTankLock : result){ |
| | | Thread LockThread = new Thread(finalSyURL){ |
| | | @Override |
| | | public void run() { |
| | | String lockNumHead = ardTankLock.getLockNum().substring(0,2); |
| | | String lockNumTail = ardTankLock.getLockNum().substring(2,4); |
| | | //计算校验 |
| | | String checkNum = Integer.toHexString(Integer.parseInt(lockNumHead, 16) + Integer.parseInt(lockNumTail, 16) + Integer.parseInt("01", 16)); |
| | | |
| | | if(checkNum.length() == 1){ |
| | | checkNum = "0" + checkNum; |
| | | }else if(checkNum.length() > 2){ |
| | | checkNum = checkNum.substring(checkNum.length() - 2,checkNum.length()); |
| | | } |
| | | |
| | | String paramsStr = "%7B%22type%22%3A%22ff%22%2C%22dataCnt%22%3A%22" + ardTankLock.getLockNum() + "01" + checkNum + "%22%7D"; |
| | | |
| | | sYClient.sendCmd(finalSyURL,userId,ardTankLock.getCarId(),199,"DataDownTransfer", paramsStr,sessionId); |
| | | } |
| | | }; |
| | | LockThread.start(); |
| | | } |
| | | } |
| | | }; |
| | | thread.start(); |
| | | } |
| | | }; |
| | | //lockStateTimer.scheduleAtFixedRate(lockStateTask,date,1000); |
| | | } |
| | | |
| | | /** |