|
@@ -6,7 +6,9 @@ import com.its.op.dto.its.vms.TbVmsDsplPrstDto;
|
|
|
import com.its.op.entity.its.vms.TbVmsCtlr;
|
|
import com.its.op.entity.its.vms.TbVmsCtlr;
|
|
|
import com.its.op.entity.its.vms.TbVmsDsplPrst;
|
|
import com.its.op.entity.its.vms.TbVmsDsplPrst;
|
|
|
import com.its.op.entity.its.vms.TbVmsDsplPrstKey;
|
|
import com.its.op.entity.its.vms.TbVmsDsplPrstKey;
|
|
|
|
|
+import com.its.op.global.CmmnCdManager;
|
|
|
import com.its.op.global.TbVmsCtlrManager;
|
|
import com.its.op.global.TbVmsCtlrManager;
|
|
|
|
|
+import com.its.utils.ItsUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -43,8 +45,6 @@ public class TbVmsDsplPrstService {
|
|
|
*/
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
|
public List<TbVmsDsplPrstDto> findAll(boolean isMemory) {
|
|
public List<TbVmsDsplPrstDto> findAll(boolean isMemory) {
|
|
|
- //List<TbVmsDsplPrstDto> result = new ArrayList<>();
|
|
|
|
|
- List<TbVmsDsplPrst> data = this.repo.findAll();
|
|
|
|
|
List<TbVmsCtlr> stts;
|
|
List<TbVmsCtlr> stts;
|
|
|
if (isMemory) {
|
|
if (isMemory) {
|
|
|
List<TbVmsCtlr> temp = this.ctlrManager.findAll();
|
|
List<TbVmsCtlr> temp = this.ctlrManager.findAll();
|
|
@@ -53,11 +53,8 @@ public class TbVmsDsplPrstService {
|
|
|
stts = this.ctlrRepo.findAllList();
|
|
stts = this.ctlrRepo.findAllList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ List<TbVmsDsplPrst> data = this.repo.findAll();
|
|
|
return makeDsplPrstList(data, stts);
|
|
return makeDsplPrstList(data, stts);
|
|
|
-// for (TbVmsDsplPrst entity : data) {
|
|
|
|
|
-// result.add(entity.toDto());
|
|
|
|
|
-// }
|
|
|
|
|
-// return result;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -66,7 +63,6 @@ public class TbVmsDsplPrstService {
|
|
|
*/
|
|
*/
|
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
|
public List<TbVmsDsplPrstDto> findAllByIds(List<Long> ids, boolean isMemory) {
|
|
public List<TbVmsDsplPrstDto> findAllByIds(List<Long> ids, boolean isMemory) {
|
|
|
- List<TbVmsDsplPrstDto> result = new ArrayList<>();
|
|
|
|
|
List<TbVmsDsplPrst> data = this.repo.findAllByIds(ids);
|
|
List<TbVmsDsplPrst> data = this.repo.findAllByIds(ids);
|
|
|
List<TbVmsCtlr> stts;
|
|
List<TbVmsCtlr> stts;
|
|
|
if (isMemory) {
|
|
if (isMemory) {
|
|
@@ -77,10 +73,6 @@ public class TbVmsDsplPrstService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return makeDsplPrstList(data, stts);
|
|
return makeDsplPrstList(data, stts);
|
|
|
-// for (TbVmsDsplPrst entity : data) {
|
|
|
|
|
-// result.add(entity.toDto());
|
|
|
|
|
-// }
|
|
|
|
|
-// return result;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -91,20 +83,42 @@ public class TbVmsDsplPrstService {
|
|
|
*/
|
|
*/
|
|
|
public List<TbVmsDsplPrstDto> makeDsplPrstList(List<TbVmsDsplPrst> data, List<TbVmsCtlr> vmsList) {
|
|
public List<TbVmsDsplPrstDto> makeDsplPrstList(List<TbVmsDsplPrst> data, List<TbVmsCtlr> vmsList) {
|
|
|
Map<Long, TbVmsDsplPrstDto> result = new HashMap<>();
|
|
Map<Long, TbVmsDsplPrstDto> result = new HashMap<>();
|
|
|
- data.forEach(obj -> {
|
|
|
|
|
- TbVmsDsplPrstDto dto = result.get(obj.getVmsCtlrNmbr());
|
|
|
|
|
- if (dto == null) {
|
|
|
|
|
- dto = obj.toDto();
|
|
|
|
|
- result.put(obj.getVmsCtlrNmbr(), dto);
|
|
|
|
|
- }
|
|
|
|
|
- dto.addMsg(obj);
|
|
|
|
|
- });
|
|
|
|
|
vmsList.forEach(obj -> {
|
|
vmsList.forEach(obj -> {
|
|
|
|
|
+ TbVmsDsplPrstDto dto = TbVmsDsplPrstDto.builder()
|
|
|
|
|
+ .vmsCtlrNmbr(obj.getVmsCtlrNmbr())
|
|
|
|
|
+ .msgs(new ArrayList<>())
|
|
|
|
|
+ .dsplDt(CmmnCdManager.CMNC_STTS_ERROR_DT)
|
|
|
|
|
+ .svcYn("N")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ dto.setVms(obj);
|
|
|
|
|
+ dto.setStts(obj);
|
|
|
|
|
+ result.put(obj.getVmsCtlrNmbr(), dto);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ data.forEach(obj -> {
|
|
|
TbVmsDsplPrstDto dto = result.get(obj.getVmsCtlrNmbr());
|
|
TbVmsDsplPrstDto dto = result.get(obj.getVmsCtlrNmbr());
|
|
|
if (dto != null) {
|
|
if (dto != null) {
|
|
|
- dto.setStts(obj);
|
|
|
|
|
|
|
+ dto.setDsplDt(obj.getDsplDt());
|
|
|
|
|
+ dto.setSvcYn(ItsUtils.getServiceYn(obj.getDsplDt()));
|
|
|
|
|
+ dto.addMsg(obj);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+// data.forEach(obj -> {
|
|
|
|
|
+// TbVmsDsplPrstDto dto = result.get(obj.getVmsCtlrNmbr());
|
|
|
|
|
+// if (dto == null) {
|
|
|
|
|
+// dto = obj.toDto();
|
|
|
|
|
+// result.put(obj.getVmsCtlrNmbr(), dto);
|
|
|
|
|
+// }
|
|
|
|
|
+// dto.addMsg(obj);
|
|
|
|
|
+// });
|
|
|
|
|
+//
|
|
|
|
|
+// vmsList.forEach(obj -> {
|
|
|
|
|
+// TbVmsDsplPrstDto dto = result.get(obj.getVmsCtlrNmbr());
|
|
|
|
|
+// if (dto != null) {
|
|
|
|
|
+// dto.setStts(obj);
|
|
|
|
|
+// }
|
|
|
|
|
+// });
|
|
|
return new ArrayList<>(result.values());
|
|
return new ArrayList<>(result.values());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -115,9 +129,20 @@ public class TbVmsDsplPrstService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public TbVmsDsplPrstDto makeDsplPrst(TbVmsDsplPrst data, TbVmsCtlr vms) {
|
|
public TbVmsDsplPrstDto makeDsplPrst(TbVmsDsplPrst data, TbVmsCtlr vms) {
|
|
|
- TbVmsDsplPrstDto result = data.toDto();
|
|
|
|
|
- result.addMsg(data);
|
|
|
|
|
|
|
+ TbVmsDsplPrstDto result = TbVmsDsplPrstDto.builder()
|
|
|
|
|
+ .vmsCtlrNmbr(vms.getVmsCtlrNmbr())
|
|
|
|
|
+ .msgs(new ArrayList<>())
|
|
|
|
|
+ .dsplDt(data.getDsplDt())
|
|
|
|
|
+ .svcYn(ItsUtils.getServiceYn(data.getDsplDt()))
|
|
|
|
|
+ .build();
|
|
|
|
|
+
|
|
|
|
|
+ result.setVms(vms);
|
|
|
result.setStts(vms);
|
|
result.setStts(vms);
|
|
|
|
|
+ result.addMsg(data);
|
|
|
|
|
+
|
|
|
|
|
+// TbVmsDsplPrstDto result = data.toDto();
|
|
|
|
|
+// result.addMsg(data);
|
|
|
|
|
+// result.setStts(vms);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|