ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/OtherFallbackFactory.java
@@ -131,6 +131,11 @@ public R<HashMap<String, Object>> getCarportData() { return R.fail("远程调用获取配置失败:"+throwable.getMessage()); } @Override public R reset(String electricity) { return R.fail("远程调用获取配置失败:"+throwable.getMessage()); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/OtherClient.java
@@ -92,6 +92,7 @@ @GetMapping(value = "/region/getCarportData") R<HashMap<String, Object>> getCarportData(); @GetMapping(value = "/region/reset") R reset(@RequestParam("electricity") String electricity); } ruoyi-service/ruoyi-jianguan/src/main/java/com/ruoyi/jianguan/util/TaskUtil.java
@@ -1,6 +1,7 @@ package com.ruoyi.jianguan.util; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.TAppUser; import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; @@ -11,6 +12,8 @@ import com.ruoyi.order.api.model.TChargingOrder; import com.ruoyi.order.api.vo.TChargingOrderVo; import com.ruoyi.other.api.domain.Operator; import com.ruoyi.other.api.domain.TSystemConfiguration; import com.ruoyi.other.api.feignClient.OtherClient; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; @@ -44,6 +47,9 @@ private ChargingOrderClient chargingOrderClient; @Resource private AppUserClient appUserClient; @Resource private OtherClient otherClient; @Resource private RedisTemplate redisTemplate; @@ -284,6 +290,14 @@ } }); } @Scheduled(cron = "0 0 0 * * ?") public void reset() { String electricity = KsolarUtils.getElectricity(); otherClient.reset(electricity); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RegionController.java
@@ -102,4 +102,17 @@ HashMap<String, Object> carportData = screenContentMapper.getCarportData(); return R.ok(carportData); } @GetMapping(value = "/reset") @ResponseBody public void reset(@RequestParam("electricity") String electricity){ TSystemConfiguration sysConfig = tSystemConfigurationService.getOne(new LambdaQueryWrapper<TSystemConfiguration>() .eq(TSystemConfiguration::getType,5)); sysConfig.setContent(electricity.split("_")[0]); tSystemConfigurationService.updateById(sysConfig); TSystemConfiguration sysConfig1 = tSystemConfigurationService.getOne(new LambdaQueryWrapper<TSystemConfiguration>() .eq(TSystemConfiguration::getType,4)); sysConfig1.setContent(electricity.split("_")[1]); tSystemConfigurationService.updateById(sysConfig1); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/EnergyRefreshService.java
@@ -31,7 +31,7 @@ // 记录截至昨天的总量(每天凌晨0点) @Scheduled(cron = "0 0 0 * * ?") // @Scheduled(cron = "0 0 0 * * ?") public void reset() { String electricity = KsolarUtils.getElectricity();