|  |  |  | @ -1,6 +1,8 @@ | 
		
	
		
			
				|  |  |  |  | package cn.estsh.i3plus.core.apiservice.controller.base; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.core.api.iservice.busi.ITestTransService; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.platform.common.tool.HttpClientTool; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.platform.common.util.CommonConstWords; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.platform.plugin.opc.pojo.OpcUAParam; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.platform.plugin.opc.service.OpcUAService; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.i3plus.pojo.base.annotation.AnnoIgnoreLog; | 
		
	
	
		
			
				
					|  |  |  | @ -9,20 +11,24 @@ import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.base.controller.CoreBaseController; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.exception.ImppBusiException; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.util.ImppRedis; | 
		
	
		
			
				|  |  |  |  | import cn.estsh.impp.framework.boot.util.ResultBean; | 
		
	
		
			
				|  |  |  |  | import com.alibaba.fastjson.JSON; | 
		
	
		
			
				|  |  |  |  | import io.swagger.annotations.Api; | 
		
	
		
			
				|  |  |  |  | import io.swagger.annotations.ApiOperation; | 
		
	
		
			
				|  |  |  |  | import lombok.Setter; | 
		
	
		
			
				|  |  |  |  | import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaMonitoredItem; | 
		
	
		
			
				|  |  |  |  | import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaSubscription; | 
		
	
		
			
				|  |  |  |  | import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue; | 
		
	
		
			
				|  |  |  |  | import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger; | 
		
	
		
			
				|  |  |  |  | import org.slf4j.Logger; | 
		
	
		
			
				|  |  |  |  | import org.slf4j.LoggerFactory; | 
		
	
		
			
				|  |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
		
	
		
			
				|  |  |  |  | import org.springframework.web.bind.annotation.RestController; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import javax.annotation.Resource; | 
		
	
		
			
				|  |  |  |  | import java.util.HashMap; | 
		
	
		
			
				|  |  |  |  | import java.util.Hashtable; | 
		
	
		
			
				|  |  |  |  | import java.util.Map; | 
		
	
	
		
			
				
					|  |  |  | @ -45,6 +51,104 @@ public class PressureTestController extends CoreBaseController { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     public static Map<UInteger,OpcUAParam> upcSub = new Hashtable<>(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @Resource(name = CommonConstWords.IMPP_REDIS_RES) | 
		
	
		
			
				|  |  |  |  |     public ImppRedis imppRedis; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @Autowired | 
		
	
		
			
				|  |  |  |  |     private ITestTransService testTransService; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @GetMapping("/s-redis-put") | 
		
	
		
			
				|  |  |  |  |     @ApiOperation(value = "redisPut", notes = "redisPut") | 
		
	
		
			
				|  |  |  |  |     public ResultBean sredisPut(){ | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             testTransService.insertRedis(); | 
		
	
		
			
				|  |  |  |  |             return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); | 
		
	
		
			
				|  |  |  |  |         }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |             return ResultBean.fail(busExcep); | 
		
	
		
			
				|  |  |  |  |         }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |             return ImppExceptionBuilder.newInstance().buildExceptionResult(e); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @GetMapping("/s-redis-put-test") | 
		
	
		
			
				|  |  |  |  |     @ApiOperation(value = "redisPutTest", notes = "redisPutTest") | 
		
	
		
			
				|  |  |  |  |     public ResultBean sredisPutTest(){ | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             testTransService.selectRedis(); | 
		
	
		
			
				|  |  |  |  |             return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); | 
		
	
		
			
				|  |  |  |  |         }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |             return ResultBean.fail(busExcep); | 
		
	
		
			
				|  |  |  |  |         }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |             return ImppExceptionBuilder.newInstance().buildExceptionResult(e); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @GetMapping("/redis-put") | 
		
	
		
			
				|  |  |  |  |     @ApiOperation(value = "redisPut", notes = "redisPut") | 
		
	
		
			
				|  |  |  |  |     public ResultBean redisPut(){ | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             for (int i = 0; i < 1000; i++) { | 
		
	
		
			
				|  |  |  |  |                 imppRedis.putObject(i + "", i); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); | 
		
	
		
			
				|  |  |  |  |         }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |             return ResultBean.fail(busExcep); | 
		
	
		
			
				|  |  |  |  |         }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |             return ImppExceptionBuilder.newInstance().buildExceptionResult(e); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @GetMapping("/redis-put-test") | 
		
	
		
			
				|  |  |  |  |     @ApiOperation(value = "redisPutTest", notes = "redisPutTest") | 
		
	
		
			
				|  |  |  |  |     public ResultBean redisPutTest(){ | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             for (int i = 0; i < 1000; i++) { | 
		
	
		
			
				|  |  |  |  | //                imppRedis.putObjectTest(i + "", i);
 | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); | 
		
	
		
			
				|  |  |  |  |         }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |             return ResultBean.fail(busExcep); | 
		
	
		
			
				|  |  |  |  |         }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |             return ImppExceptionBuilder.newInstance().buildExceptionResult(e); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @GetMapping("/redis-put-run") | 
		
	
		
			
				|  |  |  |  |     @ApiOperation(value = "redisPutThread", notes = "redisPutThread") | 
		
	
		
			
				|  |  |  |  |     public ResultBean redisPutThread(Boolean isTest){ | 
		
	
		
			
				|  |  |  |  |         try { | 
		
	
		
			
				|  |  |  |  |             RedisTest.setImppRedis(imppRedis); | 
		
	
		
			
				|  |  |  |  |             RedisTest.setTest(isTest); | 
		
	
		
			
				|  |  |  |  |             for (int i = 0; i < 10; i++) { | 
		
	
		
			
				|  |  |  |  |                 new RedisTest().run(); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); | 
		
	
		
			
				|  |  |  |  |         }catch(ImppBusiException busExcep){ | 
		
	
		
			
				|  |  |  |  |             return ResultBean.fail(busExcep); | 
		
	
		
			
				|  |  |  |  |         }catch(Exception e){ | 
		
	
		
			
				|  |  |  |  |             return ImppExceptionBuilder.newInstance().buildExceptionResult(e); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     static class RedisTest implements Runnable{ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         @Setter | 
		
	
		
			
				|  |  |  |  |         public static ImppRedis imppRedis; | 
		
	
		
			
				|  |  |  |  |         @Setter | 
		
	
		
			
				|  |  |  |  |         public static boolean isTest; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         @Override | 
		
	
		
			
				|  |  |  |  |         public void run() { | 
		
	
		
			
				|  |  |  |  |             for (int i = 0; i < 200; i++) { | 
		
	
		
			
				|  |  |  |  |                 if(isTest) { | 
		
	
		
			
				|  |  |  |  |                     imppRedis.putObject("runnable" + i, i); | 
		
	
		
			
				|  |  |  |  |                 }else{ | 
		
	
		
			
				|  |  |  |  | //                    imppRedis.putObjectTest("runnable" + i, i);
 | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     private OpcUAService getOpcUaService(OpcUAParam opcUAParam){ | 
		
	
		
			
				|  |  |  |  |         if(!uaServiceMap.containsKey(opcUAParam.getServerUrl())){ | 
		
	
		
			
				|  |  |  |  |             OpcUAService opcService = new OpcUAService(); | 
		
	
	
		
			
				
					|  |  |  | 
 |