From f0eb4272cc0090065696d86efc141c28c93b8cc4 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Wed, 15 Feb 2023 17:02:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E5=88=97=E8=A1=A8=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/user/controller/UserInfoController.java | 13 ++---- .../com/ningdatech/pmapi/user/entity/UserInfo.java | 1 + .../pmapi/user/manage/UserInfoManage.java | 50 +++++++++++++++++++++- .../pmapi/user/model/po/ReqUserDisablePO.java | 11 ++++- .../pmapi/user/model/vo/ResUserInfoListVO.java | 9 ++-- 5 files changed, 68 insertions(+), 16 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java index fad8006..4943f54 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java @@ -11,7 +11,6 @@ import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -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.RequestMapping; @@ -20,10 +19,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** - *

- * 用户信息表 前端控制器 - *

- * * @author Liuxinxin * @since 2023-01-04 */ @@ -41,10 +36,10 @@ public class UserInfoController { return userInfoManage.list(reqUserInfoListPO); } - @ApiOperation(value = "用户禁用", notes = "用户禁用") - @PostMapping("/disable") - public void disable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) { - userInfoManage.disable(reqUserDisablePO); + @ApiOperation(value = "用户禁用/启用", notes = "用户禁用/启用") + @PostMapping("/disable-enable") + public void disableOrEnable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) { + userInfoManage.disableOrEnable(reqUserDisablePO); } @ApiOperation(value = "用户详情", notes = "用户详情") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java index 03ced2e..75d807f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/entity/UserInfo.java @@ -40,4 +40,5 @@ public class UserInfo implements Serializable { private String realName; + private String available; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index b8a66e9..de80bb9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -1,14 +1,25 @@ package com.ningdatech.pmapi.user.manage; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; +import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.user.model.po.ReqUserDetailEditPO; import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; +import com.ningdatech.pmapi.user.service.IUserInfoService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + /** * @author liuxinxin * @date 2023/2/13 上午9:09 @@ -17,12 +28,47 @@ import org.springframework.stereotype.Component; @RequiredArgsConstructor public class UserInfoManage { + private final IDingOrganizationService iDingOrganizationService; + private final IDingEmployeeInfoService iDingEmployeeInfoService; + private final IUserInfoService iUserInfoService; + public PageVo list(ReqUserInfoListPO reqUserInfoListPO) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true"); - return null; + Page page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); + List records = page.getRecords(); + long total = page.getTotal(); + List resUserInfoListVOList = new ArrayList<>(); + if (records != null && records.size() > 0) { + resUserInfoListVOList = records.stream() + .map(r -> { + ResUserInfoListVO resListVO = new ResUserInfoListVO(); + resListVO.setName(r.getEmployeeName()); + resListVO.setOrgName(r.getOrganizationCode()); + resListVO.setOrgCode(r.getOrganizationCode()); + // TODO 从用户信息中获取 +// resListVO.setPhoneNo(); + // 从所属组织中获取 +// resListVO.setRegionId(); + resListVO.setStatus(false); + resListVO.setUpdateTime(r.getUpdateOn()); +// 从用户信息中获取 + resListVO.setUserId(1L); + resListVO.setEmployeeCode(r.getEmployeeCode()); + resListVO.setUserRoleList(new ArrayList<>()); + return resListVO; + }).collect(Collectors.toList()); + } + + PageVo pageVo = new PageVo<>(); + pageVo.setTotal(total); + pageVo.setRecords(resUserInfoListVOList); + return pageVo; } - public void disable(ReqUserDisablePO reqUserDisablePO) { + public void disableOrEnable(ReqUserDisablePO reqUserDisablePO) { + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisablePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisablePO.java index 2f712df..96196fb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisablePO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDisablePO.java @@ -12,11 +12,18 @@ import javax.validation.constraints.NotBlank; */ @Data -@ApiModel("用户禁用PO") +@ApiModel("用户禁用/启用 PO") public class ReqUserDisablePO { - @NotBlank(message = "用户ID不能为空") @ApiModelProperty("用户id") private Long userId; + @NotBlank(message = "浙政钉 用户编码 不能为空") + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @NotBlank(message = "浙政钉 用户编码 不能为空") + @ApiModelProperty("操作 true: 启用 / false 禁用") + private Boolean operation; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java index 3e61983..a16ee03 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserInfoListVO.java @@ -19,6 +19,9 @@ public class ResUserInfoListVO { @ApiModelProperty("用户id") private Long userId; + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + @ApiModelProperty("姓名") private String name; @@ -28,8 +31,8 @@ public class ResUserInfoListVO { @ApiModelProperty("所在单位(主职)") private String orgName; - @ApiModelProperty("所在单位(主职)id") - private Long orgId; + @ApiModelProperty("所在单位(主职)code") + private String orgCode; @ApiModelProperty("所属区域") private Long regionId; @@ -38,7 +41,7 @@ public class ResUserInfoListVO { private List userRoleList; @ApiModelProperty("状态") - private String status; + private Boolean status; @ApiModelProperty("更新时间") private LocalDateTime updateTime;