Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
#	hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
zhongwei
haungxing 6 months ago
parent
commit
b12bbcf42a
  1. 7
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  3. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClient.java
  4. 15
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClientFallback.java
  5. 130
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java
  6. 44
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java
  7. 6
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  8. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java
  9. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml
  10. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  11. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java
  12. 47
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  13. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java
  14. 17
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java
  15. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java
  16. 125
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  17. 38
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java
  18. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java
  19. 61
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  20. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/RunReportConstant.java
  21. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java
  22. 134
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java
  23. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java
  24. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.xml
  25. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationRelationService.java
  26. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  27. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationRelationServiceImpl.java
  28. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  29. 19
      hzims-service/operational/src/main/resources/db/2.0.5.sql

7
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -19,6 +19,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
import com.hnac.hzims.equipment.vo.RideDeviceVo;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.vo.CreateTableVO; import org.springblade.system.vo.CreateTableVO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -84,6 +85,9 @@ public interface IEmInfoClient {
String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath"; String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath";
String EM_INFO_LIST = API_PREFIX + "/emInfoList"; String EM_INFO_LIST = API_PREFIX + "/emInfoList";
String RIDE_DEVICES = API_PREFIX + "/rideDevices";
@PostMapping(DETAIL) @PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id); EmInfoEntity getByCode(@RequestParam("code") String id);
@ -169,4 +173,7 @@ public interface IEmInfoClient {
@GetMapping(EM_INFO_LIST) @GetMapping(EM_INFO_LIST)
R<List<EmInfoEntity>> emInfoList(EmInfoEntity req); R<List<EmInfoEntity>> emInfoList(EmInfoEntity req);
@GetMapping(RIDE_DEVICES)
List<RideDeviceVo> rideDevices(List<Long> longs);
} }

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -2,6 +2,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
import com.hnac.hzims.equipment.vo.RideDeviceVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.vo.CreateTableVO; import org.springblade.system.vo.CreateTableVO;
@ -114,4 +115,9 @@ public class IEmInfoClientBack implements IEmInfoClient {
public R<List<EmInfoEntity>> emInfoList(EmInfoEntity req) { public R<List<EmInfoEntity>> emInfoList(EmInfoEntity req) {
return R.fail("远程调用失败"); return R.fail("远程调用失败");
} }
@Override
public List<RideDeviceVo> rideDevices(List<Long> longs) {
return new ArrayList<>();
}
} }

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClient.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.fill.feign;
import com.hnac.hzims.operational.OperationalConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author ysj
*/
@FeignClient(
value = OperationalConstants.APP_NAME,
fallback = IGenerateClientFallback.class
)
public interface IGenerateClient {
String API_PREFIX = "/feign/generate/";
String STATION_GENERATE_BY_TIME = API_PREFIX + "/stationGenerateByTime";
@GetMapping(STATION_GENERATE_BY_TIME)
Double stationGenerateByTime(@RequestParam("stationId") String stationId,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime);
}

15
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/feign/IGenerateClientFallback.java

@ -0,0 +1,15 @@
package com.hnac.hzims.operational.fill.feign;
import org.springframework.stereotype.Component;
/**
* @author hx
*/
@Component
public class IGenerateClientFallback implements IGenerateClient {
@Override
public Double stationGenerateByTime(String stationId, String startTime, String endTime) {
return 0.0;
}
}

130
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java

@ -0,0 +1,130 @@
package com.hnac.hzims.operational.station.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import okhttp3.internal.annotations.EverythingIsNonNull;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 站点和霍山生态流量电站的关联关系表
* @author tanghaihao
* @date 2023年10月08日 13:58
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("station_relation")
public class StationRelation implements Serializable {
private static final long serialVersionUID=1L;
/**
* ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 站点编码
*/
@TableField("station_code")
private String stationCode;
/**
* 站点名称
*/
@TableField(exist = false)
private String stationName;
/**
* 设备编码
*/
@TableField("device_code")
private String deviceCode;
/**
* 设备名称
*/
@TableField(exist = false)
private String deviceName;
/**
* 核定流量
*/
@TableField("flow_value")
private String flowValue;
/**
* 低级告警负责人id
*/
@TableField("low_soe_user_id")
private String lowSoeUserId;
/**
* 低级告警电话号码
*/
@TableField("low_soe_phone")
private String lowSoePhone;
/**
* 中级告警负责人id
*/
@TableField("middle_soe_user_id")
private String middleSoeUserId;
/**
* 中级告警电话号码
*/
@TableField("middle_soe_phone")
private String middleSoePhone;
/**
* 高级告警负责人id
*/
@TableField("high_soe_user_id")
private String highSoeUserId;
/**
* 高级告警电话号码
*/
@TableField("high_soe_phone")
private String highSoePhone;
/**
* 当日是否发送预警
*/
@TableField("send_warning")
private Integer sendWarning;
/**
* 当日是否发送告警
*/
@TableField("send_soe")
private Integer sendSoe;
/**
* 创建时间
*/
@TableField("create_time")
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField("update_time")
private LocalDateTime updateTime;
/**
* 逻辑删除
*/
@TableField("is_deleted")
private Integer isDeleted;
}

