liupeng 4 years ago
parent
commit
e88ab61ffc

+ 2 - 4
code/sapparent/sapcms/src/main/java/org/fouram/controller/ApiController.java

@@ -303,8 +303,7 @@ public class ApiController extends BaseController {
 		if (dto.getPageNumber() == null) {
 			return ResultUtil.error("参数pageNumber为空");
 		}
-		Object result = sapCheckReportService.findUserReportPage(dto.getStartDate(), dto.getEndDate(),
-				dto.getDepartId(), dto.getName(), dto.getStatus(), dto.getPageSize(), dto.getPageNumber());
+		Object result = sapCheckReportService.findUserReportPage(dto);
 		return ResultUtil.success(result, "操作成功");
 	}
 
@@ -326,8 +325,7 @@ public class ApiController extends BaseController {
 		ysFilePath = hzFilePath;
 		// 明细
 		String resultFilePath = "/public/excel/userReport" + DateUtil.getTimeStamp() + ".xlsx";
-		List<Map<String, Object>> mxList = sapCheckReportService.findUserReports(dto.getStartDate(), dto.getEndDate(),
-				dto.getDepartId(), dto.getName(), dto.getStatus(), null, null);
+		List<Map<String, Object>> mxList = sapCheckReportService.findUserReports(dto);
 		ExcelExportUtil.exportExcelFile(getRootPath() + ysFilePath, mxList, getRootPath() + resultFilePath, 1, 1);
 		return ResultUtil.success(resultFilePath, "操作成功");
 	}

+ 10 - 0
code/sapparent/sapcms/src/main/java/org/fouram/controller/SapReportController.java

@@ -2,9 +2,11 @@ package org.fouram.controller;
 
 import org.fouram.core.base.controller.BaseController;
 import org.fouram.core.util.ResultUtil;
+import org.fouram.dto.input.FindUsersDTO;
 import org.fouram.dto.input.SapReportAuthDTO.SapReportAuthDeleteDTO;
 import org.fouram.dto.input.SapReportAuthDTO.SapReportAuthSaveDTO;
 import org.fouram.dto.input.SapReportAuthDTO.SapReportAuthSelectListDTO;
+import org.fouram.service.SapCheckReportService;
 import org.fouram.service.SapOrgService;
 import org.fouram.service.SapReportAuthService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,6 +27,8 @@ public class SapReportController extends BaseController {
 	private SapOrgService sapOrgService;
 	@Autowired
 	private SapReportAuthService service;
+	@Autowired
+	private SapCheckReportService reportService;
 
 	@PostMapping(value = "/selectFirstOrgList", produces = "application/json;charset=utf-8")
 	@ResponseBody
@@ -51,4 +55,10 @@ public class SapReportController extends BaseController {
 		service.deleteById(dto.getId());
 		return ResultUtil.success();
 	}
+	
+	@PostMapping(value = "/selectUserReportList", produces = "application/json;charset=utf-8")
+	@ResponseBody
+	public Object selectUserReportList(@RequestBody FindUsersDTO dto) throws Exception {
+		return ResultUtil.success(reportService.findUserReports(dto), null);
+	}
 }

+ 20 - 11
code/sapparent/sapservice/src/main/java/org/fouram/service/SapCheckReportService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.fouram.core.base.service.BaseService;
 import org.fouram.core.util.DateUtil;
+import org.fouram.dto.input.FindUsersDTO;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
@@ -15,11 +16,9 @@ import com.google.common.collect.Maps;
 @Service
 public class SapCheckReportService extends BaseService {
 
-	public JSONObject findUserReportPage(String startDate, String endDate, String departId, String name, String state,
-			Integer pageSize, Integer pageNumber) throws Exception {
-		List<Map<String, Object>> list = findUserReports(startDate, endDate, departId, name, state, pageSize,
-				pageNumber);
-		Long total = findUserReportTotal(startDate, endDate, departId, name, state);
+	public JSONObject findUserReportPage(FindUsersDTO dto) throws Exception {
+		List<Map<String, Object>> list = findUserReports(dto);
+		Long total = findUserReportTotal(dto);
 		return getPageResult(list, total);
 	}
 
@@ -31,8 +30,14 @@ public class SapCheckReportService extends BaseService {
 	}
 
 	@SuppressWarnings("unchecked")
-	public List<Map<String, Object>> findUserReports(String startDate, String endDate, String departId, String name,
-			String state, Integer pageSize, Integer pageNumber) throws Exception {
+	public List<Map<String, Object>> findUserReports(FindUsersDTO dto) throws Exception {
+		String startDate = dto.getStartDate();
+		String endDate = dto.getEndDate();
+		String departId = dto.getDepartId();
+		String name = dto.getName();
+		String state = dto.getStatus();
+		Integer pageSize = dto.getPageSize();
+		Integer pageNumber = dto.getPageNumber();
 		if (StringUtils.isNotBlank(departId) && departId.endsWith(",")) {
 			departId = departId.substring(0, departId.length() - 1);
 		}
@@ -87,10 +92,10 @@ public class SapCheckReportService extends BaseService {
 				for (int i = 0; i < result.size(); i++) {
 					int count = 0;
 					for (String vkey : list.get(i).keySet()) {
-						if(count >= 5) {
+						if (count >= 5) {
 							result.get(i).put(vkey, list.get(i).get(vkey));
 						}
-						count ++;
+						count++;
 					}
 				}
 			}
@@ -128,8 +133,12 @@ public class SapCheckReportService extends BaseService {
 		return reportDaySql;
 	}
 
-	public Long findUserReportTotal(String startDate, String endDate, String departId, String name, String state)
-			throws Exception {
+	public Long findUserReportTotal(FindUsersDTO dto) throws Exception {
+		String startDate = dto.getStartDate();
+		String endDate = dto.getEndDate();
+		String departId = dto.getDepartId();
+		String name = dto.getName();
+		String state = dto.getStatus();
 		if (StringUtils.isNotBlank(departId) && departId.endsWith(",")) {
 			departId = departId.substring(0, departId.length() - 1);
 		}