更新部分文件

This commit is contained in:
wans 2022-09-25 13:49:22 +08:00
parent 28843bc91c
commit f54944daaf
5 changed files with 358 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException; import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage; import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult; import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.DateUtil; import com.cm.common.utils.DateUtil;
import com.cm.systemcity.dao.datarelease.IDataReleaseDao; import com.cm.systemcity.dao.datarelease.IDataReleaseDao;
@ -14,10 +15,14 @@ import com.cm.systemcity.pojo.dtos.reportcase.CaseStatisticDTO;
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseAssignDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseAssignDTO;
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseDTO;
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseLogDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseLogDTO;
import com.cm.systemcity.pojo.dtos.userlocation.UserLocationDTO;
import com.cm.systemcity.service.dict.IDictService; import com.cm.systemcity.service.dict.IDictService;
import com.cm.systemcity.service.readstate.IReadStateService; import com.cm.systemcity.service.readstate.IReadStateService;
import com.cm.systemcity.service.reportcase.IReportCaseService; import com.cm.systemcity.service.reportcase.IReportCaseService;
import com.cm.systemcity.service.userlocation.IUserLocationService;
import com.cm.systemcity.utils.BigDataResult; import com.cm.systemcity.utils.BigDataResult;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -46,6 +51,8 @@ public class DataReleaseController extends AbstractController {
private IDictService dictService; private IDictService dictService;
@Autowired @Autowired
private IReportCaseService reportCaseService; private IReportCaseService reportCaseService;
@Autowired
private IUserLocationService userLocationService;
@ApiOperation(value = "案件情况-数量", notes = "案件情况-数量") @ApiOperation(value = "案件情况-数量", notes = "案件情况-数量")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@ -465,4 +472,32 @@ public class DataReleaseController extends AbstractController {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return reportCaseService.listCaseStatisticRatio(params); return reportCaseService.listCaseStatisticRatio(params);
} }
@GetMapping("list-page-user-location")
public SuccessResultList<List<UserLocationDTO>> listPageUserLocation (ListPage page){
Map<String, Object> params = requestParams();
PageHelper.startPage(page.getPage(), page.getRows());
List<Map<String, Object>> userLocationList = dataReleaseDao.listUserLocation(params);
List<UserLocationDTO> resList = new ArrayList<>();
// 查询用户上传的最新的一条定位信息
for(Map<String, Object> item : userLocationList){
String userId = item.get("creator").toString();
params.put("userId", userId);
Map<String, Object> temp = dataReleaseDao.getLastUserLocationInfo(params);
UserLocationDTO dto = new UserLocationDTO();
dto.setUserLocationId(temp.get("user_location_id") == null ? "" : temp.get("user_location_id").toString());
dto.setUserLongitude(temp.get("user_longitude") == null ? "" : temp.get("user_longitude").toString());
dto.setUserLatitude(temp.get("user_latitude") == null ? "" : temp.get("user_latitude").toString());
dto.setUserLocation(temp.get("user_location") == null ? "" : temp.get("user_location").toString());
dto.setIsOverstep(temp.get("is_overstep") == null ? "" : temp.get("is_overstep").toString());
dto.setUserName(temp.get("user_name") == null ? "" : temp.get("user_name").toString());
dto.setCreator(temp.get("creator") == null ? "" : temp.get("creator").toString());
dto.setGmtCreate(temp.get("gmt_create") == null ? "" : temp.get("gmt_create").toString());
dto.setUserAvatar(temp.get("user_avatar") == null ? "" : temp.get("user_avatar").toString());
dto.setUserPhone(temp.get("user_phone") == null ? "" : temp.get("user_phone").toString());
resList.add(dto);
}
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(userLocationList);
return new SuccessResultList<>(resList, pageInfo.getPageNum(), pageInfo.getTotal());
}
} }

View File

@ -56,4 +56,18 @@ public interface IDataReleaseDao {
List<Map<String, Object>> getCommunityInfo(Map<String, Object> param); List<Map<String, Object>> getCommunityInfo(Map<String, Object> param);
List<Map<String, Object>> listCaseInMap(Map<String, Object> params); List<Map<String, Object>> listCaseInMap(Map<String, Object> params);
/**
* 实时活跃人员列表去重查询-大数据接口
* @param params
* @return
*/
List<Map<String, Object>> listUserLocation(Map<String, Object> params);
/**
* 查询人员上传定位的最后一条记录
* @param params
* @return
*/
Map<String, Object> getLastUserLocationInfo(Map<String, Object> params);
} }

View File

@ -912,7 +912,7 @@ public class UserLocationServiceImpl extends BaseService implements IUserLocatio
//userId = "f569baa1-8c99-47bb-98d8-5eea132e0051"; //userId = "f569baa1-8c99-47bb-98d8-5eea132e0051";
/** /**
* 小王帅 2021年7月4日16:31:24 * 小王帅 2021年7月4日16:31:24
* 因为片区信息中relation_id保存的是community_boss_id * 因为片区信息中部分人员relation_id保存的是community_boss_id
* 所以要用userId去查询 * 所以要用userId去查询
* 2021-10-12 一个用户可能有多个片区信息 * 2021-10-12 一个用户可能有多个片区信息
*/ */

View File

