|
|
@@ -2,6 +2,7 @@ package com.sckw.manage.service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -33,6 +34,8 @@ import com.sckw.manage.model.vo.res.AddressQueryResVo;
|
|
|
import com.sckw.stream.enums.MessageEnum;
|
|
|
import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.RemoteUserService;
|
|
|
+import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
@@ -66,6 +69,9 @@ public class KwmAddressService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ private RemoteUserService remoteUserService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private StreamBridge streamBridge;
|
|
|
|
|
|
@@ -77,6 +83,16 @@ public class KwmAddressService {
|
|
|
* @date: 2023/7/12
|
|
|
*/
|
|
|
public PageResult queryByPage(AddressQueryReqVo reqVo) {
|
|
|
+ Integer cityCode = reqVo.getCityCode();
|
|
|
+ List<Integer> cityCodeList = new ArrayList<>();
|
|
|
+ if (Objects.nonNull(cityCode)) {
|
|
|
+ cityCodeList.add(cityCode);
|
|
|
+ List<AreaTreeFrontResDto> allArea = remoteUserService.findAllArea(cityCode);
|
|
|
+ if (CollectionUtils.isNotEmpty(allArea)) {
|
|
|
+ cityCodeList.addAll(allArea.stream().map(AreaTreeFrontResDto::getCode).distinct().toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reqVo.setCityCodeList(cityCodeList);
|
|
|
PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
|
|
|
List<KwmAddress> kwmAddressList = findList(reqVo);
|
|
|
if (CollectionUtils.isEmpty(kwmAddressList)) {
|
|
|
@@ -95,7 +111,7 @@ public class KwmAddressService {
|
|
|
*/
|
|
|
private List<KwmAddress> findList(AddressQueryReqVo reqVo) {
|
|
|
LambdaQueryWrapper<KwmAddress> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(Objects.nonNull(reqVo.getCityCode()), KwmAddress::getCityCode, reqVo.getCityCode()).
|
|
|
+ wrapper.in(Objects.nonNull(reqVo.getCityCode()), KwmAddress::getCityCode, reqVo.getCityCodeList()).
|
|
|
eq(Objects.nonNull(reqVo.getType()), KwmAddress::getType, reqVo.getType()).
|
|
|
eq(KwmAddress::getDelFlag, Global.NO).
|
|
|
and(StringUtils.isNotBlank(reqVo.getKeywords()),
|
|
|
@@ -113,7 +129,6 @@ public class KwmAddressService {
|
|
|
|
|
|
if (StringUtils.isNotBlank(reqVo.getIds())) {
|
|
|
wrapper.in(KwmAddress::getId, StringUtils.splitStrToList(reqVo.getIds(), Long.class));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (!Objects.equals(LoginUserHolder.getSystemType(), SystemTypeEnum.MANAGE.getCode())) {
|