|  |  |  | @ -1,16 +1,19 @@ | 
		
	
		
			
				|  |  |  |  | package com.ipsplm.service.simulation.impl; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import com.alibaba.fastjson.JSON; | 
		
	
		
			
				|  |  |  |  | import com.alibaba.fastjson.JSONObject; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.dao.simulation.SimulationAnalysisMapper; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.entity.simulation.*; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.entity.simulation.vo.BufferNumVO; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.entity.simulation.vo.BufferVO; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.entity.simulation.vo.OeeVO; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO; | 
		
	
		
			
				|  |  |  |  | import com.ipsplm.service.simulation.ISimulationAnalysisService; | 
		
	
		
			
				|  |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
		
	
		
			
				|  |  |  |  | import org.springframework.stereotype.Service; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import java.util.Collections; | 
		
	
		
			
				|  |  |  |  | import java.util.ArrayList; | 
		
	
		
			
				|  |  |  |  | import java.util.List; | 
		
	
		
			
				|  |  |  |  | import java.util.Map; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | /** | 
		
	
		
			
				|  |  |  |  |  * @Description 仿真分析实现类 | 
		
	
	
		
			
				
					|  |  |  | @ -30,68 +33,10 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public PlantEquipmentUtilizationVO getPlantEquipmentUtilization(Long flag) { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getPlantEquipmentUtilization(flag); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取不锈钢OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeBxg> getOeeBxg() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeBxg(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取大径线OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeDj> getOeeDj() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeDj(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取小二线OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeXe> getOeeXe() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeXe(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取小一线OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeXy> getOeeXy() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeXy(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取中二线OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeZe> getOeeZe() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeZe(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取中一线OEE | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public List<OeeZy> getOeeZy() { | 
		
	
		
			
				|  |  |  |  |         return simulationAnalysisMapper.getOeeZy(); | 
		
	
		
			
				|  |  |  |  |     public List<OeeVO> getPlantEquipmentUtilization(Long flag) { | 
		
	
		
			
				|  |  |  |  |         List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag); | 
		
	
		
			
				|  |  |  |  |         List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization); | 
		
	
		
			
				|  |  |  |  |         return oeeVOList; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
	
		
			
				
					|  |  |  | @ -107,6 +52,7 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取缓存数量时间 | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @param process | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
	
		
			
				
					|  |  |  | @ -144,4 +90,75 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         return null; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取OEE数据 | 
		
	
		
			
				|  |  |  |  |      * | 
		
	
		
			
				|  |  |  |  |      * @param tableCode | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     @Override | 
		
	
		
			
				|  |  |  |  |     public Object getOee(String tableCode) { | 
		
	
		
			
				|  |  |  |  |         switch (tableCode) { | 
		
	
		
			
				|  |  |  |  |             case "oee_bxg": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeBxg> oeeBxgList = simulationAnalysisMapper.getOeeBxg(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeBxgList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             case "oee_dj": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeDj> oeeDjList = simulationAnalysisMapper.getOeeDj(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeDjList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             case "oee_xe": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeXe> oeeXeList = simulationAnalysisMapper.getOeeXe(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeXeList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             case "oee_xy": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeXy> oeeXyList = simulationAnalysisMapper.getOeeXy(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeXyList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             case "oee_ze": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeZe> oeeZeList = simulationAnalysisMapper.getOeeZe(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeZeList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             case "oee_zy": { | 
		
	
		
			
				|  |  |  |  |                 List<OeeZy> oeeZyList = simulationAnalysisMapper.getOeeZy(); | 
		
	
		
			
				|  |  |  |  |                 List<OeeVO> oeeVOList = beanToKeyValue(oeeZyList); | 
		
	
		
			
				|  |  |  |  |                 return oeeVOList; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             default: | 
		
	
		
			
				|  |  |  |  |                 break; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         return null; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     /** | 
		
	
		
			
				|  |  |  |  |      * 获取对象的属性名和属性值并存入OeeVO对象的集合 | 
		
	
		
			
				|  |  |  |  |      * @param oeeList | 
		
	
		
			
				|  |  |  |  |      * @return | 
		
	
		
			
				|  |  |  |  |      */ | 
		
	
		
			
				|  |  |  |  |     public List<OeeVO> beanToKeyValue(List oeeList) { | 
		
	
		
			
				|  |  |  |  |         List<OeeVO> oeeVOList = new ArrayList<>(); | 
		
	
		
			
				|  |  |  |  |         for (Object object : oeeList) { | 
		
	
		
			
				|  |  |  |  |             JSONObject jsonObject = (JSONObject) JSON.toJSON(object); | 
		
	
		
			
				|  |  |  |  |             Object status = jsonObject.get("status"); | 
		
	
		
			
				|  |  |  |  |             for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { | 
		
	
		
			
				|  |  |  |  |                 OeeVO oeeVO = new OeeVO(); | 
		
	
		
			
				|  |  |  |  |                 Object value = entry.getValue(); | 
		
	
		
			
				|  |  |  |  |                 String key = entry.getKey(); | 
		
	
		
			
				|  |  |  |  |                 if ("flag".equals(key) || "id".equals(key) || "status".equals(key)) { | 
		
	
		
			
				|  |  |  |  |                     continue; | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |                 oeeVO.setName(key); | 
		
	
		
			
				|  |  |  |  |                 oeeVO.setValue(value); | 
		
	
		
			
				|  |  |  |  |                 oeeVO.setStatus(status); | 
		
	
		
			
				|  |  |  |  |                 oeeVOList.add(oeeVO); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         return oeeVOList; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |