Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-01 17:18:12 +08:00
commit 26e6c2d157
9 changed files with 118 additions and 44 deletions

View File

@ -235,8 +235,9 @@ public class CensusControllerV3 {
})
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id\n" +
"INNER JOIN sys_dept c ON b.dept_id = c.id WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?)) GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id \n" +
"inner join sys_user d on a.creator = d.id\n" +
"INNER JOIN sys_dept c ON d.dept_id = c.id WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?)) GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
}
@ -298,10 +299,10 @@ public class CensusControllerV3 {
})
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT AVG(a.score) as score,b.name FROM tb_resource_score a INNER JOIN tb_data_resource b on a.resource_id = b.id\n" +
"INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
"WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?))\n" +
"group by b.name order by score desc limit 5", ps);
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT SUM(IFNULL(e.score,0)) as score,c.name FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id\n" +
"INNER JOIN sys_dept d ON b.dept_id = d.id INNER JOIN tb_resource_score e ON a.reference_id = e.resource_id \n" +
"WHERE a.del_flag = 0 AND c.type = ? AND c.del_flag = 0 AND (d.id = ? OR INSTR(d.pids,?)) AND e.del_flag = 0\n" +
"group by c.name order by score desc limit 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
}

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,32 +37,42 @@ 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);
}
private List<CategoryDTO> getAllCategory(List<CategoryDTO> topCategory) {
List<CompletableFuture> tasks = new CopyOnWriteArrayList<>();
for (CategoryDTO categoryDto : topCategory) {
if (categoryDao.selectByParentId(categoryDto.getId()).isEmpty()) {
categoryDto.setIsLeaf("Y");
categoryDto.setChildren(new ArrayList());
} else {
ArrayList<CategoryDTO> list = new ArrayList<>();
categoryDao.selectByParentId(categoryDto.getId())
.forEach(item -> {
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
categoryDto.setIsLeaf("N");
categoryDto.setChildren(getAllCategory(list));
CompletableFuture task =
CompletableFuture.runAsync(() -> {
categoryDao.selectByParentId(categoryDto.getId())
.forEach(item -> {
CategoryDTO dto = new CategoryDTO();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
categoryDto.setIsLeaf("N");
categoryDto.setChildren(getAllCategory(list));
});
tasks.add(task);
}
}
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
return topCategory;
}
@ -77,7 +89,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 +99,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

@ -16,6 +16,7 @@ import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.common.utils.DateUtils;
import io.renren.modules.monitor.dto.CameraChannelDto1;
import io.renren.modules.monitor.entity.CameraChannel;
import io.renren.modules.monitor.mapper.CameraChannelMapper;
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
@ -551,6 +552,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
re.add(new HashMap<String, Object>() {
{
QueryWrapper<CameraChannel> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("check_status", 1)
.ne("gps_x", "")
.ne("gps_y", "")
.isNotNull("gps_x")
.isNotNull("gps_y");
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
put("type", "基础设施");
}
@ -904,7 +910,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
.eq("approve_status", "通过");
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
ArrayList cameraList = new ArrayList();
applicationEntities.forEach(index -> cameraList.add(cameraChannelMapper.selectByChannelCode(index.getCameraList())));
applicationEntities.forEach(index -> {
List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index.getCameraList().replaceAll("\"", ""));
if (!channelDto1s.isEmpty()) {
cameraList.add(channelDto1s.get(0));
}
});
return cameraList;
}
@ -1385,9 +1396,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//获取部门列表
List<Map<String, Object>> list = new ArrayList<>();
if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept");
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept");
} else {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
list = jdbcTemplate.queryForList("SELECT id as deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?)", ps);
}
if (list.size() > 0) {
@ -1397,31 +1408,32 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return new PageData<>(list, list.size());
}
//分别根据部门获取应用组件数和申请组件数
//分别根据部门获取组件使用总数和申请组件数
Map<String, Object> paraMap = new ConcurrentHashMap<>();
paraMap.put("resourceType", params.get("resourceType"));
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
paraMap.put("id", m.get("id"));
paraMap.put("id", m.get("deptId"));
Map<String, Object> maps1 = new HashMap<>();
maps1 = baseDao.assemblyCarByDept(paraMap);
if (maps1 == null) {
m.put("carNum", 0);
m.put("resourceCarNum", 0);
} else {
m.put("carNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
}
});
});
//这里的使用数应该就是调用数先用这个等查询调用数的接口开发完了再改2020/07/01 ytl
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> {
paraMap.put("id", m.get("id"));
paraMap.put("id", m.get("deptId"));
Map<String, Object> maps2 = new HashMap<>();
maps2 = baseDao.assemblyUseByDept(paraMap);
if (maps2 == null) {
m.put("useNum", 0);
m.put("resourceUseNum", 0);
} else {
m.put("useNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
m.put("resourceUseNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
}
});
});
@ -1444,9 +1456,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Object[] ps = {params.get("id"), params.get("id")};
List<Map<String, Object>> list = new ArrayList<>();
if (Long.parseLong(params.get("id").toString()) == 0) {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept ");
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept ");
} else {
list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
list = jdbcTemplate.queryForList("SELECT id AS deptId,name AS deptName FROM sys_dept WHERE id = ? OR INSTR(pids,?) ", ps);
}
if (list.size() > 0) {
@ -1459,7 +1471,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("resourceType", params.get("resourceType"));
result.forEach(r -> {
map.put("id", r.get("id"));
map.put("id", r.get("deptId"));
Map<String, Object> stringObjectMap = baseDao.assemblyCarByDept(map);
if (stringObjectMap != null) {
r.put("resourceCarNum", stringObjectMap.get("carNum"));
@ -1554,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

@ -73,11 +73,11 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
List<ResourceCollectionEntity> collectionEntities = resourceCollectionDao.selectByMap(selectMap);
if (collectionEntities.isEmpty()) {
resourceCollectionDao.insert(item);
CompletableFuture.runAsync(() -> {
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + item.getResourceId());
});
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + item.getResourceId());
}
});
}

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=")">

View File

@ -89,7 +89,8 @@
res.type,
res.del_flag AS "delFlag",
car.note1,
car.create_date AS "time"
car.create_date AS "time",
res.del_flag AS "delFlag"
FROM
tb_resource_car car,
tb_data_resource res