图例相关接口完善等

This commit is contained in:
mi9688
2024-10-11 12:29:15 +08:00
parent 04def663c1
commit eefc4e9a45
30 changed files with 835 additions and 117 deletions

View File

@ -0,0 +1,125 @@
package com.fastbee.ggroup.domain;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 站点基础信息对象 g_site_info
*
* @author kerwincui
* @date 2024-10-10
*/
@ApiModel(value = "GSiteInfo",description = "站点基础信息 g_site_info")
@Data
public class GSiteInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 站点ID主键自增长 */
private Long id;
/** 监测站点 */
@Excel(name = "监测站点")
@ApiModelProperty("监测站点")
private String monitoringStation;
/** 站点桩号 */
@Excel(name = "站点桩号")
@ApiModelProperty("站点桩号")
private String pileNumber;
/** 项目名称 */
@Excel(name = "项目名称")
@ApiModelProperty("项目名称")
private String projectName;
/** 建设年度 */
@Excel(name = "建设年度")
@ApiModelProperty("建设年度")
private String constructionYear;
/** 设备品牌 */
@Excel(name = "设备品牌")
@ApiModelProperty("设备品牌")
private String equipmentBrand;
/** 设备型号 */
@Excel(name = "设备型号")
@ApiModelProperty("设备型号")
private String equipmentModel;
/** 站点位置 */
@Excel(name = "站点位置")
@ApiModelProperty("站点位置")
private String siteLocation;
/** 站点坐标 */
@Excel(name = "站点坐标")
@ApiModelProperty("站点坐标")
private String siteCoordinates;
/** 经度 */
@Excel(name = "经度")
@ApiModelProperty("经度")
private BigDecimal longitude;
/** 纬度 */
@Excel(name = "纬度")
@ApiModelProperty("纬度")
private BigDecimal latitude;
/** 保护范围 */
@Excel(name = "保护范围")
@ApiModelProperty("保护范围")
private String protectionScope;
/** 保护范围备注 */
@Excel(name = "保护范围备注")
@ApiModelProperty("保护范围备注")
private String protectionScopeRemarks;
/** 故障报修 */
@Excel(name = "故障报修")
@ApiModelProperty("故障报修")
private String faultReport;
/** 管理人员 */
@Excel(name = "管理人员")
@ApiModelProperty("管理人员")
private String manager;
/** 管理者手机 */
@Excel(name = "管理者手机")
@ApiModelProperty("管理者手机")
private String managerPhone;
/** 站点实际图片URL */
@Excel(name = "站点实际图片URL")
@ApiModelProperty("站点实际图片URL")
private String pictures;
/** 行政区代码 */
@Excel(name = "行政区代码")
@ApiModelProperty("行政区代码")
private String code;
/** 备注 */
@Excel(name = "备注")
@ApiModelProperty("备注")
private String remarks;
/** 删除标志0代表存在2代表删除 */
private Integer delFlag;
/** 所属站点id */
@Excel(name = "所属站点id")
@ApiModelProperty("所属站点id")
private Long siteId;
}

View File

@ -53,4 +53,5 @@ private static final long serialVersionUID = 1L;
@ApiModelProperty("项目id")
private Long projectId;
}

View File

@ -8,4 +8,5 @@ import java.util.List;
public class GGroupSiteRelateDto {
private List<Long> siteIds;//站点id列表
private Long parentId;//父节点id
private Long ProjectId;//项目id
}

View File

@ -0,0 +1,20 @@
package com.fastbee.ggroup.domain.dto;
import com.fastbee.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GLegendCateGoryDto {
/** 图标 */
private String icon;
/** 图标名称 */
private String name;
/** 图例类型名称 */
private String typeName;
/** 类别 */
private String category;
}

View File

