BUGFIX:1.生成的图案在design时未加入到library
2.获取组织名时出现空字符串 TASK:1. 允许超级管理员按组织名查询用户design频次
This commit is contained in:
@@ -52,7 +52,8 @@ public class ConvenientInquiryController {
|
||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||
@GetMapping("/getDesignStatistic")
|
||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime,
|
||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email,
|
||||
@RequestParam(required = false) String organizationName) {
|
||||
/*Long accountId = UserContext.getUserHolder().getId();
|
||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L)
|
||||
@@ -75,7 +76,7 @@ public class ConvenientInquiryController {
|
||||
} else {
|
||||
return Response.fail("Sorry, you don't have permission");
|
||||
}*/
|
||||
return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email));
|
||||
return Response.success(convenientInquiryService.getDesignStatistic(startTime, endTime, ids, email, organizationName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public class ProjectQueryDTO extends PageQueryBaseVo {
|
||||
private Integer intersection;
|
||||
|
||||
// todo 获取历史列表,允许传入多个类型
|
||||
// private List<String> process;
|
||||
private String process;
|
||||
private List<String> process;
|
||||
// private String process;
|
||||
|
||||
private Integer asc;
|
||||
}
|
||||
|
||||
@@ -244,4 +244,6 @@ public interface AccountService extends IService<Account> {
|
||||
void checkEduAdminExpireStatus();
|
||||
|
||||
void setEduAdminToExpire(Account adminAccount);
|
||||
|
||||
String getOrganizationTypeByRole(Integer roleNum);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
|
||||
|
||||
IPage<TrialOrder> getTrial(QueryUserConditionsVO queryUserConditionsVO);
|
||||
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email);
|
||||
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids,
|
||||
String email, String organizationName);
|
||||
|
||||
QuestionnaireFeedbackVO getQuestionnaireInfo();
|
||||
|
||||
|
||||
@@ -3570,6 +3570,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
@Override
|
||||
public Set<String> organizationNameSearch(String type, String name) {
|
||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
||||
qw.lambda().ne(Account::getOrganizationName, "").isNotNull(Account::getOrganizationName);
|
||||
if (!StringUtil.isNullOrEmpty(name)) {
|
||||
qw.lambda().like(Account::getOrganizationName, name);
|
||||
}
|
||||
@@ -3657,6 +3658,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (Objects.isNull(organization)){
|
||||
organization = convenientInquiryService.addOrganization(adminAcc.getOrganizationName(), getOrganizationTypeByRole(adminAcc.getSystemUser()));
|
||||
}
|
||||
if (isActive){
|
||||
organization.setStatus(1);
|
||||
} else {
|
||||
@@ -3666,4 +3670,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
organizationMapper.updateById(organization);
|
||||
}
|
||||
|
||||
public String getOrganizationTypeByRole(Integer roleNum){
|
||||
String type;
|
||||
switch (roleNum){
|
||||
case 5:
|
||||
type = "Enterprise";
|
||||
break;
|
||||
case 7:
|
||||
type = "Education";
|
||||
break;
|
||||
default:
|
||||
type = null;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -581,13 +581,20 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
while (sketchIterator.hasNext()) {
|
||||
CollectionSketchDTO sketchBoard = sketchIterator.next();
|
||||
String level2Type = sketchBoard.getLevel2Type();
|
||||
String level3Type = "";
|
||||
String level3Type = null;
|
||||
if ("Collection".equals(sketchBoard.getDesignType())) {
|
||||
level3Type = collectionElementMapper.selectOne(new LambdaQueryWrapper<CollectionElement>().eq(CollectionElement::getId, sketchBoard.getSketchBoardId()).select(CollectionElement::getLevel3Type)).getLevel3Type();
|
||||
} else if ("Library".equals(sketchBoard.getDesignType())){
|
||||
level3Type = libraryService.getById(sketchBoard.getSketchBoardId()).getLevel3Type();
|
||||
} else if ("Generate".equals(sketchBoard.getDesignType())){
|
||||
GenerateDetail generateDetail = generateDetailMapper.selectById(sketchBoard.getSketchBoardId());
|
||||
assert generateDetail != null;
|
||||
Generate generate = generateMapper.selectById(generateDetail.getGenerateId());
|
||||
assert generate != null;
|
||||
level3Type = GenerateServiceImpl.extractGender(generate.getGenerateType());
|
||||
}
|
||||
//判断性别和当前project性别是否一致,不一致则移除
|
||||
assert level3Type != null;
|
||||
if (!level3Type.equalsIgnoreCase(designDTO.getModelSex())) {
|
||||
sketchIterator.remove();
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
}
|
||||
|
||||
public List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids,
|
||||
String email) {
|
||||
String email, String organizationName) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Account account = accountService.getById(accountId);
|
||||
// 允许查看数据的用户id
|
||||
@@ -166,6 +166,8 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
break;
|
||||
case 1:
|
||||
role = "prsn";
|
||||
// 如果时个人版的管理员,允许查看所有人的信息,并可以查看指定组织的design数据
|
||||
account.setOrganizationName(organizationName);
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||
@@ -654,7 +656,8 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
if (Objects.nonNull(organization)){
|
||||
account.setOrganizationId(organization.getId());
|
||||
} else {
|
||||
organization = addOrganization(accountAddDTO.getOrganizationName(), organization.getType());
|
||||
String type = accountService.getOrganizationTypeByRole(account.getSystemUser());
|
||||
organization = addOrganization(accountAddDTO.getOrganizationName(), type);
|
||||
account.setOrganizationName(accountAddDTO.getOrganizationName());
|
||||
account.setOrganizationId(organization.getId());
|
||||
}
|
||||
@@ -1124,12 +1127,13 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
private OrganizationMapper organizationMapper;
|
||||
|
||||
public Organization addOrganization(String name, String type) {
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
// 用户登录时没有携带token,故无法获取用户信息
|
||||
/*Long accountId = UserContext.getUserHolder().getId();
|
||||
Account account = accountService.getById(accountId);
|
||||
// 允许查看数据的用户id
|
||||
if (!ADMIN_IDS.contains(account.getId())) {
|
||||
throw new BusinessException("have.no.permission", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}*/
|
||||
Organization organization = new Organization();
|
||||
organization.setName(name);
|
||||
organization.setType(type);
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.google.common.collect.Lists;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -389,7 +388,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
|
||||
// 生成library - 根据设计元素生成设计库信息
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByCollectionId(collectionId);
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
@@ -420,14 +419,21 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return requestId;
|
||||
}
|
||||
|
||||
private String getAgeGroupByCollectionId(Long collectionId){
|
||||
List<CollectionElement> byCollectionId = collectionElementService.getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()){
|
||||
Long projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
private String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){
|
||||
if (Objects.nonNull(projectId)){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
} else if (Objects.nonNull(collectionId) && collectionId != 0){
|
||||
List<CollectionElement> byCollectionId = collectionElementService.getByCollectionId(collectionId);
|
||||
if (byCollectionId != null && !byCollectionId.isEmpty()){
|
||||
projectId = byCollectionId.get(0).getProjectId();
|
||||
if (projectId != null && projectId != 0L){
|
||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||
return workspace.getAgeGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -706,6 +712,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (!CollectionUtils.isEmpty(elementVO.getMarketingSketchElements())) {
|
||||
elements.addAll(elementVO.getMarketingSketchElements());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(elementVO.getGenerateCollectionElements())) {
|
||||
elements.addAll(elementVO.getGenerateCollectionElements());
|
||||
}
|
||||
collectionElementService.saveLibraryByCollectionElement(elements, timeZone, elementVO.getModelSex(), ageGroup);
|
||||
}
|
||||
|
||||
@@ -2516,7 +2525,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
log.info("design python端运行时间:" + totalTimeInSeconds + " 秒");
|
||||
//生成library
|
||||
startTime = System.currentTimeMillis();
|
||||
String ageGroup = getAgeGroupByCollectionId(collectionId);
|
||||
String ageGroup = getAgeGroupByProjectOrCollectionId(designDTO.getProjectId(), collectionId);
|
||||
generateLibrary(elementVO, designDTO.getTimeZone(), ageGroup);
|
||||
//处理关联关系,修复element覆盖得情况
|
||||
// List<CollectionElement> relationElements = collectionElementService.getByOnlyCollectionId(collectionId);
|
||||
|
||||
@@ -1929,11 +1929,11 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (Objects.nonNull(query.getEndDate())) {
|
||||
queryWrapper.le("update_time", new Date(query.getEndDate()));
|
||||
}
|
||||
// if (Objects.nonNull(query.getProcess()) && !query.getProcess().isEmpty()) {
|
||||
if (!StringUtils.isEmpty(query.getProcess())) {
|
||||
if (Objects.nonNull(query.getProcess()) && !query.getProcess().isEmpty()) {
|
||||
// if (!StringUtils.isEmpty(query.getProcess())) {
|
||||
// todo 获取历史列表,允许传入多个类型
|
||||
// queryWrapper.in("process", query.getProcess());
|
||||
queryWrapper.eq("process", query.getProcess());
|
||||
queryWrapper.in("process", query.getProcess());
|
||||
// queryWrapper.eq("process", query.getProcess());
|
||||
}
|
||||
// 新增分类过滤
|
||||
if (CollectionUtil.isNotEmpty(query.getClassificationIdList())) {
|
||||
|
||||
Reference in New Issue
Block a user