Commit d33d8b91 authored by tianchao's avatar tianchao
parents 3ad9b36a b5a578ba
...@@ -16,6 +16,8 @@ public enum BusinessError implements XError { ...@@ -16,6 +16,8 @@ public enum BusinessError implements XError {
StrategyReference(2004, "当前策略已被引用"), StrategyReference(2004, "当前策略已被引用"),
WellheadReferenceLine(2005, "当前井口已被线路引用"), WellheadReferenceLine(2005, "当前井口已被线路引用"),
WellheadReferenceSpace(2006, "当前井口已被间开引用"), WellheadReferenceSpace(2006, "当前井口已被间开引用"),
WellNumberExists(2007, "井号已存在"),
MakerNumberExists(2008, "出场编号已存在"),
; ;
private int code; private int code;
......
...@@ -42,39 +42,73 @@ import java.util.Objects; ...@@ -42,39 +42,73 @@ import java.util.Objects;
@XService @XService
public class BaseDieselGeneratorService { public class BaseDieselGeneratorService {
@XText("新增") /**
* 柴发设备模块--新增
* POST /base/base-diesel-generator/create-base-diesel-generator
* 接口ID:105601993
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105601993
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("柴发设备模块--新增")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult createBaseDieselGenerator(XContext context, CreateBaseDieselGeneratorInput input) { public XServiceResult createBaseDieselGenerator(XContext context, CreateBaseDieselGeneratorInput input) {
return XTransactionHelper.begin(context, () -> {
BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class); BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class);
if (this.checkMakerNumberExists(mapper, input.getMakerNumber(), null)) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseDieselGeneratorEnt entity = XCopyUtils.copyNewObject(input, BaseDieselGeneratorEnt.class); BaseDieselGeneratorEnt entity = XCopyUtils.copyNewObject(input, BaseDieselGeneratorEnt.class);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.insert(entity); mapper.insert(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("更新") /**
* 柴发设备模块--修改
* POST /base/base-diesel-generator/update-base-diesel-generator
* 接口ID:105601994
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105601994
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("柴发设备模块--修改")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult updateBaseDieselGenerator(XContext context, UpdateBaseDieselGeneratorInput input) { public XServiceResult updateBaseDieselGenerator(XContext context, UpdateBaseDieselGeneratorInput input) {
return XTransactionHelper.begin(context, () -> {
BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class); BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class);
if (this.checkMakerNumberExists(mapper, input.getMakerNumber(), input.getId())) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseDieselGeneratorEnt entity = this.selectOneByDieselId(input.getId(), mapper); BaseDieselGeneratorEnt entity = this.selectOneByDieselId(input.getId(), mapper);
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("删除") /**
* 柴发设备模块--删除
* POST /base/base-diesel-generator/delete-base-diesel-generator
* 接口ID:105601998
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105601998
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("柴发设备模块--删除")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult deleteBaseDieselGenerator(XContext context, DeleteBaseDieselGeneratorInput input) { public XServiceResult deleteBaseDieselGenerator(XContext context, DeleteBaseDieselGeneratorInput input) {
...@@ -82,23 +116,31 @@ public class BaseDieselGeneratorService { ...@@ -82,23 +116,31 @@ public class BaseDieselGeneratorService {
if (this.checkDieselIsReference(context, dieselId)) { if (this.checkDieselIsReference(context, dieselId)) {
return XServiceResult.error(context, BusinessError.DieselReference); return XServiceResult.error(context, BusinessError.DieselReference);
} }
return XTransactionHelper.begin(context, () -> {
BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class); BaseDieselGeneratorMapper mapper = context.getBean(BaseDieselGeneratorMapper.class);
BaseDieselGeneratorEnt entity = this.selectOneByDieselId(dieselId, mapper); if (Objects.isNull(this.selectOneByDieselId(dieselId, mapper))) {
if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
entity = new BaseDieselGeneratorEnt(); BaseDieselGeneratorEnt entity = new BaseDieselGeneratorEnt();
entity.setId(dieselId); entity.setId(dieselId);
entity.setIsDeleted(BusinessConstant.ZERO); entity.setIsDeleted(BusinessConstant.ZERO);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("根据id获取详情") /**
* 柴发设备模块--详情
* GET /base/base-diesel-generator/get-base-diesel-generator
* 接口ID:105601991
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105601991
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetBaseDieselGeneratorOutput}>
*/
@XText("柴发设备模块--详情")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XSingleResult<GetBaseDieselGeneratorOutput> getBaseDieselGenerator(XContext context, GetBaseDieselGeneratorInput input) { public XSingleResult<GetBaseDieselGeneratorOutput> getBaseDieselGenerator(XContext context, GetBaseDieselGeneratorInput input) {
...@@ -112,7 +154,7 @@ public class BaseDieselGeneratorService { ...@@ -112,7 +154,7 @@ public class BaseDieselGeneratorService {
} }
/** /**
* 分页查询 * 柴发设备模块--分页查询
* GET /base/base-diesel-generator/query-base-diesel-generator * GET /base/base-diesel-generator/query-base-diesel-generator
* 接口ID:105601992 * 接口ID:105601992
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105601992 * 接口地址:https://app.apifox.com/project/3196988/apis/api-105601992
...@@ -121,7 +163,7 @@ public class BaseDieselGeneratorService { ...@@ -121,7 +163,7 @@ public class BaseDieselGeneratorService {
* @param input 输入 * @param input 输入
* @return {@link XPageResult}<{@link QueryBaseDieselGeneratorOutput}> * @return {@link XPageResult}<{@link QueryBaseDieselGeneratorOutput}>
*/ */
@XText("分页查询") @XText("柴发设备模块--分页查询")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XPageResult<QueryBaseDieselGeneratorOutput> queryBaseDieselGenerator(XContext context, QueryBaseDieselGeneratorInput input) { public XPageResult<QueryBaseDieselGeneratorOutput> queryBaseDieselGenerator(XContext context, QueryBaseDieselGeneratorInput input) {
...@@ -132,6 +174,7 @@ public class BaseDieselGeneratorService { ...@@ -132,6 +174,7 @@ public class BaseDieselGeneratorService {
if (StringUtils.isNotEmpty(input.getLineId())) { if (StringUtils.isNotEmpty(input.getLineId())) {
queryWrapper.lambda() queryWrapper.lambda()
.notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_diesel w WHERE base_diesel_generator.id = w.diesel_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId()) .notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_diesel w WHERE base_diesel_generator.id = w.diesel_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId())
.notExists(StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_diesel w WHERE base_diesel_generator.id = w.diesel_id AND w.is_deleted = 1")
.eq(BaseDieselGeneratorEnt::getOuId, input.getOuId()); .eq(BaseDieselGeneratorEnt::getOuId, input.getOuId());
} else { } else {
List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId()); List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId());
...@@ -176,4 +219,21 @@ public class BaseDieselGeneratorService { ...@@ -176,4 +219,21 @@ public class BaseDieselGeneratorService {
.eq(BaseModel::getId, dieselId) .eq(BaseModel::getId, dieselId)
); );
} }
/**
* 检查编号是否存在
*
* @param mapper 映射器
* @param makerNumber 出场编号
* @param id id
* @return boolean
*/
private boolean checkMakerNumberExists(BaseDieselGeneratorMapper mapper, String makerNumber, String id) {
Long count = mapper.selectCount(new LambdaQueryWrapper<BaseDieselGeneratorEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(BaseDieselGeneratorEnt::getMakerNumber, makerNumber)
.ne(StringUtils.isNotEmpty(id), BaseModel::getId, id)
);
return count > 0;
}
} }
\ No newline at end of file
...@@ -42,39 +42,73 @@ import java.util.Objects; ...@@ -42,39 +42,73 @@ import java.util.Objects;
@XService @XService
public class BaseEnergyStorageDeviceService { public class BaseEnergyStorageDeviceService {
@XText("新增") /**
* 储能设备模块--新增
* POST /base/base-energy-storage-device/create-base-energy-storage-device
* 接口ID:105602202
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105602202
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("储能设备模块--新增")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult createBaseEnergyStorageDevice(XContext context, CreateBaseEnergyStorageDeviceInput input) { public XServiceResult createBaseEnergyStorageDevice(XContext context, CreateBaseEnergyStorageDeviceInput input) {
return XTransactionHelper.begin(context, () -> {
BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class); BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class);
if (this.checkMakerNumberExists(mapper, input.getMakerNumber(), null)) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseEnergyStorageDeviceEnt entity = XCopyUtils.copyNewObject(input, BaseEnergyStorageDeviceEnt.class); BaseEnergyStorageDeviceEnt entity = XCopyUtils.copyNewObject(input, BaseEnergyStorageDeviceEnt.class);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.insert(entity); mapper.insert(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("更新") /**
* 储能设备模块--修改
* POST /base/base-energy-storage-device/update-base-energy-storage-device
* 接口ID:105602203
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105602203
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("储能设备模块--修改")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult updateBaseEnergyStorageDevice(XContext context, UpdateBaseEnergyStorageDeviceInput input) { public XServiceResult updateBaseEnergyStorageDevice(XContext context, UpdateBaseEnergyStorageDeviceInput input) {
return XTransactionHelper.begin(context, () -> {
BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class); BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class);
if (this.checkMakerNumberExists(mapper, input.getMakerNumber(), input.getId())) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BaseEnergyStorageDeviceEnt entity = this.selectOneByDeviceId(input.getId(), mapper); BaseEnergyStorageDeviceEnt entity = this.selectOneByDeviceId(input.getId(), mapper);
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("删除") /**
* 储能设备模块--删除
* POST /base/base-energy-storage-device/delete-base-energy-storage-device
* 接口ID:105602204
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105602204
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("储能设备模块--删除")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult deleteBaseEnergyStorageDevice(XContext context, DeleteBaseEnergyStorageDeviceInput input) { public XServiceResult deleteBaseEnergyStorageDevice(XContext context, DeleteBaseEnergyStorageDeviceInput input) {
...@@ -82,23 +116,31 @@ public class BaseEnergyStorageDeviceService { ...@@ -82,23 +116,31 @@ public class BaseEnergyStorageDeviceService {
if (this.checkStorageIsReference(context, storageId)) { if (this.checkStorageIsReference(context, storageId)) {
return XServiceResult.error(context, BusinessError.StorageReference); return XServiceResult.error(context, BusinessError.StorageReference);
} }
return XTransactionHelper.begin(context, () -> {
BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class); BaseEnergyStorageDeviceMapper mapper = context.getBean(BaseEnergyStorageDeviceMapper.class);
BaseEnergyStorageDeviceEnt entity = this.selectOneByDeviceId(storageId, mapper); if (Objects.isNull(this.selectOneByDeviceId(storageId, mapper))) {
if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
entity = new BaseEnergyStorageDeviceEnt(); BaseEnergyStorageDeviceEnt entity = new BaseEnergyStorageDeviceEnt();
entity.setId(storageId); entity.setId(storageId);
entity.setIsDeleted(BusinessConstant.ZERO); entity.setIsDeleted(BusinessConstant.ZERO);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("根据id获取详情") /**
* 储能设备模块--详情
* GET /base/base-energy-storage-device/get-base-energy-storage-device
* 接口ID:105602200
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105602200
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetBaseEnergyStorageDeviceOutput}>
*/
@XText("储能设备模块--详情")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XSingleResult<GetBaseEnergyStorageDeviceOutput> getBaseEnergyStorageDevice(XContext context, GetBaseEnergyStorageDeviceInput input) { public XSingleResult<GetBaseEnergyStorageDeviceOutput> getBaseEnergyStorageDevice(XContext context, GetBaseEnergyStorageDeviceInput input) {
...@@ -112,7 +154,7 @@ public class BaseEnergyStorageDeviceService { ...@@ -112,7 +154,7 @@ public class BaseEnergyStorageDeviceService {
} }
/** /**
* 分页查询 * 储能设备模块--分页查询
* GET /base/base-energy-storage-device/query-base-energy-storage-device * GET /base/base-energy-storage-device/query-base-energy-storage-device
* 接口ID:105602201 * 接口ID:105602201
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105602201 * 接口地址:https://app.apifox.com/project/3196988/apis/api-105602201
...@@ -121,7 +163,7 @@ public class BaseEnergyStorageDeviceService { ...@@ -121,7 +163,7 @@ public class BaseEnergyStorageDeviceService {
* @param input 输入 * @param input 输入
* @return {@link XPageResult}<{@link QueryBaseEnergyStorageDeviceOutput}> * @return {@link XPageResult}<{@link QueryBaseEnergyStorageDeviceOutput}>
*/ */
@XText("分页查询") @XText("储能设备模块--分页查询")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XPageResult<QueryBaseEnergyStorageDeviceOutput> queryBaseEnergyStorageDevice(XContext context, QueryBaseEnergyStorageDeviceInput input) { public XPageResult<QueryBaseEnergyStorageDeviceOutput> queryBaseEnergyStorageDevice(XContext context, QueryBaseEnergyStorageDeviceInput input) {
...@@ -132,6 +174,7 @@ public class BaseEnergyStorageDeviceService { ...@@ -132,6 +174,7 @@ public class BaseEnergyStorageDeviceService {
if (StringUtils.isNotEmpty(input.getLineId())) { if (StringUtils.isNotEmpty(input.getLineId())) {
queryWrapper.lambda() queryWrapper.lambda()
.notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_storage w WHERE base_energy_storage_device.id = w.storage_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId()) .notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_storage w WHERE base_energy_storage_device.id = w.storage_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId())
.notExists(StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_storage w WHERE base_energy_storage_device.id = w.storage_id AND w.is_deleted = 1")
.eq(BaseEnergyStorageDeviceEnt::getOuId, input.getOuId()); .eq(BaseEnergyStorageDeviceEnt::getOuId, input.getOuId());
} else { } else {
List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId()); List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId());
...@@ -176,4 +219,21 @@ public class BaseEnergyStorageDeviceService { ...@@ -176,4 +219,21 @@ public class BaseEnergyStorageDeviceService {
.eq(BaseModel::getId, deviceId) .eq(BaseModel::getId, deviceId)
); );
} }
/**
* 检查编号是否存在
*
* @param mapper 映射器
* @param makerNumber 出场编号
* @param id id
* @return boolean
*/
private boolean checkMakerNumberExists(BaseEnergyStorageDeviceMapper mapper, String makerNumber, String id) {
Long count = mapper.selectCount(new LambdaQueryWrapper<BaseEnergyStorageDeviceEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(BaseEnergyStorageDeviceEnt::getMakerNumber, makerNumber)
.ne(StringUtils.isNotEmpty(id), BaseModel::getId, id)
);
return count > 0;
}
} }
\ No newline at end of file
...@@ -68,11 +68,13 @@ public class BasePhotovoltaicPlantService { ...@@ -68,11 +68,13 @@ public class BasePhotovoltaicPlantService {
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult createBasePhotovoltaicPlant(XContext context, CreateBasePhotovoltaicPlantInput input) { public XServiceResult createBasePhotovoltaicPlant(XContext context, CreateBasePhotovoltaicPlantInput input) {
PpsUserSession session = context.getSession(PpsUserSession.class); BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
if (StringUtils.isNotEmpty(input.getMakerNumber()) && this.checkMakerNumberExists(mapper, input.getMakerNumber(), null)) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BasePhotovoltaicPlantEnt entity = XCopyUtils.copyNewObject(input, BasePhotovoltaicPlantEnt.class); BasePhotovoltaicPlantEnt entity = XCopyUtils.copyNewObject(input, BasePhotovoltaicPlantEnt.class);
BaseUtils.setBaseModelDefault(entity, session); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
mapper.insert(entity); mapper.insert(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
...@@ -92,21 +94,33 @@ public class BasePhotovoltaicPlantService { ...@@ -92,21 +94,33 @@ public class BasePhotovoltaicPlantService {
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult updateBasePhotovoltaicPlant(XContext context, UpdateBasePhotovoltaicPlantInput input) { public XServiceResult updateBasePhotovoltaicPlant(XContext context, UpdateBasePhotovoltaicPlantInput input) {
PpsUserSession session = context.getSession(PpsUserSession.class);
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class); BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
if (StringUtils.isNotEmpty(input.getMakerNumber()) && this.checkMakerNumberExists(mapper, input.getMakerNumber(), input.getId())) {
return XServiceResult.error(context, BusinessError.MakerNumberExists);
}
BasePhotovoltaicPlantEnt entity = this.selectOneByPlantId(input.getId(), mapper); BasePhotovoltaicPlantEnt entity = this.selectOneByPlantId(input.getId(), mapper);
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
BaseUtils.setBaseModelDefault(entity, session); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("删除") /**
* 光伏电站模块--删除
* POST /base/base-photovoltaic-plant/delete-base-photovoltaic-plant
* 接口ID:105466280
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105466280
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("光伏电站模块--删除")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult deleteBasePhotovoltaicPlant(XContext context, DeleteBasePhotovoltaicPlantInput input) { public XServiceResult deleteBasePhotovoltaicPlant(XContext context, DeleteBasePhotovoltaicPlantInput input) {
...@@ -114,17 +128,15 @@ public class BasePhotovoltaicPlantService { ...@@ -114,17 +128,15 @@ public class BasePhotovoltaicPlantService {
if (this.checkPhotovoltaicIsReference(context, plantId)) { if (this.checkPhotovoltaicIsReference(context, plantId)) {
return XServiceResult.error(context, BusinessError.PhotovoltaicReference); return XServiceResult.error(context, BusinessError.PhotovoltaicReference);
} }
return XTransactionHelper.begin(context, () -> {
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class); BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
BasePhotovoltaicPlantEnt entity = this.selectOneByPlantId(plantId, mapper); if (Objects.isNull(this.selectOneByPlantId(plantId, mapper))) {
if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
entity = new BasePhotovoltaicPlantEnt(); BasePhotovoltaicPlantEnt entity = new BasePhotovoltaicPlantEnt();
entity.setId(plantId); entity.setId(plantId);
entity.setIsDeleted(BusinessConstant.ZERO); entity.setIsDeleted(BusinessConstant.ZERO);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
...@@ -186,6 +198,7 @@ public class BasePhotovoltaicPlantService { ...@@ -186,6 +198,7 @@ public class BasePhotovoltaicPlantService {
if (StringUtils.isNotEmpty(input.getLineId())) { if (StringUtils.isNotEmpty(input.getLineId())) {
queryWrapper.lambda() queryWrapper.lambda()
.notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_plant w WHERE base_photovoltaic_plant.id = w.plant_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId()) .notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_plant w WHERE base_photovoltaic_plant.id = w.plant_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId())
.notExists(StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_plant w WHERE base_photovoltaic_plant.id = w.plant_id AND w.is_deleted = 1")
.eq(BasePhotovoltaicPlantEnt::getOuId, input.getOuId()); .eq(BasePhotovoltaicPlantEnt::getOuId, input.getOuId());
} else { } else {
List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId()); List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId());
...@@ -283,4 +296,21 @@ public class BasePhotovoltaicPlantService { ...@@ -283,4 +296,21 @@ public class BasePhotovoltaicPlantService {
singleResult.throwIfFail(); singleResult.throwIfFail();
return singleResult.getResult(); return singleResult.getResult();
} }
/**
* 检查编号是否存在
*
* @param mapper 映射器
* @param makerNumber 出场编号
* @param id id
* @return boolean
*/
private boolean checkMakerNumberExists(BasePhotovoltaicPlantMapper mapper, String makerNumber, String id) {
Long count = mapper.selectCount(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(BasePhotovoltaicPlantEnt::getMakerNumber, makerNumber)
.ne(StringUtils.isNotEmpty(id), BaseModel::getId, id)
);
return count > 0;
}
} }
...@@ -44,39 +44,73 @@ import java.util.Objects; ...@@ -44,39 +44,73 @@ import java.util.Objects;
@XService @XService
public class BaseWellheadService { public class BaseWellheadService {
@XText("新增") /**
* 井口配置模块--新增
* POST /base/base-wellhead/create-base-wellhead
* 接口ID:105357657
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105357657
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("井口配置模块--新增")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult createBaseWellhead(XContext context, CreateBaseWellheadInput input) { public XServiceResult createBaseWellhead(XContext context, CreateBaseWellheadInput input) {
return XTransactionHelper.begin(context, () -> {
BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class); BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class);
if (this.checkWellNumberExists(mapper, input.getWellNumber(), null)) {
return XServiceResult.error(context, BusinessError.WellNumberExists);
}
BaseWellheadEnt entity = XCopyUtils.copyNewObject(input, BaseWellheadEnt.class); BaseWellheadEnt entity = XCopyUtils.copyNewObject(input, BaseWellheadEnt.class);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.insert(entity); mapper.insert(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("更新") /**
* 井口配置模块--修改
* POST /base/base-wellhead/update-base-wellhead
* 接口ID:105426967
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105426967
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("井口配置模块--修改")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult updateBaseWellhead(XContext context, UpdateBaseWellheadInput input) { public XServiceResult updateBaseWellhead(XContext context, UpdateBaseWellheadInput input) {
return XTransactionHelper.begin(context, () -> {
BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class); BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class);
if (this.checkWellNumberExists(mapper, input.getWellNumber(), input.getId())) {
return XServiceResult.error(context, BusinessError.WellNumberExists);
}
BaseWellheadEnt entity = this.selectOneByWellheadId(input.getId(), mapper); BaseWellheadEnt entity = this.selectOneByWellheadId(input.getId(), mapper);
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
XCopyUtils.copyObject(input, entity); XCopyUtils.copyObject(input, entity);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("删除") /**
* 井口配置模块--删除
* POST /base/base-wellhead/delete-base-wellhead
* 接口ID:105430749
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105430749
*
* @param context 上下文
* @param input 输入
* @return {@link XServiceResult}
*/
@XText("井口配置模块--删除")
@XApiAnonymous @XApiAnonymous
@XApiPost @XApiPost
public XServiceResult deleteBaseWellhead(XContext context, DeleteBaseWellheadInput input) { public XServiceResult deleteBaseWellhead(XContext context, DeleteBaseWellheadInput input) {
...@@ -87,23 +121,31 @@ public class BaseWellheadService { ...@@ -87,23 +121,31 @@ public class BaseWellheadService {
if (this.checkWellheadIsSpaceReference(context, wellheadId)) { if (this.checkWellheadIsSpaceReference(context, wellheadId)) {
return XServiceResult.error(context, BusinessError.WellheadReferenceSpace); return XServiceResult.error(context, BusinessError.WellheadReferenceSpace);
} }
return XTransactionHelper.begin(context, () -> {
BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class); BaseWellheadMapper mapper = context.getBean(BaseWellheadMapper.class);
BaseWellheadEnt entity = this.selectOneByWellheadId(wellheadId, mapper); if (Objects.isNull(this.selectOneByWellheadId(wellheadId, mapper))) {
if (Objects.isNull(entity)) {
return XServiceResult.error(context, XError.NotFound); return XServiceResult.error(context, XError.NotFound);
} }
entity = new BaseWellheadEnt(); BaseWellheadEnt entity = new BaseWellheadEnt();
entity.setId(wellheadId); entity.setId(wellheadId);
entity.setIsDeleted(BusinessConstant.ZERO); entity.setIsDeleted(BusinessConstant.ZERO);
PpsUserSession session = context.getSession(PpsUserSession.class); BaseUtils.setBaseModelDefault(entity, context.getSession(PpsUserSession.class));
BaseUtils.setBaseModelDefault(entity, session); return XTransactionHelper.begin(context, () -> {
mapper.updateById(entity); mapper.updateById(entity);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
@XText("根据ID获取详情") /**
* 井口配置模块--详情
* GET /base/base-wellhead/get-base-wellhead
* 接口ID:105325952
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105325952
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult}<{@link GetBaseWellheadOutput}>
*/
@XText("井口配置模块--详情")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XSingleResult<GetBaseWellheadOutput> getBaseWellhead(XContext context, GetBaseWellheadInput input) { public XSingleResult<GetBaseWellheadOutput> getBaseWellhead(XContext context, GetBaseWellheadInput input) {
...@@ -117,7 +159,7 @@ public class BaseWellheadService { ...@@ -117,7 +159,7 @@ public class BaseWellheadService {
} }
/** /**
* 分页查询 * 井口配置模块--分页查询
* GET /base/base-wellhead/query-base-wellhead * GET /base/base-wellhead/query-base-wellhead
* 接口ID:105431641 * 接口ID:105431641
* 接口地址:https://app.apifox.com/project/3196988/apis/api-105431641 * 接口地址:https://app.apifox.com/project/3196988/apis/api-105431641
...@@ -126,7 +168,7 @@ public class BaseWellheadService { ...@@ -126,7 +168,7 @@ public class BaseWellheadService {
* @param input 输入 * @param input 输入
* @return {@link XPageResult}<{@link QueryBaseWellheadOutput}> * @return {@link XPageResult}<{@link QueryBaseWellheadOutput}>
*/ */
@XText("分页查询") @XText("井口配置模块--分页查询")
@XApiAnonymous @XApiAnonymous
@XApiGet @XApiGet
public XPageResult<QueryBaseWellheadOutput> queryBaseWellhead(XContext context, QueryBaseWellheadInput input) { public XPageResult<QueryBaseWellheadOutput> queryBaseWellhead(XContext context, QueryBaseWellheadInput input) {
...@@ -135,6 +177,7 @@ public class BaseWellheadService { ...@@ -135,6 +177,7 @@ public class BaseWellheadService {
if (StringUtils.isNotEmpty(input.getLineId())) { if (StringUtils.isNotEmpty(input.getLineId())) {
queryWrapper.lambda() queryWrapper.lambda()
.notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_wellhead w WHERE base_wellhead.id = w.wellhead_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId()) .notExists(!StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_wellhead w WHERE base_wellhead.id = w.wellhead_id AND w.is_deleted = 1 AND w.line_id <> {0}", input.getLineId())
.notExists(StringUtils.equals(BusinessConstant.LINE_FLAG_ID, input.getLineId()), "SELECT 1 FROM base_power_line_wellhead w WHERE base_wellhead.id = w.wellhead_id AND w.is_deleted = 1")
.eq(BaseWellheadEnt::getOuId, input.getOuId()); .eq(BaseWellheadEnt::getOuId, input.getOuId());
} else { } else {
List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId()); List<String> allListByOuId = ServiceUtil.getOrgIdsByPath(context, input.getOuId());
...@@ -191,4 +234,21 @@ public class BaseWellheadService { ...@@ -191,4 +234,21 @@ public class BaseWellheadService {
.eq(BaseModel::getId, wellheadId) .eq(BaseModel::getId, wellheadId)
); );
} }
/**
* 检查井编号存在
*
* @param mapper 映射器
* @param wellNumber 井号
* @param id id
* @return boolean
*/
private boolean checkWellNumberExists(BaseWellheadMapper mapper, String wellNumber, String id) {
Long count = mapper.selectCount(new LambdaQueryWrapper<BaseWellheadEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(BaseWellheadEnt::getWellNumber, wellNumber)
.ne(StringUtils.isNotEmpty(id), BaseModel::getId, id)
);
return count > 0;
}
} }
package pps.core.base.service.data.base_diesel_generator; package pps.core.base.service.data.base_diesel_generator;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 柴发设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class CreateBaseDieselGeneratorInput { public class CreateBaseDieselGeneratorInput {
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name") @XText("组织机构name")
private String ouName; private String ouName;
@XText("设备名称") @XText("设备名称")
@NotBlank(message = "缺少设备名称")
private String deviceName; private String deviceName;
@XText("出厂编号") @XText("出厂编号")
@NotBlank(message = "缺少出厂编号")
private String makerNumber; private String makerNumber;
@XText("柴发设备机组型号key(字典获取)") @XText("柴发设备机组型号key(字典获取)")
...@@ -26,9 +38,10 @@ public class CreateBaseDieselGeneratorInput { ...@@ -26,9 +38,10 @@ public class CreateBaseDieselGeneratorInput {
private String unitTypeName; private String unitTypeName;
@XText("常用功率(KW)") @XText("常用功率(KW)")
@NotNull(message = "缺少常用功率")
private BigDecimal normalPower; private BigDecimal normalPower;
@XText("备用功率(KW)") @XText("备用功率(KW)")
@NotNull(message = "缺少备用功率")
private BigDecimal standbyPower; private BigDecimal standbyPower;
} }
...@@ -2,9 +2,16 @@ package pps.core.base.service.data.base_diesel_generator; ...@@ -2,9 +2,16 @@ package pps.core.base.service.data.base_diesel_generator;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 柴发设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class DeleteBaseDieselGeneratorInput { public class DeleteBaseDieselGeneratorInput {
@XText("ID") @XText("ID")
private String id; private String id;
} }
...@@ -2,9 +2,16 @@ package pps.core.base.service.data.base_diesel_generator; ...@@ -2,9 +2,16 @@ package pps.core.base.service.data.base_diesel_generator;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 柴发设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class GetBaseDieselGeneratorInput { public class GetBaseDieselGeneratorInput {
@XText("ID") @XText("ID")
private String id; private String id;
} }
package pps.core.base.service.data.base_diesel_generator; package pps.core.base.service.data.base_diesel_generator;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 柴发设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class UpdateBaseDieselGeneratorInput { public class UpdateBaseDieselGeneratorInput {
@XText("ID") @XText("ID")
@NotBlank(message = "缺少设备ID")
private String id; private String id;
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name") @XText("组织机构name")
private String ouName; private String ouName;
@XText("设备名称") @XText("设备名称")
@NotBlank(message = "缺少设备名称")
private String deviceName; private String deviceName;
@XText("出厂编号") @XText("出厂编号")
@NotBlank(message = "缺少出厂编号")
private String makerNumber; private String makerNumber;
@XText("柴发设备机组型号key(字典获取)") @XText("柴发设备机组型号key(字典获取)")
...@@ -28,9 +42,10 @@ public class UpdateBaseDieselGeneratorInput { ...@@ -28,9 +42,10 @@ public class UpdateBaseDieselGeneratorInput {
private String unitTypeName; private String unitTypeName;
@XText("常用功率(KW)") @XText("常用功率(KW)")
@NotNull(message = "缺少常用功率")
private BigDecimal normalPower; private BigDecimal normalPower;
@XText("备用功率(KW)") @XText("备用功率(KW)")
@NotNull(message = "缺少备用功率")
private BigDecimal standbyPower; private BigDecimal standbyPower;
} }
package pps.core.base.service.data.base_energy_storage_device; package pps.core.base.service.data.base_energy_storage_device;
import com.baomidou.mybatisplus.annotation.TableField; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 储能设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class CreateBaseEnergyStorageDeviceInput { public class CreateBaseEnergyStorageDeviceInput {
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name") @XText("组织机构name")
private String ouName; private String ouName;
@XText("设备名称") @XText("设备名称")
@NotBlank(message = "缺少设备名称")
private String deviceName; private String deviceName;
@XText("出厂编号") @XText("出厂编号")
@NotBlank(message = "缺少出厂编号")
private String makerNumber; private String makerNumber;
@XText("储能设备规格型号key(字典获取)") @XText("储能设备规格型号key(字典获取)")
...@@ -27,20 +38,22 @@ public class CreateBaseEnergyStorageDeviceInput { ...@@ -27,20 +38,22 @@ public class CreateBaseEnergyStorageDeviceInput {
private String storageModelName; private String storageModelName;
@XText("设备容量(KWh)") @XText("设备容量(KWh)")
@NotNull(message = "缺少设备容量")
private BigDecimal apparatusCapacity; private BigDecimal apparatusCapacity;
@XText("额定放电功率(KW)") @XText("额定放电功率(KW)")
@NotNull(message = "缺少额定放电功率")
private BigDecimal ratedDischargePower; private BigDecimal ratedDischargePower;
@XText("额定充电功率(KW)") @XText("额定充电功率(KW)")
@NotNull(message = "缺少额定充电功率")
private BigDecimal ratedChargingPower; private BigDecimal ratedChargingPower;
@XText("额定放电深度") @XText("额定放电深度")
@TableField @NotNull(message = "缺少额定放电深度")
private BigDecimal ratedDischargeDepth; private BigDecimal ratedDischargeDepth;
@XText("额定放电效率") @XText("额定放电效率")
@TableField @NotNull(message = "缺少额定放电效率")
private BigDecimal ratedDischargeEfficiency; private BigDecimal ratedDischargeEfficiency;
} }
...@@ -2,8 +2,16 @@ package pps.core.base.service.data.base_energy_storage_device; ...@@ -2,8 +2,16 @@ package pps.core.base.service.data.base_energy_storage_device;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 储能设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class DeleteBaseEnergyStorageDeviceInput { public class DeleteBaseEnergyStorageDeviceInput {
@XText("ID") @XText("ID")
private String id; private String id;
} }
...@@ -2,8 +2,16 @@ package pps.core.base.service.data.base_energy_storage_device; ...@@ -2,8 +2,16 @@ package pps.core.base.service.data.base_energy_storage_device;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 储能设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class GetBaseEnergyStorageDeviceInput { public class GetBaseEnergyStorageDeviceInput {
@XText("ID") @XText("ID")
private String id; private String id;
} }
package pps.core.base.service.data.base_energy_storage_device; package pps.core.base.service.data.base_energy_storage_device;
import com.baomidou.mybatisplus.annotation.TableField; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 储能设备
*
* @author ZWT
* @date 2023/10/20
*/
@Data @Data
public class UpdateBaseEnergyStorageDeviceInput { public class UpdateBaseEnergyStorageDeviceInput {
@XText("ID") @XText("ID")
@NotBlank(message = "缺少设备ID")
private String id; private String id;
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name") @XText("组织机构name")
private String ouName; private String ouName;
@XText("设备名称") @XText("设备名称")
@NotBlank(message = "缺少设备名称")
private String deviceName; private String deviceName;
@XText("出厂编号") @XText("出厂编号")
@NotBlank(message = "缺少出厂编号")
private String makerNumber; private String makerNumber;
@XText("储能设备规格型号key(字典获取)") @XText("储能设备规格型号key(字典获取)")
...@@ -29,20 +42,22 @@ public class UpdateBaseEnergyStorageDeviceInput { ...@@ -29,20 +42,22 @@ public class UpdateBaseEnergyStorageDeviceInput {
private String storageModelName; private String storageModelName;
@XText("设备容量(KWh)") @XText("设备容量(KWh)")
@NotNull(message = "缺少设备容量")
private BigDecimal apparatusCapacity; private BigDecimal apparatusCapacity;
@XText("额定放电功率(KW)") @XText("额定放电功率(KW)")
@NotNull(message = "缺少额定放电功率")
private BigDecimal ratedDischargePower; private BigDecimal ratedDischargePower;
@XText("额定充电功率(KW)") @XText("额定充电功率(KW)")
@NotNull(message = "缺少额定充电功率")
private BigDecimal ratedChargingPower; private BigDecimal ratedChargingPower;
@XText("额定放电深度") @XText("额定放电深度")
@TableField @NotNull(message = "缺少额定放电深度")
private BigDecimal ratedDischargeDepth; private BigDecimal ratedDischargeDepth;
@XText("额定放电效率") @XText("额定放电效率")
@TableField @NotNull(message = "缺少额定放电效率")
private BigDecimal ratedDischargeEfficiency; private BigDecimal ratedDischargeEfficiency;
} }
package pps.core.base.service.data.base_photovoltaic_plant; package pps.core.base.service.data.base_photovoltaic_plant;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
...@@ -15,9 +17,14 @@ import java.math.BigDecimal; ...@@ -15,9 +17,14 @@ import java.math.BigDecimal;
public class CreateBasePhotovoltaicPlantInput { public class CreateBasePhotovoltaicPlantInput {
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name")
private String ouName;
@XText("电站名称") @XText("电站名称")
@NotBlank(message = "缺少电站名称")
private String stationName; private String stationName;
@XText("出厂编号") @XText("出厂编号")
...@@ -26,30 +33,34 @@ public class CreateBasePhotovoltaicPlantInput { ...@@ -26,30 +33,34 @@ public class CreateBasePhotovoltaicPlantInput {
@XText("光伏设备规格型号key(字典获取)") @XText("光伏设备规格型号key(字典获取)")
private String photovoltaicModelKey; private String photovoltaicModelKey;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("安装倾角") @XText("安装倾角")
@NotNull(message = "缺少安装倾角")
private BigDecimal mountingAngle; private BigDecimal mountingAngle;
@XText("装机总量(KWP)") @XText("装机总量(KWP)")
@NotNull(message = "缺少装机总量")
private BigDecimal totalPower; private BigDecimal totalPower;
@XText("阵列朝向") @XText("阵列朝向")
@NotNull(message = "缺少阵列朝向")
private BigDecimal arrayOrientation; private BigDecimal arrayOrientation;
@XText("组织机构name")
private String ouName;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("经度(°)") @XText("经度(°)")
@NotNull(message = "缺少经度")
private BigDecimal longitude; private BigDecimal longitude;
@XText("纬度(°)") @XText("纬度(°)")
@NotNull(message = "缺少纬度")
private BigDecimal latitude; private BigDecimal latitude;
@XText("高程(m)") @XText("高程(m)")
@NotNull(message = "缺少高程")
private BigDecimal elevation; private BigDecimal elevation;
@XText("地区编码") @XText("地区编码")
@NotNull(message = "缺少地区编码")
private Integer areaCode; private Integer areaCode;
} }
package pps.core.base.service.data.base_photovoltaic_plant; package pps.core.base.service.data.base_photovoltaic_plant;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
...@@ -15,12 +17,18 @@ import java.math.BigDecimal; ...@@ -15,12 +17,18 @@ import java.math.BigDecimal;
public class UpdateBasePhotovoltaicPlantInput { public class UpdateBasePhotovoltaicPlantInput {
@XText("ID") @XText("ID")
@NotBlank(message = "缺少电站ID")
private String id; private String id;
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name")
private String ouName;
@XText("电站名称") @XText("电站名称")
@NotBlank(message = "缺少电站名称")
private String stationName; private String stationName;
@XText("出厂编号") @XText("出厂编号")
...@@ -29,30 +37,34 @@ public class UpdateBasePhotovoltaicPlantInput { ...@@ -29,30 +37,34 @@ public class UpdateBasePhotovoltaicPlantInput {
@XText("光伏设备规格型号key(字典获取)") @XText("光伏设备规格型号key(字典获取)")
private String photovoltaicModelKey; private String photovoltaicModelKey;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("安装倾角") @XText("安装倾角")
@NotNull(message = "缺少安装倾角")
private BigDecimal mountingAngle; private BigDecimal mountingAngle;
@XText("装机总量(KWP)") @XText("装机总量(KWP)")
@NotNull(message = "缺少装机总量")
private BigDecimal totalPower; private BigDecimal totalPower;
@XText("阵列朝向") @XText("阵列朝向")
@NotNull(message = "缺少阵列朝向")
private BigDecimal arrayOrientation; private BigDecimal arrayOrientation;
@XText("组织机构name")
private String ouName;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("经度(°)") @XText("经度(°)")
@NotNull(message = "缺少经度")
private BigDecimal longitude; private BigDecimal longitude;
@XText("纬度(°)") @XText("纬度(°)")
@NotNull(message = "缺少纬度")
private BigDecimal latitude; private BigDecimal latitude;
@XText("高程(m)") @XText("高程(m)")
@NotNull(message = "缺少高程")
private BigDecimal elevation; private BigDecimal elevation;
@XText("地区编码") @XText("地区编码")
@NotNull(message = "缺少地区编码")
private Integer areaCode; private Integer areaCode;
} }
\ No newline at end of file
package pps.core.base.service.data.base_wellhead; package pps.core.base.service.data.base_wellhead;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 井口配置
*
* @author ZWT
* @date 2023/10/20
*/
@Data
public class CreateBaseWellheadInput { public class CreateBaseWellheadInput {
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name") @XText("组织机构name")
private String ouName; private String ouName;
@XText("井号") @XText("井号")
@NotBlank(message = "缺少井号")
private String wellNumber; private String wellNumber;
@XText("运行类型key(字典获取)") @XText("运行类型key(字典获取)")
@NotBlank(message = "缺少运行类型")
private String runTypeKey; private String runTypeKey;
@XText("运行类型name(字典获取)") @XText("运行类型name(字典获取)")
private String runTypeName; private String runTypeName;
@XText("运行功率(KW)") @XText("运行功率(KW)")
@NotNull(message = "缺少运行功率")
private BigDecimal serviceRating; private BigDecimal serviceRating;
public String getOuId() {
return this.ouId;
}
public void setOuId(String value) {
this.ouId = value;
}
public String getWellNumber() {
return this.wellNumber;
}
public void setWellNumber(String value) {
this.wellNumber = value;
}
public String getRunTypeKey() {
return this.runTypeKey;
}
public void setRunTypeKey(String value) {
this.runTypeKey = value;
}
public BigDecimal getServiceRating() {
return this.serviceRating;
}
public void setServiceRating(BigDecimal value) {
this.serviceRating = value;
}
public String getOuName() {
return ouName;
}
public void setOuName(String ouName) {
this.ouName = ouName;
}
public String getRunTypeName() {
return runTypeName;
}
public void setRunTypeName(String runTypeName) {
this.runTypeName = runTypeName;
}
} }
package pps.core.base.service.data.base_wellhead; package pps.core.base.service.data.base_wellhead;
import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 井口配置
*
* @author ZWT
* @date 2023/10/20
*/
@Data
public class DeleteBaseWellheadInput { public class DeleteBaseWellheadInput {
@XText("ID") @XText("ID")
private String id; private String id;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
} }
package pps.core.base.service.data.base_wellhead; package pps.core.base.service.data.base_wellhead;
import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
/**
* 井口配置
*
* @author ZWT
* @date 2023/10/20
*/
@Data
public class GetBaseWellheadInput { public class GetBaseWellheadInput {
@XText("ID") @XText("ID")
private String id; private String id;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
} }
...@@ -8,7 +8,7 @@ import xstartup.base.data.XPageInput; ...@@ -8,7 +8,7 @@ import xstartup.base.data.XPageInput;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 井口 * 井口配置
* *
* @author ZWT * @author ZWT
* @date 2023/09/25 * @date 2023/09/25
......
package pps.core.base.service.data.base_wellhead; package pps.core.base.service.data.base_wellhead;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* 井口配置
*
* @author ZWT
* @date 2023/10/20
*/
@Data
public class UpdateBaseWellheadInput { public class UpdateBaseWellheadInput {
@XText("ID") @XText("ID")
@NotBlank(message = "缺少井口ID")
private String id; private String id;
@XText("组织机构ID") @XText("组织机构ID")
@NotBlank(message = "缺少组织机构ID")
private String ouId; private String ouId;
@XText("组织机构name")
private String ouName;
@XText("井号") @XText("井号")
@NotBlank(message = "缺少井号")
private String wellNumber; private String wellNumber;
@XText("运行类型key(字典获取)") @XText("运行类型key(字典获取)")
@NotBlank(message = "缺少运行类型")
private String runTypeKey; private String runTypeKey;
@XText("运行类型name(字典获取)")
private String runTypeName;
@XText("运行功率(KW)") @XText("运行功率(KW)")
@NotNull(message = "缺少运行功率")
private BigDecimal serviceRating; private BigDecimal serviceRating;
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public String getOuId() {
return this.ouId;
}
public void setOuId(String value) {
this.ouId = value;
}
public String getWellNumber() {
return this.wellNumber;
}
public void setWellNumber(String value) {
this.wellNumber = value;
}
public String getRunTypeKey() {
return this.runTypeKey;
}
public void setRunTypeKey(String value) {
this.runTypeKey = value;
}
public BigDecimal getServiceRating() {
return this.serviceRating;
}
public void setServiceRating(BigDecimal value) {
this.serviceRating = value;
}
} }
...@@ -332,8 +332,11 @@ public class SpaceCalibrationService { ...@@ -332,8 +332,11 @@ public class SpaceCalibrationService {
private SpaceCalibrationPeriodEnt getPeriodEntByParam(SpaceCalibrationPeriodMapper mapper, String lineId, String ouId) { private SpaceCalibrationPeriodEnt getPeriodEntByParam(SpaceCalibrationPeriodMapper mapper, String lineId, String ouId) {
return mapper.selectOne( return mapper.selectOne(
new LambdaQueryWrapper<SpaceCalibrationPeriodEnt>() new LambdaQueryWrapper<SpaceCalibrationPeriodEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(SpaceCalibrationPeriodEnt::getLineId, lineId) .eq(SpaceCalibrationPeriodEnt::getLineId, lineId)
.eq(SpaceCalibrationPeriodEnt::getOuId, ouId) .eq(SpaceCalibrationPeriodEnt::getOuId, ouId)
.orderByDesc(BaseModel::getModifyTime)
.last("LIMIT 1")
); );
} }
......
...@@ -102,7 +102,7 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -102,7 +102,7 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
} }
Integer isCurrentBasic = entity.getIsCurrentBasic(); Integer isCurrentBasic = entity.getIsCurrentBasic();
if (isCurrentBasic.equals(0)) { if (isCurrentBasic.equals(0)) {
return XServiceResult.error(992, "基础制度无法修改"); return XServiceResult.error(context, BusinessError.CannotBeDeleted);
} }
PpsUserSession session = context.getSession(PpsUserSession.class); PpsUserSession session = context.getSession(PpsUserSession.class);
this.updateInstitutionDetail(context, session, mapper, institutionId, input, entity); this.updateInstitutionDetail(context, session, mapper, institutionId, input, entity);
...@@ -290,11 +290,9 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -290,11 +290,9 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
@XApiPost @XApiPost
@XText("基础间开配置--设为基础制度") @XText("基础间开配置--设为基础制度")
public XServiceResult updateBasicInstitution(XContext context, UpdateSpaceInstitutionDetailInput input) { public XServiceResult updateBasicInstitution(XContext context, UpdateSpaceInstitutionDetailInput input) {
PpsUserSession session = context.getSession(PpsUserSession.class);
String ouId = input.getOuId(); String ouId = input.getOuId();
String lineId = input.getLineId(); String lineId = input.getLineId();
String institutionId = input.getId(); String institutionId = input.getId();
return XTransactionHelper.begin(context, () -> {
SpaceInstitutionDetailMapper mapper = context.getBean(SpaceInstitutionDetailMapper.class); SpaceInstitutionDetailMapper mapper = context.getBean(SpaceInstitutionDetailMapper.class);
SpaceInstitutionDetailEnt detail = this.getInstitutionDetail(mapper, institutionId); SpaceInstitutionDetailEnt detail = this.getInstitutionDetail(mapper, institutionId);
if (Objects.isNull(detail)) { if (Objects.isNull(detail)) {
...@@ -304,6 +302,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -304,6 +302,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
if (isCurrentBasic.equals(BusinessConstant.ZERO)) { if (isCurrentBasic.equals(BusinessConstant.ZERO)) {
return XServiceResult.error(context, BusinessError.RepeatSetting); return XServiceResult.error(context, BusinessError.RepeatSetting);
} }
PpsUserSession session = context.getSession(PpsUserSession.class);
return XTransactionHelper.begin(context, () -> {
//关闭当前基础制度 //关闭当前基础制度
mapper.update(null, new LambdaUpdateWrapper<SpaceInstitutionDetailEnt>() mapper.update(null, new LambdaUpdateWrapper<SpaceInstitutionDetailEnt>()
.eq(SpaceInstitutionDetailEnt::getOuId, ouId) .eq(SpaceInstitutionDetailEnt::getOuId, ouId)
...@@ -324,6 +324,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -324,6 +324,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
); );
//长期/中短期制度优化初始化 //长期/中短期制度优化初始化
this.institutionOptimizeInitialize(context, detail); this.institutionOptimizeInitialize(context, detail);
//校准周期初始化
this.calibrationHistoryInitialize(context, detail, session);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
...@@ -343,7 +345,6 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -343,7 +345,6 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
if (StringUtils.isEmpty(historyId)) { if (StringUtils.isEmpty(historyId)) {
return XServiceResult.error(context, BusinessError.LackOfHistoryRecord); return XServiceResult.error(context, BusinessError.LackOfHistoryRecord);
} }
PpsUserSession session = context.getSession(PpsUserSession.class);
String institutionId = input.getId(); String institutionId = input.getId();
SpaceInstitutionDetailMapper mapper = context.getBean(SpaceInstitutionDetailMapper.class); SpaceInstitutionDetailMapper mapper = context.getBean(SpaceInstitutionDetailMapper.class);
SpaceInstitutionDetailEnt detail = this.getInstitutionDetail(mapper, institutionId); SpaceInstitutionDetailEnt detail = this.getInstitutionDetail(mapper, institutionId);
...@@ -358,10 +359,13 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -358,10 +359,13 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
if (DateUtil.date().compareTo(calibrationDate) > 0) { if (DateUtil.date().compareTo(calibrationDate) > 0) {
return XServiceResult.error(context, BusinessError.Expired); return XServiceResult.error(context, BusinessError.Expired);
} }
PpsUserSession session = context.getSession(PpsUserSession.class);
return XTransactionHelper.begin(context, () -> { return XTransactionHelper.begin(context, () -> {
this.updateInstitutionDetail(context, session, mapper, institutionId, input, detail); this.updateInstitutionDetail(context, session, mapper, institutionId, input, detail);
//制度优化 //制度优化
this.institutionOptimizeInitialize(context, detail); this.institutionOptimizeInitialize(context, detail);
//校准周期初始化
this.calibrationHistoryInitialize(context, detail, session);
return XServiceResult.OK; return XServiceResult.OK;
}); });
} }
...@@ -583,6 +587,67 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -583,6 +587,67 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
} }
} }
/**
* 校准周期初始化
*
* @param context 上下文
* @param detail 细节
*/
private void calibrationHistoryInitialize(XContext context, SpaceInstitutionDetailEnt detail, PpsUserSession session) {
//查最近的校准历史
SpaceCalibrationHistoryMapper mapper = context.getBean(SpaceCalibrationHistoryMapper.class);
SpaceCalibrationHistoryEnt historyEnt = mapper.selectOne(new LambdaQueryWrapper<SpaceCalibrationHistoryEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(SpaceCalibrationHistoryEnt::getInstitutionId, detail.getId())
.orderByDesc(SpaceCalibrationHistoryEnt::getCalibrationDate)
.last("LIMIT 1")
);
DateTime now = DateUtil.beginOfDay(DateUtil.date());
boolean isCreate = false;
if (Objects.nonNull(historyEnt)) {
//判断当前时间是否大于等于校准日期
Date calibrationDate = historyEnt.getCalibrationDate();
if (DateUtil.compare(now, calibrationDate) >= 0) {
isCreate = true;
}
} else {
isCreate = true;
}
//新增
if (isCreate) {
//查周期配置
SpaceCalibrationPeriodMapper periodMapper = context.getBean(SpaceCalibrationPeriodMapper.class);
SpaceCalibrationPeriodEnt periodEnt = periodMapper.selectOne(new LambdaQueryWrapper<SpaceCalibrationPeriodEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(SpaceCalibrationPeriodEnt::getLineId, detail.getLineId())
.eq(SpaceCalibrationPeriodEnt::getOuId, detail.getOuId())
.orderByDesc(BaseModel::getModifyTime)
.last("LIMIT 1")
);
if (Objects.nonNull(periodEnt)) {
mapper.insert(this.createCalibrationHistory(session, detail, now, Integer.valueOf(periodEnt.getDayNumber())));
}
}
}
/**
* 创建校准历史记录
*
* @param detail 细节
* @param date 日期
* @param dayNumber 天数
* @return {@link SpaceCalibrationHistoryEnt}
*/
private SpaceCalibrationHistoryEnt createCalibrationHistory(PpsUserSession session, SpaceInstitutionDetailEnt detail, Date date, Integer dayNumber) {
SpaceCalibrationHistoryEnt historyEnt = new SpaceCalibrationHistoryEnt();
BaseUtils.setBaseModelDefault(historyEnt, session);
historyEnt.setLineId(detail.getLineId());
historyEnt.setInstitutionId(detail.getId());
historyEnt.setExecutionCycle(BaseUtils.getExecutionCycleForCalibration(date, dayNumber));
historyEnt.setCalibrationDate(DateUtil.beginOfDay(DateUtil.offsetDay(date, dayNumber + 1)));
return historyEnt;
}
/** /**
* 条件查询输电线路井口列表 * 条件查询输电线路井口列表
* *
...@@ -658,8 +723,6 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -658,8 +723,6 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
*/ */
private void updateInstitutionDetail(XContext context, PpsUserSession session, SpaceInstitutionDetailMapper mapper, String institutionId, private void updateInstitutionDetail(XContext context, PpsUserSession session, SpaceInstitutionDetailMapper mapper, String institutionId,
UpdateSpaceInstitutionDetailInput input, SpaceInstitutionDetailEnt entity) { UpdateSpaceInstitutionDetailInput input, SpaceInstitutionDetailEnt entity) {
List<UpdateSpaceInstitutionWellheadInput> wellheadList = input.getWellheadList();
if (CollUtil.isNotEmpty(wellheadList)) {
//删除之前关联的信息 //删除之前关联的信息
SpaceInstitutionWellheadMapper wellheadMapper = context.getBean(SpaceInstitutionWellheadMapper.class); SpaceInstitutionWellheadMapper wellheadMapper = context.getBean(SpaceInstitutionWellheadMapper.class);
wellheadMapper.delete(new LambdaQueryWrapper<SpaceInstitutionWellheadEnt>() wellheadMapper.delete(new LambdaQueryWrapper<SpaceInstitutionWellheadEnt>()
...@@ -669,6 +732,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService { ...@@ -669,6 +732,8 @@ public class SpaceInstitutionDetailService extends SpaceOptimizeBaseService {
durationMapper.delete(new LambdaQueryWrapper<SpaceInstitutionDurationEnt>() durationMapper.delete(new LambdaQueryWrapper<SpaceInstitutionDurationEnt>()
.eq(SpaceInstitutionDurationEnt::getInstitutionId, institutionId) .eq(SpaceInstitutionDurationEnt::getInstitutionId, institutionId)
); );
List<UpdateSpaceInstitutionWellheadInput> wellheadList = input.getWellheadList();
if (CollUtil.isNotEmpty(wellheadList)) {
//重新添加关联信息 //重新添加关联信息
this.saveInstitutionWellhead(context, session, institutionId, wellheadList); this.saveInstitutionWellhead(context, session, institutionId, wellheadList);
} }
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
FROM space_institution_detail d FROM space_institution_detail d
JOIN space_calibration_history h ON d.id = h.institution_id JOIN space_calibration_history h ON d.id = h.institution_id
WHERE h.is_deleted = 1 WHERE h.is_deleted = 1
AND d.is_deleted = 1
AND d.is_current_basic = 0
AND h.line_id = #{lineId} AND h.line_id = #{lineId}
ORDER BY h.calibration_date DESC ORDER BY h.calibration_date DESC
</select> </select>
......
...@@ -44,6 +44,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -44,6 +44,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
String endTime = input.getEndTime(); String endTime = input.getEndTime();
Integer dateType = input.getDateType(); Integer dateType = input.getDateType();
List list = null; List list = null;
if (CollUtil.isNotEmpty(plantIds)) {
switch (dateType) { switch (dateType) {
case 0: case 0:
PlantPredictedPowerLongTermDataMapper longTermDataMapper = context.getBean(PlantPredictedPowerLongTermDataMapper.class); PlantPredictedPowerLongTermDataMapper longTermDataMapper = context.getBean(PlantPredictedPowerLongTermDataMapper.class);
...@@ -57,7 +58,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -57,7 +58,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
"STR_TO_DATE( CONCAT( hour_time, ':', min_time ), '%H:%i:%s' ) AS create_time") "STR_TO_DATE( CONCAT( hour_time, ':', min_time ), '%H:%i:%s' ) AS create_time")
.lambda() .lambda()
.eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerLongTermDataEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerLongTermDataEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerLongTermDataEnt::getPlantId, plantIds) .in(PlantPredictedPowerLongTermDataEnt::getPlantId, plantIds)
.eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerLongTermDataEnt::getYearTime, yearTime) .eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerLongTermDataEnt::getYearTime, yearTime)
.eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerLongTermDataEnt::getMonthTime, monthTime) .eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerLongTermDataEnt::getMonthTime, monthTime)
.between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerLongTermDataEnt::getDataDate, startTime, endTime) .between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerLongTermDataEnt::getDataDate, startTime, endTime)
...@@ -65,7 +66,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -65,7 +66,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
PlantPredictedPowerLongTermDataEnt::getMonthTime, PlantPredictedPowerLongTermDataEnt::getMonthTime,
PlantPredictedPowerLongTermDataEnt::getHourTime, PlantPredictedPowerLongTermDataEnt::getHourTime,
PlantPredictedPowerLongTermDataEnt::getMinTime) PlantPredictedPowerLongTermDataEnt::getMinTime)
.orderByAsc(PlantPredictedPowerLongTermDataEnt::getHourTime) .orderByAsc(PlantPredictedPowerLongTermDataEnt::getHourTime, PlantPredictedPowerLongTermDataEnt::getMinTime)
); );
break; break;
case 1: case 1:
...@@ -80,7 +81,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -80,7 +81,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
"STR_TO_DATE( CONCAT( hour_time, ':', min_time ), '%H:%i:%s' ) AS create_time") "STR_TO_DATE( CONCAT( hour_time, ':', min_time ), '%H:%i:%s' ) AS create_time")
.lambda() .lambda()
.eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerDataEnt::getPlantId, plantIds) .in(PlantPredictedPowerDataEnt::getPlantId, plantIds)
.eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerDataEnt::getYearTime, yearTime) .eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerDataEnt::getYearTime, yearTime)
.eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime) .eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime)
.between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerDataEnt::getDataDate, startTime, endTime) .between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerDataEnt::getDataDate, startTime, endTime)
...@@ -88,11 +89,12 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -88,11 +89,12 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
PlantPredictedPowerDataEnt::getMonthTime, PlantPredictedPowerDataEnt::getMonthTime,
PlantPredictedPowerDataEnt::getHourTime, PlantPredictedPowerDataEnt::getHourTime,
PlantPredictedPowerDataEnt::getMinTime) PlantPredictedPowerDataEnt::getMinTime)
.orderByAsc(PlantPredictedPowerDataEnt::getHourTime) .orderByAsc(PlantPredictedPowerDataEnt::getHourTime, PlantPredictedPowerDataEnt::getMinTime)
); );
break; break;
default: default:
} }
}
List<DynamicQueryPlantPredictedPowerOutput> outputs; List<DynamicQueryPlantPredictedPowerOutput> outputs;
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
outputs = new ArrayList<>(0); outputs = new ArrayList<>(0);
...@@ -119,6 +121,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -119,6 +121,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
String endTime = input.getEndTime(); String endTime = input.getEndTime();
Integer dateType = input.getDateType(); Integer dateType = input.getDateType();
List list = null; List list = null;
if (CollUtil.isNotEmpty(plantIds)) {
switch (dateType) { switch (dateType) {
case 0: case 0:
PlantPredictedPowerLongTermDataMapper longTermDataMapper = context.getBean(PlantPredictedPowerLongTermDataMapper.class); PlantPredictedPowerLongTermDataMapper longTermDataMapper = context.getBean(PlantPredictedPowerLongTermDataMapper.class);
...@@ -128,7 +131,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -128,7 +131,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
"IFNULL( AVG( power ), 0 ) AS power") "IFNULL( AVG( power ), 0 ) AS power")
.lambda() .lambda()
.eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerLongTermDataEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerLongTermDataEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerLongTermDataEnt::getPlantId, plantIds) .in(PlantPredictedPowerLongTermDataEnt::getPlantId, plantIds)
.eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerLongTermDataEnt::getYearTime, yearTime) .eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerLongTermDataEnt::getYearTime, yearTime)
.eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerLongTermDataEnt::getMonthTime, monthTime) .eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerLongTermDataEnt::getMonthTime, monthTime)
.between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerLongTermDataEnt::getDataDate, startTime, endTime) .between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerLongTermDataEnt::getDataDate, startTime, endTime)
...@@ -144,7 +147,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -144,7 +147,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
"IFNULL( AVG( power ), 0 ) AS power") "IFNULL( AVG( power ), 0 ) AS power")
.lambda() .lambda()
.eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerDataEnt::getPlantId, plantIds) .in(PlantPredictedPowerDataEnt::getPlantId, plantIds)
.eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerDataEnt::getYearTime, yearTime) .eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerDataEnt::getYearTime, yearTime)
.eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime) .eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime)
.between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerDataEnt::getDataDate, startTime, endTime) .between(!StringUtils.isAnyBlank(startTime, endTime), PlantPredictedPowerDataEnt::getDataDate, startTime, endTime)
...@@ -154,6 +157,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -154,6 +157,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
break; break;
default: default:
} }
}
List<DynamicQueryPlantPredictedPowerOutput> outputs; List<DynamicQueryPlantPredictedPowerOutput> outputs;
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
outputs = new ArrayList<>(0); outputs = new ArrayList<>(0);
......
...@@ -59,6 +59,7 @@ public class StoragePredictedPowerCloudServiceImpl implements IStoragePredictedP ...@@ -59,6 +59,7 @@ public class StoragePredictedPowerCloudServiceImpl implements IStoragePredictedP
StoragePredictedPowerDataEnt::getMonthTime, StoragePredictedPowerDataEnt::getMonthTime,
StoragePredictedPowerDataEnt::getHourTime, StoragePredictedPowerDataEnt::getHourTime,
StoragePredictedPowerDataEnt::getMinTime) StoragePredictedPowerDataEnt::getMinTime)
.orderByAsc(StoragePredictedPowerDataEnt::getHourTime, StoragePredictedPowerDataEnt::getMinTime)
); );
List<DynamicQueryStoragePredictedPowerOutput> outputs; List<DynamicQueryStoragePredictedPowerOutput> outputs;
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
......
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