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..5fc00d0691 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CommunityLoginFormDTO.java @@ -0,0 +1,41 @@ +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 CommunityLoginFormDTO extends PageFormDTO { + /** + * 所选择的组织id + */ + private String orgId; + + /** + * 组织类型 + */ + private String level; + + /** + * 开始日期: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/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..a1ef997fc0 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/CountActivityFormDTO.java @@ -0,0 +1,42 @@ +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; + + /** + * 是否活跃 1 活跃 0 不活跃 + */ + private String isActivity; + + + /** + * 开始日期: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/form/yt/LoginLogCountByLevelFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/LoginLogCountByLevelFormDTO.java index 6681005be5..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,6 +1,8 @@ package com.epmet.dto.form.yt; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -19,16 +21,20 @@ public class LoginLogCountByLevelFormDTO { /** * 组织类型 */ - private String orgType; + private String level; /** * 开始日期: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/AgencyCountCensusResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java new file mode 100644 index 0000000000..9f453b4a09 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import java.io.Serializable; + +/** + * @ClassName AgencyCountCensus$ + * @Description + * @Date 2023/4/6 16:46 + * @Author lichao + **/ +public class AgencyCountCensusResultDTO implements Serializable { + + private static final long serialVersionUID = 4360690752084258055L; + + private String level; + private Integer count; +} 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-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/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index ba94cc12ab..2f70dc04ce 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -518,4 +518,11 @@ public class CustomerAgencyController { } + @GetMapping("getAgencyCountList") + public Result> getAgencyCountList(@RequestParam String agencyId){ + return new Result>().ok(customerAgencyService.getAgencyCountList(agencyId)); + } + + + } 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..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 @@ -1,14 +1,30 @@ 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.ConvertUtils; +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; 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; 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; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; /** @@ -33,8 +49,106 @@ 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())); + } + + /** + * 下级社区账号登录次数排名 + * + * @return + */ + @PostMapping("community-count") + public Result> communityCount(@RequestBody CommunityLoginFormDTO formDTO) { + 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())); + } + + /** + * 查看区县 + * + * @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())); + } + + /*** + * 获取当前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)); + } + + + /*** + * 导出活跃 + * @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())) { + 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/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 2ef0034462..7d01383272 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -429,5 +429,7 @@ public interface CustomerAgencyDao extends BaseDao { * @return */ List getAllCommunity(String customerId); + + Integer agencyCount(@Param("pids") String pids,@Param("level") String level); } 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..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,8 +1,16 @@ 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; + +import java.util.Date; +import java.util.List; /** * 工作人员登录日志表 @@ -12,5 +20,56 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffLoginLogDao extends BaseDao { - + + /** + * 各社区登录总次数 + * + * @param orgId + * @param startDate + * @param endDate + * @return + */ + List pageCommunityCount(@Param("orgId") String orgId, + @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); + + /** + * 各区县登录总次数 + * + * @param orgId + * @param startDate + * @param endDate + * @return + */ + 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); + + /*** + * 获取登陆情况 + * @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/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/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 39111b0efa..d80ec62617 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 @@ -362,4 +362,5 @@ public interface CustomerAgencyService extends BaseService * @return */ String getOrgIdPath(String orgId); + List getAgencyCountList(String agencyId); } 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..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 @@ -1,7 +1,13 @@ 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; @@ -15,6 +21,7 @@ import java.util.Date; public interface StaffLoginLogService extends BaseService { /** * 登录,插入记录 + * * @param staffId * @param loginTime */ @@ -24,10 +31,67 @@ 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); + + /** + * 下级社区账号登录次数排名 + * + * @param formDTO + * @return + */ + PageData pageCommunityCount(CommunityLoginFormDTO formDTO); + + /** + * 柱状图:下级组织账号登录次数汇总 + * + * @param orgId + * @param level + * @param startDate + * @param endDate + * @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); + + /*** + * 获取登陆情况 + * @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/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index f164b34328..67f97aeb0c 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 @@ -1624,4 +1624,31 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getAgencyCountList(String agencyId) { + + List agencyCountCensusResultDTOS = new ArrayList<>(); + + CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId); + if (customerAgency != null){ +// pidu + // 区县级 + if (customerAgency.getLevel().equals("district")){ +// Integer count = baseDao.agencyCount() + // 镇街级 + }else if (customerAgency.getLevel().equals("street")){ + + + }else{ + + + } + + }else{ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); + } + + return agencyCountCensusResultDTOS; + } + } 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..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 @@ -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,26 @@ 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.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; 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; /** * 工作人员登录日志表 @@ -77,21 +87,21 @@ public class StaffLoginLogServiceImpl extends BaseServiceImpl cityWrapper = new LambdaQueryWrapper<>(); cityWrapper.eq(StaffLoginLogEntity::getAgencyId, orgId) @@ -101,25 +111,25 @@ 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)); - } else if (Constant.DISTRICT.equals(orgType)) { + } else if (Constant.DISTRICT.equals(level)) { resultDTO.setCityCount(NumConstant.ONE_NEG); //只展示本区县的登录情况 @@ -131,18 +141,18 @@ 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)); - } else if (Constant.STREET.equals(orgType)) { + } else if (Constant.STREET.equals(level)) { resultDTO.setCityCount(NumConstant.ONE_NEG); resultDTO.setDistrictCount(NumConstant.ONE_NEG); @@ -152,14 +162,15 @@ 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)); - } else if (Constant.COMMUNITY.equals(orgType)) { + } else if (Constant.COMMUNITY.equals(level)) { resultDTO.setCityCount(NumConstant.ONE_NEG); resultDTO.setDistrictCount(NumConstant.ONE_NEG); resultDTO.setStreetCount(NumConstant.ONE_NEG); @@ -173,5 +184,121 @@ 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); + } + + /** + * 下级社区账号登录次数排名 + * + * @param formDTO + * @return + */ + @Override + public PageData pageCommunityCount(CommunityLoginFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getOrgId())) { + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); + formDTO.setOrgId(staffInfoCacheResult.getAgencyId()); + formDTO.setLevel(staffInfoCacheResult.getLevel()); + } + if (formDTO.getIsPage()) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + 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(formDTO.getOrgId(), formDTO.getStartDate(), formDTO.getEndDate()); + int total = CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size(); + return new PageData<>(list, total, total); + } + + /** + * 柱状图:下级组织账号登录次数汇总 + * + * @param orgId + * @param level + * @param startDate + * @param endDate + * @return + */ + @Override + public PageData 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); + } + + + /** + * 查看区县 + * + * @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(); + } + 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); + } + // 不分页 + List list = baseDao.pageDistrictCount(orgId, 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(); + } + 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); + } + // 不分页 + List list = baseDao.pageStreetCount(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/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 882249b1ad..3c1b1d9068 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -863,6 +863,15 @@ AND CUSTOMER_ID = #{customerId} AND pids LIKE concat('%',#{agencyId}, '%' ) + + SELECT + ca.id AS agencyId, + d.ORGANIZATION_NAME AS districtName, + s.ORGANIZATION_NAME AS streetName, + 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') + LEFT JOIN customer_agency s + ON ( ca.PID = s.ID ) + LEFT JOIN customer_agency d + ON ( s.PID = d.ID ) + WHERE + ca.DEL_FLAG = '0' + AND (ca.id = #{orgId} or ca.pids like concat('%',#{orgId},'%') ) + AND ca.LEVEL = 'community' + + and l.LOGIN_TIME >= #{startDate} + + + and l.LOGIN_TIME <= #{endDate} + + GROUP BY ca.id + order by count(l.id) desc + + + + + + + + + + + + + \ No newline at end of file