Ver código fonte

年度计划导入

tags/24080901
WendyYang 1 ano atrás
pai
commit
6def1d850b
3 arquivos alterados com 132 adições e 0 exclusões
  1. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java
  2. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  3. +108
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java Ver arquivo

@@ -12,6 +12,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

@@ -58,4 +59,11 @@ public class AnnualPlanController {
annualPlanLibManage.suspendAnnualPlan(req);
}

@PostMapping("/importAnnualPlan")
@ApiOperation("导入年度计划")
@WebLog("导入年度计划")
public void importAnnualPlan(MultipartFile file) {
annualPlanLibManage.importAnnualPlan(file);
}

}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java Ver arquivo

@@ -1,5 +1,8 @@
package com.ningdatech.pmapi.projectlib.manage;

import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -21,10 +24,14 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*;

@@ -129,4 +136,13 @@ public class AnnualPlanLibManage {
stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND);
}

@Transactional(rollbackFor = Exception.class)
public void importAnnualPlan(MultipartFile file) {
try (InputStream inputStream = file.getInputStream()) {
EasyExcel.read(inputStream).sheet(0);
} catch (IOException e) {
throw BizException.wrap("导入年度计划失败");
}
}

}

+ 108
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java Ver arquivo

@@ -0,0 +1,108 @@
package com.ningdatech.pmapi.projectlib.model.dto;

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

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
* <p>
* AnnualLibImportDTO
* </p>
*
* @author WendyYang
* @since 13:46 2023/2/13
*/
@Data
public class AnnualLibImportDTO {

@ExcelProperty("序号")
@NotNull(message = "序号不能为空")
private Integer serialNumber;

@ExcelProperty("项目id")
@NotNull(message = "项目ID不能为空")
private Long projectId;

@ExcelProperty("项目名称")
@NotBlank(message = "项目名称不能为空")
private String projectName;

@NotBlank(message = "建设内容不能为空")
@ExcelProperty("建设内容")
private String projectIntroduction;

@NotBlank(message = "建设依据不能为空")
@ExcelProperty("建设依据")
private String buildBasis;

@ExcelProperty("建设性质")
@NotBlank(message = "建设性质不能为空")
private String isFirst;

@ExcelProperty("建设起止年限")
@NotBlank(message = "建设起止年限不能为空")
private String buildCycle;

@NotBlank(message = "总投资不能为空")
@ExcelProperty("总投资")
private BigDecimal declaredAmount;

@NotNull(message = "年度投资额不能为空")
@ExcelProperty("年度投资额")
private BigDecimal annualPlanAMount;

@ExcelProperty("自有资金")
@NotNull(message = "自由资金不能为空")
private BigDecimal declareHaveAmount;

@ExcelProperty("政府投资-本级财政")
@NotNull(message = "政府投资-本级财政不能为空")
private BigDecimal declareGovOwnFinanceAmount;

@ExcelProperty("政府投资-上级补")
@NotNull(message = "政府投资-上级补不能为空")
private BigDecimal declareGovSuperiorFinanceAmount;

@ExcelProperty("银行贷款")
@NotNull(message = "银行贷款不能为空")
private BigDecimal declareBankLendingAmount;

@ExcelProperty("其他")
@NotNull(message = "其他不能为空")
private BigDecimal declareOtherAmount;

@ExcelProperty("一季度")
@NotBlank(message = "一季度不能为空")
private String engineeringSpeedOne;

@ExcelProperty("二季度")
@NotBlank(message = "二季度不能为空")
private String engineeringSpeedTwo;

@ExcelProperty("三季度")
@NotBlank(message = "三季度不能为空")
private String engineeringSpeedThree;

@ExcelProperty("四季度")
@NotBlank(message = "四季度不能为空")
private String engineeringSpeedFour;

@ExcelProperty("建设单位")
@NotBlank(message = "建设单位不能为空")
private String buildUnitName;

@ExcelProperty("项目联系人")
@NotBlank(message = "项目联系人不能为空")
private String contactName;

@ExcelProperty("项目分管领导")
@NotBlank(message = "项目分管领导不能为空")
private String responsibleMan;

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

}

Carregando…
Cancelar
Salvar