@@ -11,7 +11,6 @@ import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Controller; | |||||
import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||
import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
@@ -20,10 +19,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
/** | /** | ||||
* <p> | |||||
* 用户信息表 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author Liuxinxin | * @author Liuxinxin | ||||
* @since 2023-01-04 | * @since 2023-01-04 | ||||
*/ | */ | ||||
@@ -41,10 +36,10 @@ public class UserInfoController { | |||||
return userInfoManage.list(reqUserInfoListPO); | 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 = "用户详情") | @ApiOperation(value = "用户详情", notes = "用户详情") | ||||
@@ -40,4 +40,5 @@ public class UserInfo implements Serializable { | |||||
private String realName; | private String realName; | ||||
private String available; | |||||
} | } |
@@ -1,14 +1,25 @@ | |||||
package com.ningdatech.pmapi.user.manage; | 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.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.ReqUserDetailEditPO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | ||||
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; | ||||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | ||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
* @date 2023/2/13 上午9:09 | * @date 2023/2/13 上午9:09 | ||||
@@ -17,12 +28,47 @@ import org.springframework.stereotype.Component; | |||||
@RequiredArgsConstructor | @RequiredArgsConstructor | ||||
public class UserInfoManage { | public class UserInfoManage { | ||||
private final IDingOrganizationService iDingOrganizationService; | |||||
private final IDingEmployeeInfoService iDingEmployeeInfoService; | |||||
private final IUserInfoService iUserInfoService; | |||||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | ||||
LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||||
.eq(DingEmployeeInfo::getMainJob, "true"); | |||||
return null; | |||||
Page<DingEmployeeInfo> page = iDingEmployeeInfoService.page(new Page<>(reqUserInfoListPO.getPageNumber(), reqUserInfoListPO.getPageSize()), wrapper); | |||||
List<DingEmployeeInfo> records = page.getRecords(); | |||||
long total = page.getTotal(); | |||||
List<ResUserInfoListVO> 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<ResUserInfoListVO> pageVo = new PageVo<>(); | |||||
pageVo.setTotal(total); | |||||
pageVo.setRecords(resUserInfoListVOList); | |||||
return pageVo; | |||||
} | } | ||||
public void disable(ReqUserDisablePO reqUserDisablePO) { | |||||
public void disableOrEnable(ReqUserDisablePO reqUserDisablePO) { | |||||
} | } | ||||
@@ -12,11 +12,18 @@ import javax.validation.constraints.NotBlank; | |||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("用户禁用PO") | |||||
@ApiModel("用户禁用/启用 PO") | |||||
public class ReqUserDisablePO { | public class ReqUserDisablePO { | ||||
@NotBlank(message = "用户ID不能为空") | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
@NotBlank(message = "浙政钉 用户编码 不能为空") | |||||
@ApiModelProperty("操作 true: 启用 / false 禁用") | |||||
private Boolean operation; | |||||
} | } |
@@ -19,6 +19,9 @@ public class ResUserInfoListVO { | |||||
@ApiModelProperty("用户id") | @ApiModelProperty("用户id") | ||||
private Long userId; | private Long userId; | ||||
@ApiModelProperty("浙政钉 用户编码") | |||||
private String employeeCode; | |||||
@ApiModelProperty("姓名") | @ApiModelProperty("姓名") | ||||
private String name; | private String name; | ||||
@@ -28,8 +31,8 @@ public class ResUserInfoListVO { | |||||
@ApiModelProperty("所在单位(主职)") | @ApiModelProperty("所在单位(主职)") | ||||
private String orgName; | private String orgName; | ||||
@ApiModelProperty("所在单位(主职)id") | |||||
private Long orgId; | |||||
@ApiModelProperty("所在单位(主职)code") | |||||
private String orgCode; | |||||
@ApiModelProperty("所属区域") | @ApiModelProperty("所属区域") | ||||
private Long regionId; | private Long regionId; | ||||
@@ -38,7 +41,7 @@ public class ResUserInfoListVO { | |||||
private List<Role> userRoleList; | private List<Role> userRoleList; | ||||
@ApiModelProperty("状态") | @ApiModelProperty("状态") | ||||
private String status; | |||||
private Boolean status; | |||||
@ApiModelProperty("更新时间") | @ApiModelProperty("更新时间") | ||||
private LocalDateTime updateTime; | private LocalDateTime updateTime; | ||||