Merge branch 'dev/dev_xp' into dev/dev
# Conflicts: # src/main/java/com/ai/da/service/CollectionElementService.java # src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java
This commit is contained in:
@@ -5,6 +5,7 @@ import com.ai.da.mapper.primary.entity.LibraryModelPoint;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -137,4 +138,7 @@ public interface CollectionElementService extends IService<CollectionElement> {
|
||||
CollectionElement editLevel2Type(Long elementId, String level2Type, String designType);
|
||||
|
||||
List<CollectionElement> getByProjectId(Long projectId);
|
||||
|
||||
List<CollectionElementVO> selectedImageSeg(List<MultipartFile> files, Long id, String type);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.QueryPaymentInfoDTO;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.vo.PaymentInfoVO;
|
||||
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
|
||||
import com.ai.da.model.vo.QuestionnaireVO;
|
||||
@@ -21,6 +20,8 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
|
||||
|
||||
IPage<TrialOrder> getTrial(QueryUserConditionsVO queryUserConditionsVO);
|
||||
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email);
|
||||
|
||||
QuestionnaireFeedbackVO getQuestionnaireInfo();
|
||||
|
||||
List<QuestionnaireVO> getAllQuestionnaire();
|
||||
@@ -53,4 +54,6 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
|
||||
Map<String, List<String>> getCities();
|
||||
|
||||
String exportTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO, HttpServletResponse response);
|
||||
|
||||
PageBaseResponse<AccountCreditsUsageDTO> getGenerateFrequency(AccountCreditsUsageQueryDTO queryDTO);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,14 @@ import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.QueryPaymentInfoDTO;
|
||||
import com.ai.da.model.dto.*;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.*;
|
||||
@@ -41,6 +41,7 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -68,10 +69,15 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
@Resource
|
||||
private PaymentInfoMapper paymentInfoMapper;
|
||||
@Resource
|
||||
private DesignMapper designMapper;
|
||||
|
||||
@Value("${minio.bucketName.users}")
|
||||
private String userBucket;
|
||||
|
||||
private static final List<Long> ADMIN_IDS = Arrays.asList(4L, 6L, 31L, 73L, 83L, 87L);
|
||||
private static final List<Long> ADMIN_IDS_READ_ONLY = Arrays.asList(12592L, 12201L);
|
||||
|
||||
public IPage<TrialOrder> getTrial(QueryUserConditionsVO queryUserConditionsVO) {
|
||||
log.info("getTrial parameter : {},page:{}, size:{}", queryUserConditionsVO, queryUserConditionsVO.getPage(), queryUserConditionsVO.getSize());
|
||||
/* 添加按条件查询试用用户 */
|
||||
@@ -122,6 +128,46 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
// List<TrialOrder> trialOrders = trialOrderMapper.selectList(null);
|
||||
}
|
||||
|
||||
public List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids,
|
||||
String email) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Account account = accountService.getById(accountId);
|
||||
// 允许查看数据的用户id
|
||||
if (Objects.nonNull(account.getSystemUser())
|
||||
&& (account.getSystemUser().equals(5)
|
||||
|| account.getSystemUser().equals(7)
|
||||
|| ADMIN_IDS.contains(account.getId())
|
||||
|| ADMIN_IDS_READ_ONLY.contains(account.getId())
|
||||
)) {
|
||||
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");
|
||||
Date date = new Date();
|
||||
endTime = simpleDateFormat.format(date);
|
||||
}
|
||||
if (!StringUtil.isNullOrEmpty(email)){
|
||||
email = email.trim();
|
||||
}
|
||||
String role;
|
||||
switch (account.getSystemUser()){
|
||||
case 5:
|
||||
role = "corp";
|
||||
break;
|
||||
case 7:
|
||||
role = "edu";
|
||||
break;
|
||||
case 1:
|
||||
role = "prsn";
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("Sorry, you don't have permission", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
return designMapper.getDesignStatistic(startTime, endTime, ids, email, role);
|
||||
} else {
|
||||
throw new BusinessException("Sorry, you don't have permission", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public QuestionnaireFeedbackVO getQuestionnaireInfo() {
|
||||
String title = "AiDA_3.0 Feedback Survey--06/2024";
|
||||
@@ -802,4 +848,61 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询generate使用频次
|
||||
* @param queryDTO
|
||||
* @return
|
||||
*/
|
||||
public PageBaseResponse<AccountCreditsUsageDTO> getGenerateFrequency(AccountCreditsUsageQueryDTO queryDTO){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Account account = accountService.getById(accountId);
|
||||
// 允许查看数据的用户id
|
||||
if (Objects.nonNull(account.getSystemUser())
|
||||
&& (account.getSystemUser().equals(5)
|
||||
|| account.getSystemUser().equals(7)
|
||||
|| ADMIN_IDS.contains(account.getId())
|
||||
|| ADMIN_IDS_READ_ONLY.contains(account.getId())
|
||||
)) {
|
||||
boolean groupByEvent = !StringUtil.isNullOrEmpty(queryDTO.getChangeEvent());
|
||||
String role;
|
||||
switch (account.getSystemUser()){
|
||||
case 5:
|
||||
role = "corp";
|
||||
break;
|
||||
case 7:
|
||||
role = "edu";
|
||||
break;
|
||||
case 1:
|
||||
role = "prsn";
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("Sorry, you don't have permission");
|
||||
}
|
||||
Integer size = queryDTO.getSize();
|
||||
int offset = (queryDTO.getPage() - 1) * size;
|
||||
List<AccountCreditsUsageDTO> creditsUsageDTOS = accountMapper.selectCreditUsage(
|
||||
groupByEvent, queryDTO.getChangeEvent(), role, queryDTO.getUserEmail(), queryDTO.getId(),
|
||||
queryDTO.getStartTime(), queryDTO.getEndTime(), size, offset);
|
||||
if (!creditsUsageDTOS.isEmpty()){
|
||||
int total = accountMapper.countCreditUsage(
|
||||
groupByEvent, queryDTO.getChangeEvent(), role, queryDTO.getUserEmail(), queryDTO.getId(),
|
||||
queryDTO.getStartTime(), queryDTO.getEndTime());
|
||||
// 总页数
|
||||
double totalPage = Math.ceil((double) total / size);
|
||||
// 组装返回参数
|
||||
PageBaseResponse<AccountCreditsUsageDTO> response = new PageBaseResponse<>();
|
||||
response.setContent(creditsUsageDTOS);
|
||||
response.setPage(queryDTO.getPage());
|
||||
response.setSize(size);
|
||||
response.setTotal(total);
|
||||
response.setPages((long) totalPage);
|
||||
return response;
|
||||
}else {
|
||||
return new PageBaseResponse<>();
|
||||
}
|
||||
}else {
|
||||
throw new BusinessException("Sorry, you don't have permission");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user