Commit 6ffcf0af authored by 赵啸非's avatar 赵啸非

修改人员学习

parent d150e0a6
......@@ -25,7 +25,7 @@
<profiles.server.port>17300</profiles.server.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/study</profiles.server.path>
<profiles.nacos.server-addr>192.168.0.48:8848</profiles.nacos.server-addr>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov-cs</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
......@@ -70,24 +70,6 @@
</properties>
</profile>
<profile>
<id>cs-prod</id>
<properties>
<profiles.active>cs-prod</profiles.active>
<profiles.server.port>17300</profiles.server.port>
<profiles.server.gatewayport>11078</profiles.server.gatewayport>
<profiles.server.path>/study</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.nacos.server-addr>nacos.scsmile.cn:80</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov-cs</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>INFO</profiles.log.level>
<package.environment>test</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>chuanshan-prod</id>
<properties>
......
......@@ -59,22 +59,33 @@ public class StudyStatServiceImpl extends AbstractCRUDServiceImpl<StudyStatDao,
}
}));
Map<String, Integer> map = new HashMap<>();
List<Map<String, Integer>> dayList = new ArrayList<>();
for (int i = 7; i > 0; i--) {
String beforeDay = DateUtil.offsetDay(new Date(), -i).toString();
Map<String, Integer> map = new HashMap<>();
String beforeDay = DateUtil.offsetDay(new Date(), -i).toDateStr();
if (collect.containsKey(beforeDay)) {
map.put(beforeDay, collect.getOrDefault(beforeDay, new ArrayList<>()).size());
} else {
map.put(beforeDay, 0);
}
dayList.add(map);
}
model.put("dayTrend", map);
model.put("dayList", dayList);
//首页统计。
//统计学些类型占比
List<ProjectEntity> projectEntities = projectService.find(new ProjectQuery());
Map<String, Long> studyTypeStat = projectEntities.stream().collect(Collectors.groupingBy(x -> ProjectTypeEnum.getByValue(x.getProjectType()).getDesc(), Collectors.counting()));
ProjectTypeEnum.getEnumMap().entrySet().forEach(item -> {
if (!studyTypeStat.containsKey(item.getValue())) {
studyTypeStat.put(item.getValue(), 0L);
}
});
model.put("studyTypeStat", studyTypeStat);
//学习量前
......@@ -85,11 +96,14 @@ public class StudyStatServiceImpl extends AbstractCRUDServiceImpl<StudyStatDao,
int count = projectStudyService.count(projectStudyQuery, context);
projectEntity.setStudyPersonCount(count);
}
List<ProjectEntity> leaderList = projectEntities.stream()
List<Map<String, String>> leaderList = projectEntities.stream()
.sorted(Comparator.comparing(ProjectEntity::getStudyPersonCount, Comparator.reverseOrder()))
.limit(5).collect(Collectors.toList());
.limit(5).map(item->{
Map<String, String> map = new HashMap<>();
map.put("title",item.getTitle());
map.put("count",item.getStudyPersonCount().toString());
return map;
}).collect(Collectors.toList());
model.put("leaderList", leaderList);
}
......
......@@ -50,7 +50,7 @@ public class StudyStatController extends BaseCRUDJsonBodyMappingController<Study
/**
* 首页统计
*/
@PostMapping(value = "index")
@GetMapping(value = "index")
@UnAuth
public String indexStat() {
JSONObject jsonObject = new JSONObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment