|
|
@@ -3,10 +3,12 @@ package com.usky.vpp.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.usky.vpp.domain.VppCustomer;
|
|
|
import com.usky.vpp.domain.VppDrEvent;
|
|
|
+import com.usky.vpp.domain.VppDrInvitation;
|
|
|
import com.usky.vpp.domain.VppDrParticipation;
|
|
|
import com.usky.vpp.domain.VppResourcePoint;
|
|
|
import com.usky.vpp.domain.VppSite;
|
|
|
import com.usky.vpp.mapper.VppCustomerMapper;
|
|
|
+import com.usky.vpp.mapper.VppDrInvitationMapper;
|
|
|
import com.usky.vpp.mapper.VppDrParticipationMapper;
|
|
|
import com.usky.vpp.mapper.VppResourcePointMapper;
|
|
|
import com.usky.vpp.mapper.VppSiteMapper;
|
|
|
@@ -37,6 +39,8 @@ public class VppUnDrSyncServiceImpl implements VppUnDrSyncService {
|
|
|
private VppResourcePointMapper resourcePointMapper;
|
|
|
@Autowired
|
|
|
private VppDrParticipationMapper participationMapper;
|
|
|
+ @Autowired
|
|
|
+ private VppDrInvitationMapper invitationMapper;
|
|
|
|
|
|
@Override
|
|
|
public void syncOptContent(VppDrEvent event, List<Map<String, Object>> optList, boolean clearing) {
|
|
|
@@ -44,30 +48,34 @@ public class VppUnDrSyncServiceImpl implements VppUnDrSyncService {
|
|
|
return;
|
|
|
}
|
|
|
for (Map<String, Object> item : optList) {
|
|
|
- syncOne(event, item, clearing);
|
|
|
+ syncOne(event, item, clearing, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncTargetResources(VppDrEvent event, List<Map<String, Object>> resources, boolean clearing) {
|
|
|
+ public void syncTargetResources(VppDrEvent event, List<Map<String, Object>> resources, boolean clearing,
|
|
|
+ Integer responseStatus) {
|
|
|
if (event == null || resources == null || resources.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
for (Map<String, Object> resource : resources) {
|
|
|
- syncOne(event, resource, clearing);
|
|
|
+ syncOne(event, resource, clearing, responseStatus);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void syncOne(VppDrEvent event, Map<String, Object> item, boolean clearing) {
|
|
|
+ private void syncOne(VppDrEvent event, Map<String, Object> item, boolean clearing, Integer responseStatus) {
|
|
|
String account = VppUnPayloadHelper.getString(item, "account");
|
|
|
if (!StringUtils.hasText(account)) {
|
|
|
return;
|
|
|
}
|
|
|
BigDecimal load = resolveLoadKw(item);
|
|
|
- if (load == null) {
|
|
|
- return;
|
|
|
+ if (load != null) {
|
|
|
+ syncParticipation(event, account, load, clearing);
|
|
|
}
|
|
|
+ updateInvitationResponseStatus(event, account, responseStatus);
|
|
|
+ }
|
|
|
|
|
|
+ private void syncParticipation(VppDrEvent event, String account, BigDecimal load, boolean clearing) {
|
|
|
VppCustomer customer = customerMapper.selectOne(new LambdaQueryWrapper<VppCustomer>()
|
|
|
.eq(VppCustomer::getAccountNo, account)
|
|
|
.eq(VppCustomer::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
@@ -122,6 +130,33 @@ public class VppUnDrSyncServiceImpl implements VppUnDrSyncService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void updateInvitationResponseStatus(VppDrEvent event, String account, Integer responseStatus) {
|
|
|
+ if (event == null || event.getId() == null || responseStatus == null || !StringUtils.hasText(account)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ VppSite site = siteMapper.selectOne(new LambdaQueryWrapper<VppSite>()
|
|
|
+ .eq(VppSite::getAccountNo, account.trim())
|
|
|
+ .eq(VppSite::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ if (site == null || site.getId() == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ VppDrInvitation invitation = invitationMapper.selectOne(new LambdaQueryWrapper<VppDrInvitation>()
|
|
|
+ .eq(VppDrInvitation::getDrEventId, event.getId())
|
|
|
+ .eq(VppDrInvitation::getSiteId, site.getId())
|
|
|
+ .eq(VppDrInvitation::getDeleteFlag, VppAuditHelper.NOT_DELETED)
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ if (invitation == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ invitation.setResponseStatus(responseStatus);
|
|
|
+ if(responseStatus == 2){
|
|
|
+ invitation.setIsWinningBid(1);
|
|
|
+ }
|
|
|
+ VppAuditHelper.fillUpdate(invitation);
|
|
|
+ invitationMapper.updateById(invitation);
|
|
|
+ }
|
|
|
+
|
|
|
private BigDecimal resolveLoadKw(Map<String, Object> item) {
|
|
|
BigDecimal load = VppUnPayloadHelper.getDecimal(item, "load");
|
|
|
if (load != null) {
|