Browse Source

项目列表导出

master
CMM 1 year ago
parent
commit
662cd3e35e
6 changed files with 86 additions and 101 deletions
  1. +42
    -60
      pmapi/src/main/java/com/ningdatech/pmapi/common/model/entity/ExcelExportDTO.java
  2. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java
  3. +16
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/entity/ExportOption.java
  4. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  5. +23
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java

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

@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
* 待办中心待我处理项目列表导出实体
@@ -20,25 +21,6 @@ import java.io.Serializable;
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;

@@ -91,128 +73,128 @@ public class ExcelExportDTO implements Serializable {
private Integer isFirst;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -16,6 +16,7 @@ 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;

@@ -135,4 +136,5 @@ public class ExcelDownUtil {
response.setContentType(StrPool.CONTENT_TYPE);
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + encodeName(fileName) + ".xls");
}

}

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

@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;



/**
* 导出选项实体类
*
@@ -22,7 +24,7 @@ public class ExportOption {
private Boolean id;

@ApiModelProperty("项目名称")
private Boolean name;
private Boolean projectName;

@ApiModelProperty("行政区划编码")
private Boolean areaCode;
@@ -43,25 +45,25 @@ public class ExportOption {
private Boolean contactPhone;

@ApiModelProperty("上级业务主管单位")
private Boolean higherSuperUnit;
private Boolean higherSuperOrg;

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

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

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

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

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

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

@ApiModelProperty("项目类型")
private Boolean projectType;
@@ -70,10 +72,10 @@ public class ExportOption {
private Boolean isFirst;

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

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

@ApiModelProperty("申报金额(万元)")
private Boolean declareAmount;
@@ -85,7 +87,7 @@ public class ExportOption {
private Boolean budgetSource;

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

@ApiModelProperty("项目简介")
private Boolean projectIntroduction;
@@ -136,7 +138,7 @@ public class ExportOption {
private Boolean businessName;

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

@ApiModelProperty("软件开发(万元)")
private Boolean softwareDevelopmentAmount;
@@ -163,10 +165,10 @@ public class ExportOption {
private Boolean annualPlanHaveAmount;

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

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

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


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

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


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

@@ -4,7 +4,9 @@ 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;
import com.alibaba.xxpt.gateway.shared.api.response.OapiMessageWorkNotificationResponse;
@@ -221,8 +223,6 @@ public class TodoCenterManage {
* @since 2023/02/01 17:44
*/
public void exportPendingProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) {

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::getBuildOrgName,param.getBuildUnitName())
@@ -230,9 +230,7 @@ public class TodoCenterManage {
.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();
List<Project> records = projectService.list(wrapper);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -244,31 +242,32 @@ public class TodoCenterManage {
}
excelExportWriter.setFileName(fileName);

List<String> sheetsName = new ArrayList<>();
sheetsName.add("sheet1");
List<String> sheetsNames = new ArrayList<>();
sheetsNames.add(fileName);

// 表体列数据集合
List<String> columnList = new ArrayList<>();
List<List<String>> columnList = new ArrayList<>();

// 表体行数据集合
List<List<String>> rowList = new ArrayList<>();
List<String> rowList = param.getExportOptionList();
records.stream().forEach(record -> {
List<String> rowValues = new ArrayList<>();
rowList.stream().forEach(c -> {
String s = JSON.toJSONString(record);
JSONObject jsonObject = JSON.parseObject(s);
String rowValue = String.valueOf(jsonObject.get(c));
rowValues.add(rowValue);
});
columnList.add(rowValues);
});
// sheet列表集合
List<List<List<String>>> sheets = new ArrayList<>();
ExportOption exportOption = param.getExportOption();


sheets.add(columnList);
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.setDatas(columnList);
excelExportWriter.setSheets(sheetsNames);
excelExportWriter.setHeadPropertyClass(List.class);
excelExportWriter.setHeadPropertyFlag(Boolean.FALSE);


ExcelDownUtil.excelExportFile(response,excelExportWriter);
}
/**


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

@@ -50,6 +50,6 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable {
private Integer isSupplement;

@ApiModelProperty("导出选项")
private ExportOption exportOption;
private List<String> exportOptionList;

}

Loading…
Cancel
Save