From 4ab42c4dc15f365d0a622c709f6007247f21ed4f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 15:56:15 +0800 Subject: [PATCH 1/2] kaishijieshu --- .../dto/form/yt/CommunityLoginFormDTO.java | 9 ++++++--- .../form/yt/LoginLogCountByLevelFormDTO.java | 9 ++++++--- .../controller/StaffLoginLogController.java | 2 +- .../epmet/service/StaffLoginLogService.java | 4 ++-- .../service/impl/StaffLoginLogServiceImpl.java | 18 +++++++++--------- .../main/resources/mapper/StaffLoginLogDao.xml | 4 ++-- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java index 35aa64951f..5fc00d0691 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java @@ -1,6 +1,7 @@ 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; @@ -21,18 +22,20 @@ public class CommunityLoginFormDTO extends PageFormDTO { /** * 组织类型 */ - private String orgType; + private String level; /** * 开始日期:yyyy-MM-dd */ - @DateTimeFormat(pattern="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") + @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/form/yt/LoginLogCountByLevelFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java index ff485c832a..c115f530c9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.form.yt; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -20,18 +21,20 @@ public class LoginLogCountByLevelFormDTO { /** * 组织类型 */ - private String orgType; + private String level; /** * 开始日期:yyyy-MM-dd */ - @DateTimeFormat(pattern="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") + @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-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 19385e1298..deb09b74d5 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 @@ -36,7 +36,7 @@ public class StaffLoginLogController { */ @PostMapping("count-level") public Result countLevel(@RequestBody LoginLogCountByLevelFormDTO formDTO) { - return new Result().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStartDate(), formDTO.getEndDate())); + return new Result().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getLevel(), formDTO.getStartDate(), formDTO.getEndDate())); } /** 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 25c5fe48f8..901abab32d 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 @@ -27,12 +27,12 @@ public interface StaffLoginLogService extends BaseService { * 返回市级账号登录总次数、区县级账号登录总次数、镇街级账号登录总次数、社区级账号登录总次数 * * @param orgId 为空时,默认当前登录用户所属组织id - * @param orgType + * @param level * @param startDate yyyy-MM-dd * @param endDate yyyy-MM-dd * @return */ - LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate); + LoginLogCountByLevelResultDTO countLevel(String orgId, String level, Date startDate, Date endDate); /** * 下级社区账号登录次数排名 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 007b7d572a..bb2f33a8b5 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 @@ -84,21 +84,21 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl cityWrapper = new LambdaQueryWrapper<>(); cityWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) @@ -126,7 +126,7 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); PageInfo pageInfo = new PageInfo<>(list); - return new PageData<>(list, pageInfo.getTotal()); + return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize()); } // 不分页 List list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); 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 c0af48c5b3..54980a8b24 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 @@ -41,10 +41,10 @@ AND l.ORG_ID_PATH LIKE concat( #{orgIdPath}, '%' ) AND l.AGENCY_LEVEL = 'community' - l.LOGIN_TIME >= #{startDate} + and l.LOGIN_TIME >= #{startDate} - l.LOGIN_TIME <= #{endDate} + and l.LOGIN_TIME <= #{endDate} GROUP BY l.AGENCY_ID From d4525b4e53bd0805bb24f8f657739024f309cc80 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 16:12:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9F=B1=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StaffLoginLogController.java | 12 ++++++++++ .../java/com/epmet/dao/StaffLoginLogDao.java | 11 ++++++++++ .../epmet/service/StaffLoginLogService.java | 10 +++++++++ .../impl/StaffLoginLogServiceImpl.java | 20 ++++++++++++++++- .../resources/mapper/StaffLoginLogDao.xml | 22 +++++++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) 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 deb09b74d5..03984e80fb 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 @@ -48,4 +48,16 @@ public class StaffLoginLogController { return new Result>().ok(staffLoginLogService.pageCommunityCount(formDTO)); } + /** + * 柱状图:下级组织账号登录次数汇总 + * + * @param formDTO + * @return + */ + @PostMapping("sub-count") + public Result> querySubCount(@RequestBody LoginLogCountByLevelFormDTO formDTO) { + return new Result>().ok(staffLoginLogService.querySubCount(formDTO.getOrgId(), formDTO.getLevel(), formDTO.getStartDate(), formDTO.getEndDate())); + } + + } 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 43e5479aa7..2ad70b214e 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 @@ -28,4 +28,15 @@ public interface StaffLoginLogDao extends BaseDao { List pageCommunityCount(@Param("orgIdPath") String orgIdPath, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + + /** + * 柱状图:下级组织账号登录次数汇总 + * @param orgId + * @param startDate + * @param endDate + * @return + */ + List querySubCount(@Param("orgId") String orgId, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); } \ 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 901abab32d..50bf65c8fa 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 @@ -41,4 +41,14 @@ public interface StaffLoginLogService extends BaseService { * @return */ PageData pageCommunityCount(CommunityLoginFormDTO formDTO); + + /** + * 柱状图:下级组织账号登录次数汇总 + * @param orgId + * @param level + * @param startDate + * @param endDate + * @return + */ + PageData querySubCount(String orgId, String level, Date startDate, Date endDate); } \ 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 bb2f33a8b5..c22cbb8d21 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 @@ -207,5 +207,23 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl querySubCount(String orgId, String level, Date startDate, Date endDate) { + if (StringUtils.isBlank(orgId)) { + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); + orgId = staffInfoCacheResult.getAgencyId(); + } + List list = baseDao.querySubCount(orgId, startDate, endDate); + int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); + return new PageData(list, total, total); + } } \ No newline at end of file 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 54980a8b24..6ef4d35ded 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 @@ -50,4 +50,26 @@ l.AGENCY_ID order by count(1) desc + + + \ No newline at end of file