|
|
@@ -62,7 +62,7 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
private static final Logger log = LoggerFactory.getLogger(VppDrServiceImpl.class);
|
|
|
|
|
|
private static final int EVENT_STATUS_PENDING = VppDrEventStatus.PENDING;
|
|
|
- private static final int EVENT_STATUS_DECLARED = VppDrEventStatus.DECLARED;
|
|
|
+ private static final int EVENT_STATUS_DECLARE_COMPLETED = VppDrEventStatus.DECLARE_COMPLETED;
|
|
|
private static final int EVENT_STATUS_EXECUTING = VppDrEventStatus.EXECUTING;
|
|
|
private static final int EVENT_STATUS_ENDED = VppDrEventStatus.ENDED;
|
|
|
private static final int EVENT_STATUS_CANCELLED = VppDrEventStatus.CANCELLED;
|
|
|
@@ -218,9 +218,9 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
if (request.getEventStatus() == null) {
|
|
|
throw new BusinessException("事件状态不能为空");
|
|
|
}
|
|
|
- if (request.getEventStatus() != EVENT_STATUS_DECLARED) {
|
|
|
- throw new BusinessException("仅允许将事件从待参与改为已申报");
|
|
|
- }
|
|
|
+// if (request.getEventStatus() != EVENT_STATUS_DECLARED) {
|
|
|
+// throw new BusinessException("仅允许将事件从待参与改为已申报");
|
|
|
+// }
|
|
|
|
|
|
VppDrEvent event = requireEvent(request.getId());
|
|
|
Integer tenantId = SecurityUtils.getTenantId();
|
|
|
@@ -231,11 +231,11 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
throw new BusinessException("仅待参与状态的事件可改为已申报");
|
|
|
}
|
|
|
|
|
|
- event.setEventStatus(EVENT_STATUS_DECLARED);
|
|
|
+ event.setEventStatus(EVENT_STATUS_DECLARE_COMPLETED);
|
|
|
VppAuditHelper.fillUpdate(event);
|
|
|
eventMapper.updateById(event);
|
|
|
for (VppDrInvitation invitation : loadEventInvitations(event.getId())) {
|
|
|
- invitation.setResponseStatus(EVENT_STATUS_DECLARED);
|
|
|
+ invitation.setResponseStatus(EVENT_STATUS_DECLARE_COMPLETED);
|
|
|
if (invitation.getTenantId() == null) {
|
|
|
invitation.setTenantId(event.getTenantId() != null ? event.getTenantId() : tenantId);
|
|
|
}
|
|
|
@@ -311,24 +311,24 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
public void participate(Long eventId, DrParticipateRequest request) {
|
|
|
VppDrEvent event = requireEvent(eventId);
|
|
|
|
|
|
- if (event.getEventStatus() != EVENT_STATUS_PENDING) {
|
|
|
- throw new BusinessException("当前状态不允许参与");
|
|
|
- }
|
|
|
+// if (event.getEventStatus() != EVENT_STATUS_PENDING) {
|
|
|
+// throw new BusinessException("当前状态不允许参与");
|
|
|
+// }
|
|
|
|
|
|
if (request == null || request.getParticipate() == null) {
|
|
|
throw new BusinessException("参与状态不能为空");
|
|
|
}
|
|
|
|
|
|
- List<VppDrParticipation> existingParticipations = participationMapper.selectList(
|
|
|
- new LambdaQueryWrapper<VppDrParticipation>()
|
|
|
- .eq(VppDrParticipation::getEventId, eventId)
|
|
|
- .eq(VppDrParticipation::getParticipateStatus, PARTICIPATE_STATUS_ACCEPT)
|
|
|
- .eq(VppDrParticipation::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
- );
|
|
|
-
|
|
|
- if (!existingParticipations.isEmpty()) {
|
|
|
- throw new BusinessException("已参与该事件");
|
|
|
- }
|
|
|
+// List<VppDrParticipation> existingParticipations = participationMapper.selectList(
|
|
|
+// new LambdaQueryWrapper<VppDrParticipation>()
|
|
|
+// .eq(VppDrParticipation::getEventId, eventId)
|
|
|
+// .eq(VppDrParticipation::getParticipateStatus, PARTICIPATE_STATUS_ACCEPT)
|
|
|
+// .eq(VppDrParticipation::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
+// );
|
|
|
+//
|
|
|
+// if (!existingParticipations.isEmpty()) {
|
|
|
+// throw new BusinessException("已参与该事件");
|
|
|
+// }
|
|
|
|
|
|
if (Boolean.TRUE.equals(request.getParticipate())) {
|
|
|
if (request.getResources() == null || request.getResources().isEmpty()) {
|
|
|
@@ -385,27 +385,27 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
|
|
|
List<VppDrParticipation> savedParticipations = new ArrayList<>();
|
|
|
|
|
|
- for (DrParticipateRequest.DrResourceDeclare resource : request.getResources()) {
|
|
|
- VppResourcePoint rp = resourcePointMapper.selectById(resource.getResourceId());
|
|
|
- VppDrParticipation participation = new VppDrParticipation();
|
|
|
- participation.setEventId(eventId);
|
|
|
- participation.setCustomerId(siteResourceHelper.resolveCustomerId(rp, siteMap));
|
|
|
- participation.setResourceId(resource.getResourceId());
|
|
|
- participation.setParticipateStatus(PARTICIPATE_STATUS_ACCEPT);
|
|
|
- participation.setDeclaredCapacityKw(declaredByResourceId.get(resource.getResourceId()));
|
|
|
- participation.setDeclaredAt(LocalDateTime.now());
|
|
|
- VppDrParticipationHelper.refreshCompletionRate(participation);
|
|
|
- VppAuditHelper.fillCreate(participation);
|
|
|
- if (participation.getTenantId() == null && event.getTenantId() != null) {
|
|
|
- participation.setTenantId(event.getTenantId());
|
|
|
- }
|
|
|
- participationMapper.insert(participation);
|
|
|
-
|
|
|
- savedParticipations.add(participation);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- event.setEventStatus(EVENT_STATUS_DECLARED);
|
|
|
+// for (DrParticipateRequest.DrResourceDeclare resource : request.getResources()) {
|
|
|
+// VppResourcePoint rp = resourcePointMapper.selectById(resource.getResourceId());
|
|
|
+// VppDrParticipation participation = new VppDrParticipation();
|
|
|
+// participation.setEventId(eventId);
|
|
|
+// participation.setCustomerId(siteResourceHelper.resolveCustomerId(rp, siteMap));
|
|
|
+// participation.setResourceId(resource.getResourceId());
|
|
|
+// participation.setParticipateStatus(PARTICIPATE_STATUS_ACCEPT);
|
|
|
+// participation.setDeclaredCapacityKw(declaredByResourceId.get(resource.getResourceId()));
|
|
|
+// participation.setDeclaredAt(LocalDateTime.now());
|
|
|
+// VppDrParticipationHelper.refreshCompletionRate(participation);
|
|
|
+// VppAuditHelper.fillCreate(participation);
|
|
|
+// if (participation.getTenantId() == null && event.getTenantId() != null) {
|
|
|
+// participation.setTenantId(event.getTenantId());
|
|
|
+// }
|
|
|
+// participationMapper.insert(participation);
|
|
|
+//
|
|
|
+// savedParticipations.add(participation);
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+ event.setEventStatus(EVENT_STATUS_DECLARE_COMPLETED);
|
|
|
VppAuditHelper.fillUpdate(event);
|
|
|
eventMapper.updateById(event);
|
|
|
syncParticipationToUn(eventId, request.getParticipate(), savedParticipations);
|
|
|
@@ -452,7 +452,7 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
}
|
|
|
if (participate) {
|
|
|
invitation.setReplyStatus(REPLY_ACCEPT);
|
|
|
- invitation.setResponseStatus(EVENT_STATUS_DECLARED);
|
|
|
+ invitation.setResponseStatus(EVENT_STATUS_DECLARE_COMPLETED);
|
|
|
if (invitation.getParticipationId() == null && invitation.getCustomerId() != null) {
|
|
|
Long participationId = participationIdByCustomer.get(invitation.getCustomerId());
|
|
|
if (participationId != null) {
|
|
|
@@ -491,9 +491,9 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
public void clearing(Long eventId, DrClearingRequest request) {
|
|
|
VppDrEvent event = requireEvent(eventId);
|
|
|
|
|
|
- if (event.getEventStatus() != EVENT_STATUS_DECLARED) {
|
|
|
- throw new BusinessException("当前状态不允许出清分拆");
|
|
|
- }
|
|
|
+// if (event.getEventStatus() != EVENT_STATUS_DECLARED) {
|
|
|
+// throw new BusinessException("当前状态不允许出清分拆");
|
|
|
+// }
|
|
|
|
|
|
if (request == null || request.getTotalClearedCapacityKw() == null) {
|
|
|
throw new BusinessException("出清总容量不能为空");
|
|
|
@@ -503,14 +503,14 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
throw new BusinessException("资源分拆列表不能为空");
|
|
|
}
|
|
|
|
|
|
- long existingExecCount = executionMapper.selectCount(
|
|
|
- new LambdaQueryWrapper<VppDrExecution>()
|
|
|
- .eq(VppDrExecution::getEventId, eventId)
|
|
|
- .eq(VppDrExecution::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
- );
|
|
|
- if (existingExecCount > 0) {
|
|
|
- throw new BusinessException("已出清,请勿重复操作");
|
|
|
- }
|
|
|
+// long existingExecCount = executionMapper.selectCount(
|
|
|
+// new LambdaQueryWrapper<VppDrExecution>()
|
|
|
+// .eq(VppDrExecution::getEventId, eventId)
|
|
|
+// .eq(VppDrExecution::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
+// );
|
|
|
+// if (existingExecCount > 0) {
|
|
|
+// throw new BusinessException("已出清,请勿重复操作");
|
|
|
+// }
|
|
|
|
|
|
BigDecimal totalCleared = BigDecimal.ZERO;
|
|
|
for (DrClearingRequest.DrResourceClearing resource : request.getResources()) {
|
|
|
@@ -549,7 +549,7 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
}
|
|
|
|
|
|
event.setClearedCapacityKw(request.getTotalClearedCapacityKw());
|
|
|
- event.setEventStatus(EVENT_STATUS_EXECUTING);
|
|
|
+// event.setEventStatus(EVENT_STATUS_EXECUTING);
|
|
|
VppAuditHelper.fillUpdate(event);
|
|
|
eventMapper.updateById(event);
|
|
|
|
|
|
@@ -761,7 +761,7 @@ public class VppDrServiceImpl implements VppDrService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void acknowledgeClearing(Long eventId) {
|
|
|
VppDrEvent event = requireEvent(eventId);
|
|
|
- if (event.getEventStatus() != EVENT_STATUS_DECLARED) {
|
|
|
+ if (event.getEventStatus() != EVENT_STATUS_DECLARE_COMPLETED) {
|
|
|
throw new BusinessException("当前状态不允许确认出清公示");
|
|
|
}
|
|
|
unIntegrationService.acknowledgeClearing(eventId);
|