Merge branch 'release/3.0' into dev/dev_xp
# Conflicts: # src/main/java/com/ai/da/mapper/primary/DesignMapper.java # src/main/resources/mapper/primary/DesignMapper.xml
This commit is contained in:
@@ -58,7 +58,7 @@ public class AsyncCallerUtil {
|
||||
return null;
|
||||
} catch (InterruptedException | ExecutionException | BusinessException e) {
|
||||
// 处理异常
|
||||
log.error("发生错误 : " + e);
|
||||
log.error("发生错误 : " + e, e);
|
||||
// 取消定时任务
|
||||
assert timeoutTask != null;
|
||||
timeoutTask.cancel(true);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ai.da.controller;
|
||||
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.DesignMapper;
|
||||
import com.ai.da.mapper.TrialOrderMapper;
|
||||
import com.ai.da.mapper.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.UserDesignStatisticDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "便利查询")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/inquiry")
|
||||
public class ConvenientInquiryController {
|
||||
|
||||
@Resource
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@ApiOperation("获取当前所有试用用户")
|
||||
@GetMapping("/getTrial")
|
||||
public Response<List<TrialOrder>> getTrial(){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)){
|
||||
List<TrialOrder> trialOrders = trialOrderMapper.selectList(null);
|
||||
return Response.success(trialOrders);
|
||||
}else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime,@RequestParam String endTime){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)){
|
||||
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime);
|
||||
return Response.success(designStatistic);
|
||||
}else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.common.config.mybatis.plus.CommonMapper;
|
||||
//import com.ai.da.mapper.entity.Design;
|
||||
import com.ai.da.model.dto.UserDesignStatisticDTO;
|
||||
|
||||
import java.util.List;
|
||||
import com.ai.da.mapper.primary.entity.Design;
|
||||
|
||||
/**
|
||||
@@ -13,4 +17,6 @@ public interface DesignMapper extends CommonMapper<Design> {
|
||||
|
||||
//返回插入数据后生成的主键
|
||||
Long insertDesign(Design design);
|
||||
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDesignStatisticDTO {
|
||||
|
||||
private Long accountId;
|
||||
|
||||
private Long useDesignTimes;
|
||||
|
||||
private String userEmail;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String isTrial;
|
||||
}
|
||||
@@ -2919,6 +2919,7 @@ public class PythonService {
|
||||
Boolean result = JSON.parseObject(JSON.toJSONString(response)).getBoolean("successful");
|
||||
|
||||
if (result && jsonObject.get("code").equals(200)) {
|
||||
log.info("Generate##responseObject###{}", jsonObject);
|
||||
return setGenerateImageList(jsonObject.getJSONObject("data"));
|
||||
}
|
||||
log.info("generateSketchOrPrintPrint失败###{}", jsonObject);
|
||||
|
||||
@@ -489,6 +489,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
trialOrder.setStatus(0);
|
||||
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);
|
||||
// 判断当前的试用订单是否自动批准
|
||||
if (AutoApproved.getStatus()) {
|
||||
// 改变试用订单状态,新增试用用户
|
||||
@@ -501,7 +503,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
accountMapper.updateById(account);
|
||||
}else {
|
||||
account.setUserName(trialOrder.getUserName());
|
||||
@@ -509,7 +511,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setUserEmail(trialOrder.getEmail());
|
||||
account.setLanguage(Language.ENGLISH.name());
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
@@ -517,6 +519,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
// 发送邮件提醒用户试用用户已创建
|
||||
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);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
@@ -549,7 +553,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
accountMapper.updateById(account);
|
||||
}else {
|
||||
account.setUserName(trialOrder.getUserName());
|
||||
@@ -557,7 +561,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
account.setUserEmail(trialOrder.getEmail());
|
||||
account.setLanguage(Language.ENGLISH.name());
|
||||
account.setValidStartTime(System.currentTimeMillis());
|
||||
account.setValidEndTime(Instant.now().plus(3, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setValidEndTime(Instant.now().plus(5, ChronoUnit.DAYS).toEpochMilli());
|
||||
account.setCreateDate(new Date());
|
||||
account.setIsTrial(1);
|
||||
account.setIsBeginner(1);
|
||||
@@ -565,6 +569,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
// 发送邮件提醒用户试用用户已创建
|
||||
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);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
|
||||
Reference in New Issue
Block a user