1.api增加方法路由

2.返回结果集失败增加空参方法
3.季度指标表ext字段由json改为jsonObject
4.增加季度考核指标编辑方法(自评/管理员评分)及审核方法
5.季度考核指标控制层
6.季度考核指标增加ext字段映射,getList方法增加id判断
7.通过季度考核指标获取项目立项集合,if条件更改
8.项目立项-季度考核指标增加(伪)工作流
9.季度考核指标查询列表查询方法有多个人物查询改为(伪)工作流通过当前执行人查询
This commit is contained in:
zty 2024-07-15 16:22:03 +08:00
parent d762ac6895
commit 15c3c3159a
11 changed files with 262 additions and 36 deletions

View File

@ -382,8 +382,8 @@ public class Api {
*/ */
public static final String PROJECT_QUARTERLY_EVALUATION=PROJECT_PREFIX+"/quarterExamine"; public static final String PROJECT_QUARTERLY_EVALUATION=PROJECT_PREFIX+"/quarterExamine";
public static final String PROJECT_QUARTERLY_EVALUATION_LIST=PROJECT_QUARTERLY_EVALUATION+"/list"; 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_INFO_GET_ACCEPT_PROJECTS = PROJECT_INFO + "/accept"; public static final String PROJECT_INFO_GET_ACCEPT_PROJECTS = PROJECT_INFO + "/accept";

View File

@ -3,6 +3,7 @@ package com.xqopen.kehui.flows.util;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.xqopen.kehui.common.entity.SystemUserLogin;
import com.xqopen.kehui.common.service.ISystemUserLoginService; import com.xqopen.kehui.common.service.ISystemUserLoginService;
import com.xqopen.kehui.exception.ErrorCode; import com.xqopen.kehui.exception.ErrorCode;
import com.xqopen.kehui.exception.XQException; import com.xqopen.kehui.exception.XQException;
@ -10,6 +11,7 @@ import com.xqopen.kehui.flows.service.IFlowsService;
import com.xqopen.kehui.project.entity.ProjectInfo; import com.xqopen.kehui.project.entity.ProjectInfo;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation; import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.project.entity.ProjectWeekly; import com.xqopen.kehui.project.entity.ProjectWeekly;
import com.xqopen.kehui.project.service.IProjectAssessmentIndicatorsService;
import com.xqopen.kehui.project.service.IProjectInfoService; import com.xqopen.kehui.project.service.IProjectInfoService;
import com.xqopen.kehui.project.service.IProjectWeeklyService; import com.xqopen.kehui.project.service.IProjectWeeklyService;
import com.xqopen.kehui.project.service.ProjectQuarterlyEvaluationService; import com.xqopen.kehui.project.service.ProjectQuarterlyEvaluationService;
@ -21,6 +23,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
@ -38,6 +41,8 @@ public class ProjectInitListener implements ExecutionListener {
ISystemUserLoginService systemUserLoginService; ISystemUserLoginService systemUserLoginService;
@Autowired @Autowired
ProjectQuarterlyEvaluationService projectQuarterlyEvaluationService; ProjectQuarterlyEvaluationService projectQuarterlyEvaluationService;
@Autowired
IProjectAssessmentIndicatorsService projectAssessmentIndicatorsService;
@Override @Override
@Transactional @Transactional
@ -98,12 +103,24 @@ public class ProjectInitListener implements ExecutionListener {
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");
JSONArray branchLeaders = (JSONArray) ext.get("branchLeaders");
JSONArray MainLeader = (JSONArray) ext.get("MainLeader");
//添加json数据
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("projectAdmin",projectAdmin.get(1)); jsonObject.put("projectManager",getSystemUserLogin(projectManager).getId());
jsonObject.put("projectAdmin",getSystemUserLogin(String.valueOf(projectAdmin.get(1))).getId());
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());
quarterlyEvaluation.setExt(jsonObject); quarterlyEvaluation.setExt(jsonObject);
quarterlyEvaluation.setCreatedAt(new Timestamp(System.currentTimeMillis())); quarterlyEvaluation.setCreatedAt(new Timestamp(System.currentTimeMillis()));
quarterlyEvaluation.setProjectId(String.valueOf(projectInfo.getId())); quarterlyEvaluation.setProjectId(String.valueOf(projectInfo.getId()));
projectQuarterlyEvaluationService.insert(quarterlyEvaluation); projectQuarterlyEvaluationService.insert(quarterlyEvaluation);
//添加季度审核的状态
JSONObject infoExt = projectInfo.getExt();
infoExt.put("taskName","季度审核填报");//任务节点
infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人
if(!StringUtils.isEmpty(projectInfo.getId()))projectInfoService.updateById(projectInfo);
} }
} }
} }
@ -114,4 +131,13 @@ public class ProjectInitListener implements ExecutionListener {
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
} }
private SystemUserLogin getSystemUserLogin(String name) {
SystemUserLogin systemUserLogin = new SystemUserLogin();
if(!StringUtils.isEmpty(name)){
EntityWrapper<SystemUserLogin> wrapper = new EntityWrapper<>();
wrapper.eq(SystemUserLogin.USERINFO_ID,Long.parseLong(name));
systemUserLogin = systemUserLoginService.selectOne(wrapper);
}
return systemUserLogin;
}
} }

