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

@@ -0,0 +1,62 @@
package com.njcn.csdevice.pojo.dto;
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 com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2023/9/12 16:10【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@NoArgsConstructor
public class CsEquipmentProcessDTO {
private String id;
/**
* 网络设备ID
*/
private String devId;
/**
* 操作人员
*/
private String operator;
/**
* 起始时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime startTime;
/**
* 结束时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime endTime;
/**
* 设备当前流程1:设备登记2功能调试3出厂调试4设备投运
*/
private String process;
/**
* 流程状态 0:取消 1:成功
*/
private String status;
}

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
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.dto.CsEquipmentProcessDTO;
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
import com.njcn.csdevice.service.CsEquipmentProcessPOService;
import com.njcn.web.controller.BaseController;
@@ -19,6 +20,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;
/**
* 类的介绍:设备调试日志记录
*
@@ -49,4 +52,15 @@ public class CsEquipmentProcessController extends BaseController {
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/query")
@ApiOperation("新增记录")
@ApiImplicitParam(name = "csEquipmentProcessDTO", value = "逻辑子设备标识", required = true)
public HttpResult<List<CsEquipmentProcessDTO>> queryList(@RequestBody @Validated CsEquipmentProcessDTO csEquipmentProcessDTO){
String methodDescribe = getMethodDescribe("query");
List<CsEquipmentProcessDTO> result = csEquipmentProcessPOService.queryqueryList(csEquipmentProcessDTO);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -228,5 +228,14 @@ public class EquipmentDeliveryController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@ResponseBody
@ApiOperation("取消联调")
@PostMapping(value = "deleteTest")
public HttpResult<String> deleteTest(@RequestParam("deviceId") String deviceId,@RequestParam("type") String type){
String methodDescribe = getMethodDescribe("testCompletion");
csEquipmentDeliveryService.deleteTest(deviceId,type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -98,4 +98,6 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
void delete(String devId);
void testCompletion(String deviceId,String type);
void deleteTest(String deviceId, String type);
}

View File

@@ -1,7 +1,11 @@
package com.njcn.csdevice.service;
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
* Description:
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface CsEquipmentProcessPOService extends IService<CsEquipmentProcessPO>{
List<CsEquipmentProcessDTO> queryqueryList(CsEquipmentProcessDTO csEquipmentProcessDTO);
}

View File

@@ -391,6 +391,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
}
if (!CollectionUtils.isEmpty (trueCollect)) {
List<CsEquipmentProcessPO> collect1 = new ArrayList<>();
List<CsEquipmentDeliveryPO> collect = trueCollect.stream ( ).map (temp -> {
CsEquipmentDeliveryPO csEquipmentDeliveryPO = new CsEquipmentDeliveryPO ( );
BeanUtils.copyProperties (temp, csEquipmentDeliveryPO);
@@ -401,8 +402,16 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
csEquipmentDeliveryPO.setRunStatus(1);
csEquipmentDeliveryPO.setStatus("1");
csEquipmentDeliveryPO.setProcess(1);
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
csEquipmentProcess.setStartTime(LocalDateTime.now());
csEquipmentProcess.setProcess(1);
collect1.add(csEquipmentProcess);
return csEquipmentDeliveryPO;
}).collect (Collectors.toList ( ));
csEquipmentProcessPOService.saveBatch(collect1,500);
this.saveOrUpdateBatch (collect, 500);
}
if (!CollectionUtils.isEmpty (falseCollect)) {
@@ -463,18 +472,35 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
@Override
@Transactional(rollbackFor = Exception.class)
public void testCompletion(String deviceId,String type) {
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
set(CsEquipmentDeliveryPO::getStatus,0).
set(CsEquipmentDeliveryPO::getRunStatus,1).
set(CsEquipmentDeliveryPO::getProcess,type+1).update();
this.delete(deviceId);
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getDevId,deviceId).
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getDevId,one.getNdid()).
eq(CsEquipmentProcessPO::getProcess,type).
eq(CsEquipmentProcessPO::getStatus,1).
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
update();
}
@Override
public void deleteTest(String deviceId, String type) {
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
set(CsEquipmentDeliveryPO::getStatus,0).
set(CsEquipmentDeliveryPO::getRunStatus,1).
set(CsEquipmentDeliveryPO::getProcess,type).update();
this.delete(deviceId);
csEquipmentProcessPOService.lambdaUpdate().eq(CsEquipmentProcessPO::getDevId,one.getNdid()).
eq(CsEquipmentProcessPO::getProcess,type).
eq(CsEquipmentProcessPO::getStatus,0).
set(CsEquipmentProcessPO::getEndTime,LocalDateTime.now()).
update();
}
/**
* 根据ndid生成二维码
* @param ndid

View File

@@ -1,10 +1,18 @@
package com.njcn.csdevice.service.impl;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.CsEquipmentProcessPOMapper;
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
import com.njcn.csdevice.service.CsEquipmentProcessPOService;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* Description:
@@ -16,4 +24,16 @@ import com.njcn.csdevice.service.CsEquipmentProcessPOService;
@Service
public class CsEquipmentProcessPOServiceImpl extends ServiceImpl<CsEquipmentProcessPOMapper, CsEquipmentProcessPO> implements CsEquipmentProcessPOService{
@Override
public List<CsEquipmentProcessDTO> queryqueryList(CsEquipmentProcessDTO csEquipmentProcessDTO) {
List<CsEquipmentProcessPO> list = this.lambdaQuery().eq(StringUtils.isNotBlank(csEquipmentProcessDTO.getId()), CsEquipmentProcessPO::getId, csEquipmentProcessDTO.getId()).
eq(StringUtils.isNotBlank(csEquipmentProcessDTO.getDevId()), CsEquipmentProcessPO::getDevId, csEquipmentProcessDTO.getDevId()).
eq(StringUtils.isNotBlank(csEquipmentProcessDTO.getProcess()), CsEquipmentProcessPO::getProcess, csEquipmentProcessDTO.getProcess()).list();
List<CsEquipmentProcessDTO> collect = list.stream().map(temp -> {
CsEquipmentProcessDTO csEquipmentProcessDTO1 = new CsEquipmentProcessDTO();
BeanUtils.copyProperties(temp, csEquipmentProcessDTO1);
return csEquipmentProcessDTO1;
}).collect(Collectors.toList());
return collect;
}
}

View File

@@ -36,9 +36,12 @@ public class CsEventUserQueryParam {
*/
private List<String> target;
private String type;
/**
* 状态(0:未读取 1:已读取)
*/
private String status;
private String level;
}

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());