Browse Source

项目列表导出

master
CMM 1 year ago
parent
commit
27aef1ada8
11 changed files with 624 additions and 68 deletions
  1. +218
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java
  2. +65
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportWriter.java
  3. +67
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  4. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  5. +13
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  6. +197
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java
  7. +0
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java
  8. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  9. +45
    -21
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  10. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java
  11. +0
    -42
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeExportDTO.java

+ 218
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java View File

@@ -0,0 +1,218 @@
package com.ningdatech.pmapi.common.model.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* 待办中心待我处理项目列表导出实体
*
* @author CMM
* @since 2023/01/19 16:42
*/
@Data
@NoArgsConstructor
@AllArgsConstructor

public class ExcelExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

//@ExcelProperty("项目名称")
//private String projectName;
//
//@ExcelProperty("申报单位")
//private String buildUnitName;
//
//@ExcelProperty("申报金额")
//private Integer declareAmount;
//
//@ExcelProperty("预算年度")
//private Integer projectYear;
//
//@ExcelProperty("流程状态")
//private String processStatusName;
//
//@ExcelProperty("发起时间")
//@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
//private LocalDateTime processLaunchTime;

@ExcelProperty("项目ID")
private Long id;

@ExcelProperty("项目名称")
private String projectName;

@ExcelProperty("行政区划编码")
private String areaCode;

@ExcelProperty("行政区划名称")
private String area;

@ExcelProperty("项目负责人")
private String responsibleMan;

@ExcelProperty("项目负责人手机号")
private String responsibleManMobile;

@ExcelProperty("项目联系人")
private String contactName;

@ExcelProperty("项目联系人手机号")
private String contactPhone;

@ExcelProperty("上级业务主管单位")
private String higherSuperUnit;

@ExcelProperty("上级主管单位浙政钉ID")
private Boolean higherSuperUnitCode;

@ExcelProperty("本级主管部门")
private Boolean superUnit;

@ExcelProperty("本级主管部门浙政钉ID")
private Boolean superUnitCode;

@ExcelProperty("建设单位名称")
private Boolean constructionUnitName;

@ExcelProperty("建设单位浙政钉ID")
private Boolean buildUnitZheJiangGovernmentDingId;

@ExcelProperty("建设单位统一信用代码")
private Boolean buildUnitCode;

@ExcelProperty("项目类型")
private Boolean projectType;

@ExcelProperty("是否首次新建")
private Boolean isFirst;

@ExcelProperty("关联应用")
private Boolean includeApplication;

@ExcelProperty("关联应用IRS编码")
private Boolean includeApplicationIRSCode;

@ExcelProperty("申报金额(万元)")
private Boolean declareAmount;

@ExcelProperty("批复金额")
private Boolean approvedTotalInvestmentIncrease;

@ExcelProperty("预算来源")
private Boolean budgetSource;

@ExcelProperty("预算年度")
private Boolean budgetYear;

@ExcelProperty("项目简介")
private Boolean projectIntroduction;

@ExcelProperty("立项依据")
private Boolean buildBasis;

@ExcelProperty("建设层级")
private Boolean buildLevel;

@ExcelProperty("发改编码")
private Boolean developCode;

@ExcelProperty("财政编码")
private Boolean financialCode;

@ExcelProperty("信息是否有效")
private Boolean informationValidity;

@ExcelProperty("是否数字化改革项目")
private Boolean isDigitalReform;

@ExcelProperty("综合应用领域")
private Boolean bizDomain;

@ExcelProperty("是否上云")
private Boolean isCloud;

@ExcelProperty("云类型")
private Boolean cloudType;

@ExcelProperty("四大体系")
private Boolean fourSystems;

@ExcelProperty("是否临时增补")
private Boolean isTemporaryAugment;

@ExcelProperty("等保级别")
private Boolean protectionLevel;

@ExcelProperty("是否密评 0:否 1:是")
private Boolean isSecretComments;

@ExcelProperty("业务编号")
private Boolean businessNumber;

