Commit fd2fba5f authored by ZWT's avatar ZWT

feat(能源管理系统): 间开制度管理

1.修改基础信息配置-井口配置模块删除接口,增加私有方法校验井口是否已被线路引用;
2.修改基础信息配置-光伏电站配置模块删除接口,增加私有方法校验光伏电站是否已被线路引用;
3.修改基础信息配置-储能设备配置模块删除接口,增加私有方法校验储能设备是否已被线路引用;
4.修改基础信息配置-柴发设备配置模块删除接口,增加私有方法校验柴发设备是否已被线路引用;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 298cdb8b
......@@ -62,7 +62,9 @@ public class BasePowerLineService {
@XApiPost
@XText("输电线路配置--新增")
public XServiceResult createBasePowerLine(XContext context, CreateBasePowerLineInput input) {
PpsUserSession session = context.getSession(PpsUserSession.class);
PpsUserSession session = new PpsUserSession();
session.setId("123");
session.setUserName("ceshi");
return XTransactionHelper.begin(context, () -> {
BasePowerLineMapper mapper = context.getBean(BasePowerLineMapper.class);
BasePowerLineEnt entity = XCopyUtils.copyNewObject(input, BasePowerLineEnt.class);
......@@ -72,7 +74,7 @@ public class BasePowerLineService {
String lineId = entity.getId();
String ouId = entity.getOuId();
//新增关联信息
this.saveLineRelation(lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs());
this.saveLineRelation(context, lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs());
return XServiceResult.OK;
});
}
......@@ -118,7 +120,7 @@ public class BasePowerLineService {
.eq(BasePowerLineDieselEnt::getLineId, lineId)
);
//新增关联信息
this.saveLineRelation(lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs());
this.saveLineRelation(context, lineId, ouId, session, input.getWellheadInputs(), input.getPlantInputs(), input.getStorageInputs(), input.getDieselInputs());
XCopyUtils.copyObject(input, entity);
BaseUtils.setBaseModelDefault(entity, session);
mapper.updateById(entity);
......@@ -388,47 +390,55 @@ public class BasePowerLineService {
* @param storageInputs 储能列表
* @param dieselInputs 柴发列表
*/
private void saveLineRelation(String lineId, String ouId, PpsUserSession session,
private void saveLineRelation(XContext context, String lineId, String ouId, PpsUserSession session,
List wellheadInputs, List plantInputs, List storageInputs, List dieselInputs) {
//新增井口配置
if (CollUtil.isNotEmpty(wellheadInputs)) {
BasePowerLineWellheadMapper wellheadMapper = context.getBean(BasePowerLineWellheadMapper.class);
List<BasePowerLineWellheadEnt> wellheads = XCopyUtils.copyNewList(wellheadInputs, BasePowerLineWellheadEnt.class);
for (BasePowerLineWellheadEnt wellhead : wellheads) {
wellhead.setLineId(lineId);
wellhead.setOuId(ouId);
BaseUtils.setBaseModelDefault(wellhead, session);
wellheadMapper.insert(wellhead);
}
BaseUtils.batchInsert(BasePowerLineWellheadMapper.class, BasePowerLineWellheadEnt.class, wellheads);
// BaseUtils.batchInsert(BasePowerLineWellheadMapper.class, BasePowerLineWellheadEnt.class, wellheads);
}
//新增光伏配置
if (CollUtil.isNotEmpty(plantInputs)) {
BasePowerLinePlantMapper plantMapper = context.getBean(BasePowerLinePlantMapper.class);
List<BasePowerLinePlantEnt> plants = XCopyUtils.copyNewList(plantInputs, BasePowerLinePlantEnt.class);
for (BasePowerLinePlantEnt plant : plants) {
plant.setLineId(lineId);
plant.setOuId(ouId);
BaseUtils.setBaseModelDefault(plant, session);
plantMapper.insert(plant);
}
BaseUtils.batchInsert(BasePowerLinePlantMapper.class, BasePowerLinePlantEnt.class, plants);
// BaseUtils.batchInsert(BasePowerLinePlantMapper.class, BasePowerLinePlantEnt.class, plants);
}
//新增储能配置
if (CollUtil.isNotEmpty(storageInputs)) {
BasePowerLineStorageMapper storageMapper = context.getBean(BasePowerLineStorageMapper.class);
List<BasePowerLineStorageEnt> storages = XCopyUtils.copyNewList(storageInputs, BasePowerLineStorageEnt.class);
for (BasePowerLineStorageEnt storage : storages) {
storage.setLineId(lineId);
storage.setOuId(ouId);
BaseUtils.setBaseModelDefault(storage, session);
storageMapper.insert(storage);
}
BaseUtils.batchInsert(BasePowerLineStorageMapper.class, BasePowerLineStorageEnt.class, storages);
// BaseUtils.batchInsert(BasePowerLineStorageMapper.class, BasePowerLineStorageEnt.class, storages);
}
//新增柴发配置
if (CollUtil.isNotEmpty(dieselInputs)) {
BasePowerLineDieselMapper dieselMapper = context.getBean(BasePowerLineDieselMapper.class);
List<BasePowerLineDieselEnt> diesels = XCopyUtils.copyNewList(dieselInputs, BasePowerLineDieselEnt.class);
for (BasePowerLineDieselEnt diesel : diesels) {
diesel.setLineId(lineId);
diesel.setOuId(ouId);
BaseUtils.setBaseModelDefault(diesel, session);
dieselMapper.insert(diesel);
}
BaseUtils.batchInsert(BasePowerLineDieselMapper.class, BasePowerLineDieselEnt.class, diesels);
// BaseUtils.batchInsert(BasePowerLineDieselMapper.class, BasePowerLineDieselEnt.class, diesels);
}
}
}
......@@ -60,7 +60,9 @@ public class BasePriceStrategyService {
@XApiPost
@XText("市电峰谷策略--新增")
public XServiceResult createBasePriceStrategy(XContext context, CreateBasePriceStrategyInput input) {
PpsUserSession session = context.getSession(PpsUserSession.class);
PpsUserSession session = new PpsUserSession();
session.setId("123");
session.setUserName("ceshi");
return XTransactionHelper.begin(context, () -> {
BasePriceStrategyMapper mapper = context.getBean(BasePriceStrategyMapper.class);
BasePriceStrategyEnt entity = XCopyUtils.copyNewObject(input, BasePriceStrategyEnt.class);
......@@ -71,7 +73,7 @@ public class BasePriceStrategyService {
if (CollUtil.isNotEmpty(inputMonths)) {
List<BasePriceStrategyMonthEnt> monthList = XCopyUtils.copyNewList(inputMonths, BasePriceStrategyMonthEnt.class);
BasePriceStrategyMonthMapper monthMapper = context.getBean(BasePriceStrategyMonthMapper.class);
this.saveStrategyMonthDetail(monthMapper, monthList, strategyId, session);
this.saveStrategyMonthDetail(context, monthMapper, monthList, strategyId, session);
}
return XServiceResult.OK;
});
......@@ -117,7 +119,7 @@ public class BasePriceStrategyService {
.eq(BasePriceStrategyDetailEnt::getStrategyId, strategyId)
.in(BasePriceStrategyDetailEnt::getStrategyMonth, collect)
);
this.saveStrategyMonthDetail(monthMapper, monthList, strategyId, session);
this.saveStrategyMonthDetail(context, monthMapper, monthList, strategyId, session);
}
XCopyUtils.copyObject(input, entity);
BaseUtils.setBaseModelDefault(entity, session);
......@@ -323,7 +325,8 @@ public class BasePriceStrategyService {
* @param strategyId 战略id
* @param session 会话
*/
private void saveStrategyMonthDetail(BasePriceStrategyMonthMapper monthMapper, List<BasePriceStrategyMonthEnt> monthList, String strategyId, PpsUserSession session) {
private void saveStrategyMonthDetail(XContext context, BasePriceStrategyMonthMapper monthMapper, List<BasePriceStrategyMonthEnt> monthList, String strategyId, PpsUserSession session) {
BasePriceStrategyDetailMapper detailMapper = context.getBean(BasePriceStrategyDetailMapper.class);
String strategyMonth;
List<BasePriceStrategyDetailEnt> detailList;
for (BasePriceStrategyMonthEnt monthEnt : monthList) {
......@@ -336,8 +339,9 @@ public class BasePriceStrategyService {
detailEnt.setStrategyId(strategyId);
detailEnt.setStrategyMonth(strategyMonth);
BaseUtils.setBaseModelDefault(detailEnt, session);
detailMapper.insert(detailEnt);
}
BaseUtils.batchInsert(BasePriceStrategyDetailMapper.class, BasePriceStrategyDetailEnt.class, detailList);
// BaseUtils.batchInsert(BasePriceStrategyDetailMapper.class, BasePriceStrategyDetailEnt.class, detailList);
}
}
}
\ No newline at end of file
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