Commit e94ee362 authored by ZWT's avatar ZWT

feat(能源管理系统): 基础信息配置

1.修改基础信息配置--输电线路配置模块查询井口列表接口,增加返回结果参数,修改查询逻辑,完成接口冒烟测试同时修改接口文档;
2.修改基础信息配置模块业务工具类,增加匹配查询字典名称方法;
3.修改基础信息配置模块业务工具类,增加匹配查询地区名称方法;
4.修改基础信息配置模块业务工具类,增加匹配查询组织名称方法;
5.修改基础信息配置--市电峰谷配置模块详情接口,增加时段类型值返回结果字段;
6.修改基础信息配置--市电峰谷配置模块表结构字段类型,同时更新相应代码,修改部分接口业务处理逻辑,重新完成接口冒烟测试;
7.修改基础信息配置--输电线路配置模块表结构字段类型,同时更新相应代码,修改部分接口业务处理逻辑,重新完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 43362550
...@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -5,8 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import pps.cloud.base.service.data.QueryBaseStationInput;
import pps.cloud.base.service.data.QueryBaseStationOutput;
import pps.cloud.system.enums.OuLevelDic; import pps.cloud.system.enums.OuLevelDic;
import pps.cloud.system.service.SysOrganizationCloudService; import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.data.*; import pps.cloud.system.service.data.*;
...@@ -38,7 +36,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -38,7 +36,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@Override @Override
public XSingleResult<GetSysOrganizationViewOutput> getSysOrganizationById(XContext context, GetSysOrganizationViewInput input){ public XSingleResult<GetSysOrganizationViewOutput> getSysOrganizationById(XContext context, GetSysOrganizationViewInput input) {
SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class); SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class);
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationEnt::getId, input.getId()); queryWrapper.lambda().eq(SysOrganizationEnt::getId, input.getId());
...@@ -62,7 +60,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -62,7 +60,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class); SysOrganizationMapper mapper = context.getBean(SysOrganizationMapper.class);
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>();
LambdaQueryWrapper<SysOrganizationEnt> lambda = queryWrapper.lambda(); LambdaQueryWrapper<SysOrganizationEnt> lambda = queryWrapper.lambda();
lambda.in(SysOrganizationEnt::getOuName,input.getIds()); lambda.in(SysOrganizationEnt::getOuName, input.getIds());
XPageInput pageInput = new XPageInput(); XPageInput pageInput = new XPageInput();
pageInput.setPage(1); pageInput.setPage(1);
pageInput.setLimit(1000); pageInput.setLimit(1000);
...@@ -79,7 +77,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -79,7 +77,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
view.setEndTime(new Date()); view.setEndTime(new Date());
try { try {
view.setUserId(context.getSession(PpsUserSession.class).getId()); view.setUserId(context.getSession(PpsUserSession.class).getId());
}catch (Exception e){ } catch (Exception e) {
view.setUserId(""); view.setUserId("");
} }
SysOrganizationView sysOrganizationView = viewMapper.getSysOrganizationByOuLevelAndOuId(view); SysOrganizationView sysOrganizationView = viewMapper.getSysOrganizationByOuLevelAndOuId(view);
...@@ -110,9 +108,9 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -110,9 +108,9 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
view.setEndTime(new Date()); view.setEndTime(new Date());
view.setUserId(input.getUserId()); view.setUserId(input.getUserId());
List<SysOrganizationView> sysOrganizationView = viewMapper.getSysOrganizationListByOuLevelAndUserId(view); List<SysOrganizationView> sysOrganizationView = viewMapper.getSysOrganizationListByOuLevelAndUserId(view);
List<GetSysOrganizationViewOutput> output=new ArrayList<>(); List<GetSysOrganizationViewOutput> output = new ArrayList<>();
for(SysOrganizationView item:sysOrganizationView){ for (SysOrganizationView item : sysOrganizationView) {
GetSysOrganizationViewOutput itemOutput=XCopyUtils.copyNewObject(item, GetSysOrganizationViewOutput.class); GetSysOrganizationViewOutput itemOutput = XCopyUtils.copyNewObject(item, GetSysOrganizationViewOutput.class);
output.add(itemOutput); output.add(itemOutput);
} }
return XListResult.success(output); return XListResult.success(output);
...@@ -137,26 +135,26 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -137,26 +135,26 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
QueryWrapper<SysUserOrganizationRelEnt> wrapper = new QueryWrapper<>(); QueryWrapper<SysUserOrganizationRelEnt> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(SysUserOrganizationRelEnt::getUserId,input.getUserId()) wrapper.lambda().eq(SysUserOrganizationRelEnt::getUserId, input.getUserId())
.le(SysUserOrganizationRelEnt::getEffectTime,new Date()) .le(SysUserOrganizationRelEnt::getEffectTime, new Date())
.ge(SysUserOrganizationRelEnt::getEndTime,new Date()); .ge(SysUserOrganizationRelEnt::getEndTime, new Date());
List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(wrapper); List<SysUserOrganizationRelEnt> relEnts = mapper.selectList(wrapper);
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput(); GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
if (!CollectionUtils.isEmpty(relEnts)){ if (!CollectionUtils.isEmpty(relEnts)) {
if (XStringUtils.isNotEmpty(relEnts.get(0).getOuId())){ if (XStringUtils.isNotEmpty(relEnts.get(0).getOuId())) {
QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysOrganizationEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationEnt::getId,relEnts.get(0).getOuId()) queryWrapper.lambda().eq(SysOrganizationEnt::getId, relEnts.get(0).getOuId())
.eq(SysOrganizationEnt::getIsDeleted,1); .eq(SysOrganizationEnt::getIsDeleted, 1);
SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(queryWrapper); SysOrganizationEnt sysOrganizationEnt = sysOrganizationMapper.selectOne(queryWrapper);
XCopyUtils.copyObject(sysOrganizationEnt,output); XCopyUtils.copyObject(sysOrganizationEnt, output);
output.setOuId(relEnts.get(0).getOuId()); output.setOuId(relEnts.get(0).getOuId());
QueryWrapper<SysOrganizationRelEnt> qw = new QueryWrapper<>(); QueryWrapper<SysOrganizationRelEnt> qw = new QueryWrapper<>();
qw.lambda().eq(SysOrganizationRelEnt::getOuId,relEnts.get(0).getOuId()) qw.lambda().eq(SysOrganizationRelEnt::getOuId, relEnts.get(0).getOuId())
.le(SysOrganizationRelEnt::getEffectTime,new Date()) .le(SysOrganizationRelEnt::getEffectTime, new Date())
.ge(SysOrganizationRelEnt::getEndTime,new Date()); .ge(SysOrganizationRelEnt::getEndTime, new Date());
List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(qw); List<SysOrganizationRelEnt> sysOrganizationRelEnts = sysOrganizationRelMapper.selectList(qw);
if(!CollectionUtils.isEmpty(sysOrganizationRelEnts)){ if (!CollectionUtils.isEmpty(sysOrganizationRelEnts)) {
output.setOuPath(sysOrganizationRelEnts.get(0).getOuIdPath()); output.setOuPath(sysOrganizationRelEnts.get(0).getOuIdPath());
} }
} }
...@@ -175,6 +173,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -175,6 +173,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
List<GetSysOrganizationViewOutput> outputs = XCopyUtils.copyNewList(list, GetSysOrganizationViewOutput.class); List<GetSysOrganizationViewOutput> outputs = XCopyUtils.copyNewList(list, GetSysOrganizationViewOutput.class);
return XPageResult.success(outputs, input, pageInfo.getTotal()); return XPageResult.success(outputs, input, pageInfo.getTotal());
} }
@Override @Override
public XListResult<GetSysOrganizationViewOutput> getOrganizationByParentOuId(XContext context, GetSysOrganizationViewInput input) { public XListResult<GetSysOrganizationViewOutput> getOrganizationByParentOuId(XContext context, GetSysOrganizationViewInput input) {
SysOrganizationViewMapper userOrganizationRelViewMapper = context.getBean(SysOrganizationViewMapper.class); SysOrganizationViewMapper userOrganizationRelViewMapper = context.getBean(SysOrganizationViewMapper.class);
...@@ -188,14 +187,14 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -188,14 +187,14 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@Override @Override
public XSingleResult<GetSysOrganizationViewOutput> getOrganizationBySubOuId(XContext context, GetSysOrganizationViewInput input) { public XSingleResult<GetSysOrganizationViewOutput> getOrganizationBySubOuId(XContext context, GetSysOrganizationViewInput input) {
if(input.getId()==null){ if (input.getId() == null) {
return XSingleResult.error(context,PARAM_EMPTY); return XSingleResult.error(context, PARAM_EMPTY);
} }
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationRelEnt::getOuId, input.getId()); queryWrapper.lambda().eq(SysOrganizationRelEnt::getOuId, input.getId());
queryWrapper.lambda().lt(SysOrganizationRelEnt::getEffectTime,new Date()); queryWrapper.lambda().lt(SysOrganizationRelEnt::getEffectTime, new Date());
queryWrapper.lambda().gt(SysOrganizationRelEnt::getEndTime,new Date()); queryWrapper.lambda().gt(SysOrganizationRelEnt::getEndTime, new Date());
SysOrganizationRelEnt relEnt = mapper.selectOne(queryWrapper); SysOrganizationRelEnt relEnt = mapper.selectOne(queryWrapper);
SysOrganizationMapper orgMapper = context.getBean(SysOrganizationMapper.class); SysOrganizationMapper orgMapper = context.getBean(SysOrganizationMapper.class);
...@@ -211,7 +210,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -211,7 +210,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
SysAuthOuScopeViewMapper scopeViewMapper = context.getBean(SysAuthOuScopeViewMapper.class); SysAuthOuScopeViewMapper scopeViewMapper = context.getBean(SysAuthOuScopeViewMapper.class);
List<SysAuthOuScopeView> sysAuthOuScopeViews = scopeViewMapper.selectOuIdsByUserId(input.getUserId()); List<SysAuthOuScopeView> sysAuthOuScopeViews = scopeViewMapper.selectOuIdsByUserId(input.getUserId());
List<GetSysOrganizationViewOutput> list = new ArrayList<>(); List<GetSysOrganizationViewOutput> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(sysAuthOuScopeViews)){ if (!CollectionUtils.isEmpty(sysAuthOuScopeViews)) {
sysAuthOuScopeViews.forEach(sysAuthOuScopeView -> { sysAuthOuScopeViews.forEach(sysAuthOuScopeView -> {
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput(); GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
output.setOuId(sysAuthOuScopeView.getOuId()); output.setOuId(sysAuthOuScopeView.getOuId());
...@@ -229,7 +228,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -229,7 +228,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
SysAuthOuScopeView record = XCopyUtils.copyNewObject(input, SysAuthOuScopeView.class); SysAuthOuScopeView record = XCopyUtils.copyNewObject(input, SysAuthOuScopeView.class);
List<SysAuthOuScopeView> sysAuthOuScopeViews = scopeViewMapper.selectOuInfoByCondition(record); List<SysAuthOuScopeView> sysAuthOuScopeViews = scopeViewMapper.selectOuInfoByCondition(record);
List<GetSysOrganizationViewOutput> list = new ArrayList<>(); List<GetSysOrganizationViewOutput> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(sysAuthOuScopeViews)){ if (!CollectionUtils.isEmpty(sysAuthOuScopeViews)) {
sysAuthOuScopeViews.forEach(sysAuthOuScopeView -> { sysAuthOuScopeViews.forEach(sysAuthOuScopeView -> {
GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput(); GetSysOrganizationViewOutput output = new GetSysOrganizationViewOutput();
output.setOuId(sysAuthOuScopeView.getOuId()); output.setOuId(sysAuthOuScopeView.getOuId());
...@@ -242,7 +241,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -242,7 +241,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@XText("根据用户id获取用户组织机构") @XText("根据用户id获取用户组织机构")
public XListResult<OuIdAndOutNameOutput> getOrgListByUserId(XContext context, QueryUserIdInput input){ public XListResult<OuIdAndOutNameOutput> getOrgListByUserId(XContext context, QueryUserIdInput input) {
SysUserOrganizationRelViewMapper mapper = context.getBean(SysUserOrganizationRelViewMapper.class); SysUserOrganizationRelViewMapper mapper = context.getBean(SysUserOrganizationRelViewMapper.class);
List<SysUserOrganizationRelView> list = mapper.getOrgListByUserId(input.getUserId()); List<SysUserOrganizationRelView> list = mapper.getOrgListByUserId(input.getUserId());
List<OuIdAndOutNameOutput> outputs = XCopyUtils.copyNewList(list, OuIdAndOutNameOutput.class); List<OuIdAndOutNameOutput> outputs = XCopyUtils.copyNewList(list, OuIdAndOutNameOutput.class);
...@@ -250,15 +249,15 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -250,15 +249,15 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
} }
@XText("根据组织机构id获取所有的子级组织机构") @XText("根据组织机构id获取所有的子级组织机构")
public XListResult<GetOuListTreeOutput> getAllOuListByOuId(XContext context, GetAllOuListByOuIdInput input){ public XListResult<GetOuListTreeOutput> getAllOuListByOuId(XContext context, GetAllOuListByOuIdInput input) {
List<GetOuListTreeOutput> outputs = new ArrayList<>(); List<GetOuListTreeOutput> outputs = new ArrayList<>();
SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class); SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class);
SysOrganizationView view = new SysOrganizationView(); SysOrganizationView view = new SysOrganizationView();
view.setIsDeleted(1); view.setIsDeleted(1);
view.setId(input.getOuId()); view.setId(input.getOuId());
List<SysOrganizationView> list = mapper.selectAllListByOuId(view); List<SysOrganizationView> list = mapper.selectAllListByOuId(view);
if(list.size()>0){ if (list.size() > 0) {
for(SysOrganizationView item : list){ for (SysOrganizationView item : list) {
GetOuListTreeOutput out = new GetOuListTreeOutput(); GetOuListTreeOutput out = new GetOuListTreeOutput();
out.setOuId(item.getId()); out.setOuId(item.getId());
out.setOuName(item.getOuName()); out.setOuName(item.getOuName());
...@@ -271,13 +270,13 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -271,13 +270,13 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
} }
@XText("根据组织机构id获取所有的子级组织机构") @XText("根据组织机构id获取所有的子级组织机构")
public XListResult<GetOuListTreeOutput> getOuListByOuIds(XContext context, GetOuListByOuIdsInput input){ public XListResult<GetOuListTreeOutput> getOuListByOuIds(XContext context, GetOuListByOuIdsInput input) {
if(CollectionUtils.isEmpty(input.getOuIdList())) return XListResult.success(new ArrayList<>()); if (CollectionUtils.isEmpty(input.getOuIdList())) return XListResult.success(new ArrayList<>());
List<GetOuListTreeOutput> outputs = new ArrayList<>(); List<GetOuListTreeOutput> outputs = new ArrayList<>();
SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class); SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class);
List<SysOrganizationView> list = mapper.selectListByOuIds(input.getOuIdList()); List<SysOrganizationView> list = mapper.selectListByOuIds(input.getOuIdList());
if(list.size()>0){ if (list.size() > 0) {
for(SysOrganizationView item : list){ for (SysOrganizationView item : list) {
GetOuListTreeOutput out = new GetOuListTreeOutput(); GetOuListTreeOutput out = new GetOuListTreeOutput();
out.setOuId(item.getId()); out.setOuId(item.getId());
out.setOuName(item.getOuName()); out.setOuName(item.getOuName());
...@@ -293,7 +292,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -293,7 +292,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
public XSingleResult<GetOuIdPathByOuIdOutput> getOuIdPathByOuId(XContext context, GetOuIdPathByOuIdInput input) { public XSingleResult<GetOuIdPathByOuIdOutput> getOuIdPathByOuId(XContext context, GetOuIdPathByOuIdInput input) {
SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class); SysOrganizationRelMapper mapper = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysOrganizationRelEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysOrganizationRelEnt::getOuId,input.getOuId()); queryWrapper.lambda().eq(SysOrganizationRelEnt::getOuId, input.getOuId());
queryWrapper.lambda().gt(SysOrganizationRelEnt::getEndTime, new Date());// 结束时间 queryWrapper.lambda().gt(SysOrganizationRelEnt::getEndTime, new Date());// 结束时间
queryWrapper.lambda().lt(SysOrganizationRelEnt::getEffectTime, new Date()); //有效时间 queryWrapper.lambda().lt(SysOrganizationRelEnt::getEffectTime, new Date()); //有效时间
queryWrapper.lambda().orderByDesc(SysOrganizationRelEnt::getCreateTime); queryWrapper.lambda().orderByDesc(SysOrganizationRelEnt::getCreateTime);
...@@ -325,13 +324,13 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -325,13 +324,13 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
return XSingleResult.success(orgOuLevel); return XSingleResult.success(orgOuLevel);
} }
private GetOrganizationOuLevel getOrgOuLevel(XContext context,String ouId,String ouLevel){ private GetOrganizationOuLevel getOrgOuLevel(XContext context, String ouId, String ouLevel) {
OuLevelDic byKey = OuLevelDic.getByKey(ouLevel); OuLevelDic byKey = OuLevelDic.getByKey(ouLevel);
if(byKey==null){ if (byKey == null) {
GetSysOrganizationViewInput input = new GetSysOrganizationViewInput(); GetSysOrganizationViewInput input = new GetSysOrganizationViewInput();
input.setId(ouId); input.setId(ouId);
XSingleResult<GetSysOrganizationViewOutput> organizationBySubOuId = getOrganizationBySubOuId(context, input); XSingleResult<GetSysOrganizationViewOutput> organizationBySubOuId = getOrganizationBySubOuId(context, input);
getOrgOuLevel(context,organizationBySubOuId.getResult().getId(),organizationBySubOuId.getResult().getOuLevel()); getOrgOuLevel(context, organizationBySubOuId.getResult().getId(), organizationBySubOuId.getResult().getOuLevel());
} }
GetOrganizationOuLevel out = new GetOrganizationOuLevel(); GetOrganizationOuLevel out = new GetOrganizationOuLevel();
out.setOuId(ouId); out.setOuId(ouId);
...@@ -341,8 +340,8 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -341,8 +340,8 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
@Override @Override
public XListResult<GetSysOrganizationViewOutput> getOrganizationBySubOuIds(XContext context, GetSysOrganizationViewInput input) { public XListResult<GetSysOrganizationViewOutput> getOrganizationBySubOuIds(XContext context, GetSysOrganizationViewInput input) {
if(CollectionUtils.isEmpty(input.getIds())){ if (CollectionUtils.isEmpty(input.getIds())) {
return XListResult.error(context,PARAM_EMPTY); return XListResult.error(context, PARAM_EMPTY);
} }
SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class); SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class);
List<SysOrganizationView> views = mapper.selectOrganizationBySubOuIds(input.getIds()); List<SysOrganizationView> views = mapper.selectOrganizationBySubOuIds(input.getIds());
...@@ -351,10 +350,10 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -351,10 +350,10 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
} }
@Override @Override
public XListResult<GetSysOrganizationViewOutput> selectRegionFirmByUserId(XContext context,SelectRegionFirmInput input) { public XListResult<GetSysOrganizationViewOutput> selectRegionFirmByUserId(XContext context, SelectRegionFirmInput input) {
SysOrganizationService bean = context.getBean(SysOrganizationService.class); SysOrganizationService bean = context.getBean(SysOrganizationService.class);
XListResult<pps.core.system.service.data.sys_organization.GetSysOrganizationViewOutput> listResult = bean.selectRegionFirmByUserId(context,input); XListResult<pps.core.system.service.data.sys_organization.GetSysOrganizationViewOutput> listResult = bean.selectRegionFirmByUserId(context, input);
if (CollectionUtils.isEmpty(listResult.getResult())){ if (CollectionUtils.isEmpty(listResult.getResult())) {
return XListResult.success(new ArrayList<>()); return XListResult.success(new ArrayList<>());
} }
List<GetSysOrganizationViewOutput> outputs = XCopyUtils.copyNewList(listResult.getResult(), GetSysOrganizationViewOutput.class); List<GetSysOrganizationViewOutput> outputs = XCopyUtils.copyNewList(listResult.getResult(), GetSysOrganizationViewOutput.class);
...@@ -382,7 +381,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -382,7 +381,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
record.setIsDeleted(SysOrganizationCode.NORMAL); record.setIsDeleted(SysOrganizationCode.NORMAL);
record.setEndTime(new Date()); record.setEndTime(new Date());
List<SysOrganizationView> list = mapper.selectOrganizationEffectiveByOuName(record); List<SysOrganizationView> list = mapper.selectOrganizationEffectiveByOuName(record);
List<GetSysOrganizationViewOutput> viewList = XCopyUtils.copyNewList(list , GetSysOrganizationViewOutput.class); List<GetSysOrganizationViewOutput> viewList = XCopyUtils.copyNewList(list, GetSysOrganizationViewOutput.class);
return XListResult.success(viewList); return XListResult.success(viewList);
} }
...@@ -393,7 +392,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ ...@@ -393,7 +392,7 @@ public class SysOrganizationCloudServiceImpl implements SysOrganizationCloudServ
view.setIsDeleted(1); view.setIsDeleted(1);
view.setId(input.getOuId()); view.setId(input.getOuId());
List<SysOrganizationView> list = mapper.selectAllListByOuId(view); List<SysOrganizationView> list = mapper.selectAllListByOuId(view);
List<GetSysOrganizationViewOutput> viewList = XCopyUtils.copyNewList(list , GetSysOrganizationViewOutput.class); List<GetSysOrganizationViewOutput> viewList = XCopyUtils.copyNewList(list, GetSysOrganizationViewOutput.class);
return XListResult.success(viewList); return XListResult.success(viewList);
} }
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod; import com.github.pagehelper.page.PageMethod;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.data.GetOuListTreeOutput;
import pps.cloud.system.service.data.QuerySysDictionaryViewOutput; import pps.cloud.system.service.data.QuerySysDictionaryViewOutput;
import pps.core.base.entity.*; import pps.core.base.entity.*;
import pps.core.base.mapper.*; import pps.core.base.mapper.*;
...@@ -38,6 +39,7 @@ import xstartup.helper.XTransactionHelper; ...@@ -38,6 +39,7 @@ import xstartup.helper.XTransactionHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* 输电线路配置模块 * 输电线路配置模块
...@@ -224,11 +226,23 @@ public class BasePowerLineService { ...@@ -224,11 +226,23 @@ public class BasePowerLineService {
PageInfo<BasePowerLineView> pageInfo = new PageInfo<>(list); PageInfo<BasePowerLineView> pageInfo = new PageInfo<>(list);
List<QueryBasePowerLineViewOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QueryBasePowerLineViewOutput.class); List<QueryBasePowerLineViewOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QueryBasePowerLineViewOutput.class);
if (CollUtil.isNotEmpty(outputs)) { if (CollUtil.isNotEmpty(outputs)) {
String ouName = DictUtils.getSysOrgNameById(context, input.getOuId()); List<GetOuListTreeOutput> ouInfos = DictUtils.getOuListByOuIds(
context,
outputs.stream()
.map(QueryBasePowerLineViewOutput::getOuId)
.distinct()
.collect(Collectors.toList())
);
List<QuerySysDictionaryViewOutput> gridTypeList = DictUtils.getDictList(context, DictTypeConstant.GRID_TYPE); List<QuerySysDictionaryViewOutput> gridTypeList = DictUtils.getDictList(context, DictTypeConstant.GRID_TYPE);
List<QuerySysDictionaryViewOutput> lineTypeList = DictUtils.getDictList(context, DictTypeConstant.LINE_TYPE); List<QuerySysDictionaryViewOutput> lineTypeList = DictUtils.getDictList(context, DictTypeConstant.LINE_TYPE);
for (QueryBasePowerLineViewOutput output : outputs) { for (QueryBasePowerLineViewOutput output : outputs) {
output.setOuName(ouName); output.setOuName(
ouInfos.stream()
.filter(row -> StringUtils.equals(row.getOuId(), output.getOuId()))
.map(GetOuListTreeOutput::getOuName)
.findAny()
.orElse(null)
);
output.setGridTypeName( output.setGridTypeName(
DictUtils.getDicNameByStream(gridTypeList, output.getGridTypeKey()) DictUtils.getDicNameByStream(gridTypeList, output.getGridTypeKey())
); );
......
...@@ -89,6 +89,23 @@ public class DictUtils { ...@@ -89,6 +89,23 @@ public class DictUtils {
return listByOuIdResult.stream().map(GetSysOrganizationViewOutput::getId).collect(Collectors.toList()); return listByOuIdResult.stream().map(GetSysOrganizationViewOutput::getId).collect(Collectors.toList());
} }
/**
* 通过组织机构ID集合获取详情列表
*
* @param context 上下文
* @param ouIds ou id
* @return {@link List}<{@link GetOuListTreeOutput}>
*/
public static List<GetOuListTreeOutput> getOuListByOuIds(XContext context, List<String> ouIds) {
GetOuListByOuIdsInput input = new GetOuListByOuIdsInput();
input.setOuIdList(ouIds);
SysOrganizationCloudService organizationCloudService = context.getBean(SysOrganizationCloudService.class);
XListResult<GetOuListTreeOutput> ouListByOuIds = organizationCloudService.getOuListByOuIds(context, input);
ouListByOuIds.throwIfFail();
return ouListByOuIds.getResult();
}
/*-------------------------其他-------------------------*/ /*-------------------------其他-------------------------*/
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment