From 75c7fca923b3b97635b2d564c003f019baf60d03 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 18 Apr 2023 15:07:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=99=BB=E5=BD=95=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=83=85=E5=86=B5=EF=BC=8C=E6=9F=B1=E7=8A=B6=E5=9B=BE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/StaffLoginLogDao.java | 7 ++++ .../impl/StaffLoginLogServiceImpl.java | 32 ++++++++++++++- .../resources/mapper/StaffLoginLogDao.xml | 40 +++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) 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 0db1338752..e3f1252b8f 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 @@ -33,6 +33,9 @@ public interface StaffLoginLogDao extends BaseDao { @Param("startDate") Date startDate, @Param("endDate") Date endDate); + List selectCommunityCount(@Param("orgId") String orgId, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); /** * 柱状图:下级组织账号登录次数汇总 * @@ -72,4 +75,8 @@ public interface StaffLoginLogDao extends BaseDao { ActivityTatalInfo selectOneActivityTotal(CountActivityFormDTO formDTO); + + Integer selectLoginTotalByPath(@Param("orgIdPath") String orgIdPath, + @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/impl/StaffLoginLogServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java index a47241caf1..37e27b83b1 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 @@ -9,17 +9,20 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.CustomerAgencyDao; 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.AccountActivityInfo; 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.CustomerAgencyEntity; import com.epmet.entity.StaffLoginLogEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.CustomerAgencyService; @@ -32,6 +35,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -45,6 +49,8 @@ import java.util.List; public class StaffLoginLogServiceImpl extends BaseServiceImpl implements StaffLoginLogService { @Autowired private EpmetUserOpenFeignClient userOpenFeignClient; + @Autowired + private CustomerAgencyDao customerAgencyDao; /** @@ -242,8 +248,30 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.selectCommunityCount(orgId, startDate, endDate); + int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); + return new PageData(list, total, total); + } + //先查询出下级组织 + LambdaQueryWrapper agencyWrapper=new LambdaQueryWrapper<>(); + agencyWrapper.eq(CustomerAgencyEntity::getPid,orgId).orderByAsc(CustomerAgencyEntity::getCreatedTime); + List subAgencyList=customerAgencyDao.selectList(agencyWrapper); + List list=new ArrayList<>(); + for(CustomerAgencyEntity agencyEntity:subAgencyList){ + CommunityLoginResultDTO resultDTO=new CommunityLoginResultDTO(); + resultDTO.setAgencyId(agencyEntity.getId()); + resultDTO.setAgencyName(agencyEntity.getOrganizationName()); + resultDTO.setAgencyLevel(agencyEntity.getLevel()); + String orgIdPath=PidUtils.convertPid2OrgIdPath(agencyEntity.getId(),agencyEntity.getPids()); + //查询本组织及下级 + resultDTO.setCount(baseDao.selectLoginTotalByPath(orgIdPath,startDate,endDate)); + list.add(resultDTO); } - List list = baseDao.querySubCount(orgId, startDate, endDate); + // List list = baseDao.querySubCount(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 13a1b5da8e..9eddf595fa 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 @@ -51,6 +51,33 @@ GROUP BY ca.id order by count(l.id) desc,ca.CREATED_TIME desc + + + + + + \ No newline at end of file