|
@ -15,12 +15,15 @@ public class CrowdfundingServiceImpl implements CrowdfundingService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CrowdfundingMapper crowdfundingMapper; |
|
|
private CrowdfundingMapper crowdfundingMapper; |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public CrowdfundingInfo loadPage() { |
|
|
public CrowdfundingInfo loadPage() { |
|
|
CrowdfundingInfo crowdfundingInfoList = crowdfundingMapper.loadPage(); |
|
|
|
|
|
//如果当前进度大于等于目标人数,将status变更为0 |
|
|
|
|
|
if (crowdfundingInfoList != null && crowdfundingInfoList.getNowNumber() >= crowdfundingInfoList.getTargetNumber()) { |
|
|
|
|
|
|
|
|
CrowdfundingInfo crowdfundingInfoList1 = crowdfundingMapper.loadPage(); |
|
|
|
|
|
if (crowdfundingInfoList1 != null && crowdfundingInfoList1.getNowNumber() >= crowdfundingInfoList1.getTargetNumber()) { |
|
|
|
|
|
crowdfundingMapper.updateStatus(1); |
|
|
|
|
|
}else { |
|
|
crowdfundingMapper.updateStatus(0); |
|
|
crowdfundingMapper.updateStatus(0); |
|
|
} |
|
|
} |
|
|
|
|
|
CrowdfundingInfo crowdfundingInfoList = crowdfundingMapper.loadPage(); |
|
|
List<Participant> participants = crowdfundingMapper.queryCrowdUser(null); |
|
|
List<Participant> participants = crowdfundingMapper.queryCrowdUser(null); |
|
|
if (crowdfundingInfoList != null) { |
|
|
if (crowdfundingInfoList != null) { |
|
|
crowdfundingInfoList.setParticipantList(participants); |
|
|
crowdfundingInfoList.setParticipantList(participants); |
|
@ -79,6 +82,7 @@ public class CrowdfundingServiceImpl implements CrowdfundingService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void deleteCrowdUser(String jwcode) throws MyException { |
|
|
public void deleteCrowdUser(String jwcode) throws MyException { |
|
|
if (CollectionUtils.isEmpty(crowdfundingMapper.queryCrowdUser(new Participant(null,jwcode,null,null)))) { |
|
|
if (CollectionUtils.isEmpty(crowdfundingMapper.queryCrowdUser(new Participant(null,jwcode,null,null)))) { |
|
|
throw new MyException("删除失败,用户不存在"); |
|
|
throw new MyException("删除失败,用户不存在"); |
|
@ -86,6 +90,7 @@ public class CrowdfundingServiceImpl implements CrowdfundingService { |
|
|
List<Participant> participants = crowdfundingMapper.queryCrowdUser(new Participant(null, jwcode, null, null)); |
|
|
List<Participant> participants = crowdfundingMapper.queryCrowdUser(new Participant(null, jwcode, null, null)); |
|
|
Participant participant = participants.get(0); |
|
|
Participant participant = participants.get(0); |
|
|
crowdfundingMapper.saveDeleteCrowdUser(participant); |
|
|
crowdfundingMapper.saveDeleteCrowdUser(participant); |
|
|
|
|
|
crowdfundingMapper.updateMinusNowNumber(); |
|
|
crowdfundingMapper.deleteCrowdUser(jwcode); |
|
|
crowdfundingMapper.deleteCrowdUser(jwcode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|