View File

@ -21,6 +21,7 @@
<result property="projectId" column="project_id" jdbcType="BIGINT"/> <result property="projectId" column="project_id" jdbcType="BIGINT"/>
<result property="quarter" column="quarter" jdbcType="VARCHAR"/> <result property="quarter" column="quarter" jdbcType="VARCHAR"/>
<result property="number" column="number" jdbcType="BIGINT"/> <result property="number" column="number" jdbcType="BIGINT"/>
<result property="ext" column="ext_" jdbcType="JAVA_OBJECT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -36,6 +37,8 @@
<if test="indicators.projectId!=null"> <if test="indicators.projectId!=null">
and project_id =#{indicators.projectId} and project_id =#{indicators.projectId}
</if> </if>
<if test="indicators.id!=null">
and id_=#{indicators.id}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -147,7 +147,7 @@
</select> </select>
<select id="getListByIds" resultMap="ProjectInfoList"> <select id="getListByIds" resultMap="ProjectInfoList">
select * from project_info where 1=1 select * from project_info where 1=1
<if test="list!=null"> <if test="list.size>0">
and cast(id_ as varchar) in and cast(id_ as varchar) in
<foreach collection="list" item="id" open="(" separator="," close=")"> <foreach collection="list" item="id" open="(" separator="," close=")">
#{id} #{id}

View File

