Merge branch 'dev/dev' into dev/dev_xp

This commit is contained in:
2024-05-10 17:12:52 +08:00
9 changed files with 233 additions and 61 deletions

View File

@@ -2,12 +2,25 @@ package com.ai.da.common.config;
import com.ai.da.common.utils.SendEmailUtil;
import com.ai.da.mapper.primary.AccountMapper;
import com.ai.da.mapper.primary.TrialOrderMapper;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Component
@@ -16,6 +29,9 @@ public class MyTaskScheduler {
@Resource
private AccountMapper accountMapper;
@Resource
private TrialOrderMapper trialOrderMapper;
// 定时任务,每十五天执行一次
// @Scheduled(cron = "0 0 0 ? * MON")
@Scheduled(cron = "0 0 0 */15 * ?")
@@ -36,7 +52,7 @@ public class MyTaskScheduler {
Long currentTimestamp = System.currentTimeMillis();
// 计算时间差(毫秒)
long timeDifference = timestamp - currentTimestamp;
long timeDifference = currentTimestamp - timestamp;
if (timeDifference < 0) {
continue;
@@ -52,4 +68,65 @@ public class MyTaskScheduler {
}
}
}
@Scheduled(cron = "0 0 8 * * ?")
public void sendTrialOrderExcelToManagements() {
// 获取前一天日期
LocalDate yesterday = LocalDate.now().minusDays(1);
// 查询前一天的试用订单
QueryWrapper<TrialOrder> qw = new QueryWrapper<>();
qw.lambda().between(TrialOrder::getCreateTime, yesterday.atStartOfDay(), yesterday.atTime(23, 59, 59));
List<TrialOrder> trialOrders = trialOrderMapper.selectList(qw);
if (!trialOrders.isEmpty()) {
// 创建Excel工作簿
try (Workbook workbook = new XSSFWorkbook()) {
// 创建工作表
Sheet sheet = workbook.createSheet("Trial Orders");
// 创建标题行
Row headerRow = sheet.createRow(0);
headerRow.createCell(0).setCellValue("ID");
headerRow.createCell(1).setCellValue("Title");
headerRow.createCell(2).setCellValue("Surname");
headerRow.createCell(3).setCellValue("Given Name");
headerRow.createCell(4).setCellValue("Username");
headerRow.createCell(5).setCellValue("Email");
headerRow.createCell(6).setCellValue("Country");
headerRow.createCell(7).setCellValue("Occupation");
headerRow.createCell(8).setCellValue("Create Time");
headerRow.createCell(9).setCellValue("Update Time");
headerRow.createCell(10).setCellValue("Status");
// 填充数据
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
int rowNum = 1;
for (TrialOrder trialOrder : trialOrders) {
Row row = sheet.createRow(rowNum++);
row.createCell(0).setCellValue(trialOrder.getId());
row.createCell(1).setCellValue(trialOrder.getTitle());
row.createCell(2).setCellValue(trialOrder.getSurname());
row.createCell(3).setCellValue(trialOrder.getGivenName());
row.createCell(4).setCellValue(trialOrder.getUserName());
row.createCell(5).setCellValue(trialOrder.getEmail());
row.createCell(6).setCellValue(trialOrder.getCountry());
row.createCell(7).setCellValue(trialOrder.getOccupation());
row.createCell(8).setCellValue(trialOrder.getCreateTime().format(formatter));
row.createCell(9).setCellValue(trialOrder.getUpdateTime().format(formatter));
row.createCell(10).setCellValue(trialOrder.getStatus());
}
// 保存Excel文件
String fileName = "trialOrder-" + yesterday.format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx";
try (FileOutputStream fileOut = new FileOutputStream(fileName)) {
workbook.write(fileOut);
SendEmailUtil.sendExcelEmail("1023316923@qq.com", null, Files.readAllBytes(Paths.get(fileName)), fileName);
SendEmailUtil.sendExcelEmail("calvinwong@aidlab.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
SendEmailUtil.sendExcelEmail("kaicpang.pang@connect.polyu.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
SendEmailUtil.sendExcelEmail("kimwong@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -9,12 +9,14 @@ import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.ses.v20201002.SesClient;
import com.tencentcloudapi.ses.v20201002.models.Attachment;
import com.tencentcloudapi.ses.v20201002.models.SendEmailRequest;
import com.tencentcloudapi.ses.v20201002.models.SendEmailResponse;
import com.tencentcloudapi.ses.v20201002.models.Template;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import java.util.Base64;
import java.util.Date;
/**
@@ -130,7 +132,9 @@ public class SendEmailUtil {
private final static Long YOUR_TRIAL_TEMPLATE_ID = 117214L;
private final static Long APPROVAL_TEMPLATE_ID = 117215L;
private final static Long NOTIFICATION_TEMPLATE_ID = 117216L;
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType) {
private final static Long NOTIFICATION_CHINESE_TEMPLATE_ID = 122229L;
private final static Long TRIAL_ORDER_LIST_ID = 122273L;
public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
@@ -162,7 +166,11 @@ public class SendEmailUtil {
break;
case 3:
subject = "Approval Confirmation for AiDA System Trial Access";
template.setTemplateID(NOTIFICATION_TEMPLATE_ID);
if (country.equals("China")) {
template.setTemplateID(NOTIFICATION_CHINESE_TEMPLATE_ID);
}else {
template.setTemplateID(NOTIFICATION_TEMPLATE_ID);
}
template.setTemplateData(buildNotificationData(trialOrder));
break;
default:
@@ -180,6 +188,45 @@ public class SendEmailUtil {
throw new BusinessException("failed.to.send.mail");
}
}
public static void sendExcelEmail(String receiverAddress, String senderAddress, byte[] fileContent, String fileName) {
try {
// 实例化一个认证对象
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("ses.tencentcloudapi.com");
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
SendEmailRequest req = new SendEmailRequest();
if (StringUtils.isEmpty(senderAddress)) {
senderAddress = SEND_ADDRESS;
}
req.setFromEmailAddress(senderAddress);
req.setDestination(new String[]{receiverAddress});
// 根据邮件类型设置不同的主题和模板
String subject = "";
Template template = new Template();
subject = "昨日试用订单数据";
template.setTemplateID(TRIAL_ORDER_LIST_ID);
req.setSubject(subject);
req.setTemplate(template);
Attachment attachment = new Attachment();
attachment.setFileName(fileName); // 设置附件文件名
// 设置附件内容
attachment.setContent(Base64.getEncoder().encodeToString(fileContent));
req.setAttachments(new Attachment[] {attachment});
// 发送邮件
SendEmailResponse resp = client.SendEmail(req);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
log.info("邮件发送失败###{}", e.toString());
throw new BusinessException("failed.to.send.mail");
}
}
private final static Long WILLBEEXPIRED_TEMPLATE_ID = 118178L;
public static void sendWillBeExpiredEmail(Account account, String senderAddress) {
try {
@@ -293,7 +340,7 @@ public class SendEmailUtil {
// 根据邮件类型设置不同的主题和模板
String subject = "";
Template template = new Template();
subject = "Notice: AiDA 3.0 Website Maintenance Downtime";
subject = "Upcoming AiDA 3.0 Launch and Scheduled Maintenance";
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
template.setTemplateData(buildAccountData(account));

View File

@@ -35,10 +35,15 @@ public class Workspace implements Serializable {
@ApiModelProperty(value = "工作空间名称")
private String workSpaceName;
/**
* 用户ID
* 用户
*/
@ApiModelProperty(value = "用户名")
private String userName;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private Long accountId;
/**
* 性别
*/

View File

@@ -228,19 +228,28 @@ public class PythonService {
long noPrintNum = 8 - pinPrintNum - noPinPrintNum;
elementVO.setNoPinPrintNum(noPinPrintNum);
int pinSketchNum = 0;
int sysSketchNum = 0;
int noPinSketchNum = 0;
int[] sketchNumbers = new int[3];
for (int i = 0; i < 8; i++) {
CurrentDesignPictureTypeEnum designPictureType = calculateCurrentDesignPictureTypeNew(elementVO, pinSketchNum, sysSketchNum, noPinSketchNum, systemScale);
CurrentDesignPictureTypeEnum designPictureType = calculateCurrentDesignPictureTypeNew(elementVO, sketchNumbers, systemScale);
if (designPictureType == null) break;
CurrentDesignPrintPictureTypeEnum designPrintPictureType = calculateCurrentDesignPintPictureType(pinPrintNum, noPinPrintNum, noPrintNum);
if (designPrintPictureType == null) break;
updateSketchNumbers(designPictureType, pinSketchNum, sysSketchNum, noPinSketchNum);
updatePrintNumbers(designPrintPictureType, pinPrintNum, noPinPrintNum, noPrintNum);
updateSketchNumbers(designPictureType, sketchNumbers);
switch (designPrintPictureType) {
case PIN:
pinPrintNum--;
break;
case NO_PIN:
noPinPrintNum--;
break;
case NO:
noPrintNum--;
break;
}
// updatePrintNumbers(designPrintPictureType, pinPrintNum, noPinPrintNum, noPrintNum);
DesignPythonItemPrint designPythonItemPrint = getRandomPrint(elementVO, designPrintPictureType);
elementVO.setDesignPythonItemPrint(designPythonItemPrint);
@@ -252,16 +261,16 @@ public class PythonService {
return designPythonObjects;
}
private void updateSketchNumbers(CurrentDesignPictureTypeEnum designPictureType, int pinSketchNum, int sysSketchNum, int noPinSketchNum) {
private void updateSketchNumbers(CurrentDesignPictureTypeEnum designPictureType, int[] sketchNumbers) {
switch (designPictureType) {
case PIN:
pinSketchNum++;
sketchNumbers[0] ++;
break;
case NO_PIN:
noPinSketchNum--;
sketchNumbers[2] --;
break;
case SYS_FILE:
sysSketchNum--;
sketchNumbers[1] --;
break;
}
}
@@ -288,16 +297,24 @@ public class PythonService {
}
private CurrentDesignPictureTypeEnum calculateCurrentDesignPictureTypeNew(ValidateElementVO elementVO, int pinSketchNum, int sysSketchNum, int noPinSketchNum, BigDecimal systemScale) {
private CurrentDesignPictureTypeEnum calculateCurrentDesignPictureTypeNew(ValidateElementVO elementVO, int[] sketchNumbers, BigDecimal systemScale) {
List<CollectionElement> pinData = getPinData(elementVO);
if (CollectionUtil.isNotEmpty(pinData)) {
return CurrentDesignPictureTypeEnum.PIN;
} else {
if (sysSketchNum == 0 && noPinSketchNum == 0) {
sysSketchNum = systemScale.multiply(BigDecimal.valueOf(8 - pinSketchNum)).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
noPinSketchNum = 8 - pinSketchNum - sysSketchNum;
if (sketchNumbers[1] == 0 && sketchNumbers[2] == 0) {
sketchNumbers[1] = systemScale.multiply(BigDecimal.valueOf(8 - sketchNumbers[0])).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
sketchNumbers[2] = 8 - sketchNumbers[0] - sketchNumbers[1];
}
if (noPinSketchNum > 0) {
if (sketchNumbers[2] > 0 && sketchNumbers[1] > 0) {
Long l = RandomsUtil.randomSysFile(0l, 2l);
if (l == 0l) {
return CurrentDesignPictureTypeEnum.NO_PIN;
}else {
return CurrentDesignPictureTypeEnum.SYS_FILE;
}
}
if (sketchNumbers[2] > 0) {
return CurrentDesignPictureTypeEnum.NO_PIN;
}
return CurrentDesignPictureTypeEnum.SYS_FILE;

View File

@@ -77,7 +77,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
@Transactional
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
Account account = getOneByUserName(accountDTO.getUserName());
Account account = getOneByEmail(accountDTO.getEmail());
//用户有效期校验
validateUserValidaExpire(account);
if ("Third-000000".equals(account.getUserPassword())) {
@@ -287,8 +287,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
private Account getOneByEmail(String email) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Account::getUserEmail, email);
queryWrapper.lambda().last("limit 1");
queryWrapper.eq("BINARY user_email", email);
List<Account> accountList = accountMapper.selectList(queryWrapper);
if (CollectionUtil.isEmpty(accountList)) {
throw new BusinessException("email.does.not.exist", ResultEnum.PROMPT.getCode());
@@ -471,28 +470,27 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
String ipAddress = RequestInfoUtil.getIpAddress(request);
// 先检测试用订单
QueryWrapper<TrialOrder> trialOrderQueryWrapper = new QueryWrapper<>();
trialOrderQueryWrapper.lambda().eq(TrialOrder::getIp, ipAddress);
trialOrderQueryWrapper.lambda().and(wrapper ->
wrapper.eq(TrialOrder::getEmail, accountTrialDTO.getEmail())
.or() // OR
.like(TrialOrder::getUserName, accountTrialDTO.getUserName()));
trialOrderQueryWrapper.eq("BINARY email", accountTrialDTO.getEmail());
// trialOrderQueryWrapper.lambda().eq(TrialOrder::getIp, ipAddress);
// trialOrderQueryWrapper.lambda().and(wrapper ->
// wrapper.eq(TrialOrder::getEmail, accountTrialDTO.getEmail())
// .or() // OR
// .like(TrialOrder::getUserName, accountTrialDTO.getUserName()));
List<TrialOrder> trialOrders = trialOrderMapper.selectList(trialOrderQueryWrapper);
if (CollectionUtil.isNotEmpty(trialOrders)) {
throw new BusinessException("You have submitted a trial application, please wait for approval.");
}
// 先检测用户名和邮箱
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.lambda().eq(Account::getUserEmail, accountTrialDTO.getEmail())
.or()
.eq(Account::getUserName, accountTrialDTO.getUserName());
qw.eq("BINARY email", accountTrialDTO.getEmail());
List<Account> accountList = accountMapper.selectList(qw);
if (CollectionUtil.isNotEmpty(accountList)) {
if (accountList.get(0).getIsTrial() == 1) {
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
}else {
Account account = accountList.get(0);
if (null == account.getValidEndTime() || account.getValidEndTime() > System.currentTimeMillis()) {
throw new BusinessException("The username or email has already been registered", ResultEnum.PROMPT.getCode());
throw new BusinessException("The email has already been registered", ResultEnum.PROMPT.getCode());
}
}
}
@@ -502,9 +500,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrder.setStatus(0);
trialOrder.setIp(ipAddress);
trialOrderMapper.insert(trialOrder);
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1);
SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,1);
SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,1);
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,1);
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,1);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,1);
// 判断当前的试用订单是否自动批准
if (AutoApproved.getStatus()) {
// 改变试用订单状态,新增试用用户
@@ -532,10 +530,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.insert(account);
}
// 发送邮件提醒用户试用用户已创建
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}
return Boolean.TRUE;
}
@@ -556,9 +554,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
trialOrderMapper.updateById(trialOrder);
QueryWrapper<Account> qw = new QueryWrapper<>();
qw.lambda().eq(Account::getUserEmail, trialOrder.getEmail())
.or()
.eq(Account::getUserName, trialOrder.getUserName());
qw.eq("BINARY email", trialOrder.getEmail());
List<Account> accountList = accountMapper.selectList(qw);
Account account = new Account();
@@ -582,10 +578,10 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
accountMapper.insert(account);
}
// 发送邮件提醒用户试用用户已创建
SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3);
// SendEmailUtil.sendCustomEmail("1023316923@qq.com", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("calvinwong@aidlab.hk", null, trialOrder,2);
// SendEmailUtil.sendCustomEmail("kaicpang.pang@connect.polyu.hk", null, trialOrder,2);
SendEmailUtil.sendCustomEmail(account.getUserEmail(), null, trialOrder, 3, trialOrder.getCountry());
}
return Boolean.TRUE;
}

View File

@@ -595,7 +595,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
public void checkModel(String value, List<Long> modelIds, Integer deleteModelConfirm) {
AuthPrincipalVo authPrincipalVo = UserContext.getUserHolder();
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().eq(Workspace::getUserName, authPrincipalVo.getUsername());
qw.lambda().eq(Workspace::getAccountId, authPrincipalVo.getId());
if (value.equals(Sex.FEMALE.getValue())) {
qw.lambda().in(Workspace::getMannequinFemaleId, modelIds);
}

View File

@@ -86,8 +86,8 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
// 防止前端传值修改标识
workspace.setIsLastIndex(null);
AuthPrincipalVo userInfo = UserContext.getUserHolder();
workspace.setUserName(userInfo.getUsername());
checkWorkspaceName(workspace.getId(), workspace.getWorkSpaceName(), userInfo.getUsername());
workspace.setAccountId(userInfo.getId());
checkWorkspaceName(workspace.getId(), workspace.getWorkSpaceName(), userInfo.getId());
if (null == workspace.getId()) {
workspace.setIsLastIndex(0);
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();
@@ -123,11 +123,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
}
}
private void checkWorkspaceName(Long id, String workSpaceName, String userName) {
private void checkWorkspaceName(Long id, String workSpaceName, Long accountId) {
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().ne(null != id, Workspace::getId, id);
qw.lambda().eq(Workspace::getWorkSpaceName, workSpaceName);
qw.lambda().eq(Workspace::getUserName, userName);
qw.lambda().eq(Workspace::getAccountId, accountId);
List<Workspace> workspaces = baseMapper.selectList(qw);
if (!CollectionUtils.isEmpty(workspaces)) {
throw new BusinessException("the.workspaceName.already.exists", ResultEnum.PROMPT.getCode());
@@ -137,9 +137,9 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
@Override
public WorkspaceVO getPage(WorkspaceDTO query) {
WorkspaceVO vo = new WorkspaceVO();
String userName = UserContext.getUserHolder().getUsername();
Long accountId = UserContext.getUserHolder().getId();
QueryWrapper<Workspace> qw = new QueryWrapper<>();
qw.lambda().eq(Workspace::getUserName, userName);
qw.lambda().eq(Workspace::getAccountId, accountId);
IPage<Workspace> page = workspaceMapper.selectPage(new Page<>(query.getPage(), query.getSize()), qw);
if (page.getTotal() == 0L) {
// 给用户新建默认workspace
@@ -148,7 +148,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
workspace.setSex(Sex.FEMALE.getValue());
workspace.setSystemDesignerPercentage(SYSTEM_DESIGNER_PERCENTAGE);
workspace.setPosition("Overall");
workspace.setUserName(userName);
workspace.setAccountId(accountId);
QueryWrapper<SysFile> systemFemaleQw = new QueryWrapper<>();
systemFemaleQw.lambda().eq(SysFile::getLevel1Type, "Models");
systemFemaleQw.lambda().eq(SysFile::getLevel2Type, "Female");
@@ -225,7 +225,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
);
vo.setPage(PageBaseResponse.success(convert));
QueryWrapper<Workspace> qwIsLastIndex = new QueryWrapper<>();
qwIsLastIndex.lambda().eq(Workspace::getUserName, userName);
qwIsLastIndex.lambda().eq(Workspace::getAccountId, accountId);
qwIsLastIndex.lambda().eq(Workspace::getIsLastIndex, 1);
qwIsLastIndex.last("limit 1");
List<Workspace> workspaces = workspaceMapper.selectList(qwIsLastIndex);
@@ -250,9 +250,9 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
@Override
public Workspace getByIdNew(Long id) {
String userName = UserContext.getUserHolder().getUsername();
Long accountId = UserContext.getUserHolder().getId();
QueryWrapper<Workspace> qwOld = new QueryWrapper<>();
qwOld.lambda().eq(Workspace::getUserName, userName);
qwOld.lambda().eq(Workspace::getAccountId, accountId);
qwOld.lambda().eq(Workspace::getIsLastIndex, 1);
Workspace oldIsLastIndex = workspaceMapper.selectOne(qwOld);
oldIsLastIndex.setIsLastIndex(0);