...
|
...
|
@@ -7,11 +7,14 @@ import lombok.extern.slf4j.Slf4j; |
7
|
7
|
import org.apache.commons.collections4.CollectionUtils;
|
8
|
8
|
import org.apache.commons.lang3.StringUtils;
|
9
|
9
|
import org.springframework.stereotype.Service;
|
|
10
|
+import org.thingsboard.server.common.data.exception.ThingsboardException;
|
10
|
11
|
import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO;
|
|
12
|
+import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO;
|
11
|
13
|
import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity;
|
12
|
14
|
import org.thingsboard.server.dao.yunteng.mapper.TkCheckDetailsMapper;
|
13
|
15
|
import org.thingsboard.server.dao.yunteng.service.AbstractBaseService;
|
14
|
16
|
import org.thingsboard.server.dao.yunteng.service.TkCheckDetailsService;
|
|
17
|
+import org.thingsboard.server.dao.yunteng.service.TkDeviceAccountService;
|
15
|
18
|
|
16
|
19
|
import java.util.ArrayList;
|
17
|
20
|
import java.util.List;
|
...
|
...
|
@@ -22,6 +25,8 @@ import java.util.stream.Collectors; |
22
|
25
|
@Slf4j
|
23
|
26
|
public class TkCheckDetailsServiceImpl extends AbstractBaseService<TkCheckDetailsMapper, TkCheckDetailsEntity>
|
24
|
27
|
implements TkCheckDetailsService {
|
|
28
|
+ private final TkDeviceAccountService tkDeviceAccountService;
|
|
29
|
+
|
25
|
30
|
@Override
|
26
|
31
|
public List<TkCheckDetailsDTO> batchSave(List<TkCheckDetailsDTO> checkDetailsDTOList, String inspectionPlanId) {
|
27
|
32
|
List<TkCheckDetailsDTO> oldTkCheckDetailsDTOList = listByInspectionPlanId(inspectionPlanId);
|
...
|
...
|
@@ -98,6 +103,13 @@ public class TkCheckDetailsServiceImpl extends AbstractBaseService<TkCheckDetail |
98
|
103
|
return CollectionUtils.emptyIfNull(tkCheckDetailsEntitieList).stream().map(entity -> {
|
99
|
104
|
TkCheckDetailsDTO tkCheckDetailsDTO = new TkCheckDetailsDTO();
|
100
|
105
|
entity.copyToDTO(tkCheckDetailsDTO);
|
|
106
|
+ try {
|
|
107
|
+ TkDeviceAccountDTO tkDeviceAccountDTO = tkDeviceAccountService.load(tkCheckDetailsDTO.getCheckDeviceId());
|
|
108
|
+ tkCheckDetailsDTO.setTkDeviceAccountDTO(tkDeviceAccountDTO);
|
|
109
|
+ } catch (ThingsboardException e) {
|
|
110
|
+ throw new RuntimeException(e);
|
|
111
|
+ }
|
|
112
|
+
|
101
|
113
|
return tkCheckDetailsDTO;
|
102
|
114
|
}).collect(Collectors.toList());
|
103
|
115
|
}
|
...
|
...
|
|