增加手动同步数据

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

View File

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

View File

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

View File

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

View File

@ -23,4 +23,9 @@ public class UserServiceImpl implements IUserService {
return userDao.listPO(params); 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 city_report_case crc
WHERE WHERE
crc.is_delete = 0 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 != ''"> <if test="startTime != null and startTime != ''">
AND AND
LEFT(crc.gmt_create, 10) <![CDATA[ >= ]]> #{startTime} LEFT(crc.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
@ -211,6 +219,10 @@
crca.handle_user_id = #{handleUserId} crca.handle_user_id = #{handleUserId}
) )
</if> </if>
<if test="isAccept != null and isAccept == 1">
AND
crc.case_status > 1
</if>
<if test="isHandle != null and isHandle == 1"> <if test="isHandle != null and isHandle == 1">
AND AND
crc.case_status > 3 crc.case_status > 3

View File

@ -17,6 +17,19 @@
sys_user su sys_user su
WHERE WHERE
is_delete = 0 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 != ''"> <if test="roleId != null and roleId != ''">
AND AND
EXISTS ( EXISTS (

View File

@ -10,7 +10,9 @@
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/> <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/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all"> <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.layui-table-cell a {text-decoration: underline;}
</style>
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
@ -155,7 +157,7 @@
{field:'caseTotal', width:100, title: '案件总数', align:'center', {field:'caseTotal', width:100, title: '案件总数', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', // {field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center',
@ -167,13 +169,13 @@
{field:'caseHandleTotal', width:160, title: '已处理案件', align:'center', {field:'caseHandleTotal', width:160, title: '已处理案件', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {field:'caseInspectTotal', width:160, title: '已检查案件', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {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() { function reloadTable() {
dataLoading = true; dataLoading = true;

View File

@ -56,6 +56,9 @@
<button type="button" id="search" class="layui-btn layui-btn-sm"> <button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索 <i class="fa fa-lg fa-search"></i> 搜索
</button> </button>
<button type="button" id="refreshData" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-refresh"></i> 更新数据
</button>
</div> </div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table> <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
@ -342,6 +345,26 @@
reloadTable(1); 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> </script>
</body> </body>

View File

@ -10,7 +10,9 @@
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/> <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/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all"> <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.layui-table-cell a {text-decoration: underline;}
</style>
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
@ -147,25 +149,25 @@
{field:'caseTotal', width:100, title: '案件总数', align:'center', {field:'caseTotal', width:100, title: '案件总数', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {field:'caseHandleTotal', width:160, title: '已处理案件', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {field:'caseInspectTotal', width:160, title: '已检查案件', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {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() { $(document).on('click', '#search', function() {
if(dataLoading){ if(dataLoading){
layer.msg('数据加载中,请稍等...'); 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 handleUserId = queryParams.handleUserId;
var startTime = queryParams.startTime; var startTime = queryParams.startTime;
var endTime = queryParams.endTime; var endTime = queryParams.endTime;
var isAccept = queryParams.isAccept;
var isHandle = queryParams.isHandle; var isHandle = queryParams.isHandle;
var isInspect = queryParams.isInspect; var isInspect = queryParams.isInspect;
var isOnfile = queryParams.isOnfile; var isOnfile = queryParams.isOnfile;
var areaId = queryParams.areaId;
var communityId = queryParams.communityId;
var tableUrl = 'api/kpi/listpage-case'; var tableUrl = 'api/kpi/listpage-case';
var dataLoading = false; var dataLoading = false;
@ -86,9 +89,12 @@
endTime : endTime ? endTime : '', endTime : endTime ? endTime : '',
userId : userId ? userId : '', userId : userId ? userId : '',
handleUserId : handleUserId ? handleUserId : '', handleUserId : handleUserId ? handleUserId : '',
isAccept: isAccept ? isAccept : '',
isHandle: isHandle ? isHandle : '', isHandle: isHandle ? isHandle : '',
isInspect: isInspect ? isInspect : '', isInspect: isInspect ? isInspect : '',
isOnfile: isOnfile ? isOnfile : '', isOnfile: isOnfile ? isOnfile : '',
areaId: areaId ? areaId : '',
communityId: communityId ? communityId : '',
}, },
width: admin.screen() > 1 ? '100%' : '', width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 20, height: $win.height() - 20,
@ -142,7 +148,7 @@
templet: function (row) { templet: function (row) {
var value = '<div style="text-align: left">'+ 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"><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 class="info-row"><span class="col-content">'+ row.caseContent +'</span></div>'+
'</div>'; '</div>';
return value; return value;
@ -247,6 +253,20 @@
return value; 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> </script>
</body> </body>

View File

@ -10,7 +10,9 @@
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/> <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/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all"> <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.layui-table-cell a {text-decoration: underline;}
</style>
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-fluid layui-anim layui-anim-fadein">
@ -112,13 +114,13 @@
{field:'caseReportTotal', width:160, title: '上报案件总数', align:'center', {field:'caseReportTotal', width:160, title: '上报案件总数', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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', {field:'caseHandleTotal', width:160, title: '处理案件总数', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; 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() { function reloadTable() {
dataLoading = true; dataLoading = true;

View File

@ -41,6 +41,9 @@
<button type="button" id="search" class="layui-btn layui-btn-sm"> <button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索 <i class="fa fa-lg fa-search"></i> 搜索
</button> </button>
<button type="button" id="refreshData" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-refresh"></i> 更新数据
</button>
</div> </div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table> <table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
@ -242,6 +245,26 @@
reloadTable(1); 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> </script>
</body> </body>