123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- package com.redxun.knowledge.analysis.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.redxun.common.annotation.ClassDefine;
- import com.redxun.common.base.entity.JsonPageResult;
- import com.redxun.common.base.entity.JsonResult;
- import com.redxun.common.base.entity.QueryData;
- import com.redxun.knowledge.analysis.entity.dto.DownloadDto;
- import com.redxun.knowledge.analysis.entity.dto.PersonVisitDto;
- import com.redxun.knowledge.analysis.entity.page.MyJsonResult;
- import com.redxun.knowledge.analysis.entity.vo.*;
- import com.redxun.knowledge.analysis.service.*;
- import com.redxun.knowledge.utils.DateUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.BindingResult;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletResponse;
- import javax.validation.Valid;
- import java.util.*;
- /**
- * 文件名: CommonController
- * 作者: zizg
- * 时间: 2023/3/17
- * 描述:
- * 修改人:
- * 修改时间:
- * 修改内容:
- */
- @Slf4j
- @RestController
- @RequestMapping("/api-knowledge/analysis")
- @Api(tags = "业务--系统页面访问量统计")
- @ClassDefine(title = "业务--系统页面访问量统计", alias = "CommonController", path = "/api-knowledge/analysis", packages = "analysis", packageName = "子系统名称")
- public class AnalysisCommonController {
- @Autowired
- private AnalysisCommonServiceImpl analysisCommonService;
- @Autowired
- private AnalysisAlbumServiceImpl analysisAlbumService;
- @Autowired
- private AnalysisMapServiceImpl analysisMapService;
- @Autowired
- private AnalysisSearchServiceImpl analysisSearchService;
- @Autowired
- private AnalysisSynthesizeServiceImpl analysisSynthesizeService;
- @Autowired
- private AnalysisDownloadService analysisDownloadService;
- @ApiOperation("PC 各模块整体数量统计")
- @GetMapping("totalAmount")
- public JsonResult totalAmount() {
- Map<String, Object> result = analysisCommonService.totalAmount();
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("PC 获取搜索服务访问量分布柱状图数据")
- @GetMapping("searchVisitHistogram")
- public JsonResult searchVisitHistogram() {
- SearchVisitHistogramVo searchVisitHistogramVo = analysisCommonService.searchVisitHistogram();
- return JsonResult.getSuccessResult(searchVisitHistogramVo);
- }
- @ApiOperation("PC 获取搜索服务分词的词云数据")
- @GetMapping("searchParticipleWordCloud")
- public JsonResult searchParticipleWordCloud(@RequestParam(value = "tops", required = false, defaultValue = "100") Integer tops) {
- List<SearchParticipleWordCloudVo> result = analysisCommonService.searchParticipleWordCloud(tops);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("PC 查询各类型(维基、文档)知识数量")
- @GetMapping("knowledgeTypeAmount")
- public JsonResult knowledgeTypeAmount() {
- Map<String, Object> result = analysisCommonService.knowledgeTypeAmount();
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("知识类型访问量分布")
- @GetMapping("knowledgeTypeVisitProportion")
- public JsonResult knowledgeTypeVisitProportion(@RequestParam("type") String type) {
- Map<String, Object> result = analysisCommonService.knowledgeTypeVisitProportion(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("各一级分类知识创建数量")
- @GetMapping("level1KnowledgeHistogram")
- public JsonResult level1KnowledgeHistogram(@RequestParam("type") String type,
- @RequestParam(value = "sort", required = false) String sort) {
- List<KnowledgeCategoryVo> knowledgeCategoryVoList = analysisCommonService.level1KnowledgeHistogram(type, sort);
- return JsonResult.getSuccessResult(knowledgeCategoryVoList);
- }
- @ApiOperation("组织创建知识数量")
- @PostMapping("organizationKnowledges")
- public JsonPageResult organizationKnowledges(@RequestBody QueryData queryData) {
- JsonPageResult jsonResult = JsonPageResult.getSuccess("");
- IPage knowledgeCompanyVoList = analysisCommonService.organizationKnowledges(queryData);
- jsonResult.setPageData(knowledgeCompanyVoList);
- return jsonResult;
- }
- @ApiOperation("组织创建知识数量(新)")
- @GetMapping("organizationKnowledge")
- public JsonResult organizationKnowledge(@RequestParam(value = "type",required = false) String type,
- @RequestParam("organizationId") String organizationId,
- @RequestParam(value = "createTime",required = false) String createTime,
- @RequestParam(value = "endTime",required = false) String endTime) {
- KnowledgeCompanyVo result = analysisCommonService.organizationKnowledge(type, organizationId,createTime,endTime);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("人员创建知识数量")
- @PostMapping("personKnowledge")
- public JsonResult personKnowledge(@RequestBody @Valid PersonVisitDto personVisitDto,BindingResult validResult) {
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- if (validResult.hasErrors()) {
- return jsonResult.setMessage("组织Id不能为空");
- }
- List<KnowledgeCompanyVo> result = analysisCommonService.personKnowledge(personVisitDto);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("专辑创建总量")
- @GetMapping("albumAmount")
- public JsonResult albumAmount(@RequestParam("type") String type) {
- CreateCountTotal result = analysisAlbumService.albumAmount(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("专辑详情Top访问量(pv)统计")
- @GetMapping("albumDetailVisits")
- public JsonResult albumDetailVisits(@RequestParam("type") String type,
- @RequestParam(value = "tops", required = false, defaultValue = "10") Integer tops) {
- List<AlbumDetailVisitsVo> result = analysisAlbumService.albumDetailVisits(type, tops);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("各一级分类专辑创建数量")
- @GetMapping("level1AlbumHistogram")
- public JsonResult level1AlbumHistogram(@RequestParam("type") String type,
- @RequestParam(value = "sort", required = false) String sort) {
- List<AlbumCategoryVo> result = analysisAlbumService.level1AlbumHistogram(type, sort);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("组织创建和访问专辑数量")
- @PostMapping("organizationAlbums")
- public JsonPageResult organizationAlbums(@RequestBody QueryData queryData) {
- JsonPageResult jsonResult = JsonPageResult.getSuccess("");
- IPage result = analysisAlbumService.organizationAlbums(queryData);
- jsonResult.setPageData(result);
- return jsonResult;
- }
- @ApiOperation("组织创建和访问专辑数量(新)")
- @GetMapping("organizationAlbum")
- public JsonResult organizationAlbum(@RequestParam(value = "type",required = false) String type,
- @RequestParam("organizationId") String organizationId,
- @RequestParam(value = "createTime",required = false) String createTime,
- @RequestParam(value = "endTime",required = false) String endTime) {
- AlbumCompanyVo result = analysisAlbumService.organizationAlbum(type, organizationId,createTime,endTime);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("人员创建和访问专辑数量")
- @PostMapping("personAlbum")
- public JsonResult personAlbum(@RequestBody @Valid PersonVisitDto personVisitDto,BindingResult validResult) {
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- if (validResult.hasErrors()) {
- return jsonResult.setMessage("组织Id不能为空");
- }
- List<AlbumCompanyVo> result = analysisAlbumService.personAlbum(personVisitDto);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("地图创建总量")
- @GetMapping("mapAmount")
- public JsonResult mapAmount(@RequestParam("type") String type) {
- CreateCountTotal result = analysisMapService.mapAmount(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("各类型地图创建数量")
- @GetMapping("typeMapPie")
- public JsonResult typeMapPie(@RequestParam("type") String type) {
- List<MapTypeCountVo> result = analysisMapService.typeMapPie(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("地图页面访问量")
- @GetMapping("mapPageHistogram")
- public JsonResult mapPageHistogram(@RequestParam("type") String type) {
- List<MapPagePvVo> result = analysisMapService.mapPageHistogram(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("组织创建和访问地图数量")
- @PostMapping("organizationMaps")
- public JsonPageResult organizationMaps(@RequestBody QueryData queryData) {
- JsonPageResult jsonResult = JsonPageResult.getSuccess("");
- IPage result = analysisMapService.organizationMaps(queryData);
- jsonResult.setPageData(result);
- return jsonResult;
- }
- @ApiOperation("组织创建和访问地图数量(新)")
- @GetMapping("organizationMap")
- public JsonResult organizationMap(@RequestParam(value = "type",required = false) String type,
- @RequestParam("organizationId") String organizationId,
- @RequestParam(value = "createTime",required = false) String createTime,
- @RequestParam(value = "endTime",required = false) String endTime) {
- MapCompanyVo result = analysisMapService.organizationMap(type, organizationId,createTime,endTime);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("人员创建和访问地图数量")
- @PostMapping("personMap")
- public JsonResult personMap(@RequestBody @Valid PersonVisitDto personVisitDto,BindingResult validResult) {
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- if (validResult.hasErrors()) {
- return jsonResult.setMessage("组织Id不能为空");
- }
- List<MapCompanyVo> result = analysisMapService.personMap(personVisitDto);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("各业务系统分布")
- @GetMapping("searchSystemDetailVisits")
- public JsonResult searchSystemDetailVisits(@RequestParam("type") String type) {
- List<SystemDetailVisitsVo> result = analysisSearchService.searchSystemDetailVisits(type);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("组织访问量")
- @PostMapping("organizationSearchs")
- public JsonPageResult organizationSearchs(@RequestBody QueryData queryData) {
- JsonPageResult jsonResult = JsonPageResult.getSuccess("");
- Map<String, List> result = analysisSearchService.organizationSearchs(queryData);
- MyJsonResult myJsonResult = new MyJsonResult(result.get("rows"), result.get("columns"));
- jsonResult.setResult(myJsonResult);
- return jsonResult;
- }
- @ApiOperation("组织访问量(新)")
- @GetMapping("organizationSearch")
- public JsonResult organizationSearch(@RequestParam(value = "type",required = false) String type,
- @RequestParam("organizationId") String organizationId,
- @RequestParam(value = "createTime",required = false) String createTime,
- @RequestParam(value = "endTime",required = false) String endTime) {
- OrganizationSearchVo result = analysisSearchService.organizationSearch(type, organizationId,createTime,endTime);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("人员访问量")
- @PostMapping("personSearch")
- public JsonResult personSearch(@RequestBody @Valid PersonVisitDto personVisitDto,BindingResult validResult) {
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- if (validResult.hasErrors()) {
- return jsonResult.setMessage("组织Id不能为空");
- }
- List<OrganizationSearchVo> result = analysisSearchService.personSearch(personVisitDto);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("用户访问总量")
- @GetMapping("totalUserVisits")
- public JsonResult totalUserVisits(@RequestParam("module") String module,
- @RequestParam("type") String type) {
- CreateUserView createUserView = analysisSynthesizeService.totalUserVisits(module, type);
- return JsonResult.getSuccessResult(createUserView);
- }
- @ApiOperation("各板块访问量分布")
- @GetMapping("moduleUserVisits")
- public JsonResult moduleUserVisits(@RequestParam("type") String type) {
- Map<String, Object> map = analysisSynthesizeService.moduleUserVisits(type);
- return JsonResult.getSuccessResult(map);
- }
- @ApiOperation("各板块访问量分布(UV)")
- @GetMapping("moduleUserUniqueVisits")
- public JsonResult moduleUserUniqueVisits(@RequestParam("type") String type) {
- Map<String, Object> map = analysisSynthesizeService.moduleUserUniqueVisits(type);
- return JsonResult.getSuccessResult(map);
- }
- @ApiOperation("组织访问量")
- @PostMapping("organizationVisits")
- public JsonPageResult organizationVisits(@RequestBody QueryData queryData) {
- JsonPageResult jsonResult = JsonPageResult.getSuccess("");
- IPage result = analysisSynthesizeService.organizationVisits(queryData);
- jsonResult.setPageData(result);
- return jsonResult;
- }
- @ApiOperation("组织访问量(新)")
- @GetMapping("organizationVisit")
- public JsonResult organizationVisit(@RequestParam(value = "type",required = false) String type,
- @RequestParam("organizationId") String organizationId,
- @RequestParam(value = "createTime",required = false) String createTime,
- @RequestParam(value = "endTime",required = false) String endTime) {
- SynthesizeCompanyVo result = analysisSynthesizeService.organizationVisit(type, organizationId,createTime,endTime);
- return JsonResult.getSuccessResult(result);
- }
- @ApiOperation("人员访问量")
- @PostMapping("personVisit")
- public JsonResult personVisit(@RequestBody @Valid PersonVisitDto personVisitDto, BindingResult validResult) {
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- if (validResult.hasErrors()) {
- return jsonResult.setMessage("组织Id不能为空");
- }
- List<SynthesizeCompanyVo> result = analysisSynthesizeService.personVisit(personVisitDto);
- return jsonResult.setData(result);
- }
- @ApiOperation("人员模版导出")
- @PostMapping("download")
- public void download(@RequestBody @Valid DownloadDto downloadDto, BindingResult bindingResult, HttpServletResponse httpServletResponse){
- if (bindingResult.hasErrors()){
- throw new RuntimeException(bindingResult.toString());
- }
- analysisDownloadService.download(downloadDto,httpServletResponse);
- }
- @ApiOperation("展示员工的知识上传数和专辑评论数")
- @GetMapping("knowledgeSumAndYelpSumByUserId")
- public JsonResult knowledgeSumAndYelpSumByUserId(@RequestParam(value = "beginTime",required = false) String beginTime,
- @RequestParam(value = "endTime",required = false) String endTime,
- @RequestParam(value = "userId",required = false) String userId){
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- Map<String,Object> result = analysisCommonService.knowledgeSumAndYelpSumByLogin(beginTime,endTime,userId);
- return jsonResult.setData(result);
- }
- @ApiOperation("展示员工知识上传数和专辑评论数列表")
- @GetMapping("knowledgeSumAndYelpSumList")
- public JsonResult knowledgeSumAndYelpSumList(@RequestParam(value = "beginTime",required = false) String beginTime,
- @RequestParam(value = "endTime",required = false) String endTime,
- @RequestParam(value = "type") Integer type){
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- List<KnowledgeSumAndYelpSumListVo> result = analysisCommonService.knowledgeSumAndYelpSumList(type,beginTime,endTime);
- return jsonResult.setData(result);
- }
- @ApiOperation("员工行为页面返回左上角时间")
- @GetMapping("getRoundTime")
- public JsonResult getRoundTime(){
- JsonResult jsonResult = JsonResult.getSuccessResult("");
- Map<String,Object> result = new HashMap<>();
- //获取当前年
- Calendar calendar = Calendar.getInstance();
- int year = calendar.get(Calendar.YEAR);
- result.put("beginTime",DateUtils.format(DateUtils.getFirstOfYearByUser(year)));
- result.put("endTime",DateUtils.format(new Date()));
- return jsonResult.setData(result);
- }
- }
|