From 21dde141cff1f787cbb62c857c1ca4cd79bb0039 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Sat, 11 Feb 2023 23:33:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=B8=AD=E5=BF=83-=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/enums/ExportOptionEnum.java | 148 +++ .../pmapi/common/util/ExcelDownUtil.java | 5 +- .../pmapi/todocenter/bean/entity/ExportOption.java | 199 ---- .../controller/TodoCenterController.java | 21 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 1105 +++++++++++--------- .../model/dto/req/ReqToBeProcessedDTO.java | 8 +- 6 files changed, 795 insertions(+), 691 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ExportOptionEnum.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ExportOptionEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ExportOptionEnum.java new file mode 100644 index 0000000..406b18f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enums/ExportOptionEnum.java @@ -0,0 +1,148 @@ +package com.ningdatech.pmapi.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + + + +/** + * 导出选项枚举 + * + * @author CMM + * @since 2023/02/10 16:38 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ExportOptionEnum { + /** + * 导出选项 + */ + id(1,"项目ID"), + + projectName(2,"项目名称"), + + areaCode(3,"行政区划编码"), + + area(4,"行政区划名称"), + + responsibleMan(5,"项目负责人"), + + responsibleManMobile(6,"项目负责人手机号"), + + contactName(7,"项目联系人"), + + contactPhone(8,"项目联系人手机号"), + + higherSuperOrg(9,"上级业务主管单位"), + + higherSuperOrgCode(10,"上级主管单位浙政钉ID"), + + superOrg(11,"本级主管部门"), + + superOrgCode(12,"本级主管部门浙政钉ID"), + + buildOrgName(13,"建设单位名称"), + + buildOrgZheJiangGovDingId(14,"建设单位浙政钉ID"), + + buildOrgCode(15,"建设单位统一信用代码"), + + projectType(16,"项目类型"), + + isFirst(17,"是否首次新建"), + + relatedExistsApplication(18,"关联应用"), + + relatedExistsApplicationCode(19,"关联应用IRS编码"), + + declareAmount(20,"申报金额(万元)"), + + approvedTotalInvestmentIncrease(21,"批复金额"), + + /** + * 表里没有 + */ + budgetSource(22,"预算来源"), + + projectYear(23,"预算年度"), + + projectIntroduction(24,"项目简介"), + + buildBasis(25,"立项依据"), + + buildLevel(26,"建设层级"), + + developCode(27,"发改编码"), + + financialCode(28,"财政编码"), + + /** + * 表里没有 + */ + informationValidity(29,"信息是否有效"), + + + isDigitalReform(30,"是否数字化改革项目"), + + bizDomain(31,"综合应用领域"), + + isCloud(32,"是否上云"), + + cloudType(33,"云类型"), + + fourSystems(34,"四大体系"), + isTemporaryAugment(35,"是否临时增补"), + + protectionLevel(36,"等保级别"), + + isSecretComments(37,"是否密评"), + + businessNumber(38,"业务编号"), + + businessName(39,"业务名称"), + + orgName(40,"单位名称"), + + softwareDevelopmentAmount(41,"软件开发(万元)"), + + cloudHardwarePurchaseAmount(42,"云资源、硬件购置(万元)"), + + thirdPartyAmount(43,"第三方服务(万元)"), + + safetyInputTitle(44,"投入项"), + + safetyInputDescribe(45,"内容描述"), + + safetyInputAmount(46,"金额"), + + annualPlanAmount(47,"年度支付金额(万元)"), + + annualPlanHaveAmount(48,"自有资金(万元)"), + + declareGovOwnFinanceAmount(49,"政府投资-本级财政资金(万元)"), + + declareGovSuperiorFinanceAmount(50,"政府投资-上级补助资金(万元)"), + + declareBankLendingAmount(51,"银行贷款(万元)"), + + declareOtherAmount(52,"其它资金(万元)"), + + engineeringSpeedOne(53,"第一季度"), + + engineeringSpeedTwo(54,"第二季度"), + + engineeringSpeedThree(55,"第三季度"), + + engineeringSpeedFour(56,"第四季度"), + + preliminaryPlanFile(57,"初步方案"), + + supportingMaterialsFile(58,"附件-佐证材料"), + + projectRemarks(59,"备注"); + + private Integer code; + private String desc; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java index 9426e16..8e26b58 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java @@ -10,13 +10,11 @@ import java.util.function.BiConsumer; import javax.servlet.http.HttpServletResponse; -import com.alibaba.druid.wall.violation.ErrorCode; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.ningdatech.basic.exception.BizException; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; -import com.ningdatech.pmapi.todocenter.bean.entity.ExportOption; import org.apache.commons.collections4.CollectionUtils; import org.apache.http.HttpStatus; @@ -93,7 +91,6 @@ public class ExcelDownUtil { }else { writer = EasyExcel.write(response.getOutputStream()).build(); } - int sheetNum = 0; if (CollectionUtils.isNotEmpty(excelExport.getSheets())){ sheetNum = excelExport.getSheets().size(); @@ -108,7 +105,7 @@ public class ExcelDownUtil { } for (int i = 0; i < sheetNum; i++) { - WriteSheet sheet = EasyExcel.writerSheet(i).build(); + WriteSheet sheet = EasyExcel.writerSheet(i).automaticMergeHead(false).build(); if (CollectionUtils.isNotEmpty(excelExport.getSheets())){ sheet.setSheetName(excelExport.getSheets().get(i)); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java deleted file mode 100644 index 6ec98bf..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.ningdatech.pmapi.todocenter.bean.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - - -/** - * 导出选项实体类 - * - * @author CMM - * @since 2023/02/10 16:38 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExportOption { - /** - * 导出选项 - */ - @ApiModelProperty("项目ID") - private Boolean id; - - @ApiModelProperty("项目名称") - private Boolean projectName; - - @ApiModelProperty("行政区划编码") - private Boolean areaCode; - - @ApiModelProperty("行政区划名称") - private Boolean area; - - @ApiModelProperty("项目负责人") - private Boolean responsibleMan; - - @ApiModelProperty("项目负责人手机号") - private Boolean responsibleManMobile; - - @ApiModelProperty("项目联系人") - private Boolean contactName; - - @ApiModelProperty("项目联系人手机号") - private Boolean contactPhone; - - @ApiModelProperty("上级业务主管单位") - private Boolean higherSuperOrg; - - @ApiModelProperty("上级主管单位浙政钉ID") - private Boolean higherSuperOrgCode; - - @ApiModelProperty("本级主管部门") - private Boolean superOrg; - - @ApiModelProperty("本级主管部门浙政钉ID") - private Boolean superOrgCode; - - @ApiModelProperty("建设单位名称") - private Boolean buildOrgName; - - @ApiModelProperty("建设单位浙政钉ID") - private Boolean buildOrgZheJiangGovDingId; - - @ApiModelProperty("建设单位统一信用代码") - private Boolean buildOrgCode; - - @ApiModelProperty("项目类型") - private Boolean projectType; - - @ApiModelProperty("是否首次新建") - private Boolean isFirst; - - @ApiModelProperty("关联应用") - private Boolean relatedExistsApplication; - - @ApiModelProperty("关联应用IRS编码") - private Boolean relatedExistsApplicationCode; - - @ApiModelProperty("申报金额(万元)") - private Boolean declareAmount; - - @ApiModelProperty("批复金额") - private Boolean approvedTotalInvestmentIncrease; - - @ApiModelProperty("预算来源") - private Boolean budgetSource; - - @ApiModelProperty("预算年度") - private Boolean projectYear; - - @ApiModelProperty("项目简介") - private Boolean projectIntroduction; - - @ApiModelProperty("立项依据") - private Boolean buildBasis; - - @ApiModelProperty("建设层级") - private Boolean buildLevel; - - @ApiModelProperty("发改编码") - private Boolean developCode; - - @ApiModelProperty("财政编码") - private Boolean financialCode; - - @ApiModelProperty("信息是否有效") - private Boolean informationValidity; - - @ApiModelProperty("是否数字化改革项目") - private Boolean isDigitalReform; - - @ApiModelProperty("综合应用领域") - private Boolean bizDomain; - - @ApiModelProperty("是否上云") - private Boolean isCloud; - - @ApiModelProperty("云类型") - private Boolean cloudType; - - @ApiModelProperty("四大体系") - private Boolean fourSystems; - - @ApiModelProperty("是否临时增补") - private Boolean isTemporaryAugment; - - @ApiModelProperty("等保级别") - private Boolean protectionLevel; - - @ApiModelProperty("是否密评 0:否 1:是") - private Boolean isSecretComments; - - @ApiModelProperty("业务编号") - private Boolean businessNumber; - - @ApiModelProperty("业务名称") - private Boolean businessName; - - @ApiModelProperty("单位名称") - private Boolean orgName; - - @ApiModelProperty("软件开发(万元)") - private Boolean softwareDevelopmentAmount; - - @ApiModelProperty("云资源、硬件购置(万元)") - private Boolean cloudHardwarePurchaseAmount; - - @ApiModelProperty("第三方服务(万元)") - private Boolean thirdPartyAmount; - - @ApiModelProperty("投入项") - private Boolean safetyInputTitle; - - @ApiModelProperty("内容描述") - private Boolean safetyInputDescribe; - - @ApiModelProperty("金额(万元)") - private Boolean safetyInputAmount; - - @ApiModelProperty("年度支付金额(万元)") - private Boolean annualPlanAmount; - - @ApiModelProperty("自有资金(万元)") - private Boolean annualPlanHaveAmount; - - @ApiModelProperty("政府投资-本级财政资金(万元)") - private Boolean declareGovOwnFinanceAmount; - - @ApiModelProperty("政府投资-上级补助资金(万元)") - private Boolean declareGovSuperiorFinanceAmount; - - @ApiModelProperty("银行贷款(万元)") - private Boolean declareBankLendingAmount; - - @ApiModelProperty("其它资金(万元)") - private Boolean declareOtherAmount; - - @ApiModelProperty("第一季度") - private Boolean engineeringSpeedOne; - - @ApiModelProperty("第二季度") - private Boolean engineeringSpeedTwo; - - @ApiModelProperty("第三季度") - private Boolean engineeringSpeedThree; - - @ApiModelProperty("第四季度") - private Boolean engineeringSpeedFour; - - @ApiModelProperty("初步方案") - private Boolean preliminaryPlanFile; - - @ApiModelProperty("附件-佐证材料") - private Boolean supportingMaterialsFile; - - @ApiModelProperty("备注") - private Boolean projectRemarks; -} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index f434455..9185797 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -57,7 +57,6 @@ public class TodoCenterController { @PostMapping("/exportPending") public void exportPendingProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ todoCenterManage.exportPendingProjectList(response,param); - // ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportPendingProjectList); } /** @@ -101,9 +100,9 @@ public class TodoCenterController { * @param response * @return void */ - @GetMapping("/exportHandled") - public void exportHandledProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){ - ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportHandledProjectList); + @PostMapping("/exportHandled") + public void exportHandledProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + todoCenterManage.exportHandledProjectList(response,param); } /** @@ -124,9 +123,9 @@ public class TodoCenterController { * @param response * @return void */ - @GetMapping("/exportMySubmitted") - public void exportMySubmittedProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){ - ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportMySubmittedProjectList); + @PostMapping("/exportMySubmitted") + public void exportMySubmittedProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + todoCenterManage.exportMySubmittedProjectList(response,param); } /** @@ -147,10 +146,8 @@ public class TodoCenterController { * @param response * @return void */ - @GetMapping("/exportCcMe") - public void exportCcMeProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){ - ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportCcMeProjectList); + @PostMapping("/exportCcMe") + public void exportCcMeProjectList(@Valid @RequestBody ReqToBeProcessedDTO param, HttpServletResponse response){ + todoCenterManage.exportCcMeProjectList(response,param); } - - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 98a3880..f9abe34 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -4,8 +4,6 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; -import com.alibaba.druid.support.json.JSONUtils; -import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.xxpt.gateway.shared.api.request.OapiMessageWorkNotificationRequest; @@ -21,15 +19,13 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.common.constant.DingConstant; -import com.ningdatech.pmapi.common.model.entity.ExcelExportDTO; +import com.ningdatech.pmapi.common.enums.ExportOptionEnum; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; -import com.ningdatech.pmapi.todocenter.bean.entity.ExportOption; import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode; import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; @@ -93,7 +89,6 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; @@ -129,47 +124,40 @@ public class TodoCenterManage { private final StateMachineUtils stateMachineUtils; @Resource(name = "executableClient") private ExecutableClient client; + /** * 待办中心待我处理项目列表查询 + * * @param param * @return com.ningdatech.basic.model.PageVo * @author CMM - * @since 2023/02/01 17:44 + * @since 2023/02/01 */ public PageVo queryPendingProjectList(ReqToBeProcessedDTO param) { // 获取登录用户ID // long userId = LoginUserUtil.getUserId(); - Long userId = 381496L; - // Long userId = 6418616L; - + Long userId = 381496L; + // Long userId = 6418616L; TaskQuery taskQuery = taskService.createTaskQuery(); taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); - List taskList = taskQuery.list(); + List results = getToBeProcessedProjects(param,taskList); + + Map taskMap = taskList.stream() + .collect(Collectors.toMap(Task::getProcessInstanceId, t -> t)); + Set processInsIds = results.stream() + .map(Project::getInstCode) + .collect(Collectors.toSet()); + Set staterUsers = new HashSet<>(); - Page page = param.page(); + // 将申报项目待登录用户处理的流程实例一次性取出来,减少查询次数 + Map instanceMap = CollectionUtil.isNotEmpty(taskList) + ? historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(processInsIds).list().stream() + .collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) + : new HashMap<>(); - Map taskMap = taskList.stream().collect(Collectors.toMap(Task::getProcessInstanceId, t -> t)); - List taskProcessInsIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toList()); - - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); - wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) - .like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildOrgName,param.getBuildUnitName()) - .eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) - .eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) - .ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) - .le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); - projectService.page(page,wrapper); - Set processInsIds = page.getRecords().stream().map(Project::getInstCode).collect(Collectors.toSet()); - - // 将申报项目流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(taskList) ? - historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInsIds) - .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); - // 过滤申报项目中待登录用户审核的项目 - List results = page.getRecords().stream().filter(w -> taskProcessInsIds.contains(w.getInstCode())).collect(Collectors.toList()); - List resVos = results.stream().map(d -> { ResToBeProcessedDTO res = new ResToBeProcessedDTO(); BeanUtils.copyProperties(d, res); @@ -182,62 +170,59 @@ public class TodoCenterManage { // 从待办任务列表中取出当前登录用户及项目实例对应的任务 Task task = taskMap.get(d.getInstCode()); HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); - //从缓存取 + // 从缓存取 staterUsers.add(String.valueOf(userId)); - ProcessTaskVo processTaskVo = ProcessTaskVo.builder() - .taskId(task.getId()) - .taskName(task.getName()) - .taskDefKey(task.getTaskDefinitionKey()) - .processDefId(task.getProcessDefinitionId()) - .executionId(task.getExecutionId()) - .nodeId(task.getTaskDefinitionKey()) - .deployId(instance.getDeploymentId()) - .processDefName(instance.getProcessDefinitionName()) - .version(instance.getProcessDefinitionVersion()) - .instanceId(task.getProcessInstanceId()) - .ownerId(instance.getStartUserId()) - .createTime(instance.getStartTime()) - .taskCreateTime(task.getCreateTime()) - .build(); - res.setProcessTaskInfo(processTaskVo); + ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) + .taskDefKey(task.getTaskDefinitionKey()).processDefId(task.getProcessDefinitionId()) + .executionId(task.getExecutionId()).nodeId(task.getTaskDefinitionKey()) + .deployId(instance.getDeploymentId()).processDefName(instance.getProcessDefinitionName()) + .version(instance.getProcessDefinitionVersion()).instanceId(task.getProcessInstanceId()) + .ownerId(instance.getStartUserId()).createTime(instance.getStartTime()) + .taskCreateTime(task.getCreateTime()).build(); + res.setProcessTaskInfo(processTaskVo); return res; }).collect(Collectors.toList()); - //取用户信息,减少数据库查询,一次构建 + // 取用户信息,减少数据库查询,一次构建 List result = null; if (CollectionUtil.isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); - result = resVos.stream().peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) + result = resVos.stream() + .peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) .collect(Collectors.toList()); // Map userMap = userInfoService.getUserMapByIds(staterUsers); // result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) // .collect(Collectors.toList()); } - return PageVo.of(result,resVos.size()); + return PageVo.of(result, result.size()); } + /** * 待办中心列表导出 * @param response * @param param * @return void * @author CMM - * @since 2023/02/01 17:44 + * @since 2023/02/01 */ public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); - wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) - .like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildOrgName,param.getBuildUnitName()) - .eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) - .eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) - .ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) - .le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); - List records = projectService.list(wrapper); + param.setPageNumber(1); + param.setPageSize(10000); + // 获取登录用户ID + // long userId = LoginUserUtil.getUserId(); + Long userId = 381496L; + // Long userId = 6418616L; + TaskQuery taskQuery = taskService.createTaskQuery(); + taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); + List taskList = taskQuery.list(); + List records = getToBeProcessedProjects(param, taskList); + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_待我处理_增补项目列表"; - }else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_待我处理_非增补项目列表"; } excelExportWriter.setFileName(fileName); @@ -245,37 +230,66 @@ public class TodoCenterManage { List sheetsNames = new ArrayList<>(); sheetsNames.add(fileName); - // 表体列数据集合 - List> columnList = new ArrayList<>(); - // 表体行数据集合 - List rowList = param.getExportOptionList(); - records.stream().forEach(record -> { - List rowValues = new ArrayList<>(); - rowList.stream().forEach(c -> { + List> rowList = new ArrayList<>(); + // 表体列数据集合 + List columnList = param.getExportOptionList(); + for (ExportOptionEnum column : columnList) { + List columnValues = new ArrayList<>(); + columnValues.add(column.getDesc()); + records.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { String s = JSON.toJSONString(record); JSONObject jsonObject = JSON.parseObject(s); - String rowValue = String.valueOf(jsonObject.get(c)); - rowValues.add(rowValue); + String columnValue = String.valueOf(jsonObject.get(column.toString())); + columnValues.add(columnValue); }); - columnList.add(rowValues); - }); + rowList.add(columnValues); + } // sheet列表集合 List>> sheets = new ArrayList<>(); - sheets.add(columnList); + sheets.add(rowList); excelExportWriter.setHeads(sheets); - excelExportWriter.setDatas(columnList); + excelExportWriter.setDatas(rowList); excelExportWriter.setSheets(sheetsNames); excelExportWriter.setHeadPropertyClass(List.class); excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); - ExcelDownUtil.excelExportFile(response,excelExportWriter); + ExcelDownUtil.excelExportFile(response, excelExportWriter); } + + /** + * 获取申报项目列表中待登录用户处理的项目列表 + * @param param + * @param taskList + * @return java.util.List + * @author CMM + * @since 2023/02/11 + */ + private List getToBeProcessedProjects(ReqToBeProcessedDTO param, List taskList) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); + wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) + .eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) + .eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) + .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, + param.getProcessLaunchStartTime()) + .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); + projectService.page(page, wrapper); + + List taskProcessInsIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toList()); + + // 过滤申报项目中待登录用户审核的项目 + return page.getRecords().stream().filter(w -> taskProcessInsIds.contains(w.getInstCode())) + .collect(Collectors.toList()); + } + /** * 流程处理相关操作 + * * @param param * @return void * @author CMM - * @since 2023/02/01 17:43 + * @since 2023/02/01 */ public void handler(ReqProcessHandlerDTO param) { @@ -315,7 +329,7 @@ public class TodoCenterManage { break; // 撤回 case WITHDRAW: - doWithDrawProcess(task,userId); + doWithDrawProcess(task, userId); break; default: throw new IllegalStateException("Unexpected value: " + param.getAction()); @@ -324,26 +338,25 @@ public class TodoCenterManage { /** * 审批任务:驳回 - * - * @param task 当前任务 + * @param task 当前任务 * @param userId - * @param param 参数 + * @param param 参数 */ private void doReject(Task task, Long userId, ReqProcessHandlerDTO param) { // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); String projectName = declaredProject.getProjectName(); Map var = new HashMap<>(16); var.put("approve_" + task.getId(), param.getAction()); // TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 - //获取流程定义 + // 获取流程定义 Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); // 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); + FlowNode rootNode = (FlowNode)process.getFlowElement("root", true); // TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 - sendWorkNoticeToStartUser(task,projectName,rootNode); + sendWorkNoticeToStartUser(task, projectName, rootNode); // 更新项目状态 updateRejectProjectStatus(task); @@ -355,20 +368,20 @@ public class TodoCenterManage { * @param task 当前任务 * @return void * @author CMM - * @since 2023/02/08 20:44 + * @since 2023/02/08 */ private void updateRejectProjectStatus(Task task) { // 获取当前登录用户 Long userId = LoginUserUtil.getUserId(); // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); // 获取当前流程项目状态 Integer projectStatusSecond = declaredProject.getStatus(); // 根据当前状态获取对应的通过事件 ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusRejectEvent(projectStatusSecond); try { - stateMachineUtils.execute(declaredProject,event); + stateMachineUtils.execute(declaredProject, event); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); } catch (Exception e) { @@ -380,14 +393,15 @@ public class TodoCenterManage { /** * 获取最新版本的流程配置 + * * @param task 当前任务 * @return com.wflow.bean.entity.WflowModels * @author CMM * @since 2023/02/01 17:30 */ private WflowModels getLastWflowModels(Task task) { - WflowModels wflowModels = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getProcessDefId, task.getProcessDefinitionId())); + WflowModels wflowModels = processModelService.getOne( + Wrappers.lambdaQuery(WflowModels.class).eq(WflowModels::getProcessDefId, task.getProcessDefinitionId())); if (ObjectUtil.isNull(wflowModels)) { log.warn("流程{}不存在", wflowModels.getFormId()); throw new BusinessException("不存在该表单"); @@ -397,10 +411,9 @@ public class TodoCenterManage { /** * 审批任务:盖章并通过 - * - * @param task 当前任务 + * @param task 当前任务 * @param userId - * @param param 参数 + * @param param 参数 */ private void doSealPass(Task task, Long userId, ReqProcessHandlerDTO param) { Map var = new HashMap<>(16); @@ -410,8 +423,8 @@ public class TodoCenterManage { // TODO 市级单位:为大数据局;区县单位:为大数据中心(根据附件区分?) // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); // 更新项目状态到下一个状态 updatePassProjectStatus(task, userId, declaredProject); taskService.complete(param.getTaskId(), var); @@ -419,46 +432,46 @@ public class TodoCenterManage { /** * 审批任务:通过 - * - * @param task 当前任务 + * @param task 当前任务 * @param userId - * @param param 参数 + * @param param 参数 */ private void doPass(Task task, Long userId, ReqProcessHandlerDTO param) { String processInstanceId = task.getProcessInstanceId(); // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); String projectName = declaredProject.getProjectName(); Map var = new HashMap<>(16); var.put("approve_" + task.getId(), param.getAction()); // 保存审核意见 if (hasComment(param.getAuditInfo())) { - //执行自定义的保存评论的功能 - managementService.executeCommand(new SaveCommentCmd(param.getTaskId(),param.getInstanceId(),String.valueOf(userId),JSONObject.toJSONString(param.getAuditInfo()))); + // 执行自定义的保存评论的功能 + managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), + String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); } - updatePassProjectStatus(task,userId,declaredProject); - taskService.complete(param.getTaskId(), var); + updatePassProjectStatus(task, userId, declaredProject); + taskService.complete(param.getTaskId(), var); // 获取bpm对象 BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); - //传节点定义key 获取当前节点 - FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); + // 传节点定义key 获取当前节点 + FlowNode currentNode = (FlowNode)bpmnModel.getFlowElement(task.getTaskDefinitionKey()); // 获取流程下一个节点的审核用户ID - String nextUserId = getNextUserId(currentNode,processInstanceId); + String nextUserId = getNextUserId(currentNode, processInstanceId); // 若有下一个审核人,向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 - if (Objects.nonNull(nextUserId)){ + if (Objects.nonNull(nextUserId)) { UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); // TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 - String msg = String.format(PASS_MSG_TEMPLATE,null,projectName); + String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); // sendWorkNotice(auditUserInfo,msg); - }else { + } else { // 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 // TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 // 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); + FlowNode rootNode = (FlowNode)bpmnModel.getFlowElement("root"); // sendWorkNoticeToStartUser(task, projectName, rootNode); } } @@ -466,12 +479,12 @@ public class TodoCenterManage { /** * 当为通过操作时,更新项目表中项目状态 * - * @param task 当前任务 + * @param task 当前任务 * @param userId * @param declaredProject * @return void * @author CMM - * @since 2023/02/08 20:38 + * @since 2023/02/08 */ private void updatePassProjectStatus(Task task, Long userId, Project declaredProject) { // 获取当前流程项目状态 @@ -479,7 +492,7 @@ public class TodoCenterManage { // 根据当前状态获取对应的通过事件 ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(projectStatusSecond); try { - stateMachineUtils.execute(declaredProject,event); + stateMachineUtils.execute(declaredProject, event); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); } catch (Exception e) { @@ -496,7 +509,7 @@ public class TodoCenterManage { * @param rootNode 流程发起节点 * @return void * @author CMM - * @since 2023/02/03 10:05 + * @since 2023/02/03 */ private void sendWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { String startUserId = getRootUserId(rootNode); @@ -513,7 +526,7 @@ public class TodoCenterManage { * @param rootNode 根节点 * @return java.lang.String * @author CMM - * @since 2023/02/02 21:47 + * @since 2023/02/02 */ private String getRootUserId(FlowNode rootNode) { String rootUserId = null; @@ -526,7 +539,7 @@ public class TodoCenterManage { // TODO 若要会签需判断候选人 // 发起事件 if (targetFlowElement instanceof StartEvent) { - UserTask userTask = (UserTask) targetFlowElement; + UserTask userTask = (UserTask)targetFlowElement; rootUserId = userTask.getAssignee(); break; } @@ -537,12 +550,11 @@ public class TodoCenterManage { /** * 获取当前节点的下一个节点的审核用户ID - * - * @param currentNode 当前节点 + * @param currentNode 当前节点 * @param processInstanceId * @return java.lang.String 下一个节点的浙政钉用户ID * @author CMM - * @since 2023/02/02 16:49 + * @since 2023/02/02 */ private String getNextUserId(FlowNode currentNode, String processInstanceId) { String nextUserId = null; @@ -553,7 +565,7 @@ public class TodoCenterManage { // 类型自己判断 FlowElement targetFlowElement = currentOutgoingFlow.getTargetFlowElement(); // 如果下个审批节点为结束节点,那么跳过该节点 - if (targetFlowElement instanceof EndEvent){ + if (targetFlowElement instanceof EndEvent) { continue; } // TODO 若要会签需判断候选人 @@ -561,8 +573,7 @@ public class TodoCenterManage { if (targetFlowElement instanceof UserTask) { String actId = targetFlowElement.getId(); ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() - .processInstanceId(processInstanceId) - .activityId(actId).singleResult(); + .processInstanceId(processInstanceId).activityId(actId).singleResult(); String executionId = activityInstance.getExecutionId(); nextUserId = runtimeService.getVariable(executionId, "assignee", String.class); break; @@ -570,31 +581,33 @@ public class TodoCenterManage { } return nextUserId; } + /** * 判断处理操作是否含有审核意见 * @param comment 审核意见 * @return boolean * @author CMM - * @since 2023/02/01 17:33 + * @since 2023/02/01 */ private boolean hasComment(ProcessComment comment) { - return Objects.nonNull(comment) && (StrUtil.isNotBlank(comment.getText()) - || CollectionUtil.isNotEmpty(comment.getAttachments())); + return Objects.nonNull(comment) + && (StrUtil.isNotBlank(comment.getText()) || CollectionUtil.isNotEmpty(comment.getAttachments())); } + /** * 发送浙政钉工作通知 * @param auditUserInfo 审核人信息 * @param msg 要发送的工作通知 * @return void * @author CMM - * @since 2023/02/01 17:32 + * @since 2023/02/01 */ private void sendWorkNotice(UserInfo auditUserInfo, String msg) { // TODO 获取浙政钉唯一标识 String dingKey = null; IntelligentGetClient intelligentGetClient = client.newIntelligentGetClient(DingConstant.WORKING_NOTICE); OapiMessageWorkNotificationRequest request = new OapiMessageWorkNotificationRequest(); - //消息体(参考下文示例消息格式) + // 消息体(参考下文示例消息格式) MessageText messageText = new MessageText(); messageText.setMsgType("text"); MessageContent messageContent = new MessageContent(); @@ -603,10 +616,10 @@ public class TodoCenterManage { messageText.setText(messageContent); request.setMsg(JSONUtil.toJsonStr(messageText)); // 构建唯一的消息ID - // String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId(); + // String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId(); // request.setBizMsgId(bizMsgId); request.setBizMsgId(null); - //租户id + // 租户id // request.setTenantId(GovDingProperties.tenantId.toString()); request.setReceiverIds(dingKey); // 获取结果 @@ -617,56 +630,54 @@ public class TodoCenterManage { } } + /** * 撤销流程处理 - * - * @param task 当前任务 + * @param task 当前任务 * @param userId */ private void doWithDrawProcess(Task task, Long userId) { - //获取流程定义 + // 获取流程定义 Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); // 获取当前运行流程的发起人节点信息 - FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); + FlowNode rootNode = (FlowNode)process.getFlowElement("root", true); // 获取当前节点 - FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); + FlowNode currentNode = (FlowNode)process.getFlowElement(task.getTaskDefinitionKey(), true); String rootUserId = getRootUserId(rootNode); // 判断当前登录用户是否是流程发起人 - if (rootUserId.equals(String.valueOf(userId))){ + if (rootUserId.equals(String.valueOf(userId))) { // TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 updateWithdrawProjectStatus(task, userId); List executions = runtimeService.createExecutionQuery() - .processInstanceId(task.getProcessInstanceId()) - .onlyChildExecutions().list(); + .processInstanceId(task.getProcessInstanceId()).onlyChildExecutions().list(); // 强制流程指向撤回 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) - .moveExecutionsToSingleActivityId(executions.stream().map(Execution::getId) - .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) - .changeState(); - }else { + runtimeService.createChangeActivityStateBuilder().processInstanceId(task.getProcessInstanceId()) + .moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) + .moveExecutionsToSingleActivityId( + executions.stream().map(Execution::getId).collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) + .changeState(); + } else { FlowElementsContainer parentContainer = currentNode.getParentContainer(); for (FlowElement flowElement : parentContainer.getFlowElements()) { - UserTask beforeUserTask = (UserTask) flowElement; - if (beforeUserTask.getAssignee().equals(String.valueOf(userId))){ + UserTask beforeUserTask = (UserTask)flowElement; + if (beforeUserTask.getAssignee().equals(String.valueOf(userId))) { // TODO 若是前一个审核人点击撤回,在审核记录中移除自己提交过的审核意见、 - // 待我处理中移除当前审核人的待办记录、 - // 待我处理中增加自己的待办记录、 - // 我已处理中去掉自己之前处理的记录 + // 待我处理中移除当前审核人的待办记录、 + // 待我处理中增加自己的待办记录、 + // 我已处理中去掉自己之前处理的记录 // 更新项目状态 updateWithdrawProjectStatus(task, userId); - HistoricTaskInstance beforeTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(beforeUserTask.getId()).singleResult(); + HistoricTaskInstance beforeTaskInstance = + historyService.createHistoricTaskInstanceQuery().taskId(beforeUserTask.getId()).singleResult(); List executions = runtimeService.createExecutionQuery() - .processInstanceId(beforeTaskInstance.getProcessInstanceId()) - .onlyChildExecutions().list(); + .processInstanceId(beforeTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); // 强制流程指向撤回 - runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdTo(flowElement.getId(), HisProInsEndActId.WITHDRAW) - .moveExecutionsToSingleActivityId(executions.stream().map(Execution::getId) - .collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) - .changeState(); + runtimeService.createChangeActivityStateBuilder().processInstanceId(task.getProcessInstanceId()) + .moveActivityIdTo(flowElement.getId(), HisProInsEndActId.WITHDRAW) + .moveExecutionsToSingleActivityId( + executions.stream().map(Execution::getId).collect(Collectors.toList()), + HisProInsEndActId.WITHDRAW) + .changeState(); break; } } @@ -679,18 +690,18 @@ public class TodoCenterManage { * @param userId * @return void * @author CMM - * @since 2023/02/08 20:41 + * @since 2023/02/08 */ private void updateWithdrawProjectStatus(Task task, Long userId) { // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); // 获取当前流程项目状态 Integer projectStatusSecond = declaredProject.getStatus(); // 根据当前状态获取对应的撤回事件 ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusWithdrawEvent(projectStatusSecond); try { - stateMachineUtils.execute(declaredProject,event); + stateMachineUtils.execute(declaredProject, event); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); } catch (Exception e) { @@ -702,56 +713,59 @@ public class TodoCenterManage { /** * 退回流程处理 - * - * @param task * @param task 当前任务 - * @param userId 当前登录用户ID - * @param param 参数 + * @param userId 当前登录用户ID + * @param param 参数 */ private void doBackTask(Task task, Long userId, ReqProcessHandlerDTO param) { // 获取当前申报项目 - Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) - .eq(Project::getInstCode, task.getProcessInstanceId())); + Project declaredProject = projectService + .getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); String projectName = declaredProject.getProjectName(); - //获取流程定义 + // 获取流程定义 Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); // 获取根节点即流程发起节点 - FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); + FlowNode rootNode = (FlowNode)process.getFlowElement("root", true); // TODO 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 - sendWorkNoticeToStartUser(task,projectName,rootNode); - //执行自定义回退逻辑,回退到流程发起人 - managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, param.getTaskId(), rootNode.getId())); - runtimeService.setVariables(param.getInstanceId(), Maps.newHashMap("approve_" + param.getTaskId(), param.getAction())); - log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(), task.getTaskDefinitionKey(), param.getTargetNode()); + sendWorkNoticeToStartUser(task, projectName, rootNode); + // 执行自定义回退逻辑,回退到流程发起人 + managementService + .executeCommand(new BackToHisApprovalNodeCmd(runtimeService, param.getTaskId(), rootNode.getId())); + runtimeService.setVariables(param.getInstanceId(), + Maps.newHashMap("approve_" + param.getTaskId(), param.getAction())); + log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(), task.getTaskDefinitionKey(), + param.getTargetNode()); } /** * 查询流程表单数据及审批的进度步骤 - * - * @param nodeId 当前获取流程人员关联的流程节点ID + * @param nodeId 当前获取流程人员关联的流程节点ID * @param instanceId 流程实例ID * @return 流程进度及表单详情 */ public ProcessProgressDetailVo getProcessDetail(String nodeId, String instanceId) { - HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceId).singleResult(); + HistoricProcessInstance instance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(instanceId).singleResult(); // 取表单及表单数据 HistoricVariableInstance forms = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_FORMS).singleResult(); - List formDatas = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(instanceId).list(); + .processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_FORMS).singleResult(); + List formDatas = + historyService.createHistoricVariableInstanceQuery().processInstanceId(instanceId).list(); // 取节点设置 HistoricVariableInstance nodeProps = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult(); - Map nodePropsValue = (Map) nodeProps.getValue(); + .processInstanceId(instanceId).variableName(WflowGlobalVarDef.WFLOW_NODE_PROPS).singleResult(); + Map nodePropsValue = (Map)nodeProps.getValue(); ProcessNode currentNode = null; if (StrUtil.isNotBlank(nodeId)) { // 搜索当前版本流程的配置 - WflowModelHistorys modelHistory = modelHistorysMapper.selectOne(new QueryWrapper<>(WflowModelHistorys.builder() - .processDefId(instance.getProcessDefinitionId()).version(instance.getProcessDefinitionVersion()).build())); + WflowModelHistorys modelHistory = modelHistorysMapper.selectOne( + new QueryWrapper<>(WflowModelHistorys.builder().processDefId(instance.getProcessDefinitionId()) + .version(instance.getProcessDefinitionVersion()).build())); currentNode = nodeCatchService.reloadProcessByStr(modelHistory.getProcess()).get(nodeId); } UserDo users = orgRepositoryService.getUserById(instance.getStartUserId()); - OrgUser startUser = OrgUser.builder().id(users.getUserId()).name(users.getUserName()).avatar(users.getAvatar()).build(); + OrgUser startUser = + OrgUser.builder().id(users.getUserId()).name(users.getUserName()).avatar(users.getAvatar()).build(); List taskRecords = getHisTaskRecords(instanceId, nodePropsValue); // 获取添加抄送任务 @@ -760,40 +774,28 @@ public class TodoCenterManage { // TODO 下版实现 获取等待中且还未开始的任务,如果存在条件则需要直接解析条件 taskRecords.addAll(getFutureTask(instanceId)); } - taskRecords = taskRecords.stream() - .sorted(Comparator.comparing(ProgressNode::getStartTime)) - .collect(Collectors.toList()); - taskRecords.add(0, ProgressNode.builder() - .nodeId("root") - .name("提交申请") - .user(startUser) - .nodeType(NodeTypeEnum.ROOT) - .startTime(instance.getStartTime()) - .finishTime(instance.getStartTime()) - .taskId("root") - .result(ProcessHandlerEnum.PASS) - .build()); + taskRecords = + taskRecords.stream().sorted(Comparator.comparing(ProgressNode::getStartTime)).collect(Collectors.toList()); + taskRecords.add(0, + ProgressNode.builder().nodeId("root").name("提交申请").user(startUser).nodeType(NodeTypeEnum.ROOT) + .startTime(instance.getStartTime()).finishTime(instance.getStartTime()).taskId("root") + .result(ProcessHandlerEnum.PASS).build()); // 提取全量表单数据 - Map formData = formDatas.stream().filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)).collect(Collectors.toMap(HistoricVariableInstance::getVariableName, - HistoricVariableInstance::getValue)); + Map formData = + formDatas.stream().filter(CodeUtil.distinctByKey(HistoricVariableInstance::getVariableName)).collect( + Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)); HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(instanceId).variableName("owner").singleResult(); - ProcessInstanceUserDto owner = (ProcessInstanceUserDto) variableInstance.getValue(); - ProcessProgressDetailVo res = ProcessProgressDetailVo.builder() - .instanceId(instanceId) - .version(instance.getProcessDefinitionVersion()) - .formItems(formService.filterFormAndDataByPermConfig((List
) forms.getValue(), formData, currentNode)) - .formData(formData) - .processDefName(instance.getProcessDefinitionName()) - .startTempUser(startUser) - .startDept(null == owner ? null : owner.getOrgName()) - .result(instance.getEndActivityId()) - .startTime(instance.getStartTime()) - .progress(taskRecords) - .build(); + .processInstanceId(instanceId).variableName("owner").singleResult(); + ProcessInstanceUserDto owner = (ProcessInstanceUserDto)variableInstance.getValue(); + ProcessProgressDetailVo res = ProcessProgressDetailVo.builder().instanceId(instanceId) + .version(instance.getProcessDefinitionVersion()) + .formItems(formService.filterFormAndDataByPermConfig((List)forms.getValue(), formData, currentNode)) + .formData(formData).processDefName(instance.getProcessDefinitionName()).startTempUser(startUser) + .startDept(null == owner ? null : owner.getOrgName()).result(instance.getEndActivityId()) + .startTime(instance.getStartTime()).progress(taskRecords).build(); // UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId())); // res.setStartUser(userInfo); - if (Objects.isNull(instance.getEndActivityId())){ + if (Objects.isNull(instance.getEndActivityId())) { res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); } else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) { // TODO 被退回的审核节点状态这里只是暂时这么判断,具体怎么保存这个退回状态,后面讨论 @@ -808,24 +810,18 @@ public class TodoCenterManage { /** * 获取抄送的流程实例信息 - * * @param instanceId 实例ID * @return 抄送我的流程 */ private List getCcTaskRecords(String instanceId) { Set ccUsers = new HashSet<>(); - List ccList = ccTasksMapper.selectList(new QueryWrapper() - .eq("instance_id", instanceId)).stream().map(task -> { - ccUsers.add(task.getUserId()); - return ProgressNode.builder() - .nodeId(task.getNodeId()) - .nodeType(NodeTypeEnum.CC) - .name(task.getNodeName()) - .user(OrgUser.builder().id(task.getUserId()).build()) - .startTime(task.getCreateTime()) - .finishTime(task.getCreateTime()) - .build(); - }).collect(Collectors.toList()); + List ccList = ccTasksMapper + .selectList(new QueryWrapper().eq("instance_id", instanceId)).stream().map(task -> { + ccUsers.add(task.getUserId()); + return ProgressNode.builder().nodeId(task.getNodeId()).nodeType(NodeTypeEnum.CC) + .name(task.getNodeName()).user(OrgUser.builder().id(task.getUserId()).build()) + .startTime(task.getCreateTime()).finishTime(task.getCreateTime()).build(); + }).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(ccUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(ccUsers); ccList.stream().peek(v -> v.setUser(userMap.get(v.getUser().getId()))).collect(Collectors.toList()); @@ -835,66 +831,57 @@ public class TodoCenterManage { /** * 获取流程的审批历史记录 - * * @param instanceId 审批实例ID - * @param nodeProps 节点设置 + * @param nodeProps 节点设置 * @return 历史记录列表 */ private List getHisTaskRecords(String instanceId, Map nodeProps) { List list = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(instanceId).orderByHistoricActivityInstanceStartTime().asc().list(); + .processInstanceId(instanceId).orderByHistoricActivityInstanceStartTime().asc().list(); Set userSet = new HashSet<>(); - //获取节点处理结果 - Map varMap = historyService.createHistoricVariableInstanceQuery() - .processInstanceId(instanceId).variableNameLike("approve_%").list().stream() - .collect(Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum) v.getValue())); + // 获取节点处理结果 + Map varMap = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(instanceId).variableNameLike("approve_%").list().stream().collect( + Collectors.toMap(HistoricVariableInstance::getVariableName, v -> (ProcessHandlerEnum)v.getValue())); Map> commentMap = new HashMap<>(); - //统一处理所有评论数据,省的多次查询 - List cmvos = taskService.getProcessInstanceComments(instanceId).stream().map(comment -> { - userSet.add(comment.getUserId()); - ProgressNodeAuditInfoVo progressNodeAuditInfoVo = ProgressNodeAuditInfoVo.builder() - .id(comment.getId()) - .taskId(comment.getTaskId()) - .commentType(comment.getType()) - .type("COMMENT") - .createTime(comment.getTime()) - .user(UserInfo.builder().id(Long.valueOf(comment.getUserId())).build()) - .build(); - ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); - progressNodeAuditInfoVo.setText(processComment.getText()); - progressNodeAuditInfoVo.setAttachments(processComment.getAttachments()); - return progressNodeAuditInfoVo; - }).collect(Collectors.toList()); + // 统一处理所有评论数据,省的多次查询 + List cmvos = + taskService.getProcessInstanceComments(instanceId).stream().map(comment -> { + userSet.add(comment.getUserId()); + ProgressNodeAuditInfoVo progressNodeAuditInfoVo = + ProgressNodeAuditInfoVo.builder().id(comment.getId()).taskId(comment.getTaskId()) + .commentType(comment.getType()).type("COMMENT").createTime(comment.getTime()) + .user(UserInfo.builder().id(Long.valueOf(comment.getUserId())).build()).build(); + ProcessComment processComment = JSONObject.parseObject(comment.getFullMessage(), ProcessComment.class); + progressNodeAuditInfoVo.setText(processComment.getText()); + progressNodeAuditInfoVo.setAttachments(processComment.getAttachments()); + return progressNodeAuditInfoVo; + }).collect(Collectors.toList()); cmvos.forEach(cm -> { - //把评论数据按照task进行归类 + // 把评论数据按照task进行归类 String taskId = Optional.ofNullable(cm.getTaskId()).orElse(instanceId); List vos = commentMap.computeIfAbsent(taskId, k -> new ArrayList<>()); vos.add(cm); }); // 再将评论按照任务一次构建,方便取出 - Map commentsMap = cmvos.stream() - .collect(Collectors.toMap(ProgressNodeAuditInfoVo::getTaskId, c -> c)); - List progressNodes = list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())).map(his -> { - Object props = nodeProps.get(his.getActivityId()); - ApprovalModeEnum approvalMode = null; - if (props instanceof ApprovalProps) { - approvalMode = ((ApprovalProps) props).getMode(); - } - userSet.add(his.getAssignee()); - return ProgressNode.builder() - .nodeId(his.getActivityId()) - .name(his.getActivityName()) - .nodeType(NodeTypeEnum.APPROVAL) - .user(OrgUser.builder().id(his.getAssignee()).build()) - .startTime(his.getStartTime()) - .finishTime(his.getEndTime()) - .taskId(his.getTaskId()) - .approvalMode(approvalMode) - .auditInfo(commentsMap.get(his.getTaskId())) - .result(varMap.get("approve_" + his.getTaskId())) - .build(); - }).collect(Collectors.toList()); + Map commentsMap = + cmvos.stream().collect(Collectors.toMap(ProgressNodeAuditInfoVo::getTaskId, c -> c)); + List progressNodes = + list.stream().filter(his -> ObjectUtil.isNotNull(his.getTaskId())).map(his -> { + Object props = nodeProps.get(his.getActivityId()); + ApprovalModeEnum approvalMode = null; + if (props instanceof ApprovalProps) { + approvalMode = ((ApprovalProps)props).getMode(); + } + userSet.add(his.getAssignee()); + return ProgressNode.builder().nodeId(his.getActivityId()).name(his.getActivityName()) + .nodeType(NodeTypeEnum.APPROVAL).user(OrgUser.builder().id(his.getAssignee()).build()) + .startTime(his.getStartTime()).finishTime(his.getEndTime()).taskId(his.getTaskId()) + .approvalMode(approvalMode).auditInfo(commentsMap.get(his.getTaskId())) + .result(varMap.get("approve_" + his.getTaskId())).build(); + }).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(userSet)) { Map map = userDeptOrLeaderService.getUserMapByIds(userSet); progressNodes.forEach(n -> n.setUser(map.get(n.getUser().getId()))); @@ -903,57 +890,46 @@ public class TodoCenterManage { } private List getFutureTask(String instanceId) { - //根据流程遍历后续节点,期间要穿越后续包含并行网关和条件网关的节点 + // 根据流程遍历后续节点,期间要穿越后续包含并行网关和条件网关的节点 return Collections.emptyList(); } + /** * 待办中心我已处理项目列表查询 + * * @param param * @return com.ningdatech.basic.model.PageVo * @author CMM - * @since 2023/02/03 10:07 + * @since 2023/02/03 */ public PageVo queryHandledProjectList(ReqToBeProcessedDTO param) { // 获取登录用户ID // long userId = LoginUserUtil.getUserId(); Long userId = 381496L; - // 获取入参分页信息 - Page page = param.page(); - //自定义sql查询所有已办的任务实例 - String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n" + - "LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n" + - "WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" + - "ORDER BY aht.END_TIME_ DESC"; - NativeHistoricTaskInstanceQuery taskInstanceQuery = historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); + // 自定义sql查询所有已办的任务实例 + String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n" + + "LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n" + + "WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" + "ORDER BY aht.END_TIME_ DESC"; + NativeHistoricTaskInstanceQuery taskInstanceQuery = + historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); List taskInstances = taskInstanceQuery.list(); - // 把已办任务实例一次性取出来,减少查询次数 - Map taskInstanceMap = taskInstances.stream() - .collect(Collectors.toMap(HistoricTaskInstance::getProcessInstanceId, v -> v)); - - // 把已办任务流程实例一次性取出来,减少查询次数 Set taskProcessInsIds = taskInstances.stream() .map(HistoricTaskInstance::getProcessInstanceId) .collect(Collectors.toSet()); - Map instanceMap = CollectionUtil.isNotEmpty(taskInstances) ? - historyService.createHistoricProcessInstanceQuery().processInstanceIds(taskProcessInsIds) - .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); + List results = getHandledProjects(param, taskProcessInsIds); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); - wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) - .like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildOrgName,param.getBuildUnitName()) - .eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) - .eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) - .ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) - .le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); - projectService.page(page,wrapper); - Set staterUsers = new HashSet<>(); + // 把已办任务实例一次性取出来,减少查询次数 + Map taskInstanceMap = taskInstances.stream() + .collect(Collectors.toMap(HistoricTaskInstance::getProcessInstanceId, v -> v)); - // 过滤申报项目中登录用户已审核的项目 - List results = page.getRecords().stream() - .filter(w -> taskProcessInsIds.contains(w.getInstCode())) - .collect(Collectors.toList()); + Map instanceMap = CollectionUtil.isNotEmpty(taskInstances) + ? historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(taskProcessInsIds) + .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) + : new HashMap<>(); + Set staterUsers = new HashSet<>(); List resVos = results.stream().map(d -> { @@ -962,49 +938,70 @@ public class TodoCenterManage { res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); LocalDateTime processLaunchTime = d.getCreateOn(); String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); - LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + LocalDateTime launchTime = + LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); res.setProcessLaunchTime(launchTime); LocalDateTime processHandleTime = d.getUpdateOn(); String handleTimeFormat = NdDateUtils.format(processHandleTime, "yyyy-MM-dd HH:mm"); - LocalDateTime handleTime = LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + LocalDateTime handleTime = + LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); res.setProcessHandleTime(handleTime); // 从已处理任务实例列表中取出当前登录用户及项目实例对应的任务实例 HistoricTaskInstance task = taskInstanceMap.get(d.getInstCode()); HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId()); - //从缓存取 + // 从缓存取 staterUsers.add(instance.getStartUserId()); - ProcessTaskVo processTaskVo = ProcessTaskVo.builder() - .taskId(task.getId()) - .taskName(task.getName()) - .taskDefKey(task.getTaskDefinitionKey()) - .processDefId(task.getProcessDefinitionId()) - .executionId(task.getExecutionId()) - .nodeId(task.getTaskDefinitionKey()) - .deployId(instance.getDeploymentId()) - .processDefName(instance.getProcessDefinitionName()) - .version(instance.getProcessDefinitionVersion()) - .instanceId(task.getProcessInstanceId()) - .ownerId(instance.getStartUserId()) - .createTime(instance.getStartTime()) - .taskCreateTime(task.getCreateTime()) - .build(); + ProcessTaskVo processTaskVo = ProcessTaskVo.builder().taskId(task.getId()).taskName(task.getName()) + .taskDefKey(task.getTaskDefinitionKey()).processDefId(task.getProcessDefinitionId()) + .executionId(task.getExecutionId()).nodeId(task.getTaskDefinitionKey()) + .deployId(instance.getDeploymentId()).processDefName(instance.getProcessDefinitionName()) + .version(instance.getProcessDefinitionVersion()).instanceId(task.getProcessInstanceId()) + .ownerId(instance.getStartUserId()).createTime(instance.getStartTime()) + .taskCreateTime(task.getCreateTime()).build(); res.setProcessTaskInfo(processTaskVo); return res; }).collect(Collectors.toList()); - //取用户信息,减少数据库查询,一次构建 + // 取用户信息,减少数据库查询,一次构建 List result = null; if (CollectionUtil.isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); - result = resVos.stream().peek(v -> v.getProcessTaskInfo() - .setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) - .collect(Collectors.toList()); + result = resVos.stream() + .peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))) + .collect(Collectors.toList()); // Map userMap = userInfoService.getUserMapByIds(staterUsers); // result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId))) // .collect(Collectors.toList()); - + } - return PageVo.of(result,resVos.size()); + return PageVo.of(result, result.size()); + } + + /** + * 获取申报项目列表中登录用户已处理项目列表 + * @param param + * @param taskProcessInsIds + * @return java.util.List + * @author CMM + * @since 2023/02/11 + */ + private List getHandledProjects(ReqToBeProcessedDTO param, Set taskProcessInsIds) { + // 获取入参分页信息 + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); + wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) + .eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) + .eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) + .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, + param.getProcessLaunchStartTime()) + .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); + projectService.page(page, wrapper); + + // 过滤申报项目中登录用户已审核的项目 + return page.getRecords().stream() + .filter(w -> taskProcessInsIds.contains(w.getInstCode())) + .collect(Collectors.toList()); } /** @@ -1013,76 +1010,113 @@ public class TodoCenterManage { * @param param 请求参数 * @return void * @author CMM - * @since 2023/02/06 16:25 + * @since 2023/02/06 */ public void exportHandledProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { - PageVo page = queryHandledProjectList(param); - List collect = (List) page.getRecords(); + param.setPageNumber(1); + param.setPageSize(10000); + // 获取登录用户ID + // long userId = LoginUserUtil.getUserId(); + Long userId = 381496L; + // 自定义sql查询所有已办的任务实例 + String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n" + + "LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n" + + "WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" + "ORDER BY aht.END_TIME_ DESC"; + NativeHistoricTaskInstanceQuery taskInstanceQuery = + historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); + List taskInstances = taskInstanceQuery.list(); + + // 把已办任务流程实例一次性取出来,减少查询次数 + Set taskProcessInsIds = taskInstances.stream() + .map(HistoricTaskInstance::getProcessInstanceId) + .collect(Collectors.toSet()); + List records = getHandledProjects(param, taskProcessInsIds); + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_我已处理_增补项目列表"; - }else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_我已处理_非增补项目列表"; } - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ResHandledExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new BizException("导出失败!"); + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + + // 表体行数据集合 + List> rowList = new ArrayList<>(); + // 表体列数据集合 + List columnList = param.getExportOptionList(); + for (ExportOptionEnum column : columnList) { + List columnValues = new ArrayList<>(); + columnValues.add(column.getDesc()); + records.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { + String s = JSON.toJSONString(record); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue = String.valueOf(jsonObject.get(column.toString())); + columnValues.add(columnValue); + }); + rowList.add(columnValues); } + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(rowList); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(rowList); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + } /** * 查询我提交的项目列表 + * * @param param * @return com.ningdatech.basic.model.PageVo * @author CMM - * @since 2023/02/06 16:18 + * @since 2023/02/06 */ public PageVo queryMySubmittedProjectList(ReqToBeProcessedDTO param) { - HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery(); + // Long startUserId = LoginUserUtil.getUserId(); Long startUserId = 381496L; - Page page = param.page(); + HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery(); Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy); - List historicProcessInstances = instanceQuery - .orderByProcessInstanceStartTime().desc() - .orderByProcessInstanceEndTime().desc() - .list(); - //把已办任务流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(historicProcessInstances) ? - historyService.createHistoricProcessInstanceQuery().processInstanceIds(historicProcessInstances.stream() - .map(h -> h.getId()).collect(Collectors.toSet())).list().stream() - .collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); - Set historicProcessInstanceIds = historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet()); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); - wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) - .like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildOrgName,param.getBuildUnitName()) - .eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) - .eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) - .ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) - .le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); - projectService.page(page,wrapper); + List historicProcessInstances = + instanceQuery.orderByProcessInstanceStartTime().desc().orderByProcessInstanceEndTime().desc().list(); + Set historicProcessInstanceIds = + historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet()); + + List results = getMySubmittedProjects(param, historicProcessInstanceIds); + + // 把已办任务流程实例一次性取出来,减少查询次数 + Map instanceMap = CollectionUtil.isNotEmpty(historicProcessInstances) ? historyService + .createHistoricProcessInstanceQuery() + .processInstanceIds(historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet())) + .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); + Set staterUsers = new HashSet<>(); - List resVos = page.getRecords().stream().filter(d -> historicProcessInstanceIds.contains(d.getInstCode())).map(d -> { - ResToBeProcessedDTO res = new ResToBeProcessedDTO(); - BeanUtils.copyProperties(d, res); - res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); - LocalDateTime processLaunchTime = d.getCreateOn(); - String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); - LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); - res.setProcessLaunchTime(launchTime); - HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); - staterUsers.add(ist.getStartUserId()); - ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); - res.setProcessInstanceInfo(processInstanceVo); - return res; - }).collect(Collectors.toList()); + + List resVos = + results.stream().map(d -> { + ResToBeProcessedDTO res = new ResToBeProcessedDTO(); + BeanUtils.copyProperties(d, res); + res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); + LocalDateTime processLaunchTime = d.getCreateOn(); + String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); + LocalDateTime launchTime = + LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + res.setProcessLaunchTime(launchTime); + HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); + staterUsers.add(ist.getStartUserId()); + ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); + res.setProcessInstanceInfo(processInstanceVo); + return res; + }).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); @@ -1092,36 +1126,55 @@ public class TodoCenterManage { }).collect(Collectors.toList()); } - //if (CollectionUtil.isNotEmpty(staterUsers)) { - // Map userMap = userInfoService.getUserMapByIds(staterUsers); - // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) - // .collect(Collectors.toList()); - //} - return PageVo.of(resVos,resVos.size()); + // if (CollectionUtil.isNotEmpty(staterUsers)) { + // Map userMap = userInfoService.getUserMapByIds(staterUsers); + // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) + // .collect(Collectors.toList()); + // } + return PageVo.of(resVos, resVos.size()); + } + + /** + * 获取申报项目列表中当前登录用户发起的项目列表 + * @param param + * @param historicProcessInstanceIds + * @return java.util.List + * @author CMM + * @since 2023/02/11 + */ + private List getMySubmittedProjects(ReqToBeProcessedDTO param, Set historicProcessInstanceIds) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); + wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) + .eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) + .eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) + .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, + param.getProcessLaunchStartTime()) + .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); + projectService.page(page, wrapper); + + // 筛选出申报项目中我发起的项目 + List results = page.getRecords().stream() + .filter(d -> historicProcessInstanceIds.contains(d.getInstCode())) + .collect(Collectors.toList()); + return results; } /** * 获取流程实例信息 - * * @param ist 流程实例 * @return java.util.List * @author CMM - * @since 2023/02/06 17:34 + * @since 2023/02/06 */ - private ProcessInstanceVo getProcessInstanceVos( HistoricProcessInstance ist) { + private ProcessInstanceVo getProcessInstanceVos(HistoricProcessInstance ist) { Map instanceNodeMap = new HashMap<>(); - ProcessInstanceVo instanceVo = ProcessInstanceVo.builder() - .processDefId(ist.getProcessDefinitionId()) - .instanceId(ist.getId()) - .nodeId(instanceNodeMap.get(ist.getId())) - .formId(ist.getProcessDefinitionKey()) - .staterUserId(ist.getStartUserId()) - .startTime(ist.getStartTime()) - .finishTime(ist.getEndTime()) - .processDefName(ist.getProcessDefinitionName()) - .result(ist.getEndActivityId()) - .version(ist.getProcessDefinitionVersion()) - .build(); + ProcessInstanceVo instanceVo = ProcessInstanceVo.builder().processDefId(ist.getProcessDefinitionId()) + .instanceId(ist.getId()).nodeId(instanceNodeMap.get(ist.getId())).formId(ist.getProcessDefinitionKey()) + .staterUserId(ist.getStartUserId()).startTime(ist.getStartTime()).finishTime(ist.getEndTime()) + .processDefName(ist.getProcessDefinitionName()).result(ist.getEndActivityId()) + .version(ist.getProcessDefinitionVersion()).build(); if (Objects.isNull(ist.getEndActivityId())) { instanceVo.setStatus(ProcessStatusEnum.UNDER_REVIEW.name()); @@ -1158,69 +1211,114 @@ public class TodoCenterManage { return instanceVo; } + /** + * 待办中心-我发起的项目列表导出 + * @param response + * @param param + * @return void + * @author CMM + * @since 2023/02/11 + */ public void exportMySubmittedProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { - PageVo page = queryMySubmittedProjectList(param); - List collect = (List) page.getRecords(); + + param.setPageNumber(1); + param.setPageSize(10000); + // Long startUserId = LoginUserUtil.getUserId(); + Long startUserId = 381496L; + HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery(); + Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy); + List historicProcessInstances = instanceQuery + .orderByProcessInstanceStartTime().desc() + .orderByProcessInstanceEndTime().desc() + .list(); + Set historicProcessInstanceIds = historicProcessInstances.stream() + .map(h -> h.getId()) + .collect(Collectors.toSet()); + List records = getMySubmittedProjects(param, historicProcessInstanceIds); + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_我发起的_增补项目列表"; - }else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_我发起的_非增补项目列表"; } - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ResMySubmittedExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new BizException("导出失败!"); + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + + // 表体行数据集合 + List> rowList = new ArrayList<>(); + // 表体列数据集合 + List columnList = param.getExportOptionList(); + for (ExportOptionEnum column : columnList) { + List columnValues = new ArrayList<>(); + columnValues.add(column.getDesc()); + records.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { + String s = JSON.toJSONString(record); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue = String.valueOf(jsonObject.get(column.toString())); + columnValues.add(columnValue); + }); + rowList.add(columnValues); } + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(rowList); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(rowList); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); } + /** + * 待办中心-抄送我的项目列表查询 + * @param param + * @return com.ningdatech.basic.model.PageVo + * @author CMM + * @since 2023/02/11 + */ public PageVo queryCcMeProjectList(ReqToBeProcessedDTO param) { // 获取当前登录用户ID // Long userId = LoginUserUtil.getUserId(); Long userId = 381496L; - Page page = param.page(); - Set staterUsers = new HashSet<>(); List ccTasks = ccTasksMapper.selectList(Wrappers.lambdaQuery(WflowCcTasks.class) - .eq(WflowCcTasks::getUserId, String.valueOf(userId)) - .orderByDesc(WflowCcTasks::getCreateTime)); + .eq(WflowCcTasks::getUserId, String.valueOf(userId)).orderByDesc(WflowCcTasks::getCreateTime)); + List processInsIds = ccTasks.stream() + .map(WflowCcTasks::getInstanceId) + .collect(Collectors.toList()); - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); - wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName()) - .like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildOrgName,param.getBuildUnitName()) - .eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear()) - .eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement()) - .ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime()) - .le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime()); - projectService.page(page,wrapper); + List results = getCcMeProjects(param, processInsIds); + Set staterUsers = new HashSet<>(); // 将抄送我的流程实例一次性取出来,减少查询次数 - Map instanceMap = CollectionUtil.isNotEmpty(ccTasks) ? - historyService.createHistoricProcessInstanceQuery().processInstanceIds(ccTasks.stream() - .map(WflowCcTasks::getInstanceId).collect(Collectors.toSet())) - .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>(); - List processInsIds = ccTasks.stream().map(WflowCcTasks::getInstanceId).collect(Collectors.toList()); - List resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getInstCode())).map(d -> { - ResToBeProcessedDTO res = new ResToBeProcessedDTO(); - BeanUtils.copyProperties(d, res); - res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); - LocalDateTime processLaunchTime = d.getCreateOn(); - String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); - LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); - res.setProcessLaunchTime(launchTime); - HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); - staterUsers.add(ist.getStartUserId()); - ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); - res.setProcessInstanceInfo(processInstanceVo); - return res; - }).collect(Collectors.toList()); + Map instanceMap = CollectionUtil.isNotEmpty(ccTasks) + ? historyService.createHistoricProcessInstanceQuery() + .processInstanceIds(ccTasks.stream().map(WflowCcTasks::getInstanceId).collect(Collectors.toSet())) + .list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) + : new HashMap<>(); + List resVos = + results.stream().map(d -> { + ResToBeProcessedDTO res = new ResToBeProcessedDTO(); + BeanUtils.copyProperties(d, res); + res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus())); + LocalDateTime processLaunchTime = d.getCreateOn(); + String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm"); + LocalDateTime launchTime = + LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + res.setProcessLaunchTime(launchTime); + HistoricProcessInstance ist = instanceMap.get(d.getInstCode()); + staterUsers.add(ist.getStartUserId()); + ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist); + res.setProcessInstanceInfo(processInstanceVo); + return res; + }).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(staterUsers)) { Map userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers); @@ -1230,33 +1328,100 @@ public class TodoCenterManage { }).collect(Collectors.toList()); } - //if (CollectionUtil.isNotEmpty(staterUsers)) { - // Map userMap = userInfoService.getUserMapByIds(staterUsers); - // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) - // .collect(Collectors.toList()); - //} - return PageVo.of(resVos,resVos.size()); + // if (CollectionUtil.isNotEmpty(staterUsers)) { + // Map userMap = userInfoService.getUserMapByIds(staterUsers); + // resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId))) + // .collect(Collectors.toList()); + // } + return PageVo.of(resVos, resVos.size()); + } + + /** + * 获取申报项目表中抄送当前登录用户的项目列表 + * @param param + * @param processInsIds + * @return java.util.List + * @author CMM + * @since 2023/02/11 + */ + private List getCcMeProjects(ReqToBeProcessedDTO param, List processInsIds) { + Page page = param.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class); + wrapper.like(StrUtil.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) + .like(StrUtil.isNotBlank(param.getBuildUnitName()), Project::getBuildOrgName, param.getBuildUnitName()) + .eq(Objects.nonNull(param.getProjectYear()), Project::getProjectYear, param.getProjectYear()) + .eq(Objects.nonNull(param.getIsSupplement()), Project::getIsTemporaryAugment, param.getIsSupplement()) + .ge(Objects.nonNull(param.getProcessLaunchStartTime()), Project::getBeginTime, + param.getProcessLaunchStartTime()) + .le(Objects.nonNull(param.getProcessLaunchEndTime()), Project::getEndTime, param.getProcessLaunchEndTime()); + projectService.page(page, wrapper); + + return page.getRecords().stream() + .filter(d -> processInsIds.contains(d.getInstCode())) + .collect(Collectors.toList()); } + /** + * 待办中心-抄送我的项目列表导出 + * @param response + * @param param + * @return void + * @author CMM + * @since 2023/02/11 + */ public void exportCcMeProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) { - PageVo page = queryCcMeProjectList(param); - List collect = (List) page.getRecords(); + + param.setPageNumber(1); + param.setPageSize(10000); + // 获取当前登录用户ID + // Long userId = LoginUserUtil.getUserId(); + + Long userId = 381496L; + List ccTasks = ccTasksMapper.selectList(Wrappers.lambdaQuery(WflowCcTasks.class) + .eq(WflowCcTasks::getUserId, String.valueOf(userId)).orderByDesc(WflowCcTasks::getCreateTime)); + List processInsIds = ccTasks.stream() + .map(WflowCcTasks::getInstanceId) + .collect(Collectors.toList()); + + List records = getCcMeProjects(param, processInsIds); + + ExcelExportWriter excelExportWriter = new ExcelExportWriter(); + String fileName = null; - if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_抄送我的_增补项目列表"; - }else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){ + } else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())) { fileName = "待办中心_抄送我的_非增补项目列表"; } - ExcelDownUtil.setFileName(fileName,response); - //数据导出处理函数 - try { - EasyExcel.write(response.getOutputStream(), ResCcMeExportDTO.class) - .autoCloseStream(false) - .registerWriteHandler(ExcelExportStyle.formalStyle()) - .sheet(fileName) - .doWrite(collect); - } catch (IOException e) { - throw new BizException("导出失败!"); + excelExportWriter.setFileName(fileName); + + List sheetsNames = new ArrayList<>(); + sheetsNames.add(fileName); + + // 表体行数据集合 + List> rowList = new ArrayList<>(); + // 表体列数据集合 + List columnList = param.getExportOptionList(); + for (ExportOptionEnum column : columnList) { + List columnValues = new ArrayList<>(); + columnValues.add(column.getDesc()); + records.stream().sorted(Comparator.comparing(Project::getId)).forEach(record -> { + String s = JSON.toJSONString(record); + JSONObject jsonObject = JSON.parseObject(s); + String columnValue = String.valueOf(jsonObject.get(column.toString())); + columnValues.add(columnValue); + }); + rowList.add(columnValues); } + // sheet列表集合 + List>> sheets = new ArrayList<>(); + sheets.add(rowList); + excelExportWriter.setHeads(sheets); + excelExportWriter.setDatas(rowList); + excelExportWriter.setSheets(sheetsNames); + excelExportWriter.setHeadPropertyClass(List.class); + excelExportWriter.setHeadPropertyFlag(Boolean.FALSE); + ExcelDownUtil.excelExportFile(response, excelExportWriter); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java index 5568449..395d38b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java @@ -1,16 +1,12 @@ package com.ningdatech.pmapi.todocenter.model.dto.req; import java.io.Serializable; -import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import com.ningdatech.basic.model.PagePo; -import com.ningdatech.pmapi.todocenter.bean.entity.ExportOption; +import com.ningdatech.pmapi.common.enums.ExportOptionEnum; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; @@ -50,6 +46,6 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable { private Integer isSupplement; @ApiModelProperty("导出选项") - private List exportOptionList; + private List exportOptionList; }