| | |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.WebsocketConst; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.board.vo.EquAndon; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | | import org.jeecg.modules.mdc.entity.AndonOrder; |
| | |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.AndonOrderWebSocketVo; |
| | | import org.jeecg.modules.message.websocket.WebSocket; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | andonOrderWebSocketVo.setPersonResponsible(user.getRealname()); |
| | | andonOrderWebSocketVo.setRepairTime(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setFaultInfo(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setType("open"); |
| | | andonOrderWebSocketVo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(order.getEquipmentId()) ? equipmentIdToProductionIdMap.get(order.getEquipmentId()).getProductionName() : null); |
| | | andonOrderWebSocketVoList.add(andonOrderWebSocketVo); |
| | | } |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<AndonOrderWebSocketVo> untreatedAndonList() { |
| | | List<AndonOrderWebSocketVo> result = new ArrayList<>(); |
| | | List<AndonOrder> andonOrderList = this.baseMapper.untreatedAndonList(); |
| | | if (andonOrderList != null && !andonOrderList.isEmpty()) { |
| | | |
| | | List<String> equipmentIds = andonOrderList.stream().map(AndonOrder::getEquipmentId).collect(Collectors.toList()); |
| | | List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(equipmentIds); |
| | | Map<String, MdcEquProDto> equipmentIdToProductionIdMap = CollectionUtils.isNotEmpty(equipmentList) ? equipmentList.stream().collect(Collectors.toMap(MdcEquProDto::getEquipmentId, comRateDto -> comRateDto)) : new HashMap<>(); |
| | | |
| | | andonOrderList.forEach(andonOrder -> { |
| | | AndonOrderWebSocketVo andonOrderWebSocketVo = new AndonOrderWebSocketVo(); |
| | | andonOrderWebSocketVo.setEquipmentId(andonOrder.getEquipmentId()); |
| | | andonOrderWebSocketVo.setCallPersonnel(userService.getById(andonOrder.getOperator()).getRealname()); |
| | | andonOrderWebSocketVo.setCallTime(DateUtils.format(andonOrder.getOperateTime(), DatePattern.NORM_DATE_PATTERN)); |
| | | andonOrderWebSocketVo.setCallReason(andonOrder.getCallReason()); |
| | | andonOrderWebSocketVo.setAndonType("程序呼叫"); |
| | | andonOrderWebSocketVo.setPersonResponsible(userService.getById(andonOrder.getResponder()).getRealname()); |
| | | andonOrderWebSocketVo.setRepairTime(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setFaultInfo(StringPool.EMPTY); |
| | | andonOrderWebSocketVo.setType("open"); |
| | | andonOrderWebSocketVo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(andonOrder.getEquipmentId()) ? equipmentIdToProductionIdMap.get(andonOrder.getEquipmentId()).getProductionName() : null); |
| | | result.add(andonOrderWebSocketVo); |
| | | |
| | | }); |
| | | } |
| | | return result; |
| | | } |
| | | } |