@ -1,21 +1,35 @@
package com.xqopen.kehui.project.action; package com.xqopen.kehui.project.action;
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.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
import com.xqopen.kehui.Api; import com.xqopen.kehui.Api;
import com.xqopen.kehui.common.entity.SystemUserLogin;
import com.xqopen.kehui.common.service.ISystemUserLoginService;
import com.xqopen.kehui.exception.ErrorCode; import com.xqopen.kehui.exception.ErrorCode;
import com.xqopen.kehui.exception.XQException; import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.project.api.ProjectAssessmentIndicatorsApi; import com.xqopen.kehui.project.api.ProjectAssessmentIndicatorsApi;
import com.xqopen.kehui.project.entity.ProjectAssessmentIndicators; import com.xqopen.kehui.project.entity.ProjectAssessmentIndicators;
import com.xqopen.kehui.project.entity.ProjectInfo;
import com.xqopen.kehui.project.entity.ProjectQuarterlyEvaluation;
import com.xqopen.kehui.project.service.IProjectAssessmentIndicatorsService; import com.xqopen.kehui.project.service.IProjectAssessmentIndicatorsService;
import com.xqopen.kehui.project.service.IProjectInfoService;
import com.xqopen.kehui.project.service.ProjectQuarterlyEvaluationService;
import com.xqopen.kehui.util.ApiResponse; import com.xqopen.kehui.util.ApiResponse;
import com.xqopen.kehui.util.PageNoUtil; import com.xqopen.kehui.util.PageNoUtil;
import com.xqopen.kehui.util.ResultListReqUtil; import com.xqopen.kehui.util.ResultListReqUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List; import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@RestController @RestController
@ -23,18 +37,158 @@ import java.util.List;
public class ProjectAssessmentIndicatorsController implements ProjectAssessmentIndicatorsApi { public class ProjectAssessmentIndicatorsController implements ProjectAssessmentIndicatorsApi {
@Autowired @Autowired
IProjectAssessmentIndicatorsService indicatorsService; IProjectAssessmentIndicatorsService indicatorsService;
@Autowired
IProjectInfoService projectInfoService;
@Autowired
ProjectQuarterlyEvaluationService evaluationService;
@Autowired
ISystemUserLoginService userLoginService;
@Override @Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST) @PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST)
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException { public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException {
try { try {
Page<ProjectAssessmentIndicators> page = new Page<>(pageNoUtil.getPageNo(),pageNoUtil.getPageSize()); Page<ProjectAssessmentIndicators> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT()); List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT());
ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>(indicatorsServiceList,pageNoUtil.getPageNo(),pageNoUtil.getPageSize()); ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>(indicatorsServiceList, pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
return ApiResponse.fillSuccess(listReqUtil); return ApiResponse.fillSuccess(listReqUtil);
}catch (Exception e){ } catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.list", e); log.error("ProjectAssessmentIndicatorsController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
} }
} }
@Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_UPDATE)
public String update(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException {
try {
if (!ObjectUtils.isEmpty(pageNoUtil)) {
ProjectAssessmentIndicators indicators = pageNoUtil.getT();
if (!ObjectUtils.isEmpty(indicators)) {
Long id = indicators.getId();
if (id == null) return ApiResponse.fillFail("操作异常!");
JSONObject ext = indicators.getExt();
if (!ObjectUtils.isEmpty(ext)) {
//如果ext里面有所项目管理员打分字段先判断当前账号是否是管理员
String adminScoring = String.valueOf(ext.get("adminScoring"));
if (!StringUtils.isEmpty(adminScoring) && !"null".equals(adminScoring)) {
String projectAdmin = String.valueOf(ext.get("projectAdmin"));
if (userId != null && !StringUtils.isEmpty(projectAdmin)) {
if (!userId.equals(projectAdmin)) {//如果当前账号不是管理员直接返回
return ApiResponse.fillFail("你不是所项目管理员无法打分!");
}
}
}
}
if (indicatorsService.updateById(indicators)) return ApiResponse.fillSuccess("操作成功!");
}
}
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.update", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail("操作失败!");
}
@Override
@Transactional
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_EXAMINE)
public String examine(@RequestHeader Long userId, @RequestBody Map map) throws XQException {
try {
if (!ObjectUtils.isEmpty(map)) {
String id = String.valueOf(map.get("id"));//项目id
ProjectInfo projectInfo = projectInfoService.selectById(Long.parseLong(id));
if (!ObjectUtils.isEmpty(projectInfo)) {
JSONObject ext = projectInfo.getExt();
if (!ObjectUtils.isEmpty(ext)) {
String taskName = String.valueOf(ext.get("taskName"));//节点名称
String examine = String.valueOf(map.get("examine"));//通过or驳回
switch (taskName) {
case "季度审核填报":
if ("1".equals(examine)) {
return ApiResponse.fillFail("季度审核填报无法驳回!");
}
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);
}
break;
case "分管领导审核":
ext.put("branchLeadersSpyj", map.get("spyj"));
if ("0".equals(examine)) {
examine(userId, "主要领导审核", ext, "MainLeader", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "管理员审核", ext, "projectAdmin", projectInfo);
}
break;
case "主要领导审核":
if ("0".equals(examine)) {
ext.put("MainLeaderSpyj", map.get("spyj"));
examine(userId, "主要领导审核", ext, "MainLeader", projectInfo);
} else if ("1".equals(examine)) {
examine(userId, "分管领导审核", ext, "branchLeaders", projectInfo);
}
default:
break;
}
return ApiResponse.fillSuccess("操作成功!");
}
}
}
} catch (Exception e) {
log.error("ProjectAssessmentIndicatorsController.examine", e);
// 批量新增出现异常被捕获时手动回滚事务保证数据库一致
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail();
}
/**
* 审核
*
* @param taskName
* @param ext
* @param role
* @param projectInfo
*/
public void examine(Long userId, String taskName, JSONObject ext, String role, ProjectInfo projectInfo) {
EntityWrapper<ProjectQuarterlyEvaluation> evaluationEntityWrapper = new EntityWrapper<>();
evaluationEntityWrapper.eq("project_id", String.valueOf(projectInfo.getId()));
evaluationEntityWrapper.eq("is_deleted", "0");
ProjectQuarterlyEvaluation quarterlyEvaluation = evaluationService.selectOne(evaluationEntityWrapper);
if (!ObjectUtils.isEmpty(quarterlyEvaluation)) {
JSONObject quarterlyEvaluationExt = quarterlyEvaluation.getExt();
String user = String.valueOf(quarterlyEvaluationExt.get(role));
quarterlyEvaluationExt.put("taskName", taskName);
if ("流程结束".equals(taskName)) {
user = "";
}
quarterlyEvaluationExt.put("executor", user);
quarterlyEvaluation.setExt(quarterlyEvaluationExt);
quarterlyEvaluation.setUpdatedAt(new Timestamp(System.currentTimeMillis()));
quarterlyEvaluation.setUpdatedBy(String.valueOf(userId));
evaluationService.updateById(quarterlyEvaluation);
ext.put("taskName", taskName);
ext.put("executor", user);
projectInfo.setExt(ext);
projectInfoService.updateById(projectInfo);
}
}
private SystemUserLogin getSystemUserLogin(String name) {
SystemUserLogin systemUserLogin = new SystemUserLogin();
if (!StringUtils.isEmpty(name)) {
EntityWrapper<SystemUserLogin> wrapper = new EntityWrapper<>();
wrapper.eq(SystemUserLogin.USERINFO_ID, Long.parseLong(name));
systemUserLogin = userLoginService.selectOne(wrapper);
}
return systemUserLogin;
}
} }

