diff --git a/src/main/java/com/xqopen/kehui/project/action/ProjectAssessmentIndicatorsController.java b/src/main/java/com/xqopen/kehui/project/action/ProjectAssessmentIndicatorsController.java index 6d2884a..bcccba0 100644 --- a/src/main/java/com/xqopen/kehui/project/action/ProjectAssessmentIndicatorsController.java +++ b/src/main/java/com/xqopen/kehui/project/action/ProjectAssessmentIndicatorsController.java @@ -11,8 +11,12 @@ 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.dto.FlowsRecordList; +import com.xqopen.kehui.flows.dto.FlowsRecordResp; +import com.xqopen.kehui.flows.dto.FlowsTaskItem; import com.xqopen.kehui.flows.entity.FlowsConfiguration; import com.xqopen.kehui.flows.service.IFlowsConfigurationService; +import com.xqopen.kehui.personal.entity.PersonalMember; import com.xqopen.kehui.personal.service.IPersonalMemberService; import com.xqopen.kehui.project.api.ProjectAssessmentIndicatorsApi; import com.xqopen.kehui.project.dto.ProjectAssessmentIndicatorsDto; @@ -34,9 +38,7 @@ import org.springframework.web.bind.annotation.*; import java.sql.Timestamp; import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Slf4j @@ -224,7 +226,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI break; case "管理员审核": // ext.put("adminSpyj", map.get("spyj")); - map.put("adminSpyj", map.get("spyj")); +// map.put("adminSpyj", map.get("spyj")); if ("0".equals(examine)) { map.put("taskName", "分管领导审核"); map.put("executor", ext.get("branchLeaders")); @@ -241,7 +243,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI } break; case "分管领导审核": - map.put("branchLeadersSpyj", map.get("spyj")); +// map.put("branchLeadersSpyj", map.get("spyj")); // ext.put("branchLeadersSpyj", map.get("spyj")); if ("0".equals(examine)) { map.put("taskName", "主要领导审核"); @@ -254,7 +256,7 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI } break; case "主要领导审核": - map.put("MainLeaderSpyj", map.get("spyj")); +// map.put("MainLeaderSpyj", map.get("spyj")); if ("0".equals(examine)) { // ext.put("MainLeaderSpyj", map.get("spyj")); map.put("executor", ""); @@ -353,15 +355,71 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI if (!ObjectUtils.isEmpty(list)) { String taskName = String.valueOf(map.get("taskName")); String userId = String.valueOf(map.get("userId")); + String examine = String.valueOf(map.get("examine")); + String spyj = String.valueOf(map.get("spyj")); + + FlowsRecordResp quarterRecord=new FlowsRecordResp(); + List ls=new ArrayList<>(); + FlowsRecordList taskItemsList=new FlowsRecordList(); + List taskItems=new ArrayList<>(); + if (!"部门主任评级".equals(taskName)) { for (int i = 0; i < list.size(); i++) { ProjectAssessmentIndicators indicators = list.get(i); JSONObject ext = indicators.getExt(); + + //流转 + if(ext.containsKey("quarterRecord")){ + quarterRecord = ((JSONObject) ext.get("quarterRecord")).toJavaObject(FlowsRecordResp.class); + ls = quarterRecord.getLs(); + taskItemsList = ls.get(0); + taskItems = taskItemsList.getTaskItems(); + Collections.reverse(taskItems); + FlowsTaskItem taskItem = taskItems.get(taskItems.size()-1); + taskItem.setDueDate(new Date()); + taskItem.setActionName("0".equals(examine) ? "同意" : "驳回"); + if (StringUtils.isEmpty(spyj) ||"null".equals(spyj)) {//审批意见 + taskItem.setActionReason("0".equals(examine) ? "同意" : "驳回"); + } else taskItem.setActionReason(spyj); + taskItems.set(taskItems.size() - 1, taskItem); + if(!"流程结束".equals(taskName)){ + FlowsTaskItem taskItem1 = new FlowsTaskItem(); + taskItem1.setNodeName(taskName); + taskItem1.setAssigneeName(getPersonalByUserLogin(Long.parseLong(String.valueOf(map.get("executor")))).getPersonName()); + taskItems.add(taskItem1); + } + Collections.reverse(taskItems); + taskItemsList.setTaskItems(taskItems); + ls.set(0, taskItemsList); + quarterRecord.setLs(ls); + }else { + FlowsTaskItem taskItem = new FlowsTaskItem(); + taskItem.setDueDate(new Date()); + taskItem.setAssigneeName(getPersonalByUserLogin(Long.parseLong(ext.getString("executor"))).getPersonName()); + taskItem.setNodeName(ext.getString("taskName")); + taskItem.setActionName("0".equals(examine) ? "同意" : "驳回"); + if (StringUtils.isEmpty(spyj) || "null".equals(spyj)) {//审批意见 + taskItem.setActionReason("0".equals(examine) ? "同意" : "驳回"); + } else taskItem.setActionReason(String.valueOf(map.get("spyj"))); + taskItems.add(taskItem); + FlowsTaskItem taskItem1 = new FlowsTaskItem(); + taskItem1.setNodeName(taskName); + taskItem1.setAssigneeName(getPersonalByUserLogin(Long.parseLong(String.valueOf(map.get("executor")))).getPersonName()); + taskItems.add(taskItem1); + Collections.reverse(taskItems);//倒转 + taskItemsList.setTaskItems(taskItems); + ls.add(taskItemsList); + quarterRecord.setLs(ls); + } + ext.put("quarterRecord",quarterRecord); + ext.put("executor", map.get("executor")); ext.put("taskName", taskName); - Object adminSpyj = map.get("adminSpyj") == null ? null : ext.put("adminSpyj", map.get("adminSpyj")); - Object branchLeadersSpyj = map.get("branchLeadersSpyj") == null ? null : ext.put("branchLeadersSpyj", map.get("branchLeadersSpyj")); - Object MainLeaderSpyj = map.get("MainLeaderSpyj") == null ? null : ext.put("MainLeaderSpyj", map.get("MainLeaderSpyj")); +// Object adminSpyj = map.get("adminSpyj") == null ? null : ext.put("adminSpyj", map.get("adminSpyj")); +// Object branchLeadersSpyj = map.get("branchLeadersSpyj") == null ? null : ext.put("branchLeadersSpyj", map.get("branchLeadersSpyj")); +// Object MainLeaderSpyj = map.get("MainLeaderSpyj") == null ? null : ext.put("MainLeaderSpyj", map.get("MainLeaderSpyj")); + + //历史委托人 String historyExecutor = new String(); if (!ObjectUtils.isEmpty(ext.get("historyExecutor"))) { String str = String.valueOf(ext.get("historyExecutor")); @@ -458,4 +516,21 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI } return systemUserLogin; } + /** + * 通过账号id拿到人事对象 + * + * @param userId + * @return + */ + private PersonalMember getPersonalByUserLogin(Long userId) { + EntityWrapper userLoginEntityWrapper = new EntityWrapper<>(); + userLoginEntityWrapper.eq(SystemUserLogin.ID_, userId); + userLoginEntityWrapper.eq(SystemUserLogin.IS_DELETED, false); + SystemUserLogin systemUserLogin = userLoginService.selectOne(userLoginEntityWrapper); + EntityWrapper personalMemberEntityWrapper = new EntityWrapper<>(); + personalMemberEntityWrapper.eq(PersonalMember.ID_, systemUserLogin.getUserinfoId()); + personalMemberEntityWrapper.eq(PersonalMember.IS_DELETED, false); + return personalMemberService.selectOne(personalMemberEntityWrapper); + } + }