@ExcelProperty("业务名称")
private Boolean businessName;

@ExcelProperty("单位名称")
private Boolean unitName;

@ExcelProperty("软件开发(万元)")
private Boolean softwareDevelopmentAmount;

@ExcelProperty("云资源、硬件购置(万元)")
private Boolean cloudHardwarePurchaseAmount;

@ExcelProperty("第三方服务(万元)")
private Boolean thirdPartyAmount;

@ExcelProperty("投入项")
private Boolean safetyInputTitle;

@ExcelProperty("内容描述")
private Boolean safetyInputDescribe;

@ExcelProperty("金额(万元)")
private Boolean safetyInputAmount;

@ExcelProperty("年度支付金额(万元)")
private Boolean annualPlanAmount;

@ExcelProperty("自有资金(万元)")
private Boolean annualPlanHaveAmount;

@ExcelProperty("政府投资-本级财政资金(万元)")
private Boolean declareGovernmentOwnFinanceAmount;

@ExcelProperty("政府投资-上级补助资金(万元)")
private Boolean declareGovernmentSuperiorFinanceAmount;

@ExcelProperty("银行贷款(万元)")
private Boolean declareBankLendingAmount;

@ExcelProperty("其它资金(万元)")
private Boolean declareOtherAmount;

@ExcelProperty("第一季度")
private Boolean engineeringSpeedOne;

@ExcelProperty("第二季度")
private Boolean engineeringSpeedTwo;

@ExcelProperty("第三季度")
private Boolean engineeringSpeedThree;

@ExcelProperty("第四季度")
private Boolean engineeringSpeedFour;

@ExcelProperty("初步方案")
private Boolean preliminaryPlanFile;

@ExcelProperty("附件-佐证材料")
private Boolean supportingMaterialsFile;

@ExcelProperty("备注")
private Boolean projectRemarks;
}

+ 65
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportWriter.java View File

@@ -0,0 +1,65 @@
package com.ningdatech.pmapi.common.model.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Collection;
import java.util.List;


/**
* 文件模板导出对象
* @author CMM
* @since 2023/02/11 11:26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExcelExportWriter {
/**
* 文件名称
*/
private String fileName;

/**
* sheet 名称数组
*/
private List<String> sheets;

/**
* 是否启用 头部Excel属性。
* 如果使用,则会读取 class对象注解 ExcelProperty 属性值。
* 不启用:则会根据heads 动态对列名称去便利
*/
private Boolean headPropertyFlag;

/**
* 头部属性class
*/
private Class headPropertyClass;

/**
* 动态列名称
* 描述:
* 第一个List 代表:sheet 列表集合
* 第二个List 代表:表体行数据(集合)
* 第三个list 代表:表体列数据(集合)
*/
private List<List<List<String>>> heads;


/**
* 数据对象
* 1、对象写:根据对象固定字段写(分为三层)
* 第二个List 代表:表体行数据(集合)
* 第三个对象(class) 对象
* List<ActivityUserPrizeVO>
*
* 2、无对象写(动态表体数据) 分为三层
* 第一个List 代表:表体行数据(集合)
* 第二个list 代表:表体列数据(集合)
* List<List<Object>>
*/
private Collection<?> datas;
}

+ 67
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -2,11 +2,21 @@ package com.ningdatech.pmapi.common.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
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 org.apache.commons.collections4.CollectionUtils;
import org.apache.http.HttpStatus;

import com.alibaba.fastjson.JSON;
@@ -68,4 +78,61 @@ public class ExcelDownUtil {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}

