release-v1.0 #1
@ -110,4 +110,14 @@ public class DocumentController extends BaseController
|
|||||||
{
|
{
|
||||||
return toAjax(documentService.pushDoc(ids));
|
return toAjax(documentService.pushDoc(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档统计,涉及文档类别统计、文档来源统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/statistics")
|
||||||
|
public AjaxResult statistics()
|
||||||
|
{
|
||||||
|
return AjaxResult.success(documentService.statistics());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.rzdata.web.mapper;
|
|||||||
import com.rzdata.web.domain.Document;
|
import com.rzdata.web.domain.Document;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Mapper接口
|
* 【请填写功能名称】Mapper接口
|
||||||
@ -63,4 +64,8 @@ public interface DocumentMapper
|
|||||||
public int updatePushDoc(Document doc);
|
public int updatePushDoc(Document doc);
|
||||||
|
|
||||||
public int batchDeleteById(List<String> list);
|
public int batchDeleteById(List<String> list);
|
||||||
|
|
||||||
|
List<Map<String, Object>> countType();
|
||||||
|
|
||||||
|
List<Map<String, Object>> countSource();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.rzdata.web.service;
|
|||||||
import com.rzdata.web.domain.Document;
|
import com.rzdata.web.domain.Document;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service接口
|
* 【请填写功能名称】Service接口
|
||||||
@ -74,4 +75,6 @@ public interface IDocumentService
|
|||||||
int pushDoc(String[] ids);
|
int pushDoc(String[] ids);
|
||||||
|
|
||||||
public int batchDeleteById(List<String> docIds);
|
public int batchDeleteById(List<String> docIds);
|
||||||
|
|
||||||
|
Map<String, Object> statistics();
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,10 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.rzdata.common.constant.Constants;
|
import com.rzdata.common.constant.Constants;
|
||||||
|
import com.rzdata.common.core.domain.entity.SysDictData;
|
||||||
import com.rzdata.common.utils.DateUtils;
|
import com.rzdata.common.utils.DateUtils;
|
||||||
import com.rzdata.common.utils.SecurityUtils;
|
import com.rzdata.common.utils.SecurityUtils;
|
||||||
|
import com.rzdata.system.service.ISysDictTypeService;
|
||||||
import com.rzdata.web.domain.Attachment;
|
import com.rzdata.web.domain.Attachment;
|
||||||
import com.rzdata.web.domain.Document;
|
import com.rzdata.web.domain.Document;
|
||||||
import com.rzdata.web.domain.Tool;
|
import com.rzdata.web.domain.Tool;
|
||||||
@ -16,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,6 +37,9 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ToolServiceImpl toolService;
|
private ToolServiceImpl toolService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDictTypeService sysDictTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
*
|
*
|
||||||
@ -236,5 +239,45 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
public int batchDeleteById(List<String> docIds){
|
public int batchDeleteById(List<String> docIds){
|
||||||
return documentMapper.batchDeleteById(docIds);
|
return documentMapper.batchDeleteById(docIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> statistics() {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
List<Map<String, Object>> countType = this.documentMapper.countType();
|
||||||
|
List<Map<String, Object>> countSource = this.documentMapper.countSource();
|
||||||
|
//组织数据
|
||||||
|
assembleData(countType, countSource);
|
||||||
|
result.put("countType", countType);
|
||||||
|
result.put("countSource", countSource);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assembleData(List<Map<String, Object>> countType, List<Map<String, Object>> countSource) {
|
||||||
|
//
|
||||||
|
List<SysDictData> toolTypeList = sysDictTypeService.selectDictDataByType("doc_class");
|
||||||
|
List<SysDictData> toolSourceList = sysDictTypeService.selectDictDataByType("doc_source");
|
||||||
|
if(CollUtil.isNotEmpty(countType)){
|
||||||
|
for (Map<String, Object> map : countType) {
|
||||||
|
map.put("value", map.get("statistics"));
|
||||||
|
for (SysDictData sysDictData : toolTypeList) {
|
||||||
|
if(sysDictData.getDictValue().equals(map.get("types"))){
|
||||||
|
map.put("name", sysDictData.getDictLabel());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(countSource)){
|
||||||
|
for (Map<String, Object> map : countSource) {
|
||||||
|
map.put("value", map.get("statistics"));
|
||||||
|
for (SysDictData sysDictData : toolSourceList) {
|
||||||
|
if(sysDictData.getDictValue().equals(map.get("types"))){
|
||||||
|
map.put("name", sysDictData.getDictLabel());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,4 +163,14 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!-- 文档类型统计-->
|
||||||
|
<select id="countType" resultType="java.util.Map">
|
||||||
|
select t.doc_type as types, sum(1) as statistics from t_document t where t.is_deleted = '0' group by t.doc_type;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 文档来源统计-->
|
||||||
|
<select id="countSource" resultType="java.util.Map">
|
||||||
|
select t.doc_source as types, sum(1) as statistics from t_document t where t.is_deleted = '0' group by t.doc_source;
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user