1.季度审核审核增加一个非空校验

2.结项列表查询增加倒序
3.立项新增时增加自动生成项目编号,增加结项审核方法(为测试)
4.项目立项结束监控器去掉季度审核判断
This commit is contained in:
zty 2024-07-26 14:31:26 +08:00
parent 0066572118
commit b3c1e569ba
5 changed files with 197 additions and 12 deletions

View File

@ -112,9 +112,9 @@ public class ProjectInitListener implements ExecutionListener {
}); });
projectWeeklyService.insertBatch(weeklyArrayList); projectWeeklyService.insertBatch(weeklyArrayList);
//平台专项类/目标责任类才有季度考核 //平台专项类/目标责任类才有季度考核(已删除)
//添加季度审核数据 //添加季度审核数据
if ("5".equals(openRange) || "6".equals(openRange)) { // if ("5".equals(openRange) || "6".equals(openRange)) {
ProjectQuarterlyEvaluation quarterlyEvaluation = new ProjectQuarterlyEvaluation(); ProjectQuarterlyEvaluation quarterlyEvaluation = new ProjectQuarterlyEvaluation();
quarterlyEvaluation.setCreatedBy(projectManager); quarterlyEvaluation.setCreatedBy(projectManager);
JSONArray projectAdmin = (JSONArray) ext.get("projectAdmin"); JSONArray projectAdmin = (JSONArray) ext.get("projectAdmin");
@ -142,7 +142,7 @@ public class ProjectInitListener implements ExecutionListener {
projectQuarterlyEvaluationService.insert(quarterlyEvaluation); projectQuarterlyEvaluationService.insert(quarterlyEvaluation);
//添加季度审核的状态 //添加季度审核的状态
JSONObject infoExt = projectInfo.getExt(); JSONObject infoExt = projectInfo.getExt();
infoExt.put("taskName","季度审核");//任务节点 infoExt.put("taskName","结项填报");//任务节点
// infoExt.put("executor",executor); // infoExt.put("executor",executor);
infoExt.put("executor",executor); infoExt.put("executor",executor);
// infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人 // infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人
@ -165,7 +165,7 @@ public class ProjectInitListener implements ExecutionListener {
} }
} }
if(!StringUtils.isEmpty(projectInfo.getId()))projectInfoService.updateById(projectInfo); if(!StringUtils.isEmpty(projectInfo.getId()))projectInfoService.updateById(projectInfo);
} // }
} }
} }
} }

View File

@ -172,12 +172,12 @@
LEFT JOIN personal_member pm on ui.userinfo_id=pm.id_ LEFT JOIN personal_member pm on ui.userinfo_id=pm.id_
WHERE pi.is_deleted=false and pi.ext_->>'taskName' !='结项完成' WHERE pi.is_deleted=false and pi.ext_->>'taskName' !='结项完成'
<if test="projectInfo.createdBy!=null"> <if test="projectInfo.createdBy!=null">
and pi.created_by=#{projectInfo.createdBy} and pi.created_by=#{projectInfo.createdBy} or pi.ext_ ->> 'endExecutor' =CAST(#{projectInfo.createdBy} AS varchar)
</if> </if>
<if test="projectInfo.id!=null"> <if test="projectInfo.id!=null">
and pi.id_=#{projectInfo.id} and pi.id_=#{projectInfo.id}
</if> </if>
order by pi.created_at desc -- order by pi.created_at desc
<!-- select * from project_info--> <!-- select * from project_info-->
<!-- <where>--> <!-- <where>-->
<!-- is_deleted=false--> <!-- is_deleted=false-->

View File

