处理网格员查询问题
This commit is contained in:
parent
910c7ea28e
commit
60e84305ef
@ -20,6 +20,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -114,7 +115,7 @@ public class GridPersonnelController extends AbstractController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagegridpersonnel")
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return gridPersonnelService.listPageGridPersonnel(page);
|
||||
@ -137,7 +138,7 @@ public class GridPersonnelController extends AbstractController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagegridpersonnelofmine")
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return gridPersonnelService.listPageGridPersonnelOfMine(page);
|
||||
|
@ -16,6 +16,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -102,7 +103,7 @@ public class GridPersonnelAppController extends AbstractController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagegridpersonnel")
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(@RequestHeader("token") String token, ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(@RequestHeader("token") String token, ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return gridPersonnelService.listPageGridPersonnel(page);
|
||||
|
@ -16,6 +16,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -102,7 +103,7 @@ public class GridPersonnelResourceController extends AbstractController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpagegridpersonnel")
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return gridPersonnelService.listPageGridPersonnel(page);
|
||||
|
@ -11,6 +11,7 @@ import com.cm.common.result.SuccessResultList;
|
||||
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
||||
import com.cm.inspection.pojo.vos.gridpersonnel.GridPersonnelVO;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -116,7 +117,7 @@ public interface IGridPersonnelService {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException;
|
||||
SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException, UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* 网格人员列表(通过用户名和是否是网格员)
|
||||
@ -173,7 +174,7 @@ public interface IGridPersonnelService {
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException;
|
||||
SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException, UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* 获取我的网格员身份
|
||||
|
@ -8,6 +8,7 @@ import com.cm.common.exception.SaveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
@ -24,9 +25,12 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.oauth2.client.resource.UserRedirectRequiredException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.swing.text.ParagraphView;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -202,8 +206,21 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnel(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
Object keywords = page.getParams().get("keywords");
|
||||
if(keywords != null && !StringUtils.isBlank(keywords.toString())) {
|
||||
page.getParams().remove("keywords");
|
||||
List<String> userIds = new ArrayList<>();
|
||||
List<UserResourceBO> userResourceBOs = userService.listResourceByKeywords(keywords.toString());
|
||||
for(UserResourceBO userResourceBO : userResourceBOs) {
|
||||
userIds.add(userResourceBO.getUserId());
|
||||
}
|
||||
if(userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), page.getPage(), 0L);
|
||||
}
|
||||
page.getParams().put("userIds", userIds);
|
||||
}
|
||||
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelDao.listGridPersonnel(page.getParams());
|
||||
PageInfo<GridPersonnelDTO> pageInfo = new PageInfo<>(gridPersonnelDTOs);
|
||||
setGridPersonnelUserInfo(gridPersonnelDTOs);
|
||||
@ -252,7 +269,7 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException {
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPageGridPersonnelOfMine(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
page.getParams().put("leaderUserId", securityComponent.getCurrentUser().getUserId());
|
||||
return listPageGridPersonnel(page);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user