|
@@ -21,12 +21,14 @@ import org.fouram.core.util.LoggerUtil;
|
|
|
import org.fouram.core.util.ResultUtil;
|
|
|
import org.fouram.entity.SapOrg;
|
|
|
import org.fouram.entity.SapUser;
|
|
|
+import org.fouram.input.FindUsersDTO;
|
|
|
import org.fouram.service.SapCheckService;
|
|
|
import org.fouram.service.SapOrgService;
|
|
|
import org.fouram.service.SapUserService;
|
|
|
import org.fouram.service.WxDepartService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
@@ -235,21 +237,13 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
@RequestMapping(value = "/findUserReports", produces = "application/json;charset=utf-8")
|
|
|
@ResponseBody
|
|
|
- public Object findUsers(HttpServletRequest request) {
|
|
|
+ public Object findUsers(HttpServletRequest request, @RequestBody FindUsersDTO dto) {
|
|
|
try {
|
|
|
- // 开始时间、结束时间、 部门、姓名
|
|
|
- String startDate = getPageData().getString("startDate");
|
|
|
- String endDate = getPageData().getString("endDate");
|
|
|
- String departId = getPageData().getString("departId");
|
|
|
- String name = getPageData().getString("name");
|
|
|
- String state = getPageData().getString("state");
|
|
|
- Integer pageNumber = getPageData().getInteger("pageNumber");
|
|
|
- if(pageNumber == null) {
|
|
|
+ if (dto.getPageNumber() == null) {
|
|
|
return ResultUtil.error("参数pageNumber为空");
|
|
|
}
|
|
|
- Integer pageSize = 20;
|
|
|
- Object result = sapCheckService.findUserReports(startDate, endDate, departId, name, state, pageSize,
|
|
|
- pageNumber);
|
|
|
+ Object result = sapCheckService.findUserReports(dto.getStartDate(), dto.getEndDate(), dto.getDepartId(),
|
|
|
+ dto.getName(), dto.getState(), dto.getPageSize(), dto.getPageNumber());
|
|
|
return ResultUtil.success(result, "操作成功");
|
|
|
} catch (Exception e) {
|
|
|
LoggerUtil.error(e);
|
|
@@ -259,15 +253,10 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@RequestMapping(value = "/exportUserReportExcel")
|
|
|
- public void exportUserReportExcel(HttpServletResponse response) {
|
|
|
+ public void exportUserReportExcel(HttpServletResponse response, @RequestBody FindUsersDTO dto) {
|
|
|
try {
|
|
|
- // 开始时间、结束时间、 部门、姓名
|
|
|
- String startDate = getPageData().getString("startDate");
|
|
|
- String endDate = getPageData().getString("endDate");
|
|
|
- String departId = getPageData().getString("departId");
|
|
|
- String name = getPageData().getString("name");
|
|
|
- String state = getPageData().getString("state");
|
|
|
- Object object = sapCheckService.findUserReports(startDate, endDate, departId, name, state, null, null);
|
|
|
+ Object object = sapCheckService.findUserReports(dto.getStartDate(), dto.getEndDate(), dto.getDepartId(),
|
|
|
+ dto.getName(), dto.getState(), null, null);
|
|
|
List<Map<String, Object>> dataList = (List<Map<String, Object>>) object;
|
|
|
String haveFilePath = "/public/excel/userReport.xlsx";
|
|
|
ExcelExportUtil.exportExcelStream(getRootPath() + haveFilePath, dataList, 1, response);
|