Browse Source

活跃度统计计算

dev
曲树通 2 years ago
parent
commit
c092c37e15
  1. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java
  2. 44
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/AccountActivityInfo.java
  3. 30
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/ActivityTatalInfo.java
  4. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java
  5. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java
  6. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java
  7. 44
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java
  8. 73
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

37
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.form.yt;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Description 下级社区账号登录次数排名入参
* @Author yzm
* @Date 2023/4/6 14:18
*/
@Data
public class CountActivityFormDTO extends PageFormDTO {
/**
* 所选择的组织id
*/
private String orgId;
/**
* 开始日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startDate;
/**
* 截止日期yyyy-MM-dd
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endDate;
}

44
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/AccountActivityInfo.java

@ -0,0 +1,44 @@
package com.epmet.dto.result.yt;
import lombok.Data;
import java.io.Serializable;
/**
* @author: qushutong
* @Date: 2023/4/6 13:33
* @Description: 账户活跃情况
*/
@Data
public class AccountActivityInfo implements Serializable {
private static final long serialVersionUID = -918630886413844674L;
/**
* 组织名称
*/
private String agencyName = "";
/**
* 登陆次数
*/
private String loginCount = "";
/**
* 活跃账号数
*/
private String accountActivityCount = "";
/**
* 总账号数
*/
private String accountCount = "";
/**
* 组织id
*/
private String agencyId = "";
}

30
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/ActivityTatalInfo.java

@ -0,0 +1,30 @@
package com.epmet.dto.result.yt;
import lombok.Data;
import java.io.Serializable;
/**
* @author: qushutong
* @Date: 2023/4/6 13:33
* @Description: 账户活跃总数
*/
@Data
public class ActivityTatalInfo implements Serializable {
private static final long serialVersionUID = -918630886413844674L;
/**
* 不活跃账号总数
*/
private String inactivityCount = "";
/**
* 活跃账号总数
*/
private String activityCount = "";
}

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java

@ -3,7 +3,9 @@ package com.epmet.controller;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CommunityLoginFormDTO;
import com.epmet.dto.form.yt.CountActivityFormDTO;
import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO; import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO;
import com.epmet.dto.result.yt.ActivityTatalInfo;
import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
import com.epmet.service.StaffLoginLogService; import com.epmet.service.StaffLoginLogService;
@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.epmet.dto.result.yt.AccountActivityInfo;
/** /**
@ -41,6 +44,7 @@ public class StaffLoginLogController {
/** /**
* 下级社区账号登录次数排名 * 下级社区账号登录次数排名
*
* @return * @return
*/ */
@PostMapping("community-count") @PostMapping("community-count")
@ -75,6 +79,7 @@ public class StaffLoginLogController {
/** /**
* 查看街镇 * 查看街镇
*
* @param formDTO * @param formDTO
* @return * @return
*/ */
@ -85,4 +90,29 @@ public class StaffLoginLogController {
formDTO.getEndDate(), formDTO.getIsPage(), formDTO.getEndDate(), formDTO.getIsPage(),
formDTO.getPageNo(), formDTO.getPageSize())); formDTO.getPageNo(), formDTO.getPageSize()));
} }
/***
* 获取当前agencyid下 下级组织活跃情况
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.yt.AccountActivityInfo>
* @author qushutong
* @date 2023/4/6 13:41
*/
@PostMapping("getAccountActivityInfo")
public Result<PageData<AccountActivityInfo>> getAccountActivityInfo(@RequestBody CountActivityFormDTO formDTO) {
return new Result<PageData<AccountActivityInfo>>().ok(staffLoginLogService.getAccountActivityInfo(formDTO));
}
/***
* 获取活跃度总数
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.dto.result.yt.AccountActivityInfo>>
* @author qushutong
* @date 2023/4/6 17:35
*/
@PostMapping("getActivityTotal")
public Result<ActivityTatalInfo> getActivityTotal(@RequestBody CountActivityFormDTO formDTO) {
return new Result<ActivityTatalInfo>().ok(staffLoginLogService.getActivityTotal(formDTO));
}
} }

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java

