Browse Source

#发电量整改

zhongwei
yang_shj 5 months ago
parent
commit
8ddb991352
  1. 43
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java
  2. 43
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java
  3. 14
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java
  4. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/ThirtyGenerateMapper.java
  5. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/ThreeGenerateMapper.java
  6. 72
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java
  7. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/ThirtyGenerateService.java
  8. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/ThreeGenerateService.java
  9. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/ThirtyGenerateServiceImpl.java
  10. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/ThreeGenerateServiceImpl.java
  11. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/ObtainGenerationService.java
  12. 299
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java
  13. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/ThirtyGenerateMapper.xml
  14. 5
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/ThreeGenerateMapper.xml

43
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThirtyGenerationEntity.java

@ -0,0 +1,43 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("hzims_em_thirty_generate")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备30天发电量对象", description = "")
public class ThirtyGenerationEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "月份 : String")
private String strDay;
@ApiModelProperty(value = "月份 : Int")
private Integer day;
@ApiModelProperty(value = "发电量")
private BigDecimal generate;
}

43
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/ThreeGenerationEntity.java

@ -0,0 +1,43 @@
package com.hnac.hzims.equipment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
/**
* 实体类
*
* @author Chill
*/
@Data
@TableName("hzims_em_three_generate")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备3年发电量对象", description = "")
public class ThreeGenerationEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "设备编号")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "月份 : String")
private String strMonth;
@ApiModelProperty(value = "月份 : Int")
private Integer month;
@ApiModelProperty(value = "发电量")
private BigDecimal generate;
}

14
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/ScheduledConstant.java

