提交
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
@RequestMapping("/EquipmentTransfer")
|
||||
@Api(tags = " 设备转移、恢复")
|
||||
@AllArgsConstructor
|
||||
@Deprecated
|
||||
public class CsEquipmentTransferPOController extends BaseController {
|
||||
|
||||
private final CsEquipmentTransferPOService csEquipmentTransferPOService;
|
||||
|
||||
@@ -45,11 +45,11 @@ public class DeviceUserController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/share")
|
||||
@ApiOperation("设备扫码分享")
|
||||
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
||||
public HttpResult<Boolean> share(@RequestParam("id") String id){
|
||||
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
||||
public HttpResult<Boolean> share(@RequestParam("ids") List<String> ids){
|
||||
String methodDescribe = getMethodDescribe("share");
|
||||
|
||||
Boolean flag = csDeviceUserPOService.share (id);
|
||||
Boolean flag = csDeviceUserPOService.share (ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ public class DeviceUserController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/transfer")
|
||||
@ApiOperation("设备转移(直接扫码不用申请)")
|
||||
@ApiImplicitParam(name = "eid", value = "设备Id", required = true)
|
||||
public HttpResult<Boolean> transfer(@RequestParam("eid") String eid){
|
||||
@ApiImplicitParam(name = "ids", value = "设备Id集合", required = true)
|
||||
public HttpResult<Boolean> transfer(@RequestParam("ids") List<String> ids){
|
||||
String methodDescribe = getMethodDescribe("transfer");
|
||||
|
||||
Boolean flag = csDeviceUserPOService.transfer (eid);
|
||||
Boolean flag = csDeviceUserPOService.transfer (ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,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.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
@@ -114,5 +115,15 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryLine")
|
||||
@ApiOperation("按条件查询监测点")
|
||||
@ApiImplicitParam(name = "lineParamdto", value = "查询条件", required = true)
|
||||
public HttpResult<List<CsLedger>> queryLine(@RequestBody @Validated LineParamDTO lineParamdto){
|
||||
String methodDescribe = getMethodDescribe("queryLine");
|
||||
List<CsLedger> list = csLedgerService.queryLine(lineParamdto);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm;
|
||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.LinePostionParam;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||
@@ -33,7 +34,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/lineTopologyDiagram")
|
||||
@Api(tags = " 拓扑图-监测点")
|
||||
@Api(tags = "拓扑图-监测点")
|
||||
@AllArgsConstructor
|
||||
public class LineTopologyDiagramController extends BaseController {
|
||||
|
||||
@@ -83,4 +84,14 @@ public class LineTopologyDiagramController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/auditList")
|
||||
@ApiOperation("批量修改监测点拓扑图关系")
|
||||
@ApiImplicitParam(name = "list", value = "监测点拓扑图数据集", required = true)
|
||||
public HttpResult<String> auditList(@RequestBody LinePostionParam linePostionParam){
|
||||
String methodDescribe = getMethodDescribe("auditList");
|
||||
appLineTopologyDiagramService.auditList(linePostionParam.getPointList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,4 +20,5 @@ public interface CsLedgerMapper extends BaseMapper<CsLedger> {
|
||||
|
||||
List<CsLedgerVO> getAll();
|
||||
|
||||
List<CsLedger> queryLine(@Param("lineParamdto") LineParamDTO lineParamdto);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,35 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.csdevice.mapper.CsLedgerMapper">
|
||||
|
||||
<select id="getAll" resultType="CsLedgerVO">
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
pid,
|
||||
pids,
|
||||
`name`,
|
||||
`level`,
|
||||
sort,
|
||||
remark,
|
||||
`state`,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
</sql>
|
||||
<resultMap id="BaseResultMap" type="com.njcn.csdevice.pojo.po.CsLedger">
|
||||
<result column="id" property="id"/>
|
||||
<result column="pid" property="pid"/>
|
||||
<result column="pids" property="pids"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="level" property="level"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="state" property="state"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
<select id="getAll" resultType="CsLedgerVO">
|
||||
select
|
||||
id,pid,name,level,sort
|
||||
from
|
||||
@@ -11,4 +39,19 @@
|
||||
state = 1
|
||||
</select>
|
||||
|
||||
<select id="queryLine" resultType="com.njcn.csdevice.pojo.po.CsLedger">
|
||||
select id from cs_ledger a where a.`Level`='3' and a.state='1'
|
||||
<if test="lineParamdto.engineerId!=null and lineParamdto.engineerId!=''">
|
||||
and FIND_IN_SET(#{lineParamdto.engineerId}, a.pids )
|
||||
</if>
|
||||
<if test="lineParamdto.projectId!=null and lineParamdto.projectId!=''">
|
||||
and FIND_IN_SET(#{lineParamdto.projectId}, a.pids )
|
||||
</if>
|
||||
<if test="lineParamdto.devId!=null and lineParamdto.devId!=''">
|
||||
and FIND_IN_SET(#{lineParamdto.devId}, a.pids )
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -23,4 +23,6 @@ public interface AppLineTopologyDiagramService extends IService<AppLineTopologyD
|
||||
AppTopologyDiagramVO query(String devId);
|
||||
|
||||
List<AppLineTopologyDiagramVO> queryByTopoId(String id);
|
||||
|
||||
void auditList(List<AppLineTopologyDiagramPO> list);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -17,13 +19,13 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
|
||||
Boolean add(String id);
|
||||
|
||||
Boolean share(String id);
|
||||
Boolean share(List<String> ids);
|
||||
|
||||
DevCountVO devCount(String id);
|
||||
|
||||
String isPrimaryUser(String deviceId);
|
||||
|
||||
Boolean transfer(String eid);
|
||||
Boolean transfer( List<String> ids);
|
||||
|
||||
Boolean delete(String eid);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public interface CsEquipmentTransferPOService extends IService<CsEquipmentTransferPO>{
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
@@ -68,4 +69,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
CsLedger findDataById(String id);
|
||||
|
||||
List<CsLedgerVO> getProjectTree();
|
||||
|
||||
List<CsLedger> queryLine(LineParamDTO lineParamdto);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -62,4 +63,14 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
||||
result = this.getBaseMapper().queryByTopoId( id);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditList(List<AppLineTopologyDiagramPO> list) {
|
||||
list.forEach(temp->{
|
||||
this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()).
|
||||
eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()).
|
||||
set(AppLineTopologyDiagramPO::getLng,temp.getLng()).update();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -23,6 +24,7 @@ import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||
import com.njcn.cswarn.api.CsEquipmentAlarmFeignClient;
|
||||
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -50,7 +52,7 @@ import static java.util.Objects.*;
|
||||
public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper, CsDeviceUserPO> implements CsDeviceUserPOService{
|
||||
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
||||
// private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
@Override
|
||||
@@ -73,80 +75,117 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean share(String id) {
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||
public Boolean share(List<String> ids) {
|
||||
ids.stream().forEach(id->{
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||
|
||||
}
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
CsDeviceUserPO one = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).eq(CsDeviceUserPO::getSubUserId,userIndex).one();
|
||||
if(!isNull(one)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.REPEAT_SHARE);
|
||||
}
|
||||
CsDeviceUserPO csDeviceUserPO = list.get(0);
|
||||
csDeviceUserPO.setSubUserId(userIndex);
|
||||
boolean save = this.save(csDeviceUserPO);
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||
|
||||
return save;
|
||||
}
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
String userRole = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
|
||||
|
||||
}
|
||||
userRole=strings.get(0);
|
||||
//分享只能给vip用户分享
|
||||
if(
|
||||
Objects.equals(userRole, AppRoleEnum.APP_VIP_USER.getCode())
|
||||
){
|
||||
throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
|
||||
|
||||
}
|
||||
CsDeviceUserPO one = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).eq(CsDeviceUserPO::getSubUserId,userIndex).one();
|
||||
if(!isNull(one)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.REPEAT_SHARE);
|
||||
}
|
||||
CsDeviceUserPO csDeviceUserPO = list.get(0);
|
||||
csDeviceUserPO.setSubUserId(userIndex);
|
||||
boolean save = this.save(csDeviceUserPO);
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevCountVO devCount(String id) {
|
||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
DevCountVO devCountVO = new DevCountVO();
|
||||
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
if(CollectionUtils.isEmpty(device)){
|
||||
devCountVO.setOnLineDevCount(0);
|
||||
devCountVO.setOnLineDevs(new ArrayList<>());
|
||||
devCountVO.setOffLineDevCount(0);
|
||||
devCountVO.setOffLineDevs(new ArrayList<>());
|
||||
}else {
|
||||
queryWrapper.clear();
|
||||
queryWrapper.in("id",device);
|
||||
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
devCountVO.setOnLineDevCount(collect2.size());
|
||||
devCountVO.setOnLineDevs(collect2);
|
||||
devCountVO.setOffLineDevCount(collect.size());
|
||||
devCountVO.setOffLineDevs(collect);
|
||||
List<String> roleProject = roleEngineerDevService.getRoleProject();
|
||||
devCountVO.setProjectCount(roleProject.size());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
|
||||
List<String> collect1 = deviceTree.stream().filter(temp -> temp.getId().equals(id)).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
//求交集
|
||||
device.retainAll(collect1);
|
||||
if(CollectionUtils.isEmpty(device)){
|
||||
devCountVO.setOnLineCount(0);
|
||||
devCountVO.setOnLineDevs(new ArrayList<>());
|
||||
devCountVO.setOffLineCount(0);
|
||||
devCountVO.setOffLineDevs(new ArrayList<>());
|
||||
|
||||
devCountVO.setAllDevCount(0);
|
||||
devCountVO.setAllDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentOnLineDevCount(0);
|
||||
devCountVO.setCurrentOnLineDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentOffLineDevCount(0);
|
||||
devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentProjectCount(0);
|
||||
devCountVO.setCurrentProjectCount(0);
|
||||
|
||||
}else {
|
||||
devCountVO.setAllDevCount(device.size());
|
||||
|
||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.clear();
|
||||
queryWrapper.in("id",device);
|
||||
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
devCountVO.setAllDevs(csEquipmentDeliveryPOS);
|
||||
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
devCountVO.setOnLineCount(collect2.size());
|
||||
devCountVO.setOnLineDevs(collect2);
|
||||
devCountVO.setOffLineCount(collect.size());
|
||||
devCountVO.setOffLineDevs(collect);
|
||||
|
||||
|
||||
devCountVO.setCurrentOnLineDevCount(collect2.size());
|
||||
devCountVO.setCurrentOnLineDevs(collect2);
|
||||
devCountVO.setCurrentOffLineDevCount(collect.size());
|
||||
devCountVO.setCurrentOffLineDevs(collect);
|
||||
List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
||||
devCountVO.setCurrentProjectCount(list.size());
|
||||
}
|
||||
|
||||
|
||||
CsEquipmentAlarmParm csEquipmentAlarmPageParm = new CsEquipmentAlarmParm();
|
||||
csEquipmentAlarmPageParm.setEngineerId(id);
|
||||
|
||||
//未处理的
|
||||
csEquipmentAlarmPageParm.setDealFlag("0");
|
||||
//todo 后续添加时间条件
|
||||
//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());
|
||||
devCountVO.setAlarmLineDevs(data);
|
||||
devCountVO.setAlarmEventCount(data.size());
|
||||
// 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.setId(id);
|
||||
//
|
||||
devCountVO.setEventCount(0);
|
||||
devCountVO.setAlarmLineCount(data.size());
|
||||
//todo重寫 offLineCount AlarmLineCount
|
||||
devCountVO.setOffLineCount(0);
|
||||
|
||||
return devCountVO;
|
||||
}
|
||||
@@ -167,16 +206,20 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean transfer(String eid) {
|
||||
public Boolean transfer(List<String> ids) {
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
ids.forEach(eid->{
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||
|
||||
}
|
||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id=sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).set(CsDeviceUserPO::getSubUserId,userIndex).update();
|
||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id<>sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).update();
|
||||
|
||||
});
|
||||
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||
|
||||
}
|
||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id=sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).set(CsDeviceUserPO::getSubUserId,userIndex).update();
|
||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id<>sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).update();
|
||||
|
||||
|
||||
return true;
|
||||
@@ -196,6 +239,10 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
csEquipmentDeliveryPO.setRunStatus(0);
|
||||
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
|
||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0").update();
|
||||
//删除监测点,设备
|
||||
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,eid).set(CsLedger::getState,0).update();
|
||||
iCsLedgerService.lambdaUpdate().eq(CsLedger::getPid,eid).set(CsLedger::getState,0).update();
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -44,6 +44,7 @@ import static java.util.Objects.isNull;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTransferPOMapper, CsEquipmentTransferPO> implements CsEquipmentTransferPOService{
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
@@ -79,7 +80,7 @@ public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTra
|
||||
String[] split = equipmentIds.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if(Objects.equals(collect1.get(DicDataEnum.AUTHORITY_TRANSFER.getCode()),csEquipmentTransferPO.getEventType())){
|
||||
csDeviceUserPOService.transfer(split[i]);
|
||||
// csDeviceUserPOService.transfer(split[i]);
|
||||
|
||||
}
|
||||
else if(Objects.equals(collect1.get(DicDataEnum.DATA_RECOVERY.getCode()),csEquipmentTransferPO.getEventType())){
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||
@@ -209,6 +210,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return engineeringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedger> queryLine(LineParamDTO lineParamdto) {
|
||||
List<CsLedger> lineIds = this.getBaseMapper().queryLine(lineParamdto);
|
||||
return lineIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -50,9 +50,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
@@ -81,7 +79,8 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
return collect;
|
||||
}
|
||||
|
||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())) {
|
||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||
@@ -113,7 +112,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
if(
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
@@ -130,7 +129,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
return collect1;
|
||||
|
||||
}
|
||||
else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())) {
|
||||
else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||
@@ -149,8 +148,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
collect = csLedgers1.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user