From b97f547d625fb23f649ff999d38b58fd3591452e Mon Sep 17 00:00:00 2001 From: TS-QD1 Date: Wed, 5 Apr 2023 17:40:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E5=8A=A8=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/apis/kpi/KpiController.java | 25 ++- .../dtos/kpi/CommunityBossCaseCountDTO.java | 9 + .../cm/bigdata/pojo/vos/kpi/CaseListPage.java | 27 +++ .../cm/bigdata/service/kpi/IKpiService.java | 4 +- .../cm/bigdata/service/kpi/IUserService.java | 3 + .../service/kpi/impl/KpiServiceImpl.java | 182 ++++++++++-------- .../kpi/impl/ReportCaseServiceImpl.java | 3 + .../service/kpi/impl/UserServiceImpl.java | 5 + .../db2-mapper/kpi/report-case-mapper.xml | 12 ++ .../mybatis/db2-mapper/kpi/user-mapper.xml | 13 ++ .../route/kpi/community-boss-count.html | 40 +++- .../route/kpi/community-boss-day-count.html | 23 +++ .../static/route/kpi/community-count.html | 50 ++++- .../static/route/kpi/detail/map/case-map.html | 69 +++++++ .../static/route/kpi/detail/user-case.html | 22 ++- .../static/route/kpi/n-person-count.html | 30 ++- .../static/route/kpi/n-person-day-count.html | 23 +++ 17 files changed, 439 insertions(+), 101 deletions(-) create mode 100644 src/main/resources/static/route/kpi/detail/map/case-map.html diff --git a/src/main/java/com/cm/bigdata/controller/apis/kpi/KpiController.java b/src/main/java/com/cm/bigdata/controller/apis/kpi/KpiController.java index cd0f67f..398f117 100644 --- a/src/main/java/com/cm/bigdata/controller/apis/kpi/KpiController.java +++ b/src/main/java/com/cm/bigdata/controller/apis/kpi/KpiController.java @@ -41,19 +41,24 @@ public class KpiController extends AbstractController { @GetMapping("update-community-boss-day-count/{level}") public SuccessResultData 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 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 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") diff --git a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/CommunityBossCaseCountDTO.java b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/CommunityBossCaseCountDTO.java index 2f93cb2..d838f6a 100644 --- a/src/main/java/com/cm/bigdata/pojo/dtos/kpi/CommunityBossCaseCountDTO.java +++ b/src/main/java/com/cm/bigdata/pojo/dtos/kpi/CommunityBossCaseCountDTO.java @@ -6,6 +6,7 @@ public class CommunityBossCaseCountDTO implements Comparable listPOByRoleId(String roleId); + List listPO(Map params); + } diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java index fcb8618..81b5beb 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/KpiServiceImpl.java @@ -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 communityBoss4DTOList = communityBossService.listPOByLevel(communityBossLevel); - List userIds = communityBoss4DTOList.stream().map(CommunityBossPO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList()); - Map> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date); - Map> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date); - Map populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userIds); - Map populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userIds, date); - Map populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userIds, date); - // 删除当日数据 - deleteCommunityBossDayCount(date, communityBossLevel); - communityBoss4DTOList.forEach(communityBossDTO -> { - String userId = communityBossDTO.getCommunityBossUserId(); - List 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 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 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 params = new HashMap<>(); + params.put("communityBossLevel", communityBossLevel); + params.put("areaId", areaId); + params.put("communityId", communityId); + List communityBossDTOList = communityBossService.list(params); + List userIds = communityBossDTOList.stream().map(CommunityBossDTO::getCommunityBossUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList()); + List dates = listDate(startTime, endTime); + dates.forEach(date -> { + Map> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date); + Map> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date); + Map populationCountMap = KpiUtil.mapPopulationCount(basePopulationInfoService, userIds); + Map populationSaveCountMap = KpiUtil.mapPopulationSaveCount(basePopulationInfoService, userIds, date); + Map populationUpdateCountMap = KpiUtil.mapPopulationUpdateCount(basePopulationInfoService, userIds, date); + // 删除当日数据 + deleteCommunityBossDayCount(date, communityBossLevel); + communityBossDTOList.forEach(communityBossDTO -> { + String userId = communityBossDTO.getCommunityBossUserId(); + List 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 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 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 params = new HashMap<>(); // 专管员 - List userPOS = userService.listPOByRoleId("bc405346-8714-4ded-89ac-9cc4d755f66a"); + params.put("roleId", "bc405346-8714-4ded-89ac-9cc4d755f66a"); + params.put("departmentId", departmentId); + List userPOS = userService.listPO(params); if (userPOS.isEmpty()) { return; } List userIds = userPOS.stream().map(UserPO::getUserId).filter(StringUtils::isNotBlank).collect(Collectors.toList()); - Map> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date); - Map> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date); - // 删除当日数据 - deleteNPersonDayCount(date); - userPOS.forEach(userPO -> { - String userId = userPO.getUserId(); - List 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 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 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 dates = listDate(startTime, endTime); + dates.forEach(date -> { + Map> userSigninMap = KpiUtil.mapSignin(userSignService, userIds, date); + Map> userSignoutMap = KpiUtil.mapSignout(userSignService, userIds, date); + // 删除当日数据 + deleteNPersonDayCount(date); + userPOS.forEach(userPO -> { + String userId = userPO.getUserId(); + List 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 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 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 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 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 params = new HashMap<>(4); params.put("dayDate", date); @@ -234,8 +265,7 @@ public class KpiServiceImpl implements IKpiService { Map params = new HashMap<>(); params.put("areaId", areaId); params.put("communityId", communityId); - List communityPOS = communityService.listPO(params); - return communityPOS.stream().map(communityPO -> { + return Collections.synchronizedCollection(communityService.listPO(params)).parallelStream().map(communityPO -> { Map 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 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 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 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 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); diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/ReportCaseServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/ReportCaseServiceImpl.java index 6f05734..ecd58f4 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/ReportCaseServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/ReportCaseServiceImpl.java @@ -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 reportCaseDTOS = reportCaseDao.list(params); PageInfo pageInfo = new PageInfo<>(reportCaseDTOS); diff --git a/src/main/java/com/cm/bigdata/service/kpi/impl/UserServiceImpl.java b/src/main/java/com/cm/bigdata/service/kpi/impl/UserServiceImpl.java index bdcd2a1..b2b8739 100644 --- a/src/main/java/com/cm/bigdata/service/kpi/impl/UserServiceImpl.java +++ b/src/main/java/com/cm/bigdata/service/kpi/impl/UserServiceImpl.java @@ -23,4 +23,9 @@ public class UserServiceImpl implements IUserService { return userDao.listPO(params); } + @Override + public List listPO(Map params) { + return userDao.listPO(params); + } + } diff --git a/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml b/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml index b249251..15528e4 100644 --- a/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml +++ b/src/main/resources/mybatis/db2-mapper/kpi/report-case-mapper.xml @@ -186,6 +186,14 @@ city_report_case crc WHERE crc.is_delete = 0 + + AND + crc.area_id = #{areaId} + + + AND + crc.community_id = #{communityId} + AND LEFT(crc.gmt_create, 10) = ]]> #{startTime} @@ -211,6 +219,10 @@ crca.handle_user_id = #{handleUserId} ) + + AND + crc.case_status > 1 + AND crc.case_status > 3 diff --git a/src/main/resources/mybatis/db2-mapper/kpi/user-mapper.xml b/src/main/resources/mybatis/db2-mapper/kpi/user-mapper.xml index 97e0b5c..5f36b97 100644 --- a/src/main/resources/mybatis/db2-mapper/kpi/user-mapper.xml +++ b/src/main/resources/mybatis/db2-mapper/kpi/user-mapper.xml @@ -17,6 +17,19 @@ sys_user su WHERE is_delete = 0 + + AND + EXISTS ( + SELECT + 1 + FROM + sys_department_user sdu + WHERE + su.user_id = sdu.user_id + AND + sdu.department_id = #{departmentId} + ) + AND EXISTS ( diff --git a/src/main/resources/static/route/kpi/community-boss-count.html b/src/main/resources/static/route/kpi/community-boss-count.html index 84c44bc..7069335 100644 --- a/src/main/resources/static/route/kpi/community-boss-count.html +++ b/src/main/resources/static/route/kpi/community-boss-count.html @@ -10,7 +10,9 @@ - +
@@ -155,7 +157,7 @@ {field:'caseTotal', width:100, title: '案件总数', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, // {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 `${rowData}件`; } }, {field:'caseInspectTotal', width:160, title: '已检查案件', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, {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; diff --git a/src/main/resources/static/route/kpi/community-boss-day-count.html b/src/main/resources/static/route/kpi/community-boss-day-count.html index e290124..e3b6ba9 100644 --- a/src/main/resources/static/route/kpi/community-boss-day-count.html +++ b/src/main/resources/static/route/kpi/community-boss-day-count.html @@ -56,6 +56,9 @@ +
@@ -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); + }); + }); + }); }) diff --git a/src/main/resources/static/route/kpi/community-count.html b/src/main/resources/static/route/kpi/community-count.html index 4bcdcd9..2989f17 100644 --- a/src/main/resources/static/route/kpi/community-count.html +++ b/src/main/resources/static/route/kpi/community-count.html @@ -10,7 +10,9 @@ - +
@@ -147,25 +149,25 @@ {field:'caseTotal', width:100, title: '案件总数', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, {field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件' + return `${rowData}件`; } }, {field:'caseHandleTotal', width:160, title: '已处理案件', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, {field:'caseInspectTotal', width:160, title: '已检查案件', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, {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('数据加载中,请稍等...'); diff --git a/src/main/resources/static/route/kpi/detail/map/case-map.html b/src/main/resources/static/route/kpi/detail/map/case-map.html new file mode 100644 index 0000000..2f7fc5d --- /dev/null +++ b/src/main/resources/static/route/kpi/detail/map/case-map.html @@ -0,0 +1,69 @@ + + + + + + + + + + + + +
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/static/route/kpi/detail/user-case.html b/src/main/resources/static/route/kpi/detail/user-case.html index fe212a5..b340641 100644 --- a/src/main/resources/static/route/kpi/detail/user-case.html +++ b/src/main/resources/static/route/kpi/detail/user-case.html @@ -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 = '
'+ '
案件来源'+ sourceFormatter(row.caseSource) +'
'+ - ''+ + ''+ '
'+ row.caseContent +'
'+ '
'; 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); + } + }) }) diff --git a/src/main/resources/static/route/kpi/n-person-count.html b/src/main/resources/static/route/kpi/n-person-count.html index de471d9..de57044 100644 --- a/src/main/resources/static/route/kpi/n-person-count.html +++ b/src/main/resources/static/route/kpi/n-person-count.html @@ -10,7 +10,9 @@ - +
@@ -112,13 +114,13 @@ {field:'caseReportTotal', width:160, title: '上报案件总数', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, {field:'caseHandleTotal', width:160, title: '处理案件总数', align:'center', templet: function(row) { var rowData = row[this.field]; - return rowData + '件'; + return `${rowData}件`; } }, ]], @@ -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; diff --git a/src/main/resources/static/route/kpi/n-person-day-count.html b/src/main/resources/static/route/kpi/n-person-day-count.html index fa0ac72..d7663bb 100644 --- a/src/main/resources/static/route/kpi/n-person-day-count.html +++ b/src/main/resources/static/route/kpi/n-person-day-count.html @@ -41,6 +41,9 @@ +
@@ -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); + }); + }); + }); + })