首页统计功能
新增pom引入包(mongo,redis等)
This commit is contained in:
parent
2d678c1998
commit
4da2c35574
33
pom.xml
33
pom.xml
@ -109,6 +109,39 @@
|
||||
<artifactId>login-oauth2-client</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>redis-cache</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ink.wgink</groupId>
|
||||
<artifactId>mongo-module-dictionary</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mongodb start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<!-- mongodb end -->
|
||||
|
||||
<!-- redis start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- redis end -->
|
||||
|
||||
<!-- session share start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- session share end -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -0,0 +1,65 @@
|
||||
package cn.com.tenlion.systemhouse.controller.api.statistics;
|
||||
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.houseusersub.HouseUserSubDTO;
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.statistics.StatisticsDTO;
|
||||
import cn.com.tenlion.systemhouse.service.houseusersub.IHouseUserSubService;
|
||||
import cn.com.tenlion.systemhouse.service.statistics.IStatisticsService;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: StatisticsController
|
||||
* @Description: 统计
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-09-24 17:03:54
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "统计接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/statistics")
|
||||
public class StatisticsController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IStatisticsService statisticsService;
|
||||
|
||||
@ApiOperation(value = "房屋系统总体数据", notes = "房屋系统总体数据接口")
|
||||
@ApiImplicitParams({})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("house_sys_info")
|
||||
public List<StatisticsDTO> houseSysInfo() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return statisticsService.houseSysInfo(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "小区类型", notes = "小区类型接口")
|
||||
@ApiImplicitParams({})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("estate_info")
|
||||
public List<StatisticsDTO> estateInfo() {
|
||||
return statisticsService.estateInfo();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "楼宇类型", notes = "楼宇类型接口")
|
||||
@ApiImplicitParams({})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("building_info")
|
||||
public List<StatisticsDTO> buildingInfo() {
|
||||
return statisticsService.buildingInfo();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "房屋类型", notes = "房屋类型接口")
|
||||
@ApiImplicitParams({})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("house_info")
|
||||
public List<StatisticsDTO> houseInfo() {
|
||||
return statisticsService.houseInfo();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.com.tenlion.systemhouse.dao.statistics;
|
||||
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.statistics.StatisticsDTO;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IStatisticsDao
|
||||
* @Description: 统计
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-11-22 15:31:23
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IStatisticsDao {
|
||||
|
||||
/**
|
||||
* 小区数量
|
||||
* @return
|
||||
*/
|
||||
Integer residentialCount(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 楼宇数量
|
||||
* @return
|
||||
*/
|
||||
Integer buildingCount(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 房屋数量
|
||||
* @return
|
||||
*/
|
||||
Integer houseCount(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 社区数量
|
||||
* @return
|
||||
*/
|
||||
Integer communityCount(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 小区类型
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> estateInfo(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 楼宇类型
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> buildingInfo(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 房屋类型
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> houseInfo(Map<String, Object> params);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.com.tenlion.systemhouse.pojo.dtos.statistics;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: StatisticsDTO
|
||||
* @Description: 统计专用
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-09-17 14:43:53
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class StatisticsDTO {
|
||||
|
||||
@ApiModelProperty(name = "dataType", value = "数据类型")
|
||||
private String dataType;
|
||||
@ApiModelProperty(name = "count", value = "数量")
|
||||
private String count;
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(String count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.com.tenlion.systemhouse.service.statistics;
|
||||
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.statistics.StatisticsDTO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IResidentialIntroductionService
|
||||
* @Description: 小区简介
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-11-22 15:31:23
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public interface IStatisticsService {
|
||||
|
||||
/**
|
||||
* 房屋系统总体数据
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> houseSysInfo(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 小区数量
|
||||
* @return
|
||||
*/
|
||||
Integer residentialCount(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 楼宇数量
|
||||
* @return
|
||||
*/
|
||||
Integer buildingCount(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 房屋数量
|
||||
* @return
|
||||
*/
|
||||
Integer houseCount(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 出租房数量
|
||||
* @return
|
||||
*/
|
||||
Integer rentalHousingCount(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 社区数量
|
||||
* @return
|
||||
*/
|
||||
Integer communityCount(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 小区类型
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> estateInfo();
|
||||
|
||||
/**
|
||||
* 楼宇类型
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> buildingInfo();
|
||||
|
||||
/**
|
||||
* 房屋类型
|
||||
* @return
|
||||
*/
|
||||
List<StatisticsDTO> houseInfo();
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package cn.com.tenlion.systemhouse.service.statistics.impl;
|
||||
|
||||
|
||||
import cn.com.tenlion.systemhouse.dao.statistics.IStatisticsDao;
|
||||
import cn.com.tenlion.systemhouse.pojo.dtos.statistics.StatisticsDTO;
|
||||
import cn.com.tenlion.systemhouse.service.statistics.IStatisticsService;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: ResidentialIntroductionServiceImpl
|
||||
* @Description: 小区简介
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-11-22 15:31:23
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Service
|
||||
public class StatisticsServiceImpl extends DefaultBaseService implements IStatisticsService {
|
||||
|
||||
@Autowired
|
||||
private IStatisticsDao statisticsDao;
|
||||
|
||||
@Override
|
||||
public List<StatisticsDTO> houseSysInfo(Map<String, Object> params) {
|
||||
List<StatisticsDTO> statisticsDTOList = new ArrayList<>();
|
||||
|
||||
Integer residentialCount = residentialCount(params);
|
||||
StatisticsDTO statisticsDTO = new StatisticsDTO();
|
||||
statisticsDTO.setDataType("小区");
|
||||
statisticsDTO.setCount(residentialCount.toString());
|
||||
statisticsDTOList.add(statisticsDTO);
|
||||
|
||||
Integer buildingCount = buildingCount(params);
|
||||
statisticsDTO = new StatisticsDTO();
|
||||
statisticsDTO.setDataType("楼宇");
|
||||
statisticsDTO.setCount(buildingCount.toString());
|
||||
statisticsDTOList.add(statisticsDTO);
|
||||
|
||||
Integer houseCount = houseCount(params);
|
||||
statisticsDTO = new StatisticsDTO();
|
||||
statisticsDTO.setDataType("房屋");
|
||||
statisticsDTO.setCount(houseCount.toString());
|
||||
statisticsDTOList.add(statisticsDTO);
|
||||
|
||||
params.put("houseStatus", "出租");
|
||||
Integer rentalHousingCount = rentalHousingCount(params);
|
||||
statisticsDTO = new StatisticsDTO();
|
||||
statisticsDTO.setDataType("出租房");
|
||||
statisticsDTO.setCount(rentalHousingCount.toString());
|
||||
statisticsDTOList.add(statisticsDTO);
|
||||
|
||||
Integer communityCount = communityCount(params);
|
||||
statisticsDTO = new StatisticsDTO();
|
||||
statisticsDTO.setDataType("社区");
|
||||
statisticsDTO.setCount(communityCount.toString());
|
||||
statisticsDTOList.add(statisticsDTO);
|
||||
return statisticsDTOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer residentialCount(Map<String, Object> params) {
|
||||
return statisticsDao.residentialCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer buildingCount(Map<String, Object> params) {
|
||||
return statisticsDao.buildingCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer houseCount(Map<String, Object> params) {
|
||||
return statisticsDao.houseCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer rentalHousingCount(Map<String, Object> params) {
|
||||
return statisticsDao.houseCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer communityCount(Map<String, Object> params) {
|
||||
return statisticsDao.communityCount(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticsDTO> estateInfo() {
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
List<StatisticsDTO> statisticsDTOList = statisticsDao.estateInfo(params);
|
||||
return statisticsDTOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticsDTO> buildingInfo() {
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
List<StatisticsDTO> statisticsDTOList = statisticsDao.buildingInfo(params);
|
||||
return statisticsDTOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticsDTO> houseInfo() {
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
List<StatisticsDTO> statisticsDTOList = statisticsDao.houseInfo(params);
|
||||
return statisticsDTOList;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
server:
|
||||
port: 8081
|
||||
url: http://192.168.0.111:8081/systemhousehttp://192.168.0.111:8081/systemhousehttp://192.168.0.111:8081/systemhouse
|
||||
url: http://192.168.0.111:8081/systemhouse
|
||||
system-title: 房屋管理系统
|
||||
system-sub-title: 房屋管理系统
|
||||
servlet:
|
||||
|
@ -1,8 +1,9 @@
|
||||
server:
|
||||
port: 8081
|
||||
url: http://192.168.0.111:8081/systemhouse
|
||||
port: 8083
|
||||
url: http://192.168.0.111:8083/systemhouse
|
||||
system-title: 房屋管理系统
|
||||
system-sub-title: 房屋管理系统
|
||||
nav-page: http://192.168.0.155:7011/usercenter
|
||||
servlet:
|
||||
context-path: /systemhouse
|
||||
|
||||
@ -57,11 +58,50 @@ spring:
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
# 合并多个DruidDataSource的监控数据
|
||||
use-global-data-source-stat: true
|
||||
data:
|
||||
mongodb:
|
||||
uri: mongodb://smartcity:smartcity@192.168.0.156:27017/smartcity
|
||||
redis:
|
||||
database: 6
|
||||
host: 192.168.0.156
|
||||
port: 6379
|
||||
password: 666
|
||||
timeout: 3000ms
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: 1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis/mybatis-config.xml
|
||||
mapper-locations: classpath*:mybatis/mapper/**/*.xml
|
||||
|
||||
api-path:
|
||||
# user-center: http://49.233.36.36:58091/usercenter
|
||||
user-center: http://192.168.0.155:7011/usercenter
|
||||
|
||||
# 安全
|
||||
security:
|
||||
oauth2:
|
||||
# oauth-server: http://49.233.36.36:58091/usercenter
|
||||
oauth-server: http://192.168.0.155:7011/usercenter
|
||||
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
||||
client:
|
||||
client-id: caed885903874d0391ad16832887e4e0
|
||||
client-secret: cENSUjMxWFNHY1R1NjJsK3E2SmltTTg0TjNyQmVsdjA2dGtXcGFQY2d2N2xIdG9KZmEyTjJIRnI0dG1McEdEVA==
|
||||
user-authorization-uri: ${security.oauth2.oauth-server}/oauth2_client/authorize
|
||||
access-token-uri: ${security.oauth2.oauth-server}/oauth2_client/token
|
||||
grant-type: authorization_code
|
||||
resource:
|
||||
jwt:
|
||||
key-uri: ${security.oauth2.oauth-server}/oauth2_client/token_key
|
||||
token-info-uri: ${security.oauth2.oauth-server}/oauth2_client/check_token
|
||||
user-info-uri: ${security.oauth2.oauth-server}/user
|
||||
authorization:
|
||||
check-token-access: ${security.oauth2.oauth-server}/oauth2_client/token_key
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: error
|
||||
|
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.com.tenlion.systemhouse.dao.statistics.IStatisticsDao">
|
||||
|
||||
<resultMap id="statisticsDTO" type="cn.com.tenlion.systemhouse.pojo.dtos.statistics.StatisticsDTO">
|
||||
<result column="dataType" property="dataType"/>
|
||||
<result column="count" property="count"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 小区数量 -->
|
||||
<select id="residentialCount" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(t1.residential_id)
|
||||
FROM
|
||||
house_residential t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 楼宇数量 -->
|
||||
<select id="buildingCount" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(t1.building_id)
|
||||
FROM
|
||||
house_building t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 房屋/出租房数量 -->
|
||||
<select id="houseCount" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(t1.building_house_id)
|
||||
FROM
|
||||
house_building_house t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="houseStatus != null and houseStatus != ''">
|
||||
AND t1.house_status = #{houseStatus}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 社区数量 -->
|
||||
<select id="communityCount" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(t1.community_id)
|
||||
FROM
|
||||
house_community t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 小区类型 -->
|
||||
<select id="estateInfo" parameterType="map" resultMap="statisticsDTO">
|
||||
SELECT
|
||||
t1.residential_type dataType,
|
||||
COUNT(t1.residential_id) count
|
||||
FROM
|
||||
house_residential t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
GROUP BY
|
||||
t1.residential_type
|
||||
</select>
|
||||
|
||||
<!-- 楼宇类型 -->
|
||||
<select id="buildingInfo" parameterType="map" resultMap="statisticsDTO">
|
||||
SELECT
|
||||
t1.building_type dataType,
|
||||
COUNT(t1.building_id) count
|
||||
FROM
|
||||
house_building t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
GROUP BY
|
||||
t1.building_type
|
||||
</select>
|
||||
|
||||
<!-- 房屋类型 -->
|
||||
<select id="houseInfo" parameterType="map" resultMap="statisticsDTO">
|
||||
SELECT
|
||||
t1.house_status dataType,
|
||||
COUNT(t1.building_house_id) count
|
||||
FROM
|
||||
house_building_house t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
GROUP BY
|
||||
t1.house_status
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -91,7 +91,7 @@
|
||||
// 初始化备注富文本
|
||||
function initRemakeRichText(value) {
|
||||
var editor = new wangEditor('#remake');
|
||||
editor.customConfig.zIndex = 1000;
|
||||
editor.customConfig.zIndex = 0;
|
||||
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
|
||||
editor.customConfig.uploadImgMaxLength = 1;
|
||||
editor.customConfig.uploadFileName = 'image';
|
||||
|
629
src/main/resources/templates/default-home.html
Normal file
629
src/main/resources/templates/default-home.html
Normal file
@ -0,0 +1,629 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
*{margin:0;padding:0;}
|
||||
[v-cloak]{display: none}
|
||||
ul{list-style: none}
|
||||
.container{width: 97%;margin:0 auto;}
|
||||
.tab{margin-bottom: 10px;float: right;width: 74%;height:140px;overflow-y: auto}
|
||||
.top:after, .tab:after, .list:after{content: '';display: block;clear: both}
|
||||
.logo-box{float: left;width:25%;}
|
||||
.logo{max-width: 100%;height:183px;}
|
||||
.box h3{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;font-size: 18px;font-weight: normal;color: #000;}
|
||||
.list-box{float:left;width: 18%;padding: 5px;box-sizing: border-box;border-top: 1px solid #000;border-bottom: 1px solid #000;border-left: 1px solid #000;}
|
||||
.list-box:last-child{margin-right: 0}
|
||||
.list-box h4{font-size: 16px;font-weight: normal;color: #000;}
|
||||
.list-box ul li{height: 35px;color: #000;border-bottom: 1px solid #DDD;font-size: 0}
|
||||
.list-box ul li a{display:inline-block;margin-right:5px;color: #000;text-decoration: none;font-size: 14px;line-height: 35px;vertical-align: top;}
|
||||
.list-box ul li span{float:right;font-size: 14px;line-height: 35px;display: inline-block;max-width: 70%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;vertical-align: top;}
|
||||
.layui-card-body{padding: 0 15px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="list" style="padding-left: 15px;padding-right: 15px;">
|
||||
<div class="list-box" style="margin-top:61px;">
|
||||
<ul>
|
||||
<li>
|
||||
<span id="xqDiv">小区</span>
|
||||
</li>
|
||||
<li>
|
||||
<span id="xqCountDiv"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-box" style="margin-top:61px;">
|
||||
<ul>
|
||||
<li>
|
||||
<span id="lyDiv">楼宇</span>
|
||||
</li>
|
||||
<li>
|
||||
<span id="lyCountDiv"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-box" style="margin-top:61px;">
|
||||
<ul>
|
||||
<li>
|
||||
<span id="fwDiv">房屋</span>
|
||||
</li>
|
||||
<li>
|
||||
<span id="fwCountDiv"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-box" style="margin-top:61px;">
|
||||
<ul>
|
||||
<li>
|
||||
<span id="czfDiv">出租房</span>
|
||||
</li>
|
||||
<li>
|
||||
<span id="czfCountDiv"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-box" style="margin-top:61px;border-right: 1px solid #000;">
|
||||
<ul>
|
||||
<li>
|
||||
<span id="sqDiv">社区</span>
|
||||
</li>
|
||||
<li>
|
||||
<span id="sqCountDiv"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" style="padding-left: 15px;padding-right: 15px;">
|
||||
<div id="xqPieDiv" style="width: 300px;height:410px;margin: 40px auto 0 70px;float: left;"></div>
|
||||
<div id="lyPieDiv" style="width: 300px;height:410px;margin: 40px auto 0 70px;float: left;"></div>
|
||||
<div id="fwPieDiv" style="width: 300px;height:410px;margin: 40px auto 0 70px;float: left;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="assets/js/vue.min.js"></script>
|
||||
<script type="text/javascript" src="assets/js/vendor/echarts/echarts.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'form', 'table', 'laydate', 'common', 'laytpl'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var laytpl = layui.laytpl;
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/statistics/house_sys_info';
|
||||
var xqPieUrl = 'api/statistics/estate_info';
|
||||
var lyPieUrl = 'api/statistics/building_info';
|
||||
var fwPieUrl = 'api/statistics/house_info';
|
||||
var selectedAreaArray = [];
|
||||
var app = {};
|
||||
|
||||
// 柱状图
|
||||
function barCharts(data) {
|
||||
const posList = [
|
||||
'left',
|
||||
'right',
|
||||
'top',
|
||||
'bottom',
|
||||
'inside',
|
||||
'insideTop',
|
||||
'insideLeft',
|
||||
'insideRight',
|
||||
'insideBottom',
|
||||
'insideTopLeft',
|
||||
'insideTopRight',
|
||||
'insideBottomLeft',
|
||||
'insideBottomRight'
|
||||
];
|
||||
app.configParameters = {
|
||||
rotate: {
|
||||
min: -90,
|
||||
max: 90
|
||||
},
|
||||
align: {
|
||||
options: {
|
||||
left: 'left',
|
||||
center: 'center',
|
||||
right: 'right'
|
||||
}
|
||||
},
|
||||
verticalAlign: {
|
||||
options: {
|
||||
top: 'top',
|
||||
middle: 'middle',
|
||||
bottom: 'bottom'
|
||||
}
|
||||
},
|
||||
position: {
|
||||
options: posList.reduce(function (map, pos) {
|
||||
map[pos] = pos;
|
||||
return map;
|
||||
}, {})
|
||||
},
|
||||
distance: {
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
};
|
||||
app.config = {
|
||||
rotate: 90,
|
||||
align: 'left',
|
||||
verticalAlign: 'middle',
|
||||
position: 'insideBottom',
|
||||
distance: 15,
|
||||
onChange: function () {
|
||||
const labelOption = {
|
||||
rotate: app.config.rotate,
|
||||
align: app.config.align,
|
||||
verticalAlign: app.config.verticalAlign,
|
||||
position: app.config.position,
|
||||
distance: app.config.distance
|
||||
};
|
||||
myChart.setOption({
|
||||
series: [
|
||||
{
|
||||
label: labelOption
|
||||
},
|
||||
{
|
||||
label: labelOption
|
||||
},
|
||||
{
|
||||
label: labelOption
|
||||
},
|
||||
{
|
||||
label: labelOption
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
const labelOption = {
|
||||
show: true,
|
||||
position: app.config.position,
|
||||
distance: app.config.distance,
|
||||
align: app.config.align,
|
||||
verticalAlign: app.config.verticalAlign,
|
||||
rotate: app.config.rotate,
|
||||
formatter: '{b}:{c}%',
|
||||
fontSize: 16,
|
||||
rich: {
|
||||
name: {}
|
||||
}
|
||||
};
|
||||
|
||||
var xAxisValue;
|
||||
var series = [];
|
||||
if(!$.isEmptyObject(data)) {
|
||||
if(null != data.xAxisValue && '' != data.xAxisValue && typeof(data.xAxisValue) != 'undefined') {
|
||||
xAxisValue = data.xAxisValue.split(',');
|
||||
delete data.xAxisValue;
|
||||
}
|
||||
for(let key in data) {
|
||||
if('pieData' != key) {
|
||||
series.push({
|
||||
name: key,
|
||||
type: 'bar',
|
||||
// 不同系列的柱间距离,为百分比(如 '30%',表示柱子宽度的 30%)。
|
||||
// 如果想要两个系列的柱子重叠,可以设置 barGap 为 '-100%'。这在用柱子做背景的时候有用。
|
||||
// 在同一坐标系上,此属性会被多个 'bar' 系列共享。此属性应设置于此坐标系中最后一个 'bar' 系列上才会生效,并且是对此坐标系中所有 'bar' 系列生效。
|
||||
barGap: 0,
|
||||
label: labelOption,
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
data: data[key].split(',')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var chartDom = document.getElementById('barDiv');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['退回率', '未完成率', '超期率', '即将超期率', '完成率']
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
orient: 'vertical',
|
||||
left: 'right',
|
||||
top: 'center',
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
magicType: { show: true, type: ['bar', 'stack'] },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true }
|
||||
}
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
axisTick: { show: false },
|
||||
data: xAxisValue
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
}
|
||||
],
|
||||
series: series
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}else {
|
||||
top.dialog.msg('该条件下暂无数据');
|
||||
}
|
||||
myChart.on('click', function (param) {
|
||||
console.log(param)
|
||||
});
|
||||
}
|
||||
|
||||
// 饼图
|
||||
function xqPieCharts(data) {
|
||||
var chartDom = document.getElementById('xqPieDiv');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
var pieData = [];
|
||||
|
||||
if(!$.isEmptyObject(data)) {
|
||||
var pieDataArr = data;
|
||||
if(null != pieDataArr && pieDataArr.length > 0) {
|
||||
for(let key in pieDataArr) {
|
||||
pieData.push({
|
||||
name: pieDataArr[key]['dataType'],
|
||||
value: pieDataArr[key]['count']
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(pieData)
|
||||
|
||||
option = {
|
||||
title: {
|
||||
text: '小区类型',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '任务数据',
|
||||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: pieData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
|
||||
// 饼图
|
||||
function lyPieCharts(data) {
|
||||
var chartDom = document.getElementById('lyPieDiv');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
var pieData = [];
|
||||
|
||||
if(!$.isEmptyObject(data)) {
|
||||
var pieDataArr = data;
|
||||
if(null != pieDataArr && pieDataArr.length > 0) {
|
||||
for(let key in pieDataArr) {
|
||||
pieData.push({
|
||||
name: pieDataArr[key]['dataType'],
|
||||
value: pieDataArr[key]['count']
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(pieData)
|
||||
|
||||
option = {
|
||||
title: {
|
||||
text: '任务完成情况',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '任务数据',
|
||||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: pieData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
|
||||
// 饼图
|
||||
function fwPieCharts(data) {
|
||||
var chartDom = document.getElementById('fwPieDiv');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
var pieData = [];
|
||||
|
||||
if(!$.isEmptyObject(data)) {
|
||||
var pieDataArr = data;
|
||||
if(null != pieDataArr && pieDataArr.length > 0) {
|
||||
for(let key in pieDataArr) {
|
||||
pieData.push({
|
||||
name: pieDataArr[key]['dataType'],
|
||||
value: pieDataArr[key]['count']
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(pieData)
|
||||
|
||||
option = {
|
||||
title: {
|
||||
text: '任务完成情况',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '任务数据',
|
||||
type: 'pie',
|
||||
radius: '50%',
|
||||
data: pieData,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
}
|
||||
|
||||
function initHouseSysInfoData() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path(tableUrl, []), {}, null, function (code, data) {
|
||||
for(var i=0;i<data.length;i++) {
|
||||
$("div.list div").each(function(){
|
||||
if(data[i].dataType == $(this).find('ul li:first').find('span').text()) {
|
||||
$(this).find('ul li:first').siblings().find('span').text(data[i].count);
|
||||
}
|
||||
})
|
||||
}
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
|
||||
initHouseSysInfoData();
|
||||
|
||||
function initEstateInfoData() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path(xqPieUrl, []), {}, null, function (code, data) {
|
||||
console.log(data)
|
||||
xqPieCharts(data);
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
|
||||
function initBuildingInfoData() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path(lyPieUrl, []), {}, null, function (code, data) {
|
||||
lyPieCharts(data);
|
||||
console.log(data)
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
|
||||
function initHouseInfoData() {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path(fwPieUrl, []), {}, null, function (code, data) {
|
||||
fwPieCharts(data);
|
||||
console.log(data)
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
|
||||
initEstateInfoData();
|
||||
initBuildingInfoData();
|
||||
initHouseInfoData();
|
||||
|
||||
// 选择区域
|
||||
$(document).on('click', '#area', function() {
|
||||
top.dialog.open({
|
||||
title: '选择地区',
|
||||
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#area').val())]),
|
||||
width: '800px',
|
||||
height: '225px',
|
||||
onClose: function () {
|
||||
selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
||||
console.log(selectedAreaArray)
|
||||
var areaCode = '';
|
||||
var areaName = '';
|
||||
if (selectedAreaArray.length > 0) {
|
||||
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
||||
for (var i = 0, item; item = selectedAreaArray[i++];) {
|
||||
if (areaName) {
|
||||
areaName += ',';
|
||||
}
|
||||
areaName += item.areaName;
|
||||
$('#areaId_' + i).val(item.areaId);
|
||||
}
|
||||
}
|
||||
$('#area').val(areaName);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
var layIndex;
|
||||
top.restAjax.get(top.restAjax.path(tableUrl, []), {
|
||||
keywords: $('#keywords').val(),
|
||||
// distributeDeadline: $('#distributeDeadline').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val(),
|
||||
taskArea1Id: $('#areaId_1').val(),
|
||||
taskArea1Id: $('#areaId_1').val(),
|
||||
taskArea2Id: $('#areaId_2').val(),
|
||||
taskArea3Id: $('#areaId_3').val(),
|
||||
taskArea4Id: $('#areaId_4').val(),
|
||||
taskArea5Id: $('#areaId_5').val(),
|
||||
userId: $('#userId').val(),
|
||||
urgentLevel: $('#urgentLevel').val(),
|
||||
reportCount: $('#reportCount').val(),
|
||||
}, null, function (code, data) {
|
||||
console.log(data.data)
|
||||
barCharts(data.data);
|
||||
pieCharts(data.data);
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd HH:mm:ss'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd HH:mm:ss'
|
||||
});
|
||||
}
|
||||
|
||||
initDate();
|
||||
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
|
||||
// 事件 - 清空搜索条件
|
||||
$(document).on('click', '#reset', function() {
|
||||
$('#keywords').val('');
|
||||
$('#startTime').val('');
|
||||
$('#endTime').val('');
|
||||
$('#area').val('');
|
||||
$('#areaId_1').val('');
|
||||
$('#areaId_2').val('');
|
||||
$('#areaId_3').val('');
|
||||
$('#areaId_4').val('');
|
||||
$('#areaId_5').val('');
|
||||
$('#receiverUser').val('');
|
||||
$('#userId').val('');
|
||||
$('#urgentLevel').val('');
|
||||
$('#reportCount').val('');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user