@ -1,7 +1,10 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.yt.CountActivityFormDTO;
import com.epmet.dto.result.yt.ActivityTatalInfo;
import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.AccountActivityInfo;
import com.epmet.entity.StaffLoginLogEntity; import com.epmet.entity.StaffLoginLogEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -20,6 +23,7 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
/** /**
* 各社区登录总次数 * 各社区登录总次数
*
* @param orgId * @param orgId
* @param startDate * @param startDate
* @param endDate * @param endDate
@ -31,6 +35,7 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
/** /**
* 柱状图下级组织账号登录次数汇总 * 柱状图下级组织账号登录次数汇总
*
* @param orgId * @param orgId
* @param startDate * @param startDate
* @param endDate * @param endDate
@ -42,16 +47,29 @@ public interface StaffLoginLogDao extends BaseDao<StaffLoginLogEntity> {
/** /**
* 各区县登录总次数 * 各区县登录总次数
*
* @param orgId * @param orgId
* @param startDate * @param startDate
* @param endDate * @param endDate
* @return * @return
*/ */
List<CommunityLoginResultDTO> pageDistrictCount(@Param("orgId")String orgId, List<CommunityLoginResultDTO> pageDistrictCount(@Param("orgId") String orgId,
@Param("startDate")Date startDate, @Param("startDate") Date startDate,
@Param("endDate")Date endDate); @Param("endDate") Date endDate);
List<CommunityLoginResultDTO> pageStreetCount(@Param("orgId") String orgId,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
/***
* 获取登陆情况
* @param formDTO
* @return com.epmet.dto.result.yt.AccountActivityInfo
* @author qushutong
* @date 2023/4/6 13:47
*/
List<AccountActivityInfo> selectListActivityInfo(CountActivityFormDTO formDTO);
List<CommunityLoginResultDTO> pageStreetCount(@Param("orgId")String orgId, ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO);
@Param("startDate")Date startDate,
@Param("endDate")Date endDate);
} }

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java

@ -3,8 +3,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CommunityLoginFormDTO;
import com.epmet.dto.form.yt.CountActivityFormDTO;
import com.epmet.dto.result.yt.ActivityTatalInfo;
import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
import com.epmet.dto.result.yt.AccountActivityInfo;
import com.epmet.entity.StaffLoginLogEntity; import com.epmet.entity.StaffLoginLogEntity;
import java.util.Date; import java.util.Date;
@ -18,6 +21,7 @@ import java.util.Date;
public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> { public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
/** /**
* 登录插入记录 * 登录插入记录
*
* @param staffId * @param staffId
* @param loginTime * @param loginTime
*/ */
@ -44,6 +48,7 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
/** /**
* 柱状图下级组织账号登录次数汇总 * 柱状图下级组织账号登录次数汇总
*
* @param orgId * @param orgId
* @param level * @param level
* @param startDate * @param startDate
@ -54,6 +59,7 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
/** /**
* 查看区县 * 查看区县
*
* @param orgId * @param orgId
* @param level * @param level
* @param startDate * @param startDate
@ -67,6 +73,7 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
/** /**
* 查看街镇 * 查看街镇
*
* @param orgId * @param orgId
* @param startDate * @param startDate
* @param endDate * @param endDate
@ -76,4 +83,15 @@ public interface StaffLoginLogService extends BaseService<StaffLoginLogEntity> {
* @return * @return
*/ */
PageData<CommunityLoginResultDTO> streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize); PageData<CommunityLoginResultDTO> streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize);
/***
* 获取登陆情况
* @param formDTO
* @return com.epmet.dto.result.yt.AccountActivityInfo
* @author qushutong
* @date 2023/4/6 13:47
*/
PageData<AccountActivityInfo> getAccountActivityInfo(CountActivityFormDTO formDTO);
ActivityTatalInfo getActivityTotal(CountActivityFormDTO formDTO);
} }

44
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java

