代码优化

master
lulicheng 9 months ago
parent 3aa4196399
commit 243aeb989f

@ -55,6 +55,11 @@
<version>5.7.22</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

@ -0,0 +1,19 @@
package com.ipsplm.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
@EnableWebSocket
public class WebSocketConfig {
/**
* ServerEndpointExporter
* bean使@ServerEndpointWebsocket endpoint
*/
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

@ -3,6 +3,7 @@ package com.ipsplm.controller.simulation;
import com.ipsplm.entity.dto.ResponseDTO;
import com.ipsplm.service.simulation.ISimulationAnalysisService;
import com.ipsplm.service.simulation.ISimulationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -20,6 +21,9 @@ public class SimulationAnalysisController {
@Autowired
private ISimulationAnalysisService simulationAnalysisService;
@Autowired
private ISimulationService simulationService;
/**
*
* @param flag
@ -59,4 +63,9 @@ public class SimulationAnalysisController {
public ResponseDTO getBufferNum(@RequestParam String process){
return ResponseDTO.ok(simulationAnalysisService.getBufferNum(process));
}
@GetMapping("/test-socket")
public ResponseDTO testSocket(@RequestParam String param){
return ResponseDTO.ok(simulationService.getPlantData(param));
}
}

@ -3,6 +3,7 @@ package com.ipsplm.dao.simulation;
import com.ipsplm.entity.simulation.*;
import com.ipsplm.entity.simulation.vo.BufferVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import com.ipsplm.entity.simulation.vo.FieldCnVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -85,33 +86,35 @@ public interface SimulationAnalysisMapper {
* @param bufferNameList
* @return
*/
List<BufferNumDj> getBufferNumDj(List<BufferVO> bufferNameList);
List<BufferNumDj> getBufferNumDj(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
* 线
* @param bufferNameList
* @return
*/
List<BufferNumXe> getBufferNumXe(List<BufferVO> bufferNameList);
List<BufferNumXe> getBufferNumXe(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
* 线
* @param bufferNameList
* @return
*/
List<BufferNumXy> getBufferNumXy(List<BufferVO> bufferNameList);
List<BufferNumXy> getBufferNumXy(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
* 线
* @param bufferNameList
* @return
*/
List<BufferNumZe> getBufferNumZe(List<BufferVO> bufferNameList);
List<BufferNumZe> getBufferNumZe(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
* 线
* @param bufferNameList
* @return
*/
List<BufferNumZy> getBufferNumZy(List<BufferVO> bufferNameList);
List<BufferNumZy> getBufferNumZy(@Param("bufferNameList") List<BufferVO> bufferNameList);
List<FieldCnVO> getFieldInfo(@Param("tableId") Integer tableId,@Param("groupId") Integer groupId);
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,137 +27,164 @@ public class BufferNumBxg implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgBufferL;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgWgjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgWgjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZgqdQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZgqdH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgXzlQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgXzlH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgWthjjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgWthhjH;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZppt1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZppt1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZppt2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgZppt2H;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgHjgw3H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgYcwjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgYcwjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bxgSsQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsH;
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,162 +27,194 @@ public class BufferNumDj implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djBuffer1L;
/**
* 线线2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djBuffer2L;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZgqdQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZgqdH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djXzlQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djXzlH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djWthjjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djWthhjH;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djZppt4H;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw4H;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw5Q;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djHjgw5H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djYcwjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djYcwjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String djSsQ;
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,197 +27,236 @@ public class BufferNumXe implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeBufferL;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWgj1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWgj1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWgj2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWgj2H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZgqdQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZgqdH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeXzlQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeXzlH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWthjjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeWthhjH;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt4H;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt5Q;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeZppt5H;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw4H;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw5Q;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeHjgw5H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeYcwjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeYcwjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xeSsQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String jjgQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String jjgH;
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,137 +27,164 @@ public class BufferNumXy implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyBufferL;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyWgjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyWgjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZgqdQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZgqdH;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyZppt4H;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyHjgw4H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyYcwjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xyYcwjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String xySsQ;
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,202 +27,242 @@ public class BufferNumZe implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线1
*/
private String zeBuffer1L;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeBuffer1L;
/**
* 线线2
*/
private String zeBuffer2L;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeBuffer2L;
/**
*
*/
private String zeWgjQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeWgjQ;
/**
*
*/
private String zeWgjH;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeWgjH;
/**
*
*/
private String zeZgqdQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZgqdQ;
/**
*
*/
private String zeZgqdH;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZgqdH;
/**
* 1
*/
private String zeXzl1Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeXzl1Q;
/**
* 1
*/
private String zeXzl1H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeXzl1H;
/**
* 2
*/
private String zeXzl2Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeXzl2Q;
/**
* 2
*/
private String zeXzl2H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeXzl2H;
/**
*
*/
private String zeWthjjQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeWthjjQ;
/**
*
*/
private String zeWthhjH;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeWthhjH;
/**
* 1
*/
private String zeZppt1Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt1Q;
/**
* 1
*/
private String zeZppt1H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt1H;
/**
* 2
*/
private String zeZppt2Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt2Q;
/**
* 2
*/
private String zeZppt2H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt2H;
/**
* 3
*/
private String zeZppt3Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt3Q;
/**
* 3
*/
private String zeZppt3H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeZppt3H;
/**
* 1
*/
private String zeHjgw1Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw1Q;
/**
* 1
*/
private String zeHjgw1H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw1H;
/**
* 2
*/
private String zeHjgw2Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw2Q;
/**
* 2
*/
private String zeHjgw2H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw2H;
/**
* 3
*/
private String zeHjgw3Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw3Q;
/**
* 3
*/
private String zeHjgw3H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw3H;
/**
* 4
*/
private String zeHjgw4Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw4Q;
/**
* 4
*/
private String zeHjgw4H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw4H;
/**
* 5
*/
private String zeHjgw5Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw5Q;
/**
* 5
*/
private String zeHjgw5H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw5H;
/**
* 6
*/
private String zeHjgw6Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw6Q;
/**
* 6
*/
private String zeHjgw6H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw6H;
/**
* 7
*/
private String zeHjgw7Q;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw7Q;
/**
* 7
*/
private String zeHjgw7H;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeHjgw7H;
/**
*
*/
private String zeYcwjQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeYcwjQ;
/**
*
*/
private String zeYcwjH;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeYcwjH;
/**
*
*/
private String zeSsQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zeSsQ;
/**
*
*/
private String tsQ;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsQ;
/**
*
*/
private String tsH;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsH;
}

@ -3,10 +3,12 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 线
@ -25,42 +27,50 @@ public class BufferNumZy implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Long flag;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String recordTime;
/**
* 线线1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyBuffer1L;
/**
* 线线2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyBuffer2L;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyWgj1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyWgj1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyWgj2Q;
/**
@ -71,176 +81,211 @@ public class BufferNumZy implements Serializable {
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZgqdQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZgqdH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyXzlQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyXzlH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyWthjjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyWthhjH;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt4H;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt5Q;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyZppt5H;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw1Q;
/**
* 1
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw1H;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw2Q;
/**
* 2
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw2H;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw3Q;
/**
* 3
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw3H;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw4Q;
/**
* 4
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw4H;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw5Q;
/**
* 5
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw5H;
/**
* 6
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw6Q;
/**
* 6
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw6H;
/**
* 7
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw7Q;
/**
* 7
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyHjgw7H;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyYcwjQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zyYcwjH;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String zySsQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsQ;
/**
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String tsH;
}

@ -0,0 +1,13 @@
package com.ipsplm.entity.simulation.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class BufferNumDTO implements Serializable {
//y轴Buffer数量
private String bufferNum;
//缓冲描述
private String bufferName;
}

@ -1,14 +1,14 @@
package com.ipsplm.entity.simulation.vo;
import com.ipsplm.entity.simulation.dto.BufferNumDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class BufferNumVO implements Serializable {
//x轴时间
private String xTime;
//y轴Buffer数量
private String bufferNum;
//缓冲描述
private String bufferName;
private String recordTime;
private List<BufferNumDTO> bufferNumVOList;
}

@ -0,0 +1,12 @@
package com.ipsplm.entity.simulation.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class FieldCnVO implements Serializable {
private String fieldCode;
private String fieldName;
}

@ -0,0 +1,12 @@
package com.ipsplm.service.simulation;
/**
* @Description 仿Service
* @Author FanDongqiang
* @Date 2023/3/15 16:23
* @Version 1.0
*/
public interface ISimulationService {
String getPlantData(Object param);
}

@ -4,9 +4,8 @@ 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.BufferVO;
import com.ipsplm.entity.simulation.vo.OeeVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import com.ipsplm.entity.simulation.dto.BufferNumDTO;
import com.ipsplm.entity.simulation.vo.*;
import com.ipsplm.service.simulation.ISimulationAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,7 +35,8 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
public List<OeeVO> getPlantEquipmentUtilization(Long flag) {
List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag);
List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(null,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
/**
@ -63,27 +63,33 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
switch (tableCode) {
case "buffernum_bxg": {
List<BufferNumBxg> bufferNumBxgList = simulationAnalysisMapper.getBufferNumBxg(bufferNameList);
return bufferNumBxgList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(1,2);
return beanToKeyValue(bufferNumBxgList,fieldCnVOList);
}
case "buffernum_dj": {
List<BufferNumDj> bufferNumDjList = simulationAnalysisMapper.getBufferNumDj(bufferNameList);
return bufferNumDjList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(2,2);
return beanToKeyValue(bufferNumDjList,fieldCnVOList);
}
case "buffernum_xe": {
List<BufferNumXe> bufferNumXeList = simulationAnalysisMapper.getBufferNumXe(bufferNameList);
return bufferNumXeList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(3,2);
return beanToKeyValue(bufferNumXeList,fieldCnVOList);
}
case "buffernum_xy": {
List<BufferNumXy> bufferNumXyList = simulationAnalysisMapper.getBufferNumXy(bufferNameList);
return bufferNumXyList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(6,2);
return beanToKeyValue(bufferNumXyList,fieldCnVOList);
}
case "buffernum_ze": {
List<BufferNumZe> bufferNumZeList = simulationAnalysisMapper.getBufferNumZe(bufferNameList);
return bufferNumZeList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(5,2);
return beanToKeyValue(bufferNumZeList,fieldCnVOList);
}
case "buffernum_zy": {
List<BufferNumZy> bufferNumZyList = simulationAnalysisMapper.getBufferNumZy(bufferNameList);
return bufferNumZyList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(4,2);
return beanToKeyValue(bufferNumZyList,fieldCnVOList);
}
default:
break;
@ -103,32 +109,38 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
case "oee_bxg": {
List<OeeBxg> oeeBxgList = simulationAnalysisMapper.getOeeBxg();
List<OeeVO> oeeVOList = beanToKeyValue(oeeBxgList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(7,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
case "oee_dj": {
List<OeeDj> oeeDjList = simulationAnalysisMapper.getOeeDj();
List<OeeVO> oeeVOList = beanToKeyValue(oeeDjList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(12,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
case "oee_xe": {
List<OeeXe> oeeXeList = simulationAnalysisMapper.getOeeXe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXeList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(9,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
case "oee_xy": {
List<OeeXy> oeeXyList = simulationAnalysisMapper.getOeeXy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXyList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(8,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
case "oee_ze": {
List<OeeZe> oeeZeList = simulationAnalysisMapper.getOeeZe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZeList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(11,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
case "oee_zy": {
List<OeeZy> oeeZyList = simulationAnalysisMapper.getOeeZy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZyList);
return oeeVOList;
List<FieldCnVO> fieldCnVOList = simulationAnalysisMapper.getFieldInfo(10,1);
return fieldNameToChinese(fieldCnVOList,oeeVOList);
}
default:
break;
@ -161,4 +173,45 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
}
return oeeVOList;
}
public List<OeeVO> fieldNameToChinese(List<FieldCnVO> fieldCnVOList,List<OeeVO> oeeVOList) {
for (OeeVO oeeVO : oeeVOList) {
for (FieldCnVO fieldCnVO : fieldCnVOList) {
if (oeeVO.getName().equals(fieldCnVO.getFieldCode())) {
oeeVO.setName(fieldCnVO.getFieldName());
break;
}
}
}
return oeeVOList;
}
public List<BufferNumVO> beanToKeyValue(List bufferNumList,List<FieldCnVO> fieldCnVOList) {
List<BufferNumVO> bufferNumVOList = new ArrayList<>();
for (Object buffernum : bufferNumList) {
JSONObject jsonObject = (JSONObject) JSON.toJSON(buffernum);
String recordTime = jsonObject.getString("recordTime");
List<BufferNumDTO> bufferNumDTOList = new ArrayList<>();
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
BufferNumDTO bufferNumDTO = new BufferNumDTO();
Object value = entry.getValue();
String key = entry.getKey();
if(value == null || "recordTime".equals(key)){
continue;
}
for (FieldCnVO fieldCnVO : fieldCnVOList) {
if(key.equals(fieldCnVO.getFieldCode())){
bufferNumDTO.setBufferName(fieldCnVO.getFieldName());
break;
}
}
bufferNumDTO.setBufferNum((String) value);
bufferNumDTOList.add(bufferNumDTO);
}
BufferNumVO bufferNumVO = new BufferNumVO();
bufferNumVO.setRecordTime(recordTime);
bufferNumVO.setBufferNumVOList(bufferNumDTOList);
bufferNumVOList.add(bufferNumVO);
}
return bufferNumVOList;
}
}

@ -0,0 +1,84 @@
package com.ipsplm.service.simulation.impl;
import cn.hutool.json.JSONUtil;
import com.ipsplm.service.simulation.ISimulationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.*;
import java.net.Socket;
/**
* @Description 仿Service
* @Author FanDongqiang
* @Date 2023/3/15 16:26
* @Version 1.0
*/
@Service
@Slf4j
public class SimulationServiceImpl implements ISimulationService {
@Value("${plant.socket.ip}")
private String ip;
@Value("${plant.socket.port}")
private Integer port;
/**
* 仿
*
* @param param 仿
*/
@Override
public String getPlantData(Object param) {
Socket socket = null;
String receivedMessage = null;
try {
// 创建Socket对象指定服务端的IP地址和端口号
socket = new Socket(ip, port);
// 获取输入流和输出流 输入流和输出流是通过socket对象来进行数据传输的。
InputStream inputStream = socket.getInputStream();
OutputStream outputStream = socket.getOutputStream();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
// PrintWriter writer = new PrintWriter(outputStream, true);
// 将用户输入的信息发送给服务端
// writer.println(param);
bufferedWriter.write((String) param);
bufferedWriter.flush();
long oldTime = System.currentTimeMillis();
// 接收服务端的响应并打印
long newTime = System.currentTimeMillis();
// 接收服务器发送的消息
byte[] buffer = new byte[1024];
int length = inputStream.read(buffer);
receivedMessage = new String(buffer, 0, length);
if(newTime-oldTime > 210 * 1000) {
receivedMessage = "请求超时";
log.info("请求超时");
}else {
if (StringUtils.isNotEmpty(receivedMessage)) {
System.out.println("收到服务器发送的消息:" + receivedMessage);
return receivedMessage;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (socket != null) {
try {
// 关闭连接
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return receivedMessage;
}
}

@ -0,0 +1,104 @@
package com.ipsplm.ws;
import com.ipsplm.service.simulation.ISimulationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component
@ServerEndpoint(value = "/websocket/simulation")
public class SimulationWebsocket {
private Session session;
private static ISimulationService simulationService;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private boolean isSimulationRunning = false;
@Autowired
public void setService(ISimulationService simulationService) {
SimulationWebsocket.simulationService = simulationService;
}
//存放websocket的集合
private static CopyOnWriteArraySet<SimulationWebsocket> webSocketSet = new CopyOnWriteArraySet<>();
@OnOpen
public void OnOpen(Session session) {
this.session = session;
webSocketSet.add(this);
log.info("【websocket消息】有新的连接, 总数:{}", webSocketSet.size());
}
@OnMessage
public void onMessage(String message) {
log.info("【websocket消息】收到客户端发来的消息:{}", message);
if ("StartSimulation".equals(message)) {
//发送开始仿真的信息
String result = simulationService.getPlantData(message);
if ("Simulation Started".equals(result)) {
isSimulationRunning = true;
log.info("【仿真开始】");
scheduler.scheduleAtFixedRate(() -> {
if (isSimulationRunning) {
String data = simulationService.getPlantData("SimulationProgress");
// 根据需要处理和发送获取到的数据
log.info("【仿真数据】:" + data);
sendMessage(data);
if("1".equals(data) || "1.00".equals(data)){
sendMessage("ending");
isSimulationRunning = false;
scheduler.shutdown();
}
}
}, 0, 10, TimeUnit.SECONDS);
} else {
sendMessage("Simulation Start Failed");
}
} else if ("ResetSimulation".equals(message)) {
String resetSimulation = simulationService.getPlantData(message);
if ("Simulation Reset".equals(resetSimulation)) {
sendMessage("ending");
} else {
sendMessage("Simulation Reset Failed");
}
} else {
String resetSimulation = simulationService.getPlantData(message);
}
}
@OnClose
public void onClose() {
webSocketSet.remove(this);
log.info("【websocket消息】连接断开, 总数:{}", webSocketSet.size());
}
public void sendMessage(String message) {
for (SimulationWebsocket webSocket : webSocketSet) {
try {
synchronized (webSocket.session) {
if (webSocket.session.isOpen()) {
webSocket.session.getBasicRemote().sendText(message);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

@ -23,8 +23,8 @@ spring:
#仿真Socket
plant:
socket:
ip:
port:
ip: 127.0.0.1
port: 30000
mybatis-plus:
configuration:

@ -35,7 +35,7 @@
<if test="flag != null and flag != ''">
where bxg.flag = #{flag}
</if>
order by flag desc , status limit 9
order by flag desc , status
</select>
<!-- 获取不锈钢OEE-->
<select id="getOeeBxg" resultType="com.ipsplm.entity.simulation.OeeBxg">
@ -87,7 +87,7 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_bxg
from buffernum_bxg order by flag desc,record_time limit 48
</select>
<!-- 获取大径线缓存数量-->
<select id="getBufferNumDj" resultType="com.ipsplm.entity.simulation.BufferNumDj">
@ -95,7 +95,7 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_dj
from buffernum_dj order by flag desc,record_time limit 48
</select>
<!-- 获取小二线缓存数量-->
<select id="getBufferNumXe" resultType="com.ipsplm.entity.simulation.BufferNumXe">
@ -103,7 +103,7 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_xe
from buffernum_xe order by flag desc,record_time limit 48
</select>
<!-- 获取小一线缓存数量-->
<select id="getBufferNumXy" resultType="com.ipsplm.entity.simulation.BufferNumXy">
@ -111,7 +111,7 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_xy
from buffernum_xy order by flag desc,record_time limit 48
</select>
<!-- 获取中二线缓存数量-->
<select id="getBufferNumZe" resultType="com.ipsplm.entity.simulation.BufferNumZe">
@ -119,7 +119,7 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_ze
from buffernum_ze order by flag desc,record_time limit 48
</select>
<!-- 获取中一线缓存数量-->
<select id="getBufferNumZy" resultType="com.ipsplm.entity.simulation.BufferNumZy">
@ -127,6 +127,18 @@
<foreach collection="bufferNameList" item="item" separator=",">
${item.bufferCode}
</foreach>
from buffernum_zy
from buffernum_zy order by flag desc,record_time limit 48
</select>
<select id="getFieldInfo" resultType="com.ipsplm.entity.simulation.vo.FieldCnVO">
select field_code as fieldCode, field_des as fieldName from field_cn
<where>
<if test="tableId != null">
and table_id = #{tableId}
</if>
<if test="groupId != null">
and group_id = #{groupId}
</if>
</where>
;
</select>
</mapper>
Loading…
Cancel
Save