登录用户部门排序问题

This commit is contained in:
2023-04-28 16:00:35 +08:00
parent 0a2c90e354
commit 33c9678661
8 changed files with 66 additions and 65 deletions

View File

@@ -26,4 +26,6 @@ public class BaseVO implements Serializable {
@ApiModelProperty("父节点id") @ApiModelProperty("父节点id")
private String pid; private String pid;
private Integer sort;
} }

View File

@@ -206,7 +206,7 @@ public class MonitorPointController extends BaseController {
* @author zbj * @author zbj
* @date 2022/7/28 * @date 2022/7/28
*/ */
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD) /*@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
@PostMapping("/downloadMonitorEventWaveFile") @PostMapping("/downloadMonitorEventWaveFile")
@ApiOperation("监测点事件波形下载") @ApiOperation("监测点事件波形下载")
@ApiImplicitParam(name = "waveFileParam", value = "波形下载参数", required = true) @ApiImplicitParam(name = "waveFileParam", value = "波形下载参数", required = true)
@@ -214,6 +214,6 @@ public class MonitorPointController extends BaseController {
String methodDescribe = getMethodDescribe("downloadMonitorEventWaveFile"); String methodDescribe = getMethodDescribe("downloadMonitorEventWaveFile");
HttpServletResponse resp = eventAnalysisService.downloadMonitorEventWaveFile(waveFileParam, response); HttpServletResponse resp = eventAnalysisService.downloadMonitorEventWaveFile(waveFileParam, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
} }*/
} }

View File

