33import com .google .common .collect .Maps ;
44import io .netty .util .internal .ThreadLocalRandom ;
55import org .apache .commons .collections4 .CollectionUtils ;
6- import org .apache .commons .math3 .random .RandomDataGenerator ;
76import org .hswebframework .web .api .crud .entity .PagerResult ;
87import org .hswebframework .web .api .crud .entity .QueryParamEntity ;
98import org .hswebframework .web .id .IDGenerator ;
109import org .jetlinks .core .command .CommandHandler ;
1110import org .jetlinks .core .command .CommandUtils ;
12- import org .jetlinks .core .config .ConfigKey ;
1311import org .jetlinks .core .device .DeviceOperator ;
1412import org .jetlinks .core .device .DeviceState ;
1513import org .jetlinks .core .message .DeviceMessage ;
@@ -71,7 +69,7 @@ public Mono<PagerResult<DeviceInfo>> queryDevicePage(QueryDevicePageCommand cmd)
7169
7270 for (int i = 0 ; i < e .getPageSize (); i ++) {
7371 DeviceInfo inf = new DeviceInfo ();
74- inf .setId ("mock-device-" + offset + i );
72+ inf .setId ("mock-device-" + ( offset + i ) );
7573 inf .setName ("模拟设备_" + (offset + i ));
7674 inf .setState (org .jetlinks .sdk .server .device .DeviceState .online );
7775
@@ -101,7 +99,11 @@ protected Flux<DeviceMessage> createMockData(DeviceOperator device,
10199 }
102100 Map <String , Object > data = Maps .newHashMapWithExpectedSize (properties .size ());
103101 for (PropertyMetadata property : properties ) {
104- data .put (property .getId (), mockData (property .getValueType ()));
102+ String source = (String ) property .getExpand ("source" ).orElse (null );
103+ if (source == null || "device" .equals (source )) {
104+ //属性来源不是设备的不模拟
105+ data .put (property .getId (), mockData (property .getValueType ()));
106+ }
105107 }
106108
107109 ReportPropertyMessage message = new ReportPropertyMessage ();
@@ -111,7 +113,6 @@ protected Flux<DeviceMessage> createMockData(DeviceOperator device,
111113 }
112114
113115
114-
115116 @ Override
116117 public Mono <Byte > getDeviceState (DeviceOperator device ) {
117118 return Mono
0 commit comments