This commit is contained in:
huangzj
2023-09-18 11:21:48 +08:00
parent f34e2626b4
commit c6729d0c33
12 changed files with 199 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
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.CsEventUserPOService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Description:
* Date: 2023/9/4 16:18【需求编号】
@@ -28,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/eventUser")
@Api(tags = "暂降事件")
@Api(tags = "事件")
@AllArgsConstructor
public class EventUserController extends BaseController {
private final CsEventUserPOService csEventUserPOService;
@@ -42,6 +45,16 @@ public class EventUserController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, count, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventList")
@ApiOperation("当天暂降事件未读消息")
@ApiImplicitParam(name = "csEventUserQueryParam", value = "暂降事件查询参数", required = true)
public HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) {
String methodDescribe = getMethodDescribe("queryEventList");
List<EventDetailVO> list = csEventUserPOService.queryUserEventList(csEventUserQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateStatus")
@ApiOperation("已读事件")

View File

@@ -182,6 +182,19 @@ public class MqttMessageHandler {
}
});
List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
collect2.forEach((k,v)->{
if(!CollectionUtil.isEmpty(v)){
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(v.get(0),thdDataVO);
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
thdDataVO.setPhase("avg");
result.add(thdDataVO);
}
});
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
collect4.forEach((k,v)->{

View File

@@ -31,16 +31,21 @@
<select id="queryUserEventList" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
select a.event_id id,a.user_id userId,a.status status,b.device_id deviceId,b.line_id lineId,
b.start_time startTime,b.tag tag ,b.wave_path wavePath, b.type type
from cs_event_user a inner join cs_event b on a.event_id=b.id where 1=1 and DATE(b.start_time) =DATE(NOW()) and b.tag in
from cs_event_user a inner join cs_event b on a.event_id=b.id where 1=1 and DATE(b.start_time) =DATE(NOW())
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.target != null and csEventUserQueryParam.target.size()>0">
and b.tag in
<foreach collection="csEventUserQueryParam.target" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<!-- <if test="csEventUserQueryParam!=null and csEventUserQueryParam.enginnerId != null and csEventUserQueryParam.enginnerId !=''">-->
<!-- AND a.enginner_id =#{ csEventUserQueryParam.enginnerId}-->
<!-- </if>-->
<!-- <if test="csEventUserQueryParam!=null and csEventUserQueryParam.deviceId != null and csEventUserQueryParam.deviceId !=''">-->
<!-- AND a.device_id =#{ csEventUserQueryParam.deviceId}-->
<!-- </if>-->
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.type != null and csEventUserQueryParam.type !=''">
AND b.type =#{ csEventUserQueryParam.type}
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.level != null and csEventUserQueryParam.level !=''">
AND b.level =#{ csEventUserQueryParam.level}
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.status != null and csEventUserQueryParam.status !=''">
AND a.status =#{ csEventUserQueryParam.status}
</if>

View File

@@ -1,22 +1,28 @@
package com.njcn.csharmonic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.enums.AppRoleEnum;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
import com.njcn.csharmonic.service.CsEventUserPOService;
import org.springframework.util.CollectionUtils;
/**
*
* Description:
@@ -40,7 +46,16 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
@Override
public List<EventDetailVO> queryUserEventList(CsEventUserQueryParam csEventUserQueryParam) {
csEventUserQueryParam.setUserId(RequestUtil.getUserIndex());
if(CollectionUtil.isEmpty(csEventUserQueryParam.getTarget())){
String role = RequestUtil.getUserRole();
List<String> strings = JSONArray.parseArray(role, String.class);
if(CollectionUtils.isEmpty(strings)){
return new ArrayList<>();
}
role=strings.get(0);
if( Objects.equals(role, AppRoleEnum.APP_VIP_USER.getCode())){
csEventUserQueryParam.setLevel("3");
}
if(CollectionUtil.isEmpty(csEventUserQueryParam.getTarget())&&Objects.equals(csEventUserQueryParam.getType(),"0")){
/*获取所有暂态事件类型*/
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.APP_EVENT.getCode()).getData();
List<String> collect = data.stream().map(DictData::getCode).collect(Collectors.toList());