@ -191,6 +191,9 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
if (!ObjectUtils.isEmpty(ext)) { if (!ObjectUtils.isEmpty(ext)) {
String taskName = String.valueOf(ext.get("taskName"));//节点名称 String taskName = String.valueOf(ext.get("taskName"));//节点名称
String examine = String.valueOf(map.get("examine"));//通过or驳回 String examine = String.valueOf(map.get("examine"));//通过or驳回
if(StringUtils.isEmpty(examine)){
return ApiResponse.fillFail("无法判断是提交还是驳回");
}
boolean isOffice = (boolean) map.get("isOffice");//项目负责人是否是办公室部门的 boolean isOffice = (boolean) map.get("isOffice");//项目负责人是否是办公室部门的
Integer businessNumber = 0;//查看是第几个部门主任评级了 Integer businessNumber = 0;//查看是第几个部门主任评级了
if (!ObjectUtils.isEmpty(ext.get("businessNumber"))) { if (!ObjectUtils.isEmpty(ext.get("businessNumber"))) {
@ -344,7 +347,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
log.error("ProjectAssessmentIndicatorsController.getBusinessByUserInfoId", e); log.error("ProjectAssessmentIndicatorsController.getBusinessByUserInfoId", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
return ApiResponse.fillFail(); return ApiResponse.fillFail(null);
} }
/** /**

View File

@ -1,5 +1,6 @@
package com.xqopen.kehui.project.action; package com.xqopen.kehui.project.action;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.support.spring.FastJsonJsonView; import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
@ -125,16 +126,81 @@ public class ProjectInitComtroller implements ProjectInitApi {
public String addInit(@RequestHeader("userId") Long userId, @RequestBody ProjectInfoInitDto initDto) throws XQException { public String addInit(@RequestHeader("userId") Long userId, @RequestBody ProjectInfoInitDto initDto) throws XQException {
ProjectInfoReq infoReq = initDto.getProjectInfoReq(); ProjectInfoReq infoReq = initDto.getProjectInfoReq();
try { try {
//判断项目名是否重复
ProjectInfo info = new JacksonUtil<ProjectInfo>().setAddEntity(userId, infoReq, ProjectInfo.class); ProjectInfo info = new JacksonUtil<ProjectInfo>().setAddEntity(userId, infoReq, ProjectInfo.class);
EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>(); EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>();
wrapper.eq("project_name", info.getProjectName()); wrapper.eq("project_name", info.getProjectName());
wrapper.eq("project_no", info.getProjectNo());
wrapper.eq("project_category", "init"); wrapper.eq("project_category", "init");
wrapper.eq("is_deleted", false); wrapper.eq("is_deleted", false);
List<ProjectInfo> infos = projectInfoService.selectList(wrapper); List<ProjectInfo> infos = projectInfoService.selectList(wrapper);
if (!ObjectUtils.isEmpty(infos)) { if (!ObjectUtils.isEmpty(infos)) {
return ApiResponse.fillFail("项目名称/编号已存在!"); return ApiResponse.fillFail("项目名称已存在!");
} }
//自送生成项目编号
JSONObject infoExt = info.getExt();//拿到当前的ext
//年份
Calendar cal = Calendar.getInstance(); // 获取当前时间的Calendar实例
int year = cal.get(Calendar.YEAR); // 获取年份
//部门编码
//项目编号:年份-部门-类别-序号
StringBuffer buffer = new StringBuffer();
buffer.append(year).append("-");
ArrayList signedDepts= (ArrayList) infoExt.get("signedDepts");//获取立项部门
String orgId= String.valueOf(signedDepts.get(0));//获取立项Id//根据项目名称拼接
switch (orgId){
case "1215549953418465281":
buffer.append("BGS");//办公室
break;
case "939036815719927809":
buffer.append("GHB");//战略规划部
break;
case "1496282215842058241":
buffer.append("CPB");//服务产品部
break;
case "1215550126769049601":
buffer.append("SCB");//市场发展部
break;
case "1215550163188191233":
buffer.append("PTB");//平台建设部
break;
}
//项目类别
buffer.append("-");
String openRange = String.valueOf(infoExt.get("openRange"));
switch (openRange){
case "1":
buffer.append("TT");
break;
case "2":
buffer.append("SC");
break;
case "3":
buffer.append("RD");
break;
case "4":
buffer.append("CK");
break;
case "5":
buffer.append("ZX");
break;
case "6":
buffer.append("ZR");
break;
case "7":
buffer.append("ZY");
break;
default:
buffer.append("TPT");//临时
break;
}
//序号
EntityWrapper<ProjectInfo> infoEntityWrapper = new EntityWrapper<>();
infoEntityWrapper.eq(ProjectInfo.IS_DELETED,false);
infoEntityWrapper.like(ProjectInfo.PROJECT_NO,buffer.toString());
int count = infoService.selectCount(infoEntityWrapper); //条数
count++;
buffer.append("-").append(String.format("%03d", count)); //生成编号
info.setProjectNo(buffer.toString());
infoService.insert(info); infoService.insert(info);
//批量新增项目考核季度表 //批量新增项目考核季度表
if (!ObjectUtils.isEmpty(initDto)) { if (!ObjectUtils.isEmpty(initDto)) {
@ -354,9 +420,9 @@ public class ProjectInitComtroller implements ProjectInitApi {
*/ */
@Override @Override
@PostMapping(Api.PROJECT_INIT_CONCLUSION_UPDATE) @PostMapping(Api.PROJECT_INIT_CONCLUSION_UPDATE)
public String conclusionUpdate(@RequestHeader Long userId, @RequestBody Map<String,Object> map) throws XQException { public String conclusionUpdate(@RequestHeader Long userId, @RequestBody Map<String, Object> map) throws XQException {
try { try {
if(ObjectUtils.isEmpty(map.get("projectId"))){ if (ObjectUtils.isEmpty(map.get("projectId"))) {
return ApiResponse.fillFail("获取项目id失败"); return ApiResponse.fillFail("获取项目id失败");
} }
Long projectId = Long.parseLong(String.valueOf(map.get("projectId"))); Long projectId = Long.parseLong(String.valueOf(map.get("projectId")));
@ -369,7 +435,7 @@ public class ProjectInitComtroller implements ProjectInitApi {
String execution = String.valueOf(map.get("execution")); String execution = String.valueOf(map.get("execution"));
if (!StringUtils.isEmpty(execution)) { if (!StringUtils.isEmpty(execution)) {
ext.put("execution", execution); ext.put("execution", execution);
ext.put("conclusionFile",map.get("conclusionFile")); ext.put("conclusionFile", map.get("conclusionFile"));
if (infoService.updateById(projectInfo)) { if (infoService.updateById(projectInfo)) {
return ApiResponse.fillSuccess("操作成功!"); return ApiResponse.fillSuccess("操作成功!");
} }
@ -382,4 +448,114 @@ public class ProjectInitComtroller implements ProjectInitApi {
} }
return ApiResponse.fillFail("错误请联系管理员"); return ApiResponse.fillFail("错误请联系管理员");
} }
@Override
public String examine(@RequestHeader Long userId, @RequestBody Map map) throws XQException {
try {
if (!ObjectUtils.isEmpty(map.get("id"))) {
Long id = Long.parseLong(String.valueOf(map.get("id")));//项目di
EntityWrapper<ProjectInfo> infoEntityWrapper = new EntityWrapper<>();
infoEntityWrapper.eq(ProjectInfo.IS_DELETED, false);
infoEntityWrapper.eq(ProjectInfo.ID_, id);
ProjectInfo projectInfo = infoService.selectOne(infoEntityWrapper);
if (!ObjectUtils.isEmpty(projectInfo)) {
JSONObject ext = projectInfo.getExt();
String taskName = String.valueOf(ext.get("taskName"));
String examine = String.valueOf(map.get("examine"));//通过or驳回
String opinion = String.valueOf(map.get("opinion"));
if (!StringUtils.isEmpty(examine)) {
return ApiResponse.fillFail("无法判断是提交还是驳回");
}
switch (taskName) {
case "结项填报":
if ("1".equals(examine)) {
return ApiResponse.fillFail("结项填报无法驳回!");
} else if ("0".equals(examine)) {
JSONArray projectManagerData = (JSONArray) ext.get("projectManagerData");
map.put("endExecutor", getSystemUserLogin(String.valueOf(projectManagerData.get(1))));
map.put("taskName", "项目负责人审核");
}
break;
case "项目负责人审核":
map.put("projectManagerOpinion",opinion);
if ("1".equals(examine)) {
JSONArray draftManId = (JSONArray) ext.get("draftManId");
map.put("endExecutor", getSystemUserLogin(String.valueOf(draftManId.get(1))));
map.put("taskName", "结项填报");
} else if ("0".equals(examine)) {
JSONArray projectAdmin = (JSONArray) ext.get("projectAdmin");
map.put("endExecutor", getSystemUserLogin(String.valueOf(projectAdmin.get(1))));
map.put("taskName", "项目管理员审核");
}
break;
case "项目管理员审核":
if ("1".equals(examine)) {
JSONArray projectManagerData = (JSONArray) ext.get("projectManagerData");
map.put("endExecutor", getSystemUserLogin(String.valueOf(projectManagerData.get(1))));
map.put("taskName", "项目负责人审核");
} else if ("0".equals(examine)) {
JSONArray branchLeaders = (JSONArray) ext.get("branchLeaders");
map.put("endExecutor", getSystemUserLogin(String.valueOf(branchLeaders.get(1))));
map.put("taskName", "分管领导审核");
}
break;
case "分管领导审核":
if ("1".equals(examine)) {
JSONArray projectAdmin = (JSONArray) ext.get("projectAdmin");
map.put("endExecutor", getSystemUserLogin(String.valueOf(projectAdmin.get(1))));
map.put("taskName", "项目管理员审核");
} else if ("0".equals(examine)) {
JSONArray MainLeader = (JSONArray) ext.get("MainLeader");
map.put("endExecutor", getSystemUserLogin(String.valueOf(MainLeader.get(1))));
map.put("taskName", "主要领导批准");
}
break;
case "主要领导批准":
if ("1".equals(examine)) {
map.put("endExecutor", " ");
map.put("taskName", "结项完成");
} else if ("0".equals(examine)) {
JSONArray projectAdmin = (JSONArray) ext.get("projectAdmin");
map.put("endExecutor", getSystemUserLogin(String.valueOf(projectAdmin.get(1))));
map.put("taskName", "分管领导审核");
}
break;
}
if (examine(map, projectInfo)) {//调用审核方法
return ApiResponse.fillSuccess("操作成功!");
} else {
return ApiResponse.fillFail("操作失败!");
}
}
return ApiResponse.fillFail("获取流程进度失败!");
}
} catch (Exception e) {
log.error("ProjectInitController.examine", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail("操作失败!");
}
/**
* 审核方法体
*
* @param map
* @param projectInfo
* @return
*/
private boolean examine(Map map, ProjectInfo projectInfo) {
if (!ObjectUtils.isEmpty(projectInfo)) {
JSONObject ext = projectInfo.getExt();
if (!ObjectUtils.isEmpty(ext)) {
if (!ObjectUtils.isEmpty(map)) {
String taskName = String.valueOf(map.get("taskName"));
ext.put("taskName", taskName);
ext.put("endExecutor", map.get("endExecutor"));
return infoService.updateById(projectInfo);
}
}
}
return false;
}
} }

View File

@ -48,4 +48,10 @@ public interface ProjectInitApi {
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"), @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
}) })
String conclusionUpdate(Long userId, Map<String,Object> map)throws XQException; String conclusionUpdate(Long userId, Map<String,Object> map)throws XQException;
@ApiOperation(value = "结项审核", notes = "结项审核", response = ApiResponse.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;
} }