From 9bbb9e5e3fb8d4b2b7d6ed91025a528e72de2205 Mon Sep 17 00:00:00 2001 From: "2265829957@qq.com" <2265829957@qq.com> Date: Wed, 30 Apr 2025 14:19:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/evcs/dto/EquipBizRequest.java | 3 + .../evcs/api/CheckChargeOrderController.java | 52 +++ .../QueryEquipBusinessPolicyController.java | 3 +- .../evcs/api/QueryStopChargeController.java | 3 - .../CDNotificationStationInfoController.java | 14 +- .../api/CDQueryStopChargeController.java | 4 +- .../CDConnectorChargeStatusInfoTask.java | 42 ++- .../CDNotificationChargeOrderInfoTask.java | 2 +- ...NotificationEquipmentV2GPowerInfoTask.java | 4 +- .../CDNotificationOrderInfoTask.java | 20 +- .../CDNotificationStationFeeTask.java | 4 +- .../CDNotificationStationInfoTask.java | 6 +- .../CDNotificationStationPowerInfoTask.java | 6 +- .../CDNotificationStationStatusTask.java | 6 +- ...seNotificationOperationStatusInfoTask.java | 6 +- ...viseNotificationRealtimePowerInfoTask.java | 6 +- .../java/com/xhpc/evcs/config/EvcsFilter.java | 43 +-- .../CYCNotificationStationInfoController.java | 18 +- .../evcs/jpa/XhpcHistoryOrderRepository.java | 8 +- .../evcs/notification/CoreDispatcher.java | 8 +- .../NotificationCancelOrderTask.java | 2 +- ...NotificationChargeOrderInfo4BonusTask.java | 6 +- .../NotificationChargeOrderInfoHenDaTask.java | 98 +++++ ...tificationChargeOrderInfoKuaiDianTask.java | 99 +++++ .../NotificationChargeOrderInfoTask.java | 4 +- ...ificationChargeOrderInfoXinDianTuTask.java | 97 +++++ .../NotificationEquipChargeStatusTask.java | 12 +- .../NotificationStartChargeResultTask.java | 4 +- .../NotificationStationStatusTask.java | 25 +- .../NotificationStopChargeResultTask.java | 2 +- .../src/main/resources/bootstrap.yml | 10 +- .../com/xhpc/system/api/domain/SysUser.java | 33 +- .../com/xhpc/system/api/model/LoginUser.java | 14 + .../xhpc/auth/controller/TokenController.java | 13 +- ruoyi-auth/src/main/resources/bootstrap.yml | 4 +- .../common/security/service/TokenService.java | 1 + .../src/main/resources/bootstrap.yml | 6 +- .../src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/bootstrap.yml | 4 +- .../src/main/resources/bootstrap.yml | 4 +- .../system/controller/SysRoleController.java | 6 +- .../system/controller/SysUserController.java | 6 +- .../service/impl/SysNoticeServiceImpl.java | 4 + .../src/main/resources/bootstrap.yml | 4 +- .../mapper/system/SysNoticeMapper.xml | 1 - .../resources/mapper/system/SysRoleMapper.xml | 2 + .../resources/mapper/system/SysUserMapper.xml | 8 +- .../src/main/resources/bootstrap.yml | 4 +- .../controller/OrderLogController.java | 26 +- .../controller/PileLogController.java | 7 +- .../controller/StationLogController.java | 4 +- .../controller/WorkStationController.java | 2 +- .../domain/XhpcStationDeviceDomain.java | 6 +- .../service/impl/PileLogServiceImpl.java | 42 +-- .../service/impl/StationLogServiceImpl.java | 6 +- .../src/main/resources/bootstrap.yml | 4 +- .../mapper/XhpcStationDeviceMapper.xml | 12 +- .../src/main/resources/bootstrap.yml | 4 +- .../controller/XhpcPlaceholderController.java | 89 +++++ .../station/dto/XhpcPlaceholderDto.java | 20 + .../station/dto/XhpcPlaceholderTimeDto.java | 19 + .../station/mapper/XhpcPlaceholderMapper.java | 33 ++ .../service/IXhpcPlaceholderService.java | 25 ++ .../service/XhpcPlaceholderServiceImpl.java | 354 ++++++++++++++++++ .../src/main/resources/bootstrap.yml | 4 +- .../mapper/XhpcPlaceholderMapper.xml | 290 ++++++++++++++ .../xhpc/common/domain/XhpcPlaceholder.java | 28 ++ .../common/domain/XhpcPlaceholderTime.java | 34 ++ .../com/xhpc/common/util/UserTypeUtil.java | 8 + .../order/domain/XhpcPlaceholderOrder.java | 50 +++ .../src/main/resources/bootstrap.yml | 4 +- .../XhpcPileRegularInspectController.java | 12 +- .../order/mapper/XhpcRealTimeOrderMapper.java | 5 + .../impl/XhpcRealTimeOrderServiceImpl.java | 50 +++ .../src/main/resources/bootstrap.yml | 4 +- .../mapper/XhpcRealTimeOrderMapper.xml | 192 +++++++++- .../src/main/resources/bootstrap.yml | 4 +- .../com/xhpc/pp/logic/RealtimeDataLogic.java | 17 + .../src/main/resources/bootstrap.yml | 4 +- .../service/impl/XhpcOperatorServiceImpl.java | 3 + .../src/main/resources/bootstrap.yml | 4 +- .../resources/mapper/XhpcCommunityMapper.xml | 1 + .../resources/mapper/XhpcCustomersMapper.xml | 1 + .../mapper/XhpcUserVehicleMapper.xml | 2 +- .../src/main/resources/bootstrap.yml | 4 +- 85 files changed, 1906 insertions(+), 203 deletions(-) create mode 100644 evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoHenDaTask.java create mode 100644 evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoKuaiDianTask.java create mode 100644 evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoXinDianTuTask.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcPlaceholderController.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderDto.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderTimeDto.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcPlaceholderMapper.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcPlaceholderService.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcPlaceholderServiceImpl.java create mode 100644 xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPlaceholderMapper.xml create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholder.java create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholderTime.java create mode 100644 xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcPlaceholderOrder.java diff --git a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipBizRequest.java b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipBizRequest.java index 486744d7..ca400c23 100644 --- a/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipBizRequest.java +++ b/evcs-modules/evcs-common/src/main/java/com/xhpc/evcs/dto/EquipBizRequest.java @@ -14,7 +14,10 @@ public class EquipBizRequest { //将json当中的键值对为equipBizSeq的数据,封装到该属性中 @JsonProperty("EquipBizSeq") String equipBizSeq; + @JsonProperty("TraceId") + String traceId; @JsonProperty("ConnectorID") String connectorId; + } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java index a7a2abaf..5e9e728b 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/CheckChargeOrderController.java @@ -1,13 +1,28 @@ package com.xhpc.evcs.api; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.fasterxml.jackson.core.JsonProcessingException; import com.xhpc.evcs.dto.*; +import com.xhpc.evcs.encryption.Aes128Cbc; import com.xhpc.evcs.encryption.EvcsConst; +import com.xhpc.evcs.encryption.HMAC; import com.xhpc.evcs.utils.JSONUtil; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; @RestController() public class CheckChargeOrderController { @@ -39,5 +54,42 @@ public class CheckChargeOrderController { response.setData(JSONUtil.toJSONString(resp)); return response; } + public static void main(String[] args) { + try { + CommonRequest commonRequest = new CommonRequest<>(); + StationStatusRequest stationStatusRequest =new StationStatusRequest(); + String[] strings = new String[]{"4"}; + stationStatusRequest.setStationIds(strings); + String data = JSONUtil.toJSONString(stationStatusRequest); + commonRequest.setData(data); + commonRequest.setOperatorId("MA005DBW1"); + String s = encryptReqOut("8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6", "wAeYIVQUwd0iGZsV", commonRequest); + + System.out.println("==========sss==============="+s); + + + }catch (Exception e){ + + } + } + + public static String encryptReqOut(String dataSecret, String dataSecretIV, String sigSecret, CommonRequest commonRequest) + throws BadPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, + IllegalBlockSizeException, NoSuchPaddingException, InvalidKeyException, JsonProcessingException { + + String data = Aes128Cbc.encrypt(commonRequest.getData(), dataSecret, dataSecretIV); + commonRequest.setData(data); + Calendar cal = Calendar.getInstance(); + DateTime dt = new DateTime(cal); + commonRequest.setTimeStamp(dt.toString(DatePattern.PURE_DATETIME_PATTERN)); + commonRequest.setSeq(String.valueOf(DateUtil.millisecond(dt))); + String sig = + HMAC.hmacDigest(commonRequest.getOperatorId() + data + commonRequest.getTimeStamp() + commonRequest.getSeq(), + sigSecret); + commonRequest.setSig(sig); + final String jsonString = JSONUtil.toJSONString(commonRequest); +// log.debug("enc to out:{} ", jsonString); + return jsonString; + } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipBusinessPolicyController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipBusinessPolicyController.java index 2034c0d3..1d715495 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipBusinessPolicyController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryEquipBusinessPolicyController.java @@ -1,5 +1,6 @@ package com.xhpc.evcs.api; +import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.data.redis.CacheRateModel; import com.xhpc.evcs.dto.*; import com.xhpc.evcs.jpa.XhpcTerminalRepository; @@ -20,7 +21,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; @Slf4j @RestController -public class QueryEquipBusinessPolicyController { +public class QueryEquipBusinessPolicyController extends BaseController { @Autowired private XhpcTerminalRepository xhpcTerminalRepository; diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStopChargeController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStopChargeController.java index 719cd7e0..74dce2ac 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStopChargeController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStopChargeController.java @@ -78,9 +78,6 @@ public class QueryStopChargeController { pileInfo.getCommunicationProtocolVersion() : "0A"; //给对应的枪发送停止充电指令 - System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); - System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); - System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum); // 判断停止指令发送是否成功 diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDNotificationStationInfoController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDNotificationStationInfoController.java index 909b4eec..0489e2e5 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDNotificationStationInfoController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDNotificationStationInfoController.java @@ -137,10 +137,10 @@ public class CDNotificationStationInfoController extends CoreDispatcher { Map mapStationInfo =new HashMap<>(); mapStationInfo.put("StationInfo",cdStationInfo); String data =JSONUtil.toJSONString(mapStationInfo); - System.out.println("=======data========"+data); + // System.out.println("=======data========"+data); commonRequest.setData(data); String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut); - System.out.println("=======result========"+result); + // System.out.println("=======result========"+result); } }catch (Exception e){ e.printStackTrace(); @@ -157,7 +157,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher { @PostMapping("/v10/query_stations_info") public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest commonRequest) { - System.out.println("================查询充电站信息======================="); + // System.out.println("================查询充电站信息======================="); CommonResponse resp = new CommonResponse(); try{ //当前页数 @@ -242,7 +242,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher { */ @PostMapping("/v10/getNotificationConnectorChargeStatus") public void getNotificationConnectorChargeStatus(@RequestBody Map orderMap){ - System.out.println("==================设备充电中状态变化推送(我们平台推送成都市平台) =========================="); + //System.out.println("==================设备充电中状态变化推送(我们平台推送成都市平台) =========================="); //先查订单号 在查实时数据 最后计算金额 try { String orderNo = orderMap.get("orderNo").toString(); @@ -327,7 +327,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher { CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut); - System.out.println("===设备充电中状态变化推送====result========"+result); + // System.out.println("===设备充电中状态变化推送====result========"+result); } } catch (JsonProcessingException e) { e.printStackTrace(); @@ -493,7 +493,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher { CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String ok = ok(commonRequest, "/notification_stationFee", authSecretTokenOut); - log.info("===============notification_stationFee=================="+ok); + //log.info("===============notification_stationFee=================="+ok); REDIS.deleteObject(stationKey); } } @@ -894,7 +894,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher { String dataSecretIV="av6A8QdnRaVRMXu6"; String data = Aes128Cbc.encrypt(rawData, dataSecret, dataSecretIV); - System.out.println("==========data=============="+data); + // System.out.println("==========data=============="+data); }catch (Exception e){ e.printStackTrace(); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDQueryStopChargeController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDQueryStopChargeController.java index 1b13c1c3..aeeeb1bb 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDQueryStopChargeController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/api/CDQueryStopChargeController.java @@ -81,8 +81,8 @@ public class CDQueryStopChargeController { pileInfo.getCommunicationProtocolVersion() : "0A"; //给对应的枪发送停止充电指令 - System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); - System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); + // System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); + // System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo); R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum); // 判断停止指令发送是否成功 diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDConnectorChargeStatusInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDConnectorChargeStatusInfoTask.java index c3a96174..4c57c844 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDConnectorChargeStatusInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDConnectorChargeStatusInfoTask.java @@ -39,12 +39,29 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher { private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo; private final Logger logger = LoggerFactory.getLogger(CDConnectorChargeStatusInfoTask.class); + //9099开放定时任务 9009不开放 + /** + * 清除3天前数据 + * 实时数据没40秒 + */ + @Scheduled(fixedDelay = 1000 * 60) + public void runY() throws Exception{ + Collection realtimeOrder = REDIS.keys("cdjgpc:realTime:*"); + for (String okey : realtimeOrder) { + String orderNo = REDIS.getCacheObject(okey); + String format = DateUtil.format(DateUtil.offsetDay(new Date(),-3), "yyMMdd"); + if(Integer.parseInt(format)>Integer.parseInt(orderNo.substring(16,22))){ + REDIS.deleteObject(okey); + } + } + } + //9099开放定时任务 9009不开放 /** * 设备充电中状态变化推送(我们平台推送成都市平台) --已推送 * 实时数据没40秒 */ - // @Scheduled(fixedDelay = 1000 * 40) + @Scheduled(fixedDelay = 1000 * 40) public void run() throws Exception{ List longList =new ArrayList<>(); @@ -79,6 +96,10 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher { } if(falen){ continue;} CacheRealtimeData lord = REDIS.getCacheObject("order:"+orderNo+".lord"); + if(lord ==null){ + REDIS.deleteObject(okey); + continue; + } String formatTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); Map cacheMap =REDIS.getCacheMap("order:"+orderNo+".notification"); if(cacheMap==null || cacheMap.get("startTime")==null || "".equals(cacheMap.get("startTime"))){ @@ -157,15 +178,32 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher { CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut); + System.out.println("===设备充电中状态变化推送====lord.getOrderNo()========"+lord.getOrderNo()); + System.out.println("===设备充电中状态变化推送====result========"+result); JSONObject jsonObject = JSONObject.parseObject(result); if("0".equals(jsonObject.get("Ret").toString())){ + System.out.println("===设备充电中状态变化推送====okey========"+okey); REDIS.deleteObject(okey); } - //System.out.println("===设备充电中状态变化推送====result========"+result); } } catch (JsonProcessingException e) { e.printStackTrace(); } } } + + public static void main(String[] args) { + String num ="80836000010001022504092251329998"; + String format = DateUtil.format(DateUtil.offsetDay(new Date(),-3), "yyMMdd"); + System.out.println(format); + System.out.println(num.substring(16,22)); + if(Integer.parseInt(format)>Integer.parseInt(num.substring(16,22))){ + System.out.println("=============="); + }else{ + System.out.println("=======4444======="); + } + + } + + } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationChargeOrderInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationChargeOrderInfoTask.java index 15f5aa9f..d0a6ea29 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationChargeOrderInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationChargeOrderInfoTask.java @@ -43,7 +43,7 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher { private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class); //9099开放定时任务 9009不开放 - //@Scheduled(fixedRate = 1000 * 15) + @Scheduled(fixedRate = 1000 * 15) public void run() throws JsonProcessingException { Collection orderKeys = REDIS.keys("order:*"); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationEquipmentV2GPowerInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationEquipmentV2GPowerInfoTask.java index 9ada265a..d8099f69 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationEquipmentV2GPowerInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationEquipmentV2GPowerInfoTask.java @@ -94,10 +94,10 @@ public class CDNotificationEquipmentV2GPowerInfoTask extends CoreDispatcher { Map mapStationInfo =new HashMap<>(); mapStationInfo.put("EquipmentV2GPowerInfo",cdEquipmentV2GPowerInfo); String data = JSONUtil.toJSONString(mapStationInfo); - System.out.println("=======data========"+data); + // System.out.println("=======data========"+data); commonRequest.setData(data); String result =ok(commonRequest,"/notification_equipmentV2GPowerInfo",authSecretTokenOut); - System.out.println("=====V2G 实时负荷信息推送==result========"+result); + // System.out.println("=====V2G 实时负荷信息推送==result========"+result); } } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationOrderInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationOrderInfoTask.java index 1cdfa536..ea966e3f 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationOrderInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationOrderInfoTask.java @@ -22,6 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Example; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.io.IOException; import java.util.Date; @@ -39,6 +42,8 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; */ @Component @Slf4j +@RestController +@RequestMapping("/api/orderInfoTask") public class CDNotificationOrderInfoTask extends CoreDispatcher { @Autowired private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; @@ -54,26 +59,24 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher { private XhpcChargingStationRepository chargingStationRepo; @Autowired private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo; - private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class); + private final Logger logger = LoggerFactory.getLogger(CDNotificationOrderInfoTask.class); /** *订单信息推送 ---已推送--推送服务使用 * @throws IOException */ //9099开放定时任务 9009不开放 - //@Scheduled(fixedDelay = 1000 * 60) + @GetMapping("/infoTask") + @Scheduled(fixedRate = 1000 * 30) public void run() throws IOException { - AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType( "MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo // maybe对接第三方 if (authSecretTokenOut != null) { - final List notYetPushOrder = - xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0); + xhpcHistoryOrderRepository.findTop1000ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder()); for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) { - XhpcStationInternetBlacklist xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(), 6L).orElse(null); @@ -85,7 +88,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher { notify(xhpcHistoryOrder, authSecretTokenOut, false); }else{ //充电时长不能小于或等于0 不能推送 - logger.info("========新平台推送=======responseBody===================充电时长不能小于或等于0=========="); + // logger.info("========新平台推送=======responseBody===================充电时长不能小于或等于0=========="); } } @@ -146,10 +149,11 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher { commonRequest.setData(data); String responseBody = ok(commonRequest, "/notification_orderInfo", authSecretTokenOut); logger.info("========新平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq()); - logger.info("========新平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq()); + CDCancelOrderResponse cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody, CDCancelOrderResponse.class, authSecretTokenOut); + //logger.info("========新平台推送=======responseBody==状态==========================="+cdChargeOrder4BonusInfoRes.getStatus()); if (!isRepush) { authSecretTokenOut.setLastPushOrder(xhpcHistoryOrder.getHistoryOrderId()); authSecretTokenRepository.save(authSecretTokenOut); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationFeeTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationFeeTask.java index ebc6e0c6..3ccbb47f 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationFeeTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationFeeTask.java @@ -31,7 +31,7 @@ public class CDNotificationStationFeeTask extends CoreDispatcher { private final Logger logger = LoggerFactory.getLogger(CDNotificationStationFeeTask.class); //9099开放定时任务 9009不开放 - //@Scheduled(fixedDelay = 1000 * 60) + @Scheduled(fixedDelay = 1000 * 60) public void run() throws IOException { AuthSecretToken authSecretTokenOut = @@ -48,7 +48,7 @@ public class CDNotificationStationFeeTask extends CoreDispatcher { CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String ok = ok(commonRequest, "/notification_stationFee", authSecretTokenOut); - log.info("======站点费率推送=========notification_stationFee=================="+ok); + // log.info("======站点费率推送=========notification_stationFee=================="+ok); REDIS.deleteObject(stationKey); } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationInfoTask.java index 18a1aafa..1518b0d1 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationInfoTask.java @@ -32,7 +32,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher { private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class); //9099开放定时任务 9009不开放 - //@Scheduled(cron = "0 0 0 1/15 * ? ") + @Scheduled(cron = "0 0 0 1/15 * ? ") public void run() throws IOException { try{ List xhpcStationInternetBlacklist = @@ -114,10 +114,10 @@ public class CDNotificationStationInfoTask extends CoreDispatcher { Map mapStationInfo =new HashMap<>(); mapStationInfo.put("StationInfo",cdStationInfo); String data = JSONUtil.toJSONString(mapStationInfo); - System.out.println("=======data========"+data); + // System.out.println("=======data========"+data); commonRequest.setData(data); String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut); - System.out.println("=====推送充电站信息==result========"+result); + // System.out.println("=====推送充电站信息==result========"+result); } } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationPowerInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationPowerInfoTask.java index a270a42b..ff72ca82 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationPowerInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationPowerInfoTask.java @@ -46,7 +46,7 @@ public class CDNotificationStationPowerInfoTask extends CoreDispatcher { private final Logger logger = LoggerFactory.getLogger(CDNotificationStationPowerInfoTask.class); //9099开放定时任务 9009不开放 - //@Scheduled(cron = "0 0/1 * * * ? ") + //@Scheduled(cron = "0 0/1 * * * ? ") public void run() throws IOException { //不参与合作的电站 List xhpcStationInternetBlacklist =xhpcStationInternetBlacklistRepo.findByInternetUserId(6L); @@ -98,10 +98,10 @@ public class CDNotificationStationPowerInfoTask extends CoreDispatcher { Map mapStationInfo =new HashMap<>(); mapStationInfo.put("StationPowerInfo",cdStationPowerlnfo); String data = JSONUtil.toJSONString(mapStationInfo); - System.out.println("=======data========"+data); + // System.out.println("=======data========"+data); commonRequest.setData(data); String result =ok(commonRequest,"/notification_stationPowerInfo",authSecretTokenOut); - System.out.println("=====充电站实时负荷信息推送==result========"+result); + // System.out.println("=====充电站实时负荷信息推送==result========"+result); } } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationStatusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationStatusTask.java index 25de40c0..4b0a8cf4 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationStatusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDNotificationStationStatusTask.java @@ -50,7 +50,7 @@ public class CDNotificationStationStatusTask extends CoreDispatcher { @Resource private XhpcTerminalRepository terminalRepository; //9099开放定时任务 9009不开放 - //@Scheduled(fixedRate = 1000 * 45) + @Scheduled(fixedRate = 1000 * 180) protected void run() throws IOException { Collection stationTerminalKeys = REDIS.keys("stationTerminalStatus:*"); @@ -124,9 +124,9 @@ public class CDNotificationStationStatusTask extends CoreDispatcher { CDConnectorStatusInfoReq connectorStatusInfoReq = new CDConnectorStatusInfoReq(); - System.out.println("=========stationTerminalKey=========="+stationTerminalKey); + //System.out.println("=========stationTerminalKey=========="+stationTerminalKey+"======ConnectorID======="+connectorStatusInfo.getConnectorID()); String key =stationTerminalKey.replace("stationTerminalStatus","cdjgpc:station")+".notification"; - System.out.println("=========key=========="+key); + // System.out.println("=========key=========="+key); CDStationInfo cdStationInfo =REDIS.getCacheObject(key); CDConnectorStatusInfo cdConnectorStatusInfo =new CDConnectorStatusInfo(); cdConnectorStatusInfo.setOperatorID(cdStationInfo.getOperatorId()); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationOperationStatusInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationOperationStatusInfoTask.java index 9c138e48..97f9fc30 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationOperationStatusInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationOperationStatusInfoTask.java @@ -50,7 +50,7 @@ public class CDSuperviseNotificationOperationStatusInfoTask extends CoreDispatch R r = powerPileService.getSuperviseNotificationOperationStatusInfo(replace); if(r.getCode() !=200){ - logger.info("========推送充电站用能统计信息失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); + // logger.info("========推送充电站用能统计信息失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); } String key ="cdjgpc:station:"+replace+".getSuperviseNotificationOperationStatusInfo"; List stationStatsInfoList =REDIS.getCacheObject(key); @@ -63,8 +63,8 @@ public class CDSuperviseNotificationOperationStatusInfoTask extends CoreDispatch CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String ok = ok(commonRequest, "/supervise_notification_operation_status_info", authSecretTokenOut); - System.out.println("=====ok======"+ok); - logger.info("========推送充电站用能统计信息成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); + // System.out.println("=====ok======"+ok); + // logger.info("========推送充电站用能统计信息成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); REDIS.deleteObject(key); } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationRealtimePowerInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationRealtimePowerInfoTask.java index ebb9f374..715a1dc2 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationRealtimePowerInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cdjgpc/notification/CDSuperviseNotificationRealtimePowerInfoTask.java @@ -51,7 +51,7 @@ public class CDSuperviseNotificationRealtimePowerInfoTask extends CoreDispatcher R r = powerPileService.getSuperviseNotificationRealtimePowerInfo(authSecretTokenOut.getOperatorId3irdpty(),replace); if(r.getCode() !=200){ - logger.info("========推送充电站实时功率失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); + // logger.info("========推送充电站实时功率失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); } String key ="cdjgpc:station:"+replace+".getSuperviseNotificationRealtimePowerInfo"; List supStationPowerInfos =REDIS.getCacheObject(key); @@ -62,8 +62,8 @@ public class CDSuperviseNotificationRealtimePowerInfoTask extends CoreDispatcher CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String ok = ok(commonRequest, "/supervise_notification_realtime_power_info", authSecretTokenOut); - System.out.println("=====ok======"+ok); - logger.info("========推送充电站实时功率成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); + //System.out.println("=====ok======"+ok); + //logger.info("========推送充电站实时功率成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd")); REDIS.deleteObject(key); } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/config/EvcsFilter.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/config/EvcsFilter.java index 33366970..fa0f5ea0 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/config/EvcsFilter.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/config/EvcsFilter.java @@ -75,7 +75,7 @@ public class EvcsFilter extends OncePerRequestFilter { if (!ObjectUtils.isEmpty(bodyString)) { String servletPath = request.getServletPath(); log.debug("servletPath: " + servletPath); - log.info("=================servletPath=========================="+servletPath); + //log.info("=================servletPath=========================="+servletPath); CommonRequest commonRequest = JSONUtil.readParams(bodyString, CommonRequest.class); resp.setRet(EvcsConst.RET_FAIL); ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response); @@ -89,7 +89,7 @@ public class EvcsFilter extends OncePerRequestFilter { } else { String operatorId = commonRequest.getOperatorId(); - log.info("=================operatorId=========================="+operatorId); + // log.info("=================operatorId=========================="+operatorId); String authorization = request.getHeader("Authorization"); log.debug("Authorization: {}", authorization); @@ -97,19 +97,19 @@ public class EvcsFilter extends OncePerRequestFilter { Date now = Calendar.getInstance().getTime(); if (servletPath.endsWith("/v1/query_token")) { - log.info("================老接口过滤 token========operatorId=========="+operatorId); + // log.info("================老接口过滤 token========operatorId=========="+operatorId); authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(1,operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null); handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest, responseWrapper, authSecretTokenIn); }else if (servletPath.endsWith("/v10/query_token")) { - log.info("================新监管平台(蓉城充) token========operatorId=========="+operatorId); + // log.info("================新监管平台(蓉城充) token========operatorId=========="+operatorId); authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(2,operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null); handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest, responseWrapper, authSecretTokenIn); }else if (servletPath.endsWith("/v20/query_token")) { - log.info("================川逸充 token========operatorId=========="+operatorId); + // log.info("================川逸充 token========operatorId=========="+operatorId); authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(3,operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null); handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest, @@ -118,21 +118,22 @@ public class EvcsFilter extends OncePerRequestFilter { if (authorization != null && authorization.startsWith("Bearer ")) { String token = authorization.replace("Bearer ", ""); - if(servletPath.endsWith("/v1/")){ - authSecretTokenIn = - authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(1, - operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); - }else if(servletPath.endsWith("/v10/")){ - authSecretTokenIn = - authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(2, - operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); - }else if(servletPath.endsWith("/v20/")){ - authSecretTokenIn = - authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(3, - operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); - } - +// if(servletPath.endsWith("/v1/")){ +// authSecretTokenIn = +// authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(1, +// operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); +// }else if(servletPath.endsWith("/v10/")){ +// authSecretTokenIn = +// authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(2, +// operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); +// }else if(servletPath.endsWith("/v20/")){ +// authSecretTokenIn = +// authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(3, +// operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); +// } + authSecretTokenIn =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan( + operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null); if (authSecretTokenIn == null) { resp.setRet("4002"); resp.setMsg("Invalid token(db)"); @@ -185,7 +186,7 @@ public class EvcsFilter extends OncePerRequestFilter { final String encout = request.getHeader("enc.out"); chain.doFilter(requestWrapper, responseWrapper); byte[] buf = responseWrapper.getContentAsByteArray(); - log.debug("out.plain: {}", new String(buf, StandardCharsets.UTF_8)); + // log.debug("out.plain: {}", new String(buf, StandardCharsets.UTF_8)); String encryptedData; if (encout == null) { encryptedData = encryptRespOut(authSecretTokenIn.getDataSecret(), authSecretTokenIn.getDataSecretIV(), @@ -358,7 +359,7 @@ public class EvcsFilter extends OncePerRequestFilter { equipBizRequest.setConnectorId("8083600001000801"); String data = JSONUtil.toJSONString(equipBizRequest); - System.out.println("========data========"+data); + //System.out.println("========data========"+data); commonRequest.setData(data); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cyc/api/CYCNotificationStationInfoController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cyc/api/CYCNotificationStationInfoController.java index de044d83..4d343967 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cyc/api/CYCNotificationStationInfoController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/cyc/api/CYCNotificationStationInfoController.java @@ -41,8 +41,8 @@ public class CYCNotificationStationInfoController extends CoreDispatcher { */ @PostMapping("/v20/getCYCNotificationConnectorChargeStatus") public void getCYCNotificationConnectorChargeStatus(@RequestBody Map orderMap){ - System.out.println("==================设备充电中状态变化推送(川逸充) =========================="); - System.out.println("==================设备充电中状态变化推送(川逸充) =============orderMap============="+orderMap.toString()); + //System.out.println("==================设备充电中状态变化推送(川逸充) =========================="); + //System.out.println("==================设备充电中状态变化推送(川逸充) =============orderMap============="+orderMap.toString()); //先查订单号 在查实时数据 最后计算金额 try { String orderNo = orderMap.get("orderNo").toString(); @@ -99,14 +99,14 @@ public class CYCNotificationStationInfoController extends CoreDispatcher { //Map map =new HashMap<>(); //map.put("ConnectorChargeStatusInfo",cdConnectorChargeStatusInfo); String data = JSONUtil.toJSONString(cdConnectorChargeStatusInfo); - System.out.println("===川逸充设备充电中状态变化推送====data========"+data); + // System.out.println("===川逸充设备充电中状态变化推送====data========"+data); CommonRequest commonRequest = new CommonRequest<>(); commonRequest.setData(data); String result = ok(commonRequest, "/notification_equip_charge_status", authSecretTokenOut); - System.out.println("===川逸充设备充电中状态变化推送====result========"+result); + // System.out.println("===川逸充设备充电中状态变化推送====result========"+result); CYCChargeChargeStatusResponse chargeStatusResponse = DTOJsonHelper.parseResponseData(result, CYCChargeChargeStatusResponse.class, authSecretTokenOut); - System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+chargeStatusResponse.toString()); + // System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+chargeStatusResponse.toString()); } } catch (JsonProcessingException e) { e.printStackTrace(); @@ -141,13 +141,13 @@ public class CYCNotificationStationInfoController extends CoreDispatcher { String result = ok(commonRequest, "/notification_start_charge_result", authSecretToken.get()); - System.out.println("===川逸充启动结果推送====result========"+result); + // System.out.println("===川逸充启动结果推送====result========"+result); CYCChargeOrderInfoResponse cycChargeOrderInfoResponse = DTOJsonHelper.parseResponseData(result, CYCChargeOrderInfoResponse.class, authSecretToken.get()); - System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+cycChargeOrderInfoResponse.toString()); + // System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+cycChargeOrderInfoResponse.toString()); } }else{ - System.out.println("===川逸充启动结果失败====result========"); + // System.out.println("===川逸充启动结果失败====result========"); } } @@ -176,7 +176,7 @@ public class CYCNotificationStationInfoController extends CoreDispatcher { //String result="pCA3UNQO1CqxRS6KvcNDpw=="; CYCChargeOrderInfoResponse cycChargeOrderInfoResponse = DTOJsonHelper.parseResponseData(result, CYCChargeOrderInfoResponse.class, authSecretToken.get()); - System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+cycChargeOrderInfoResponse.toString()); + // System.out.println("===川逸充设备充电中状态变化推送====cycChargeOrderInfoResponse========"+cycChargeOrderInfoResponse.toString()); } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java index de2ecbdb..d5340ed3 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/jpa/XhpcHistoryOrderRepository.java @@ -20,15 +20,21 @@ public interface XhpcHistoryOrderRepository extends JpaRepository findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i); + List findTop100ByHistoryOrderIdGreaterThanEqualAndConfirmResultAndUserIdOrderByHistoryOrderIdAsc(Long hisOrderId,int confirmResult, Long userId); + List findByConfirmResultNotAndOperatorId3rdptyEvcsIsNotNull(int succCode); List findByConfirmResultNotAndSource(int confirmResult, int source); + List findByConfirmResultAndSource(int confirmResult, int source); + + List findTop1000ByHistoryOrderIdGreaterThanEqualOrderByHistoryOrderIdAsc(Long hisOrderId); + @Query("select ho from XhpcHistoryOrder ho join EtPushFailedOrder fo on ho.historyOrderId = fo.id where fo.operatorId3rdpty = ?1") List findJoinPushFailedOrders(@Param("operatorId3irdpty")String operatorId3irdpty, Pageable pageable); default List findTop10JoinPushFailedOrders(String operatorId3irdpty) { - return findJoinPushFailedOrders(operatorId3irdpty, PageRequest.of(0, 100)); + return findJoinPushFailedOrders(operatorId3irdpty, PageRequest.of(0, 500)); } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/CoreDispatcher.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/CoreDispatcher.java index 23eb1c1c..eb4904e8 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/CoreDispatcher.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/CoreDispatcher.java @@ -117,13 +117,13 @@ public class CoreDispatcher { bearerToken = authSecretTokenOut.getToken(); commonRequest.setData(originalData); tData = JSONUtil.toJSONString(commonRequest); - System.out.println("=========加密前data=============="+tData); - log.debug("to [{}] {} out plain data:\n{}", authSecretTokenOut.getOperatorId3irdpty(), url, tData); + // System.out.println("=========加密前data=============="+tData); + //log.debug("to [{}] {} out plain data:\n{}", authSecretTokenOut.getOperatorId3irdpty(), url, tData); if (authSecretTokenOut.isEncrypt()) { tData = encryptReqOut(authSecretTokenOut.getDataSecret(), authSecretTokenOut.getDataSecretIV(), authSecretTokenOut.getSigSecret(), commonRequest); // log.debug("notify out encrypt data:\n{}", tData); - System.out.println("=========加密data=============="+tData); + // System.out.println("=========加密data=============="+tData); } body = okhttp3.RequestBody.create(JSON, tData); // logger.info("==============平台推送值================="+tData); @@ -239,7 +239,7 @@ public class CoreDispatcher { bearerToken = authSecretTokenOut.getToken(); commonRequest.setData(originalData); tData = JSONUtil.toJSONString(commonRequest); - log.debug("to [{}] {} out plain data:\n{}", authSecretTokenOut.getOperatorId3irdpty(), url, tData); + // log.debug("to [{}] {} out plain data:\n{}", authSecretTokenOut.getOperatorId3irdpty(), url, tData); if (authSecretTokenOut.isEncrypt()) { tData = encryptReqOut(authSecretTokenOut.getDataSecret(), authSecretTokenOut.getDataSecretIV(), authSecretTokenOut.getSigSecret(), commonRequest); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java index 01274b17..ab2a8dbc 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationCancelOrderTask.java @@ -32,7 +32,7 @@ public class NotificationCancelOrderTask extends CoreDispatcher { //推送不开放(evcs 放开) //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 15) + @Scheduled(fixedRate = 1000 * 15) public void run() throws JsonProcessingException { //Getting the orders, which need to be notified. diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java index 61166c95..94372ef1 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfo4BonusTask.java @@ -47,7 +47,7 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher { * @throws IOException */ //9099开放定时任务 9009不开放 - //@Scheduled(fixedDelay = 1000 * 60) + //@Scheduled(fixedRate = 1000 * 180) public void run() throws IOException { AuthSecretToken authSecretTokenOut = @@ -116,8 +116,8 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher { commonRequest.setData(data); String responseBody = ok(commonRequest, "/notification_charge_order_info_for_bonus", authSecretTokenOut, operatorIdEvcs); - logger.info("========老平台推送=======operatorIdEvcs============================="+operatorIdEvcs); - logger.info("========老平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq()); + //logger.info("========老平台推送=======operatorIdEvcs============================="+operatorIdEvcs); + //logger.info("========老平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq()); CDChargeOrder4BonusInfoRes cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody, CDChargeOrder4BonusInfoRes.class, authSecretTokenOut); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoHenDaTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoHenDaTask.java new file mode 100644 index 00000000..bc68a0ab --- /dev/null +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoHenDaTask.java @@ -0,0 +1,98 @@ +package com.xhpc.evcs.notification; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.xhpc.evcs.domain.AuthSecretToken; +import com.xhpc.evcs.dto.ChargeOrderInfo; +import com.xhpc.evcs.dto.ChargeOrderInfoResponse; +import com.xhpc.evcs.dto.CommonRequest; +import com.xhpc.evcs.dto.DTOJsonHelper; +import com.xhpc.evcs.jpa.AuthSecretTokenRepository; +import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository; +import com.xhpc.evcs.utils.JSONUtil; +import com.xhpc.order.domain.XhpcHistoryOrder; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; + +import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; +import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; + +/** + * 恒大推送订单 + */ +@Component +@Slf4j +public class NotificationChargeOrderInfoHenDaTask extends CoreDispatcher { + + @Autowired + private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; + @Autowired + private AuthSecretTokenRepository authSecretTokenRepository; + + private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoHenDaTask.class); + /** + * 推送充电恒大订单信息 + * * @throws IOException + */ + //9099开放定时任务 9009不开放 + //@Scheduled(fixedDelay = 1000 * 15) + //@Scheduled(cron = "0/30 * * * * ? ") + public void run() throws IOException { + + AuthSecretToken authSecretTokenOut = + authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType( + "MA5FF58R7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo + + // maybe对接第三方 + if (authSecretTokenOut != null) { + final List notYetPushOrder = + xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanEqualAndConfirmResultAndUserIdOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), -1,2L); + for (XhpcHistoryOrder horder : notYetPushOrder) { + + String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs(); + if (operatorId3rdptyEvcs == null) { + if (horder.getInternetSerialNumber() != null) { + operatorId3rdptyEvcs = horder.getInternetSerialNumber().substring(0, 9); + horder.setOperatorId3rdptyEvcs(operatorId3rdptyEvcs); + xhpcHistoryOrderRepository.save(horder); // mending + } + } + + ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder); + final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretTokenOut); + if (pushResp != null) { + horder.setConfirmResult(pushResp.getConfirmResult()); + logger.debug("恒大3rd part order {} push result: {}", horder.getSerialNumber(), + pushResp.getConfirmResult()); + //logger.info("==============推送返回值================="+pushResp.toString()); + xhpcHistoryOrderRepository.save(horder); + REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true); + + authSecretTokenOut.setLastPushOrder(horder.getHistoryOrderId()); + authSecretTokenRepository.save(authSecretTokenOut); + } else { + logger.error("恒大3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs, + horder.getSerialNumber(), horder.getInternetSerialNumber()); + } + } + + } + } + + + public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException { + + String data = JSONUtil.toJSONString(chargeOrderInfo); + CommonRequest commonRequest = new CommonRequest<>(); + commonRequest.setData(data); + String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut); + return DTOJsonHelper.parseResponseData(responseBody, + ChargeOrderInfoResponse.class, authSecretTokenOut); + } +} diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoKuaiDianTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoKuaiDianTask.java new file mode 100644 index 00000000..1ee45c88 --- /dev/null +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoKuaiDianTask.java @@ -0,0 +1,99 @@ +package com.xhpc.evcs.notification; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.xhpc.evcs.domain.AuthSecretToken; +import com.xhpc.evcs.dto.ChargeOrderInfo; +import com.xhpc.evcs.dto.ChargeOrderInfoResponse; +import com.xhpc.evcs.dto.CommonRequest; +import com.xhpc.evcs.dto.DTOJsonHelper; +import com.xhpc.evcs.jpa.AuthSecretTokenRepository; +import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository; +import com.xhpc.evcs.utils.JSONUtil; +import com.xhpc.order.domain.XhpcHistoryOrder; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; + +import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; +import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; + +/** + * 快电推送订单 + */ +@Component +@Slf4j +public class NotificationChargeOrderInfoKuaiDianTask extends CoreDispatcher { + + @Autowired + private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; + @Autowired + private AuthSecretTokenRepository authSecretTokenRepository; + + private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoKuaiDianTask.class); + /** + * 推送充电快电订单信息 + * * @throws IOException + */ + //9099开放定时任务 9009不开放 + //@Scheduled(fixedDelay = 1000 * 26) + //@Scheduled(cron = "0/20 * * * * ? ") + public void run() throws IOException { + + AuthSecretToken authSecretTokenOut = + authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType( + "MA005DBW1", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo + + // maybe对接第三方 + if (authSecretTokenOut != null) { + final List notYetPushOrder = + xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanEqualAndConfirmResultAndUserIdOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), -1,1L); + for (XhpcHistoryOrder horder : notYetPushOrder) { + + String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs(); + if (operatorId3rdptyEvcs == null) { + if (horder.getInternetSerialNumber() != null) { + operatorId3rdptyEvcs = horder.getInternetSerialNumber().substring(0, 9); + horder.setOperatorId3rdptyEvcs(operatorId3rdptyEvcs); + xhpcHistoryOrderRepository.save(horder); // mending + } + } + + ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder); + final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretTokenOut); + if (pushResp != null) { + horder.setConfirmResult(pushResp.getConfirmResult()); + logger.debug("快电3rd part order {} push result: {}", horder.getSerialNumber(), + pushResp.getConfirmResult()); + //logger.info("==============推送返回值================="+pushResp.toString()); + xhpcHistoryOrderRepository.save(horder); + REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true); + + authSecretTokenOut.setLastPushOrder(horder.getHistoryOrderId()); + authSecretTokenRepository.save(authSecretTokenOut); + + } else { + logger.error("快电3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs, + horder.getSerialNumber(), horder.getInternetSerialNumber()); + } + } + + } + } + + + public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException { + + String data = JSONUtil.toJSONString(chargeOrderInfo); + CommonRequest commonRequest = new CommonRequest<>(); + commonRequest.setData(data); + String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut); + return DTOJsonHelper.parseResponseData(responseBody, + ChargeOrderInfoResponse.class, authSecretTokenOut); + } +} diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java index 335760ec..8a7e43d1 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoTask.java @@ -40,7 +40,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class); //推送不开放(evcs 放开) //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 15) + @Scheduled(fixedDelay = 1000 * 15) public void run() throws JsonProcessingException { Collection orderKeys = REDIS.keys("order:*"); @@ -61,7 +61,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher { } List authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT); List xhpcHistoryOrderList = - xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1); + xhpcHistoryOrderRepository.findByConfirmResultAndSource(-1, 1); for (XhpcHistoryOrder horder : xhpcHistoryOrderList) { if("765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){ diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoXinDianTuTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoXinDianTuTask.java new file mode 100644 index 00000000..590744e9 --- /dev/null +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationChargeOrderInfoXinDianTuTask.java @@ -0,0 +1,97 @@ +package com.xhpc.evcs.notification; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.xhpc.evcs.domain.*; +import com.xhpc.evcs.dto.*; +import com.xhpc.evcs.jpa.*; +import com.xhpc.evcs.utils.DateUtil; +import com.xhpc.evcs.utils.JSONUtil; +import com.xhpc.order.domain.XhpcHistoryOrder; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Example; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; +import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT; + +/** + * 新电途推送订单 + */ +@Component +@Slf4j +public class NotificationChargeOrderInfoXinDianTuTask extends CoreDispatcher { + + @Autowired + private XhpcHistoryOrderRepository xhpcHistoryOrderRepository; + @Autowired + private AuthSecretTokenRepository authSecretTokenRepository; + + private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoXinDianTuTask.class); + /** + * 推送充电新电途订单信息 + * * @throws IOException + */ + //9099开放定时任务 9009不开放 + //@Scheduled(fixedDelay = 1000 * 23) + //@Scheduled(cron = "0/15 * * * * ? ") + public void run() throws IOException { + logger.info("==============开始推送新电途订单================="); + AuthSecretToken authSecretTokenOut = + authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType( + "MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo + // maybe对接第三方 + if (authSecretTokenOut != null) { + final List notYetPushOrder = + xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanEqualAndConfirmResultAndUserIdOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(),-1, 3L); + for (XhpcHistoryOrder horder : notYetPushOrder) { + + String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs(); + logger.info("==============开始推送新电途订单================="+horder.getInternetSerialNumber()); + if (operatorId3rdptyEvcs == null) { + if (horder.getInternetSerialNumber() != null) { + operatorId3rdptyEvcs = horder.getInternetSerialNumber().substring(0, 9); + horder.setOperatorId3rdptyEvcs(operatorId3rdptyEvcs); + xhpcHistoryOrderRepository.save(horder); // mending + } + } + + ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder); + final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretTokenOut); + if (pushResp != null) { + horder.setConfirmResult(pushResp.getConfirmResult()); + logger.debug("新电途3rd part order {} push result: {}", horder.getSerialNumber(), + pushResp.getConfirmResult()); + //logger.info("==============推送返回值================="+pushResp.toString()); + xhpcHistoryOrderRepository.save(horder); + REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true); + + authSecretTokenOut.setLastPushOrder(horder.getHistoryOrderId()); + authSecretTokenRepository.save(authSecretTokenOut); + } else { + logger.error("新电途3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs, + horder.getSerialNumber(), horder.getInternetSerialNumber()); + } + } + + } + } + + + public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException { + + String data = JSONUtil.toJSONString(chargeOrderInfo); + CommonRequest commonRequest = new CommonRequest<>(); + commonRequest.setData(data); + String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut); + return DTOJsonHelper.parseResponseData(responseBody, + ChargeOrderInfoResponse.class, authSecretTokenOut); + } +} diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java index 1fbb9ed3..0fbc08b3 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationEquipChargeStatusTask.java @@ -50,7 +50,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher { */ //推送不开放 //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 30) + @Scheduled(fixedRate = 1000 * 30) public void run() throws IOException { List authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT); @@ -224,14 +224,14 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher { } String data = JSONUtil.toJSONString(equipChargeStatus); CommonRequest commonRequest = new CommonRequest<>(); - System.out.println("===============充电结束状态推送========================"); - System.out.println("===============充电结束状态推送============data============"+data); - System.out.println("===============充电结束状态推送========================"); + //System.out.println("===============充电结束状态推送========================"); + //System.out.println("===============充电结束状态推送============data============"+data); + //System.out.println("===============充电结束状态推送========================"); commonRequest.setData(data); String responseBody = ok(commonRequest, "/notification_equip_charge_status", authSecretTokenOut); - System.out.println("===============充电结束状态推送===========responseBody============="+responseBody); - System.out.println("===============充电结束状态推送========================"); + //System.out.println("===============充电结束状态推送===========responseBody============="+responseBody); + //System.out.println("===============充电结束状态推送========================"); EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody, EquipChargeStatusRes.class, authSecretTokenOut); if (equipChargeStatusRes != null && equipChargeStatusRes.getSuccStat() != 0) { diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStartChargeResultTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStartChargeResultTask.java index ebc952ea..2c347397 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStartChargeResultTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStartChargeResultTask.java @@ -35,7 +35,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher { */ //(evcs 放开 30 秒, 测试平台开放 15秒) //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 15) + @Scheduled(fixedRate = 1000 * 15) public void run() throws IOException { //Getting the charge orders which from 3rd. @@ -46,7 +46,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher { if(pushOrder.get("operatorId3rdptyName") !=null && "CYC".equals((String)pushOrder.get("operatorId3rdptyName"))){ continue; } - logger.info("===============启动推送============================"+pushOrderKey); + //logger.info("===============启动推送============================"+pushOrderKey); Integer startChargeNotificationStat = (Integer) pushOrder.get("startChargeNotificationStat"); if (null != startChargeNotificationStat && 1 != startChargeNotificationStat && startChargeNotificationStat <= 20) { String startChargeSeq = (String) pushOrder.get("internetSerialNumber"); diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java index 37cd0ad9..38b85aa5 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStationStatusTask.java @@ -51,7 +51,7 @@ public class NotificationStationStatusTask extends CoreDispatcher { //推送不开放(evcs 放开) //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 45) + @Scheduled(fixedRate = 1000 * 60) protected void run() throws IOException { Collection stationTerminalKeys = REDIS.keys("stationTerminalStatus:*"); @@ -71,10 +71,14 @@ public class NotificationStationStatusTask extends CoreDispatcher { Set changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos); if (!changeStatus.isEmpty()) { for (XhpcInternetUser xhpcInternetUser : xhpcInternetUserList) { + if("5".equals(xhpcInternetUser.getInternetUserId().toString()) || "6".equals(xhpcInternetUser.getInternetUserId().toString())){ + continue; + } XhpcStationInternetBlacklist xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]), xhpcInternetUser.getInternetUserId()).orElse(null); if (xhpcStationInternetBlacklist != null) continue; + AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(xhpcInternetUser.getOperatorIdEvcs(), SECRET_TOKEN_TYPE_OUT).orElse(null); log.debug("nss pushing to: {}", authSecretTokenOut.getOperatorId3irdpty()); @@ -122,13 +126,20 @@ public class NotificationStationStatusTask extends CoreDispatcher { } public void notify(ConnectorStatusInfo connectorStatusInfo, AuthSecretToken authSecretTokenOut) throws IOException { + try{ + ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq(); + connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo); + String data = JSONUtil.toJSONString(connectorStatusInfoReq); + CommonRequest commonRequest = new CommonRequest<>(); + commonRequest.setData(data); + + //System.out.println("=====================所有设备状态============================"); + String ok = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut); + // System.out.println("=====================所有设备状态===========ok================="+ok); + }catch (Exception e){ + + } - ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq(); - connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo); - String data = JSONUtil.toJSONString(connectorStatusInfoReq); - CommonRequest commonRequest = new CommonRequest<>(); - commonRequest.setData(data); - ok(commonRequest, "/notification_stationStatus", authSecretTokenOut); } } diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java index f17b6bbc..d5801638 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/notification/NotificationStopChargeResultTask.java @@ -28,7 +28,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher { //(evcs 放开) //9009开放定时任务 9099不开放 - //@Scheduled(fixedRate = 1000 * 3) + @Scheduled(fixedRate = 1000 * 3) public void run() throws Exception { notifyService(); diff --git a/evcs-modules/evcs-core/src/main/resources/bootstrap.yml b/evcs-modules/evcs-core/src/main/resources/bootstrap.yml index 2e1f4bfc..674a5abe 100644 --- a/evcs-modules/evcs-core/src/main/resources/bootstrap.yml +++ b/evcs-modules/evcs-core/src/main/resources/bootstrap.yml @@ -1,12 +1,12 @@ -# Tomcat 9009 不走推送 9099走推送 +# Tomcat 9009 不走推送 name: evcs 9099走推送 name: jp 120.26.46.180:8858 server: - port: 9009 + port: 9099 # Spring spring: application: # 应用名称 - name: evcs + name: jp profiles: # 环境配置 active: dev @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java index 4e570ed2..2798c33a 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/domain/SysUser.java @@ -14,6 +14,7 @@ import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -91,6 +92,9 @@ public class SysUser extends BaseEntity @Excel(name = "权限类型", readConverterExp = "0=所有,1=运营商所有,2=子账号,3=流量账号") private Integer dataPowerType; + + + private Integer superType; /** * 流量用户id */ @@ -426,19 +430,28 @@ public class SysUser extends BaseEntity return corpNo; } + public Integer getSuperType() { + return superType; + } + + public void setSuperType(Integer superType) { + this.superType = superType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("userId", getUserId()) - .append("deptId", getDeptId()) + .append("userId", getUserId()) + .append("deptId", getDeptId()) .append("userType", getUserType()) - .append("userName", getUserName()) - .append("nickName", getNickName()) - .append("email", getEmail()) - .append("phonenumber", getPhonenumber()) - .append("sex", getSex()) - .append("avatar", getAvatar()) - .append("password", getPassword()) + .append("userName", getUserName()) + .append("superType", getSuperType()) + .append("nickName", getNickName()) + .append("email", getEmail()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("avatar", getAvatar()) + .append("password", getPassword()) .append("salt", getSalt()) .append("operatorId", getOperatorId()) .append("dataPowerType", getDataPowerType()) @@ -455,6 +468,6 @@ public class SysUser extends BaseEntity .append("tenantId", getTenantId()) .append("tenantName", getTenantName()) .append("corpNo", getCorpNo()) - .toString(); + .toString(); } } diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java index 3868d577..1b577dab 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/xhpc/system/api/model/LoginUser.java @@ -34,6 +34,11 @@ public class LoginUser implements Serializable */ private Integer userType; + /** + * 是否超管 0 是系统超管 1 某个租户超管 2普通用户 + */ + private Integer superType; + private String userTypeUtil; @@ -219,6 +224,14 @@ public class LoginUser implements Serializable this.status = status; } + public Integer getSuperType() { + return superType; + } + + public void setSuperType(Integer superType) { + this.superType = superType; + } + @Override public String toString() { return "LoginUser{" + @@ -226,6 +239,7 @@ public class LoginUser implements Serializable ", userid=" + userid + ", username='" + username + '\'' + ", userType=" + userType + + ", superType=" + superType + ", userTypeUtil='" + userTypeUtil + '\'' + ", tenantId='" + tenantId + '\'' + ", openId='" + openId + '\'' + diff --git a/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java b/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java index 28f64f1f..61bad08c 100644 --- a/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java +++ b/ruoyi-auth/src/main/java/com/xhpc/auth/controller/TokenController.java @@ -58,15 +58,12 @@ public class TokenController extends BaseController @PostMapping("login") public R login(@RequestBody LoginBody form) { - String tenantId = "000000"; - if(tenantId==null || "".equals(tenantId)){ - throw new BaseException("租户ID码必须填写"); - } //查询租户是否在有效期内 -// R r = tenantService.gettenantIdTime(form.getTenantId()); -// if(r.getCode() !=200){ -// return R.fail("该租户已过期或已停用,请联系管理员"); -// } + R r = tenantService.gettenantIdTime(form.getTenantId()); + if(r.getCode() !=200){ + return R.fail("该租户已过期或已停用,请联系管理员"); + } + String tenantId = form.getTenantId(); // 用户登录 LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),0,tenantId); // 获取登录token diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index 62be9823..39b4ae7d 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/xhpc/common/security/service/TokenService.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/xhpc/common/security/service/TokenService.java index c38abb8c..f4397239 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/xhpc/common/security/service/TokenService.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/xhpc/common/security/service/TokenService.java @@ -45,6 +45,7 @@ public class TokenService { loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest())); loginUser.setTenantId(loginUser.getTenantId()); loginUser.setUserType(loginUser.getUserType()); + loginUser.setSuperType(loginUser.getSuperType()); loginUser.setOpenId(loginUser.getOpenId()); loginUser.setUserTypeUtil(loginUser.getUserTypeUtil()); loginUser.setStatus(loginUser.getStatus()); diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index 5bbe74ea..902c9297 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -16,10 +16,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 @@ -35,7 +35,7 @@ spring: datasource: ds1: nacos: - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 dataId: sentinel-ruoyi-gateway groupId: DEFAULT_GROUP data-type: json diff --git a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml index 020707b3..b5bedcae 100644 --- a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml index d6293b3a..f455ff02 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml index bb947c6e..f8eb4379 100644 --- a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java index 99945c02..381928f8 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysRoleController.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @@ -78,7 +79,7 @@ public class SysRoleController extends BaseController @PreAuthorize(hasPermi = "system:role:add") @Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysRole role) + public AjaxResult add(HttpServletRequest request, @Validated @RequestBody SysRole role) { if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { @@ -88,6 +89,9 @@ public class SysRoleController extends BaseController { return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); } + //获取登陆用户 + LoginUser loginUser = tokenService.getLoginUser(request); + role.setTenantId(loginUser.getTenantId()); role.setCreateBy(SecurityUtils.getUsername()); return toAjax(roleService.insertRole(role)); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java index 66e07be0..9fc123b6 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/controller/SysUserController.java @@ -62,8 +62,9 @@ public class SysUserController extends BaseController { @GetMapping("/list") public TableDataInfo list(SysUser user) { LoginUser loginUser = tokenService.getLoginUser(); - user.setTenantId(loginUser.getTenantId()); - user.setUserId(loginUser.getUserid()); + if(loginUser.getUserid()!=1){ + user.setTenantId(loginUser.getTenantId()); + } startPage(); List list = userService.selectUserList(user); return getDataTable(list); @@ -121,6 +122,7 @@ public class SysUserController extends BaseController { sysUserVo.setUserType(UserTypeUtil.USER_TYPE); sysUserVo.setUserTypeUtil(UserTypeUtil.USER); sysUserVo.setUserid(sysUser.getUserId()); + sysUserVo.setSuperType(sysUser.getSuperType()); return R.ok(sysUserVo); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/SysNoticeServiceImpl.java index 5912d0fc..246a53d4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/xhpc/system/service/impl/SysNoticeServiceImpl.java @@ -42,6 +42,10 @@ public class SysNoticeServiceImpl implements ISysNoticeService @Override public List selectNoticeList(SysNotice notice) { + + + + return noticeMapper.selectNoticeList(notice); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml index d0362649..bbd4382c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml index 1f9187dd..3c68f251 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -106,7 +106,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader, - u.tenant_id,ten.tenant_name tenant_name + d.super_type,u.tenant_id,ten.tenant_name tenant_name from sys_user u left join sys_dept d on u.dept_id = d.dept_id @@ -217,6 +218,7 @@ tenant_id, create_by, remark, + super_type, create_time )values( #{userId}, @@ -235,6 +237,7 @@ #{tenantId}, #{createBy}, #{remark}, + #{superType}, sysdate() ) @@ -259,6 +262,7 @@ update_by = #{updateBy}, remark = #{remark}, tenant_id = #{tenantId}, + super_type=#{superType}, update_time = sysdate() where user_id = #{userId} diff --git a/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml b/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml index 09a81fa8..e063163e 100644 --- a/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml +++ b/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/OrderLogController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/OrderLogController.java index 5e19c4a5..17816187 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/OrderLogController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/OrderLogController.java @@ -5,6 +5,8 @@ import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.util.LogUserUtils; import com.xhpc.activity.service.OrderLogService; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.springframework.web.bind.annotation.*; @@ -35,7 +37,7 @@ public class OrderLogController extends BaseController { @RequestParam(required = false) String phone, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, - @RequestParam(required = false) Integer number){ + @RequestParam(required = false) Integer number){ LoginUser loginUser = logUserUtils.getLogUser(request); @@ -46,7 +48,27 @@ public class OrderLogController extends BaseController { params.put("startTime", startTime); params.put("endTime", endTime); params.put("number", number); - params.put("tenantId", loginUser.getTenantId()); + + SysUser sysUser = loginUser.getSysUser(); + Long sysUserId = sysUser.getUserId(); + + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){ + params.put("tenantId",loginUser.getTenantId()); + } + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + params.put("logOperatorId",logOperatorId); + params.put("number",1); + //运营商看自己的场站 + }else{ + params.put("number",2); + params.put("logOperatorId",sysUserId); + //查询赋值的场站 + } + }else{ + params.put("number",0); + } return getDataTable(orderLogService.getOrderPage(params)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/PileLogController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/PileLogController.java index 16708ade..805e6f34 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/PileLogController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/PileLogController.java @@ -7,6 +7,8 @@ import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.enums.StationDeviceEnum; import com.xhpc.common.util.LogUserUtils; import com.xhpc.activity.service.PileLogService; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.springframework.web.bind.annotation.*; @@ -41,9 +43,6 @@ public class PileLogController extends BaseController { @RequestParam(required = false) Long operatorId, @RequestParam(required = false) Long chargingStationId, @RequestParam(required = false) Long chargingPileId) { - - LoginUser loginUser = logUserUtils.getLogUser(request); - startPage(); Map params = new HashMap<>(); @@ -54,7 +53,7 @@ public class PileLogController extends BaseController { params.put("chargingPileId", chargingPileId); params.put("number", number); params.put("pileSerialNumber", pileSerialNumber); - params.put("tenantId", loginUser.getTenantId()); + return getDataTable(pileLogService.getPilePage(params)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/StationLogController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/StationLogController.java index 09391c4e..6d79aac0 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/StationLogController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/StationLogController.java @@ -26,12 +26,14 @@ public class StationLogController extends BaseController { HttpServletRequest request, @RequestParam(required = false) String tenantId, @RequestParam(required = false) Integer number, - @RequestParam(required = false) Long operatorId) { + @RequestParam(required = false) Long operatorId, + @RequestParam(required = false) Long chargingStationId) { startPage(); Map params = new HashMap<>(); params.put("operatorId", operatorId); params.put("number", number); params.put("tenantId", tenantId); + params.put("chargingStationId", chargingStationId); return getDataTable(stationLogService.getStationPage(request,params)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkStationController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkStationController.java index 50ad0f59..dea64915 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkStationController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/WorkStationController.java @@ -135,10 +135,10 @@ public class WorkStationController extends BaseController { @Log(title = "场站设备-新增设备", businessType = BusinessType.INSERT) @PostMapping("/") public R insertNewDevice(HttpServletRequest request, @RequestBody XhpcStationDeviceDomain domain) throws Exception { - LoginUser logUser = logUserUtils.getLogUser(request); domain.setCreateBy(logUser.getUserid().toString()); domain.setUpdateBy(logUser.getUserid().toString()); + domain.setTenantId(logUser.getTenantId()); return R.ok(stationService.insertDevice(domain)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcStationDeviceDomain.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcStationDeviceDomain.java index e8f783fa..a784ac47 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcStationDeviceDomain.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/domain/XhpcStationDeviceDomain.java @@ -8,7 +8,7 @@ import java.util.Date; /** * xhpc_station_device - * @author + * @author */ @Data public class XhpcStationDeviceDomain implements Serializable { @@ -102,5 +102,7 @@ public class XhpcStationDeviceDomain implements Serializable { */ private String updateBy; + private String tenantId; + private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PileLogServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PileLogServiceImpl.java index 14661baa..e495edcb 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PileLogServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/PileLogServiceImpl.java @@ -10,6 +10,7 @@ import com.xhpc.activity.mapper.XhpcDeviceMessageMapper; import com.xhpc.activity.service.PileLogService; import com.xhpc.common.security.service.TokenService; import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; import com.xhpc.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,37 +37,34 @@ public class PileLogServiceImpl extends BaseService implements PileLogService { @Override public List> getPilePage(Map params){ LoginUser loginUser = tokenService.getLoginUser(); - + SysUser sysUser = loginUser.getSysUser(); Long userId = loginUser.getUserid(); //桩的统计、该时段金额 List> list = new ArrayList<>(); - if (userId != UserTypeUtil.USER_ID) { - Map landUser = pileMapper.getLandUser(userId); - if (landUser != null) { - if (landUser.get("userType") != null) { - startPage(); - if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) { - Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); - params.put("logOperatorId", logOperatorId); - params.put("status", 1); - //运营商看自己的场站 - list = pileMapper.selectXhpcChargingPileList(params); - } else { - params.put("logOperatorId", userId); - params.put("status", 2); - //查询赋值的场站 - list = pileMapper.selectXhpcChargingPileList(params); - } - } + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){ + params.put("tenantId",loginUser.getTenantId()); + return pileMapper.selectXhpcChargingPileList(params); } - - } else { + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + params.put("logOperatorId",logOperatorId); + params.put("status",1); + //运营商看自己的场站 + list = pileMapper.selectXhpcChargingPileList(params); + }else{ + params.put("status",2); + params.put("logOperatorId",userId); + //查询赋值的场站 + list = pileMapper.selectXhpcChargingPileList(params); + } + }else{ startPage(); - params.put("logOperatorId", userId); params.put("status", 0); list = pileMapper.selectXhpcChargingPileList(params); } + return list; } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/StationLogServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/StationLogServiceImpl.java index 35417a5e..90700ae6 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/StationLogServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/StationLogServiceImpl.java @@ -41,6 +41,10 @@ public class StationLogServiceImpl extends BaseService implements StationLogServ params.put("operatorId",sysUserId); list = stationMapper.selectXhpcChargingStationList(params); }else{ + if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){ + params.put("tenantId",loginUser.getTenantId()); + return stationMapper.selectXhpcChargingStationList(params); + } if(sysUser.getUserId() !=UserTypeUtil.USER_ID){ Long logOperatorId = sysUser.getOperatorId(); startPage(); @@ -52,7 +56,7 @@ public class StationLogServiceImpl extends BaseService implements StationLogServ }else{ startPage(); params.put("type",2); - params.put("operatorId",sysUserId); + params.put("operatorIdYu",sysUserId); list = stationMapper.selectXhpcChargingStationList(params); } }else{ diff --git a/xhpc-modules/xhpc-activity/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-activity/src/main/resources/bootstrap.yml index 4d87bbea..f2b7e48a 100644 --- a/xhpc-modules/xhpc-activity/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-activity/src/main/resources/bootstrap.yml @@ -19,10 +19,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcStationDeviceMapper.xml b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcStationDeviceMapper.xml index 0f0686dc..84a56193 100644 --- a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcStationDeviceMapper.xml +++ b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcStationDeviceMapper.xml @@ -190,7 +190,7 @@ - \ No newline at end of file + diff --git a/xhpc-modules/xhpc-card/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-card/src/main/resources/bootstrap.yml index 7b26271c..2a4e98a5 100644 --- a/xhpc-modules/xhpc-card/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-card/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcPlaceholderController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcPlaceholderController.java new file mode 100644 index 00000000..4fdd7261 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcPlaceholderController.java @@ -0,0 +1,89 @@ +package com.xhpc.charging.station.controller; + +import com.xhpc.charging.station.dto.XhpcPlaceholderDto; +import com.xhpc.charging.station.service.IXhpcPlaceholderService; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 占位费 + * + * @author yuyang + * @Date 2025-04-22 22:06 + */ +@RestController +@RequestMapping("/placeholder") +public class XhpcPlaceholderController extends BaseController { + + @Resource + IXhpcPlaceholderService xhpcPlaceholderService; + @Resource + LogUserUtils logUserUtils; + + @GetMapping("/list") + public TableDataInfo list(HttpServletRequest request, Long chargingStationId,Integer status,Long operatorId,String startTime,String endTime) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + startPage(); + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + params.put("status", status); + params.put("chargingStationId", chargingStationId); + params.put("operatorId", operatorId); + params.put("startTime", startTime); + params.put("endTime", endTime); + List> list = xhpcPlaceholderService.getXhpcPlaceholderList(request,params); + return getDataTable(list); + } + + @GetMapping("/detail") + public R getXhpcPlaceholderDetail(@RequestParam("placeholderId") Long placeholderId) { + + return R.ok(xhpcPlaceholderService.getXhpcPlaceholderDetail(placeholderId)); + } + + @PostMapping("/updateXhpcPlaceholder") + public R updateXhpcPlaceholder(HttpServletRequest request, @RequestBody XhpcPlaceholderDto xhpcPlaceholder) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + + xhpcPlaceholder.setUpdateBy(loginUser.getUserid().toString()); + xhpcPlaceholder.setUpdateTime(new Date()); + xhpcPlaceholder.setChargingStationId(xhpcPlaceholder.getChargingStationId()); + return xhpcPlaceholderService.updateXhpcPlaceholder(xhpcPlaceholder); + } + + @PostMapping("/installXhpcPlaceholder") + public R installXhpcPlaceholder(HttpServletRequest request, @RequestBody XhpcPlaceholderDto xhpcPlaceholder) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + xhpcPlaceholder.setCreateBy(loginUser.getUserid().toString()); + xhpcPlaceholder.setCreateTime(new Date()); + return xhpcPlaceholderService.installXhpcPlaceholder(xhpcPlaceholder); + } + + /** + * 桩-删除 + */ + @DeleteMapping("/{placeholderId}") + public R remove(HttpServletRequest request,@PathVariable Long placeholderId) { + LoginUser loginUser = logUserUtils.getLogUser(request); + XhpcPlaceholderDto xhpcPlaceholder= new XhpcPlaceholderDto(); + xhpcPlaceholder.setCreateBy(loginUser.getUserid().toString()); + xhpcPlaceholder.setCreateTime(new Date()); + xhpcPlaceholder.setPlaceholderId(placeholderId); + return xhpcPlaceholderService.removeXhpcPlaceholderById(request,xhpcPlaceholder); + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderDto.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderDto.java new file mode 100644 index 00000000..9373172b --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderDto.java @@ -0,0 +1,20 @@ +package com.xhpc.charging.station.dto; + +import com.xhpc.common.domain.XhpcPlaceholder; +import com.xhpc.common.domain.XhpcPlaceholderTime; +import lombok.Data; + +import java.util.List; + +/** + * @author yuyang + * @Date 2025-04-22 23:22 + */ +@Data +public class XhpcPlaceholderDto extends XhpcPlaceholder { + + List xhpcPlaceholderTimeList; + + String price; + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderTimeDto.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderTimeDto.java new file mode 100644 index 00000000..c427db1c --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/dto/XhpcPlaceholderTimeDto.java @@ -0,0 +1,19 @@ +package com.xhpc.charging.station.dto; + +import lombok.Data; + +/** + * @author yuyang + * @Date 2025-04-24 11:35 + */ +@Data +public class XhpcPlaceholderTimeDto { + /** 启始时间 */ + private String startTime; + + /** 结束时间 */ + private String endTime; + + /** 费率id(非数据库id,用于绑定费率使用) */ + private String price; +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcPlaceholderMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcPlaceholderMapper.java new file mode 100644 index 00000000..c9d50b37 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcPlaceholderMapper.java @@ -0,0 +1,33 @@ +package com.xhpc.charging.station.mapper; + +import com.xhpc.charging.station.dto.XhpcPlaceholderDto; +import com.xhpc.common.domain.XhpcPlaceholder; +import com.xhpc.common.domain.XhpcPlaceholderTime; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @Date 2025-04-22 22:32 + */ +public interface XhpcPlaceholderMapper { + + List> getXhpcPlaceholderList(@Param("params") Map params); + + Map getXhpcPlaceholderDetail(@Param("placeholderId")Long placeholderId); + + List> getXhpcPlaceholderTimeList(@Param("placeholderId")Long placeholderId); + + int updateXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder); + + int updateXhpcPlaceholderTime(@Param("placeholderId")Long placeholderId); + + int insertXhpcPlaceholderTime(XhpcPlaceholderTime xhpcPlaceholderTime); + + int insertXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder); + + + int getXhpcPlaceholderChargingStationId(@Param("chargingStationId")Long chargingStationId,@Param("type")Integer type,@Param("placeholderId")Long placeholderId); +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcPlaceholderService.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcPlaceholderService.java new file mode 100644 index 00000000..d69b33fe --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/IXhpcPlaceholderService.java @@ -0,0 +1,25 @@ +package com.xhpc.charging.station.service; + +import com.xhpc.charging.station.dto.XhpcPlaceholderDto; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.domain.XhpcPlaceholder; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +/** + * @author yuyang + * @Date 2025-04-22 22:30 + */ +public interface IXhpcPlaceholderService { + List> getXhpcPlaceholderList(HttpServletRequest request,Map params); + + Map getXhpcPlaceholderDetail(Long placeholderId); + + R updateXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder); + + R installXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder); + + R removeXhpcPlaceholderById(HttpServletRequest request,XhpcPlaceholderDto xhpcPlaceholder); +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcPlaceholderServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcPlaceholderServiceImpl.java new file mode 100644 index 00000000..39fc1a16 --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcPlaceholderServiceImpl.java @@ -0,0 +1,354 @@ +package com.xhpc.charging.station.service; + +import cn.hutool.core.date.DateUtil; +import com.xhpc.charging.station.dto.XhpcPlaceholderDto; +import com.xhpc.charging.station.dto.XhpcPlaceholderTimeDto; +import com.xhpc.charging.station.mapper.XhpcPlaceholderMapper; +import com.xhpc.common.api.dto.XhpcRateTimeDto; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.common.core.web.service.BaseService; +import com.xhpc.common.domain.XhpcPlaceholderTime; +import com.xhpc.common.security.service.TokenService; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author yuyang + * @Date 2025-04-22 22:31 + */ +@Service +public class XhpcPlaceholderServiceImpl extends BaseService implements IXhpcPlaceholderService{ + + @Resource + XhpcPlaceholderMapper xhpcPlaceholderMapper; + @Autowired + private TokenService tokenService; + @Override + public List> getXhpcPlaceholderList(HttpServletRequest request, Map params) { + + //获取登陆用户 + LoginUser loginUser = tokenService.getLoginUser(request); + SysUser sysUser = loginUser.getSysUser(); + Long sysUserId = sysUser.getUserId(); + //桩的统计、该时段金额 + List> list =new ArrayList<>(); + if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if(UserTypeUtil.SYS_SUPER_TYPE_ONE == loginUser.getSuperType()){ + params.put("tenantId",loginUser.getTenantId()); + return xhpcPlaceholderMapper.getXhpcPlaceholderList(params); + } + if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ + Long logOperatorId = sysUser.getOperatorId(); + params.put("logOperatorId",logOperatorId); + params.put("type",1); + //运营商看自己的场站 + list = xhpcPlaceholderMapper.getXhpcPlaceholderList(params); + }else{ + params.put("type",2); + params.put("logOperatorId",sysUserId); + //查询赋值的场站 + list = xhpcPlaceholderMapper.getXhpcPlaceholderList(params); + } + }else{ + startPage(); + params.put("type",0); + list = xhpcPlaceholderMapper.getXhpcPlaceholderList(params); + } + + return list; + } + + @Override + public Map getXhpcPlaceholderDetail(Long placeholderId) { + + Map map = xhpcPlaceholderMapper.getXhpcPlaceholderDetail(placeholderId); + + if(map !=null && map.get("placeholderId") !=null){ + List> xhpcPlaceholderTimeList = xhpcPlaceholderMapper.getXhpcPlaceholderTimeList(placeholderId); + map.put("xhpcPlaceholderTimeList",xhpcPlaceholderTimeList); + } + return map; + } + + @Override + public R updateXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder) { + Long chargingStationId =xhpcPlaceholder.getChargingStationId(); + //查询场站是否存在 + int num = xhpcPlaceholderMapper.getXhpcPlaceholderChargingStationId(chargingStationId,2,xhpcPlaceholder.getPlaceholderId()); + if(num>0){ + return R.fail("1003", "该场站已存在,请进行编辑"); + } + int k = xhpcPlaceholderMapper.updateXhpcPlaceholder(xhpcPlaceholder); + if(k>0){ + Long placeholderId = xhpcPlaceholder.getPlaceholderId(); + //删除之前所有的时间段,添加新的时间段 + xhpcPlaceholderMapper.updateXhpcPlaceholderTime(placeholderId); + //添加时段段 + List list = xhpcPlaceholder.getXhpcPlaceholderTimeList(); + + //判断是否有重叠 + for (int i = 0; i < list.size(); i++) { + XhpcPlaceholderTimeDto xhpcRateTimeOne = list.get(i); + Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime()); + Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime()); + for (int j = i + 1; j < list.size(); j++) { + XhpcPlaceholderTimeDto xhpcRateTimeTwo = list.get(j); + Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime()); + Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime()); + if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) { + return R.fail("1004", "时间段有重叠"); + } + } + } + + for (int n = 0; n endTime.getTime()) { + return R.fail("1002", "开始时间不能大于结束时间"); + } + + String rateValue = xhpcPlaceholderTimeDto.getPrice(); + if(list.size() == 1){ + if(!"00:00:00".equals(xhpcPlaceholderTimeDto.getStartTime())){ + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004", "请填写默认时间段费率"); + } + addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId); + } + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + if(!endTime.equals("24:00:00")) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004", "请填写默认时间段费率"); + } + addXhpcPlaceholderTime(end,"24:00:00",price,placeholderId,chargingStationId); + } + }else{ + if(n == 0){ + if(!"00:00:00".equals(xhpcPlaceholderTimeDto.getStartTime())){ + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId); + } + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + }else if(n < list.size()-1){ + String endTimeK = list.get(n - 1).getEndTime(); + if (!endTimeK.equals(start)) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + addXhpcPlaceholderTime(endTimeK,start,price,placeholderId,chargingStationId); + } + //并把本条数据也添加上 + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + }else{ + String endTimeK = list.get(n - 1).getEndTime(); + if (!endTimeK.equals(start)) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + //添加一条默认费率时段 + addXhpcPlaceholderTime(endTimeK,start,price,placeholderId,chargingStationId); + } + //并把本条数据也添加上 + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + if (!end.equals("24:00:00")) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + //添加一条默认费率时段 + addXhpcPlaceholderTime(end,"24:00:00",price,placeholderId,chargingStationId); + } + } + } + } + } + return R.ok("修改成功"); + } + + @Override + public R installXhpcPlaceholder(XhpcPlaceholderDto xhpcPlaceholder) { + + Long chargingStationId =xhpcPlaceholder.getChargingStationId(); + //查询场站是否存在 + int num = xhpcPlaceholderMapper.getXhpcPlaceholderChargingStationId(chargingStationId,1,null); + if(num>0){ + return R.fail("1003", "该场站已存在,请进行编辑"); + } + int k = xhpcPlaceholderMapper.insertXhpcPlaceholder(xhpcPlaceholder); + if(k>0){ + Long placeholderId = xhpcPlaceholder.getPlaceholderId(); + //删除之前所有的时间段,添加新的时间段 + xhpcPlaceholderMapper.updateXhpcPlaceholderTime(placeholderId); + //添加时段段 + List list = xhpcPlaceholder.getXhpcPlaceholderTimeList(); + + //判断是否有重叠 + for (int i = 0; i < list.size(); i++) { + XhpcPlaceholderTimeDto xhpcRateTimeOne = list.get(i); + Date startOne = DateUtil.parse(xhpcRateTimeOne.getStartTime()); + Date endOne = DateUtil.parse(xhpcRateTimeOne.getEndTime()); + for (int j = i + 1; j < list.size(); j++) { + XhpcPlaceholderTimeDto xhpcRateTimeTwo = list.get(j); + Date startTwo = DateUtil.parse(xhpcRateTimeTwo.getStartTime()); + Date endTwo = DateUtil.parse(xhpcRateTimeTwo.getEndTime()); + if (DateUtil.compare(startOne, endTwo) < 0 && DateUtil.compare(startTwo, endOne) < 0) { + return R.fail("1004", "时间段有重叠"); + } + } + } + + for (int n = 0; n endTime.getTime()) { + return R.fail("1002", "开始时间不能大于结束时间"); + } + + String rateValue = xhpcPlaceholderTimeDto.getPrice(); + if(list.size() == 1){ + if(!"00:00:00".equals(xhpcPlaceholderTimeDto.getStartTime())){ + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004", "请填写默认时间段费率"); + } + addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId); + } + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + if(!endTime.equals("24:00:00")) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004", "请填写默认时间段费率"); + } + addXhpcPlaceholderTime(end,"24:00:00",price,placeholderId,chargingStationId); + } + }else{ + if(n == 0){ + if(!"00:00:00".equals(xhpcPlaceholderTimeDto.getStartTime())){ + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + addXhpcPlaceholderTime("00:00:00",start,price,placeholderId,chargingStationId); + } + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + }else if(n < list.size()-1){ + String endTimeK = list.get(n - 1).getEndTime(); + if (!endTimeK.equals(start)) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + addXhpcPlaceholderTime(endTimeK,start,price,placeholderId,chargingStationId); + } + //并把本条数据也添加上 + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + }else{ + String endTimeK = list.get(n - 1).getEndTime(); + if (!endTimeK.equals(start)) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + //添加一条默认费率时段 + addXhpcPlaceholderTime(endTimeK,start,price,placeholderId,chargingStationId); + } + //并把本条数据也添加上 + addXhpcPlaceholderTime(start,end,rateValue,placeholderId,chargingStationId); + if (!end.equals("24:00:00")) { + if(rateValue ==null || "".equals(rateValue)){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return R.fail("1004","请填写默认时间段费率"); + } + //添加一条默认费率时段 + addXhpcPlaceholderTime(end,"24:00:00",price,placeholderId,chargingStationId); + } + } + } + } + }else{ + return R.fail("添加失败"); + } + return R.ok("添加成功"); + } + + @Override + public R removeXhpcPlaceholderById(HttpServletRequest request,XhpcPlaceholderDto xhpcPlaceholder) { + + int i = xhpcPlaceholderMapper.updateXhpcPlaceholder(xhpcPlaceholder); + if(i>0){ + //删除之前所有的时间段,添加新的时间段 + xhpcPlaceholderMapper.updateXhpcPlaceholderTime(xhpcPlaceholder.getPlaceholderId()); + } + return R.ok("修改成功"); + } + + private void addXhpcPlaceholderTime(String startTime,String endTime,String price,Long placeholderId,Long chargingStationId){ + XhpcPlaceholderTime xhpcPlaceholderTime =new XhpcPlaceholderTime(); + Date start = DateUtil.parse(startTime); + Date emd = DateUtil.parse(endTime); + xhpcPlaceholderTime.setStartTime(start); + xhpcPlaceholderTime.setEndTime(emd); + xhpcPlaceholderTime.setPrice(new BigDecimal(price)); + xhpcPlaceholderTime.setPlaceholderId(placeholderId); + xhpcPlaceholderTime.setChargingStationId(chargingStationId); + xhpcPlaceholderMapper.insertXhpcPlaceholderTime(xhpcPlaceholderTime); + } + +} diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml index 4263af98..df6f2994 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPlaceholderMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPlaceholderMapper.xml new file mode 100644 index 00000000..570ef57b --- /dev/null +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcPlaceholderMapper.xml @@ -0,0 +1,290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update xhpc_placeholder + + start_time = #{startTime}, + end_time = #{endTime}, + status = #{status}, + content = #{content}, + max_fee = #{maxFee}, + free_time = #{freeTime}, + del_flag = #{delFlag}, + update_time = #{updateTime}, + update_by = #{updateBy}, + remark = #{remark}, + + where placeholder_id = #{placeholderId} + + + + update xhpc_placeholder_time set del_flag =1 where placeholder_id=#{placeholderId} + + + + insert into xhpc_placeholder_time + + + placeholder_id, + + + start_time, + + + end_time, + + + price, + + + del_flag, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + tenant_id, + + + + + #{placeholderId}, + + + #{startTime}, + + + #{endTime}, + + + #{price}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + #{tenantId}, + + + + + + insert into xhpc_placeholder + + + charging_station_id, + + + start_time, + + + end_time, + + + max_fee, + + + free_time, + + + content, + + + del_flag, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + tenant_id, + + + status, + + + + + #{chargingStationId}, + + + #{startTime}, + + + #{endTime}, + + + #{maxFee}, + + + #{freeTime}, + + + #{content}, + + + #{delFlag}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + #{tenantId}, + + + #{status}, + + + + + + diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholder.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholder.java new file mode 100644 index 00000000..8663a7c9 --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholder.java @@ -0,0 +1,28 @@ +package com.xhpc.common.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 占位表 + * + * @author yuyang + * @Date 2025-04-22 21:59 + */ +@Data +public class XhpcPlaceholder extends BaseEntity { + + private Long placeholderId; + private Date startTime; + private Date endTime; + private BigDecimal maxFee; + private Integer freeTime; + private Long chargingStationId; + private String content; + private Integer status; + private Integer delFlag; + +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholderTime.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholderTime.java new file mode 100644 index 00000000..78ec9d98 --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcPlaceholderTime.java @@ -0,0 +1,34 @@ +package com.xhpc.common.domain; + +import com.xhpc.common.core.annotation.Excel; +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 占位费时间段 + * + * @author yuyang + * @Date 2025-04-22 21:55 + */ +@Data +public class XhpcPlaceholderTime extends BaseEntity { + + private Long placeholderTimeId; + + private Long placeholderId; + + private Date startTime; + + private Date endTime; + + private BigDecimal price; + + private Long chargingStationId; + + private Integer delFlag; + + +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java index e974fba1..92dc6454 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/util/UserTypeUtil.java @@ -100,6 +100,14 @@ public class UserTypeUtil { public static final String SYS_USER_TYPE_THREE = "03"; public static final String SYS_USER_TYPE_FOUR = "04"; + + /** + * 系统租户管理员(0 是系统超管 1 某个租户超管 2普通用户) + */ + public static final Integer SYS_SUPER_TYPE_FOUR = 0; + public static final Integer SYS_SUPER_TYPE_ONE = 1; + public static final Integer SYS_SUPER_TYPE_TWO = 2; + /** * 启动方式 微信、支付宝、刷卡 */ diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcPlaceholderOrder.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcPlaceholderOrder.java new file mode 100644 index 00000000..388c675f --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcPlaceholderOrder.java @@ -0,0 +1,50 @@ +package com.xhpc.order.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +import javax.persistence.*; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author yuyang + * @Date 2025-04-23 14:15 + */ +@Data +@Entity +@Table(name = "xhpc_placeholder_order") +public class XhpcPlaceholderOrder extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long placeholderOrderId; + private Long historyOrderId; + private Long chargingStationId; + private Long chargeOrderId; + private Long terminalId; + private Long userId; + private String serialNumber; + private String internetSerialNumber; + private Integer confirmResult; + private Integer source; + private Long placeholderId; + private Integer freeTime; + private Integer maxFee; + private String operatorId; + private String placeholderOrderNumber; + private Integer status; + private String terminalNumber; + private Integer billEquipment; + private Date startTime; + private Date endTime; + private Integer totalTimeSpan; + private BigDecimal overtimePrice; + private BigDecimal totalMoney; + private BigDecimal price; + private String tenantId; + + public XhpcPlaceholderOrder() { + + } +} diff --git a/xhpc-modules/xhpc-general/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-general/src/main/resources/bootstrap.yml index dbb21612..a42b67b3 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-general/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java index 2ef80f27..54880b3b 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcPileRegularInspectController.java @@ -58,7 +58,15 @@ public class XhpcPileRegularInspectController extends BaseController { xhpcPileRegularInspectService.getRateTime(); } - - //定期抄发管理员定时任务 + + //占位费定时任务 + @Scheduled(cron = "0/10 * * * * ? ") + public void getxhpcPlaceholderOrderTime() + { + xhpcPileRegularInspectService.getTimingPriceTime(); + } + + + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java index 9111b850..fb9b68d8 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java @@ -213,4 +213,9 @@ public interface XhpcRealTimeOrderMapper { void insertXhpcBarrierGateRecord(XhpcBarrierGateRecord xhpcBarrierGateRecord); + + //查询该场站是否有占位费设置 + Map getXhpcPlaceholder(@Param("chargingStationId")Long chargingStationId); + + int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder ); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index f2097752..6c51cd69 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -45,6 +45,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT; +import static com.xhpc.common.data.redis.StaticBeanUtil.*; + /** * @author yuyang * @date 2021/8/7 15:07 @@ -1595,6 +1598,46 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe }catch (Exception e){ e.printStackTrace(); } + //查询该场站是否有占位费 + Map xhpcPlaceholderMap = xhpcRealTimeOrderMapper.getXhpcPlaceholder(xhpcHistoryOrder.getChargingStationId()); + + if(xhpcPlaceholderMap !=null){ + //占位订单生成 + XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder(); + placeholderOrder.setHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId()); + placeholderOrder.setChargingStationId(xhpcHistoryOrder.getChargingStationId()); + placeholderOrder.setChargeOrderId(xhpcHistoryOrder.getChargeOrderId()); + placeholderOrder.setTerminalId(xhpcHistoryOrder.getTerminalId()); + placeholderOrder.setUserId(xhpcHistoryOrder.getUserId()); + placeholderOrder.setSerialNumber(xhpcHistoryOrder.getSerialNumber()); + placeholderOrder.setInternetSerialNumber(xhpcHistoryOrder.getInternetSerialNumber()); + placeholderOrder.setConfirmResult(-1); + placeholderOrder.setSource(xhpcHistoryOrder.getSource()); + placeholderOrder.setPlaceholderId(Long.valueOf(xhpcPlaceholderMap.get("placeholderId").toString())); + placeholderOrder.setFreeTime(Integer.valueOf(xhpcPlaceholderMap.get("freeTime").toString())); + placeholderOrder.setMaxFee(new BigDecimal(xhpcPlaceholderMap.get("maxFee").toString()).intValue()); + placeholderOrder.setOperatorId("MA6DFCTD5"); + //订单流水号 终端号+年月日时分秒+自增4位 共32位 + String substring = xhpcHistoryOrder.getSerialNumber().substring(0, 16); + String orderNo = genOrder(substring); + placeholderOrder.setPlaceholderOrderNumber(orderNo); + placeholderOrder.setStatus(1); + placeholderOrder.setTerminalNumber(substring); + placeholderOrder.setBillEquipment(1); + placeholderOrder.setStartTime(xhpcHistoryOrder.getEndTime()); + placeholderOrder.setCreateTime(new Date()); + placeholderOrder.setTenantId(xhpcHistoryOrder.getTenantId()); + xhpcRealTimeOrderMapper.insertXhpcPlaceholderOrder(placeholderOrder); + logger.info("<<<<<<<<<<<<<>>>>>>>>>>>>>>>"+placeholderOrder.getPlaceholderOrderId()); + String gunkey = "placeholderOrder:"+substring+":"+xhpcHistoryOrder.getSerialNumber(); + Map cacheGun =new HashMap<>(); + cacheGun.put("source",xhpcHistoryOrder.getSource()); + cacheGun.put("placeholderOrderId",placeholderOrder.getPlaceholderOrderId()); + cacheGun.put("status",0); + cacheGun.put("serialNumber",xhpcHistoryOrder.getSerialNumber()); + cacheGun.put("internetSerialNumber",xhpcHistoryOrder.getInternetSerialNumber()); + REDIS.setCacheMap(gunkey, cacheGun); + } }catch (Exception e){ e.printStackTrace(); logger.info("<<<<<<<<<<<<<<<<运行异常,结算失败,数据回滚>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber()); @@ -2238,7 +2281,14 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe } } + public static String genOrder(String terminalSerialNumber) { + Date date = Calendar.getInstance().getTime(); + String format = DateUtil.format(date, "yyMMddHHmmss"); + //自增 + String orderNo = terminalSerialNumber + format ; + return orderNo; + } public static void main(String[] args) { // WxMessageSend("ot6ul4nlSC5ZZOC4rTLS5hedFTGk","69_G2hFrelhCsfOPuFB6OPP5I8j_DKdP-N6QF-shvpUFT2mQ-KjonSxbS_mrP5P9nYyat9OsJLZAcbYA4g5rWdn0i6whxueiU3hWfguoeqSnick1zAGvu7SKa50_VkKPAcAGABGR","黄金东二路","80","76.6"); diff --git a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml index 8fd67a26..0db7c88d 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml index 3202e844..17398b5a 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml @@ -688,8 +688,6 @@ inner join ( select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_app_user as xau on xau.app_user_id = xco.user_id where xco.source=0 and xau.phone LIKE concat('%',#{phone}, '%') union - co.driver_id LIKE concat('%',#{phone}, '%') - union select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = xco.user_id where xco.source=2 and xcp.account LIKE concat('%',#{phone}, '%') union select xco.charge_order_id as charge_order_id from xhpc_charge_order as xco INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = xco.user_id where xco.source=3 and xcup.account LIKE concat('%',#{phone}, '%') @@ -1312,4 +1310,194 @@ + + + + insert into xhpc_placeholder_order + + + history_order_id, + + + charging_station_id, + + + charge_order_id, + + + user_id, + + + terminal_id, + + + serial_number, + + + internet_serial_number, + + + confirm_Result, + + + source, + + + placeholder_id, + + + free_time, + + + max_fee, + + + operator_id, + + + placeholder_order_number, + + + status, + + + terminal_number, + + + bill_equipment, + + + start_time, + + + end_time, + + + total_time_span, + + + overtime_price, + + + total_money, + + + price, + + + create_time, + + + create_by, + + + update_time, + + + update_by, + + + remark, + + + tenant_id, + + + + + #{historyOrderId}, + + + #{chargingStationId}, + + + #{chargeOrderId}, + + + #{userId}, + + + #{terminalId}, + + + #{serialNumber}, + + + #{internetSerialNumber}, + + + #{confirmResult}, + + + #{source}, + + + #{placeholderId}, + + + #{freeTime}, + + + #{maxFee}, + + + #{operatorId}, + + + #{placeholderOrderNumber}, + + + #{status}, + + + #{terminalNumber}, + + + #{billEquipment}, + + + #{startTime}, + + + #{endTime}, + + + #{totalTimeSpan}, + + + #{overtimePrice}, + + + #{totalMoney}, + + + #{price}, + + + #{createTime}, + + + #{createBy}, + + + #{updateTime}, + + + #{updateBy}, + + + #{remark}, + + + #{tenantId}, + + + diff --git a/xhpc-modules/xhpc-payment/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-payment/src/main/resources/bootstrap.yml index 4a2817f0..27bd265a 100644 --- a/xhpc-modules/xhpc-payment/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-payment/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java index ea2e6f11..b524646b 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/logic/RealtimeDataLogic.java @@ -28,6 +28,8 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; +import java.time.Duration; +import java.time.Instant; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -80,6 +82,7 @@ public class RealtimeDataLogic implements ServiceLogic { String statusplain = stable[statusInt]; cacheGun.put("pileGunStatus", stable[Integer.parseInt(realtimeData.getPileGunStatus())]); cacheGun.put("vehicleGunStatus", pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]); + double wv = reverseHexInt(realtimeData.getWorkingVoltage()) / 10.0; cacheGun.put("voltage", wv); double wc = reverseHexInt(realtimeData.getWorkingCurrent()) / 10.0; @@ -294,6 +297,20 @@ public class RealtimeDataLogic implements ServiceLogic { @Override public void run() { REDIS.setCacheObject("cdjgpc:realTime:"+orderNo,orderNo); + //插枪状态发生变化进行判断是否收停车费 + String vehicleGunStatus = pvgstable[Integer.parseInt(realtimeData.getVehicleGunStatus())]; + if("否".equals(vehicleGunStatus)){ + String gunkey = "placeholderOrder:"+terminalId+":*"; + + Collection orderKeys = REDIS.keys(gunkey); + for (String okey : orderKeys) { + Map cacheGun = REDIS.getCacheMap(gunkey); + if(cacheGun !=null){ + cacheGun.put("status",1); + REDIS.setCacheMap(gunkey, cacheGun); + } + } + } } }); return new ServiceResult(false); diff --git a/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml index 0244fca3..224d1f2e 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-power-pile/src/main/resources/bootstrap.yml @@ -18,10 +18,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java index 8b7ea213..9375498f 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcOperatorServiceImpl.java @@ -118,6 +118,9 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService { Long sysUserId = sysUser.getUserId(); //获取登陆用户 if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){ + if (UserTypeUtil.SYS_SUPER_TYPE_ONE.equals(loginUser.getSuperType())) { + return xhpcOperatorMapper.selectOperatorList(operatorId,name, contactName, contactPhone, createTimeStart, createTimeEnd,loginUser.getTenantId(),0,sysUserId); + } if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){ Long logOperatorId = sysUser.getOperatorId(); return xhpcOperatorMapper.selectOperatorList(operatorId,name, contactName, contactPhone, createTimeStart, createTimeEnd,tenantId,1,logOperatorId); diff --git a/xhpc-modules/xhpc-user/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-user/src/main/resources/bootstrap.yml index 69f51a0e..953f05a5 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-user/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml index 40f813a7..dcbd3b59 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCommunityMapper.xml @@ -253,6 +253,7 @@ weixin_open_id as weixinOpenId, alipay_open_id AS alipayOpenId, account AS account, + tenant_id as tenantId, phone AS phone, recharge_money AS rechargeMoney, consume_money AS consumeMoney, diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml index 1773a580..8640e8d5 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcCustomersMapper.xml @@ -260,6 +260,7 @@ recharge_money AS rechargeMoney, consume_money AS consumeMoney, red_packet AS redPacket, + tenant_id as tenantId, surplus_money AS surplusMoney, create_time as createTime, type, diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml index eb1995c1..ca627aa4 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml @@ -173,7 +173,7 @@ and type =#{type} - order by tyep desc,create_time desc limit 1 + order by type desc,create_time desc limit 1 diff --git a/xhpc-modules/xhpc-wxma/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-wxma/src/main/resources/bootstrap.yml index 6287bed8..287434f3 100644 --- a/xhpc-modules/xhpc-wxma/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-wxma/src/main/resources/bootstrap.yml @@ -16,10 +16,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 config: # 配置中心地址 - server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848 + server-addr: 120.26.46.180:8858 # 配置文件格式 file-extension: yml # 共享配置