@ -15,8 +15,11 @@ import com.epmet.dao.StaffLoginLogDao;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CommunityLoginFormDTO;
import com.epmet.dto.form.yt.CountActivityFormDTO;
import com.epmet.dto.result.yt.ActivityTatalInfo;
import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.CommunityLoginResultDTO;
import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO;
import com.epmet.dto.result.yt.AccountActivityInfo;
import com.epmet.entity.StaffLoginLogEntity; import com.epmet.entity.StaffLoginLogEntity;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerAgencyService;
@ -108,21 +111,21 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
// 市下面区县账号 // 市下面区县账号
LambdaQueryWrapper<StaffLoginLogEntity> districtWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> districtWrapper = new LambdaQueryWrapper<>();
districtWrapper.eq(StaffLoginLogEntity::getPid, orgId) districtWrapper.eq(StaffLoginLogEntity::getPid, orgId)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.DISTRICT) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.DISTRICT)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setDistrictCount(baseDao.selectCount(districtWrapper)); resultDTO.setDistrictCount(baseDao.selectCount(districtWrapper));
// 市级下面所有街道 // 市级下面所有街道
LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>();
streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); resultDTO.setStreetCount(baseDao.selectCount(streetWrapper));
// 市级下面所有社区 // 市级下面所有社区
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>();
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper));
@ -138,14 +141,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
// 区县下所有的街道 // 区县下所有的街道
LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> streetWrapper = new LambdaQueryWrapper<>();
streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); resultDTO.setStreetCount(baseDao.selectCount(streetWrapper));
// 去线下所有社区 // 去线下所有社区
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>();
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper));
@ -159,10 +162,11 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); resultDTO.setStreetCount(baseDao.selectCount(streetWrapper));
// 街道下所有社区 // 街道下所有社区
LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StaffLoginLogEntity> communityWrapper = new LambdaQueryWrapper<>();
communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath)
.eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY)
.between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate);
resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper));
@ -180,6 +184,18 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
return resultDTO; return resultDTO;
} }
@Override
public PageData<AccountActivityInfo> getAccountActivityInfo(CountActivityFormDTO formDTO) {
List<AccountActivityInfo> accountActivityInfos = baseDao.selectListActivityInfo(formDTO);
int total = CollectionUtils.isEmpty(accountActivityInfos) ? NumConstant.ZERO : accountActivityInfos.size();
return new PageData<>(accountActivityInfos, total);
}
@Override
public ActivityTatalInfo getActivityTotal(CountActivityFormDTO formDTO) {
return baseDao.selectOneActivityTotal(formDTO);
}
/** /**
* 下级社区账号登录次数排名 * 下级社区账号登录次数排名
* *
@ -197,7 +213,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate());
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize()); return new PageData<>(list, pageInfo.getTotal(), formDTO.getPageSize());
} }
// 不分页 // 不分页
List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); List<CommunityLoginResultDTO> list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate());
@ -243,16 +259,16 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
public PageData<CommunityLoginResultDTO> pageDistrictCount(String orgId, String level, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { public PageData<CommunityLoginResultDTO> pageDistrictCount(String orgId, String level, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) {
if (StringUtils.isBlank(orgId)) { if (StringUtils.isBlank(orgId)) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
orgId=staffInfoCacheResult.getAgencyId(); orgId = staffInfoCacheResult.getAgencyId();
} }
if (isPage) { if (isPage) {
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId, startDate, endDate); List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId, startDate, endDate);
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(),pageSize); return new PageData<>(list, pageInfo.getTotal(), pageSize);
} }
// 不分页 // 不分页
List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId,startDate, endDate); List<CommunityLoginResultDTO> list = baseDao.pageDistrictCount(orgId, startDate, endDate);
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<>(list, total, total); return new PageData<>(list, total, total);
} }
@ -269,19 +285,19 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl<StaffLoginLogDao,
* @return * @return
*/ */
@Override @Override
public PageData<CommunityLoginResultDTO> streetCount(String orgId,Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { public PageData<CommunityLoginResultDTO> streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) {
if (StringUtils.isBlank(orgId)) { if (StringUtils.isBlank(orgId)) {
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId());
orgId=staffInfoCacheResult.getAgencyId(); orgId = staffInfoCacheResult.getAgencyId();
} }
if (isPage) { if (isPage) {
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId, startDate, endDate); List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId, startDate, endDate);
PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list); PageInfo<CommunityLoginResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal(),pageSize); return new PageData<>(list, pageInfo.getTotal(), pageSize);
} }
// 不分页 // 不分页
List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId,startDate, endDate); List<CommunityLoginResultDTO> list = baseDao.pageStreetCount(orgId, startDate, endDate);
int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size();
return new PageData<>(list, total, total); return new PageData<>(list, total, total);
} }

73
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml

