代码优化

master
lulicheng 9 months ago
parent 243aeb989f
commit 1435a356de

@ -64,8 +64,4 @@ public class SimulationAnalysisController {
return ResponseDTO.ok(simulationAnalysisService.getBufferNum(process)); return ResponseDTO.ok(simulationAnalysisService.getBufferNum(process));
} }
@GetMapping("/test-socket")
public ResponseDTO testSocket(@RequestParam String param){
return ResponseDTO.ok(simulationService.getPlantData(param));
}
} }

@ -116,5 +116,17 @@ public interface SimulationAnalysisMapper {
*/ */
List<BufferNumZy> getBufferNumZy(@Param("bufferNameList") List<BufferVO> bufferNameList); List<BufferNumZy> getBufferNumZy(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
*
* @param tableId
* @param groupId
* @return
*/
List<FieldCnVO> getFieldInfo(@Param("tableId") Integer tableId,@Param("groupId") Integer groupId); List<FieldCnVO> getFieldInfo(@Param("tableId") Integer tableId,@Param("groupId") Integer groupId);
/**
* 仿
* @return
*/
String getSimEndTime();
} }

@ -5,6 +5,7 @@ import com.ipsplm.entity.simulation.vo.OeeVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO; import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description 仿 * @Description 仿
@ -19,7 +20,7 @@ public interface ISimulationAnalysisService {
* @param flag * @param flag
* @return * @return
*/ */
List<OeeVO> getPlantEquipmentUtilization(Long flag); Map<String,Object> getPlantEquipmentUtilization(Long flag);
/** /**
* *

@ -10,9 +10,7 @@ import com.ipsplm.service.simulation.ISimulationAnalysisService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @Description 仿 * @Description 仿
@ -32,11 +30,15 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
* @return * @return
*/ */
@Override @Override
public List<OeeVO> getPlantEquipmentUtilization(Long flag) { public Map<String,Object> getPlantEquipmentUtilization(Long flag) {
String simEndTime = simulationAnalysisMapper.getSimEndTime();
List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag); List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag);
List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization); List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization);
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(null,1); List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(null,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList); Map<String,Object> result = new HashMap<>();
result.put("simEndTime",simEndTime);
result.put("oeeList",fieldNameToChinese(fieldCnVOList,oeeVOList));
return result;
} }
/** /**

@ -10,8 +10,6 @@ import javax.websocket.OnMessage;
import javax.websocket.OnOpen; import javax.websocket.OnOpen;
import javax.websocket.Session; import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint; import javax.websocket.server.ServerEndpoint;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;

@ -129,6 +129,7 @@
</foreach> </foreach>
from buffernum_zy order by flag desc,record_time limit 48 from buffernum_zy order by flag desc,record_time limit 48
</select> </select>
<!-- 获取字段信息-->
<select id="getFieldInfo" resultType="com.ipsplm.entity.simulation.vo.FieldCnVO"> <select id="getFieldInfo" resultType="com.ipsplm.entity.simulation.vo.FieldCnVO">
select field_code as fieldCode, field_des as fieldName from field_cn select field_code as fieldCode, field_des as fieldName from field_cn
<where> <where>
@ -141,4 +142,8 @@
</where> </where>
; ;
</select> </select>
<!-- 获取仿真结束时间-->
<select id="getSimEndTime" resultType="java.lang.String">
select simtime from pts_message order by simtime desc limit 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save