增加手动同步数据

This commit is contained in:
TS-QD1 2023-04-05 17:40:55 +08:00
parent 4d2afc775d
commit b97f547d62
17 changed files with 439 additions and 101 deletions

View File

@ -41,19 +41,24 @@ public class KpiController extends AbstractController {
@GetMapping("update-community-boss-day-count/{level}")
public SuccessResultData<String> updateCommunityBossDayCount(@PathVariable("level") Integer level,
@RequestParam("dayDate") String dayDate) {
long startTime = System.currentTimeMillis();
kpiService.updateCommunityBossDayCount(dayDate, level);
long endTime = System.currentTimeMillis();
return new SuccessResultData<>("used " + (endTime - startTime) + " ms");
@RequestParam(name = "areaId", required = false) String areaId,
@RequestParam(name = "communityId", required = false) String communityId,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime) {
long startTimeMillis = System.currentTimeMillis();
kpiService.updateCommunityBossDayCount(areaId, communityId, startTime, endTime, level);
long endTimeMillis = System.currentTimeMillis();
return new SuccessResultData<>("used " + (endTimeMillis - startTimeMillis) + " ms");
}
@GetMapping("update-n-person-day-count")
public SuccessResultData<String> updateNPersonDayCount(@RequestParam("dayDate") String dayDate) {
long startTime = System.currentTimeMillis();
kpiService.updateNPersonDayCount(dayDate);
long endTime = System.currentTimeMillis();
return new SuccessResultData<>("used " + (endTime - startTime) + " ms");
public SuccessResultData<String> updateNPersonDayCount(@RequestParam(name = "departmentId", required = false) String departmentId,
@RequestParam(name = "startTime", required = false) String startTime,
@RequestParam(name = "endTime", required = false) String endTime) {
long startTimeMillis = System.currentTimeMillis();
kpiService.updateNPersonDayCount(departmentId, startTime, endTime);
long endTimeMillis = System.currentTimeMillis();
return new SuccessResultData<>("used " + (endTimeMillis - startTimeMillis) + " ms");
}
@GetMapping("update-case")

View File

@ -6,6 +6,7 @@ public class CommunityBossCaseCountDTO implements Comparable<CommunityBossCaseCo
private String areaName;
private String communityId;
private String communityName;
private String userId;
private String userName;
private Integer caseTotal;
private Integer caseHandleTotal;
@ -44,6 +45,14 @@ public class CommunityBossCaseCountDTO implements Comparable<CommunityBossCaseCo
this.communityName = communityName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}

View File

@ -8,9 +8,12 @@ public class CaseListPage extends ListPage {
private String handleUserId;
private String startTime;
private String endTime;
private Integer isAccept;
private Integer isHandle;
private Integer isInspect;
private Integer isOnfile;
private String areaId;
private String communityId;
public String getUserId() {
return userId;
@ -44,6 +47,14 @@ public class CaseListPage extends ListPage {
this.endTime = endTime;
}
public Integer getIsAccept() {
return isAccept;
}
public void setIsAccept(Integer isAccept) {
this.isAccept = isAccept;
}
public Integer getIsHandle() {
return isHandle;
}
@ -67,4 +78,20 @@ public class CaseListPage extends ListPage {
public void setIsOnfile(Integer isOnfile) {
this.isOnfile = isOnfile;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getCommunityId() {
return communityId;
}
public void setCommunityId(String communityId) {
this.communityId = communityId;
}
}

View File

@ -14,7 +14,7 @@ public interface IKpiService {
*
* @param date
*/
void updateCommunityBossDayCount(String date, int level);
void updateCommunityBossDayCount(String areaId, String communityId, String startTime, String endTime, int level);
/**
* 更新N员
@ -22,7 +22,7 @@ public interface IKpiService {
*
* @param dayDate
*/
void updateNPersonDayCount(String dayDate);
void updateNPersonDayCount(String departmentId, String startTime, String endTime);
/**

View File

@ -3,8 +3,11 @@ package com.cm.bigdata.service.kpi;
import com.cm.bigdata.pojo.pos.kpi.UserPO;
import java.util.List;
import java.util.Map;
public interface IUserService {
List<UserPO> listPOByRoleId(String roleId);
List<UserPO> listPO(Map<String, Object> params);
}

View File

@ -7,6 +7,8 @@ import com.cm.bigdata.service.kpi.*;
import com.cm.bigdata.utils.KpiUtil;
import com.cm.common.constants.ISystemConstant;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
@ -14,10 +16,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -45,82 +44,114 @@ public class KpiServiceImpl implements IKpiService {
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD_HH_MM_SS);
@Override
public void updateCommunityBossDayCount(String date, int level) {
public void updateCommunityBossDayCount(String areaId, String communityId, String startTime, String endTime, int level) {
// communityBoss表中的level位1-4对应的是2-5级网格员
final int communityBossLevel = level - 1;
List<CommunityBossPO> communityBoss4DTOList = communityBossService.listPOByLevel(communityBossLevel);
List<String> userIds = communityBoss4DTOList.stream().map(CommunityBossPO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userIds);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userIds, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userIds, date);
// 删除当日数据
deleteCommunityBossDayCount(date, communityBossLevel);
communityBoss4DTOList.forEach(communityBossDTO -> {
String userId = communityBossDTO.getCommunityBossUserId();
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
int populationCount = populationCountMap.get(userId) == null ? 0 : populationCountMap.get(userId);
int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId);
int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId);
// 新增
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
params.put("dayDate", date);
params.put("isSignin", isSignin);
params.put("isSigninLate", isSigninLate);
params.put("isSignout", isSignout);
params.put("isSignoutEarly", isSignoutEarly);
params.put("workDistance", workDistance);
params.put("populationCount", populationCount);
params.put("savePopulationCount", savePopulationCount);
params.put("updatePopulationCount", updatePopulationCount);
params.put("level", communityBossLevel);
kpiDao.saveCommunityBossDayCount(params);
final int communityBossLevel = level;
Map<String, Object> params = new HashMap<>();
params.put("communityBossLevel", communityBossLevel);
params.put("areaId", areaId);
params.put("communityId", communityId);
List<CommunityBossDTO> communityBossDTOList = communityBossService.list(params);
List<String> userIds = communityBossDTOList.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
List<String> dates = listDate(startTime, endTime);
dates.forEach(date -> {
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date);
Map<String, Integer> populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userIds);
Map<String, Integer> populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userIds, date);
Map<String, Integer> populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userIds, date);
// 删除当日数据
deleteCommunityBossDayCount(date, communityBossLevel);
communityBossDTOList.forEach(communityBossDTO -> {
String userId = communityBossDTO.getCommunityBossUserId();
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
int populationCount = populationCountMap.get(userId) == null ? 0 : populationCountMap.get(userId);
int savePopulationCount = populationSaveCountMap.get(userId) == null ? 0 : populationSaveCountMap.get(userId);
int updatePopulationCount = populationUpdateCountMap.get(userId) == null ? 0 : populationUpdateCountMap.get(userId);
// 新增
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("userId", userId);
queryParams.put("dayDate", date);
queryParams.put("isSignin", isSignin);
queryParams.put("isSigninLate", isSigninLate);
queryParams.put("isSignout", isSignout);
queryParams.put("isSignoutEarly", isSignoutEarly);
queryParams.put("workDistance", workDistance);
queryParams.put("populationCount", populationCount);
queryParams.put("savePopulationCount", savePopulationCount);
queryParams.put("updatePopulationCount", updatePopulationCount);
queryParams.put("level", communityBossLevel);
kpiDao.saveCommunityBossDayCount(queryParams);
});
});
}
@Override
public void updateNPersonDayCount(String date) {
public void updateNPersonDayCount(String departmentId, String startTime, String endTime) {
Map<String, Object> params = new HashMap<>();
// 专管员
List<UserPO> userPOS = userService.listPOByRoleId("bc405346-8714-4ded-89ac-9cc4d755f66a");
params.put("roleId", "bc405346-8714-4ded-89ac-9cc4d755f66a");
params.put("departmentId", departmentId);
List<UserPO> userPOS = userService.listPO(params);
if (userPOS.isEmpty()) {
return;
}
List<String> userIds = userPOS.stream().map(UserPO::getUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList());
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date);
// 删除当日数据
deleteNPersonDayCount(date);
userPOS.forEach(userPO -> {
String userId = userPO.getUserId();
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
// 新增
Map<String, Object> params = new HashMap<>();
params.put("userId", userId);
params.put("dayDate", date);
params.put("isSignin", isSignin);
params.put("isSigninLate", isSigninLate);
params.put("isSignout", isSignout);
params.put("isSignoutEarly", isSignoutEarly);
params.put("workDistance", workDistance);
List<String> dates = listDate(startTime, endTime);
dates.forEach(date -> {
Map<String, List<UserSigninPO>> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date);
Map<String, List<UserSignoutPO>> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date);
// 删除当日数据
deleteNPersonDayCount(date);
userPOS.forEach(userPO -> {
String userId = userPO.getUserId();
List<UserSigninPO> userSigninPO = userSigninMap.get(userId);
int isSignin = userSigninPO == null || userSigninPO.size() == 0 ? 0 : 1;
int isSigninLate = userSigninPO == null || userSigninPO.size() == 0 ? 0 : userSigninPO.get(0).getIsLate();
List<UserSignoutPO> userSignoutPOS = userSignoutMap.get(userId);
int isSignout = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : 1;
int isSignoutEarly = userSignoutPOS == null || userSignoutPOS.size() == 0 ? 0 : userSignoutPOS.get(0).getIsEarly();
double workDistance = KpiUtil.calculateWorkDistance(userLocationService, userId, date);
// 新增
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("userId", userId);
queryParams.put("dayDate", date);
queryParams.put("isSignin", isSignin);
queryParams.put("isSigninLate", isSigninLate);
queryParams.put("isSignout", isSignout);
queryParams.put("isSignoutEarly", isSignoutEarly);
queryParams.put("workDistance", workDistance);
kpiDao.saveNPersonDayCount(params);
kpiDao.saveNPersonDayCount(queryParams);
});
});
}
private List<String> listDate(String startTime, String endTime) {
LocalDateTime startLocalDateTime = LocalDateTime.now();
LocalDateTime endLocalDateTime = LocalDateTime.now();
if (!StringUtils.isBlank(startTime)) {
startLocalDateTime = LocalDateTime.parse(startTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
}
if (!StringUtils.isBlank(endTime)) {
endLocalDateTime = LocalDateTime.parse(endTime, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
}
LocalDateTime currentLocalDateTime = startLocalDateTime;
List<String> dates = Collections.synchronizedList(new ArrayList<>());
while (!currentLocalDateTime.isAfter(endLocalDateTime)) {
String date = currentLocalDateTime.toString(DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
currentLocalDateTime = currentLocalDateTime.plusDays(1);
dates.add(date);
}
return dates;
}
private void deleteNPersonDayCount(String date) {
Map<String, Object> params = new HashMap<>(4);
params.put("dayDate", date);
@ -234,8 +265,7 @@ public class KpiServiceImpl implements IKpiService {
Map<String, Object> params = new HashMap<>();
params.put("areaId", areaId);
params.put("communityId", communityId);
List<CommunityPO> communityPOS = communityService.listPO(params);
return communityPOS.stream().map(communityPO -> {
return Collections.synchronizedCollection(communityService.listPO(params)).parallelStream().map(communityPO -> {
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("areaId", communityPO.getAreaId());
queryParams.put("communityId", communityPO.getCommunityId());
@ -273,9 +303,10 @@ public class KpiServiceImpl implements IKpiService {
params.put("areaId", areaId);
params.put("communityId", communityId);
params.put("communityBossLevel", communityBossLevel);
return communityBossService.list(params).stream().map(communityBossDTO -> {
return Collections.synchronizedCollection(communityBossService.list(params)).parallelStream().map(communityBossDTO -> {
CommunityBossCaseCountDTO communityBossCaseCountDTO = new CommunityBossCaseCountDTO();
BeanUtils.copyProperties(communityBossDTO, communityBossCaseCountDTO);
communityBossCaseCountDTO.setUserId(communityBossDTO.getCommunityBossUserId());
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("reportUserId", communityBossDTO.getCommunityBossUserId());
queryParams.put("startTime", startTime);
@ -283,13 +314,13 @@ public class KpiServiceImpl implements IKpiService {
// 总数
Integer total = countCase(queryParams);
// 已受理
queryParams.put("gmtAccept", "isNotNull");
queryParams.put("isAccept", 1);
Integer acceptTotal = countCase(queryParams);
// 已处理
queryParams.put("gmtHandle", "isNotNull");
queryParams.put("isHandle", 1);
Integer handleTotal = countCase(queryParams);
// 已检查
queryParams.put("gmtInspect", "isNotNull");
queryParams.put("isInspect", 1);
Integer inspectTotal = countCase(queryParams);
// 已归档和检查一致
communityBossCaseCountDTO.setCaseTotal(total);
@ -305,7 +336,7 @@ public class KpiServiceImpl implements IKpiService {
Map<String, Object> params = new HashMap<>();
params.put("departmentParentId", "0");
params.put("departmentId", departmentId);
return departmentService.listUserPO(params).stream().map(departmentUserPO -> {
return Collections.synchronizedCollection(departmentService.listUserPO(params)).parallelStream().map(departmentUserPO -> {
NPersonCaseCountDTO nPersonCaseCountDTO = new NPersonCaseCountDTO();
BeanUtils.copyProperties(departmentUserPO, nPersonCaseCountDTO);
Map<String, Object> queryParams = new HashMap<>();
@ -315,7 +346,7 @@ public class KpiServiceImpl implements IKpiService {
// 上报总数
Integer caseReportTotal = countCase(queryParams);
// 处理总数
queryParams.clear();
queryParams.remove("reportUserId");
queryParams.put("handleUserId", nPersonCaseCountDTO.getUserId());
Integer caseHandleTotal = countCase(queryParams);
nPersonCaseCountDTO.setCaseReportTotal(caseReportTotal);
@ -395,7 +426,6 @@ public class KpiServiceImpl implements IKpiService {
BeanUtils.copyProperties(departmentUserPO, nPersonCaseDayCountDTO);
Map<String, Object> queryParams = new HashMap<>();
queryParams.put("userId", departmentUserPO.getUserId());
queryParams.put("startTime", startTime);
queryParams.put("endTime", endTime);
Integer isSigninTotal = 0;
@ -419,7 +449,7 @@ public class KpiServiceImpl implements IKpiService {
// 上报总数
Integer caseReportTotal = countCase(queryParams);
// 处理总数
queryParams.clear();
queryParams.remove("reportUserId");
queryParams.put("handleUserId", nPersonCaseDayCountDTO.getUserId());
Integer caseHandleTotal = countCase(queryParams);
nPersonCaseDayCountDTO.setCaseReportTotal(caseReportTotal);

View File

@ -59,9 +59,12 @@ public class ReportCaseServiceImpl implements IReportCaseService {
params.put("handleUserId", caseListPage.getHandleUserId());
params.put("startTime", caseListPage.getStartTime());
params.put("endTime", caseListPage.getEndTime());
params.put("isAccept", caseListPage.getIsAccept());
params.put("isHandle", caseListPage.getIsHandle());
params.put("isInspect", caseListPage.getIsInspect());
params.put("isOnfile", caseListPage.getIsOnfile());
params.put("areaId", caseListPage.getAreaId());
params.put("communityId", caseListPage.getCommunityId());
PageHelper.startPage(caseListPage.getPage(), caseListPage.getRows());
List<ReportCaseDTO> reportCaseDTOS = reportCaseDao.list(params);
PageInfo<ReportCaseDTO> pageInfo = new PageInfo<>(reportCaseDTOS);

View File

@ -23,4 +23,9 @@ public class UserServiceImpl implements IUserService {
return userDao.listPO(params);
}
@Override
public List<UserPO> listPO(Map<String, Object> params) {
return userDao.listPO(params);
}
}

View File

@ -186,6 +186,14 @@
city_report_case crc
WHERE
crc.is_delete = 0
<if test="areaId != null and areaId != ''">
AND
crc.area_id = #{areaId}
</if>
<if test="communityId != null and communityId != ''">
AND
crc.community_id = #{communityId}
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(crc.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
@ -211,6 +219,10 @@
crca.handle_user_id = #{handleUserId}
)
</if>
<if test="isAccept != null and isAccept == 1">
AND
crc.case_status > 1
</if>
<if test="isHandle != null and isHandle == 1">
AND
crc.case_status > 3

View File

@ -17,6 +17,19 @@
sys_user su
WHERE
is_delete = 0
<if test="departmentId != null and departmentId != ''">
AND
EXISTS (
SELECT
1
FROM
sys_department_user sdu
WHERE
su.user_id = sdu.user_id
AND
sdu.department_id = #{departmentId}
)
</if>
<if test="roleId != null and roleId != ''">
AND
EXISTS (

View File

@ -10,7 +10,9 @@
<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>
.layui-table-cell a {text-decoration: underline;}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
@ -155,7 +157,7 @@
{field:'caseTotal', width:100, title: '案件总数', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseEvent">${rowData}件</a>`;
}
},
// {field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center',
@ -167,13 +169,13 @@
{field:'caseHandleTotal', width:160, title: '已处理案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseHandleEvent">${rowData}件</a>`;
}
},
{field:'caseInspectTotal', width:160, title: '已检查案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseInspectEvent">${rowData}件</a>`;
}
},
{field:'caseOnfileTotal', width:160, title: '已归档案件', align:'center',
@ -198,6 +200,36 @@
});
}
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'caseEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?userId={userId}&startTime={startTime}&endTime={endTime}', [data.userId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseHandleEvent') {
top.dialog.open({
title: `${data.userName} 案件处理总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?userId={userId}&isHandle=1&startTime={startTime}&endTime={endTime}', [data.userId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseInspectEvent') {
top.dialog.open({
title: `${data.userName} 案件检查总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?userId={userId}&isInspect=1&startTime={startTime}&endTime={endTime}', [data.userId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
}
});
// 重载表格
function reloadTable() {
dataLoading = true;

View File

@ -56,6 +56,9 @@
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
<button type="button" id="refreshData" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-refresh"></i> 更新数据
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
@ -342,6 +345,26 @@
reloadTable(1);
});
$(document).on('click', '#refreshData', function() {
top.dialog.confirm('确定更新吗?没有日期,只更新当日数据。时间可能较长,请不要关闭页面!', function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/kpi/update-community-boss-day-count/{level}', [$('#communityBossLevel').val()]), {
areaId : $('#areaId').val(),
communityId : $('#communityId').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
}, null, function(code, data) {
reloadTable(1);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg('正在更新...', {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
});
})
</script>
</body>

View File

@ -10,7 +10,9 @@
<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>
.layui-table-cell a {text-decoration: underline;}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
@ -147,25 +149,25 @@
{field:'caseTotal', width:100, title: '案件总数', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseEvent">${rowData}件</a>`;
}
},
{field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件'
return `<a href="javascript:void(0)" lay-event="caseAcceptEvent">${rowData}件</a>`;
}
},
{field:'caseHandleTotal', width:160, title: '已处理案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseHandleEvent">${rowData}件</a>`;
}
},
{field:'caseInspectTotal', width:160, title: '已检查案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseInspectEvent">${rowData}件</a>`;
}
},
{field:'caseOnfileTotal', width:160, title: '已归档案件', align:'center',
@ -208,6 +210,44 @@
});
}
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'caseEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseAcceptEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isAccept=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseHandleEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isHandle=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseInspectEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isInspect=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
}
});
$(document).on('click', '#search', function() {
if(dataLoading){
layer.msg('数据加载中,请稍等...');

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="/bigdata/">
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.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 style="padding: 15px; background-color: #FFF">
<div id="container"></div>
</div>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=oWU9RD4ihDHAafexgI6XOrTK8lDatRju"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laytpl', 'form','laydate'], function() {
var $ = layui.$;
var $win = $(window);
var queryParams = top.restAjax.params(window.location.href);
var lat = queryParams.lat;
var lng = queryParams.lng;
function init() {
var map;
function size() {
$('#container').css({
height: `${$win.height() - 30}px`
})
}
function map() {
var point = new BMapGL.Point(lng, lat);
var marker = new BMapGL.Marker(point);
// 添加比例尺控件
var scaleCtrl = new BMapGL.ScaleControl();
// 添加缩放控件
var zoomCtrl = new BMapGL.ZoomControl();
// 添加城市列表控件
var cityCtrl = new BMapGL.CityListControl();
var mapTypeCtrl = new BMapGL.MapTypeControl();
map = new BMapGL.Map("container");
map.centerAndZoom(point, 15);
map.addOverlay(marker);
//设置地图旋转角度
map.setHeading(64.5);
//设置地图的倾斜角度
map.setTilt(73);
map.addControl(scaleCtrl);
map.addControl(zoomCtrl);
map.addControl(cityCtrl);
map.addControl(mapTypeCtrl);
map.enableScrollWheelZoom();
}
size();
map();
}
init();
});
</script>
</body>
</html>

View File

@ -68,9 +68,12 @@
var handleUserId = queryParams.handleUserId;
var startTime = queryParams.startTime;
var endTime = queryParams.endTime;
var isAccept = queryParams.isAccept;
var isHandle = queryParams.isHandle;
var isInspect = queryParams.isInspect;
var isOnfile = queryParams.isOnfile;
var areaId = queryParams.areaId;
var communityId = queryParams.communityId;
var tableUrl = 'api/kpi/listpage-case';
var dataLoading = false;
@ -86,9 +89,12 @@
endTime : endTime ? endTime : '',
userId : userId ? userId : '',
handleUserId : handleUserId ? handleUserId : '',
isAccept: isAccept ? isAccept : '',
isHandle: isHandle ? isHandle : '',
isInspect: isInspect ? isInspect : '',
isOnfile: isOnfile ? isOnfile : '',
areaId: areaId ? areaId : '',
communityId: communityId ? communityId : '',
},
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 20,
@ -142,7 +148,7 @@
templet: function (row) {
var value = '<div style="text-align: left">'+
'<div class="info-row"><span class="col-left">案件来源</span><span class="col-right">'+ sourceFormatter(row.caseSource) +'</span></div>'+
'<div class="info-row"><a href="javascript:;" class="col-line" lay-event="showLocation"><i class="fa fa-map-marker"></i>'+ row.casePosition +'</a></div>'+
'<div class="info-row"><a href="javascript:;" class="col-line" lay-event="showLocationEvent"><i class="fa fa-map-marker"></i>'+ row.casePosition +'</a></div>'+
'<div class="info-row"><span class="col-content">'+ row.caseContent +'</span></div>'+
'</div>';
return value;
@ -247,6 +253,20 @@
return value;
}
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'showLocationEvent') {
top.dialog.open({
title: '案件位置',
url: top.restAjax.path('route/kpi/detail/map/case-map.html?lng={lng}&lat={lat}', [data.caseLongitude, data.caseLatitude]),
width: '800px',
height: '80%',
onClose: function() {}
})
console.log(data);
}
})
})
</script>
</body>

View File

@ -10,7 +10,9 @@
<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>
.layui-table-cell a {text-decoration: underline;}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
@ -112,13 +114,13 @@
{field:'caseReportTotal', width:160, title: '上报案件总数', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseEvent">${rowData}件</a>`;
}
},
{field:'caseHandleTotal', width:160, title: '处理案件总数', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
return `<a href="javascript:void(0)" lay-event="caseHandleEvent">${rowData}件</a>`;
}
},
]],
@ -137,6 +139,28 @@
});
}
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'caseEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?userId={userId}&startTime={startTime}&endTime={endTime}', [data.userId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseHandleEvent') {
top.dialog.open({
title: `${data.userName} 案件处理总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?handleUserId={handleUserId}&startTime={startTime}&endTime={endTime}', [data.userId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
}
});
// 重载表格
function reloadTable() {
dataLoading = true;

View File

@ -41,6 +41,9 @@
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
<button type="button" id="refreshData" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-refresh"></i> 更新数据
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
@ -242,6 +245,26 @@
reloadTable(1);
});
$(document).on('click', '#refreshData', function() {
top.dialog.confirm('确定更新吗?没有日期,只更新当日数据。时间可能较长,请不要关闭页面!', function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/kpi/update-n-person-day-count', []), {
departmentId : $('#departmentId').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
}, null, function(code, data) {
reloadTable(1);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg('正在更新...', {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
});
})
</script>
</body>