liupeng 4 rokov pred
rodič
commit
4c6d85f7a7

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

@@ -26,10 +26,12 @@ import org.fouram.dto.output.GetIngoreListOutput;
 import org.fouram.dto.output.GetToBeConfirmedListOutput;
 import org.fouram.dto.output.SyncWeixinUserOutput;
 import org.fouram.entity.SapOrg;
+import org.fouram.entity.SapReportAuth;
 import org.fouram.entity.SapUser;
 import org.fouram.enums.DelFlagEnum;
 import org.fouram.service.SapCheckReportService;
 import org.fouram.service.SapOrgService;
+import org.fouram.service.SapReportAuthService;
 import org.fouram.service.SapUserService;
 import org.fouram.service.SyncSapUserToWxService;
 import org.fouram.service.WxDepartService;
@@ -37,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
@@ -61,6 +64,8 @@ public class ApiController extends BaseController {
 	@Autowired
 	private WxDepartService wxDepartService;
 	@Autowired
+	private SapReportAuthService authService;
+	@Autowired
 	private SapCheckReportService sapCheckReportService;
 	@Autowired
 	private SyncSapUserToWxService syncSapUserToWxService;
@@ -296,13 +301,21 @@ public class ApiController extends BaseController {
 	public Object findDepartJSON(HttpServletRequest request) throws Exception {
 		return ResultUtil.success(wxDepartService.findDepartJSON(), "操作成功");
 	}
-
+	
 	@PostMapping(value = "/findUserReports", produces = "application/json;charset=utf-8")
 	@ResponseBody
-	public Object findUsers(HttpServletRequest request, @RequestBody FindUsersDTO dto) throws Exception {
+	public Object findUserReports(HttpServletRequest request, @RequestBody FindUsersDTO dto, @RequestHeader("userId") String userId) throws Exception {
 		if (dto.getPageNumber() == null) {
 			return ResultUtil.error("参数pageNumber为空");
 		}
+		if (StringUtils.isBlank(dto.getDepartId())) {
+			List<SapReportAuth> auths = authService.selectListByWxUserId(userId);
+			List<Long> departIds = Lists.newArrayList();
+			for (SapReportAuth auth : auths) {
+				departIds.add(auth.getWxDepartId());
+			}
+			dto.setDepartIds(departIds);
+		}
 		Object result = sapCheckReportService.findUserReportPage(dto);
 		return ResultUtil.success(result, "操作成功");
 	}

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

@@ -1,29 +1,20 @@
 package org.fouram.controller;
 
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
 import org.fouram.core.base.controller.BaseController;
 import org.fouram.core.util.ParamUtil;
 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.entity.SapReportAuth;
-import org.fouram.service.SapCheckReportService;
 import org.fouram.service.SapReportAuthService;
 import org.fouram.service.WxDepartService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
-import com.google.common.collect.Lists;
-
 import io.swagger.annotations.Api;
 
 @Controller
@@ -35,8 +26,6 @@ public class SapReportController extends BaseController {
 	private SapReportAuthService service;
 	@Autowired
 	private WxDepartService wxDepartService;
-	@Autowired
-	private SapCheckReportService reportService;
 
 	@PostMapping(value = "/selectFirstDepartList", produces = "application/json;charset=utf-8")
 	@ResponseBody
@@ -68,22 +57,4 @@ 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, @RequestHeader("userId") String userId)
-			throws Exception {
-		ParamUtil.isBlank(userId, "header参数userId不可以为空");
-		ParamUtil.isNull(dto.getPageSize(), "参数pageSize不可以为空");
-		ParamUtil.isNull(dto.getPageNumber(), "参数pageNumber不可以为空");
-		if (StringUtils.isBlank(dto.getDepartId())) {
-			List<SapReportAuth> auths = service.selectListByWxUserId(userId);
-			List<Long> departIds = Lists.newArrayList();
-			for (SapReportAuth auth : auths) {
-				departIds.add(auth.getWxDepartId());
-			}
-			dto.setDepartIds(departIds);
-		}
-		return ResultUtil.success(reportService.findUserReports(dto), null);
-	}
 }