public static void excelExportFile(HttpServletResponse response, ExcelExportWriter excelExport) {
try {
if (Objects.isNull(excelExport)) {
throw new BizException("导出失败!");
}
setExportResponseHeader(excelExport.getFileName(), response);

ExcelWriter writer = null;
//是否启用头部属性、头部属性类不能为空
if (Objects.nonNull(excelExport.getHeadPropertyFlag()) && excelExport.getHeadPropertyFlag() && Objects.nonNull(excelExport.getHeadPropertyClass())) {
writer = EasyExcel.write(response.getOutputStream(), excelExport.getHeadPropertyClass()).build();
}else {
writer = EasyExcel.write(response.getOutputStream()).build();
}

int sheetNum = 0;
if (CollectionUtils.isNotEmpty(excelExport.getSheets())){
sheetNum = excelExport.getSheets().size();
}else if (CollectionUtils.isNotEmpty(excelExport.getHeads())) {
sheetNum = excelExport.getHeads().size();
}else if (CollectionUtils.isNotEmpty(excelExport.getDatas())) {
sheetNum = excelExport.getDatas().size();
}

if (sheetNum == 0){
sheetNum = 1;
}

for (int i = 0; i < sheetNum; i++) {
WriteSheet sheet = EasyExcel.writerSheet(i).build();
if (CollectionUtils.isNotEmpty(excelExport.getSheets())){
sheet.setSheetName(excelExport.getSheets().get(i));
}
if (CollectionUtils.isNotEmpty(excelExport.getHeads())){
sheet.setHead(excelExport.getHeads().get(i));
}

if (CollectionUtils.isNotEmpty(excelExport.getDatas())) {
writer.write((Collection<?>) ((List)excelExport.getDatas()).get(i), sheet);
}else {
writer.write((Collection<?>) null, sheet);
}
}
// 最后 finish
if (null != writer) {
writer.finish();
}
}catch (Exception e){
log.error("export file error!", e);
throw new BizException("导出失败!");
}
}
public static void setExportResponseHeader(String fileName, HttpServletResponse response) throws UnsupportedEncodingException {
// 设置响应头和保存文件名
response.setContentType(StrPool.CONTENT_TYPE);
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}
}

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

@@ -2,12 +2,15 @@ package com.ningdatech.pmapi.projectlib.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.req.ProjectLibListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@@ -33,4 +36,10 @@ public class ProjectLibController {
return projectLibManage.projectLibList(req);
}

@GetMapping("/getProjectInfo")
@ApiOperation("获取申报项目信息")
private Project getProjectInfo (@Validated @ModelAttribute String processInstanceId){
return projectLibManage.getProjectInfo(processInstanceId);
}

}

+ 13
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -80,4 +80,17 @@ public class ProjectLibManage {
return PageVo.of(records, total);
}

/**
*
* @param instanceCode 申报项目流程实例编号
* @return com.ningdatech.pmapi.projectlib.model.entity.Project
* @author CMM
* @since 2023/02/11 11:15
*/
public Project getProjectInfo(String instanceCode) {
// 查询项目申报信息
Project projectInfo = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, instanceCode));
return projectInfo;
}
}

+ 197
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java View File

@@ -0,0 +1,197 @@
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 name;

@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 higherSuperUnit;

@ApiModelProperty("上级主管单位浙政钉ID")
private Boolean higherSuperUnitCode;

@ApiModelProperty("本级主管部门")
private Boolean superUnit;

@ApiModelProperty("本级主管部门浙政钉ID")
private Boolean superUnitCode;

@ApiModelProperty("建设单位名称")
private Boolean constructionUnitName;

@ApiModelProperty("建设单位浙政钉ID")
private Boolean buildUnitZheJiangGovernmentDingId;

@ApiModelProperty("建设单位统一信用代码")
private Boolean buildUnitCode;

@ApiModelProperty("项目类型")
private Boolean projectType;

@ApiModelProperty("是否首次新建")
private Boolean isFirst;

@ApiModelProperty("关联应用")
private Boolean includeApplication;

@ApiModelProperty("关联应用IRS编码")
private Boolean includeApplicationIRSCode;

@ApiModelProperty("申报金额(万元)")
private Boolean declareAmount;

@ApiModelProperty("批复金额")
private Boolean approvedTotalInvestmentIncrease;

@ApiModelProperty("预算来源")
private Boolean budgetSource;

@ApiModelProperty("预算年度")
private Boolean budgetYear;

@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 unitName;

