Browse Source

#首页区域地图修改

zhongwei
yang_shj 9 months ago
parent
commit
b502e61952
  1. 13
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/AreaMapEntity.java
  2. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/AreaMapVo.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java
  4. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  5. 66
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/AreaMapController.java
  6. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/AreaMapService.java
  7. 99
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/AreaMapServiceImpl.java
  8. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java
  9. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java
  10. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java
  11. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java
  12. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

13
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/AreaMapEntity.java

@ -3,19 +3,17 @@ package com.hnac.hzims.operational.config.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.Data;
import lombok.Builder; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
/** /**
* @author ysj * @author ysj
*/ */
@EqualsAndHashCode(callSuper = true)
@ApiModel("区域地图配置实体类") @ApiModel("区域地图配置实体类")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("hzims_area_map_config") @TableName("hzims_area_map_config")
@Data
public class AreaMapEntity extends TenantEntity { public class AreaMapEntity extends TenantEntity {
@ApiModelProperty("区域机构ID") @ApiModelProperty("区域机构ID")
@ -23,4 +21,7 @@ public class AreaMapEntity extends TenantEntity {
@ApiModelProperty("地图编码") @ApiModelProperty("地图编码")
private String mapCode; private String mapCode;
@ApiModelProperty("地图名称")
private String mapName;
} }

17
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/AreaMapVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.config.vo;
import com.hnac.hzims.operational.config.entity.AreaMapEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author ysj
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AreaMapVo extends AreaMapEntity {
@ApiModelProperty("用户名称")
private String userName;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java

@ -14,7 +14,7 @@ import org.springblade.core.mp.support.QueryField;
public class MapMarkerVo { public class MapMarkerVo {
@ApiModelProperty(value = "机构ID") @ApiModelProperty(value = "机构ID")
private Long deptId; private String deptId;
@ApiModelProperty(value = "站点名称") @ApiModelProperty(value = "站点名称")
private String stationName; private String stationName;

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -417,7 +417,7 @@ public class EmInfoController extends BladeController {
@GetMapping("/hkVideoDevices") @GetMapping("/hkVideoDevices")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
@ApiOperation(value = "海康视频设备获取") @ApiOperation(value = "海康视频设备获取")
public R<List<EmInfoEntity>> hkVideoDevices(@RequestParam("deptId") Long deptId) { public R<List<EmInfoEntity>> hkVideoDevices(@RequestParam(value = "deptId",required = false) Long deptId) {
return R.data(em_infoService.hkVideoDevices(deptId)); return R.data(em_infoService.hkVideoDevices(deptId));
} }

66
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/AreaMapController.java

@ -1,11 +1,29 @@
package com.hnac.hzims.operational.config.controller; package com.hnac.hzims.operational.config.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.config.entity.AreaMapEntity;
import com.hnac.hzims.operational.config.service.AreaMapService; import com.hnac.hzims.operational.config.service.AreaMapService;
import com.hnac.hzims.operational.config.vo.AreaMapVo;
import com.hnac.hzims.operational.fill.entity.OtherEntity;
import com.hnac.hzims.operational.fill.vo.OtherVo;
import com.hnac.hzims.operational.main.vo.MapMarkerVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springframework.web.bind.annotation.RequestMapping; import org.springblade.core.log.annotation.ApiLog;
import org.springframework.web.bind.annotation.RestController; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/** /**
@ -14,8 +32,48 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
@Api(value = "区域地图配置",tags = "区域地图配置") @Api(value = "区域地图配置",tags = "区域地图配置")
@RequestMapping("/areaMap") @RequestMapping("/area")
public class AreaMapController extends BladeController { public class AreaMapController extends BladeController {
private AreaMapService areaMapService; private AreaMapService service;
@PostMapping("/save")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增", notes = "传入AreaMapEntity对象")
public R save(@RequestBody AreaMapEntity entity) {
return R.status(service.save(entity));
}
@PostMapping("/remove")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.deleteLogic(Func.toLongList(ids)));
}
@PostMapping("/update")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "修改")
public R update(@Valid @RequestBody AreaMapEntity entity) {
return R.status(service.updateById(entity));
}
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 4)
@OperationAnnotation(moduleName = "区域地图配置",
title = "区域地图配置",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页区域地图配置")
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
public R<IPage<AreaMapVo>> list(AreaMapVo vo, Query query) {
return R.data(service.pageCondition(vo, query));
}
@ApiLog
@ApiOperation("获取百度地图编码")
@GetMapping("/map")
@ApiOperationSupport(order = 5)
public R<List<MapMarkerVo>> map(@ApiParam(value = "区域机构ID") Long deptId, @RequestParam(value ="types") List<Integer> types) {
return R.data(service.map(deptId,types,false));
}
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/AreaMapService.java

@ -1,12 +1,22 @@
package com.hnac.hzims.operational.config.service; package com.hnac.hzims.operational.config.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.config.entity.AreaMapEntity; import com.hnac.hzims.operational.config.entity.AreaMapEntity;
import com.hnac.hzims.operational.config.vo.AreaMapVo;
import com.hnac.hzims.operational.main.vo.MapMarkerVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/** /**
* @author ysj * @author ysj
*/ */
public interface AreaMapService extends BaseService<AreaMapEntity> { public interface AreaMapService extends BaseService<AreaMapEntity> {
IPage<AreaMapVo> pageCondition(AreaMapVo vo, Query query);
List<MapMarkerVo> map(Long deptId, List<Integer> types, boolean make);
} }

99
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/AreaMapServiceImpl.java

@ -1,12 +1,34 @@
package com.hnac.hzims.operational.config.service.impl; package com.hnac.hzims.operational.config.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.config.entity.AreaMapEntity; import com.hnac.hzims.operational.config.entity.AreaMapEntity;
import com.hnac.hzims.operational.config.mapper.AreaMapMapper; import com.hnac.hzims.operational.config.mapper.AreaMapMapper;
import com.hnac.hzims.operational.config.service.AreaMapService; import com.hnac.hzims.operational.config.service.AreaMapService;
import com.hnac.hzims.operational.config.vo.AreaMapVo;
import com.hnac.hzims.operational.config.wrapper.AreaMapWrapper;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.vo.MapMarkerVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.entity.Region;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
@ -15,4 +37,81 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AreaMapServiceImpl extends BaseServiceImpl<AreaMapMapper, AreaMapEntity> implements AreaMapService { public class AreaMapServiceImpl extends BaseServiceImpl<AreaMapMapper, AreaMapEntity> implements AreaMapService {
private final AreaService areaService;
private final ISysClient sysClient;
/**
* 分页查询
* @param vo
* @param query
* @return
*/
@Override
public IPage<AreaMapVo> pageCondition(AreaMapVo vo, Query query) {
LambdaQueryWrapper<AreaMapEntity> queryWrapper = new LambdaQueryWrapper();
queryWrapper.orderByDesc(AreaMapEntity::getCreateTime);
if(!ObjectUtil.isEmpty(vo.getAreaId())){
queryWrapper.eq(AreaMapEntity::getAreaId,vo.getAreaId());
}
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = AreaMapWrapper.build().listVO(pages.getRecords());
return pages.setRecords(list);
}
/**
* 获取地图标记
* @param deptId
* @return
*/
@Override
public List<MapMarkerVo> map(Long deptId, List<Integer> types, boolean make) {
if(CollectionUtil.isEmpty(types)){
types = Collections.singletonList(HomePageConstant.HYDROPOWER);
}
// 获取集团/区域map结构数据
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,types,make);
if (MapUtils.isEmpty(deptMap)) {
return null;
}
List<MapMarkerVo> list = new ArrayList<>();
deptMap.forEach((key,value)->{
MapMarkerVo vo = new MapMarkerVo();
vo.setDeptId(key.getId().toString());
vo.setStationName(key.getDeptName());
// 获取第一个站点经纬度、行政编码信息
StationEntity station = value.get(0);
if(ObjectUtil.isEmpty(station)){
return;
}
if(make && 2 == station.getStatus()){
return;
}
vo.setDataOrigin(station.getDataOrigin());
vo.setLttd(station.getLttd());
vo.setLgtd(station.getLgtd());
String areaCode = station.getAreaCode();
if(StringUtil.isBlank(areaCode)){
return;
}
String[] arrCode = areaCode.split(",");
vo.setAreaCode(arrCode[1] + "00");
R<Region> R = sysClient.getRegion(arrCode[1]);
if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) {
vo.setAreaName(R.getData().getName());
}
list.add(vo);
});
// 区域地图编码配置替换
List<AreaMapEntity> areaMaps = this.list();
if(!CollectionUtil.isEmpty(areaMaps)){
return list.stream().peek(map->{
List<AreaMapEntity> contains = areaMaps.stream().filter(o-> map.getDeptId().contains(o.getAreaId().toString())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(contains)){
map.setAreaCode(contains.get(0).getMapCode());
}
}).collect(Collectors.toList());
}
return list;
}
} }

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java

@ -0,0 +1,32 @@
package com.hnac.hzims.operational.config.wrapper;
import com.hnac.hzims.operational.config.entity.AreaMapEntity;
import com.hnac.hzims.operational.config.vo.AreaMapVo;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
/**
* @author ysj
*/
public class AreaMapWrapper extends BaseEntityWrapper<AreaMapEntity, AreaMapVo> {
public static AreaMapWrapper build() {
return new AreaMapWrapper();
}
@Override
public AreaMapVo entityVO(AreaMapEntity entity) {
AreaMapVo vo = BeanUtil.copy(entity, AreaMapVo.class);
User createUser = UserCache.getUser(entity.getCreateUser());
if(ObjectUtil.isEmpty(createUser)){
return vo;
}
assert vo != null;
vo.setUserName(createUser.getName());
return vo;
}
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java

@ -33,8 +33,6 @@ public class QdnHomeController extends BladeController {
private final HomeService homeService; private final HomeService homeService;
private final ISideHustleService regionService;
private final HydropowerService hydropowerService; private final HydropowerService hydropowerService;
@ApiLog @ApiLog
@ -52,12 +50,4 @@ public class QdnHomeController extends BladeController {
public R<HydropowerScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) { public R<HydropowerScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(hydropowerService.KPIs(deptId,false)); return R.data(hydropowerService.KPIs(deptId,false));
} }
@ApiLog
@ApiOperation("获取地图标记")
@GetMapping("/getMapMarker")
@ApiOperationSupport(order = 6)
public R<List<MapMarkerVo>> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId, @RequestParam(value ="types") List<Integer> types) {
return R.data(regionService.getMapMarker(deptId,types,false));
}
} }

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java

@ -70,14 +70,6 @@ public class SideHustleController extends BladeController {
} }
@ApiLog @ApiLog
@ApiOperation("获取地图标记")
@GetMapping("/getMapMarker")
@ApiOperationSupport(order = 6)
public R<List<MapMarkerVo>> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId,@RequestParam(value ="types") List<Integer> types) {
return R.data(regionService.getMapMarker(deptId,types,true));
}
@ApiLog
@ApiOperation("区域当月发电量完成情况") @ApiOperation("区域当月发电量完成情况")
@GetMapping("/powerFinishMonth") @GetMapping("/powerFinishMonth")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java