@ -3,6 +3,8 @@ package com.fastbee.ggroup.domain.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 站点编辑对象 g_sites
*
@ -10,8 +12,7 @@ import lombok.Data;
* @date 2024-09-29
*/
@Data
public class GSitesEditDto
{
public class GSitesEditDto implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;//站点id

View File

@ -1,5 +1,8 @@
package com.fastbee.ggroup.enums;
import lombok.Getter;
@Getter
public enum GroupTagEnum {
RIVERS_LAKES(1, "江河湖泊"),
WATER_CONSERVANCY_PROJECTS(2, "水利工程"),
@ -16,14 +19,6 @@ public enum GroupTagEnum {
this.description = description;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
public static GroupTagEnum fromCode(int code) {
for (GroupTagEnum tag : GroupTagEnum.values()) {
if (tag.getCode() == code) {

View File

@ -0,0 +1,35 @@
package com.fastbee.ggroup.enums;
import lombok.Getter;
/**
* @author mi9688
* &#064;date 2024/10/09 17:00
*/
@Getter
public enum SiteTypeCategoryEnum {
//水利设施与管理
WATER_MANAGEMENT("水利设施与管理"),
//检测站
DETECTION_STATION("检测站"),
//公共设施
PUBLIC_FACILITIES("公共设施"),
//报警事件
ALARM_EVENT("报警事件"),
//其他
OTHER("其他");
private final String name;
SiteTypeCategoryEnum(String name){this.name = name;}
public static SiteTypeCategoryEnum getEnum(String name){
for(SiteTypeCategoryEnum siteTypeCategoryEnum : SiteTypeCategoryEnum.values()){
if(siteTypeCategoryEnum.getName().equals(name)){
return siteTypeCategoryEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,63 @@
package com.fastbee.ggroup.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fastbee.ggroup.domain.GSiteInfo;
/**
* 站点基础信息Mapper接口
*
* @author kerwincui
* @date 2024-10-10
*/
public interface GSiteInfoMapper extends BaseMapper<GSiteInfo>
{
/**
* 查询站点基础信息
*
* @param id 站点基础信息主键
* @return 站点基础信息
*/
public GSiteInfo selectGSiteInfoById(Long id);
/**
* 查询站点基础信息列表
*
* @param gSiteInfo 站点基础信息
* @return 站点基础信息集合
*/
public List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
/**
* 新增站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int insertGSiteInfo(GSiteInfo gSiteInfo);
/**
* 修改站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int updateGSiteInfo(GSiteInfo gSiteInfo);
/**
* 删除站点基础信息
*
* @param id 站点基础信息主键
* @return 结果
*/
public int deleteGSiteInfoById(Long id);
/**
* 批量删除站点基础信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGSiteInfoByIds(Long[] ids);
}

View File

@ -1,7 +1,10 @@
package com.fastbee.ggroup.service;
import java.util.List;
import java.util.Map;
import com.fastbee.ggroup.domain.GLegend;
import com.fastbee.ggroup.domain.dto.GLegendCateGoryDto;
import com.fastbee.ggroup.domain.dto.GLegendDto;
/**
@ -59,4 +62,11 @@ public interface IGLegendService
* @return 结果
*/
public int deleteGLegendById(Long id);
/**
* 获取不同类别图例列表
*/
public List<?> getLegendListByCategory();
}

View File

@ -1,6 +1,8 @@
package com.fastbee.ggroup.service;
import java.util.List;
import java.util.Map;
import com.fastbee.ggroup.domain.GLegendType;
/**
@ -58,4 +60,6 @@ public interface IGLegendTypeService
* @return 结果
*/
public int deleteGLegendTypeById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.ggroup.service;
import java.util.List;
import com.fastbee.ggroup.domain.GSiteInfo;
/**
* 站点基础信息Service接口
*
* @author kerwincui
* @date 2024-10-10
*/
public interface IGSiteInfoService
{
/**
* 查询站点基础信息
*
* @param id 站点基础信息主键
* @return 站点基础信息
*/
public GSiteInfo selectGSiteInfoById(Long id);
/**
* 查询站点基础信息列表
*
* @param gSiteInfo 站点基础信息
* @return 站点基础信息集合
*/
public List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo);
/**
* 新增站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int insertGSiteInfo(GSiteInfo gSiteInfo);
/**
* 修改站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
public int updateGSiteInfo(GSiteInfo gSiteInfo);
/**
* 批量删除站点基础信息
*
* @param ids 需要删除的站点基础信息主键集合
* @return 结果
*/
public int deleteGSiteInfoByIds(Long[] ids);
/**
* 删除站点基础信息信息
*
* @param id 站点基础信息主键
* @return 结果
*/
public int deleteGSiteInfoById(Long id);
}

View File

@ -51,7 +51,6 @@ public class GGroupsServiceImpl implements IGGroupsService
@Override
public List<GGroups> selectGGroupsList(GGroups gGroups)
{
List<GGroups> groups = gGroupsMapper.selectGGroupsList(gGroups);
return buildTree(groups);
}
@ -65,11 +64,9 @@ public class GGroupsServiceImpl implements IGGroupsService
private List<GGroups> buildTree(List<GGroups> groups) {
Map<Long, GGroups> map = new HashMap<>();
List<GGroups> roots = new ArrayList<>();
for (GGroups group : groups) {
map.put(group.getId(), group);
}
for (GGroups group : groups) {
Long parentId = group.getParentId();
if (parentId == null || !map.containsKey(parentId)) {
@ -86,9 +83,6 @@ public class GGroupsServiceImpl implements IGGroupsService
return roots;
}
/**
* 新增组
*

View File

@ -1,11 +1,18 @@
package com.fastbee.ggroup.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.ggroup.domain.GLegendType;
import com.fastbee.ggroup.domain.dto.GLegendCateGoryDto;
import com.fastbee.ggroup.domain.dto.GLegendDto;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GLegendMapper;
@ -19,6 +26,7 @@ import com.fastbee.ggroup.service.IGLegendService;
* @date 2024-10-08
*/
@Service
@Slf4j
public class GLegendServiceImpl implements IGLegendService
{
@Autowired
@ -45,14 +53,14 @@ public class GLegendServiceImpl implements IGLegendService
@Override
public List<GLegendDto> selectGLegendList(GLegend gLegend)
{
MPJLambdaWrapper<GLegend> wrapper = new MPJLambdaWrapper<GLegend>()
.select(GLegend::getId,GLegend::getIcon,GLegend::getType,GLegend::getName)
.select(GLegendType::getTypeName,GLegendType::getCategory)
.leftJoin(GLegendType.class,GLegendType::getId,GLegend::getType);
if(StringUtils.isNotBlank(gLegend.getSearchValue())){
wrapper.like(GLegend::getName,gLegend.getSearchValue());
}
return gLegendMapper.selectJoinList(GLegendDto.class,wrapper);
// return gLegendMapper.selectGLegendList(gLegend);
}
/**
@ -104,4 +112,32 @@ public class GLegendServiceImpl implements IGLegendService
{
return gLegendMapper.deleteGLegendById(id);
}
@Override
public List<?> getLegendListByCategory() {
MPJLambdaWrapper<GLegend> wrapper = new MPJLambdaWrapper<GLegend>()
.select(GLegend::getIcon, GLegend::getName)
.select(GLegendType::getTypeName, GLegendType::getCategory)
.leftJoin(GLegendType.class, GLegendType::getId, GLegend::getType);
// 获取所有的 GLegendCateGoryDto 列表
List<GLegendCateGoryDto> gLegendCateGoryList = gLegendMapper.selectJoinList(GLegendCateGoryDto.class, wrapper);
// 按照类别分成多个list结集合
gLegendCateGoryList.forEach(System.err::println);
Map<String, List<GLegendCateGoryDto>> map = gLegendCateGoryList.stream()
.collect(Collectors.groupingBy(GLegendCateGoryDto::getCategory));
System.err.println(map);
List<Map<String, Object>> list=new ArrayList<>();
// 循环这个map
for (Map.Entry<String, List<GLegendCateGoryDto>> entry : map.entrySet()) {
System.err.println(entry.getKey() + " : " + entry.getValue());
Map<String,Object> itemMap=new HashMap<>();
itemMap.put("category",entry.getKey());
itemMap.put("list",entry.getValue());
list.add(itemMap);
}
return list;
}
}

View File

@ -1,7 +1,12 @@
package com.fastbee.ggroup.service.impl;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.ggroup.enums.SiteTypeCategoryEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GLegendTypeMapper;
@ -93,4 +98,6 @@ public class GLegendTypeServiceImpl implements IGLegendTypeService
{
return gLegendTypeMapper.deleteGLegendTypeById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.fastbee.ggroup.service.impl;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.ggroup.mapper.GSiteInfoMapper;
import com.fastbee.ggroup.domain.GSiteInfo;
import com.fastbee.ggroup.service.IGSiteInfoService;
/**
* 站点基础信息Service业务层处理
*
* @author kerwincui
* @date 2024-10-10
*/
@Service
public class GSiteInfoServiceImpl implements IGSiteInfoService
{
@Autowired
private GSiteInfoMapper gSiteInfoMapper;
/**
* 查询站点基础信息
*
* @param id 站点基础信息主键
* @return 站点基础信息
*/
@Override
public GSiteInfo selectGSiteInfoById(Long id)
{
return gSiteInfoMapper.selectGSiteInfoById(id);
}
/**
* 查询站点基础信息列表
*
* @param gSiteInfo 站点基础信息
* @return 站点基础信息
*/
@Override
public List<GSiteInfo> selectGSiteInfoList(GSiteInfo gSiteInfo)
{
return gSiteInfoMapper.selectGSiteInfoList(gSiteInfo);
}
/**
* 新增站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
@Override
public int insertGSiteInfo(GSiteInfo gSiteInfo)
{
gSiteInfo.setCreateTime(DateUtils.getNowDate());
return gSiteInfoMapper.insertGSiteInfo(gSiteInfo);
}
/**
* 修改站点基础信息
*
* @param gSiteInfo 站点基础信息
* @return 结果
*/
@Override
public int updateGSiteInfo(GSiteInfo gSiteInfo)
{
gSiteInfo.setUpdateTime(DateUtils.getNowDate());
return gSiteInfoMapper.updateGSiteInfo(gSiteInfo);
}
/**
* 批量删除站点基础信息
*
* @param ids 需要删除的站点基础信息主键
* @return 结果
*/
@Override
public int deleteGSiteInfoByIds(Long[] ids)
{
return gSiteInfoMapper.deleteGSiteInfoByIds(ids);
}
/**
* 删除站点基础信息信息
*
* @param id 站点基础信息主键
* @return 结果
*/
@Override
public int deleteGSiteInfoById(Long id)
{
return gSiteInfoMapper.deleteGSiteInfoById(id);
}
}

View File

@ -3,7 +3,6 @@ package com.fastbee.ggroup.service.impl;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fastbee.common.exception.ServiceException;
@ -12,9 +11,6 @@ import com.fastbee.ggroup.domain.dto.GGroupSiteDto;
import com.fastbee.ggroup.domain.dto.GGroupSiteRelateDto;
import com.fastbee.ggroup.domain.dto.GSitesEditDto;
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -60,7 +56,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
return gSitesMapper.selectList(new LambdaQueryWrapper<GSites>()
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType)
.eq(GSites::getProjectId, 1)
.eq(GSites::getProjectId, gSites.getProjectId())
);
}
@ -75,16 +71,13 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
public int insertGSites(GGroupSiteDto gGroupSiteDto) {
GSites gSites = new GSites();
gSites.setName(gGroupSiteDto.getName().trim());
gSites.setType(gGroupSiteDto.getType());
gSites.setIcon(gGroupSiteDto.getIcon());
gSites.setProjectId(gGroupSiteDto.getProjectId());
//根据名称判断是否存在该站点
GSites gSites1 = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
BeanUtils.copyProperties(gGroupSiteDto, gSites);
//是否存在同名站点
GSites sameNameSite = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
.select(GSites::getName, GSites::getId)
.eq(GSites::getName, gGroupSiteDto.getName().trim()));
if (gSites1 != null) {
throw new ServiceException("站点名称已存在");
if (Objects.isNull(sameNameSite )) {
throw new ServiceException("站点名称重复");
}
//插入站点表
int inserted = gSitesMapper.insert(gSites);
@ -102,22 +95,13 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
*/
@Override
public int updateGSites(GSitesEditDto gSitesEditDto) {
//查修改前站点名称
GSites gSites = gSitesMapper.selectGSitesById(gSitesEditDto.getId());
if (Objects.isNull(gSites)) {
throw new ServiceException("修改站点不存在!");
}
//判断修改后是否和修改前一致
if(gSites.getName().trim().equals(gSitesEditDto.getName().trim())){
return 1;
}
//不能有重复名字的站点
GSites gSites1 = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
//是否存在同名站点
GSites sameNameSite = gSitesMapper.selectOne(new LambdaQueryWrapper<GSites>()
.select(GSites::getName, GSites::getId)
.eq(GSites::getName, gSitesEditDto.getName().trim()));
if (Objects.nonNull(gSites1)) {
throw new ServiceException("站点名称已存在");
.eq(GSites::getName, gSitesEditDto.getName().trim())
.ne(GSites::getId, gSitesEditDto.getId()));
if (Objects.nonNull(sameNameSite)) {
throw new ServiceException("站点名称重复");
}
GSites sites = new GSites();
BeanUtils.copyProperties(gSitesEditDto, sites);
@ -144,20 +128,17 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteGSitesById(Long id) {
GSiteGroups gSiteGroups = gSiteGroupsMapper.selectGSiteGroupsById(id);
if (Objects.isNull(gSiteGroups)) {
throw new ServiceException("站点不存在");
}
// int deleted = gSitesMapper.deleteById(gSiteGroups.getSiteId());
//删除关系
return gSiteGroupsMapper.deleteById(id);
}
/**
* 站点关联组
* @param gGroupSiteRelateDto 传输对象
* @return 结果
*/
@Override
public int relateGroup(GGroupSiteRelateDto gGroupSiteRelateDto) {
Long parentId = gGroupSiteRelateDto.getParentId();
if (StringUtils.isBlank(parentId.toString())) {
if (StringUtils.isBlank(gGroupSiteRelateDto.getParentId().toString())) {
throw new ServiceException("请选择分组!");
}
List<Long> siteIds = gGroupSiteRelateDto.getSiteIds();
@ -170,8 +151,8 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
.collect(Collectors.toList())
.stream()
.map(item -> {
item.setParentId(parentId);
item.setProjectId(1L);
item.setParentId(gGroupSiteRelateDto.getParentId());
item.setProjectId(gGroupSiteRelateDto.getProjectId());
return item;
})
.collect(Collectors.toList()));