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