项目初始化
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.jeesite.modules.apps.Module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class NoteInfo implements Serializable {
|
||||
private String key;
|
||||
private String label;
|
||||
private Long value01;
|
||||
private Long value02;
|
||||
|
||||
public NoteInfo(){}
|
||||
|
||||
public NoteInfo(String key,String label,Long value01,Long value02){
|
||||
this.key = key;
|
||||
this.label = label;
|
||||
this.value01 = value01;
|
||||
this.value02 = value02;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/sys/analysis")
|
||||
@RequestMapping(value = "${adminPath}/desktop/analysis")
|
||||
public class SysAnalysisController {
|
||||
|
||||
@RequestMapping(value = "getHostInfo")
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.jeesite.modules.apps.web;
|
||||
|
||||
import com.jeesite.modules.apps.Module.ChartDataItem;
|
||||
import com.jeesite.modules.apps.Module.NoteInfo;
|
||||
import com.jeesite.modules.biz.entity.MyNotes;
|
||||
import com.jeesite.modules.biz.service.MyNotesService;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import com.jeesite.modules.utils.DateUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/desktop/workbench")
|
||||
public class SysWorkbenchController {
|
||||
|
||||
@Resource
|
||||
private MyNotesService myNotesService;
|
||||
|
||||
@RequestMapping(value = "getNoteInfo")
|
||||
@ResponseBody
|
||||
public List<NoteInfo> getNoteInfo() {
|
||||
List<NoteInfo> noteInfos = new ArrayList<>();
|
||||
List<DictData> dictDataList = DictUtils.getDictList("note_type");
|
||||
List<MyNotes> myNotesList = myNotesService.findList(new MyNotes());
|
||||
Map<String, Long> totalMap = myNotesList.stream()
|
||||
.collect(Collectors.groupingBy(MyNotes::getType, Collectors.counting()));
|
||||
Map<String, Long> ustatusMap = myNotesList.stream()
|
||||
.filter(note -> note.getUstatus().equals("done"))
|
||||
.collect(Collectors.groupingBy(MyNotes::getType, Collectors.counting()));
|
||||
for (DictData dict : dictDataList) {
|
||||
String type = dict.getDictValue();
|
||||
Long value01 = totalMap.getOrDefault(type, 0L);
|
||||
Long value02 = ustatusMap.getOrDefault(type, 0L);
|
||||
noteInfos.add(new NoteInfo(dict.getDictValue(), dict.getDictLabel(), value01, value02));
|
||||
}
|
||||
return noteInfos;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "getNoteChart")
|
||||
@ResponseBody
|
||||
public List<ChartDataItem> getNoteChart(MyNotes myNotes) {
|
||||
List<MyNotes> myNotesList = myNotesService.findList(myNotes);
|
||||
Map<String, ChartDataItem> chartDataMap = myNotesList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
note -> Optional.of(DateUtils.getMonth(note.getCreateTime())).orElse(""),
|
||||
Collectors.collectingAndThen(Collectors.toList(), list -> {
|
||||
String month = list.stream()
|
||||
.findFirst()
|
||||
.map(MyNotes::getCreateTime)
|
||||
.map(DateUtils::getMonth)
|
||||
.orElse("");
|
||||
Long todoCount = list.stream().filter(n -> n.getUstatus().equals("todo")).count();
|
||||
Long doingCount = list.stream().filter(n -> n.getUstatus().equals("doing")).count();
|
||||
Long doneCount = list.stream().filter(n -> n.getUstatus().equals("done")).count();
|
||||
ChartDataItem item = new ChartDataItem();
|
||||
item.setAxisName(month);
|
||||
item.setValue01(String.valueOf(todoCount));
|
||||
item.setValue02(String.valueOf(doingCount));
|
||||
item.setValue03(String.valueOf(doneCount));
|
||||
return item;
|
||||
})
|
||||
));
|
||||
return chartDataMap.values().stream()
|
||||
.sorted(Comparator.comparing(ChartDataItem::getAxisName))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user