新增网格员接口

This commit is contained in:
wanggeng 2021-12-08 20:49:12 +08:00
parent 090de658ff
commit 69d38c2a1b
4 changed files with 119 additions and 11 deletions

View File

@ -3,11 +3,13 @@ package cn.com.tenlion.usercenter.controller.resource.teammember;
import cn.com.tenlion.usercenter.pojo.dtos.teammember.TeamMemberDTO;
import cn.com.tenlion.usercenter.service.teammember.ITeamMemberService;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.pojo.vos.IdsVO;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -32,8 +34,8 @@ public class TeamMemberResourceController extends DefaultBaseController {
@ApiOperation(value = "队伍人员详情", notes = "队伍人员详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "teamMemberId", value = "队伍人员ID", paramType = "path")
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "teamMemberId", value = "队伍人员ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{teamMemberId}")
@ -43,7 +45,7 @@ public class TeamMemberResourceController extends DefaultBaseController {
@ApiOperation(value = "队伍人员列表", notes = "队伍人员列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
@ -54,12 +56,12 @@ public class TeamMemberResourceController extends DefaultBaseController {
@ApiOperation(value = "队伍人员分页列表", notes = "队伍人员分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
@ -196,4 +198,42 @@ public class TeamMemberResourceController extends DefaultBaseController {
return teamMemberService.listPageSubByAreaCodeAndSort(areaCode, sort, page);
}
@ApiOperation(value = "队伍人员列表通过部门ID列表", notes = "队伍人员列表通过部门ID列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("list/department-ids")
public List<TeamMemberDTO> listByDepartmentIds(@RequestBody IdsVO idsVO) {
if (idsVO.getIds().isEmpty()) {
throw new ParamsException("id列表不能为空");
}
return teamMemberService.listByDepartmentIds(idsVO.getIds());
}
@ApiOperation(value = "获取队伍人员分页列表通过部门ID列表", notes = "获取队伍人员分页列表通过部门ID列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("listpage/department-ids")
public SuccessResultList<List<TeamMemberDTO>> listPageByDepartmentIds(ListPage page, @RequestBody IdsVO idsVO) {
if (idsVO.getIds().isEmpty()) {
throw new ParamsException("id列表不能为空");
}
Map<String, Object> params = requestParams();
page.setParams(params);
return teamMemberService.listPageByDepartmentIds(page, idsVO.getIds());
}
@ApiOperation(value = "队伍人员统计通过部门ID列表", notes = "队伍人员统计通过部门ID列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("count/department-ids")
public SuccessResultData<Integer> countByDepartmentIds(@RequestBody IdsVO idsVO) {
if (idsVO.getIds().isEmpty()) {
throw new ParamsException("id列表不能为空");
}
return teamMemberService.countByDepartmentIds(idsVO.getIds());
}
}

View File

@ -1,6 +1,7 @@
package cn.com.tenlion.usercenter.service.teammember;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import cn.com.tenlion.usercenter.pojo.dtos.teammember.TeamMemberDTO;
import cn.com.tenlion.usercenter.pojo.vos.teammember.TeamMemberVO;
@ -303,4 +304,28 @@ public interface ITeamMemberService {
*/
SuccessResultList<List<TeamMemberDTO>> listPageSubByAreaCodeAndSort(String areaCode, String sort, ListPage page);
/**
* 队伍人员列表通过部门ID列表
*
* @param departmentIds 部门ID列表
* @return
*/
List<TeamMemberDTO> listByDepartmentIds(List<String> departmentIds);
/**
* 获取队伍人员分页列表通过部门ID列表
*
* @param page
* @param departmentIds 部门ID列表
* @return
*/
SuccessResultList<List<TeamMemberDTO>> listPageByDepartmentIds(ListPage page, List<String> departmentIds);
/**
* 队伍人员统计通过部门ID列表
*
* @param departmentIds
* @return
*/
SuccessResultData<Integer> countByDepartmentIds(List<String> departmentIds);
}

View File

@ -14,7 +14,9 @@ import ink.wgink.interfaces.role.IRoleUserBaseService;
import ink.wgink.interfaces.user.IUserBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.string.WStringUtil;
@ -40,6 +42,8 @@ public class TeamMemberServiceImpl extends DefaultBaseService implements ITeamMe
private IUserBaseService userBaseService;
@Autowired
private IRoleUserBaseService roleUserBaseService;
@Autowired
private IDepartmentUserService departmentUserService;
@Override
public void save(TeamMemberVO teamMemberVO) {
@ -297,6 +301,38 @@ public class TeamMemberServiceImpl extends DefaultBaseService implements ITeamMe
return listPage(page);
}
@Override
public List<TeamMemberDTO> listByDepartmentIds(List<String> departmentIds) {
List<String> userIds = departmentUserService.listUserId(departmentIds);
if (userIds.isEmpty()) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put("userIds", userIds);
return list(params);
}
@Override
public SuccessResultList<List<TeamMemberDTO>> listPageByDepartmentIds(ListPage page, List<String> departmentIds) {
List<String> userIds = departmentUserService.listUserId(departmentIds);
if (userIds.isEmpty()) {
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
}
page.getParams().put("userIds", userIds);
return listPage(page);
}
@Override
public SuccessResultData<Integer> countByDepartmentIds(List<String> departmentIds) {
List<String> userIds = departmentUserService.listUserId(departmentIds);
if (userIds.isEmpty()) {
return new SuccessResultData<>(0);
}
Map<String, Object> params = getHashMap(2);
params.put("userIds", userIds);
return new SuccessResultData<>(count(params));
}
/**
* 设置用户
*

View File

@ -370,9 +370,16 @@
FROM
city_team_member t1
<where>
<if test="areaCode != null and areaCode != ''">
<if test="areaCode != null and areaCode != ''">
t1.area_code = #{areaCode}
</if>
</if>
<if test="userIds != null and userIds.size > 0">
AND
t1.user_id IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
</where>
</select>