@ -40,16 +40,48 @@
ca.DEL_FLAG = '0' ca.DEL_FLAG = '0'
AND (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') ) AND (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') )
AND ca.LEVEL = 'community' AND ca.LEVEL = 'community'
<if test ='null != startDate'> <if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate} and l.LOGIN_TIME &gt;= #{startDate}
</if> </if>
<if test ='null != endDate'> <if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate} and l.LOGIN_TIME &lt;= #{endDate}
</if> </if>
GROUP BY GROUP BY
ca.id ca.id
order by count(l.id) desc order by count(l.id) desc
</select> </select>
<!--社区活跃列表-->
<select id="selectListActivityInfo" resultType="com.epmet.dto.result.yt.AccountActivityInfo">
SELECT
COUNT(DISTINCT(l.id)) AS loginCount,
COUNT(DISTINCT(l.STAFF_ID)) accountActivityCount,
COUNT(DISTINCT(ag.USER_ID)) accountCount,
a.ID agencyId,
a.ORGANIZATION_NAME agencyName
FROM
customer_agency a
LEFT JOIN staff_login_log l ON a.ID = l.AGENCY_ID
AND a.`LEVEL` = l.AGENCY_LEVEL
AND l.DEL_FLAG = '0'
LEFT JOIN customer_staff_agency ag ON a.ID = ag.AGENCY_ID
AND ag.DEL_FLAG = '0'
WHERE
a.DEL_FLAG = '0'
a.`LEVEL` = 'community'
<if test="agencyId!= null and agencyId.trim() != ''">
AND a.PIDS LIKE CONCAT('%',#{orgId},'%')
</if>
<if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate}
</if>
<if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate}
</if>
GROUP BY
a.ID
ORDER BY
COUNT(DISTINCT(l.id)) DESC;
</select>
<!-- 柱状图:下级组织账号登录次数汇总 --> <!-- 柱状图:下级组织账号登录次数汇总 -->
<select id="querySubCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO"> <select id="querySubCount" parameterType="map" resultType="com.epmet.dto.result.yt.CommunityLoginResultDTO">
@ -63,10 +95,10 @@
on(ca.ID=l.AGENCY_ID) on(ca.ID=l.AGENCY_ID)
where ca.DEL_FLAG='0' where ca.DEL_FLAG='0'
and ca.PID = #{orgId} and ca.PID = #{orgId}
<if test ='null != startDate'> <if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate} and l.LOGIN_TIME &gt;= #{startDate}
</if> </if>
<if test ='null != endDate'> <if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate} and l.LOGIN_TIME &lt;= #{endDate}
</if> </if>
group by ca.id group by ca.id
@ -85,10 +117,10 @@
ca.DEL_FLAG = '0' ca.DEL_FLAG = '0'
and (ca.id=#{orgId} or ca.pids like concat('%',#{orgId},'%') ) and (ca.id=#{orgId} or ca.pids like concat('%',#{orgId},'%') )
AND ca.LEVEL = 'district' AND ca.LEVEL = 'district'
<if test ='null != startDate'> <if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate} and l.LOGIN_TIME &gt;= #{startDate}
</if> </if>
<if test ='null != endDate'> <if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate} and l.LOGIN_TIME &lt;= #{endDate}
</if> </if>
GROUP BY GROUP BY
@ -109,14 +141,39 @@
ca.DEL_FLAG = '0' ca.DEL_FLAG = '0'
and (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') ) and (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') )
AND ca.LEVEL = 'street' AND ca.LEVEL = 'street'
<if test ='null != startDate'> <if test='null != startDate'>
and l.LOGIN_TIME &gt;= #{startDate} and l.LOGIN_TIME &gt;= #{startDate}
</if> </if>
<if test ='null != endDate'> <if test='null != endDate'>
and l.LOGIN_TIME &lt;= #{endDate} and l.LOGIN_TIME &lt;= #{endDate}
</if> </if>
GROUP BY GROUP BY
ca.id ca.id
order by count(l.id) desc order by count(l.id) desc
</select> </select>
<select id="selectOneActivityTotal" resultType="com.epmet.dto.result.yt.ActivityTatalInfo">
SELECT
COUNT(t.activityCount = '0' OR NULL) inactivityCount,
COUNT(t.activityCount > '0' OR NULL) activityCount
FROM
(
SELECT
COUNT(DISTINCT(l.ID)) activityCount
FROM
customer_agency a
LEFT JOIN staff_login_log l ON a.ID = l.AGENCY_ID
WHERE
a.PIDS LIKE CONCAT(
'%',
#{orgId},
'%'
)
AND a.`LEVEL` = 'community'
AND a.DEL_FLAG = '0'
GROUP BY
a.ID
) t;
</select>
</mapper> </mapper>
Loading…
Cancel
Save