|
@@ -227,64 +227,44 @@ public class CostInfoController {
|
|
|
public ResMsg listRuntimeTaskByExpense(
|
|
|
@RequestBody ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
|
|
|
String username = TokenData.takeFromRequest().getLoginName();
|
|
|
- ////---按照前端传递参数查询任务数量
|
|
|
- //MyPageData<Task> pageData = flowApiService.getTaskListByUserName(
|
|
|
- // username, listRuntimeTaskRequestVo);
|
|
|
- //Long totalCount = pageData.getTotalCount();
|
|
|
//---查询到所有的任务量
|
|
|
final Integer pageNum = listRuntimeTaskRequestVo.getPageNum();
|
|
|
listRuntimeTaskRequestVo.setPageNum(1);
|
|
|
listRuntimeTaskRequestVo.setPageSize(flowWorkOrderService.getCountByCondition(""));
|
|
|
- MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(
|
|
|
- username, listRuntimeTaskRequestVo);
|
|
|
+ MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(username, listRuntimeTaskRequestVo);
|
|
|
List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageDataTwo.getDataList());
|
|
|
+ String queryType = "费用报销";
|
|
|
//---从所有的任务里取出一个分类的任务
|
|
|
- List<FlowTaskVo> flowTaskVoListByExpense = new ArrayList<>();
|
|
|
+ //先拿到任务所在的全部流程
|
|
|
+ List<FlowTaskVo> flowTaskVoListByQueryType = new ArrayList<>();
|
|
|
+ Set<Long> entryIdList = new HashSet<>();
|
|
|
for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- String categoryName = categoryService.getById(flowEntryService.getById(taskVo.getEntryId()).getCategoryId()).getName();
|
|
|
- taskVo.setCategoryName(categoryName);
|
|
|
- if (categoryName.equals("费用报销")) {
|
|
|
- //拿到任务所在表单中数据字段和对应的值(包含每个申请记录的项目名称和流程的任务变量)
|
|
|
- JSONObject jsonData = viewUserTaskDatasource(taskVo.getProcessInstanceId(), taskVo.getTaskId()).getData();
|
|
|
- Map<String, Object> masterAndOneToOne = (Map<String, Object>) jsonData.get("masterAndOneToOne");
|
|
|
- if (masterAndOneToOne.get("project_name") != null) {
|
|
|
- Integer projectId = Integer.parseInt(masterAndOneToOne.get("project_name").toString());
|
|
|
- String projectName = projectInfoFlowMapper.getById(projectId).getProjectName();
|
|
|
- taskVo.setProjectName(projectName == null ? "" : projectName);
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("application_fee") != null) {
|
|
|
- taskVo.setApplicationFee(masterAndOneToOne.get("application_fee").toString());
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("total_money") != null) {
|
|
|
- taskVo.setApplicationFee(masterAndOneToOne.get("total_money").toString());
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("accommodation_days") != null) {
|
|
|
- taskVo.setAccommodationDays(masterAndOneToOne.get("accommodation_days").toString());
|
|
|
- }
|
|
|
- //每个审批项在各自记录表中的主键id
|
|
|
- if (masterAndOneToOne.get("id") != null) {
|
|
|
- taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("id").toString()));
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("communication_id") != null) {
|
|
|
- taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("communication_id").toString()));
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("purchase_id") != null) {
|
|
|
- taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("purchase_id").toString()));
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("cost_type") != null) {
|
|
|
- taskVo.setCostType(masterAndOneToOne.get("cost_type").toString());
|
|
|
- }
|
|
|
- taskVo.setFlowTaskStatus(flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(taskVo.getProcessInstanceId()).getFlowStatus() + "");
|
|
|
- if (StringUtils.isNotBlank(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- if (taskVo.getProjectName().contains(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- flowTaskVoListByExpense.add(taskVo);
|
|
|
+ entryIdList.add(taskVo.getEntryId());
|
|
|
+ }
|
|
|
+ List<FlowEntry> entryList = flowEntryService.getInList(entryIdList);
|
|
|
+ //获取流程所在的分类
|
|
|
+ Set<Long> categoryIdList = new HashSet<>();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ categoryIdList.add(entry.getCategoryId());
|
|
|
+ }
|
|
|
+ List<FlowCategory> flowCategoryList = categoryService.getInList(categoryIdList);
|
|
|
+ //给流程任务对象的流程分类字段赋值
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
+ Long entryId = taskVo.getEntryId();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ if (entry.getEntryId().equals(entryId)) {
|
|
|
+ for (FlowCategory category : flowCategoryList) {
|
|
|
+ if (category.getCategoryId().equals(entry.getCategoryId())) {
|
|
|
+ if (category.getName().equals(queryType)) {
|
|
|
+ taskVo.setCostType(category.getName());
|
|
|
+ flowTaskVoListByQueryType.add(taskVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- flowTaskVoListByExpense.add(taskVo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return PackageAgain(flowTaskVoListByExpense, pageNum);
|
|
|
+ return PackageAgain(flowTaskVoListByQueryType, pageNum, queryType);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -302,47 +282,44 @@ public class CostInfoController {
|
|
|
public ResMsg listRuntimeTaskByManHour(
|
|
|
@RequestBody ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
|
|
|
String username = TokenData.takeFromRequest().getLoginName();
|
|
|
- //MyPageData<Task> pageData = flowApiService.getTaskListByUserName(
|
|
|
- // username, listRuntimeTaskRequestVo);
|
|
|
- //List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageData.getDataList());
|
|
|
//---查询到所有的任务量
|
|
|
final Integer pageNum = listRuntimeTaskRequestVo.getPageNum();
|
|
|
listRuntimeTaskRequestVo.setPageNum(1);
|
|
|
listRuntimeTaskRequestVo.setPageSize(flowWorkOrderService.getCountByCondition(""));
|
|
|
- MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(
|
|
|
- username, listRuntimeTaskRequestVo);
|
|
|
+ MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(username, listRuntimeTaskRequestVo);
|
|
|
List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageDataTwo.getDataList());
|
|
|
+ String queryType = "人员工时";
|
|
|
//---从所有的任务里取出一个分类的任务
|
|
|
- List<FlowTaskVo> flowTaskVoListByManHour = new ArrayList<>();
|
|
|
+ //先拿到任务所在的全部流程
|
|
|
+ List<FlowTaskVo> flowTaskVoListByQueryType = new ArrayList<>();
|
|
|
+ Set<Long> entryIdList = new HashSet<>();
|
|
|
for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- String categoryName = categoryService.getById(flowEntryService.getById(taskVo.getEntryId()).getCategoryId()).getName();
|
|
|
- taskVo.setCategoryName(categoryName);
|
|
|
- if (categoryName.equals("人员工时")) {
|
|
|
- //拿到任务所在表单中数据字段和对应的值(包含每个申请记录的项目名称和流程的任务变量)
|
|
|
- JSONObject jsonData = viewUserTaskDatasource(taskVo.getProcessInstanceId(), taskVo.getTaskId()).getData();
|
|
|
- Map<String, Object> masterAndOneToOne = (Map<String, Object>) jsonData.get("masterAndOneToOne");
|
|
|
- if (masterAndOneToOne.get("project_name") != null) {
|
|
|
- Integer projectId = Integer.parseInt(masterAndOneToOne.get("project_name").toString());
|
|
|
- taskVo.setProjectId(projectId);
|
|
|
- String projectName = projectInfoFlowMapper.getById(projectId).getProjectName();
|
|
|
- taskVo.setProjectName(projectName == null ? "" : projectName);
|
|
|
- }
|
|
|
-
|
|
|
- if (masterAndOneToOne.get("man_id") != null) {
|
|
|
- taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("man_id").toString()));
|
|
|
- }
|
|
|
- taskVo.setCostType(categoryName);
|
|
|
- taskVo.setFlowTaskStatus(flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(taskVo.getProcessInstanceId()).getFlowStatus() + "");
|
|
|
- if (StringUtils.isNotBlank(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- if (taskVo.getProjectName().contains(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- flowTaskVoListByManHour.add(taskVo);
|
|
|
+ entryIdList.add(taskVo.getEntryId());
|
|
|
+ }
|
|
|
+ List<FlowEntry> entryList = flowEntryService.getInList(entryIdList);
|
|
|
+ //获取流程所在的分类
|
|
|
+ Set<Long> categoryIdList = new HashSet<>();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ categoryIdList.add(entry.getCategoryId());
|
|
|
+ }
|
|
|
+ List<FlowCategory> flowCategoryList = categoryService.getInList(categoryIdList);
|
|
|
+ //给流程任务对象的流程分类字段赋值
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
+ Long entryId = taskVo.getEntryId();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ if (entry.getEntryId().equals(entryId)) {
|
|
|
+ for (FlowCategory category : flowCategoryList) {
|
|
|
+ if (category.getCategoryId().equals(entry.getCategoryId())) {
|
|
|
+ if (category.getName().equals(queryType)) {
|
|
|
+ taskVo.setCostType(category.getName());
|
|
|
+ flowTaskVoListByQueryType.add(taskVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- flowTaskVoListByManHour.add(taskVo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return PackageAgain(flowTaskVoListByManHour, pageNum);
|
|
|
+ return PackageAgain(flowTaskVoListByQueryType, pageNum, queryType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -358,43 +335,44 @@ public class CostInfoController {
|
|
|
public ResMsg listRuntimeTaskByProjectAdd(
|
|
|
@RequestBody ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
|
|
|
String username = TokenData.takeFromRequest().getLoginName();
|
|
|
- //MyPageData<Task> pageData = flowApiService.getTaskListByUserName(
|
|
|
- // username, listRuntimeTaskRequestVo);
|
|
|
- //List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageData.getDataList());
|
|
|
//---查询到所有的任务量
|
|
|
final Integer pageNum = listRuntimeTaskRequestVo.getPageNum();
|
|
|
listRuntimeTaskRequestVo.setPageNum(1);
|
|
|
listRuntimeTaskRequestVo.setPageSize(flowWorkOrderService.getCountByCondition(""));
|
|
|
- MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(
|
|
|
- username, listRuntimeTaskRequestVo);
|
|
|
+ MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(username, listRuntimeTaskRequestVo);
|
|
|
List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageDataTwo.getDataList());
|
|
|
+ String queryType = "新建项目";
|
|
|
//---从所有的任务里取出一个分类的任务
|
|
|
- List<FlowTaskVo> flowTaskVoListByProjectAdd = new ArrayList<>();
|
|
|
+ //先拿到任务所在的全部流程
|
|
|
+ List<FlowTaskVo> flowTaskVoListByQueryType = new ArrayList<>();
|
|
|
+ Set<Long> entryIdList = new HashSet<>();
|
|
|
for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- String categoryName = categoryService.getById(flowEntryService.getById(taskVo.getEntryId()).getCategoryId()).getName();
|
|
|
- taskVo.setCategoryName(categoryName);
|
|
|
- if (categoryName.equals("新建项目")) {
|
|
|
- //拿到任务所在表单中数据字段和对应的值(包含每个申请记录的项目名称和流程的任务变量)
|
|
|
- JSONObject jsonData = viewUserTaskDatasource(taskVo.getProcessInstanceId(), taskVo.getTaskId()).getData();
|
|
|
- Map<String, Object> masterAndOneToOne = (Map<String, Object>) jsonData.get("masterAndOneToOne");
|
|
|
- if (masterAndOneToOne.get("project_id") != null) {
|
|
|
- Integer projectId = Integer.parseInt(masterAndOneToOne.get("project_id").toString());
|
|
|
- taskVo.setProjectId(projectId);
|
|
|
- String projectName = projectInfoFlowMapper.getById(projectId).getProjectName();
|
|
|
- taskVo.setProjectName(projectName == null ? "" : projectName);
|
|
|
- }
|
|
|
- taskVo.setCostType(categoryName);
|
|
|
- taskVo.setFlowTaskStatus(flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(taskVo.getProcessInstanceId()).getFlowStatus() + "");
|
|
|
- if (StringUtils.isNotBlank(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- if (taskVo.getProjectName().contains(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- flowTaskVoListByProjectAdd.add(taskVo);
|
|
|
+ entryIdList.add(taskVo.getEntryId());
|
|
|
+ }
|
|
|
+ List<FlowEntry> entryList = flowEntryService.getInList(entryIdList);
|
|
|
+ //获取流程所在的分类
|
|
|
+ Set<Long> categoryIdList = new HashSet<>();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ categoryIdList.add(entry.getCategoryId());
|
|
|
+ }
|
|
|
+ List<FlowCategory> flowCategoryList = categoryService.getInList(categoryIdList);
|
|
|
+ //给流程任务对象的流程分类字段赋值
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
+ Long entryId = taskVo.getEntryId();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ if (entry.getEntryId().equals(entryId)) {
|
|
|
+ for (FlowCategory category : flowCategoryList) {
|
|
|
+ if (category.getCategoryId().equals(entry.getCategoryId())) {
|
|
|
+ if (category.getName().equals(queryType)) {
|
|
|
+ taskVo.setCostType(category.getName());
|
|
|
+ flowTaskVoListByQueryType.add(taskVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- flowTaskVoListByProjectAdd.add(taskVo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return PackageAgain(flowTaskVoListByProjectAdd, pageNum);
|
|
|
+ return PackageAgain(flowTaskVoListByQueryType, pageNum, queryType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -410,46 +388,44 @@ public class CostInfoController {
|
|
|
public ResMsg listRuntimeTaskByProjectTaskAdd(
|
|
|
@RequestBody ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
|
|
|
String username = TokenData.takeFromRequest().getLoginName();
|
|
|
- //MyPageData<Task> pageData = flowApiService.getTaskListByUserName(
|
|
|
- // username, listRuntimeTaskRequestVo);
|
|
|
- //List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageData.getDataList());
|
|
|
//---查询到所有的任务量
|
|
|
final Integer pageNum = listRuntimeTaskRequestVo.getPageNum();
|
|
|
listRuntimeTaskRequestVo.setPageNum(1);
|
|
|
listRuntimeTaskRequestVo.setPageSize(flowWorkOrderService.getCountByCondition(""));
|
|
|
- MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(
|
|
|
- username, listRuntimeTaskRequestVo);
|
|
|
+ MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(username, listRuntimeTaskRequestVo);
|
|
|
List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageDataTwo.getDataList());
|
|
|
+ String queryType = "新建任务";
|
|
|
//---从所有的任务里取出一个分类的任务
|
|
|
- List<FlowTaskVo> flowTaskVoListByTaskAdd = new ArrayList<>();
|
|
|
+ //先拿到任务所在的全部流程
|
|
|
+ List<FlowTaskVo> flowTaskVoListByQueryType = new ArrayList<>();
|
|
|
+ Set<Long> entryIdList = new HashSet<>();
|
|
|
for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- String categoryName = categoryService.getById(flowEntryService.getById(taskVo.getEntryId()).getCategoryId()).getName();
|
|
|
- taskVo.setCategoryName(categoryName);
|
|
|
- if (categoryName.equals("新建任务")) {
|
|
|
- //拿到任务所在表单中数据字段和对应的值(包含每个申请记录的项目名称和流程的任务变量)
|
|
|
- JSONObject jsonData = viewUserTaskDatasource(taskVo.getProcessInstanceId(), taskVo.getTaskId()).getData();
|
|
|
- Map<String, Object> masterAndOneToOne = (Map<String, Object>) jsonData.get("masterAndOneToOne");
|
|
|
- if (masterAndOneToOne.get("project_id") != null) {
|
|
|
- Integer projectId = Integer.parseInt(masterAndOneToOne.get("project_id").toString());
|
|
|
- taskVo.setProjectId(projectId);
|
|
|
- String projectName = projectInfoFlowMapper.getById(projectId).getProjectName();
|
|
|
- taskVo.setProjectName(projectName == null ? "" : projectName);
|
|
|
- }
|
|
|
- if (masterAndOneToOne.get("task_id") != null) {
|
|
|
- taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("task_id").toString()));
|
|
|
- }
|
|
|
- taskVo.setCostType(categoryName);
|
|
|
- taskVo.setFlowTaskStatus(flowWorkOrderService.getFlowWorkOrderByProcessInstanceId(taskVo.getProcessInstanceId()).getFlowStatus() + "");
|
|
|
- if (StringUtils.isNotBlank(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- if (taskVo.getProjectName().contains(listRuntimeTaskRequestVo.getProjectName())) {
|
|
|
- flowTaskVoListByTaskAdd.add(taskVo);
|
|
|
+ entryIdList.add(taskVo.getEntryId());
|
|
|
+ }
|
|
|
+ List<FlowEntry> entryList = flowEntryService.getInList(entryIdList);
|
|
|
+ //获取流程所在的分类
|
|
|
+ Set<Long> categoryIdList = new HashSet<>();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ categoryIdList.add(entry.getCategoryId());
|
|
|
+ }
|
|
|
+ List<FlowCategory> flowCategoryList = categoryService.getInList(categoryIdList);
|
|
|
+ //给流程任务对象的流程分类字段赋值
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
+ Long entryId = taskVo.getEntryId();
|
|
|
+ for (FlowEntry entry : entryList) {
|
|
|
+ if (entry.getEntryId().equals(entryId)) {
|
|
|
+ for (FlowCategory category : flowCategoryList) {
|
|
|
+ if (category.getCategoryId().equals(entry.getCategoryId())) {
|
|
|
+ if (category.getName().equals(queryType)) {
|
|
|
+ taskVo.setCostType(category.getName());
|
|
|
+ flowTaskVoListByQueryType.add(taskVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- flowTaskVoListByTaskAdd.add(taskVo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return PackageAgain(flowTaskVoListByTaskAdd, pageNum);
|
|
|
+ return PackageAgain(flowTaskVoListByQueryType, pageNum, queryType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -530,100 +506,21 @@ public class CostInfoController {
|
|
|
return jsonData;
|
|
|
}
|
|
|
|
|
|
- private ResMsg PackageAgain(List<FlowTaskVo> flowTaskVoListByExpense, Integer pageNum) {
|
|
|
- //重新进行包装分页
|
|
|
- if (flowTaskVoListByExpense.size() < 1) {
|
|
|
- return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByExpense, Long.valueOf(flowTaskVoListByExpense.size())));
|
|
|
- }
|
|
|
- List<FlowTaskVo> flowTaskVoListByExpenseRsg = new ArrayList<>();
|
|
|
- if (pageNum == 1) {
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
- flowTaskVoListByExpenseRsg.add(flowTaskVoListByExpense.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (int i = (pageNum - 1) * 10; i < pageNum * 10 - 1; i++) {
|
|
|
- flowTaskVoListByExpenseRsg.add(flowTaskVoListByExpense.get(i));
|
|
|
- if (i == flowTaskVoListByExpense.size() - 1) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByExpenseRsg, Long.valueOf(flowTaskVoListByExpense.size())));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //============================================================================================================================================================
|
|
|
- //============================================================================================================================================================
|
|
|
-
|
|
|
- /**
|
|
|
- * 返回当前用户待办的任务列表。(操作项目信息分类)
|
|
|
- * param processDefinitionName 流程定义名 (模糊查询)。
|
|
|
- * param taskName 任务名称 (模糊查询)。
|
|
|
- * param pageParam 分页对象。
|
|
|
- *
|
|
|
- * @return 返回当前用户待办的任务列表。如果指定流程标识,则仅返回该流程的待办任务列表。
|
|
|
- */
|
|
|
- @DisableDataFilter
|
|
|
- @PostMapping("/listRuntimeTaskByProjectAddd")
|
|
|
- public ResMsg listRuntimeTaskByProjectAddd(
|
|
|
- @RequestBody ListRuntimeTaskRequestVo listRuntimeTaskRequestVo) {
|
|
|
- Date queryStartTime = new Date();
|
|
|
-
|
|
|
- String username = TokenData.takeFromRequest().getLoginName();
|
|
|
- //---查询到所有的任务量
|
|
|
- final Integer pageNum = listRuntimeTaskRequestVo.getPageNum();
|
|
|
- listRuntimeTaskRequestVo.setPageNum(1);
|
|
|
- listRuntimeTaskRequestVo.setPageSize(flowWorkOrderService.getCountByCondition(""));
|
|
|
- MyPageData<Task> pageDataTwo = flowApiService.getTaskListByUserName(username, listRuntimeTaskRequestVo);
|
|
|
- List<FlowTaskVo> flowTaskVoList = flowApiService.convertToFlowTaskList(pageDataTwo.getDataList());
|
|
|
- String queryType = "新建项目";
|
|
|
- //---从所有的任务里取出一个分类的任务
|
|
|
- //先拿到任务所在的全部流程
|
|
|
- List<FlowTaskVo> flowTaskVoListByProjectAdd = new ArrayList<>();
|
|
|
- Set<Long> entryIdList = new HashSet<>();
|
|
|
- for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- entryIdList.add(taskVo.getEntryId());
|
|
|
- }
|
|
|
- List<FlowEntry> entryList = flowEntryService.getInList(entryIdList);
|
|
|
- //获取流程所在的分类
|
|
|
- Set<Long> categoryIdList = new HashSet<>();
|
|
|
- for (FlowEntry entry : entryList) {
|
|
|
- categoryIdList.add(entry.getCategoryId());
|
|
|
- }
|
|
|
- List<FlowCategory> flowCategoryList = categoryService.getInList(categoryIdList);
|
|
|
- //给流程任务对象的流程分类字段赋值
|
|
|
- for (FlowTaskVo taskVo : flowTaskVoList) {
|
|
|
- Long entryId = taskVo.getEntryId();
|
|
|
- for (FlowEntry entry : entryList) {
|
|
|
- if (entry.getEntryId().equals(entryId)) {
|
|
|
- for (FlowCategory category : flowCategoryList) {
|
|
|
- if (category.getCategoryId().equals(entry.getCategoryId())) {
|
|
|
- if (category.getName().equals(queryType)) {
|
|
|
- taskVo.setCostType(category.getName());
|
|
|
- flowTaskVoListByProjectAdd.add(taskVo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return PackageAgainn(flowTaskVoListByProjectAdd, pageNum, queryType, queryStartTime);
|
|
|
- }
|
|
|
|
|
|
- private ResMsg PackageAgainn(List<FlowTaskVo> flowTaskVoListByExpense, Integer pageNum, String queryType, Date queryStartTime) {
|
|
|
+ private ResMsg PackageAgain(List<FlowTaskVo> flowTaskVoListByQueryType, Integer pageNum, String queryType) {
|
|
|
//重新进行包装分页
|
|
|
- if (flowTaskVoListByExpense.size() < 1) {
|
|
|
- return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByExpense, Long.valueOf(flowTaskVoListByExpense.size())));
|
|
|
+ if (flowTaskVoListByQueryType.size() < 1) {
|
|
|
+ return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByQueryType, Long.valueOf(flowTaskVoListByQueryType.size())));
|
|
|
}
|
|
|
- List<FlowTaskVo> flowTaskVoListByExpenseRsg = new ArrayList<>();
|
|
|
+ List<FlowTaskVo> flowTaskVoListByQueryTypeRsg = new ArrayList<>();
|
|
|
if (pageNum == 1) {
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
- flowTaskVoListByExpenseRsg.add(flowTaskVoListByExpense.get(i));
|
|
|
+ flowTaskVoListByQueryTypeRsg.add(flowTaskVoListByQueryType.get(i));
|
|
|
}
|
|
|
} else {
|
|
|
for (int i = (pageNum - 1) * 10; i < pageNum * 10 - 1; i++) {
|
|
|
- flowTaskVoListByExpenseRsg.add(flowTaskVoListByExpense.get(i));
|
|
|
- if (i == flowTaskVoListByExpense.size() - 1) {
|
|
|
+ flowTaskVoListByQueryTypeRsg.add(flowTaskVoListByQueryType.get(i));
|
|
|
+ if (i == flowTaskVoListByQueryType.size() - 1) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -633,7 +530,7 @@ public class CostInfoController {
|
|
|
Set<String> processInstanceIds = new HashSet<>();
|
|
|
Date getIdBefore = new Date();
|
|
|
System.err.println("获取ID数据前:" + getIdBefore.getTime());
|
|
|
- for (FlowTaskVo taskVo : flowTaskVoListByExpenseRsg) {
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoListByQueryTypeRsg) {
|
|
|
Integer projectId = null;
|
|
|
JSONObject jsonData = viewUserTaskDatasource(taskVo.getProcessInstanceId(), taskVo.getTaskId()).getData();
|
|
|
Map<String, Object> masterAndOneToOne = (Map<String, Object>) jsonData.get("masterAndOneToOne");
|
|
@@ -641,6 +538,42 @@ public class CostInfoController {
|
|
|
projectId = Integer.parseInt(masterAndOneToOne.get("project_id").toString());
|
|
|
taskVo.setProjectId(projectId);
|
|
|
}
|
|
|
+ //新建任务分类中,获取的项目任务的id
|
|
|
+ if (masterAndOneToOne.get("task_id") != null) {
|
|
|
+ taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("task_id").toString()));
|
|
|
+ }
|
|
|
+ //人员工时分类中,获取的项目id和工时流程表中保存的工时id
|
|
|
+ if (masterAndOneToOne.get("project_name") != null) {
|
|
|
+ projectId = Integer.parseInt(masterAndOneToOne.get("project_name").toString());
|
|
|
+ taskVo.setProjectId(projectId);
|
|
|
+ }
|
|
|
+ if (masterAndOneToOne.get("man_id") != null) {
|
|
|
+ taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("man_id").toString()));
|
|
|
+ }
|
|
|
+ //费用报销分类中,获取费用申请记录流程表中的【申请费用,总价,住宿天数】
|
|
|
+ if (masterAndOneToOne.get("application_fee") != null) {
|
|
|
+ taskVo.setApplicationFee(masterAndOneToOne.get("application_fee").toString());
|
|
|
+ }
|
|
|
+ if (masterAndOneToOne.get("total_money") != null) {
|
|
|
+ taskVo.setApplicationFee(masterAndOneToOne.get("total_money").toString());
|
|
|
+ }
|
|
|
+ if (masterAndOneToOne.get("accommodation_days") != null) {
|
|
|
+ taskVo.setAccommodationDays(masterAndOneToOne.get("accommodation_days").toString());
|
|
|
+ }
|
|
|
+ //费用报销分类中,每个审批项在各自记录表中的主键id
|
|
|
+ if (masterAndOneToOne.get("id") != null) {
|
|
|
+ taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("id").toString()));
|
|
|
+ }
|
|
|
+ if (masterAndOneToOne.get("communication_id") != null) {
|
|
|
+ taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("communication_id").toString()));
|
|
|
+ }
|
|
|
+ if (masterAndOneToOne.get("purchase_id") != null) {
|
|
|
+ taskVo.setApplyDataId(Integer.parseInt(masterAndOneToOne.get("purchase_id").toString()));
|
|
|
+ }
|
|
|
+ //费用报销分类中,每个审批项的费用类别
|
|
|
+ if (masterAndOneToOne.get("cost_type") != null) {
|
|
|
+ taskVo.setCostType(masterAndOneToOne.get("cost_type").toString());
|
|
|
+ }
|
|
|
taskVo.setCostType(queryType);
|
|
|
projectIds.add(projectId);
|
|
|
processInstanceIds.add(taskVo.getProcessInstanceId());
|
|
@@ -653,7 +586,7 @@ public class CostInfoController {
|
|
|
List<ProjectInfoEntity> projectInfos = projectInfoMapper.findAllById(projectIds);
|
|
|
List<FlowWorkOrder> instanceIdIn = flowWorkOrderService.findAllByProcessInstanceIdIn(processInstanceIds);
|
|
|
|
|
|
- for (FlowTaskVo taskVo : flowTaskVoListByExpenseRsg) {
|
|
|
+ for (FlowTaskVo taskVo : flowTaskVoListByQueryTypeRsg) {
|
|
|
for (ProjectInfoEntity info : projectInfos) {
|
|
|
if (info.getProjectId().equals(taskVo.getProjectId())) {
|
|
|
taskVo.setProjectName(info.getProjectName() == null ? "" : info.getProjectName());
|
|
@@ -669,12 +602,7 @@ public class CostInfoController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- System.err.println("本次查询开始时间:" + queryStartTime);
|
|
|
- Date queryEndTime = new Date();
|
|
|
- System.err.println("本次查询结束时间:" + queryEndTime);
|
|
|
- System.err.println("本次查询耗时+++++:" + (queryEndTime.getTime() - queryStartTime.getTime()));
|
|
|
-
|
|
|
- return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByExpenseRsg, Long.valueOf(flowTaskVoListByExpense.size())));
|
|
|
+ return ResMsg.newInstance(CodeEnum.OK, MyPageUtil.makeResponseData(flowTaskVoListByQueryTypeRsg, Long.valueOf(flowTaskVoListByQueryType.size())));
|
|
|
}
|
|
|
|
|
|
}
|