Selaa lähdekoodia

用户详情编辑 列表接口

tags/24080901
liuxinxin 1 vuosi sitten
vanhempi
commit
8e1c250d17
8 muutettua tiedostoa jossa 217 lisäystä ja 4 poistoa
  1. +71
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  2. +16
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java
  3. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  4. +33
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/base/UserRoleInfo.java
  5. +29
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java
  6. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java
  7. +29
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java
  8. +9
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java

+ 71
- 3
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Näytä tiedosto

@@ -3,18 +3,24 @@ package com.ningdatech.pmapi.ding.task;
import cn.hutool.core.collection.CollUtil;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.common.config.GovDingProperties;
import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO;
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
* @author liuxinxin
@@ -26,17 +32,25 @@ public class EmployeeBatchGetTask {

private final static Integer PAGE_SIZE = 20;

private final static Integer GROUP_SIZE = 100;

@Autowired
private ZwddClient zwddClient;

@Autowired
private IDingOrganizationService iDingOrganizationService;

@Autowired
private IDingEmployeeInfoService iDingEmployeeInfoService;

@Transactional(rollbackFor = Exception.class)
public void batchGetEmployeeTask() {

// 获取所有的组织列表
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list();
if (CollUtil.isNotEmpty(dingOrganizationList)) {
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();

for (DingOrganization dingOrganization : dingOrganizationList) {
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
String organizationCode = dingOrganization.getOrganizationCode();
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
query.setEmployeeStatus("A");
@@ -65,13 +79,67 @@ public class EmployeeBatchGetTask {
}
}

List<DingEmployeeInfo> dingEmployeeInfoList = new ArrayList<>();
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
List<String> employeeCodes = allOrganizationEmployeePositionList.stream().map(OrganizationEmployeePosition::getEmployeeCode).collect(Collectors.toList());
GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes);
// List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData();
} else {
// iDingEmployeeInfoService.saveBatch();
}
// 批量保存用户信息
saveBatch(allOrganizationEmployeePositionList);
}

}


}

private List<DingEmployeeInfo> buildDingEmployeeInfoRecord(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
List<DingEmployeeInfo> saveRecordList = new ArrayList<>();
for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) {
List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions();
if (CollUtil.isNotEmpty(govEmployeePositions)) {
List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>();
for (GovEmployeePosition govEmployeePosition : govEmployeePositions) {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob());
dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode());
dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode());
dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode());
dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode());
dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode());
dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode());
dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode());
dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus());
segmentSaveRecordList.add(dingEmployeeInfo);
}
saveRecordList.addAll(segmentSaveRecordList);
} else {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
saveRecordList.add(dingEmployeeInfo);
}

// zwddClient.pageOrganizationEmployeePositions(query);

}
return null;
}

private void saveBatch(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {


// // 批量保存
// if (saveRecordList.size() <= GROUP_SIZE) {
// iDingOrganizationService.saveBatch(saveRecordList);
// } else {
// List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
// for (List<DingOrganization> segment : split) {
// iDingOrganizationService.saveBatch(segment);
// }
// }

}
}

+ 16
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserInfoController.java Näytä tiedosto

@@ -3,8 +3,10 @@ package com.ningdatech.pmapi.user.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.user.manage.UserInfoManage;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -40,8 +42,21 @@ public class UserInfoController {

@ApiOperation(value = "用户禁用", notes = "用户禁用")
@PostMapping("/disable")
public void disable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO){
public void disable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO) {
userInfoManage.disable(reqUserDisablePO);
}

@ApiOperation(value = "用户详情", notes = "用户详情")
@PostMapping("/detail")
public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserInfoListPO reqUserInfoListPO) {
return userInfoManage.userInfoDetail(reqUserInfoListPO);
}

@ApiOperation(value = "用户详情编辑", notes = "用户详情编辑")
@PostMapping("/detail/edit")
public void userInfoDetailEdit(@Valid @RequestBody ReqUserDetailEditPO reqUserDetailEditPO) {
userInfoManage.userInfoDetailEdit(reqUserDetailEditPO);
}


}

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java Näytä tiedosto

@@ -2,8 +2,10 @@ package com.ningdatech.pmapi.user.manage;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.user.mapper.UserInfoMapper;
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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@@ -26,4 +28,12 @@ public class UserInfoManage {
public void disable(ReqUserDisablePO reqUserDisablePO) {

}

public ResUserDetailVO userInfoDetail(ReqUserInfoListPO reqUserInfoListPO) {
return null;
}

public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) {

}
}

+ 33
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/base/UserRoleInfo.java Näytä tiedosto

@@ -0,0 +1,33 @@
package com.ningdatech.pmapi.user.model.base;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Size;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
* @author liuxinxin
* @date 2022/8/22 下午4:12
*/
@Data
@ApiModel("用户角色信息")
public class UserRoleInfo {

@ApiModelProperty(value = "名称")
private String name;

@ApiModelProperty(value = "枚举code")
private String code;

@ApiModelProperty(value = "描述")
@Size(max = 100, message = "描述长度不能超过100")
@TableField(value = "describe", condition = LIKE)
private String describe;

@ApiModelProperty(value = "排序")
private Integer roleSort;
}

+ 29
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java Näytä tiedosto

@@ -0,0 +1,29 @@
package com.ningdatech.pmapi.user.model.po;

import com.ningdatech.pmapi.user.model.base.UserRoleInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2023/2/15 上午8:43
*/
@Data
@ApiModel("获取用户详情编辑请求")
public class ReqUserDetailEditPO {

@ApiModelProperty("userId")
private Long userId;

@ApiModelProperty("手机号")
private String phoneNo;

@ApiModelProperty("状态 启用/禁用")
private Boolean status;

@ApiModelProperty("用户角色信息列表")
private List<UserRoleInfo> userRoleInfoList;
}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java Näytä tiedosto

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.user.model.po;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
* @author liuxinxin
* @date 2023/2/15 上午8:43
*/
@Data
@ApiModel("获取用户详情请求")
public class ReqUserDetailPO {

@NotNull(message = "用户id 不能为空")
@ApiModelProperty("用户id")
private Long userId;
}

+ 29
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java Näytä tiedosto

@@ -0,0 +1,29 @@
package com.ningdatech.pmapi.user.model.vo;

import com.ningdatech.pmapi.user.model.base.UserRoleInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
* @author liuxinxin
* @date 2023/2/15 上午8:43
*/
@Data
@ApiModel("获取用户详情请求")
public class ResUserDetailVO {

@ApiModelProperty("userId")
private Long userId;

@ApiModelProperty("手机号")
private String phoneNo;

@ApiModelProperty("状态 启用/禁用")
private Boolean status;

@ApiModelProperty("用户角色信息列表")
private List<UserRoleInfo> userRoleInfoList;
}

+ 9
- 0
pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java Näytä tiedosto

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.organization;

import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
@@ -23,9 +24,17 @@ class OrganizationTest extends AppTests {
@Autowired
private OrganizationBatchGetTask organizationBatchGetTask;

@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;

@Test
public void testBatchGetOrganization() {
organizationBatchGetTask.batchGetOrganizationTask();
}

@Test
public void testEmployeeBatchGetTask(){
employeeBatchGetTask.batchGetEmployeeTask();
}

}

Loading…
Peruuta
Tallenna