diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java new file mode 100644 index 0000000000..ab3996a085 --- /dev/null +++ b/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; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/AccountActivityInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/AccountActivityInfo.java new file mode 100644 index 0000000000..b63ed0c20f --- /dev/null +++ b/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 = ""; + + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/ActivityTatalInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/ActivityTatalInfo.java new file mode 100644 index 0000000000..a92b42661d --- /dev/null +++ b/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 = ""; + + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java index eb2d5ed42b..38a466d3c2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffLoginLogController.java +++ b/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.utils.Result; 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.result.yt.ActivityTatalInfo; import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; 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.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.epmet.dto.result.yt.AccountActivityInfo; /** @@ -41,6 +44,7 @@ public class StaffLoginLogController { /** * 下级社区账号登录次数排名 + * * @return */ @PostMapping("community-count") @@ -75,6 +79,7 @@ public class StaffLoginLogController { /** * 查看街镇 + * * @param formDTO * @return */ @@ -85,4 +90,29 @@ public class StaffLoginLogController { formDTO.getEndDate(), formDTO.getIsPage(), formDTO.getPageNo(), formDTO.getPageSize())); } + + /*** + * 获取当前agencyid下 下级组织活跃情况 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author qushutong + * @date 2023/4/6 13:41 + */ + @PostMapping("getAccountActivityInfo") + public Result> getAccountActivityInfo(@RequestBody CountActivityFormDTO formDTO) { + return new Result>().ok(staffLoginLogService.getAccountActivityInfo(formDTO)); + } + + /*** + * 获取活跃度总数 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author qushutong + * @date 2023/4/6 17:35 + */ + @PostMapping("getActivityTotal") + public Result getActivityTotal(@RequestBody CountActivityFormDTO formDTO) { + return new Result().ok(staffLoginLogService.getActivityTotal(formDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java index ea6fbcab85..0db1338752 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffLoginLogDao.java @@ -1,7 +1,10 @@ package com.epmet.dao; 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.AccountActivityInfo; import com.epmet.entity.StaffLoginLogEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -20,6 +23,7 @@ public interface StaffLoginLogDao extends BaseDao { /** * 各社区登录总次数 + * * @param orgId * @param startDate * @param endDate @@ -31,6 +35,7 @@ public interface StaffLoginLogDao extends BaseDao { /** * 柱状图:下级组织账号登录次数汇总 + * * @param orgId * @param startDate * @param endDate @@ -42,16 +47,29 @@ public interface StaffLoginLogDao extends BaseDao { /** * 各区县登录总次数 + * * @param orgId * @param startDate * @param endDate * @return */ - List pageDistrictCount(@Param("orgId")String orgId, - @Param("startDate")Date startDate, - @Param("endDate")Date endDate); + List pageDistrictCount(@Param("orgId") String orgId, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); - List pageStreetCount(@Param("orgId")String orgId, - @Param("startDate")Date startDate, - @Param("endDate")Date endDate); + List 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 selectListActivityInfo(CountActivityFormDTO formDTO); + + + ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java index d7d21d53db..5d39463647 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java +++ b/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.tools.page.PageData; 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.LoginLogCountByLevelResultDTO; +import com.epmet.dto.result.yt.AccountActivityInfo; import com.epmet.entity.StaffLoginLogEntity; import java.util.Date; @@ -18,6 +21,7 @@ import java.util.Date; public interface StaffLoginLogService extends BaseService { /** * 登录,插入记录 + * * @param staffId * @param loginTime */ @@ -44,6 +48,7 @@ public interface StaffLoginLogService extends BaseService { /** * 柱状图:下级组织账号登录次数汇总 + * * @param orgId * @param level * @param startDate @@ -54,6 +59,7 @@ public interface StaffLoginLogService extends BaseService { /** * 查看区县 + * * @param orgId * @param level * @param startDate @@ -67,6 +73,7 @@ public interface StaffLoginLogService extends BaseService { /** * 查看街镇 + * * @param orgId * @param startDate * @param endDate @@ -76,4 +83,15 @@ public interface StaffLoginLogService extends BaseService { * @return */ PageData 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 getAccountActivityInfo(CountActivityFormDTO formDTO); + + ActivityTatalInfo getActivityTotal(CountActivityFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java index b362881243..85e498a6c3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java +++ b/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.CustomerStaffDTO; 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.LoginLogCountByLevelResultDTO; +import com.epmet.dto.result.yt.AccountActivityInfo; import com.epmet.entity.StaffLoginLogEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.CustomerAgencyService; @@ -84,7 +87,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl districtWrapper = new LambdaQueryWrapper<>(); districtWrapper.eq(StaffLoginLogEntity::getPid, orgId) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.DISTRICT) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.DISTRICT) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setDistrictCount(baseDao.selectCount(districtWrapper)); // 市级下面所有街道 LambdaQueryWrapper streetWrapper = new LambdaQueryWrapper<>(); streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); // 市级下面所有社区 LambdaQueryWrapper communityWrapper = new LambdaQueryWrapper<>(); communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); @@ -138,14 +141,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl streetWrapper = new LambdaQueryWrapper<>(); streetWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.STREET) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.STREET) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setStreetCount(baseDao.selectCount(streetWrapper)); // 去线下所有社区 LambdaQueryWrapper communityWrapper = new LambdaQueryWrapper<>(); communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); @@ -159,10 +162,11 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl communityWrapper = new LambdaQueryWrapper<>(); communityWrapper.like(StaffLoginLogEntity::getOrgIdPath, orgIdPath) - .eq(StaffLoginLogEntity::getAgencyLevel,Constant.COMMUNITY) + .eq(StaffLoginLogEntity::getAgencyLevel, Constant.COMMUNITY) .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); @@ -180,6 +184,18 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl getAccountActivityInfo(CountActivityFormDTO formDTO) { + List 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 list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); PageInfo pageInfo = new PageInfo<>(list); - return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize()); + return new PageData<>(list, pageInfo.getTotal(), formDTO.getPageSize()); } // 不分页 List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); @@ -243,16 +259,16 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl pageDistrictCount(String orgId, String level, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { if (StringUtils.isBlank(orgId)) { CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); - orgId=staffInfoCacheResult.getAgencyId(); + orgId = staffInfoCacheResult.getAgencyId(); } if (isPage) { PageHelper.startPage(pageNo, pageSize); List list = baseDao.pageDistrictCount(orgId, startDate, endDate); PageInfo pageInfo = new PageInfo<>(list); - return new PageData<>(list, pageInfo.getTotal(),pageSize); + return new PageData<>(list, pageInfo.getTotal(), pageSize); } // 不分页 - List list = baseDao.pageDistrictCount(orgId,startDate, endDate); + List list = baseDao.pageDistrictCount(orgId, startDate, endDate); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData<>(list, total, total); } @@ -269,19 +285,19 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl streetCount(String orgId,Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { + public PageData streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize) { if (StringUtils.isBlank(orgId)) { CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); - orgId=staffInfoCacheResult.getAgencyId(); + orgId = staffInfoCacheResult.getAgencyId(); } if (isPage) { PageHelper.startPage(pageNo, pageSize); List list = baseDao.pageStreetCount(orgId, startDate, endDate); PageInfo pageInfo = new PageInfo<>(list); - return new PageData<>(list, pageInfo.getTotal(),pageSize); + return new PageData<>(list, pageInfo.getTotal(), pageSize); } // 不分页 - List list = baseDao.pageStreetCount(orgId,startDate, endDate); + List list = baseDao.pageStreetCount(orgId, startDate, endDate); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData<>(list, total, total); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml index d0f43fb828..8bf8d36d2e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffLoginLogDao.xml @@ -25,49 +25,81 @@ + + SELECT - ca.id AS agencyId, - ca.ORGANIZATION_NAME AS agencyName, - ca.LEVEL AS agencyLevel, - count(l.id) AS count + ca.id AS agencyId, + ca.ORGANIZATION_NAME AS agencyName, + ca.LEVEL AS agencyLevel, + count(l.id) AS count FROM customer_agency ca left join staff_login_log l ON ( ca.ID =l.AGENCY_ID and l.DEL_FLAG = '0') WHERE - ca.DEL_FLAG = '0' - and (ca.id=#{orgId} or ca.pids like concat('%',#{orgId},'%') ) + ca.DEL_FLAG = '0' + and (ca.id=#{orgId} or ca.pids like concat('%',#{orgId},'%') ) AND ca.LEVEL = 'district' - + and l.LOGIN_TIME >= #{startDate} - - and l.LOGIN_TIME <= #{endDate} + + and l.LOGIN_TIME <= #{endDate} GROUP BY - ca.id - order by count(l.id) desc + ca.id + order by count(l.id) desc + + \ No newline at end of file