提交代码,设备权限分享
This commit is contained in:
@@ -28,7 +28,7 @@ public enum AlgorithmResponseEnum {
|
||||
LOSE_EFFICACY ("A00509","二维码失效,该设备已绑定"),
|
||||
DATA_LOSE ("A00510","未找到设备与主用户信息"),
|
||||
REPEAT_SHARE ("A00511","设备已分享完成,请勿再次分享"),
|
||||
|
||||
DEVICE_LOSE("A00512","设备id缺失")
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -43,6 +43,17 @@ public class CsTouristDataPOController extends BaseController {
|
||||
Boolean flag = csTouristDataPOService.add(csTouristDataParms);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/remove")
|
||||
@ApiOperation("移除游客数据")
|
||||
@ApiImplicitParam(name = "csTouristDataParms", value = "新增工程参数", required = true)
|
||||
public HttpResult<Boolean> remove(@Validated @RequestBody List<CsTouristDataParm> csTouristDataParms){
|
||||
String methodDescribe = getMethodDescribe("remove");
|
||||
|
||||
Boolean flag = csTouristDataPOService.remove(csTouristDataParms);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryAll")
|
||||
@ApiOperation("查询游客数据")
|
||||
|
||||
@@ -21,4 +21,6 @@ public interface CsTouristDataPOService extends IService<CsTouristDataPO>{
|
||||
Boolean add(List<CsTouristDataParm> csTouristDataParms);
|
||||
|
||||
List<CsTouristDataParmVO> queryAll();
|
||||
|
||||
Boolean remove(List<CsTouristDataParm> csTouristDataParms);
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ public class RoleEngineerDevService {
|
||||
if(CollectionUtils.isEmpty(collect1)){
|
||||
return collect;
|
||||
}else{
|
||||
csLedgerQueryWrapper.in("id",collect1);
|
||||
csLedgerQueryWrapper.in("id",collect1).eq("level",2);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect2 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.in("id",collect2);
|
||||
csLedgerQueryWrapper.in("id",collect2).eq("level",1);
|
||||
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
collect.addAll(collect3);
|
||||
@@ -83,7 +83,7 @@ public class RoleEngineerDevService {
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||
|
||||
}else{
|
||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||
collect =csEngineeringPOS.stream().map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -92,6 +92,8 @@ public class RoleEngineerDevService {
|
||||
}
|
||||
public List<String> getDevice(){
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
role=strings.get(0);
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
@@ -121,14 +123,14 @@ public class RoleEngineerDevService {
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
|
||||
}else{
|
||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
collect = csLedgers.stream().map(CsLedger::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return collect;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.param.CsTouristDataParm;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -9,6 +12,7 @@ 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.csdevice.pojo.po.CsTouristDataPO;
|
||||
@@ -53,4 +57,17 @@ public class CsTouristDataPOServiceImpl extends ServiceImpl<CsTouristDataPOMappe
|
||||
List<CsTouristDataParmVO> result = this.getBaseMapper().queryAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean remove(List<CsTouristDataParm> csTouristDataParms) {
|
||||
List<String> collect = csTouristDataParms.stream().map(CsTouristDataParm::getDeviceId).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.DEVICE_LOSE);
|
||||
}
|
||||
QueryWrapper<CsTouristDataPO> QueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper.in(CsTouristDataPO.COL_DEVICE_ID,collect);
|
||||
boolean remove = this.remove(QueryWrapper);
|
||||
return remove;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user