czh %!s(int64=2) %!d(string=hai) anos
pai
achega
bcf64a73e6

+ 12 - 8
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmAddressService.java

@@ -346,17 +346,21 @@ public class KwmAddressService {
      * @date 2023/7/18
      */
     public List<AddressQueryResVo> queryByEnt(QueryByEntReqVo reqVo) {
+        Map<Long, EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntTreeByIds(Collections.singletonList(reqVo.getId()));
+        if (entCacheResDtos.isEmpty()) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
+        }
+
+        EntCacheResDto entCacheResDto = entCacheResDtos.get(reqVo.getId());
+        if (Objects.isNull(entCacheResDto)) {
+            throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
+        }
+
         LambdaQueryWrapper<KwmAddress> wrapper = new LambdaQueryWrapper<>();
-        //wrapper.eq(KwmAddress::getEntId, reqVo.getId());
         wrapper.eq(KwmAddress::getDelFlag, Global.NO);
-        List<Long> ids = new ArrayList<>();
-        ids.add(reqVo.getId());
-        Map<Long, EntCacheResDto> entCacheResDtos = remoteSystemService.queryEntTreeByIds(ids);
-        EntCacheResDto id = entCacheResDtos.get(reqVo.getId());
-        wrapper.eq(KwmAddress::getEntId, id.getId());
-        //entCacheResDtos.get();
+        wrapper.eq(KwmAddress::getEntId, entCacheResDto.getId());
         if (StringUtils.isNotBlank(reqVo.getCityTrueName())) {
-            wrapper.and(wp -> wp.eq(KwmAddress::getName, reqVo.getCityTrueName()));
+            wrapper.eq(KwmAddress::getName, reqVo.getCityTrueName());
         }
         if (StringUtils.isNotBlank(reqVo.getCityName())) {
             wrapper.and(wp -> wp.like(KwmAddress::getCityName, reqVo.getCityName()).or().