|
@@ -1,8 +1,6 @@
|
|
|
package com.its.op.service.its.facility;
|
|
|
|
|
|
import com.its.op.dao.repository.its.code.TbCmmnCdRepository;
|
|
|
-import com.its.op.dao.repository.its.facility.TbFcltFailHsRepository;
|
|
|
-import com.its.op.dao.repository.its.facility.TbFcltFailRparHsRepository;
|
|
|
import com.its.op.dto.its.facility.FcltFailTypeDto;
|
|
|
import com.its.op.dto.its.facility.TbFcltFailHsDto;
|
|
|
import com.its.op.entity.its.code.TbCmmnCd;
|
|
@@ -17,26 +15,26 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.NoSuchElementException;
|
|
|
-import java.util.Optional;
|
|
|
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
public class TbFcltFailHsService {
|
|
|
|
|
|
- private final TbFcltFailHsRepository repo;
|
|
|
- private final TbFcltFailRparHsRepository rparHsRepo;
|
|
|
+// private final TbFcltFailHsRepository repo;
|
|
|
+// private final TbFcltFailRparHsRepository rparHsRepo;
|
|
|
private final TbCmmnCdRepository cmmnCdRepo;
|
|
|
|
|
|
// 데이터 1건 조회, 없으면 exception
|
|
|
private TbFcltFailHs requireOne(String id) throws NoSuchElementException {
|
|
|
- Optional<TbFcltFailHs> info = this.repo.findById(id);
|
|
|
- if (info.isPresent()) {
|
|
|
- return info.get();
|
|
|
- }
|
|
|
- else {
|
|
|
- throw new NoSuchElementException("데이터가 존재하지 않습니다: " + id);
|
|
|
- }
|
|
|
+ return null;
|
|
|
+// Optional<TbFcltFailHs> info = this.repo.findById(id);
|
|
|
+// if (info.isPresent()) {
|
|
|
+// return info.get();
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// throw new NoSuchElementException("데이터가 존재하지 않습니다: " + id);
|
|
|
+// }
|
|
|
// return repo.findById(id)
|
|
|
// .orElseThrow(() -> new NoSuchElementException("데이터가 존재하지 않습니다: " + id));
|
|
|
}
|
|
@@ -45,10 +43,10 @@ public class TbFcltFailHsService {
|
|
|
@Transactional(readOnly = true)
|
|
|
public List<TbFcltFailHsDto> findAll() {
|
|
|
List<TbFcltFailHsDto> result = new ArrayList<>();
|
|
|
- List<TbFcltFailHs> data = this.repo.findAll();
|
|
|
- for (TbFcltFailHs entity : data) {
|
|
|
- result.add(entity.toDto());
|
|
|
- }
|
|
|
+// List<TbFcltFailHs> data = this.repo.findAll();
|
|
|
+// for (TbFcltFailHs entity : data) {
|
|
|
+// result.add(entity.toDto());
|
|
|
+// }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -57,7 +55,7 @@ public class TbFcltFailHsService {
|
|
|
public TbFcltFailHsDto updateById(String id, TbFcltFailHsDto.TbFcltFailHsUpdReq req) {
|
|
|
TbFcltFailHs entity = requireOne(id);
|
|
|
entity.updateInfo(req);
|
|
|
- this.repo.save(entity);
|
|
|
+// this.repo.save(entity);
|
|
|
return entity.toDto();
|
|
|
}
|
|
|
|
|
@@ -67,7 +65,7 @@ public class TbFcltFailHsService {
|
|
|
List<TbFcltFailHsDto> result = new ArrayList<>();
|
|
|
for (TbFcltFailHsDto.TbFcltFailHsUpdReq req : reqList) {
|
|
|
TbFcltFailHs obj = req.toEntity();
|
|
|
- this.repo.save(obj);
|
|
|
+// this.repo.save(obj);
|
|
|
result.add(obj.toDto());
|
|
|
}
|
|
|
return result;
|
|
@@ -77,7 +75,7 @@ public class TbFcltFailHsService {
|
|
|
@Transactional
|
|
|
public TbFcltFailHsDto mergeInfo(TbFcltFailHsDto.TbFcltFailHsUpdReq req) {
|
|
|
TbFcltFailHs obj = req.toEntity();
|
|
|
- this.repo.save(obj);
|
|
|
+// this.repo.save(obj);
|
|
|
return obj.toDto();
|
|
|
}
|
|
|
|
|
@@ -85,8 +83,8 @@ public class TbFcltFailHsService {
|
|
|
@Transactional
|
|
|
public TbFcltFailHsDto deleteById(String id) {
|
|
|
TbFcltFailHs entity = requireOne(id);
|
|
|
- this.rparHsRepo.deleteDataById(id);
|
|
|
- this.repo.deleteById(id);
|
|
|
+// this.rparHsRepo.deleteDataById(id);
|
|
|
+// this.repo.deleteById(id);
|
|
|
return entity.toDto();
|
|
|
}
|
|
|
|
|
@@ -95,12 +93,12 @@ public class TbFcltFailHsService {
|
|
|
public List<TbFcltFailHsDto> deleteByIds(List<String> ids) {
|
|
|
List<TbFcltFailHsDto> result = new ArrayList<>();
|
|
|
for (String id : ids) {
|
|
|
- Optional<TbFcltFailHs> obj = this.repo.findById(id);
|
|
|
- if (obj.isPresent()) {
|
|
|
- this.rparHsRepo.deleteDataById(id);
|
|
|
- this.repo.deleteById(id);
|
|
|
- result.add(obj.get().toDto());
|
|
|
- }
|
|
|
+// Optional<TbFcltFailHs> obj = this.repo.findById(id);
|
|
|
+// if (obj.isPresent()) {
|
|
|
+// this.rparHsRepo.deleteDataById(id);
|
|
|
+// this.repo.deleteById(id);
|
|
|
+// result.add(obj.get().toDto());
|
|
|
+// }
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -114,10 +112,10 @@ public class TbFcltFailHsService {
|
|
|
public List<TbFcltFailHsDto> findAllFailList(String fcltId) {
|
|
|
|
|
|
List<TbFcltFailHsDto> result = new ArrayList<>();
|
|
|
- List<TbFcltFailHs> data = this.repo.findAllFailList(fcltId);
|
|
|
- data.forEach(obj -> {
|
|
|
- result.add(obj.toDto());
|
|
|
- });
|
|
|
+// List<TbFcltFailHs> data = this.repo.findAllFailList(fcltId);
|
|
|
+// data.forEach(obj -> {
|
|
|
+// result.add(obj.toDto());
|
|
|
+// });
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -129,7 +127,7 @@ public class TbFcltFailHsService {
|
|
|
@Transactional(readOnly = true)
|
|
|
public String findNewHsSeq() {
|
|
|
String currYear = ItsUtils.getSysTime("yyyyMM");
|
|
|
- Integer newId = this.repo.findNewHsSeq(currYear);
|
|
|
+ Integer newId = 0;//this.repo.findNewHsSeq(currYear);
|
|
|
return String.format("%s%04d", currYear, newId);
|
|
|
}
|
|
|
|