44
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/vo/HomeMapStationVo.java

@ -0,0 +1,44 @@
package com.hnac.hzims.operational.station.vo;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.mp.support.QueryField;
/**
* @author ysj
*/
@Data
public class HomeMapStationVo {
@ApiModelProperty("行政区划")
private String areaCode;
@ApiModelProperty("编号")
private String code;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("经度(东经)")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float lgtd;
@ApiModelProperty("纬度(北纬)")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float lttd;
@ApiModelProperty("所属机构")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long refDept;
@ApiModelProperty("站点是否为国外 1:是;0:否")
private Boolean isAbroad;
@ApiModelProperty("所属国家")
private String refCountry;
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -9,6 +9,7 @@ import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.DeviceVO;
import com.hnac.hzims.equipment.vo.RideDeviceVo;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -155,6 +156,11 @@ public class EmInfoClient implements IEmInfoClient {
return R.data(service.list(queryWrapper)); return R.data(service.list(queryWrapper));
} }
@Override
public List<RideDeviceVo> rideDevices(List<Long> deptIds) {
return service.rideDevices(deptIds);
}
@PostMapping(GET_EM_CREATE_TABLE) @PostMapping(GET_EM_CREATE_TABLE)
@Override @Override
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) { public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {

1
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java

@ -19,4 +19,5 @@ public interface EmParamMapper extends UserDataScopeBaseMapper<EmParamEntity> {
List<EmParamEntity> selectRideCountGroupEmIdByDepts(@Param("list") List<Long> list); List<EmParamEntity> selectRideCountGroupEmIdByDepts(@Param("list") List<Long> list);
List<EmParamEntity> rides(List<Long> deviceIds);
} }

9
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.xml

@ -53,4 +53,13 @@
'installedCapacity') 'installedCapacity')
</select> </select>
<select id="rides" resultType="com.hnac.hzims.equipment.entity.EmParamEntity">
SELECT * FROM HZIMS_EM_PARAM
WHERE `IS_DELETED` = 0
AND (PARAM_NAME = 'ct' OR PARAM_NAME = 'CT' OR PARAM_NAME = 'PR' OR PARAM_NAME = 'pt')
AND INFO_ID IN
<foreach collection="deviceIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>

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

@ -98,4 +98,6 @@ public interface IEmInfoService extends BaseService<EmInfoEntity> {
List<EmInfoEntity> select(Long deptId); List<EmInfoEntity> select(Long deptId);
List<EmInfoTreeVO> getEmInfoTree(EmInfoEntity req); List<EmInfoTreeVO> getEmInfoTree(EmInfoEntity req);
List<RideDeviceVo> rideDevices(List<Long> deptIds);
} }

1
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmParamService.java

@ -19,4 +19,5 @@ public interface IEmParamService extends BaseService<EmParamEntity> {
Map<Long, Map<String,Double>> getRideCountGroupEmIdByDepts(List<Long> emIds); Map<Long, Map<String,Double>> getRideCountGroupEmIdByDepts(List<Long> emIds);
List<EmParamEntity> rides(List<Long> deviceIds);
} }

