1.增加判断负责人是当前部门的api

2.季度审核增加判断办公室/部门主任方法
3.审核增加部门主任评级节点,增加上面俩方法
4.项目立项监控器,增加判断项目负责人字段
5.季度审核查询通过当前负责人id改为id模糊查询
This commit is contained in:
zty 2024-07-17 21:07:53 +08:00
parent 29739bd262
commit 42ae88438e
5 changed files with 168 additions and 7 deletions

View File

@ -386,7 +386,7 @@ public class Api {
public static final String PROJECT_QUARTERLY_EVALUATION_LIST=PROJECT_QUARTERLY_EVALUATION+"/list";
public static final String PROJECT_QUARTERLY_EVALUATION_UPDATE=PROJECT_QUARTERLY_EVALUATION+"/update";
public static final String PROJECT_QUARTERLY_EVALUATION_EXAMINE=PROJECT_QUARTERLY_EVALUATION+"/examine";
public static final String PROJECT_QUARTERLY_EVALUATION_GETOFFICE=PROJECT_QUARTERLY_EVALUATION+"/getOffice/{id}";
public static final String PROJECT_INFO_GET_ACCEPT_PROJECTS = PROJECT_INFO + "/accept";

View File

@ -3,11 +3,15 @@ package com.xqopen.kehui.flows.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.xqopen.kehui.common.entity.SystemOrg;
import com.xqopen.kehui.common.entity.SystemUserLogin;
import com.xqopen.kehui.common.service.ISystemOrgService;
import com.xqopen.kehui.common.service.ISystemUserLoginService;
import com.xqopen.kehui.exception.ErrorCode;
import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.flows.service.IFlowsService;
import com.xqopen.kehui.personal.entity.PersonalMember;
import com.xqopen.kehui.personal.service.IPersonalMemberService;
import com.xqopen.kehui.project.entity.ProjectInfo;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.project.entity.ProjectWeekly;
@ -43,7 +47,10 @@ public class ProjectInitListener implements ExecutionListener {
ProjectQuarterlyEvaluationService projectQuarterlyEvaluationService;
@Autowired
IProjectAssessmentIndicatorsService projectAssessmentIndicatorsService;
@Autowired
ISystemOrgService orgService;
@Autowired
IPersonalMemberService personalMemberService;
@Override
@Transactional
public void notify(DelegateExecution execution) throws Exception {
@ -112,6 +119,7 @@ public class ProjectInitListener implements ExecutionListener {
jsonObject.put("branchLeaders",getSystemUserLogin(String.valueOf(branchLeaders.get(1))).getId());
jsonObject.put("MainLeader",getSystemUserLogin(String.valueOf(MainLeader.get(1))).getId());
jsonObject.put("executor",getSystemUserLogin(projectManager).getId());
jsonObject.put("taskName","季度审核填报");
quarterlyEvaluation.setExt(jsonObject);
quarterlyEvaluation.setCreatedAt(new Timestamp(System.currentTimeMillis()));
quarterlyEvaluation.setProjectId(String.valueOf(projectInfo.getId()));
@ -120,6 +128,24 @@ public class ProjectInitListener implements ExecutionListener {
JSONObject infoExt = projectInfo.getExt();
infoExt.put("taskName","季度审核填报");//任务节点
infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人
//判断项目负责人是否是办公室部门的
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
orgEntityWrapper.eq("is_deleted",false);
orgEntityWrapper.eq("org_name","办公室");
SystemOrg systemOrg = orgService.selectOne(orgEntityWrapper);
if(!ObjectUtils.isEmpty(systemOrg)){
EntityWrapper<PersonalMember> memberEntityWrapper = new EntityWrapper<>();
memberEntityWrapper.eq("is_deleted",false);
memberEntityWrapper.eq("id_",Long.parseLong(projectManager));
memberEntityWrapper.and("ext_->> 'deptId'= " + "'" + systemOrg.getId() + "'");
PersonalMember personalMember = personalMemberService.selectOne(memberEntityWrapper);
if(!ObjectUtils.isEmpty(personalMember)){
infoExt.put("isOffice","0");
}
else{
infoExt.put("isOffice","1");
}
}
if(!StringUtils.isEmpty(projectInfo.getId()))projectInfoService.updateById(projectInfo);
}
}

View File

@ -5,10 +5,15 @@ import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.xqopen.kehui.Api;
import com.xqopen.kehui.common.entity.SystemOrg;
import com.xqopen.kehui.common.entity.SystemUserLogin;
import com.xqopen.kehui.common.service.ISystemOrgService;
import com.xqopen.kehui.common.service.ISystemUserLoginService;
import com.xqopen.kehui.exception.ErrorCode;
import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.flows.entity.FlowsConfiguration;
import com.xqopen.kehui.flows.service.IFlowsConfigurationService;
import com.xqopen.kehui.personal.service.IPersonalMemberService;
import com.xqopen.kehui.project.api.ProjectAssessmentIndicatorsApi;
import com.xqopen.kehui.project.entity.ProjectAssessmentIndicators;
import com.xqopen.kehui.project.entity.ProjectInfo;
@ -30,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController
@ -43,6 +49,12 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
ProjectQuarterlyEvaluationService evaluationService;
@Autowired
ISystemUserLoginService userLoginService;
@Autowired
IPersonalMemberService personalMemberService;
@Autowired
ISystemOrgService orgService;
@Autowired
IFlowsConfigurationService flowsConfigurationService;
@Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST)
@ -104,19 +116,36 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
if (!ObjectUtils.isEmpty(ext)) {
String taskName = String.valueOf(ext.get("taskName"));//节点名称
String examine = String.valueOf(map.get("examine"));//通过or驳回
String isOffice = String.valueOf(ext.get("isOffice"));//项目负责人是否是办公室部门的
switch (taskName) {
case "季度审核填报":
if ("1".equals(examine)) {
return ApiResponse.fillFail("季度审核填报无法驳回!");
} else if ("0".equals(examine)) {
if ("0".equals(isOffice)) {
examine(userId, "部门主任评级", ext, "", projectInfo);
} else if ("1".equals(isOffice)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
}
}
break;
case "部门主任评级":
if ("0".equals(examine)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
}
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
break;
case "管理员审核":
ext.put("adminSpyj", map.get("spyj"));
if ("0".equals(examine)) {
examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
if ("0".equals(isOffice)) {
examine(userId, "部门主任评级", ext, "", projectInfo);
} else {
examine(userId, "季度审核填报", ext, "projectManager", projectInfo);
}
}
break;
case "分管领导审核":
@ -130,7 +159,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
case "主要领导审核":
if ("0".equals(examine)) {
ext.put("MainLeaderSpyj", map.get("spyj"));
examine(userId, "主要领导审核", ext, "MainLeader", projectInfo);
examine(userId, "流程结束", ext, "MainLeader", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
}
@ -150,6 +179,58 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
return ApiResponse.fillFail();
}
/**
* 通过人事id查询部门是否是办公室下面的如果项目负责人是办公室的则无法自评只能由四个业务部评分
*
* @param id
* @return
* @throws XQException
*/
@Override
@GetMapping(Api.PROJECT_QUARTERLY_EVALUATION_GETOFFICE)
public String getOffice(@PathVariable String id) throws XQException {
try {
ProjectInfo info = projectInfoService.selectById(Long.parseLong(id));
if (!ObjectUtils.isEmpty(info)) {
JSONObject ext = info.getExt();
String isOffice = String.valueOf(ext.get("isOffice"));
if ("0".equals(isOffice)) {
return ApiResponse.fillSuccess("0");
} else {
return ApiResponse.fillSuccess("1");
}
}
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.getOffice", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail("获取当前负责人失败!");
}
@Override
public String getBusinessByUserInfoId(@PathVariable String id) throws XQException{
try {
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
flowsConfigurationEntityWrapper.eq("approved_role", "business");
flowsConfigurationEntityWrapper.eq("is_deleted", false);
flowsConfigurationEntityWrapper.eq("approver_id", Long.parseLong(id));
FlowsConfiguration flowsConfiguration = flowsConfigurationService.selectOne(flowsConfigurationEntityWrapper);
if(!ObjectUtils.isEmpty(flowsConfiguration)){
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
orgEntityWrapper.eq("is_deleted", false);
orgEntityWrapper.eq("id_",flowsConfiguration.getOrgId());
SystemOrg systemOrg = orgService.selectOne(orgEntityWrapper);
if(!ObjectUtils.isEmpty(systemOrg)){
return ApiResponse.fillSuccess(systemOrg.getOrgName());
}
}
}catch (Exception e){
log.error("ProjectAssessmentIndicatorsController.getBusinessByUserInfoId", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail();
}
/**
* 审核
*
@ -165,7 +246,43 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
ProjectQuarterlyEvaluation quarterlyEvaluation = evaluationService.selectOne(evaluationEntityWrapper);
if (!ObjectUtils.isEmpty(quarterlyEvaluation)) {
JSONObject quarterlyEvaluationExt = quarterlyEvaluation.getExt();
String user = String.valueOf(quarterlyEvaluationExt.get(role));
String user = new String();
if (!"部门主任评级".equals(taskName)) {
user = String.valueOf(quarterlyEvaluationExt.get(role));
if ("流程结束".equals(taskName)) {
user = " ";
}
} else {
//如果节点是部门主任评级时则当前责任人是四个业务部的部门主任
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
orgEntityWrapper.andNew().eq("is_deleted", false);
orgEntityWrapper.andNew().eq("org_name", "战略规划部").or()
.eq("org_name", "平台建设部").or()
.eq("org_name", "市场发展部").or()
.eq("org_name", "服务产品部");
orgEntityWrapper.setSqlSelect("id_");
List<Object> objectList = orgService.selectObjs(orgEntityWrapper);//先拿到部门集合ids
if (!StringUtils.isEmpty(objectList)) {
// 使用Streams将Object集合转换为Long集合
List<Long> longs = objectList.stream()
.map(obj -> (Long) obj) // 强制类型转换
.collect(Collectors.toList());
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
flowsConfigurationEntityWrapper.eq("approved_role", "business");
flowsConfigurationEntityWrapper.eq("is_deleted", false);
flowsConfigurationEntityWrapper.in("org_id", longs);
flowsConfigurationEntityWrapper.setSqlSelect("approver_id");
List<Object> objectList1 = flowsConfigurationService.selectObjs(flowsConfigurationEntityWrapper);//拿到人事集合ids
longs = objectList1.stream()
.map(obj -> (Long) obj) // 强制类型转换
.collect(Collectors.toList());
EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>();
userLoginEntityWrapper.eq("is_deleted", false);
userLoginEntityWrapper.in("userinfo_id", longs);
userLoginEntityWrapper.setSqlSelect("string_agg(id_::text,',')");
user = String.valueOf(userLoginService.selectObj(userLoginEntityWrapper));
}
}
quarterlyEvaluationExt.put("taskName", taskName);
quarterlyEvaluationExt.put("executor", user);
quarterlyEvaluation.setExt(quarterlyEvaluationExt);

View File

@ -47,7 +47,8 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
//判断当前执行人是谁项目负责人/分管领导/主要领导
EntityWrapper<ProjectQuarterlyEvaluation> evaluationEntityWrapper = new EntityWrapper<>();
evaluationEntityWrapper.eq("is_deleted", "0");
evaluationEntityWrapper.and("ext_->> 'executor'= " + "'" + userId + "'");
// evaluationEntityWrapper.and("ext_->> 'executor'= " + "'" + userId + "'");
evaluationEntityWrapper.and("ext_->> 'executor' like " + "'%" + userId + "%'");
evaluationEntityWrapper.and("ext_->> 'taskName'!='流程结束'");
//根据当前执行人查询
// evaluationEntityWrapper.andNew()

View File

@ -26,5 +26,22 @@ public interface ProjectAssessmentIndicatorsApi {
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
})
String update(Long userId,PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException;
@ApiOperation(value = "审核/驳回", notes = "审核/驳回", response = ProjectAchievementResp.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
})
String examine(Long userId, Map map) throws XQException;
@ApiOperation(value = "判断当前负责人是否是办公室部门", notes = "判断当前负责人是否是办公室部门", response = ProjectAchievementResp.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
})
String getOffice(String id) throws XQException;
@ApiOperation(value = "判断部门主任", notes = "判断部门主任", response = ProjectAchievementResp.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
})
String getBusinessByUserInfoId(String id) throws XQException;
}