Commit 4b7a9b91 authored by ZWT's avatar ZWT

feat(能源管理系统): 测试问题修复

1.修改间开制度管理-长期/中短期/短期间开优化定时任务,修改代码结构,处理部分未优化数据无法初始化问题;
2.修改间开制度管理-长期/中短期定时任务,修改离网型算法逻辑,优化代码;
3.修改间开制度管理-短期间开优化详情接口,优化代码;
4.修改间开制度管理-间开优化模块间开制度跟踪接口,解决短期间开制度查询多条导致程序报错问题;
5.修改间开制度管理-短期间开优化定时任务,解决重复添加短期优化记录问题;
6.修改光伏预测-查询预测列表接口,解决缺少电量值问题;
7.修改基础信息管理-井口配置模块分页列表接口,增加线路ID入参字段,修改查询逻辑;
8.修改基础信息管理-光伏电站配置模块分页列表接口,增加线路ID入参字段,修改查询逻辑;
9.修改基础信息管理-柴发设备配置模块分页列表接口,增加线路ID入参字段,修改查询逻辑;
10.修改基础信息管理-储能设备配置模块分页列表接口,增加线路ID入参字段,修改查询逻辑;
11.修改基础信息管理-光伏电站配置模块新增/修改接口,修改光伏电站表,增加字段,同时修改对应代码,修改接口优化代码结构;
12.修改基础信息管理--光伏电站配置模块详情接口,增加通过地区ID查询地区名称Cloud接口,修改代码逻辑;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 678292f3
...@@ -18,4 +18,14 @@ public interface SystemAreaService { ...@@ -18,4 +18,14 @@ public interface SystemAreaService {
@XText("查询地区详细地址") @XText("查询地区详细地址")
XSingleResult<AddressInfoModel> getAddressInfo(XContext context, GetSysAreaInput input); XSingleResult<AddressInfoModel> getAddressInfo(XContext context, GetSysAreaInput input);
/**
* 地区Cloud服务-条件查询地区
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetSysAreaOutput}>
*/
@XText("地区Cloud服务-条件查询地区")
XSingleResult<GetSysAreaOutput> getSysAreaByParam(XContext context, GetSysAreaInput input);
} }
package pps.cloud.system.service.data; package pps.cloud.system.service.data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 地区入参
*
* @author ZWT
* @date 2023/10/10
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetSysAreaInput { public class GetSysAreaInput {
private Integer id; private Integer id;
private String name; private String name;
...@@ -8,37 +24,4 @@ public class GetSysAreaInput { ...@@ -8,37 +24,4 @@ public class GetSysAreaInput {
private Integer parentId; private Integer parentId;
private Integer lev; private Integer lev;
public Integer getId() {
return this.id;
}
public void setId(Integer value) {
this.id = value;
}
public String getName() {
return this.name;
}
public void setName(String value) {
this.name = value;
}
public Integer getParentId() {
return this.parentId;
}
public void setParentId(Integer value) {
this.parentId = value;
}
public Integer getLev() {
return this.lev;
}
public void setLev(Integer value) {
this.lev = value;
}
} }
package pps.core.system.service; package pps.core.system.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pps.cloud.system.service.SystemAreaService; import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.AddressInfoModel; import pps.cloud.system.service.data.AddressInfoModel;
import pps.cloud.system.service.data.GetSysAreaInput; import pps.cloud.system.service.data.GetSysAreaInput;
...@@ -20,6 +20,7 @@ import xstartup.data.XSingleResult; ...@@ -20,6 +20,7 @@ import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiPost; import xstartup.feature.api.annotation.XApiPost;
import java.util.List; import java.util.List;
import java.util.Objects;
@XService @XService
public class SystemAreaServiceImpl implements SystemAreaService { public class SystemAreaServiceImpl implements SystemAreaService {
...@@ -40,33 +41,56 @@ public class SystemAreaServiceImpl implements SystemAreaService { ...@@ -40,33 +41,56 @@ public class SystemAreaServiceImpl implements SystemAreaService {
Integer sysAreaId = input.getId(); Integer sysAreaId = input.getId();
SysAreaMapper mapper = context.getBean(SysAreaMapper.class); SysAreaMapper mapper = context.getBean(SysAreaMapper.class);
AddressInfoModel model = new AddressInfoModel(); AddressInfoModel model = new AddressInfoModel();
QueryWrapper<SysAreaEnt> queryWrapper =new QueryWrapper<>(); QueryWrapper<SysAreaEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(SysAreaEnt::getId,sysAreaId); queryWrapper.lambda().eq(SysAreaEnt::getId, sysAreaId);
SysAreaEnt sysAreaEnt = mapper.selectOne(queryWrapper); SysAreaEnt sysAreaEnt = mapper.selectOne(queryWrapper);
if(ObjectUtils.isNotEmpty(sysAreaEnt)){ if (ObjectUtils.isNotEmpty(sysAreaEnt)) {
if(sysAreaEnt.getLev()==0){ if (sysAreaEnt.getLev() == 0) {
model.setArea(String.valueOf(sysAreaEnt.getId())); model.setArea(String.valueOf(sysAreaEnt.getId()));
} }
while (!StringUtils.equals("0",String.valueOf(sysAreaEnt.getParentId()))){ while (!StringUtils.equals("0", String.valueOf(sysAreaEnt.getParentId()))) {
if(sysAreaEnt.getLev()==1){ if (sysAreaEnt.getLev() == 1) {
model.setProvince(String.valueOf(sysAreaEnt.getId())); model.setProvince(String.valueOf(sysAreaEnt.getId()));
} }
if(sysAreaEnt.getLev()==2){ if (sysAreaEnt.getLev() == 2) {
model.setCity(String.valueOf(sysAreaEnt.getId())); model.setCity(String.valueOf(sysAreaEnt.getId()));
} }
if(sysAreaEnt.getLev()==3){ if (sysAreaEnt.getLev() == 3) {
model.setCounty(String.valueOf(sysAreaEnt.getId())); model.setCounty(String.valueOf(sysAreaEnt.getId()));
} }
QueryWrapper<SysAreaEnt> query =new QueryWrapper<>(); QueryWrapper<SysAreaEnt> query = new QueryWrapper<>();
query.lambda().eq(SysAreaEnt::getId,sysAreaEnt.getParentId()); query.lambda().eq(SysAreaEnt::getId, sysAreaEnt.getParentId());
sysAreaEnt = mapper.selectOne(query); sysAreaEnt = mapper.selectOne(query);
if(sysAreaEnt.getLev()==0){ if (sysAreaEnt.getLev() == 0) {
model.setArea(String.valueOf(sysAreaEnt.getId())); model.setArea(String.valueOf(sysAreaEnt.getId()));
} }
} }
} }
return XSingleResult.success(model); return XSingleResult.success(model);
} }
/**
* 地区Cloud服务-条件查询地区
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetSysAreaOutput}>
*/
@XApiPost
@Override
public XSingleResult<GetSysAreaOutput> getSysAreaByParam(XContext context, GetSysAreaInput input) {
Integer id = input.getId();
String name = input.getName();
Integer parentId = input.getParentId();
SysAreaMapper mapper = context.getBean(SysAreaMapper.class);
SysAreaEnt sysAreaEnt = mapper.selectOne(new LambdaQueryWrapper<SysAreaEnt>()
.eq(Objects.nonNull(id), SysAreaEnt::getId, id)
.eq(Objects.nonNull(parentId), SysAreaEnt::getParentId, parentId)
.eq(StringUtils.isNotEmpty(name), SysAreaEnt::getName, name)
.last("LIMIT 1")
);
return XSingleResult.success(XCopyUtils.copyNewObject(sysAreaEnt, GetSysAreaOutput.class));
}
} }
...@@ -5,6 +5,9 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,6 +5,9 @@ import cn.hutool.core.util.StrUtil;
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.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import pps.cloud.system.service.SystemAreaService;
import pps.cloud.system.service.data.GetSysAreaInput;
import pps.cloud.system.service.data.GetSysAreaOutput;
import pps.core.base.entity.BasePhotovoltaicPlantEnt; import pps.core.base.entity.BasePhotovoltaicPlantEnt;
import pps.core.base.entity.BasePowerLineEnt; import pps.core.base.entity.BasePowerLineEnt;
import pps.core.base.entity.BasePowerLinePlantEnt; import pps.core.base.entity.BasePowerLinePlantEnt;
...@@ -39,6 +42,7 @@ import xstartup.helper.XTransactionHelper; ...@@ -39,6 +42,7 @@ import xstartup.helper.XTransactionHelper;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
/** /**
...@@ -126,7 +130,17 @@ public class BasePhotovoltaicPlantService { ...@@ -126,7 +130,17 @@ public class BasePhotovoltaicPlantService {
}); });
} }
@XText("根据id获取详情") /**
* 光伏电站模块--详情
* GET /base/base-photovoltaic-plant/get-base-photovoltaic-plant
* 接口ID:105466276
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105466276
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetBasePhotovoltaicPlantOutput}>
*/
@XText("光伏电站模块--详情")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XSingleResult<GetBasePhotovoltaicPlantOutput> getBasePhotovoltaicPlant(XContext context, GetBasePhotovoltaicPlantInput input) { public XSingleResult<GetBasePhotovoltaicPlantOutput> getBasePhotovoltaicPlant(XContext context, GetBasePhotovoltaicPlantInput input) {
...@@ -144,11 +158,16 @@ public class BasePhotovoltaicPlantService { ...@@ -144,11 +158,16 @@ public class BasePhotovoltaicPlantService {
if (Objects.nonNull(organizationView)) { if (Objects.nonNull(organizationView)) {
output.setProvince(organizationView.getProvinceName()); output.setProvince(organizationView.getProvinceName());
} }
output.setAreaName(Optional.ofNullable(this.getSysAreaInfo(context, GetSysAreaInput.builder()
.id(entity.getAreaCode())
.build()))
.map(GetSysAreaOutput::getName)
.orElse(null));
return XSingleResult.success(output); return XSingleResult.success(output);
} }
/** /**
* 分页查询 * 光伏电站模块--分页查询
* GET /base/base-photovoltaic-plant/query-base-photovoltaic-plant * GET /base/base-photovoltaic-plant/query-base-photovoltaic-plant
* 接口ID:105466277 * 接口ID:105466277
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105466277 * 接口地址:https://app.apifox.com/project/3196988/apis/api-105466277
...@@ -157,7 +176,7 @@ public class BasePhotovoltaicPlantService { ...@@ -157,7 +176,7 @@ public class BasePhotovoltaicPlantService {
* @param input 输入 * @param input 输入
* @return {@link XPageResult}<{@link QueryBasePhotovoltaicPlantOutput}> * @return {@link XPageResult}<{@link QueryBasePhotovoltaicPlantOutput}>
*/ */
@XText("分页查询") @XText("光伏电站模块--分页查询")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XPageResult<QueryBasePhotovoltaicPlantOutput> queryBasePhotovoltaicPlant(XContext context, QueryBasePhotovoltaicPlantInput input) { public XPageResult<QueryBasePhotovoltaicPlantOutput> queryBasePhotovoltaicPlant(XContext context, QueryBasePhotovoltaicPlantInput input) {
...@@ -250,4 +269,18 @@ public class BasePhotovoltaicPlantService { ...@@ -250,4 +269,18 @@ public class BasePhotovoltaicPlantService {
return mapper.selectOne(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>() return mapper.selectOne(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>()
.eq(BaseModel::getId, plantId)); .eq(BaseModel::getId, plantId));
} }
/**
* 获取系统区域信息
*
* @param context 上下文
* @param input 输入
* @return {@link GetSysAreaOutput}
*/
private GetSysAreaOutput getSysAreaInfo(XContext context, GetSysAreaInput input) {
SystemAreaService systemAreaService = context.getBean(SystemAreaService.class);
XSingleResult<GetSysAreaOutput> singleResult = systemAreaService.getSysAreaByParam(context, input);
singleResult.throwIfFail();
return singleResult.getResult();
}
} }
...@@ -4,35 +4,19 @@ import lombok.Data; ...@@ -4,35 +4,19 @@ import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/**
* 光伏电站
*
* @author ZWT
* @date 2023/10/10
*/
@Data @Data
public class GetBasePhotovoltaicPlantOutput { public class GetBasePhotovoltaicPlantOutput {
@XText("ID") @XText("ID")
private String id; private String id;
@XText("是否删除(1_是;0_否)")
private Integer isDeleted;
@XText("创建人ID")
private String createById;
@XText("创建人名称")
private String createByName;
@XText("创建时间")
private Date createTime;
@XText("修改人ID")
private String modifyById;
@XText("修改人名称")
private String modifyByName;
@XText("修改时间")
private Date modifyTime;
@XText("组织机构ID") @XText("组织机构ID")
private String ouId; private String ouId;
...@@ -74,4 +58,7 @@ public class GetBasePhotovoltaicPlantOutput { ...@@ -74,4 +58,7 @@ public class GetBasePhotovoltaicPlantOutput {
@XText("地区编码") @XText("地区编码")
private Integer areaCode; private Integer areaCode;
@XText("地区名称")
private String areaName;
} }
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