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 ; * } * * 当然有while(true){}死循环的工作job一定在长线程池中工作,如果在短线程池中工作,线程池监控线程就会 * * 需要while(true){}死循环的工作job一定在长线程池中工作,如果在短线程池中工作,线程池监控线程就会 * 以忙碌超时原因把线程强制销毁(线程池监控线程调用工作线程的destroy方法),这里的销毁实际上销毁不了 * 的,只不把该线程清了线程池,这个线程仍然是活着的, 线程里的job仍然被执行,所以在线程的destroy方法 * 中调用了job.destroy(),使job停止下来,线程也自然执行完毕而得以停止,以上是代码逻辑存在while(true){} * 死循环,如果不是代码逻辑,而是程序bug造成的死循环,或程序抛出了异常且未抓住异常,这时无论如何也停止 * 线程,这个线程仍然是活着的, 线程里的job仍然被执行,所以在线程的destroy方法中调用了job.destroy(), * 使job停止下来,线程也自然执行完毕而得以停止,以上是代码逻辑存在while(true){}死循环, * 如果不是代码逻辑,而是程序bug造成的死循环,或程序抛出了异常且未捕获异常,这时无论如何也停止 * 不了工作job,也销毁不了这个线程的 */ public void destroy() ; /** * 判断,工作是否被外部强制销毁,销毁后,持有本job的线程就能施放回归 */ 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; } 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"> 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()))))) ;