src/main/java/com/fzzy/api/Constant.java
@@ -325,7 +325,7 @@ public static ApiCommonDevice getCommonDeviceCache(String sn) { if (null == sn) return null; log.info("å¨çº¿è®¾å¤ï¼" + JSON.toJSONString(contextDeviceMap)); //log.info("å¨çº¿è®¾å¤ï¼" + JSON.toJSONString(contextDeviceMap)); return contextDeviceMap.get(sn); } @@ -333,7 +333,7 @@ if (null == ip) return null; if (contextDeviceMap.isEmpty()) return null; log.info("å¨çº¿è®¾å¤ï¼" + JSON.toJSONString(contextDeviceMap)); //log.info("å¨çº¿è®¾å¤ï¼" + JSON.toJSONString(contextDeviceMap)); for (ApiCommonDevice device : contextDeviceMap.values()) { if (ip.equals(device.getIp())) return device; } src/main/java/com/fzzy/gateway/entity/GatewayDevice.java
@@ -153,4 +153,8 @@ @PropertyDef(label = "夿³¨", description = "夿³¨ä¿¡æ¯") private String remark; @Column(name = "BH_ID_", length = 50) @PropertyDef(label = "åæºå é¨ä»åºç¼ç ") private String bhId; } src/main/java/com/fzzy/gateway/hx2023/data/GrainData.java
@@ -28,4 +28,5 @@ private JSONObject properties; } src/main/java/com/fzzy/gateway/hx2023/data/GrainOutPut.java
@@ -39,5 +39,8 @@ private List<GrainTemp> temperature; private String liquidHeight = "0.0"; private String detectTime ; } src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml
@@ -150,13 +150,17 @@ <Property name="label">çµç¼ç±»å</Property> </PropertyDef> <PropertyDef name="depotType"> <Property/> <Property></Property> <Property name="label">ä»åºç±»å</Property> <Property name="mapping"> <Property name="mapValues">${dorado.getDataProvider("apiTriggerPR#listDepotType").getResult()}</Property> <Property name="keyProperty">code</Property> <Property name="valueProperty">name</Property> </Property> </PropertyDef> <PropertyDef name="bhId"> <Property></Property> <Property name="label">åæºå é¨ä»åºç¼ç </Property> </PropertyDef> </DataType> <DataType name="dtParam" parent="Map"> @@ -449,7 +453,12 @@ <Property name="property">position</Property> <Editor/> </AutoFormElement> <AutoFormElement layoutConstraint="colSpan:2"> <AutoFormElement> <Property name="name">bhId</Property> <Property name="property">bhId</Property> <Editor/> </AutoFormElement> <AutoFormElement layoutConstraint="colSpan:1"> <Property name="name">remark</Property> <Property name="property">remark</Property> <Editor/> src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java
@@ -125,7 +125,7 @@ //è·å请æ±ä¿¡æ¯ BaseReqData reqData = ProtocolUtils.getSyncReq(gatewayDevice.getDepotIdSys()); BaseReqData reqData = ProtocolUtils.getSyncReq(gatewayDevice.getDeviceSn()); if (null == reqData) { replayGrain(message); log.error("主æº-------->>å¹³å°ï¼è§£æç²®æ å¤±è´¥ï¼æªè·åå°ç²®æ 请æ±ä¿¡æ¯ï¼" + message.getAddr()); @@ -350,18 +350,46 @@ JSONObject properties = new JSONObject(); properties.put("data", outPut); properties.put("timestamp", grain.getTimestamp()); properties.put("timestamp", grain.getTimestamp()); outPut.setDetectTime( grain.getTimestamp()); String height = this.getCacheHeight(device); if (StringUtils.isEmpty(height)) height = "0.0"; properties.put("liquidHeight", height); grain.setProperties(properties); outPut.setLiquidHeight(height); grain.setOutput(JSONObject.toJSONString(outPut)); properties.put("output", outPut); GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode()); //ç³»ç»æ°è±¡ç«ä¿¡æ¯ WeatherWebDto weather = WeatherWebDto.contextMap.get("default"); //æ°è±¡ä¿¡æ¯ GrainWeather weatherStation = new GrainWeather(); weatherStation.setMessageId(ScConstant.getMessageId()); weatherStation.setMessgeId(weatherStation.getMessageId()); if (null != gatewayDeviceWeather) { weatherStation.setId(gatewayDeviceWeather.getDeviceId()); } else { weatherStation.setId(device.getDeviceId()); } weatherStation.setAirPressure(weather.getPressure()); weatherStation.setHumidity(weather.getHumidity()); weatherStation.setPm(weather.getAir_pm25()); weatherStation.setRadiation("0"); weatherStation.setRainfallAmount(weather.getWea()); weatherStation.setTemperature(weather.getTem()); weatherStation.setWindDirection(weather.getWin()); weatherStation.setWindPower(weather.getWin_meter()); weatherStation.setWindSpeed(weather.getWin_speed()); grain.setWeatherStation(JSONObject.toJSONString(weatherStation)); //å°è£ å¥½çæ°æ® log.info("---æ²¹ç½ä»ä¿¡æ¯å°è£ 宿----å¼å§æ§è¡æ¨é"); grain.setProperties(properties); reqData.setData(JSONObject.toJSONString(grain)); doPushGrain(reqData); @@ -375,8 +403,17 @@ */ private String getCacheHeight(GatewayDevice device) { //ç»å ¶ä»è½¯ä½¿ç¨ String key = RedisConst.KEY_DEPOT_HEIGHT + ":" + configData.getCompanyId() + "_" + device.getDepotIdSys(); return (String) redisUtil.get(key); //igds:5012:DEPOT_HEIGHT:0134 String key = "igds:"+ device.getOrgId() + ":" + RedisConst.KEY_DEPOT_HEIGHT+ ":" + device.getDepotIdSys(); com.ld.igds.grain.dto.GrainData ht = (com.ld.igds.grain.dto.GrainData) redisUtil.get(key); log.info("KEY="+key); if(ht!=null){ log.info("VALUE="+ht.getOilHeight()); return ht.getOilHeight() ; }else { return "0.0"; } } src/main/java/com/fzzy/protocol/bhzn/service/Bhzn2GatewayGrainService.java
@@ -58,10 +58,10 @@ try { //Step 请æ±ä¿¡æ¯æ¾å ¥å å ProtocolUtils.addSyncReq2Map(device.getDepotIdSys(), reqData); ProtocolUtils.addSyncReq2Map(device.getDeviceSn(), reqData); // çæç²®æ ä¿¡æ¯ String hexStr = CommandBuild.getInstance().getMsgCheck(device.getDeviceSn(), device.getDepotIdSys()); String hexStr = CommandBuild.getInstance().getMsgCheck(device.getDeviceSn(), device.getBhId()); // åéå½ä»¤ InvokeResult message = BhznGrainV2ServerEngine.push(device.getIp(), device.getPort(), BytesUtil.hexStrToBytes(hexStr)); src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java
@@ -36,10 +36,11 @@ public void analysis1001(ReMessage reMessage) { //è·åå°ç»éä¿¡æ¯ï¼æ§è¡è®¾å¤ä¿¡æ¯æ´ç ApiCommonDevice device = Constant.getCommonDeviceCache(reMessage.getSn()); if (null == device) { device = new ApiCommonDevice(); GatewayDevice d = GatewayUtils.getCacheByDeviceSn(reMessage.getSn()); if (null == d) { d = new GatewayDevice(); } ApiCommonDevice device = new ApiCommonDevice(); device.setIp(reMessage.getIp()); device.setPort(reMessage.getPort()); device.setSn(reMessage.getSn()); src/main/java/com/fzzy/protocol/fzzy/service/FzzyGatewayGrainService.java
@@ -36,8 +36,7 @@ GatewayDevice device = reqData.getDevice(); //è·åè¿æ¥ä¸ç设å¤ä¿¡æ¯ ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCache(device.getIp()); ApiCommonDevice apiCommonDevice = Constant.getCommonDeviceCacheBySn(device.getDeviceSn()); if (null == apiCommonDevice) { resp.setCode(500); resp.setMsg("ç³»ç»æªè·åå°ä¸è¡è¿æ¥è®¾å¤ä¿¡æ¯ï¼æ æ³æ§è¡"); src/main/java/com/ld/igds/grain/dto/GrainData.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,111 @@ package com.ld.igds.grain.dto; import com.bstek.dorado.annotation.PropertyDef; import com.fasterxml.jackson.annotation.JsonFormat; import com.ld.igds.models.Depot; import com.ld.igds.models.MQuality; import lombok.Data; import javax.persistence.Transient; import java.io.Serializable; import java.util.Date; import java.util.List; /** * ç¨äºå°è£ çç²®æ ä¿¡æ¯ï¼æ¯æ¬¡è·åç²®æ æ°æ®ï¼å°è£ 为å½å对象 * * @author jiazx */ @Data public class GrainData implements Serializable { /** * */ private static final long serialVersionUID = 1L; @PropertyDef(label = "æ¹æ¬¡ç¼å·") private String batchId; @PropertyDef(label = "ç»ç»ç¼ç ", description = "") private String companyId; @PropertyDef(label = "æå±ä»åº", description = "ä»åºç¼å·") private String depotId; @PropertyDef(label = "æä½æ¸©ç²®æ¸©", description = "åä½âï¼ç²®æ æä½æ¸©") private Double tempMin = 0.0; @PropertyDef(label = "æé«ç²®æ¸©", description = "åä½âï¼ç²®æ æé«æ¸©") private Double tempMax = 0.0; @PropertyDef(label = "å¹³å粮温", description = "åä½âï¼ç²®æ 平忏©åº¦") private Double tempAve = 0.0; @PropertyDef(label = "ä»å 湿度") private Double humidityIn; @PropertyDef(label = "ä»å 温度") private Double tempIn; @PropertyDef(label = "ä»å 湿度") private Double humidityOut; @PropertyDef(label = "ä»å¤æ¸©åº¦") private Double tempOut; @PropertyDef(label = "å±è¡å", description = "ç¨-éå¼çé 置信æ¯") private String cable; @PropertyDef(label = "çä»å±é ç½®", description = "ç¨-éå¼çé 置信æ¯") private String cableCir; @PropertyDef(label = "æ²¹é¢é«åº¦",description = "ç¨-éå¼ç两个å¼ï¼æ²¹é¢é«åº¦-建çé«åº¦") private String oilHeight; @PropertyDef(label = "天æ°", description = "ç´æ¥å¡«åä¸æä¿¡æ¯ï¼æ´ï¼é´é¨å¤©") private String weather = "#"; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") @PropertyDef(label = "æ¥æ¶æ¶é´") private Date receiveDate; @PropertyDef(label = "æ£æµäºº") private String checkUser; @PropertyDef(label = "夿³¨") private String remark; @PropertyDef(label = "ééç¹ä¿¡æ¯", description = "ç¨éå·éå¼ç温度信æ¯ä¿¡æ¯") private String points; @PropertyDef(label = "å个ééç¹çä¿¡æ¯", description = "å ³ç³»åæ®µ") private List<GrainPoint> listPoints; @PropertyDef(label = "åå±ç²®æ¸©", description = "å ³ç³»åæ®µ") private List<GrainLay> listLays; @PropertyDef(label = "åè¡æ¸©åº¦", description = "å ³ç³»åæ®µ") private List<GrainRow> listRows; @PropertyDef(label = "仿¿ä¿¡æ¯", description = "å ³ç³»åæ®µ") private Depot depotData; @PropertyDef(label = "åéªä¿¡æ¯", description = "å ³ç³»åæ®µ") private MQuality mquality; @PropertyDef(label = "ç³»ç»æ¶é´", description = "å ³ç³»åæ®µ") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8") private Date sysDate = new Date(); @PropertyDef(label = "建çé«åº¦") private String depotHeight; @PropertyDef(label = "æ£æµå¨é", description = "åä½KG") private Double storage; @Transient @PropertyDef(label = "å½åä»iot设å¤çæ¸©æ¹¿åº¦æ°æ®") private List<GrainIotData> grainIotData; } src/main/java/com/ld/igds/grain/dto/GrainIotData.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,57 @@ package com.ld.igds.grain.dto; import lombok.Data; import java.io.Serializable; /** * ç¨äºå°è£ æåç²®æ¸©æ¹¿åº¦ä¿¡æ¯ * * @author chen */ @Data public class GrainIotData implements Serializable { /** * */ private static final long serialVersionUID = 1L; /** * ç»ç»ç¼ç */ private String companyId; /** * ä»åºç¼ç */ private String depotId; /** * 设å¤ç¼ç */ private String deviceId; /** * 设å¤åç§° */ private String name; /** * æ¶é´ */ private String time; /** * 温度 */ private Double temp = 0.0; /** * 湿度 */ private Double hum = 0.0; /** * 夿¸© */ private Double outTemp = 0.0; /** * 夿¹¿ */ private Double outHum = 0.0; } src/main/java/com/ld/igds/grain/dto/GrainLay.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,56 @@ package com.ld.igds.grain.dto; import com.bstek.dorado.annotation.PropertyDef; import lombok.Data; /** * ç²®æ æ°æ®è§£æå¯¹è±¡-å±ä¿¡æ¯ */ @Data public class GrainLay { @PropertyDef(label = "æå¨å±") private int fz; @PropertyDef(label = "æå¨å±") private int z; @PropertyDef(label = "屿使¸©") private Double tempMin; @PropertyDef(label = "屿髿¸©") private Double tempMax; @PropertyDef(label = "å±å¹³å温") private Double tempAve = 0.0; @PropertyDef(label = "å å平忏©åº¦", description = "åä½âï¼ç²®æ 平忏©åº¦") private Double tempAveIn = 0.0; @PropertyDef(label = "å¤å平忏©åº¦", description = "åä½âï¼ç²®æ 平忏©åº¦") private Double tempAveOut = 0.0; private int sumNum;//å½å屿»æ° private int sumInNum;//å åä¸ªæ° private int sumOutNum;//å¤åä¸ªæ° private double sumTemp;//屿»æ¸©åº¦ private double sumInTemp; private double sumOutTemp; public GrainLay() { super(); } public GrainLay(int fz,int z) { super(); this.fz = fz; this.z = z; } } src/main/java/com/ld/igds/grain/dto/GrainPoint.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ package com.ld.igds.grain.dto; import com.bstek.dorado.annotation.PropertyDef; import lombok.Data; /** * ç²®æ æ°æ®è§£æå¯¹è±¡-ééç¹å¯¹è±¡ä¿¡æ¯ï¼XYZ表示çåè¡å±ï¼æ°å¼ä»1å¼å§ã * */ @Data public class GrainPoint { @PropertyDef(label = "æå¨å±") private int z; @PropertyDef(label = "æå¨å±") private int fz; @PropertyDef(label = "æå¨åï¼ç仿å¨åæ°") private int x; @PropertyDef(label = "æå¨è¡ï¼ç仿 ¹å·ï¼æ»æ ¹å·") private int y; @PropertyDef(label = "ééç¹æ¸©åº¦") private Double temp = 0.0; public GrainPoint() { super(); } public GrainPoint(Double temp,int x, int y, int z, int fz) { super(); this.z = z; this.x = x; this.y = y; this.fz = fz; this.temp = temp; } } src/main/java/com/ld/igds/grain/dto/GrainRow.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,36 @@ package com.ld.igds.grain.dto; import com.bstek.dorado.annotation.PropertyDef; import lombok.Data; /** * ç²®æ æ°æ®è§£æå¯¹è±¡-åä¿¡æ¯ */ @Data public class GrainRow { @PropertyDef(label = "æå¨è¡", description = "æ°æ®ä»0å¼å§ï¼å¦ææ¯çä»çè¯ï¼ç¨äºè®°å½çä»çæ ¹æ°") private int y; @PropertyDef(label = "屿使¸©") private Double tempMin; @PropertyDef(label = "屿髿¸©") private Double tempMax; @PropertyDef(label = "å±å¹³å温") private Double tempAve = 0.0; private int sumNum;// å½å屿»æ° private double sumTemp;// 屿»æ¸©åº¦ public GrainRow() { super(); } public GrainRow(int y) { super(); this.y = y; } } src/main/java/com/ld/igds/models/Depot.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,89 @@ package com.ld.igds.models; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @Desc: åºç¡ä¿¡æ¯-è´§ä½ä¿¡æ¯ * @author: Andy * @update-time: 2023/5/26 */ @Data public class Depot implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String id; private String companyId; private String deptId; private String ggm; private String name; private String buildingId; private String granaryId; private String depotType; private String depotStatus; private String storeType; private Double storageMax; private Double storageReal; private String foodType; private String foodVariety; private String foodLevel; private String foodLocation; private String foodYear; private Double perWet; private Double perImpurity; private Double bulkWeight; private String storeKeeper; private String storeKeeperName; private Date storeDate; private Date checkDate; private String remark; private Date updateTime; private String bhId; // ------------å ¶ä»å±æ§ä¿¡æ¯------------// private String foodVarietyName; private String foodTypeName; private String depotTypeName; private String depotStatusName; private String foodLevelName; private Double posX; private Double posY; } src/main/java/com/ld/igds/models/MQuality.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,59 @@ package com.ld.igds.models; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * è´¨é管çï¼2023å¹´5æ26æ¥ æ ¹æ®æ°å½ç²®è§ä¼åè°æ´ * * @author chen */ @Data public class MQuality implements Serializable { private static final long serialVersionUID = 1L; private String id; private String companyId; private String deptId; private String depotId; private String foodVariety; private String foodLevel; private Date storeDate; private String type; private Date time; private String unit; private String user; private String standard; private String zblb; private String result; private String spaqzbsfhg; private Date qfrq; private Date bgcjsj; private String shrxm; private String qydbh; private Date checkTime; private String checkArea; private String checkUser; private String jdrxm; private String ypbh; private Double ypsl; private Double dbsl; private String ypdj; private String normalYear; private String remark; private Date updateTime; }