Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
yitonglei 2022-07-01 16:09:22 +08:00
commit ff808b022b
6 changed files with 69 additions and 15 deletions

View File

@ -18,6 +18,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
@Service
public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category, CategoryDTO> implements CategoryService {
@ -35,12 +37,16 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
@Override
public List<CategoryDTO> getCategoryTree() {
List<Category> topCategory = categoryDao.selectByParentId(null);
ArrayList<CategoryDTO> list = new ArrayList<>();
topCategory.forEach(item -> {
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
List<CategoryDTO> list = new CopyOnWriteArrayList<>();
List<CompletableFuture> completableFutureLis = new ArrayList<>();
topCategory.forEach(index ->
completableFutureLis.add(CompletableFuture.runAsync(() -> {
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(index, dto);
list.add(dto);
}))
);
CompletableFuture.allOf(completableFutureLis.toArray(new CompletableFuture[completableFutureLis.size()])).join();
return getAllCategory(list);
}
@ -53,10 +59,10 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
ArrayList<CategoryDTO> list = new ArrayList<>();
categoryDao.selectByParentId(categoryDto.getId())
.forEach(item -> {
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
categoryDto.setIsLeaf("N");
categoryDto.setChildren(getAllCategory(list));
}
@ -77,7 +83,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
public List<Category> getAllFiledByTopCategory(String topCategoryName) {
QueryWrapper<Category> wrapper = new QueryWrapper<>();
wrapper.eq("root_category", topCategoryName)
.eq("del_flag",0)
.eq("del_flag", 0)
.eq("is_attr", "true")
.orderByAsc("xh");
return categoryDao.selectList(wrapper);
@ -87,7 +93,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
public List<Map> getAllFilterCriteriaByTopCategory(String topCategoryName) {
QueryWrapper<Category> wrapper = new QueryWrapper<>();
wrapper.eq("root_category", topCategoryName)
.eq("del_flag",0)
.eq("del_flag", 0)
.eq("is_link_to_dic", "true")
.eq("is_filter_criteria", "true")
.orderByAsc("xh");

View File

@ -1566,7 +1566,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
dtoList.forEach(temp->{
Map p=new HashMap();
p.put("resource_id", temp.getId());
temp.setApplyCount(String.valueOf(tResourceMountApplyService.list(p).size()));
temp.setApplyCount(String.valueOf(tAbilityApplicationService.list(p).size()));
});
return new PageData<>(dtoList, dtoList.size());
}

View File

@ -55,6 +55,14 @@ public class WorkDynamicsController {
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("/getDeptWork")
@ApiOperation("查询用户所在部门的工作动态")
@LogOperation("查询用户所在部门的工作动态")
public Result<PageData<WorkDynamicsDTO>> getDeptWork(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<WorkDynamicsDTO> page = workDynamicsService.getDeptWork(params);
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("/select/{id}")
@ApiOperation("查询工作动态详细信息")
@LogOperation("查询工作动态详细信息")

View File

@ -1,9 +1,12 @@
package io.renren.modules.workDynamics.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
import java.util.Map;
/**
* 工作动态
*
@ -13,4 +16,6 @@ import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
public interface WorkDynamicsService extends CrudService<WorkDynamicsEntity, WorkDynamicsDTO> {
void deleteByIds(Long[] ids);
PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params);
}

View File

@ -2,7 +2,14 @@ package io.renren.modules.workDynamics.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysUserService;
import io.renren.modules.workDynamics.dao.WorkDynamicsDao;
import io.renren.modules.workDynamics.dto.WorkDynamicsDTO;
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
@ -10,7 +17,10 @@ import io.renren.modules.workDynamics.service.WorkDynamicsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 工作动态
@ -24,6 +34,9 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
@Autowired
private WorkDynamicsDao workDynamicsDao;
@Autowired
private SysUserService sysUserService;
@Override
public QueryWrapper<WorkDynamicsEntity> getWrapper(Map<String, Object> params){
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
@ -40,4 +53,26 @@ public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, Wo
public void deleteByIds(Long[] ids) {
workDynamicsDao.deleteByIds(ids);
}
@Override
public PageData<WorkDynamicsDTO> getDeptWork(Map<String, Object> params) {
Integer curPage = 1;
Integer limit = 10;
if (params.get(Constant.PAGE) != null) {
curPage = Integer.parseInt((String) params.get(Constant.PAGE));
}
if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
List<SysUserDTO> sysUserList = sysUserService.list(new HashMap());
List<Long> userIdList=sysUserList.stream().map(user->user.getId()).collect(Collectors.toList());
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag", 0);
if(userIdList.size()>0){
wrapper.in("creator", userIdList);
}
IPage<WorkDynamicsEntity> page = new Page<>(curPage, limit);
List<WorkDynamicsDTO> result=ConvertUtils.sourceToTarget(workDynamicsDao.selectPage(page, wrapper).getRecords(), WorkDynamicsDTO.class);
return new PageData<WorkDynamicsDTO>(result, result.size());
}
}

View File

@ -1340,8 +1340,8 @@
</select>
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
SELECT count(trma.id) as count, tdr.name
FROM tb_data_resource tdr left join t_resource_mount_apply trma on tdr.id=trma.resource_id
SELECT count(taa.id) as count, tdr.name
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
<if test="null != list">
where tdr.dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">