Browse Source

项目申报相关导出

tags/24080901
CMM 1 year ago
parent
commit
90a872d7dc
13 changed files with 449 additions and 0 deletions
  1. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java
  2. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  3. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
  4. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java
  5. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  6. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  7. +58
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  8. +64
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java
  9. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ConstructionPlanExportDTO.java
  10. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java
  11. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PretrialDeclaredExportDTO.java
  12. +46
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java
  13. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java View File

@@ -1,9 +1,11 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq;
import com.ningdatech.pmapi.projectdeclared.manage.ConstructionPlanManage;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
@@ -16,6 +18,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname ConstructionPlanController
* @Description 建设方案申报
@@ -44,4 +48,10 @@ public class ConstructionPlanController {
String instanceId = constructionPlanManage.startTheProcess(dto);
return "建设方案申报 【" + instanceId + "】 成功";
}

@GetMapping("/export")
@ApiOperation("可申报建设方案项目列表导出")
public void exportList(ConstrctionPlanListReq planReq, HttpServletResponse response){
ExcelDownUtil.downXls(response,planReq,constructionPlanManage::exportList);
}
}

+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectdeclared.controller;

import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
@@ -9,6 +10,7 @@ import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -17,6 +19,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname DeclaredProjectController
* @Description 申报项目
@@ -68,4 +72,10 @@ public class DeclaredProjectController {
String instanceId = declaredProjectManage.startTheProcess(dto);
return "启动流程实例 【" + instanceId + "】 成功";
}

@GetMapping("/export")
@ApiOperation("申报项目列表导出")
public void exportList(ProjectListReq req, HttpServletResponse response){
ExcelDownUtil.downXls(response,req,declaredProjectManage::exportList);
}
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage;
@@ -16,6 +17,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname PrequalificationDeclaredController
* @Description 预审申报
@@ -43,4 +46,10 @@ public class PrequalificationDeclaredController {
public String startTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) {
return prequalificationDeclaredProjectManage.startTheProcess(dto);
}

@GetMapping("/export")
@ApiOperation("可预审申报项目列表导出")
public void exportList(PrequalificationDeclaredListReq preReq, HttpServletResponse response){
ExcelDownUtil.downXls(response,preReq,prequalificationDeclaredProjectManage::exportList);
}
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ProjectAdjustmentController.java View File

@@ -1,10 +1,12 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq;
import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -13,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

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

