ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/MsgUtil.java
@@ -187,7 +187,6 @@ String reqText = JSON.toJSONString(submitReq); //加密 String encode = Base64.encodeBase64String(reqText.getBytes()); System.err.println(encode); return encode; } /** ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -1443,14 +1443,6 @@ } public static void main(String[] args) { // String reqStr1 = MsgUtil.codeMsg("19983174515", "123456"); // String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1); String reqStr3 = MsgUtil.faultMsg("18398968484", "长河服务区充电站(遂", "123"); String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); System.err.println(result3); } @Log(title = "【我的】退出登录", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TAccountingStrategyDetailServiceImpl.java
@@ -234,8 +234,12 @@ TChargingGun chargingGun = chargingGunService.getById(gunId); TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectById(chargingGun.getAccountingStrategyId()); if(Objects.isNull(accountingStrategy)){ Site site = siteService.getById(chargingGun.getSiteId()); accountingStrategy = accountingStrategyMapper.selectById(site.getAccountingStrategyId()); if(Objects.isNull(accountingStrategy)){ throw new ServiceException("未查询到计费策略"); } } List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); // 获取当前登录用户id ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
@@ -43,6 +43,7 @@ import com.ruoyi.system.api.feignClient.SysUserClient; import com.ruoyi.system.api.feignClient.SysUserRoleClient; import com.ruoyi.system.api.model.SysUserRoleVo; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -63,6 +64,7 @@ * @author xiaochen * @since 2024-08-06 */ @Slf4j @Service public class TChargingPileServiceImpl extends ServiceImpl<TChargingPileMapper, TChargingPile> implements TChargingPileService { @@ -703,11 +705,24 @@ */ @Override public void updateStatus() { List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0)); for (TChargingGun chargingGun : list) { Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", chargingGun.getFullNumber()); //判断设备是否真的离线5分钟 //查询出redis集合汇总符合条件的数据 Set keys = redisTemplate.opsForHash().keys("charging_gun_online"); List<String> fullNumbers = new ArrayList<>(); keys.forEach(key -> { Long time = (Long) redisTemplate.opsForHash().get("charging_gun_online", key); if(null != time && System.currentTimeMillis() - time > 300000){ log.info("设备编号:{}已离线", key); log.info("间隔时间", System.currentTimeMillis() - time); fullNumbers.add(key.toString()); } }); if(fullNumbers.size() == 0){ return; } //处理符合条件的数据,修改设备状态 List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getFullNumber, fullNumbers).eq(TChargingGun::getDelFlag, 0)); for (TChargingGun chargingGun : list) { TChargingGun chargingGun1 = new TChargingGun(); chargingGun1.setId(chargingGun.getId()); chargingGun1.setStatus(1); @@ -759,7 +774,6 @@ siteName = siteName.substring(0,10); } chargingPileNotificationService.saveData(4,faultMessage.getSiteId(),faultMessage.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); } } } } ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/TaskUtil.java
@@ -2,6 +2,8 @@ import com.ruoyi.chargingPile.service.TChargingPileService; import org.springframework.boot.web.context.WebServerInitializedEvent; import org.springframework.context.ApplicationListener; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -12,19 +14,29 @@ * 定时任务工具类 */ @Component public class TaskUtil { public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { @Resource private TChargingPileService chargingPileService;; private TChargingPileService chargingPileService; private Integer port = null; @Override public void onApplicationEvent(WebServerInitializedEvent event) { port = event.getWebServer().getPort(); System.out.println("端口号:" + port); } /** * 每隔2分钟去处理的定时任务 * 每隔1分钟去处理的定时任务 */ @Scheduled(fixedRate = 120000) @Scheduled(fixedRate = 60000) public void taskMinute(){ if(null != port && port == 5300){ chargingPileService.updateStatus(); } } } ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/util/TaskUtil.java
@@ -18,6 +18,8 @@ import com.ruoyi.order.api.model.TChargingBill; import com.ruoyi.order.api.model.TChargingOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.context.WebServerInitializedEvent; import org.springframework.context.ApplicationListener; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -36,7 +38,7 @@ * @date 2023/7/11 8:39 */ @Component public class TaskUtil { public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { @Resource @@ -53,11 +55,20 @@ @Resource private ChargingPileClient chargingPileClient; private Integer port = null; @Override public void onApplicationEvent(WebServerInitializedEvent event) { port = event.getWebServer().getPort(); System.out.println("端口号:" + port); } // 每天凌晨12点30执行 推送充电用能统计 @Scheduled(cron = "0 30 0 * * ?") public void superviseNotificationOperationStatsInfo() { String port = System.getProperty("server.port"); if("5701".equals(port)){ if(null != port && port == 5701){ StationStatsInfoResult res = new StationStatsInfoResult(); int dayOfMonth1 = LocalDateTime.now().getYear(); int dayOfMonth2 = LocalDateTime.now().getMonthValue(); @@ -142,8 +153,7 @@ // 每15分钟执行一次的定时任务 @Scheduled(cron = "0 0/15 * * * ?") public void supervise_notification_realtime_power_info() { String port = System.getProperty("server.port"); if("5701".equals(port)){ if(null != port && port == 5701){ List<Site> data = siteClient.getSiteAll().getData(); List<Integer> siteIds = data.stream().filter(s->s.getStatus() == 1).map(Site::getId).collect(Collectors.toList()); List<TChargingPile> tChargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/util/TaskUtil.java
@@ -1,6 +1,8 @@ //package com.ruoyi.integration.util; // //import com.ruoyi.integration.mongodb.service.*; //import org.springframework.boot.web.context.WebServerInitializedEvent; //import org.springframework.context.ApplicationListener; //import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.stereotype.Component; // @@ -12,7 +14,7 @@ // * @Date 2025/5/21 11:43 // */ //@Component //public class TaskUtil { //public class TaskUtil implements ApplicationListener<WebServerInitializedEvent> { // // @Resource // private AcquisitionBillingModeReplyService acquisitionBillingModeReplyService; @@ -38,15 +40,20 @@ // @Resource // private ChargingHandshakeService chargingHandshakeService; // // private Integer port = null; // // @Override // public void onApplicationEvent(WebServerInitializedEvent event) { // port = event.getWebServer().getPort(); // } // // // /** // * 定时任务 // */ // @Scheduled(cron = "0 0 9 * * ?") // public void run(){ // //获取当前运行的端口号 // String port = System.getProperty("server.port"); // if("5701".equals(port)){ // if(null != port && port == 5701){ // acquisitionBillingModeReplyService.taskDelete(); // acquisitionBillingModeService.taskDelete(); // billingModeVerifyReplyService.taskDelete(); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -2179,6 +2179,13 @@ */ @Override public R endChargeBillingCharge(TransactionRecordMessageVO vo) { Boolean hasKey = redisService.hasKey("endOrder:" + vo.getTransaction_serial_number()); if(hasKey){ return R.ok(); } //添加1分钟的缓存 redisService.setCacheObject("endOrder:" + vo.getTransaction_serial_number(), vo.getTransaction_serial_number(), 1L, TimeUnit.MINUTES); try { TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); if(null == chargingOrder){ return R.ok(); @@ -2203,7 +2210,6 @@ chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); List<AccountingStrategyDetailOrderVo> lists = new ArrayList<>(); try { //跨天 if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ //当天的 @@ -2323,10 +2329,6 @@ vo1.setChargingCapacity(sharp_peak_charge); lists.add(vo1); } } }catch (Exception e){ e.printStackTrace(); R.fail("处理失败"); } //开始处理明细 @@ -2648,6 +2650,11 @@ summaryData.setElectricPrice(electronic_reduce.setScale(2, BigDecimal.ROUND_HALF_EVEN)); summaryData.setServicePrice(serviceMoney.setScale(2, BigDecimal.ROUND_HALF_EVEN)); chargingOrderSummaryDataService.save(summaryData); }catch (Exception e) { e.printStackTrace(); }finally { redisService.deleteObject("endOrder:" + vo.getTransaction_serial_number()); } return R.ok(); }