47
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -949,4 +949,51 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return this.baseMapper.getEmInfoTree(queryWrapper); return this.baseMapper.getEmInfoTree(queryWrapper);
} }
@Override
public List<RideDeviceVo> rideDevices(List<Long> deptIds) {
// 查询设备
List<EmInfoEntity> devices = this.list(Wrappers.<EmInfoEntity>lambdaQuery()
.in(EmInfoEntity::getDepartment,deptIds)
.eq(EmInfoEntity::getHomePageDisplay,"1")
.eq(EmInfoEntity::getEmType,"2")
);
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
List<EmParamEntity> paramList = paramService.rides(devices.stream().map(EmInfoEntity::getId).collect(Collectors.toList()));
return devices.stream().map(device->{
RideDeviceVo rideDevice = new RideDeviceVo();
BeanUtil.copyProperties(device,rideDevice);
// 寻找设备配置参数
List<EmParamEntity> itemParamList = paramList.stream().filter(o->device.getId().equals(o.getInfoId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(itemParamList)) {
// 遍历设备配置参数
for (EmParamEntity paramEntity : itemParamList) {
String paramName = paramEntity.getParamName();
switch (paramName) {
case "ct":
case "CT":
rideDevice.setCt(Double.parseDouble(paramEntity.getParamValue()));
break;
case "pt":
case "PT":
rideDevice.setPt(Double.parseDouble(paramEntity.getParamValue()));
break;
default:
break;
}
}
// 设置ct * pt
if (null != rideDevice.getCt() && null != rideDevice.getPt()) {
rideDevice.setRide(rideDevice.getCt() * rideDevice.getPt());
}else{
rideDevice.setRide(1.0);
}
}else{
rideDevice.setRide(1.0);
}
return rideDevice;
}).collect(Collectors.toList());
}
} }

5
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java

@ -69,4 +69,9 @@ public class EmParamServiceImpl extends BaseServiceImpl<EmParamMapper, EmParamEn
return result; return result;
} }
@Override
public List<EmParamEntity> rides(List<Long> deviceIds) {
return this.baseMapper.rides(deviceIds);
}
} }

17
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java

@ -1,6 +1,5 @@
package com.hnac.hzims.bigmodel.interactive.controller; package com.hnac.hzims.bigmodel.interactive.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.BigModelConstants; import com.hnac.hzims.bigmodel.BigModelConstants;
@ -8,7 +7,6 @@ import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq;
import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzinfo.log.annotation.Business; import com.hnac.hzinfo.log.annotation.Business;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -16,9 +14,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.system.dto.ControlDTO; import org.springblade.system.dto.ControlDTO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Author: huangxing * @Author: huangxing
@ -84,4 +80,15 @@ public class InteractiveController {
public R resolveStations(String startTime,String endTime,String type,String enumType) { public R resolveStations(String startTime,String endTime,String type,String enumType) {
return R.data(interactiveService.resolveStations(startTime,endTime,type,enumType)); return R.data(interactiveService.resolveStations(startTime,endTime,type,enumType));
} }
@ApiOperation("站点发电量")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/generation",method = {RequestMethod.GET,RequestMethod.POST})
public R generation(@RequestParam @ApiParam("站点编号") String stationId,
@RequestParam @ApiParam("开始时间") String startTime,
@RequestParam @ApiParam("结束时间")String endTime) {
double generate = interactiveService.generation(stationId,startTime,endTime);
DecimalFormat format = new DecimalFormat("0.00");
return R.data(format.format(generate) + "kwh");
}
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java

@ -46,4 +46,6 @@ public interface IInteractiveService {
R knowledgeAsk(String question, String sessionId, String userId, String knowledge); R knowledgeAsk(String question, String sessionId, String userId, String knowledge);
R<Object> sendRemoteControl(ControlDTO operate); R<Object> sendRemoteControl(ControlDTO operate);
Double generation(String stationId, String startTime, String endTime);
} }

125
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java

