@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#save(com.legendshop.model * .entity.VisitLog) */ @Override public Long save(VisitLog visitLog) { if (!AppUtils.isBlank(visitLog.getVisitId())) { update(visitLog); return visitLog.getVisitId(); } return (Long) visitLogDao.save(visitLog); }