pom.xml
@@ -145,11 +145,12 @@ <version>${spring.boot.version}</version> </dependency> <!-- <dependency>--> <!-- <groupId>org.springframework.kafka</groupId>--> <!-- <artifactId>spring-kafka</artifactId>--> <!-- <version>${spring.boot.version}</version>--> <!-- </dependency>--> <!-- kafka --> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> <version>2.2.1.RELEASE</version> </dependency> <dependency> <groupId>net.sourceforge.nekohtml</groupId> src/main/java/com/fzzy/api/data/GatewayDeviceProtocol.java
@@ -12,6 +12,7 @@ public enum GatewayDeviceProtocol { GRAIN_FZZY_ZH_2023("GRAIN_FZZY_ZH_2023", "ç²®æ -飿£è´è¿æ§å¶æåè®®2023"), GRAIN_FZZY_IGDS_V40("GRAIN_FZZY_IGDS_V40", "ç²®æ -飿£è´è¿ç³»ç»V40"), DEVICE_WEIGHT_HTTP("DEVICE_WEIGHT_HTTP", "å°ç£ -HTTPåè®®"), DEVICE_WEIGHT_TCP_YH("DEVICE_WEIGHT_TCP_YH", "å°ç£ -èåTCPåè®®"), DEVICE_IDCARD_HTTP("DEVICE_IDCARD_HTTP", "身份è¯-HTTPåè®®"), @@ -26,6 +27,7 @@ public static List<ApiTrigger> listTrigger() { List<ApiTrigger> list = new ArrayList<>(); list.add(new ApiTrigger(GRAIN_FZZY_ZH_2023.getCode(), GRAIN_FZZY_ZH_2023.getName())); list.add(new ApiTrigger(GRAIN_FZZY_IGDS_V40.getCode(), GRAIN_FZZY_IGDS_V40.getName())); list.add(new ApiTrigger(DEVICE_WEIGHT_HTTP.getCode(), DEVICE_WEIGHT_HTTP.getName())); list.add(new ApiTrigger(DEVICE_WEIGHT_TCP_YH.getCode(), DEVICE_WEIGHT_TCP_YH.getName())); list.add(new ApiTrigger(DEVICE_IDCARD_HTTP.getCode(), DEVICE_IDCARD_HTTP.getName())); src/main/java/com/fzzy/api/data/GatewayDeviceType.java
@@ -16,8 +16,9 @@ TYPE_03("TYPE_03", "éé¸"), TYPE_04("TYPE_04", "LED"), TYPE_05("TYPE_05", "æ¦æ ·æº"), TYPE_06("TYPE_06", "æå头"), TYPE_06("TYPE_06", "è§é¢å®é²æå头"), TYPE_07("TYPE_07", "ç²®æ åæº"), TYPE_08("TYPE_08", "æ¡é¢æææå头"), TYPE_99("TYPE_99", "ç¬ç«IOT"); @@ -34,6 +35,7 @@ list.add(new ApiTrigger(TYPE_05.getCode(), TYPE_05.getName())); list.add(new ApiTrigger(TYPE_06.getCode(), TYPE_06.getName())); list.add(new ApiTrigger(TYPE_07.getCode(), TYPE_07.getName())); list.add(new ApiTrigger(TYPE_08.getCode(), TYPE_08.getName())); list.add(new ApiTrigger(TYPE_99.getCode(), TYPE_99.getName())); return list; } src/main/java/com/fzzy/api/data/GatewayProtocol.java
@@ -14,7 +14,7 @@ GATE_WEBSOCKET("GATE_WEBSOCKET", "webSocket"), GATE_MQTT("GATE_MQTT", "MQTT"), GATE_HTTP("GATE_HTTP", "HTTP"), GATE_TEST("GATE_TEST", "æµè¯"); GATE_TEST("GATE_TEST", "æ¼ç¤ºæµè¯"); private String code; src/main/java/com/fzzy/async/fzzy40/Fzzy40CommonService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,35 @@ package com.fzzy.async.fzzy40; import com.fzzy.async.fzzy40.entity.Fz40Grain; import com.fzzy.async.fzzy40.repository.Fzzy40Sync1302Rep; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Date; import java.util.List; /** * 2023å¹´10æ31æ¥ 02:28:21 ANDYå¢å ç¨äºèªç±æ¥å£è°ç¨ï¼å¦å ¶ä»æ¨¡åè°ç¨ */ @Component public class Fzzy40CommonService { @Resource private Fzzy40Sync1302Rep fzzy40Sync1302Rep; /** * æ ¹æ®å¼æ¶é´åæªè³æ¶é´è·åç²®æ ä¿¡æ¯ * * @param depotId ç³»ç»ä¸çä»åºç¼ç * @param start * @param end * @return */ public List<Fz40Grain> listGrain(String depotId, Date start, Date end) { return fzzy40Sync1302Rep.findByReceiveDate(depotId, start, end); } } src/main/java/com/fzzy/async/fzzy40/repository/Fzzy40Sync1302Rep.java
@@ -1,6 +1,5 @@ package com.fzzy.async.fzzy40.repository; import com.fzzy.async.fzzy35.entity.Fz35Grain; import com.fzzy.async.fzzy40.entity.Fz40Grain; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; @@ -19,10 +18,23 @@ /** * æ ¹æ®æ¶é´æ®µæ¥è¯¢ç²®æ æ°æ® * * @param start * @param end * @return */ @Query("from Fz40Grain where receiveDate >=:start and receiveDate <:end order by receiveDate ") List<Fz40Grain> findByReceiveDate(@Param("start") Date start, @Param("end") Date end); /** * æ ¹æ®æ¶é´æ®µæ¥è¯¢ç²®æ æ°æ® * * @param depotId * @param start * @param end * @return */ @Query("from Fz40Grain where depotId =:depotId and receiveDate >=:start and receiveDate <:end order by receiveDate ") List<Fz40Grain> findByReceiveDate(@Param("depotId") String depotId, @Param("start") Date start, @Param("end") Date end); } src/main/java/com/fzzy/conf/MyPartitionTemplate.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,65 @@ package com.fzzy.conf; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.kafka.core.DefaultKafkaProducerFactory; import org.springframework.kafka.core.KafkaTemplate; import javax.annotation.PostConstruct; import java.util.HashMap; import java.util.Map; /** * èªå®ä¹é 置类 */ @Slf4j @Configuration @ConfigurationProperties(prefix = "spring.kafka") public class MyPartitionTemplate { private String bootstrapServers; private String securityProtocol; private String saslMechanism; private String saslJaasConfig; private String saslUsername; private String saslPassword; KafkaTemplate<String, String> kafkaTemplate; @PostConstruct public void setKafkaTemplate() { Map<String, Object> props = new HashMap<>(); props.put("bootstrap.servers", bootstrapServers); props.put("security.protocol", securityProtocol); props.put("sasl.mechanism", saslMechanism); if (StringUtils.isNotEmpty(saslUsername) && StringUtils.isNotEmpty(saslPassword)) { saslJaasConfig = saslJaasConfig.replace("{username}", saslUsername) .replace("{password}", saslPassword); props.put("sasl.jaas.config", saslJaasConfig); log.debug("----sasl.jaas.config---{}", saslJaasConfig); } this.kafkaTemplate = new KafkaTemplate<>(new DefaultKafkaProducerFactory<>(props)); } public KafkaTemplate<String, String> getKafkaTemplate() { return kafkaTemplate; } } src/main/java/com/fzzy/gateway/api/DeviceReportService.java
@@ -1,6 +1,7 @@ package com.fzzy.gateway.api; import com.fzzy.gateway.entity.GatewayDevice; import com.fzzy.gateway.hx2023.data.GrainData; public interface DeviceReportService { @@ -21,4 +22,12 @@ */ String report2GatewayBySn(double weigh, GatewayDevice device); /** * ç²®æ æ°æ®æ¨å¨å°äºç«¯ç³»ç» * @param data * @return */ String pushGrainData2Cloud(GrainData data); } src/main/java/com/fzzy/gateway/data/QueryParam.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package com.fzzy.gateway.data; import java.util.Date; import lombok.Data; @Data public class QueryParam { private Date start; private Date end; private Date dayTime; } src/main/java/com/fzzy/gateway/entity/GatewayDevice.java
@@ -25,7 +25,7 @@ @PropertyDef(label = "ç³»ç»ID") private String id; @Column(name = "DEVICE_SN_", length = 50) @Column(name = "DEVICE_SN_", length = 100) @PropertyDef(label = "设å¤åºåå·") private String deviceSn; @@ -42,12 +42,16 @@ private String type; @Column(name = "DEPOT_ID_", length = 30) @PropertyDef(label = "æå±ä»åº") @PropertyDef(label = "ä»åºç¼ç ") private String depotId; @Column(name = "DEPOT_NAME_", length = 50) @PropertyDef(label = "æå±ä»åº") @PropertyDef(label = "ä»åºåç§°") private String depotName; @Column(name = "DEPOT_ID_SYS_", length = 30) @PropertyDef(label = "åºåºç³»ç»ä»åºç¼ç ") private String depotIdSys; @Column(name = "IP_", length = 20) @PropertyDef(label = "é讯IP") @@ -58,11 +62,11 @@ private Integer port; @PropertyDef(label = "设å¤ç¨æ·å") @Column(name = "username", length = 50) @Column(name = "USERNAME_", length = 50) private String userName; @PropertyDef(label = "设å¤å¯ç ") @Column(name = "password", length = 50) @Column(name = "PASSWORD_", length = 50) private String password; @Column(name = "RTSP_", length = 100) src/main/java/com/fzzy/gateway/hx2023/ScConstant.java
@@ -1,5 +1,7 @@ package com.fzzy.gateway.hx2023; import org.apache.commons.lang.math.RandomUtils; /** * 常é */ @@ -11,4 +13,7 @@ public static String MESSAGE_TYPE_REPORT_PROPERTY = "REPORT_PROPERTY"; public static String getMessageId() { return System.currentTimeMillis() + RandomUtils.nextInt(1000) + ""; } } src/main/java/com/fzzy/gateway/hx2023/controller/GatewayController.java
@@ -7,11 +7,9 @@ import com.fzzy.gateway.hx2023.data.GatewayAuthData; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.stereotype.Repository; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; /** * src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
@@ -2,36 +2,48 @@ import lombok.Data; import java.util.List; /** * ç²®æ ä¿¡æ¯ */ @Data public class GrainData { //æ¶æ¯ ID private String messageId; //设å¤ç¼ç private String deviceId; //æ´ä»å¹³å温度 private String avgTemperature; //æ´ä»æä½æ¸©åº¦ private String minTemperature; //æ´ä»æé«æ¸©åº¦ private String maxTemperature; //æ£æµæ¶é´-æ ¼å¼ï¼yyyy-MM-dd HH:mm:ss private String collectTime; private String minX; private String minX = "0"; private String minY; private String minY = "0"; private String minZ; private String minZ = "0"; private String maxX; private String maxX = "0"; private String maxY; private String maxY = "0"; private String maxZ; private String maxZ = "0"; //模åè¯å«ç -常éï¼åºå®ä¼ apiTemperature private String apISource = "apiTemperature"; //ç²®æ¸©è¯¦ç» private List<GrainDataDetail> temperature; } src/main/java/com/fzzy/gateway/hx2023/data/GrainDataDetail.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ package com.fzzy.gateway.hx2023.data; import lombok.Data; /** * ç²®æ ä¿¡æ¯è¯¦ç» */ @Data public class GrainDataDetail { //æ ¹å· private int cableNum; //å±å· private int layerNumber; //ç´¢å¼ private int position; //æ¸©åº¦å¼ private String temperature; public GrainDataDetail() { } public GrainDataDetail(int cableNum, int layerNumber, int position, String temperature) { this.cableNum = cableNum; this.layerNumber = layerNumber; this.position = position; this.temperature = temperature; } } src/main/java/com/fzzy/gateway/hx2023/kafka/KafkaDeviceReport.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,62 @@ package com.fzzy.gateway.hx2023.kafka; import com.alibaba.fastjson2.JSONObject; import com.fzzy.gateway.hx2023.data.GrainData; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Component; import javax.annotation.Resource; /** * 使ç¨KAFKAæ¨å¨è¿åä¿¡æ¯å®ç°ï¼é对å½åç½å ³ */ @Slf4j @Component public class KafkaDeviceReport { @Resource private KafkaTemplate<String, Object> kafkaTemplate; /** * æ¨å¨ç²®æ å°äºç«¯ç³»ç» * * @param data * @return */ public String sendGrainData2Cloud(GrainData data) { log.debug("----æ¨éç²®æ ä¿¡æ¯å°äºç«¯---{}",data); //æ¨éä¿¡æ¯ kafkaTemplate.send("TOPIC_ZLJ_GRAIN_TEMPERATURE",JSONObject.toJSONString(data)).addCallback(success -> { // æ¶æ¯åéå°çtopic String topic = success.getRecordMetadata().topic(); // æ¶æ¯åéå°çååº int partition = success.getRecordMetadata().partition(); // æ¶æ¯å¨ååºå çoffset long offset = success.getRecordMetadata().offset(); log.info("ç²®æ æ¨éæå:" + topic + "-" + partition + "-" + offset); }, failure -> { log.error("ç²®æ æ¨é失败:" + failure.getMessage()); }); return "SUCCESS"; } @KafkaListener(topics = {"TOPIC_ZLJ_GRAIN_TEMPERATURE"}) public void onMessage1(ConsumerRecord<?, ?> record) { log.info("è·åæ¶è´¹ä¿¡æ¯ï¼" + record.topic() + "-" + record.partition() + "-" + record.value()); } } src/main/java/com/fzzy/gateway/hx2023/kafka/package-info.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1 @@ package com.fzzy.gateway.hx2023.kafka; src/main/java/com/fzzy/gateway/hx2023/service/DeviceReportServiceImpl.java
@@ -6,9 +6,11 @@ import com.fzzy.gateway.api.DeviceReportService; import com.fzzy.gateway.entity.GatewayDevice; import com.fzzy.gateway.hx2023.ScConstant; import com.fzzy.gateway.hx2023.data.GrainData; import com.fzzy.gateway.hx2023.data.WebSocketPacket; import com.fzzy.gateway.hx2023.data.WebSocketPacketHeader; import com.fzzy.gateway.hx2023.data.WeightInfo; import com.fzzy.gateway.hx2023.kafka.KafkaDeviceReport; import com.fzzy.gateway.hx2023.websocket.WebSocketDeviceReport; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -22,6 +24,8 @@ @Resource private WebSocketDeviceReport webSocketDeviceReport; @Resource private KafkaDeviceReport kafkaDeviceReport; @Override public String getProvinceProtocol() { @@ -71,4 +75,10 @@ return null; } @Override public String pushGrainData2Cloud(GrainData data) { return kafkaDeviceReport.sendGrainData2Cloud(data); } } src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java
@@ -4,24 +4,44 @@ import com.bstek.dorado.annotation.DataResolver; import com.bstek.dorado.annotation.Expose; import com.fzzy.api.utils.ContextUtil; import com.fzzy.api.utils.RedisConst; import com.fzzy.api.utils.RedisUtil; import com.fzzy.api.utils.DateUtil; import com.fzzy.async.fzzy40.Fzzy40CommonService; import com.fzzy.async.fzzy40.entity.Fz40Grain; import com.fzzy.gateway.GatewayUtils; import com.fzzy.gateway.api.DeviceReportService; import com.fzzy.gateway.api.GatewayRemoteManager; import com.fzzy.gateway.data.QueryParam; import com.fzzy.gateway.entity.GatewayDevice; import com.fzzy.gateway.hx2023.ScConstant; import com.fzzy.gateway.hx2023.data.GrainData; import com.fzzy.gateway.hx2023.data.GrainDataDetail; import com.fzzy.gateway.service.repository.GatewayDeviceRep; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateFormatUtils; import org.springframework.beans.BeanUtils; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.HashMap; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @Slf4j @Component public class GatewayDeviceService { @Resource private GatewayDeviceRep gatewayDeviceRep; @Resource private Fzzy40CommonService fzzy40CommonService; @Resource private GatewayRemoteManager gatewayRemoteManager; /** * gatewayDeviceService#listAll @@ -30,7 +50,8 @@ */ @DataProvider public List<GatewayDevice> listAll() { return gatewayDeviceRep.findAll(); Sort sort = new Sort(Sort.Direction.ASC, "deviceId"); return gatewayDeviceRep.findAll(sort); } /** @@ -90,4 +111,169 @@ GatewayUtils.add2Cache(device); } } /** * gatewayDeviceService#ajaxTestGrain * ç²®æ æ¨éæµè¯ * * @param param * @return */ @Expose public String ajaxTestGrain(Map<String,Object> parameter) { //è·å设å¤é ç½®ï¼åªé对粮æ 设å¤è¿è¡æ§è¡ List<GatewayDevice> list = this.listAll(); if (null == list || list.isEmpty()) { return "ERRORï¼ä¸ºè·åå°ç³»ç»ä¸è®¾å¤é ç½®ï¼åæ¶æ§è¡"; } Date dayTime = (Date) parameter.get("dayTime"); if (null == dayTime) dayTime = new Date(); QueryParam param = new QueryParam(); param.setDayTime(dayTime); param.setStart(DateUtil.getCurZero(dayTime)); param.setEnd(DateUtil.getNextZero(dayTime)); //妿é¨ç½²FZZY-IGDS-V40çæ¬ç³»ç» return this.pushByV40(list, param); } private String pushByV40(List<GatewayDevice> list, QueryParam param) { String depotIdSys; List<Fz40Grain> listGrain; Fz40Grain lastData; GrainData pushData; DeviceReportService deviceReportService = null; for (GatewayDevice device : list) { depotIdSys = device.getDepotIdSys(); if (StringUtils.isEmpty(depotIdSys)) { log.info("--------设å¤--{}-æªé 置系ç»ç¸å ³ä»åºç¼ç ï¼æ æ³æ§è¡å½åæä½",device.getDeviceName()); continue; } listGrain = fzzy40CommonService.listGrain(depotIdSys, param.getStart(), param.getEnd()); if (null == listGrain || listGrain.isEmpty()) { log.info("---------设å¤---{}--æªåæ¥å°ç²®æ ä¿¡æ¯ï¼è¯·ç¡®è®¤å½åæ¡ä»¶ä¸æ¯å¦ææ°æ®",device.getDeviceName()); continue; } //è·åæå䏿¡ç²®æ ä½ä¸ºå½åæ°æ® lastData = listGrain.get(listGrain.size() - 1); pushData = this.lastData2PushData(lastData, device); if (null == deviceReportService) { deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol()); } deviceReportService.pushGrainData2Cloud(pushData); } return "SUCCESS"; } /** * å°ç²®æ æ°æ®è½¬æ¢ä¸ºæ¨ééè¦çæ°æ®æ ¼å¼ * * @param lastData * @return */ private GrainData lastData2PushData(Fz40Grain lastData, GatewayDevice device) { GrainData result = new GrainData(); result.setMessageId(ScConstant.getMessageId()); result.setDeviceId(device.getDeviceId()); result.setAvgTemperature(lastData.getTempAve() + ""); result.setMinTemperature(lastData.getTempMin() + ""); result.setMaxTemperature(lastData.getTempMax() + ""); result.setCollectTime(DateFormatUtils.format(lastData.getReceiveDate(), "yyyy-MM-dd HH:mm:ss")); //å±-è¡-å String[] attrCable = lastData.getCable().split("-"); //å±é ç½® int layMax = Integer.valueOf(attrCable[0]); //é对çä»é ç½® String[] cableCirAtt = new String[0]; if (StringUtils.isNotEmpty(lastData.getCableCir())) { cableCirAtt = lastData.getCableCir().split("-"); } //温度éå String[] attr = lastData.getPoints().split(","); //æ ¹å· int cableNum = 1, layerNumber = 1, position = 0; int curCir = 1;//æå¨å int cirLay = 1;//å½ååçå± String curTemp; List<GrainDataDetail> details = new ArrayList<>(); for (int i = 0; i < attr.length; i++) { position = i; curTemp = attr[i]; //æ ¹å· cableNum = (i / layMax) + 1; layerNumber = (i % layMax) + 1; if (cableCirAtt.length > 0) { curCir = getCurCir(cableNum, attrCable); cirLay = Integer.valueOf(cableCirAtt[curCir - 1]); details.add(new GrainDataDetail(cableNum, cirLay, position, curTemp)); } else { //夿æå¤§ TODO å¾ ä¼å if (curTemp.equals(result.getMaxTemperature())) { result.setMaxX(cableNum + ""); result.setMaxZ(curTemp); } //夿æå° TODO å¾ ä¼å if (curTemp.equals(result.getMinTemperature())) { result.setMinX(cableNum + ""); result.setMinZ(curTemp); } details.add(new GrainDataDetail(cableNum, layerNumber, position, curTemp)); } } result.setTemperature(details); return result; } private int getCurCir(int curRoot, String[] cableRuleAtt) { int sum = 0; for (int i = 0; i < cableRuleAtt.length; i++) { sum += Integer.valueOf(cableRuleAtt[i]); if (curRoot <= sum) return i + 1; } return 1; } } src/main/java/com/fzzy/gateway/view/GatewayConf.view.xml
@@ -24,11 +24,11 @@ <Property name="label">ç½å ³ID</Property> </PropertyDef> <PropertyDef name="gatewayUsername"> <Property/> <Property></Property> <Property name="label">ç½å ³ç¨æ·å</Property> </PropertyDef> <PropertyDef name="gatewayPassword"> <Property/> <Property></Property> <Property name="label">ç½å ³å¯ç </Property> </PropertyDef> <PropertyDef name="gatewayIp"> @@ -86,12 +86,28 @@ <Property name="label">ç²®åºç³»ç»ä¸åºåºç¼ç </Property> </PropertyDef> </DataType> <DataType name="dtParam" parent="Map"> <PropertyDef name="start"> <Property name="dataType">Date</Property> </PropertyDef> <PropertyDef name="end"> <Property name="dataType">Date</Property> </PropertyDef> <PropertyDef name="dayTime"> <Property name="dataType">Date</Property> <Property name="label">éæ©æ¶é´</Property> </PropertyDef> </DataType> </Model> <View layout="regionPadding:10"> <Property name="packages">font-awesome,css-common</Property> <DataSet id="dsMain"> <Property name="dataType">[dtMain]</Property> <Property name="dataProvider">gatewayConfService#listAll</Property> </DataSet> <DataSet id="dsQuery"> <ClientEvent name="onReady">self.insert({});</ClientEvent> <Property name="dataType">dtParam</Property> </DataSet> <ToolBar> <ToolBarLabel> @@ -107,14 +123,6 @@ <Property name="iconClass">fa fa-plus</Property> <Property name="width">90</Property> <Property name="exClassName">toolbar-button</Property> </ToolBarButton> <ToolBarButton> <ClientEvent name="onClick">view.get("#dsMain").flushAsync();
 </ClientEvent> <Property name="caption">å·æ°</Property> <Property name="iconClass">fa fa-search</Property> <Property name="width">100</Property> <Property name="exClassName">toolbar-button-push</Property> </ToolBarButton> <ToolBarButton> <ClientEvent name="onClick">var cur = view.get("#dgMain").getCurrentItem();
 @@ -144,6 +152,13 @@ <Property name="width">90</Property> <Property name="exClassName">toolbar-button-warn</Property> </ToolBarButton> <Separator/> <ToolBarButton> <ClientEvent name="onClick">view.get("#dialogGrain").show();</ClientEvent> <Property name="caption">ç²®æ æ¨éæµè¯</Property> <Property name="iconClass">fa fa-search</Property> <Property name="exClassName">toolbar-button-push</Property> </ToolBarButton> </ToolBar> <DataGrid id="dgMain"> <Property name="dataSet">dsMain</Property> @@ -162,6 +177,13 @@ <Property name="name">grade</Property> <Property name="width">200</Property> </DataColumn> <DataColumn name="gatewayId"> <Property name="property">gatewayId</Property> <Property name="width">300</Property> </DataColumn> <DataColumn name="gatewayUsername"> <Property name="property">gatewayUsername</Property> </DataColumn> <DataColumn name="userName"> <Property name="property">userName</Property> </DataColumn> @@ -170,9 +192,6 @@ </DataColumn> <DataColumn name="exeTag"> <Property name="property">exeTag</Property> </DataColumn> <DataColumn name="deptId"> <Property name="property">deptId</Property> </DataColumn> </DataGrid> <Dialog id="dialogMain"> @@ -321,5 +340,40 @@ <Property name="service">gatewayConfService#pushData</Property> <Property name="confirmMessage">ç¡®å®è¦ä¸æ¥ä¹ï¼</Property> </AjaxAction> <Dialog id="dialogGrain"> <Property name="width">400</Property> <Property name="height">300</Property> <Property name="caption">éæ©æ¡ä»¶</Property> <Buttons> <Button> <ClientEvent name="onClick">var data = view.get("#dsQuery.data");
 view.get("#ajaxTestGrain").set("parameter",data.toJSON()).execute(function(result){
 self.get("parent").hide();
 $alert(result);
 });</ClientEvent> <Property name="caption">ç¡®å®æ§è¡</Property> </Button> <Button> <ClientEvent name="onClick">view.get("parent").hide();</ClientEvent> <Property name="caption">åæ¶æ§è¡</Property> </Button> </Buttons> <Children> <AutoForm> <Property name="dataSet">dsQuery</Property> <Property name="cols">*</Property> <AutoFormElement> <Property name="name">dayTime</Property> <Property name="property">dayTime</Property> <Editor/> </AutoFormElement> </AutoForm> </Children> <Tools/> </Dialog> <AjaxAction id="ajaxTestGrain"> <Property name="service">gatewayDeviceService#ajaxTestGrain</Property> <Property name="executingMessage">å¨åªåæ§è¡ä¸â¦â¦</Property> </AjaxAction> </View> </ViewConfig> src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml
@@ -16,8 +16,16 @@ </PropertyDef> <PropertyDef name="deviceName"> <Property></Property> <Property name="label">åç§°</Property> <Property name="label">设å¤åç§°</Property> <Property name="required">true</Property> </PropertyDef> <PropertyDef name="depotName"> <Property></Property> <Property name="label">ä»åºåç§°</Property> </PropertyDef> <PropertyDef name="depotId"> <Property></Property> <Property name="label">æå±ä»åºç¼ç </Property> </PropertyDef> <PropertyDef name="type"> <Property></Property> @@ -27,10 +35,6 @@ <Property name="valueProperty">name</Property> <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerGatewayDeviceType").getResult()}</Property> </Property> </PropertyDef> <PropertyDef name="depotId"> <Property></Property> <Property name="label">æå±ä»åºç¼ç </Property> </PropertyDef> <PropertyDef name="ip"> <Property></Property> @@ -45,7 +49,7 @@ <Property name="label">è§é¢RTSP</Property> </PropertyDef> <PropertyDef name="provinceProtocol"> <Property/> <Property></Property> <Property name="label">çå¹³å°åè®®</Property> <Property name="mapping"> <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerPushProtocol").getResult()}</Property> @@ -56,7 +60,7 @@ </PropertyDef> <PropertyDef name="pushProtocol"> <Property></Property> <Property name="label">ç³»ç»ç½å ³é讯åè®®</Property> <Property name="label">ä¸ç³»ç»é讯åè®®</Property> <Property name="mapping"> <Property name="mapValues">${dorado.getDataProvider("apiTriggerService#triggerGatewayProtocol").getResult()}</Property> <Property name="keyProperty">code</Property> @@ -66,7 +70,7 @@ </PropertyDef> <PropertyDef name="syncProtocol"> <Property></Property> <Property name="label">ç½å ³è®¾å¤é讯åè®®</Property> <Property name="label">ä¸è®¾å¤é讯åè®®</Property> <Property name="mapping"> <Property name="keyProperty">code</Property> <Property name="valueProperty">name</Property> @@ -95,16 +99,16 @@ <Property name="label">TCPæå¡ç«¯å£</Property> </PropertyDef> <PropertyDef name="userName"> <Property/> <Property></Property> <Property name="label">设å¤ç¨æ·å</Property> </PropertyDef> <PropertyDef name="password"> <Property/> <Property></Property> <Property name="label">设å¤å¯ç </Property> </PropertyDef> <PropertyDef name="depotName"> <PropertyDef name="depotIdSys"> <Property/> <Property name="label">æå±ä»åº</Property> <Property name="label">åºåºç³»ç»ä»åºç¼ç </Property> </PropertyDef> </DataType> </Model> @@ -176,15 +180,20 @@ </DataColumn> <DataColumn name="type"> <Property name="property">type</Property> <Property name="align">center</Property> </DataColumn> <DataColumn name="deviceId"> <Property name="property">deviceId</Property> <Property name="align">center</Property> <Property name="width">550</Property> </DataColumn> <DataColumn name="syncProtocol"> <Property name="property">syncProtocol</Property> <Property name="align">center</Property> </DataColumn> <DataColumn name="pushProtocol"> <Property name="property">pushProtocol</Property> </DataColumn> <DataColumn name="remark"> <Property name="property">remark</Property> <Property name="align">center</Property> </DataColumn> </DataGrid> <Dialog id="dialogMain"> @@ -278,13 +287,11 @@ <AutoFormElement> <Property name="name">pushProtocol</Property> <Property name="property">pushProtocol</Property> <Property name="labelWidth">150</Property> <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">syncProtocol</Property> <Property name="property">syncProtocol</Property> <Property name="labelWidth">150</Property> <Editor/> </AutoFormElement> <AutoFormElement> @@ -303,6 +310,11 @@ <Property name="property">httpUrl</Property> <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">depotIdSys</Property> <Property name="property">depotIdSys</Property> <Editor/> </AutoFormElement> <AutoFormElement layoutConstraint="colSpan:3"> <Property name="name">remark</Property> <Property name="property">remark</Property> src/main/resources/application-dev.yml
@@ -75,6 +75,31 @@ max-idle: 10 min-idle: 0 timeout: 6000 kafka: bootstrap-servers: 103.203.217.42:9092 security-protocol: SASL_PLAINTEXT sasl-mechanism: PLAIN sasl-jaas-config: org.apache.kafka.common.security.scram.ScramLoginModule required username=\"{username}\" password=\"{password}\";" sasl-username: sc001 sasl-password: wCV0ISwmoKwbx1lpBKMW producer: # producer ç产è retries: 0 # éè¯æ¬¡æ° acks: 1 # åºç级å«:å¤å°ä¸ªååºå¯æ¬å¤ä»½å®ææ¶åç产è åéack确认(å¯é0ã1ãall/-1) batch-size: 16384 # æ¹éå¤§å° buffer-memory: 33554432 # ç产端ç¼å²åºå¤§å° key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.apache.kafka.common.serialization.StringSerializer consumer: # consumeræ¶è´¹è group-id: fzzygroup # é»è®¤çæ¶è´¹ç»ID enable-auto-commit: true # æ¯å¦èªå¨æäº¤offset auto-commit-interval: 100 # æäº¤offsetå»¶æ¶(æ¥æ¶å°æ¶æ¯åå¤ä¹ æäº¤offset) # earliest:å½åååºä¸æå·²æäº¤çoffsetæ¶ï¼ä»æäº¤çoffsetå¼å§æ¶è´¹ï¼æ æäº¤çoffsetæ¶ï¼ä»å¤´å¼å§æ¶è´¹ # latest:å½åååºä¸æå·²æäº¤çoffsetæ¶ï¼ä»æäº¤çoffsetå¼å§æ¶è´¹ï¼æ æäº¤çoffsetæ¶ï¼æ¶è´¹æ°äº§çç该ååºä¸çæ°æ® # none:topicåååºé½åå¨å·²æäº¤çoffsetæ¶ï¼ä»offsetåå¼å§æ¶è´¹ï¼åªè¦æä¸ä¸ªååºä¸åå¨å·²æäº¤çoffsetï¼åæåºå¼å¸¸ auto-offset-reset: latest key-deserializer: org.apache.kafka.common.serialization.StringDeserializer value-deserializer: org.apache.kafka.common.serialization.StringDeserializer mqtt: host: tcp://10.13.4.84:11883