Browse Source

#无功电量

zhongwei
yang_shj 3 months ago
parent
commit
611d995be2
  1. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
  2. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/GenerationScheduledTask.java
  3. 4
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ObtainGenerationServiceImpl.java

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java

@ -21,7 +21,7 @@ import javax.annotation.Resource;
@Resource @Resource
public class ScheduledApplication extends SpringBootServletInitializer { public class ScheduledApplication extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run("hzims-scheduled", ScheduledApplication.class, args); BladeApplication.run("hzims-scheduled-ysj", ScheduledApplication.class, args);
} }
@Override @Override

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

@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
@ -49,6 +48,7 @@ public class GenerationScheduledTask {
* @return * @return
*/ */
@XxlJob(THIRTY_DAY_POWER_GENERATION) @XxlJob(THIRTY_DAY_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> thirtyDayPowerGeneration(String param) { public ReturnT<String> thirtyDayPowerGeneration(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -63,6 +63,7 @@ public class GenerationScheduledTask {
* @return * @return
*/ */
@XxlJob(THIS_DAY_POWER_GENERATION) @XxlJob(THIS_DAY_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> thisDayPowerGeneration(String param) { public ReturnT<String> thisDayPowerGeneration(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -77,6 +78,7 @@ public class GenerationScheduledTask {
* @return * @return
*/ */
@XxlJob(LOAD_THREE_YEAR_POWER_GENERATION) @XxlJob(LOAD_THREE_YEAR_POWER_GENERATION)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadThreeYearPowerGeneration(String param) { public ReturnT<String> loadThreeYearPowerGeneration(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");

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

@ -297,8 +297,8 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
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()); 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()); CountDownLatch countDownLatch = new CountDownLatch(limits.size());
for(List<StationEntity> item : limits){ for(List<StationEntity> item : limits){
try{
pool.submit(()->{ pool.submit(()->{
try{
item.forEach(station->{ item.forEach(station->{
// 站点设备集合 // 站点设备集合
List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<EminfoAndEmParamVo> eminfos = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
@ -354,11 +354,11 @@ public class ObtainGenerationServiceImpl implements ObtainGenerationService {
}); });
countDownLatch.countDown(); countDownLatch.countDown();
log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList())); log.error("save_generation_execute_complete: {}" ,item.stream().map(StationEntity::getName).collect(Collectors.toList()));
});
}catch (Exception e){ }catch (Exception e){
countDownLatch.countDown(); countDownLatch.countDown();
log.error("save_generation_execute_complete_error : {}" ,e.getMessage()); log.error("save_generation_execute_complete_error : {}" ,e.getMessage());
} }
});
} }
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {

Loading…
Cancel
Save