View as "text/plain" | Blame | Last modification | View Log | RSS feed
package com.spice.profitmandi.service.user;import java.time.LocalDate;import java.time.LocalDateTime;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;import com.spice.profitmandi.dao.entity.dtr.PunchInOut;import com.spice.profitmandi.dao.repository.dtr.PunchInOutRepository;@Componentpublic class PunchInOutServiceImpl implements PunchInOutService {@Autowiredprivate PunchInOutRepository punchInOutRepository;@Overridepublic void punchInOut(int fofoId) throws ProfitMandiBusinessException {PunchInOut punchInOut = null;try {punchInOut = punchInOutRepository.selectByFofoIdAndCreateDate(fofoId, LocalDate.now());}catch(ProfitMandiBusinessException profitMandiBusinessException) {}if(punchInOut == null) {punchInOut = new PunchInOut();punchInOut.setFofoId(fofoId);punchInOut.setPunchInTimestamp(LocalDateTime.now());}else {punchInOut.setPunchOutTimestamp(LocalDateTime.now());}punchInOutRepository.persist(punchInOut);}}