1.api增加结项修改路由

2.人事管理模块报错修复,修复空指针异常
3.项目立项增加获取结项列表、修改方法
4.ProjectQuarterlyEvaluationController删去无用注释
This commit is contained in:
zty 2024-07-24 09:27:03 +08:00
parent 7d7758747a
commit 6f96af8a1a
8 changed files with 105 additions and 59 deletions

View File

@ -373,6 +373,7 @@ public class Api {
*/
public static final String PROJECT_INIT_CONCLUSION= PROJECT_INIT+"/conclusion";
public static final String PROJECT_INIT_CONCLUSION_LIST= PROJECT_INIT_CONCLUSION+"/list";
public static final String PROJECT_INIT_CONCLUSION_UPDATE= PROJECT_INIT_CONCLUSION+"/update";
/***
* 周报填报管理
*/

View File

@ -41,5 +41,5 @@ public interface ProjectInfoDao extends BaseMapper<ProjectInfo> {
ProjectInfo getInfoByProName(@Param("projectName") String projectName);
String getProId(@Param("projectName") String projectName);
List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page, @Param("userId") Long userId);
List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page,@Param("projectInfo") ProjectInfo projectInfo);
}

View File

@ -169,7 +169,14 @@
select pm.person_name as projectManagerData,pi.* from project_info pi
LEFT JOIN system_user_login ui on CAST(pi.created_by AS bigint)=ui.id_
LEFT JOIN personal_member pm on ui.userinfo_id=pm.id_
WHERE pi.is_deleted=false and pi.created_by=#{userId} and pi.ext_->>'taskName' !='结项完成'
WHERE pi.is_deleted=false and pi.ext_->>'taskName' !='结项完成'
<if test="projectInfo.createdBy!=null">
and pi.created_by=#{projectInfo.createdBy}
</if>
<if test="projectInfo.id!=null">
and pi.id_=#{projectInfo.id}
</if>
order by pi.created_at desc
<!-- select * from project_info-->
<!-- <where>-->
<!-- is_deleted=false-->

View File

