Commit b37086e7 authored by ZWT's avatar ZWT

feat(能源管理系统): 系统开发

1.开发基础信息配置-市电峰谷配置模块删除功能,完成接口冒烟测试并生成接口文档;
2.开发基础信息配置-市电峰谷配置模块详情功能,完成接口冒烟测试并生成接口文档;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent d493171d
......@@ -14,6 +14,7 @@ import pps.core.base.mapper.BasePriceStrategyMonthMapper;
import pps.core.base.mapper.BasePriceStrategyViewMapper;
import pps.core.base.service.data.base_price_strategy.*;
import pps.core.base.service.data.base_price_strategy_month.CreateBasePriceStrategyMonthInput;
import pps.core.base.service.data.base_price_strategy_month.GetBasePriceStrategyMonthOutput;
import pps.core.base.service.data.base_price_strategy_month.UpdateBasePriceStrategyMonthInput;
import pps.core.common.session.PpsUserSession;
import xstartup.annotation.XService;
......@@ -31,10 +32,7 @@ import xstartup.feature.api.annotation.XApiPost;
import xstartup.feature.mybatis.helper.XMapperHelper;
import xstartup.helper.XTransactionHelper;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -48,7 +46,7 @@ import java.util.stream.Collectors;
public class BasePriceStrategyService {
/**
* 创建市电峰谷策略
* 市电峰谷策略--新增
*
* @param context 上下文
* @param input 输入
......@@ -56,7 +54,7 @@ public class BasePriceStrategyService {
*/
@XApiAnonymous
@XApiPost
@XText("创建市电峰谷策略")
@XText("市电峰谷策略--新增")
public XServiceResult createBasePriceStrategy(XContext context, CreateBasePriceStrategyInput input) {
// PpsUserSession session = context.getSession(PpsUserSession.class);
PpsUserSession session = new PpsUserSession();
......@@ -82,7 +80,7 @@ public class BasePriceStrategyService {
}
/**
* 更新市电峰谷策略
* 市电峰谷策略--修改
*
* @param context 上下文
* @param input 输入
......@@ -90,7 +88,7 @@ public class BasePriceStrategyService {
*/
@XApiAnonymous
@XApiPost
@XText("更新市电峰谷策略")
@XText("市电峰谷策略--修改")
public XServiceResult updateBasePriceStrategy(XContext context, UpdateBasePriceStrategyInput input) {
// PpsUserSession session = context.getSession(PpsUserSession.class);
PpsUserSession session = new PpsUserSession();
......@@ -136,7 +134,7 @@ public class BasePriceStrategyService {
}
/**
* 删除市电峰谷策略
* 市电峰谷策略--删除
* (如果被引用,则不能删除)
*
* @param context 上下文
......@@ -145,7 +143,7 @@ public class BasePriceStrategyService {
*/
@XApiAnonymous
@XApiPost
@XText("删除市电峰谷策略")
@XText("市电峰谷策略--删除")
public XServiceResult deleteBasePriceStrategy(XContext context, DeleteBasePriceStrategyInput input) {
// PpsUserSession session = context.getSession(PpsUserSession.class);
PpsUserSession session = new PpsUserSession();
......@@ -176,18 +174,63 @@ public class BasePriceStrategyService {
});
}
/**
* 市电峰谷策略--详情
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetBasePriceStrategyOutput}>
*/
@XApiAnonymous
@XApiGet
@XText("市电峰谷策略--详情")
public XSingleResult<GetBasePriceStrategyOutput> getBasePriceStrategy(XContext context, GetBasePriceStrategyInput input) {
BasePriceStrategyMapper mapper = context.getBean(BasePriceStrategyMapper.class);
String strategyId = input.getId();
QueryWrapper<BasePriceStrategyEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BasePriceStrategyEnt::getId, input.getId());
queryWrapper.lambda()
.select(BasePriceStrategyEnt::getId,
BasePriceStrategyEnt::getPolicyName,
BasePriceStrategyEnt::getAreaCode,
BasePriceStrategyEnt::getStrategyYear,
BasePriceStrategyEnt::getIsFixedPrice,
BasePriceStrategyEnt::getFixedElectricityPrice)
.eq(BasePriceStrategyEnt::getId, strategyId);
BasePriceStrategyEnt entity = mapper.selectOne(queryWrapper);
if (entity == null) {
return XSingleResult.error(context, XError.NotFound);
}
GetBasePriceStrategyOutput output = new GetBasePriceStrategyOutput();
XCopyUtils.copyObject(entity, output);
//查月份
BasePriceStrategyMonthMapper monthMapper = context.getBean(BasePriceStrategyMonthMapper.class);
List<BasePriceStrategyMonthEnt> monthEntList = monthMapper.selectList(new QueryWrapper<BasePriceStrategyMonthEnt>()
.lambda()
.select(BasePriceStrategyMonthEnt::getId, BasePriceStrategyMonthEnt::getStrategyMonth)
.eq(BasePriceStrategyMonthEnt::getStrategyId, strategyId));
if (!monthEntList.isEmpty()) {
//查明细
BasePriceStrategyDetailMapper detailMapper = context.getBean(BasePriceStrategyDetailMapper.class);
List<BasePriceStrategyDetailEnt> detailEntList = detailMapper.selectList(new QueryWrapper<BasePriceStrategyDetailEnt>()
.lambda()
.select(BasePriceStrategyDetailEnt::getStrategyMonth,
BasePriceStrategyDetailEnt::getPeriodTypeKey,
BasePriceStrategyDetailEnt::getStartTime,
BasePriceStrategyDetailEnt::getEndTime,
BasePriceStrategyDetailEnt::getElectrovalence,
BasePriceStrategyDetailEnt::getInternalSettlementPrice)
.eq(BasePriceStrategyDetailEnt::getStrategyId, strategyId));
if (!detailEntList.isEmpty()) {
Map<Integer, List<BasePriceStrategyDetailEnt>> collect = detailEntList.stream()
.collect(Collectors.groupingBy(BasePriceStrategyDetailEnt::getStrategyMonth));
for (BasePriceStrategyMonthEnt monthEnt : monthEntList) {
monthEnt.setDetails(collect.get(monthEnt.getStrategyMonth()));
}
}
List<GetBasePriceStrategyMonthOutput> months = new ArrayList<>(16);
XCopyUtils.copyList(monthEntList, months, GetBasePriceStrategyMonthOutput.class);
output.setMonths(months);
}
return XSingleResult.success(output);
}
......
package pps.core.base.service.data.base_price_strategy;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import xstartup.annotation.XText;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Date;
/**
* 市电峰谷配置入参
*
* @author ZWT
* @date 2023/08/25
*/
@Data
public class GetBasePriceStrategyInput {
@XText("ID")
@NotBlank
private String id;
@XText("是否删除(0_是;1_否)")
......@@ -43,109 +55,4 @@ public class GetBasePriceStrategyInput {
@XText("固定电价")
private BigDecimal fixedElectricityPrice;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public Integer getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(Integer value) {
this.isDeleted = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
public String getPolicyName() {
return this.policyName;
}
public void setPolicyName(String value) {
this.policyName = value;
}
public String getAreaCode() {
return this.areaCode;
}
public void setAreaCode(String value) {
this.areaCode = value;
}
public Integer getStrategyYear() {
return this.strategyYear;
}
public void setStrategyYear(Integer value) {
this.strategyYear = value;
}
public Integer getIsFixedPrice() {
return this.isFixedPrice;
}
public void setIsFixedPrice(Integer value) {
this.isFixedPrice = value;
}
public BigDecimal getFixedElectricityPrice() {
return this.fixedElectricityPrice;
}
public void setFixedElectricityPrice(BigDecimal value) {
this.fixedElectricityPrice = value;
}
}
package pps.core.base.service.data.base_price_strategy;
import jakarta.validation.Valid;
import lombok.Data;
import pps.core.base.service.data.base_price_strategy_month.GetBasePriceStrategyMonthOutput;
import xstartup.annotation.XText;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 市电峰谷配置返回结果
*
* @author ZWT
* @date 2023/08/25
*/
@Data
public class GetBasePriceStrategyOutput {
@XText("ID")
private String id;
......@@ -44,108 +56,9 @@ public class GetBasePriceStrategyOutput {
@XText("固定电价")
private BigDecimal fixedElectricityPrice;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public Integer getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(Integer value) {
this.isDeleted = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
public String getPolicyName() {
return this.policyName;
}
public void setPolicyName(String value) {
this.policyName = value;
}
public String getAreaCode() {
return this.areaCode;
}
public void setAreaCode(String value) {
this.areaCode = value;
}
public Integer getStrategyYear() {
return this.strategyYear;
}
public void setStrategyYear(Integer value) {
this.strategyYear = value;
}
public Integer getIsFixedPrice() {
return this.isFixedPrice;
}
public void setIsFixedPrice(Integer value) {
this.isFixedPrice = value;
}
public BigDecimal getFixedElectricityPrice() {
return this.fixedElectricityPrice;
}
public void setFixedElectricityPrice(BigDecimal value) {
this.fixedElectricityPrice = value;
}
/**
* 月份
*/
@Valid
private List<GetBasePriceStrategyMonthOutput> months;
}
package pps.core.base.service.data.base_price_strategy_detail;
import lombok.Data;
import xstartup.annotation.XText;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Date;
/**
* 明细
*
* @author ZWT
* @date 2023/08/25
*/
@Data
public class GetBasePriceStrategyDetailOutput {
@XText("ID")
private String id;
......@@ -49,125 +58,4 @@ public class GetBasePriceStrategyDetailOutput {
@XText("内部结算价")
private BigDecimal internalSettlementPrice;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public Integer getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(Integer value) {
this.isDeleted = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
public String getStrategyId() {
return this.strategyId;
}
public void setStrategyId(String value) {
this.strategyId = value;
}
public Integer getStrategyMonth() {
return this.strategyMonth;
}
public void setStrategyMonth(Integer value) {
this.strategyMonth = value;
}
public String getPeriodTypeKey() {
return this.periodTypeKey;
}
public void setPeriodTypeKey(String value) {
this.periodTypeKey = value;
}
public Date getStartTime() {
return this.startTime;
}
public void setStartTime(Date value) {
this.startTime = value;
}
public Date getEndTime() {
return this.endTime;
}
public void setEndTime(Date value) {
this.endTime = value;
}
public BigDecimal getElectrovalence() {
return this.electrovalence;
}
public void setElectrovalence(BigDecimal value) {
this.electrovalence = value;
}
public BigDecimal getInternalSettlementPrice() {
return this.internalSettlementPrice;
}
public void setInternalSettlementPrice(BigDecimal value) {
this.internalSettlementPrice = value;
}
}
package pps.core.base.service.data.base_price_strategy_month;
import jakarta.validation.Valid;
import lombok.Data;
import pps.core.base.service.data.base_price_strategy_detail.GetBasePriceStrategyDetailOutput;
import xstartup.annotation.XText;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 月份
*
* @author ZWT
* @date 2023/08/25
*/
@Data
public class GetBasePriceStrategyMonthOutput {
@XText("ID")
private String id;
......@@ -35,84 +46,9 @@ public class GetBasePriceStrategyMonthOutput {
@XText("市电峰谷月(1-12)")
private Integer strategyMonth;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public Integer getIsDeleted() {
return this.isDeleted;
}
public void setIsDeleted(Integer value) {
this.isDeleted = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
public String getStrategyId() {
return this.strategyId;
}
public void setStrategyId(String value) {
this.strategyId = value;
}
public Integer getStrategyMonth() {
return this.strategyMonth;
}
public void setStrategyMonth(Integer value) {
this.strategyMonth = value;
}
/**
* 明细
*/
@Valid
private List<GetBasePriceStrategyDetailOutput> details;
}
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