@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl; import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl;
import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.entity.FunctionEntity;
import com.hnac.hzims.bigmodel.function.service.IFunctionService; import com.hnac.hzims.bigmodel.function.service.IFunctionService;
@ -20,16 +21,26 @@ import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.RideDeviceVo;
import com.hnac.hzims.operational.fill.feign.IGenerateClient;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.xxl.job.core.log.XxlJobLogger; import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.*;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.dto.ControlDTO; import org.springblade.system.dto.ControlDTO;
import org.springblade.system.dto.DeptStationDTO; import org.springblade.system.dto.DeptStationDTO;
import org.springblade.system.feign.IDeptClient; import org.springblade.system.feign.IDeptClient;
@ -41,7 +52,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants.TypeEnum; import static com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants.TypeEnum;
@ -58,8 +72,14 @@ public class InteractiveServiceImpl implements IInteractiveService {
private final BladeLogger logger; private final BladeLogger logger;
private final IEmInfoClient deviceClient;
private final IRemoteClient remoteClient; private final IRemoteClient remoteClient;
private final IStationClient stationClient;
private final IGenerateClient generateClient;
private final IJumpPageService jumpPageService; private final IJumpPageService jumpPageService;
private final IParamsService paramsService; private final IParamsService paramsService;
@ -74,8 +94,12 @@ public class InteractiveServiceImpl implements IInteractiveService {
private final IStationClient stationClient; private final IStationClient stationClient;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final ExtraResolveStrategyService extraResolveStrategyService; private final ExtraResolveStrategyService extraResolveStrategyService;
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("station-device-generate-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
@Value("${fdp.host}") @Value("${fdp.host}")
private String fdpHost; private String fdpHost;
@ -330,4 +354,97 @@ public class InteractiveServiceImpl implements IInteractiveService {
public R<Object> sendRemoteControl(ControlDTO operate) { public R<Object> sendRemoteControl(ControlDTO operate) {
return remoteClient.sendCtrl(operate); return remoteClient.sendCtrl(operate);
} }
/**
* 站点发电量
* @param stationId
* @param startTime
* @param endTime
* @return
*/
@Override
public Double generation(String stationId, String startTime, String endTime) {
// 步骤1.查询站点
R<StationEntity> station = stationClient.getStationByCode(stationId);
if(!station.isSuccess() || ObjectUtil.isEmpty(station.getData())){
return 0.0;
}
// 步骤2.查询填报发电量
double fill = generateClient.stationGenerateByTime(stationId,startTime,endTime);
// 步骤3.查询设备
List<RideDeviceVo> devices = deviceClient.rideDevices(Collections.singletonList(station.getData().getRefDept()));
if(CollectionUtil.isEmpty(devices)){
return fill;
}
// 步骤4.遍历设备查询发电量
// 监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(devices.size());
List<Double> deviceGenerate = new CopyOnWriteArrayList();
for(RideDeviceVo device : devices){
pool.submit(()->{
deviceGenerate.add(this.periodTargetFloat(startTime,endTime,5,6,device.getNumber(),device.getRide(), HomePageConstant.HYDROPOWER_GENERATE_POWER));
});
countDownLatch.countDown();
}
//所有模板数据获取完成后释放锁
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
return fill + deviceGenerate.stream().mapToDouble(Double::doubleValue).sum();
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标
* @return
*/
private Double periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setKeepFigures(2);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return 0.0;
}
List<AnalyzeDataConditionVO> records = result.getData();
if(CollectionUtil.isEmpty(records)){
return 0.0;
}
AnalyzeDataConditionVO analyzeDataConditionVO = records.get(0);
if (ObjectUtil.isEmpty(analyzeDataConditionVO)) {
return 0.0;
}
List<AnalyseDataTaosVO> analyseDataTaosVOList = analyzeDataConditionVO.getList();
if (CollectionUtil.isEmpty(analyseDataTaosVOList)) {
return 0.0;
}
AnalyseDataTaosVO analyseDataTaosVO = analyzeDataConditionVO.getList().get(0);
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0.0;
}
return Double.parseDouble(analyseDataTaosVO.getVal()) * ride;
}
} }

38
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java

@ -0,0 +1,38 @@
package com.hnac.hzims.operational.fill.feign;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.service.GenerateService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@RestController
@Slf4j
@AllArgsConstructor
public class GenerateClient implements IGenerateClient {
private final GenerateService generateService;
@Override
@GetMapping(STATION_GENERATE_BY_TIME)
public Double stationGenerateByTime(String stationId, String startTime, String endTime) {
List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,stationId)
.ge(GenerateEntity::getFillDate,startTime)
.le(GenerateEntity::getGenerate,endTime)
);
if(CollectionUtil.isEmpty(generates)){
return 0.0;
}
return generates.stream().mapToDouble(GenerateEntity::getGenerate).sum();
}
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java

@ -15,10 +15,13 @@ public interface IAnalyseDataService {
<T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource); <T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource);
List<AnalyzeCodeBySignagesVO> analyzeCodeBySignages(List<MultiAnalyzeCodePO> list);
List<AnalyzeDataConditionVO> periodTargetSignages(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, List<String> signages);
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages); List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
List<AnalyseDataTaosVO> periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List<String> deviceCodes, String signages); List<AnalyseDataTaosVO> periodTargetDatas(String startTime, String endTime, Integer accessRules, Integer cycleType, List<String> deviceCodes, String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages); Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages);
} }

