提交
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.api.fallback.RoleEngineerDevClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/roleEngineerDev", fallbackFactory = RoleEngineerDevClientFallbackFactory.class,contextId = "roleEngineerDev")
|
||||
public interface RoleEngineerDevFeignClient {
|
||||
|
||||
@PostMapping("/getRoleengineer")
|
||||
public HttpResult<List<String>> getRoleengineer();
|
||||
|
||||
@PostMapping("/getDevice")
|
||||
public HttpResult<List<String>> getDevice();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.api.RoleEngineerDevFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RoleEngineerDevClientFallbackFactory implements FallbackFactory<RoleEngineerDevFeignClient> {
|
||||
@Override
|
||||
public RoleEngineerDevFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
// exceptionEnum = UserEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new RoleEngineerDevFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getRoleengineer() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询角色工程异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getDevice() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询角色设备异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
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.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/7/10 18:30【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CsLineTopologyTemplateParm {
|
||||
/**
|
||||
* 拓扑图模板Id
|
||||
*/
|
||||
@NotBlank(message="拓扑图模板Id不能为空!")
|
||||
private String topoId;
|
||||
|
||||
/**
|
||||
* 监测点位置
|
||||
*/
|
||||
private String linePostion;
|
||||
|
||||
/**
|
||||
* 监测点中心点经度
|
||||
*/
|
||||
@ApiModelProperty(value="监测点中心点经度")
|
||||
@NotBlank(message="监测点中心点经度不能为空!")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 监测点中心点纬度
|
||||
*/
|
||||
@ApiModelProperty(value="监测点中心点纬度")
|
||||
@NotBlank(message="监测点中心点纬度不能为空!")
|
||||
private BigDecimal lat;
|
||||
|
||||
}
|
||||
@@ -24,13 +24,15 @@ import java.math.BigDecimal;
|
||||
@TableName(value = "cs_line_topology_template")
|
||||
public class CsLineTopologyTemplate extends BaseEntity {
|
||||
/**
|
||||
* 拓扑图Id
|
||||
* 模板Id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
@TableField(value = "topo_id")
|
||||
private String topoId;
|
||||
|
||||
/**
|
||||
* 监测点Id
|
||||
* 监测点位置
|
||||
*/
|
||||
@TableField(value = "line_postion")
|
||||
private String linePostion;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
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.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/7/10 18:30【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CsLineTopologyTemplateVO {
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String id;
|
||||
private String topoId;
|
||||
|
||||
/**
|
||||
* 监测点位置
|
||||
*/
|
||||
private String linePostion;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点经度")
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
@ApiModelProperty(value="中心点纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.vo;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -35,5 +37,6 @@ public class CsTopologyDiagramTemplateVO {
|
||||
@TableField(value = "`status`")
|
||||
private String status;
|
||||
|
||||
private List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.csdevice.controller.project;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
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.param.CsLineTopologyTemplateParm;
|
||||
import com.njcn.csdevice.pojo.vo.CsTopologyDiagramTemplateVO;
|
||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (cs_line_topology_template)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/lineTemplate")
|
||||
@Api(tags = " 监测点位置模板")
|
||||
@AllArgsConstructor
|
||||
public class CsLineTopologyTemplateController extends BaseController {
|
||||
|
||||
private final CsLineTopologyTemplateService csLineTopologyTemplateService;
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@PostMapping("/addLineTemplate")
|
||||
@ApiOperation("上传拓扑图模板监测点位置")
|
||||
@ApiImplicitParam(name = "csLineTopologyTemplateParms", value = "扑图模板监测点位置", required = true)
|
||||
public HttpResult<Boolean> addLineTemplate(@RequestBody List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms){
|
||||
String methodDescribe = getMethodDescribe("addLineTemplate");
|
||||
Boolean flag = csLineTopologyTemplateService.add(csLineTopologyTemplateParms);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,flag, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.njcn.csdevice.controller.project;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.param.AppProjectAddParm;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.vo.AppProjectVO;
|
||||
import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||
import com.njcn.csdevice.service.impl.RoleEngineerDevServiceImpl;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2023/3/27 10:54【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/roleEngineerDev")
|
||||
@Api(tags = " 角色工程设备")
|
||||
@AllArgsConstructor
|
||||
public class RoleEngineerDevController extends BaseController {
|
||||
|
||||
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRoleengineer")
|
||||
@ApiOperation("角色工程查询")
|
||||
public HttpResult<List<String>> getRoleengineer(){
|
||||
String methodDescribe = getMethodDescribe("getRoleengineer");
|
||||
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, roleengineer, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevice")
|
||||
@ApiOperation("角色设备查询")
|
||||
public HttpResult<List<String>> getDevice(){
|
||||
String methodDescribe = getMethodDescribe("getDevice");
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, device, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/topologyTemplate")
|
||||
@Api(tags = " 拓扑图-监测点")
|
||||
@Api(tags = " 拓扑图模板")
|
||||
@AllArgsConstructor
|
||||
public class TopologyTemplateController extends BaseController {
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.CsLineTopologyTemplateParm;
|
||||
import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
|
||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -13,4 +18,7 @@ import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
|
||||
public interface CsLineTopologyTemplateService extends IService<CsLineTopologyTemplate>{
|
||||
|
||||
|
||||
Boolean add(List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms);
|
||||
|
||||
List<CsLineTopologyTemplateVO> queryByTopoId(String topoId);
|
||||
}
|
||||
|
||||
@@ -1,141 +1,15 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/6/27 9:28【需求编号】
|
||||
* Date: 2023/7/11 16:26【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class RoleEngineerDevService {
|
||||
|
||||
private final CsEngineeringUserMapper csEngineeringUserMapper;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final CsEngineeringMapper csEngineeringMapper;
|
||||
private final CsTouristDataPOMapper csTouristDataPOMapper;
|
||||
|
||||
public List<String> getRoleengineer(){
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
role=strings.get(0);
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
|
||||
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
|
||||
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
|
||||
csDeviceUserPOQueryWrapper.and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
.or()
|
||||
.eq("sub_user_id",userIndex);
|
||||
});
|
||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect1)){
|
||||
return collect;
|
||||
}else{
|
||||
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).eq("level",1);
|
||||
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
collect.addAll(collect3);
|
||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||
//todo查询配置的游客工程
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||
|
||||
}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());
|
||||
}
|
||||
|
||||
return collect;
|
||||
}
|
||||
public List<String> getDevice(){
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
role=strings.get(0);
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
|
||||
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
|
||||
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
|
||||
csDeviceUserPOQueryWrapper.and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
.or()
|
||||
.eq("sub_user_id",userIndex);
|
||||
});
|
||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
return collect1;
|
||||
|
||||
}
|
||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
|
||||
}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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface RoleEngineerDevService {
|
||||
List<String> getRoleengineer();
|
||||
List<String> getDevice();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import com.njcn.csdevice.pojo.po.CsEngineeringUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import com.njcn.csdevice.service.CsEngineeringService;
|
||||
import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
@@ -51,7 +50,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
private final RedisUtil redisUtil;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final CsEngineeringUserMapper csEngineeringUserMapper;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
private final RoleEngineerDevServiceImpl roleEngineerDevService;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsLineTopologyTemplateMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineTopologyTemplateParm;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsLineTopologyTemplate;
|
||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -17,4 +26,33 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class CsLineTopologyTemplateServiceImpl extends ServiceImpl<CsLineTopologyTemplateMapper, CsLineTopologyTemplate> implements CsLineTopologyTemplateService {
|
||||
|
||||
@Override
|
||||
public Boolean add(List<CsLineTopologyTemplateParm> csLineTopologyTemplateParms) {
|
||||
List<CsLineTopologyTemplate> csLineTopologyTemplates = new ArrayList<>();
|
||||
QueryWrapper<CsLineTopologyTemplate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("",csLineTopologyTemplateParms.get(0).getTopoId());
|
||||
this.remove(queryWrapper);
|
||||
|
||||
csLineTopologyTemplateParms.stream().forEach(csLineTopologyTemplateParm -> {
|
||||
CsLineTopologyTemplate cs = new CsLineTopologyTemplate();
|
||||
BeanUtils.copyProperties(csLineTopologyTemplateParm, cs);
|
||||
cs.setStatus("1");
|
||||
csLineTopologyTemplates.add(cs);
|
||||
});
|
||||
boolean b = this.saveBatch(csLineTopologyTemplates);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLineTopologyTemplateVO> queryByTopoId(String topoId) {
|
||||
List<CsLineTopologyTemplate> list = new ArrayList<>();
|
||||
list = this.lambdaQuery().eq(CsLineTopologyTemplate::getTopoId, topoId).eq(CsLineTopologyTemplate::getStatus, 1).list();
|
||||
List<CsLineTopologyTemplateVO> collect = list.stream().map(csLineTopologyTemplate -> {
|
||||
CsLineTopologyTemplateVO vo = new CsLineTopologyTemplateVO();
|
||||
BeanUtils.copyProperties(csLineTopologyTemplate, vo);
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsTopologyDiagramTemplateMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsTopologyDiagramTemplate;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsTopologyDiagramTemplateVO;
|
||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||
import com.njcn.csdevice.service.CsTopologyDiagramTemplateService;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
@@ -33,7 +35,7 @@ import java.util.stream.Collectors;
|
||||
public class CsTopologyDiagramTemplateServiceImpl extends ServiceImpl<CsTopologyDiagramTemplateMapper, CsTopologyDiagramTemplate> implements CsTopologyDiagramTemplateService {
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final CsLineTopologyTemplateService csLineTopologyTemplateService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public String uploadImage(MultipartFile issuesFile) {
|
||||
@@ -61,6 +63,8 @@ public class CsTopologyDiagramTemplateServiceImpl extends ServiceImpl<CsTopology
|
||||
BeanUtils.copyProperties(temp, vo);
|
||||
|
||||
vo.setFilePath(fileStorageUtil.getFileUrl(vo.getFilePath()));
|
||||
List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOS = csLineTopologyTemplateService.queryByTopoId(temp.getId());
|
||||
vo.setCsLineTopologyTemplateVOList(csLineTopologyTemplateVOS);
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/6/27 9:28【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
private final CsEngineeringUserMapper csEngineeringUserMapper;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final CsEngineeringMapper csEngineeringMapper;
|
||||
private final CsTouristDataPOMapper csTouristDataPOMapper;
|
||||
@Override
|
||||
public List<String> getRoleengineer(){
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
role=strings.get(0);
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
|
||||
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
|
||||
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
|
||||
csDeviceUserPOQueryWrapper.and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
.or()
|
||||
.eq("sub_user_id",userIndex);
|
||||
});
|
||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect1)){
|
||||
return collect;
|
||||
}else{
|
||||
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).eq("level",1);
|
||||
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
collect.addAll(collect3);
|
||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||
//todo查询配置的游客工程
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||
|
||||
}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());
|
||||
}
|
||||
|
||||
return collect;
|
||||
}
|
||||
@Override
|
||||
public List<String> getDevice(){
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
role=strings.get(0);
|
||||
String userIndex = RequestUtil.getUserIndex();
|
||||
QueryWrapper<CsEngineeringUserPO> csEngineeringUserPOQueryWrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<CsDeviceUserPO> csDeviceUserPOQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.lambda().eq(CsEngineeringUserPO::getUserId,userIndex);
|
||||
List<CsEngineeringUserPO> csEngineeringUserPOS = csEngineeringUserMapper.selectList(csEngineeringUserPOQueryWrapper);
|
||||
collect = csEngineeringUserPOS.stream().map(CsEngineeringUserPO::getEngineeringId).collect(Collectors.toList());
|
||||
csDeviceUserPOQueryWrapper.and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
.or()
|
||||
.eq("sub_user_id",userIndex);
|
||||
});
|
||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
return collect1;
|
||||
|
||||
}
|
||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
|
||||
}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,7 +1,12 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csharmonic.param.CsConfigurationParm;
|
||||
import com.njcn.csharmonic.pojo.po.CsConfigurationPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -11,4 +16,5 @@ import com.njcn.csharmonic.pojo.po.CsConfigurationPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsConfigurationMapper extends BaseMapper<CsConfigurationPO> {
|
||||
Page<CsConfigurationPO> queryPage(Page<CsConfigurationPO> temppage, @Param("temp") CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam, @Param("list") List<String> list);
|
||||
}
|
||||
@@ -16,4 +16,24 @@
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, `status`, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
<select id="queryPage" resultMap="BaseResultMap">
|
||||
select * from cs_configuration a where a.status="1"
|
||||
and
|
||||
SUBSTRING_INDEX(a.engeering_ids,',',1) in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||
AND a.name = #{temp.searchValue}
|
||||
</if>
|
||||
<if test="temp!=null and temp.searchEndTime != null and temp.searchEndTime !=''">
|
||||
AND a.create_time <= #{temp.searchEndTime}"
|
||||
</if>
|
||||
<if test="temp!=null and temp.searchBeginTime != null and temp.searchBeginTime !=''">
|
||||
AND a.create_time >= #{temp.searchBeginTime}
|
||||
</if>
|
||||
order by a.order_by asc,create_time desc
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -5,6 +5,7 @@ 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.api.RoleEngineerDevFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.mapper.CsConfigurationMapper;
|
||||
import com.njcn.csharmonic.param.CsConfigurationParm;
|
||||
@@ -44,6 +45,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final RoleEngineerDevFeignClient roleEngineerDevFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -100,13 +102,17 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
Page<CsConfigurationVO> returnpage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||
Page<CsConfigurationPO> temppage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||
|
||||
|
||||
QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||
query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||
le (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchEndTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchEndTime ( )).
|
||||
ge (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchBeginTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchBeginTime ( )).
|
||||
eq ("status",1).orderByAsc("order_by").orderByDesc(CsConfigurationPO.COL_CREATE_TIME);
|
||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().selectPage(temppage, query);
|
||||
List<String> data1 = roleEngineerDevFeignClient.getRoleengineer().getData();
|
||||
if(CollectionUtils.isEmpty(data1)){
|
||||
return returnpage;
|
||||
}
|
||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1);
|
||||
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||
// le (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchEndTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchEndTime ( )).
|
||||
// ge (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchBeginTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchBeginTime ( )).
|
||||
// eq ("status",1).orderByAsc("order_by").orderByDesc(CsConfigurationPO.COL_CREATE_TIME);
|
||||
// Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().selectPage(temppage, query);
|
||||
List<String> collect1 = csConfigurationPOPage.getRecords().stream().map(CsConfigurationPO::getCreateBy).collect(Collectors.toList());
|
||||
Map<String, String> collect2;
|
||||
if(!CollectionUtils.isEmpty(collect1)){
|
||||
|
||||
Reference in New Issue
Block a user