View File

@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -129,11 +130,21 @@ public class ProjectInitComtroller implements ProjectInitApi {
infoService.insert(info); infoService.insert(info);
//批量新增项目考核季度表 //批量新增项目考核季度表
if (!ObjectUtils.isEmpty(initDto)) { if (!ObjectUtils.isEmpty(initDto)) {
JSONObject ext = info.getExt();
String projectAdmin= String.valueOf(((ArrayList) ext.get("projectAdmin")).get(1));
String branchLeaders= String.valueOf(((ArrayList) ext.get("branchLeaders")).get(1));
String MainLeader= String.valueOf(((ArrayList) ext.get("MainLeader")).get(1));
List<ProjectAssessmentIndicators> membersList = initDto.getMembersList(); List<ProjectAssessmentIndicators> membersList = initDto.getMembersList();
if (!membersList.isEmpty()) { if (!membersList.isEmpty()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("projectAdmin",getSystemUserLogin(projectAdmin).getId());
jsonObject.put("branchLeaders",getSystemUserLogin(branchLeaders).getId());
jsonObject.put("MainLeader",getSystemUserLogin(MainLeader).getId());
membersList.forEach(item -> { membersList.forEach(item -> {
item.setProjectId(info.getId()); item.setProjectId(info.getId());
item.setCreatedBy(userId); item.setCreatedBy(userId);
item.setExt(jsonObject);
item.setCreatedAt(new Timestamp(System.currentTimeMillis())); item.setCreatedAt(new Timestamp(System.currentTimeMillis()));
item.setUpdatedBy(null); item.setUpdatedBy(null);
}); });
@ -198,7 +209,15 @@ public class ProjectInitComtroller implements ProjectInitApi {
} }
return systemUserLogin; return systemUserLogin;
} }
private SystemUserLogin getSystemUserLogin(String name) {
SystemUserLogin systemUserLogin = new SystemUserLogin();
if(!StringUtils.isEmpty(name)){
EntityWrapper<SystemUserLogin> wrapper = new EntityWrapper<>();
wrapper.eq(SystemUserLogin.USERINFO_ID,Long.parseLong(name));
systemUserLogin = userLoginService.selectOne(wrapper);
}
return systemUserLogin;
}
private activitiEnum.activitiType getActivitiType(String projectCategory, activitiEnum.activitiClass aClass) { private activitiEnum.activitiType getActivitiType(String projectCategory, activitiEnum.activitiClass aClass) {
activitiEnum.activitiType aType = null; activitiEnum.activitiType aType = null;
switch (aClass) { switch (aClass) {

View File

@ -19,8 +19,10 @@ import com.xqopen.kehui.util.PageNoUtil;
import com.xqopen.kehui.util.ResultListReqUtil; import com.xqopen.kehui.util.ResultListReqUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -37,28 +39,33 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
@Override @Override
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION) @PostMapping(Api.PROJECT_QUARTERLY_EVALUATION)
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil) throws XQException { public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectQuarterlyEvaluation> pageNoUtil) throws XQException {
try { try {
//先拿到季度审核表数据 //先拿到季度审核表数据
EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>(); EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>();
userLoginEntityWrapper.eq("id_",userId); userLoginEntityWrapper.eq("id_", userId);
SystemUserLogin systemUserLogin = userLoginService.selectOne(userLoginEntityWrapper); SystemUserLogin systemUserLogin = userLoginService.selectOne(userLoginEntityWrapper);
EntityWrapper<ProjectQuarterlyEvaluation> evaluationEntityWrapper = new EntityWrapper<>(); //判断当前执行人是谁项目负责人/分管领导/主要领导
evaluationEntityWrapper.eq("is_deleted","0"); EntityWrapper<ProjectQuarterlyEvaluation> evaluationEntityWrapper = new EntityWrapper<>();
evaluationEntityWrapper.eq("created_by",String.valueOf(systemUserLogin.getUserinfoId())); evaluationEntityWrapper.eq("is_deleted", "0");
evaluationEntityWrapper.setSqlSelect("project_id"); evaluationEntityWrapper.and("ext_->> 'executor'= " + "'" + userId + "'");//根据当前执行人查询
List<Object> evaluationList = quarterlyEvaluationService.selectObjs(evaluationEntityWrapper); // evaluationEntityWrapper.andNew()
Page<ProjectInfo> page = new Page<>(pageNoUtil.getPageNo(),pageNoUtil.getPageSize()); // .eq("created_by", String.valueOf(systemUserLogin.getUserinfoId()))
// .or("ext_->> 'projectAdmin'= " + "'" + userId + "'")
//通过季度审核表的项目id集合查询到当前负责人下面的项目列表 // .or("ext_->> 'branchLeaders'= " + "'" + userId + "'")
List<ProjectInfoListItemResp> list = projectInfoService.getListByIds(page, evaluationList); // .or("ext_->> 'MainLeader'= " + "'" + userId + "'");
ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(); evaluationEntityWrapper.setSqlSelect("project_id");
listReqUtil.setLs(list); List<Object> evaluationList = quarterlyEvaluationService.selectObjs(evaluationEntityWrapper);
listReqUtil.setPages(page.getPages()); Page<ProjectInfo> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
listReqUtil.setTotal(page.getTotal()); List<ProjectInfoListItemResp> list = new ArrayList<>();
return ApiResponse.fillSuccess(listReqUtil); //通过季度审核表的项目id集合查询到当前负责人下面的项目列表
}catch (Exception e){ if (!ObjectUtils.isEmpty(evaluationList)) {
log.error("ProjectQuarterlyEvaluationController.list", e); list = projectInfoService.getListByIds(page, evaluationList);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null); }
} ResultListReqUtil<ProjectInfoListItemResp> listReqUtil = new ResultListReqUtil<>(list, page.getPages(), page.getTotal());
return ApiResponse.fillSuccess(listReqUtil);
} catch (Exception e) {
log.error("ProjectQuarterlyEvaluationController.list", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
} }
} }

View File

@ -10,6 +10,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.Map;
@Api(value = "季度考核指标管理", tags = Constants.MODULE_PROJECT, description = "项目模块") @Api(value = "季度考核指标管理", tags = Constants.MODULE_PROJECT, description = "项目模块")
public interface ProjectAssessmentIndicatorsApi { public interface ProjectAssessmentIndicatorsApi {
@ApiOperation(value = "获取季度考核指标列表", notes = "获取季度考核指标列表", response = ProjectAchievementResp.class) @ApiOperation(value = "获取季度考核指标列表", notes = "获取季度考核指标列表", response = ProjectAchievementResp.class)
@ -18,4 +20,11 @@ public interface ProjectAssessmentIndicatorsApi {
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"), @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
}) })
String list(Long userId, PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException; String list(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 update(Long userId,PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException;
String examine(Long userId, Map map) throws XQException;
} }

View File

@ -1,6 +1,6 @@
package com.xqopen.kehui.project.entity; package com.xqopen.kehui.project.entity;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
@ -38,5 +38,5 @@ public class ProjectAssessmentIndicators {
@ApiModelProperty("序号") @ApiModelProperty("序号")
private Long number; private Long number;
@TableField("ext_") @TableField("ext_")
private JSON ext; private JSONObject ext;
} }

View File

@ -1,6 +1,8 @@
package com.xqopen.kehui.project.entity; package com.xqopen.kehui.project.entity;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
@ -29,7 +31,8 @@ public class ProjectQuarterlyEvaluation implements Serializable {
/** /**
* *
*/ */
private Object ext; @TableField("ext_")
private JSONObject ext;
/** /**
* *

View File

@ -45,7 +45,12 @@ public class ApiResponse {
jsonObject.put("data", result); jsonObject.put("data", result);
return JSON.toJSONString(jsonObject, SerializerFeature.BrowserCompatible); return JSON.toJSONString(jsonObject, SerializerFeature.BrowserCompatible);
} }
public static String fillFail() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("status", -1);
jsonObject.put("data", "操作失败!");
return JSON.toJSONString(jsonObject, SerializerFeature.BrowserCompatible);
}
/** /**
* *
* @param result * @param result