Commit 119aca6c5c65e643bb8a97c35d080faac8a75456
Merge remote-tracking branch 'origin/test_hhl_0102' into test_hhl_0102
Showing
15 changed files
with
92 additions
and
19 deletions
@@ -8,11 +8,17 @@ import org.springframework.http.ResponseEntity; | @@ -8,11 +8,17 @@ import org.springframework.http.ResponseEntity; | ||
8 | import org.springframework.security.access.prepost.PreAuthorize; | 8 | import org.springframework.security.access.prepost.PreAuthorize; |
9 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
10 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 10 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
11 | +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | ||
12 | +import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | ||
11 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceCagegoryDTO; | 13 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceCagegoryDTO; |
14 | +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
15 | +import org.thingsboard.server.dao.yunteng.service.TkDeviceAccountService; | ||
12 | import org.thingsboard.server.dao.yunteng.service.TkDeviceCagegoryService; | 16 | import org.thingsboard.server.dao.yunteng.service.TkDeviceCagegoryService; |
13 | import org.thingsboard.server.queue.util.TbCoreComponent; | 17 | import org.thingsboard.server.queue.util.TbCoreComponent; |
14 | 18 | ||
19 | +import java.util.HashMap; | ||
15 | import java.util.List; | 20 | import java.util.List; |
21 | +import java.util.Map; | ||
16 | 22 | ||
17 | @RestController | 23 | @RestController |
18 | @TbCoreComponent | 24 | @TbCoreComponent |
@@ -23,6 +29,8 @@ import java.util.List; | @@ -23,6 +29,8 @@ import java.util.List; | ||
23 | public class TkDeviceCagegoryController extends BaseController { | 29 | public class TkDeviceCagegoryController extends BaseController { |
24 | private final TkDeviceCagegoryService tkDeviceCagegoryService; | 30 | private final TkDeviceCagegoryService tkDeviceCagegoryService; |
25 | 31 | ||
32 | + private final TkDeviceAccountService tkDeviceAccountService; | ||
33 | + | ||
26 | @PostMapping("/getCagegoryByParentid") | 34 | @PostMapping("/getCagegoryByParentid") |
27 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | 35 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") |
28 | @ApiOperation("根据父类型获取设备类别") | 36 | @ApiOperation("根据父类型获取设备类别") |
@@ -48,6 +56,12 @@ public class TkDeviceCagegoryController extends BaseController { | @@ -48,6 +56,12 @@ public class TkDeviceCagegoryController extends BaseController { | ||
48 | @GetMapping("/delete") | 56 | @GetMapping("/delete") |
49 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | 57 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") |
50 | public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException { | 58 | public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException { |
59 | + Map<String, Object> params = new HashMap<>(); | ||
60 | + params.put("categoryId", id); | ||
61 | + TkPageData<TkDeviceAccountDTO> page = tkDeviceAccountService.page(params); | ||
62 | + if (page != null && page.getTotal() > 0) { | ||
63 | + throw new TkDataValidationException("类别下还有关联数据不能删除!"); | ||
64 | + } | ||
51 | return ResponseEntity.ok(tkDeviceCagegoryService.delete(id)); | 65 | return ResponseEntity.ok(tkDeviceCagegoryService.delete(id)); |
52 | } | 66 | } |
53 | 67 |
@@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | @@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | ||
14 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; |
15 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; |
16 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; | 16 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; |
17 | +import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | ||
17 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
18 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
19 | import org.thingsboard.server.dao.yunteng.service.TkDeviceAccountService; | 20 | import org.thingsboard.server.dao.yunteng.service.TkDeviceAccountService; |
@@ -92,6 +93,8 @@ public class TkRepairOrderController extends BaseController { | @@ -92,6 +93,8 @@ public class TkRepairOrderController extends BaseController { | ||
92 | throws ThingsboardException { | 93 | throws ThingsboardException { |
93 | params.put(PAGE, page); | 94 | params.put(PAGE, page); |
94 | params.put(PAGE_SIZE, pageSize); | 95 | params.put(PAGE_SIZE, pageSize); |
96 | + String currentUserId = getCurrentUser().getCurrentUserId(); | ||
97 | + params.put("userId", currentUserId); | ||
95 | return tkRepairOrderService.page(params); | 98 | return tkRepairOrderService.page(params); |
96 | } | 99 | } |
97 | 100 |
@@ -4,13 +4,17 @@ import io.swagger.annotations.Api; | @@ -4,13 +4,17 @@ import io.swagger.annotations.Api; | ||
4 | import io.swagger.annotations.ApiOperation; | 4 | import io.swagger.annotations.ApiOperation; |
5 | import lombok.RequiredArgsConstructor; | 5 | import lombok.RequiredArgsConstructor; |
6 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
7 | +import org.apache.commons.collections4.CollectionUtils; | ||
7 | import org.springframework.http.ResponseEntity; | 8 | import org.springframework.http.ResponseEntity; |
8 | import org.springframework.security.access.prepost.PreAuthorize; | 9 | import org.springframework.security.access.prepost.PreAuthorize; |
9 | import org.springframework.web.bind.annotation.*; | 10 | import org.springframework.web.bind.annotation.*; |
10 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 11 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
12 | +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | ||
13 | +import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | ||
11 | import org.thingsboard.server.common.data.yunteng.dto.TkSupplierDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.TkSupplierDTO; |
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 15 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
13 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | +import org.thingsboard.server.dao.yunteng.service.TkDeviceAccountService; | ||
14 | import org.thingsboard.server.dao.yunteng.service.TkSupplierService; | 18 | import org.thingsboard.server.dao.yunteng.service.TkSupplierService; |
15 | import org.thingsboard.server.queue.util.TbCoreComponent; | 19 | import org.thingsboard.server.queue.util.TbCoreComponent; |
16 | 20 | ||
@@ -28,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -28,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
28 | public class TkSupplierController extends BaseController { | 32 | public class TkSupplierController extends BaseController { |
29 | private final TkSupplierService tkSupplierService; | 33 | private final TkSupplierService tkSupplierService; |
30 | 34 | ||
35 | + private final TkDeviceAccountService tkDeviceAccountService; | ||
31 | 36 | ||
32 | @PostMapping("/pageData") | 37 | @PostMapping("/pageData") |
33 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | 38 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") |
@@ -61,6 +66,10 @@ public class TkSupplierController extends BaseController { | @@ -61,6 +66,10 @@ public class TkSupplierController extends BaseController { | ||
61 | @PostMapping("/delete") | 66 | @PostMapping("/delete") |
62 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | 67 | @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") |
63 | public ResponseEntity<Boolean> delete(@RequestBody TkSupplierDTO param) throws ThingsboardException { | 68 | public ResponseEntity<Boolean> delete(@RequestBody TkSupplierDTO param) throws ThingsboardException { |
69 | + List<TkDeviceAccountDTO> tkDeviceAccountDTOS = tkDeviceAccountService.listBySupplierId(param.getIds()); | ||
70 | + if (CollectionUtils.isNotEmpty(tkDeviceAccountDTOS)) { | ||
71 | + throw new TkDataValidationException("存在关联的供应商无法删除!"); | ||
72 | + } | ||
64 | return ResponseEntity.ok(tkSupplierService.delete(param.getIds())); | 73 | return ResponseEntity.ok(tkSupplierService.delete(param.getIds())); |
65 | } | 74 | } |
66 | 75 |
@@ -31,7 +31,7 @@ server: | @@ -31,7 +31,7 @@ server: | ||
31 | # Server bind-address | 31 | # Server bind-address |
32 | address: "${HTTP_BIND_ADDRESS:0.0.0.0}" | 32 | address: "${HTTP_BIND_ADDRESS:0.0.0.0}" |
33 | # Server bind port | 33 | # Server bind port |
34 | - port: "${HTTP_BIND_PORT:8080}" | 34 | + port: "${HTTP_BIND_PORT:9527}" |
35 | # Server forward headers strategy | 35 | # Server forward headers strategy |
36 | forward_headers_strategy: "${HTTP_FORWARD_HEADERS_STRATEGY:NONE}" | 36 | forward_headers_strategy: "${HTTP_FORWARD_HEADERS_STRATEGY:NONE}" |
37 | # Server SSL configuration | 37 | # Server SSL configuration |
@@ -766,7 +766,7 @@ spring: | @@ -766,7 +766,7 @@ spring: | ||
766 | datasource: | 766 | datasource: |
767 | # Database driver for Spring JPA - org.postgresql.Driver | 767 | # Database driver for Spring JPA - org.postgresql.Driver |
768 | driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}" | 768 | driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}" |
769 | - url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://10.9.0.221:5432/thingskit}" | 769 | + url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://10.9.0.205:5432/thingskit}" |
770 | username: "${SPRING_DATASOURCE_USERNAME:postgres}" | 770 | username: "${SPRING_DATASOURCE_USERNAME:postgres}" |
771 | password: "${SPRING_DATASOURCE_PASSWORD:postgres}" | 771 | password: "${SPRING_DATASOURCE_PASSWORD:postgres}" |
772 | hikari: | 772 | hikari: |
@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service; | @@ -11,10 +11,7 @@ import org.springframework.stereotype.Service; | ||
11 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 11 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
12 | import org.thingsboard.server.common.data.id.TenantId; | 12 | import org.thingsboard.server.common.data.id.TenantId; |
13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
14 | -import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | ||
15 | -import org.thingsboard.server.common.data.yunteng.dto.TkDeviceCagegoryDTO; | ||
16 | -import org.thingsboard.server.common.data.yunteng.dto.TkSupplierDTO; | ||
17 | -import org.thingsboard.server.common.data.yunteng.dto.UserDTO; | 14 | +import org.thingsboard.server.common.data.yunteng.dto.*; |
18 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | 15 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
19 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 16 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
20 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceAccountEntity; | 17 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceAccountEntity; |
@@ -24,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.*; | @@ -24,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.*; | ||
24 | 21 | ||
25 | import java.util.List; | 22 | import java.util.List; |
26 | import java.util.Map; | 23 | import java.util.Map; |
24 | +import java.util.Optional; | ||
27 | import java.util.stream.Collectors; | 25 | import java.util.stream.Collectors; |
28 | 26 | ||
29 | @Service | 27 | @Service |
@@ -156,6 +154,21 @@ public class TkDeviceAccountServiceImpl extends AbstractBaseService<TkDeviceAcco | @@ -156,6 +154,21 @@ public class TkDeviceAccountServiceImpl extends AbstractBaseService<TkDeviceAcco | ||
156 | } | 154 | } |
157 | 155 | ||
158 | @Override | 156 | @Override |
157 | + public List<TkDeviceAccountDTO> listBySupplierId(List<String> supplierIdList) throws ThingsboardException { | ||
158 | + if (CollectionUtils.isEmpty(supplierIdList)) { | ||
159 | + throw new TkDataValidationException("供应商id不能为空!"); | ||
160 | + } | ||
161 | + QueryWrapper<TkDeviceAccountEntity> wrapper = new QueryWrapper<>(); | ||
162 | + LambdaQueryWrapper<TkDeviceAccountEntity> lambda = wrapper.lambda(); | ||
163 | + TenantId tenantId = SpringBeanUtils.getTenantId(); | ||
164 | + lambda.eq(TkDeviceAccountEntity::getTenantId, tenantId.getId().toString()); | ||
165 | + lambda.in(TkDeviceAccountEntity::getSupplierId, supplierIdList); | ||
166 | + List<TkDeviceAccountEntity> entities = baseMapper.selectList(wrapper); | ||
167 | + return Optional.ofNullable(entities).map(all -> all.stream().map(item -> item.getDTO(TkDeviceAccountDTO.class)) | ||
168 | + .collect(Collectors.toList())).orElse(null); | ||
169 | + } | ||
170 | + | ||
171 | + @Override | ||
159 | public boolean delete(String id) { | 172 | public boolean delete(String id) { |
160 | int count = baseMapper.deleteById(id); | 173 | int count = baseMapper.deleteById(id); |
161 | return count > 0; | 174 | return count > 0; |
@@ -107,7 +107,7 @@ public class TkDeviceCagegoryServiceImpl extends AbstractBaseService<TkDeviceCag | @@ -107,7 +107,7 @@ public class TkDeviceCagegoryServiceImpl extends AbstractBaseService<TkDeviceCag | ||
107 | } | 107 | } |
108 | TkDeviceCagegoryUtil utils = new TkDeviceCagegoryUtil(topMenuList, subMenu); | 108 | TkDeviceCagegoryUtil utils = new TkDeviceCagegoryUtil(topMenuList, subMenu); |
109 | List<TkDeviceCagegoryDTO> result = utils.getTree(); | 109 | List<TkDeviceCagegoryDTO> result = utils.getTree(); |
110 | - return result; | 110 | + return Optional.ofNullable(result).orElse(new ArrayList<>()); |
111 | } | 111 | } |
112 | 112 | ||
113 | private List<String> getFullTreeId(List<String> filterIdList, Map<String, String> idMap) { | 113 | private List<String> getFullTreeId(List<String> filterIdList, Map<String, String> idMap) { |
@@ -12,6 +12,8 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | @@ -12,6 +12,8 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | ||
12 | import org.thingsboard.server.common.data.yunteng.dto.TkPreserveDetailStatusDTO; | 12 | import org.thingsboard.server.common.data.yunteng.dto.TkPreserveDetailStatusDTO; |
13 | import org.thingsboard.server.common.data.yunteng.enums.PreserveDetailStatusEnum; | 13 | import org.thingsboard.server.common.data.yunteng.enums.PreserveDetailStatusEnum; |
14 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | 14 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
15 | +import org.thingsboard.server.dao.yunteng.entities.TenantBaseEntity; | ||
16 | +import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailEntity; | ||
15 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailStatusEntity; | 17 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailStatusEntity; |
16 | import org.thingsboard.server.dao.yunteng.mapper.TkPreserveDetailStatusMapper; | 18 | import org.thingsboard.server.dao.yunteng.mapper.TkPreserveDetailStatusMapper; |
17 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | 19 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
@@ -44,6 +46,15 @@ public class TkPreserveDetailStatusServiceImpl extends AbstractBaseService<TkPre | @@ -44,6 +46,15 @@ public class TkPreserveDetailStatusServiceImpl extends AbstractBaseService<TkPre | ||
44 | } | 46 | } |
45 | 47 | ||
46 | @Override | 48 | @Override |
49 | + public void deleteNotInIdEqRecordId(String recordId, List<String> notinIds) throws ThingsboardException { | ||
50 | + baseMapper.delete(new QueryWrapper<TkPreserveDetailStatusEntity>() | ||
51 | + .lambda().eq(TkPreserveDetailStatusEntity::getPreserveRecordId, recordId) | ||
52 | + .eq(TenantBaseEntity::getTenantId, SpringBeanUtils.getTenantId().getId().toString()) | ||
53 | + .notIn(TkPreserveDetailStatusEntity::getId, notinIds) | ||
54 | + ); | ||
55 | + } | ||
56 | + | ||
57 | + @Override | ||
47 | public List<TkPreserveDetailStatusDTO> listByPreserveRecordId(List<String> preserveRecordId) throws ThingsboardException { | 58 | public List<TkPreserveDetailStatusDTO> listByPreserveRecordId(List<String> preserveRecordId) throws ThingsboardException { |
48 | if (CollectionUtils.isEmpty(preserveRecordId)) { | 59 | if (CollectionUtils.isEmpty(preserveRecordId)) { |
49 | throw new TkDataValidationException("保养记录id不能为空!"); | 60 | throw new TkDataValidationException("保养记录id不能为空!"); |
@@ -88,11 +88,12 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -88,11 +88,12 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
88 | @Transactional | 88 | @Transactional |
89 | public TkPreserveRecordDTO save(TkPreserveRecordDTO dto) throws ThingsboardException { | 89 | public TkPreserveRecordDTO save(TkPreserveRecordDTO dto) throws ThingsboardException { |
90 | checkDto(dto); | 90 | checkDto(dto); |
91 | - | 91 | + Boolean isAdd = false; |
92 | TkPreserveRecordEntity entity = new TkPreserveRecordEntity(); | 92 | TkPreserveRecordEntity entity = new TkPreserveRecordEntity(); |
93 | if (StringUtils.isBlank(dto.getId())) { | 93 | if (StringUtils.isBlank(dto.getId())) { |
94 | dto.copyToEntity(entity); | 94 | dto.copyToEntity(entity); |
95 | baseMapper.insert(entity); | 95 | baseMapper.insert(entity); |
96 | + isAdd = true; | ||
96 | } else { | 97 | } else { |
97 | LambdaQueryWrapper<TkPreserveRecordEntity> filter = new QueryWrapper<TkPreserveRecordEntity>().lambda() | 98 | LambdaQueryWrapper<TkPreserveRecordEntity> filter = new QueryWrapper<TkPreserveRecordEntity>().lambda() |
98 | .eq(TkPreserveRecordEntity::getId, dto.getId()); | 99 | .eq(TkPreserveRecordEntity::getId, dto.getId()); |
@@ -103,6 +104,14 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -103,6 +104,14 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
103 | String id = dto.getId(); | 104 | String id = dto.getId(); |
104 | List<TkPreserveDetailStatusDTO> preserveDetailStatusList = dto.getPreserveDetailStatusList(); | 105 | List<TkPreserveDetailStatusDTO> preserveDetailStatusList = dto.getPreserveDetailStatusList(); |
105 | if (CollectionUtils.isNotEmpty(preserveDetailStatusList)) { | 106 | if (CollectionUtils.isNotEmpty(preserveDetailStatusList)) { |
107 | + List<String> detaulStatusIdList = preserveDetailStatusList.stream().filter(e -> StringUtils.isNotBlank(e.getId())) | ||
108 | + .map(BaseDTO::getId).collect(Collectors.toList()); | ||
109 | + if (isAdd == false) { | ||
110 | + if (CollectionUtils.isEmpty(detaulStatusIdList)) { | ||
111 | + detaulStatusIdList.add("empty"); | ||
112 | + } | ||
113 | + tkPreserveDetailStatusService.deleteNotInIdEqRecordId(id, detaulStatusIdList); | ||
114 | + } | ||
106 | for (TkPreserveDetailStatusDTO tkPreserveDetailStatusDTO : preserveDetailStatusList) { | 115 | for (TkPreserveDetailStatusDTO tkPreserveDetailStatusDTO : preserveDetailStatusList) { |
107 | tkPreserveDetailStatusDTO.setPreserveRecordId(id); | 116 | tkPreserveDetailStatusDTO.setPreserveRecordId(id); |
108 | tkPreserveDetailStatusService.save(tkPreserveDetailStatusDTO); | 117 | tkPreserveDetailStatusService.save(tkPreserveDetailStatusDTO); |
@@ -133,7 +142,7 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -133,7 +142,7 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
133 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); | 142 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); |
134 | } | 143 | } |
135 | 144 | ||
136 | - if (dto.getPreserveStatus() != null) { | 145 | + if (dto.getPreserveStatus() == null) { |
137 | dto.setPreserveStatus(PreserveRecordStatusEnum.INCOMPLETE); | 146 | dto.setPreserveStatus(PreserveRecordStatusEnum.INCOMPLETE); |
138 | } | 147 | } |
139 | } | 148 | } |
@@ -9,11 +9,7 @@ import org.apache.commons.collections4.CollectionUtils; | @@ -9,11 +9,7 @@ import org.apache.commons.collections4.CollectionUtils; | ||
9 | import org.apache.commons.lang3.StringUtils; | 9 | import org.apache.commons.lang3.StringUtils; |
10 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
11 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 11 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
12 | -import org.thingsboard.server.common.data.id.TenantId; | ||
13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 12 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
14 | -import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | ||
15 | -import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | ||
16 | -import org.thingsboard.server.common.data.yunteng.dto.TkPreserveRecordDTO; | ||
17 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; | 13 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; |
18 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; | 14 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; |
19 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | 15 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
@@ -30,7 +26,6 @@ import java.time.LocalDateTime; | @@ -30,7 +26,6 @@ import java.time.LocalDateTime; | ||
30 | import java.util.HashMap; | 26 | import java.util.HashMap; |
31 | import java.util.Map; | 27 | import java.util.Map; |
32 | import java.util.Optional; | 28 | import java.util.Optional; |
33 | -import java.util.UUID; | ||
34 | 29 | ||
35 | @Service | 30 | @Service |
36 | @RequiredArgsConstructor | 31 | @RequiredArgsConstructor |
@@ -151,6 +146,10 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | @@ -151,6 +146,10 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | ||
151 | if (StringUtils.isBlank(dto.getTenantId())) { | 146 | if (StringUtils.isBlank(dto.getTenantId())) { |
152 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); | 147 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); |
153 | } | 148 | } |
149 | + | ||
150 | + if (dto.getStatus() == null) { | ||
151 | + dto.setStatus(RepairOrderStatusEnum.SCHEDULING); | ||
152 | + } | ||
154 | } | 153 | } |
155 | 154 | ||
156 | @Override | 155 | @Override |
@@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | @@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | ||
14 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; |
15 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairRecordDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairRecordDTO; |
16 | import org.thingsboard.server.common.data.yunteng.dto.UserDTO; | 16 | import org.thingsboard.server.common.data.yunteng.dto.UserDTO; |
17 | +import org.thingsboard.server.common.data.yunteng.utils.DateTimeUtils; | ||
17 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | 18 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 19 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | import org.thingsboard.server.dao.yunteng.entities.TkRepairRecordEntity; | 20 | import org.thingsboard.server.dao.yunteng.entities.TkRepairRecordEntity; |
@@ -24,6 +25,7 @@ import org.thingsboard.server.dao.yunteng.service.TkRepairRecordService; | @@ -24,6 +25,7 @@ import org.thingsboard.server.dao.yunteng.service.TkRepairRecordService; | ||
24 | import org.thingsboard.server.dao.yunteng.service.TkUserService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkUserService; |
25 | 26 | ||
26 | import java.time.LocalDateTime; | 27 | import java.time.LocalDateTime; |
28 | +import java.util.Date; | ||
27 | import java.util.HashMap; | 29 | import java.util.HashMap; |
28 | import java.util.Map; | 30 | import java.util.Map; |
29 | import java.util.Optional; | 31 | import java.util.Optional; |
@@ -39,9 +41,10 @@ public class TkRepairRecordServiceImpl extends AbstractBaseService<TkRepairRecor | @@ -39,9 +41,10 @@ public class TkRepairRecordServiceImpl extends AbstractBaseService<TkRepairRecor | ||
39 | 41 | ||
40 | private final TkRepairOrderService tkRepairOrderService; | 42 | private final TkRepairOrderService tkRepairOrderService; |
41 | 43 | ||
42 | - | ||
43 | private final TkUserService tkUserService; | 44 | private final TkUserService tkUserService; |
44 | 45 | ||
46 | + private final String REPAIR_RECORD_CODE_PREFIX = "RRC_"; | ||
47 | + | ||
45 | @Override | 48 | @Override |
46 | public TkPageData<TkRepairRecordDTO> page(Map<String, Object> params) throws ThingsboardException { | 49 | public TkPageData<TkRepairRecordDTO> page(Map<String, Object> params) throws ThingsboardException { |
47 | params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); | 50 | params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); |
@@ -94,6 +97,11 @@ public class TkRepairRecordServiceImpl extends AbstractBaseService<TkRepairRecor | @@ -94,6 +97,11 @@ public class TkRepairRecordServiceImpl extends AbstractBaseService<TkRepairRecor | ||
94 | if (StringUtils.isBlank(dto.getTenantId())) { | 97 | if (StringUtils.isBlank(dto.getTenantId())) { |
95 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); | 98 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); |
96 | } | 99 | } |
100 | + | ||
101 | + if (StringUtils.isBlank(dto.getCode())) { | ||
102 | + long time = new Date().getTime(); | ||
103 | + dto.setCode(REPAIR_RECORD_CODE_PREFIX + time); | ||
104 | + } | ||
97 | } | 105 | } |
98 | 106 | ||
99 | 107 |
@@ -114,7 +114,7 @@ public class TkSupplierServiceImpl extends AbstractBaseService<TkSupplierMapper, | @@ -114,7 +114,7 @@ public class TkSupplierServiceImpl extends AbstractBaseService<TkSupplierMapper, | ||
114 | } | 114 | } |
115 | 115 | ||
116 | @Override | 116 | @Override |
117 | - public boolean delete(String id) { | 117 | + public boolean delete(String id){ |
118 | int count = baseMapper.deleteById(id); | 118 | int count = baseMapper.deleteById(id); |
119 | return count > 0; | 119 | return count > 0; |
120 | } | 120 | } |
@@ -19,6 +19,8 @@ public interface TkDeviceAccountService extends BaseService<TkDeviceAccountEntit | @@ -19,6 +19,8 @@ public interface TkDeviceAccountService extends BaseService<TkDeviceAccountEntit | ||
19 | 19 | ||
20 | List<String> getIdByDeviceName(String deviceName) throws ThingsboardException; | 20 | List<String> getIdByDeviceName(String deviceName) throws ThingsboardException; |
21 | 21 | ||
22 | + List<TkDeviceAccountDTO> listBySupplierId(List<String> supplierId) throws ThingsboardException; | ||
23 | + | ||
22 | boolean delete(String id); | 24 | boolean delete(String id); |
23 | 25 | ||
24 | } | 26 | } |
@@ -9,5 +9,7 @@ import java.util.List; | @@ -9,5 +9,7 @@ import java.util.List; | ||
9 | public interface TkPreserveDetailStatusService extends BaseService<TkPreserveDetailStatusEntity> { | 9 | public interface TkPreserveDetailStatusService extends BaseService<TkPreserveDetailStatusEntity> { |
10 | TkPreserveDetailStatusDTO save(TkPreserveDetailStatusDTO dto) throws ThingsboardException; | 10 | TkPreserveDetailStatusDTO save(TkPreserveDetailStatusDTO dto) throws ThingsboardException; |
11 | 11 | ||
12 | + void deleteNotInIdEqRecordId(String recordId, List<String> notinIds) throws ThingsboardException; | ||
13 | + | ||
12 | List<TkPreserveDetailStatusDTO> listByPreserveRecordId(List<String> preserveRecordId) throws ThingsboardException; | 14 | List<TkPreserveDetailStatusDTO> listByPreserveRecordId(List<String> preserveRecordId) throws ThingsboardException; |
13 | } | 15 | } |
@@ -16,7 +16,7 @@ public interface TkSupplierService extends BaseService<TkSupplierEntity> { | @@ -16,7 +16,7 @@ public interface TkSupplierService extends BaseService<TkSupplierEntity> { | ||
16 | 16 | ||
17 | TkSupplierDTO detail(String id) throws ThingsboardException; | 17 | TkSupplierDTO detail(String id) throws ThingsboardException; |
18 | 18 | ||
19 | - boolean delete(String id); | 19 | + boolean delete(String id) throws ThingsboardException; |
20 | 20 | ||
21 | - boolean delete(List<String> ids); | 21 | + boolean delete(List<String> ids) throws ThingsboardException; |
22 | } | 22 | } |
@@ -53,9 +53,12 @@ | @@ -53,9 +53,12 @@ | ||
53 | inner join qg_device_account da on da.id=o.device_id | 53 | inner join qg_device_account da on da.id=o.device_id |
54 | inner join sys_user su2 on su2.id=da.director_id | 54 | inner join sys_user su2 on su2.id=da.director_id |
55 | <where> | 55 | <where> |
56 | - <if test="queryMap.id !=null "> | 56 | + <if test="queryMap.id !=null and queryMap.id !=''"> |
57 | AND o.id = #{queryMap.id} | 57 | AND o.id = #{queryMap.id} |
58 | </if> | 58 | </if> |
59 | + <if test="queryMap.userId !=null and queryMap.userId !=''"> | ||
60 | + AND (o.report_by = #{queryMap.userId} or o.creator=#{queryMap.userId} or da.director_id=#{queryMap.userId}) | ||
61 | + </if> | ||
59 | <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> | 62 | <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> |
60 | AND o.tenant_id = #{queryMap.tenantId} | 63 | AND o.tenant_id = #{queryMap.tenantId} |
61 | </if> | 64 | </if> |