List<MaintainLog> logs = maintainLogDAO.findAll();
if(logs==null||logs.size()==0)//维护记录为空
{
//第一次维护,则维护计量点;是否需要先清除所有计量点
maitainWiccMeasurePoints();
MaintainLog log = new MaintainLog();
log.setId(MyUUIDGen.getUUID());
log.setChangeTime(WinccUtility.getupdateTime(jdbcTemplate));
Timestamp date = new Timestamp(new Date().getTime());
log.setCurrentUpdate(date);
log.setLastUpdate(date);
maintainLogDAO.merge(log);
}
else//维护记录不为空
{
MaintainLog log = logs.get(0);
Timestamp userTableUpdate = WinccUtility.getupdateTime(jdbcTemplate);
Timestamp currentUpdate = log.getCurrentUpdate();
if(currentUpdate.getTime()<userTableUpdate.getTime())//有更新
{
maitainWiccMeasurePoints();
log.setChangeTime(userTableUpdate);
log.setCurrentUpdate(new Timestamp(new Date().getTime()));
log.setLastUpdate(currentUpdate);
maintainLogDAO.merge(log);
}
else
{
//无更新,不作任何处理