From 87a8ad5fc86d10b158d8ad5fae0ef45b01fc05ea Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 4 Apr 2023 14:19:41 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=88=96=E8=80=85?= =?UTF-8?q?=E9=80=80=E5=87=BAcontent=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mq/listener/listener/AuthOperationLogListener.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java index 6f8afd1418..10250f27a1 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java @@ -1,6 +1,7 @@ package com.epmet.mq.listener.listener; import com.alibaba.fastjson.JSON; +import com.epmet.auth.constants.AuthOperationConstants; import com.epmet.auth.constants.AuthOperationEnum; import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.epmet.commons.rocketmq.messages.LoginMQMsg; @@ -77,7 +78,11 @@ public class AuthOperationLogListener implements MessageListenerConcurrently { logEntity.setOperatorName(operatorInfo.getName()); logEntity.setOperatorMobile(operatorInfo.getMobile()); logEntity.setOperatingTime(msgObj.getLoginTime()); - logEntity.setContent("成功登录系统"); + if(AuthOperationConstants.LOGIN.equals(logEntity.getType())){ + logEntity.setContent("成功登录系统"); + }else{ + logEntity.setContent("成功退出系统"); + } DistributedLock distributedLock = null; RLock lock = null; From bee178b830140bde06b7d17cca0377cdcf77547e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 13:14:51 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=B8=82=E7=BA=A7?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7/=E5=8C=BA=E5=8E=BF=E7=BA=A7=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7/=E9=95=87=E8=A1=97=E7=BA=A7=E8=B4=A6=E5=8F=B7/?= =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E7=BA=A7=E8=B4=A6=E5=8F=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/yt/LoginLogCountByLevelFormDTO.java | 35 ++++++ .../yt/LoginLogCountByLevelResultDTO.java | 29 +++++ .../controller/StaffLoginLogController.java | 18 ++++ .../epmet/service/CustomerAgencyService.java | 9 +- .../epmet/service/StaffLoginLogService.java | 11 ++ .../impl/CustomerAgencyServiceImpl.java | 17 +++ .../impl/StaffLoginLogServiceImpl.java | 102 ++++++++++++++++++ 7 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/LoginLogCountByLevelResultDTO.java 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 new file mode 100644 index 0000000000..6681005be5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form.yt; + +import lombok.Data; + +import java.util.Date; + +/** + * @Description 账号登录情况,查询市级账号/区县级账号/镇街级账号/社区级账号登录次数,入参dto + * @Author yzm + * @Date 2023/4/6 10:09 + */ +@Data +public class LoginLogCountByLevelFormDTO { + /** + * 所选择的组织id + */ + private String orgId; + + /** + * 组织类型 + */ + private String orgType; + + /** + * 开始日期:yyyy-MM-dd + */ + private Date startDate; + + /** + * 截止日期:yyyy-MM-dd + */ + private Date endDate; + +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/LoginLogCountByLevelResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/LoginLogCountByLevelResultDTO.java new file mode 100644 index 0000000000..b1a4c33c42 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/LoginLogCountByLevelResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result.yt; + +import lombok.Data; + +/** + * @Description 账号登录情况,查询市级账号/区县级账号/镇街级账号/社区级账号登录次数,返参dto + * @Author yzm + * @Date 2023/4/6 10:13 + */ +@Data +public class LoginLogCountByLevelResultDTO { + /** + * 市级账号登录总次数;-1时不展示 + */ + private Integer cityCount; + /** + * 区县级账号登录总次数;-1时不展示 + */ + private Integer districtCount; + /** + * 镇街级账号登录总次数;-1时不展示 + */ + private Integer streetCount; + /** + * 社区级账号登录总次数;-1时不展示 + */ + private Integer communityCount; +} + 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 557d4d3dec..252acd3e4e 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 @@ -1,7 +1,12 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.yt.LoginLogCountByLevelFormDTO; +import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.service.StaffLoginLogService; import org.springframework.beans.factory.annotation.Autowired; +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; @@ -19,4 +24,17 @@ public class StaffLoginLogController { @Autowired private StaffLoginLogService staffLoginLogService; + + /** + * 返回市级账号登录总次数、区县级账号登录总次数、镇街级账号登录总次数、社区级账号登录总次数 + * + * @param formDTO + * @return + */ + @PostMapping("count-level") + public Result countLevel(@RequestBody LoginLogCountByLevelFormDTO formDTO) { + return new Result().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStartDate(), formDTO.getEndDate())); + } + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index f9ac7182e7..39111b0efa 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -18,7 +18,6 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -355,4 +354,12 @@ public interface CustomerAgencyService extends BaseService * @Date 2022/11/30 22:41 **/ Result> getCurrentUserCommunityInfo(TokenDto tokenDTO); + + /** + * 返回组织的orgIdPath:包含自身 + * + * @param orgId + * @return + */ + String getOrgIdPath(String orgId); } 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 4594c9cedd..1604d34e14 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 @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.entity.StaffLoginLogEntity; import java.util.Date; @@ -19,4 +20,14 @@ public interface StaffLoginLogService extends BaseService { */ void saveLog(String staffId, Date loginTime); + /** + * 返回市级账号登录总次数、区县级账号登录总次数、镇街级账号登录总次数、社区级账号登录总次数 + * + * @param orgId 为空时,默认当前登录用户所属组织id + * @param orgType + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return + */ + LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, 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/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index a6702963c4..f164b34328 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1607,4 +1607,21 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl>().ok(list); } + /** + * 返回组织的orgIdPath:包含自身 + * + * @param orgId + * @return + */ + @Override + public String getOrgIdPath(String orgId) { + CustomerAgencyEntity customerAgencyEntity = baseDao.selectById(orgId); + if (null == customerAgencyEntity) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode()); + } + if (StringUtils.isBlank(customerAgencyEntity.getPid()) || NumConstant.ZERO_STR.equals(customerAgencyEntity.getPid())) { + return orgId; + } + return customerAgencyEntity.getPids().concat(StrConstant.COLON).concat(orgId); + } } 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 52bd7a38f1..982be9b1e3 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 @@ -1,15 +1,19 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dao.StaffLoginLogDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.entity.StaffLoginLogEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.CustomerAgencyService; @@ -69,7 +73,105 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl cityWrapper = new LambdaQueryWrapper<>(); + cityWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) + .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); + resultDTO.setCityCount(baseDao.selectCount(cityWrapper)); + + // 市下面区县账号 + LambdaQueryWrapper districtWrapper = new LambdaQueryWrapper<>(); + districtWrapper.eq(StaffLoginLogEntity::getPid, orgId) + .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) + .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) + .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); + resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); + + } else if (Constant.DISTRICT.equals(orgType)) { + resultDTO.setCityCount(NumConstant.ONE_NEG); + //只展示本区县的登录情况 + LambdaQueryWrapper districtWrapper = new LambdaQueryWrapper<>(); + districtWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) + .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) + .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) + .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); + resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); + + } else if (Constant.STREET.equals(orgType)) { + resultDTO.setCityCount(NumConstant.ONE_NEG); + resultDTO.setDistrictCount(NumConstant.ONE_NEG); + + // 只展示本街道的登录情况 + LambdaQueryWrapper streetWrapper = new LambdaQueryWrapper<>(); + streetWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) + .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) + .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); + resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); + + } else if (Constant.COMMUNITY.equals(orgType)) { + resultDTO.setCityCount(NumConstant.ONE_NEG); + resultDTO.setDistrictCount(NumConstant.ONE_NEG); + resultDTO.setStreetCount(NumConstant.ONE_NEG); + + // 只展示本社区的登录情况 + LambdaQueryWrapper communityWrapper = new LambdaQueryWrapper<>(); + communityWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) + .between(null != startDate && null != endDate, StaffLoginLogEntity::getLoginTime, startDate, endDate); + resultDTO.setCommunityCount(baseDao.selectCount(communityWrapper)); + } + return resultDTO; + } } \ No newline at end of file From 4a3b8375f170ec658c3e40f44999136044f7cd39 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 14:09:00 +0800 Subject: [PATCH 03/20] level --- .../tools/redis/common/bean/CustomerStaffInfoCache.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java index 87e53edcb0..bb5526afe6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java @@ -32,6 +32,11 @@ public class CustomerStaffInfoCache implements Serializable { */ private String agencyName; + /** + * 组织级别 + */ + private String level; + /** * 2级组织名称 根据添加的来源返回(xx组织-组织/网格/部门) */ From 784551dd0bea5bd687eabb06a5972aff888afcd3 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 6 Apr 2023 14:12:25 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:1.ic=5Fevent=EF=BC=8C?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86=E5=88=86=E6=9E=90=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=AD=EF=BC=8C=E7=BC=BA=E5=B0=91del=5Fflag=3D'0'?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/IcEventDao.xml | 4 +++- .../com/epmet/processor/YanTaiTripReportSyncProcessor.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml index bd7853c4e0..d7e0d5ff39 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml @@ -28,6 +28,7 @@ and e.GRID_ID=#{orgId} + and e.DEL_FLAG = '0' and CUSTOMER_ID = #{customerId} and HAPPEN_TIME >= #{queryStartTime} and HAPPEN_TIME #{queryEndTime} @@ -81,7 +82,8 @@ select date_format(e.HAPPEN_TIME, '%Y-%m') monthName from ic_event e - e.HAPPEN_TIME >= date_format(#{queryStartTime}, '%Y-%m') + e.DEL_FLAG = '0' + and e.HAPPEN_TIME >= date_format(#{queryStartTime}, '%Y-%m') and e.HAPPEN_TIME date_format(#{queryEndTime}, '%Y-%m') and e.GRID_ID =#{orgId} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java index 6b1d4a028d..e6a1995948 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java @@ -16,7 +16,7 @@ import static com.epmet.constant.EpidemicConstant.JOB_TYPE_VACCINE; * @Author zxc * @Date 2022/11/22 14:08 */ -@Component +// @Component @Slf4j public class YanTaiTripReportSyncProcessor extends AbstractDataSyncJobProcessor { From c84d31ea7e75a03bbac3d9501ade4431e77233ba Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 6 Apr 2023 14:29:36 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E8=A1=A5=E5=85=85YanTaiTripReportSyncPro?= =?UTF-8?q?cessor=E7=9A=84@Component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/processor/YanTaiTripReportSyncProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java index e6a1995948..6b1d4a028d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiTripReportSyncProcessor.java @@ -16,7 +16,7 @@ import static com.epmet.constant.EpidemicConstant.JOB_TYPE_VACCINE; * @Author zxc * @Date 2022/11/22 14:08 */ -// @Component +@Component @Slf4j public class YanTaiTripReportSyncProcessor extends AbstractDataSyncJobProcessor { From c59a56e09b44e93e93091248c0c08296b5bd8c37 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 14:39:15 +0800 Subject: [PATCH 06/20] level --- .../dto/form/yt/CommunityLoginFormDTO.java | 35 ++++++++++++++++++ .../result/yt/CommunityLoginResultDTO.java | 37 +++++++++++++++++++ .../controller/StaffLoginLogController.java | 11 ++++++ .../java/com/epmet/dao/StaffLoginLogDao.java | 17 ++++++++- .../epmet/service/StaffLoginLogService.java | 11 ++++++ .../impl/StaffLoginLogServiceImpl.java | 34 +++++++++++++++++ .../resources/mapper/StaffLoginLogDao.xml | 29 ++++++++++++++- 7 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java 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 new file mode 100644 index 0000000000..132d4178e7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form.yt; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.util.Date; + +/** + * @Description 下级社区账号登录次数排名入参 + * @Author yzm + * @Date 2023/4/6 14:18 + */ +@Data +public class CommunityLoginFormDTO extends PageFormDTO { + /** + * 所选择的组织id + */ + private String orgId; + + /** + * 组织类型 + */ + private String orgType; + + /** + * 开始日期:yyyy-MM-dd + */ + private Date startDate; + + /** + * 截止日期:yyyy-MM-dd + */ + private Date endDate; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java new file mode 100644 index 0000000000..e1cb00a765 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/CommunityLoginResultDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.result.yt; + +import lombok.Data; + +/** + * @Description 下级社区账号登录次数排名 + * @Author yzm + * @Date 2023/4/6 14:15 + */ +@Data +public class CommunityLoginResultDTO { + /** + * 组织id + */ + private String agencyId; + /** + * 组织名称 + */ + private String agencyName; + /** + * 组织级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province) + */ + private String agencyLevel; + /** + * 所属街道名称; + */ + private String streetName; + /** + * 所属区县名称; + */ + private String districtName; + /** + * 登录次数 + */ + private Integer count; +} + 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 252acd3e4e..19385e1298 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 @@ -1,7 +1,10 @@ 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.LoginLogCountByLevelFormDTO; +import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.service.StaffLoginLogService; import org.springframework.beans.factory.annotation.Autowired; @@ -36,5 +39,13 @@ public class StaffLoginLogController { return new Result().ok(staffLoginLogService.countLevel(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStartDate(), formDTO.getEndDate())); } + /** + * 下级社区账号登录次数排名 + * @return + */ + @PostMapping("community-count") + public Result> communityCount(@RequestBody CommunityLoginFormDTO formDTO) { + return new Result>().ok(staffLoginLogService.pageCommunityCount(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 c7c38f7bbd..43e5479aa7 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,8 +1,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.yt.CommunityLoginResultDTO; import com.epmet.entity.StaffLoginLogEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; /** * 工作人员登录日志表 @@ -12,5 +17,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffLoginLogDao extends BaseDao { - + + /** + * 各社区登录总次数 + * @param orgIdPath + * @param startDate + * @param endDate + * @return + */ + List pageCommunityCount(@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/StaffLoginLogService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java index 1604d34e14..25c5fe48f8 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 @@ -1,6 +1,9 @@ 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.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.entity.StaffLoginLogEntity; @@ -30,4 +33,12 @@ public interface StaffLoginLogService extends BaseService { * @return */ LoginLogCountByLevelResultDTO countLevel(String orgId, String orgType, Date startDate, Date endDate); + + /** + * 下级社区账号登录次数排名 + * + * @param formDTO + * @return + */ + PageData pageCommunityCount(CommunityLoginFormDTO 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 982be9b1e3..007b7d572a 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 @@ -6,6 +6,7 @@ import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; 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.Result; @@ -13,17 +14,23 @@ import com.epmet.commons.tools.utils.SpringContextUtils; 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.result.yt.CommunityLoginResultDTO; import com.epmet.dto.result.yt.LoginLogCountByLevelResultDTO; import com.epmet.entity.StaffLoginLogEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.CustomerAgencyService; import com.epmet.service.StaffLoginLogService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Date; +import java.util.List; /** * 工作人员登录日志表 @@ -173,5 +180,32 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl pageCommunityCount(CommunityLoginFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getOrgId())) { + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); + formDTO.setOrgId(staffInfoCacheResult.getAgencyId()); + formDTO.setOrgType(staffInfoCacheResult.getLevel()); + } + String orgIdPath = SpringContextUtils.getBean(CustomerAgencyService.class).getOrgIdPath(formDTO.getOrgId()); + if (formDTO.getIsPage()) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + // 不分页 + List list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); + 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 bba55ac5d9..c0af48c5b3 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 @@ -22,5 +22,32 @@ - + + \ No newline at end of file From d764bd8db198ec5276448c87aa1d421757d59f61 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 14:55:12 +0800 Subject: [PATCH 07/20] kaishijieshu --- .../main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java | 3 +++ .../com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java | 3 +++ 2 files changed, 6 insertions(+) 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 132d4178e7..35aa64951f 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 @@ -2,6 +2,7 @@ package com.epmet.dto.form.yt; import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -25,11 +26,13 @@ public class CommunityLoginFormDTO extends PageFormDTO { /** * 开始日期:yyyy-MM-dd */ + @DateTimeFormat(pattern="yyyy-MM-dd") private Date startDate; /** * 截止日期:yyyy-MM-dd */ + @DateTimeFormat(pattern="yyyy-MM-dd") 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 6681005be5..ff485c832a 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,6 +1,7 @@ package com.epmet.dto.form.yt; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -24,11 +25,13 @@ public class LoginLogCountByLevelFormDTO { /** * 开始日期:yyyy-MM-dd */ + @DateTimeFormat(pattern="yyyy-MM-dd") private Date startDate; /** * 截止日期:yyyy-MM-dd */ + @DateTimeFormat(pattern="yyyy-MM-dd") private Date endDate; } 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 08/20] 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 09/20] =?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 From 20e05cc0725894ebaf770d4c91d3c4014861d7c6 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 16:42:48 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StaffLoginLogController.java | 25 +++++++ .../java/com/epmet/dao/StaffLoginLogDao.java | 19 ++++- .../epmet/service/StaffLoginLogService.java | 25 +++++++ .../impl/StaffLoginLogServiceImpl.java | 67 +++++++++++++++++- .../resources/mapper/StaffLoginLogDao.xml | 69 ++++++++++++++++--- 5 files changed, 191 insertions(+), 14 deletions(-) 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 03984e80fb..eb2d5ed42b 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 @@ -59,5 +59,30 @@ public class StaffLoginLogController { return new Result>().ok(staffLoginLogService.querySubCount(formDTO.getOrgId(), formDTO.getLevel(), formDTO.getStartDate(), formDTO.getEndDate())); } + /** + * 查看区县 + * + * @param formDTO + * @return + */ + @PostMapping("district-count") + public Result> districtCount(@RequestBody CommunityLoginFormDTO formDTO) { + return new Result>().ok(staffLoginLogService.pageDistrictCount(formDTO.getOrgId(), + formDTO.getLevel(), formDTO.getStartDate(), + formDTO.getEndDate(), formDTO.getIsPage(), + formDTO.getPageNo(), formDTO.getPageSize())); + } + /** + * 查看街镇 + * @param formDTO + * @return + */ + @PostMapping("street-count") + public Result> streetCount(@RequestBody CommunityLoginFormDTO formDTO) { + return new Result>().ok(staffLoginLogService.streetCount(formDTO.getOrgId(), + formDTO.getStartDate(), + formDTO.getEndDate(), formDTO.getIsPage(), + formDTO.getPageNo(), formDTO.getPageSize())); + } } 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 2ad70b214e..99be414369 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 @@ -20,12 +20,12 @@ public interface StaffLoginLogDao extends BaseDao { /** * 各社区登录总次数 - * @param orgIdPath + * @param orgId * @param startDate * @param endDate * @return */ - List pageCommunityCount(@Param("orgIdPath") String orgIdPath, + List pageCommunityCount(@Param("orgId") String orgId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); @@ -39,4 +39,19 @@ public interface StaffLoginLogDao extends BaseDao { List querySubCount(@Param("orgId") String orgId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + + /** + * 各区县登录总次数 + * @param orgIdPath + * @param startDate + * @param endDate + * @return + */ + List pageDistrictCount(@Param("orgIdPath")String orgIdPath, + @Param("startDate")Date startDate, + @Param("endDate")Date endDate); + + List pageStreetCount(@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/StaffLoginLogService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffLoginLogService.java index 50bf65c8fa..d7d21d53db 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 @@ -51,4 +51,29 @@ public interface StaffLoginLogService extends BaseService { * @return */ PageData querySubCount(String orgId, String level, Date startDate, Date endDate); + + /** + * 查看区县 + * @param orgId + * @param level + * @param startDate + * @param endDate + * @param isPage + * @param pageNo + * @param pageSize + * @return + */ + PageData pageDistrictCount(String orgId, String level, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize); + + /** + * 查看街镇 + * @param orgId + * @param startDate + * @param endDate + * @param isPage + * @param pageNo + * @param pageSize + * @return + */ + PageData streetCount(String orgId, Date startDate, Date endDate, Boolean isPage, Integer pageNo, Integer pageSize); } \ 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 c22cbb8d21..71472344a7 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 @@ -193,15 +193,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); + List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal(),formDTO.getPageSize()); } // 不分页 - List list = baseDao.pageCommunityCount(orgIdPath, formDTO.getStartDate(), formDTO.getEndDate()); + List list = baseDao.pageCommunityCount(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData<>(list, total, total); } @@ -226,4 +225,66 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl(list, total, total); } + + + /** + * 查看区县 + * + * @param orgId + * @param level + * @param startDate + * @param endDate + * @param isPage + * @param pageNo + * @param pageSize + * @return 返回agencyId,agencyName,count + */ + @Override + public PageData 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(); + } + String orgIdPath = SpringContextUtils.getBean(CustomerAgencyService.class).getOrgIdPath(orgId); + if (isPage) { + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.pageDistrictCount(orgIdPath, startDate, endDate); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(),pageSize); + } + // 不分页 + List list = baseDao.pageDistrictCount(orgIdPath,startDate, endDate); + int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); + return new PageData<>(list, total, total); + } + + /** + * 查看街镇 + * + * @param orgId + * @param startDate + * @param endDate + * @param isPage + * @param pageNo + * @param pageSize + * @return + */ + @Override + 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(); + } + String orgIdPath = SpringContextUtils.getBean(CustomerAgencyService.class).getOrgIdPath(orgId); + if (isPage) { + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.pageStreetCount(orgIdPath, startDate, endDate); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal(),pageSize); + } + // 不分页 + List list = baseDao.pageStreetCount(orgIdPath,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 6ef4d35ded..9173035123 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,21 +25,21 @@ @@ -72,4 +72,55 @@ group by ca.id order by count(l.ID) desc + + + + + \ No newline at end of file From e3b2c9f302dbae183fdf48bad3f54873fa484d72 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 16:47:58 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E8=A1=97=E9=95=87=E3=80=81=E5=8C=BA?= =?UTF-8?q?=E5=8E=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/StaffLoginLogDao.java | 4 +- .../impl/StaffLoginLogServiceImpl.java | 5 +- .../resources/mapper/StaffLoginLogDao.xml | 46 +++++++++---------- 3 files changed, 25 insertions(+), 30 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 99be414369..27db5ce3ce 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 @@ -42,12 +42,12 @@ public interface StaffLoginLogDao extends BaseDao { /** * 各区县登录总次数 - * @param orgIdPath + * @param orgId * @param startDate * @param endDate * @return */ - List pageDistrictCount(@Param("orgIdPath")String orgIdPath, + List pageDistrictCount(@Param("orgId")String orgId, @Param("startDate")Date startDate, @Param("endDate")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 71472344a7..a94484e4a7 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 @@ -245,15 +245,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.pageDistrictCount(orgIdPath, startDate, endDate); + List list = baseDao.pageDistrictCount(orgId, startDate, endDate); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal(),pageSize); } // 不分页 - List list = baseDao.pageDistrictCount(orgIdPath,startDate, endDate); + List list = baseDao.pageDistrictCount(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 9173035123..61c0254db3 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 @@ -48,7 +48,7 @@ GROUP BY ca.id - order by count(1) desc + order by count(l.id) desc @@ -75,17 +75,16 @@ \ No newline at end of file From 9952976aa6f7d0a3296590b3ed4304b536203f46 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 16:59:32 +0800 Subject: [PATCH 12/20] and --- .../src/main/resources/mapper/StaffLoginLogDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 61c0254db3..d0f43fb828 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 @@ -82,7 +82,7 @@ FROM customer_agency ca left join staff_login_log l ON ( ca.ID =l.AGENCY_ID and l.DEL_FLAG = '0') WHERE - and ca.DEL_FLAG = '0' + ca.DEL_FLAG = '0' and (ca.id=#{orgId} or ca.pids like concat('%',#{orgId},'%') ) AND ca.LEVEL = 'district' @@ -106,7 +106,7 @@ FROM customer_agency ca left join staff_login_log l ON ( ca.ID =l.AGENCY_ID and l.DEL_FLAG = '0') WHERE - and ca.DEL_FLAG = '0' + ca.DEL_FLAG = '0' and (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') ) AND ca.LEVEL = 'street' From d1b3ecdc4554535f33f2f91d7a6871833aadb507 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 6 Apr 2023 17:09:21 +0800 Subject: [PATCH 13/20] orgId --- .../src/main/java/com/epmet/dao/StaffLoginLogDao.java | 2 +- .../com/epmet/service/impl/StaffLoginLogServiceImpl.java | 5 ++--- 2 files changed, 3 insertions(+), 4 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 27db5ce3ce..ea6fbcab85 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 @@ -51,7 +51,7 @@ public interface StaffLoginLogDao extends BaseDao { @Param("startDate")Date startDate, @Param("endDate")Date endDate); - List pageStreetCount(@Param("orgIdPath")String orgIdPath, + List pageStreetCount(@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/impl/StaffLoginLogServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffLoginLogServiceImpl.java index a94484e4a7..b362881243 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 @@ -274,15 +274,14 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl list = baseDao.pageStreetCount(orgIdPath, startDate, endDate); + List list = baseDao.pageStreetCount(orgId, startDate, endDate); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal(),pageSize); } // 不分页 - List list = baseDao.pageStreetCount(orgIdPath,startDate, endDate); + List list = baseDao.pageStreetCount(orgId,startDate, endDate); int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); return new PageData<>(list, total, total); } From c092c37e150f3f07513695acd6a3db0c88ba3ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com> Date: Thu, 6 Apr 2023 17:45:49 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E6=B4=BB=E8=B7=83=E5=BA=A6=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/yt/CountActivityFormDTO.java | 37 ++++ .../dto/result/yt/AccountActivityInfo.java | 44 +++++ .../dto/result/yt/ActivityTatalInfo.java | 30 ++++ .../controller/StaffLoginLogController.java | 30 ++++ .../java/com/epmet/dao/StaffLoginLogDao.java | 30 +++- .../epmet/service/StaffLoginLogService.java | 18 ++ .../impl/StaffLoginLogServiceImpl.java | 46 +++-- .../resources/mapper/StaffLoginLogDao.xml | 165 ++++++++++++------ 8 files changed, 325 insertions(+), 75 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/AccountActivityInfo.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/yt/ActivityTatalInfo.java 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 From 4f43d087e1ff284cd52e112faba525850b8c31c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com> Date: Thu, 6 Apr 2023 18:26:29 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/yt/CountActivityFormDTO.java | 13 ++++++--- .../controller/StaffLoginLogController.java | 27 ++++++++++++++++++- .../resources/mapper/StaffLoginLogDao.xml | 8 ++++++ 3 files changed, 43 insertions(+), 5 deletions(-) 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 index ab3996a085..a1ef997fc0 100644 --- 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 @@ -19,19 +19,24 @@ public class CountActivityFormDTO extends PageFormDTO { */ private String orgId; + /** + * 是否活跃 1 活跃 0 不活跃 + */ + private String isActivity; + /** * 开始日期:yyyy-MM-dd */ - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") + @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") + @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 38a466d3c2..c1b2a226f8 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 @@ -1,6 +1,10 @@ package com.epmet.controller; +import com.alibaba.nacos.client.naming.utils.CollectionUtils; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.yt.CommunityLoginFormDTO; import com.epmet.dto.form.yt.CountActivityFormDTO; @@ -16,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.epmet.dto.result.yt.AccountActivityInfo; +import javax.servlet.http.HttpServletResponse; + /** * 工作人员登录日志表 @@ -106,7 +112,7 @@ public class StaffLoginLogController { /*** * 获取活跃度总数 * @param formDTO - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result> * @author qushutong * @date 2023/4/6 17:35 */ @@ -115,4 +121,23 @@ public class StaffLoginLogController { return new Result().ok(staffLoginLogService.getActivityTotal(formDTO)); } + + /*** + * 导出活跃 + * @param response + * @param tokenDto + * @param formDTO + * @return void + * @author qushutong + * @date 2023/4/6 18:04 + */ + @PostMapping("accountActivityInfo-export") + public void analysisExport(HttpServletResponse response, @LoginUser TokenDto tokenDto, @RequestBody CountActivityFormDTO formDTO) throws Exception { + formDTO.setIsPage(false); + PageData res = staffLoginLogService.getAccountActivityInfo(formDTO); + if (!CollectionUtils.isEmpty(res.getList())) { + ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountActivityInfo.class); + } + } + } 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 8bf8d36d2e..b956a42611 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 @@ -77,6 +77,14 @@ and l.LOGIN_TIME <= #{endDate} + + + AND l.AGENCY_ID is NOT NULL + + + AND l.AGENCY_ID is NULL + + GROUP BY a.ID ORDER BY From 944b8a7a519b2f0f48cb7e8d693f4ac0e54d4bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com> Date: Fri, 7 Apr 2023 09:45:27 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StaffLoginLogController.java | 33 +++++++++----- .../epmet/excel/yt/AccountActivityExcel.java | 45 +++++++++++++++++++ .../excel/yt/AccountInactivityExcel.java | 28 ++++++++++++ .../resources/mapper/StaffLoginLogDao.xml | 2 +- 4 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountActivityExcel.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountInactivityExcel.java 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 c1b2a226f8..aab97c99fc 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 @@ -4,6 +4,7 @@ import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.yt.CommunityLoginFormDTO; @@ -12,6 +13,8 @@ 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.excel.yt.AccountActivityExcel; +import com.epmet.excel.yt.AccountInactivityExcel; import com.epmet.service.StaffLoginLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController; import com.epmet.dto.result.yt.AccountActivityInfo; import javax.servlet.http.HttpServletResponse; +import java.util.List; /** @@ -112,7 +116,7 @@ public class StaffLoginLogController { /*** * 获取活跃度总数 * @param formDTO - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result> * @author qushutong * @date 2023/4/6 17:35 */ @@ -122,21 +126,28 @@ public class StaffLoginLogController { } - /*** - * 导出活跃 - * @param response - * @param tokenDto - * @param formDTO - * @return void - * @author qushutong - * @date 2023/4/6 18:04 - */ + /*** + * 导出活跃 + * @param response + * @param tokenDto + * @param formDTO + * @return void + * @author qushutong + * @date 2023/4/6 18:04 + */ @PostMapping("accountActivityInfo-export") public void analysisExport(HttpServletResponse response, @LoginUser TokenDto tokenDto, @RequestBody CountActivityFormDTO formDTO) throws Exception { formDTO.setIsPage(false); PageData res = staffLoginLogService.getAccountActivityInfo(formDTO); if (!CollectionUtils.isEmpty(res.getList())) { - ExcelUtils.exportExcelToTarget(response, null, res.getList(), AccountActivityInfo.class); + if("1".equals(formDTO.getIsActivity())){ + List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountActivityExcel.class); + ExcelUtils.exportExcelToTarget(response, null, accountActivityExcels, AccountActivityInfo.class); + }else { + List accountActivityExcels = ConvertUtils.sourceToTarget(res.getList(), AccountInactivityExcel.class); + ExcelUtils.exportExcelToTarget(response, null, accountActivityExcels, AccountActivityInfo.class); + } + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountActivityExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountActivityExcel.java new file mode 100644 index 0000000000..4c7d6bd6f5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountActivityExcel.java @@ -0,0 +1,45 @@ +package com.epmet.excel.yt; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @author: qushutong + * @Date: 2023/4/6 13:33 + * @Description: 账户活跃情况 + */ +@Data +public class AccountActivityExcel implements Serializable { + private static final long serialVersionUID = -918630886413844674L; + + /** + * 组织名称 + */ + @Excel(name = "组织名称") + private String agencyName = ""; + + /** + * 登陆次数 + */ + @Excel(name = "登陆次数") + private String loginCount = ""; + + /** + * 活跃账号数 + */ + @Excel(name = "活跃账号数") + private String accountActivityCount = ""; + + + /** + * 总账号数 + */ + @Excel(name = "总账号数") + private String accountCount = ""; + + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountInactivityExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountInactivityExcel.java new file mode 100644 index 0000000000..6635ab63c9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/yt/AccountInactivityExcel.java @@ -0,0 +1,28 @@ +package com.epmet.excel.yt; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @author: qushutong + * @Date: 2023/4/6 13:33 + * @Description: 账户不活跃情况 + */ +@Data +public class AccountInactivityExcel implements Serializable { + private static final long serialVersionUID = -918630886413844674L; + + /** + * 组织名称 + */ + @Excel(name = "组织名称") + private String agencyName = ""; + + + + + +} 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 b956a42611..c63b1025d3 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 @@ -57,7 +57,7 @@ COUNT(DISTINCT(l.STAFF_ID)) accountActivityCount, COUNT(DISTINCT(ag.USER_ID)) accountCount, a.ID agencyId, - a.ORGANIZATION_NAME agencyName + a.ALL_PARENT_NAME agencyName FROM customer_agency a LEFT JOIN staff_login_log l ON a.ID = l.AGENCY_ID From 66d543e9a0b9cfa3b3f2e6af857c51d52e018f2b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Apr 2023 09:56:08 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/StaffLoginLogDao.xml | 141 +++++++++--------- 1 file changed, 71 insertions(+), 70 deletions(-) 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 b956a42611..b7c5b34a43 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 @@ -22,32 +22,33 @@ - + @@ -91,72 +92,72 @@ COUNT(DISTINCT(l.id)) DESC; - + + - + From 7c7ff004200d541bfd12076346772f1d4fbc230e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com> Date: Fri, 7 Apr 2023 10:51:09 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/StaffLoginLogDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dc274ec1b8..70d53a5d5b 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 @@ -69,7 +69,7 @@ WHERE a.DEL_FLAG = '0' a.`LEVEL` = 'community' - + AND a.PIDS LIKE CONCAT('%',#{orgId},'%') From 75d0c883066e97a18e2ea0a0dde955e973c9e088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B2=E6=A0=91=E9=80=9A?= <1976590620@qq.com> Date: Fri, 7 Apr 2023 11:09:34 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/StaffLoginLogDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 70d53a5d5b..a906683282 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 @@ -68,7 +68,7 @@ AND ag.DEL_FLAG = '0' WHERE a.DEL_FLAG = '0' - a.`LEVEL` = 'community' + AND a.`LEVEL` = 'community' AND a.PIDS LIKE CONCAT('%',#{orgId},'%') From e8b16f1d910e72f72b5e344d764d32e9c33a0f26 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Apr 2023 13:41:30 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E8=A1=97=E9=95=87=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=8C=BA=E5=8E=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/StaffLoginLogDao.xml | 3 +++ 1 file changed, 3 insertions(+) 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 a906683282..6ed487ad44 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 @@ -143,10 +143,13 @@ ca.id AS agencyId, ca.ORGANIZATION_NAME AS agencyName, ca.LEVEL AS agencyLevel, + pa.ORGANIZATION_NAME as districtName, 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') + left join customer_agency pa + on(ca.pid=pa.id) WHERE ca.DEL_FLAG = '0' and (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') )