admin/src/views/business/ywconditionermeter.vue
@@ -27,14 +27,20 @@ <el-table-column prop="dbName" label="çµè¡¨åç§°" min-width="130" align="center" show-overflow-tooltip /> <el-table-column prop="dbAdr" label="表å°å" min-width="120" align="center" show-overflow-tooltip /> <el-table-column prop="wgMac" label="ç½å ³MAC" min-width="140" align="center" show-overflow-tooltip /> <el-table-column label="å¤èæºMAC" min-width="180" align="center" show-overflow-tooltip> <template slot-scope="{ row }">{{ formatNum(row.dljMac) }}</template> </el-table-column> <el-table-column label="æ³¢ç¹ç" min-width="80" align="center"> <template slot-scope="{ row }">{{ formatNum(row.btl) }}</template> </el-table-column> <el-table-column label="æ¯å¦æ ¡éª" min-width="100" align="center"> <template slot-scope="{ row }">{{ formatJy(row.jy) }}</template> </el-table-column> <el-table-column prop="dbBb" label="忝" min-width="80" align="center" /> <el-table-column prop="xyName" label="åè®®" min-width="100" align="center" show-overflow-tooltip /> <el-table-column prop="standbyShare" label="å¾ æºåæ" min-width="100" align="center" show-overflow-tooltip /> <el-table-column prop="outdoorLoop" label="夿ºåè·¯" min-width="90" align="center" /> <el-table-column label="åç(kW)" min-width="100" align="center"> <template slot-scope="{ row }">{{ formatNum(row.powerKw) }}</template> </el-table-column> <el-table-column label="累计çµé" min-width="110" align="center"> <el-table-column label="累计çµè½" min-width="110" align="center"> <template slot-scope="{ row }">{{ formatNum(row.totalDl) }}</template> </el-table-column> <el-table-column label="æä½" min-width="160" align="center" fixed="right"> @@ -122,6 +128,10 @@ if (val === null || val === undefined || val === '') return '-' return val }, formatJy (val) { if (val === null || val === undefined || val === '') return '-' return Number(val) === 1 ? '1-æ ¡éª' : '0-æ æ ¡éª' }, handleSync () { this.$dialog.actionConfirm('ç¡®è®¤ä»æºç²¾çµå¹³å°åæ¥å ¨é¨çµè¡¨åï¼', '忥çµè¡¨') .then(() => { @@ -141,8 +151,8 @@ this.operateType = 'energy' meterApi.queryEnergy(row.id) .then(res => { this.$tip.apiSuccess(res || 'æ¥çµé请æ±å·²æäº¤') this.handlePageChange() this.$tip.apiSuccess(res || 'æ¥çµéæå') this.search() }) .catch(e => this.$tip.apiFailed(e)) .finally(() => { @@ -155,8 +165,8 @@ this.operateType = 'power' meterApi.queryPower(row.id) .then(res => { this.$tip.apiSuccess(res || 'æ¥åç请æ±å·²æäº¤') this.handlePageChange() this.$tip.apiSuccess(res || 'æ¥åçæå') this.search() }) .catch(e => this.$tip.apiFailed(e)) .finally(() => { server/db/business.yw_conditioner_meter.dlj_mac.sql
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ -- 空è°çµè¡¨ï¼å¤èæº MACãæ³¢ç¹çãæ ¡éªä½ SET @db := DATABASE(); SET @sql := IF( (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yw_conditioner_meter' AND COLUMN_NAME = 'dlj_mac') = 0, 'ALTER TABLE `yw_conditioner_meter` ADD COLUMN `dlj_mac` varchar(64) DEFAULT NULL COMMENT ''å¤èæºMAC'' AFTER `xy_name`', 'SELECT 1' ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @sql := IF( (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yw_conditioner_meter' AND COLUMN_NAME = 'btl') = 0, 'ALTER TABLE `yw_conditioner_meter` ADD COLUMN `btl` int DEFAULT NULL COMMENT ''æ³¢ç¹ç'' AFTER `dlj_mac`', 'SELECT 1' ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET @sql := IF( (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'yw_conditioner_meter' AND COLUMN_NAME = 'jy') = 0, 'ALTER TABLE `yw_conditioner_meter` ADD COLUMN `jy` int DEFAULT NULL COMMENT ''æ¯å¦æ ¡éª 0æ æ ¡éª 1æ ¡éª'' AFTER `btl`', 'SELECT 1' ); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; server/db/yw_conditioner_module.sql
@@ -53,6 +53,9 @@ `wg_id` int DEFAULT NULL, `xy_id` int DEFAULT NULL, `xy_name` varchar(128) DEFAULT NULL, `dlj_mac` varchar(64) DEFAULT NULL COMMENT 'å¤èæºMAC', `btl` int DEFAULT NULL COMMENT 'æ³¢ç¹ç', `jy` int DEFAULT NULL COMMENT 'æ¯å¦æ ¡éª 0æ æ ¡éª 1æ ¡éª', `db_bb` int DEFAULT NULL COMMENT '忝', `standby_share` varchar(32) DEFAULT NULL COMMENT 'å¾ æºåæ', `outdoor_loop` int DEFAULT NULL COMMENT '夿ºåè·¯å·', server/system_timer/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: dev active: pro application: name: systemTimer # å®å ¨é ç½® server/visits/admin_timer/src/main/java/com/doumee/api/InterfaceLogTimerController.java
@@ -31,5 +31,4 @@ return ApiResponse.success("å¼å¯å®æ¶æ¥å£æ¥å¿æ¸ çæå"); } } server/visits/admin_timer/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: dev active: pro application: name: visitsTimer # å®å ¨é ç½® server/visits/dmvisit_admin/src/main/resources/bootstrap.yml
@@ -1,6 +1,6 @@ spring: profiles: active: dev active: pro application: name: visitsAdmin # å®å ¨é ç½® server/visits/dmvisit_service/src/main/java/com/doumee/core/conditoner/model/response/MeterDbInfoResponse.java
@@ -13,6 +13,9 @@ private Integer wg_id; private String xy_name; private Integer xy_id; private String dlj_mac; private Integer btl; private Integer jy; private String db_adr; private String db_name; private Integer db_bb; server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwConditionerMeter.java
@@ -36,6 +36,12 @@ private Integer wgId; private Integer xyId; private String xyName; @ApiModelProperty("å¤èæºMAC") private String dljMac; @ApiModelProperty("æ³¢ç¹ç") private Integer btl; @ApiModelProperty("æ¯å¦æ ¡éª 0æ æ ¡éª 1æ ¡éª") private Integer jy; @ApiModelProperty("忝") private Integer dbBb; @ApiModelProperty("å¾ æºåæ") server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/ConditionerBizServiceImpl.java
@@ -524,23 +524,8 @@ if (!ok) { throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), apiMsg(resp, "æ¥è¯¢å¤±è´¥")); } if (ACTION_QUERY_DL == actionType && resp.getData() != null) { try { BigDecimal dl = new BigDecimal(String.valueOf(resp.getData())); meter.setTotalDl(dl); } catch (Exception ignored) { } } if (ACTION_QUERY_POWER == actionType && resp.getData() != null) { try { BigDecimal kw = new BigDecimal(String.valueOf(resp.getData())); meter.setPowerKw(kw); } catch (Exception ignored) { } } meter.setLastSyncDate(new Date()); meterMapper.updateById(meter); return "æ¥è¯¢æå"; String syncMsg = syncMeters(); return "æ¥è¯¢æåï¼" + syncMsg; } @Override @@ -772,6 +757,9 @@ if (StringUtils.isBlank(meter.getXyName())) { throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "çµè¡¨å议为空ï¼è¯·å 忥çµè¡¨"); } if (StringUtils.isBlank(meter.getDljMac())) { throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "å¤èæºMAC为空ï¼è¯·å 忥çµè¡¨"); } DevControlRequest req = new DevControlRequest(); req.fillSessionDefaults(); req.setWg_mac(meter.getWgMac()); @@ -781,6 +769,9 @@ JSONObject setVal = new JSONObject(); setVal.put("db_bb", meter.getDbBb() != null ? meter.getDbBb() : 1); setVal.put("xy_name", meter.getXyName()); setVal.put("dlj_mac", meter.getDljMac()); setVal.put("btl", meter.getBtl() != null ? meter.getBtl() : 4); setVal.put("jy", meter.getJy() != null ? meter.getJy() : 0); req.setSet_val(setVal); return req; } @@ -837,16 +828,60 @@ local.setWgId(item.getWg_id()); local.setXyId(item.getXy_id()); local.setXyName(item.getXy_name()); local.setDljMac(item.getDlj_mac()); local.setBtl(item.getBtl()); local.setJy(item.getJy()); local.setDbBb(item.getDb_bb()); local.setOutdoorLoop(item.getDb_rhd()); local.setDbUptime(item.getDb_uptime()); if (item.getDb_data() != null) { local.setDbData(JSON.toJSONString(item.getDb_data())); BigDecimal energy = parseDbDataEnergy(item.getDb_data()); if (energy != null) { local.setTotalDl(energy); } } local.setLastSyncDate(now); local.setEditDate(now); } private BigDecimal parseDbDataEnergy(Object dbData) { if (dbData == null) { return null; } if (dbData instanceof Number) { return new BigDecimal(dbData.toString()); } if (dbData instanceof String) { String text = ((String) dbData).trim(); if (StringUtils.isBlank(text)) { return null; } try { return new BigDecimal(text); } catch (Exception ignored) { try { return parseDbDataEnergy(JSON.parse(text)); } catch (Exception ignored2) { return null; } } } if (dbData instanceof JSONObject) { JSONObject obj = (JSONObject) dbData; for (String key : Arrays.asList("dl", "dn", "total_dl", "totalDl", "db_data", "energy")) { if (obj.containsKey(key) && obj.get(key) != null) { return parseDbDataEnergy(obj.get(key)); } } return null; } if (dbData instanceof Map) { return parseDbDataEnergy(new JSONObject((Map<String, Object>) dbData)); } return null; } private void fillConditionerFromStatus(YwConditioner local, DeviceStatusResponse item, DeviceArchiveResponse archive, Date now) { local.setPlatformDevId(item.getDev_id());