@@ -3,6 +3,9 @@ package com.ningdatech.pmapi.common.helper; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import java.util.Collection; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/10 下午4:38 | |||
@@ -23,6 +26,8 @@ public interface UserInfoHelper { | |||
UserFullInfoDTO getUserFullInfo(UserInfo userInfo); | |||
List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos); | |||
String getUserName(Long userId); | |||
/** | |||
@@ -34,6 +39,8 @@ public interface UserInfoHelper { | |||
UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); | |||
List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes); | |||
/** | |||
* 获取用户任职所在单位code | |||
* | |||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
@@ -21,10 +22,9 @@ 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.Objects; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
/** | |||
* @author liuxinxin | |||
@@ -127,6 +127,83 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
return userFullInfo; | |||
} | |||
/** | |||
* 批量查询 这里 会没有角色 | |||
* @param userInfos | |||
* @return | |||
*/ | |||
@Override | |||
public List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos) { | |||
List<UserFullInfoDTO> res = Lists.newArrayList(); | |||
if(CollUtil.isEmpty(userInfos)){ | |||
return res; | |||
} | |||
Map<String,UserInfo> userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode,e->e)); | |||
// 获取浙政钉雇员信息 组织信息 | |||
List<String> employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||
if (CollUtil.isNotEmpty(employeeCodes)) { | |||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService | |||
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.in(DingEmployeeInfo::getEmployeeCode, employeeCodes) | |||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||
if(CollUtil.isEmpty(dingEmployeeInfoList)){ | |||
return res; | |||
} | |||
// 装配用户任职所在单位 | |||
List<String> empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); | |||
List<String> orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); | |||
List<String> allOrgCodes = Stream.concat(empPosUnitCodes.stream(),orgCodes.stream()).collect(Collectors.toList()); | |||
if (CollUtil.isEmpty(allOrgCodes)) { | |||
return res; | |||
} | |||
List<DingOrganization> dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); | |||
if (CollUtil.isEmpty(dingOrganizations)) { | |||
return res; | |||
} | |||
Map<String,DingOrganization> orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode,d -> d)); | |||
res = dingEmployeeInfoList.stream().map(e -> { | |||
UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); | |||
if(orgMap.containsKey(e.getEmpPosUnitCode())){ | |||
DingOrganization organization = orgMap.get(e.getEmpPosUnitCode()); | |||
userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode()); | |||
userFullInfo.setEmpPosUnitName(organization.getOrganizationName()); | |||
userFullInfo.setRegionCode(organization.getDivisionCode()); | |||
} | |||
if(orgMap.containsKey(e.getOrganizationCode())){ | |||
DingOrganization organization = orgMap.get(e.getOrganizationCode()); | |||
userFullInfo.setOrganizationCode(organization.getOrganizationCode()); | |||
userFullInfo.setOrganizationName(organization.getOrganizationName()); | |||
// 测试使用 | |||
userFullInfo.setRegionLevel(3); | |||
} | |||
if(userMap.containsKey(e.getEmployeeCode())){ | |||
UserInfo userInfo = userMap.get(e.getEmployeeCode()); | |||
// 装配返回 | |||
userFullInfo.setUserId(userInfo.getId()); | |||
userFullInfo.setIdentifier(userInfo.getRealName()); | |||
userFullInfo.setRealName(userInfo.getRealName()); | |||
userFullInfo.setEmployeeCode(e.getEmployeeCode()); | |||
userFullInfo.setUsername(userInfo.getRealName()); | |||
userFullInfo.setMobile(userInfo.getMobile()); | |||
userFullInfo.setAccountId(userInfo.getAccountId()); | |||
String available = userInfo.getAvailable(); | |||
if (StringUtils.isNotBlank(available)) { | |||
userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); | |||
} | |||
} | |||
return userFullInfo; | |||
}).collect(Collectors.toList()); | |||
} | |||
return res; | |||
} | |||
@Override | |||
public String getUserName(Long userId) { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
@@ -154,6 +231,12 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
} | |||
@Override | |||
public List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes) { | |||
List<UserInfo> userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); | |||
return getUserFullInfos(userInfos); | |||
} | |||
@Override | |||
public String getUserEmpPosUnitCode(Long userId) { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
return userFullInfo.getEmpPosUnitCode(); | |||
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.common.util; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.util.NumberUtils; | |||
@@ -109,4 +110,10 @@ public class BizUtils { | |||
return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); | |||
} | |||
public static String getProjectTypeName(Integer projectType) { | |||
if (Objects.nonNull(projectType)) { | |||
return ProjectTypeEnum.getDesc(projectType); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
package com.ningdatech.pmapi.common.util; | |||
import com.ningdatech.basic.util.StrPool; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname CodeUtil | |||
* @Description | |||
* @Date 2023/6/20 16:06 | |||
* @Author PoffyZhang | |||
*/ | |||
@Slf4j | |||
public class CodeUtil { | |||
public static Collection<String> convertStrToList(String str) { | |||
if(StringUtils.isBlank(str)){ | |||
return Collections.emptyList(); | |||
} | |||
return Arrays.stream(str.split(StrPool.COMMA)).collect(Collectors.toList()); | |||
} | |||
} |
@@ -1,54 +0,0 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @Classname PerformanceAppraisalController | |||
* @Description | |||
* @Date 2023/6/19 14:16 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价控制器") | |||
@RequestMapping("/api/v1/performance-appraisal") | |||
public class PerformanceAppraisalController { | |||
private final PerformanceAppraisalManage performanceAppraisalManage; | |||
@GetMapping("/list") | |||
@ApiOperation("绩效列表") | |||
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) { | |||
return performanceAppraisalManage.list(req); | |||
} | |||
@GetMapping("/detail/{id}") | |||
@ApiOperation("绩效详情") | |||
public PerformanceAppraisalVO detail(@PathVariable Long id) { | |||
return performanceAppraisalManage.detail(id); | |||
} | |||
@PostMapping("/create") | |||
@ApiOperation("新建绩效") | |||
@WebLog("新建绩效") | |||
public String create(PerformanceAppraisalCreateDTO createDTO) { | |||
return performanceAppraisalManage.create(createDTO); | |||
} | |||
@PostMapping("/edit") | |||
@ApiOperation("编辑绩效") | |||
@WebLog("编辑绩效") | |||
public String edit(PerformanceAppraisalEditDTO editDTO) { | |||
return performanceAppraisalManage.edit(editDTO); | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
package com.ningdatech.pmapi.performance.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalPlanManage; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceAppraisalController | |||
* @Description | |||
* @Date 2023/6/19 14:16 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "绩效评价-评价计划") | |||
@RequestMapping("/api/v1/performance-appraisal/plan") | |||
public class PerformanceAppraisalPlanController { | |||
private final PerformanceAppraisalPlanManage performanceAppraisalPlanManage; | |||
@GetMapping("/list") | |||
@ApiOperation("绩效评价列表") | |||
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) { | |||
return performanceAppraisalPlanManage.list(req); | |||
} | |||
@GetMapping("/detail/{id}") | |||
@ApiOperation("绩效评价列表") | |||
public PerformanceAppraisalVO detail(@PathVariable Long id) { | |||
return performanceAppraisalPlanManage.detail(id); | |||
} | |||
@PostMapping("/create") | |||
@ApiOperation("绩效评价创建") | |||
@WebLog("绩效评价创建") | |||
public String create(@Valid @RequestBody PerformanceAppraisalCreateDTO createDTO) { | |||
return performanceAppraisalPlanManage.create(createDTO); | |||
} | |||
@PostMapping("/edit") | |||
@ApiOperation("编辑绩效评价") | |||
@WebLog("编辑绩效评价") | |||
public String edit(@Valid @RequestBody PerformanceAppraisalEditDTO editDTO) { | |||
return performanceAppraisalPlanManage.edit(editDTO); | |||
} | |||
@GetMapping("/group/list/{appraisalId}") | |||
@ApiOperation("绩效评价分组列表") | |||
public List<PerformanceAppraisalProjectGroupVO> groupList(@PathVariable Long appraisalId) { | |||
return performanceAppraisalPlanManage.groupList(appraisalId); | |||
} | |||
@PostMapping("/group/save") | |||
@ApiOperation("绩效评价分组保存") | |||
@WebLog("绩效评价分组保存") | |||
public String groupSave(@Valid @RequestBody PerformanceAppraisalProjectGroupSaveDTO dto) { | |||
return performanceAppraisalPlanManage.groupSave(dto); | |||
} | |||
} |
@@ -28,8 +28,9 @@ public class PerformanceAppraisalConveter { | |||
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | |||
vo.setIsReAppraisal(p.getIsReAppraisal()); | |||
vo.setId(p.getProjectId()); | |||
if(map.containsKey(p.getProjectId())){ | |||
Project project = map.get(p.getProjectId()); | |||
if(map.containsKey(p.getProjectCode())){ | |||
Project project = map.get(p.getProjectCode()); | |||
vo.setProjectCode(project.getProjectCode()); | |||
vo.setProjectName(project.getProjectName()); | |||
vo.setProjectType(project.getProjectType()); | |||
vo.setProjectTypeName(getProjectTypeName(project.getProjectType())); | |||
@@ -7,34 +7,43 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Maps; | |||
import com.google.common.collect.Sets; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.util.BizUtils; | |||
import com.ningdatech.pmapi.common.util.CodeUtil; | |||
import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter; | |||
import com.ningdatech.pmapi.performance.model.dto.AppraisalProjectDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO; | |||
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectGroupService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -46,7 +55,7 @@ import java.util.stream.Collectors; | |||
@Component | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class PerformanceAppraisalManage { | |||
public class PerformanceAppraisalPlanManage { | |||
private final IPerformanceAppraisalService performanceAppraisalService; | |||
@@ -58,6 +67,10 @@ public class PerformanceAppraisalManage { | |||
private final IProjectApplicationService applicationService; | |||
private final IPerformanceAppraisalProjectGroupService groupService; | |||
private final UserInfoHelper userInfoHelper; | |||
/** | |||
* 绩效列表 | |||
* @param req | |||
@@ -182,6 +195,7 @@ public class PerformanceAppraisalManage { | |||
* @param createDTO | |||
* @return | |||
*/ | |||
@Transactional | |||
public String create(PerformanceAppraisalCreateDTO createDTO) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
@@ -194,11 +208,15 @@ public class PerformanceAppraisalManage { | |||
pa.setUpdateBy(user.getUsername()); | |||
performanceAppraisalService.save(pa); | |||
if(CollUtil.isNotEmpty(createDTO.getProjects())){ | |||
if(CollUtil.isNotEmpty(createDTO.getProjects()) | |||
&& StringUtils.isNotBlank(createDTO.getTarget()) | |||
&& createDTO.getTarget().contains("1")){ | |||
saveProjects(createDTO,pa.getId(),user); | |||
} | |||
if(CollUtil.isNotEmpty(createDTO.getApplicationIds())){ | |||
if(CollUtil.isNotEmpty(createDTO.getApplicationIds()) | |||
&& StringUtils.isNotBlank(createDTO.getTarget()) | |||
&& createDTO.getTarget().contains("2")){ | |||
saveApplications(createDTO,pa.getId(),user); | |||
} | |||
@@ -211,6 +229,7 @@ public class PerformanceAppraisalManage { | |||
* @param editDTO | |||
* @return | |||
*/ | |||
@Transactional | |||
public String edit(PerformanceAppraisalEditDTO editDTO) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
@@ -252,7 +271,8 @@ public class PerformanceAppraisalManage { | |||
} | |||
} | |||
private void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
@Transactional | |||
public void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(createDTO.getProjects())){ | |||
return; | |||
} | |||
@@ -275,7 +295,8 @@ public class PerformanceAppraisalManage { | |||
} | |||
} | |||
private void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
@Transactional | |||
public void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(createDTO.getApplicationIds())){ | |||
return; | |||
} | |||
@@ -296,7 +317,8 @@ public class PerformanceAppraisalManage { | |||
} | |||
} | |||
private void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
@Transactional | |||
public void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
if(Objects.isNull(editDTO.getProjects())){ | |||
return; | |||
} | |||
@@ -321,8 +343,9 @@ public class PerformanceAppraisalManage { | |||
} | |||
} | |||
private void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(editDTO.getApplicationIds())){ | |||
@Transactional | |||
public void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
if(Objects.isNull(editDTO.getApplicationIds())){ | |||
return; | |||
} | |||
@@ -344,4 +367,119 @@ public class PerformanceAppraisalManage { | |||
performanceAppraisalApplicationService.save(paa); | |||
} | |||
} | |||
public List<PerformanceAppraisalProjectGroupVO> groupList(Long appraisalId) { | |||
List<PerformanceAppraisalProjectGroup> groups = groupService.list( | |||
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) | |||
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)); | |||
if(CollUtil.isEmpty(groups)){ | |||
return Collections.emptyList(); | |||
} | |||
Set<String> allEmployeeCodes = Sets.newHashSet(); | |||
Set<String> projectCodes = Sets.newHashSet(); | |||
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||
Map<String, Project> projectMap = Maps.newHashMap(); | |||
groups.stream().forEach(g -> { | |||
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); | |||
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); | |||
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectIds())); | |||
}); | |||
if(CollUtil.isNotEmpty(allEmployeeCodes)){ | |||
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes); | |||
if(CollUtil.isNotEmpty(users)){ | |||
userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); | |||
} | |||
} | |||
if(CollUtil.isNotEmpty(projectCodes)){ | |||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode,projectCodes) | |||
.eq(Project::getNewest,Boolean.TRUE)); | |||
if(CollUtil.isNotEmpty(projects)){ | |||
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); | |||
} | |||
} | |||
Map<String, Project> finalProjectMap = projectMap; | |||
Map<String, UserFullInfoDTO> finalUserMap = userMap; | |||
return groups.stream().map(g -> { | |||
PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); | |||
vo.setAppraisalId(g.getAppraisalId()); | |||
vo.setName(g.getName()); | |||
vo.setCreateOn(g.getCreateOn()); | |||
vo.setCreateBy(g.getCreateBy()); | |||
vo.setUpdateBy(g.getUpdateBy()); | |||
vo.setUpdateOn(g.getUpdateOn()); | |||
vo.setId(g.getId()); | |||
vo.setProjects(checkProject(g.getProjectIds(), finalProjectMap)); | |||
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap)); | |||
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap)); | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
} | |||
/** | |||
* 分组 保存 | |||
* @param dto | |||
* @return | |||
*/ | |||
public String groupSave(PerformanceAppraisalProjectGroupSaveDTO dto) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceAppraisalProjectGroup group = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectGroup.class); | |||
if(Objects.isNull(dto.getId())){ | |||
group.setId(null); | |||
group.setCreateOn(LocalDateTime.now()); | |||
group.setCreateBy(user.getUsername()); | |||
}else{ | |||
PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!"); | |||
group.setId(old.getId()); | |||
} | |||
if(CollUtil.isNotEmpty(dto.getProjectCodes())){ | |||
group.setProjectIds(dto.getProjectCodes().stream().collect(Collectors.joining(StrPool.COMMA))); | |||
} | |||
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ | |||
group.setReAppraisalUsers(dto.getReAppraisalUsers().stream().collect(Collectors.joining(StrPool.COMMA))); | |||
} | |||
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ | |||
group.setVerificationUsers(dto.getVerificationUsers().stream().collect(Collectors.joining(StrPool.COMMA))); | |||
} | |||
group.setUpdateOn(LocalDateTime.now()); | |||
group.setUpdateBy(user.getUsername()); | |||
groupService.saveOrUpdate(group); | |||
return "操作成功"; | |||
} | |||
private List<PerformanceAppraisalProjectVO> checkProject(String projectIds, Map<String, Project> projectMap) { | |||
if(StringUtils.isBlank(projectIds)){ | |||
return Collections.emptyList(); | |||
} | |||
return Arrays.stream(projectIds.split(StrPool.COMMA)).map(projectCode -> { | |||
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | |||
if(projectMap.containsKey(projectCode)){ | |||
Project project = projectMap.get(projectCode); | |||
vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType())); | |||
vo.setProjectType(project.getProjectType()); | |||
vo.setId(project.getId()); | |||
vo.setProjectCode(projectCode); | |||
vo.setProjectYear(project.getProjectYear()); | |||
vo.setDeclareAmount(project.getDeclareAmount()); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
} | |||
private List<UserFullInfoDTO> checkUser(String users, Map<String, UserFullInfoDTO> userMap) { | |||
if(StringUtils.isBlank(users)){ | |||
return Collections.emptyList(); | |||
} | |||
return Arrays.stream(users.split(StrPool.COMMA)).map( | |||
employeeCode -> userMap.get(employeeCode) | |||
).collect(Collectors.toList()); | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceAppraisalProjectGroupMapper extends BaseMapper<PerformanceAppraisalProjectGroup> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectGroupMapper"> | |||
</mapper> |
@@ -2,9 +2,7 @@ package com.ningdatech.pmapi.performance.model.dto; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
import java.util.List; | |||
/** | |||
* @Classname AppraisalProjectDTO | |||
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import io.swagger.annotations.ApiModel; | |||
@@ -30,26 +31,32 @@ public class PerformanceAppraisalCreateDTO implements Serializable { | |||
@ApiModelProperty("自评开始时间") | |||
@NotNull(message = "自评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
@NotNull(message = "自评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
@NotNull(message = "复评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
@NotNull(message = "复评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
@NotNull(message = "核查时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
@NotNull(message = "核查时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -27,35 +28,34 @@ public class PerformanceAppraisalEditDTO implements Serializable { | |||
private Long id; | |||
@ApiModelProperty("计划名称") | |||
@NotBlank(message = "请输入计划名称") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private String name; | |||
@ApiModelProperty("自评开始时间") | |||
@NotNull(message = "自评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
@NotNull(message = "自评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
@NotNull(message = "复评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
@NotNull(message = "复评时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
@NotNull(message = "核查时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
@NotNull(message = "核查时间错误") | |||
@JSONField(format = "yyyy-MM-dd") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
@NotBlank(message = "评价目标不能为空") | |||
private String target; | |||
@ApiModelProperty("评价项目 只有ID 和是否复评") | |||
@@ -0,0 +1,43 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceAppraisalProjectGroupSaveDTO | |||
* @Description 绩效评价和项目分组 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") | |||
public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("id") | |||
private Long id; | |||
@ApiModelProperty("名称") | |||
private String name; | |||
@ApiModelProperty("计划id") | |||
private Long appraisalId; | |||
@ApiModelProperty("分组内的所有项目code") | |||
private List<String> projectCodes; | |||
@ApiModelProperty("复评人员") | |||
private List<String> reAppraisalUsers; | |||
@ApiModelProperty("核查人员") | |||
private List<String> verificationUsers; | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.ningdatech.pmapi.performance.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @Classname PerformanceAppraisalProjectGroup | |||
* @Description 绩效评价和项目分组 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@TableName("nd_performance_appraisal_project_group") | |||
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") | |||
public class PerformanceAppraisalProjectGroup implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
@TableId(type = IdType.AUTO) | |||
private Long id; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
@ApiModelProperty("名称") | |||
private String name; | |||
@ApiModelProperty("计划id") | |||
private Long appraisalId; | |||
@ApiModelProperty("分组内的所有项目id") | |||
private String projectIds; | |||
@ApiModelProperty("复评人员") | |||
private String reAppraisalUsers; | |||
@ApiModelProperty("核查人员") | |||
private String verificationUsers; | |||
} |
@@ -1,11 +1,8 @@ | |||
package com.ningdatech.pmapi.performance.model.req; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.basic.model.PagePo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
import java.time.LocalDateTime; | |||
/** | |||
@@ -23,10 +20,8 @@ public class PerformanceAppraisalListReq extends PagePo { | |||
private String name; | |||
@ApiModelProperty("开始时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private LocalDateTime start; | |||
private String start; | |||
@ApiModelProperty("结束时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private LocalDateTime end; | |||
private String end; | |||
} |
@@ -0,0 +1,46 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceAppraisalProjectGroupVO | |||
* @Description 绩效评价和项目分组 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价项目分组", description = "绩效评价项目分组") | |||
public class PerformanceAppraisalProjectGroupVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
private LocalDateTime createOn; | |||
private LocalDateTime updateOn; | |||
private String createBy; | |||
private String updateBy; | |||
@ApiModelProperty("名称") | |||
private String name; | |||
@ApiModelProperty("计划id") | |||
private Long appraisalId; | |||
@ApiModelProperty("分组内的所有项目") | |||
private List<PerformanceAppraisalProjectVO> projects; | |||
@ApiModelProperty("复评人员") | |||
private List<UserFullInfoDTO> reAppraisalUsers; | |||
@ApiModelProperty("核查人员") | |||
private List<UserFullInfoDTO> verificationUsers; | |||
} |
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
@@ -24,6 +25,9 @@ public class PerformanceAppraisalProjectVO implements Serializable { | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("项目编码") | |||
private String projectCode; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@@ -38,4 +42,10 @@ public class PerformanceAppraisalProjectVO implements Serializable { | |||
@ApiModelProperty("是否复评") | |||
private Boolean isReAppraisal; | |||
@ApiModelProperty("申报金额") | |||
private BigDecimal declareAmount; | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceAppraisalProjectGroupService extends IService<PerformanceAppraisalProjectGroup> { | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.ningdatech.pmapi.performance.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalProjectGroupMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectGroupService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 绩效评价分组 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceAppraisalProjectGroupServiceImpl extends ServiceImpl<PerformanceAppraisalProjectGroupMapper, | |||
PerformanceAppraisalProjectGroup> implements IPerformanceAppraisalProjectGroupService { | |||
} |
@@ -3,6 +3,9 @@ package com.ningdatech.pmapi.user.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import java.util.Collection; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 服务类 | |||
@@ -17,4 +20,5 @@ public interface IUserInfoService extends IService<UserInfo> { | |||
UserInfo getUserInfoByEmployeeCode(String employeeCode); | |||
List<UserInfo> getUserInfoByEmployeeCodes(Collection<String> employeeCodes); | |||
} |
@@ -10,6 +10,9 @@ import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Collection; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
@@ -39,4 +42,10 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> | |||
return getOne(query); | |||
} | |||
@Override | |||
public List<UserInfo> getUserInfoByEmployeeCodes(Collection<String> employeeCodes) { | |||
LambdaQueryWrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class) | |||
.in(UserInfo::getEmployeeCode, employeeCodes); | |||
return list(query); | |||
} | |||
} |