@@ -89,7 +89,7 @@ public interface EventAnalysisService {
* @author zbj * @author zbj
* @date 2022/7/28 * @date 2022/7/28
*/ */
HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception; //HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception;

View File

@@ -1815,7 +1815,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
* @author zbj * @author zbj
* @date 2022/7/28 * @date 2022/7/28
*/ */
@Override /* @Override
public HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception { public HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception {
List<String> lineId = waveFileParam.getLineId(); List<String> lineId = waveFileParam.getLineId();
List<String> timeId = waveFileParam.getTimeId(); List<String> timeId = waveFileParam.getTimeId();
@@ -1872,7 +1872,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
delFile(zipPath); delFile(zipPath);
deleteDirectoryLegacyIO(new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade")); deleteDirectoryLegacyIO(new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade"));
return response; return response;
} }*/
/** /**
* 复制保存文件 * 复制保存文件

View File

@@ -133,22 +133,22 @@ public class TransientServiceImpl implements TransientService {
String format = dateTimeFormatter.format(eventDetail.getStartTime()); String format = dateTimeFormatter.format(eventDetail.getStartTime());
transientVO.setTime(format); transientVO.setTime(format);
switch (eventDetail.getEventType()) { switch (eventDetail.getEventType()) {
case 0+"": case 0 + "":
transientVO.setTrigType("扰动"); transientVO.setTrigType("扰动");
break; break;
case 1+"": case 1 + "":
transientVO.setTrigType("暂降"); transientVO.setTrigType("暂降");
break; break;
case 2+"": case 2 + "":
transientVO.setTrigType("暂升"); transientVO.setTrigType("暂升");
break; break;
case 3+"": case 3 + "":
transientVO.setTrigType("中断"); transientVO.setTrigType("中断");
break; break;
case 4+"": case 4 + "":
transientVO.setTrigType("其他"); transientVO.setTrigType("其他");
break; break;
case 5+"": case 5 + "":
transientVO.setTrigType("录波"); transientVO.setTrigType("录波");
break; break;
} }
@@ -189,16 +189,16 @@ public class TransientServiceImpl implements TransientService {
//获取暂降事件 //获取暂降事件
RmpEventDetailPO eventDetail = rmpEventDetailMapper.getByEventId(param.getId()); RmpEventDetailPO eventDetail = rmpEventDetailMapper.getByEventId(param.getId());
LineDetailDataVO lineDetailData=new LineDetailDataVO(); LineDetailDataVO lineDetailData = new LineDetailDataVO();
MonitorVO monitorVO=new MonitorVO(); MonitorVO monitorVO = new MonitorVO();
String ip; String ip;
if(param.getSystemType()==0){ if (param.getSystemType() == 0) {
lineDetailData = lineFeignClient.getLineDetailData(eventDetail.getMeasurementPointId()).getData(); lineDetailData = lineFeignClient.getLineDetailData(eventDetail.getMeasurementPointId()).getData();
ip=lineDetailData.getIp(); ip = lineDetailData.getIp();
}else{ } else {
param.setId(eventDetail.getMeasurementPointId()); param.setId(eventDetail.getMeasurementPointId());
monitorVO = monitorClient.getMonitorTerminal(param).getData(); monitorVO = monitorClient.getMonitorTerminal(param).getData();
ip=monitorVO.getIp(); ip = monitorVO.getIp();
} }
@@ -218,7 +218,7 @@ public class TransientServiceImpl implements TransientService {
} else { } else {
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG; cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT; datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
System.out.println("波形路径-------------------"+cfgPath); System.out.println("波形路径-------------------" + cfgPath);
try ( try (
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath); InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
@@ -233,7 +233,7 @@ public class TransientServiceImpl implements TransientService {
} }
} }
waveDataDTO = waveUtil.getValidData(originalData); waveDataDTO = waveUtil.getValidData(originalData);
if(param.getSystemType()==0){ if (param.getSystemType() == 0) {
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType())); waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]); double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]);
double pt2 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[1]); double pt2 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[1]);
@@ -252,7 +252,6 @@ public class TransientServiceImpl implements TransientService {
@Override @Override
public void downloadWaveFile(List<String> eventIds, HttpServletResponse response) { public void downloadWaveFile(List<String> eventIds, HttpServletResponse response) {
copyTempData(eventIds); copyTempData(eventIds);
zipCompress(new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade")); zipCompress(new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade"));
String zipPath = generalInfo.getBusinessTempPath() + File.separator + "comtrade.zip"; String zipPath = generalInfo.getBusinessTempPath() + File.separator + "comtrade.zip";
@@ -349,8 +348,8 @@ public class TransientServiceImpl implements TransientService {
} }
// Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()),wrapper); // Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()),wrapper);
Page<RmpEventDetailPO> pageInfo = pwRmpEventDetailMapper.selectPage(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()), wrapper); Page<RmpEventDetailPO> pageInfo = pwRmpEventDetailMapper.selectPage(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()), wrapper);
List<EventDetailNew> eventDetailData=BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); List<EventDetailNew> eventDetailData = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class);
page= BeanUtil.copyProperties(pageInfo,Page.class); page = BeanUtil.copyProperties(pageInfo, Page.class);
if (CollUtil.isNotEmpty(eventDetailData)) { if (CollUtil.isNotEmpty(eventDetailData)) {
List<String> lineIds = eventDetailData.stream().map(EventDetailNew::getLineId).distinct().collect(Collectors.toList()); List<String> lineIds = eventDetailData.stream().map(EventDetailNew::getLineId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> r = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); List<AreaLineInfoVO> r = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
@@ -372,7 +371,7 @@ public class TransientServiceImpl implements TransientService {
} }
} }
if(StrUtil.isNotBlank(eventDetail.getAdvanceReason())) { if (StrUtil.isNotBlank(eventDetail.getAdvanceReason())) {
for (DictData dictData : reasonList) { for (DictData dictData : reasonList) {
if (eventDetail.getAdvanceReason().equals(dictData.getId())) { if (eventDetail.getAdvanceReason().equals(dictData.getId())) {
eventDetail.setAdvanceReason(dictData.getName()); eventDetail.setAdvanceReason(dictData.getName());
@@ -381,7 +380,7 @@ public class TransientServiceImpl implements TransientService {
} }
} }
if(StrUtil.isNotBlank(eventDetail.getAdvanceType())) { if (StrUtil.isNotBlank(eventDetail.getAdvanceType())) {
for (DictData dictData : typeList) { for (DictData dictData : typeList) {
if (eventDetail.getAdvanceType().equals(dictData.getId())) { if (eventDetail.getAdvanceType().equals(dictData.getId())) {
eventDetail.setAdvanceType(dictData.getName()); eventDetail.setAdvanceType(dictData.getName());
@@ -404,11 +403,11 @@ public class TransientServiceImpl implements TransientService {
if (StringUtils.isBlank(searchValue)) { if (StringUtils.isBlank(searchValue)) {
return true; return true;
} else { } else {
if (StringUtils.contains(item.getGdName(),searchValue) if (StringUtils.contains(item.getGdName(), searchValue)
||StringUtils.contains(item.getSubName(),searchValue) || StringUtils.contains(item.getSubName(), searchValue)
||StringUtils.contains(item.getIp(),searchValue) || StringUtils.contains(item.getIp(), searchValue)
||StringUtils.contains(item.getLineName(),searchValue) || StringUtils.contains(item.getLineName(), searchValue)
||StringUtils.containsIgnoreCase(item.getVoltageScale(),searchValue)) || StringUtils.containsIgnoreCase(item.getVoltageScale(), searchValue))
return true; return true;
} }
return false; return false;
@@ -419,17 +418,18 @@ public class TransientServiceImpl implements TransientService {
* 复制保存文件 * 复制保存文件
*/ */
public void copyTempData(List<String> eventIds) { public void copyTempData(List<String> eventIds) {
List<RmpEventDetailPO> rmpEventDetailPOList = eventDetailService.listByIds(eventIds);
List<RmpEventDetailPO> nullWave = rmpEventDetailPOList.stream().filter(item->Objects.isNull(item.getWavePath())).collect(Collectors.toList());
for (int i = 0; i < eventIds.size(); i++) { if(nullWave.size()!=0){
throw new BusinessException("请选择存在波形的事件导出!");
}
if (CollUtil.isNotEmpty(rmpEventDetailPOList)) {
for (int i = 0; i < rmpEventDetailPOList.size(); i++) {
//根据监测点id获取监测点详情 //根据监测点id获取监测点详情
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPOList.get(i).getMeasurementPointId()).getData();
RmpEventDetailPO rmpEventDetailPO = eventDetailService.getById(eventIds.get(i));
if (Objects.nonNull(rmpEventDetailPO)) {
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPO.getMeasurementPointId()).getData();
if (Objects.nonNull(lineDetailData)) { if (Objects.nonNull(lineDetailData)) {
String ip = lineDetailData.getIp(); String ip = lineDetailData.getIp();
String waveName = rmpEventDetailPO.getWavePath(); String waveName = rmpEventDetailPOList.get(i).getWavePath();
if (StrUtil.isBlank(ip) && StrUtil.isBlank(waveName)) { if (StrUtil.isBlank(ip) && StrUtil.isBlank(waveName)) {
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND); throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
} }
@@ -460,13 +460,13 @@ public class TransientServiceImpl implements TransientService {
} }
} }
String fileMu = generalInfo.getBusinessTempPath()+File.separator+"comtrade"+File.separator+ip; String fileMu = generalInfo.getBusinessTempPath() + File.separator + "comtrade" + File.separator + ip;
File mulu = new File(fileMu); File mulu = new File(fileMu);
if(!mulu.exists()){ if (!mulu.exists()) {
mulu.mkdirs(); mulu.mkdirs();
} }
File fileCfg = new File(fileMu+File.separator+waveName+GeneralConstant.CFG); File fileCfg = new File(fileMu + File.separator + waveName + GeneralConstant.CFG);
File fileDat = new File(fileMu+File.separator+waveName+GeneralConstant.DAT); File fileDat = new File(fileMu + File.separator + waveName + GeneralConstant.DAT);
fileCfg.createNewFile(); fileCfg.createNewFile();
fileDat.createNewFile(); fileDat.createNewFile();
@@ -476,7 +476,7 @@ public class TransientServiceImpl implements TransientService {
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID); throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID);
}finally { } finally {
try { try {
if (cfgStream != null) { if (cfgStream != null) {
cfgStream.close(); cfgStream.close();
@@ -488,7 +488,6 @@ public class TransientServiceImpl implements TransientService {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }
} }

View File

@@ -3,6 +3,7 @@ package com.njcn.user.pojo.vo;
import com.njcn.web.pojo.vo.BaseVO; import com.njcn.web.pojo.vo.BaseVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List; import java.util.List;
@@ -12,6 +13,7 @@ import java.util.List;
* @date 2022年04月15日 11:28 * @date 2022年04月15日 11:28
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true)
public class DeptAllTreeVO extends BaseVO { public class DeptAllTreeVO extends BaseVO {
@ApiModelProperty("子节点详细信息") @ApiModelProperty("子节点详细信息")

View File

@@ -60,29 +60,26 @@
SELECT SELECT
T3.* T3.*
FROM FROM
(
SELECT
@codes AS _ids,
(
SELECT @codes := GROUP_CONCAT( id ) FROM sys_dept WHERE FIND_IN_SET( pid, @codes ) ) AS T1
FROM
sys_dept s,
( SELECT @codes := #{id} ) T4
WHERE
@codes IS NOT NULL
<if test="type != null">
AND s.type in
<foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) T2,
sys_dept T3, sys_dept T3,
sys_area T5 sys_area T5
WHERE WHERE
FIND_IN_SET( T3.id, T2._ids ) FIND_IN_SET( #{id}, T3.pids )
and t3.type in
<foreach collection="type" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND t3.area = t5.id AND t3.area = t5.id
AND t3.State = 1 AND t3.State = 1
UNION
SELECT
T3.*
FROM
sys_dept T3,
sys_area T5
WHERE
t3.area = t5.id
and T3.id = #{id}
AND t3.State = 1
</select> </select>
<select id="deptArea" resultType="String"> <select id="deptArea" resultType="String">

View File

@@ -38,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -319,7 +320,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
return allDept.stream().filter(dept -> dept.getPid().equals(deptFirst.getId())) return allDept.stream().filter(dept -> dept.getPid().equals(deptFirst.getId()))
.peek(deptVo -> { .peek(deptVo -> {
deptVo.setChildren(getChildrens(deptVo, allDept)); deptVo.setChildren(getChildrens(deptVo, allDept));
}).collect(Collectors.toList()); }).sorted(Comparator.comparing(DeptAllTreeVO::getSort)).collect(Collectors.toList());
} }