|
|
@@ -9,6 +9,7 @@ import com.tuoheng.admin.entity.RoadInformation; |
|
|
|
import com.tuoheng.admin.entity.Section; |
|
|
|
import com.tuoheng.admin.entity.Structure; |
|
|
|
import com.tuoheng.admin.entity.User; |
|
|
|
import com.tuoheng.admin.enums.UserTypeEnum; |
|
|
|
import com.tuoheng.admin.mapper.RoadInformationMapper; |
|
|
|
import com.tuoheng.admin.mapper.SectionMapper; |
|
|
|
import com.tuoheng.admin.mapper.StructureMapper; |
|
|
@@ -63,34 +64,41 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc |
|
|
|
} |
|
|
|
//获取用户角色 |
|
|
|
Integer type = user.getType(); |
|
|
|
IPage<StructureInfoVo> pageData = null; |
|
|
|
//如果是超级管理员,查看所有构造物 |
|
|
|
//如果是部门管理员或普通用户,查询本部门的构造物及下属部门的构造物 |
|
|
|
//数据分页 |
|
|
|
IPage<Structure> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
|
|
|
|
IPage<StructureInfoVo> pageData = structureMapper.queryPage(page,query); |
|
|
|
List<StructureInfoVo> list = pageData.getRecords().stream().map((item) -> { |
|
|
|
StructureInfoVo structureInfoVo = new StructureInfoVo(); |
|
|
|
BeanUtils.copyProperties(item, structureInfoVo); |
|
|
|
//获取构造物图片,对图片进行处理 |
|
|
|
if(StringUtils.isNotEmpty(item.getImageUrl())){ |
|
|
|
String[] imageUrls = item.getImageUrl().split(","); |
|
|
|
if(StringUtils.isNotEmpty(imageUrls)){ |
|
|
|
for (int i = 0; i < imageUrls.length; i++) { |
|
|
|
if(StringUtils.isNotEmpty(imageUrls[i])){ |
|
|
|
imageUrls[i]= CommonConfig.imageURL+imageUrls[i]; |
|
|
|
if(UserTypeEnum.SUPER_ADMIN.getCode() == type){ |
|
|
|
//数据分页 |
|
|
|
IPage<Structure> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
pageData = structureMapper.queryPage(page,query); |
|
|
|
List<StructureInfoVo> list = pageData.getRecords().stream().map((item) -> { |
|
|
|
StructureInfoVo structureInfoVo = new StructureInfoVo(); |
|
|
|
BeanUtils.copyProperties(item, structureInfoVo); |
|
|
|
//获取构造物图片,对图片进行处理 |
|
|
|
if(StringUtils.isNotEmpty(item.getImageUrl())){ |
|
|
|
String[] imageUrls = item.getImageUrl().split(","); |
|
|
|
if(StringUtils.isNotEmpty(imageUrls)){ |
|
|
|
for (int i = 0; i < imageUrls.length; i++) { |
|
|
|
if(StringUtils.isNotEmpty(imageUrls[i])){ |
|
|
|
imageUrls[i]= CommonConfig.imageURL+imageUrls[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
structureInfoVo.setImageUrl(StringUtils.join(imageUrls,",")); |
|
|
|
} |
|
|
|
structureInfoVo.setImageUrl(StringUtils.join(imageUrls,",")); |
|
|
|
} |
|
|
|
// if (StringUtils.isNotEmpty(item.getImageUrl())) { |
|
|
|
// String imageUrl = getMultipleUrl(item.getImageUrl()); |
|
|
|
// structureInfoVo.setImageUrl(imageUrl); |
|
|
|
// } |
|
|
|
return structureInfoVo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(list); |
|
|
|
return structureInfoVo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(list); |
|
|
|
|
|
|
|
} |
|
|
|
//如果是部门管理员或普通用户,查询本部门的构造物及下属部门的构造物 |
|
|
|
if(UserTypeEnum.ADMIN.getCode() == type || UserTypeEnum.ORDINARY_USER.getCode() == type){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |