1.excel台账导入
2.pom文件添加 3.添加knife4j 4.添加日志
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.njcn.jbsyncdata.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic10Excel;
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic380Excel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 15:28
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "冀北数据管理")
|
||||
@RequestMapping("/dataImport")
|
||||
@RequiredArgsConstructor
|
||||
public class DisPhotovoltaicController {
|
||||
|
||||
@ApiOperation(value = "获取10kv分布式光伏接入情况")
|
||||
@PostMapping("/import10")
|
||||
public void importTakeOrder(MultipartFile file) throws Exception {
|
||||
List<DisPhotovoltaic10Excel> list = EasyExcel.read(file.getInputStream())
|
||||
.head(DisPhotovoltaic10Excel.class)
|
||||
.headRowNumber(2)
|
||||
.sheet(2).doReadSync();
|
||||
|
||||
System.out.println();
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取380kv分布式光伏接入情况")
|
||||
@PostMapping("/import380")
|
||||
public void import380(MultipartFile file) throws Exception {
|
||||
List<DisPhotovoltaic380Excel> list = EasyExcel.read(file.getInputStream())
|
||||
.head(DisPhotovoltaic380Excel.class)
|
||||
.headRowNumber(2)
|
||||
.sheet(3).doReadSync();
|
||||
|
||||
System.out.println();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.jbsyncdata.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "首页模块")
|
||||
@RestController
|
||||
public class IndexController {
|
||||
|
||||
@ApiImplicitParam(name = "name",value = "姓名",required = true)
|
||||
@ApiOperation(value = "向客人问好")
|
||||
@GetMapping("/sayHi")
|
||||
public ResponseEntity<String> sayHi(@RequestParam(value = "name")String name){
|
||||
return ResponseEntity.ok("Hi:"+name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 15:28
|
||||
*/
|
||||
@Data
|
||||
public class DisPhotovoltaic10Excel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "市单位")
|
||||
private String orgName;
|
||||
|
||||
@ExcelProperty(value = "区县")
|
||||
private String county;
|
||||
|
||||
@ExcelProperty(value = "供电所")
|
||||
private String powerSupply;
|
||||
|
||||
@ExcelProperty(value = "发电客户编号")
|
||||
private String generationUserID;
|
||||
|
||||
@ExcelProperty(value = "发电客户名称")
|
||||
private String generationUserName;
|
||||
|
||||
@ExcelProperty(value = "并网时间")
|
||||
private String connectionDate;
|
||||
|
||||
@ExcelProperty(value = "电压等级")
|
||||
private String Voltage_Level;
|
||||
|
||||
@ExcelProperty(value = "发电客户地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty(value = "发电客户类型")
|
||||
private String generationUserType;
|
||||
|
||||
@ExcelProperty(value = "消纳方式")
|
||||
private String wayConsumption;
|
||||
|
||||
@ExcelProperty(value = "合同容量")
|
||||
private BigDecimal contractCapacity;
|
||||
|
||||
@ExcelProperty(value = "行业类别")
|
||||
private String industryType;
|
||||
|
||||
@ExcelProperty(value = "台区编号")
|
||||
private String stageID;
|
||||
|
||||
@ExcelProperty(value = "台区名称")
|
||||
private String stageName;
|
||||
|
||||
@ExcelProperty(value = "PMS系统线路编号")
|
||||
private String lineID;
|
||||
|
||||
@ExcelProperty(value = "线路名称")
|
||||
private String lineName;
|
||||
|
||||
@ExcelProperty(value = "公线/专线")
|
||||
private String lineType;
|
||||
|
||||
@ExcelProperty(value = "运行状态")
|
||||
private String comFlag;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 15:28
|
||||
*/
|
||||
@Data
|
||||
public class DisPhotovoltaic380Excel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "市单位")
|
||||
private String orgName;
|
||||
|
||||
@ExcelProperty(value = "区县")
|
||||
private String county;
|
||||
|
||||
@ExcelProperty(value = "供电所")
|
||||
private String powerSupply;
|
||||
|
||||
@ExcelProperty(value = "发电客户编号")
|
||||
private String generationUserID;
|
||||
|
||||
@ExcelProperty(value = "发电客户名称")
|
||||
private String generationUserName;
|
||||
|
||||
@ExcelProperty(value = "并网时间")
|
||||
private String connectionDate;
|
||||
|
||||
|
||||
|
||||
@ExcelProperty(value = "发电客户地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty(value = "发电客户类型")
|
||||
private String generationUserType;
|
||||
|
||||
@ExcelProperty(value = "消纳方式")
|
||||
private String wayConsumption;
|
||||
|
||||
@ExcelProperty(value = "合同容量")
|
||||
private BigDecimal contractCapacity;
|
||||
|
||||
@ExcelProperty(value = "电压等级")
|
||||
private String Voltage_Level;
|
||||
|
||||
@ExcelProperty(value = "行业类别")
|
||||
private String industryType;
|
||||
|
||||
@ExcelProperty(value = "台区编号")
|
||||
private String stageID;
|
||||
|
||||
@ExcelProperty(value = "台区名称")
|
||||
private String stageName;
|
||||
|
||||
@ExcelProperty(value = "变压器PMSID")
|
||||
private String transformerPMSID;
|
||||
|
||||
@ExcelProperty(value = "是否已配置配变融合终端")
|
||||
private String isFusionTerminal;
|
||||
|
||||
@ExcelProperty(value = "是否安装反孤岛保护")
|
||||
private String isAntiarc;
|
||||
|
||||
@ExcelProperty(value = "所属线路PMS编号")
|
||||
private String lineID;
|
||||
|
||||
@ExcelProperty(value = "所属线路PMS名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.jbsyncdata.service;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 16:09
|
||||
*/
|
||||
public class DisPhotovoltaicService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.jbsyncdata.service.impl;
|
||||
|
||||
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 16:10
|
||||
*/
|
||||
public class DisPhotovoltaicServiceImpl extends DisPhotovoltaicService {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.jbsyncdata.util;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
|
||||
|
||||
@Configuration
|
||||
@EnableSwagger2WebMvc
|
||||
public class Knife4jConfiguration {
|
||||
|
||||
@Bean(value = "defaultApi2")
|
||||
public Docket defaultApi2() {
|
||||
Docket docket=new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
.title("冀北数据同步API接口文档")
|
||||
.description("冀北数据同步API")
|
||||
.termsOfServiceUrl("http://www.xx.com/")
|
||||
.version("1.0")
|
||||
.build())
|
||||
//分组名称
|
||||
.groupName("2.X版本")
|
||||
.select()
|
||||
//这里指定Controller扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("com.njcn.jbsyncdata.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
return docket;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user