@ -144,4 +144,33 @@
ORDER BY ORDER BY
gmt_create DESC gmt_create DESC
</select> </select>
<select id="listUserLocation" parameterType="map" resultType="map">
SELECT
t1.user_name,
t1.creator
FROM
city_user_location t1
WHERE
t1.gmt_create <![CDATA[ >= ]]> #{startTime}
AND t1.gmt_create <![CDATA[ <= ]]> #{endTime}
<if test="userName != null and userName != ''">
AND t1.user_name = #{userName}
</if>
GROUP BY t1.user_name, t1.creator
</select>
<select id="getLastUserLocationInfo" parameterType="map" resultType="map">
SELECT
t1.*,
t2.user_avatar,
t2.user_phone
FROM
city_user_location t1
INNER JOIN sys_user t2 ON t1.creator = t2.user_id
WHERE
t1.creator = #{userId}
ORDER BY t1.gmt_create desc
limit 1
</select>
</mapper> </mapper>

View File

@ -0,0 +1,279 @@
<!doctype html>
<html lang="en">
<head>
<base href="/servicecity/">
<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">
</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="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="userName" class="layui-input search-item" placeholder="按姓名查找">
</div>
<div class="layui-inline">
<input type="text" id="date" class="layui-input search-item" placeholder="选择日期" readonly>
</div>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'ztree', 'restajax', 'dialog'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var dialog = layui.dialog;
var restAjax = layui.restajax;
var tableUrl = 'app/data-external-release/list-page-user-location';
function init() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
month = month >= 10 ? month : ('0'+ month);
day = day >= 10 ? day : ('0'+ day);
$('#date').val(year +'-'+ month +'-'+ day);
var hour = date.getHours();
hour = hour >= 10 ? hour : ('0'+ hour);
laydate.render({
elem: '#startTime',
type: 'time',
value : hour + ':00:00'
});
laydate.render({
elem: '#endTime',
type: 'time',
value : hour + ':59:59'
});
initTable();
}
init();
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
where :{
startTime : $('#date').val() + ' ' + $('#startTime').val(),
endTime : $('#date').val() + ' ' + $('#endTime').val(),
userName : $('#userName').val()
},
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'userName', width: 120, title: '人员名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userPhone', width: 130, title: '联系电话', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userLongitude', width: 150, title: '经度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userLatitude', width: 150, title: '纬度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userLocation', width: 450, title: '位置', align:'center', event: 'userLocation',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
rowData = userLocationFormatter(rowData, row);
return rowData;
}
},/*
{field: 'isOverstep', width: 100, title: '是否越界', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
rowData = isOverstepFormatter(rowData, row);
return rowData;
}
},*/
{field: 'gmtCreate', width: 190, title: '上报时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
rowData = gmtCreateFormatter(rowData, row);
return rowData;
}
},
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 所在位置监听事件
table.on('tool(dataTable)', function(obj){
var data = obj.data;
if(obj.event === 'userLocation'){
showUserLocation(data.creator, data.userLongitude, data.userLatitude);
}
});
function showUserLocation(creator, lng, lat) {
dialog.open({
url: restAjax.path('route/userlocation/map_location.html?userId={userId}&lng={lng}&lat={lat}', [creator, lng, lat]),
title: '查看位置',
width: '600px',
height: '550px',
onClose: function() {}
});
}
// 定位地址格式化
function userLocationFormatter(val, row) {
var value;
switch (row.isOverstep) {
case '1':
value = '<a href="javascript:void(0);" style="color:red;"><i class="fa fa-map-marker"></i> '+ val +'</a>';
break;
case '0':
value = '<a href="javascript:void(0);" style="color:green;"><i class="fa fa-map-marker"></i> '+ val +'</a>'
break;
default:
value = '<a href="javascript:void(0);" style="color:blue;"><i class="fa fa-map-marker"></i> '+ val +'</a>'
}
return value;
}
// 操作栏格式
function formatterOperation(val, row) {
return '<div class="btn-group btn-group-xs">'+
'<button type="button" class="btn btn-danger" onclick="remove(\''+ row.userLocationId +'\')">删除</button>'+
'</div>';
}
function getTableUrl() {
var url = restAjax.path('api/userlocation/listpageuserlocation', []);
var keywords = $('#keywords').val();
var params = '?t='+ new Date().getTime();
if('' != keywords) {
params += '&keywords='+ encodeURI(keywords);
}
if('' == $('#date').val()) {
$('#date').val(formatterDate(new Date()));
}
if('' == $('#startTime').val()) {
$('#startTime').val('00:00:00');
}
if('' == $('#endTime').val()) {
$('#endTime').val('23:59:59');
}
var date = $('#date').val();
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
if('' != date) {
params += '&date='+ date;
}
if('' != startTime) {
params += '&startTime='+ startTime;
}
if('' != endTime) {
params += '&endTime='+ endTime;
}
return url + params;
}
// 事件 - 搜索
$(document).on('click', '#search', function() {
loadTable(1);
});
function loadTable(currentPage) {
table.reload('dataTable', {
url: restAjax.path(tableUrl, []),
where: {
startTime : $('#date').val() + ' ' + $('#startTime').val(),
endTime : $('#date').val() + ' ' + $('#endTime').val(),
userName : $('#userName').val()
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
});
</script>
</body>
</html>