61
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java

@ -22,7 +22,10 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -47,6 +50,58 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
return result; return result;
} }
/**
* 查询设备实例属性标识
* @param list
* @return
*/
@Override
public List<AnalyzeCodeBySignagesVO> analyzeCodeBySignages(List<MultiAnalyzeCodePO> list) {
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
return result.getData();
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param signages 指标集合
* @return
*/
@Override
public List<AnalyzeDataConditionVO> periodTargetSignages(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, List<String> signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
signages.forEach(signage->{
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setKeepFigures(2);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
analyzeDataConditionPO.setSignages(signage);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
});
po.setSignboardConditions(signboardConditions);
log.error("period_targets_data_request {}",po);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return new ArrayList<>();
}
log.error("period_targets_data_resp {}",result);
return result.getData();
}
/*** /***
* 指标数据列表查询 * 指标数据列表查询
* @param startTime 开始时间 * @param startTime 开始时间
@ -134,7 +189,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
* @return * @return
*/ */
@Override @Override
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) { public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO(); AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
@ -170,7 +225,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) { if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f; return 0f;
} }
return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride; return Float.parseFloat(String.valueOf(Double.parseDouble(analyseDataTaosVO.getVal()) * ride)) ;
} }

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/RunReportConstant.java

@ -5,4 +5,9 @@ public interface RunReportConstant {
* 运行月报定时任务 * 运行月报定时任务
*/ */
String TASK_VALUE_RUN_REPORT_CREATE = "runReportCreateHandler"; String TASK_VALUE_RUN_REPORT_CREATE = "runReportCreateHandler";
/**
* 数据平台霍山生态流量监测模型标识
*/
String HS_MODEL_SIGNAGE = "hs_ecological_flow_model";
} }

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java