@ -1,14 +1,8 @@
package com.xqopen.kehui.personal.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.support.spring.FastJsonJsonView;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.xqopen.kehui.Api;
import com.xqopen.kehui.common.entity.SystemRole;
@ -22,29 +16,19 @@ import com.xqopen.kehui.personal.api.PersonalEventsApi;
import com.xqopen.kehui.personal.dto.*;
import com.xqopen.kehui.personal.entity.PersonalEvents;
import com.xqopen.kehui.personal.entity.PersonalMember;
import com.xqopen.kehui.personal.entity.PersonalUserInfo;
import com.xqopen.kehui.personal.service.IPersonalEventsService;
import com.xqopen.kehui.personal.service.IPersonalMemberService;
import com.xqopen.kehui.personal.service.IPersonalUserInfoService;
import com.xqopen.kehui.personal.util.personalEnum;
import com.xqopen.kehui.util.*;
import com.xqopen.kehui.util.ApiResponse;
import com.xqopen.kehui.util.JacksonUtil;
import com.xqopen.kehui.util.MailUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p> 人员事件管理 前端控制器 </p>
@ -320,9 +304,12 @@ public class PersonalEventsController implements PersonalEventsApi {
salesLeave = ext_.getInteger("salesLeave");
}
List<SystemRole> roles = roleService.getSystemRoleByRoleTagAUserId("personnel", userId);
if (eventsResp.getEventsType().equals("leave") && activitiStatus.equals("2") && salesLeave != 1 && roles != null && !roles.isEmpty()) {
if (eventsResp.getEventsType().equals("leave") && "2".equals(activitiStatus) && salesLeave != 1 && roles != null && !roles.isEmpty()) {
// if (eventsResp.getEventsType().equals("leave") && activitiStatus.equals("2") && salesLeave != 1 && roles != null && !roles.isEmpty()) {
return true;
}if (eventsResp.getEventsType().equals("leaveXh") && activitiStatus.equals("2") && salesLeave != 1 && roles != null && !roles.isEmpty()) {
}
// if (eventsResp.getEventsType().equals("leaveXh") && activitiStatus.equals("2") && salesLeave != 1 && roles != null && !roles.isEmpty()) {
if (eventsResp.getEventsType().equals("leaveXh") && "2".equals(activitiStatus) && salesLeave != 1 && roles != null && !roles.isEmpty()) {
return true;
}
return false;

View File

@ -41,10 +41,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Slf4j
@ -130,31 +127,31 @@ public class ProjectInitComtroller implements ProjectInitApi {
try {
ProjectInfo info = new JacksonUtil<ProjectInfo>().setAddEntity(userId, infoReq, ProjectInfo.class);
EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>();
wrapper.eq("project_name",info.getProjectName());
wrapper.eq("project_no",info.getProjectNo());
wrapper.eq("project_category","init");
wrapper.eq("is_deleted",false);
wrapper.eq("project_name", info.getProjectName());
wrapper.eq("project_no", info.getProjectNo());
wrapper.eq("project_category", "init");
wrapper.eq("is_deleted", false);
List<ProjectInfo> infos = projectInfoService.selectList(wrapper);
if(!ObjectUtils.isEmpty(infos)){
if (!ObjectUtils.isEmpty(infos)) {
return ApiResponse.fillFail("项目名称/编号已存在!");
}
infoService.insert(info);
//批量新增项目考核季度表
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));
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));
String projectManagerData = String.valueOf(((ArrayList) ext.get("projectManagerData")).get(1));
List<ProjectAssessmentIndicators> membersList = initDto.getMembersList();
if (!membersList.isEmpty()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("executor",getSystemUserLogin(projectManagerData).getId());//第一个节点执行人一定是项目负责人
jsonObject.put("taskName","季度审核填报");
jsonObject.put("projectManager",jsonObject.get("executor"));
jsonObject.put("projectAdmin",getSystemUserLogin(projectAdmin).getId());
jsonObject.put("branchLeaders",getSystemUserLogin(branchLeaders).getId());
jsonObject.put("MainLeader",getSystemUserLogin(MainLeader).getId());
jsonObject.put("executor", getSystemUserLogin(projectManagerData).getId());//第一个节点执行人一定是项目负责人
jsonObject.put("taskName", "季度审核填报");
jsonObject.put("projectManager", jsonObject.get("executor"));
jsonObject.put("projectAdmin", getSystemUserLogin(projectAdmin).getId());
jsonObject.put("branchLeaders", getSystemUserLogin(branchLeaders).getId());
jsonObject.put("MainLeader", getSystemUserLogin(MainLeader).getId());
membersList.forEach(item -> {
item.setProjectId(info.getId());
item.setCreatedBy(userId);
@ -223,15 +220,17 @@ public class ProjectInitComtroller implements ProjectInitApi {
}
return systemUserLogin;
}
private SystemUserLogin getSystemUserLogin(String name) {
SystemUserLogin systemUserLogin = new SystemUserLogin();
if(!StringUtils.isEmpty(name)){
if (!StringUtils.isEmpty(name)) {
EntityWrapper<SystemUserLogin> wrapper = new EntityWrapper<>();
wrapper.eq(SystemUserLogin.USERINFO_ID,Long.parseLong(name));
wrapper.eq(SystemUserLogin.USERINFO_ID, Long.parseLong(name));
systemUserLogin = userLoginService.selectOne(wrapper);
}
return systemUserLogin;
}
private activitiEnum.activitiType getActivitiType(String projectCategory, activitiEnum.activitiClass aClass) {
activitiEnum.activitiType aType = null;
switch (aClass) {
@ -309,8 +308,8 @@ public class ProjectInitComtroller implements ProjectInitApi {
// 先逻辑删除所有的季度考核表然后新增之后再修改流程数据
if (!ObjectUtils.isEmpty(id)) {
indicatorsService.updateByProjectId(id);
if(!ObjectUtils.isEmpty(membersList)){
membersList.forEach(a->a.setProjectId(id));
if (!ObjectUtils.isEmpty(membersList)) {
membersList.forEach(a -> a.setProjectId(id));
indicatorsService.insertBatch(membersList);
}
}
@ -326,21 +325,64 @@ public class ProjectInitComtroller implements ProjectInitApi {
/**
* 根据当前当前id获取结项列表
*
* @param userId
* @return
*/
@Override
@PostMapping(Api.PROJECT_INIT_CONCLUSION_LIST)
public String conclusionList(@RequestHeader Long userId, @RequestBody PageNoUtil pageNoUtil)throws XQException {
public String conclusionList(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectInfo> pageNoUtil) throws XQException {
try {
Page<ProjectInfo> page = new Page<>(pageNoUtil.getPageNo(),pageNoUtil.getPageSize());
List<ProjectInfoListItemResp> list = infoService.conclusionList(page, userId);
return ApiResponse.fillSuccess(new ResultListReqUtil<ProjectInfoListItemResp>(list,page.getTotal(),page.getPages()));
}catch (Exception e){
Page<ProjectInfo> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
ProjectInfo info = pageNoUtil.getT();
info.setCreatedBy(userId);
List<ProjectInfoListItemResp> list = infoService.conclusionList(page, info);
return ApiResponse.fillSuccess(new ResultListReqUtil<ProjectInfoListItemResp>(list, page.getTotal(), page.getPages()));
} catch (Exception e) {
log.error("ProjectInitController.conclusionList", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
}
/**
* 项目结项修改这里仅能修改ext里面完成情况及领导审批
*
* @param userId
* @param map
* @return
* @throws XQException
*/
@Override
@PostMapping(Api.PROJECT_INIT_CONCLUSION_UPDATE)
public String conclusionUpdate(@RequestHeader Long userId, @RequestBody Map<String,Object> map) throws XQException {
try {
if(ObjectUtils.isEmpty(map.get("projectId"))){
return ApiResponse.fillFail("获取项目id失败");
}
Long projectId = Long.parseLong(String.valueOf(map.get("projectId")));
EntityWrapper<ProjectInfo> wrapper = new EntityWrapper<>();
wrapper.eq(ProjectInfo.IS_DELETED, false);
wrapper.eq(ProjectInfo.ID_, projectId);
ProjectInfo projectInfo = projectInfoService.selectOne(wrapper);
if (!ObjectUtils.isEmpty(projectInfo)) {
JSONObject ext = projectInfo.getExt();
String execution = String.valueOf(map.get("execution"));
if (!StringUtils.isEmpty(execution)) {
ext.put("execution", execution);
ArrayList conclusionFile= (ArrayList) map.get("conclusionFile");
if(!ObjectUtils.isEmpty(conclusionFile)){
ext.put("conclusionFile",conclusionFile);
}
if (infoService.updateById(projectInfo)) {
return ApiResponse.fillSuccess("操作成功!");
}
}
}
} catch (Exception e) {
log.error("ProjectInitController.conclusionUpdate", e);
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
}
return ApiResponse.fillFail("错误请联系管理员");
}
}

View File

@ -4,6 +4,7 @@ import com.xqopen.kehui.exception.XQException;
import com.xqopen.kehui.project.dto.ProjectFindReq;
import com.xqopen.kehui.project.dto.ProjectInfoInitDto;
import com.xqopen.kehui.project.dto.ProjectInfoListResp;
import com.xqopen.kehui.project.entity.ProjectInfo;
import com.xqopen.kehui.util.ApiResponse;
import com.xqopen.kehui.util.Constants;
import com.xqopen.kehui.util.PageNoUtil;
@ -12,6 +13,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
@Api(value = "项目立项管理", tags = Constants.MODULE_PROJECT, description = "项目模块")
public interface ProjectInitApi {
@ApiOperation(value = "新增项目立项", notes = "新增项目立项", response = ApiResponse.class)
@ -38,5 +41,11 @@ public interface ProjectInitApi {
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
})
String conclusionList(Long userId, PageNoUtil pageNoUtil) throws XQException;
String conclusionList(Long userId, PageNoUtil<ProjectInfo> pageNoUtil) 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 conclusionUpdate(Long userId, Map<String,Object> map)throws XQException;
}

View File

@ -32,8 +32,8 @@ public interface IProjectInfoService extends IService<ProjectInfo> {
/**
* 根据创建id拿到结项列表其实也就是立项人是谁谁就能结项
* @param page
* @param userId
* @param projectInfo
* @return
*/
List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page, Long userId);
List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page, ProjectInfo projectInfo);
}

View File

@ -55,7 +55,7 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoDao, ProjectI
}
@Override
public List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page, Long userId) {
return infoDao.conclusionList(page,userId);
public List<ProjectInfoListItemResp> conclusionList(Page<ProjectInfo> page,ProjectInfo projectInfo) {
return infoDao.conclusionList(page,projectInfo);
}
}