微调
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 事件推送日志表
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-09-18
|
||||
*/
|
||||
@Data
|
||||
public class CsEventSendMsgVO {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 事件id
|
||||
*/
|
||||
private String eventId;
|
||||
|
||||
/**
|
||||
* 推送事件时用户的devCode
|
||||
*/
|
||||
private String devCode;
|
||||
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 推送时间
|
||||
*/
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime sendTime;
|
||||
|
||||
/**
|
||||
* 推送状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -29,9 +29,13 @@ public class DevCountVO {
|
||||
private Integer alarmCount;
|
||||
@ApiModelProperty(value = "事件数")
|
||||
private Integer eventCount;
|
||||
@ApiModelProperty(value = "项目数")
|
||||
private Integer projectCount;
|
||||
@ApiModelProperty(value = "工程个数")
|
||||
private Integer eningerCount;
|
||||
|
||||
@ApiModelProperty(value = "运行事件数")
|
||||
private Integer runCount;
|
||||
@ApiModelProperty(value = "稳态件数")
|
||||
private Integer harmonicCount;
|
||||
|
||||
@ApiModelProperty(value = "当前工程id")
|
||||
private String currentId;
|
||||
@@ -39,17 +43,27 @@ public class DevCountVO {
|
||||
private Integer currentOnLineDevCount;
|
||||
private List<CsEquipmentDeliveryPO> currentOnLineDevs;
|
||||
|
||||
@ApiModelProperty(value = "当前工程设备在线总数")
|
||||
@ApiModelProperty(value = "当前工程设备离线总数")
|
||||
private Integer currentOffLineDevCount;
|
||||
private List<CsEquipmentDeliveryPO> currentOffLineDevs;
|
||||
|
||||
@ApiModelProperty(value = "警告数")
|
||||
@ApiModelProperty(value = "设备警告数")
|
||||
private Integer currentAlarmCount;
|
||||
@ApiModelProperty(value = "事件数")
|
||||
@ApiModelProperty(value = "暂态事件数")
|
||||
private Integer currentEventCount;
|
||||
@ApiModelProperty(value = "运行事件数")
|
||||
private Integer currentRunCount;
|
||||
@ApiModelProperty(value = "稳态件数")
|
||||
private Integer currentHarmonicCount;
|
||||
|
||||
@ApiModelProperty(value = "项目数")
|
||||
private Integer currentProjectCount;
|
||||
|
||||
@ApiModelProperty(value = "项目数")
|
||||
private Long feedBackCount;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -140,7 +140,19 @@
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-harmonic-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>runtime</scope>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-device-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -8,8 +9,11 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -49,5 +53,16 @@ public class CsEventSendMsgController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryLog")
|
||||
@ApiOperation("查询推送日志")
|
||||
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||
public HttpResult<IPage<CsEventSendMsgVO>> queryLog(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryLog");
|
||||
IPage<CsEventSendMsgVO> list = csEventSendMsgService.queryPage(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ResponseBody
|
||||
@ApiOperation("联调完成")
|
||||
@PostMapping(value = "testcompletion")
|
||||
public HttpResult<String> testCompletion(@RequestParam("deviceId") String deviceId,@RequestParam("type") String type,@RequestParam("remark") String remark){
|
||||
public HttpResult<String> testCompletion(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
||||
String methodDescribe = getMethodDescribe("testCompletion");
|
||||
csEquipmentDeliveryService.testCompletion(deviceId,type, remark);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
@@ -231,8 +231,8 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ResponseBody
|
||||
@ApiOperation("取消联调")
|
||||
@PostMapping(value = "deleteTest")
|
||||
public HttpResult<String> deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") String type,@RequestParam("remark") String remark){
|
||||
String methodDescribe = getMethodDescribe("testCompletion");
|
||||
public HttpResult<String> deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") Integer type,@RequestParam("remark") String remark){
|
||||
String methodDescribe = getMethodDescribe("deleteTest");
|
||||
csEquipmentDeliveryService.deleteTest(deviceId,type, remark);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,5 @@ import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
*/
|
||||
public interface CsEventSendMsgMapper extends BaseMapper<CsEventSendMsg> {
|
||||
|
||||
Page<CsEventSendMsgVO> selectPages(Page<CsEventSendMsgVO> returnpage,@Param("baseParam") BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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.njcn.csdevice.mapper.CsEventSendMsgMapper">
|
||||
|
||||
<select id="selectPages" resultType="com.njcn.csdevice.pojo.vo.CsEventSendMsgVO">
|
||||
select * from cs_event_send_msg a LEFT JOIN cs_event b on a.event_id =b.id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -97,7 +97,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
|
||||
void delete(String devId);
|
||||
|
||||
void testCompletion(String deviceId,String type,String remark);
|
||||
void testCompletion(String deviceId,Integer type,String remark);
|
||||
|
||||
void deleteTest(String deviceId, String type,String remark);
|
||||
void deleteTest(String deviceId, Integer type,String remark);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +16,5 @@ import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
*/
|
||||
public interface ICsEventSendMsgService extends IService<CsEventSendMsg> {
|
||||
|
||||
IPage<CsEventSendMsgVO> queryPage(BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.njcn.csdevice.service.impl;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
@@ -14,6 +16,12 @@ import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.cssystem.api.FeedBackFeignClient;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
@@ -55,9 +63,11 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final CsMarketDataMapper csMarketDataMapper;
|
||||
|
||||
private final EventUserFeignClient eventUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
private final FeedBackFeignClient feedBackFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(String id) {
|
||||
@@ -137,8 +147,8 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
devCountVO.setOnLineDevs(collect2);
|
||||
devCountVO.setOffLineDevCount(collect.size());
|
||||
devCountVO.setOffLineDevs(collect);
|
||||
List<String> roleProject = roleEngineerDevService.getRoleProject();
|
||||
devCountVO.setProjectCount(roleProject.size());
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
devCountVO.setEningerCount(roleengineer.size());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
|
||||
@@ -151,7 +161,6 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
devCountVO.setCurrentOffLineDevCount(0);
|
||||
devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentProjectCount(0);
|
||||
devCountVO.setCurrentProjectCount(0);
|
||||
|
||||
}else {
|
||||
queryWrapper.clear();
|
||||
@@ -167,27 +176,34 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
||||
devCountVO.setCurrentProjectCount(list.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
CsEventUserQueryParam csEventUserQueryParam = new CsEventUserQueryParam();
|
||||
csEventUserQueryParam.setStatus("0");
|
||||
List<EventDetailVO> data = eventUserFeignClient.queryEventList(csEventUserQueryParam).getData();
|
||||
List<EventDetailVO> event = data.stream().filter(temp -> temp.getType() == 0).collect(Collectors.toList());
|
||||
List<EventDetailVO> harmonic = data.stream().filter(temp -> temp.getType() == 1).collect(Collectors.toList());
|
||||
List<EventDetailVO> alarm = data.stream().filter(temp -> temp.getType() == 3).collect(Collectors.toList());
|
||||
List<EventDetailVO> run = data.stream().filter(temp -> temp.getType() == 2).collect(Collectors.toList());
|
||||
CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
|
||||
csFeedbackQueryParm.setPageNum(1);
|
||||
csFeedbackQueryParm.setPageSize(10);
|
||||
csFeedbackQueryParm.setStatus("1");
|
||||
Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
|
||||
long total = data1.getTotal();
|
||||
devCountVO.setFeedBackCount(total);
|
||||
//todo 后续添加警告数,事件数
|
||||
devCountVO.setEventCount(0);
|
||||
devCountVO.setAlarmCount(0);
|
||||
devCountVO.setCurrentEventCount(0);
|
||||
devCountVO.setCurrentAlarmCount(0);
|
||||
|
||||
// csEquipmentAlarmPageParm.setStartTime();
|
||||
// csEquipmentAlarmPageParam.setEndTime();
|
||||
// List<CsEquipmentAlarmVO> data = csEquipmentAlarmFeignClient.queryList(csEquipmentAlarmPageParm).getData();
|
||||
// List<String> devIds = data.stream().map(CsEquipmentAlarmVO::getEquipmentId).distinct().collect(Collectors.toList());
|
||||
// queryWrapper.clear();
|
||||
// queryWrapper.in("id",devIds);
|
||||
//
|
||||
// List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
//
|
||||
// devCountVO.setAlarmLineDevs(csEquipmentDeliveryPOS);
|
||||
// devCountVO.setAlarmEventCount(devIds.size());
|
||||
devCountVO.setEventCount(event.size());
|
||||
devCountVO.setAlarmCount(harmonic.size());
|
||||
devCountVO.setRunCount(run.size());
|
||||
devCountVO.setHarmonicCount(alarm.size());
|
||||
List<EventDetailVO> curEvent = event.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curHarmonic = harmonic.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curAlarm = alarm.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curRun = run.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
|
||||
devCountVO.setCurrentEventCount(curEvent.size());
|
||||
devCountVO.setCurrentAlarmCount(curAlarm.size());
|
||||
devCountVO.setCurrentRunCount(curRun.size());
|
||||
devCountVO.setCurrentHarmonicCount(curHarmonic.size());
|
||||
|
||||
|
||||
return devCountVO;
|
||||
|
||||
@@ -443,12 +443,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
*/
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("id",devId);
|
||||
csLedgerService.removeById(csLedgerQueryWrapper);
|
||||
csLedgerService.remove(csLedgerQueryWrapper);
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("pid",devId);
|
||||
List<CsLedger> list = csLedgerService.list(csLedgerQueryWrapper);
|
||||
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
csLedgerService.removeById(csLedgerQueryWrapper);
|
||||
csLedgerService.remove(csLedgerQueryWrapper);
|
||||
QueryWrapper<CsDevModelRelationPO> csDevModelRelationPOQueryWrapper = new QueryWrapper<>();
|
||||
csDevModelRelationPOQueryWrapper.clear();
|
||||
csDevModelRelationPOQueryWrapper.eq("dev_id",devId);
|
||||
@@ -471,10 +471,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void testCompletion(String deviceId,String type,String remark) {
|
||||
public void testCompletion(String deviceId,Integer type,String remark) {
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
||||
set(CsEquipmentDeliveryPO::getStatus,0).
|
||||
set(CsEquipmentDeliveryPO::getStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getProcess,type+1).update();
|
||||
this.delete(deviceId);
|
||||
@@ -487,11 +487,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTest(String deviceId, String type ,String remark) {
|
||||
public void deleteTest(String deviceId, Integer type ,String remark) {
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||
|
||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
||||
set(CsEquipmentDeliveryPO::getStatus,0).
|
||||
set(CsEquipmentDeliveryPO::getStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||
set(CsEquipmentDeliveryPO::getProcess,type).update();
|
||||
this.delete(deviceId);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsEventSendMsgMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -17,4 +22,11 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class CsEventSendMsgServiceImpl extends ServiceImpl<CsEventSendMsgMapper, CsEventSendMsg> implements ICsEventSendMsgService {
|
||||
|
||||
@Override
|
||||
public IPage<CsEventSendMsgVO> queryPage(BaseParam baseParam) {
|
||||
Page<CsEventSendMsgVO> returnpage = new Page<> (baseParam.getPageNum ( ), baseParam.getPageSize ( ));
|
||||
|
||||
Page<CsEventSendMsgVO> result = this.getBaseMapper().selectPages(returnpage,baseParam);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/eventUser", fallbackFactory = EventUserFeignClientFallbackFactory.class,contextId = "eventUser")
|
||||
public interface EventUserFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryEventList")
|
||||
HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) ;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.csharmonic.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EventUserFeignClientFallbackFactory implements FallbackFactory<EventUserFeignClient> {
|
||||
@Override
|
||||
public EventUserFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new EventUserFeignClient() {
|
||||
|
||||
|
||||
@PostMapping("/queryEventList")
|
||||
@Override
|
||||
public HttpResult<List<EventDetailVO>> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取当天事件未读消息未读消息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ public class CommonStatisticalQueryParam {
|
||||
private List<String> lineList;
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private String DevId;
|
||||
@ApiModelProperty(value = "指标id")
|
||||
@NotBlank(message="指标id不能为空")
|
||||
@ApiModelProperty(value = "指标组id")
|
||||
@NotBlank(message="指标组id不能为空")
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "取值类型(Max,Min,cp95,avg)")
|
||||
private String valueType;
|
||||
|
||||
@@ -67,6 +67,12 @@
|
||||
<artifactId>cs-device-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-harmonic-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
|
||||
@@ -7,9 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.EventService;
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -33,17 +31,8 @@ import java.util.List;
|
||||
@Api(tags = "暂降事件")
|
||||
@AllArgsConstructor
|
||||
public class EventController extends BaseController {
|
||||
private final EventService eventService;
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEvent")
|
||||
@ApiOperation("暂降事件查询")
|
||||
@ApiImplicitParam(name = "eventQueryDTO", value = "暂降事件查询参数", required = true)
|
||||
@Deprecated
|
||||
public HttpResult<List<EntData>> queryEvent(@RequestBody EventQueryDTO eventQueryDTO) {
|
||||
String methodDescribe = getMethodDescribe("queryEvent");
|
||||
List<EntData> list = eventService.queryEvent(eventQueryDTO);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
private final CsEventPOService eventService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEventList")
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EventUserController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryEventList")
|
||||
@ApiOperation("当天暂降事件未读消息")
|
||||
@ApiOperation("当天事件未读消息")
|
||||
@ApiImplicitParam(name = "csEventUserQueryParam", value = "暂降事件查询参数", required = true)
|
||||
public HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryEventList");
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MqttMessageHandler {
|
||||
// List<Future<List<ThdDataVO>>> resultList = new ArrayList< Future<List<ThdDataVO>>>();
|
||||
|
||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("7677f94c749dedaff30f911949cbd724").getData();
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("b934664f9592d1c5e92caa90695b7103").getData();
|
||||
data.forEach(temp->{
|
||||
if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/9/4 15:15【需求编号】
|
||||
@@ -12,5 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface CsEventPOService extends IService<CsEventPO>{
|
||||
|
||||
|
||||
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/8/30 8:46【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface EventService {
|
||||
|
||||
List<EntData> queryEvent(EventQueryDTO eventQueryDTO);
|
||||
|
||||
|
||||
List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam);
|
||||
}
|
||||
@@ -1,10 +1,29 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -14,6 +33,47 @@ import com.njcn.csharmonic.service.CsEventPOService;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService{
|
||||
private final EvtDataService evtDataService;
|
||||
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final CsEventUserPOService csEventUserPOService;
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
|
||||
List<EventDetailVO> list = csEventUserPOService.queryUserEventList(csEventUserQueryParam);
|
||||
list.forEach(temp->{
|
||||
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
||||
temp.setEquipmentName(devDetail.getEquipmentName());
|
||||
temp.setProjectId(devDetail.getProjectId());
|
||||
temp.setProjectName(devDetail.getProjectName());
|
||||
temp.setEngineeringid(devDetail.getEngineeringid());
|
||||
temp.setEngineeringName(devDetail.getEngineeringName());
|
||||
EleEpdPqd data = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(data.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
for (EleEvtParm eleEvtParm : data1) {
|
||||
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
||||
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
||||
if (evtData == null) {
|
||||
eventDataSetDTO.setValue("3.1415926");
|
||||
}else {
|
||||
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("3.1415926"));
|
||||
|
||||
}
|
||||
|
||||
eventDataSetDTOS.add(eventDataSetDTO);
|
||||
}
|
||||
temp.setDataSet(eventDataSetDTOS);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,26 @@ package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -36,6 +43,8 @@ import org.springframework.util.CollectionUtils;
|
||||
public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, CsEventUserPO> implements CsEventUserPOService{
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
csEventUserQueryParam.setUserId(RequestUtil.getUserIndex());
|
||||
@@ -62,6 +71,17 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
||||
csEventUserQueryParam.setTarget(collect);
|
||||
}
|
||||
List<EventDetailVO> list = this.getBaseMapper().queryUserEventList(csEventUserQueryParam);
|
||||
|
||||
list.forEach(temp->{
|
||||
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
||||
temp.setEquipmentName(devDetail.getEquipmentName());
|
||||
temp.setProjectId(devDetail.getProjectId());
|
||||
temp.setProjectName(devDetail.getProjectName());
|
||||
temp.setEngineeringid(devDetail.getEngineeringid());
|
||||
temp.setEngineeringName(devDetail.getEngineeringName());
|
||||
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.NjcnBeanUtil;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.csharmonic.service.EventService;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.EventQueryDTO;
|
||||
import com.njcn.influx.pojo.po.cs.EntData;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/8/30 19:41【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventServiceImpl implements EventService {
|
||||
private final EvtDataService evtDataService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final CsEventUserPOService csEventUserPOService;
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
@Override
|
||||
public List<EntData> queryEvent(EventQueryDTO eventQueryDTO) {
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(eventQueryDTO.getDevId()).getData();
|
||||
if(CollectionUtil.isEmpty(csLinePOList)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
||||
}
|
||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
eventQueryDTO.setLineIds(collect);
|
||||
List<EleEpdPqd> data = epdFeignClient.selectByIds(eventQueryDTO.getTarget()).getData();
|
||||
if(CollectionUtil.isEmpty(data)){
|
||||
new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR);
|
||||
}
|
||||
List<String> collect1 = data.stream().map(EleEpdPqd::getName).collect(Collectors.toList());
|
||||
eventQueryDTO.setTarget(collect1);
|
||||
List<EntData> eventData = evtDataService.getEventData(eventQueryDTO);
|
||||
return eventData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||
|
||||
List<EventDetailVO> list = csEventUserPOService.queryUserEventList(csEventUserQueryParam);
|
||||
list.forEach(temp->{
|
||||
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
||||
temp.setEquipmentName(devDetail.getEquipmentName());
|
||||
temp.setProjectId(devDetail.getProjectId());
|
||||
temp.setProjectName(devDetail.getProjectName());
|
||||
temp.setEngineeringid(devDetail.getEngineeringid());
|
||||
temp.setEngineeringName(devDetail.getEngineeringName());
|
||||
EleEpdPqd data = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(data.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
for (EleEvtParm eleEvtParm : data1) {
|
||||
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
||||
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
||||
eventDataSetDTO.setValue(evtData.getValue());
|
||||
eventDataSetDTOS.add(eventDataSetDTO);
|
||||
}
|
||||
temp.setDataSet(eventDataSetDTOS);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.njcn.influx.service.HaronicRatioService;
|
||||
import com.njcn.influx.service.PowerQualityService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -60,6 +61,7 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
private final DecimalFormat df = new DecimalFormat("#0.0000");
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -224,6 +226,9 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
|
||||
@Override
|
||||
public List<ThdDataVO> queryCommonStatisticalByTime(CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
||||
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
|
||||
Optional.ofNullable(commonStatisticalQueryParam.getDevId()).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DEVICE_LOSE));
|
||||
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineByDevId(commonStatisticalQueryParam.getDevId()).getData();
|
||||
@@ -232,18 +237,15 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
}
|
||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
|
||||
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||
|
||||
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||
if(CollectionUtil.isNotEmpty(data)){
|
||||
data.forEach(epdPqd->{
|
||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
//获取对应的治理后的指标
|
||||
if(data.getName().equals("Pq_ThdI")){
|
||||
EleEpdPqd data1 = epdFeignClient.selectById("1a4c5741bd57bd815b361c53d627a891").getData();
|
||||
List<StatisticalDataDTO> deviceRtData2 = commonService.getDeviceRtDataByTime(collect, data1.getClassId(), data1.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
deviceRtData.addAll(deviceRtData2);
|
||||
}
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
|
||||
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
@@ -254,18 +256,23 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(data.getId());
|
||||
vo.setUnit(data.getUnit());
|
||||
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
result.addAll(collect1);
|
||||
});
|
||||
}
|
||||
|
||||
return collect1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThdDataVO> queryLineCommonStatistical(CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
||||
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
if(CollectionUtil.isEmpty(commonStatisticalQueryParam.getLineList())){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
|
||||
}
|
||||
@@ -275,18 +282,16 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
}
|
||||
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
|
||||
EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
|
||||
|
||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, data.getClassId(), data.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
//获取对应的治理后的指标
|
||||
if(data.getName().equals("Pq_ThdI")){
|
||||
EleEpdPqd data1 = epdFeignClient.selectById("1a4c5741bd57bd815b361c53d627a891").getData();
|
||||
List<StatisticalDataDTO> deviceRtData2 = commonService.getDeviceRtDataByTime(collect, data1.getClassId(), data1.getName()+frequency, data.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
deviceRtData.addAll(deviceRtData2);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(data)){
|
||||
data.forEach(epdPqd->{
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
|
||||
|
||||
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
@@ -300,12 +305,18 @@ public class StableDataServiceImpl implements StableDataService {
|
||||
vo.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(data.getId());
|
||||
vo.setUnit(data.getUnit());
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
collect1 = collect1.stream().distinct().collect(Collectors.toList());
|
||||
return collect1;
|
||||
result.addAll(collect1);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private String phaseReflection(String phase){
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.cssystem.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cssystem.api.fallback.FeedBackFeignClientFallbackFactory;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_SYSTEM_BOOT, path = "/feedback", fallbackFactory = FeedBackFeignClientFallbackFactory.class,contextId = "feedback")
|
||||
public interface FeedBackFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryFeedBackPage")
|
||||
HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.cssystem.api.fallback;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
|
||||
import com.njcn.cssystem.api.FeedBackFeignClient;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FeedBackFeignClientFallbackFactory implements FallbackFactory<FeedBackFeignClient> {
|
||||
@Override
|
||||
public FeedBackFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new FeedBackFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取反馈接口异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.cssystem.controller.feedback;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -65,10 +66,10 @@ public class FeedBackController extends BaseController {
|
||||
@PostMapping("/queryFeedBackPage")
|
||||
@ApiOperation("查询反馈列表")
|
||||
@ApiImplicitParam(name = "csFeedbackQueryParm", value = "新增反馈聊天参数", required = true)
|
||||
public HttpResult<IPage<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm){
|
||||
public HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryFeedBackPage");
|
||||
|
||||
IPage<CsFeedbackVO> csFeedbackVOIPage = csFeedbackService.queryFeedBackPage(csFeedbackQueryParm);
|
||||
Page<CsFeedbackVO> csFeedbackVOIPage = csFeedbackService.queryFeedBackPage(csFeedbackQueryParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csFeedbackVOIPage, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackAddParm;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackAuditParm;
|
||||
@@ -36,7 +37,7 @@ public interface CsFeedbackService extends IService<CsFeedbackPO>{
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/6
|
||||
*/
|
||||
IPage<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
Page<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
/**
|
||||
* @Description: queryFeedBackDetail
|
||||
* @Param: [id]
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CsFeedbackServiceImpl extends ServiceImpl<CsFeedbackMapper, CsFeedb
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
public Page<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
Page<CsFeedbackPO> page = new Page<> (csFeedbackQueryParm.getPageNum ( ), csFeedbackQueryParm.getPageSize ( ));
|
||||
Page<CsFeedbackVO> returnpage = new Page<> (csFeedbackQueryParm.getPageNum ( ), csFeedbackQueryParm.getPageSize ( ));
|
||||
List<String> data = roleEngineerDevFeignClient.getRoleengineer().getData();
|
||||
|
||||
Reference in New Issue
Block a user