Browse Source

增加是否临时增补字段

master
WendyYang 1 year ago
parent
commit
2de8c4f544
2 changed files with 24 additions and 3 deletions
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  2. +22
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/DataScopeEnum.java

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

@@ -145,7 +145,7 @@ public class AnnualPlanLibManage {
try (InputStream inputStream = file.getInputStream()) { try (InputStream inputStream = file.getInputStream()) {
EasyExcel.read(inputStream, new AnalysisEventListener<AnnualLibImportDTO>() { EasyExcel.read(inputStream, new AnalysisEventListener<AnnualLibImportDTO>() {


private List<Project> records = new ArrayList<>();
private final List<Project> records = new ArrayList<>();


@Override @Override
public void onException(Exception exception, AnalysisContext context) throws Exception { public void onException(Exception exception, AnalysisContext context) throws Exception {
@@ -179,7 +179,7 @@ public class AnnualPlanLibManage {
project.setBeginTime(dataArr[0].trim()); project.setBeginTime(dataArr[0].trim());
project.setEndTime(dataArr[1].trim()); project.setEndTime(dataArr[1].trim());
project.setProjectIntroduction(data.getProjectIntroduction()); project.setProjectIntroduction(data.getProjectIntroduction());
project.setIsFirst(data.getIsFirst().equals("新建") ? 1 : 0);
project.setIsFirst("新建".equals(data.getIsFirst()) ? 1 : 0);
records.add(project); records.add(project);
} }




+ 22
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/enumeration/DataScopeEnum.java View File

@@ -2,9 +2,11 @@ package com.ningdatech.pmapi.sys.model.enumeration;


import lombok.Getter; import lombok.Getter;


import java.util.Arrays;

/** /**
* <p> * <p>
* DataScopeEnum
* 数据权限可见范围枚举
* </p> * </p>
* *
* @author WendyYang * @author WendyYang
@@ -28,4 +30,23 @@ public enum DataScopeEnum {
this.code = code; this.code = code;
this.desc = desc; this.desc = desc;
} }

public boolean eq(Integer code) {
return this.code.equals(code);
}

/**
* 根据code获取枚举实例
*
* @param code 编码
* @return {@link DataScopeEnum}
* @author WendyYang
**/
public static DataScopeEnum getByCode(Integer code) {
return Arrays.stream(values())
.filter(w -> w.eq(code))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("无效的数据权限可见范围编码"));
}

} }

Loading…
Cancel
Save