Переглянути джерело

Fixed-error-null-expire-date

new-feature
Viet.LeQ2 1 рік тому
джерело
коміт
59986b0053
2 змінених файлів з 8 додано та 3 видалено
  1. BIN
      build/libs/smart-farm-0.0.1-SNAPSHOT.war
  2. +8
    -3
      src/main/java/vn/azteam/tpf/web/rest/TBCodeResource.java

BIN
build/libs/smart-farm-0.0.1-SNAPSHOT.war Переглянути файл


+ 8
- 3
src/main/java/vn/azteam/tpf/web/rest/TBCodeResource.java Переглянути файл

@@ -135,6 +135,10 @@ public class TBCodeResource {
throw new BadRequestAlertException("1047", ENTITY_NAME, "1047");
}

if (tBCodeCreationDTO.getExpiredDate() == null) {
throw new BadRequestAlertException("1047", ENTITY_NAME, "1047");
}

Optional<TBCropDTO> tbCropDTO = tBCropService.findOne(tBCodeCreationDTO.gettBCropId());
if (!tbCropDTO.isPresent()) {
throw new BadRequestAlertException("1019", ENTITY_NAME, "1019");
@@ -151,6 +155,7 @@ public class TBCodeResource {
tBCodeDTO.setCreatedDate(Instant.now());
tBCodeDTO.setCreatedById(currentUser.getUserId());
tBCodeDTO.setStatus(TBCodeStatusEnum.NEW);
tBCodeDTO.setExpiredDate(tBCodeCreationDTO.getExpiredDate());
if (tBCodeCreationDTO.getTbExampleStampId() != null) {
tBCodeDTO.setTbExampleStampId(tBCodeCreationDTO.getTbExampleStampId());
}
@@ -271,11 +276,11 @@ public class TBCodeResource {

Optional<TBCode> tbCode = tBCodeService.findByCode(activityCodeCreationDTO.getCode());

if(!tbCode.isPresent()) {
if (!tbCode.isPresent()) {
throw new BadRequestAlertException("1047", ENTITY_NAME, "1047");
} else {
if(tbCode.get().getStatus().equals(TBCodeStatusEnum.EXPIRED)
|| tbCode.get().getStatus().equals(TBCodeStatusEnum.CANCELED)) {
if (tbCode.get().getStatus().equals(TBCodeStatusEnum.EXPIRED)
|| tbCode.get().getStatus().equals(TBCodeStatusEnum.CANCELED)) {
throw new BadRequestAlertException("1047", "TB Code is not active", "1047");
}
}

Завантаження…
Відмінити
Зберегти