优化通道管理/行政区划页面逻辑

This commit is contained in:
648540858
2024-11-05 18:23:58 +08:00
parent d5eb13192e
commit 9a29f44c86
23 changed files with 237 additions and 244 deletions

View File

@@ -41,7 +41,7 @@ public interface IGbChannelService {
void reset(int id);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode, Boolean hasGroup);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, String civilCode, String groupDeviceId);
void removeCivilCode(List<Region> allChildren);

View File

@@ -27,11 +27,13 @@ public interface IRegionService {
Region queryRegionByDeviceId(String regionDeviceId);
List<RegionTree> queryForTree(String query, Integer parent);
List<RegionTree> queryForTree(String query, Integer parent, Boolean hasChannel);
void syncFromChannel();
boolean delete(int id);
boolean batchAdd(List<Region> regionList);
List<Region> getPath(String deviceId);
}

View File

@@ -388,10 +388,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
@Override
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasCivilCode,
Boolean hasGroup) {
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, String civilCode, String groupDeviceId) {
PageHelper.startPage(page, count);
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasCivilCode, hasGroup);
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, civilCode, groupDeviceId);
return new PageInfo<>(all);
}

View File

@@ -139,9 +139,9 @@ public class RegionServiceImpl implements IRegionService {
}
@Override
public List<RegionTree> queryForTree(String query, Integer parent) {
public List<RegionTree> queryForTree(String query, Integer parent, Boolean hasChannel) {
List<RegionTree> regionList = regionMapper.queryForTree(query, parent);
if (parent != null) {
if (parent != null && hasChannel != null && hasChannel) {
Region parentRegion = regionMapper.queryOne(parent);
if (parentRegion != null) {
List<RegionTree> channelList = commonGBChannelMapper.queryForRegionTreeByCivilCode(query, parentRegion.getDeviceId());
@@ -224,4 +224,31 @@ public class RegionServiceImpl implements IRegionService {
return true;
}
@Override
public List<Region> getPath(String deviceId) {
Region region = regionMapper.queryByDeviceId(deviceId);
if (region == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "行政区划不存在");
}
List<Region> allParent = getAllParent(region);
allParent.add(region);
return allParent;
}
private List<Region> getAllParent(Region region) {
if (region.getParentId() == null) {
return new ArrayList<>();
}
List<Region> regionList = new ArrayList<>();
Region parent = regionMapper.queryByDeviceId(region.getParentDeviceId());
if (parent == null) {
return regionList;
}
List<Region> allParent = getAllParent(parent);
allParent.add(parent);
return allParent;
}
}