| | |
| | | import org.apache.mina.core.service.IoAcceptor; |
| | | import org.apache.mina.core.service.IoHandler; |
| | | import org.apache.mina.core.session.IoSession; |
| | | import org.jeecg.common.api.CommonAPI; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.config.TenantContext; |
| | | import org.jeecg.common.config.mqtoken.UserTokenContext; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.util.JwtUtil; |
| | | import org.jeecg.common.util.RedisUtil; |
| | | import org.jeecg.common.util.SpringContextUtils; |
| | | import org.jeecg.modules.dry.api.JeecgSystemApi; |
| | | import org.jeecg.modules.dry.common.CacheConstants; |
| | | import org.jeecg.modules.dry.entity.*; |
| | | import org.jeecg.modules.dry.service.*; |
| | | import org.jeecg.modules.dry.socket.ServerHandler; |
| | | import org.jeecg.modules.dry.socket.SocketServerConfig; |
| | | import org.jeecg.modules.dry.util.DryUtil; |
| | | import org.jeecg.modules.dry.vo.*; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private IDryProdRecordService prodRecordService; |
| | | |
| | | @Autowired |
| | | private IoAcceptor ioAcceptor; |
| | | private CommonAPI commonAPI; |
| | | |
| | | private String token; |
| | | |
| | | |
| | | |
| | | public String getTemporaryToken() { |
| | | if (token == null) { |
| | | RedisUtil redisUtil = SpringContextUtils.getBean(RedisUtil.class); |
| | | // 模拟登录生成Token |
| | | token = JwtUtil.sign("admin", "b668043e3ea4bc2d"); |
| | | // 设置Token缓存有效时间为 5 分钟 |
| | | redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); |
| | | redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, 5 * 60 * 1000); |
| | | } |
| | | |
| | | return token; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Result<?> realTimeDataHandle(RealTimeDataVo realTimeDataVo) { |
| | | TenantContext.setTenant(realTimeDataVo.getTenantid()+""); |
| | | log.info("实时数据:"+realTimeDataVo.toString()); |
| | | |
| | | |
| | | // 1 查询或创建工单 |
| | | // 1.1 从redis取出工单缓存 |
| | |
| | | orderVo.setState_windbox(realTimeDataVo.getState_windbox()); |
| | | orderVo.setState_valve(realTimeDataVo.getState_valve()); |
| | | orderVo.setOrderStatus(realTimeDataVo.getWorkorder_status()); |
| | | orderVo.setEqp_status(realTimeDataVo.getEqp_status()); |
| | | orderVo.setEqp_state(realTimeDataVo.getEqp_state()); |
| | | orderVo.setWarning(realTimeDataVo.getEqp_warning()); |
| | | orderVo.setFault(realTimeDataVo.getEqp_fault()); |
| | | orderVo.setLevel(realTimeDataVo.getLevel()); |
| | | |
| | | String fault = realTimeDataVo.getFault(); |
| | | // String[] split = fault.split(","); |
| | | // for (String s : split) { |
| | | // |
| | | // } |
| | | |
| | | DryOrderTrendVo trendVo = new DryOrderTrendVo(realTimeDataVo); |
| | | // 2.2 保存工单含水率变化 或 重量变化 |
| | |
| | | |
| | | |
| | | LambdaQueryWrapper<DryEquipment> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | queryWrapper.eq(DryEquipment::getTenantId, realTimeDataVo.getTenantid()); |
| | | queryWrapper.eq(DryEquipment::getEnable, "Y"); |
| | | |