@Override public void process(VisitLog visitLog) { visitLog.setArea(IPSeeker.getInstance().getArea(visitLog.getIp())); visitLog.setCountry(IPSeeker.getInstance().getCountry(visitLog.getIp())); VisitLog origin = null; if (VisitTypeEnum.INDEX.value().equals(visitLog.getPage())) { origin = visitLogDao.getVisitedIndexLog(visitLog); } else { origin = visitLogDao.getVisitedProdLog(visitLog); } if (origin != null) { Integer num = origin.getVisitNum(); if (num == null) { num = 1; } else { num++; } origin.setVisitNum(num); origin.setDate(new Date()); visitLogDao.updateVisitLog(origin); } else { visitLog.setVisitNum(1); visitLogDao.save(visitLog); } }
/* * (non-Javadoc) * * @see * com.legendshop.business.service.VisitLogService#update(com.legendshop * .model.entity.VisitLog) */ @Override public void update(VisitLog visitLog) { visitLogDao.updateVisitLog(visitLog); }