@ -10,6 +10,7 @@ import com.hnac.hzims.operational.data.service.HzimsDataService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HomeMapStationVo;
import com.hnac.hzims.operational.station.vo.StationVO; import com.hnac.hzims.operational.station.vo.StationVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -177,9 +178,9 @@ public class StationController extends BladeController {
@ApiLog @ApiLog
@GetMapping("/getHomeStationList") @GetMapping("/getHomeStationList")
@ApiOperationSupport(order = 91) @ApiOperationSupport(order = 91)
@ApiOperation(value = "获取首页站点列表", notes = "") @ApiOperation(value = "获取首页地图站点列表", notes = "")
public R<List<StationEntity>> getHomeStationList(@RequestParam(value = "deptId", required = false) Long deptId, @RequestParam(value = "types", required = false) List<Integer> types, @RequestParam(value = "serveType", required = false) Integer serveType) { public R<List<HomeMapStationVo>> getHomeStationList() {
return R.data(stationService.getHomeStationList(deptId, types, serveType,true)); return R.data(stationService.homeMapStationVo());
} }
@ApiLog @ApiLog

134
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java

@ -0,0 +1,134 @@
package com.hnac.hzims.operational.station.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.station.RunReportConstant;
import com.hnac.hzims.operational.station.entity.StationRelation;
import com.hnac.hzims.operational.station.service.IStationRelationService;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
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;
/**
* @author tanghaihao
* @date 2023年10月08日 15:04
*/
@RestController
@RequestMapping("/station/station-relation")
@AllArgsConstructor
@Api(value = "站点和霍山生态流量电站的关联关系管理",tags = "站点和霍山生态流量电站的关联关系管理")
public class StationRelationController {
private final IStationRelationService stationRelationService;
private final DeviceClient deviceClient;
@GetMapping("/list")
@ApiOperation("查询列表")
@ApiOperationSupport(order = 1)
public R<List<StationRelation>> list(StationRelation stationRelation) {
return R.data(stationRelationService.getStationRelationList(stationRelation));
}
@GetMapping("/page")
@ApiOperation("分页查询列表")
@ApiOperationSupport(order = 2)
public R<IPage<StationRelation>> page(StationRelation stationRelation, Query query) {
return R.data(stationRelationService.getStationRelationPageList(stationRelation, query));
}
@PostMapping("/save")
@ApiOperation("保存")
@ApiOperationSupport(order = 3)
public R save(@RequestBody @Valid StationRelation stationRelation) {
if (Func.isEmpty(stationRelation.getStationCode())) {
return R.fail("站点编码不能为空");
}
if (Func.isEmpty(stationRelation.getDeviceCode())) {
return R.fail("设备编码不能为空");
}
if (Func.isEmpty(stationRelation.getLowSoeUserId())) {
return R.fail("低级告警负责人不能为空");
}
if (Func.isEmpty(stationRelation.getLowSoePhone())) {
return R.fail("低级告警电话号码不能为空");
}
if (Func.isEmpty(stationRelation.getMiddleSoeUserId())) {
return R.fail("中级告警负责人不能为空");
}
if (Func.isEmpty(stationRelation.getMiddleSoePhone())) {
return R.fail("中级告警电话号码不能为空");
}
if (Func.isEmpty(stationRelation.getHighSoeUserId())) {
return R.fail("高级告警负责人不能为空");
}
if (Func.isEmpty(stationRelation.getHighSoePhone())) {
return R.fail("高级告警电话号码不能为空");
}
if (Func.isEmpty(stationRelation.getFlowValue())) {
return R.fail("核定流量不能为空");
}
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper();
wrapper.and(item -> item.eq(StationRelation::getStationCode, stationRelation.getStationCode())
.or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode()));
wrapper.eq(StationRelation::getIsDeleted, 0);
int count = stationRelationService.count(wrapper);
if (count > 0) {
return R.fail("站点关联关系已存在");
}
return R.status(stationRelationService.save(stationRelation));
}
@PostMapping("/update")
@ApiOperation("编辑")
@ApiOperationSupport(order = 4)
public R update(@RequestBody @Valid StationRelation stationRelation) {
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper();
wrapper.and(item -> item.eq(StationRelation::getStationCode, stationRelation.getStationCode())
.or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode()));
wrapper.eq(StationRelation::getIsDeleted, 0);
wrapper.ne(StationRelation::getId, stationRelation.getId());
int count = stationRelationService.count(wrapper);
if (count > 0) {
return R.fail("站点关联关系已存在");
}
return R.status(stationRelationService.updateById(stationRelation));
}
@GetMapping("/remove")
@ApiOperation("删除")
@ApiOperationSupport(order = 5)
public R remove(Long id) {
LambdaUpdateWrapper<StationRelation> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(StationRelation::getIsDeleted, 1);
wrapper.eq(StationRelation::getId, id);
stationRelationService.update(wrapper);
return R.success("操作成功");
}
@GetMapping("/getDevice")
@ApiOperation("获取生态流量模型的设备信息")
@ApiOperationSupport(order = 6)
public R<List<DeviceInstanceVO>> getDevice() {
R<List<DeviceInstanceVO>> rData = deviceClient.getDeviceByModelSignage(RunReportConstant.HS_MODEL_SIGNAGE);
if (rData.getCode() == 200) {
List<DeviceInstanceVO> data = rData.getData();
return R.data(data);
} else {
return R.fail("获取设备信息失败");
}
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java

@ -0,0 +1,8 @@
package com.hnac.hzims.operational.station.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.station.entity.StationRelation;
public interface StationRelationMapper extends BaseMapper<StationRelation> {
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.operational.station.mapper.StationRelationMapper">
</mapper>

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationRelationService.java

@ -0,0 +1,19 @@
package com.hnac.hzims.operational.station.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.operational.station.entity.StationRelation;
import org.springblade.core.mp.support.Query;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年10月08日 15:04
*/
public interface IStationRelationService extends IService<StationRelation> {
List<StationRelation> getStationRelationList(StationRelation stationRelation);
IPage<StationRelation> getStationRelationPageList(StationRelation stationRelation, Query query);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.station.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.main.vo.StationCountVo; import com.hnac.hzims.operational.main.vo.StationCountVo;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.vo.HomeMapStationVo;
import com.hnac.hzims.operational.station.vo.StationAndDeptVo; import com.hnac.hzims.operational.station.vo.StationAndDeptVo;
import com.hnac.hzims.operational.station.vo.StationVO; import com.hnac.hzims.operational.station.vo.StationVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -136,4 +137,6 @@ public interface IStationService extends BaseService<StationEntity> {
* @return 更新是否成功 * @return 更新是否成功
*/ */
boolean updateBatchSort(List<StationEntity> req); boolean updateBatchSort(List<StationEntity> req);
List<HomeMapStationVo> homeMapStationVo();
} }

47
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationRelationServiceImpl.java

@ -0,0 +1,47 @@
package com.hnac.hzims.operational.station.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.operational.station.entity.StationRelation;
import com.hnac.hzims.operational.station.mapper.StationRelationMapper;
import com.hnac.hzims.operational.station.service.IStationRelationService;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author tanghaihao
* @date 2023年10月08日 14:37
*/
@Service
public class StationRelationServiceImpl extends ServiceImpl<StationRelationMapper, StationRelation> implements IStationRelationService {
@Override
public List<StationRelation> getStationRelationList(StationRelation stationRelation) {
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper();
if (Func.isNotEmpty(stationRelation.getStationCode())) {
wrapper.eq(StationRelation::getStationCode, stationRelation.getStationCode());
}
if (Func.isNotEmpty(stationRelation.getDeviceCode())) {
wrapper.eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode());
}
wrapper.eq(StationRelation::getIsDeleted, 0);
return this.list(wrapper);
}
@Override
public IPage<StationRelation> getStationRelationPageList(StationRelation stationRelation, Query query) {
LambdaQueryWrapper<StationRelation> wrapper = new LambdaQueryWrapper();
if (Func.isNotEmpty(stationRelation.getStationCode())) {
wrapper.eq(StationRelation::getStationCode, stationRelation.getStationCode());
}
if (Func.isNotEmpty(stationRelation.getDeviceCode())) {
wrapper.eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode());
}
wrapper.eq(StationRelation::getIsDeleted, 0);
return this.page(Condition.getPage(query), wrapper);
}
}

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -25,6 +25,7 @@ import com.hnac.hzims.operational.station.mapper.StationMapper;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationPushConfigService; import com.hnac.hzims.operational.station.service.IStationPushConfigService;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HomeMapStationVo;
import com.hnac.hzims.operational.station.vo.StationAndDeptVo; import com.hnac.hzims.operational.station.vo.StationAndDeptVo;
import com.hnac.hzims.operational.station.vo.StationPushConfigVO; import com.hnac.hzims.operational.station.vo.StationPushConfigVO;
import com.hnac.hzims.operational.station.vo.StationVO; import com.hnac.hzims.operational.station.vo.StationVO;
@ -776,4 +777,31 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
} }
return this.updateBatchById(stations); return this.updateBatchById(stations);
} }
/**
* 获取首页地图站点列表
* @return
*/
@Override
public List<HomeMapStationVo> homeMapStationVo() {
List<StationEntity> stations = this.list(Wrappers.<StationEntity>lambdaQuery()
.isNotNull(StationEntity::getRefDept)
.isNotNull(StationEntity::getAreaCode)
);
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
return stations.stream().map(o->{
HomeMapStationVo mapStation = new HomeMapStationVo();
mapStation.setAreaCode(o.getAreaCode());
mapStation.setName(o.getName());
mapStation.setCode(o.getCode());
mapStation.setLttd(o.getLttd());
mapStation.setLgtd(o.getLgtd());
mapStation.setRefDept(o.getRefDept());
mapStation.setIsAbroad(o.getIsAbroad());
mapStation.setRefCountry(o.getRefCountry());
return mapStation;
}).collect(Collectors.toList());
}
} }

