This commit is contained in:
huangzj
2023-09-20 15:33:40 +08:00
parent becaa461ea
commit e9795c5acd
30 changed files with 485 additions and 234 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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>

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

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

View File

@@ -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;
}
}