1.台账数据导入
2.pom文件调整
This commit is contained in:
33
pom.xml
33
pom.xml
@@ -156,6 +156,33 @@
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>1.7.3-RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
<!--mysql驱动-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.19</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
@@ -171,6 +198,12 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>influxdb-springboot-starter</artifactId>
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>com.njcn</groupId>-->
|
||||
<!-- <artifactId>common-core</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.jbsyncdata;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
public class JbSyncdataApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -5,22 +5,21 @@ import com.alibaba.excel.EasyExcel;
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic10Excel;
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic380Excel;
|
||||
import com.njcn.jbsyncdata.pojo.ExcelData;
|
||||
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
|
||||
import com.njcn.jbsyncdata.service.IBusinessService;
|
||||
import com.njcn.jbsyncdata.util.StreamUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -36,6 +35,7 @@ import java.util.stream.Collectors;
|
||||
public class DisPhotovoltaicController {
|
||||
|
||||
private final IBusinessService businessService;
|
||||
private final DisPhotovoltaicService disPhotovoltaicService;
|
||||
|
||||
@ApiOperation(value = "获取10kv分布式光伏接入情况")
|
||||
@PostMapping("/import10")
|
||||
@@ -71,7 +71,35 @@ public class DisPhotovoltaicController {
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入10kv分布式光伏接入情况", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@PostMapping("/import10KV")
|
||||
public void import10(MultipartFile file, HttpServletResponse response) throws Exception {
|
||||
List<DisPhotovoltaic10Excel> list = EasyExcel.read(file.getInputStream())
|
||||
.head(DisPhotovoltaic10Excel.class)
|
||||
.headRowNumber(2)
|
||||
.sheet(2).doReadSync();
|
||||
list = list.stream()
|
||||
.filter(t -> StrUtil.isNotBlank(t.getGenerationUserID()))
|
||||
.filter(t -> StrUtil.isNotBlank(t.getStageID()))
|
||||
.filter(StreamUtil.distinctByKey(DisPhotovoltaic10Excel::getGenerationUserID))
|
||||
.collect(Collectors.toList());
|
||||
disPhotovoltaicService.SavaPmsPowerGenerationUser10KV(list, response);
|
||||
|
||||
}
|
||||
@ApiOperation(value = "导入380kv分布式光伏接入情况", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@PostMapping("/import380KV")
|
||||
public void import380KV(MultipartFile file, HttpServletResponse response) throws Exception {
|
||||
List<DisPhotovoltaic380Excel> list = EasyExcel.read(file.getInputStream())
|
||||
.head(DisPhotovoltaic380Excel.class)
|
||||
.headRowNumber(1)
|
||||
.sheet(0).doReadSync();
|
||||
list = list.stream()
|
||||
.filter(t -> StrUtil.isNotBlank(t.getGenerationUserID()))
|
||||
.filter(t -> StrUtil.isNotBlank(t.getStageID()))
|
||||
.filter(StreamUtil.distinctByKey(DisPhotovoltaic380Excel::getGenerationUserID))
|
||||
.collect(Collectors.toList());
|
||||
disPhotovoltaicService.SavaPmsPowerGenerationUser380KV(list, response);
|
||||
System.out.println();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
24
src/main/java/com/njcn/jbsyncdata/mapper/DictDataMapper.java
Normal file
24
src/main/java/com/njcn/jbsyncdata/mapper/DictDataMapper.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.njcn.jbsyncdata.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.jbsyncdata.pojo.Dept;
|
||||
import com.njcn.jbsyncdata.pojo.DictData;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
public interface DictDataMapper extends BaseMapper<DictData> {
|
||||
|
||||
List<DictData> selectList(@Param("code") String code);
|
||||
DictData selectByCode(@Param("dataCode") String dataCode,@Param("typeCode") String typeCode);
|
||||
List<Dept> selectUserList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.jbsyncdata.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发电用户台账 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-09
|
||||
*/
|
||||
public interface PmsPowerGenerationUserMapper extends MppBaseMapper<PmsPowerGenerationUser> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.jbsyncdata.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.jbsyncdata.pojo.PmsStatationStat;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-10
|
||||
*/
|
||||
public interface PmsStatationStatMapper extends MppBaseMapper<PmsStatationStat> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.jbsyncdata.mapper.DictDataMapper">
|
||||
|
||||
|
||||
<select id="selectList" resultType="com.njcn.jbsyncdata.pojo.DictData">
|
||||
SELECT sys_dict_data.*
|
||||
FROM sys_dict_data sys_dict_data,
|
||||
sys_dict_type sys_dict_type
|
||||
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||
AND sys_dict_type.code = #{code}
|
||||
|
||||
order by sort
|
||||
</select>
|
||||
<select id="selectUserList" resultType="com.njcn.jbsyncdata.pojo.Dept">
|
||||
select * from sys_dept where state = 1 order by sort
|
||||
</select>
|
||||
<select id="selectByCode" resultType="com.njcn.jbsyncdata.pojo.DictData">
|
||||
SELECT sys_dict_data.*
|
||||
FROM sys_dict_data sys_dict_data,
|
||||
sys_dict_type sys_dict_type
|
||||
WHERE sys_dict_data.type_id = sys_dict_type.id
|
||||
and sys_dict_data.code = #{dataCode}
|
||||
and sys_dict_type.code = #{typeCode}
|
||||
and sys_dict_data.state = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.jbsyncdata.mapper.PmsStatationStatMapper">
|
||||
|
||||
</mapper>
|
||||
73
src/main/java/com/njcn/jbsyncdata/pojo/Dept.java
Normal file
73
src/main/java/com/njcn/jbsyncdata/pojo/Dept.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_dept")
|
||||
public class Dept {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 部门表Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父节点Id(0为根节点)
|
||||
*/
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 上层所有节点Id
|
||||
*/
|
||||
private String pids;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 专项分析类型区分
|
||||
*/
|
||||
private Integer specialType;
|
||||
|
||||
/**
|
||||
* (sys_Area)行政区域Id,自定义部门无需填写部门
|
||||
*/
|
||||
private String area;
|
||||
|
||||
/**
|
||||
* 部门类型 0-非自定义;1-web自定义;2-App自定义;3-web测试
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 部门描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
62
src/main/java/com/njcn/jbsyncdata/pojo/DictData.java
Normal file
62
src/main/java/com/njcn/jbsyncdata/pojo/DictData.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_dict_data")
|
||||
public class DictData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典数据表Id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典类型表Id
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 事件等级:0-普通;1-中等;2-严重(默认为0)
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 与高级算法内部Id描述对应;
|
||||
*/
|
||||
private Integer algoDescribe;
|
||||
|
||||
/**
|
||||
* 目前只用于表示电压等级数值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
@@ -12,8 +12,15 @@ import java.math.BigDecimal;
|
||||
* @date 2023/9/26 15:28
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(30)
|
||||
public class DisPhotovoltaic10Excel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "错误信息")
|
||||
private String errorMessage;
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
private String serialNumber;
|
||||
|
||||
@ExcelProperty(value = "市单位")
|
||||
private String orgName;
|
||||
|
||||
@@ -45,7 +52,7 @@ public class DisPhotovoltaic10Excel implements Serializable {
|
||||
private String wayConsumption;
|
||||
|
||||
@ExcelProperty(value = "合同容量")
|
||||
private BigDecimal contractCapacity;
|
||||
private Float contractCapacity;
|
||||
|
||||
@ExcelProperty(value = "行业类别")
|
||||
private String industryType;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -12,8 +13,15 @@ import java.math.BigDecimal;
|
||||
* @date 2023/9/26 15:28
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(30)
|
||||
public class DisPhotovoltaic380Excel implements Serializable {
|
||||
|
||||
@ExcelProperty(value = "错误信息")
|
||||
private String errorMessage;
|
||||
|
||||
@ExcelProperty(value = "序号")
|
||||
private String serialNumber;
|
||||
|
||||
@ExcelProperty(value = "市单位")
|
||||
private String orgName;
|
||||
|
||||
@@ -44,7 +52,7 @@ public class DisPhotovoltaic380Excel implements Serializable {
|
||||
private String wayConsumption;
|
||||
|
||||
@ExcelProperty(value = "合同容量")
|
||||
private BigDecimal contractCapacity;
|
||||
private Float contractCapacity;
|
||||
|
||||
@ExcelProperty(value = "电压等级")
|
||||
private String Voltage_Level;
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发电用户台账
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-09
|
||||
*/
|
||||
@Data
|
||||
@TableName("pms_power_generation_user")
|
||||
@ApiModel(value = "PmsPowerGenerationUser对象", description = "发电用户台账")
|
||||
public class PmsPowerGenerationUser{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户编号")
|
||||
@TableId("Id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
@TableField("Name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("组织机构名称")
|
||||
@TableField("Org_Name")
|
||||
private String orgName;
|
||||
|
||||
@ApiModelProperty("组织机构ID(外键)")
|
||||
@TableField("Org_Id")
|
||||
private String orgId;
|
||||
|
||||
@ApiModelProperty("运维单位名称")
|
||||
@TableField("Operation_Name")
|
||||
private String operationName;
|
||||
|
||||
@ApiModelProperty("运维单位ID(外键)")
|
||||
@TableField("Operation_Id")
|
||||
private String operationId;
|
||||
|
||||
@ApiModelProperty("电源类别(字典)")
|
||||
@TableField("Power_Category")
|
||||
private String powerCategory;
|
||||
|
||||
@ApiModelProperty("电站类型(字典)")
|
||||
@TableField("Power_Station_Type")
|
||||
private String powerStationType;
|
||||
|
||||
@ApiModelProperty("发电方式(字典)")
|
||||
@TableField("Power_Generation_Mode")
|
||||
private String powerGenerationMode;
|
||||
|
||||
@ApiModelProperty("并网电压等级(字典)")
|
||||
@TableField("Voltage_Level")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty("总装机容量")
|
||||
@TableField("Source_Capacity")
|
||||
private Float sourceCapacity;
|
||||
|
||||
@ApiModelProperty("并网日期")
|
||||
@TableField("Connection_Date")
|
||||
private LocalDate connectionDate;
|
||||
|
||||
@ApiModelProperty("能源消纳方式(字典)")
|
||||
@TableField("Connection_Mode")
|
||||
private String connectionMode;
|
||||
|
||||
@ApiModelProperty("客户状态(字典)")
|
||||
@TableField("Gc_Stat")
|
||||
private String gcStat;
|
||||
|
||||
@ApiModelProperty("供电变电站(外键)")
|
||||
@TableField("Power_Station_Id")
|
||||
private String powerStationId;
|
||||
|
||||
@ApiModelProperty("供电线路(外键)")
|
||||
@TableField("Line_Id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("供电台区(外键)")
|
||||
@TableField("Platform_Id")
|
||||
private String platformId;
|
||||
|
||||
@ApiModelProperty("用户标签")
|
||||
@TableField("User_Tag")
|
||||
private String userTag;
|
||||
|
||||
@ApiModelProperty("是否是上送国网监测点,0-否 1-是")
|
||||
@TableField("Is_Up_To_Grid")
|
||||
private Integer isUpToGrid;
|
||||
|
||||
@ApiModelProperty("数据状态:0-删除;1-正常; ")
|
||||
@TableField("Status")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("创建用户")
|
||||
@TableField("Create_By")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField("Create_Time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新用户")
|
||||
@TableField("Update_By")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
@TableField("Update_Time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 数据状态:0-10kv;1-380kv
|
||||
*/
|
||||
private Integer inputStatus;
|
||||
}
|
||||
80
src/main/java/com/njcn/jbsyncdata/pojo/PmsStatationStat.java
Normal file
80
src/main/java/com/njcn/jbsyncdata/pojo/PmsStatationStat.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.njcn.jbsyncdata.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-10
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("pms_statation_stat")
|
||||
@ApiModel(value = "PmsStatationStat对象", description = "")
|
||||
public class PmsStatationStat {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("电站编号")
|
||||
@TableId("Power_Id")
|
||||
private String powerId;
|
||||
|
||||
@ApiModelProperty("电站名称")
|
||||
@TableField("Power_Name")
|
||||
private String powerName;
|
||||
|
||||
@ApiModelProperty("组织机构id")
|
||||
@TableField("Org_Id")
|
||||
private String orgId;
|
||||
|
||||
@TableField("Org_Name")
|
||||
private String orgName;
|
||||
|
||||
@ApiModelProperty("应设点数量")
|
||||
@TableField("Should_Be_Num")
|
||||
private Integer shouldBeNum;
|
||||
|
||||
@ApiModelProperty("电压等级(字典)")
|
||||
@TableField("Voltage_Level")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty("经度")
|
||||
@TableField("Longitude")
|
||||
private Double longitude;
|
||||
|
||||
@ApiModelProperty("纬度")
|
||||
@TableField("Latitude")
|
||||
private Double latitude;
|
||||
|
||||
@ApiModelProperty("数据状态:0-删除;1-正常; ")
|
||||
@TableField("Status")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("创建用户")
|
||||
@TableField("Create_By")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField("Create_Time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("更新用户")
|
||||
@TableField("Update_By")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
@TableField("Update_Time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,34 @@
|
||||
package com.njcn.jbsyncdata.service;
|
||||
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic10Excel;
|
||||
import com.njcn.jbsyncdata.pojo.DisPhotovoltaic380Excel;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 16:09
|
||||
*/
|
||||
public class DisPhotovoltaicService {
|
||||
public interface DisPhotovoltaicService {
|
||||
|
||||
/**
|
||||
* @param list
|
||||
* @param response
|
||||
* @Description: 10KV导入
|
||||
* @Author: wr
|
||||
* @Date: 2023/10/10 16:01
|
||||
*/
|
||||
void SavaPmsPowerGenerationUser10KV(List<DisPhotovoltaic10Excel> list, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* @param list
|
||||
* @param response
|
||||
* @Description: 380kv导入
|
||||
* @Author: wr
|
||||
* @Date: 2023/10/10 16:01
|
||||
*/
|
||||
void SavaPmsPowerGenerationUser380KV(List<DisPhotovoltaic380Excel> list, HttpServletResponse response);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.jbsyncdata.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发电用户台账 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-09
|
||||
*/
|
||||
public interface IPmsPowerGenerationUserService extends IMppService<PmsPowerGenerationUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.jbsyncdata.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.jbsyncdata.pojo.PmsStatationStat;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-10
|
||||
*/
|
||||
public interface IPmsStatationStatService extends IMppService<PmsStatationStat> {
|
||||
|
||||
}
|
||||
@@ -1,11 +1,418 @@
|
||||
package com.njcn.jbsyncdata.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.jbsyncdata.mapper.DictDataMapper;
|
||||
import com.njcn.jbsyncdata.pojo.*;
|
||||
import com.njcn.jbsyncdata.service.DisPhotovoltaicService;
|
||||
import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
|
||||
import com.njcn.jbsyncdata.service.IPmsStatationStatService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/9/26 16:10
|
||||
*/
|
||||
public class DisPhotovoltaicServiceImpl extends DisPhotovoltaicService {
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DisPhotovoltaicServiceImpl implements DisPhotovoltaicService {
|
||||
|
||||
private final IPmsPowerGenerationUserService iPmsPowerGenerationUserService;
|
||||
private final DictDataMapper dictDataMapper;
|
||||
private final IPmsStatationStatService iPmsStatationStatService;
|
||||
|
||||
@Override
|
||||
public void SavaPmsPowerGenerationUser10KV(List<DisPhotovoltaic10Excel> list, HttpServletResponse response) {
|
||||
List<PmsPowerGenerationUser> info = new ArrayList<>();
|
||||
List<DisPhotovoltaic10Excel> errorInfo = new ArrayList<>();
|
||||
//电源类别
|
||||
DictData powerCategory = dictDataMapper.selectByCode("Distributed_Power", "Power_Category");
|
||||
//客户状态
|
||||
DictData dictData = dictDataMapper.selectByCode("Normal_Power", "Ecc_Stat");
|
||||
//电站类型
|
||||
DictData powerStationType = dictDataMapper.selectByCode("Village_Level", "Power_Station_Type");
|
||||
//发电方式
|
||||
DictData powerGenerationMode = dictDataMapper.selectByCode("Pho_Power", "Power_Generation");
|
||||
//消纳方式
|
||||
List<DictData> connection_mode = dictDataMapper.selectList("Connection_Mode");
|
||||
//电压等级
|
||||
List<DictData> dev_voltage = dictDataMapper.selectList("Dev_Voltage");
|
||||
//获取部门信息
|
||||
List<Dept> depts = dictDataMapper.selectUserList();
|
||||
//导入变电站数据
|
||||
add(list, dev_voltage);
|
||||
PmsPowerGenerationUser user;
|
||||
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
||||
new LambdaQueryWrapper<PmsStatationStat>()
|
||||
.eq(PmsStatationStat::getStatus, 1)
|
||||
);
|
||||
Map<String, PmsStatationStat> oldSubMap = oldList.stream()
|
||||
.collect(Collectors.toMap(x -> x.getPowerName() + "_" + x.getOrgName(), Function.identity()));
|
||||
|
||||
for (DisPhotovoltaic10Excel excel : list) {
|
||||
if (StrUtil.hasBlank(excel.getStageID(),
|
||||
excel.getLineID()
|
||||
)
|
||||
) {
|
||||
excel.setErrorMessage("线路/台区编号不能为空");
|
||||
errorInfo.add(excel);
|
||||
continue;
|
||||
}
|
||||
//todo 变电站未知
|
||||
String replace = excel.getCounty().replace("国网冀北", "")
|
||||
.replace("唐山市","")
|
||||
.replace("双桥","双桥区")
|
||||
.replace("古冶","古冶供电中心")
|
||||
.replace("张家口","国网张家口")
|
||||
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
||||
.replace("有限","")
|
||||
.replace("分","");
|
||||
PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap);
|
||||
if (ObjectUtil.isNull(sub)) {
|
||||
excel.setErrorMessage("部门信息不存在");
|
||||
errorInfo.add(excel);
|
||||
continue;
|
||||
}
|
||||
|
||||
user = new PmsPowerGenerationUser();
|
||||
user.setId(excel.getGenerationUserID());
|
||||
user.setName(excel.getGenerationUserName());
|
||||
//todo 部门信息
|
||||
user.setOrgName("国网" + excel.getOrgName());
|
||||
user.setOrgId(getDeptCode("国网" + excel.getOrgName(), depts).getCode());
|
||||
user.setOperationName(user.getOrgName());
|
||||
user.setOperationId(user.getOrgId());
|
||||
//todo 电源类别(分布式电源)
|
||||
user.setPowerCategory(powerCategory.getId());
|
||||
//todo 电站类型(村级)
|
||||
user.setPowerStationType(powerStationType.getId());
|
||||
//todo 发电方式未知
|
||||
user.setPowerGenerationMode(powerGenerationMode.getId());
|
||||
|
||||
//todo 电压等级(需要转换)
|
||||
user.setVoltageLevel(getVoltage(excel.getVoltage_Level(), dev_voltage));
|
||||
|
||||
|
||||
user.setSourceCapacity(excel.getContractCapacity());
|
||||
|
||||
DateTime dateTime = DateUtil.parseDate(excel.getConnectionDate());
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
LocalDateTime localDateTime = dateTime.toInstant().atZone(zoneId).toLocalDateTime();
|
||||
user.setConnectionDate(localDateTime.toLocalDate());
|
||||
|
||||
user.setConnectionMode(getAlgoDescribe(excel.getWayConsumption(), connection_mode));
|
||||
user.setGcStat(dictData.getId());
|
||||
|
||||
|
||||
user.setPowerStationId(sub.getPowerId());
|
||||
user.setLineId(excel.getLineID());
|
||||
user.setPlatformId(excel.getStageID());
|
||||
user.setUserTag("发电用户");
|
||||
user.setIsUpToGrid(1);
|
||||
user.setStatus(1);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
user.setInputStatus(0);
|
||||
info.add(user);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
LambdaQueryWrapper<PmsPowerGenerationUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PmsPowerGenerationUser::getInputStatus, 0);
|
||||
iPmsPowerGenerationUserService.remove(lambdaQueryWrapper);
|
||||
iPmsPowerGenerationUserService.saveOrUpdateBatch(info, 1000);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(errorInfo)) {
|
||||
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic10Excel.class, response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SavaPmsPowerGenerationUser380KV(List<DisPhotovoltaic380Excel> list, HttpServletResponse response) {
|
||||
List<PmsPowerGenerationUser> info = new ArrayList<>();
|
||||
List<DisPhotovoltaic380Excel> errorInfo = new ArrayList<>();
|
||||
//电源类别
|
||||
DictData powerCategory = dictDataMapper.selectByCode("Distributed_Power", "Power_Category");
|
||||
//客户状态
|
||||
DictData dictData = dictDataMapper.selectByCode("Normal_Power", "Ecc_Stat");
|
||||
//电站类型
|
||||
DictData powerStationType = dictDataMapper.selectByCode("Village_Level", "Power_Station_Type");
|
||||
//发电方式
|
||||
DictData powerGenerationMode = dictDataMapper.selectByCode("Pho_Power", "Power_Generation");
|
||||
//消纳方式
|
||||
List<DictData> connection_mode = dictDataMapper.selectList("Connection_Mode");
|
||||
//电压等级
|
||||
List<DictData> dev_voltage = dictDataMapper.selectList("Dev_Voltage");
|
||||
//获取部门信息
|
||||
List<Dept> depts = dictDataMapper.selectUserList();
|
||||
//导入变电站数据
|
||||
addSub(list, dev_voltage);
|
||||
PmsPowerGenerationUser user;
|
||||
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
||||
new LambdaQueryWrapper<PmsStatationStat>()
|
||||
.eq(PmsStatationStat::getStatus, 1)
|
||||
);
|
||||
Map<String, PmsStatationStat> oldSubMap = oldList.stream()
|
||||
.collect(Collectors.toMap(x -> x.getPowerName() + "_" + x.getOrgName(), Function.identity()));
|
||||
|
||||
for (DisPhotovoltaic380Excel excel : list) {
|
||||
if (StrUtil.hasBlank(excel.getStageID(),
|
||||
excel.getLineID(),
|
||||
excel.getConnectionDate()
|
||||
)
|
||||
) {
|
||||
excel.setErrorMessage("并网时间/线路/台区编号不能为空");
|
||||
errorInfo.add(excel);
|
||||
continue;
|
||||
}
|
||||
//todo 变电站未知
|
||||
String replace = subString(excel.getCounty());
|
||||
|
||||
PmsStatationStat sub = getSub(excel.getPowerSupply() + "_" + replace, oldSubMap);
|
||||
if (ObjectUtil.isNull(sub)) {
|
||||
excel.setErrorMessage("部门信息不存在");
|
||||
errorInfo.add(excel);
|
||||
continue;
|
||||
}
|
||||
|
||||
user = new PmsPowerGenerationUser();
|
||||
user.setId(excel.getGenerationUserID());
|
||||
user.setName(excel.getGenerationUserName());
|
||||
//todo 部门信息
|
||||
user.setOrgName(replace);
|
||||
user.setOrgId(getDeptCode(replace, depts).getCode());
|
||||
user.setOperationName(user.getOrgName());
|
||||
user.setOperationId(user.getOrgId());
|
||||
//todo 电源类别(分布式电源)
|
||||
user.setPowerCategory(powerCategory.getId());
|
||||
//todo 电站类型(村级)
|
||||
user.setPowerStationType(powerStationType.getId());
|
||||
//todo 发电方式未知
|
||||
user.setPowerGenerationMode(powerGenerationMode.getId());
|
||||
|
||||
//todo 电压等级(需要转换)
|
||||
user.setVoltageLevel(get380Voltage(excel.getVoltage_Level(), dev_voltage));
|
||||
|
||||
|
||||
user.setSourceCapacity(excel.getContractCapacity());
|
||||
|
||||
DateTime dateTime = DateUtil.parseDate(excel.getConnectionDate());
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
LocalDateTime localDateTime = dateTime.toInstant().atZone(zoneId).toLocalDateTime();
|
||||
user.setConnectionDate(localDateTime.toLocalDate());
|
||||
|
||||
user.setConnectionMode(getAlgoDescribe(excel.getWayConsumption(), connection_mode));
|
||||
user.setGcStat(dictData.getId());
|
||||
|
||||
|
||||
user.setPowerStationId(sub.getPowerId());
|
||||
user.setLineId(excel.getLineID());
|
||||
user.setPlatformId(excel.getStageID());
|
||||
user.setUserTag("发电用户");
|
||||
user.setIsUpToGrid(1);
|
||||
user.setStatus(1);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
user.setInputStatus(1);
|
||||
info.add(user);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
LambdaQueryWrapper<PmsPowerGenerationUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PmsPowerGenerationUser::getInputStatus, 1);
|
||||
iPmsPowerGenerationUserService.remove(lambdaQueryWrapper);
|
||||
iPmsPowerGenerationUserService.saveBatch(info, 1000);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(errorInfo)) {
|
||||
exportExcel(LocalDateTime.now() + "错误信息.xlsx", errorInfo,DisPhotovoltaic380Excel.class, response);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAlgoDescribe(String name, List<DictData> dictData) {
|
||||
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().indexOf(name) != -1).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictDataList)) {
|
||||
return dictDataList.get(0).getId();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getVoltage(String name, List<DictData> dictData) {
|
||||
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().indexOf(name) != -1
|
||||
&& x.getName().length() == name.length() + 2
|
||||
).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictDataList)) {
|
||||
return dictDataList.get(0).getId();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String get380Voltage(String name, List<DictData> dictData) {
|
||||
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().equals(name)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictDataList)) {
|
||||
return dictDataList.get(0).getId();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//变电站查询
|
||||
public PmsStatationStat getSub(String name, Map<String, PmsStatationStat> oldSubMap) {
|
||||
if (oldSubMap.containsKey(name)) {
|
||||
return oldSubMap.get(name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dept getDeptCode(String name, List<Dept> deptList) {
|
||||
List<Dept> collect = deptList.stream().filter(x -> x.getName().equals(name)
|
||||
).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
return collect.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//10kv变电站添加
|
||||
public void add(List<DisPhotovoltaic10Excel> list, List<DictData> dev_voltage) {
|
||||
//查询所有部门
|
||||
List<Dept> depts = dictDataMapper.selectUserList();
|
||||
List<String> statName = list.stream().map(DisPhotovoltaic10Excel::getPowerSupply).distinct().collect(Collectors.toList());
|
||||
|
||||
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
||||
new LambdaQueryWrapper<PmsStatationStat>()
|
||||
.in(PmsStatationStat::getPowerName, statName)
|
||||
.eq(PmsStatationStat::getStatus, 1)
|
||||
);
|
||||
List<String> oldNameList = oldList.stream().map(PmsStatationStat::getPowerName).collect(Collectors.toList());
|
||||
List<PmsStatationStat> info = new ArrayList();
|
||||
Map<String, DisPhotovoltaic10Excel> subAddMap = list.stream()
|
||||
.collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2));
|
||||
subAddMap.forEach((key, value) -> {
|
||||
String[] split = key.split("_");
|
||||
Dept dept = getDeptCode(split[0].replace("国网冀北","")
|
||||
.replace("唐山市","")
|
||||
.replace("双桥","双桥区")
|
||||
.replace("古冶","古冶供电中心")
|
||||
.replace("张家口","国网张家口")
|
||||
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
||||
.replace("有限","")
|
||||
.replace("分",""), depts);
|
||||
if (ObjectUtil.isNotNull(dept)) {
|
||||
if (!oldNameList.contains(split[1])) {
|
||||
PmsStatationStat stat = new PmsStatationStat();
|
||||
stat.setPowerName(split[1]);
|
||||
stat.setOrgId(dept.getCode());
|
||||
stat.setOrgName(dept.getName());
|
||||
stat.setShouldBeNum(100);
|
||||
stat.setVoltageLevel(getVoltage(value.getVoltage_Level(), dev_voltage));
|
||||
stat.setStatus(1);
|
||||
stat.setCreateTime(LocalDateTime.now());
|
||||
stat.setUpdateTime(LocalDateTime.now());
|
||||
info.add(stat);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
iPmsStatationStatService.saveBatch(info, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
//10kv变电站添加
|
||||
public void addSub(List<DisPhotovoltaic380Excel> list, List<DictData> dev_voltage) {
|
||||
//查询所有部门
|
||||
List<Dept> depts = dictDataMapper.selectUserList();
|
||||
List<String> statName = list.stream().map(DisPhotovoltaic380Excel::getPowerSupply).distinct().collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
List<String> orgName = list.stream().map(x-> subString(x.getCounty()))
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
List<PmsStatationStat> oldList = iPmsStatationStatService.list(
|
||||
new LambdaQueryWrapper<PmsStatationStat>()
|
||||
.in(PmsStatationStat::getPowerName, statName)
|
||||
.in(PmsStatationStat::getOrgName, orgName)
|
||||
.eq(PmsStatationStat::getStatus, 1)
|
||||
);
|
||||
Map<String, List<PmsStatationStat>> collect = oldList.stream().collect(Collectors.groupingBy(x -> x.getOrgName() + "_" + x.getPowerName()));
|
||||
Map<String, PmsStatationStat> oldNameMap = oldList.stream().collect(Collectors.toMap(x -> x.getOrgName() + "_" + x.getPowerName(), Function.identity()));
|
||||
|
||||
List<PmsStatationStat> info = new ArrayList();
|
||||
Map<String, DisPhotovoltaic380Excel> subAddMap = list.stream()
|
||||
.collect(Collectors.toMap(x -> x.getCounty() + "_" + x.getPowerSupply(), Function.identity(), (key1, key2) -> key2));
|
||||
subAddMap.forEach((key, value) -> {
|
||||
String[] split = key.split("_");
|
||||
String replace = subString(split[0]);
|
||||
Dept dept = getDeptCode(replace, depts);
|
||||
if (ObjectUtil.isNotNull(dept)) {
|
||||
if (!oldNameMap.containsKey(replace+"_"+split[1])) {
|
||||
PmsStatationStat stat = new PmsStatationStat();
|
||||
stat.setPowerName(split[1]);
|
||||
stat.setOrgId(dept.getCode());
|
||||
stat.setOrgName(dept.getName());
|
||||
stat.setShouldBeNum(100);
|
||||
stat.setVoltageLevel(getVoltage(value.getVoltage_Level(), dev_voltage));
|
||||
stat.setStatus(1);
|
||||
stat.setCreateTime(LocalDateTime.now());
|
||||
stat.setUpdateTime(LocalDateTime.now());
|
||||
info.add(stat);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
iPmsStatationStatService.saveBatch(info, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void exportExcel(String fileName, List<?> list,Class<?> t, HttpServletResponse response) {
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
EasyExcel.write(outputStream,t).sheet("sheet").doWrite(list);
|
||||
} catch (IOException e) {
|
||||
log.error(">>> 导出数据异常:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
private String subString(String name){
|
||||
String replace ;
|
||||
if(name.equals("古冶")){
|
||||
replace = name
|
||||
.replace("古冶","古冶供电中心");
|
||||
}else{
|
||||
replace = name.replace("国网冀北", "")
|
||||
.replace("唐山市","")
|
||||
.replace("双桥","双桥区")
|
||||
.replace("张家口","国网张家口")
|
||||
.replace("国网昌黎县供电公司","昌黎县供电公司")
|
||||
.replace("双滦客服中心","双滦区供电中心")
|
||||
.replace("营子客服中心","营子区供电中心")
|
||||
.replace("安次客户服务分中心","安次供电中心")
|
||||
.replace("广阳客户服务分中心","广阳供电中心")
|
||||
.replace("国网卢龙县供电公司","卢龙县供电公司")
|
||||
.replace("国网青龙县供电公司","青龙县供电公司")
|
||||
.replace("广阳客户服务分中心","广阳供电中心")
|
||||
.replace("有限","")
|
||||
.replace("分","");
|
||||
}
|
||||
return replace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.jbsyncdata.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.jbsyncdata.mapper.PmsPowerGenerationUserMapper;
|
||||
import com.njcn.jbsyncdata.pojo.PmsPowerGenerationUser;
|
||||
import com.njcn.jbsyncdata.service.IPmsPowerGenerationUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 发电用户台账 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-09
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PmsPowerGenerationUserServiceImpl extends MppServiceImpl<PmsPowerGenerationUserMapper, PmsPowerGenerationUser> implements IPmsPowerGenerationUserService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.jbsyncdata.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.jbsyncdata.mapper.PmsStatationStatMapper;
|
||||
import com.njcn.jbsyncdata.pojo.PmsStatationStat;
|
||||
import com.njcn.jbsyncdata.service.IPmsStatationStatService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-10-10
|
||||
*/
|
||||
@Service
|
||||
public class PmsStatationStatServiceImpl extends MppServiceImpl<PmsStatationStatMapper, PmsStatationStat> implements IPmsStatationStatService {
|
||||
|
||||
}
|
||||
@@ -9,7 +9,10 @@ spring:
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://101.132.25.239:13306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT&rewriteBatchedStatements=true
|
||||
# url: jdbc:mysql://101.132.25.239:13306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT&rewriteBatchedStatements=true
|
||||
# username: root
|
||||
# password: njcnpqs
|
||||
url: jdbc:mysql://192.168.1.18:13306/pqsinfo_pms_jb?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: njcnpqs
|
||||
#初始化建立物理连接的个数、最小、最大连接数
|
||||
@@ -39,7 +42,7 @@ spring:
|
||||
max-file-size: 500MB
|
||||
enabled: true
|
||||
influx:
|
||||
url: http://127.0.0.1:8086
|
||||
url: http://192.168.1.18:8086
|
||||
user: admin
|
||||
password: 123456
|
||||
database: pqsbase_sjzx
|
||||
|
||||
Reference in New Issue
Block a user