From 3dc2929d22a5f437fbee133df66aaff26a10d243 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 13 九月 2024 09:47:10 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPool.java | 40 ++++++++++++-------- pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml | 33 +++++++++++++++- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java | 17 ++++++++ pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpIoSessionCallback.java | 6 ++ 4 files changed, 76 insertions(+), 20 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPool.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPool.java index 32537ae..8c557e2 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPool.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPool.java @@ -14,12 +14,20 @@ * @return */ public Integer size() ; + /** + * 绾跨▼姹犱腑绾跨▼鏈�澶ч檺鍒朵釜鏁� + * @return + */ public Integer maxThread() ; + /** + * 绾跨▼姹犱腑绾跨▼鏈�灏忛檺鍒朵釜鏁� + * @return + */ public Integer minThread() ; /** - * 鎶婃墍瑕佹墽琛岀殑宸ヤ綔瀵硅薄瀹炰緥鏀惧叆绾跨▼姹犱腑 - * @param job ThreadJob 宸ヤ綔瀵硅薄瀹炰緥 - * @throws Exception + * 鎶婃墍瑕佹墽琛岀殑宸ヤ綔浠诲姟瀵硅薄瀹炰緥鏀惧叆绾跨▼姹犱腑 + * @param job ThreadJob 宸ヤ綔浠诲姟瀵硅薄瀹炰緥 + * @throws Exception */ public void putJob(Job job) throws Exception ; } @@ -31,18 +39,18 @@ */ public interface Job{ /** - * 绾跨▼姹犲伐浣滅被鐨勫洖璋冩柟娉曘�� + * 绾跨▼姹犵嚎绋嬫墽琛屾椂鐨勫洖璋冩柟娉曘�� * 娉ㄦ剰锛� * 1銆佽繖涓柟娉曞唴锛屽敖閲忎笉浣跨敤try catch璇彞锛屽鏋滅‘瀹為渶瑕佺敤锛� - * 瑕佷竴瀹氱敤try catch finnaly璇彞锛岃�屼笖finnaly鍐呬笉瑕� - * 鍐嶆湁鍙兘浜х敓寮傚父銆傚惁鍒欑嚎绋嬪緱涓嶅埌缁撴潫锛屼笉鑳藉洖褰掔┖闂茬嚎绋嬫睜銆� - * 2銆佸鏋滃湪鐭嚎绋嬫睜涓紝杩欎釜鏂规硶鍐呬笉鑳芥墽琛屾案寰幆宸ヤ綔锛屼緥濡傛湁while(true)杩欐牱 - * 鐨勫伐浣滀换鍔★紝鍚﹀垯鑷宠秴鏃舵椂闂达紝绯荤粺寮哄埗鍋滄姝ゅ伐浣溿�� - * 3銆佸鏋滃湪鐭嚎绋嬫睜涓紝杩欎釜鏂规硶鍐呭彧鑳芥墽琛岀煭鏃堕棿鍗虫垚瀹屾垚鐨勫伐浣滐紝宸ヤ綔瀹屾垚鍚庡嵆閫�鍑烘湰鏂规硶浣撱�� + * 瑕佷竴瀹氱敤try catch finnaly璇彞锛岃�屼笖finnaly鍐呬笉瑕佸啀鏈夊彲鑳戒骇鐢熷紓甯搞�� + * 鍚﹀垯绾跨▼寰椾笉鍒扮粨鏉燂紝涓嶈兘鍥炲綊绌洪棽绾跨▼姹犮�� + * 2銆佸鏋滃湪鐭嚎绋嬫睜涓紝杩欎釜鏂规硶鍐呬笉鑳芥墽琛屾案寰幆宸ヤ綔锛屼緥濡傛湁while(true)杩欐牱鐨勫伐浣滀换鍔★紝 + * 鍚﹀垯鑷宠秴鏃舵椂闂达紝绯荤粺寮哄埗鍋滄姝ゅ伐浣溿�� + * 3銆佸鏋滃湪鐭嚎绋嬫睜涓紝杩欎釜鏂规硶鍐呭彧鑳芥墽琛岀煭鏃堕棿鍗冲彲瀹屾垚鐨勫伐浣滐紝宸ヤ綔瀹屾垚鍚庡嵆閫�鍑烘湰鏂规硶浣撱�� * @throws Exception */ public void execute() throws Exception ; - + /** * 澶栭儴璋冪敤锛屽己鍒堕攢姣佸伐浣� * 涓昏搴旂敤锛� @@ -61,16 +69,16 @@ * public void destroy(){ * this.isDestroy = true ; * } - * - * 褰撶劧鏈墂hile(true){}姝诲惊鐜殑宸ヤ綔job涓�瀹氬湪闀跨嚎绋嬫睜涓伐浣滐紝濡傛灉鍦ㄧ煭绾跨▼姹犱腑宸ヤ綔锛岀嚎绋嬫睜鐩戞帶绾跨▼灏变細 + * + * 闇�瑕亀hile(true){}姝诲惊鐜殑宸ヤ綔job涓�瀹氬湪闀跨嚎绋嬫睜涓伐浣滐紝濡傛灉鍦ㄧ煭绾跨▼姹犱腑宸ヤ綔锛岀嚎绋嬫睜鐩戞帶绾跨▼灏变細 * 浠ュ繖纰岃秴鏃跺師鍥犳妸绾跨▼寮哄埗閿�姣侊紙绾跨▼姹犵洃鎺х嚎绋嬭皟鐢ㄥ伐浣滅嚎绋嬬殑destroy鏂规硶锛夛紝杩欓噷鐨勯攢姣佸疄闄呬笂閿�姣佷笉浜� - * 鐨勶紝鍙笉鎶婅绾跨▼娓呬簡绾跨▼姹狅紝杩欎釜绾跨▼浠嶇劧鏄椿鐫�鐨勶紝 绾跨▼閲岀殑job浠嶇劧琚墽琛岋紝鎵�浠ュ湪绾跨▼鐨刣estroy鏂规硶 - * 涓皟鐢ㄤ簡job.destroy()锛屼娇job鍋滄涓嬫潵锛岀嚎绋嬩篃鑷劧鎵ц瀹屾瘯鑰屽緱浠ュ仠姝紝浠ヤ笂鏄唬鐮侀�昏緫瀛樺湪while(true){} - * 姝诲惊鐜紝濡傛灉涓嶆槸浠g爜閫昏緫锛岃�屾槸绋嬪簭bug閫犳垚鐨勬寰幆锛屾垨绋嬪簭鎶涘嚭浜嗗紓甯镐笖鏈姄浣忓紓甯革紝杩欐椂鏃犺濡備綍涔熷仠姝� + * 绾跨▼锛岃繖涓嚎绋嬩粛鐒舵槸娲荤潃鐨勶紝 绾跨▼閲岀殑job浠嶇劧琚墽琛岋紝鎵�浠ュ湪绾跨▼鐨刣estroy鏂规硶涓皟鐢ㄤ簡job.destroy()锛� + * 浣縥ob鍋滄涓嬫潵锛岀嚎绋嬩篃鑷劧鎵ц瀹屾瘯鑰屽緱浠ュ仠姝紝浠ヤ笂鏄唬鐮侀�昏緫瀛樺湪while(true){}姝诲惊鐜紝 + * 濡傛灉涓嶆槸浠g爜閫昏緫锛岃�屾槸绋嬪簭bug閫犳垚鐨勬寰幆锛屾垨绋嬪簭鎶涘嚭浜嗗紓甯镐笖鏈崟鑾峰紓甯革紝杩欐椂鏃犺濡備綍涔熷仠姝� * 涓嶄簡宸ヤ綔job锛屼篃閿�姣佷笉浜嗚繖涓嚎绋嬬殑 */ public void destroy() ; - + /** * 鍒ゆ柇锛屽伐浣滄槸鍚﹁澶栭儴寮哄埗閿�姣侊紝閿�姣佸悗锛屾寔鏈夋湰job鐨勭嚎绋嬪氨鑳芥柦鏀惧洖褰� */ diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java index 81700c2..f4968aa 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClient.java @@ -50,4 +50,21 @@ * 寮�闃�娆℃暟 */ private Integer openCount; + + /** + * 鐢ㄦ按閲� + */ + private Double waterConsumption; + + /** + * 娑堣垂閲戦 + */ + private Double amountSpent; + + /** + * 鐢ㄦ按鏃堕暱 + */ + private Double waterDuration; + + } diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml index bff8b95..cb816f9 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml @@ -748,7 +748,16 @@ cli.clientNum, CONCAT(cli.districtTitle, cli.address) AS address, cli.phone, - cli.idCard + cli.idCard, + IFNULL((SELECT SUM(his.cl_this_amount) + FROM rm_open_close_valve_history his + <where> + his.client_id = cli.id + <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> + AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + ),0) AS waterConsumption FROM se_client cli <where> <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterConsumption != null"> @@ -786,7 +795,16 @@ cli.clientNum, CONCAT(cli.districtTitle, cli.address) AS address, cli.phone, - cli.idCard + cli.idCard, + IFNULL((SELECT SUM(his.cl_this_money) + FROM rm_open_close_valve_history his + <where> + his.client_id = cli.id + <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> + AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + ),0) AS amountSpent FROM se_client cli <where> <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and amountSpent != null"> @@ -825,7 +843,16 @@ cli.clientNum, CONCAT(cli.districtTitle, cli.address) AS address, cli.phone, - cli.idCard + cli.idCard, + IFNULL((SELECT SUM(his.cl_this_time) + FROM rm_open_close_valve_history his + <where> + his.client_id = cli.id + <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != ''"> + AND his.op_dt BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + ),0) AS waterDuration FROM se_client cli <where> <if test="timeStart != null and timeStart != '' and timeStop != null and timeStop != '' and waterDuration != null"> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpIoSessionCallback.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpIoSessionCallback.java index ef4a867..e123b4d 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpIoSessionCallback.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/forTcp/TcpIoSessionCallback.java @@ -18,6 +18,10 @@ */ public void sessionOpened(IoSession session) throws Exception { log.info("缃戠粶杩炴帴寤虹珛锛岀粓绔綉鍧�鏄細" + session.getRemoteAddress().toString()) ; + if(session != null) { + String rtuAddr = (String) session.getAttribute(TcpIoSessionAttrIdIsRtuAddr.sessionArrIdKey); + RtuLogDealer.log(rtuAddr, "缃戠粶鎺ュ叆"); + } } /** @@ -32,7 +36,7 @@ //璁板綍鐘舵�� RtuStatusDealer.offLine(rtuAddr); } - + RtuLogDealer.log(rtuAddr, "缃戠粶杩炴帴鍏抽棴"); log.info("缃戠粶杩炴帴鍏抽棴锛�" + (rtuAddr==null?"":("缁堢鍦板潃鏄細" + rtuAddr))) ; //+ (session==null?"":(session.getRemoteAddress() == null?"":(session.getRemoteAddress().toString()==null?"":("锛岀粓绔綉鍧�鏄細" + session.getRemoteAddress().toString()))))) ; -- Gitblit v1.8.0