diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/AreaMapEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/AreaMapEntity.java index 4deb318..9046ef4 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/entity/AreaMapEntity.java +++ b/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 io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; /** * @author ysj */ +@EqualsAndHashCode(callSuper = true) @ApiModel("区域地图配置实体类") -@AllArgsConstructor -@NoArgsConstructor -@Builder @TableName("hzims_area_map_config") +@Data public class AreaMapEntity extends TenantEntity { @ApiModelProperty("区域机构ID") @@ -23,4 +21,7 @@ public class AreaMapEntity extends TenantEntity { @ApiModelProperty("地图编码") private String mapCode; + + @ApiModelProperty("地图名称") + private String mapName; } \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/AreaMapVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/config/vo/AreaMapVo.java new file mode 100644 index 0000000..1d48857 --- /dev/null +++ b/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; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java index b80c630..3323447 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/MapMarkerVo.java +++ b/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 { @ApiModelProperty(value = "机构ID") - private Long deptId; + private String deptId; @ApiModelProperty(value = "站点名称") private String stationName; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java index c9d160d..ca50cc4 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java @@ -417,7 +417,7 @@ public class EmInfoController extends BladeController { @GetMapping("/hkVideoDevices") @ApiOperationSupport(order = 12) @ApiOperation(value = "海康视频设备获取") - public R> hkVideoDevices(@RequestParam("deptId") Long deptId) { + public R> hkVideoDevices(@RequestParam(value = "deptId",required = false) Long deptId) { return R.data(em_infoService.hkVideoDevices(deptId)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/AreaMapController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/AreaMapController.java index 8b4cd70..a996ee4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/AreaMapController.java +++ b/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; +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.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.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springblade.core.log.annotation.ApiLog; +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 @AllArgsConstructor @Api(value = "区域地图配置",tags = "区域地图配置") -@RequestMapping("/areaMap") +@RequestMapping("/area") 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> list(AreaMapVo vo, Query query) { + return R.data(service.pageCondition(vo, query)); + } + + @ApiLog + @ApiOperation("获取百度地图编码") + @GetMapping("/map") + @ApiOperationSupport(order = 5) + public R> map(@ApiParam(value = "区域机构ID") Long deptId, @RequestParam(value ="types") List types) { + return R.data(service.map(deptId,types,false)); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/AreaMapService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/AreaMapService.java index 287cc24..edf1601 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/AreaMapService.java +++ b/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; +import com.baomidou.mybatisplus.core.metadata.IPage; 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.support.Query; +import org.springblade.core.tool.api.R; + +import java.util.List; /** * @author ysj */ public interface AreaMapService extends BaseService { + IPage pageCondition(AreaMapVo vo, Query query); + + List map(Long deptId, List types, boolean make); } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/AreaMapServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/AreaMapServiceImpl.java index f829010..7bd56bc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/AreaMapServiceImpl.java +++ b/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; +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.mapper.AreaMapMapper; 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 org.apache.commons.collections4.MapUtils; 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 java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + /** * @author ysj @@ -15,4 +37,81 @@ import org.springframework.stereotype.Service; @RequiredArgsConstructor public class AreaMapServiceImpl extends BaseServiceImpl implements AreaMapService { + private final AreaService areaService; + + private final ISysClient sysClient; + + /** + * 分页查询 + * @param vo + * @param query + * @return + */ + @Override + public IPage pageCondition(AreaMapVo vo, Query query) { + LambdaQueryWrapper 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 map(Long deptId, List types, boolean make) { + if(CollectionUtil.isEmpty(types)){ + types = Collections.singletonList(HomePageConstant.HYDROPOWER); + } + // 获取集团/区域map结构数据 + Map> deptMap = areaService.areaOrStaion(deptId,types,make); + if (MapUtils.isEmpty(deptMap)) { + return null; + } + List 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 R = sysClient.getRegion(arrCode[1]); + if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) { + vo.setAreaName(R.getData().getName()); + } + list.add(vo); + }); + // 区域地图编码配置替换 + List areaMaps = this.list(); + if(!CollectionUtil.isEmpty(areaMaps)){ + return list.stream().peek(map->{ + List 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; + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/wrapper/AreaMapWrapper.java new file mode 100644 index 0000000..d7f01b9 --- /dev/null +++ b/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 { + + 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; + } +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java index 4bcc04d..3a41efc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/QdnHomeController.java +++ b/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 ISideHustleService regionService; - private final HydropowerService hydropowerService; @ApiLog @@ -52,12 +50,4 @@ public class QdnHomeController extends BladeController { public R KPIs(@ApiParam(value = "站点机构ID") Long deptId) { return R.data(hydropowerService.KPIs(deptId,false)); } - - @ApiLog - @ApiOperation("获取地图标记") - @GetMapping("/getMapMarker") - @ApiOperationSupport(order = 6) - public R> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId, @RequestParam(value ="types") List types) { - return R.data(regionService.getMapMarker(deptId,types,false)); - } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java index a589b16..54c768d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java @@ -70,14 +70,6 @@ public class SideHustleController extends BladeController { } @ApiLog - @ApiOperation("获取地图标记") - @GetMapping("/getMapMarker") - @ApiOperationSupport(order = 6) - public R> getMapMarker(@ApiParam(value = "区域机构ID") Long deptId,@RequestParam(value ="types") List types) { - return R.data(regionService.getMapMarker(deptId,types,true)); - } - - @ApiLog @ApiOperation("区域当月发电量完成情况") @GetMapping("/powerFinishMonth") @ApiOperationSupport(order = 7) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java index 5c6000c..aeb8520 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java @@ -26,7 +26,5 @@ public interface ISideHustleService { List areaScale(Long deptId); - List getMapMarker(Long deptId,List types,boolean make); - List getStaionPlanPower(Map> map); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java index cdf5868..d2ce385 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java +++ b/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 getMapMarker(Long deptId,List types,boolean make) { - if(CollectionUtil.isEmpty(types)){ - types = Collections.singletonList(HomePageConstant.HYDROPOWER); - } - // 获取集团/区域map结构数据 - Map> deptMap = areaService.areaOrStaion(deptId,types,make); - if (MapUtils.isEmpty(deptMap)) { - return null; - } - List 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 R = sysClient.getRegion(arrCode[1]); - if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) { - vo.setAreaName(R.getData().getName()); - } - list.add(vo); - }); - return list; - } - - /** * 获取站点数据 * @return */