From a518c57bf384a854683d13993992148e54620f2b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 7 Jun 2023 13:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8C=BA=E5=9F=9F=E5=91=98?= =?UTF-8?q?=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/ding/task/EmployeeBatchGetTask.java | 19 +++++++++--- .../controller/ProjectFileController.java | 12 ++++++++ .../pmapi/filemanage/manage/ProjectFileManage.java | 9 ++++++ .../pmapi/filemanage/model/vo/ProjectFileVO.java | 36 ++++++++++++++++++++++ 4 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java index ae234c9..de061ae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java @@ -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 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 organizations = iDingOrganizationService.list(); + Map 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 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); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java index 67f513d..0605b44 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/controller/ProjectFileController.java @@ -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); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java index 777b1f7..bd8211b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java @@ -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 "申请成功"; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java new file mode 100644 index 0000000..c49c8cf --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java @@ -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; +}