提交
This commit is contained in:
@@ -19,7 +19,6 @@ import lombok.Data;
|
|||||||
* 工程信息表
|
* 工程信息表
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName(value = "cs_engineering")
|
|
||||||
public class CsEngineeringVO extends BaseEntity {
|
public class CsEngineeringVO extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
|
|||||||
@@ -26,6 +26,13 @@ public class CsLedgerVO implements Serializable {
|
|||||||
@ApiModelProperty(name = "name",value = "名称")
|
@ApiModelProperty(name = "name",value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "path",value = "拓扑图路径")
|
||||||
|
private String path;
|
||||||
|
@ApiModelProperty(name = "area",value = "区域")
|
||||||
|
private String area;
|
||||||
|
@ApiModelProperty(name = "remark",value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
@ApiModelProperty(name = "sort",value = "排序")
|
@ApiModelProperty(name = "sort",value = "排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
|||||||
@@ -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.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
@@ -107,5 +108,14 @@ public class CsLedgerController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceId, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deviceId, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getProjectTree")
|
||||||
|
@ApiOperation("工程-项目-拓扑图树")
|
||||||
|
public HttpResult<List<CsLedgerVO>> getProjectTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||||
|
List<CsLedgerVO> list = csLedgerService.getProjectTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,4 +66,5 @@ public interface ICsLedgerService {
|
|||||||
*/
|
*/
|
||||||
CsLedger findDataById(String id);
|
CsLedger findDataById(String id);
|
||||||
|
|
||||||
|
List<CsLedgerVO> getProjectTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
AppTopologyDiagramQueryParm appTopologyDiagramQueryParm = new AppTopologyDiagramQueryParm();
|
AppTopologyDiagramQueryParm appTopologyDiagramQueryParm = new AppTopologyDiagramQueryParm();
|
||||||
appTopologyDiagramQueryParm.setId(appLineTopologyDiagramPO.getId());
|
appTopologyDiagramQueryParm.setId(appLineTopologyDiagramPO.getId());
|
||||||
List<AppTopologyDiagramVO> appTopologyDiagramVOS = appTopologyDiagramService.queryAppTopologyDiagram(appTopologyDiagramQueryParm);
|
List<AppTopologyDiagramVO> appTopologyDiagramVOS = appTopologyDiagramService.queryAppTopologyDiagram(appTopologyDiagramQueryParm);
|
||||||
|
if(CollectionUtil.isEmpty(appTopologyDiagramVOS)){
|
||||||
|
throw new BusinessException("设备下未找到拓扑图信息");
|
||||||
|
}
|
||||||
AppTopologyDiagramVO appTopologyDiagramVO = appTopologyDiagramVOS.get(0);
|
AppTopologyDiagramVO appTopologyDiagramVO = appTopologyDiagramVOS.get(0);
|
||||||
return appTopologyDiagramVO;
|
return appTopologyDiagramVO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,30 @@ package com.njcn.csdevice.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.*;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.service.ICsEngineeringUserService;
|
import com.njcn.csdevice.service.ICsEngineeringUserService;
|
||||||
import com.njcn.csdevice.service.ICsLedgerService;
|
import com.njcn.csdevice.service.ICsLedgerService;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
|
import com.njcn.system.pojo.po.Area;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.bouncycastle.cert.ocsp.Req;
|
import org.bouncycastle.cert.ocsp.Req;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,6 +42,13 @@ import java.util.stream.Collectors;
|
|||||||
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
||||||
|
|
||||||
private final ICsEngineeringUserService csEngineeringUserService;
|
private final ICsEngineeringUserService csEngineeringUserService;
|
||||||
|
private final AreaFeignClient areaFeignClient;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
||||||
|
private final AppProjectMapper appProjectMapper;
|
||||||
|
private final CsEngineeringMapper csEngineeringMapper;
|
||||||
|
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getLedgerTree() {
|
public List<CsLedgerVO> getLedgerTree() {
|
||||||
@@ -136,11 +147,66 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return this.lambdaQuery().eq(CsLedger::getId,id).one();
|
return this.lambdaQuery().eq(CsLedger::getId,id).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedgerVO> getProjectTree() {
|
||||||
|
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
|
//fixme 这边先根据登录的用户名称来区分是否展示所有的台账信息
|
||||||
|
if (Objects.equals(RequestUtil.getUsername(),"root") || Objects.equals(RequestUtil.getUsername(),"njcnser")){
|
||||||
|
engineeringList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
List<CsEngineeringPO> engineering = csEngineeringUserService.getEngineeringByUser();
|
||||||
|
engineeringList = allList.stream().filter(item->engineering.stream().map(CsEngineeringPO::getId).collect(Collectors.toList()).contains(item.getId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("status","1");
|
||||||
|
List<AppTopologyDiagramPO> appTopologyDiagramPOS = appTopologyDiagramMapper.selectList(queryWrapper);
|
||||||
|
projectList.forEach(temp->{
|
||||||
|
AppProjectPO appProjectPO = appProjectMapper.selectById(temp.getId());
|
||||||
|
temp.setArea(appProjectPO.getArea());
|
||||||
|
temp.setRemark(appProjectPO.getDescription());
|
||||||
|
List<CsLedgerVO> collect = appTopologyDiagramPOS.stream().filter(appTopologyDiagramPO -> Objects.equals(appTopologyDiagramPO.getProjectId(), temp.getId()))
|
||||||
|
.map(po -> {
|
||||||
|
CsLedgerVO vo = new CsLedgerVO();
|
||||||
|
vo.setId(po.getId());
|
||||||
|
vo.setPid(po.getProjectId());
|
||||||
|
vo.setName(po.getName());
|
||||||
|
vo.setPath(fileStorageUtil.getFileUrl(po.getFilePath()));
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
temp.setChildren(collect);
|
||||||
|
});
|
||||||
|
engineeringList.forEach(eng -> {
|
||||||
|
|
||||||
|
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||||
|
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
||||||
|
eng.setRemark(csEngineeringPO.getDescription());
|
||||||
|
eng.setChildren(getChildren(eng, projectList));
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
return engineeringList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子节点
|
* 获取子节点
|
||||||
*/
|
*/
|
||||||
public List<CsLedgerVO> getChildren(CsLedgerVO item, List<CsLedgerVO> all) {
|
public List<CsLedgerVO> getChildren(CsLedgerVO item, List<CsLedgerVO> all) {
|
||||||
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
public String getAreaById(String id){
|
||||||
|
|
||||||
|
String areaName =redisUtil.getStringByKey (id);
|
||||||
|
areaName = Optional.ofNullable (areaName).orElseGet (() ->{
|
||||||
|
Area data = areaFeignClient.selectIdArea (id).getData ( );
|
||||||
|
redisUtil.saveByKey (id,data.getName ());
|
||||||
|
return data.getName ();
|
||||||
|
});
|
||||||
|
|
||||||
|
return areaName;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class CsPagePO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "`name`")
|
@TableField(value = "`name`")
|
||||||
private String name;
|
private String name;
|
||||||
|
/*排序id
|
||||||
|
* */
|
||||||
|
@TableField(value = "k_id")
|
||||||
|
private String kId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组态页面文件路径
|
* 组态页面文件路径
|
||||||
@@ -57,6 +61,7 @@ public class CsPagePO extends BaseEntity {
|
|||||||
public static final String COL_PID = "pid";
|
public static final String COL_PID = "pid";
|
||||||
|
|
||||||
public static final String COL_NAME = "name";
|
public static final String COL_NAME = "name";
|
||||||
|
public static final String COL_KID = "k_id";
|
||||||
|
|
||||||
public static final String COL_PATH = "path";
|
public static final String COL_PATH = "path";
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.njcn.csharmonic.service.CsConfigurationService;
|
|||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.user.api.UserFeignClient;
|
import com.njcn.user.api.UserFeignClient;
|
||||||
import com.njcn.user.pojo.po.User;
|
import com.njcn.user.pojo.po.User;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@@ -64,9 +65,10 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
NjcnBeanUtil.copyPropertiesIgnoreCase(auditParm,csConfigurationPO);
|
NjcnBeanUtil.copyPropertiesIgnoreCase(auditParm,csConfigurationPO);
|
||||||
|
if(!Objects.isNull(auditParm.getFileContent())){
|
||||||
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
||||||
|
|
||||||
csConfigurationPO.setImagePath(s);
|
csConfigurationPO.setImagePath(s);
|
||||||
|
}
|
||||||
|
|
||||||
boolean b = this.updateById(csConfigurationPO);
|
boolean b = this.updateById(csConfigurationPO);
|
||||||
|
|
||||||
@@ -77,6 +79,8 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
public IPage<CsConfigurationVO> queryPage(CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
public IPage<CsConfigurationVO> queryPage(CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
||||||
Page<CsConfigurationVO> returnpage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
Page<CsConfigurationVO> returnpage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||||
Page<CsConfigurationPO> temppage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
Page<CsConfigurationPO> temppage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||||
|
String deptIndex = RequestUtil.getDeptIndex();
|
||||||
|
|
||||||
|
|
||||||
QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||||
query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||||
@@ -98,7 +102,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
||||||
BeanUtils.copyProperties(page, csDevModelPageVO);
|
BeanUtils.copyProperties(page, csDevModelPageVO);
|
||||||
if(Objects.isNull(page.getImagePath())){
|
if(Objects.isNull(page.getImagePath())){
|
||||||
csDevModelPageVO.setFileContent("");
|
csDevModelPageVO.setFileContent(null);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
|||||||
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq(StringUtils.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
queryWrapper.eq(StringUtils.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
||||||
like(StringUtils.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
like(StringUtils.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
||||||
eq ("status",1);
|
eq ("status",1).
|
||||||
// orderByDesc(CsPagePO.COL_CREATE_TIME);
|
orderByAsc(CsPagePO.COL_KID);
|
||||||
|
|
||||||
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
||||||
List<String> collect1 = pageData.getRecords().stream().map(CsPagePO::getCreateBy).collect(Collectors.toList());
|
List<String> collect1 = pageData.getRecords().stream().map(CsPagePO::getCreateBy).collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user