@ -0,0 +1,14 @@
package com.hnac.hzims.operational.main.constant;
/**
* 定时任务JobHandler名称
* @author 11423
*/
public interface ScheduledConstant {
String THREE_YEAR_POWER_GENERATION = "threeYearPowerGeneration";
String THIRTY_DAY_POWER_GENERATION = "thirtyDayPowerGeneration";
String THIS_DAY_POWER_GENERATION = "thisDayPowerGeneration";
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/ThirtyGenerateMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.mapper.equipment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
/**
* @author ysj
*/
public interface ThirtyGenerateMapper extends BaseMapper<ThirtyGenerationEntity> {
}

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/ThreeGenerateMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.mapper.equipment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
/**
* @author ysj
*/
public interface ThreeGenerateMapper extends BaseMapper<ThreeGenerationEntity> {
}

72
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java

@ -0,0 +1,72 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.scheduled.service.operation.home.ObtainGenerationService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import static com.hnac.hzims.operational.main.constant.ScheduledConstant.*;
/**
* 设备发电量定时任务
* @author ysj
*/
@Slf4j
@Component
public class GenerationScheduledTask {
@Autowired
private ObtainGenerationService service;
/**
* 设备近3年发电量数据 : 按月分割
* @param param
* @return
*/
@XxlJob(THREE_YEAR_POWER_GENERATION)
public ReturnT<String> threeYearPowerGeneration(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.threeYearPowerGeneration(param);
return new ReturnT<>("SUCCESS");
}
/**
* 设备30天发电量数据 : 按日分割
* @param param
* @return
*/
@XxlJob(THIRTY_DAY_POWER_GENERATION)
public ReturnT<String> thirtyDayPowerGeneration(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.thirtyDayPowerGeneration(param);
return new ReturnT<>("SUCCESS");
}
/**
* 当天发电量数据
* @param param
* @return
*/
@XxlJob(THIS_DAY_POWER_GENERATION)
public ReturnT<String> thisDayPowerGeneration(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.thisDayPowerGeneration(param);
return new ReturnT<>("SUCCESS");
}
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/ThirtyGenerateService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.equipment;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface ThirtyGenerateService extends BaseService<ThirtyGenerationEntity> {
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/ThreeGenerateService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.equipment;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface ThreeGenerateService extends BaseService<ThreeGenerationEntity> {
}

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/ThirtyGenerateServiceImpl.java

@ -0,0 +1,22 @@
package com.hnac.hzims.scheduled.service.equipment.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
import com.hnac.hzims.scheduled.mapper.equipment.ThirtyGenerateMapper;
import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("equipment")
public class ThirtyGenerateServiceImpl extends BaseServiceImpl<ThirtyGenerateMapper, ThirtyGenerationEntity> implements ThirtyGenerateService {
}

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/ThreeGenerateServiceImpl.java

@ -0,0 +1,22 @@
package com.hnac.hzims.scheduled.service.equipment.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
import com.hnac.hzims.scheduled.mapper.equipment.ThreeGenerateMapper;
import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
@DS("equipment")
public class ThreeGenerateServiceImpl extends BaseServiceImpl<ThreeGenerateMapper, ThreeGenerationEntity> implements ThreeGenerateService {
}

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/ObtainGenerationService.java

@ -0,0 +1,13 @@
package com.hnac.hzims.scheduled.service.operation.home;
/**
* @author ysj
*/
public interface ObtainGenerationService {
void threeYearPowerGeneration(String param);
void thirtyDayPowerGeneration(String param);
void thisDayPowerGeneration(String param);
}

299
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java

@ -0,0 +1,299 @@
package com.hnac.hzims.scheduled.service.operation.home.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.ThirtyGenerationEntity;
import com.hnac.hzims.equipment.entity.ThreeGenerationEntity;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.equipment.ThirtyGenerateService;
import com.hnac.hzims.scheduled.service.equipment.ThreeGenerateService;
import com.hnac.hzims.scheduled.service.operation.fill.GenerateService;
import com.hnac.hzims.scheduled.service.operation.fill.PowerService;
import com.hnac.hzims.scheduled.service.operation.home.ObtainGenerationService;
import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author ysj
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class ObtainGenerationServiceImpl implements ObtainGenerationService {
private final DataService dataService;
private final PowerService powerService;
private final StationService stationService;
private final GenerateService generateService;
private final ThreeGenerateService threeGenerateService;
private final ThirtyGenerateService thirtyGenerateService;
private final RedisTemplate redisTemplate;
@Value("${hzims.equipment.emInfo.emInfoList}")
public String device_cache_cofig_final;
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("obtain-generation-pool-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/**
* 设备近3年发电量数据 : 按月分割
* @param param
*/
@Override
public void threeYearPowerGeneration(String param) {
// 步骤1.水电、光伏站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC)));
// 步骤2.缓存设备信息
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 步骤3.站点-设备3年发电量
this.saveGeneration(stations,devices);
}
/**
* 设备30天发电量数据 : 按日分割
* @param param
*/
@Override
public void thirtyDayPowerGeneration(String param) {
// 步骤1.水电、光伏站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC)));
// 步骤2.缓存设备信息
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 步骤3.站点-设备30发电量
this.saveThirtyGeneration(stations,devices);
}
/**
* 当天发电量
* @param param
*/
@Override
public void thisDayPowerGeneration(String param) {
// 步骤1.水电、光伏站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery().in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC)));
// 步骤2.缓存设备信息
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 步骤3.站点-设备当日发电量
}
/**
* 查询发电量
* @param stations
* @param devices
*/
private void saveThirtyGeneration(List<StationEntity> stations, List<EminfoAndEmParamVo> devices) {
Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-29);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
// 将站点切割
int limit = countStep(stations.size());
List<List<StationEntity>> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList());
CountDownLatch countDownLatch = new CountDownLatch(limits.size());
for(List<StationEntity> item : limits){
try{
pool.submit(()->{
item.forEach(station->{
// 站点设备集合
List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
// 遍历查询发电量
eminfos.forEach(device->{
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
// 保存设备发电量
thirtyGenerateService.saveBatch(records.stream().map(record -> {
ThirtyGenerationEntity generate = new ThirtyGenerationEntity();
generate.setStationId(station.getCode());
generate.setStationName(station.getName());
generate.setDeviceCode(device.getEmCode());
generate.setDeviceName(device.getName());
generate.setTenantId(station.getTenantId());
generate.setCreateDept(station.getRefDept());
generate.setCreateUser(station.getCreateUser());
generate.setUpdateUser(station.getUpdateUser());
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrDay(DateUtil.format(time,DateUtil.PATTERN_DATETIME));
generate.setDay(time.getDay());
if(StringUtil.isEmpty(record.getVal())){
generate.setGenerate(BigDecimal.ZERO);
}else{
generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()));
}
return generate;
}).collect(Collectors.toList()));
});
});
countDownLatch.countDown();
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
});
}catch (Exception e){
log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
}
}
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
/**
* 保存站点-设备查询发电量
* @param stations
* @param devices
*/
private void saveGeneration(List<StationEntity> stations, List<EminfoAndEmParamVo> devices) {
// 开始时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 结束日期
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 将站点切割
int limit = countStep(stations.size());
List<List<StationEntity>> limits = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stations.stream().skip((long) a * 3).limit(3).parallel().collect(Collectors.toList())).collect(Collectors.toList());
CountDownLatch countDownLatch = new CountDownLatch(limits.size());
for(List<StationEntity> item : limits){
try{
pool.submit(()->{
item.forEach(station->{
// 站点设备集合
List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
// 遍历查询发电量
eminfos.forEach(device->{
List<AnalyseDataTaosVO> records = dataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
// 保存设备发电量
threeGenerateService.saveBatch(records.stream().map(record -> {
ThreeGenerationEntity generate = new ThreeGenerationEntity();
generate.setStationId(station.getCode());
generate.setStationName(station.getName());
generate.setDeviceCode(device.getEmCode());
generate.setDeviceName(device.getName());
generate.setTenantId(station.getTenantId());
generate.setCreateDept(station.getRefDept());
generate.setCreateUser(station.getCreateUser());
generate.setUpdateUser(station.getUpdateUser());
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setMonth(time.getMonth() + 1);
if(StringUtil.isEmpty(record.getVal())){
generate.setGenerate(BigDecimal.ZERO);
}else{
generate.setGenerate(BigDecimal.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()));
}
return generate;
}).collect(Collectors.toList()));
});
// 填报发电量保存
threeGenerateService.saveBatch(this.saveFillGenerate(station,start,end));
});
countDownLatch.countDown();
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
});
}catch (Exception e){
log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
}
}
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
/**
* 补充填报数据
* @param station
* @param start
* @param end
*/
private List<ThreeGenerationEntity> saveFillGenerate(StationEntity station, String start, String end) {
start = DateUtil.format(DateUtil.parse(start,DateUtil.PATTERN_DATETIME),"yyyy-MM");
end = DateUtil.format(DateUtil.parse(end,DateUtil.PATTERN_DATETIME),"yyyy-MM");
List<PowerMonthVo> powerMonths;
// 光伏
if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){
powerMonths = powerService.generateThreeYear(start,end,station.getRefDept());
}else{
// 水电
powerMonths = generateService.generateThreeYear(start,end,station.getCode());
}
if(CollectionUtil.isEmpty(powerMonths)){
return new ArrayList<>();
}
return powerMonths.stream().map(power->{
ThreeGenerationEntity generation = new ThreeGenerationEntity();
generation.setStationId(station.getCode());
generation.setStationName(station.getName());
generation.setTenantId(station.getTenantId());
generation.setCreateDept(station.getRefDept());
generation.setCreateUser(station.getCreateUser());
generation.setUpdateUser(station.getUpdateUser());
generation.setStrMonth(power.getStrMonth());
generation.setMonth(power.getMonth());
if(power.getPower() <= 0){
generation.setGenerate(BigDecimal.ZERO);
}else{
generation.setGenerate(BigDecimal.valueOf(Double.parseDouble(power.getPower().toString())).setScale(2, RoundingMode.HALF_UP));
}
return generation;
}).collect(Collectors.toList());
}
/**
* 计算切分次数
*/
private static Integer countStep(Integer size) {
return (size + 3 - 1) / 3;
}
}

5
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/ThirtyGenerateMapper.xml

@ -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.hnac.hzims.scheduled.mapper.equipment.ThirtyGenerateMapper">
</mapper>

5
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/ThreeGenerateMapper.xml

@ -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.hnac.hzims.scheduled.mapper.equipment.ThreeGenerateMapper">
</mapper>
Loading…
Cancel
Save