1.微调
This commit is contained in:
@@ -10,10 +10,15 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -47,6 +52,8 @@ public class CsCommTerminalController extends BaseController {
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
@@ -57,16 +64,8 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getDevIdsByUser");
|
||||
List<String> result;
|
||||
List<CsDeviceUserPO> poList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isNotEmpty(poList)){
|
||||
result = poList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}else {
|
||||
result = Collections.emptyList();
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,19 +77,16 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isNotEmpty(devList)){
|
||||
List<String> devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}
|
||||
@@ -106,11 +102,9 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getPqUserIdsByUser");
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isNotEmpty(devList)){
|
||||
List<String> devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
@@ -124,6 +118,21 @@ public class CsCommTerminalController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<String> commGetDevIds(String userId){
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
||||
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
* @author cdf
|
||||
|
||||
@@ -66,7 +66,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
// .in(CsEventPO::getLineId,ids)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
|
||||
List<String> lineIds = StrUtil.isBlank(baseParam.getSearchValue())
|
||||
? csLineFeignClient.getAllLine().getData()
|
||||
? csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData()
|
||||
: Collections.singletonList(baseParam.getSearchValue());
|
||||
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
@@ -152,16 +152,16 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
|
||||
/* List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return Collections.emptyList();
|
||||
}*/
|
||||
}
|
||||
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery().select(CsEventPO::getId,CsEventPO::getStartTime,CsEventPO::getTag,CsEventPO::getPersistTime,CsEventPO::getAmplitude)
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
// .in(CsEventPO::getLineId,ids)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
List<F47Curve> f47CurveList = csEventPOList.stream().map(item->{
|
||||
@@ -185,16 +185,16 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
DateTime start = DateUtil.beginOfMonth(dateTime);
|
||||
DateTime end = DateUtil.endOfMonth(dateTime);
|
||||
|
||||
/* List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return Collections.emptyList();
|
||||
}*/
|
||||
}
|
||||
List<DateTime> rangList = DateUtil.rangeToList(start,end, DateField.DAY_OF_MONTH);
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery().select(CsEventPO::getId,CsEventPO::getTag,CsEventPO::getStartTime,CsEventPO::getPersistTime,CsEventPO::getAmplitude)
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
// .in(CsEventPO::getLineId,ids)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
if(CollUtil.isEmpty(csEventPOList)){
|
||||
@@ -233,13 +233,10 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
result.add(new EventCoordsVO.inner(i, j, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return result;
|
||||
}*/
|
||||
return eventCoordsVO;
|
||||
}
|
||||
|
||||
//查询监测点未处理暂态事件
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
@@ -248,7 +245,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
// .in(CsEventPO::getLineId,ids)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
// 定义幅值和持续时间的分类规则
|
||||
|
||||
Reference in New Issue
Block a user