TASK: 用户试用添加,印花逻辑调整;
This commit is contained in:
@@ -94,4 +94,6 @@ public interface AccountService extends IService<Account> {
|
||||
String getUserLanguage();
|
||||
|
||||
String changeUserLanguage(String language);
|
||||
|
||||
Boolean trialUserLogout();
|
||||
}
|
||||
|
||||
@@ -81,4 +81,6 @@ public interface LibraryService extends IService<Library> {
|
||||
Boolean checkMd5(String level1Type, String level2Type, String sex, String md5);
|
||||
|
||||
void batchDeleteLibrary(LibraryDeleteDTO deleteDTO);
|
||||
|
||||
void deleteTrialData(Long id);
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ public interface UserLikeGroupService extends IService<UserLikeGroup> {
|
||||
*/
|
||||
UserLikeChooseVO choose(Long userGroupId);
|
||||
|
||||
void deleteTrialData(Long id);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.security.jwt.JWTTokenHelper;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.AccountMapper;
|
||||
import com.ai.da.mapper.LibraryMapper;
|
||||
import com.ai.da.mapper.UserLikeGroupMapper;
|
||||
import com.ai.da.mapper.entity.Account;
|
||||
import com.ai.da.mapper.entity.AccountLoginLog;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -18,6 +20,8 @@ import com.ai.da.model.vo.AccountPreLoginVO;
|
||||
import com.ai.da.model.vo.AuthPrincipalVo;
|
||||
import com.ai.da.service.AccountLoginLogService;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.LibraryService;
|
||||
import com.ai.da.service.UserLikeGroupService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -50,7 +54,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
private JWTTokenHelper jwtTokenHelper;
|
||||
|
||||
@Resource
|
||||
AccountLoginLogService accountLoginLogService;
|
||||
private AccountLoginLogService accountLoginLogService;
|
||||
|
||||
@Resource
|
||||
private LibraryService libraryService;
|
||||
|
||||
@Resource
|
||||
private UserLikeGroupService userLikeGroupService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -355,6 +365,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setValidStartTime(Long.valueOf(accountAddDTO.getValidStartTime()));
|
||||
account.setValidEndTime(Long.valueOf(accountAddDTO.getValidEndTime()));
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsTrial(accountAddDTO.getIsTrial());
|
||||
return accountMapper.insert(account) > 0;
|
||||
}
|
||||
|
||||
@@ -419,4 +430,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
String accountToken = createAccountToken(account);
|
||||
return accountToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean trialUserLogout() {
|
||||
AuthPrincipalVo userInfo = UserContext.getUserHolder();
|
||||
Account account = accountMapper.selectById(userInfo.getId());
|
||||
if (account.getIsTrial() != 1) {
|
||||
throw new BusinessException("用户为正式用户");
|
||||
}
|
||||
libraryService.deleteTrialData(userInfo.getId());
|
||||
userLikeGroupService.deleteTrialData(userInfo.getId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class ClassificationServiceImpl implements ClassificationService {
|
||||
qw.lambda().eq(Classification::getClassificationName, classificationDTO.getClassificationName());
|
||||
List<Classification> classificationList = classificationMapper.selectList(qw);
|
||||
if (CollectionUtil.isNotEmpty(classificationList)) {
|
||||
throw new BusinessException("classificationName.already.exists", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("classificationName.already.exists", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,18 +138,29 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
// 新增分类过滤
|
||||
if (CollectionUtil.isNotEmpty(query.getClassificationIdList())) {
|
||||
List<Long> libraryIdList = new ArrayList<>();
|
||||
for (int i = 0; i < query.getClassificationIdList().size(); i++) {
|
||||
List<Long> libraryIdListByClassificationId = classificationService.getLibraryIdListByClassificationId(query.getClassificationIdList().get(i));
|
||||
if (i == 0) {
|
||||
libraryIdList.addAll(libraryIdListByClassificationId);
|
||||
}else {
|
||||
libraryIdList.retainAll(libraryIdListByClassificationId);
|
||||
if (query.getIntersection() == 1) {
|
||||
for (Long classificationId : query.getClassificationIdList()) {
|
||||
libraryIdList.addAll(classificationService.getLibraryIdListByClassificationId(classificationId));
|
||||
}
|
||||
if (CollectionUtil.isEmpty(libraryIdList)) {
|
||||
if (CollectionUtil.isNotEmpty(libraryIdList)) {
|
||||
queryWrapper.lambda().in(Library::getId, libraryIdList);
|
||||
}else {
|
||||
return PageBaseResponse.success(new Page<>());
|
||||
}
|
||||
}else {
|
||||
for (int i = 0; i < query.getClassificationIdList().size(); i++) {
|
||||
List<Long> libraryIdListByClassificationId = classificationService.getLibraryIdListByClassificationId(query.getClassificationIdList().get(i));
|
||||
if (i == 0) {
|
||||
libraryIdList.addAll(libraryIdListByClassificationId);
|
||||
}else {
|
||||
libraryIdList.retainAll(libraryIdListByClassificationId);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(libraryIdList)) {
|
||||
return PageBaseResponse.success(new Page<>());
|
||||
}
|
||||
}
|
||||
queryWrapper.lambda().in(Library::getId, libraryIdList);
|
||||
}
|
||||
queryWrapper.lambda().in(Library::getId, libraryIdList);
|
||||
}
|
||||
queryWrapper.orderByDesc("id");
|
||||
IPage<Library> page = getBaseMapper().selectPage(
|
||||
@@ -358,6 +369,13 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTrialData(Long userId) {
|
||||
QueryWrapper<Library> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(Library::getAccountId, userId);
|
||||
libraryMapper.delete(qw);
|
||||
}
|
||||
|
||||
private void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm) {
|
||||
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
|
||||
QueryWrapper<Workspace> qw = new QueryWrapper<>();
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.TDesignPythonOutfitMapper;
|
||||
import com.ai.da.mapper.UserLikeGroupMapper;
|
||||
import com.ai.da.mapper.UserLikeMapper;
|
||||
import com.ai.da.mapper.entity.TDesignPythonOutfit;
|
||||
import com.ai.da.mapper.entity.UserLike;
|
||||
import com.ai.da.mapper.entity.UserLikeGroup;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.AccountService;
|
||||
@@ -23,6 +25,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.TimeZone;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -42,6 +45,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
@Resource
|
||||
private UserLikeService userLikeService;
|
||||
|
||||
@Resource
|
||||
private UserLikeMapper userLikeMapper;
|
||||
|
||||
@Resource
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@@ -129,4 +135,17 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
UserLikeCollectionVO userLikeCollection = collectionService.chooseCollection(group.getCollectionId());
|
||||
return new UserLikeChooseVO(userGroupId, userLikeVOS, userLikeCollection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTrialData(Long userId) {
|
||||
QueryWrapper<UserLikeGroup> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(UserLikeGroup::getAccountId, userId);
|
||||
List<Long> userLikeGroupIdList = userLikeGroupMapper.selectList(qw).stream()
|
||||
.map(UserLikeGroup::getId)
|
||||
.collect(Collectors.toList());
|
||||
userLikeGroupMapper.delete(qw);
|
||||
QueryWrapper<UserLike> userLikeQueryWrapper = new QueryWrapper<>();
|
||||
userLikeQueryWrapper.lambda().in(UserLike::getUserLikeGroupId, userLikeGroupIdList);
|
||||
userLikeMapper.delete(userLikeQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
qw.lambda().eq(Workspace::getUserName, userName);
|
||||
List<Workspace> workspaces = baseMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("the.workspaceName.already.exists", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("the.workspaceName.already.exists", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
qw.lambda().eq(Workspace::getIsLastIndex, 1);
|
||||
List<Workspace> workspaces = workspaceMapper.selectList(qw);
|
||||
if (!CollectionUtils.isEmpty(workspaces)) {
|
||||
throw new BusinessException("unable.to.delete.the.workspace.you.are.currently.using", ResultEnum.WARNING.getCode());
|
||||
throw new BusinessException("unable.to.delete.the.workspace.you.are.currently.using", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
workspaceMapper.deleteBatchIds(deleteIds);
|
||||
return deleteIds;
|
||||
|
||||
Reference in New Issue
Block a user