Explorar el Código

项目库编辑表导出修改

tags/24080901
CMM hace 1 año
padre
commit
b4fa645321
Se han modificado 3 ficheros con 50 adiciones y 60 borrados
  1. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  2. +49
    -60
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  3. BIN
      template/丽水市2023年数字化项目年度计划编辑表.xls

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java Ver fichero

@@ -47,6 +47,7 @@ public interface CommonConst {
String CONTINUED_CONSTRUCTION = "续建";
String MONTH = "月";
String ZHI = "至";
String YEAR = "年";





+ 49
- 60
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Ver fichero

@@ -86,23 +86,10 @@ public class AnnualPlanLibManage {
/**
* 年度计划查询状态
*/
private static final List<ProjectStatusEnum> ANNUAL_PLAN_LIST_STATUS = Arrays.asList(
IN_THE_ANNUAL_PLAN,
SCHEME_UNDER_REVIEW,
SCHEME_REVIEW_FAILED,
TO_BE_APPROVED,
TO_BE_DECLARED,
PLAN_TO_BE_DECLARED,
PENDING_PREQUALIFICATION_CHOICE,
PROJECT_APPROVED,
TO_BE_PURCHASED,
UNDER_CONSTRUCTION,
TO_BE_FINALLY_INSPECTED,
FINAL_ACCEPTANCE_IS_UNDER_REVIEW,
FINAL_ACCEPTANCE_REVIEW_FAILED,
ARCHIVED
);

private static final List<ProjectStatusEnum> ANNUAL_PLAN_LIST_STATUS =
Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED,
PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION,
TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED);

public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
@@ -111,10 +98,10 @@ public class AnnualPlanLibManage {
throw new BizException("请传入是否临时增补标志!");
}
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment);
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByDesc(Project::getAnnualPlanAddTime);
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
//数据权限
// 数据权限
buildProjectLibPermission(query);
Page<Project> page = projectService.page(req.page(), query);
long total;
@@ -162,15 +149,12 @@ public class AnnualPlanLibManage {
public void projectApproved(ProjectApprovedReq req) {
Project project = projectService.getById(req.getProjectId());
stateMachine.pass(project);
LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class)
.set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId())
.set(Project::getBuildCycle, req.getBuildCycle())
LambdaUpdateWrapper<Project> update =
Wrappers.lambdaUpdate(Project.class).set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId()).set(Project::getBuildCycle, req.getBuildCycle())
.set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId())
.set(Project::getApprovalDate, req.getApprovedDate())
.set(Project::getStatus, project.getStatus())
.set(Project::getStage, project.getStage())
.eq(Project::getId, req.getProjectId());
.set(Project::getApprovalDate, req.getApprovedDate()).set(Project::getStatus, project.getStatus())
.set(Project::getStage, project.getStage()).eq(Project::getId, req.getProjectId());
projectService.update(update);
}

@@ -196,7 +180,7 @@ public class AnnualPlanLibManage {
param.setIsTemporaryAugment(isTemporaryAugment);
param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByDesc(Project::getAnnualPlanAddTime);
List<Project> projects = projectService.list(query);

@@ -204,9 +188,9 @@ public class AnnualPlanLibManage {

ProjectLibFlagEnum projectLibFlag = param.getProjectLibFlag();
String fileName = null;
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)){
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)) {
fileName = "年度计划库列表";
}else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)){
} else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)) {
fileName = "年度计划增补库列表";
}
excelExportWriter.setFileName(fileName);
@@ -239,22 +223,22 @@ public class AnnualPlanLibManage {
}
switch (currentUserDataScope.get().getRole()) {
case NORMAL_MEMBER:
//普通用户 只能看到自己单位去申报的
// 普通用户 只能看到自己单位去申报的
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode());
break;
case COMPANY_MANAGER:
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode());
break;
case SUPER_ADMIN:
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员
break;
case REGION_MANAGER:
//区域管理员 看到自己区域的项目
// 区域管理员 看到自己区域的项目
query.eq(Project::getAreaCode, user.getRegionCode());
break;
default:
//没有权限的话 就让它查不到
// 没有权限的话 就让它查不到
query.eq(Project::getId, "NULL");
break;
}
@@ -278,16 +262,15 @@ public class AnnualPlanLibManage {
throw new BizException(e.getMessage());
}
// 筛选出导入的新建项目
List<AnnualLibImportDTO> newList = list.stream()
.filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst()))
.collect(Collectors.toList());
List<AnnualLibImportDTO> newList =
list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList());
List<Project> projectList = newList.stream().map(n -> {
Project project = new Project();
assemblyProjectInfo(n, project);
// 根据传入标志判断是否临时增补
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)){
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)) {
project.setIsTemporaryAugment(CommonEnum.NO.getCode());
}else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)){
} else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)) {
project.setIsTemporaryAugment(CommonEnum.YES.getCode());
}
project.setCreateBy(userId);
@@ -301,8 +284,7 @@ public class AnnualPlanLibManage {

// 筛选出导入的续建项目
List<AnnualLibImportDTO> continuedList = list.stream()
.filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst()))
.collect(Collectors.toList());
.filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList());
List<ProjectRenewalFundDeclaration> renewalFundDeclarationList = continuedList.stream().map(c -> {
ProjectRenewalFundDeclaration renewalFundDeclaration = new ProjectRenewalFundDeclaration();
BeanUtils.copyProperties(c, renewalFundDeclaration);
@@ -324,8 +306,8 @@ public class AnnualPlanLibManage {
// 建设依据忽略
project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0);
String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI);
if (CollectionUtils.isEmpty(Arrays.asList(dataArr))){
throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!");
if (CollectionUtils.isEmpty(Arrays.asList(dataArr))) {
throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!");
}
project.setBeginTime(dataArr[0].trim());
project.setEndTime(dataArr[1].trim());
@@ -352,10 +334,10 @@ public class AnnualPlanLibManage {
Integer isTemporaryAugment = null;
String fileName = null;
// 设置excel的文件名称和是否增补
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)){
if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)) {
isTemporaryAugment = 0;
fileName = "丽水市" + year + "年数字化项目年度计划库编辑表";
}else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)){
} else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)) {
isTemporaryAugment = 1;
fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表";
}
@@ -363,30 +345,32 @@ public class AnnualPlanLibManage {
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment);
query.orderByDesc(Project::getAnnualPlanAddTime);
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode));
//数据权限
// 数据权限
buildProjectLibPermission(query);
List<Project> projects = projectService.list(query);
List<AnnualLibExportDTO> list = projects.stream().map(p -> {
AnnualLibExportDTO dto = new AnnualLibExportDTO();
BeanUtils.copyProperties(p, dto);
String buildCycle = p.getBuildCycle();
if (Objects.nonNull(buildCycle)) {
String cycle = buildCycle.replace(StrPool.TILDA, CommonConst.ZHI);
dto.setBuildCycle(cycle);
}
String beginTime = p.getBeginTime();
String begin = beginTime.replace(StrPool.DASH, CommonConst.YEAR);
begin = begin + CommonConst.MONTH;
String endTime = p.getEndTime();
String end = endTime.replace(StrPool.DASH, CommonConst.YEAR);
end = end + CommonConst.MONTH;
String buildCycle = begin + CommonConst.ZHI + end;
dto.setBuildCycle(buildCycle);
dto.setProjectId(p.getId());
dto.setDeclaredAmount(p.getDeclareAmount());
dto.setBuildUnitName(p.getBuildOrgName());
String buildBasis = p.getBuildBasis();
List<JSONObject> fileArray = JSON.parseArray(buildBasis, JSONObject.class);
List<String> nameList = CollUtils.fieldList(fileArray, w ->
w.getString(CommonConst.TITLE) + StrPool.LEFT_BRACKET +
w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET);
List<String> nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.TITLE)
+ StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET);
String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA));
dto.setBuildBasis(basis);
if (CommonEnum.YES.getCode().equals(p.getIsFirst())){
if (CommonEnum.YES.getCode().equals(p.getIsFirst())) {
dto.setIsFirst(CommonConst.NEW_CONSTRUCTION);
}else if (CommonEnum.NO.getCode().equals(p.getIsFirst())){
} else if (CommonEnum.NO.getCode().equals(p.getIsFirst())) {
dto.setIsFirst(CommonConst.CONTINUED_CONSTRUCTION);
}
dto.setFirstQuarter(p.getEngineeringSpeedOne());
@@ -405,10 +389,14 @@ public class AnnualPlanLibManage {
// 获取本地目录的年度计划编辑表Excel模板
File directory = new File("");
String templateName = "丽水市" + year + "年数字化项目年度计划编辑表";
String templatePath = directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls";
String templatePath =
directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls";
TemplateExportParams temp = new TemplateExportParams(templatePath);
HashMap<String, Object> map = new HashMap<>();
temp.setSheetNum(new Integer[] {0, 1});
temp.setSheetName(new String[] {"实施类(新建)", "实施类(续建)"});
Map<String, Object> map = new HashMap<>(4);
map.put("mapList", list);
map.put("mapList1", null);
Workbook workbook = ExcelExportUtil.exportExcel(temp, map);
if (workbook == null) {
throw new BizException("读取模板失败!");
@@ -416,7 +404,8 @@ public class AnnualPlanLibManage {
// 重置响应对象
response.reset();
try {
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName),"UTF-8") + ".xls");
response.setHeader("Content-disposition",
"attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}


BIN
template/丽水市2023年数字化项目年度计划编辑表.xls Ver fichero


Cargando…
Cancelar
Guardar