@@ -28,7 +28,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; | |||
"com.ningdatech.pmapi.sms.controller", | |||
"com.ningdatech.pmapi.workbench.controller", | |||
"com.ningdatech.pmapi.ding.controller", | |||
"com.ningdatech.pmapi.filemanage.controller" | |||
"com.ningdatech.pmapi.filemanage.controller", | |||
"com.ningdatech.pmapi.performance.controller" | |||
}) | |||
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { | |||
@@ -0,0 +1,54 @@ | |||
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,71 @@ | |||
package com.ningdatech.pmapi.performance.convert; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname PerformanceAppraisalConverer | |||
* @Description | |||
* @Date 2023/6/19 15:31 | |||
* @Author PoffyZhang | |||
*/ | |||
public class PerformanceAppraisalConveter { | |||
public static List<PerformanceAppraisalProjectVO> convertProjects( | |||
List<PerformanceAppraisalProject> projects, Map<String, Project> map) { | |||
if(CollUtil.isNotEmpty(projects) && CollUtil.isNotEmpty(map)){ | |||
return projects.stream().map(p -> { | |||
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | |||
vo.setIsReAppraisal(p.getIsReAppraisal()); | |||
vo.setId(p.getProjectId()); | |||
if(map.containsKey(p.getProjectId())){ | |||
Project project = map.get(p.getProjectId()); | |||
vo.setProjectName(project.getProjectName()); | |||
vo.setProjectType(project.getProjectType()); | |||
vo.setProjectTypeName(getProjectTypeName(project.getProjectType())); | |||
vo.setBuildOrgName(project.getBuildOrgName()); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
} | |||
return Collections.emptyList(); | |||
} | |||
public static List<PerformanceAppraisalApplicationVO> convertApplications( | |||
List<PerformanceAppraisalApplication> applications, Map<Long, ProjectApplication> map) { | |||
if(CollUtil.isNotEmpty(applications) && CollUtil.isNotEmpty(map)){ | |||
return applications.stream().map(a -> { | |||
PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO(); | |||
vo.setId(a.getApplicationId()); | |||
if(map.containsKey(a.getApplicationId())){ | |||
ProjectApplication application = map.get(a.getApplicationId()); | |||
vo.setApplicationName(StringUtils.isNotBlank(application.getApplicationName())? | |||
application.getApplicationName() : application.getAccountAppName()); | |||
vo.setApplicationType(application.getApplicationType()); | |||
vo.setBizDomain(application.getBizDomain()); | |||
// vo.setBuildOrgName(application.get()); | |||
vo.setPublishSide(application.getPublishSide()); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
} | |||
return Collections.emptyList(); | |||
} | |||
public static String getProjectTypeName(Integer projectType) { | |||
if (Objects.nonNull(projectType)) { | |||
return ProjectTypeEnum.getDesc(projectType); | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
} |
@@ -0,0 +1,347 @@ | |||
package com.ningdatech.pmapi.performance.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
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.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
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.entity.PerformanceAppraisal; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService; | |||
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.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname PerformanceAppraisalManage | |||
* @Description | |||
* @Date 2023/6/19 14:18 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@Slf4j | |||
@AllArgsConstructor | |||
public class PerformanceAppraisalManage { | |||
private final IPerformanceAppraisalService performanceAppraisalService; | |||
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; | |||
private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; | |||
private final IProjectService projectService; | |||
private final IProjectApplicationService applicationService; | |||
/** | |||
* 绩效列表 | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) { | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.like(StringUtils.isNotBlank(req.getName()),PerformanceAppraisal::getName,req.getName()) | |||
.ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart()) | |||
.le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd()) | |||
.orderByDesc(PerformanceAppraisal::getUpdateOn); | |||
performanceAppraisalService.page(page,wrapper); | |||
if(0L == page.getTotal()){ | |||
return PageVo.empty(); | |||
} | |||
List<Long> paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.in(PerformanceAppraisalProject::getAppraisalId, paIds)); | |||
Map<String,Project> projectMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paps)){ | |||
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); | |||
List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); | |||
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)); | |||
} | |||
} | |||
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.in(PerformanceAppraisalApplication::getAppraisalId, paIds)); | |||
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paas)){ | |||
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); | |||
List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); | |||
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.in(ProjectApplication::getId, applicationIds)); | |||
if(CollUtil.isNotEmpty(apps)){ | |||
applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); | |||
} | |||
} | |||
Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap; | |||
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap; | |||
Map<String,Project> finalProjectMap = projectMap; | |||
Map<Long,ProjectApplication> finalApplicationMap = applicationMap; | |||
List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> { | |||
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); | |||
if(finalPapsGroupMap.containsKey(p.getId())){ | |||
vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap)); | |||
} | |||
if(finalPaasGroupMap.containsKey(p.getId())){ | |||
vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap)); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
} | |||
public PerformanceAppraisalVO detail(Long id) { | |||
PerformanceAppraisal pa = performanceAppraisalService.getById(id); | |||
VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); | |||
PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); | |||
//绩效关联的项目 | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, id)); | |||
Map<String,Project> projectMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalProject>> papsGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paps)){ | |||
papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); | |||
List<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); | |||
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)); | |||
} | |||
} | |||
//绩效关联的应用 | |||
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.eq(PerformanceAppraisalApplication::getAppraisalId, id)); | |||
Map<Long,ProjectApplication> applicationMap = Maps.newHashMap(); | |||
Map<Long,List<PerformanceAppraisalApplication>> paasGroupMap = Maps.newHashMap(); | |||
if(CollUtil.isNotEmpty(paas)){ | |||
paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); | |||
List<Long> applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); | |||
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.in(ProjectApplication::getId, applicationIds)); | |||
if(CollUtil.isNotEmpty(apps)){ | |||
applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); | |||
} | |||
} | |||
Map<Long, List<PerformanceAppraisalProject>> finalPapsGroupMap = papsGroupMap; | |||
Map<Long,List<PerformanceAppraisalApplication>> finalPaasGroupMap = paasGroupMap; | |||
Map<String,Project> finalProjectMap = projectMap; | |||
Map<Long,ProjectApplication> finalApplicationMap = applicationMap; | |||
if(finalPapsGroupMap.containsKey(vo.getId())){ | |||
vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); | |||
} | |||
if(finalPaasGroupMap.containsKey(vo.getId())){ | |||
vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap)); | |||
} | |||
return vo; | |||
} | |||
/** | |||
* 新建计划 | |||
* @param createDTO | |||
* @return | |||
*/ | |||
public String create(PerformanceAppraisalCreateDTO createDTO) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
deduplicationName(createDTO); | |||
PerformanceAppraisal pa = BeanUtil.copyProperties(createDTO,PerformanceAppraisal.class); | |||
pa.setCreateOn(LocalDateTime.now()); | |||
pa.setCreateBy(user.getUsername()); | |||
pa.setUpdateOn(LocalDateTime.now()); | |||
pa.setUpdateBy(user.getUsername()); | |||
performanceAppraisalService.save(pa); | |||
if(CollUtil.isNotEmpty(createDTO.getProjects())){ | |||
saveProjects(createDTO,pa.getId(),user); | |||
} | |||
if(CollUtil.isNotEmpty(createDTO.getApplicationIds())){ | |||
saveApplications(createDTO,pa.getId(),user); | |||
} | |||
return "新建成功"; | |||
} | |||
/** | |||
* 编辑计划 | |||
* @param editDTO | |||
* @return | |||
*/ | |||
public String edit(PerformanceAppraisalEditDTO editDTO) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
deduplicationName(editDTO); | |||
PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO,PerformanceAppraisal.class); | |||
pa.setUpdateOn(LocalDateTime.now()); | |||
pa.setUpdateBy(user.getUsername()); | |||
performanceAppraisalService.updateById(pa); | |||
if(CollUtil.isNotEmpty(editDTO.getProjects())){ | |||
saveProjects(editDTO,user); | |||
} | |||
if(CollUtil.isNotEmpty(editDTO.getApplicationIds())){ | |||
saveApplications(editDTO,user); | |||
} | |||
return "编辑成功"; | |||
} | |||
/** | |||
* 名称去重 | |||
* @param dto | |||
*/ | |||
private void deduplicationName(PerformanceAppraisalCreateDTO dto) { | |||
long count = performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.eq(PerformanceAppraisal::getName, dto.getName())); | |||
VUtils.isTrue(count > 0).throwMessage("名称已经存在"); | |||
} | |||
private void deduplicationName(PerformanceAppraisalEditDTO dto) { | |||
if(StringUtils.isNotBlank(dto.getName())){ | |||
long count =performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.eq(PerformanceAppraisal::getName,dto.getName()) | |||
.ne(Objects.nonNull(dto.getId()),PerformanceAppraisal::getId,dto.getId())); | |||
VUtils.isTrue(count > 0).throwMessage("名称已经存在"); | |||
} | |||
} | |||
private void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(createDTO.getProjects())){ | |||
return; | |||
} | |||
List<AppraisalProjectDTO> projects = createDTO.getProjects(); | |||
for(AppraisalProjectDTO appraisalProject : projects){ | |||
Project newProject = projectService.getNewProject(appraisalProject.getId()); | |||
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId()); | |||
PerformanceAppraisalProject pap = new PerformanceAppraisalProject(); | |||
pap.setAppraisalId(id); | |||
pap.setProjectId(appraisalProject.getId()); | |||
pap.setProjectCode(newProject.getProjectCode()); | |||
pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); | |||
pap.setCreateBy(user.getUsername()); | |||
pap.setCreateOn(LocalDateTime.now()); | |||
pap.setUpdateBy(user.getUsername()); | |||
pap.setUpdateOn(LocalDateTime.now()); | |||
performanceAppraisalProjectService.save(pap); | |||
} | |||
} | |||
private void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(createDTO.getApplicationIds())){ | |||
return; | |||
} | |||
List<Long> applicationIds = createDTO.getApplicationIds(); | |||
for(Long applicationId : applicationIds){ | |||
ProjectApplication projectApplication = applicationService.getById(applicationId); | |||
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId); | |||
PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); | |||
paa.setAppraisalId(id); | |||
paa.setApplicationId(applicationId); | |||
paa.setCreateBy(user.getUsername()); | |||
paa.setCreateOn(LocalDateTime.now()); | |||
paa.setUpdateBy(user.getUsername()); | |||
paa.setUpdateOn(LocalDateTime.now()); | |||
performanceAppraisalApplicationService.save(paa); | |||
} | |||
} | |||
private void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
if(Objects.isNull(editDTO.getProjects())){ | |||
return; | |||
} | |||
//删除先 | |||
performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); | |||
List<AppraisalProjectDTO> projects = editDTO.getProjects(); | |||
for(AppraisalProjectDTO appraisalProject : projects){ | |||
Project newProject = projectService.getNewProject(appraisalProject.getId()); | |||
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId()); | |||
PerformanceAppraisalProject pap = new PerformanceAppraisalProject(); | |||
pap.setAppraisalId(editDTO.getId()); | |||
pap.setProjectId(appraisalProject.getId()); | |||
pap.setProjectCode(newProject.getProjectCode()); | |||
pap.setIsReAppraisal(appraisalProject.getIsReAppraisal()); | |||
pap.setCreateBy(user.getUsername()); | |||
pap.setCreateOn(LocalDateTime.now()); | |||
pap.setUpdateBy(user.getUsername()); | |||
pap.setUpdateOn(LocalDateTime.now()); | |||
performanceAppraisalProjectService.save(pap); | |||
} | |||
} | |||
private void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { | |||
if(CollUtil.isEmpty(editDTO.getApplicationIds())){ | |||
return; | |||
} | |||
//删除先 | |||
performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); | |||
List<Long> applicationIds = editDTO.getApplicationIds(); | |||
for(Long applicationId : applicationIds){ | |||
ProjectApplication projectApplication = applicationService.getById(applicationId); | |||
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId); | |||
PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); | |||
paa.setAppraisalId(editDTO.getId()); | |||
paa.setApplicationId(applicationId); | |||
paa.setCreateBy(user.getUsername()); | |||
paa.setCreateOn(LocalDateTime.now()); | |||
paa.setUpdateBy(user.getUsername()); | |||
paa.setUpdateOn(LocalDateTime.now()); | |||
performanceAppraisalApplicationService.save(paa); | |||
} | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceAppraisalApplicationMapper extends BaseMapper<PerformanceAppraisalApplication> { | |||
} |
@@ -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.PerformanceAppraisalApplicationMapper"> | |||
</mapper> |
@@ -0,0 +1,17 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceAppraisalMapper extends BaseMapper<PerformanceAppraisal> { | |||
} |
@@ -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.PerformanceAppraisalMapper"> | |||
</mapper> |
@@ -0,0 +1,17 @@ | |||
package com.ningdatech.pmapi.performance.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author Zpf | |||
* @since 2023-06-03 | |||
*/ | |||
public interface PerformanceAppraisalProjectMapper extends BaseMapper<PerformanceAppraisalProject> { | |||
} |
@@ -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.PerformanceAppraisalProjectMapper"> | |||
</mapper> |
@@ -0,0 +1,24 @@ | |||
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 | |||
* @Description | |||
* @Date 2023/6/19 17:08 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
public class AppraisalProjectDTO { | |||
@ApiModelProperty("项目ID") | |||
@NotNull(message = "项目ID 必填") | |||
private Long id; | |||
@ApiModelProperty("是否复评") | |||
private Boolean isReAppraisal = Boolean.FALSE; | |||
} |
@@ -0,0 +1,64 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO; | |||
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceAppraisalCreateDTO | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价创建对象", description = "绩效评价创建对象") | |||
public class PerformanceAppraisalCreateDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("计划名称") | |||
@NotBlank(message = "请输入计划名称") | |||
private String name; | |||
@ApiModelProperty("自评开始时间") | |||
@NotNull(message = "自评时间错误") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
@NotNull(message = "自评时间错误") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
@NotNull(message = "复评时间错误") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
@NotNull(message = "复评时间错误") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
@NotNull(message = "核查时间错误") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
@NotNull(message = "核查时间错误") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
@NotBlank(message = "评价目标不能为空") | |||
private String target; | |||
@ApiModelProperty("评价项目 只有ID 和是否复评") | |||
private List<AppraisalProjectDTO> projects; | |||
@ApiModelProperty("评价应用ids") | |||
private List<Long> applicationIds; | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.ningdatech.pmapi.performance.model.dto; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @Classname PerformanceAppraisalEditDTO | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价编辑对象", description = "绩效评价编辑对象") | |||
public class PerformanceAppraisalEditDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("id") | |||
@NotNull(message = "编辑的时候 id必填") | |||
private Long id; | |||
@ApiModelProperty("计划名称") | |||
@NotBlank(message = "请输入计划名称") | |||
private String name; | |||
@ApiModelProperty("自评开始时间") | |||
@NotNull(message = "自评时间错误") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
@NotNull(message = "自评时间错误") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
@NotNull(message = "复评时间错误") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
@NotNull(message = "复评时间错误") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
@NotNull(message = "核查时间错误") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
@NotNull(message = "核查时间错误") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
@NotBlank(message = "评价目标不能为空") | |||
private String target; | |||
@ApiModelProperty("评价项目 只有ID 和是否复评") | |||
private List<AppraisalProjectDTO> projects; | |||
@ApiModelProperty("评价应用ids") | |||
private List<Long> applicationIds; | |||
} |
@@ -0,0 +1,58 @@ | |||
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 PerformanceAppraisal | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@TableName("nd_performance_appraisal") | |||
@ApiModel(value = "绩效评价对象", description = "绩效评价对象") | |||
public class PerformanceAppraisal 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("自评开始时间") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
private String target; | |||
} |
@@ -0,0 +1,40 @@ | |||
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 PerformanceAppraisalApplication | |||
* @Description 绩效评价和应用关联对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@TableName("nd_performance_appraisal_application") | |||
@ApiModel(value = "绩效评价和应用关联对象", description = "绩效评价和应用关联对象") | |||
public class PerformanceAppraisalApplication 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("计划id") | |||
private Long appraisalId; | |||
@ApiModelProperty("应用id") | |||
private Long applicationId; | |||
} |
@@ -0,0 +1,46 @@ | |||
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 PerformanceAppraisalProject | |||
* @Description 绩效评价和项目关联对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@TableName("nd_performance_appraisal_project") | |||
@ApiModel(value = "绩效评价和项目关联对象", description = "绩效评价和项目关联对象") | |||
public class PerformanceAppraisalProject 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("计划id") | |||
private Long appraisalId; | |||
@ApiModelProperty("项目id") | |||
private Long projectId; | |||
@ApiModelProperty("项目编码") | |||
private String projectCode; | |||
@ApiModelProperty("是否核查") | |||
private Boolean isReAppraisal; | |||
} |
@@ -0,0 +1,32 @@ | |||
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; | |||
/** | |||
* <p> | |||
* PerformanceAppraisalListReq | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 09:32 2023/06/13 | |||
*/ | |||
@Data | |||
public class PerformanceAppraisalListReq extends PagePo { | |||
@ApiModelProperty("计划名称") | |||
private String name; | |||
@ApiModelProperty("开始时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private LocalDateTime start; | |||
@ApiModelProperty("结束时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private LocalDateTime end; | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* @Classname PerformanceAppraisalApplicationVO | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价应用对象", description = "绩效评价应用对象") | |||
public class PerformanceAppraisalApplicationVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("应用名称") | |||
private String applicationName; | |||
@ApiModelProperty("申报单位") | |||
private String buildOrgName; | |||
@ApiModelProperty("应用类型") | |||
private String applicationType; | |||
@ApiModelProperty("应用领域") | |||
private String bizDomain; | |||
@ApiModelProperty("发布端") | |||
private String publishSide; | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
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 PerformanceAppraisalProjectVO | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价项目对象", description = "绩效评价项目对象") | |||
public class PerformanceAppraisalProjectVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("项目ID") | |||
private Long id; | |||
@ApiModelProperty("项目名称") | |||
private String projectName; | |||
@ApiModelProperty("申报单位") | |||
private String buildOrgName; | |||
@ApiModelProperty("项目类型") | |||
private Integer projectType; | |||
@ApiModelProperty("项目类型名") | |||
private String projectTypeName; | |||
@ApiModelProperty("是否复评") | |||
private Boolean isReAppraisal; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.ningdatech.pmapi.performance.model.vo; | |||
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 PerformanceAppraisal | |||
* @Description 绩效评价对象 | |||
* @Date 2023/6/19 14:02 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "绩效评价对象", description = "绩效评价对象") | |||
public class PerformanceAppraisalVO 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("自评开始时间") | |||
private LocalDateTime selfAppraisalStart; | |||
@ApiModelProperty("自评结束时间") | |||
private LocalDateTime selfAppraisalEnd; | |||
@ApiModelProperty("复评开始时间") | |||
private LocalDateTime reAppraisalStart; | |||
@ApiModelProperty("复评结束时间") | |||
private LocalDateTime reAppraisalEnd; | |||
@ApiModelProperty("核查开始时间") | |||
private LocalDateTime verificationStart; | |||
@ApiModelProperty("核查结束时间") | |||
private LocalDateTime verificationEnd; | |||
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2") | |||
private String target; | |||
@ApiModelProperty("评价项目列表") | |||
private List<PerformanceAppraisalProjectVO> projects; | |||
@ApiModelProperty("评价应用列表") | |||
private List<PerformanceAppraisalApplicationVO> applications; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceAppraisalApplicationService extends IService<PerformanceAppraisalApplication> { | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceAppraisalProjectService extends IService<PerformanceAppraisalProject> { | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.ningdatech.pmapi.performance.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||
/** | |||
* <p> | |||
* 服务类 | |||
* </p> | |||
* | |||
* @author PoffyZhang | |||
* @since 2023-06-03 | |||
*/ | |||
public interface IPerformanceAppraisalService extends IService<PerformanceAppraisal> { | |||
} |
@@ -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.PerformanceAppraisalApplicationMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 绩效评价和应用 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceAppraisalApplicationServiceImpl extends ServiceImpl<PerformanceAppraisalApplicationMapper, | |||
PerformanceAppraisalApplication> implements IPerformanceAppraisalApplicationService { | |||
} |
@@ -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.PerformanceAppraisalProjectMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 绩效评价和项目 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceAppraisalProjectServiceImpl extends ServiceImpl<PerformanceAppraisalProjectMapper, | |||
PerformanceAppraisalProject> implements IPerformanceAppraisalProjectService { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.ningdatech.pmapi.performance.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalMapper; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 绩效评价 服务实现类 | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 2023-06-15 | |||
*/ | |||
@Service | |||
public class PerformanceAppraisalServiceImpl extends ServiceImpl<PerformanceAppraisalMapper, PerformanceAppraisal> implements IPerformanceAppraisalService { | |||
} |