| | |
| | | package com.dy.rtuMw.server.rtuData.p206V1_0_0; |
| | | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClient; |
| | | import com.dy.rtuMw.server.ServerProperties; |
| | | import com.dy.rtuMw.server.rtuData.TaskSurpport; |
| | | import com.dy.rtuMw.server.rtuData.dbSv.DbSv; |
| | | import com.dy.common.mw.protocol.Data; |
| | |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | | * @Date 2024/2/27 14:20 |
| | |
| | | public class TkDealWorkReport extends TaskSurpport { |
| | | |
| | | private static final Logger log = LogManager.getLogger(TkDealWorkReport.class.getName()) ; |
| | | |
| | | private static final Map<String, Integer> RtuReportTimes = new HashMap<>(); |
| | | |
| | | //类ID,一定与Tree.xml配置文件中配置一致 |
| | | public static final String taskId = "TkDealWorkReport" ; |
| | |
| | | DataV1_0_1 dV1_0_1 = (DataV1_0_1) d.getSubData();//前面任务已经判断不为null |
| | | Object cdObj = dV1_0_1.subData; |
| | | if (cdObj != null && cdObj instanceof DataCd84Vo) { |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | SeClient clientVo = (SeClient)objs[3] ;//这个值对象中只有id和name会有值 |
| | | try{ |
| | | this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; |
| | | }catch (Exception e){ |
| | | log.error("保存控制器阀开工作报时发生异常", e); |
| | | boolean deal = false ; |
| | | Integer times = RtuReportTimes.get(d.rtuAddr) ; |
| | | if(times == null){ |
| | | times = 1 ; |
| | | RtuReportTimes.put(d.rtuAddr, times) ; |
| | | deal = true ;//第一次 |
| | | }else{ |
| | | times++ ; |
| | | if(times > ServerProperties.workReportDealOneByTimes){ |
| | | times = 1 ;//循环第一次 |
| | | deal = true ; |
| | | } |
| | | RtuReportTimes.put(d.rtuAddr, times) ; |
| | | } |
| | | if(deal){ |
| | | Object[] objs = this.getTaskResults(TkPreGenObjs.taskId) ; |
| | | DbSv sv = (DbSv)objs[0] ; |
| | | PrController controller = (PrController)objs[1] ; |
| | | SeClient clientVo = (SeClient)objs[3] ;//这个值对象中只有id和name会有值 |
| | | try{ |
| | | this.doDeal(sv, clientVo, controller, d.getRtuAddr(), dV1_0_1, (DataCd84Vo)cdObj) ; |
| | | }catch (Exception e){ |
| | | log.error("保存控制器阀开工作报时发生异常", e); |
| | | } |
| | | } |
| | | } |
| | | } |