Compare commits
No commits in common. '718755f8a040123b64dc0c676c1c5ca185aaca33' and '4c1dc15d664e8a94f49cc7fae41fc186f22bc1b8' have entirely different histories.
718755f8a0
...
4c1dc15d66
@ -1,24 +0,0 @@
|
|||||||
package com.yau.digitalrmb.walletopening.application;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
@ApiModel(description = "开通数字货币钱包实验重新实训结果")
|
|
||||||
public class WalletOpeningTrainingResetResult {
|
|
||||||
@ApiModelProperty(value = "是否重置成功", example = "true")
|
|
||||||
private final boolean reset;
|
|
||||||
@ApiModelProperty(value = "逻辑删除的记录总数", example = "12")
|
|
||||||
private final int deletedRecordCount;
|
|
||||||
@ApiModelProperty(value = "处理说明")
|
|
||||||
private final String message;
|
|
||||||
|
|
||||||
public WalletOpeningTrainingResetResult(int deletedRecordCount) {
|
|
||||||
this.reset = true;
|
|
||||||
this.deletedRecordCount = deletedRecordCount;
|
|
||||||
this.message = "钱包开通实验步骤数据已逻辑删除,可从步骤一重新开始";
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReset() { return reset; }
|
|
||||||
public int getDeletedRecordCount() { return deletedRecordCount; }
|
|
||||||
public String getMessage() { return message; }
|
|
||||||
}
|
|
||||||
@ -1,126 +0,0 @@
|
|||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.yau.digitalrmb.walletopening.interfaces.rest;
|
|
||||||
|
|
||||||
import com.yau.digitalrmb.institutionidentity.application.InstitutionKeySubject;
|
|
||||||
import com.yau.digitalrmb.security.context.AuthContextHolder;
|
|
||||||
import com.yau.digitalrmb.security.context.JwtUser;
|
|
||||||
import com.yau.digitalrmb.shared.api.ApiResponse;
|
|
||||||
import com.yau.digitalrmb.shared.web.TraceIdFilter;
|
|
||||||
import com.yau.digitalrmb.walletopening.application.WalletOpeningTrainingResetResult;
|
|
||||||
import com.yau.digitalrmb.walletopening.application.WalletOpeningTrainingResetService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.slf4j.MDC;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/v1/wallet-opening/training")
|
|
||||||
@Tag(name = "开通数字货币钱包-实验管理", description = "钱包开通实验重新实训")
|
|
||||||
public class WalletOpeningTrainingResetController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private WalletOpeningTrainingResetService resetService;
|
|
||||||
|
|
||||||
@PostMapping("/reset")
|
|
||||||
@Operation(summary = "重新开始钱包开通实验",
|
|
||||||
description = "逻辑删除当前用户在钱包开通模块的全部步骤数据(申请记录、钱包标识、智能合约、注册登记、验证记录、央行注册与激活、成绩明细),可从步骤一重新开始。")
|
|
||||||
public ApiResponse<WalletOpeningTrainingResetResult> reset() {
|
|
||||||
JwtUser jwtUser = AuthContextHolder.get();
|
|
||||||
return ApiResponse.success(resetService.reset(InstitutionKeySubject.from(jwtUser)), traceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String traceId() {
|
|
||||||
return MDC.get(TraceIdFilter.MDC_KEY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue