diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index 7433f7e83d..43cb3df89b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.exception.RenException; 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.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; @@ -13,14 +14,13 @@ import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; +import com.epmet.dataaggre.excel.StaffPatrollExcel; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; 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 org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -209,4 +209,13 @@ public class EpmetUserController { return new Result().ok(epmetUserService.mentionMeEvent(tokenDto.getUserId())); } + @GetMapping("export/staffpatroll") + public void export( @RequestBody StaffListFormDTO formDTO, HttpServletResponse response) throws Exception { + ValidatorUtils.validateEntity(formDTO, StaffListFormDTO.Staff.class); + //formDTO.setUserId(tokenDto.getUserId()); + formDTO.setUserId("73ae6280e46a6653a5605d51d5462725"); + List resultDTOS = epmetUserService.staffPatrolList(formDTO); + ExcelUtils.exportExcelToTarget(response, null, resultDTOS, StaffPatrollExcel.class); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java new file mode 100644 index 0000000000..503c8b4cab --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/excel/StaffPatrollExcel.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dataaggre.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * 客户表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-11 + */ +@Data +public class StaffPatrollExcel { + + @Excel(name = "组织") + private String gridName = ""; + @Excel(name = "姓名") + private String staffName = ""; + @Excel(name = "巡查总次数") + private Integer patrolTotal = 0; + @Excel(name = "上报项目数") + private Integer reportProjectCount; + @Excel(name = "巡查总时长") + private String totalTime = ""; + + + +}