|
|
|
|
@ -0,0 +1,126 @@
|
|
|
|
|
package com.yau.digitalrmb.walletopening.application;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.yau.digitalrmb.institutionidentity.application.InstitutionKeySubject;
|
|
|
|
|
import com.yau.digitalrmb.institutionidentity.infrastructure.StuModuleScoreDetailsEntity;
|
|
|
|
|
import com.yau.digitalrmb.institutionidentity.infrastructure.StuModuleScoreDetailsMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.BankReceivedApplicationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.BankReceivedApplicationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.CentralWalletActivationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.CentralWalletActivationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.CentralWalletRegistrationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.CentralWalletRegistrationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.SmartContractGenerationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.SmartContractGenerationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletApplicationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletApplicationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletIdentifierGenerationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletIdentifierGenerationMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletRegistrationRequestEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletRegistrationRequestMapper;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletVerificationEntity;
|
|
|
|
|
import com.yau.digitalrmb.walletopening.infrastructure.WalletVerificationMapper;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class WalletOpeningTrainingResetService {
|
|
|
|
|
|
|
|
|
|
@Resource private WalletApplicationMapper walletApplicationMapper;
|
|
|
|
|
@Resource private BankReceivedApplicationMapper bankReceivedApplicationMapper;
|
|
|
|
|
@Resource private WalletIdentifierGenerationMapper walletIdentifierGenerationMapper;
|
|
|
|
|
@Resource private SmartContractGenerationMapper smartContractGenerationMapper;
|
|
|
|
|
@Resource private WalletRegistrationRequestMapper walletRegistrationRequestMapper;
|
|
|
|
|
@Resource private WalletVerificationMapper walletVerificationMapper;
|
|
|
|
|
@Resource private CentralWalletRegistrationMapper centralWalletRegistrationMapper;
|
|
|
|
|
@Resource private CentralWalletActivationMapper centralWalletActivationMapper;
|
|
|
|
|
@Resource private StuModuleScoreDetailsMapper scoreDetailsMapper;
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public WalletOpeningTrainingResetResult reset(InstitutionKeySubject subject) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
count += logicalDeleteWalletApplications(subject);
|
|
|
|
|
count += logicalDeleteBankReceivedApplications(subject);
|
|
|
|
|
count += logicalDeleteWalletIdentifierGenerations(subject);
|
|
|
|
|
count += logicalDeleteSmartContracts(subject);
|
|
|
|
|
count += logicalDeleteWalletRegistrationRequests(subject);
|
|
|
|
|
count += logicalDeleteWalletVerifications(subject);
|
|
|
|
|
count += logicalDeleteCentralWalletRegistrations(subject);
|
|
|
|
|
count += logicalDeleteCentralWalletActivations(subject);
|
|
|
|
|
count += logicalDeleteScore(subject.getUserId());
|
|
|
|
|
return new WalletOpeningTrainingResetResult(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteWalletApplications(InstitutionKeySubject s) {
|
|
|
|
|
return walletApplicationMapper.update(null, new LambdaUpdateWrapper<WalletApplicationEntity>()
|
|
|
|
|
.eq(WalletApplicationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(WalletApplicationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(WalletApplicationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(WalletApplicationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteBankReceivedApplications(InstitutionKeySubject s) {
|
|
|
|
|
return bankReceivedApplicationMapper.update(null, new LambdaUpdateWrapper<BankReceivedApplicationEntity>()
|
|
|
|
|
.eq(BankReceivedApplicationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(BankReceivedApplicationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(BankReceivedApplicationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(BankReceivedApplicationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteWalletIdentifierGenerations(InstitutionKeySubject s) {
|
|
|
|
|
return walletIdentifierGenerationMapper.update(null, new LambdaUpdateWrapper<WalletIdentifierGenerationEntity>()
|
|
|
|
|
.eq(WalletIdentifierGenerationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(WalletIdentifierGenerationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(WalletIdentifierGenerationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(WalletIdentifierGenerationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteSmartContracts(InstitutionKeySubject s) {
|
|
|
|
|
return smartContractGenerationMapper.update(null, new LambdaUpdateWrapper<SmartContractGenerationEntity>()
|
|
|
|
|
.eq(SmartContractGenerationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(SmartContractGenerationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(SmartContractGenerationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(SmartContractGenerationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteWalletRegistrationRequests(InstitutionKeySubject s) {
|
|
|
|
|
return walletRegistrationRequestMapper.update(null, new LambdaUpdateWrapper<WalletRegistrationRequestEntity>()
|
|
|
|
|
.eq(WalletRegistrationRequestEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(WalletRegistrationRequestEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(WalletRegistrationRequestEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(WalletRegistrationRequestEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteWalletVerifications(InstitutionKeySubject s) {
|
|
|
|
|
return walletVerificationMapper.update(null, new LambdaUpdateWrapper<WalletVerificationEntity>()
|
|
|
|
|
.eq(WalletVerificationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(WalletVerificationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(WalletVerificationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(WalletVerificationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteCentralWalletRegistrations(InstitutionKeySubject s) {
|
|
|
|
|
return centralWalletRegistrationMapper.update(null, new LambdaUpdateWrapper<CentralWalletRegistrationEntity>()
|
|
|
|
|
.eq(CentralWalletRegistrationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(CentralWalletRegistrationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(CentralWalletRegistrationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(CentralWalletRegistrationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteCentralWalletActivations(InstitutionKeySubject s) {
|
|
|
|
|
return centralWalletActivationMapper.update(null, new LambdaUpdateWrapper<CentralWalletActivationEntity>()
|
|
|
|
|
.eq(CentralWalletActivationEntity::getUserId, s.getUserId())
|
|
|
|
|
.eq(CentralWalletActivationEntity::getSchoolId, s.getSchoolId())
|
|
|
|
|
.eq(CentralWalletActivationEntity::getClassId, s.getClassId())
|
|
|
|
|
.set(CentralWalletActivationEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int logicalDeleteScore(String userId) {
|
|
|
|
|
return scoreDetailsMapper.update(null, new LambdaUpdateWrapper<StuModuleScoreDetailsEntity>()
|
|
|
|
|
.eq(StuModuleScoreDetailsEntity::getUserId, userId)
|
|
|
|
|
.eq(StuModuleScoreDetailsEntity::getMoudule, WalletOpeningScoreService.MODULE_NAME)
|
|
|
|
|
.set(StuModuleScoreDetailsEntity::getDeleted, true));
|
|
|
|
|
}
|
|
|
|
|
}
|