Merge branch 'release/3.0' into dev/dev

# Conflicts:
#	src/main/java/com/ai/da/controller/ConvenientInquiryController.java
#	src/main/java/com/ai/da/model/dto/DesignCollectionDTO.java
#	src/main/java/com/ai/da/service/impl/DesignServiceImpl.java
This commit is contained in:
2025-01-08 10:33:49 +08:00
5 changed files with 42 additions and 8 deletions

View File

@@ -140,6 +140,9 @@ public class MyTaskScheduler {
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);
SendEmailUtil.sendExcelEmail("ningning@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
SendEmailUtil.sendExcelEmail("johnnyho@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
SendEmailUtil.sendExcelEmail("ringolau@code-create.com.hk", null, Files.readAllBytes(Paths.get(fileName)), fileName);
}
} catch (IOException e) {
e.printStackTrace();
@@ -149,6 +152,9 @@ public class MyTaskScheduler {
SendEmailUtil.sendNoExcelEmail("calvinwong@aidlab.hk", null);
SendEmailUtil.sendNoExcelEmail("kaicpang.pang@connect.polyu.hk", null);
SendEmailUtil.sendNoExcelEmail("kimwong@code-create.com.hk", null);
SendEmailUtil.sendNoExcelEmail("ningning@code-create.com.hk", null);
SendEmailUtil.sendNoExcelEmail("johnnyho@code-create.com.hk", null);
SendEmailUtil.sendNoExcelEmail("ringolau@code-create.com.hk", null);
}
}

View File

@@ -14,6 +14,8 @@ import com.ai.da.model.vo.QueryUserConditionsVO;
import com.ai.da.service.AccountService;
import com.ai.da.service.ConvenientInquiryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itextpdf.text.pdf.PRIndirectReference;
import io.netty.util.internal.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -60,7 +62,11 @@ public class ConvenientInquiryController {
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
String userEmail = accountService.getById(accountId).getUserEmail();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|| userEmail.equals("joho8228@hotmail.com") || userEmail.equals("wanninghua160@gmail.com")
) {
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
if (StringUtil.isNullOrEmpty(endTime)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
@@ -143,7 +149,14 @@ public class ConvenientInquiryController {
@ApiOperation("添加用户")
@PostMapping("/addUser")
public Response<Boolean> addUser(@Valid @RequestBody AccountAddDTO accountAddDTO) {
return Response.success(convenientInquiryService.addUser(accountAddDTO));
Long userAccountId = UserContext.getUserHolder().getId();
if (userAccountId.equals(31L) || userAccountId.equals(87L) || userAccountId.equals(83L)
|| userAccountId.equals(6L) || userAccountId.equals(4L) || userAccountId.equals(73L)
) {
return Response.success(convenientInquiryService.addUser(accountAddDTO));
} else {
return Response.fail("Sorry, you don't have permission");
}
}
@ApiOperation("修改用户信息")
@@ -152,14 +165,25 @@ public class ConvenientInquiryController {
@ApiParam(value = "有效期截止时间的毫秒级unix格式") @RequestParam @Nullable Long validEndTime,
@ApiParam(value = "用户类型 1/2/3/0 -> yearly/monthly/trial/visitor") @RequestParam @Nullable Integer systemUser,
@ApiParam("积分") @RequestParam @Nullable Long credits) {
return Response.success(convenientInquiryService.modifyUser(accountId, validEndTime, systemUser, credits));
Long userAccountId = UserContext.getUserHolder().getId();
if (userAccountId.equals(31L) || userAccountId.equals(87L) || userAccountId.equals(83L)
|| userAccountId.equals(6L) || userAccountId.equals(4L) || userAccountId.equals(73L)
) {
return Response.success(convenientInquiryService.modifyUser(accountId, validEndTime, systemUser, credits));
} else {
return Response.fail("Sorry, you don't have permission");
}
}
@ApiOperation("获取用户信息")
@PostMapping("/getUserInfo")
public Response<IPage<Account>> getUserInfo(@Valid @RequestBody QueryUserConditionsVO queryUserConditionsVO) {
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
String userEmail = accountService.getById(accountId).getUserEmail();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|| accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)
|| userEmail.equals("joho8228@hotmail.com") || userEmail.equals("wanninghua160@gmail.com")
) {
return Response.success(convenientInquiryService.getUserInfo(queryUserConditionsVO));
} else {
return Response.fail("Sorry, you don't have permission");

View File

@@ -835,6 +835,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
throw new BusinessException("Machine not registered or machine identification has changed, login free has failed, please contact us at help@aida.com.hk.");
}
Account account = accountList.get(0);
validateUserValidaExpire(account);
AccountLoginVO response = CopyUtil.copyObject(account, AccountLoginVO.class);
String token = LocalCacheUtils.getTokenCache(String.valueOf(account.getId()));
if (StringUtils.isNotBlank(token)) {

View File

@@ -57,12 +57,12 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
@Transactional(rollbackFor = Exception.class)
@Override
public Long saveCollection(Long accountId, String timeZone, String moodTemplateId, String moodboardPostion) {
public Long saveCollection(Long accountId, String timeZone, String moodTemplateId, String moodboardPosition) {
Collection collection = new Collection();
collection.setAccountId(accountId);
collection.setCreateDate(DateUtil.getByTimeZone(timeZone));
collection.setMoodTemplateId(moodTemplateId);
collection.setMoodboardPosition(moodboardPostion);
collection.setMoodboardPosition(moodboardPosition);
if (collectionMapper.insert(collection) <= 0) {
throw new BusinessException("save.collection.failed");
}

View File

@@ -502,7 +502,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
account.setCreateDate(new Date());
account.setIsBeginner(1);
log.info("添加用户:{}", accountAddDTO.getUserEmail());
log.info("管理员:{}添加用户账号{}", UserContext.getUserHolder().getUsername(), accountAddDTO.getUserEmail());
return accountService.save(account);
}
@@ -515,13 +515,16 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
throw new BusinessException("you have to choose a user");
}
String username = UserContext.getUserHolder().getUsername();
Account account = new Account();
// 修改用户有效期截止日期、用户类型、积分
if (!Objects.isNull(validEndTime)) {
account.setValidEndTime(validEndTime);
log.info("管理员:{},修改用户 {} 信息,将账号到期时间置为:{}", username, accountId, validEndTime);
}
if (!Objects.isNull(systemUser)) {
account.setSystemUser(systemUser);
log.info("管理员:{},修改用户 {} 信息,将账号身份置为:{}", username, accountId, systemUser);
}
/*if (!StringUtils.isNullOrEmpty(systemUser)) {
int systemUser = 0;
@@ -543,10 +546,10 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
}*/
if (!Objects.isNull(credits)) {
account.setCredits(new BigDecimal(credits));
log.info("管理员:{},修改用户 {} 信息,将账号积分置为:{}", username, accountId, credits);
}
account.setId(accountId);
account.setUpdateDate(new Date());
log.info("修改用户信息:{}", accountId);
return accountMapper.updateById(account) == 1;
// accountService.update(account,null);
}