19
hzims-service/operational/src/main/resources/db/2.0.5.sql

@ -0,0 +1,19 @@
DROP TABLE IF EXISTS `station_relation`;
CREATE TABLE `station_relation` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`station_code` varchar(200) DEFAULT NULL COMMENT '站点编码',
`device_code` varchar(128) DEFAULT NULL COMMENT '设备编码',
`send_warning` int(11) DEFAULT '0' COMMENT '当日是否发送预警',
`send_soe` int(11) DEFAULT '0' COMMENT '当日是否发送告警',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除',
`low_soe_user_id` varchar(20) DEFAULT NULL COMMENT '低级告警负责人id',
`low_soe_phone` varchar(20) DEFAULT NULL COMMENT '低级告警电话号码',
`middle_soe_user_id` varchar(20) DEFAULT NULL COMMENT '中级告警负责人id',
`middle_soe_phone` varchar(20) DEFAULT NULL COMMENT '中级告警电话号码',
`high_soe_user_id` varchar(20) DEFAULT NULL COMMENT '高级告警负责人id',
`high_soe_phone` varchar(20) DEFAULT NULL COMMENT '高级告警电话号码',
`flow_value` double(12,3) DEFAULT NULL COMMENT '核定流量',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='站点和霍山生态流量电站的关联关系表';
Loading…
Cancel
Save