Browse Source

项目库列表导出、流程进度详情

master
CMM 1 year ago
parent
commit
1886c6c478
9 changed files with 123 additions and 33 deletions
  1. +8
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java
  2. +1
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  3. +7
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java
  4. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  5. +2
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java
  6. +50
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  7. +34
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  8. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java
  9. +4
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 8
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java View File

@@ -143,7 +143,14 @@ public enum ExportOptionEnum {
projectRemarks(59, "备注"),
processStatusName(60, "流程状态名称"),
processLaunchTime(61,"流程发起时间"),
processHandleTime(62,"流程处理时间");
processHandleTime(62,"流程处理时间"),

projectStatusName(63,"项目状态名称"),

createOn(64,"创建时间"),

updateOn(65,"更新时间");


private Integer code;
private String desc;


+ 1
- 3
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -140,12 +140,10 @@ public class ExcelDownUtil {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}

public static List<List<String>> getExportDatas(ToBeProcessedExportReq param, List<Project> projects) {
public static List<List<String>> getExportDatas(List<ExportOptionEnum> columnList, List<Project> projects) {

// 表体行数据集合
List<List<String>> rowList = Lists.newArrayList();
// 表体列数据集合
List<ExportOptionEnum> columnList = param.getExportOptionList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList();
columnValues.add(column.getDesc());


+ 7
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java View File

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@@ -27,7 +28,7 @@ import javax.validation.Valid;
* @since 14:07 2023/2/11
*/
@RestController
@AllArgsConstructor
@RequiredArgsConstructor
@Api(tags = "年度计划库")
@RequestMapping("/api/v1/annualPlan")
public class AnnualPlanController {
@@ -68,17 +69,16 @@ public class AnnualPlanController {
annualPlanLibManage.importAnnualPlan(file);
}

@GetMapping("/exportAnnualPlanEditTable")
@ApiOperation("导出年度计划编辑表")
public void exportAnnualPlanEditTable(HttpServletResponse response) {
annualPlanLibManage.exportAnnualPlanEditTable(response);
}

@GetMapping("/modify")
@ApiOperation("年度计划编辑")
@WebLog("年度计划编辑")
public void modify(@RequestBody ProjectDTO req) {
annualPlanLibManage.updateAnnualPlan(req);
}
@PostMapping("/exportList")
@ApiOperation("项目库【列表|编辑表】导出")
public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response){
annualPlanLibManage.exportList(param,response);
}

}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java View File

@@ -8,11 +8,14 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
@@ -48,4 +51,10 @@ public class ProjectLibController {
private List<ProcessDetailVO> processScheduleDetail(@PathVariable("projectId") Long projectId){
return projectLibManage.processScheduleDetail(projectId);
}

@PostMapping("/exportList")
@ApiOperation("项目库列表导出")
private void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response){
projectLibManage.exportList(param,response);
}
}

pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteHandle.java → pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java View File

@@ -1,17 +1,8 @@
package com.ningdatech.pmapi.projectlib.handle;

import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@@ -22,14 +13,14 @@ import java.util.List;
* @since 2023/02/26 21:36
*/
@Component
public class ProcessExecuteHandle {
public class ProcessExecuteChainHandle {

/**
* 具体处理者的集合
*/
private final List<AbstractProcessBusinessHandle> processBusinessHandles;

public ProcessExecuteHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) {
public ProcessExecuteChainHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) {
this.processBusinessHandles = processBusinessHandles;
}


+ 50
- 5
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java View File

@@ -12,8 +12,11 @@ import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.ValidUtil;
import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibImportDTO;
@@ -36,6 +39,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*;

@@ -77,7 +81,11 @@ public class AnnualPlanLibManage {

public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
query.eq(Project::getIsTemporaryAugment, 0);
Integer isTemporaryAugment = req.getIsTemporaryAugment();
if (Objects.isNull(isTemporaryAugment)){
throw new BizException("请传入是否临时增补标志!");
}
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment);
query.orderByDesc(Project::getAnnualPlanAddTime);
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
Page<Project> page = projectService.page(req.page(), query);
@@ -203,13 +211,50 @@ public class AnnualPlanLibManage {
}
}

public void exportAnnualPlanEditTable(HttpServletResponse response) {
// TODO
}

public void updateAnnualPlan(ProjectDTO req) {
Project project = BeanUtil.copyProperties(req, Project.class);
projectService.updateById(project);
}

public void exportList(ProjectListReq param, HttpServletResponse response) {
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
Integer isTemporaryAugment = param.getIsTemporaryAugment();
if (Objects.isNull(isTemporaryAugment)){
throw new BizException("请传入是否临时增补标志!");
}
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment);
query.eq(Project::getIsTemporaryAugment, 0);
query.orderByDesc(Project::getAnnualPlanAddTime);
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
List<Project> projects = projectService.list(query);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

Integer tableFlag = param.getTableFlag();
if (Objects.isNull(tableFlag)){
throw new BizException("请传入要导出的表格类型!");
}
String fileName = null;
if (tableFlag == 0){
fileName = "年度计划库编辑表";
} else if (tableFlag == 1) {
fileName = "年度计划库列表";
}
excelExportWriter.setFileName(fileName);
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);
ExcelDownUtil.excelExportFile(response, excelExportWriter);
}
}

+ 34
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteHandle;
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
@@ -20,10 +23,12 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;
import java.util.*;

/**
@@ -41,7 +46,7 @@ public class ProjectLibManage {
private final IProjectService projectService;
private final IProjectApplicationService applicationService;
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService;
private final ProcessExecuteHandle processExecuteHandle;
private final ProcessExecuteChainHandle processExecuteHandle;

public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
@@ -127,4 +132,31 @@ public class ProjectLibManage {
List<ProcessDetailVO> processDetailVOS = new ArrayList<>();
return processExecuteHandle.handle(projectId, processDetailVOS);
}

public void exportList(ProjectListReq param, HttpServletResponse response) {

param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
List<Project> projects = projectService.list(query);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

String fileName = "项目库列表";
excelExportWriter.setFileName(fileName);

List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);
excelExportWriter.setHeads(sheets);
excelExportWriter.setDatas(exportDatas);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);
ExcelDownUtil.excelExportFile(response, excelExportWriter);
}
}

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectListReq.java View File

@@ -1,11 +1,13 @@
package com.ningdatech.pmapi.projectlib.model.req;

import com.ningdatech.basic.model.PagePo;
import com.ningdatech.pmapi.common.enumeration.ExportOptionEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@@ -83,4 +85,10 @@ public class ProjectListReq extends PagePo {

@ApiModelProperty("实例code 多个")
private List<String> instCodes;

@ApiModelProperty("导出选项")
private List<ExportOptionEnum> exportOptionList;

@ApiModelProperty(value = "表格类型",allowableValues = "0,1")
private Integer tableFlag;
}

+ 4
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -174,7 +174,7 @@ public class TodoCenterManage {
}
excelExportWriter.setFileName(fileName);
List<String> sheetsNames = Lists.newArrayList(fileName);
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = Lists.newArrayList();
sheets.add(exportDatas);
@@ -690,7 +690,7 @@ public class TodoCenterManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);

List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);
@@ -783,7 +783,7 @@ public class TodoCenterManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);
@@ -880,7 +880,7 @@ public class TodoCenterManage {
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);
// 表体行数据集合
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param, projects);
List<List<String>> exportDatas = ExcelDownUtil.getExportDatas(param.getExportOptionList(), projects);
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
sheets.add(exportDatas);


Loading…
Cancel
Save