/**
@@ -43,4 +46,10 @@ public class ProjectAdjustmentController {
String instanceId = projectAdjustmentManage.adjustment(dto);
return "项目内容调整并且重新申报 【" + instanceId + "】 成功";
}

@GetMapping("/export")
@ApiOperation("项目内容调整列表导出")
public void exportList(AdjustmentListReq preReq, HttpServletResponse response){
ExcelDownUtil.downXls(response,preReq,projectAdjustmentManage::exportList);
}
}

+ 59
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -1,18 +1,29 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
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.projectdeclared.model.dto.ConstructionPlanExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PretrialDeclaredExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.ConstrctionPlanListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -37,10 +48,14 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname DeclaredProjectManage
@@ -176,4 +191,48 @@ public class ConstructionPlanManage {
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}

public void exportList(HttpServletResponse response, ConstrctionPlanListReq planReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(planReq,req);
//项目阶段 状态 已定 方案待申报
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode());
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
req.setPageSize(CommonConst.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
Page<Project> page = projectService.page(req.page(), query);
List<Project> records = page.getRecords();


List<ConstructionPlanExportDTO> collect = records.stream().map(r -> {
ConstructionPlanExportDTO exportDTO = new ConstructionPlanExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
return exportDTO;
}).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
collect.get(i).setSerialNumber(i + 1);
}
String fileName = "建设方案申报项目列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ConstructionPlanExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

+ 52
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -8,22 +9,31 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.projectdeclared.model.dto.*;
import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectRenewalExportDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
@@ -49,6 +59,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -349,4 +361,44 @@ public class DeclaredProjectManage {
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectlibManager.projectLibList(req);
}

public void exportList(HttpServletResponse response, ProjectListReq param) {
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
param.setBuildOrgCode(userFullInfo.getOrganizationCode());
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE);

LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
Page<Project> page = projectService.page(param.page(), query);
List<Project> records = page.getRecords();


List<DeclaredProjectExportDTO> collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
return exportDTO;
}).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
collect.get(i).setSerialNumber(i + 1);
}
String fileName = "项目申报列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

+ 58
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java View File

@@ -1,17 +1,28 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
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.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PretrialDeclaredExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -35,10 +46,14 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname ProqualificationDeclaredProjectManage
@@ -202,4 +217,47 @@ public class PrequalificationDeclaredProjectManage {
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}

public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) {
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 待预审
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
req.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode());
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
req.setPageSize(CommonConst.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
Page<Project> page = projectService.page(req.page(), query);
List<Project> records = page.getRecords();


List<PretrialDeclaredExportDTO> collect = records.stream().map(r -> {
PretrialDeclaredExportDTO exportDTO = new PretrialDeclaredExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
return exportDTO;
}).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
collect.get(i).setSerialNumber(i + 1);
}
String fileName = "预审申报项目列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), PretrialDeclaredExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

+ 64
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java View File

@@ -1,14 +1,25 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectAdjustmentExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq;
import com.ningdatech.pmapi.projectdeclared.utils.ReStartProcessMapUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
@@ -26,6 +37,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
@@ -131,4 +144,55 @@ public class ProjectAdjustmentManage {
req.setBuildOrgCode(userFullInfo.getOrganizationCode());
return projectLibManage.projectLibList(req);
}

public void exportList(HttpServletResponse response, AdjustmentListReq preReq) {
//限定参数 复制bean
ProjectListReq req = new ProjectListReq();
BeanUtils.copyProperties(preReq,req);
//项目阶段 状态 已定 方案待申报
req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode()));
//只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态
req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(),
ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(),
ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(),
ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()));
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
//放入用户的单位
req.setBuildOrgCode(userFullInfo.getOrganizationCode());

LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
Page<Project> page = projectService.page(req.page(), query);

req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
req.setPageSize(CommonConst.EXPORT_PAGE_SIZE);
List<Project> records = page.getRecords();


List<ProjectAdjustmentExportDTO> collect = records.stream().map(r -> {
ProjectAdjustmentExportDTO exportDTO = new ProjectAdjustmentExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
return exportDTO;
}).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
collect.get(i).setSerialNumber(i + 1);
}
String fileName = "项目内容调整列表";
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ConstructionPlanExportDTO.java View File

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

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;

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


/**
* 建设方案申报列表导出实体类
*
* @author CMM
* @since 2023/03/10 10:20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ConstructionPlanExportDTO {
@ExcelProperty(value = "序号",index = 0)
private Integer serialNumber;

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

@ExcelProperty("项目类型")
private String projectTypeName;

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

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

@ExcelProperty("创建时间")
private String createOn;

}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/DeclaredProjectExportDTO.java View File

@@ -0,0 +1,45 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;


/**
* 申报项目列表导出实体类
*
* @author CMM
* @since 2023/03/10 10:20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DeclaredProjectExportDTO {
@ExcelProperty(value = "序号",index = 0)
private Integer serialNumber;

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

@ExcelProperty("项目类型")
private String projectTypeName;

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

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

@ExcelProperty("创建时间")
private String createOn;

@ExcelProperty("项目状态")
private String statusName;

}

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PretrialDeclaredExportDTO.java View File

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

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;

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


/**
* 预审申报列表导出实体类
*
* @author CMM
* @since 2023/03/10 10:20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PretrialDeclaredExportDTO {
@ExcelProperty(value = "序号",index = 0)
private Integer serialNumber;

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

@ExcelProperty("项目类型")
private String projectTypeName;

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

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

@ExcelProperty("创建时间")
private String createOn;

}

+ 46
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/ProjectAdjustmentExportDTO.java View File

@@ -0,0 +1,46 @@
package com.ningdatech.pmapi.projectdeclared.model.dto;

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;

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


/**
* 项目内容调整列表导出实体类
*
* @author CMM
* @since 2023/03/10 10:20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProjectAdjustmentExportDTO {
@ExcelProperty(value = "序号",index = 0)
private Integer serialNumber;

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

@ExcelProperty("项目类型")
private String projectTypeName;

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

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

@ExcelProperty("项目状态")
private String statusName;

@ExcelProperty("创建时间")
private String createOn;


}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectStatusChange.java View File

@@ -1,5 +1,7 @@
package com.ningdatech.pmapi.projectlib.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -29,6 +31,7 @@ public class ProjectStatusChange implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("项目ID")


Loading…
Cancel
Save