@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 declareGovernmentOwnFinanceAmount;

@ApiModelProperty("政府投资-上级补助资金(万元)")
private Boolean declareGovernmentSuperiorFinanceAmount;

@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;
}

+ 0
- 4
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java View File

@@ -75,8 +75,4 @@ public class ProcessProgressDetailVo {
* 发起时间
*/
private Date startTime;
/**
* 项目申报信息
*/
private Project declaredProjectInfo;
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java View File

@@ -56,7 +56,8 @@ public class TodoCenterController {
*/
@GetMapping("/exportPending")
public void exportPendingProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){
ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportPendingProjectList);
todoCenterManage.exportPendingProjectList(response,param);
// ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportPendingProjectList);
}

/**


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

@@ -19,12 +19,15 @@ 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.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;
@@ -58,10 +61,8 @@ import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.process.props.ApprovalProps;
import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.bean.vo.TaskCommentVo;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.service.FormService;
@@ -69,7 +70,6 @@ import com.wflow.workflow.service.*;
import com.wflow.workflow.utils.Executor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.statement.select.Distinct;
import org.assertj.core.util.Maps;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
@@ -86,7 +86,6 @@ import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.flowable.variable.api.history.NativeHistoricVariableInstanceQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@@ -222,25 +221,54 @@ public class TodoCenterManage {
* @since 2023/02/01 17:44
*/
public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) {
PageVo<ResToBeProcessedDTO> page = queryPendingProjectList(param);
List<ResToBeProcessedDTO> collect = (List<ResToBeProcessedDTO>) page.getRecords();

Page<Project> page = param.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildUnitName,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<Project> records = page.getRecords();

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

String fileName = null;
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_待我处理_增补项目列表";
}else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_待我处理_非增补项目列表";
}
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ResToBeExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new BizException("导出失败!");
}
excelExportWriter.setFileName(fileName);

List<String> sheetsName = new ArrayList<>();
sheetsName.add("sheet1");
// 表体列数据集合
List<String> columnList = new ArrayList<>();
// 表体行数据集合
List<List<String>> rowList = new ArrayList<>();
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
ExportOption exportOption = param.getExportOption();

excelExportWriter.setHeads(sheets);

List<ExcelExportDTO> data = records.stream().map(r -> {
ExcelExportDTO res = new ExcelExportDTO();
BeanUtils.copyProperties(r, res);
return res;
}).collect(Collectors.toList());

excelExportWriter.setDatas(data);
excelExportWriter.setSheets(sheetsName);
excelExportWriter.setHeadPropertyClass(ExcelExportDTO.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);


ExcelDownUtil.excelExportFile(response,excelExportWriter);
}
/**
* 流程处理相关操作
@@ -775,10 +803,6 @@ public class TodoCenterManage {
} else if (HisProInsEndActId.END.equals(instance.getEndActivityId())) {
res.setStatus(ProcessStatusEnum.APPROVED.name());
}
// 查询项目申报信息
Project projectInfo = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, instanceId));
res.setDeclaredProjectInfo(projectInfo);
return res;
}



+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java View File

@@ -1,10 +1,16 @@
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 io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -43,5 +49,7 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable {
@NotNull(message = "是否增补字段不能为空!")
private Integer isSupplement;

@ApiModelProperty("导出选项")
private ExportOption exportOption;

}

+ 0
- 42
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeExportDTO.java View File

@@ -1,42 +0,0 @@
package com.ningdatech.pmapi.todocenter.model.dto.res;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 待办中心待我处理项目列表导出实体
*
* @author CMM
* @since 2023/01/19 16:42
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResToBeExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ExcelProperty("项目名称")
private String projectName;

@ExcelProperty("申报单位")
private String buildUnitName;

@ExcelProperty("申报金额")
private Integer declareAmount;

@ExcelProperty("预算年度")
private Integer projectYear;

@ExcelProperty("流程状态")
private String processStatusName;

@ExcelProperty("发起时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime processLaunchTime;
}

Loading…
Cancel
Save