Commit 4b246629 authored by tianchao's avatar tianchao

1.菜单保存

2.组织机构保存
3.线路保存
parent 1200c03f
......@@ -27,11 +27,6 @@ public class BaseLineAllView implements Serializable {
@TableField
private BigDecimal elevation;
@XText("组织id")
@TableField
private String ouId;
@XText("油田ouid")
private String oilOuId;
......@@ -84,13 +79,6 @@ public class BaseLineAllView implements Serializable {
this.elevation = elevation;
}
public String getOuId() {
return ouId;
}
public void setOuId(String ouId) {
this.ouId = ouId;
}
public String getOilOuId() {
return oilOuId;
......
......@@ -24,11 +24,11 @@ public class BaseLineEnt implements Serializable {
@XText("线路类型")
@TableField
private Integer lineType;
private String lineType;
@XText("电网类型")
@TableField
private Integer gridType;
private String gridType;
@XText("装机容量")
@TableField
......@@ -44,7 +44,7 @@ public class BaseLineEnt implements Serializable {
@XText("组织id")
@TableField
private String ouId;
private String wellOuId;
@TableField
private String createById;
......@@ -88,20 +88,20 @@ public class BaseLineEnt implements Serializable {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......@@ -128,12 +128,12 @@ public class BaseLineEnt implements Serializable {
this.arrayToward = value;
}
public String getOuId() {
return this.ouId;
public String getWellOuId() {
return wellOuId;
}
public void setOuId(String value) {
this.ouId = value;
public void setWellOuId(String wellOuId) {
this.wellOuId = wellOuId;
}
public String getCreateById() {
......
......@@ -20,11 +20,11 @@ public class BaseLineView implements Serializable {
@XText("线路类型")
@TableField
private Integer lineType;
private String lineType;
@XText("电网类型")
@TableField
private Integer gridType;
private String gridType;
@XText("装机容量")
@TableField
......@@ -38,10 +38,6 @@ public class BaseLineView implements Serializable {
@TableField
private BigDecimal arrayToward;
@XText("组织id")
@TableField
private String ouId;
@TableField
private String createById;
......@@ -95,20 +91,20 @@ public class BaseLineView implements Serializable {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......@@ -135,14 +131,6 @@ public class BaseLineView implements Serializable {
this.arrayToward = value;
}
public String getOuId() {
return this.ouId;
}
public void setOuId(String value) {
this.ouId = value;
}
public String getCreateById() {
return this.createById;
}
......
package pps.core.base.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService;
import pps.cloud.system.service.SystemDictionaryService;
import pps.cloud.system.service.data.QuerySysDictionaryViewInput;
import pps.cloud.system.service.data.QuerySysDictionaryViewOutput;
import pps.cloud.system.service.data.*;
import pps.core.base.entity.BaseLineAllView;
import pps.core.base.entity.BaseLineEnt;
import pps.core.base.entity.BaseLineView;
......@@ -17,6 +18,7 @@ import xstartup.annotation.XService;
import xstartup.base.XContext;
import xstartup.base.data.CustomQueryInput;
import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult;
import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
......@@ -27,7 +29,9 @@ import xstartup.feature.api.annotation.XApiPost;
import xstartup.feature.api.annotation.XApiPost;
import xstartup.feature.mybatis.helper.XMapperHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@XService
public class BaseLineService {
......@@ -87,17 +91,62 @@ public class BaseLineService {
@XApiAnonymous
@XApiPost
public XListResult<QueryBaseLineOutput> queryBaseLineList(XContext context, QueryBaseLineListInput input){
public XPageResult<QueryBaseLineOutput> queryBaseLineList(XContext context, QueryBaseLineListInput input){
PageHelper.startPage(input.getPage(), input.getLimit());
//获取组织机构下的子集
SysOrganizationCloudService cloudService = context.getBean(SysOrganizationCloudService.class);
GetAllOuListByOuIdInput ouIdInput = new GetAllOuListByOuIdInput();
if(XStringUtils.isNotEmpty(input.getOuId()))
ouIdInput.setOuId(input.getOuId());
else
ouIdInput.setOuId("00000000-0000-0000-0000-000000000000");
XListResult<GetOuListTreeOutput> outputXListResult = cloudService.getAllOuListByOuId(context , ouIdInput);
outputXListResult.throwIfFail();
List<GetOuListTreeOutput> ouList = outputXListResult.getResult();
List<String> ouIdList = new ArrayList<>();
if(CollectionUtils.isEmpty(ouList)){
ouIdList.add(input.getOuId());
}else {
ouIdList = ouList.stream().map(GetOuListTreeOutput::getOuId).collect(Collectors.toList());
}
BaseLineMapper mapper = context.getBean(BaseLineMapper.class);
List<BaseLineEnt> list = mapper.selectList(new QueryWrapper<>());
List<QueryBaseLineOutput> outputs = XCopyUtils.copyNewList(list, QueryBaseLineOutput.class);
QueryWrapper<BaseLineEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(BaseLineEnt::getWellOuId , ouIdList);
List<BaseLineEnt> list = mapper.selectList(queryWrapper);
PageInfo<BaseLineEnt> pageInfo = new PageInfo<>(list);
List<QueryBaseLineOutput> outputs = XCopyUtils.copyNewList(pageInfo.getList(), QueryBaseLineOutput.class);
//获取线路、电网字典
List<QuerySysDictionaryViewOutput> gridTypeList = getDictList(context , "grid_type");
List<QuerySysDictionaryViewOutput> lineTypeList = getDictList(context , "line_type");
outputs.stream().forEach(item->{
item.setGridTypeName(getDictName(item.getGridType() + "", gridTypeList));
item.setLineTypeName(getDictName(item.getGridType() + "", lineTypeList));
});
return XListResult.success(outputs);
//获取上级线路
List<Integer> parenIds = list.stream().filter(item->item.getParentId() != null).map(BaseLineEnt::getParentId).collect(Collectors.toList());
List<BaseLineEnt> parentList = new ArrayList<>();
if(!CollectionUtils.isEmpty(parenIds)){
queryWrapper.clear();
queryWrapper.lambda().in(BaseLineEnt::getId , parenIds);
parentList = mapper.selectList(queryWrapper);
}
for(QueryBaseLineOutput item : outputs){
item.setGridTypeName(getDictName(item.getGridType(), gridTypeList));
item.setLineTypeName(getDictName(item.getLineType(), lineTypeList));
GetOuListTreeOutput treeOutput = ouList.stream().filter(tree->tree.getOuId().equals(item.getWellOuId())).findFirst().orElse(null);
if(null != treeOutput){
//设置井场
item.setWellOuName(treeOutput.getOuName());
//根据井场,设置油田
GetOuListTreeOutput oilTreeOutput = ouList.stream().filter(tree->tree.getOuId().equals(treeOutput.getParentOuId())).findFirst().orElse(null);
if(null != oilTreeOutput){
item.setOilOuName(oilTreeOutput.getOuName());
}
}
if(item.getParentId() != null){
//设置父级线路
BaseLineEnt parent = parentList.stream().filter(p->p.getId() == item.getParentId()).findFirst().orElse(null);
if(parent != null)
item.setPLineName(parent.getLineName());
}
}
return XPageResult.success(outputs, input, pageInfo.getTotal());
}
@XApiAnonymous
......
......@@ -13,10 +13,10 @@ public class CreateBaseLineInput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -28,7 +28,7 @@ public class CreateBaseLineInput {
private BigDecimal arrayToward;
@XText("组织id")
private String ouId;
private String wellOuId;
private String createById;
......@@ -59,20 +59,20 @@ public class CreateBaseLineInput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......@@ -99,12 +99,12 @@ public class CreateBaseLineInput {
this.arrayToward = value;
}
public String getOuId() {
return this.ouId;
public String getWellOuId() {
return wellOuId;
}
public void setOuId(String value) {
this.ouId = value;
public void setWellOuId(String wellOuId) {
this.wellOuId = wellOuId;
}
public String getCreateById() {
......
......@@ -14,10 +14,10 @@ public class CreateBaseLineOutput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -67,20 +67,20 @@ public class CreateBaseLineOutput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......
......@@ -14,10 +14,10 @@ public class DeleteBaseLineOutput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -67,20 +67,20 @@ public class DeleteBaseLineOutput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......
......@@ -14,10 +14,10 @@ public class GetBaseLineOutput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -29,7 +29,7 @@ public class GetBaseLineOutput {
private BigDecimal arrayToward;
@XText("组织id")
private String ouId;
private String wellOuId;
private String createById;
......@@ -67,20 +67,20 @@ public class GetBaseLineOutput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......@@ -107,12 +107,12 @@ public class GetBaseLineOutput {
this.arrayToward = value;
}
public String getOuId() {
return this.ouId;
public String getWellOuId() {
return wellOuId;
}
public void setOuId(String value) {
this.ouId = value;
public void setWellOuId(String wellOuId) {
this.wellOuId = wellOuId;
}
public String getCreateById() {
......
......@@ -28,11 +28,6 @@ public class QueryBaseLineAllOutput extends XPageInput {
private BigDecimal elevation;
@XText("组织id")
private String ouId;
@XText("油田ouid")
private String oilOuId;
......@@ -85,14 +80,6 @@ public class QueryBaseLineAllOutput extends XPageInput {
this.elevation = elevation;
}
public String getOuId() {
return ouId;
}
public void setOuId(String ouId) {
this.ouId = ouId;
}
public String getOilOuId() {
return oilOuId;
}
......
......@@ -3,7 +3,7 @@ package pps.core.base.service.data.base_line;
import xstartup.annotation.XText;
import xstartup.base.data.XPageInput;
public class QueryBaseLineListInput {
public class QueryBaseLineListInput extends XPageInput {
@XText("组织id")
private String ouId;
......
......@@ -19,13 +19,13 @@ public class QueryBaseLineOutput extends XPageInput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("线路类型")
private String lineTypeName;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("电网类型")
private String gridTypeName;
......@@ -42,9 +42,6 @@ public class QueryBaseLineOutput extends XPageInput {
private BigDecimal arrayToward;
@XText("组织id")
private String ouId;
@XText("油田ouid")
private String oilOuId;
......@@ -102,19 +99,19 @@ public class QueryBaseLineOutput extends XPageInput {
this.lineName = lineName;
}
public Integer getLineType() {
public String getLineType() {
return lineType;
}
public void setLineType(Integer lineType) {
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
public String getGridType() {
return gridType;
}
public void setGridType(Integer gridType) {
public void setGridType(String gridType) {
this.gridType = gridType;
}
......@@ -142,13 +139,6 @@ public class QueryBaseLineOutput extends XPageInput {
this.arrayToward = arrayToward;
}
public String getOuId() {
return ouId;
}
public void setOuId(String ouId) {
this.ouId = ouId;
}
public String getOilOuId() {
return oilOuId;
......
......@@ -14,10 +14,10 @@ public class UpdateBaseLineInput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -29,7 +29,7 @@ public class UpdateBaseLineInput {
private BigDecimal arrayToward;
@XText("组织id")
private String ouId;
private String wellOuId;
private String createById;
......@@ -67,20 +67,20 @@ public class UpdateBaseLineInput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......@@ -107,12 +107,12 @@ public class UpdateBaseLineInput {
this.arrayToward = value;
}
public String getOuId() {
return this.ouId;
public String getWellOuId() {
return wellOuId;
}
public void setOuId(String value) {
this.ouId = value;
public void setWellOuId(String wellOuId) {
this.wellOuId = wellOuId;
}
public String getCreateById() {
......
......@@ -14,10 +14,10 @@ public class UpdateBaseLineOutput {
private String lineName;
@XText("线路类型")
private Integer lineType;
private String lineType;
@XText("电网类型")
private Integer gridType;
private String gridType;
@XText("装机容量")
private BigDecimal installCapacity;
......@@ -67,20 +67,20 @@ public class UpdateBaseLineOutput {
this.lineName = value;
}
public Integer getLineType() {
return this.lineType;
public String getLineType() {
return lineType;
}
public void setLineType(Integer value) {
this.lineType = value;
public void setLineType(String lineType) {
this.lineType = lineType;
}
public Integer getGridType() {
return this.gridType;
public String getGridType() {
return gridType;
}
public void setGridType(Integer value) {
this.gridType = value;
public void setGridType(String gridType) {
this.gridType = gridType;
}
public BigDecimal getInstallCapacity() {
......
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