Browse Source

更新区域员工

master
PoffyZhang 1 year ago
parent
commit
a518c57bf3
4 changed files with 71 additions and 5 deletions
  1. +14
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  2. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java
  3. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java
  4. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java

+ 14
- 5
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java View File

@@ -194,7 +194,7 @@ public class EmployeeBatchGetTask {
dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream()
.filter(r -> "true".equals(r.getMainJob())
&& "A".equals(r.getEmpStatus())
&& StringUtils.isNotBlank(r.getOrganizationCode())
&& StringUtils.isNotBlank(r.getEmpPosUnitCode())
&& StringUtils.isNotBlank(r.getEmployeeCode())
).collect(Collectors.toList());

@@ -203,16 +203,19 @@ public class EmployeeBatchGetTask {
List<DingEmployeeInfo> saveList = new ArrayList<>();

for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) {
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getOrganizationCode())) {
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) {
saveList.add(dingEmployeeInfo);
}
}

List<DingOrganization> organizations = iDingOrganizationService.list();
Map<String, DingOrganization> organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o));

for (DingEmployeeInfo dingEmployeeInfo : saveList) {
String employeeCode = dingEmployeeInfo.getEmployeeCode();

DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getOrganizationCode, dingEmployeeInfo.getOrganizationCode())
.eq(DingEmployeeInfo::getEmpPosUnitCode, dingEmployeeInfo.getEmpPosUnitCode())
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode));
if (Objects.isNull(employeeInfo)) {
iDingEmployeeInfoService.save(dingEmployeeInfo);
@@ -220,11 +223,11 @@ public class EmployeeBatchGetTask {
dingEmployeeInfo.setId(employeeInfo.getId());
iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo);
}
generateOrUpdateUserInfo(dingEmployeeInfo);
generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap);
}
}

public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo) {
public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map<String, DingOrganization> organizationMap) {
String employeeCode = dingEmployeeInfo.getEmployeeCode();
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, employeeCode));
@@ -239,7 +242,13 @@ public class EmployeeBatchGetTask {
.updateBy(-1L)
.createOn(LocalDateTime.now())
.updateOn(LocalDateTime.now())
.empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode())
.build();
if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode());
userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName());
userInfo.setRegionCode(dingOrganization.getDivisionCode());
}
iUserInfoService.save(userInfo);
}
}


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java View File

@@ -4,6 +4,7 @@ import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.filemanage.manage.ProjectFileManage;
import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@@ -31,4 +32,15 @@ public class ProjectFileController {
return projectFileManage.list(param);
}

@GetMapping("/{projectId}")
@ApiOperation(value = "档案详情", notes = "档案详情")
public ProjectFileVO file(@PathVariable Long projectId){
return projectFileManage.file(projectId);
}

@PostMapping("/want-read/{projectId}")
@ApiOperation(value = "申请借阅", notes = "申请借阅")
public String wantRead(@PathVariable Long projectId){
return projectFileManage.wantRead(projectId);
}
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.filemanage.model.param.ProjectFileListParam;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileListVO;
import com.ningdatech.pmapi.filemanage.model.vo.ProjectFileVO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import lombok.AllArgsConstructor;
@@ -49,4 +50,12 @@ public class ProjectFileManage {
}).collect(Collectors.toList());
return PageVo.of(vos,page.getTotal());
}

public ProjectFileVO file(Long projectId) {
return null;
}

public String wantRead(Long projectId) {
return "申请成功";
}
}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.filemanage.model.vo;

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

import java.time.LocalDateTime;

/**
* @Classname ProjectFileVO
* @Description
* @Date 2023/6/6 14:41
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "ProjectFileVO", description = "项目档案")
public class ProjectFileVO {

@ApiModelProperty("项目ID")
private Long id;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("项目单位")
private String buildOrgName;

@ApiModelProperty("项目编号")
private String pojectCode;

@ApiModelProperty("是否可阅")
private Boolean canRead = Boolean.FALSE;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;
}

Loading…
Cancel
Save