Merge branch 'master' of http://47.92.168.204:3000/VoRDM/vordm-backend
This commit is contained in:
commit
78d40da6b8
|
@ -11,6 +11,6 @@ import org.springframework.cloud.client.SpringCloudApplication;
|
|||
@SpringCloudApplication
|
||||
public class VoRdmApplication {
|
||||
public static void main(String[] args) {
|
||||
BladeApplication.run("gljNew-"+CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args);
|
||||
BladeApplication.run(CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,8 +362,8 @@ public class DisasterInfoController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/statistics")
|
||||
public R statistics() {
|
||||
return R.data(disasterInfoService.statistics());
|
||||
public R statistics(String year) {
|
||||
return R.data(disasterInfoService.statistics(year));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,4 +68,16 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
|
|||
List<Map<String, Object>> getDisasterInfoByMouth(@Param("start") String start,@Param("end") String end,@Param("type") Integer type,@Param("chiefId") Long chiefId);
|
||||
|
||||
void updataUserByEmail(@Param("email") String email,@Param("password") String password);
|
||||
|
||||
List<DisasterInfo> listGetByYear(String year);
|
||||
|
||||
List<Map<String, Long>> visitAndDownLoad(String year);
|
||||
|
||||
List<Map<String, Long>> initiateAndResponseData(String year);
|
||||
|
||||
List<Map<String, Long>> chiefData(String year);
|
||||
|
||||
List<Map<String, Long>> adminData(String year);
|
||||
|
||||
List<Map<String, Long>> disasterNum(String year);
|
||||
}
|
||||
|
|
|
@ -272,5 +272,105 @@
|
|||
</if>
|
||||
GROUP BY date
|
||||
</select>
|
||||
<select id="listGetByYear" resultType="com.kening.vordm.entity.DisasterInfo">
|
||||
select * from disaster_info t where date_format(t.disaster_time,'%Y') = #{year}
|
||||
</select>
|
||||
<select id="visitAndDownLoad" resultType="java.util.Map">
|
||||
SELECT d.dict_value, SUM(t.visit_count) as visit, SUM(t.download_count) as download FROM disaster_info t INNER JOIN blade_dict_biz d on t.disaster_type = d.dict_key
|
||||
where date_format(t.disaster_time,'%Y') = #{year} GROUP BY d.dict_value
|
||||
</select>
|
||||
<select id="initiateAndResponseData" resultType="java.util.Map">
|
||||
select d.`key`, sum(d.response) as response, SUM(d.initiate) as initiate from (
|
||||
SELECT CONCAT(#{year},'-01' ) as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-01')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-02' ) as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-02')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-03' ) as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-03')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-04' ) as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-04' )
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-05') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-05' )
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-06') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-06')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-07') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-07')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-08') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-08')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-09') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-09')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-10') as `key` , 0 as response,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-10')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-11') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-11')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-12') as `key`, 0 as response ,count(1) as initiate FROM disaster_info t
|
||||
where date_format(t.disaster_time,'%Y-%m') = CONCAT(#{year},'-12')
|
||||
union ALL
|
||||
|
||||
|
||||
SELECT CONCAT(#{year},'-01') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-01')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-02') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-02')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-03') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-03')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-04') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-04')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-05') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-05')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-06') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-06')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-07') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-07')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-08') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-08')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-09') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-09')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-10') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-10')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-11') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-11')
|
||||
union ALL
|
||||
SELECT CONCAT(#{year},'-12') as `key`, count(1) as response ,0 as initiate FROM disaster_info t
|
||||
where date_format(t.respond_time,'%Y-%m') = CONCAT(#{year},'-12') ) d
|
||||
GROUP BY d.`key` ORDER BY d.`key`
|
||||
|
||||
|
||||
</select>
|
||||
<select id="chiefData" resultType="java.util.Map">
|
||||
SELECT b.`name`, count(*) as val FROM disaster_info t INNER JOIN blade_user b on t.chief_id = b.id
|
||||
where date_format(t.disaster_time,'%Y') = #{year} GROUP BY b.`name` ORDER BY val desc limit 10
|
||||
</select>
|
||||
<select id="adminData" resultType="java.util.Map">
|
||||
SELECT b.`name`, count(*) as val FROM guest_manage_disaster_ref t INNER JOIN blade_user b on t.manager_id = b.id INNER JOIN disaster_info d on d.id = t.disaster_id
|
||||
where date_format(d.disaster_time,'%Y') = #{year} and b.role_id = '1123598816738675202' GROUP BY b.`name` ORDER BY val desc limit 10
|
||||
</select>
|
||||
<select id="disasterNum" resultType="java.util.Map">
|
||||
SELECT d.dict_value as `name`, count(1) as val FROM disaster_info t INNER JOIN blade_dict_biz d on t.disaster_type = d.dict_key
|
||||
where date_format(t.disaster_time,'%Y') = #{year} GROUP BY d.dict_value
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -61,7 +61,7 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
|
|||
* 后台管理系统-控制台灾害各项统计
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> statistics();
|
||||
Map<String,Object> statistics(String year);
|
||||
|
||||
boolean removeManage(List<DisasterInfo> disasterInfoList);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -241,29 +242,70 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> statistics() {
|
||||
public Map<String, Object> statistics(String year) {
|
||||
Map<String,Object> resultMap = Maps.newHashMap();
|
||||
boolean isAdmin = AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? true : false;
|
||||
//boolean isAdmin = AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? true : false;
|
||||
//查询灾害表数据
|
||||
List<DisasterInfo> disasterInfoList = isAdmin ? list():list(Wrappers.<DisasterInfo>lambdaQuery().eq(DisasterInfo::getChiefId,AuthUtil.getUserId()));
|
||||
List<DisasterInfo> disasterInfoList = this.baseMapper.listGetByYear(year);
|
||||
//统计head头部的数据
|
||||
Map<String,Object> headMap = headData(disasterInfoList);
|
||||
//访问量和下载量
|
||||
List<Map<String,Long>> visitAndDownLoadData = this.baseMapper.visitAndDownLoad(year);
|
||||
//响应量和发起量
|
||||
List<Map<String,Long>> initiateAndResponseData = this.baseMapper.initiateAndResponseData(year);
|
||||
//统计灾害发生区域占比
|
||||
Map<String,Long> countryData = disasterCountryProportion(disasterInfoList);
|
||||
//统计当年的灾害申请次数 按月查询
|
||||
List<Map<String,Object>> applyMonth = getDisasterReponseByMouth(1,isAdmin);
|
||||
//统计灾害数量占比
|
||||
Map<String,Long> disasterNum = disasterNumProportion(isAdmin);
|
||||
//List<Map<String,Object>> applyMonth = getDisasterReponseByMouth(1,isAdmin);
|
||||
//统计灾害数量占比 那个饼图
|
||||
List<Map<String,Long>> disasterNum = this.baseMapper.disasterNum(year);
|
||||
//统计chief
|
||||
List<Map<String,Long>> chiefMap = this.baseMapper.chiefData(year);
|
||||
//统计admin
|
||||
List<Map<String,Long>> adminfMap = this.baseMapper.adminData(year);
|
||||
//统计当年的灾害响应次数 按月查询
|
||||
List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin);
|
||||
//List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin);
|
||||
resultMap.put("header",headMap);
|
||||
//响应量
|
||||
resultMap.put("line",initiateAndResponseData);
|
||||
//下载量
|
||||
resultMap.put("vandd",visitAndDownLoadData);
|
||||
//admin
|
||||
resultMap.put("admin",adminfMap);
|
||||
//chief
|
||||
resultMap.put("chief",chiefMap);
|
||||
//国家
|
||||
resultMap.put("country",countryData);
|
||||
//灾害类型分类
|
||||
resultMap.put("disasterNum",disasterNum);
|
||||
resultMap.put("responseMonth",responseMonth);
|
||||
resultMap.put("applyMonth",applyMonth);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public Map<String, Object> statistics(String year) {
|
||||
// Map<String,Object> resultMap = Maps.newHashMap();
|
||||
// boolean isAdmin = AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? true : false;
|
||||
// //查询灾害表数据
|
||||
// List<DisasterInfo> disasterInfoList = isAdmin ? list():list(Wrappers.<DisasterInfo>lambdaQuery().eq(DisasterInfo::getChiefId,AuthUtil.getUserId()));
|
||||
// //统计head头部的数据
|
||||
// Map<String,Object> headMap = headData(disasterInfoList);
|
||||
// //统计灾害发生区域占比
|
||||
// Map<String,Long> countryData = disasterCountryProportion(disasterInfoList);
|
||||
// //统计当年的灾害申请次数 按月查询
|
||||
// List<Map<String,Object>> applyMonth = getDisasterReponseByMouth(1,isAdmin);
|
||||
// //统计灾害数量占比
|
||||
// Map<String,Long> disasterNum = disasterNumProportion(isAdmin);
|
||||
// //统计当年的灾害响应次数 按月查询
|
||||
// List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin);
|
||||
// resultMap.put("header",headMap);
|
||||
// resultMap.put("country",countryData);
|
||||
// resultMap.put("disasterNum",disasterNum);
|
||||
// resultMap.put("responseMonth",responseMonth);
|
||||
// resultMap.put("applyMonth",applyMonth);
|
||||
// return resultMap;
|
||||
// }
|
||||
/**
|
||||
* 统计head头部信息
|
||||
* @return
|
||||
|
@ -291,9 +333,12 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
|
|||
* @return
|
||||
*/
|
||||
private Map<String,Long> disasterCountryProportion(List<DisasterInfo> disasterInfoList){
|
||||
Map<String,Long> proportionMap;
|
||||
Map<String,Long> proportionMap = new LinkedHashMap<>();
|
||||
//根据国家分组统计次数以及总灾害的占比
|
||||
proportionMap = disasterInfoList.stream().filter(data->data.getDisasterCountry()!=null).collect(Collectors.groupingBy(DisasterInfo::getDisasterCountry,Collectors.counting()));
|
||||
disasterInfoList.stream().filter(data->
|
||||
data.getDisasterCountry()!=null
|
||||
).collect(Collectors.groupingBy(DisasterInfo::getDisasterCountry,Collectors.counting()))
|
||||
.entrySet().stream().sorted(Map.Entry.<String,Long>comparingByValue().reversed()).limit(15).forEachOrdered(e -> proportionMap.put(e.getKey(), e.getValue()));
|
||||
return proportionMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<modules>
|
||||
<module>biz-vordm</module>
|
||||
<module>vordm-crawl</module>
|
||||
<module>vordm-twitter</module>
|
||||
<!-- <module>kn-setting</module>-->
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM bladex/alpine-java:openjdk8-openj9_cn_slim
|
||||
|
||||
LABEL maintainer=whq<460794335@qq.com>
|
||||
|
||||
RUN mkdir -p /kn/vordm
|
||||
|
||||
WORKDIR /kn/vordm
|
||||
|
||||
EXPOSE 8980
|
||||
|
||||
ADD ./target/vordm-twitter.jar ./app.jar
|
||||
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
||||
|
||||
CMD ["--spring.profiles.active=test"]
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>kn-service</artifactId>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>vordm-twitter</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<artifactId>kn-launcher</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>wildfly-common</artifactId>
|
||||
<groupId>org.wildfly.common</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itmuch</groupId>
|
||||
<artifactId>spring-cloud-wii</artifactId>
|
||||
<version>2.2.6.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
<!--Hystrix-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.kening.crawl.twitter;
|
||||
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@SpringCloudApplication
|
||||
@ComponentScan({"org.springblade", "com.kening.crawl.twitter"})
|
||||
public class TwitterApplication {
|
||||
public static void main(String[] args) {
|
||||
BladeApplication.run("vordm-twitter", TwitterApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
server:
|
||||
port: 8980
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
loadbalancer:
|
||||
retry:
|
||||
enabled: true
|
Loading…
Reference in New Issue