车牌、地图统计、道闸、推送
This commit is contained in:
parent
92886f6ff8
commit
38dfa13a71
@ -0,0 +1,24 @@
|
|||||||
|
package com.xhpc.evcs.cdjgpc.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "ET_PUSH_CDJG_FAILED_ORDER")
|
||||||
|
public class EtPushCdjgFailedOrder {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String operatorId3rdpty;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.xhpc.evcs.cdjgpc.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||||
|
public class CDCancelOrderResponse {
|
||||||
|
@JsonProperty("Status")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
"EquipmentModel",
|
"EquipmentModel",
|
||||||
"EquipmentProductCode",
|
"EquipmentProductCode",
|
||||||
"TransformerID",
|
"TransformerID",
|
||||||
|
"EquipmentName",
|
||||||
"ProductionDate",
|
"ProductionDate",
|
||||||
"ConstructionTime",
|
"ConstructionTime",
|
||||||
"EquipmentType",
|
"EquipmentType",
|
||||||
@ -71,8 +72,8 @@ public class CDEquipmentInfo {
|
|||||||
/**
|
/**
|
||||||
* 设备名称
|
* 设备名称
|
||||||
*/
|
*/
|
||||||
// @JsonProperty("EquipmentName")
|
@JsonProperty("EquipmentName")
|
||||||
// public String equipmentName;
|
public String equipmentName;
|
||||||
/**
|
/**
|
||||||
* 设备生产日期
|
* 设备生产日期
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -266,14 +266,14 @@ public class CDOrderInfo {
|
|||||||
DecimalFormat df = new DecimalFormat("#.000");
|
DecimalFormat df = new DecimalFormat("#.000");
|
||||||
this.meterValueStart =Double.parseDouble(df.format(v));
|
this.meterValueStart =Double.parseDouble(df.format(v));
|
||||||
}else{
|
}else{
|
||||||
this.meterValueStart = xhpcHistoryOrder.getMeterValueStartEvcs();
|
this.meterValueStart = 0.00;
|
||||||
}
|
}
|
||||||
if(xhpcHistoryOrder.getMeterValueEndEvcs() !=null && xhpcHistoryOrder.getMeterValueEndEvcs()>0){
|
if(xhpcHistoryOrder.getMeterValueEndEvcs() !=null && xhpcHistoryOrder.getMeterValueEndEvcs()>0){
|
||||||
double v = xhpcHistoryOrder.getMeterValueEndEvcs() / 10000;
|
double v = xhpcHistoryOrder.getMeterValueEndEvcs() / 10000;
|
||||||
DecimalFormat df = new DecimalFormat("#.000");
|
DecimalFormat df = new DecimalFormat("#.000");
|
||||||
this.meterValueEnd =Double.parseDouble(df.format(v));
|
this.meterValueEnd =Double.parseDouble(df.format(v));
|
||||||
} else{
|
} else{
|
||||||
this.meterValueEnd = xhpcHistoryOrder.getMeterValueEndEvcs();
|
this.meterValueEnd = 0.00;
|
||||||
}
|
}
|
||||||
final List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList =
|
final List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList =
|
||||||
xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList();
|
xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList();
|
||||||
|
|||||||
@ -189,4 +189,7 @@ public class CDChargeOrderInfo4BonusReq {
|
|||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStartChargeSeq() {
|
||||||
|
return startChargeSeq;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,6 +78,10 @@ public class QueryStopChargeController {
|
|||||||
pileInfo.getCommunicationProtocolVersion() :
|
pileInfo.getCommunicationProtocolVersion() :
|
||||||
"0A";
|
"0A";
|
||||||
//给对应的枪发送停止充电指令
|
//给对应的枪发送停止充电指令
|
||||||
|
System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||||
|
System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||||
|
System.out.println("=================111========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||||
|
|
||||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||||
// 判断停止指令发送是否成功
|
// 判断停止指令发送是否成功
|
||||||
if (r.getCode() != 200) {
|
if (r.getCode() != 200) {
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class CDNotificationChargeOrderInfoController {
|
|||||||
stationInfo.setOperatorId(operatorID);
|
stationInfo.setOperatorId(operatorID);
|
||||||
String data = commonRequest.getData();
|
String data = commonRequest.getData();
|
||||||
ChargeOrderInfo chargeOrderInfo = JSONUtil.readParams(data, ChargeOrderInfo.class);
|
ChargeOrderInfo chargeOrderInfo = JSONUtil.readParams(data, ChargeOrderInfo.class);
|
||||||
chargeOrderInfo.setInfraOperatorId("759588065"); //todo use common request operator id && check NPE
|
chargeOrderInfo.setInfraOperatorId("MA6CC2LK7"); //todo use common request operator id && check NPE
|
||||||
chargeOrderInfo.setBillerOperatorId("MA6DFCTD5");
|
chargeOrderInfo.setBillerOperatorId("MA6DFCTD5");
|
||||||
// log.info(">>notify charge order OID: " + operatorID);
|
// log.info(">>notify charge order OID: " + operatorID);
|
||||||
// chargeOrderInfoRepository.save(chargeOrderInfo);
|
// chargeOrderInfoRepository.save(chargeOrderInfo);
|
||||||
|
|||||||
@ -56,6 +56,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
|||||||
PowerPileService powerPileService;
|
PowerPileService powerPileService;
|
||||||
|
|
||||||
//充电站信息变化推送(我们平台推送成都市平台) --已推送
|
//充电站信息变化推送(我们平台推送成都市平台) --已推送
|
||||||
|
//自己调用接口
|
||||||
@PostMapping("/v10/getNotificationStationInfo")
|
@PostMapping("/v10/getNotificationStationInfo")
|
||||||
public R getNotificationStationInfo(@RequestBody Map<String, Object> map){
|
public R getNotificationStationInfo(@RequestBody Map<String, Object> map){
|
||||||
try{
|
try{
|
||||||
@ -91,6 +92,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
|||||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||||
mapStationInfo.put("StationInfo",cdStationInfo);
|
mapStationInfo.put("StationInfo",cdStationInfo);
|
||||||
String data =JSONUtil.toJSONString(mapStationInfo);
|
String data =JSONUtil.toJSONString(mapStationInfo);
|
||||||
|
System.out.println("=======data========"+data);
|
||||||
commonRequest.setData(data);
|
commonRequest.setData(data);
|
||||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||||
System.out.println("=======result========"+result);
|
System.out.println("=======result========"+result);
|
||||||
@ -195,6 +197,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/v10/getNotificationConnectorChargeStatus")
|
@PostMapping("/v10/getNotificationConnectorChargeStatus")
|
||||||
public void getNotificationConnectorChargeStatus(@RequestBody Map<String, Object> orderMap){
|
public void getNotificationConnectorChargeStatus(@RequestBody Map<String, Object> orderMap){
|
||||||
|
System.out.println("==================设备充电中状态变化推送(我们平台推送成都市平台) ==========================");
|
||||||
//先查订单号 在查实时数据 最后计算金额
|
//先查订单号 在查实时数据 最后计算金额
|
||||||
try {
|
try {
|
||||||
String orderNo = orderMap.get("orderNo").toString();
|
String orderNo = orderMap.get("orderNo").toString();
|
||||||
@ -279,7 +282,7 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
|||||||
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||||
commonRequest.setData(data);
|
commonRequest.setData(data);
|
||||||
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
|
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
|
||||||
System.out.println("=======result========"+result);
|
System.out.println("===设备充电中状态变化推送====result========"+result);
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -486,32 +489,6 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询站点费率(成都市平台调用我们平台)
|
|
||||||
* @param commonRequest
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@PostMapping("/v10/notification_order_settlement_info")
|
|
||||||
public CommonResponse notificationOrderSettlementInfo(@RequestBody CommonRequest<CDNotificationOrderSettlementInfoRequest> commonRequest) throws Exception{
|
|
||||||
CommonResponse resp = new CommonResponse();
|
|
||||||
resp.setRet(EvcsConst.RET_FAIL);
|
|
||||||
CDNotificationOrderSettlementInfoRequest stationFeeRequest = JSONUtil.readParams(commonRequest.getData(), CDNotificationOrderSettlementInfoRequest.class);
|
|
||||||
if (stationFeeRequest == null) {
|
|
||||||
resp.setMsg("Request or token params validation failed");
|
|
||||||
resp.setRet("4002");
|
|
||||||
} else {
|
|
||||||
//查询订单
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电设备运行统计计信息 --已调用
|
* 查询充电设备运行统计计信息 --已调用
|
||||||
* @param commonRequest
|
* @param commonRequest
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,19 +31,19 @@ import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
|||||||
*/
|
*/
|
||||||
public class CDQueryStartChargeController {
|
public class CDQueryStartChargeController {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
AuthSecretTokenRepository authSecretTokenRepository;
|
AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
@Autowired
|
@Resource
|
||||||
private OrderMappingRepository etOrderMappingRepo;
|
private OrderMappingRepository etOrderMappingRepo;
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||||
@Autowired
|
@Resource
|
||||||
private PileOrderService pileOrderService;
|
private PileOrderService pileOrderService;
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -81,6 +81,9 @@ public class CDQueryStopChargeController {
|
|||||||
pileInfo.getCommunicationProtocolVersion() :
|
pileInfo.getCommunicationProtocolVersion() :
|
||||||
"0A";
|
"0A";
|
||||||
//给对应的枪发送停止充电指令
|
//给对应的枪发送停止充电指令
|
||||||
|
System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||||
|
System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||||
|
|
||||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||||
// 判断停止指令发送是否成功
|
// 判断停止指令发送是否成功
|
||||||
if (r.getCode() != 200) {
|
if (r.getCode() != 200) {
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.xhpc.evcs.cdjgpc.jpa;
|
||||||
|
|
||||||
|
import com.xhpc.evcs.cdjgpc.domain.EtPushCdjgFailedOrder;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||||
|
|
||||||
|
public interface EtPushCdjgFailedOrderRepository extends JpaRepository<EtPushCdjgFailedOrder,Long>,
|
||||||
|
QueryByExampleExecutor<EtPushCdjgFailedOrder>, JpaSpecificationExecutor<EtPushCdjgFailedOrder> {
|
||||||
|
}
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
package com.xhpc.evcs.cdjgpc.notification;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.xhpc.common.data.redis.CacheRateModel;
|
||||||
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
|
import com.xhpc.evcs.cdjgpc.dto.CDConnectorChargeStatusInfo;
|
||||||
|
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||||
|
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||||
|
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||||
|
import com.xhpc.evcs.dto.CommonRequest;
|
||||||
|
import com.xhpc.evcs.dto.ConnectorStatusInfoReq;
|
||||||
|
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||||
|
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||||
|
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.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
|
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
|
@Resource
|
||||||
|
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(CDConnectorChargeStatusInfoTask.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备充电中状态变化推送(我们平台推送成都市平台) --已推送
|
||||||
|
* 实时数据没40秒
|
||||||
|
*/
|
||||||
|
@Scheduled(fixedDelay = 1000 * 40)
|
||||||
|
public void run() throws Exception{
|
||||||
|
|
||||||
|
List<Long> longList =new ArrayList<>();
|
||||||
|
|
||||||
|
List<XhpcStationInternetBlacklist> list = xhpcStationInternetBlacklistRepo.findByInternetUserId(6L);
|
||||||
|
for (int i = 0; i <list.size() ; i++) {
|
||||||
|
XhpcStationInternetBlacklist xhpcStationInternetBlacklist = list.get(i);
|
||||||
|
Long chargingStationId = xhpcStationInternetBlacklist.getChargingStationId();
|
||||||
|
longList.add(chargingStationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<String> realtimeOrder = REDIS.keys("cdjgpc:realTime:*");
|
||||||
|
|
||||||
|
for (String okey : realtimeOrder) {
|
||||||
|
try {
|
||||||
|
String orderNo = REDIS.getCacheObject(okey);
|
||||||
|
if(orderNo.equals("00000000000000000000000000000000")){
|
||||||
|
REDIS.deleteObject(okey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String key = "pile:"+orderNo.substring(0,14);
|
||||||
|
Map<String, Object> cachePile = REDIS.getCacheMap(key);
|
||||||
|
String stationId = cachePile.get("stationId").toString();
|
||||||
|
boolean falen =false;
|
||||||
|
if(longList.size()>0){
|
||||||
|
for (int i = 0; i <longList.size() ; i++) {
|
||||||
|
if(stationId.equals(longList.get(i).toString())){
|
||||||
|
REDIS.deleteObject(okey);
|
||||||
|
falen =true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(falen){ continue;}
|
||||||
|
CacheRealtimeData lord = REDIS.getCacheObject("order:"+orderNo+".lord");
|
||||||
|
String formatTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
Map<String, Object> cacheMap =REDIS.getCacheMap("order:"+orderNo+".notification");
|
||||||
|
if(cacheMap==null || cacheMap.get("startTime")==null || "".equals(cacheMap.get("startTime"))){
|
||||||
|
cacheMap.put("lastPushTime", formatTime);
|
||||||
|
}else{
|
||||||
|
cacheMap.put("lastPushTime", cacheMap.get("pushTime"));
|
||||||
|
}
|
||||||
|
cacheMap.put("pushTime", formatTime);
|
||||||
|
CDConnectorChargeStatusInfo cdConnectorChargeStatusInfo = new CDConnectorChargeStatusInfo();
|
||||||
|
Map<String, Object> cacheMapOrder = REDIS.getCacheMap("order:"+orderNo);
|
||||||
|
if(cacheMap.get("startTime")==null ){
|
||||||
|
if(cacheMapOrder !=null && cacheMapOrder.get("startTime")!=null){
|
||||||
|
cdConnectorChargeStatusInfo.setStartTime(cacheMapOrder.get("startTime").toString());
|
||||||
|
cacheMap.put("startTime", cacheMapOrder.get("startTime").toString());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cdConnectorChargeStatusInfo.setStartTime(cacheMap.get("startTime").toString());
|
||||||
|
}
|
||||||
|
if(cacheMapOrder !=null && cacheMapOrder.get("status")!=null){
|
||||||
|
if("已结束".equals(cacheMapOrder.get("status").toString())){
|
||||||
|
cdConnectorChargeStatusInfo.setConnectorStatus(1);
|
||||||
|
cdConnectorChargeStatusInfo.setOrderStatus(4);
|
||||||
|
}else{
|
||||||
|
cdConnectorChargeStatusInfo.setConnectorStatus(3);
|
||||||
|
cdConnectorChargeStatusInfo.setOrderStatus(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
REDIS.setCacheMap("order:"+orderNo+".notification",cacheMap);
|
||||||
|
cdConnectorChargeStatusInfo.setStartChargeSeq(lord.getOrderNo());
|
||||||
|
cdConnectorChargeStatusInfo.setConnectorID(lord.getPileNo()+lord.getGunId());
|
||||||
|
cdConnectorChargeStatusInfo.setCurrentA((double)(lord.getWorkingCurrent()/10));
|
||||||
|
cdConnectorChargeStatusInfo.setVoltageA((double)(lord.getWorkingVoltage()/10));
|
||||||
|
cdConnectorChargeStatusInfo.setSoc((double)lord.getSoc());
|
||||||
|
cdConnectorChargeStatusInfo.setEndTime(formatTime);
|
||||||
|
cdConnectorChargeStatusInfo.setPushTime(formatTime);
|
||||||
|
cdConnectorChargeStatusInfo.setLastPushTime(cacheMap.get("lastPushTime").toString());
|
||||||
|
BigDecimal chargingDegree = new BigDecimal(lord.getChargingDegree()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||||
|
BigDecimal amountCharged = new BigDecimal(lord.getAmountCharged()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||||
|
cdConnectorChargeStatusInfo.setTotalPower(chargingDegree.doubleValue());
|
||||||
|
cdConnectorChargeStatusInfo.setTotalMoney(amountCharged.doubleValue());
|
||||||
|
|
||||||
|
|
||||||
|
cdConnectorChargeStatusInfo.setEquipmentID(orderNo.substring(0,14));
|
||||||
|
cdConnectorChargeStatusInfo.setStationID(stationId);
|
||||||
|
|
||||||
|
String stationSey = "cdjgpc:station:".concat(stationId)+".notification";
|
||||||
|
CDStationInfo cdStationInfo =REDIS.getCacheObject(stationSey);
|
||||||
|
cdConnectorChargeStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||||
|
cdConnectorChargeStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + orderNo);
|
||||||
|
|
||||||
|
if(cacheOrder !=null && cacheOrder.get("rateModelId") !=null){
|
||||||
|
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + cacheOrder.get("rateModelId").toString());
|
||||||
|
if(rateModel.getT1SvcPrice().equals(rateModel.getT2SvcPrice()) && rateModel.getT3SvcPrice().equals(rateModel.getT4SvcPrice()) &&
|
||||||
|
rateModel.getT1SvcPrice().equals(rateModel.getT3SvcPrice())){
|
||||||
|
|
||||||
|
BigDecimal divide = new BigDecimal(rateModel.getT1SvcPrice()).divide(new BigDecimal(100000)).setScale(2, BigDecimal.ROUND_UP);
|
||||||
|
|
||||||
|
BigDecimal bigDecimal = chargingDegree.multiply(divide).setScale(2, BigDecimal.ROUND_UP);
|
||||||
|
cdConnectorChargeStatusInfo.setSeviceMoney(bigDecimal.doubleValue());
|
||||||
|
BigDecimal subtract = amountCharged.subtract(bigDecimal);
|
||||||
|
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||||
|
}else{
|
||||||
|
//暂时不考虑不同服务费 默认为0.2
|
||||||
|
BigDecimal multiply = chargingDegree.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_UP);;
|
||||||
|
cdConnectorChargeStatusInfo.setSeviceMoney(multiply.doubleValue());
|
||||||
|
BigDecimal subtract = amountCharged.subtract(multiply);
|
||||||
|
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||||
|
}
|
||||||
|
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA6CC2LK7", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||||
|
Map<String, Object> map =new HashMap<>();
|
||||||
|
map.put("ConnectorChargeStatusInfo",cdConnectorChargeStatusInfo);
|
||||||
|
String data = JSONUtil.toJSONString(map);
|
||||||
|
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||||
|
commonRequest.setData(data);
|
||||||
|
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
|
if("0".equals(jsonObject.get("Ret").toString())){
|
||||||
|
REDIS.deleteObject(okey);
|
||||||
|
}
|
||||||
|
//System.out.println("===设备充电中状态变化推送====result========"+result);
|
||||||
|
}
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,7 @@ 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.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @author yuyang
|
* @author yuyang
|
||||||
* @date 2023-09-24 19:27
|
* @date 2023-09-24 19:27
|
||||||
*/
|
*/
|
||||||
@ -41,6 +42,7 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
|||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||||
|
|
||||||
|
//现阶段不开放
|
||||||
//@Scheduled(fixedRate = 1000 * 15)
|
//@Scheduled(fixedRate = 1000 * 15)
|
||||||
public void run() throws JsonProcessingException {
|
public void run() throws JsonProcessingException {
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
|||||||
xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1);
|
xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1);
|
||||||
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
||||||
for (AuthSecretToken authSecretToken : authSecretTokenList) {
|
for (AuthSecretToken authSecretToken : authSecretTokenList) {
|
||||||
if(!"765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){
|
if(!"MA6CC2LK7".equals(horder.getInternetSerialNumber().substring(0, 9))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs();
|
String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs();
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package com.xhpc.evcs.cdjgpc.notification;
|
package com.xhpc.evcs.cdjgpc.notification;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||||
|
import com.xhpc.evcs.cdjgpc.domain.EtPushCdjgFailedOrder;
|
||||||
|
import com.xhpc.evcs.cdjgpc.dto.CDCancelOrderResponse;
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDOrderInfo;
|
import com.xhpc.evcs.cdjgpc.dto.CDOrderInfo;
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||||
|
import com.xhpc.evcs.cdjgpc.jpa.EtPushCdjgFailedOrderRepository;
|
||||||
import com.xhpc.evcs.domain.*;
|
import com.xhpc.evcs.domain.*;
|
||||||
import com.xhpc.evcs.dto.CDChargeOrder4BonusInfoRes;
|
|
||||||
import com.xhpc.evcs.dto.CommonRequest;
|
import com.xhpc.evcs.dto.CommonRequest;
|
||||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||||
import com.xhpc.evcs.jpa.*;
|
import com.xhpc.evcs.jpa.*;
|
||||||
@ -21,6 +24,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,7 +43,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private EtPushFailedOrderRepository etPushFailedOrderRepository;
|
private EtPushCdjgFailedOrderRepository etPushCdjgFailedOrderRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -48,36 +52,55 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
|||||||
private OrderMappingRepository orderMappingRepository;
|
private OrderMappingRepository orderMappingRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private XhpcChargingStationRepository chargingStationRepo;
|
private XhpcChargingStationRepository chargingStationRepo;
|
||||||
|
@Autowired
|
||||||
|
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*订单信息推送 ---已推送
|
*订单信息推送 ---已推送--推送服务使用
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
//@Scheduled(fixedDelay = 1000 * 60)
|
@Scheduled(fixedDelay = 1000 * 60)
|
||||||
public void run() throws IOException {
|
public void run() throws IOException {
|
||||||
|
|
||||||
AuthSecretToken authSecretTokenOut =
|
AuthSecretToken authSecretTokenOut =
|
||||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||||
// maybe对接第三方
|
// maybe对接第三方
|
||||||
if (authSecretTokenOut != null) {
|
if (authSecretTokenOut != null) {
|
||||||
|
|
||||||
final List<XhpcHistoryOrder> notYetPushOrder =
|
final List<XhpcHistoryOrder> notYetPushOrder =
|
||||||
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0);
|
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0);
|
||||||
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
|
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
|
||||||
|
|
||||||
|
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||||
|
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(),
|
||||||
|
6L).orElse(null);
|
||||||
|
if (xhpcStationInternetBlacklist != null) continue;
|
||||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||||
|
if(!xhpcHistoryOrder.getStartTime().toString().equals(xhpcHistoryOrder.getEndTime().toString())){
|
||||||
notify(xhpcHistoryOrder, authSecretTokenOut, false);
|
notify(xhpcHistoryOrder, authSecretTokenOut, false);
|
||||||
|
}else{
|
||||||
|
//充电时长不能小于或等于0 不能推送
|
||||||
|
logger.info("========新平台推送=======responseBody===================充电时长不能小于或等于0==========");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
final List<XhpcHistoryOrder> pushFailedOrders =
|
final List<XhpcHistoryOrder> pushFailedOrders =
|
||||||
xhpcHistoryOrderRepository.findTop10JoinPushFailedOrders(authSecretTokenOut.getOperatorId3irdpty());
|
xhpcHistoryOrderRepository.findTop10JoinPushFailedOrders(authSecretTokenOut.getOperatorId3irdpty());
|
||||||
for (XhpcHistoryOrder xhpcHistoryOrder : pushFailedOrders) {
|
for (XhpcHistoryOrder xhpcHistoryOrder : pushFailedOrders) {
|
||||||
|
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||||
|
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(),
|
||||||
|
6L).orElse(null);
|
||||||
|
if (xhpcStationInternetBlacklist != null) continue;
|
||||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||||
final boolean notify = notify(xhpcHistoryOrder, authSecretTokenOut, true);
|
final boolean notify = notify(xhpcHistoryOrder, authSecretTokenOut, true);
|
||||||
if (notify) {
|
if (notify) {
|
||||||
etPushFailedOrderRepository.deleteById(xhpcHistoryOrder.getHistoryOrderId());
|
etPushCdjgFailedOrderRepository.deleteById(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,20 +144,23 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
|||||||
CommonRequest<CDOrderInfo> commonRequest = new CommonRequest<>();
|
CommonRequest<CDOrderInfo> commonRequest = new CommonRequest<>();
|
||||||
commonRequest.setData(data);
|
commonRequest.setData(data);
|
||||||
String responseBody = ok(commonRequest, "/notification_orderInfo", authSecretTokenOut);
|
String responseBody = ok(commonRequest, "/notification_orderInfo", authSecretTokenOut);
|
||||||
CDChargeOrder4BonusInfoRes cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody,
|
logger.info("========新平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq());
|
||||||
CDChargeOrder4BonusInfoRes.class, authSecretTokenOut);
|
|
||||||
|
CDCancelOrderResponse cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||||
|
CDCancelOrderResponse.class, authSecretTokenOut);
|
||||||
if (!isRepush) {
|
if (!isRepush) {
|
||||||
authSecretTokenOut.setLastPushOrder(xhpcHistoryOrder.getHistoryOrderId());
|
authSecretTokenOut.setLastPushOrder(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
authSecretTokenRepository.save(authSecretTokenOut);
|
authSecretTokenRepository.save(authSecretTokenOut);
|
||||||
}
|
}
|
||||||
if (cdChargeOrder4BonusInfoRes != null && cdChargeOrder4BonusInfoRes.getConfirmResult() == 0) {
|
if (cdChargeOrder4BonusInfoRes != null && cdChargeOrder4BonusInfoRes.getStatus() == 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (!isRepush) {
|
if (!isRepush) {
|
||||||
EtPushFailedOrder etPushFailedOrder = new EtPushFailedOrder();
|
EtPushCdjgFailedOrder etPushFailedOrder = new EtPushCdjgFailedOrder();
|
||||||
etPushFailedOrder.setId(xhpcHistoryOrder.getHistoryOrderId());
|
etPushFailedOrder.setId(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
etPushFailedOrder.setOperatorId3rdpty(authSecretTokenOut.getOperatorId3irdpty());
|
etPushFailedOrder.setOperatorId3rdpty(authSecretTokenOut.getOperatorId3irdpty());
|
||||||
etPushFailedOrderRepository.save(etPushFailedOrder);
|
etPushFailedOrder.setCreateTime(new Date());
|
||||||
|
etPushCdjgFailedOrderRepository.save(etPushFailedOrder);
|
||||||
}
|
}
|
||||||
logger.error(String.format("push CD notification order[%s] failed: %s", xhpcHistoryOrder.getSerialNumber(),
|
logger.error(String.format("push CD notification order[%s] failed: %s", xhpcHistoryOrder.getSerialNumber(),
|
||||||
responseBody));
|
responseBody));
|
||||||
|
|||||||
@ -0,0 +1,57 @@
|
|||||||
|
package com.xhpc.evcs.cdjgpc.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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class CDNotificationStationFeeTask extends CoreDispatcher {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationFeeTask.class);
|
||||||
|
|
||||||
|
//--推送服务使用
|
||||||
|
@Scheduled(fixedDelay = 1000 * 60)
|
||||||
|
public void run() throws IOException {
|
||||||
|
|
||||||
|
AuthSecretToken authSecretTokenOut =
|
||||||
|
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||||
|
"MA6CC2LK7", "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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,22 +1,15 @@
|
|||||||
package com.xhpc.evcs.cdjgpc.notification;
|
package com.xhpc.evcs.cdjgpc.notification;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||||
import com.xhpc.common.core.domain.R;
|
|
||||||
import com.xhpc.common.core.utils.HttpUtils;
|
|
||||||
import com.xhpc.common.domain.XhpcTerminal;
|
import com.xhpc.common.domain.XhpcTerminal;
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfo;
|
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfo;
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfoReq;
|
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfoReq;
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDStationFee;
|
|
||||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||||
import com.xhpc.evcs.dto.CommonRequest;
|
import com.xhpc.evcs.dto.CommonRequest;
|
||||||
import com.xhpc.evcs.dto.ConnectorStatusInfo;
|
import com.xhpc.evcs.dto.ConnectorStatusInfo;
|
||||||
import com.xhpc.evcs.dto.ConnectorStatusInfoReq;
|
|
||||||
import com.xhpc.evcs.dto.PageRequest;
|
|
||||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||||
@ -36,7 +29,6 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_IN;
|
|
||||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
||||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
||||||
@ -57,8 +49,8 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
|||||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||||
@Resource
|
@Resource
|
||||||
private XhpcTerminalRepository terminalRepository;
|
private XhpcTerminalRepository terminalRepository;
|
||||||
|
//--推送服务使用
|
||||||
//@Scheduled(fixedRate = 1000 * 45)
|
@Scheduled(fixedRate = 1000 * 45)
|
||||||
protected void run() throws IOException {
|
protected void run() throws IOException {
|
||||||
|
|
||||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||||
@ -132,7 +124,10 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
|||||||
|
|
||||||
CDConnectorStatusInfoReq connectorStatusInfoReq = new CDConnectorStatusInfoReq();
|
CDConnectorStatusInfoReq connectorStatusInfoReq = new CDConnectorStatusInfoReq();
|
||||||
|
|
||||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus","cdjgpc:station")+".notification");
|
System.out.println("=========stationTerminalKey=========="+stationTerminalKey);
|
||||||
|
String key =stationTerminalKey.replace("stationTerminalStatus","cdjgpc:station")+".notification";
|
||||||
|
System.out.println("=========key=========="+key);
|
||||||
|
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||||
CDConnectorStatusInfo cdConnectorStatusInfo =new CDConnectorStatusInfo();
|
CDConnectorStatusInfo cdConnectorStatusInfo =new CDConnectorStatusInfo();
|
||||||
cdConnectorStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
cdConnectorStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||||
cdConnectorStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
cdConnectorStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||||
@ -148,7 +143,7 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
|||||||
commonRequest.setData(data);
|
commonRequest.setData(data);
|
||||||
String result = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
String result = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
||||||
|
|
||||||
System.out.println("=======result========"+result);
|
System.out.println("===设备状态变化推送====result========"+result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@ public class EvcsFilter extends OncePerRequestFilter {
|
|||||||
if (!ObjectUtils.isEmpty(bodyString)) {
|
if (!ObjectUtils.isEmpty(bodyString)) {
|
||||||
String servletPath = request.getServletPath();
|
String servletPath = request.getServletPath();
|
||||||
log.debug("servletPath: " + servletPath);
|
log.debug("servletPath: " + servletPath);
|
||||||
|
log.info("=================servletPath=========================="+servletPath);
|
||||||
CommonRequest commonRequest = JSONUtil.readParams(bodyString, CommonRequest.class);
|
CommonRequest commonRequest = JSONUtil.readParams(bodyString, CommonRequest.class);
|
||||||
resp.setRet(EvcsConst.RET_FAIL);
|
resp.setRet(EvcsConst.RET_FAIL);
|
||||||
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
||||||
@ -88,11 +89,22 @@ public class EvcsFilter extends OncePerRequestFilter {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
String operatorId = commonRequest.getOperatorId();
|
String operatorId = commonRequest.getOperatorId();
|
||||||
|
|
||||||
|
log.info("=================operatorId=========================="+operatorId);
|
||||||
|
|
||||||
String authorization = request.getHeader("Authorization");
|
String authorization = request.getHeader("Authorization");
|
||||||
log.debug("Authorization: {}", authorization);
|
log.debug("Authorization: {}", authorization);
|
||||||
AuthSecretToken authSecretTokenIn = null;
|
AuthSecretToken authSecretTokenIn = null;
|
||||||
Date now = Calendar.getInstance().getTime();
|
Date now = Calendar.getInstance().getTime();
|
||||||
if (servletPath.endsWith("query_token")) {
|
|
||||||
|
if (servletPath.endsWith("/v1/query_token")) {
|
||||||
|
log.info("================老接口过滤 token========operatorId=========="+operatorId);
|
||||||
|
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||||
|
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||||
|
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||||
|
responseWrapper, authSecretTokenIn);
|
||||||
|
}else if (servletPath.endsWith("/v10/query_token")) {
|
||||||
|
log.info("================新接口过滤 token========operatorId=========="+operatorId);
|
||||||
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||||
|
|||||||
@ -20,7 +20,6 @@ public interface AuthSecretTokenRepository extends JpaRepository<AuthSecretToken
|
|||||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(String operatorId,
|
Optional<AuthSecretToken> findByOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(String operatorId,
|
||||||
String secretTokenType,
|
String secretTokenType,
|
||||||
Date time);
|
Date time);
|
||||||
|
|
||||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(String operatorId3irdpty,
|
Optional<AuthSecretToken> findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(String operatorId3irdpty,
|
||||||
String operatorID,
|
String operatorID,
|
||||||
String secretTokenTypeIn);
|
String secretTokenTypeIn);
|
||||||
|
|||||||
@ -134,7 +134,7 @@ public class CoreDispatcher {
|
|||||||
assert body != null;
|
assert body != null;
|
||||||
// if (body==null) request = req.get().build();
|
// if (body==null) request = req.get().build();
|
||||||
// else
|
// else
|
||||||
logger.info("==============body================="+body.toString());
|
// logger.info("==============body================="+body.toString());
|
||||||
request = req.post(body).build();
|
request = req.post(body).build();
|
||||||
OkHttpClient client = builder.build();
|
OkHttpClient client = builder.build();
|
||||||
return fwdToInfra(request, client);
|
return fwdToInfra(request, client);
|
||||||
@ -254,7 +254,7 @@ public class CoreDispatcher {
|
|||||||
assert body != null;
|
assert body != null;
|
||||||
// if (body==null) request = req.get().build();
|
// if (body==null) request = req.get().build();
|
||||||
// else
|
// else
|
||||||
logger.info("==============body================="+body.toString());
|
// logger.info("==============body================="+body.toString());
|
||||||
request = req.post(body).build();
|
request = req.post(body).build();
|
||||||
OkHttpClient client = builder.build();
|
OkHttpClient client = builder.build();
|
||||||
return fwdToInfra(request, client);
|
return fwdToInfra(request, client);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.xhpc.evcs.dto.DTOJsonHelper;
|
|||||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||||
import com.xhpc.evcs.utils.JSONUtil;
|
import com.xhpc.evcs.utils.JSONUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -29,7 +30,8 @@ public class NotificationCancelOrderTask extends CoreDispatcher {
|
|||||||
|
|
||||||
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||||
|
|
||||||
// @Scheduled(fixedRate = 1000 * 15)
|
//推送不开放
|
||||||
|
//@Scheduled(fixedRate = 1000 * 15)
|
||||||
public void run() throws JsonProcessingException {
|
public void run() throws JsonProcessingException {
|
||||||
|
|
||||||
//Getting the orders, which need to be notified.
|
//Getting the orders, which need to be notified.
|
||||||
|
|||||||
@ -38,22 +38,30 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
|||||||
private OrderMappingRepository orderMappingRepository;
|
private OrderMappingRepository orderMappingRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private XhpcChargingStationRepository chargingStationRepo;
|
private XhpcChargingStationRepository chargingStationRepo;
|
||||||
|
@Autowired
|
||||||
|
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送充电订单信息(运营奖补)
|
* 推送充电订单信息(运营奖补)(测试环境开)
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
//@Scheduled(fixedDelay = 1000 * 60)
|
@Scheduled(fixedDelay = 1000 * 60)
|
||||||
public void run() throws IOException {
|
public void run() throws IOException {
|
||||||
|
|
||||||
AuthSecretToken authSecretTokenOut =
|
AuthSecretToken authSecretTokenOut =
|
||||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||||
"765367656", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
"765367656", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||||
|
|
||||||
// maybe对接第三方
|
// maybe对接第三方
|
||||||
if (authSecretTokenOut != null) {
|
if (authSecretTokenOut != null) {
|
||||||
final List<XhpcHistoryOrder> notYetPushOrder =
|
final List<XhpcHistoryOrder> notYetPushOrder =
|
||||||
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0);
|
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0);
|
||||||
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
|
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
|
||||||
|
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||||
|
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(),
|
||||||
|
5L).orElse(null);
|
||||||
|
if (xhpcStationInternetBlacklist != null) continue;
|
||||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||||
@ -62,6 +70,10 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
|||||||
final List<XhpcHistoryOrder> pushFailedOrders =
|
final List<XhpcHistoryOrder> pushFailedOrders =
|
||||||
xhpcHistoryOrderRepository.findTop10JoinPushFailedOrders(authSecretTokenOut.getOperatorId3irdpty());
|
xhpcHistoryOrderRepository.findTop10JoinPushFailedOrders(authSecretTokenOut.getOperatorId3irdpty());
|
||||||
for (XhpcHistoryOrder xhpcHistoryOrder : pushFailedOrders) {
|
for (XhpcHistoryOrder xhpcHistoryOrder : pushFailedOrders) {
|
||||||
|
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||||
|
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(xhpcHistoryOrder.getChargingStationId(),
|
||||||
|
5L).orElse(null);
|
||||||
|
if (xhpcStationInternetBlacklist != null) continue;
|
||||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||||
@ -103,6 +115,9 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
|||||||
commonRequest.setData(data);
|
commonRequest.setData(data);
|
||||||
String responseBody = ok(commonRequest, "/notification_charge_order_info_for_bonus", authSecretTokenOut,
|
String responseBody = ok(commonRequest, "/notification_charge_order_info_for_bonus", authSecretTokenOut,
|
||||||
operatorIdEvcs);
|
operatorIdEvcs);
|
||||||
|
logger.info("========老平台推送=======operatorIdEvcs============================="+operatorIdEvcs);
|
||||||
|
logger.info("========老平台推送=======responseBody============================="+cdChargeOrderInfo4BonusReq.getStartChargeSeq());
|
||||||
|
|
||||||
CDChargeOrder4BonusInfoRes cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody,
|
CDChargeOrder4BonusInfoRes cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||||
CDChargeOrder4BonusInfoRes.class, authSecretTokenOut);
|
CDChargeOrder4BonusInfoRes.class, authSecretTokenOut);
|
||||||
if (!isRepush) {
|
if (!isRepush) {
|
||||||
|
|||||||
@ -38,8 +38,8 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
|||||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||||
|
//推送不开放
|
||||||
//111@Scheduled(fixedRate = 1000 * 15)
|
//@Scheduled(fixedRate = 1000 * 15)
|
||||||
public void run() throws JsonProcessingException {
|
public void run() throws JsonProcessingException {
|
||||||
|
|
||||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||||
|
|||||||
@ -48,7 +48,8 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
|||||||
* 推送充电状态
|
* 推送充电状态
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
//111@Scheduled(fixedRate = 1000 * 50)
|
//推送不开放
|
||||||
|
//@Scheduled(fixedRate = 1000 * 50)
|
||||||
public void run() throws IOException {
|
public void run() throws IOException {
|
||||||
|
|
||||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||||
|
|||||||
@ -33,7 +33,8 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
|||||||
/**
|
/**
|
||||||
* Judging the 3rd whether it has got the start charging task.
|
* Judging the 3rd whether it has got the start charging task.
|
||||||
*/
|
*/
|
||||||
//111@Scheduled(fixedRate = 1000 * 3)
|
//推送不开放
|
||||||
|
//@Scheduled(fixedRate = 1000 * 3)
|
||||||
public void run() throws IOException {
|
public void run() throws IOException {
|
||||||
|
|
||||||
//Getting the charge orders which from 3rd.
|
//Getting the charge orders which from 3rd.
|
||||||
|
|||||||
@ -49,7 +49,8 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
|||||||
@Resource
|
@Resource
|
||||||
private XhpcTerminalRepository terminalRepository;
|
private XhpcTerminalRepository terminalRepository;
|
||||||
|
|
||||||
//111@Scheduled(fixedRate = 1000 * 45)
|
//推送不开放
|
||||||
|
//@Scheduled(fixedRate = 1000 * 45)
|
||||||
protected void run() throws IOException {
|
protected void run() throws IOException {
|
||||||
|
|
||||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||||
|
|
||||||
//111@Scheduled(fixedRate = 1000 * 3)
|
//@Scheduled(fixedRate = 1000 * 3)
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
|
|
||||||
notifyService();
|
notifyService();
|
||||||
|
|||||||
@ -4,30 +4,25 @@ package com.xhpc.auth.controller;
|
|||||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||||
import com.xhpc.auth.form.LoginBody;
|
import com.xhpc.auth.form.LoginBody;
|
||||||
import com.xhpc.auth.service.SysLoginService;
|
import com.xhpc.auth.service.SysLoginService;
|
||||||
import com.xhpc.common.api.SmsService;
|
|
||||||
import com.xhpc.common.api.TenantService;
|
import com.xhpc.common.api.TenantService;
|
||||||
import com.xhpc.common.core.constant.Constants;
|
import com.xhpc.common.core.constant.Constants;
|
||||||
import com.xhpc.common.core.constant.HttpStatus;
|
import com.xhpc.common.core.constant.HttpStatus;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.exception.BaseException;
|
import com.xhpc.common.core.exception.BaseException;
|
||||||
import com.xhpc.common.core.exception.CaptchaException;
|
|
||||||
import com.xhpc.common.core.utils.StringUtils;
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.common.security.service.TokenService;
|
import com.xhpc.common.security.service.TokenService;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import lombok.extern.java.Log;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import com.aliyun.tea.*;
|
|
||||||
/**
|
/**
|
||||||
* token 控制
|
* token 控制
|
||||||
*
|
*
|
||||||
@ -63,15 +58,15 @@ public class TokenController extends BaseController
|
|||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public R<?> login(@RequestBody LoginBody form)
|
public R<?> login(@RequestBody LoginBody form)
|
||||||
{
|
{
|
||||||
String tenantId = form.getTenantId();
|
String tenantId = "000000";
|
||||||
if(tenantId==null || "".equals(tenantId)){
|
if(tenantId==null || "".equals(tenantId)){
|
||||||
throw new BaseException("租户ID码必须填写");
|
throw new BaseException("租户ID码必须填写");
|
||||||
}
|
}
|
||||||
//查询租户是否在有效期内
|
//查询租户是否在有效期内
|
||||||
R r = tenantService.gettenantIdTime(form.getTenantId());
|
// R r = tenantService.gettenantIdTime(form.getTenantId());
|
||||||
if(r.getCode() !=200){
|
// if(r.getCode() !=200){
|
||||||
return R.fail("该租户已过期或已停用,请联系管理员");
|
// return R.fail("该租户已过期或已停用,请联系管理员");
|
||||||
}
|
// }
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),0,tenantId);
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(),0,tenantId);
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
|
|||||||
@ -29,8 +29,8 @@ public class XhpcBarrierGateController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(HttpServletRequest request, String barrierGateCompany) {
|
public TableDataInfo list(String barrierGateCompany, String chargingStationNumber) {
|
||||||
List<Map<String, Object>> list = xhpcBarrierGateService.getLsit(barrierGateCompany);
|
List<Map<String, Object>> list = xhpcBarrierGateService.getLsit(barrierGateCompany,chargingStationNumber);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
package com.xhpc.charging.station.mapper;
|
package com.xhpc.charging.station.mapper;
|
||||||
|
|
||||||
import com.xhpc.common.domain.XhpcBarrierGate;
|
import com.xhpc.common.domain.XhpcBarrierGate;
|
||||||
import com.xhpc.common.domain.XhpcEquipmentAccident;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -11,7 +10,7 @@ public interface XhpcBarrierGateMapper {
|
|||||||
|
|
||||||
List<Map<String, Object>> getBarrierGateList();
|
List<Map<String, Object>> getBarrierGateList();
|
||||||
|
|
||||||
List<Map<String,Object>> getLsit(@Param("barrierGateCompany")String barrierGateCompany);
|
List<Map<String,Object>> getLsit(@Param("barrierGateCompany")String barrierGateCompany, @Param("chargingStationNumber")String chargingStationNumber);
|
||||||
|
|
||||||
|
|
||||||
void insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
|
void insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ public interface IXhpcBarrierGateService {
|
|||||||
|
|
||||||
R getBarrierGateList();
|
R getBarrierGateList();
|
||||||
|
|
||||||
List<Map<String, Object>> getLsit(String barrierGateCompany);
|
List<Map<String, Object>> getLsit(String barrierGateCompany,String chargingStationNumber);
|
||||||
|
|
||||||
|
|
||||||
R insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
|
R insertBarrierGate(XhpcBarrierGate xhpcBarrierGate);
|
||||||
|
|||||||
@ -23,8 +23,8 @@ public class XhpcBarrierGateServiceImpl extends BaseService implements IXhpcBarr
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getLsit(String barrierGateCompany) {
|
public List<Map<String, Object>> getLsit(String barrierGateCompany,String chargingStationNumber) {
|
||||||
return xhpcBarrierGateMapper.getLsit(barrierGateCompany);
|
return xhpcBarrierGateMapper.getLsit(barrierGateCompany,chargingStationNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,7 +35,7 @@ public class XhpcBarrierGateServiceImpl extends BaseService implements IXhpcBarr
|
|||||||
xhpcBarrierGateMapper.insertBarrierGate(xhpcBarrierGate);
|
xhpcBarrierGateMapper.insertBarrierGate(xhpcBarrierGate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return R.ok();
|
return R.ok(null,"保存成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +47,7 @@ public class XhpcBarrierGateServiceImpl extends BaseService implements IXhpcBarr
|
|||||||
public R deleteBarrierGateById(Long barrierGateId) {
|
public R deleteBarrierGateById(Long barrierGateId) {
|
||||||
xhpcBarrierGateMapper.deleteBarrierGateById(barrierGateId);
|
xhpcBarrierGateMapper.deleteBarrierGateById(barrierGateId);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok(null,"删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -447,6 +447,60 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
|
|||||||
pile.setType(PowerTypeEnum.getCodeByName(pile.getTypeName()));
|
pile.setType(PowerTypeEnum.getCodeByName(pile.getTypeName()));
|
||||||
pile.setConnectorType(ConnectorTypeEnum.getCodeByName(pile.getConnectorTypeName()));
|
pile.setConnectorType(ConnectorTypeEnum.getCodeByName(pile.getConnectorTypeName()));
|
||||||
pile.setEquipmentType(PileEquipmentTypeEnum.getCodeByName(pile.getEquipmentTypeName()));
|
pile.setEquipmentType(PileEquipmentTypeEnum.getCodeByName(pile.getEquipmentTypeName()));
|
||||||
|
if("否".equals(pile.getNewNationalStandardName())){
|
||||||
|
pile.setNewNationalStandard(0);
|
||||||
|
}else{
|
||||||
|
pile.setNewNationalStandard(1);
|
||||||
|
}
|
||||||
|
if("否".equals(pile.getVinFlagName())){
|
||||||
|
pile.setVinFlag(0);
|
||||||
|
}else{
|
||||||
|
pile.setVinFlag(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("未知".equals(pile.getEquipmentStatusName())){
|
||||||
|
pile.setEquipmentStatus(0);
|
||||||
|
}else if("建设中".equals(pile.getEquipmentStatusName())){
|
||||||
|
pile.setEquipmentStatus(1);
|
||||||
|
}else if("关闭下线".equals(pile.getEquipmentStatusName())){
|
||||||
|
pile.setEquipmentStatus(5);
|
||||||
|
}else if("维护中".equals(pile.getEquipmentStatusName())){
|
||||||
|
pile.setEquipmentStatus(6);
|
||||||
|
}else {
|
||||||
|
pile.setVinFlag(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("公共".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(0);
|
||||||
|
}else if("个人".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(50);
|
||||||
|
}else if("公交(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(100);
|
||||||
|
}else if("环卫(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(101);
|
||||||
|
}else if("物流(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(102);
|
||||||
|
}else if("出租车(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(103);
|
||||||
|
}else if("分时租赁(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(104);
|
||||||
|
}else if("单位(专用)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(106);
|
||||||
|
}else if("移动站点(移动储能设备)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(107);
|
||||||
|
}else if("居民小区(公共)".equals(pile.getEquipmentPurposeName())){
|
||||||
|
pile.setEquipmentStatus(108);
|
||||||
|
}else {
|
||||||
|
pile.setVinFlag(109);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("车辆充电设备".equals(pile.getEquipmentClassificatlonName())){
|
||||||
|
pile.setEquipmentClassificatlon(1);
|
||||||
|
}else{
|
||||||
|
pile.setEquipmentClassificatlon(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
XhpcChargingStation station = xhpcChargingStationService.selectXhpcChargingStationByName(pile.getChargingStationName());
|
XhpcChargingStation station = xhpcChargingStationService.selectXhpcChargingStationByName(pile.getChargingStationName());
|
||||||
if(station == null){
|
if(station == null){
|
||||||
|
|||||||
@ -354,8 +354,8 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
if (xhpcChargingStationDto.getOperatorId() == null) {
|
if (xhpcChargingStationDto.getOperatorId() == null) {
|
||||||
return AjaxResult.error(1001, "运营商不能为空");
|
return AjaxResult.error(1001, "运营商不能为空");
|
||||||
}
|
}
|
||||||
if (xhpcChargingStationDto.getName().length()> 16) {
|
if (xhpcChargingStationDto.getName().length()> 50) {
|
||||||
return AjaxResult.error(1001, "电站名称不能超过16字");
|
return AjaxResult.error(1001, "电站名称不能超过50字");
|
||||||
}
|
}
|
||||||
if (xhpcChargingStationDto.getAreaCode() == null) {
|
if (xhpcChargingStationDto.getAreaCode() == null) {
|
||||||
return AjaxResult.error(1001, "电站地址不能为空");
|
return AjaxResult.error(1001, "电站地址不能为空");
|
||||||
@ -1068,8 +1068,8 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
if (xhpcChargingStation.getChargingStationId() == null) {
|
if (xhpcChargingStation.getChargingStationId() == null) {
|
||||||
return AjaxResult.error("1001", "电站id为空");
|
return AjaxResult.error("1001", "电站id为空");
|
||||||
}
|
}
|
||||||
if (xhpcChargingStation.getName().length()> 16) {
|
if (xhpcChargingStation.getName().length()> 50) {
|
||||||
return AjaxResult.error(1001, "电站名称不能超过16字");
|
return AjaxResult.error(1001, "电站名称不能超过50字");
|
||||||
}
|
}
|
||||||
xhpcChargingStation.setServiceFee(xhpcChargingStation.getServiceFeeDescribe());
|
xhpcChargingStation.setServiceFee(xhpcChargingStation.getServiceFeeDescribe());
|
||||||
//获取之前的模板id
|
//获取之前的模板id
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="tenantId" column="tenant_id"/>
|
<result property="tenantId" column="tenant_id"/>
|
||||||
|
<result property="chargingStationNumber" column="charging_station_number"/>
|
||||||
|
<result property="url" column="url"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
@ -31,12 +33,17 @@
|
|||||||
select
|
select
|
||||||
barrier_gate_id as barrierGateId,
|
barrier_gate_id as barrierGateId,
|
||||||
barrier_gate_company as barrierGateCompany,
|
barrier_gate_company as barrierGateCompany,
|
||||||
|
charging_station_number as chargingStationNumber,
|
||||||
|
url as url,
|
||||||
start_time as startTime,
|
start_time as startTime,
|
||||||
end_time as endTime
|
end_time as endTime
|
||||||
from xhpc_barrier_gate where del_flag =0
|
from xhpc_barrier_gate where del_flag =0
|
||||||
<if test="barrierGateCompany !=null and barrierGateCompany !=''">
|
<if test="barrierGateCompany !=null and barrierGateCompany !=''">
|
||||||
and barrier_gate_company like CONCAT('%',#{barrierGateCompany},'%')
|
and barrier_gate_company like CONCAT('%',#{barrierGateCompany},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="chargingStationNumber !=null and chargingStationNumber !=''">
|
||||||
|
and charging_station_number like CONCAT('%',#{chargingStationNumber},'%')
|
||||||
|
</if>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@ -77,6 +84,12 @@
|
|||||||
<if test="null != tenantId ">
|
<if test="null != tenantId ">
|
||||||
tenant_id,
|
tenant_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != chargingStationNumber and ''!=chargingStationNumber ">
|
||||||
|
charging_station_number,
|
||||||
|
</if>
|
||||||
|
<if test="null != url and ''!=url ">
|
||||||
|
url,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
|
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
|
||||||
@ -112,6 +125,12 @@
|
|||||||
<if test="null != tenantId ">
|
<if test="null != tenantId ">
|
||||||
#{tenantId},
|
#{tenantId},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != chargingStationNumber and ''!=chargingStationNumber ">
|
||||||
|
#{chargingStationNumber},
|
||||||
|
</if>
|
||||||
|
<if test="null != url and ''!=url ">
|
||||||
|
#{url},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -151,6 +170,15 @@
|
|||||||
<if test="null != tenantId ">
|
<if test="null != tenantId ">
|
||||||
tenant_id =#{tenantId},
|
tenant_id =#{tenantId},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != tenantId ">
|
||||||
|
tenant_id =#{tenantId},
|
||||||
|
</if>
|
||||||
|
<if test="null != chargingStationNumber and ''!=chargingStationNumber ">
|
||||||
|
charging_station_number =#{chargingStationNumber},
|
||||||
|
</if>
|
||||||
|
<if test="null != url and ''!=url ">
|
||||||
|
url=#{url},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
where barrier_gate_id = #{barrierGateId}
|
where barrier_gate_id = #{barrierGateId}
|
||||||
</update>
|
</update>
|
||||||
@ -163,6 +191,8 @@
|
|||||||
select
|
select
|
||||||
barrier_gate_id as barrierGateId,
|
barrier_gate_id as barrierGateId,
|
||||||
barrier_gate_company as barrierGateCompany,
|
barrier_gate_company as barrierGateCompany,
|
||||||
|
charging_station_number as chargingStationNumber,
|
||||||
|
url as url,
|
||||||
start_time as startTime,
|
start_time as startTime,
|
||||||
end_time as endTime
|
end_time as endTime
|
||||||
from xhpc_barrier_gate
|
from xhpc_barrier_gate
|
||||||
|
|||||||
@ -25,4 +25,8 @@ public class XhpcBarrierGate extends BaseEntity {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
private String chargingStationNumber;
|
||||||
|
|
||||||
|
private String url;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.xhpc.common.domain;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XhpcBarrierGateRecord extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long barrierGateRecordId;
|
||||||
|
/** 道闸id */
|
||||||
|
private Long barrierGateId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
private Long chargingStationId;
|
||||||
|
|
||||||
|
private Date sendingTime;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@ -128,35 +128,55 @@ public class XhpcChargingPile extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 设备出厂编码
|
* 设备出厂编码
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "设备出厂编码")
|
||||||
private String equipmentProductCode;
|
private String equipmentProductCode;
|
||||||
/**
|
/**
|
||||||
* 设备出厂编码
|
* 变压器户号
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "变压器户号")
|
||||||
private String transformerId;
|
private String transformerId;
|
||||||
/**
|
/**
|
||||||
* 新国标
|
* 新国标
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Integer newNationalStandard;
|
private Integer newNationalStandard;
|
||||||
|
|
||||||
|
@Excel(name = "新国标")
|
||||||
|
private String newNationalStandardName;
|
||||||
/**
|
/**
|
||||||
* 是否支持 VIN 码识别
|
* 是否支持 VIN 码识别
|
||||||
*/
|
*/
|
||||||
private Integer vinFlag;
|
private Integer vinFlag;
|
||||||
|
|
||||||
|
@Excel(name = "是否支持VIN码")
|
||||||
|
private String vinFlagName;
|
||||||
/**
|
/**
|
||||||
* 设备状态
|
* 设备状态
|
||||||
*/
|
*/
|
||||||
private Integer equipmentStatus;
|
private Integer equipmentStatus;
|
||||||
|
|
||||||
|
@Excel(name = "设备状态")
|
||||||
|
private String equipmentStatusName;
|
||||||
/**
|
/**
|
||||||
* 设备用途
|
* 设备用途
|
||||||
*/
|
*/
|
||||||
private Integer equipmentPurpose;
|
private Integer equipmentPurpose;
|
||||||
|
|
||||||
|
@Excel(name = "设备用途")
|
||||||
|
private String equipmentPurposeName;
|
||||||
|
|
||||||
|
@Excel(name = "建设时间")
|
||||||
private String constructionTime;
|
private String constructionTime;
|
||||||
|
|
||||||
|
@Excel(name = "设备生成商组织机构代码")
|
||||||
private String manufacturerId;
|
private String manufacturerId;
|
||||||
|
|
||||||
|
|
||||||
private Integer equipmentClassificatlon;
|
private Integer equipmentClassificatlon;
|
||||||
|
|
||||||
|
@Excel(name = "设备分类")
|
||||||
|
private String equipmentClassificatlonName;
|
||||||
|
|
||||||
|
@Excel(name = "辅助电源")
|
||||||
private Integer auxPower;
|
private Integer auxPower;
|
||||||
|
|
||||||
|
|
||||||
@ -567,4 +587,43 @@ public class XhpcChargingPile extends BaseEntity {
|
|||||||
this.auxPower = auxPower;
|
this.auxPower = auxPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNewNationalStandardName() {
|
||||||
|
return newNationalStandardName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewNationalStandardName(String newNationalStandardName) {
|
||||||
|
this.newNationalStandardName = newNationalStandardName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVinFlagName() {
|
||||||
|
return vinFlagName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVinFlagName(String vinFlagName) {
|
||||||
|
this.vinFlagName = vinFlagName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEquipmentStatusName() {
|
||||||
|
return equipmentStatusName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipmentStatusName(String equipmentStatusName) {
|
||||||
|
this.equipmentStatusName = equipmentStatusName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEquipmentPurposeName() {
|
||||||
|
return equipmentPurposeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipmentPurposeName(String equipmentPurposeName) {
|
||||||
|
this.equipmentPurposeName = equipmentPurposeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEquipmentClassificatlonName() {
|
||||||
|
return equipmentClassificatlonName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipmentClassificatlonName(String equipmentClassificatlonName) {
|
||||||
|
this.equipmentClassificatlonName = equipmentClassificatlonName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -241,10 +241,14 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
|
|
||||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||||
|
|
||||||
|
|
||||||
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
|
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
|
||||||
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
||||||
return R.fail(500,"无效订单号");
|
return R.fail(500,"无效订单号");
|
||||||
}
|
}
|
||||||
|
if(xhpcChargeOrder.getStatus()==null){
|
||||||
|
xhpcChargeOrder.setStatus(0);
|
||||||
|
}
|
||||||
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo);
|
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+orderNo);
|
||||||
if(cacheMap==null || cacheMap.get("startType")==null ){
|
if(cacheMap==null || cacheMap.get("startType")==null ){
|
||||||
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
||||||
@ -306,6 +310,9 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcChargeOrder.setRemark("充电桩校验故障");
|
xhpcChargeOrder.setRemark("充电桩校验故障");
|
||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0A");
|
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0A");
|
||||||
|
System.out.println("=====================p平台下发停止充电=============================="+xhpcChargeOrder.getSerialNumber());
|
||||||
|
System.out.println("=====================p平台下发停止充电=============================="+xhpcChargeOrder.getSerialNumber());
|
||||||
|
System.out.println("=====================p平台下发停止充电=============================="+xhpcChargeOrder.getSerialNumber());
|
||||||
return R.fail(500,"充电桩校验故障");
|
return R.fail(500,"充电桩校验故障");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -889,7 +889,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
* 24小时异常订单自动结算
|
* 24小时异常订单自动结算
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test4")
|
@GetMapping("/test4")
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
//@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void test4(){
|
public void test4(){
|
||||||
//获取异常的订单 24小时之外的异常订单
|
//获取异常的订单 24小时之外的异常订单
|
||||||
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
|
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
|
||||||
@ -916,13 +916,13 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
* @param
|
* @param
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test5")
|
@GetMapping("/test5")
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
//@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void test5(){
|
public void test5(){
|
||||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
|
||||||
chargeOrderService.updateStatus();
|
chargeOrderService.updateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/1 * * * ?")
|
//@Scheduled(cron = "0 0/1 * * * ?")
|
||||||
@GetMapping("/getInvoiceInfo")
|
@GetMapping("/getInvoiceInfo")
|
||||||
public void getInvoiceInfo(){
|
public void getInvoiceInfo(){
|
||||||
logger.info("++++++++++++每1分钟,扫描一次,异常订单,自动生成工单++++++++++++++++");
|
logger.info("++++++++++++每1分钟,扫描一次,异常订单,自动生成工单++++++++++++++++");
|
||||||
|
|||||||
@ -64,6 +64,10 @@ public class XhpcStopChargingOrderController extends BaseController {
|
|||||||
if(cacheMap.get("version") !=null){
|
if(cacheMap.get("version") !=null){
|
||||||
version =cacheMap.get("version").toString();
|
version =cacheMap.get("version").toString();
|
||||||
}
|
}
|
||||||
|
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
|
||||||
|
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
|
||||||
|
System.out.println("=================111========停止充电命令已下发==================停止 充电=================="+serialNumberOrderMap);
|
||||||
|
|
||||||
R r = powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
R r = powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
||||||
|
|
||||||
if(r.getCode()==200){
|
if(r.getCode()==200){
|
||||||
|
|||||||
@ -228,4 +228,9 @@ public interface XhpcChargeOrderMapper {
|
|||||||
List<Map<String, Object>> select3rdNameBy(@Param(value = "operatorIdEvcs") String operatorIdEvcs);
|
List<Map<String, Object>> select3rdNameBy(@Param(value = "operatorIdEvcs") String operatorIdEvcs);
|
||||||
|
|
||||||
Map<String,Object> getSerialNumberOrder(@Param("serialNumber")String serialNumber);
|
Map<String,Object> getSerialNumberOrder(@Param("serialNumber")String serialNumber);
|
||||||
|
|
||||||
|
|
||||||
|
//查询场站是否有道闸
|
||||||
|
Map<String,Object> getXhpcBarrierGate(@Param("chargingStationId")Long chargingStationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.xhpc.order.mapper;
|
package com.xhpc.order.mapper;
|
||||||
|
|
||||||
|
import com.xhpc.common.domain.XhpcBarrierGateRecord;
|
||||||
import com.xhpc.common.domain.XhpcChargingPile;
|
import com.xhpc.common.domain.XhpcChargingPile;
|
||||||
import com.xhpc.order.domain.*;
|
import com.xhpc.order.domain.*;
|
||||||
import com.xhpc.order.dto.RateTime;
|
import com.xhpc.order.dto.RateTime;
|
||||||
@ -206,4 +207,6 @@ public interface XhpcRealTimeOrderMapper {
|
|||||||
//获取桩id
|
//获取桩id
|
||||||
XhpcChargingPile getSerialNumber(@Param("serialNumber")String serialNumber);
|
XhpcChargingPile getSerialNumber(@Param("serialNumber")String serialNumber);
|
||||||
|
|
||||||
|
void insertXhpcBarrierGateRecord(XhpcBarrierGateRecord xhpcBarrierGateRecord);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,4 +179,7 @@ public interface IXhpcChargeOrderService {
|
|||||||
void constantSoc(String orderNo,String soc);
|
void constantSoc(String orderNo,String soc);
|
||||||
|
|
||||||
void zhbSoc(String orderNo,String soc);
|
void zhbSoc(String orderNo,String soc);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String,Object> getXhpcBarrierGate(Long chargingStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -402,6 +402,9 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
|||||||
return AjaxResult.error(1104, "请登陆相应账号停止充电");
|
return AjaxResult.error(1104, "请登陆相应账号停止充电");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
|
||||||
|
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
|
||||||
|
System.out.println("=================111========请登陆相应账号停止充电==================停止 充电=================="+order.getSerialNumber());
|
||||||
|
|
||||||
R oa = powerPileService.stopCharging(order.getSerialNumber(), xhpcTerminal.getPileSerialNumber(),
|
R oa = powerPileService.stopCharging(order.getSerialNumber(), xhpcTerminal.getPileSerialNumber(),
|
||||||
xhpcTerminal.getSerialNumber(), version);
|
xhpcTerminal.getSerialNumber(), version);
|
||||||
@ -1310,6 +1313,11 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getXhpcBarrierGate(Long chargingStationId) {
|
||||||
|
return xhpcChargeOrderMapper.getXhpcBarrierGate(chargingStationId);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try{
|
try{
|
||||||
// //String alipayPublicKey1 = getAlipayPublicKey("C:\\Users\\Administrator\\Downloads\\alipayCertPublicKey_RSA2.crt");
|
// //String alipayPublicKey1 = getAlipayPublicKey("C:\\Users\\Administrator\\Downloads\\alipayCertPublicKey_RSA2.crt");
|
||||||
|
|||||||
@ -32,10 +32,14 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
|||||||
|
|
||||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||||
|
|
||||||
private final String [] enumeration ={"zero","one","two","three","four","five", "six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen", "eighteen","nineteen","twenty","twenty-one","twenty-two","twenty-three","twenty-four",
|
private final String [] enumeration ={"zero","one","two","three","four","five", "six","seven","eight","nine","ten","eleven",
|
||||||
"twenty-five","twenty-six","twenty-seven", "twenty-eight","twenty-nine","thirty","thirty-one","thirty-two","thirty-three","thirty-four","thirty-five","thirty-six","thirty-seven","thirty-eight","thirty-nine","forty","forty-one","forty-two","forty-three","forty-four","forty-five","forty-six","forty-seven",
|
"twelve","thirteen","fourteen","fifteen","sixteen","seventeen", "eighteen","nineteen","twenty","twenty-one","twenty-two","twenty-three",
|
||||||
"forty-eight","forty-nine","fifty","fifty-one","fifty-two","fifty-three","fifty-four","fifty-five","fifty-six","fifty-seven","fifty-eight","fifty-nine","sixty","sixty-one","sixty-two","sixty-three","sixty-four","sixty-five","sixty-six","sixty-seven","sixty-eight","sixty-nine","seventy","seventy-one","seventy-two","seventy-three","seventy-four",
|
"twenty-four","twenty-five","twenty-six","twenty-seven", "twenty-eight","twenty-nine","thirty","thirty-one","thirty-two","thirty-three","thirty-four","thirty-five",
|
||||||
"seventy-five","seventy-six","seventy-seven","seventy-eight","seventy-nine","eighty","eighty-one","eighty-two","eighty-three","eighty-four","eighty-five","eighty-six","eighty-seven","eighty-eight","eighty-nine","ninety","ninety-one","ninety-two","ninety-three","ninety-four","ninety-five"};
|
"thirty-six","thirty-seven","thirty-eight","thirty-nine","forty","forty-one","forty-two","forty-three","forty-four","forty-five","forty-six","forty-seven",
|
||||||
|
"forty-eight","forty-nine","fifty","fifty-one","fifty-two","fifty-three","fifty-four","fifty-five","fifty-six","fifty-seven","fifty-eight","fifty-nine",
|
||||||
|
"sixty","sixty-one","sixty-two","sixty-three","sixty-four","sixty-five","sixty-six","sixty-seven","sixty-eight","sixty-nine","seventy","seventy-one",
|
||||||
|
"seventy-two","seventy-three","seventy-four","seventy-five","seventy-six","seventy-seven","seventy-eight","seventy-nine","eighty","eighty-one","eighty-two","eighty-three",
|
||||||
|
"eighty-four","eighty-five","eighty-six","eighty-seven","eighty-eight","eighty-nine","ninety","ninety-one","ninety-two","ninety-three","ninety-four","ninety-five"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChargingStationPower() {
|
public void addChargingStationPower() {
|
||||||
@ -148,8 +152,6 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
|||||||
int time = Integer.parseInt(split[j]);
|
int time = Integer.parseInt(split[j]);
|
||||||
if(map.get(enumeration[time]) !=null){
|
if(map.get(enumeration[time]) !=null){
|
||||||
Double aDouble = Double.valueOf(map.get(enumeration[time]).toString());
|
Double aDouble = Double.valueOf(map.get(enumeration[time]).toString());
|
||||||
System.out.println("====j==="+j);
|
|
||||||
System.out.println("======="+powerSplit[j]);
|
|
||||||
Double aDouble1 = Double.valueOf(powerSplit[j].toString());
|
Double aDouble1 = Double.valueOf(powerSplit[j].toString());
|
||||||
double v = aDouble + aDouble1;
|
double v = aDouble + aDouble1;
|
||||||
map.put(enumeration[time],new Formatter().format("%.2f", v).toString());
|
map.put(enumeration[time],new Formatter().format("%.2f", v).toString());
|
||||||
|
|||||||
@ -141,6 +141,11 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
public List<Map<String, Object>> list(HttpServletRequest request) {
|
public List<Map<String, Object>> list(HttpServletRequest request) {
|
||||||
List<Map<String, Object>> list =new ArrayList<>();
|
List<Map<String, Object>> list =new ArrayList<>();
|
||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
if(loginUser==null){
|
||||||
|
startPage();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
Long userid = loginUser.getUserid();
|
Long userid = loginUser.getUserid();
|
||||||
String tenantId = loginUser.getTenantId();
|
String tenantId = loginUser.getTenantId();
|
||||||
Integer userType = loginUser.getUserType();
|
Integer userType = loginUser.getUserType();
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import com.xhpc.common.core.web.service.BaseService;
|
|||||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||||
import com.xhpc.common.data.redis.CacheOrderData;
|
import com.xhpc.common.data.redis.CacheOrderData;
|
||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
|
import com.xhpc.common.domain.XhpcBarrierGateRecord;
|
||||||
import com.xhpc.common.domain.XhpcChargingPile;
|
import com.xhpc.common.domain.XhpcChargingPile;
|
||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.enums.StopReasonEnum;
|
import com.xhpc.common.enums.StopReasonEnum;
|
||||||
@ -1366,6 +1367,44 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//小华充电二台子社区充电站 道闸
|
||||||
|
// try{
|
||||||
|
// if(xhpcChargeOrder.getPlateNum() !=null && !"".equals(xhpcChargeOrder.getPlateNum())){
|
||||||
|
// Map<String, Object> xhpcBarrierGate = xhpcChargeOrderService.getXhpcBarrierGate(xhpcChargeOrder.getChargingStationId());
|
||||||
|
// if(xhpcBarrierGate !=null && xhpcBarrierGate.get("url") !=null && xhpcBarrierGate.get("chargingStationNumber") !=null){
|
||||||
|
// Map<String, Object> barrierGateMap = new HashMap<>();
|
||||||
|
// barrierGateMap.put("plateNo", xhpcChargeOrder.getPlateNum());
|
||||||
|
// barrierGateMap.put("chargingStationNumber", xhpcBarrierGate.get("chargingStationNumber").toString());
|
||||||
|
// barrierGateMap.put("chargingStationName", xhpcBarrierGate.get("name").toString());
|
||||||
|
// barrierGateMap.put("address", xhpcBarrierGate.get("address").toString());
|
||||||
|
// barrierGateMap.put("longitude", xhpcBarrierGate.get("longitude").toString());
|
||||||
|
// barrierGateMap.put("latitude", xhpcBarrierGate.get("latitude").toString());
|
||||||
|
// barrierGateMap.put("startTime", xhpcHistoryOrder.getStartTime());
|
||||||
|
// barrierGateMap.put("endTime", xhpcHistoryOrder.getEndTime());
|
||||||
|
// JSONObject json = new JSONObject(barrierGateMap);
|
||||||
|
// String result = HttpUtils.post(xhpcBarrierGate.get("url").toString(), json);
|
||||||
|
// JSONObject jsonObject = JSON.parseObject(result);
|
||||||
|
// String code = jsonObject.getString("code");
|
||||||
|
// XhpcBarrierGateRecord xhpcBarrierGateRecord = new XhpcBarrierGateRecord();
|
||||||
|
// if("200".equals(code)){
|
||||||
|
// xhpcBarrierGateRecord.setStatus(0);
|
||||||
|
// }else{
|
||||||
|
// xhpcBarrierGateRecord.setStatus(1);
|
||||||
|
// }
|
||||||
|
// xhpcBarrierGateRecord.setBarrierGateId(Long.parseLong(xhpcBarrierGate.get("barrierGateId").toString()));
|
||||||
|
// xhpcBarrierGateRecord.setUserId(userId);
|
||||||
|
// xhpcBarrierGateRecord.setSource(source);
|
||||||
|
// xhpcBarrierGateRecord.setChargingStationId(xhpcChargeOrder.getChargingStationId());
|
||||||
|
// xhpcBarrierGateRecord.setSendingTime(new Date());
|
||||||
|
// xhpcBarrierGateRecord.setDelFlag(0);
|
||||||
|
// xhpcBarrierGateRecord.setRemark(result);
|
||||||
|
// xhpcRealTimeOrderMapper.insertXhpcBarrierGateRecord(xhpcBarrierGateRecord);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.info("<<<<<<<<<<<<<<<<运行异常,结算失败,数据回滚>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
logger.info("<<<<<<<<<<<<<<<<运行异常,结算失败,数据回滚>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
<result column="power" property="power"/>
|
<result column="power" property="power"/>
|
||||||
<result column="charging_time_number" property="chargingTimeNumber"/>
|
<result column="charging_time_number" property="chargingTimeNumber"/>
|
||||||
<result column="tenant_id" property="tenantId"/>
|
<result column="tenant_id" property="tenantId"/>
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcTerminal">
|
||||||
@ -394,7 +395,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSerialNumberMessage" resultMap="XhpcChargeOrderResult">
|
<select id="getSerialNumberMessage" resultMap="XhpcChargeOrderResult">
|
||||||
select *
|
select *,Plate_num as PlateNum
|
||||||
from xhpc_charge_order
|
from xhpc_charge_order
|
||||||
where serial_number = #{serialNumber}
|
where serial_number = #{serialNumber}
|
||||||
limit 1
|
limit 1
|
||||||
@ -750,4 +751,19 @@
|
|||||||
SELECT terminal_id FROM xhpc_terminal WHERE serial_number =#{serialNumber} AND del_flag = 0 )
|
SELECT terminal_id FROM xhpc_terminal WHERE serial_number =#{serialNumber} AND del_flag = 0 )
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getXhpcBarrierGate" resultType="map">
|
||||||
|
select
|
||||||
|
xcs.charging_station_id as id,
|
||||||
|
xcs.name as name,
|
||||||
|
xcs.address as address,
|
||||||
|
xcs.longitude as longitude,
|
||||||
|
xcs.latitude as latitude,
|
||||||
|
xbg.barrier_gate_id as barrierGateId,
|
||||||
|
xbg.url as url,
|
||||||
|
xbg.charging_station_number as chargingStationNumber
|
||||||
|
from xhpc_charging_station xcs
|
||||||
|
left join xhpc_barrier_gate xbg on xcs.barrier_gate_id = xbg.barrier_gate_id and xbg.del_flag =0 and xbg.status =0
|
||||||
|
where charging_station_id =#{chargingStationId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -1058,4 +1058,91 @@
|
|||||||
charging_station_id as chargingStationId
|
charging_station_id as chargingStationId
|
||||||
from xhpc_charging_pile where serial_number =#{serialNumber}
|
from xhpc_charging_pile where serial_number =#{serialNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertXhpcBarrierGateRecord">
|
||||||
|
insert into xhpc_barrier_gate_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != barrierGateId">
|
||||||
|
barrier_gate_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != userId">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
source,
|
||||||
|
</if>
|
||||||
|
<if test="null != chargingStationId ">
|
||||||
|
charging_station_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != sendingTime ">
|
||||||
|
sending_time,
|
||||||
|
</if>
|
||||||
|
<if test="null != status ">
|
||||||
|
status,
|
||||||
|
</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 != barrierGateId">
|
||||||
|
#{barrierGateId},
|
||||||
|
</if>
|
||||||
|
<if test="null != userId">
|
||||||
|
#{userId},
|
||||||
|
</if>
|
||||||
|
<if test="null != source ">
|
||||||
|
#{source},
|
||||||
|
</if>
|
||||||
|
<if test="null != chargingStationId ">
|
||||||
|
#{chargingStationId},
|
||||||
|
</if>
|
||||||
|
<if test="null != sendingTime ">
|
||||||
|
#{sendingTime},
|
||||||
|
</if>
|
||||||
|
<if test="null != status ">
|
||||||
|
#{status},
|
||||||
|
</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>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -96,9 +96,9 @@ public class AlipayPaymentController {
|
|||||||
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
|
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
|
||||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
|
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
|
||||||
}
|
}
|
||||||
if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
|
// if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
|
||||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
|
// return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
//用户信息id
|
//用户信息id
|
||||||
String userId = StringUtils.valueOf(map.get("userId"));
|
String userId = StringUtils.valueOf(map.get("userId"));
|
||||||
|
|||||||
@ -97,9 +97,9 @@ public class WxPaymentController {
|
|||||||
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
|
if(new BigDecimal(5).compareTo(new BigDecimal(amount))==1){
|
||||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
|
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能少于5元");
|
||||||
}
|
}
|
||||||
if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
|
// if(new BigDecimal(200).compareTo(new BigDecimal(amount))==-1){
|
||||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
|
// return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能大于200元");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
//用户信息id
|
//用户信息id
|
||||||
if(map.get("userId") ==null || "".equals(map.get("userId").toString())){
|
if(map.get("userId") ==null || "".equals(map.get("userId").toString())){
|
||||||
|
|||||||
@ -13,12 +13,14 @@ import com.xhpc.common.log.annotation.Log;
|
|||||||
import com.xhpc.common.log.enums.BusinessType;
|
import com.xhpc.common.log.enums.BusinessType;
|
||||||
import com.xhpc.common.security.service.TokenService;
|
import com.xhpc.common.security.service.TokenService;
|
||||||
import com.xhpc.common.util.UserTypeUtil;
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
|
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -226,8 +228,25 @@ public class XhpcRefundOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/5 * * * ? ")
|
||||||
|
public void administratorReview(){
|
||||||
|
logger.info("++++++++++++每5分,扫描一次,在管理员审核状态中,用户金额为0时,去掉该记录++++++++++++++++");
|
||||||
|
try {
|
||||||
|
List<Map<String, Object>> list = iXhpcRefundOrderService.administratorReview();
|
||||||
|
if(list !=null && list.size()>0){
|
||||||
|
for (int i = 0; i <list.size() ; i++) {
|
||||||
|
Map<String, Object> map = list.get(i);
|
||||||
|
if(map.get("balance") !=null && new BigDecimal(0).compareTo(new BigDecimal(map.get("balance").toString()))==0){
|
||||||
|
iXhpcRefundOrderService.updateXhpcRefundOrder(Long.valueOf(map.get("refundOrderId").toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("++++++++++++管理员审核异常++++++++++++++++");
|
||||||
|
e.printStackTrace();
|
||||||
|
//后期可以增加短信通知
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,4 +124,7 @@ public interface XhpcRefundOrderMapper {
|
|||||||
*/
|
*/
|
||||||
int updateRefundApplication(@Param("userId")Long userId,@Param("isRefundApplication")Integer isRefundApplication);
|
int updateRefundApplication(@Param("userId")Long userId,@Param("isRefundApplication")Integer isRefundApplication);
|
||||||
|
|
||||||
|
List<Map<String, Object>> administratorReview();
|
||||||
|
|
||||||
|
void updateXhpcRefundOrder(@Param("refundOrderId")Long refundOrderId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,4 +115,8 @@ public interface IXhpcRefundOrderService {
|
|||||||
* type 1 小于101元 2大于100元
|
* type 1 小于101元 2大于100元
|
||||||
*/
|
*/
|
||||||
public List<Long> moneyPage(Integer type);
|
public List<Long> moneyPage(Integer type);
|
||||||
|
|
||||||
|
List<Map<String, Object>> administratorReview();
|
||||||
|
|
||||||
|
void updateXhpcRefundOrder(Long refundOrderId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,4 +250,14 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
|||||||
return xhpcRefundOrderMapper.moneyPage(type);
|
return xhpcRefundOrderMapper.moneyPage(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> administratorReview() {
|
||||||
|
return xhpcRefundOrderMapper.administratorReview();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateXhpcRefundOrder(Long refundOrderId) {
|
||||||
|
xhpcRefundOrderMapper.updateXhpcRefundOrder(refundOrderId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1280,8 +1280,10 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
|||||||
logger.info("===微信=======查询以前充值记录=========");
|
logger.info("===微信=======查询以前充值记录=========");
|
||||||
//增加用户流水记录
|
//增加用户流水记录
|
||||||
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), "-"+refundFee, userId.toString(), StatusConstants.FLOWING_WATER_REFUND,source,refundOrder.getTenantId());
|
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), "-"+refundFee, userId.toString(), StatusConstants.FLOWING_WATER_REFUND,source,refundOrder.getTenantId());
|
||||||
Date date = new Date();
|
|
||||||
String createTime = DateUtil.formatDateTime(date);
|
LocalDateTime localDate = LocalDateTime.now().minusDays(363);
|
||||||
|
String createTime = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));//转为String类型
|
||||||
|
|
||||||
List<XhpcRechargeOrder> totalMoneyList = xhpcRefundOriginalOrderMapper.getTotalMoneyList(userId, source,createTime);
|
List<XhpcRechargeOrder> totalMoneyList = xhpcRefundOriginalOrderMapper.getTotalMoneyList(userId, source,createTime);
|
||||||
for (int i = 0; i <totalMoneyList.size() ; i++) {
|
for (int i = 0; i <totalMoneyList.size() ; i++) {
|
||||||
XhpcRechargeOrder xhpcRechargeOrder = totalMoneyList.get(i);
|
XhpcRechargeOrder xhpcRechargeOrder = totalMoneyList.get(i);
|
||||||
|
|||||||
@ -231,6 +231,9 @@
|
|||||||
ifnull(sum(xro.amount),0) amount
|
ifnull(sum(xro.amount),0) amount
|
||||||
from xhpc_recharge_order xro
|
from xhpc_recharge_order xro
|
||||||
where xro.del_flag = 0 and xro.user_id =#{userId}
|
where xro.del_flag = 0 and xro.user_id =#{userId}
|
||||||
|
<if test="source !=null">
|
||||||
|
and xro.source =#{source}
|
||||||
|
</if>
|
||||||
ORDER BY xro.create_time DESC
|
ORDER BY xro.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -346,4 +346,22 @@
|
|||||||
<update id="updateRefundApplication">
|
<update id="updateRefundApplication">
|
||||||
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
|
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="administratorReview" parameterType="java.lang.String" resultType="java.util.Map">
|
||||||
|
select
|
||||||
|
xro.refund_order_id refundOrderId,
|
||||||
|
xau.balance as balance
|
||||||
|
from xhpc_refund_order xro
|
||||||
|
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id and xro.source =0
|
||||||
|
|
||||||
|
where xro.del_flag = 0 and xro.status =4
|
||||||
|
|
||||||
|
ORDER BY xro.create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateXhpcRefundOrder">
|
||||||
|
update xhpc_refund_order set del_flag =1 where refund_order_id =#{refundOrderId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -397,10 +397,10 @@ public class ChargingController {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Integer F401 = HexUtils.reverseHexInt("8E200100");
|
Integer F401 = HexUtils.reverseHexInt("A6010000");
|
||||||
System.out.println("F401 转化成="+F401);
|
System.out.println("F401 转化成="+F401);
|
||||||
|
|
||||||
Integer F402 = HexUtils.reverseHexInt("8E200100");
|
Integer F402 = HexUtils.reverseHexInt("B602");
|
||||||
System.out.println("F402 转化成="+F402);
|
System.out.println("F402 转化成="+F402);
|
||||||
|
|
||||||
// Integer D007 = HexUtils.reverseHexInt("D007");
|
// Integer D007 = HexUtils.reverseHexInt("D007");
|
||||||
|
|||||||
@ -435,6 +435,7 @@ public class PileController {
|
|||||||
cdEquipmentInfo.setManufacturerName(xhpcChargingPile.getManufactureName());
|
cdEquipmentInfo.setManufacturerName(xhpcChargingPile.getManufactureName());
|
||||||
cdEquipmentInfo.setEquipmentModel(xhpcChargingPile.getBrandModel());
|
cdEquipmentInfo.setEquipmentModel(xhpcChargingPile.getBrandModel());
|
||||||
cdEquipmentInfo.setEquipmentProductCode(xhpcChargingPile.getEquipmentProductCode());
|
cdEquipmentInfo.setEquipmentProductCode(xhpcChargingPile.getEquipmentProductCode());
|
||||||
|
cdEquipmentInfo.setEquipmentName(xhpcChargingPile.getManufactureName());
|
||||||
cdEquipmentInfo.setTransformerID(xhpcChargingPile.getTransformerID());
|
cdEquipmentInfo.setTransformerID(xhpcChargingPile.getTransformerID());
|
||||||
cdEquipmentInfo.setProductionDate(xhpcChargingPile.getProductionDate());
|
cdEquipmentInfo.setProductionDate(xhpcChargingPile.getProductionDate());
|
||||||
cdEquipmentInfo.setConstructionTime(xhpcChargingPile.getConstructionTime());
|
cdEquipmentInfo.setConstructionTime(xhpcChargingPile.getConstructionTime());
|
||||||
|
|||||||
@ -50,6 +50,12 @@ public class StationController {
|
|||||||
xhpcChargingStation.setSwapMatchCars(split);
|
xhpcChargingStation.setSwapMatchCars(split);
|
||||||
}
|
}
|
||||||
xhpcChargingStation.setEquipmentInfos(new ArrayList<>());
|
xhpcChargingStation.setEquipmentInfos(new ArrayList<>());
|
||||||
|
if("3".equals(stationId)){
|
||||||
|
xhpcChargingStation.setStationName("小华充电新繁长德新世贸食品城充电站");
|
||||||
|
}else if("2".equals(stationId)){
|
||||||
|
xhpcChargingStation.setStationName("小华充电温江学府杏林充电站");
|
||||||
|
}
|
||||||
|
|
||||||
REDIS.setCacheObject(skey, xhpcChargingStation);
|
REDIS.setCacheObject(skey, xhpcChargingStation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,6 +169,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
Integer vul = (Integer) cachePile.get("voltageUpperLimits");
|
Integer vul = (Integer) cachePile.get("voltageUpperLimits");
|
||||||
Integer cul = (Integer) cachePile.get("currentLimit");
|
Integer cul = (Integer) cachePile.get("currentLimit");
|
||||||
if(vul != null && cul != null && (wc > cul || wv > vul)) {
|
if(vul != null && cul != null && (wc > cul || wv > vul)) {
|
||||||
|
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================wc > cul || wv > vul==================停止 充电=================="+pileNo);
|
||||||
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
if (r.getCode() == 200) {
|
if (r.getCode() == 200) {
|
||||||
Integer vcpcnt = (Integer) cacheOrder.get("vcpcnt");
|
Integer vcpcnt = (Integer) cacheOrder.get("vcpcnt");
|
||||||
@ -178,6 +181,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
} else {
|
} else {
|
||||||
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
Integer stopSoc = (Integer) cacheOrder.get("stopSoc");
|
||||||
if (stopSoc != null && socInt >= stopSoc) {
|
if (stopSoc != null && socInt >= stopSoc) {
|
||||||
|
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================stopSoc==================停止 充电=================="+pileNo);
|
||||||
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
String alerted = (String) cacheOrder.get("socalerted");
|
String alerted = (String) cacheOrder.get("socalerted");
|
||||||
String tel = (String) cacheOrder.get("tel");
|
String tel = (String) cacheOrder.get("tel");
|
||||||
@ -201,6 +207,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
Integer amountCharged =cacheRealtimeData.getAmountCharged();
|
Integer amountCharged =cacheRealtimeData.getAmountCharged();
|
||||||
if(chargingDegree < 10000 && amountCharged > 200000){
|
if(chargingDegree < 10000 && amountCharged > 200000){
|
||||||
// 充电度数小于1,并且,充电金额大于10
|
// 充电度数小于1,并且,充电金额大于10
|
||||||
|
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================chargingDegree < 10000==================停止 充电=================="+pileNo);
|
||||||
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
R r = chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +237,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheRealtimeData.getAmountCharged(),
|
cacheRealtimeData.getAmountCharged(),
|
||||||
cacheRealtimeData.getOrderNo());
|
cacheRealtimeData.getOrderNo());
|
||||||
chargingController.stopCharging(pileNo, gunId, default_version);
|
chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
|
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================实时数据充电度数:{}, 实时充电金==================停止 充电=================="+pileNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,6 +266,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
cacheOrder.put("abnormal", "1.2 lord as orderData");
|
cacheOrder.put("abnormal", "1.2 lord as orderData");
|
||||||
log.error("abnormal.1.2 order[{}]", orderNo);
|
log.error("abnormal.1.2 order[{}]", orderNo);
|
||||||
}
|
}
|
||||||
|
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================abnormal.1.2 orde==================停止 充电=================="+pileNo);
|
||||||
chargingController.stopCharging(pileNo, gunId, default_version);
|
chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
cacheOrder.put("status", "空闲>2下发中止");
|
cacheOrder.put("status", "空闲>2下发中止");
|
||||||
if (r == null || r.getCode() != 200) {
|
if (r == null || r.getCode() != 200) {
|
||||||
@ -266,6 +281,9 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
REDIS.setCacheMap(orderkey, cacheOrder);
|
REDIS.setCacheMap(orderkey, cacheOrder);
|
||||||
} else {
|
} else {
|
||||||
if (statusInt == 3) {
|
if (statusInt == 3) {
|
||||||
|
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
|
||||||
|
System.out.println("==========================statusInt == 3==================停止 充电=================="+pileNo);
|
||||||
chargingController.stopCharging(pileNo, gunId, default_version);
|
chargingController.stopCharging(pileNo, gunId, default_version);
|
||||||
Integer bpcnt = (Integer) cacheGun.get("pleek.bp.cnt");
|
Integer bpcnt = (Integer) cacheGun.get("pleek.bp.cnt");
|
||||||
cacheGun.put("pleek.bp.cnt", bpcnt==null?1:bpcnt++);
|
cacheGun.put("pleek.bp.cnt", bpcnt==null?1:bpcnt++);
|
||||||
@ -287,12 +305,13 @@ public class RealtimeDataLogic implements ServiceLogic {
|
|||||||
deviceMessage.setContent((String) req.get("hex"));
|
deviceMessage.setContent((String) req.get("hex"));
|
||||||
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
|
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
|
||||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||||
// executorService.execute(new Runnable() {
|
//实时数据推送设备充电中状态变化
|
||||||
// @Override
|
executorService.execute(new Runnable() {
|
||||||
// public void run() {
|
@Override
|
||||||
// evcsService.getNotificationConnectorChargeStatus(orderNo);
|
public void run() {
|
||||||
// }
|
REDIS.setCacheObject("cdjgpc:realTime:"+orderNo,orderNo);
|
||||||
// });
|
}
|
||||||
|
});
|
||||||
return new ServiceResult(false);
|
return new ServiceResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.xhpc.user.controller;
|
||||||
|
|
||||||
|
import com.xhpc.common.api.dto.XhpcChargingStationDto;
|
||||||
|
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.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.common.security.service.TokenService;
|
||||||
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
|
import com.xhpc.user.domain.AuthSetToken;
|
||||||
|
import com.xhpc.user.service.IAuthSetTokenService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/authSetToken")
|
||||||
|
public class AuthSetTokenController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAuthSetTokenService authSetTokenService;
|
||||||
|
@Resource
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@GetMapping("/getList")
|
||||||
|
public TableDataInfo getList(String name) {
|
||||||
|
startPage();
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
|
List<Map<String, Object>> list = authSetTokenService.getList(name, tenantId);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getById")
|
||||||
|
public R getById(@RequestParam("id")Long id){
|
||||||
|
return R.ok(authSetTokenService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/insertAuthSetToken")
|
||||||
|
public R insertAuthSetToken(@RequestBody AuthSetToken authSetToken) {
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
|
authSetToken.setTenantId(tenantId);
|
||||||
|
authSetTokenService.insertAuthSetToken(authSetToken);
|
||||||
|
return R.ok(null,"操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/updateAuthSetToken")
|
||||||
|
public R updateAuthSetToken(@RequestBody AuthSetToken authSetToken) {
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
String tenantId = loginUser.getTenantId();
|
||||||
|
authSetToken.setTenantId(tenantId);
|
||||||
|
authSetTokenService.updateAuthSetToken(authSetToken);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.xhpc.user.domain;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "ET_AUTH_SEC_TOKEN")
|
||||||
|
public class AuthSetToken {
|
||||||
|
|
||||||
|
public final static String SECRET_TOKEN_TYPE_IN = "IN";
|
||||||
|
public final static String SECRET_TOKEN_TYPE_OUT = "OUT";
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商/平台OperatorID
|
||||||
|
*/
|
||||||
|
private String operatorId;
|
||||||
|
/**
|
||||||
|
* 第三方OperatorID
|
||||||
|
*/
|
||||||
|
private String operatorId3irdpty;
|
||||||
|
/**
|
||||||
|
* token类型 - IN:第三方访问我平台时生成使用,OUT:我平台访问第三方时使用
|
||||||
|
*/
|
||||||
|
private String secretTokenType;
|
||||||
|
/**
|
||||||
|
* evcs程序运行时生成使用的鉴权token
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* token有效时间
|
||||||
|
*/
|
||||||
|
private Date tokenExpiry;
|
||||||
|
/**
|
||||||
|
*Data Secret加密参数,参考EVCS文档第4部分
|
||||||
|
*/
|
||||||
|
private String dataSecret;
|
||||||
|
/**
|
||||||
|
* Data SecretIV加密参数,参考EVCS文档第4部分
|
||||||
|
*/
|
||||||
|
private String dataSecretIV;
|
||||||
|
/**
|
||||||
|
* Operator Secret加密参数,参考EVCS文档第4部分
|
||||||
|
*/
|
||||||
|
private String operatorSecret;
|
||||||
|
/**encrypt
|
||||||
|
* Sig Secret加密参数,参考EVCS文档第4部分
|
||||||
|
*/
|
||||||
|
private String sigSecret;
|
||||||
|
/**
|
||||||
|
*Data SecretIV加密参数,参考EVCS文档第4部分
|
||||||
|
*/
|
||||||
|
private String urlPrefix;
|
||||||
|
/**
|
||||||
|
*是平台推送的订单的截止订单号
|
||||||
|
*/
|
||||||
|
private Long lastPushOrder;
|
||||||
|
/**
|
||||||
|
*是否加密 1:是 0:否
|
||||||
|
*/
|
||||||
|
private Integer encrypt;
|
||||||
|
/**
|
||||||
|
*租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.xhpc.user.mapper;
|
||||||
|
|
||||||
|
import com.xhpc.user.domain.AuthSetToken;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface AuthSetTokenMapper {
|
||||||
|
|
||||||
|
List<Map<String,Object>> getList(@Param("name") String name, @Param ("tenantId") String tenantId);
|
||||||
|
|
||||||
|
Map<String,Object> getById(@Param("id") Long id);
|
||||||
|
|
||||||
|
void insertAuthSetToken(AuthSetToken authSetToken);
|
||||||
|
|
||||||
|
void updateAuthSetToken(AuthSetToken authSetToken);
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.xhpc.user.service;
|
||||||
|
|
||||||
|
import com.xhpc.user.domain.AuthSetToken;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface IAuthSetTokenService {
|
||||||
|
|
||||||
|
List<Map<String,Object>> getList(String name,String tenantId);
|
||||||
|
|
||||||
|
Map<String,Object> getById(Long id);
|
||||||
|
|
||||||
|
void insertAuthSetToken(AuthSetToken authSetToken);
|
||||||
|
|
||||||
|
void updateAuthSetToken(AuthSetToken authSetToken);
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.xhpc.user.service.impl;
|
||||||
|
|
||||||
|
import com.xhpc.user.domain.AuthSetToken;
|
||||||
|
import com.xhpc.user.mapper.AuthSetTokenMapper;
|
||||||
|
import com.xhpc.user.service.IAuthSetTokenService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AuthSetTokenServiceImpl implements IAuthSetTokenService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
AuthSetTokenMapper authSetTokenMapper;
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getList(String name, String tenantId) {
|
||||||
|
return authSetTokenMapper.getList(name,tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getById(Long id) {
|
||||||
|
Map<String, Object> byId = authSetTokenMapper.getById(id);
|
||||||
|
return byId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertAuthSetToken(AuthSetToken authSetToken) {
|
||||||
|
if(authSetToken.getId() !=null){
|
||||||
|
authSetTokenMapper.updateAuthSetToken(authSetToken);
|
||||||
|
}else{
|
||||||
|
authSetTokenMapper.insertAuthSetToken(authSetToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAuthSetToken(AuthSetToken authSetToken) {
|
||||||
|
authSetTokenMapper.updateAuthSetToken(authSetToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
<?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.user.mapper.AuthSetTokenMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.xhpc.user.domain.AuthSetToken" id="AuthSetTokenResult">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<result column="name" property="name"/>
|
||||||
|
<result column="operator_id" property="operatorId"/>
|
||||||
|
<result column="operator_id3irdpty" property="operatorId3irdpty"/>
|
||||||
|
<result column="secret_token_type" property="secretTokenType"/>
|
||||||
|
<result column="token" property="token"/>
|
||||||
|
<result column="token_expiry" property="tokenExpiry"/>
|
||||||
|
<result column="data_secret" property="dataSecret"/>
|
||||||
|
<result column="data_secretiv" property="dataSecretIV"/>
|
||||||
|
<result column="operator_secret" property="operatorSecret"/>
|
||||||
|
<result column="sig_secret" property="sigSecret"/>
|
||||||
|
<result column="encrypt" property="encrypt"/>
|
||||||
|
<result column="url_prefix" property="urlPrefix"/>
|
||||||
|
<result column="last_push_order" property="lastPushOrder"/>
|
||||||
|
<result column="tenant_id" property="tenantId"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getList" resultType="map">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
operator_id as operatorId,
|
||||||
|
operator_id3irdpty as operatorId3irdpty,
|
||||||
|
secret_token_type as secretTokenType,
|
||||||
|
token as token,
|
||||||
|
token_expiry as tokenExpiry,
|
||||||
|
data_secret as dataSecret,
|
||||||
|
data_secretiv as dataSecretIV,
|
||||||
|
operator_secret as operatorSecret,
|
||||||
|
sig_secret as sigSecret,
|
||||||
|
encrypt as encrypt,
|
||||||
|
case when encrypt=0 then '否' when encrypt=1 then '是' else '未知' end as
|
||||||
|
'encryptName',
|
||||||
|
url_prefix as urlPrefix,
|
||||||
|
last_push_order as lastPushOrder,
|
||||||
|
tenant_id as tenantId
|
||||||
|
from et_auth_sec_token
|
||||||
|
where tenant_id =#{tenantId}
|
||||||
|
<if test="name !=null and ''!=name">
|
||||||
|
and name like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getById" resultType="map">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
operator_id as operatorId,
|
||||||
|
operator_id3irdpty as operatorId3irdpty,
|
||||||
|
secret_token_type as secretTokenType,
|
||||||
|
token as token,
|
||||||
|
token_expiry as tokenExpiry,
|
||||||
|
data_secret as dataSecret,
|
||||||
|
data_secretiv as dataSecretIV,
|
||||||
|
operator_secret as operatorSecret,
|
||||||
|
sig_secret as sigSecret,
|
||||||
|
case when encrypt=0 then 0 when encrypt=1 then 1 else '未知' end as 'encrypt',
|
||||||
|
url_prefix as urlPrefix,
|
||||||
|
last_push_order as lastPushOrder,
|
||||||
|
tenant_id as tenantId
|
||||||
|
from et_auth_sec_token
|
||||||
|
where id =#{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateAuthSetToken">
|
||||||
|
UPDATE et_auth_sec_token
|
||||||
|
<set>
|
||||||
|
<if test="null != name and '' != name">name = #{name},</if>
|
||||||
|
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
|
||||||
|
<if test="null != operatorId3irdpty and '' != operatorId3irdpty">operator_id3irdpty = #{operatorId3irdpty},</if>
|
||||||
|
<if test="null != secretTokenType and '' != secretTokenType">secret_token_type = #{secretTokenType},</if>
|
||||||
|
<if test="null != token and '' != token">token = #{token},</if>
|
||||||
|
<if test="null != dataSecret and '' != dataSecret">data_secret = #{dataSecret},</if>
|
||||||
|
<if test="null != dataSecretIV and '' != dataSecretIV"> data_secretiv=#{dataSecretIV},</if>
|
||||||
|
<if test="null != operatorSecret and '' != operatorSecret">operator_secret = #{operatorSecret},</if>
|
||||||
|
<if test="null != sigSecret and '' != sigSecret">sig_secret = #{sigSecret},</if>
|
||||||
|
<if test="null != encrypt">encrypt = #{encrypt},</if>
|
||||||
|
<if test="null != urlPrefix and ''!=urlPrefix ">url_prefix = #{urlPrefix},</if>
|
||||||
|
<if test="null != lastPushOrder and '' != lastPushOrder">last_push_order = #{lastPushOrder},</if>
|
||||||
|
<if test="null != tenantId and '' != tenantId">tenant_id = #{tenantId},</if>
|
||||||
|
</set>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertAuthSetToken">
|
||||||
|
insert into et_auth_sec_token(
|
||||||
|
<if test="null != name and '' != name">name,</if>
|
||||||
|
<if test="null != operatorId and '' != operatorId">operator_id,</if>
|
||||||
|
<if test="null != operatorId3irdpty and '' != operatorId3irdpty">operator_id3irdpty,</if>
|
||||||
|
<if test="null != secretTokenType and '' != secretTokenType">secret_token_type ,</if>
|
||||||
|
<if test="null != token and '' != token">token ,</if>
|
||||||
|
<if test="null != dataSecret and '' != dataSecret">data_secret,</if>
|
||||||
|
<if test="null != dataSecretIV and '' != dataSecretIV">data_secretiv,</if>
|
||||||
|
<if test="null != operatorSecret and '' != operatorSecret">operator_secret,</if>
|
||||||
|
<if test="null != sigSecret and '' != sigSecret">sig_secret ,</if>
|
||||||
|
<if test="null != encrypt">encrypt,</if>
|
||||||
|
<if test="null != urlPrefix and ''!=urlPrefix ">url_prefix,</if>
|
||||||
|
<if test="null != tenantId and '' != tenantId">tenant_id,</if>
|
||||||
|
token_expiry
|
||||||
|
)values(
|
||||||
|
<if test="null != name and '' != name">#{name},</if>
|
||||||
|
<if test="null != operatorId and '' != operatorId"> #{operatorId},</if>
|
||||||
|
<if test="null != operatorId3irdpty and '' != operatorId3irdpty">#{operatorId3irdpty},</if>
|
||||||
|
<if test="null != secretTokenType and '' != secretTokenType">#{secretTokenType},</if>
|
||||||
|
<if test="null != token and '' != token"> #{token},</if>
|
||||||
|
<if test="null != tokenExpiry and '' != tokenExpiry">#{tokenExpiry},</if>
|
||||||
|
<if test="null != dataSecret and '' != dataSecret"> #{dataSecret},</if>
|
||||||
|
<if test="null != dataSecretIV and '' != dataSecretIV"> #{dataSecretIV},</if>
|
||||||
|
<if test="null != operatorSecret and '' != operatorSecret"> #{operatorSecret},</if>
|
||||||
|
<if test="null != sigSecret and '' != sigSecret"> #{sigSecret},</if>
|
||||||
|
<if test="null != encrypt"> #{encrypt},</if>
|
||||||
|
<if test="null != urlPrefix and ''!=urlPrefix ">#{urlPrefix},</if>
|
||||||
|
<if test="null != tenantId and '' != tenantId"> #{tenantId},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -1,14 +1,19 @@
|
|||||||
package com.xhpc.wxma.controller;
|
package com.xhpc.wxma.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.wxma.socket.OrderNotificationWebSocket;
|
import com.xhpc.wxma.socket.OrderNotificationWebSocket;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yuyang
|
* @author yuyang
|
||||||
* @date 2021/8/11 17:47
|
* @date 2021/8/11 17:47
|
||||||
@ -16,6 +21,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
public class OrderNotificationWebSocketController extends BaseController {
|
public class OrderNotificationWebSocketController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(OrderNotificationWebSocketController.class);
|
private static final Logger logger = LoggerFactory.getLogger(OrderNotificationWebSocketController.class);
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
public void test(@RequestParam String userId){
|
public void test(@RequestParam String userId){
|
||||||
@ -29,5 +37,19 @@ public class OrderNotificationWebSocketController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDituNumber")
|
||||||
|
public void getDituNumber(){
|
||||||
|
String format = DateUtil.format(new Date(), "yyyyMMdd");
|
||||||
|
|
||||||
|
if(redisService.getCacheObject("global:" + format) !=null){
|
||||||
|
String number = redisService.getCacheObject("global:" + format).toString();
|
||||||
|
int numbers =Integer.parseInt(number);
|
||||||
|
numbers++;
|
||||||
|
redisService.setCacheObject("global:"+format, numbers);
|
||||||
|
}else{
|
||||||
|
redisService.setCacheObject("global:"+format, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user