修改占位费、巡检问题
This commit is contained in:
parent
d746ce9987
commit
e4236e5038
@ -34,6 +34,7 @@ import java.util.List;
|
||||
"StationLat",
|
||||
"Construction",
|
||||
"BusineHours",
|
||||
"OvertimeFee",
|
||||
"ElectricityFee",
|
||||
"ServiceFee",
|
||||
"ParkFee",
|
||||
@ -205,5 +206,7 @@ public class CWJStationInfo extends CommonStationInfo {
|
||||
// @JsonProperty("RoadInfo")
|
||||
// public String[] roadInfo;
|
||||
|
||||
|
||||
@Transient
|
||||
@JsonProperty("OvertimeFee")
|
||||
String OvertimeFee;
|
||||
}
|
||||
|
||||
@ -24,6 +24,10 @@ public class ChargeOrderInfoResponse {
|
||||
@JsonProperty("ConfirmResult")
|
||||
private Integer confirmResult;
|
||||
|
||||
@JsonProperty("ConfirmResultMessage")
|
||||
private String confirmResultMessage;
|
||||
|
||||
|
||||
@JsonProperty("StartChargeSeq")
|
||||
public String getStartChargeSeq() {
|
||||
|
||||
@ -60,6 +64,17 @@ public class ChargeOrderInfoResponse {
|
||||
this.confirmResult = confirmResult;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty("ConfirmResultMessage")
|
||||
public String getConfirmResultMessage() {
|
||||
return confirmResultMessage;
|
||||
}
|
||||
|
||||
@JsonProperty("ConfirmResultMessage")
|
||||
public void setConfirmResultMessage(String confirmResultMessage) {
|
||||
this.confirmResultMessage = confirmResultMessage;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@ -75,12 +90,14 @@ public class ChargeOrderInfoResponse {
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChargeOrderInfoResponse{" +
|
||||
"startChargeSeq='" + startChargeSeq + '\'' +
|
||||
", connectorID='" + connectorID + '\'' +
|
||||
", confirmResult=" + confirmResult +
|
||||
", confirmResultMessage='" + confirmResultMessage + '\'' +
|
||||
", additionalProperties=" + additionalProperties +
|
||||
'}';
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 云快充占位费
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-06-09 14:45
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
"OccupancyFeeCode",
|
||||
"OccupancyStatus",
|
||||
"StartChargeSeq",
|
||||
"ConnectorID",
|
||||
"StartTime",
|
||||
"OccupancyFeeStartTime",
|
||||
"EndTime",
|
||||
"FreeDuration",
|
||||
"OccupancyDuration",
|
||||
"TotalOccupancyFee"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class OccupancyOrderInfo {
|
||||
@JsonProperty("OccupancyFeeCode")
|
||||
private String occupancyFeeCode;
|
||||
|
||||
@JsonProperty("OccupancyStatus")
|
||||
private Integer occupancyStatus;
|
||||
|
||||
@JsonProperty("StartChargeSeq")
|
||||
private String startChargeSeq;
|
||||
|
||||
@JsonProperty("ConnectorID")
|
||||
private String connectorID;
|
||||
|
||||
@JsonProperty("StartTime")
|
||||
private String startTime;
|
||||
|
||||
@JsonProperty("OccupancyFeeStartTime")
|
||||
private String occupancyFeeStartTime;
|
||||
|
||||
@JsonProperty("EndTime")
|
||||
private String endTime;
|
||||
|
||||
@JsonProperty("FreeDuration")
|
||||
private Integer freeDuration;
|
||||
|
||||
@JsonProperty("OccupancyDuration")
|
||||
private Integer occupancyDuration;
|
||||
|
||||
@JsonProperty("TotalOccupancyFee")
|
||||
private BigDecimal totalOccupancyFee;
|
||||
|
||||
}
|
||||
@ -39,6 +39,8 @@ public class PlaceholderOrderInfo {
|
||||
private String timeEnd;
|
||||
@JsonProperty("HoldTime")
|
||||
private Integer holdTime;
|
||||
@JsonProperty("OvertimePrice")
|
||||
private Double overtimePrice;
|
||||
@JsonProperty("ActuallyPay")
|
||||
private Double actuallyPay;
|
||||
@JsonProperty("BillEquipment")
|
||||
|
||||
@ -15,6 +15,7 @@ public class TokenRequest {
|
||||
|
||||
@JsonProperty("OperatorID")
|
||||
private String operatorID;
|
||||
|
||||
@JsonProperty("OperatorSecret")
|
||||
private String operatorSecret;
|
||||
@JsonIgnore
|
||||
|
||||
@ -119,6 +119,12 @@
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<!-- Fastjson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -95,24 +95,13 @@ public class QueryEquipBusinessPolicyController extends BaseController {
|
||||
ArrayList<String> timeList = new ArrayList<>();
|
||||
//放入必有初始时间
|
||||
timeList.add(initTime);
|
||||
//根据出现的时段个数确定他们的时间区间,然后存放至List集合中
|
||||
int cumulativeHalfHours = 0;
|
||||
for (int i = 0; i < modelCount.size() - 1; i++) {
|
||||
if (temp != -1) {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
temp = temp + hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
} else {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
//记录中间时间
|
||||
temp = hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
}
|
||||
cumulativeHalfHours += modelCount.get(i);
|
||||
int hour = cumulativeHalfHours / 2;
|
||||
int minute = (cumulativeHalfHours % 2) * 30;
|
||||
String startTime = String.format("%02d%02d%02d", hour, minute, 0);
|
||||
timeList.add(startTime);
|
||||
}
|
||||
policyInfosArr = new PolicyInfos[timeList.size()];
|
||||
for (int i = 0; i <= timeList.size() - 1; i++) {
|
||||
|
||||
@ -76,7 +76,7 @@ public class QueryPlaceholderRulesController {
|
||||
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy.MM.dd HH:mm:ss");
|
||||
placeholderRulesXinDianTu.setEffectStartTime(startTime);
|
||||
placeholderRulesXinDianTu.setEffectEndTime(endTime);
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getType());
|
||||
placeholderRulesXinDianTu.setFreeTime(xhpcPlacreholder.getFreeTime());
|
||||
placeholderRulesXinDianTu.setMaxFee(xhpcPlacreholder.getMaxFee().doubleValue());
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ public class QueryStationsInfoController {
|
||||
}
|
||||
Long chargingStationId =Long.valueOf(stationInfo.getStationId());
|
||||
//获取占位信息
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByStatusAndChargingStationIdAndDelFlag(1,chargingStationId, 0);
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByTypeAndChargingStationIdAndDelFlag(1,chargingStationId, 0);
|
||||
if(xhpcPlacreholder !=null){
|
||||
stationInfo.setIncrementExplain(xhpcPlacreholder.getContent());
|
||||
}
|
||||
|
||||
@ -298,4 +298,73 @@ public class QueryTokenController {
|
||||
System.out.println("========/v40/query_token==============="+resp.toString());
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于平台之间认证Token的申请
|
||||
* @param encout
|
||||
* @param tokenRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v50/query_token")
|
||||
public CommonResponse queryTokenV50(@RequestHeader(value = "enc.out", defaultValue = "true") String encout,
|
||||
@RequestBody TokenRequest tokenRequest) throws IOException {
|
||||
|
||||
log.debug("<<query token request body: " + tokenRequest);
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
String operatorID = tokenRequest.getOperatorId();
|
||||
if (operatorID == null) {
|
||||
String decodedData = (String) tokenRequest.getAdditionalProperties().get("Data");
|
||||
tokenRequest = JSONUtil.readParams(decodedData, TokenRequest.class);
|
||||
}
|
||||
if (tokenRequest == null) {
|
||||
resp.setMsg("Request params validation failed");
|
||||
} else {
|
||||
operatorID = tokenRequest.getOperatorId();
|
||||
TokenResponse tokenResponse = new TokenResponse();
|
||||
//tokenResponse.setOperatorId(REDIS.getCacheObject("global:EVCS_OPID"));
|
||||
tokenResponse.setOperatorId("MA6DFCTD5");
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(tokenRequest.getOperatorId(), Instant.now(), Instant.now());
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(5,
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
resp.setMsg("Invalid OperatorID/Secret");
|
||||
tokenResponse.setSuccStat(1);
|
||||
tokenResponse.setFailReason(2);
|
||||
} else {
|
||||
String token;
|
||||
if (authSecretTokenIn.getTokenExpiry() != null && !authSecretTokenIn.getTokenExpiry().before(Calendar.getInstance().getTime())) {
|
||||
token = authSecretTokenIn.getToken();
|
||||
} else {
|
||||
token = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
authSecretTokenIn.setToken(token);
|
||||
authSecretTokenIn.setTokenExpiry(getTokenExpiry(xhpcInternetUser));
|
||||
authSecretTokenRepository.save(authSecretTokenIn);
|
||||
}
|
||||
tokenResponse.setAccessToken(token);
|
||||
Instant te = authSecretTokenIn.getTokenExpiry().toInstant();
|
||||
tokenResponse.setTokenAvailableTime(Long.valueOf(ChronoUnit.SECONDS.between(Instant.now(), te)).intValue());
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setMsg("Query token success");
|
||||
resp.setData(JSONUtil.toJSONString(tokenResponse));
|
||||
|
||||
System.out.println("========/v50/query_token==============="+tokenResponse.toString());
|
||||
}
|
||||
} else {
|
||||
resp.setMsg("Cooperation settings or start time are not valid");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -44,7 +46,7 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
* 清除5天前数据
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 60)
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void runY() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("cdjgpc:realTime:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
@ -55,17 +57,31 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除7天前数据
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void runS() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("RealtimeOrder:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
String orderNo = REDIS.getCacheObject(okey);
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-7), "yyMMdd");
|
||||
if(Integer.parseInt(format)>Integer.parseInt(orderNo.substring(16,22))){
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
}
|
||||
}
|
||||
//9099开放定时任务 9009不开放
|
||||
/**
|
||||
* 清除5天前数据
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 120)
|
||||
//@Scheduled(fixedDelay = 1000 * 120)
|
||||
public void runYu() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("orderOutpu:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-7), "yyMMdd");
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-30), "yyMMdd");
|
||||
if(Integer.parseInt(format)>Integer.parseInt(okey.substring(28,33))){
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
@ -73,12 +89,46 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
}
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(fixedDelay = 1000 * 120)
|
||||
public void runYu1() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("Yu80836000*");
|
||||
for (String okey : realtimeOrder) {
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-30), "yyMMdd");
|
||||
if(Integer.parseInt(format)>Integer.parseInt(okey.substring(18,24))){
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(fixedDelay = 1000 * 120)
|
||||
public void orderKeys() throws Exception{
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
Instant now = Instant.now();
|
||||
for (String okey : orderKeys) {
|
||||
String orderNo = okey.substring(6);
|
||||
if(orderNo.length() < 32){
|
||||
logger.error("orderNo[{}] is error", orderNo);
|
||||
continue;
|
||||
}
|
||||
Date otime = com.xhpc.evcs.utils.DateUtil.orderNo2Date(orderNo);
|
||||
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 30) {
|
||||
REDIS.deleteObject(okey);
|
||||
REDIS.deleteObject(okey.replace("order", "pushOrder"));
|
||||
logger.info("clear cache..{}", okey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
/**
|
||||
* 设备充电中状态变化推送(我们平台推送成都市平台) --已推送
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 40)
|
||||
//@Scheduled(fixedDelay = 1000 * 120)
|
||||
public void run() throws Exception{
|
||||
|
||||
List<Long> longList =new ArrayList<>();
|
||||
|
||||
@ -18,6 +18,7 @@ import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -31,7 +32,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 推送充电订单信息
|
||||
* 成都城投能源投资管理集团有限公司推送充电订单信息
|
||||
* @author yuyang
|
||||
* @date 2023-09-24 19:27
|
||||
*/
|
||||
@ -47,25 +48,9 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 60)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
Instant now = Instant.now();
|
||||
for (String okey : orderKeys) {
|
||||
String orderNo = okey.substring(6);
|
||||
if(orderNo.length() < 32){
|
||||
logger.error("orderNo[{}] is error", orderNo);
|
||||
continue;
|
||||
}
|
||||
|
||||
Date otime = DateUtil.orderNo2Date(orderNo);
|
||||
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 14) {
|
||||
REDIS.deleteObject(okey);
|
||||
REDIS.deleteObject(okey.replace("order", "pushOrder"));
|
||||
logger.info("clear cache..{}", okey);
|
||||
}
|
||||
}
|
||||
List<AuthSecretToken> authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =
|
||||
xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1);
|
||||
@ -87,7 +72,9 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
chargeOrderInfo.setChargeModel(null);
|
||||
|
||||
if(new BigDecimal(0).compareTo(horder.getTotalPrice())<0){
|
||||
chargeOrderInfo = calculateEmYu(horder,chargeOrderInfo);
|
||||
XhpcHistoryOrder horder1 =new XhpcHistoryOrder();
|
||||
BeanUtils.copyProperties(horder,horder1);
|
||||
chargeOrderInfo = calculateEmYu(horder1,chargeOrderInfo);
|
||||
}
|
||||
logger.info("==========开始推送====推送返回值============calculateEmYu=====");
|
||||
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
|
||||
|
||||
@ -45,7 +45,7 @@ public class CDNotificationEquipmentV2GPowerInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationEquipmentV2GPowerInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//不推送
|
||||
//@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void run() throws IOException {
|
||||
//不参与合作的电站
|
||||
|
||||
@ -36,7 +36,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 订单信息推送
|
||||
* 成都城投能源投资管理集团有限公司 订单信息推送
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 9:34
|
||||
*/
|
||||
@ -67,7 +67,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
@GetMapping("/infoTask")
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
//@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
|
||||
@ -22,6 +22,9 @@ 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 CDNotificationStationFeeTask extends CoreDispatcher {
|
||||
@ -31,7 +34,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 =
|
||||
|
||||
@ -22,6 +22,9 @@ import java.util.*;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 成都城投能源投资管理集团有限公司 推送场站信息
|
||||
*/
|
||||
public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
|
||||
|
||||
@ -32,7 +35,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(cron = "0 20 0 1/1 * ? ")
|
||||
//@Scheduled(cron = "0 20 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
|
||||
@ -45,7 +45,7 @@ public class CDNotificationStationPowerInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationPowerInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//不推送
|
||||
//@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void run() throws IOException {
|
||||
//不参与合作的电站
|
||||
|
||||
@ -34,7 +34,7 @@ import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
||||
|
||||
/**
|
||||
* 设备状态变化推送 --已推送
|
||||
* 成都城投能源投资管理集团有限公司 设备状态变化推送 --已推送
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 10:32
|
||||
*/
|
||||
@ -49,8 +49,9 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 180)
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(fixedRate = 1000 * 180)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
@ -109,6 +110,8 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
||||
return FREE;
|
||||
case "离线":
|
||||
return OFF_LINE;
|
||||
case "插枪":
|
||||
return CONNECTED;
|
||||
case "故障":
|
||||
return ERROR;
|
||||
default:
|
||||
|
||||
@ -42,7 +42,7 @@ public class CDSuperviseNotificationOperationStatusInfoTask extends CoreDispatch
|
||||
private final Logger logger = LoggerFactory.getLogger(CDSuperviseNotificationOperationStatusInfoTask.class);
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//不推送
|
||||
//@Scheduled(cron = "0 0 0 * * ? ")
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
@ -41,7 +41,7 @@ public class CDSuperviseNotificationRealtimePowerInfoTask extends CoreDispatcher
|
||||
PowerPileService powerPileService;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDSuperviseNotificationOperationStatusInfoTask.class);
|
||||
//9099开放定时任务 9009不开放
|
||||
//不推送
|
||||
//@Scheduled(cron = "0 0/15 * * * ? ")
|
||||
protected void run() throws IOException {
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
|
||||
@ -46,8 +46,8 @@ import java.util.*;
|
||||
@Slf4j
|
||||
//@Component //spring boot way, see https://www.surasint.com/spring-boot-webfilter-instead-of-component/
|
||||
//@Order(1) not supported, see https://github.com/spring-projects/spring-boot/issues/8276
|
||||
//成都市监管平台(蓉成充)v10 v20 川逸充 v30 v40车为家
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*", "/v30/*", "/v40/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
//成都市监管平台(蓉成充)v10 v20 川逸充 v30 v40车为家 v50云快充
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*", "/v30/*", "/v40/*", "/v50/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
@ -117,6 +117,9 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
}else if (servletPath.endsWith("/v40/query_token")) {
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(4,operatorId,AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,responseWrapper, authSecretTokenIn);
|
||||
}else if (servletPath.endsWith("/v50/query_token")) {
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(5,operatorId,AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,responseWrapper, authSecretTokenIn);
|
||||
} else {
|
||||
if (authorization != null && authorization.startsWith("Bearer ")) {
|
||||
String token = authorization.replace("Bearer ", "");
|
||||
|
||||
@ -97,24 +97,14 @@ public class CWJQueryEquipBusinessPolicyController {
|
||||
ArrayList<String> timeList = new ArrayList<>();
|
||||
//放入必有初始时间
|
||||
timeList.add(initTime);
|
||||
int cumulativeHalfHours = 0;
|
||||
//根据出现的时段个数确定他们的时间区间,然后存放至List集合中
|
||||
for (int i = 0; i < modelCount.size() - 1; i++) {
|
||||
if (temp != -1) {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
temp = temp + hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
} else {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
//记录中间时间
|
||||
temp = hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
}
|
||||
cumulativeHalfHours += modelCount.get(i);
|
||||
int hour = cumulativeHalfHours / 2;
|
||||
int minute = (cumulativeHalfHours % 2) * 30;
|
||||
String startTime = String.format("%02d%02d%02d", hour, minute, 0);
|
||||
timeList.add(startTime);
|
||||
}
|
||||
policyInfosArr = new PolicyInfos[timeList.size()];
|
||||
for (int i = 0; i <= timeList.size() - 1; i++) {
|
||||
|
||||
@ -54,14 +54,12 @@ public class CWJNotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationEquipChargeStatusTask.class);
|
||||
|
||||
/**
|
||||
* 推送充电状态(evcs 放开)
|
||||
* 推送充电状态
|
||||
* @throws IOException
|
||||
*/
|
||||
//都开放
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
@Scheduled(fixedRate = 1000 * 40)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA7D6FPW6", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
final Collection<String> gunkeys = REDIS.keys("gun:*");
|
||||
for (String gunkey : gunkeys) {
|
||||
|
||||
@ -51,8 +51,8 @@ public class CWJNotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 60)
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(fixedRate = 1000 * 60)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
@ -113,6 +113,8 @@ public class CWJNotificationStationStatusTask extends CoreDispatcher {
|
||||
return FREE;
|
||||
case "离线":
|
||||
return OFF_LINE;
|
||||
case "插枪":
|
||||
return CONNECTED;
|
||||
case "故障":
|
||||
return ERROR;
|
||||
default:
|
||||
|
||||
@ -36,5 +36,7 @@ public interface PlaceholderIOrderRepository extends JpaRepository<XhpcPlacehold
|
||||
XhpcPlaceholderOrder findByPlaceholderOrderId(Long placeholderOrderId);
|
||||
XhpcPlaceholderOrder findByPlaceholderOrderNumber(String placeholderOrderNumber);
|
||||
|
||||
XhpcPlaceholderOrder findByInternetSerialNumber(String internetSerialNumber);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -19,4 +19,7 @@ public interface PlaceholderIRepository extends JpaRepository<XhpcPlacreholder,
|
||||
|
||||
XhpcPlacreholder findByChargingStationIdAndDelFlag(Long chargingStationId,Integer delFlag);
|
||||
|
||||
XhpcPlacreholder findByTypeAndChargingStationIdAndDelFlag(Integer type,Long chargingStationId,Integer delFlag);
|
||||
|
||||
XhpcPlacreholder findByYkcStatusAndChargingStationIdAndDelFlag(Integer ykcStatus,Long chargingStationId,Integer delFlag);
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@ import java.util.List;
|
||||
public interface XhpcHistoryOrderRepository extends JpaRepository<XhpcHistoryOrder, Long>,
|
||||
QueryByExampleExecutor<XhpcHistoryOrder>, JpaSpecificationExecutor<XhpcHistoryOrder>, PagingAndSortingRepository<XhpcHistoryOrder, Long> {
|
||||
|
||||
XhpcHistoryOrder findBySerialNumber(String serialNumber);
|
||||
|
||||
List<XhpcHistoryOrder> findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(Long hisOrderId, int i);
|
||||
|
||||
List<XhpcHistoryOrder> findTop100ByHistoryOrderIdGreaterThanEqualAndConfirmResultAndUserIdOrderByHistoryOrderIdAsc(Long hisOrderId,int confirmResult, Long userId);
|
||||
|
||||
@ -20,6 +20,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 推送订单取消,都开放
|
||||
* @Author HongYun on 2021/11/8
|
||||
*/
|
||||
@Component
|
||||
@ -30,7 +31,6 @@ public class NotificationCancelOrderTask extends CoreDispatcher {
|
||||
|
||||
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
||||
* 推送充电订单信息(运营奖补)(老平台已停止推送)
|
||||
* @throws IOException
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
//不开放,已停止推送
|
||||
//@Scheduled(fixedRate = 1000 * 180)
|
||||
public void run() throws IOException {
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -45,14 +45,14 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationEquipChargeStatusTask.class);
|
||||
|
||||
/**
|
||||
* 推送充电状态(evcs 放开)
|
||||
* 推送充电状态
|
||||
* @throws IOException
|
||||
*/
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenTypeAndOperatorId3irdptyNot(SECRET_TOKEN_TYPE_OUT,"MA7D6FPW6");
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
final Collection<String> gunkeys = REDIS.keys("gun:*");
|
||||
for (AuthSecretToken authSecretToken : authSecretTokenOutList) {
|
||||
for (String gunkey : gunkeys) {
|
||||
@ -73,7 +73,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
EquipChargeStatus equipChargeStatus = new EquipChargeStatus();
|
||||
final String internetSerialNumber = REDIS.getCacheMapValue(orderkey.replace("order:", "pushOrder:"),
|
||||
"internetSerialNumber");
|
||||
if (internetSerialNumber == null || !internetSerialNumber.startsWith(authSecretToken.getOperatorId3irdpty())) {
|
||||
if (internetSerialNumber == null || !internetSerialNumber.startsWith(authSecretToken.getOperatorId3irdpty()) || "MA7D6FPW6".equals(authSecretToken.getOperatorId3irdpty())) {
|
||||
continue;
|
||||
}
|
||||
equipChargeStatus.setStartChargeSeq(internetSerialNumber);
|
||||
@ -222,14 +222,12 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
equipChargeStatus.setChargeModel(null);
|
||||
}
|
||||
String data = JSONUtil.toJSONString(equipChargeStatus);
|
||||
System.out.println("===============充电状态推送===========data============="+data+"=========startChargeSeq============"+equipChargeStatus.getStartChargeSeq());
|
||||
CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest = new CommonRequest<>();
|
||||
//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("===============充电状态推送===========responseBody============="+responseBody+"=========startChargeSeq============"+equipChargeStatus.getStartChargeSeq());
|
||||
//System.out.println("===============充电结束状态推送========================");
|
||||
EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
EquipChargeStatusRes.class, authSecretTokenOut);
|
||||
|
||||
@ -31,10 +31,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.ERROR;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.FREE;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.OFF_LINE;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@ -49,8 +46,8 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//都开放 9009 40 9099 60
|
||||
@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
//都开放
|
||||
@Scheduled(cron = "0/30 * * * * ? ")
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
@ -70,7 +67,8 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos);
|
||||
if (!changeStatus.isEmpty()) {
|
||||
for (XhpcInternetUser xhpcInternetUser : xhpcInternetUserList) {
|
||||
if("5".equals(xhpcInternetUser.getInternetUserId().toString()) || "6".equals(xhpcInternetUser.getInternetUserId().toString())){
|
||||
//车为家单独推送
|
||||
if("5".equals(xhpcInternetUser.getInternetUserId().toString()) || "6".equals(xhpcInternetUser.getInternetUserId().toString())|| "7".equals(xhpcInternetUser.getInternetUserId().toString())){
|
||||
continue;
|
||||
}
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
@ -80,10 +78,12 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(xhpcInternetUser.getOperatorIdEvcs(), SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
log.debug("nss pushing to: {}", authSecretTokenOut.getOperatorId3irdpty());
|
||||
if (authSecretTokenOut != null) {
|
||||
for (ConnectorStatusInfo statusInfo : changeStatus) {
|
||||
notify(statusInfo, authSecretTokenOut);
|
||||
if(authSecretTokenOut !=null){
|
||||
log.debug("nss pushing to: {}", authSecretTokenOut.getOperatorId3irdpty());
|
||||
if (authSecretTokenOut != null) {
|
||||
for (ConnectorStatusInfo statusInfo : changeStatus) {
|
||||
notify(statusInfo, authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,6 +117,8 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
return FREE;
|
||||
case "离线":
|
||||
return OFF_LINE;
|
||||
case "插枪":
|
||||
return CONNECTED;
|
||||
case "故障":
|
||||
return ERROR;
|
||||
default:
|
||||
@ -131,10 +133,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
String data = JSONUtil.toJSONString(connectorStatusInfoReq);
|
||||
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
|
||||
//System.out.println("=====================所有设备状态============================");
|
||||
String ok = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
||||
// System.out.println("=====================所有设备状态===========ok================="+ok);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
|
||||
//(evcs 放开)
|
||||
//都开放
|
||||
@Scheduled(cron = "0/3 * * * * ? ")
|
||||
@Scheduled(cron = "0/30 * * * * ? ")
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
|
||||
@ -37,12 +37,9 @@ public class NotificationChargeOrderInfoHenDaTask extends CoreDispatcher {
|
||||
|
||||
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 =
|
||||
|
||||
@ -93,7 +93,7 @@ public class NotificationOvertimeOrderInfoTask extends CoreDispatcher {
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
logger.error("快电3dp[{}] order[{}/{}] push fail", "MA005DBW1",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 推送场站信息
|
||||
* @author yuyang
|
||||
* @Date 2025-07-25 10:06
|
||||
*/
|
||||
@ -40,7 +41,7 @@ public class NotificationStationInfoKuaiDianTask extends CoreDispatcher {
|
||||
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
//@Scheduled(cron = "0 0 0 1/1 * ? ")
|
||||
@Scheduled(cron = "0 0 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
|
||||
@ -133,10 +134,10 @@ public class NotificationStationInfoKuaiDianTask extends CoreDispatcher {
|
||||
Map<String,Object> 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){
|
||||
|
||||
@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
@ -42,8 +43,9 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationPlaceholderOrderInfoTask.class);
|
||||
|
||||
//(占位费还没有合作)
|
||||
//9009开放定时任务 9099不开放
|
||||
//@Scheduled(fixedRate = 1000 * 30)
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
@ -91,6 +93,7 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
|
||||
placeholderOrderInfo.setTimeStart(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setTimeEnd(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setHoldTime(placeholderOrder.getTotalTimeSpan());
|
||||
placeholderOrderInfo.setOvertimePrice(new BigDecimal(0.2).doubleValue());
|
||||
placeholderOrderInfo.setActuallyPay(placeholderOrder.getTotalMoney().doubleValue());
|
||||
placeholderOrderInfo.setBillEquipment(1);
|
||||
placeholderOrderInfo.setStatus(9);
|
||||
@ -175,6 +178,7 @@ public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
|
||||
String data = JSONUtil.toJSONString(placeholderOrderInfo);
|
||||
CommonRequest<PlaceholderOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
System.out.println("========新电途推送记录=============="+data);
|
||||
String responseBody = ok(commonRequest, "/notification_placeholder_order_info", authSecretTokenOut);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
|
||||
@ -30,6 +30,7 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 占位费规则
|
||||
* @author yuyang
|
||||
* @Date 2025-08-06 15:30
|
||||
*/
|
||||
@ -49,13 +50,13 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationPlaceholderRulesTask.class);
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(cron = "0 0 3 1/1 * ? ")
|
||||
@PostMapping("/v1/run")
|
||||
@Scheduled(cron = "0 0 0/6 * * ? ")
|
||||
// @Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void run() throws IOException {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(3L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
@ -87,7 +88,7 @@ public class NotificationPlaceholderRulesTask extends CoreDispatcher {
|
||||
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy.MM.dd HH:mm:ss");
|
||||
placeholderRulesXinDianTu.setEffectStartTime(startTime);
|
||||
placeholderRulesXinDianTu.setEffectEndTime(endTime);
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getType());
|
||||
placeholderRulesXinDianTu.setFreeTime(xhpcPlacreholder.getFreeTime());
|
||||
placeholderRulesXinDianTu.setMaxFee(xhpcPlacreholder.getMaxFee().doubleValue());
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ public class NotificationStationInfoXinDianTuTask extends CoreDispatcher {
|
||||
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
//@Scheduled(cron = "0 1 0 1/1 * ? ")
|
||||
@Scheduled(cron = "0 1 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(3L);
|
||||
|
||||
@ -22,7 +22,7 @@ public class ChangePoleStatus {
|
||||
} else {
|
||||
Set<ConnectorStatusInfo> changeStatus = new HashSet<>();
|
||||
for (ConnectorStatusInfo newInfo : freshInfoList) {
|
||||
if (temp.get(newInfo.getConnectorID()) == null || !temp.get(newInfo.getConnectorID()).equals(newInfo.getStatus())) {
|
||||
if (temp.get(newInfo.getConnectorID()) == null || !temp.get(newInfo.getConnectorID()).equals(newInfo.getStatus())) {
|
||||
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
||||
connectorStatusInfo.setConnectorID(newInfo.getConnectorID());
|
||||
connectorStatusInfo.setStatus(newInfo.getStatus());
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipAuthRequest;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.EquipAuthResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:34
|
||||
*/
|
||||
@RestController
|
||||
public class YKCQueryEquipAuthController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v50/query_equip_auth")
|
||||
public CommonResponse queryEquipAuth(@RequestBody CommonRequest<CDEquipAuthRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
CDEquipAuthRequest equipAuthRequest = JSONUtil.readParams(commonRequest.getData(), CDEquipAuthRequest.class);
|
||||
if (equipAuthRequest == null) {
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
EquipAuthResponse equipAuthResponse = new EquipAuthResponse();
|
||||
String equipAuthSeq = equipAuthRequest.getEquipAuthSeq();
|
||||
String connectorId = equipAuthRequest.getConnectorId();
|
||||
equipAuthResponse.setEquipAuthSeq(equipAuthSeq);
|
||||
equipAuthResponse.setConnectorId(connectorId);
|
||||
String pileId = connectorId.substring(0, connectorId.length() - 2);
|
||||
Map<String, Object> pileDataModel = REDIS.getCacheMap("pile:" + pileId);
|
||||
Long stationId = Long.parseLong(pileDataModel.get("stationId").toString());
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser = xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(commonRequest.getOperatorId(), now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(stationId, internetUserId).orElse(null);
|
||||
if (null != xhpcStationInternetBlacklist) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端不在空闲状态:[".concat(status == null ? "未注册" : isInteger(status) ? "充电中" : status).concat(
|
||||
"]"));
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else {
|
||||
resp.setRet("0");
|
||||
resp.setMsg("success");
|
||||
equipAuthResponse.setSuccStat(0);
|
||||
equipAuthResponse.setFailReason(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
resp.setData(JSONUtil.toJSONString(equipAuthResponse));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,162 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:35
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class YKCQueryEquipBusinessPolicyController {
|
||||
@Autowired
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
|
||||
/**
|
||||
* 查询业务策略信息结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v50/query_equip_business_policy")
|
||||
public CommonResponse queryEquipBusinessPolicy(@RequestBody CommonRequest<EquipBizRequest> commonRequest) throws IOException {
|
||||
//获取充电设备接口编码(枪编码)
|
||||
EquipBizRequest equipBizRequest = JSONUtil.readParams(commonRequest.getData(), EquipBizRequest.class);
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
if (equipBizRequest == null) {
|
||||
commonResponse.setRet("500");
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String connectorId = equipBizRequest.getConnectorId();
|
||||
//获取枪所对应的桩编码
|
||||
String pileSerialNumber = xhpcTerminalRepository.selectBySql(connectorId);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap("pile:" + pileSerialNumber);
|
||||
if (pileSerialNumber == null || cachePile == null) {
|
||||
commonResponse.setMsg("ConnectorID not found");
|
||||
commonResponse.setRet("500");
|
||||
return commonResponse;
|
||||
}
|
||||
ArrayList<String> modelTypes = new ArrayList<>();
|
||||
//存储时段个数
|
||||
ArrayList<Integer> modelCount = new ArrayList<>();
|
||||
Long rateModelId = (Long) cachePile.get("rateModelId");
|
||||
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
PolicyInfos[] policyInfosArr = new PolicyInfos[0];
|
||||
if (rateModel != null) {
|
||||
String[] tfPricesSeq = rateModel.getTfPricesSeq();
|
||||
//存储时段
|
||||
//建立对应时段的映射Map集合,存放其对应的价格和服务费
|
||||
Map<String, Object> timeMap = new HashMap<>();
|
||||
//个数计数器
|
||||
int count = 0;
|
||||
//最后一个时段的前一个时段的下标索引
|
||||
int index = 0;
|
||||
//遍历获取每一个时段
|
||||
for (int i = 0; i < tfPricesSeq.length - 1; i++) {
|
||||
count++;
|
||||
//如果当前时段与后面的时段不相同,则表示当前时段已经结束,添加当前时段到list中,并将其坐标存放到另一个集合中。
|
||||
if (!tfPricesSeq[i].equals(tfPricesSeq[i + 1])) {
|
||||
//将每段时间的索引,赋值
|
||||
index = i;
|
||||
modelTypes.add(tfPricesSeq[i]);
|
||||
modelCount.add(count);
|
||||
//如果这段时段结束,则重置计数器
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
//获取最后一个时段的费率值
|
||||
String lastModelType = tfPricesSeq[tfPricesSeq.length - 1];
|
||||
//放入到类型list中
|
||||
modelTypes.add(lastModelType);
|
||||
//获取最后一个时段的费率的个数
|
||||
int lastCount = (tfPricesSeq.length - 1) - index;
|
||||
//放入到个数List中
|
||||
modelCount.add(lastCount);
|
||||
|
||||
//获取各个类型的时段的时间区间,并将其存放至timeList集合中。
|
||||
//定义一个初始时间段
|
||||
String initTime = "000000";
|
||||
//添加临时存储变量
|
||||
int temp = -1;
|
||||
ArrayList<String> timeList = new ArrayList<>();
|
||||
//放入必有初始时间
|
||||
timeList.add(initTime);
|
||||
//根据出现的时段个数确定他们的时间区间,然后存放至List集合中
|
||||
int cumulativeHalfHours = 0;
|
||||
for (int i = 0; i < modelCount.size() - 1; i++) {
|
||||
cumulativeHalfHours += modelCount.get(i);
|
||||
int hour = cumulativeHalfHours / 2;
|
||||
int minute = (cumulativeHalfHours % 2) * 30;
|
||||
String startTime = String.format("%02d%02d%02d", hour, minute, 0);
|
||||
timeList.add(startTime);
|
||||
}
|
||||
policyInfosArr = new PolicyInfos[timeList.size()];
|
||||
for (int i = 0; i <= timeList.size() - 1; i++) {
|
||||
PolicyInfos policyInfos = new PolicyInfos();
|
||||
policyInfos.setStartTime(timeList.get(i));
|
||||
String modelType = modelTypes.get(i);
|
||||
switch (modelType) {
|
||||
case "00":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT1SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT1Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "01":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT2SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT2Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "02":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT3SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT3Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "03":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT4SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT4Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
policyInfosArr[i] = policyInfos;
|
||||
}
|
||||
}
|
||||
|
||||
//封装数据
|
||||
EquipBizResponse equipBizResponse = new EquipBizResponse();
|
||||
//业务查询流水号
|
||||
equipBizResponse.setEquipBizSeq(equipBizRequest.getEquipBizSeq());
|
||||
//充电设备接口编码
|
||||
equipBizResponse.setConnectorId(connectorId);
|
||||
//操作结果
|
||||
equipBizResponse.setSuccStat(0);
|
||||
//失败原因
|
||||
equipBizResponse.setFailReason(0);
|
||||
//总时段数
|
||||
equipBizResponse.setSumPeriod(modelTypes.size());
|
||||
//计费信息
|
||||
equipBizResponse.setPolicyInfos(policyInfosArr);
|
||||
|
||||
//塞入包装类
|
||||
commonResponse.setMsg("Query equipment business policy success");
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setData(JSONUtil.toJSONString(equipBizResponse));
|
||||
}
|
||||
return commonResponse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,288 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.evcs.cwj.dto.CEJEquipChargeStatus;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.dto.ChargeDetails;
|
||||
import com.xhpc.evcs.dto.ChargeInfoRequest;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.utils.DateUtil.orderNo2DateStr;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:36
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController()
|
||||
public class YKCQueryEquipChargeStatusController {
|
||||
@Autowired
|
||||
XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
OrderMappingRepository orderMappingRepository;
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v50/query_equip_charge_status")
|
||||
public CommonResponse queryEquipChargeStatus(@RequestBody CommonRequest<ChargeInfoRequest> commonRequest) throws IOException {
|
||||
//创建数据实体类
|
||||
CEJEquipChargeStatus equipChargeStatus = new CEJEquipChargeStatus();
|
||||
//充电订单号 三方传进来都是27位
|
||||
String data = commonRequest.getData();
|
||||
ChargeInfoRequest chargeInfoRequest = JSONUtil.readParams(data, ChargeInfoRequest.class);
|
||||
CommonResponse response = new CommonResponse();
|
||||
if (chargeInfoRequest == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = chargeInfoRequest.getStartChargeSeq();
|
||||
equipChargeStatus.setStartChargeSeq(startChargeSeq);
|
||||
//充电订单状态
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order not found/started");
|
||||
log.error("3rdpty order[{}] not found", startChargeSeq);
|
||||
return response;
|
||||
}
|
||||
String internalOrderNum = etOrderMapping.getXhOrderNo();
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
if (cacheOrder == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order cache data not found");
|
||||
} else {
|
||||
String orderStatus = (String) cacheOrder.get("status");
|
||||
int startChargeSeqStat;
|
||||
if (orderStatus == null) {
|
||||
startChargeSeqStat = 5;
|
||||
} else switch (orderStatus) {
|
||||
case "启动中":
|
||||
startChargeSeqStat = 1;
|
||||
break;
|
||||
case "充电中":
|
||||
startChargeSeqStat = 2;
|
||||
break;
|
||||
case "停止中":
|
||||
startChargeSeqStat = 3;
|
||||
break;
|
||||
case "已结束":
|
||||
startChargeSeqStat = 4;
|
||||
break;
|
||||
default:
|
||||
startChargeSeqStat = 5;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setStartChargeSeqStat(startChargeSeqStat);
|
||||
//充电设备接口编码
|
||||
String connectorId = internalOrderNum.substring(0, 16);
|
||||
equipChargeStatus.setConnectorID(connectorId);
|
||||
//充电设备接口状态
|
||||
Map<String, Object> cacheGunData = REDIS.getCacheMap("gun:" + connectorId);
|
||||
String gunStatus = (String) cacheGunData.get("status");
|
||||
int connectorStatus = 0;
|
||||
switch (gunStatus) {
|
||||
case "空闲":
|
||||
connectorStatus = 1;
|
||||
break;
|
||||
case "插枪":
|
||||
connectorStatus = 2;
|
||||
break;
|
||||
case "离线":
|
||||
connectorStatus = 0;
|
||||
break;
|
||||
case "故障":
|
||||
connectorStatus = 255;
|
||||
break;
|
||||
default:
|
||||
connectorStatus = 3;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setConnectorStatus(connectorStatus);
|
||||
//A相电流
|
||||
Double current = (Double) cacheGunData.get("current");
|
||||
equipChargeStatus.setCurrentA(current);
|
||||
//A相电压
|
||||
Double voltage = (Double) cacheGunData.get("voltage");
|
||||
equipChargeStatus.setVoltageA(voltage);
|
||||
//电池剩余电量
|
||||
Integer endSoc = (Integer) cacheOrder.get("endSoc");
|
||||
Double soc = Double.valueOf(endSoc == null ? 0 : endSoc);
|
||||
equipChargeStatus.setSoc(soc);
|
||||
//开始充电时间
|
||||
String startTime = (String) cacheOrder.get("startTime");
|
||||
if (startTime == null) startTime = orderNo2DateStr(internalOrderNum);
|
||||
equipChargeStatus.setStartTime(startTime);
|
||||
//本次采样时间 直接new一个当前时间的Date就可以了
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:" + internalOrderNum + ".lord");
|
||||
if (lord != null) {
|
||||
equipChargeStatus.setEndTime(lord.getCreateTime());
|
||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() / 10000.0);
|
||||
equipChargeStatus.setTotalPower(lord.getChargingDegree() / 10000.0);
|
||||
} else {
|
||||
equipChargeStatus.setEndTime(equipChargeStatus.getStartTime());
|
||||
equipChargeStatus.setTotalMoney(0.0);
|
||||
equipChargeStatus.setTotalPower(0.0);
|
||||
}
|
||||
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
calculateEmYu(equipChargeStatus, cacheRateModel);
|
||||
|
||||
CacheBmsReqChargerOutputData bms = REDIS.getCacheObject("order:"+internalOrderNum+".bms");
|
||||
if(bms==null || bms.getBmsEstRemainingTime()==null){
|
||||
equipChargeStatus.setLeftTime(60);
|
||||
}else{
|
||||
equipChargeStatus.setLeftTime(bms.getBmsEstRemainingTime());
|
||||
}
|
||||
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
||||
response.setMsg("success");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void calculateEmYu(CEJEquipChargeStatus equipChargeStatus, CacheRateModel cacheRateModel) {
|
||||
|
||||
if (cacheRateModel == null) {
|
||||
equipChargeStatus.setChargeDetails(new ChargeDetails[0]);
|
||||
return;
|
||||
}
|
||||
final Date endTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getEndTime());
|
||||
final Date startTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getStartTime());
|
||||
long totalMilSec = endTime.getTime() - startTime.getTime();
|
||||
BigDecimal hours = new BigDecimal(totalMilSec).divide(new BigDecimal(3600000), 2, RoundingMode.FLOOR);
|
||||
int sumPeriod = hours.setScale(0, RoundingMode.CEILING).intValue() + 1;
|
||||
equipChargeStatus.setSumPeriod(sumPeriod);
|
||||
DateTime firstNDT = DateTime.of(startTime);
|
||||
Stack<ChargeDetails> chargeDetailsStack = new Stack<>();
|
||||
ChargeDetails chargeDetails = null;
|
||||
Double firstNElecMoney = 0.0;
|
||||
Double firstNSeviceMony = 0.0;
|
||||
Double firstNPower = 0.0;
|
||||
String rtfTemp = null;
|
||||
Instant startIst = startTime.toInstant();
|
||||
final Instant endInst = endTime.toInstant();
|
||||
Instant endPeriod;
|
||||
final Double totalPower = equipChargeStatus.getTotalPower();
|
||||
for (int i = 0; i < sumPeriod; i++) {
|
||||
if (!startIst.isBefore(endInst)) break;
|
||||
endPeriod = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3599L);
|
||||
if (!endPeriod.isBefore(endInst)) {
|
||||
endPeriod = endInst;
|
||||
}
|
||||
boolean newCd = false;
|
||||
int firstSTHourOfDay = firstNDT.getField(DateField.HOUR_OF_DAY);
|
||||
int tf = firstSTHourOfDay * 2;
|
||||
final String rtf = cacheRateModel.getTfPricesSeq()[tf];
|
||||
if (chargeDetails == null || !rtf.equals(rtfTemp)) {
|
||||
newCd = true;
|
||||
chargeDetails = new ChargeDetails();
|
||||
}
|
||||
rtfTemp = rtf;
|
||||
Duration durm = Duration.between(startIst, endPeriod);
|
||||
BigDecimal timePeriodRatio = BigDecimal.valueOf(durm.toMillis()).divide(BigDecimal.valueOf(totalMilSec), 2,
|
||||
RoundingMode.HALF_UP);
|
||||
calculateCD(cacheRateModel, rtf, timePeriodRatio, BigDecimal.valueOf(totalPower), chargeDetails);
|
||||
if (i == 0) {
|
||||
chargeDetails.setDetailStartTime(equipChargeStatus.getStartTime());
|
||||
} else if (newCd) {
|
||||
chargeDetails.setDetailStartTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(startIst));
|
||||
}
|
||||
startIst = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3600L);
|
||||
chargeDetails.setDetailEndTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(endPeriod));
|
||||
if (newCd) {
|
||||
chargeDetailsStack.push(chargeDetails);
|
||||
}
|
||||
}
|
||||
ChargeDetails[] cda = new ChargeDetails[chargeDetailsStack.size()];
|
||||
equipChargeStatus.setChargeDetails(chargeDetailsStack.toArray(cda));
|
||||
equipChargeStatus.setSumPeriod(chargeDetailsStack.size());
|
||||
equipChargeStatus.setElecMoney(firstNElecMoney);
|
||||
final Double totalMoney = equipChargeStatus.getTotalMoney();
|
||||
for (ChargeDetails cd : chargeDetailsStack) {
|
||||
firstNElecMoney += cd.getDetailElecMoney();
|
||||
firstNSeviceMony += cd.getDetailSeviceMoney();
|
||||
firstNPower += cd.getDetailPower();
|
||||
}
|
||||
equipChargeStatus.setElecMoney(BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNSeviceMony)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
equipChargeStatus.setSeviceMoney(BigDecimal.valueOf(firstNSeviceMony).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final BigDecimal oddm =
|
||||
BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNElecMoney)).subtract(BigDecimal.valueOf(firstNSeviceMony));
|
||||
final BigDecimal oddp = BigDecimal.valueOf(totalPower).subtract(BigDecimal.valueOf(firstNPower));
|
||||
if (!chargeDetailsStack.isEmpty()) {
|
||||
ChargeDetails peek = chargeDetailsStack.peek();
|
||||
peek.setDetailElecMoney(BigDecimal.valueOf(peek.getDetailElecMoney()).add(oddm).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
peek.setDetailPower(BigDecimal.valueOf(peek.getDetailPower()).add(oddp).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void calculateCD(CacheRateModel cacheRateModel, String rtf,
|
||||
BigDecimal timePeriodRatio, BigDecimal tpPower, ChargeDetails cd) {
|
||||
|
||||
cd.setDetailPower(BigDecimal.valueOf(cd.getDetailPower() + tpPower.multiply(timePeriodRatio).doubleValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
Integer powerPrice;
|
||||
Integer svcPrice;
|
||||
if ("00".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT1Price();
|
||||
svcPrice = cacheRateModel.getT1SvcPrice();
|
||||
} else if ("01".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT2Price();
|
||||
svcPrice = cacheRateModel.getT2SvcPrice();
|
||||
} else if ("02".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT3Price();
|
||||
svcPrice = cacheRateModel.getT3SvcPrice();
|
||||
} else{
|
||||
powerPrice = cacheRateModel.getT4Price();
|
||||
svcPrice = cacheRateModel.getT4SvcPrice();
|
||||
}
|
||||
cd.setElecPrice( new BigDecimal(powerPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
cd.setSevicePrice(new BigDecimal(svcPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailElecMoney = BigDecimal.valueOf(cd.getElecPrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailElecMoney(BigDecimal.valueOf(detailElecMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailSeviceMoney = BigDecimal.valueOf(cd.getSevicePrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailSeviceMoney(BigDecimal.valueOf(detailSeviceMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,237 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.evcs.api.QueryStartChargeController;
|
||||
import com.xhpc.evcs.cwj.dto.CWJStartChargeRequest;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:37
|
||||
*/
|
||||
@RestController
|
||||
public class YKCQueryStartChargeController extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
@Autowired
|
||||
private PileOrderService pileOrderService;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(QueryStartChargeController.class);
|
||||
private final ExecutorService asyncExecutor = Executors.newFixedThreadPool(40);
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v50/query_start_charge")
|
||||
public CommonResponse queryStartCharge(@RequestBody CommonRequest<StartChargeRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
String orderNo ="";
|
||||
StartChargeRequest startChargeRequest = JSONUtil.readParams(commonRequest.getData(), StartChargeRequest.class);
|
||||
if (startChargeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = startChargeRequest.getStartChargeSeq();
|
||||
EtOrderMapping orderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (orderMapping != null) {
|
||||
resp.setMsg("Duplicated StartChargeSeq");
|
||||
} else {
|
||||
StartChargeResponse startChargeResponse = new StartChargeResponse();
|
||||
startChargeResponse.setFailReason(0);
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
String connectorId = startChargeRequest.getConnectorId();
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
EtOrderMapping etOrderMapping = new EtOrderMapping();
|
||||
Date now = DateUtils.getNowDate();
|
||||
etOrderMapping.setCreateTime(now);
|
||||
etOrderMapping.setEvcsOrderNo(startChargeSeq);
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端状态异常:[".concat(status == null ? "未注册" : status).concat("]"));
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
String plateNum = startChargeRequest.getPlateNum();
|
||||
plateNum = plateNum == null ? startChargeRequest.getPlateNum2() : plateNum;
|
||||
R res = pileOrderService.pileStartUpBy3rd(startChargeSeq, startChargeRequest.getDriverId(),
|
||||
startChargeRequest.getChargingAmt(), plateNum, -1, connectorId);
|
||||
startChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
startChargeResponse.setConnectorID(connectorId);
|
||||
resp.setMsg(res.getMsg());
|
||||
if (res.getCode() != 200) {
|
||||
if (res.getCode() != 500) {
|
||||
startChargeResponse.setFailReason(res.getCode());
|
||||
} else {
|
||||
startChargeResponse.setFailReason(3);
|
||||
}
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
Map<String, Object> etOrderData = (Map<String, Object>) res.getData();
|
||||
if (etOrderData != null) {
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
startChargeResponse.setStartChargeSeqStat(1);
|
||||
startChargeResponse.setSuccStat(0);
|
||||
startChargeResponse.setFailReason(0);
|
||||
|
||||
pushOrder.put("startChargeSeqStat", 1);
|
||||
pushOrder.put("internetSerialNumber", startChargeRequest.getStartChargeSeq());
|
||||
pushOrder.put("connectorID", connectorId);
|
||||
pushOrder.put("startChargeNotificationStat", 0);
|
||||
pushOrder.put("chargeOrderInfoNotificationStat", 0);
|
||||
pushOrder.put("operatorId3rdpty", startChargeSeq.substring(0, 9));
|
||||
pushOrder.put("startTime", etOrderData.get("startTime"));
|
||||
orderNo = (String) etOrderData.get("orderNo");
|
||||
etOrderMapping.setXhOrderNo(orderNo);
|
||||
REDIS.setCacheMap("pushOrder:".concat(orderNo), pushOrder);
|
||||
} else {
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
etOrderMappingRepo.save(etOrderMapping);
|
||||
resp.setData(JSONUtil.toJSONString(startChargeResponse));
|
||||
}
|
||||
}
|
||||
|
||||
// if("0".equals(resp.getRet())){
|
||||
// String finalOrderNo = orderNo;
|
||||
// CompletableFuture.runAsync(()->{
|
||||
// System.out.println(">>> 异步回复 <<<");
|
||||
// processRequest(pushOrder,startChargeRequest.getStartChargeSeq(), finalOrderNo);
|
||||
// },asyncExecutor);
|
||||
// }
|
||||
// System.out.println(">>> 回复启动结果 <<<");
|
||||
return resp;
|
||||
}
|
||||
|
||||
private void emptyHorder(String startChargeSeq, String connectorId, EtOrderMapping etOrderMapping) {
|
||||
|
||||
final Long stationId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "stationId");
|
||||
XhpcChargingStation xhpcChargingStation = xhpcChargingStationRepository.findById(stationId).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
XhpcHistoryOrder emptyHorder = new XhpcHistoryOrder();
|
||||
emptyHorder.setTenantId(xhpcChargingStation.getTenantId());
|
||||
Date now = DateUtils.getNowDate();
|
||||
emptyHorder.setStartTime(now);
|
||||
emptyHorder.setEndTime(now);
|
||||
emptyHorder.setCreateTime(now);
|
||||
emptyHorder.setUpdateTime(now);
|
||||
emptyHorder.setStopReasonEvcs("平台停止");
|
||||
String sn = genOrder(connectorId);
|
||||
etOrderMapping.setXhOrderNo(sn);
|
||||
emptyHorder.setSerialNumber(sn);
|
||||
emptyHorder.setInternetSerialNumber(startChargeSeq);
|
||||
String operatorId3rdpty = startChargeSeq.substring(0, 9);
|
||||
emptyHorder.setOperatorId3rdptyEvcs(operatorId3rdpty);
|
||||
emptyHorder.setUserId(xhpcInternetUserRepository.queryDbId(operatorId3rdpty));
|
||||
emptyHorder.setType(1);
|
||||
emptyHorder.setSource(1);
|
||||
emptyHorder.setState(-1);
|
||||
emptyHorder.setChargingStationId(stationId);
|
||||
emptyHorder.setTerminalId(xhpcTerminalRepository.queryDbId(connectorId));
|
||||
emptyHorder.setConfirmResult(-1);
|
||||
xhpcHistoryOrderRepository.save(emptyHorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void notify(NotificationStartChargeResultRequestData notificationStartChargeResultRequestData,
|
||||
AuthSecretToken authSecretTokenOut, String orderNo, String startChargeSeq) throws IOException {
|
||||
|
||||
String data = JSONUtil.toJSONString(notificationStartChargeResultRequestData);
|
||||
|
||||
CommonRequest<NotificationStartChargeResultRequestData> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_start_charge_result", authSecretTokenOut);
|
||||
logger.info("==========第三方调用启动充电接口=====启动推送结果=====responseBody======================="+responseBody+"=================orderNo================="+orderNo);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =DTOJsonHelper.parseResponseData(responseBody,NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
|
||||
if (null != notificationStartStopChargeResultResponse) {
|
||||
//Ensuring that only when startChargeNotificationStat equals 1 won't be notified.
|
||||
if (notificationStartStopChargeResultResponse.getSuccStat() == 0) {
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
} else {
|
||||
Integer startChargeNotificationStat = REDIS.getCacheMapValue("pushOrder:".concat(orderNo),
|
||||
"startChargeNotificationStat");
|
||||
if (startChargeNotificationStat == 0) {
|
||||
startChargeNotificationStat = 2;
|
||||
} else {
|
||||
++startChargeNotificationStat;
|
||||
}
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat",startChargeNotificationStat);
|
||||
throw new RuntimeException(String.format("push CD start charge order status [%s] failed: %s",notificationStartChargeResultRequestData.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Async
|
||||
public void processRequest(Map<String, Object> pushOrder,String startChargeSeq,String orderNo){
|
||||
System.out.println(">>> 开始执行后续操作 <<<");
|
||||
try{
|
||||
//推送启动成功数据
|
||||
String operatorId = startChargeSeq.substring(0, 9);
|
||||
Optional<AuthSecretToken> authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,SECRET_TOKEN_TYPE_OUT);
|
||||
if (authSecretToken.isPresent()) {
|
||||
NotificationStartChargeResultRequestData notificationStartChargeResultRequestData = new NotificationStartChargeResultRequestData();
|
||||
notificationStartChargeResultRequestData.setStartTime((String) pushOrder.get("startTime"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeq(startChargeSeq);
|
||||
notificationStartChargeResultRequestData.setConnectorId((String) pushOrder.get("connectorID"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeqStat((Integer) pushOrder.get("startChargeSeqStat"));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), orderNo,startChargeSeq);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("==========第三方调用启动充电接口=====启动推送失败=====responseBody=======================");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,367 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.utils.bean.BeanUtils;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationFee;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cwj.dto.*;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:41
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class YKCQueryStationsInfoController extends CoreDispatcher {
|
||||
@Resource
|
||||
XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Resource
|
||||
XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
XhpcTerminalRepository terminalRepository;
|
||||
@Resource
|
||||
private PlaceholderIRepository placeholderIRepository;
|
||||
@Autowired
|
||||
private PlaceholderIOrderRepository placeholderIOrderRepository;
|
||||
/**
|
||||
* 云快充查询充电站信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v50/query_stations_info")
|
||||
public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest<CWJPageRequest> commonRequest) {
|
||||
|
||||
// System.out.println("================车为家查询充电站信息=======================");
|
||||
CommonResponse resp = new CommonResponse();
|
||||
try{
|
||||
//当前页数
|
||||
CWJPageRequest pageRequest = commonRequest.transformDataType(CWJPageRequest.class);
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
CWJPageStationsInfoResponse response = new CWJPageStationsInfoResponse();
|
||||
response.setPageNo(pageNo);
|
||||
//页码总数
|
||||
String operatorId = commonRequest.getOperatorId();
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
if (chargingStationDto.getPiles() != null) {
|
||||
if (isValid) {
|
||||
validStationKeys.add(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validStationKeys.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :
|
||||
(validStationKeys.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(validStationKeys.size());
|
||||
|
||||
//充电站信息列表
|
||||
List<CWJStationInfo> stationInfos = new ArrayList<>();
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && validStationKeys.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = validStationKeys.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
String stationKey = null;
|
||||
try {
|
||||
stationKey = validStationKeys.get(i);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
String stationId = stationKey.replace("station:", "");
|
||||
stationInfos.add(getNotificationStationInfo(stationId));
|
||||
}
|
||||
response.setStationInfos(stationInfos);
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station info success");
|
||||
|
||||
System.out.println("========/v50/query_stations_info=============="+ JSONUtil.toJSONString(response));
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
//组合场站数据
|
||||
public CWJStationInfo getNotificationStationInfo(String stationId){
|
||||
CWJStationInfo cwjStationInfo = new CWJStationInfo();
|
||||
|
||||
String key = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo = REDIS.getCacheObject(key);
|
||||
|
||||
BeanUtils.copyBeanProp(cwjStationInfo,cdStationInfo);
|
||||
cwjStationInfo.setBusineHours("00:00-24:00");
|
||||
cwjStationInfo.setParkingDiscountType(2);
|
||||
|
||||
//获取占位费信息
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByYkcStatusAndChargingStationIdAndDelFlag(1,Long.valueOf(stationId), 0);
|
||||
if(xhpcPlacreholder !=null){
|
||||
cwjStationInfo.setOvertimeFee(xhpcPlacreholder.getContent());
|
||||
}
|
||||
//cwjStationInfo.setAreaCode(cdStationInfo.getAreaCodeCountryside());
|
||||
cwjStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+stationId);
|
||||
|
||||
List<CWJEquipmentInfo> cwjEquipmentInfos = new ArrayList<>();
|
||||
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk) + ".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
CWJEquipmentInfo cwjEquipmentInfo = new CWJEquipmentInfo();
|
||||
BeanUtils.copyBeanProp(cwjEquipmentInfo,cdEquipmentInfo);
|
||||
|
||||
List<CWJConnectorInfo> connectorInfos =new ArrayList<>();
|
||||
List<CDConnectorInfo> connectorInfos1 = cdEquipmentInfo.getConnectorInfos();
|
||||
|
||||
for (int i = 0; i <connectorInfos1.size() ; i++) {
|
||||
CDConnectorInfo cdConnectorInfo = connectorInfos1.get(i);
|
||||
CWJConnectorInfo cwjConnectorInfo = new CWJConnectorInfo();
|
||||
BeanUtils.copyBeanProp(cwjConnectorInfo,cdConnectorInfo);
|
||||
connectorInfos.add(cwjConnectorInfo);
|
||||
}
|
||||
cwjEquipmentInfo.setConnectorInfos(connectorInfos);
|
||||
cwjEquipmentInfo.setPower(cdEquipmentInfo.getEquipmentPower());
|
||||
cwjEquipmentInfos.add(cwjEquipmentInfo);
|
||||
}
|
||||
cwjStationInfo.setEquipmentInfos(cwjEquipmentInfos);
|
||||
REDIS.setCacheObject(key, cdStationInfo);
|
||||
}
|
||||
return cwjStationInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备接口状态查询(成都市平台调用我们平台) --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v50/query_station_status")
|
||||
public CommonResponse queryStationsStatus(@RequestBody CommonRequest<StationStatusRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StationStatusRequest stationStatusRequest = JSONUtil.readParams(commonRequest.getData(), StationStatusRequest.class);
|
||||
if (stationStatusRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String[] stationIDs = stationStatusRequest.getStationIds();
|
||||
List<CWJStationStatusInfo> cdStationStatusInfos = new ArrayList<>();
|
||||
//Loading data through redis at first.
|
||||
Collection<String> guns = REDIS.keys("gun:*");
|
||||
List<String> gunsNewList = new ArrayList<>();
|
||||
for (String value : guns) {
|
||||
gunsNewList.add(value.substring(4));
|
||||
}
|
||||
List<String> gunsIds = new ArrayList<>();
|
||||
for (String value : gunsNewList) {
|
||||
if (value.length() == 16) {
|
||||
gunsIds.add(value);
|
||||
}
|
||||
}
|
||||
Map<String, Integer> statusMap = new HashMap<>();
|
||||
String[] keys = {"离线", "空闲", "故障", "插枪"};
|
||||
Integer[] values = {0, 1, 255,2};
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
statusMap.put(keys[i], values[i]);
|
||||
}
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalRepository.selectStatusBySql();
|
||||
Map<String,Integer> terminalDBMap = terminalList.stream().collect(Collectors.toMap(XhpcTerminal::getSerialNumber,XhpcTerminal::getStatus));
|
||||
|
||||
for (String stationID : stationIDs) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + stationID);
|
||||
Set<String> pileIds = new HashSet<>();
|
||||
if (null != chargingStationDto) {
|
||||
pileIds = chargingStationDto.getPiles();
|
||||
}
|
||||
boolean existsGun = false;
|
||||
List<CWJConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
|
||||
for (String pileId : pileIds) {
|
||||
for (String value : gunsIds) {
|
||||
if (pileId.equals(value.substring(0, 14))) {
|
||||
existsGun = true;
|
||||
CWJConnectorStatusInfo cdConnectorStatusInfo = new CWJConnectorStatusInfo();
|
||||
Integer gunStatus = terminalDBMap.get(value);
|
||||
if (gunStatus == null){
|
||||
existsGun = false;
|
||||
} else {
|
||||
if (gunStatus == 0){
|
||||
Object status = REDIS.getCacheMapValue("gun:" + value, "status");
|
||||
if (isInteger(status.toString())) {
|
||||
cdConnectorStatusInfo.setStatus(3);
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(statusMap.get(status));
|
||||
}
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(0);
|
||||
}
|
||||
cdConnectorStatusInfo.setConnectorID(value);
|
||||
connectorStatusInfos.add(cdConnectorStatusInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (existsGun) {
|
||||
CWJStationStatusInfo cdStationStatusInfo = new CWJStationStatusInfo();
|
||||
cdStationStatusInfo.setStationID(stationID);
|
||||
cdStationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||
cdStationStatusInfos.add(cdStationStatusInfo);
|
||||
}
|
||||
}
|
||||
CWJStationStatusInfoWrapper stationStatusInfoWrappers = new CWJStationStatusInfoWrapper();
|
||||
stationStatusInfoWrappers.setTotal(cdStationStatusInfos.size());
|
||||
if (cdStationStatusInfos.size() != 0) {
|
||||
stationStatusInfoWrappers.setStationStatusInfos(cdStationStatusInfos);
|
||||
}
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station status success");
|
||||
resp.setData(JSONUtil.toJSONString(stationStatusInfoWrappers));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送站点下线
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v50/getNotificationStationFee")
|
||||
public void getNotificationStationFee(String stationID) throws Exception {
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("StationID",stationID);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDStationFee> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
ok(commonRequest, "/notification_stationOfflineStatus", authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/v50/query_occupancy_order_info")
|
||||
public CommonResponse queryOccupancyOrderInfo(@RequestBody(required = false) CommonRequest<CancelOrderRequest> commonRequest) {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
try{
|
||||
CancelOrderRequest cancelOrderRequest = JSONUtil.readParams(commonRequest.getData(), CancelOrderRequest.class);
|
||||
XhpcPlaceholderOrder placeholderOrder = placeholderIOrderRepository.findByInternetSerialNumber(cancelOrderRequest.getStartChargeSeq());
|
||||
OccupancyOrderInfo occupancyOrderInfo = new OccupancyOrderInfo();
|
||||
occupancyOrderInfo.setOccupancyFeeCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
occupancyOrderInfo.setOccupancyStatus(placeholderOrder.getStatus());
|
||||
occupancyOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
occupancyOrderInfo.setConnectorID(placeholderOrder.getTerminalNumber());
|
||||
occupancyOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setFreeDuration(placeholderOrder.getFreeTime());
|
||||
|
||||
if(placeholderOrder.getTotalTimeSpan() !=null || placeholderOrder.getConfirmResult()==0){
|
||||
if(placeholderOrder.getTotalTimeSpan()>30){
|
||||
occupancyOrderInfo.setOccupancyFeeStartTime(DateUtil.format(DateUtil.offsetMinute(placeholderOrder.getStartTime(),30), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setOccupancyDuration(placeholderOrder.getTotalTimeSpan()-30);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0.2).multiply(new BigDecimal(placeholderOrder.getTotalTimeSpan()-30)).setScale(2,BigDecimal.ROUND_CEILING));
|
||||
}else{
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0));
|
||||
}
|
||||
}else{
|
||||
DateTime parse = cn.hutool.core.date.DateUtil.parse(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime parse1 = new DateTime();
|
||||
long betweenDay = cn.hutool.core.date.DateUtil.between(parse,parse1, DateUnit.MINUTE);
|
||||
if(betweenDay>30){
|
||||
int num = (int) (betweenDay - 30);
|
||||
occupancyOrderInfo.setOccupancyFeeStartTime(DateUtil.format(DateUtil.offsetMinute(placeholderOrder.getStartTime(),30), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setOccupancyDuration(num);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0.2).multiply(new BigDecimal(num)).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}else{
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0));
|
||||
}
|
||||
}
|
||||
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setMsg("获取占位费信息成功");
|
||||
resp.setData(JSONUtil.toJSONString(occupancyOrderInfo));
|
||||
return resp;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
resp.setMsg("获取占位费信息失败");
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,211 @@
|
||||
package com.xhpc.evcs.ykc.api;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:42
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.evcs.api.QueryStopChargeController;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcChargingPileRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
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.Async;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class YKCQueryStopChargeController extends CoreDispatcher {
|
||||
@Autowired
|
||||
PowerPileService powerPileService;
|
||||
//三方订单与redis内部订单映射表
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
@Autowired
|
||||
private com.xhpc.evcs.jpa.XhpcChargingPileRepository XhpcChargingPileRepository;
|
||||
@Autowired
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(QueryStopChargeController.class);
|
||||
private final ExecutorService asyncExecutor = Executors.newFixedThreadPool(40);
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v50/query_stop_charge")
|
||||
public CommonResponse queryStopCharge(@RequestBody CommonRequest<QueryStopChargeRequest> commonRequest) throws IOException {
|
||||
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet(EvcsConst.RET_FAIL);
|
||||
QueryStopChargeRequest queryStopChargeRequest = JSONUtil.readParams(commonRequest.getData(),
|
||||
QueryStopChargeRequest.class);
|
||||
String orderNo="";
|
||||
if (queryStopChargeRequest == null) {
|
||||
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
// evcs电订单号(27位)
|
||||
String startChargeSeq = queryStopChargeRequest.getStartChargeSeq();
|
||||
QueryStopChargeResponse queryStopChargeResponse = new QueryStopChargeResponse();
|
||||
queryStopChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
//判断三方的订单号是否存在
|
||||
EtOrderMapping etOrderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
return failCommonResponse(queryStopChargeResponse, "错误的充电订单号");
|
||||
}
|
||||
String xhOrderNo = etOrderMapping.getXhOrderNo();
|
||||
orderNo = xhOrderNo;
|
||||
String pushOrderkey = "pushOrder:".concat(xhOrderNo);
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderkey);
|
||||
if (pushOrder == null || (pushOrder.get("isStopNotified") != null && (Boolean) pushOrder.get("isStopNotified"))) {
|
||||
return failCommonResponse(queryStopChargeResponse, "已下发停止充电指令");
|
||||
}
|
||||
//充电设备接口编码(枪编码)
|
||||
String connectorId = queryStopChargeRequest.getConnectorId();
|
||||
String pileNum = connectorId.substring(0, connectorId.length() - 2);
|
||||
//从数据库中查询对应的桩的版本信息
|
||||
XhpcChargingPile pileInfo = XhpcChargingPileRepository.findBySerialNumber(pileNum).orElse(null);
|
||||
String versionNum = pileInfo.getCommunicationProtocolVersion() != null ?
|
||||
pileInfo.getCommunicationProtocolVersion() :
|
||||
"0C";
|
||||
//给对应的枪发送停止充电指令
|
||||
|
||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||
// 判断停止指令发送是否成功
|
||||
if (r.getCode() != 200) {
|
||||
//向redis中放入停止充电指令没有下发成功的标识
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
//充电订单状态
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
//操作结果
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
//失败原因
|
||||
String errorMsg = r.getMsg();
|
||||
if (errorMsg.contains("未注册")) {
|
||||
queryStopChargeResponse.setFailReason(1);
|
||||
}
|
||||
if (errorMsg.contains("离线")) {
|
||||
queryStopChargeResponse.setFailReason(2);
|
||||
}
|
||||
if (errorMsg.contains("订单号")) {
|
||||
//4 means error orderNumber
|
||||
queryStopChargeResponse.setFailReason(4);
|
||||
}
|
||||
if (errorMsg.contains("端口")) {
|
||||
//5 means port is not charging
|
||||
queryStopChargeResponse.setFailReason(5);
|
||||
}
|
||||
queryStopChargeResponse.setStartChargeSeqStat(4);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
commonResponse.setMsg("请求停止充电失败");
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
//设置该订单已经被停止的标识
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + xhOrderNo);
|
||||
order.replace("status", "已结束");
|
||||
REDIS.setCacheMap("order:".concat(xhOrderNo), order);
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
queryStopChargeResponse.setStartChargeSeqStat(4);
|
||||
queryStopChargeResponse.setSuccStat(0);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
System.out.println("=====请求停止充电==query_stop_charge========="+data);
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setMsg("请求停止充电成功");
|
||||
commonResponse.setData(data);
|
||||
}
|
||||
|
||||
// if("0".equals(commonResponse.getRet())){
|
||||
// String finalOrderNo = orderNo;
|
||||
// CompletableFuture.runAsync(()->{
|
||||
// processRequest(finalOrderNo);
|
||||
// },asyncExecutor);
|
||||
// }
|
||||
// System.out.println(">>> 回复停止结果 <<<");
|
||||
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
private CommonResponse failCommonResponse(QueryStopChargeResponse queryStopChargeResponse, String msg) throws JsonProcessingException {
|
||||
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet("500");
|
||||
commonResponse.setMsg(msg);
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public void processRequest(String orderNo){
|
||||
System.out.println(">>> 开始执行后续操作 <<<");
|
||||
try{
|
||||
//推送停止成功数据
|
||||
String pushOrderKey ="pushOrder:"+orderNo;
|
||||
String orderkey = "order:".concat(orderNo);
|
||||
CacheOrderData orderData = REDIS.getCacheMapValue(orderkey, "orderData");
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
|
||||
if (orderData != null || (pushOrder != null && pushOrder.get("startChargeSeqStat") != null && (Integer) pushOrder.get("startChargeSeqStat") > 3)) {
|
||||
Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified");
|
||||
if (isStopNotified == null || !isStopNotified) {
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
if (internetSerialNumber != null) {
|
||||
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
||||
AuthSecretToken authSecretTokenOut =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
CommonRequest<ChargeResultRequest> commonRequest = new CommonRequest<>();
|
||||
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||
//使用指定包装类封装数据
|
||||
chargeResultRequest.setConnectorID(orderkey.substring(0, 16));
|
||||
chargeResultRequest.setStartChargeSeqStat(4);
|
||||
chargeResultRequest.setSuccStat(0);
|
||||
chargeResultRequest.setFailReason(0);
|
||||
//将其转换为json
|
||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||
commonRequest.setData(jsonData);
|
||||
String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut);
|
||||
System.out.println("===充电结束=停止推送结果=======notification_stop_charge_result========="+result+"============orderNo========"+orderNo);
|
||||
pushOrder.put("isStopNotified", true);
|
||||
REDIS.setCacheMap(pushOrderKey, pushOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("==========第三方调用停止充电接口=====停止推送失败=====responseBody=======================");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,201 @@
|
||||
package com.xhpc.evcs.ykc.notification;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIOrderRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.notification.xindiantu.NotificationPlaceholderOrderInfoTask;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
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 org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 云快充订单推送
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-06-09 13:59
|
||||
*/
|
||||
@Component
|
||||
@RestController
|
||||
@RequestMapping("/yckPlaceholderOrderInfoTask")
|
||||
public class YCKNotificationPlaceholderOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private PlaceholderIOrderRepository placeholderIOrderRepository;
|
||||
private final Logger logger = LoggerFactory.getLogger(YCKNotificationPlaceholderOrderInfoTask.class);
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA1MY0GF9", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
if (authSecretTokenOut != null) {
|
||||
|
||||
//初始化
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrder =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc("MA1MY0GF9",-2);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrder) {
|
||||
if (placeholderOrder.getConfirmResult() == -2) {
|
||||
OccupancyOrderInfo occupancyOrderInfo = new OccupancyOrderInfo();
|
||||
occupancyOrderInfo.setOccupancyFeeCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
occupancyOrderInfo.setOccupancyStatus(0);
|
||||
occupancyOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
occupancyOrderInfo.setConnectorID(placeholderOrder.getTerminalNumber());
|
||||
occupancyOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
occupancyOrderInfo.setFreeDuration(placeholderOrder.getFreeTime());
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0));
|
||||
|
||||
final ChargeOrderInfoResponse pushResp = notify(occupancyOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
|
||||
Map<String, Object> additionalProperties = pushResp.getAdditionalProperties();
|
||||
|
||||
if (Integer.valueOf(additionalProperties.get("SuccStat").toString()) == 0) {
|
||||
placeholderOrder.setConfirmResult(-1);
|
||||
} else {
|
||||
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
|
||||
}
|
||||
logger.debug("云快充3rd part order {} push result: {}", placeholderOrder.getSerialNumber(), pushResp.getConfirmResult());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderOrder.setStatus(0);
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("云快充3dp[{}] order[{}/{}] push fail", "MA1MY0GF9", placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
//占位结束
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrderYus =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc("MA1MY0GF9",1,-1);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrderYus) {
|
||||
OccupancyOrderInfo occupancyOrderInfo = new OccupancyOrderInfo();
|
||||
occupancyOrderInfo.setOccupancyFeeCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
occupancyOrderInfo.setOccupancyStatus(3);
|
||||
occupancyOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
occupancyOrderInfo.setConnectorID(placeholderOrder.getTerminalNumber());
|
||||
occupancyOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setFreeDuration(placeholderOrder.getFreeTime());
|
||||
if(placeholderOrder.getTotalTimeSpan()>30){
|
||||
occupancyOrderInfo.setOccupancyFeeStartTime(DateUtil.format(DateUtil.offsetMinute(placeholderOrder.getStartTime(),30), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setOccupancyDuration(placeholderOrder.getTotalTimeSpan()-30);
|
||||
}else{
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
}
|
||||
occupancyOrderInfo.setTotalOccupancyFee(placeholderOrder.getTotalMoney());
|
||||
final ChargeOrderInfoResponse pushResp = notify(occupancyOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
|
||||
Map<String, Object> additionalProperties = pushResp.getAdditionalProperties();
|
||||
if (Integer.valueOf(additionalProperties.get("SuccStat").toString()) != 0) {
|
||||
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
|
||||
} else {
|
||||
placeholderOrder.setConfirmResult(0);
|
||||
}
|
||||
placeholderOrder.setStatus(3);
|
||||
logger.debug("云快充3rd part order {} push result: {}", placeholderOrder.getSerialNumber(), pushResp.getConfirmResult());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("云快充3dp[{}] order[{}/{}] push fail", "MA1MY0GF9", placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0/15 * * * ? ")
|
||||
public void runYu() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA1MY0GF9", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
if (authSecretTokenOut != null) {
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrder =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc("MA1MY0GF9",0,-1);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrder) {
|
||||
if (placeholderOrder.getConfirmResult() == -1) {
|
||||
OccupancyOrderInfo occupancyOrderInfo = new OccupancyOrderInfo();
|
||||
occupancyOrderInfo.setOccupancyFeeCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
occupancyOrderInfo.setOccupancyStatus(2);
|
||||
occupancyOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
occupancyOrderInfo.setConnectorID(placeholderOrder.getTerminalNumber());
|
||||
occupancyOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setFreeDuration(placeholderOrder.getFreeTime());
|
||||
if(placeholderOrder.getTotalTimeSpan() !=null || placeholderOrder.getConfirmResult()==0){
|
||||
if(placeholderOrder.getTotalTimeSpan()>30){
|
||||
occupancyOrderInfo.setOccupancyFeeStartTime(DateUtil.format(DateUtil.offsetMinute(placeholderOrder.getStartTime(),30), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setOccupancyDuration(placeholderOrder.getTotalTimeSpan()-30);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0.2).multiply(new BigDecimal(placeholderOrder.getTotalTimeSpan()-30)).setScale(2,BigDecimal.ROUND_CEILING));
|
||||
}else{
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0));
|
||||
}
|
||||
}else{
|
||||
DateTime parse = cn.hutool.core.date.DateUtil.parse(DateUtil.format(placeholderOrder.getStartTime(), "yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime parse1 = new DateTime();
|
||||
long betweenDay = cn.hutool.core.date.DateUtil.between(parse,parse1, DateUnit.MINUTE);
|
||||
if(betweenDay>30){
|
||||
int num = (int) (betweenDay - 30);
|
||||
occupancyOrderInfo.setOccupancyFeeStartTime(DateUtil.format(DateUtil.offsetMinute(placeholderOrder.getStartTime(),30), "yyyy-MM-dd HH:mm:ss"));
|
||||
occupancyOrderInfo.setOccupancyDuration(num);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0.2).multiply(new BigDecimal(num)).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||
}else{
|
||||
occupancyOrderInfo.setOccupancyDuration(0);
|
||||
occupancyOrderInfo.setTotalOccupancyFee(new BigDecimal(0));
|
||||
}
|
||||
}
|
||||
|
||||
final ChargeOrderInfoResponse pushResp = notify(occupancyOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
Map<String, Object> additionalProperties = pushResp.getAdditionalProperties();
|
||||
|
||||
if (Integer.valueOf(additionalProperties.get("SuccStat").toString()) == 0) {
|
||||
placeholderOrder.setConfirmResult(-1);
|
||||
} else {
|
||||
placeholderOrder.setConfirmResult(Integer.valueOf(additionalProperties.get("SuccStat").toString()));
|
||||
}
|
||||
logger.debug("云快充3rd part order {} push result: {}", placeholderOrder.getSerialNumber(), pushResp.getConfirmResult());
|
||||
placeholderOrder.setStatus(2);
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("云快充3dp[{}] order[{}/{}] push fail", "MA1MY0GF9", placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChargeOrderInfoResponse notify(OccupancyOrderInfo occupancyOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String data = JSONUtil.toJSONString(occupancyOrderInfo);
|
||||
CommonRequest<PlaceholderOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
System.out.println("========云快充推送记录=============="+data);
|
||||
String responseBody = ok(commonRequest, "/notification_occupancy_order_info", authSecretTokenOut);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.xhpc.evcs.ykc.notification;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationFee;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2026-03-18 16:38
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class YKCNotificationStationFeeTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
private final Logger logger = LoggerFactory.getLogger(YKCNotificationStationFeeTask.class);
|
||||
|
||||
//不开放
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA1MY0GF9", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("cdjgpc:stationFee:*"));
|
||||
for (String stationKey : stationKeys) {
|
||||
CDStationFee cdStationFeeRequest = REDIS.getCacheObject(stationKey);
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("StationFee",cdStationFeeRequest);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDStationFee> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String ok = ok(commonRequest, "/notification_stationFee", authSecretTokenOut);
|
||||
log.info("======站点费率推送=========notification_stationFee=================="+ok);
|
||||
// REDIS.deleteObject(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,266 @@
|
||||
package com.xhpc.evcs.ykc.notification;
|
||||
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.utils.bean.BeanUtils;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cdjgpc.notification.CDNotificationStationInfoTask;
|
||||
import com.xhpc.evcs.cwj.dto.CWJConnectorInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJEquipmentInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJStationInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
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 javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 云快充
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-17 13:47
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class YKCNotificationStationInfoTask extends CoreDispatcher {
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private PlaceholderIRepository placeholderIRepository;
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(cron = "0 30 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(8L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA1MY0GF9", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
for (String stationKey : stationKeys) {
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
String chargingStationId = stationKey.substring(8);
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
CWJStationInfo cwjStationInfo = new CWJStationInfo();
|
||||
BeanUtils.copyBeanProp(cwjStationInfo,cdStationInfo);
|
||||
cwjStationInfo.setBusineHours("00:00-24:00");
|
||||
cwjStationInfo.setParkingDiscountType(2);
|
||||
cwjStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//获取占位费信息
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByYkcStatusAndChargingStationIdAndDelFlag(1,Long.valueOf(chargingStationId), 0);
|
||||
if(xhpcPlacreholder !=null){
|
||||
cwjStationInfo.setOvertimeFee(xhpcPlacreholder.getContent());
|
||||
}
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
|
||||
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
|
||||
|
||||
StringBuilder price = new StringBuilder();
|
||||
StringBuilder svcPrice = new StringBuilder();
|
||||
|
||||
Integer t1Price = cacheRateModel.getT1Price();
|
||||
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
|
||||
Integer t2Price = cacheRateModel.getT2Price();
|
||||
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
|
||||
Integer t3Price = cacheRateModel.getT3Price();
|
||||
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
|
||||
Integer t4Price = cacheRateModel.getT4Price();
|
||||
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
|
||||
|
||||
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
|
||||
price.append("{");
|
||||
svcPrice.append("{");
|
||||
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
|
||||
String time = getTime(i);
|
||||
String s = cacheRateModel.getTfPricesSeq()[i];
|
||||
|
||||
if("00".equals(s)){
|
||||
price.append(time).append(t1Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
|
||||
}else if("01".equals(s)){
|
||||
price.append(time).append(t2Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
|
||||
}else if("02".equals(s)){
|
||||
price.append(time).append(t3Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
|
||||
}else{
|
||||
price.append(time).append(t4Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
|
||||
}
|
||||
}
|
||||
price.deleteCharAt(price.length()-1).append("}");
|
||||
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
|
||||
}
|
||||
cwjStationInfo.setElectricityFee(price.toString());
|
||||
cwjStationInfo.setServiceFee(svcPrice.toString());
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CWJEquipmentInfo> cwjEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk)+".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
CWJEquipmentInfo cwjEquipmentInfo = new CWJEquipmentInfo();
|
||||
BeanUtils.copyBeanProp(cwjEquipmentInfo,cdEquipmentInfo);
|
||||
|
||||
List<CWJConnectorInfo> connectorInfos =new ArrayList<>();
|
||||
List<CDConnectorInfo> connectorInfos1 = cdEquipmentInfo.getConnectorInfos();
|
||||
|
||||
for (int i = 0; i <connectorInfos1.size() ; i++) {
|
||||
CDConnectorInfo cdConnectorInfo = connectorInfos1.get(i);
|
||||
CWJConnectorInfo cwjConnectorInfo = new CWJConnectorInfo();
|
||||
BeanUtils.copyBeanProp(cwjConnectorInfo,cdConnectorInfo);
|
||||
connectorInfos.add(cwjConnectorInfo);
|
||||
}
|
||||
cwjEquipmentInfo.setConnectorInfos(connectorInfos);
|
||||
cwjEquipmentInfo.setPower(cdEquipmentInfo.getEquipmentPower());
|
||||
cwjEquipmentInfos.add(cwjEquipmentInfo);
|
||||
}
|
||||
cwjStationInfo.setEquipmentInfos(cwjEquipmentInfos);
|
||||
}
|
||||
CommonRequest<CWJStationInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationInfo",cwjStationInfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("=======data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||
System.out.println("=====推送充电站信息==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String getTime(Integer number){
|
||||
String time ="";
|
||||
if(number ==0){
|
||||
time ="00:00:00-00:30:00:";
|
||||
}else if(number ==1) {
|
||||
time = "00:30:00-01:00:00:";
|
||||
}else if(number ==2) {
|
||||
time = "01:00:00-01:30:00:";
|
||||
}else if(number ==3) {
|
||||
time = "01:30:00-02:00:00:";
|
||||
}else if(number ==4) {
|
||||
time = "02:00:00-02:30:00:";
|
||||
}else if(number ==5) {
|
||||
time = "02:30:00-03:00:00:";
|
||||
}else if(number ==6) {
|
||||
time = "03:00:00-03:30:00:";
|
||||
}else if(number ==7) {
|
||||
time = "03:30:00-04:00:00:";
|
||||
}else if(number ==8) {
|
||||
time = "04:00:00-04:30:00:";
|
||||
}else if(number ==9) {
|
||||
time = "04:30:00-05:00:00:";
|
||||
}else if(number ==10) {
|
||||
time = "05:00:00-05:30:00:";
|
||||
}else if(number ==11) {
|
||||
time = "05:30:00-06:00:00:";
|
||||
}else if(number ==12) {
|
||||
time = "06:00:00-06:30:00:";
|
||||
}else if(number ==13) {
|
||||
time = "06:30:00-07:00:00:";
|
||||
}else if(number ==14) {
|
||||
time = "07:00:00-07:30:00:";
|
||||
}else if(number ==15) {
|
||||
time = "07:30:00-08:00:00:";
|
||||
}else if(number ==16) {
|
||||
time = "08:00:00-08:30:00:";
|
||||
}else if(number ==17) {
|
||||
time = "08:30:00-09:00:00:";
|
||||
}else if(number ==18) {
|
||||
time = "09:00:00-09:30:00:";
|
||||
}else if(number ==19) {
|
||||
time = "09:30:00-10:00:00:";
|
||||
}else if(number ==20) {
|
||||
time = "10:00:00-10:30:00:";
|
||||
}else if(number ==21) {
|
||||
time = "10:30:00-11:00:00:";
|
||||
}else if(number ==22) {
|
||||
time = "11:00:00-11:30:00:";
|
||||
}else if(number ==23) {
|
||||
time = "11:30:00-12:00:00:";
|
||||
}else if(number ==24) {
|
||||
time = "12:00:00-12:30:00:";
|
||||
}else if(number ==25) {
|
||||
time = "12:30:00-13:00:00:";
|
||||
}else if(number ==26) {
|
||||
time = "13:00:00-13:30:00:";
|
||||
}else if(number ==27) {
|
||||
time = "13:30:00-14:00:00:";
|
||||
}else if(number ==28) {
|
||||
time = "14:00:00-14:30:00:";
|
||||
}else if(number ==29) {
|
||||
time = "14:30:00-15:00:00:";
|
||||
}else if(number ==30){
|
||||
time ="15:00:00-15:30:00:";
|
||||
}else if(number ==31) {
|
||||
time = "15:30:00-16:00:00:";
|
||||
}else if(number ==32) {
|
||||
time = "16:00:00-16:30:00:";
|
||||
}else if(number ==33) {
|
||||
time = "16:30:00-17:00:00:";
|
||||
}else if(number ==34) {
|
||||
time = "17:00:00-17:30:00:";
|
||||
}else if(number ==35) {
|
||||
time = "17:30:00-18:00:00:";
|
||||
}else if(number ==36) {
|
||||
time = "18:00:00-18:30:00:";
|
||||
}else if(number ==37) {
|
||||
time = "18:30:00-19:00:00:";
|
||||
}else if(number ==38) {
|
||||
time = "19:00:00-19:30:00:";
|
||||
}else if(number ==39) {
|
||||
time = "19:30:00-20:00:00:";
|
||||
}else if(number ==40){
|
||||
time ="20:00:00-20:30:00:";
|
||||
}else if(number ==41) {
|
||||
time = "20:30:00-21:00:00:";
|
||||
}else if(number ==42) {
|
||||
time = "21:00:00-21:30:00:";
|
||||
}else if(number ==43) {
|
||||
time = "21:30:00-22:00:00";
|
||||
}else if(number ==44) {
|
||||
time = "22:00:00-22:30:00:";
|
||||
}else if(number ==45) {
|
||||
time = "22:30:00-23:00:00:";
|
||||
}else if(number ==46) {
|
||||
time = "23:00:00-23:30:00";
|
||||
}else if(number ==47) {
|
||||
time = "23:30:00-24:00:00:";
|
||||
}
|
||||
return time;
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,9 @@ public class SysLoginService
|
||||
throw new BaseException("用户不存在/密码错误");
|
||||
}
|
||||
if(type==0){
|
||||
if(user.getDataPowerType()!=0){
|
||||
if(user.getDataPowerType()==0 || user.getDataPowerType()==3){
|
||||
|
||||
}else{
|
||||
remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "登陆地址错误");
|
||||
throw new BaseException("登陆地址错误,请在运营商界面登陆");
|
||||
}
|
||||
|
||||
@ -48,6 +48,12 @@ public class StatusConstants {
|
||||
*/
|
||||
public static final String OPERATION_SON_USER_TYPE = "03";
|
||||
|
||||
/**
|
||||
* 车队用户类型
|
||||
*/
|
||||
public static final String MOTORCADE_USER_TYPE = "04";
|
||||
|
||||
|
||||
/**
|
||||
* 全部权限类型
|
||||
*/
|
||||
@ -67,6 +73,10 @@ public class StatusConstants {
|
||||
* 流量账号权限类型
|
||||
*/
|
||||
public static final Integer INTERNET_POWER_TYPE = 3;
|
||||
/**
|
||||
* 车队账号权限类型
|
||||
*/
|
||||
public static final Integer MOTORCADE_TYPE = 4;
|
||||
|
||||
/**
|
||||
* 过期时间半个小时
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="super_type" property="superType"/>
|
||||
<result column="operator_id" property="operatorId"/>
|
||||
<result column="internet_user_id" property="internetUserId"/>
|
||||
<association column="dept_id" property="dept" javaType="com.xhpc.system.api.domain.SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
@ -87,6 +88,7 @@
|
||||
u.user_type,
|
||||
u.tenant_id,
|
||||
u.operator_id,
|
||||
u.internet_user_id,
|
||||
xop.corp_no corpNo
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
||||
@ -38,7 +38,10 @@ public class XhpcClearingCheckoutDomain implements Serializable {
|
||||
* 手续费
|
||||
*/
|
||||
private BigDecimal handlingFee;
|
||||
|
||||
/**
|
||||
* 不参与清分金额
|
||||
*/
|
||||
private BigDecimal clearingPrice;
|
||||
/**
|
||||
* 银行手续费
|
||||
*/
|
||||
@ -115,4 +118,4 @@ public class XhpcClearingCheckoutDomain implements Serializable {
|
||||
private String tenantName;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,5 +320,11 @@ public class XhpcClearingHistoryOrderDomain implements Serializable {
|
||||
|
||||
private String chargingModeName;
|
||||
|
||||
private Integer clearingType;
|
||||
|
||||
private BigDecimal clearingPrice;
|
||||
|
||||
private BigDecimal actClearingPrice;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@ -97,6 +97,8 @@ public class XhpcHistoryOrderDomain implements Serializable {
|
||||
*/
|
||||
private BigDecimal actPowerPrice;
|
||||
|
||||
private BigDecimal actTotalPrice;
|
||||
|
||||
/**
|
||||
* 实收服务费-运营商服务费
|
||||
*/
|
||||
@ -304,5 +306,9 @@ public class XhpcHistoryOrderDomain implements Serializable {
|
||||
*/
|
||||
private String chargingTime;
|
||||
|
||||
private Integer clearingType;
|
||||
|
||||
private BigDecimal clearingPrice;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ public interface XhpcClearingCheckoutMapper {
|
||||
|
||||
List<XhpcClearingCheckoutDomain> selectByParams(@Param("params") Map<String, Object> params);
|
||||
|
||||
|
||||
List<Map<String, Object>> getXhpcOperatorParams(@Param("params") Map<String, Object> params);
|
||||
List<Map<String, Object>> selectCheckoutMapByParams(@Param("params") Map<String, Object> params);
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ public interface XhpcClearingCheckoutMapper {
|
||||
|
||||
BigDecimal selectAmountByStatus(@Param("operatorId")String operatorId, @Param("status")Integer status);
|
||||
|
||||
|
||||
List<CheckoutBankVo> selectOrderMapByCheckoutIds(@Param("checkoutIds")String checkoutIds);
|
||||
|
||||
int updateStatusByIds(@Param("checkoutIds")String checkoutIds, @Param("status")Integer status);
|
||||
@ -40,4 +39,25 @@ public interface XhpcClearingCheckoutMapper {
|
||||
List<Map<String, Object>> selectMapGroupByStatus(@Param("checkoutIds")String checkoutIds);
|
||||
|
||||
String selectIdsByStatusAndIds(@Param("checkoutIds")String checkoutIds, @Param("status") Integer status);
|
||||
}
|
||||
|
||||
//带清分金额
|
||||
BigDecimal selectUnclearingAmount(@Param("params") Map<String, Object> params);
|
||||
//不参与清分基恩
|
||||
Map<String, Object> selectClearingPrice(@Param("params") Map<String, Object> params);
|
||||
|
||||
|
||||
Map<String, Object> selectCashedAmountOrCashingAmount(@Param("operatorId")String operatorId);
|
||||
// 1. 批量获取待清分金额 - 返回 List
|
||||
List<Map<String, Object>> selectUnclearingAmountBatch(@Param("operatorIds") List<String> operatorIds,
|
||||
@Param("params") Map<String, Object> params);
|
||||
// 2. 批量获取已提现和提现中金额 - 返回 List
|
||||
List<Map<String, Object>> selectCashedAmountOrCashingAmountBatch(@Param("operatorIds") List<String> operatorIds);
|
||||
|
||||
// 3. 批量获取不参与清分金额 - 返回 List
|
||||
List<Map<String, Object>> selectCashAmountYuBatch(@Param("operatorIds") List<String> operatorIds);
|
||||
|
||||
// 4. 批量获取清分价格和总金额 - 返回 List
|
||||
List<Map<String, Object>> selectClearingPriceBatch(@Param("operatorIds") List<String> operatorIds,
|
||||
@Param("params") Map<String, Object> params);
|
||||
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ public interface XhpcClearingHistoryOrderMapper {
|
||||
|
||||
List<XhpcClearingHistoryOrderDomain> getListPage(@Param("params") Map params);
|
||||
|
||||
List<XhpcClearingHistoryOrderDomain> getorderExportPage(@Param("params") Map params);
|
||||
|
||||
String getClearingOrderIds(@Param("params") Map params);
|
||||
|
||||
int updateStatusBatchByOrderIds(@Param("orderIds") String orderIds, @Param("status") Integer status, @Param("checkBy")String checkBy);
|
||||
@ -30,6 +32,9 @@ public interface XhpcClearingHistoryOrderMapper {
|
||||
|
||||
Map<String, Object> selectCashAmount(@Param("operatorId")String operatorId);
|
||||
|
||||
//去除不参与清分的金额
|
||||
Map<String, Object> selectCashAmountYu(@Param("operatorId")String operatorId);
|
||||
|
||||
List<Map<String, Object>> selectOrderPage(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<XhpcClearingHistoryOrderDomain> selectOrderListByOperator(@Param("operatorId")String operatorId);
|
||||
@ -52,4 +57,4 @@ public interface XhpcClearingHistoryOrderMapper {
|
||||
*/
|
||||
List<Map<String,Object>> getOrderListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId,@Param("confirmResult")Integer confirmResult,@Param("tenantId")String tenantId,@Param("isNotNull")Integer isNotNull, @Param("checkoutId")Integer checkoutId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,17 +73,17 @@ public class WorkOrderServiceImpl implements WorkOrderService {
|
||||
params.put("userId", logOperatorId);
|
||||
|
||||
//运营商看自己的场站
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
return orderMapper.findOrderListByParams(params);
|
||||
}else{
|
||||
params.put("type", 2);
|
||||
params.put("userId", sysUserId);
|
||||
//查询赋值的场站
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
return orderMapper.findOrderListByParams(params);
|
||||
}
|
||||
}else{
|
||||
params.put("type", 0);
|
||||
params.put("userId", sysUserId);
|
||||
return deviceMapper.selectStationGunDeviceListByParams(params);
|
||||
return orderMapper.findOrderListByParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public class WorkStationServiceImpl extends BaseService implements WorkStationSe
|
||||
return 0;
|
||||
}else if("故障".equals(cacheMap.get("status").toString())){
|
||||
return 1;
|
||||
}else if("空闲".equals(cacheMap.get("status").toString())){
|
||||
}else if("空闲".equals(cacheMap.get("status").toString()) || "插枪".equals(cacheMap.get("status").toString())){
|
||||
if("是".equals(cacheMap.get("vehicleGunStatus").toString())){
|
||||
return 4;
|
||||
}else{
|
||||
|
||||
@ -105,10 +105,149 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
return checkoutMapper.selectByParams(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getCheckoutPage(Map<String, Object> params){
|
||||
return checkoutMapper.selectCheckoutMapByParams(params);
|
||||
|
||||
//获取运营商
|
||||
List<Map<String, Object>> mapList = checkoutMapper.getXhpcOperatorParams(params);
|
||||
BigDecimal bankRate = new BigDecimal("0.006");
|
||||
BigDecimal handlingAmount = BigDecimal.TEN;
|
||||
|
||||
if (mapList != null && !mapList.isEmpty()) {
|
||||
// 提取所有运营商ID
|
||||
List<String> operatorIds = mapList.stream()
|
||||
.map(map -> map.get("operatorId").toString())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 1. 批量获取待清分金额
|
||||
List<Map<String, Object>> unClearingAmountList = checkoutMapper.selectUnclearingAmountBatch(operatorIds, params);
|
||||
Map<String, BigDecimal> unClearingAmountMap = unClearingAmountList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
m -> m.get("operatorId").toString(),
|
||||
m -> new BigDecimal(m.get("unClearingAmount").toString())
|
||||
));
|
||||
|
||||
// 2. 批量获取已提现和提现中金额
|
||||
List<Map<String, Object>> cashAmountList = checkoutMapper.selectCashedAmountOrCashingAmountBatch(operatorIds);
|
||||
Map<String, Map<String, BigDecimal>> cashAmountMap = cashAmountList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
m -> m.get("operatorId").toString(),
|
||||
m -> {
|
||||
Map<String, BigDecimal> map = new HashMap<>();
|
||||
map.put("cashingAmount", new BigDecimal(m.get("cashingAmount").toString()));
|
||||
map.put("cashedAmount", new BigDecimal(m.get("cashedAmount").toString()));
|
||||
return map;
|
||||
}
|
||||
));
|
||||
|
||||
// 3. 批量获取不参与清分金额相关数据
|
||||
List<Map<String, Object>> excludeClearingList = checkoutMapper.selectCashAmountYuBatch(operatorIds);
|
||||
Map<String, Map<String, BigDecimal>> excludeClearingMap = excludeClearingList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
m -> m.get("operatorId").toString(),
|
||||
m -> {
|
||||
Map<String, BigDecimal> map = new HashMap<>();
|
||||
map.put("powerAmount", new BigDecimal(m.get("powerAmount").toString()));
|
||||
map.put("serviceAmount", new BigDecimal(m.get("serviceAmount").toString()));
|
||||
return map;
|
||||
}
|
||||
));
|
||||
|
||||
// 4. 批量获取清分清分价格和总金额
|
||||
List<Map<String, Object>> clearingPriceList = checkoutMapper.selectClearingPriceBatch(operatorIds, params);
|
||||
Map<String, Map<String, BigDecimal>> clearingPriceMap = clearingPriceList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
m -> m.get("operatorId").toString(),
|
||||
m -> {
|
||||
Map<String, BigDecimal> map = new HashMap<>();
|
||||
map.put("clearingPrice", new BigDecimal(m.get("clearingPrice").toString()));
|
||||
map.put("actTotalPrice", new BigDecimal(m.get("actTotalPrice").toString()));
|
||||
return map;
|
||||
}
|
||||
));
|
||||
|
||||
// 组装数据
|
||||
for (Map<String, Object> map : mapList) {
|
||||
String operatorId = map.get("operatorId").toString();
|
||||
|
||||
// 待清分金额
|
||||
BigDecimal unClearingAmount = unClearingAmountMap.getOrDefault(operatorId, BigDecimal.ZERO);
|
||||
map.put("unClearingAmount", unClearingAmount.compareTo(BigDecimal.ZERO) >= 0 ? unClearingAmount : BigDecimal.ZERO);
|
||||
|
||||
// 已提现金额和提现中金额
|
||||
Map<String, BigDecimal> cashMap = cashAmountMap.getOrDefault(operatorId, new HashMap<>());
|
||||
map.putAll(cashMap);
|
||||
|
||||
// 不参与清分金额数据
|
||||
Map<String, BigDecimal> excludeMap = excludeClearingMap.getOrDefault(operatorId, new HashMap<>());
|
||||
BigDecimal powerAmountYu = excludeMap.getOrDefault("powerAmount", BigDecimal.ZERO).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal serviceAmountYu = excludeMap.getOrDefault("serviceAmount", BigDecimal.ZERO).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal bankFeeYu = powerAmountYu.add(serviceAmountYu).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal receivedServiceAmountYu = serviceAmountYu.subtract(handlingAmount).subtract(bankFeeYu);
|
||||
|
||||
// 可提现金额
|
||||
BigDecimal cashableAmount = powerAmountYu.add(receivedServiceAmountYu);
|
||||
map.put("cashAmount", cashableAmount.compareTo(BigDecimal.ZERO) >= 0 ? cashableAmount : BigDecimal.ZERO);
|
||||
|
||||
// 清分价格和总金额
|
||||
Map<String, BigDecimal> clearingMap = clearingPriceMap.getOrDefault(operatorId, new HashMap<>());
|
||||
BigDecimal clearingPrice = clearingMap.getOrDefault("clearingPrice", BigDecimal.ZERO);
|
||||
BigDecimal actTotalPrice = clearingMap.getOrDefault("actTotalPrice", BigDecimal.ZERO);
|
||||
|
||||
map.put("clearingPrice", clearingPrice.compareTo(BigDecimal.ZERO) >= 0 ? clearingPrice : BigDecimal.ZERO);
|
||||
map.put("actTotalPrice", actTotalPrice.compareTo(BigDecimal.ZERO) >= 0 ? actTotalPrice : BigDecimal.ZERO);
|
||||
map.put("bankFeeYu", bankFeeYu.compareTo(BigDecimal.ZERO) >= 0 ? bankFeeYu : BigDecimal.ZERO);
|
||||
map.put("handlingAmount", handlingAmount);
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> getCheckoutPageYu(Map<String, Object> params){
|
||||
|
||||
//获取运营商
|
||||
List<Map<String, Object>> mapList = checkoutMapper.getXhpcOperatorParams(params);
|
||||
BigDecimal bankRate = new BigDecimal("0.006");
|
||||
BigDecimal handlingAmount = BigDecimal.TEN;
|
||||
if(mapList !=null && mapList.size()>0){
|
||||
// 可提现金额
|
||||
for (int i = 0; i <mapList.size() ; i++) {
|
||||
Map<String, Object> map = mapList.get(i);
|
||||
//统计带清分金额、可提现金额、提现中金额、已提现金额、不参与清分金额
|
||||
String operatorId = map.get("operatorId").toString();
|
||||
params.put("operatorId",operatorId);
|
||||
// 待清分金额
|
||||
BigDecimal unClearingAmount = checkoutMapper.selectUnclearingAmount(params);
|
||||
map.put("unClearingAmount",unClearingAmount.compareTo(BigDecimal.ZERO)>=0?unClearingAmount:BigDecimal.ZERO);
|
||||
// 已提现金额\提现中金额
|
||||
map.putAll(checkoutMapper.selectCashedAmountOrCashingAmount(operatorId));
|
||||
|
||||
|
||||
//剔除不参与清分金额
|
||||
Map<String, Object> cashMapYu = historyOrderMapper.selectCashAmountYu(operatorId);
|
||||
BigDecimal powerAmountYu = new BigDecimal(cashMapYu.get("powerAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal serviceAmountYu = new BigDecimal(cashMapYu.get("serviceAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal bankFeeYu = powerAmountYu.add(serviceAmountYu).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal receivedServiceAmountYu = serviceAmountYu.subtract(handlingAmount).subtract(bankFeeYu);
|
||||
//可提现金额
|
||||
map.put("cashAmount", powerAmountYu.add(receivedServiceAmountYu).compareTo(BigDecimal.ZERO) >= 0 ? powerAmountYu.add(receivedServiceAmountYu) : BigDecimal.ZERO);
|
||||
Map<String, Object> cashMap= checkoutMapper.selectClearingPrice(params);
|
||||
BigDecimal clearingPrice =new BigDecimal(cashMap.get("clearingPrice").toString());
|
||||
BigDecimal actTotalPrice =new BigDecimal(cashMap.get("actTotalPrice").toString());
|
||||
// 不参与清分金额
|
||||
map.put("clearingPrice",clearingPrice.compareTo(BigDecimal.ZERO)>=0?clearingPrice:BigDecimal.ZERO);
|
||||
//清分总金额
|
||||
map.put("actTotalPrice",actTotalPrice.compareTo(BigDecimal.ZERO)>=0?actTotalPrice:BigDecimal.ZERO);
|
||||
//微信/支付宝手续费
|
||||
map.put("bankFeeYu",bankFeeYu.compareTo(BigDecimal.ZERO)>=0?bankFeeYu:BigDecimal.ZERO);
|
||||
//银行提现费用
|
||||
map.put("handlingAmount",handlingAmount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,12 +260,12 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
// 可提现金额
|
||||
BigDecimal bankRate = new BigDecimal("0.006");
|
||||
BigDecimal handlingAmount = BigDecimal.TEN;
|
||||
|
||||
//全部金额包含不参与清分金额
|
||||
Map<String, Object> cashMap = historyOrderMapper.selectCashAmount(operatorId.toString());
|
||||
BigDecimal powerAmount = new BigDecimal(cashMap.get("powerAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal serviceAmount = new BigDecimal(cashMap.get("serviceAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
BigDecimal bankFee = powerAmount.add(serviceAmount).subtract(handlingAmount).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal clearingPrice = new BigDecimal(cashMap.get("clearingPrice").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal bankFee = powerAmount.add(serviceAmount).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal receivedServiceAmount = serviceAmount.subtract(handlingAmount).subtract(bankFee);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
@ -137,11 +276,21 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
resultMap.put("applyServiceAmount", serviceAmount);
|
||||
resultMap.put("clearingOrderIds", cashMap.get("clearingOrderIds"));
|
||||
resultMap.put("handlingFee", handlingAmount);
|
||||
resultMap.put("bankFee", bankFee);
|
||||
|
||||
resultMap.put("receivedPowerAmount", powerAmount);
|
||||
resultMap.put("receivedServiceAmount", receivedServiceAmount);
|
||||
resultMap.put("receivedAmount", powerAmount.add(receivedServiceAmount).compareTo(BigDecimal.ZERO) >= 0 ? powerAmount.add(receivedServiceAmount) : BigDecimal.ZERO);
|
||||
resultMap.put("clearingPrice", clearingPrice);
|
||||
|
||||
//剔除不参与清分金额
|
||||
Map<String, Object> cashMapYu = historyOrderMapper.selectCashAmountYu(operatorId.toString());
|
||||
BigDecimal powerAmountYu = new BigDecimal(cashMapYu.get("powerAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal serviceAmountYu = new BigDecimal(cashMapYu.get("serviceAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal bankFeeYu = powerAmountYu.add(serviceAmountYu).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal receivedServiceAmountYu = serviceAmountYu.subtract(handlingAmount).subtract(bankFeeYu);
|
||||
resultMap.put("bankFee", bankFeeYu);
|
||||
resultMap.put("clearingPower", powerAmountYu);
|
||||
resultMap.put("clearingService", serviceAmountYu);
|
||||
resultMap.put("receivedPowerAmount", powerAmountYu);
|
||||
resultMap.put("receivedServiceAmount", receivedServiceAmountYu);
|
||||
resultMap.put("receivedAmount", powerAmountYu.add(receivedServiceAmountYu).compareTo(BigDecimal.ZERO) >= 0 ? powerAmountYu.add(receivedServiceAmountYu) : BigDecimal.ZERO);
|
||||
resultMap.put("clearingBankId", bankDomain.getClearingBankId());
|
||||
return R.ok(resultMap);
|
||||
}
|
||||
@ -310,6 +459,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)");
|
||||
writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)");
|
||||
writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)");
|
||||
writer.addHeaderAlias("clearingPrice", "运营商不参与清分金额(元)");
|
||||
writer.addHeaderAlias("startSoc", "启动SOC");
|
||||
writer.addHeaderAlias("endSoc", "结算SOC");
|
||||
writer.addHeaderAlias("startTime", "开始充电时间");
|
||||
@ -480,6 +630,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
|
||||
writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)");
|
||||
writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)");
|
||||
writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)");
|
||||
writer.addHeaderAlias("clearingPrice", "运营商不参与清分金额(元)");
|
||||
writer.addHeaderAlias("startSoc", "启动SOC");
|
||||
writer.addHeaderAlias("endSoc", "结算SOC");
|
||||
writer.addHeaderAlias("startTime", "开始充电时间");
|
||||
|
||||
@ -154,6 +154,8 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
|
||||
writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)");
|
||||
writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)");
|
||||
writer.addHeaderAlias("actTotalPrice", "运营商实收总费用(元)");
|
||||
writer.addHeaderAlias("clearingPrice", "运营商不参与清分金额(元)");
|
||||
writer.addHeaderAlias("actClearingPrice", "运营商清分金额(元)");
|
||||
writer.addHeaderAlias("startSoc", "启动SOC");
|
||||
writer.addHeaderAlias("endSoc", "结算SOC");
|
||||
writer.addHeaderAlias("startTime", "开始充电时间");
|
||||
@ -221,8 +223,19 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
|
||||
bankDomain.put("cashedAmount", cashedAmount);
|
||||
bankDomain.put("unclearingAmount", unClearingAmount);
|
||||
bankDomain.put("cashingAmount", cashingAmount);
|
||||
bankDomain.put("cashAmount", cashMap.get("amount"));
|
||||
// 可提现金额
|
||||
BigDecimal bankRate = new BigDecimal("0.006");
|
||||
BigDecimal handlingAmount = BigDecimal.TEN;
|
||||
//剔除不参与清分金额
|
||||
Map<String, Object> cashMapYu = historyOrderMapper.selectCashAmountYu(operatorId.toString());
|
||||
BigDecimal powerAmountYu = new BigDecimal(cashMapYu.get("powerAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal serviceAmountYu = new BigDecimal(cashMapYu.get("serviceAmount").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal bankFeeYu = powerAmountYu.add(serviceAmountYu).multiply(bankRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal receivedServiceAmountYu = serviceAmountYu.subtract(handlingAmount).subtract(bankFeeYu);
|
||||
|
||||
bankDomain.put("cashAmount", powerAmountYu.add(receivedServiceAmountYu).compareTo(BigDecimal.ZERO) >= 0 ? powerAmountYu.add(receivedServiceAmountYu) : BigDecimal.ZERO);
|
||||
// 不参与清分金额
|
||||
bankDomain.put("clearingPrice", cashMap.get("clearingPrice"));
|
||||
return bankDomain;
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ public class AutoProcessOrderTask {
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
//111@Scheduled(fixedRate = 60000)
|
||||
//@Scheduled(fixedRate = 60000)
|
||||
protected void run() {
|
||||
|
||||
List<XhpcWorkOrderDomain> orderList = workOrderMapper.selectByAutoRun();
|
||||
|
||||
@ -33,9 +33,10 @@ public class SyncHistoryOrderTask {
|
||||
|
||||
|
||||
/**
|
||||
* 每天六点自动同步一天之前所有未同步订单
|
||||
* 每小时自动同步一天之前所有未同步订单
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/3 * * * ?")
|
||||
@Transactional
|
||||
@GetMapping("/syncTask")
|
||||
public void ExpiredTenantStatusTask() {
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
cc.clearing_checkout_id, cc.clearing_bank_id, cc.apply_amount, cc.apply_power_amount, cc.apply_service_amount, cc.handling_fee,
|
||||
cc.received_amount, cc.bank_fee, cc.del_flag, cc.received_power_amount, cc.received_service_amount,
|
||||
cc.received_amount, cc.bank_fee, cc.del_flag, cc.received_power_amount, cc.received_service_amount,cc.clearing_price,
|
||||
cc.`status`, cc.operator_id, cc.tenant_id, cc.create_by, cc.create_time, cc.update_by, cc.update_time, cc.check_by, cc.check_time
|
||||
</sql>
|
||||
|
||||
@ -70,54 +70,88 @@
|
||||
<if test="params.type==2">
|
||||
and cc.operator_id in (select operator_id from xhpc_charging_station where charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.logOperatorId}))
|
||||
</if>
|
||||
order by cc.clearing_checkout_id desc,cc.status
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectCheckoutMapByParams" resultType="map">
|
||||
select
|
||||
xt.tenant_id as 'tenantId',
|
||||
xt.tenant_name as 'tenantName',
|
||||
xo.operator_id as 'operatorId',
|
||||
xo.name as 'operatorName',
|
||||
IFNULL(ho.unClearingAmount,0) as 'unClearingAmount',
|
||||
IFNULL(cho.cashAmount,0) as 'cashAmount',
|
||||
IFNULL(cc1.applyAmount,0) as 'applyAmount',
|
||||
IFNULL(cc2.cashedAmount,0) as 'cashedAmount'
|
||||
from xhpc_operator xo
|
||||
left join (SELECT operator_id, sum(received_amount) as 'applyAmount' from xhpc_clearing_checkout WHERE `status`=1 and del_flag=0 GROUP BY operator_id) cc1 on xo.operator_id = cc1.operator_id
|
||||
left join (SELECT operator_id, sum(received_amount) as 'cashedAmount' from xhpc_clearing_checkout WHERE `status`=6 and del_flag=0 GROUP BY operator_id) cc2 on xo.operator_id = cc2.operator_id
|
||||
left join xhpc_tenant xt on xo.tenant_id=xt.tenant_id
|
||||
LEFT JOIN (
|
||||
select
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'unClearingAmount',
|
||||
ct.operator_id as 'operatorId'
|
||||
from xhpc_clearing_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
where ho.check_status not in (1,2) and ho.del_flag=0
|
||||
<if test="params.startTime!=null and params.startTime!='' ">
|
||||
and ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!=null and params.endTime!='' ">
|
||||
and ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
GROUP BY ct.operator_id
|
||||
) ho on ho.operatorId = xo.operator_id
|
||||
LEFT JOIN (
|
||||
select
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'cashAmount',
|
||||
ho.operator_id as 'operatorId'
|
||||
from xhpc_clearing_history_order as ho
|
||||
where ho.check_status=2 and ho.del_flag=0 and ho.clearing_checkout_id is null
|
||||
GROUP BY ho.operator_id
|
||||
) cho on cho.operatorId= xo.operator_id
|
||||
where xo.del_flag = 0
|
||||
<select id="getXhpcOperatorParams" resultType="map">
|
||||
SELECT
|
||||
xt.tenant_id AS 'tenantId',
|
||||
xt.tenant_name AS 'tenantName',
|
||||
xo.operator_id AS 'operatorId',
|
||||
xo.name AS 'operatorName'
|
||||
FROM xhpc_operator xo
|
||||
LEFT JOIN xhpc_tenant xt ON xo.tenant_id = xt.tenant_id
|
||||
WHERE xo.del_flag = 0
|
||||
<if test="params.tenantId!=null and params.tenantId!=''">
|
||||
and xo.tenant_id=#{params.tenantId}
|
||||
AND xo.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.operatorId!=null and params.operatorId!='' ">
|
||||
and xo.operator_id=#{params.operatorId}
|
||||
AND xo.operator_id = #{params.operatorId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectCheckoutMapByParams" resultType="map">
|
||||
SELECT
|
||||
xt.tenant_id AS 'tenantId',
|
||||
xt.tenant_name AS 'tenantName',
|
||||
xo.operator_id AS 'operatorId',
|
||||
xo.name AS 'operatorName',
|
||||
IFNULL(ho.unClearingAmount, 0) AS 'unClearingAmount',
|
||||
IFNULL(cho.cashAmount, 0) AS 'cashAmount',
|
||||
IFNULL(cc1.applyAmount, 0) AS 'applyAmount',
|
||||
IFNULL(cc2.cashedAmount, 0) AS 'cashedAmount'
|
||||
FROM xhpc_operator xo
|
||||
LEFT JOIN (
|
||||
SELECT operator_id, SUM(received_amount) AS applyAmount
|
||||
FROM xhpc_clearing_checkout
|
||||
WHERE `status` = 1 AND del_flag = 0
|
||||
GROUP BY operator_id
|
||||
) cc1 ON xo.operator_id = cc1.operator_id
|
||||
LEFT JOIN (
|
||||
SELECT operator_id, SUM(received_amount) AS cashedAmount
|
||||
FROM xhpc_clearing_checkout
|
||||
WHERE `status` = 6 AND del_flag = 0
|
||||
GROUP BY operator_id
|
||||
) cc2 ON xo.operator_id = cc2.operator_id
|
||||
LEFT JOIN xhpc_tenant xt ON xo.tenant_id = xt.tenant_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
IFNULL(SUM(ho.act_power_price + ho.act_service_price), 0) AS unClearingAmount,
|
||||
ct.operator_id AS operatorId
|
||||
FROM xhpc_clearing_history_order ho
|
||||
LEFT JOIN xhpc_charging_station ct ON ct.charging_station_id = ho.charging_station_id
|
||||
WHERE ho.check_status NOT IN (1, 2)
|
||||
AND ho.del_flag = 0
|
||||
<if test="params.startTime!=null and params.startTime!='' ">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!=null and params.endTime!='' ">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
GROUP BY ct.operator_id
|
||||
) ho ON ho.operatorId = xo.operator_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
IFNULL(SUM(ho.act_power_price + ho.act_service_price), 0) AS cashAmount,
|
||||
ho.operator_id AS operatorId
|
||||
FROM xhpc_clearing_history_order ho
|
||||
WHERE ho.check_status = 2
|
||||
AND ho.del_flag = 0
|
||||
AND ho.clearing_checkout_id IS NULL
|
||||
<if test="params.startTime!=null and params.startTime!='' ">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!=null and params.endTime!='' ">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
GROUP BY ho.operator_id
|
||||
) cho ON cho.operatorId = xo.operator_id
|
||||
WHERE xo.del_flag = 0
|
||||
<if test="params.tenantId!=null and params.tenantId!=''">
|
||||
AND xo.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.operatorId!=null and params.operatorId!='' ">
|
||||
AND xo.operator_id = #{params.operatorId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@ -127,6 +161,7 @@
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectOrderMapByCheckoutIds" resultType="com.xhpc.activity.vo.CheckoutBankVo">
|
||||
select
|
||||
'RMB' as 'curreyType',
|
||||
@ -186,12 +221,12 @@
|
||||
handling_fee, bank_fee,
|
||||
received_amount, received_power_amount, received_service_amount, del_flag, `status`, operator_id, tenant_id,
|
||||
create_by, create_time,
|
||||
update_by,update_time, check_by, check_time)
|
||||
update_by,update_time, check_by, check_time,clearing_price)
|
||||
values (#{clearingBankId,jdbcType=BIGINT}, #{applyAmount,jdbcType=DECIMAL}, #{applyPowerAmount}, #{applyServiceAmount},
|
||||
#{handlingFee,jdbcType=DECIMAL}, #{bankFee},
|
||||
#{receivedAmount,jdbcType=DECIMAL}, #{receivedPowerAmount}, #{receivedServiceAmount}, 0, #{status}, #{operatorId}, #{tenantId,jdbcType=VARCHAR},
|
||||
#{createBy,jdbcType=VARCHAR}, sysdate(), #{updateBy,jdbcType=VARCHAR},
|
||||
sysdate(), #{checkBy}, sysdate())
|
||||
sysdate(), #{checkBy}, sysdate(),#{clearingPrice})
|
||||
</insert>
|
||||
|
||||
|
||||
@ -236,4 +271,117 @@
|
||||
set `status` = #{status}
|
||||
where find_in_set(clearing_checkout_id, #{checkoutIds})
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
<select id="selectUnclearingAmount" resultType="java.math.BigDecimal">
|
||||
select
|
||||
ifnull(sum(ho.act_total_price), 0)
|
||||
from xhpc_clearing_history_order as ho
|
||||
where ho.del_flag=0 and ho.check_status=0 and ho.operator_id=#{params.operatorId}
|
||||
<if test="params.startTime!=null and params.startTime!='' ">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!=null and params.endTime!='' ">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectClearingPrice" resultType="map">
|
||||
select
|
||||
ifnull(sum(ho.clearing_price), 0) as clearingPrice,
|
||||
ifnull(sum(ho.act_service_price+ho.act_power_price), 0) as actTotalPrice
|
||||
from xhpc_clearing_history_order as ho
|
||||
where ho.check_status=2 and ho.del_flag=0 and ho.clearing_checkout_id is null and ho.operator_id=#{params.operatorId}
|
||||
<if test="params.startTime!=null and params.startTime!='' ">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!=null and params.endTime!='' ">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectCashedAmountOrCashingAmount" resultType="map">
|
||||
SELECT
|
||||
IFNULL(SUM(CASE WHEN status = 1 THEN received_amount ELSE 0 END), 0) AS cashingAmount,
|
||||
IFNULL(SUM(CASE WHEN status = 6 THEN received_amount ELSE 0 END), 0) AS cashedAmount
|
||||
FROM xhpc_clearing_checkout
|
||||
WHERE del_flag = 0
|
||||
AND operator_id = #{operatorId}
|
||||
AND status IN (1, 6)
|
||||
</select>
|
||||
|
||||
<select id="selectUnclearingAmountBatch" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
ho.operator_id as operatorId,
|
||||
IFNULL(SUM(ho.act_total_price), 0) as unClearingAmount
|
||||
FROM xhpc_clearing_history_order ho
|
||||
WHERE ho.del_flag = 0
|
||||
AND ho.check_status = 0
|
||||
AND ho.operator_id IN
|
||||
<foreach collection="operatorIds" item="operatorId" open="(" separator="," close=")">
|
||||
#{operatorId}
|
||||
</foreach>
|
||||
<if test="params.startTime != null and params.startTime != ''">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
GROUP BY ho.operator_id
|
||||
</select>
|
||||
|
||||
<!-- 2. 批量查询已提现和提现中金额 -->
|
||||
<select id="selectCashedAmountOrCashingAmountBatch" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
operator_id as operatorId,
|
||||
IFNULL(SUM(CASE WHEN status = 1 THEN received_amount ELSE 0 END), 0) AS cashingAmount,
|
||||
IFNULL(SUM(CASE WHEN status = 6 THEN received_amount ELSE 0 END), 0) AS cashedAmount
|
||||
FROM xhpc_clearing_checkout
|
||||
WHERE del_flag = 0
|
||||
AND status IN (1, 6)
|
||||
AND operator_id IN
|
||||
<foreach collection="operatorIds" item="operatorId" open="(" separator="," close=")">
|
||||
#{operatorId}
|
||||
</foreach>
|
||||
GROUP BY operator_id
|
||||
</select>
|
||||
|
||||
<select id="selectCashAmountYuBatch" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
ho.operator_id as operatorId,
|
||||
IFNULL(SUM(ho.act_power_price), 0) as powerAmount,
|
||||
IFNULL(SUM(ho.act_service_price), 0) as serviceAmount
|
||||
FROM xhpc_clearing_history_order ho
|
||||
WHERE ho.check_status = 2
|
||||
AND ho.del_flag = 0
|
||||
AND ho.clearing_type = 0
|
||||
AND ho.clearing_checkout_id IS NULL
|
||||
AND ho.operator_id IN
|
||||
<foreach collection="operatorIds" item="operatorId" open="(" separator="," close=")">
|
||||
#{operatorId}
|
||||
</foreach>
|
||||
GROUP BY ho.operator_id
|
||||
</select>
|
||||
|
||||
<select id="selectClearingPriceBatch" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
ho.operator_id as operatorId,
|
||||
IFNULL(SUM(ho.clearing_price), 0) as clearingPrice,
|
||||
IFNULL(SUM(ho.act_service_price + ho.act_power_price), 0) as actTotalPrice
|
||||
FROM xhpc_clearing_history_order ho
|
||||
WHERE ho.check_status = 2
|
||||
AND ho.del_flag = 0
|
||||
AND ho.clearing_checkout_id IS NULL
|
||||
AND ho.operator_id IN
|
||||
<foreach collection="operatorIds" item="operatorId" open="(" separator="," close=")">
|
||||
#{operatorId}
|
||||
</foreach>
|
||||
<if test="params.startTime != null and params.startTime != ''">
|
||||
AND ho.end_time >= #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND ho.end_time <= #{params.endTime}
|
||||
</if>
|
||||
GROUP BY ho.operator_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<result column="act_price" jdbcType="DECIMAL" property="actPrice"/>
|
||||
<result column="act_power_price" jdbcType="DECIMAL" property="actPowerPrice"/>
|
||||
<result column="act_service_price" jdbcType="DECIMAL" property="actServicePrice"/>
|
||||
<result column="act_total_price" jdbcType="DECIMAL" property="actTotalPrice"/>
|
||||
<result column="internet_commission" jdbcType="DECIMAL" property="internetCommission"/>
|
||||
<result column="internet_svc_commission" jdbcType="DECIMAL" property="internetSvcCommission"/>
|
||||
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission"/>
|
||||
@ -65,6 +66,8 @@
|
||||
<result column="check_status" jdbcType="INTEGER" property="checkStatus"/>
|
||||
<result column="check_time" jdbcType="TIMESTAMP" property="checkTime"/>
|
||||
<result column="check_by" jdbcType="VARCHAR" property="checkBy"/>
|
||||
<result column="clearing_type" jdbcType="VARCHAR" property="clearingType"/>
|
||||
<result column="clearing_price" jdbcType="VARCHAR" property="clearingPrice"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
ho.clearing_order_id, ho.charging_station_id, ho.charge_order_id, ho.user_id, ho.terminal_id, ho.serial_number,
|
||||
@ -88,9 +91,12 @@
|
||||
ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs,
|
||||
ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs,
|
||||
ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id,
|
||||
ho.charging_mode,
|
||||
ho.charging_mode,ho.clearing_type,
|
||||
ifnull(ho.internet_degree_commission, 0) as 'internet_degree_commission',
|
||||
ho.`source`, ho.tenant_id, ho.operator_id, ho.operator_name,
|
||||
ifnull(ho.clearing_price, 0) as 'clearing_price',
|
||||
ifnull(ho.act_total_price, 0) as 'act_total_price',
|
||||
ifnull(ho.act_total_price-ho.clearing_price, 0) as 'actClearingPrice',
|
||||
ho.clearing_checkout_id, ho.check_status, ho.check_by, ho.check_time,
|
||||
ifnull(ho.activity_power_price_total, 0) as 'activity_power_price_total',
|
||||
ifnull(ho.activity_service_price_total, 0) as 'activity_service_price_total',
|
||||
@ -115,7 +121,9 @@
|
||||
|
||||
<select id="selectCashAmount" resultType="map">
|
||||
select
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as amount,
|
||||
ifnull(sum(ho.act_total_price-ho.clearing_price), 0) as amount,
|
||||
ifnull(sum(ho.clearing_price), 0) as clearingPrice,
|
||||
ifnull(sum(ho.act_total_price), 0) as actTotalPrice,
|
||||
ifnull(sum(ho.act_service_price), 0) as serviceAmount,
|
||||
ifnull(sum(ho.act_power_price), 0) as powerAmount,
|
||||
group_concat(clearing_order_id) as clearingOrderIds
|
||||
@ -124,6 +132,16 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectCashAmountYu" resultType="map">
|
||||
select
|
||||
ifnull(sum(ho.clearing_price), 0) as clearingPrice,
|
||||
ifnull(sum(ho.act_total_price), 0) as actTotalPrice,
|
||||
ifnull(sum(ho.act_service_price), 0) as serviceAmount,
|
||||
ifnull(sum(ho.act_power_price), 0) as powerAmount
|
||||
from xhpc_clearing_history_order as ho
|
||||
where ho.check_status=2 and ho.del_flag=0 and clearing_type=0 and ho.clearing_checkout_id is null and ho.operator_id=#{operatorId}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderListByOperator"
|
||||
resultType="com.xhpc.activity.domain.XhpcClearingHistoryOrderDomain">
|
||||
select
|
||||
@ -137,7 +155,9 @@
|
||||
select
|
||||
ho.serial_number as 'serialNumber',
|
||||
ct.name as 'stationName',
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'totalPrice',
|
||||
ifnull(sum(ho.act_total_price), 0) as 'totalPrice',
|
||||
ifnull(sum(ho.clearing_price), 0) as 'clearingPrice',
|
||||
ifnull(sum(ho.act_total_price-ho.clearing_price), 0) as 'actClearingPrice',
|
||||
ho.start_time as 'startTime',
|
||||
ho.end_time as 'endTime',
|
||||
ho.phone as phone,
|
||||
@ -151,7 +171,8 @@
|
||||
case when ho.source=0 then 'C端用户'
|
||||
when ho.source=1 then '流量方用户'
|
||||
when ho.source=2 then '社区用户'
|
||||
else 'B端客户'
|
||||
when ho.source=3 then 'B端用户'
|
||||
else '车队用户'
|
||||
end as 'sourceName',
|
||||
case when ho.charging_mode="1" then '快电'
|
||||
when ho.charging_mode="2" then '恒大'
|
||||
@ -298,6 +319,81 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getorderExportPage" resultType="com.xhpc.activity.domain.XhpcClearingHistoryOrderDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />,
|
||||
ct.name as 'station_name',
|
||||
op.name as 'operator_name',
|
||||
xt.name as 'terminal_name',
|
||||
case when co.source=0 then "C端用户"
|
||||
when co.source=1 then "流量方用户"
|
||||
when co.source=2 then "社区用户"
|
||||
else "B端客户"
|
||||
end as 'source_name',
|
||||
case when ho.charging_mode="1" then "快电"
|
||||
when ho.charging_mode="2" then "恒大"
|
||||
when ho.charging_mode="3" then "新电途"
|
||||
when ho.charging_mode="4" then "小桔"
|
||||
else "--"
|
||||
end as 'charging_mode_name'
|
||||
from xhpc_clearing_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||
left join xhpc_terminal xt on xt.terminal_id=ho.terminal_id
|
||||
where ho.status =0 and ho.del_flag=0 and ho.check_status=2 and ho.state != 3
|
||||
<if test="params.startTime!=null and params.startTime!=''">
|
||||
and ho.end_time <![CDATA[ >= ]]> #{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime!= null and params.endTime!=''">
|
||||
and ho.end_time <![CDATA[ <= ]]> #{params.endTime}
|
||||
</if>
|
||||
<if test="params.tenantId!=null and params.tenantId !=''">
|
||||
and ct.tenant_id=#{params.tenantId}
|
||||
</if>
|
||||
<if test="params.orderNo!=null and params.orderNo!=''">
|
||||
and ho.serial_number like concat('%', #{params.orderNo}, '%')
|
||||
</if>
|
||||
<if test="params.userType!=null and params.userType!=''">
|
||||
and co.source=#{params.userType}
|
||||
</if>
|
||||
<if test="params.internetName!=null and params.internetName!=''">
|
||||
and ho.charging_mode=#{params.internetName}
|
||||
</if>
|
||||
<if test="params.operatorId!=null and params.operatorId!=''">
|
||||
and ct.operator_id=#{params.operatorId}
|
||||
</if>
|
||||
<if test="params.stationId!=null and params.stationId!=''">
|
||||
and ho.charging_station_id=#{params.stationId}
|
||||
</if>
|
||||
<if test="params.checkoutIds!=null and params.checkoutIds!='' and params.checkoutIds!='-1'">
|
||||
and find_in_set(ho.clearing_checkout_id, #{params.checkoutIds})
|
||||
</if>
|
||||
|
||||
<if test="params.operatorId !=null and params.operatorId !=''">
|
||||
and ho.operator_id =#{params.operatorId}
|
||||
</if>
|
||||
<if test="params.chargingStationId !=null and params.chargingStationId !=''">
|
||||
and ho.charging_station_id =#{params.chargingStationId}
|
||||
</if>
|
||||
<if test="params.chargingPileId !=null and params.chargingPileId !=''">
|
||||
and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{params.chargingPileId} and del_flag =0)
|
||||
</if>
|
||||
<if test="params.terminalId !=null and params.terminalId !=''">
|
||||
and ho.terminal_id#{params.terminalId}
|
||||
</if>
|
||||
<if test="params.type==1">
|
||||
and ho.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.logOperatorId})
|
||||
</if>
|
||||
<if test="params.type==2">
|
||||
and ho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{params.logOperatorId})
|
||||
</if>
|
||||
<if test="params.orderIds != null and params.orderIds!='' and params.orderIds !='-1'">
|
||||
and find_in_set(ho.clearing_order_id, #{params.orderIds})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getClearingOrderIds" resultType="String">
|
||||
select
|
||||
ho.clearing_order_id clearingOrderId
|
||||
@ -400,7 +496,7 @@
|
||||
evcs_order_no, confirm_Result, rate_model_id,
|
||||
charging_mode, internet_degree_commission,
|
||||
`source`, tenant_id, operator_id,
|
||||
operator_name, clearing_checkout_id, check_status)
|
||||
operator_name, clearing_checkout_id, check_status,clearing_type,clearing_price,act_total_price)
|
||||
values
|
||||
<foreach collection="domainList" index="index" item="domain" separator=",">
|
||||
(#{domain.clearingOrderId}, #{domain.chargingStationId}, #{domain.chargeOrderId},
|
||||
@ -439,7 +535,7 @@
|
||||
#{domain.chargingMode}, #{domain.internetDegreeCommission},
|
||||
#{domain.source}, #{domain.tenantId},
|
||||
#{domain.operatorId},
|
||||
#{domain.operatorName}, #{domain.clearingCheckoutId}, #{domain.checkStatus})
|
||||
#{domain.operatorName}, #{domain.clearingCheckoutId}, #{domain.checkStatus}, #{domain.clearingType}, #{domain.clearingPrice}, #{domain.actTotalPrice})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@ -467,7 +563,7 @@
|
||||
evcs_order_no, confirm_Result, rate_model_id,
|
||||
charging_mode, internet_degree_commission,
|
||||
`source`, tenant_id, operator_id,
|
||||
operator_name, clearing_checkout_id, check_status)
|
||||
operator_name, clearing_checkout_id, check_status,clearing_type,clearing_price,act_total_price)
|
||||
values (#{chargingStationId}, #{chargeOrderId}, #{userId},
|
||||
#{terminalId}, #{serialNumber},
|
||||
#{internetSerialNumber},
|
||||
@ -493,7 +589,7 @@
|
||||
#{evcsOrderNo}, #{confirmResult}, #{rateModelId},
|
||||
#{chargingMode}, #{internetDegreeCommission},
|
||||
#{source}, #{tenantId}, #{operatorId},
|
||||
#{operatorName}, #{clearingCheckoutId}, #{checkStatus})
|
||||
#{operatorName}, #{clearingCheckoutId}, #{checkStatus}, #{clearingType}, #{clearingPrice}, #{actTotalPrice})
|
||||
</insert>
|
||||
|
||||
|
||||
@ -598,6 +694,7 @@
|
||||
ho.internet_serial_number as internetSerialNumber,
|
||||
ho.evcs_order_no as evcsOrderNo,
|
||||
ho.total_price as totalPrice,
|
||||
ho.clearing_price as clearingPrice,
|
||||
ho.act_price as actPrice,
|
||||
ho.confirm_Result as confirmResult,
|
||||
co.charging_time as chargingTime,
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
<result column="act_price" jdbcType="DECIMAL" property="actPrice" />
|
||||
<result column="act_power_price" jdbcType="DECIMAL" property="actPowerPrice" />
|
||||
<result column="act_service_price" jdbcType="DECIMAL" property="actServicePrice" />
|
||||
<result column="act_total_price" jdbcType="DECIMAL" property="actTotalPrice" />
|
||||
<result column="internet_commission" jdbcType="DECIMAL" property="internetCommission" />
|
||||
<result column="internet_svc_commission" jdbcType="DECIMAL" property="internetSvcCommission" />
|
||||
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission" />
|
||||
@ -62,6 +63,9 @@
|
||||
<result column="internet_degree_commission" jdbcType="DECIMAL" property="internetDegreeCommission" />
|
||||
<result column="source" jdbcType="INTEGER" property="source" />
|
||||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
|
||||
<result column="clearing_type" jdbcType="VARCHAR" property="clearingType" />
|
||||
<result column="clearing_price" jdbcType="VARCHAR" property="clearingPrice" />
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
ho.history_order_id, ho.charging_station_id, ho.charge_order_id, ho.user_id, ho.terminal_id, ho.serial_number,
|
||||
@ -70,20 +74,20 @@
|
||||
ho.platform_commission, ho.platform_svc_commisssion, ho.operation_commission, ho.operation_svc_commission,
|
||||
ho.start_soc, ho.end_soc, ho.reconciliation_status, ho.sorting_status, ho.`type`, ho.`status`, ho.del_flag,
|
||||
ho.create_time, ho.create_by, ho.update_time, ho.update_by, ho.remark, ho.`state`, ho.vin_normal, ho.search_value,
|
||||
ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs,
|
||||
ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs,ho.act_total_price,
|
||||
ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs,
|
||||
ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id,
|
||||
ho.charging_mode, ho.internet_degree_commission, ho.`source`, ho.tenant_id, ho.activity_power_price_total,
|
||||
ho.activity_service_price_total,ho.phone,ho.activity_total_price
|
||||
ho.activity_service_price_total,ho.phone,ho.activity_total_price,ho.clearing_type,ho.clearing_price
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectUnclearingAmount" resultType="java.math.BigDecimal">
|
||||
select
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0)
|
||||
ifnull(sum(ho.act_power_price + ho.act_service_price), 0)
|
||||
from xhpc_clearing_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
where ho.del_flag=0 and ho.check_status not in (1,2) and ct.operator_id=#{operatorId}
|
||||
</select>
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
<select id="findOrderListByParams" resultType="java.util.Map">
|
||||
SELECT
|
||||
o.work_order_id as 'workOrderId',
|
||||
o.work_order_id as 'orderId',
|
||||
o.title as 'title',
|
||||
o.type as 'typeId',
|
||||
td.name as 'typeName',
|
||||
@ -323,4 +324,4 @@
|
||||
remark=#{remark}
|
||||
where work_order_id = #{workOrderId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -4,14 +4,17 @@ import com.xhpc.card.domain.*;
|
||||
import com.xhpc.card.pojo.TIccardClientUsers;
|
||||
import com.xhpc.card.pojo.TIccardInfo;
|
||||
import com.xhpc.card.service.IXhpcCardService;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -29,7 +32,10 @@ public class XhpcCardController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcCardService xhpcCardService;
|
||||
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
/**
|
||||
* 卡启动前判断
|
||||
*
|
||||
@ -274,4 +280,42 @@ public class XhpcCardController extends BaseController {
|
||||
public R<Object> removeIccardInfo(@PathVariable Integer id) {
|
||||
return xhpcCardService.removeIccardInfo(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//定时任务,温江1-5号, 00 停止充电,下发停止充电 06 启动充电
|
||||
//@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void test1(){
|
||||
|
||||
List<Map<String, Object>> list = xhpcCardService.getSerialNumberList();
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
Map<String, Object> map = list.get(i);
|
||||
if(map.get("serialNumber") !=null){
|
||||
String serialNumberOrderMap = map.get("serialNumber").toString();
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumberOrderMap.substring(0,16));
|
||||
if(cacheMap !=null){
|
||||
if(cacheMap.get("orderkey") !=null){
|
||||
String version ="0C";
|
||||
if(cacheMap.get("version") !=null){
|
||||
version =cacheMap.get("version").toString();
|
||||
}
|
||||
powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//停用
|
||||
xhpcCardService.updateXhpcTerminalAll(1);
|
||||
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 0 6 * * ?")
|
||||
public void test2(){
|
||||
|
||||
//停用
|
||||
xhpcCardService.updateXhpcTerminalAll(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -52,4 +52,8 @@ public interface XhpcCardMapper {
|
||||
*/
|
||||
List<Integer> selectUserIdsByUserType(Integer userType);
|
||||
|
||||
}
|
||||
|
||||
List<Map<String, Object>> getSerialNumberList();
|
||||
|
||||
int updateXhpcTerminalAll(@Param("status")Integer status);
|
||||
}
|
||||
|
||||
@ -206,4 +206,8 @@ public interface IXhpcCardService {
|
||||
|
||||
R removeIccardInfo(Integer id);
|
||||
|
||||
List<Map<String, Object>> getSerialNumberList();
|
||||
|
||||
void updateXhpcTerminalAll(Integer status);
|
||||
|
||||
}
|
||||
|
||||
@ -905,6 +905,16 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getSerialNumberList() {
|
||||
return xhpcCardMapper.getSerialNumberList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateXhpcTerminalAll(Integer status) {
|
||||
xhpcCardMapper.updateXhpcTerminalAll(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于QueryRechargeRecord方法封装DTO数据
|
||||
*
|
||||
|
||||
@ -494,7 +494,7 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
||||
}else if(cacheMap.containsKey("status") &&
|
||||
"故障".equals(cacheMap.get("status").toString())){
|
||||
fault++;
|
||||
}else if("空闲".equals(cacheMap.get("status").toString())){
|
||||
}else if("空闲".equals(cacheMap.get("status").toString()) || "插枪".equals(cacheMap.get("status").toString())){
|
||||
if("是".equals(cacheMap.get("vehicleGunStatus").toString())){
|
||||
insertGun++;
|
||||
}else{
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
ic_card_info_id
|
||||
, t_iccard_info_id, use_status, create_time, user_id, user_account,
|
||||
user_type, user_name, user_id_card, user_age, user_sex, user_phone, user_vehicle,
|
||||
user_type, user_name, user_id_card, user_age, user_sex, user_phone, user_vehicle,
|
||||
del_flag,tenant_id
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
@ -249,4 +249,18 @@
|
||||
WHERE user_type = #{userType}
|
||||
and del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="getSerialNumberList" resultType="map">
|
||||
SELECT
|
||||
serial_number serialNumber
|
||||
FROM
|
||||
xhpc_charge_order
|
||||
WHERE
|
||||
charge_order_id in (SELECT MAX(charge_order_id) FROM xhpc_charge_order WHERE terminal_id in (21,22,23,24,25,26,27,28,29,30))
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateXhpcTerminalAll">
|
||||
update xhpc_terminal set status = #{status}, prompt = '夜间控制功率,桩停用' where terminal_id in (21,22,23,24,25,26,27,28,29,30) and del_flag =0
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
package com.xhpc.charging.station.controller;
|
||||
|
||||
import com.xhpc.charging.station.service.ITimingTerminalDeactivateService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.poi.ExcelUtil;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.domain.TimingTerminalDeactivate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.pagehelper.page.PageMethod.startPage;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2026-05-08 13:50
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/timingTerminalDeactivate")
|
||||
public class TimingTerminalDeactivateController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ITimingTerminalDeactivateService deactivateService;
|
||||
|
||||
/**
|
||||
* 查询桩停用调整列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TimingTerminalDeactivate deactivate) {
|
||||
startPage();
|
||||
List<TimingTerminalDeactivate> list = deactivateService.selectTimingTerminalDeactivateList(deactivate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出桩停用调整列表
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TimingTerminalDeactivate deactivate) throws IOException {
|
||||
List<TimingTerminalDeactivate> list = deactivateService.selectTimingTerminalDeactivateList(deactivate);
|
||||
ExcelUtil<TimingTerminalDeactivate> util = new ExcelUtil<>(TimingTerminalDeactivate.class);
|
||||
util.exportExcel(response, list, "桩停用调整数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取桩停用调整详细信息
|
||||
*/
|
||||
@GetMapping("/details")
|
||||
public AjaxResult details(Long timingTerminalDeactivateId) {
|
||||
return AjaxResult.success(deactivateService.selectTimingTerminalDeactivateById(timingTerminalDeactivateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增桩停用调整
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R add(@RequestBody TimingTerminalDeactivate deactivate) {
|
||||
return deactivateService.insertTimingTerminalDeactivate(deactivate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改桩停用调整
|
||||
*/
|
||||
@PostMapping("/edit")
|
||||
public R edit(@RequestBody TimingTerminalDeactivate deactivate) {
|
||||
return deactivateService.updateTimingTerminalDeactivate(deactivate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除桩停用调整
|
||||
*/
|
||||
@GetMapping("/remove")
|
||||
public AjaxResult remove(Long timingTerminalDeactivateId) {
|
||||
return toAjax(deactivateService.deleteTimingTerminalDeactivateById(timingTerminalDeactivateId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 每分钟执行一次,检查需要开始调整的任务
|
||||
*/
|
||||
@Scheduled(cron = "0 0/3 * * * ? ")
|
||||
public void executeStartAdjustment() {
|
||||
try {
|
||||
//log.info("开始执行桩停用开始调整定时任务");
|
||||
deactivateService.executeStartAdjustment();
|
||||
//log.info("桩停用开始调整定时任务执行完成");
|
||||
} catch (Exception e) {
|
||||
// log.error("桩停用开始调整定时任务执行失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 每分钟执行一次,检查需要结束调整的任务
|
||||
*/
|
||||
@Scheduled(cron = "0 0/3 * * * ? ")
|
||||
public void executeEndAdjustment() {
|
||||
try {
|
||||
//log.info("开始执行桩停用结束调整定时任务");
|
||||
deactivateService.executeEndAdjustment();
|
||||
// log.info("桩停用结束调整定时任务执行完成");
|
||||
} catch (Exception e) {
|
||||
// log.error("桩停用结束调整定时任务执行失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -245,4 +245,9 @@ public class XhpcChargingStationController extends BaseController {
|
||||
return xhpcChargingStationService.getXhpcRateTimeOrder(rateModelId,startTime,endTime,serialNumber);
|
||||
}
|
||||
|
||||
@GetMapping("/getCrossDayXhpcRateTimeOrder")
|
||||
public R getCrossDayXhpcRateTimeOrder(Long rateModelId,String startTime, String endTime,String serialNumber){
|
||||
return xhpcChargingStationService.getCrossDayXhpcRateTimeOrder(rateModelId,startTime,endTime,serialNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,13 +32,15 @@ public class XhpcPlaceholderController extends BaseController {
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HttpServletRequest request, Long chargingStationId,Integer status,Long operatorId,String startTime,String endTime) {
|
||||
public TableDataInfo list(HttpServletRequest request, Long chargingStationId,Integer status,Long operatorId,String startTime,String endTime,Integer type,Integer ykcStatus) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
params.put("status", status);
|
||||
params.put("type", type);
|
||||
params.put("ykcStatus", ykcStatus);
|
||||
params.put("chargingStationId", chargingStationId);
|
||||
params.put("operatorId", operatorId);
|
||||
params.put("startTime", startTime);
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.xhpc.charging.station.mapper;
|
||||
|
||||
import com.xhpc.common.domain.TimingTerminalDeactivate;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2026-05-08 13:43
|
||||
*/
|
||||
public interface TimingTerminalDeactivateMapper {
|
||||
/**
|
||||
* 查询桩停用调整列表(带关联查询)
|
||||
*/
|
||||
public List<TimingTerminalDeactivate> selectDeactivateList(TimingTerminalDeactivate deactivate);
|
||||
|
||||
/**
|
||||
* 批量更新执行状态
|
||||
*/
|
||||
public int batchUpdateType(@Param("list") List<Long> ids, @Param("type") Integer type, @Param("errorReason") String errorReason);
|
||||
|
||||
TimingTerminalDeactivate getTimingTerminalDeactivateById( @Param("id")Long id);
|
||||
|
||||
int addTimingTerminalDeactivate(TimingTerminalDeactivate deactivate);
|
||||
|
||||
int updateTimingTerminalDeactivate(TimingTerminalDeactivate deactivate);
|
||||
|
||||
int deleteTimingTerminalDeactivate(@Param("ids")Long ids);
|
||||
|
||||
List<TimingTerminalDeactivate> getTimingTerminalDeactivateTime(@Param("status")Integer status);
|
||||
|
||||
List<Map<String, Object>> getSerialNumberList(@Param("ids")List<String> ids);
|
||||
|
||||
int updateXhpcTerminalAll(@Param("status")Integer status,@Param("prompt")String prompt,@Param("ids")List<String> ids);
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.domain.TimingTerminalDeactivate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2026-05-08 13:40
|
||||
*/
|
||||
public interface ITimingTerminalDeactivateService {
|
||||
/**
|
||||
* 查询桩停用调整
|
||||
*/
|
||||
public TimingTerminalDeactivate selectTimingTerminalDeactivateById(Long id);
|
||||
|
||||
/**
|
||||
* 查询桩停用调整列表
|
||||
*/
|
||||
public List<TimingTerminalDeactivate> selectTimingTerminalDeactivateList(TimingTerminalDeactivate deactivate);
|
||||
|
||||
/**
|
||||
* 新增桩停用调整
|
||||
*/
|
||||
public R insertTimingTerminalDeactivate(TimingTerminalDeactivate deactivate);
|
||||
|
||||
/**
|
||||
* 修改桩停用调整
|
||||
*/
|
||||
public R updateTimingTerminalDeactivate(TimingTerminalDeactivate deactivate);
|
||||
|
||||
/**
|
||||
* 批量删除桩停用调整
|
||||
*/
|
||||
public int deleteTimingTerminalDeactivateByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除桩停用调整信息
|
||||
*/
|
||||
public int deleteTimingTerminalDeactivateById(Long id);
|
||||
|
||||
/**
|
||||
* 执行定时任务(开始调整)
|
||||
*/
|
||||
public void executeStartAdjustment();
|
||||
|
||||
/**
|
||||
* 执行定时任务(结束调整)
|
||||
*/
|
||||
public void executeEndAdjustment();
|
||||
}
|
||||
@ -262,4 +262,7 @@ public interface IXhpcChargingStationService {
|
||||
|
||||
R getXhpcRateTimeOrder(Long rateModelId,String startTime, String endTime,String serialNumber);
|
||||
|
||||
R getCrossDayXhpcRateTimeOrder(Long rateModelId,String startTime, String endTime,String serialNumber);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,231 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import com.xhpc.charging.station.mapper.TimingTerminalDeactivateMapper;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.domain.TimingTerminalDeactivate;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2026-05-08 13:41
|
||||
*/
|
||||
@Service
|
||||
public class TimingTerminalDeactivateServiceImpl implements ITimingTerminalDeactivateService{
|
||||
|
||||
@Resource
|
||||
private TimingTerminalDeactivateMapper deactivateMapper;
|
||||
@Resource
|
||||
private PowerPileService powerPileService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
@Override
|
||||
public TimingTerminalDeactivate selectTimingTerminalDeactivateById(Long id) {
|
||||
return deactivateMapper.getTimingTerminalDeactivateById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TimingTerminalDeactivate> selectTimingTerminalDeactivateList(TimingTerminalDeactivate deactivate) {
|
||||
return deactivateMapper.selectDeactivateList(deactivate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R insertTimingTerminalDeactivate(TimingTerminalDeactivate deactivate) {
|
||||
// 设置默认值
|
||||
if (deactivate.getStartType() == null) {
|
||||
deactivate.setStartType(0); // 未执行
|
||||
}
|
||||
if (deactivate.getStartStatus() == null) {
|
||||
deactivate.setStartStatus(1); // 默认停止
|
||||
}
|
||||
|
||||
if (deactivate.getReason() == null || "".equals(deactivate.getReason())) {
|
||||
return R.fail(1001, "调整原因不能为空");
|
||||
}
|
||||
if (deactivate.getChargingStationId() == null || "".equals(deactivate.getChargingStationId())) {
|
||||
return R.fail(1001, "场站不能为空");
|
||||
}
|
||||
if (deactivate.getStartTimingTime() == null || "".equals(deactivate.getStartTimingTime())) {
|
||||
return R.fail(1001, "调整开始时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>deactivate.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整开始时间不能小于现在时间");
|
||||
}
|
||||
}
|
||||
|
||||
if (deactivate.getEndTimingTime() == null || "".equals(deactivate.getEndTimingTime())) {
|
||||
return R.fail(1001, "调整结束时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>deactivate.getEndTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于现在时间");
|
||||
}
|
||||
|
||||
if(deactivate.getEndTimingTime().getTime()<deactivate.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于调整开始时间");
|
||||
}
|
||||
}
|
||||
if(deactivate.getPileIds().length()==0){
|
||||
return R.fail(1001, "请选择桩");
|
||||
}
|
||||
deactivateMapper.addTimingTerminalDeactivate(deactivate);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R updateTimingTerminalDeactivate(TimingTerminalDeactivate deactivate) {
|
||||
|
||||
// 设置默认值
|
||||
if (deactivate.getStartType() == null) {
|
||||
deactivate.setStartType(0); // 未执行
|
||||
}
|
||||
if (deactivate.getStartStatus() == null) {
|
||||
deactivate.setStartStatus(1); // 默认停止
|
||||
}
|
||||
|
||||
if (deactivate.getReason() == null || "".equals(deactivate.getReason())) {
|
||||
return R.fail(1001, "调整原因不能为空");
|
||||
}
|
||||
if (deactivate.getChargingStationId() == null || "".equals(deactivate.getChargingStationId())) {
|
||||
return R.fail(1001, "场站不能为空");
|
||||
}
|
||||
if (deactivate.getStartTimingTime() == null || "".equals(deactivate.getStartTimingTime())) {
|
||||
return R.fail(1001, "调整开始时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>deactivate.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整开始时间不能小于现在时间");
|
||||
}
|
||||
}
|
||||
|
||||
if (deactivate.getEndTimingTime() == null || "".equals(deactivate.getEndTimingTime())) {
|
||||
return R.fail(1001, "调整结束时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>deactivate.getEndTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于现在时间");
|
||||
}
|
||||
|
||||
if(deactivate.getEndTimingTime().getTime()<deactivate.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于调整开始时间");
|
||||
}
|
||||
}
|
||||
if(deactivate.getPileIds().length()==0){
|
||||
return R.fail(1001, "请选择桩");
|
||||
}
|
||||
|
||||
deactivateMapper.updateTimingTerminalDeactivate(deactivate);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteTimingTerminalDeactivateByIds(List<Long> ids) {
|
||||
return deactivateMapper.deleteTimingTerminalDeactivate(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteTimingTerminalDeactivateById(Long id) {
|
||||
return deactivateMapper.deleteTimingTerminalDeactivate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void executeStartAdjustment() {
|
||||
// 查询到达开始时间且未执行的记录
|
||||
try{
|
||||
List<TimingTerminalDeactivate> listYu = deactivateMapper.getTimingTerminalDeactivateTime(1);
|
||||
|
||||
for (int j = 0; j <listYu.size() ; j++) {
|
||||
|
||||
TimingTerminalDeactivate timingTerminalDeactivate = listYu.get(j);
|
||||
if(timingTerminalDeactivate.getStartStatus()==1){
|
||||
|
||||
List<Map<String, Object>> list = deactivateMapper.getSerialNumberList(Arrays.asList(timingTerminalDeactivate.getPileIds().split(",")));
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
Map<String, Object> map = list.get(i);
|
||||
if(map.get("serialNumber") !=null){
|
||||
String serialNumberOrderMap = map.get("serialNumber").toString();
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumberOrderMap.substring(0,16));
|
||||
if(cacheMap !=null){
|
||||
if(cacheMap.get("orderkey") !=null){
|
||||
String version ="0C";
|
||||
if(cacheMap.get("version") !=null){
|
||||
version =cacheMap.get("version").toString();
|
||||
}
|
||||
//同一个桩每道指令有500毫秒的保护期
|
||||
Thread.sleep(1500);
|
||||
System.out.println("===========serialNumberOrderMap=============="+serialNumberOrderMap+"====下发停止命令");
|
||||
powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
deactivateMapper.updateXhpcTerminalAll(timingTerminalDeactivate.getStartStatus(),timingTerminalDeactivate.getPrompt(),Arrays.asList(timingTerminalDeactivate.getPileIds().split(",")));
|
||||
|
||||
TimingTerminalDeactivate deactivate=new TimingTerminalDeactivate();
|
||||
deactivate.setTimingTerminalDeactivateId(timingTerminalDeactivate.getTimingTerminalDeactivateId());
|
||||
deactivate.setStartType(1);
|
||||
deactivateMapper.updateTimingTerminalDeactivate(deactivate);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void executeEndAdjustment() {
|
||||
try{
|
||||
// 查询到达结束时间且未执行的记录
|
||||
List<TimingTerminalDeactivate> listYu = deactivateMapper.getTimingTerminalDeactivateTime(2);
|
||||
|
||||
for (int j = 0; j <listYu.size() ; j++) {
|
||||
|
||||
TimingTerminalDeactivate timingTerminalDeactivate = listYu.get(j);
|
||||
if(timingTerminalDeactivate.getEndStatus()==1){
|
||||
List<Map<String, Object>> list = deactivateMapper.getSerialNumberList(Arrays.asList(timingTerminalDeactivate.getPileIds().split(",")));
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
Map<String, Object> map = list.get(i);
|
||||
if(map.get("serialNumber") !=null){
|
||||
String serialNumberOrderMap = map.get("serialNumber").toString();
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumberOrderMap.substring(0,16));
|
||||
if(cacheMap !=null){
|
||||
if(cacheMap.get("orderkey") !=null){
|
||||
String version ="0C";
|
||||
if(cacheMap.get("version") !=null){
|
||||
version =cacheMap.get("version").toString();
|
||||
}
|
||||
//同一个桩每道指令有500毫秒的保护期
|
||||
Thread.sleep(1500);
|
||||
powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
deactivateMapper.updateXhpcTerminalAll(timingTerminalDeactivate.getEndStatus(),timingTerminalDeactivate.getPrompt(),Arrays.asList(timingTerminalDeactivate.getPileIds().split(",")));
|
||||
|
||||
TimingTerminalDeactivate deactivate=new TimingTerminalDeactivate();
|
||||
deactivate.setTimingTerminalDeactivateId(timingTerminalDeactivate.getTimingTerminalDeactivateId());
|
||||
deactivate.setEndType(1);
|
||||
deactivateMapper.updateTimingTerminalDeactivate(deactivate);
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.charging.station.dto.XhpcActivityDiscountDto;
|
||||
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
||||
@ -1036,7 +1037,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
}else{
|
||||
map.put("cause", "--");
|
||||
}
|
||||
}else if("空闲".equals(cacheMap.get("status").toString())){
|
||||
}else if("空闲".equals(cacheMap.get("status").toString()) || "插枪".equals(cacheMap.get("status").toString())){
|
||||
if("是".equals(cacheMap.get("vehicleGunStatus").toString())){
|
||||
map.put("status", 4);
|
||||
continue;
|
||||
@ -1447,7 +1448,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
if(!"".equals(serialNumbers) && serialNumbers !=null){
|
||||
for (String serialNumber:split) {
|
||||
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+serialNumber);
|
||||
if(cacheMap !=null && "空闲".equals(cacheMap.get("status"))){
|
||||
if(cacheMap !=null && ("空闲".equals(cacheMap.get("status"))|| "插枪".equals(cacheMap.get("status").toString()))){
|
||||
number++;
|
||||
}
|
||||
}
|
||||
@ -1476,7 +1477,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
"故障".equals(cacheMap.get("status").toString())){
|
||||
fault++;
|
||||
}else if(cacheMap.containsKey("status") &&
|
||||
"空闲".equals(cacheMap.get("status").toString())){
|
||||
("空闲".equals(cacheMap.get("status").toString())|| "插枪".equals(cacheMap.get("status").toString()))){
|
||||
freeTime++;
|
||||
}else{
|
||||
charge++;
|
||||
@ -1516,7 +1517,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
return 0;
|
||||
}else if("故障".equals(cacheMap.get("status").toString())){
|
||||
return 1;
|
||||
}else if("空闲".equals(cacheMap.get("status").toString())){
|
||||
}else if("空闲".equals(cacheMap.get("status").toString()) || "插枪".equals(cacheMap.get("status").toString())){
|
||||
if("是".equals(cacheMap.get("vehicleGunStatus").toString())){
|
||||
return 4;
|
||||
}else{
|
||||
@ -1659,4 +1660,31 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
redisService.setCacheMap("Yu"+serialNumber,cacheOrder);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getCrossDayXhpcRateTimeOrder(Long rateModelId, String startTime, String endTime,String serialNumber) {
|
||||
|
||||
String start1 = endTime.substring(0,10)+" 00:00:00";
|
||||
String end1 = startTime.substring(0,10)+" 23:59:59";
|
||||
|
||||
DateTime parse1 = DateUtil.parse(startTime, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime parse2 = DateUtil.parse(end1, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
DateTime parse3 = DateUtil.parse(start1, "yyyy-MM-dd HH:mm:ss");
|
||||
DateTime parse4 = DateUtil.parse(endTime, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
List<com.xhpc.common.dto.XhpcRateTimeDto> reatTimeList1 = xhpcChargingStationMapper.getReatTimeList(DateUtil.formatTime(parse1), DateUtil.formatTime(parse2), rateModelId);
|
||||
|
||||
List<com.xhpc.common.dto.XhpcRateTimeDto> reatTimeList2 = xhpcChargingStationMapper.getReatTimeList(DateUtil.formatTime(parse3), DateUtil.formatTime(parse4), rateModelId);
|
||||
List<com.xhpc.common.dto.XhpcRateTimeDto> combinedList = new ArrayList<>();
|
||||
combinedList.addAll(reatTimeList1);
|
||||
combinedList.addAll(reatTimeList2);
|
||||
|
||||
Map<String, Object> cacheOrder =new HashMap<>();
|
||||
cacheOrder.put(serialNumber,combinedList);
|
||||
redisService.setCacheMap("Yu"+serialNumber,cacheOrder);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
||||
import com.xhpc.charging.station.mapper.XhpcTimingChargingModelMapper;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
@ -47,6 +48,8 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
||||
private IXhpcChargingStationService xhpcChargingStationService;
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
@Autowired
|
||||
private XhpcChargingStationMapper xhpcChargingStationMapper;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
|
||||
@ -589,6 +592,16 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
||||
xhpcTimingChargingModelMapper.updateXhpcTimingChargingModel(xhpcTimingChargingModel);
|
||||
//费率发生改变,缓存到redis
|
||||
powerPileService.getNotificationStationFee(chargingStationId);
|
||||
|
||||
//发送校时校价命令
|
||||
Set<String> pileList = xhpcChargingStationMapper.getXchargingPileList(chargingStationId);
|
||||
if(pileList.size()>0){
|
||||
List<String> setlist = new ArrayList<>(pileList);
|
||||
for (int j = 0; j <setlist.size() ; j++) {
|
||||
String s = setlist.get(j);
|
||||
powerPileService.configTimeNRateModel(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -0,0 +1,252 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.charging.station.mapper.TimingTerminalDeactivateMapper">
|
||||
|
||||
<resultMap type="com.xhpc.common.domain.TimingTerminalDeactivate" id="TimingTerminalDeactivateResult">
|
||||
<result property="timingTerminalDeactivateId" column="timing_terminal_deactivate_id"/>
|
||||
<result property="chargingStationId" column="charging_station_id"/>
|
||||
<result property="pileIds" column="pile_ids"/>
|
||||
<result property="startTimingTime" column="start_timing_time"/>
|
||||
<result property="startStatus" column="start_status"/>
|
||||
<result property="startType" column="start_type"/>
|
||||
<result property="endTimingTime" column="end_timing_time"/>
|
||||
<result property="endStatus" column="end_status"/>
|
||||
<result property="endType" column="end_type"/>
|
||||
<result property="prompt" column="prompt"/>
|
||||
<result property="reason" column="reason"/>
|
||||
<result property="errorReason" column="error_reason"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeactivateVo">
|
||||
select d.timing_terminal_deactivate_id, d.charging_station_id, d.pile_ids,
|
||||
d.start_timing_time, d.start_status, d.start_type, d.end_timing_time,
|
||||
d.end_status, d.end_type, d.prompt, d.reason, d.error_reason,
|
||||
d.del_flag, d.create_time, d.create_by, d.update_time, d.update_by,
|
||||
d.remark, d.tenant_id,
|
||||
s.name as chargingStationName
|
||||
from xhpc_timing_terminal_deactivate d
|
||||
left join xhpc_charging_station s on d.charging_station_id = s.charging_station_id
|
||||
</sql>
|
||||
|
||||
<select id="selectDeactivateList" resultMap="TimingTerminalDeactivateResult">
|
||||
<include refid="selectDeactivateVo"/>
|
||||
<where>
|
||||
d.del_flag = 0
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND d.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="operatorId != null">
|
||||
AND s.operator_id = #{operatorId}
|
||||
</if>
|
||||
<if test="chargingStationId != null">
|
||||
AND d.charging_station_id = #{chargingStationId}
|
||||
</if>
|
||||
<if test="startType != null">
|
||||
AND d.start_type = #{startType}
|
||||
</if>
|
||||
<if test="endType != null">
|
||||
AND d.end_type = #{endType}
|
||||
</if>
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<update id="batchUpdateType">
|
||||
update xhpc_timing_terminal_deactivate
|
||||
set start_type = #{type},
|
||||
error_reason = #{errorReason}
|
||||
where timing_terminal_deactivate_id in
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getTimingTerminalDeactivateById" resultMap="TimingTerminalDeactivateResult">
|
||||
<include refid="selectDeactivateVo"/>
|
||||
<where>
|
||||
d.del_flag = 0 and timing_terminal_deactivate_id =#{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="addTimingTerminalDeactivate">
|
||||
insert into xhpc_timing_terminal_deactivate
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != pileIds and '' != pileIds">
|
||||
pile_ids,
|
||||
</if>
|
||||
<if test="null != startTimingTime ">
|
||||
start_timing_time,
|
||||
</if>
|
||||
<if test="null != startStatus ">
|
||||
start_status,
|
||||
</if>
|
||||
<if test="null != startType ">
|
||||
start_type,
|
||||
</if>
|
||||
<if test="null != endTimingTime ">
|
||||
end_timing_time,
|
||||
</if>
|
||||
<if test="null != endStatus ">
|
||||
end_status,
|
||||
</if>
|
||||
<if test="null != endType ">
|
||||
end_type,
|
||||
</if>
|
||||
<if test="null != prompt ">
|
||||
prompt,
|
||||
</if>
|
||||
<if test="null != reason and ''!=reason">
|
||||
reason,
|
||||
</if>
|
||||
<if test="null != errorReason and ''!=errorReason">
|
||||
error_reason,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != pileIds and '' != pileIds">
|
||||
#{pileIds},
|
||||
</if>
|
||||
<if test="null != startTimingTime ">
|
||||
#{startTimingTime},
|
||||
</if>
|
||||
<if test="null != startStatus ">
|
||||
#{startStatus},
|
||||
</if>
|
||||
<if test="null != startType ">
|
||||
#{startType},
|
||||
</if>
|
||||
<if test="null != endTimingTime ">
|
||||
#{endTimingTime},
|
||||
</if>
|
||||
<if test="null != endStatus ">
|
||||
#{endStatus},
|
||||
</if>
|
||||
<if test="null != endType ">
|
||||
#{endType},
|
||||
</if>
|
||||
<if test="null != prompt ">
|
||||
#{prompt},
|
||||
</if>
|
||||
<if test="null != reason and ''!=reason">
|
||||
#{reason},
|
||||
</if>
|
||||
<if test="null != errorReason and ''!=errorReason">
|
||||
#{errorReason},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTimingTerminalDeactivate" parameterType="Integer">
|
||||
update xhpc_timing_terminal_deactivate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="chargingStationId != null">charging_station_id = #{chargingStationId},</if>
|
||||
<if test="pileIds != null and ''!=pileIds">pile_ids = #{pileIds},</if>
|
||||
<if test="startTimingTime != null">start_timing_time = #{startTimingTime},</if>
|
||||
<if test="startStatus != null">start_status = #{startStatus},</if>
|
||||
<if test="startType != null">start_type = #{startType},</if>
|
||||
<if test="endTimingTime != null">end_timing_time = #{endTimingTime},</if>
|
||||
<if test="endStatus != null">end_status = #{endStatus},</if>
|
||||
<if test="endType != null">end_type = #{endType},</if>
|
||||
<if test="prompt != null and ''!=prompt">prompt = #{prompt},</if>
|
||||
<if test="reason != null and ''!=reason">reason = #{reason},</if>
|
||||
<if test="errorReason != null and ''!=errorReason">error_reason = #{errorReason},</if>
|
||||
</trim>
|
||||
where timing_terminal_deactivate_id =#{timingTerminalDeactivateId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTimingTerminalDeactivate">
|
||||
delete from xhpc_timing_terminal_deactivate where timing_terminal_deactivate_id=#{ids}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getTimingTerminalDeactivateTime" resultMap="TimingTerminalDeactivateResult">
|
||||
<include refid="selectDeactivateVo"/>
|
||||
where 1=1
|
||||
<if test="status==1">
|
||||
and start_type=0 and start_timing_time < now()
|
||||
</if>
|
||||
<if test="status==2">
|
||||
and end_type=0 and end_timing_time < now()
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getSerialNumberList" resultType="map">
|
||||
SELECT o.serial_number serialNumber
|
||||
FROM xhpc_charge_order o
|
||||
INNER JOIN xhpc_terminal t ON o.terminal_id = t.terminal_id
|
||||
WHERE o.status = 0
|
||||
AND t.charging_pile_id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateXhpcTerminalAll">
|
||||
update xhpc_terminal set status = #{status}, prompt = #{prompt} where del_flag =0
|
||||
AND charging_pile_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
@ -77,6 +77,7 @@
|
||||
<result property="officialRunTime" column="official_run_time" />
|
||||
<result property="videoMonitor" column="video_monitor" />
|
||||
<result property="barrierGateId" column="barrier_gate_id" />
|
||||
<result property="internalType" column="internal_type" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="XhpcRateTimeResultMap" type="com.xhpc.common.dto.XhpcRateTimeDto">
|
||||
@ -394,6 +395,9 @@
|
||||
<if test="null != barrierGateId ">
|
||||
barrier_gate_id=#{barrierGateId},
|
||||
</if>
|
||||
<if test="null != internalType ">
|
||||
internal_type=#{internalType},
|
||||
</if>
|
||||
</trim>
|
||||
where charging_station_id = #{chargingStationId}
|
||||
</update>
|
||||
@ -472,6 +476,8 @@
|
||||
ct.construction_site as constructionSite,
|
||||
op.name as operatorName,
|
||||
ct.type as type,
|
||||
ct.internal_type as internalType,
|
||||
|
||||
ct.construction_time as constructionTime,
|
||||
ct.charging_method as chargingMethod,
|
||||
ct.open_all_day as openAllDay,
|
||||
@ -960,6 +966,9 @@
|
||||
<if test="null != chargingMethod and '' != chargingMethod">
|
||||
charging_method,
|
||||
</if>
|
||||
<if test="null != internalType">
|
||||
internal_type,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != name and '' != name">
|
||||
@ -1183,6 +1192,9 @@
|
||||
<if test="null != chargingMethod and '' != chargingMethod">
|
||||
#{chargingMethod},
|
||||
</if>
|
||||
<if test="null != internalType">
|
||||
#{internalType},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -1527,7 +1539,24 @@
|
||||
|
||||
<select id="getReatTimeList" resultMap="XhpcRateTimeResultMap">
|
||||
select
|
||||
xrt.*,
|
||||
xrt.rate_time_id,
|
||||
xrt.charging_station_id,
|
||||
xrt.rate_id,
|
||||
xrt.start_time,
|
||||
xrt.end_time,
|
||||
xrt.type,
|
||||
xrt.charging_pile_id,
|
||||
xrt.status,
|
||||
xrt.del_flag,
|
||||
xrt.create_time,
|
||||
xrt.create_by,
|
||||
xrt.update_time,
|
||||
xrt.update_by,
|
||||
xrt.remark,
|
||||
xrt.rate_model_id,
|
||||
xrt.sort,
|
||||
xrt.rate_value,
|
||||
xrt.tenant_id,
|
||||
xr.power_fee as power_fee,
|
||||
xr.service_fee as service_fee
|
||||
from xhpc_rate_time as xrt
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="ykcStatus" column="ykc_status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getXhpcPlaceholderList" resultType="map">
|
||||
@ -28,11 +30,18 @@
|
||||
xp.start_time as startTime,
|
||||
xp.end_time as endTime,
|
||||
xp.status as status,
|
||||
xp.type as type,
|
||||
xp.ykc_status as ykcStatus,
|
||||
xp.free_time as freeTime,
|
||||
xp.max_fee as maxFee,
|
||||
xp.create_time createTime,
|
||||
xcs.name as chargingStationName,
|
||||
xp.charging_station_id as chargingStationId
|
||||
xp.user_type as userType,
|
||||
xp.charging_station_id as chargingStationId,
|
||||
(select group_concat(inu.name separator ',')
|
||||
from xhpc_internet_user inu
|
||||
where find_in_set(inu.internet_user_id, xp.internet_user_id) > 0
|
||||
) as internetUserNames
|
||||
from xhpc_placeholder xp
|
||||
left join xhpc_charging_station xcs on xcs.charging_station_id = xp.charging_station_id
|
||||
where xp.del_flag=0
|
||||
@ -59,6 +68,12 @@
|
||||
<if test="params.status!= null and params.status!=''">
|
||||
and xp.status=#{params.status}
|
||||
</if>
|
||||
<if test="params.type!= null and params.type!=''">
|
||||
and xp.type=#{params.type}
|
||||
</if>
|
||||
<if test="params.ykcStatus!= null and params.ykcStatus!=''">
|
||||
and xp.ykc_status=#{params.ykcStatus}
|
||||
</if>
|
||||
<if test="params.type ==1">
|
||||
and xp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.logOperatorId})
|
||||
</if>
|
||||
@ -74,11 +89,20 @@
|
||||
xp.start_time as startTime,
|
||||
xp.end_time as endTime,
|
||||
xp.status as status,
|
||||
xp.type as type,
|
||||
xp.ykc_status as ykcStatus,
|
||||
xp.free_time as freeTime,
|
||||
xp.max_fee as maxFee,
|
||||
xp.content as content,
|
||||
xcs.name as chargingStationName,
|
||||
xp.charging_station_id as chargingStationId
|
||||
xp.charging_station_id as chargingStationId,
|
||||
xp.internet_user_id as internetUserId,
|
||||
xp.user_type as userType,
|
||||
xp.ykc_status as ykcStatus,
|
||||
(select group_concat(inu.name separator ',')
|
||||
from xhpc_internet_user inu
|
||||
where find_in_set(inu.internet_user_id, xp.internet_user_id) > 0
|
||||
) as internetUserNames
|
||||
from xhpc_placeholder xp
|
||||
left join xhpc_charging_station xcs on xcs.charging_station_id = xp.charging_station_id
|
||||
where xp.del_flag=0 and xp.placeholder_id =#{placeholderId}
|
||||
@ -99,6 +123,7 @@
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null ">end_time = #{endTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="content != null and content !=''">content = #{content},</if>
|
||||
<if test="maxFee != null and maxFee !=''">max_fee = #{maxFee},</if>
|
||||
<if test="freeTime != null and freeTime !=''">free_time = #{freeTime},</if>
|
||||
@ -106,6 +131,9 @@
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="internetUserId != null and internetUserId !=''">internet_user_id = #{internetUserId},</if>
|
||||
<if test="userType != null and userType !=''">user_type = #{userType},</if>
|
||||
<if test="null != ykcStatus "> ykc_status = #{ykcStatus},</if>
|
||||
</trim>
|
||||
where placeholder_id = #{placeholderId}
|
||||
</update>
|
||||
@ -240,6 +268,18 @@
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != internetUserId and '' != internetUserId">
|
||||
internet_user_id,
|
||||
</if>
|
||||
<if test="null != userType and '' != userType">
|
||||
user_type,
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
type,
|
||||
</if>
|
||||
<if test="null != ykcStatus ">
|
||||
ykc_status,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
@ -284,6 +324,18 @@
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != internetUserId and '' != internetUserId">
|
||||
#{internetUserId},
|
||||
</if>
|
||||
<if test="userType != null and userType !=''">
|
||||
#{userType},
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != ykcStatus ">
|
||||
#{ykcStatus},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
@ -36,5 +36,7 @@ public interface ChargingStationService {
|
||||
@GetMapping("/station/getXhpcRateTimeOrder")
|
||||
R getXhpcRateTimeOrder(@RequestParam(value = "rateModelId")Long rateModelId,@RequestParam(value = "startTime") String startTime,@RequestParam(value = "endTime") String endTime,@RequestParam(value = "serialNumber") String serialNumber);
|
||||
|
||||
@GetMapping("/station/getCrossDayXhpcRateTimeOrder")
|
||||
R getCrossDayXhpcRateTimeOrder(@RequestParam(value = "rateModelId")Long rateModelId,@RequestParam(value = "startTime") String startTime,@RequestParam(value = "endTime") String endTime,@RequestParam(value = "serialNumber") String serialNumber);
|
||||
|
||||
}
|
||||
|
||||
@ -51,4 +51,12 @@ public interface UserTypeService {
|
||||
R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId,@RequestParam(value = "chargingStationId")Long chargingStationId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取车队信息
|
||||
*/
|
||||
@GetMapping("/motorcade/getOrderMotorcade")
|
||||
R getOrderMotorcade(@RequestParam(value = "mark")String mark);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -55,6 +55,11 @@ public class ChargingStationServiceFactory implements FallbackFactory<ChargingSt
|
||||
public R getXhpcRateTimeOrder(Long rateModelId, String startTime, String endTime,String serialNumber) {
|
||||
return R.fail(3886,"查询该充电订单时段失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getCrossDayXhpcRateTimeOrder(Long rateModelId, String startTime, String endTime,String serialNumber) {
|
||||
return R.fail(3886,"查询该充电订单时段失败");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,11 @@ public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService>
|
||||
public R getMechanismDiscount(Long userId, Integer userType, String tenantId,Long chargingStationId) {
|
||||
return R.fail("机构信息获取失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getOrderMotorcade(String mark) {
|
||||
return R.fail("车队信息获取失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xhpc.common.data.up;
|
||||
|
||||
/**
|
||||
* 登录认证
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-03-26 15:37
|
||||
*/
|
||||
public class Certification extends BaseData {
|
||||
|
||||
private String pileNo; //桩号
|
||||
private String termType; //桩类型
|
||||
private String gunNum;
|
||||
private String version;
|
||||
private String programVersion;
|
||||
private String linkType;
|
||||
private String sim;
|
||||
private String operator;
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.xhpc.common.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 桩停用调整对象
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2026-05-08 11:10
|
||||
*/
|
||||
@Data
|
||||
public class TimingTerminalDeactivate extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long timingTerminalDeactivateId;
|
||||
|
||||
/** 场站id */
|
||||
private Long chargingStationId;
|
||||
|
||||
/** 场站名称(非数据库字段) */
|
||||
private String chargingStationName;
|
||||
|
||||
/** 桩id集合 */
|
||||
private String pileIds;
|
||||
|
||||
/** 桩名称集合(非数据库字段) */
|
||||
private String pileNames;
|
||||
|
||||
/** 调整开始时间 */
|
||||
private Date startTimingTime;
|
||||
|
||||
/** 开始调整状态(0启用 1停止) */
|
||||
private Integer startStatus;
|
||||
|
||||
/** 开始执行状态(0未执行 1已执行 2执行错误) */
|
||||
private Integer startType;
|
||||
|
||||
/** 调整结束时间 */
|
||||
private Date endTimingTime;
|
||||
|
||||
/** 结束调整状态(0启用 1停止) */
|
||||
private Integer endStatus;
|
||||
|
||||
/** 结束执行状态(0未执行 1已执行 2执行错误) */
|
||||
private Integer endType;
|
||||
|
||||
/** 桩停用提示语 */
|
||||
private String prompt;
|
||||
|
||||
/** 调整原因 */
|
||||
private String reason;
|
||||
|
||||
/** 失败原因 */
|
||||
private String errorReason;
|
||||
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private Long operatorId;
|
||||
}
|
||||
@ -298,6 +298,11 @@ public class XhpcChargingStation extends BaseEntity {
|
||||
*/
|
||||
private String chargingMethod;
|
||||
|
||||
/**
|
||||
* 允许充电方式
|
||||
*/
|
||||
private Integer internalType;
|
||||
|
||||
public Integer getInstalledTotalPower() {
|
||||
return installedTotalPower;
|
||||
}
|
||||
@ -906,4 +911,11 @@ public class XhpcChargingStation extends BaseEntity {
|
||||
this.internetEquipmentOwnerId = internetEquipmentOwnerId;
|
||||
}
|
||||
|
||||
public Integer getInternalType() {
|
||||
return internalType;
|
||||
}
|
||||
|
||||
public void setInternalType(Integer internalType) {
|
||||
this.internalType = internalType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,9 @@ public class XhpcPlaceholder extends BaseEntity {
|
||||
private Long chargingStationId;
|
||||
private String content;
|
||||
private Integer status;
|
||||
private Integer type;
|
||||
private Integer delFlag;
|
||||
|
||||
private String internetUserId;
|
||||
private String userType;
|
||||
private Integer ykcStatus;
|
||||
}
|
||||
|
||||
@ -14,9 +14,13 @@ public class UserTypeUtil {
|
||||
//流量端用户
|
||||
public static final String INTERNET = "L";
|
||||
//社区端用户
|
||||
public static final String COMMUNIT = "ST";
|
||||
public static final String COMMUNIT = "S";
|
||||
//B端大客户
|
||||
public static final String CUSTOMERS = "BE";
|
||||
public static final String CUSTOMERS = "B";
|
||||
//车队客户
|
||||
public static final String MOTORCADE_USER = "D";
|
||||
//车队总负责人
|
||||
public static final String MOTORCADE_PERSON_IN_CHARGE = "Z";
|
||||
//川逸充
|
||||
public static final String CYCUSER = "CYC";
|
||||
//c端用户
|
||||
@ -32,6 +36,11 @@ public class UserTypeUtil {
|
||||
//车队个人
|
||||
public static final Integer MOTORCADE_USER_TYPE = 5;
|
||||
|
||||
//是否参与清分
|
||||
public static final Integer CLEARING_NO = 1;
|
||||
|
||||
|
||||
|
||||
//重新登录
|
||||
public static final Integer LOGIN_TYPE = 1999;
|
||||
|
||||
@ -96,14 +105,14 @@ public class UserTypeUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 系统用户(00 平台管理员 01 运营上 03 子账户 04运维人员)
|
||||
* 系统用户(00 平台管理员 01 运营上 03 子账户 04运维人员 05车队)
|
||||
*/
|
||||
public static final String SYS_USER_TYPE_ZERO = "00";
|
||||
public static final String SYS_USER_TYPE_ONE = "01";
|
||||
public static final String SYS_USER_TYPE_TWO = "02";
|
||||
public static final String SYS_USER_TYPE_THREE = "03";
|
||||
public static final String SYS_USER_TYPE_FOUR = "04";
|
||||
|
||||
public static final String SYS_MOTORCADE_TYPE_FOUR = "05";
|
||||
|
||||
/**
|
||||
* 系统租户管理员(0 是系统超管 1 某个租户超管 2普通用户)
|
||||
|
||||
@ -85,6 +85,8 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal actServicePrice;
|
||||
|
||||
private BigDecimal actTotalPrice;
|
||||
|
||||
/**
|
||||
* 流量方总金额抽成
|
||||
*/
|
||||
@ -119,6 +121,8 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal operationSvcCommission;
|
||||
|
||||
private BigDecimal clearingPrice;
|
||||
|
||||
/**
|
||||
* 开始充电soc
|
||||
*/
|
||||
@ -129,10 +133,11 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
*/
|
||||
private String endSoc;
|
||||
|
||||
private Integer reconciliationStatus;
|
||||
/**
|
||||
* 对账状态(0待确认 1已确认,2待提交,3待审核)
|
||||
*/
|
||||
private Integer reconciliationStatus;
|
||||
private Integer clearingType;
|
||||
|
||||
/**
|
||||
* 清分状态(0待清分 1清分在途,2已提现,3待提交,4待审核)
|
||||
@ -293,6 +298,10 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
*/
|
||||
private Long operatorId;
|
||||
|
||||
private String mark;
|
||||
|
||||
private Long motorcadeId;
|
||||
|
||||
public Integer getConfirmResult() {
|
||||
|
||||
return confirmResult;
|
||||
@ -821,4 +830,44 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
public void setOperatorId(Long operatorId) {
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public String getMark() {
|
||||
return mark;
|
||||
}
|
||||
|
||||
public void setMark(String mark) {
|
||||
this.mark = mark;
|
||||
}
|
||||
|
||||
public Long getMotorcadeId() {
|
||||
return motorcadeId;
|
||||
}
|
||||
|
||||
public void setMotorcadeId(Long motorcadeId) {
|
||||
this.motorcadeId = motorcadeId;
|
||||
}
|
||||
|
||||
public Integer getClearingType() {
|
||||
return clearingType;
|
||||
}
|
||||
|
||||
public void setClearingType(Integer clearingType) {
|
||||
this.clearingType = clearingType;
|
||||
}
|
||||
|
||||
public BigDecimal getClearingPrice() {
|
||||
return clearingPrice;
|
||||
}
|
||||
|
||||
public void setClearingPrice(BigDecimal clearingPrice) {
|
||||
this.clearingPrice = clearingPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getActTotalPrice() {
|
||||
return actTotalPrice;
|
||||
}
|
||||
|
||||
public void setActTotalPrice(BigDecimal actTotalPrice) {
|
||||
this.actTotalPrice = actTotalPrice;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,10 +25,11 @@ public class XhpcPlacreholder extends BaseEntity {
|
||||
private BigDecimal maxFee;
|
||||
private Integer freeTime;
|
||||
private Integer status;
|
||||
private Integer type;
|
||||
private String content;
|
||||
private String tenantId;
|
||||
private Integer delFlag;
|
||||
|
||||
private Integer ykcStatus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -65,9 +65,9 @@ public class AliyunTemplateKeyWord {
|
||||
*/
|
||||
public static final String OPERATOR_ORDER_REFUND ="尊敬的管理员,用户退款订单";
|
||||
//免费
|
||||
public static final String OPERATOR_PLACEHOLDER_ORDER ="尊敬的用户,你的爱车已停止充电";
|
||||
public static final String OPERATOR_PLACEHOLDER_ORDER ="尊敬的用户,你的爱车已停止充电";
|
||||
|
||||
//收费
|
||||
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY ="尊敬的用户你好,你的爱车已停止充电";
|
||||
public static final String OPERATOR_PLACEHOLDER_ORDER_MONEY ="尊敬的用户你好,你的爱车已停止充电";
|
||||
public static final String OPERATOR_CODE= "您的验证码是";
|
||||
}
|
||||
|
||||
@ -39,11 +39,13 @@ public class XhpcSmsController extends BaseController {
|
||||
|
||||
signatureName = "翔桦充电";
|
||||
templateId = "SMS_226786362";
|
||||
|
||||
if(phone !=null || "".equals(phone)){
|
||||
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
String firstChar = phone.substring(0, 1);
|
||||
if(firstChar.matches("[1-9]")){
|
||||
//C端用户
|
||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId,null);
|
||||
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,1)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,1))|| UserTypeUtil.MOTORCADE_USER.equals(phone.substring(0,1))|| UserTypeUtil.MOTORCADE_PERSON_IN_CHARGE.equals(phone.substring(0,1))){
|
||||
R user = userTypeService.getUser(phone, null, null, null,tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
@ -65,7 +67,7 @@ public class XhpcSmsController extends BaseController {
|
||||
@PostMapping(value = "/send")
|
||||
public void send(@RequestBody Map<String, String> paramMap) {
|
||||
|
||||
|
||||
System.out.println("============发送短信=======paramMap==========="+paramMap.toString());
|
||||
String signatureName = null;
|
||||
String templateId = null;
|
||||
|
||||
@ -89,7 +91,6 @@ public class XhpcSmsController extends BaseController {
|
||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||
templateId = AliyunTemplate.CHARGE_MONEY_INSUFFICIENT;
|
||||
} else if (content.contains(AliyunTemplateKeyWord.REFUND_FAIL)) {
|
||||
|
||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||
templateId = AliyunTemplate.REFUND_FAIL;
|
||||
}else if (content.contains(AliyunTemplateKeyWord.CHARGING_MODEL)) {
|
||||
|
||||
@ -156,9 +156,15 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
|
||||
XhpcSms xhpcSms = new XhpcSms();
|
||||
try {
|
||||
System.out.println("============发送短信==================");
|
||||
System.out.println("============phone=================="+phone);
|
||||
System.out.println("============signatureName=================="+signatureName);
|
||||
System.out.println("============templateId=================="+templateId);
|
||||
System.out.println("============paramMap=================="+paramMap.toString());
|
||||
|
||||
String captcha = redisService.getCacheObject(phone+":"+templateId);
|
||||
if (!templateId.equals(captcha)) {
|
||||
System.out.println("============发送短信==================");
|
||||
|
||||
//使用阿里云发送通知短信
|
||||
Map<String, String> neededParam = aliyunSmsNotice(phone, signatureName, templateId, paramMap);
|
||||
System.out.println("============neededParam=================="+neededParam);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user