|
|
|
@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import vn.azteam.tpf.domain.TBCode; |
|
|
|
import vn.azteam.tpf.domain.TBCodeStatusEnum; |
|
|
|
import vn.azteam.tpf.repository.TBCodeRepository; |
|
|
|
import vn.azteam.tpf.repository.search.TBCodeSearchRepository; |
|
|
|
import vn.azteam.tpf.service.TBCodeService; |
|
|
|
@@ -82,6 +83,12 @@ public class TBCodeServiceImpl implements TBCodeService { |
|
|
|
tbCodeDTO.getId().toString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (TBCodeStatusEnum.CANCELED.equals(tbCodeOptional.get().getStatus()) || |
|
|
|
tbCodeOptional.get().getStatus().equals(TBCodeStatusEnum.EXPIRED)) { |
|
|
|
throw new BadRequestAlertException("Bad request, could not change status Canceled or Expired", "", |
|
|
|
tbCodeDTO.getId().toString()); |
|
|
|
} |
|
|
|
|
|
|
|
TBCode tbCode = tBCodeMapper.toEntity(tbCodeDTO); |
|
|
|
tbCode = tbCodeRepository.save(tbCode); |
|
|
|
return Optional.ofNullable(tBCodeMapper.toDto(tbCode)); |