@ -26,7 +26,5 @@ public interface ISideHustleService {
List<OldAreaScaleVo> areaScale(Long deptId); List<OldAreaScaleVo> areaScale(Long deptId);
List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types,boolean make);
List<PlanGenerationEntity> getStaionPlanPower(Map<Dept, List<StationEntity>> map); List<PlanGenerationEntity> getStaionPlanPower(Map<Dept, List<StationEntity>> map);
} }

46
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -934,52 +934,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
/** /**
* 获取地图标记
* @param deptId
* @return
*/
@Override
public List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types,boolean make) {
if(CollectionUtil.isEmpty(types)){
types = Collections.singletonList(HomePageConstant.HYDROPOWER);
}
// 获取集团/区域map结构数据
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,types,make);
if (MapUtils.isEmpty(deptMap)) {
return null;
}
List<MapMarkerVo> list = new ArrayList<>();
deptMap.forEach((key,value)->{
MapMarkerVo vo = new MapMarkerVo();
vo.setDeptId(key.getId());
vo.setStationName(key.getDeptName());
// 获取第一个站点经纬度、行政编码信息
StationEntity station = value.get(0);
if(ObjectUtil.isEmpty(station)){
return;
}
if(make && 2 == station.getStatus()){
return;
}
vo.setDataOrigin(station.getDataOrigin());
vo.setLttd(station.getLttd());
vo.setLgtd(station.getLgtd());
String areaCode = station.getAreaCode();
if(StringUtil.isBlank(areaCode)){
return;
}
vo.setAreaCode(areaCode);
String[] arrCode = areaCode.split(",");
R<Region> R = sysClient.getRegion(arrCode[1]);
if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) {
vo.setAreaName(R.getData().getName());
}
list.add(vo);
});
return list;
}
/**
* 获取站点数据 * 获取站点数据
* @return * @return
*/ */

Loading…
Cancel
Save