算法提交
This commit is contained in:
@@ -205,6 +205,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
||||
deptGetSubStationDTO.setUnitName(item.getUnitName());
|
||||
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
deptGetSubStationDTO.setDeptLevel(item.getDeptLevel());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<String> lineList = new ArrayList<>();
|
||||
|
||||
@@ -84,6 +84,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
deptGetChildrenMoreDTO.setUnitName(item.getUnitName());
|
||||
deptGetChildrenMoreDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
deptGetChildrenMoreDTO.setDeptLevel(item.getDeptLevel());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
@@ -121,6 +122,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
||||
deptGetSubStationDTO.setUnitName(item.getUnitName());
|
||||
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
deptGetSubStationDTO.setDeptLevel(item.getDeptLevel());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<String> subList = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.harmonic.pojo.po.upload;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -31,6 +32,7 @@ public class RUploadSubstationStatisticalDataD {
|
||||
/**
|
||||
* 省级单位id
|
||||
*/
|
||||
@MppMultiId
|
||||
private String provinceId;
|
||||
|
||||
/**
|
||||
@@ -41,6 +43,7 @@ public class RUploadSubstationStatisticalDataD {
|
||||
/**
|
||||
* 市级单位id
|
||||
*/
|
||||
@MppMultiId
|
||||
private String cityId;
|
||||
|
||||
/**
|
||||
@@ -51,6 +54,7 @@ public class RUploadSubstationStatisticalDataD {
|
||||
/**
|
||||
* 县级单位id
|
||||
*/
|
||||
@MppMultiId
|
||||
private String countyId;
|
||||
|
||||
/**
|
||||
@@ -96,11 +100,13 @@ public class RUploadSubstationStatisticalDataD {
|
||||
/**
|
||||
* 统计月份
|
||||
*/
|
||||
@MppMultiId
|
||||
private String statisticalDate;
|
||||
|
||||
/**
|
||||
* 统计类型(01:年 02:月 03:日)
|
||||
*/
|
||||
@MppMultiId
|
||||
private String statisticalType;
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ public interface IRUploadSubstationStatisticalDataDService extends IService<RUpl
|
||||
* 变电站监测统计数据
|
||||
* @param calculatedParam
|
||||
*/
|
||||
void insertSubStatisticalDataDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam);
|
||||
void insertSubStatisticalDataDay(CalculatedParam<String> calculatedParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -55,13 +52,15 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
//获取省级单位id
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
||||
String code = deptFeignClient.getDeptById(provinceId).getData().getCode();
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
//获取监测点、终端个数
|
||||
List<ROperatingIndexDPO> devList = getOperatingIndexData(calculatedParam.getDataDate());
|
||||
Map<String,List<ROperatingIndexDPO>> devMap = devList.stream().collect(Collectors.groupingBy(ROperatingIndexDPO::getOrgNo));
|
||||
//获取数据个数
|
||||
List<RStatIntegrityD> dataList = getStatIntegrityData(calculatedParam.getDataDate());
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String,List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
List<DeptGetChildrenMoreDTO> list = calculatedParam.getIdList();
|
||||
list.forEach(item->{
|
||||
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()),item.getDeptLevel())){
|
||||
@@ -69,30 +68,21 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
}
|
||||
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
||||
rUploadPointStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadPointStatisticalDataD.setProvinceId(code);
|
||||
rUploadPointStatisticalDataD.setProvinceId(dept.getCode());
|
||||
rUploadPointStatisticalDataD.setProvinceName(dept.getName());
|
||||
rUploadPointStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadPointStatisticalDataD.setStatisticalLevel(judgeLevel(item.getDeptLevel()));
|
||||
rUploadPointStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
//fixme 主配网标识文档中没有,先随便定义一个,后期调整
|
||||
rUploadPointStatisticalDataD.setDistributionFlag(UploadEnum.DISTRIBUTION_FLAG_01.getCode());
|
||||
//fixme over
|
||||
if (Objects.equals(item.getDeptLevel(),Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_2.getCode()))) {
|
||||
rUploadPointStatisticalDataD.setCityId("");
|
||||
rUploadPointStatisticalDataD.setCountyId("");
|
||||
} else if (Objects.equals(item.getDeptLevel(),Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_3.getCode()))) {
|
||||
rUploadPointStatisticalDataD.setCityId(item.getUnitId());
|
||||
rUploadPointStatisticalDataD.setCountyId("");
|
||||
} else if (Objects.equals(item.getDeptLevel(),Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()))) {
|
||||
rUploadPointStatisticalDataD.setCityId("");
|
||||
rUploadPointStatisticalDataD.setCountyId(item.getUnitId());
|
||||
}
|
||||
judgeLevel(item.getDeptLevel(),rUploadPointStatisticalDataD,item.getUnitId(),item.getUnitName(),deptList,deptMap);
|
||||
List<ROperatingIndexDPO> l1 = devMap.get(item.getUnitId());
|
||||
if (CollectionUtil.isNotEmpty(l1)){
|
||||
ROperatingIndexDPO po = l1.get(0);
|
||||
rUploadPointStatisticalDataD.setRunTerminalNum(po.getOnlineMeasurementPoints());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorNum(po.getTransitMeasurementPoints());
|
||||
rUploadPointStatisticalDataD.setRunMonitorNum(po.getMeasurementRunPoints());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(BigDecimal.valueOf(po.getMeasurementRunPoints()*100.0/po.getTransitMeasurementPoints()).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
rUploadPointStatisticalDataD.setOnlineMonitorRate(po.getMeasurementRunPoints()==0?0d:BigDecimal.valueOf(po.getTransitMeasurementPoints()*100.0/po.getMeasurementRunPoints()).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
}
|
||||
//获取当前单位下所有的监测点,匹配监测点数据
|
||||
List<LineDevGetDTO> l2 = item.getLineBaseList();
|
||||
@@ -142,16 +132,27 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
/**
|
||||
* 判断单位层级
|
||||
*/
|
||||
public String judgeLevel(Integer level) {
|
||||
public void judgeLevel(Integer level, RUploadPointStatisticalDataD rUploadPointStatisticalDataD, String id, String name, List<Dept> deptList, Map<String,List<Dept>> map) {
|
||||
String result = "";
|
||||
if (Objects.equals(level,Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_2.getCode()))){
|
||||
result = UploadEnum.STATISTICAL_LEVEL_3.getCode();
|
||||
rUploadPointStatisticalDataD.setCityId("");
|
||||
rUploadPointStatisticalDataD.setCountyId("");
|
||||
} else if (Objects.equals(level,Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_3.getCode()))) {
|
||||
result = UploadEnum.STATISTICAL_LEVEL_4.getCode();
|
||||
rUploadPointStatisticalDataD.setCityId(id);
|
||||
rUploadPointStatisticalDataD.setCityName(name);
|
||||
rUploadPointStatisticalDataD.setCountyId("");
|
||||
} else if (Objects.equals(level,Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_4.getCode()))) {
|
||||
result = UploadEnum.STATISTICAL_LEVEL_5.getCode();
|
||||
List<String> list = Arrays.stream(map.get(id).get(0).getPids().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
String parentCode = deptList.stream().filter(o->Objects.equals(o.getId(),list.get(3))).findFirst().orElse(null).getCode();
|
||||
rUploadPointStatisticalDataD.setCityId(parentCode);
|
||||
rUploadPointStatisticalDataD.setCityName(map.get(parentCode).get(0).getName());
|
||||
rUploadPointStatisticalDataD.setCountyId(id);
|
||||
rUploadPointStatisticalDataD.setCountyName(name);
|
||||
}
|
||||
return result;
|
||||
rUploadPointStatisticalDataD.setStatisticalLevel(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.upload.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.api.StatationStatClient;
|
||||
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
|
||||
import com.njcn.device.pms.pojo.po.StatationStat;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadPointStatisticalDataD;
|
||||
import com.njcn.harmonic.pojo.po.upload.RUploadSubstationStatisticalDataD;
|
||||
import com.njcn.prepare.harmonic.enums.UploadEnum;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.upload.RUploadSubstationStatisticalDataDMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
|
||||
import com.njcn.prepare.harmonic.service.mysql.upload.IRUploadSubstationStatisticalDataDService;
|
||||
@@ -15,7 +24,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -28,23 +38,105 @@ import java.util.List;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RUploadSubstationStatisticalDataDServiceImpl extends ServiceImpl<RUploadSubstationStatisticalDataDMapper, RUploadSubstationStatisticalDataD> implements IRUploadSubstationStatisticalDataDService {
|
||||
public class RUploadSubstationStatisticalDataDServiceImpl extends MppServiceImpl<RUploadSubstationStatisticalDataDMapper, RUploadSubstationStatisticalDataD> implements IRUploadSubstationStatisticalDataDService {
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final StatationStatClient statationStatClient;
|
||||
@Override
|
||||
public void insertSubStatisticalDataDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
public void insertSubStatisticalDataDay(CalculatedParam<String> calculatedParam) {
|
||||
List<RUploadSubstationStatisticalDataD> result = new ArrayList<>();
|
||||
//获取省级单位id
|
||||
Dept data = deptFeignClient.getRootDept().getData();
|
||||
deptGetLineParam.setDeptId(data.getId());
|
||||
List<DeptGetSubStationDTO> data1 = commTerminalGeneralClient.deptSubStation(deptGetLineParam).getData();
|
||||
data1.forEach(item->{
|
||||
System.out.println("id==:" + item.getUnitId());
|
||||
System.out.println("level==:" + item.getDeptLevel());
|
||||
System.out.println("");
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
//变电站id
|
||||
List<String> subList = calculatedParam.getIdList();
|
||||
//获取变电站信息
|
||||
List<StatationStat> subInfo = getSubstationInfo(subList);
|
||||
Map<String,List<StatationStat>> subMap = subInfo.stream().collect(Collectors.groupingBy(StatationStat::getOrgId));
|
||||
//获取所有部门单位信息
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String,List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
deptMap.forEach((k,v)->{
|
||||
List<String> list = Arrays.stream(v.get(0).getPids().split(",")).map(String::trim).collect(Collectors.toList());
|
||||
if (list.size() > 2){
|
||||
RUploadSubstationStatisticalDataD rUploadSubstationStatisticalDataD = new RUploadSubstationStatisticalDataD();
|
||||
rUploadSubstationStatisticalDataD.setId(IdUtil.simpleUUID());
|
||||
rUploadSubstationStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate());
|
||||
rUploadSubstationStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
||||
rUploadSubstationStatisticalDataD.setProvinceId(dept.getCode());
|
||||
rUploadSubstationStatisticalDataD.setProvinceName(dept.getName());
|
||||
//处理层级关系 && 处理基础数据
|
||||
getDeptLevel(list,rUploadSubstationStatisticalDataD,deptList,deptMap,k,subMap);
|
||||
result.add(rUploadSubstationStatisticalDataD);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(result)){
|
||||
//查询数据如果有数据,将data_id置为null,这样就保留之前的唯一id
|
||||
LambdaQueryWrapper<RUploadSubstationStatisticalDataD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RUploadSubstationStatisticalDataD::getStatisticalDate,calculatedParam.getDataDate());
|
||||
List<RUploadSubstationStatisticalDataD> oldData = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(oldData)){
|
||||
result.forEach(item->{
|
||||
item.setId(null);
|
||||
});
|
||||
}
|
||||
//存储数据
|
||||
this.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变电站信息
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public List<StatationStat> getSubstationInfo(List<String> list) {
|
||||
PmsStatationStatInfoParam param = new PmsStatationStatInfoParam();
|
||||
param.setPowerIds(list);
|
||||
return statationStatClient.getPowerInfo(param).getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前部门的层级
|
||||
* @return
|
||||
*/
|
||||
public void getDeptLevel(List<String> list, RUploadSubstationStatisticalDataD rUploadSubstationStatisticalDataD, List<Dept> deptList, Map<String,List<Dept>> map, String code, Map<String,List<StatationStat>> subMap) {
|
||||
switch (list.size()) {
|
||||
//市级
|
||||
case 3:
|
||||
int count = 0;
|
||||
//处理层级
|
||||
rUploadSubstationStatisticalDataD.setCityId(code);
|
||||
rUploadSubstationStatisticalDataD.setCityName(map.get(code).get(0).getName());
|
||||
rUploadSubstationStatisticalDataD.setCountyId("");
|
||||
//处理基础数据
|
||||
String id = deptList.stream().filter(o->Objects.equals(o.getCode(),code)).findAny().orElse(null).getId();
|
||||
List<String> codeList = deptList.stream().filter(o->Objects.equals(o.getPid(),id)).map(Dept::getCode).collect(Collectors.toList());
|
||||
for (String item : codeList) {
|
||||
List<StatationStat> l = subMap.get(item);
|
||||
if (CollectionUtil.isNotEmpty(l)){
|
||||
count = count + l.size();
|
||||
}
|
||||
}
|
||||
rUploadSubstationStatisticalDataD.setSubstationCount(count == 0 ? null:count);
|
||||
break;
|
||||
//县级
|
||||
case 4:
|
||||
//处理层级
|
||||
String parentCode = deptList.stream().filter(o->Objects.equals(o.getId(),list.get(3))).findFirst().orElse(null).getCode();
|
||||
rUploadSubstationStatisticalDataD.setCityId(parentCode);
|
||||
rUploadSubstationStatisticalDataD.setCityName(map.get(parentCode).get(0).getName());
|
||||
rUploadSubstationStatisticalDataD.setCountyId(code);
|
||||
rUploadSubstationStatisticalDataD.setCountyName(map.get(code).get(0).getName());
|
||||
//处理基础数据
|
||||
List<StatationStat> l = subMap.get(code);
|
||||
if (CollectionUtil.isNotEmpty(l)){
|
||||
rUploadSubstationStatisticalDataD.setSubstationCount(l.size());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package com.njcn.user.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.user.api.fallback.DeptFeignClientFallbackFactory;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -133,4 +140,20 @@ public interface DeptFeignClient {
|
||||
*/
|
||||
@GetMapping("/getUpByDeptIds")
|
||||
HttpResult<List<String>> getUpByDeptIds(@RequestParam("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* 根据单位集合查询对应部门
|
||||
* @param list code集合
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getDeptByCodeList")
|
||||
HttpResult<List<Dept>> getDeptByCodeList(@RequestBody List<String> list);
|
||||
|
||||
/**
|
||||
* 获取所有的部门集合
|
||||
* @author xy
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@GetMapping("/getAllDept")
|
||||
HttpResult<List<Dept>> getAllDept();
|
||||
}
|
||||
|
||||
@@ -128,6 +128,18 @@ public class DeptFeignClientFallbackFactory implements FallbackFactory<DeptFeign
|
||||
log.error("{}异常,降级处理,异常为:{}","根据部门id查询当前部门所有父级部门id",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Dept>> getDeptByCodeList(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据单位code集合查询对应部门:",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Dept>> getAllDept() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有单位:",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,8 +458,34 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++begin*/
|
||||
|
||||
/**
|
||||
* 根据单位集合查询对应部门
|
||||
* @param list code集合
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getDeptByCodeList")
|
||||
@ApiOperation("根据单位集合查询对应部门")
|
||||
@ApiImplicitParam(name = "list", value = "code集合", required = true)
|
||||
public HttpResult<List<Dept>> getDeptByCodeList(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getDeptByCodeList");
|
||||
List<Dept> result = deptService.getDeptByCodeList(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有的部门集合
|
||||
* @author xy
|
||||
* @date 2023/12/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getAllDept")
|
||||
@ApiOperation("获取所有单位")
|
||||
public HttpResult<List<Dept>> getAllDept() {
|
||||
String methodDescribe = getMethodDescribe("getAllDept");
|
||||
List<Dept> result = deptService.getAllDept();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/*++++++++++++++++++++++++++++++++pms专用+++++++++++++++++++++++++++++++end*/
|
||||
|
||||
|
||||
@@ -226,4 +226,19 @@ public interface IDeptService extends IService<Dept> {
|
||||
* @Date: 2023/11/9 15:57
|
||||
*/
|
||||
List<String> getUpByDeptIds(String deptId);
|
||||
|
||||
/**
|
||||
* @Description: 根据单位集合查询对应部门
|
||||
* @param list code集合
|
||||
* @Author: xuyang
|
||||
* @Date: 2023/12/11 11:36
|
||||
*/
|
||||
List<Dept> getDeptByCodeList(List<String> list);
|
||||
|
||||
/**
|
||||
* @Description: 获取所有单位
|
||||
* @Author: xuyang
|
||||
* @Date: 2023/12/11 14:50
|
||||
*/
|
||||
List<Dept> getAllDept();
|
||||
}
|
||||
|
||||
@@ -468,4 +468,14 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
list.add(deptId);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> getDeptByCodeList(List<String> list) {
|
||||
return this.lambdaQuery().in(Dept::getCode,list).eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dept> getAllDept() {
|
||||
return this.lambdaQuery().eq(Dept::getState,DataStateEnum.ENABLE.getCode()).list();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user