修改场站添加、场站桩功率统计、下载
This commit is contained in:
parent
da03b8d826
commit
e3211646af
@ -63,4 +63,22 @@ public class AuthSecretToken {
|
||||
this.lastPushOrder = lastPushOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthSecretToken{" +
|
||||
"id=" + id +
|
||||
", operatorId='" + operatorId + '\'' +
|
||||
", operatorId3irdpty='" + operatorId3irdpty + '\'' +
|
||||
", urlPrefix='" + urlPrefix + '\'' +
|
||||
", secretTokenType='" + secretTokenType + '\'' +
|
||||
", operatorSecret='" + operatorSecret + '\'' +
|
||||
", sigSecret='" + sigSecret + '\'' +
|
||||
", dataSecret='" + dataSecret + '\'' +
|
||||
", dataSecretIV='" + dataSecretIV + '\'' +
|
||||
", token='" + token + '\'' +
|
||||
", tokenExpiry=" + tokenExpiry +
|
||||
", encrypt=" + encrypt +
|
||||
", lastPushOrder=" + lastPushOrder +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -86,7 +87,6 @@ public class CDChargeOrderInfo4BonusReq {
|
||||
private ChargeDetails[] chargeDetails;
|
||||
|
||||
public CDChargeOrderInfo4BonusReq(XhpcHistoryOrder xhpcHistoryOrder, EtOrderMapping etOrderMapping) {
|
||||
|
||||
this.startChargeSeq = etOrderMapping.getEvcsOrderNo();
|
||||
this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16);
|
||||
this.endTime = DateUtil.date2String(xhpcHistoryOrder.getEndTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
@ -96,7 +96,28 @@ public class CDChargeOrderInfo4BonusReq {
|
||||
this.totalElecMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
this.totalSeviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
|
||||
this.totalMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if(xhpcHistoryOrder.getStopReasonEvcs() !=null){
|
||||
String stopReasonEvcs = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if("40".equals(stopReasonEvcs)||"0".equals(stopReasonEvcs)||"00".equals(stopReasonEvcs)||"45".equals(stopReasonEvcs)||"APP 远程停止".equals(stopReasonEvcs)
|
||||
||"72".equals(stopReasonEvcs)){
|
||||
this.stopReason =0;
|
||||
}else if("41".equals(stopReasonEvcs) ||"42".equals(stopReasonEvcs)||"43".equals(stopReasonEvcs)||"44".equals(stopReasonEvcs)||"4E".equals(stopReasonEvcs)||"平台停止".equals(stopReasonEvcs)){
|
||||
this.stopReason =1;
|
||||
}else if("4A".equals(stopReasonEvcs) ||"4B".equals(stopReasonEvcs)||"4C".equals(stopReasonEvcs)||"4D".equals(stopReasonEvcs)||"4F".equals(stopReasonEvcs) ||
|
||||
"55".equals(stopReasonEvcs)||"57".equals(stopReasonEvcs)||"62".equals(stopReasonEvcs)||"63".equals(stopReasonEvcs)||"74".equals(stopReasonEvcs)||"75".equals(stopReasonEvcs)
|
||||
||"78".equals(stopReasonEvcs)||"79".equals(stopReasonEvcs)||"7A".equals(stopReasonEvcs)||"7B".equals(stopReasonEvcs)||"7C".equals(stopReasonEvcs)||"7D".equals(stopReasonEvcs)
|
||||
||"7E".equals(stopReasonEvcs)||"7F".equals(stopReasonEvcs)||"83".equals(stopReasonEvcs)){
|
||||
this.stopReason =3;
|
||||
}else if("5A".equals(stopReasonEvcs)||"82".equals(stopReasonEvcs)){
|
||||
this.stopReason =2;
|
||||
}else if("6B".equals(stopReasonEvcs) ||"6D".equals(stopReasonEvcs)||"5E".equals(stopReasonEvcs)){
|
||||
this.stopReason =4;
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
this.sumPeriod = xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList().size();
|
||||
this.chargeDetails = translate(xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList());
|
||||
this.userName = xhpcHistoryOrder.getUserNameEvcs();
|
||||
@ -110,8 +131,21 @@ public class CDChargeOrderInfo4BonusReq {
|
||||
cl = Math.toIntExact((endtime.getTime() - starttime.getTime()) / 1000);
|
||||
}
|
||||
this.chargeLast = Math.abs(cl);
|
||||
this.meterValueStart = xhpcHistoryOrder.getMeterValueStartEvcs();
|
||||
this.meterValueEnd = xhpcHistoryOrder.getMeterValueEndEvcs();
|
||||
if(xhpcHistoryOrder.getMeterValueStartEvcs() !=null && xhpcHistoryOrder.getMeterValueStartEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueStartEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueStart =Double.parseDouble(df.format(v));
|
||||
}else{
|
||||
this.meterValueStart = xhpcHistoryOrder.getMeterValueStartEvcs();
|
||||
}
|
||||
if(xhpcHistoryOrder.getMeterValueEndEvcs() !=null && xhpcHistoryOrder.getMeterValueEndEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueEndEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueEnd =Double.parseDouble(df.format(v));
|
||||
} else{
|
||||
this.meterValueEnd = xhpcHistoryOrder.getMeterValueEndEvcs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ChargeDetails[] translate(List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList) {
|
||||
|
||||
@ -13,6 +13,7 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS;
|
||||
@ -76,6 +77,12 @@ public class ChargeOrderInfo {
|
||||
private Integer stopReason;
|
||||
@JsonProperty("SumPeriod")
|
||||
private Integer sumPeriod;
|
||||
@JsonProperty("MeterValueStart")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
private Double meterValueStart = 0.0;
|
||||
@JsonProperty("MeterValueEnd")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
private Double meterValueEnd = 0.0;
|
||||
@JsonProperty("ChargeDetails")
|
||||
private ChargeDetails[] chargeDetails;
|
||||
@JsonIgnore
|
||||
@ -95,7 +102,28 @@ public class ChargeOrderInfo {
|
||||
this.totalElecMoney = xhpcHistoryOrder.getPowerPriceTotal().doubleValue();
|
||||
this.totalSeviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
|
||||
this.totalMoney = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if(xhpcHistoryOrder.getStopReasonEvcs() !=null){
|
||||
String stopReasonEvcs = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if("40".equals(stopReasonEvcs)||"0".equals(stopReasonEvcs)||"00".equals(stopReasonEvcs)||"45".equals(stopReasonEvcs)||"APP 远程停止".equals(stopReasonEvcs)
|
||||
||"72".equals(stopReasonEvcs)){
|
||||
this.stopReason =0;
|
||||
}else if("41".equals(stopReasonEvcs) ||"42".equals(stopReasonEvcs)||"43".equals(stopReasonEvcs)||"44".equals(stopReasonEvcs)||"4E".equals(stopReasonEvcs)||"平台停止".equals(stopReasonEvcs)){
|
||||
this.stopReason =1;
|
||||
}else if("4A".equals(stopReasonEvcs) ||"4B".equals(stopReasonEvcs)||"4C".equals(stopReasonEvcs)||"4D".equals(stopReasonEvcs)||"4F".equals(stopReasonEvcs) ||
|
||||
"55".equals(stopReasonEvcs)||"57".equals(stopReasonEvcs)||"62".equals(stopReasonEvcs)||"63".equals(stopReasonEvcs)||"74".equals(stopReasonEvcs)||"75".equals(stopReasonEvcs)
|
||||
||"78".equals(stopReasonEvcs)||"79".equals(stopReasonEvcs)||"7A".equals(stopReasonEvcs)||"7B".equals(stopReasonEvcs)||"7C".equals(stopReasonEvcs)||"7D".equals(stopReasonEvcs)
|
||||
||"7E".equals(stopReasonEvcs)||"7F".equals(stopReasonEvcs)||"83".equals(stopReasonEvcs)){
|
||||
this.stopReason =3;
|
||||
}else if("5A".equals(stopReasonEvcs)||"82".equals(stopReasonEvcs)){
|
||||
this.stopReason =2;
|
||||
}else if("6B".equals(stopReasonEvcs) ||"6D".equals(stopReasonEvcs)||"5E".equals(stopReasonEvcs)){
|
||||
this.stopReason =4;
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
this.sumPeriod = xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList().size();
|
||||
this.chargeDetails = calcemChargeDetails;//translate(xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList());
|
||||
Date starttime = xhpcHistoryOrder.getStartTime();
|
||||
@ -107,7 +135,6 @@ public class ChargeOrderInfo {
|
||||
}
|
||||
|
||||
public ChargeOrderInfo(XhpcHistoryOrder xhpcHistoryOrder) {
|
||||
|
||||
this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16);
|
||||
this.startChargeSeq = xhpcHistoryOrder.getInternetSerialNumber();
|
||||
this.endTime = DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, xhpcHistoryOrder.getEndTime());
|
||||
@ -123,6 +150,39 @@ public class ChargeOrderInfo {
|
||||
final BigDecimal totalPrice = xhpcHistoryOrder.getTotalPrice();
|
||||
this.totalMoney = totalPrice == null ? 0.0 : totalPrice.doubleValue();
|
||||
//this.stopReason = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if(xhpcHistoryOrder.getStopReasonEvcs() !=null){
|
||||
String stopReasonEvcs = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if("41".equals(stopReasonEvcs) ||"42".equals(stopReasonEvcs)||"43".equals(stopReasonEvcs)||"44".equals(stopReasonEvcs)||"4E".equals(stopReasonEvcs)||"平台停止".equals(stopReasonEvcs)){
|
||||
this.stopReason =1;
|
||||
}else if("4A".equals(stopReasonEvcs) ||"4B".equals(stopReasonEvcs)||"4C".equals(stopReasonEvcs)||"4D".equals(stopReasonEvcs)||"4F".equals(stopReasonEvcs) ||
|
||||
"55".equals(stopReasonEvcs)||"57".equals(stopReasonEvcs)||"62".equals(stopReasonEvcs)||"63".equals(stopReasonEvcs)||"74".equals(stopReasonEvcs)||"75".equals(stopReasonEvcs)
|
||||
||"78".equals(stopReasonEvcs)||"79".equals(stopReasonEvcs)||"7A".equals(stopReasonEvcs)||"7B".equals(stopReasonEvcs)||"7C".equals(stopReasonEvcs)||"7D".equals(stopReasonEvcs)
|
||||
||"7E".equals(stopReasonEvcs)||"7F".equals(stopReasonEvcs)||"83".equals(stopReasonEvcs)){
|
||||
this.stopReason =3;
|
||||
}else if("5A".equals(stopReasonEvcs)||"82".equals(stopReasonEvcs)){
|
||||
this.stopReason =2;
|
||||
}else if("6B".equals(stopReasonEvcs) ||"6D".equals(stopReasonEvcs)||"5E".equals(stopReasonEvcs)){
|
||||
this.stopReason =4;
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
if(xhpcHistoryOrder.getMeterValueStartEvcs() !=null && xhpcHistoryOrder.getMeterValueStartEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueStartEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueStart =Double.parseDouble(df.format(v));
|
||||
}else{
|
||||
this.meterValueStart =0.00;
|
||||
}
|
||||
if(xhpcHistoryOrder.getMeterValueEndEvcs() !=null && xhpcHistoryOrder.getMeterValueEndEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueEndEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueEnd =Double.parseDouble(df.format(v));
|
||||
} else{
|
||||
this.meterValueEnd = 0.00;
|
||||
}
|
||||
final List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList =
|
||||
xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList();
|
||||
this.sumPeriod = xhpcStatisticsTimeIntervalList == null ? 0 : xhpcStatisticsTimeIntervalList.size();
|
||||
@ -301,11 +361,28 @@ public class ChargeOrderInfo {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return new ToStringBuilder(this).append("startChargeSeq", startChargeSeq).append("connectorID", connectorID).append(
|
||||
"startTime", startTime).append("endTime", endTime).append("totalPower", totalPower).append("totalElecMoney",
|
||||
totalElecMoney).append("totalSeviceMoney", totalSeviceMoney).append("totalMoney", totalMoney).append(
|
||||
"stopReason", stopReason).append("sumPeriod", sumPeriod).append("additionalProperties",
|
||||
additionalProperties).toString();
|
||||
return "ChargeOrderInfo{" +
|
||||
"startChargeSeq='" + startChargeSeq + '\'' +
|
||||
", startChargeSeqStat=" + startChargeSeqStat +
|
||||
", failReason=" + failReason +
|
||||
", identCode='" + identCode + '\'' +
|
||||
", infraOperatorId='" + infraOperatorId + '\'' +
|
||||
", billerOperatorId='" + billerOperatorId + '\'' +
|
||||
", connectorID='" + connectorID + '\'' +
|
||||
", startTime='" + startTime + '\'' +
|
||||
", chargeModel=" + chargeModel +
|
||||
", vin='" + vin + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
", totalPower=" + totalPower +
|
||||
", totalElecMoney=" + totalElecMoney +
|
||||
", totalSeviceMoney=" + totalSeviceMoney +
|
||||
", totalMoney=" + totalMoney +
|
||||
", stopReason=" + stopReason +
|
||||
", sumPeriod=" + sumPeriod +
|
||||
", meterValueStart=" + meterValueStart +
|
||||
", meterValueEnd=" + meterValueEnd +
|
||||
", chargeDetails=" + Arrays.toString(chargeDetails) +
|
||||
", additionalProperties=" + additionalProperties +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,4 +75,13 @@ public class ChargeOrderInfoResponse {
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChargeOrderInfoResponse{" +
|
||||
"startChargeSeq='" + startChargeSeq + '\'' +
|
||||
", connectorID='" + connectorID + '\'' +
|
||||
", confirmResult=" + confirmResult +
|
||||
", additionalProperties=" + additionalProperties +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,4 +57,5 @@ public class CommonRequest<T> {
|
||||
return JSONUtil.readParams(jsonNode.toString(), clz);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,12 @@ import java.io.IOException;
|
||||
@RestController()
|
||||
public class CheckChargeOrderController {
|
||||
|
||||
/**
|
||||
* 推送订单核对结果信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/check_charge_orders")
|
||||
public CommonResponse check_charge_orders(@RequestBody CommonRequest<CheckChargeOrderRequestData> commonRequest) throws IOException {
|
||||
//todo 正在开发
|
||||
|
||||
@ -2,8 +2,11 @@ package com.xhpc.evcs.api;
|
||||
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.notification.NotificationChargeOrderInfoTask;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -14,9 +17,15 @@ import java.io.IOException;
|
||||
@RestController()
|
||||
public class NotificationChargeOrderInfoController {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoController.class);
|
||||
/**
|
||||
* 推送充电订单信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/notification_charge_order_info")
|
||||
public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest) throws IOException {
|
||||
|
||||
String operatorID = commonRequest.getOperatorId();
|
||||
StationInfo stationInfo = new StationInfo();
|
||||
stationInfo.setOperatorId(operatorID);
|
||||
|
||||
@ -22,6 +22,12 @@ public class NotificationStartChargeResultController {
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
|
||||
/**
|
||||
* 推送启动充电结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/notification_start_charge_result")
|
||||
public CommonResponse notifyStartChargeResult(@RequestBody CommonRequest<NotificationStartChargeResultRequestData> commonRequest) throws IOException {
|
||||
|
||||
|
||||
@ -12,6 +12,12 @@ import java.io.IOException;
|
||||
@RestController()
|
||||
public class NotificationStationStatusController {
|
||||
|
||||
/**
|
||||
* 设备状态变化推送
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/notification_stationStatus")
|
||||
public CommonResponse notificationStationStatus(@RequestBody CommonRequest<ConnectorStatusInfo> commonRequest) throws IOException {
|
||||
|
||||
|
||||
@ -22,6 +22,12 @@ public class NotificationStopChargeResultController {
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
|
||||
/**
|
||||
* 推送停止充电结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/notification_stop_charge_result")
|
||||
public CommonResponse notifyStartChargeResult(@RequestBody CommonRequest<NotificationStopChargeResultRequestData> commonRequest) throws IOException {
|
||||
|
||||
|
||||
@ -35,6 +35,12 @@ public class QueryEquipAuthController {
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v1/query_equip_auth")
|
||||
public CommonResponse queryEquipAuth(@RequestBody CommonRequest<EquipAuthRequest> commonRequest) throws Exception {
|
||||
|
||||
|
||||
@ -25,6 +25,12 @@ public class QueryEquipBusinessPolicyController {
|
||||
@Autowired
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
|
||||
/**
|
||||
* 查询业务策略信息结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_equip_business_policy")
|
||||
public CommonResponse queryEquipBusinessPolicy(@RequestBody CommonRequest<EquipBizRequest> commonRequest) throws IOException {
|
||||
//获取充电设备接口编码(枪编码)
|
||||
|
||||
@ -33,6 +33,12 @@ public class QueryEquipChargeStatusController {
|
||||
@Autowired
|
||||
OrderMappingRepository orderMappingRepository;
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_equip_charge_status")
|
||||
public CommonResponse queryEquipChargeStatus(@RequestBody CommonRequest<ChargeInfoRequest> commonRequest) throws IOException {
|
||||
//创建数据实体类
|
||||
|
||||
@ -45,6 +45,12 @@ public class QueryStartChargeController {
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v1/query_start_charge")
|
||||
public CommonResponse queryStartCharge(@RequestBody CommonRequest<StartChargeRequest> commonRequest) throws Exception {
|
||||
|
||||
|
||||
@ -34,6 +34,12 @@ public class QueryStationStatusController {
|
||||
@Resource
|
||||
XhpcTerminalRepository terminalRepository;
|
||||
|
||||
/**
|
||||
* 设备接口状态查询
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v1/query_station_status")
|
||||
public CommonResponse queryStationsInfo(@RequestBody CommonRequest<StationStatusRequest> commonRequest) throws Exception {
|
||||
|
||||
|
||||
@ -43,6 +43,12 @@ public class QueryStationsInfoController {
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
private final String[] GUNNAMES = {"", "A", "B", "C", "D"};
|
||||
|
||||
/**
|
||||
* 查询充电站信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v1/query_stations_info")
|
||||
public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest) throws Exception {
|
||||
|
||||
@ -70,6 +76,7 @@ public class QueryStationsInfoController {
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
|
||||
@ -38,6 +38,12 @@ public class QueryStopChargeController {
|
||||
@Autowired
|
||||
private XhpcChargingPileRepository XhpcChargingPileRepository;
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_stop_charge")
|
||||
public CommonResponse queryStopCharge(@RequestBody CommonRequest<QueryStopChargeRequest> commonRequest) throws IOException {
|
||||
|
||||
|
||||
@ -36,6 +36,13 @@ public class QueryTokenController {
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
|
||||
/**
|
||||
* 用于平台之间认证Token的申请
|
||||
* @param encout
|
||||
* @param tokenRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_token")
|
||||
public CommonResponse queryToken(@RequestHeader(value = "enc.out", defaultValue = "true") String encout,
|
||||
@RequestBody TokenRequest tokenRequest) throws IOException {
|
||||
|
||||
@ -17,6 +17,8 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -43,6 +45,8 @@ public class CoreDispatcher {
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
public static final okhttp3.MediaType JSON = okhttp3.MediaType.parse("application/json; charset=utf-8");
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CoreDispatcher.class);
|
||||
|
||||
@Transactional
|
||||
public String ok(Object object, String url, AuthSecretToken authSecretTokenOut) {
|
||||
|
||||
@ -51,7 +55,6 @@ public class CoreDispatcher {
|
||||
|
||||
@Transactional
|
||||
public String ok(Object object, String url, AuthSecretToken authSecretTokenOut, String stationOperatorId) {
|
||||
|
||||
if (authSecretTokenOut == null) {
|
||||
log.error("authSecretTokenOut is null");
|
||||
throw new RuntimeException();
|
||||
@ -115,12 +118,15 @@ public class CoreDispatcher {
|
||||
// log.debug("notify out encrypt data:\n{}", tData);
|
||||
}
|
||||
body = okhttp3.RequestBody.create(JSON, tData);
|
||||
// logger.info("==============平台推送值================="+tData);
|
||||
}
|
||||
|
||||
} catch (JsonProcessingException | BadPaddingException | InvalidAlgorithmParameterException | NoSuchAlgorithmException | IllegalBlockSizeException | NoSuchPaddingException | InvalidKeyException e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg);
|
||||
throw new ServerInternalException(msg);
|
||||
}
|
||||
|
||||
final Request.Builder req = new Request.Builder()
|
||||
.url(authSecretTokenOut.getUrlPrefix() + url)
|
||||
.header("Authorization", "Bearer " + bearerToken);
|
||||
|
||||
@ -40,9 +40,12 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
||||
private XhpcChargingStationRepository chargingStationRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||
|
||||
/**
|
||||
* 推送充电订单信息(运营奖补)
|
||||
* @throws IOException
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"765367656", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
@ -71,7 +74,6 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
||||
}
|
||||
|
||||
public boolean notify(XhpcHistoryOrder xhpcHistoryOrder, AuthSecretToken authSecretTokenOut, boolean isRepush) throws IOException {
|
||||
|
||||
String operatorIdEvcs = xhpcHistoryOrder.getOperatorIdEvcs();
|
||||
if (operatorIdEvcs == null) {
|
||||
Long chargingStationId = xhpcHistoryOrder.getChargingStationId();
|
||||
|
||||
@ -39,7 +39,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
@ -81,6 +81,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
horder.setConfirmResult(pushResp.getConfirmResult());
|
||||
logger.debug("3rd part order {} push result: {}", horder.getSerialNumber(),
|
||||
pushResp.getConfirmResult());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
xhpcHistoryOrderRepository.save(horder);
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true);
|
||||
} else {
|
||||
|
||||
@ -44,7 +44,11 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationEquipChargeStatusTask.class);
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 50)
|
||||
/**
|
||||
* 推送充电状态
|
||||
* @throws IOException
|
||||
*/
|
||||
//@Scheduled(fixedRate = 1000 * 50)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
|
||||
@ -33,7 +33,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
/**
|
||||
* Judging the 3rd whether it has got the start charging task.
|
||||
*/
|
||||
@Scheduled(fixedRate = 1000 * 3)
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws IOException {
|
||||
|
||||
//Getting the charge orders which from 3rd.
|
||||
|
||||
@ -49,7 +49,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 45)
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
@ -95,7 +95,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
connectorStatusInfo.setConnectorID(gunId);
|
||||
connectorStatusInfo.setOperatorID(operatorId);
|
||||
Integer dbStatus = terminalDBMap.get(gunId);
|
||||
if(dbStatus == 0){
|
||||
if(dbStatus !=null && dbStatus == 0){
|
||||
connectorStatusInfo.setStatus(translateStatus(terminalStatusMap.get(gunId)));
|
||||
} else {
|
||||
connectorStatusInfo.setStatus(0);
|
||||
|
||||
@ -26,7 +26,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
@Scheduled(fixedRate = 1000 * 3)
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
|
||||
1
pom.xml
1
pom.xml
@ -38,6 +38,7 @@
|
||||
<common-pool.version>2.6.2</common-pool.version>
|
||||
<commons-collections.version>3.2.2</commons-collections.version>
|
||||
<alipay.sdk>4.22.37.ALL</alipay.sdk>
|
||||
<alipay.sdk.message>4.22.37.ALL</alipay.sdk.message>
|
||||
<commons-beanutils.sdk>1.9.3</commons-beanutils.sdk>
|
||||
</properties>
|
||||
|
||||
|
||||
@ -21,6 +21,31 @@
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>0.2.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>0.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea</artifactId>
|
||||
<version>1.1.14</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
package com.xhpc.auth.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.xhpc.auth.form.LoginBody;
|
||||
import com.xhpc.auth.service.SysLoginService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.api.TenantService;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.exception.BaseException;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
@ -18,11 +19,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.aliyun.tea.*;
|
||||
/**
|
||||
* token 控制
|
||||
*
|
||||
@ -43,11 +45,13 @@ public class TokenController extends BaseController
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
public static final String URL = "http://sms.daiyicloud.com/sms/apiSend/add";
|
||||
public static final String ACCOUNT ="scxhkj";
|
||||
public static final String PASSWD ="6A9628548C4CBECCE80A2479CD77679F";
|
||||
public static final String PRODUCTLD ="20191130000001";
|
||||
|
||||
public static final String accessKeyId = "LTAI5tBWjnuQGxGicnThwMF1";
|
||||
public static final String accessKeySecret = "b0WNtFYtWyTEkZzcr2WOAPoZg6w2Xu";
|
||||
/**
|
||||
* 平台管理员登陆
|
||||
* @param form
|
||||
@ -133,19 +137,32 @@ public class TokenController extends BaseController
|
||||
if(cacheObject !=null){
|
||||
return R.fail("1012","操作过于频繁,请于1分钟后重试");
|
||||
}
|
||||
String req = HttpUtils.postFormData(URL, null, assembleSmsReq(phone,content));
|
||||
JSONObject json = JSONObject.parseObject(req);
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("code", random);
|
||||
paramMap.put("phone", phone);
|
||||
paramMap.put("content", "【小华充电】您的验证码是:" + random + ",有效期为5分钟。如非本人操作,可不用理会。");
|
||||
|
||||
String ok = json.getString("ok");
|
||||
if("true".equals(ok)){
|
||||
com.aliyun.dysmsapi20170525.Client client = createClient();
|
||||
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
|
||||
.setSignName("小华充电")
|
||||
.setTemplateCode("SMS_226786362")
|
||||
.setTemplateParam("{\"code\":\""+random+"\"}")
|
||||
.setPhoneNumbers(phone);
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime);
|
||||
System.out.println("sendSmsResponse:"+sendSmsResponse);
|
||||
redisService.setCacheObject(pvToken,random,300L, TimeUnit.SECONDS);
|
||||
//1分钟有效时间设置,防止用户频繁调用
|
||||
redisService.setCacheObject(token,random,60L, TimeUnit.SECONDS);
|
||||
return R.ok();
|
||||
}else{
|
||||
|
||||
return R.fail(1012,"服务器繁忙,请稍后再试");
|
||||
} catch (Exception error) {
|
||||
// 如有需要,请打印 error
|
||||
//com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
error.printStackTrace();
|
||||
}
|
||||
return R.fail("请联系管理员进行处理");
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
return R.fail(1010,"服务器繁忙,请稍后再试");
|
||||
@ -198,4 +215,19 @@ public class TokenController extends BaseController
|
||||
}
|
||||
return i+"";
|
||||
}
|
||||
|
||||
public static com.aliyun.dysmsapi20170525.Client createClient() throws Exception {
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
// 必填,您的 AccessKey ID
|
||||
.setAccessKeyId(accessKeyId)
|
||||
// 必填,您的 AccessKey Secret
|
||||
.setAccessKeySecret(accessKeySecret);
|
||||
// Endpoint 请参考 https://api.aliyun.com/product/Dysmsapi
|
||||
config.endpoint = "dysmsapi.aliyuncs.com";
|
||||
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -44,8 +44,7 @@ public class SecurityUtils
|
||||
public static String getToken(HttpServletRequest request)
|
||||
{
|
||||
String token = ServletUtils.getRequest().getHeader(CacheConstants.HEADER);
|
||||
System.out.println("=============token=============="+token);
|
||||
System.out.println("=============token=============="+token);
|
||||
//System.out.println("=============token=============="+token);
|
||||
if (StringUtils.isNotEmpty(token) && token.startsWith(CacheConstants.TOKEN_PREFIX))
|
||||
{
|
||||
token = token.replace(CacheConstants.TOKEN_PREFIX, "");
|
||||
|
||||
@ -40,17 +40,17 @@ INSERT INTO `config_info` (`id`, `data_id`, `group_id`, `content`, `md5`, `gmt_c
|
||||
(2, 'ruoyi-gateway-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net \n port: 6379\n password: tingsun@7645313\n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # 充电桩服务\n - id: xhpc-power-pole\n uri: lb://xhpc-power-pole\n predicates:\n - Path=/pp/**\n filters:\n - StripPrefix=1\n # 账号服务\n - id: xhpc-user\n uri: lb://xhpc-user\n predicates:\n - Path=/xhpc-user/**\n filters:\n - StripPrefix=1\n # 支付服务\n - id: xhpc-payment\n uri: lb://xhpc-payment\n predicates:\n - Path=/xhpc-payment/**\n filters:\n - StripPrefix=1\n # 订单服务\n - id: xhpc-order\n uri: lb://xhpc-order\n predicates:\n - Path=/xhpc-order/**\n filters:\n - StripPrefix=1\n\n# 不校验白名单\nignore:\n whites:\n - /auth/logout\n - /auth/login\n - /*/v2/api-docs\n - /csrf\n - /xhpc-user/app/user/jscode2session\n - /xhpc-user/app/user/register\n - /xhpc-user/app/user/login\n - /xhpc-user/app/user/loginOut\n - /xhpc-user/app/user/voluntaryLogin\n - /xhpc-user/app/user/logout\n - /xhpc-user/app/user/alipayEmpower\n - /xhpc-user/app/user/appInfo\n - /xhpc-payment/wx/paymentCallback', '5a3b5371bf88b6b46ffe8271c7cae24c', '2020-05-14 14:17:55', '2021-07-28 07:50:28', 'nacos', '171.88.42.96', '', '', '网关模块', 'null', 'null', 'yaml', 'null'),
|
||||
(3, 'ruoyi-auth-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net \n port: 6379\n password: tingsun@7645313\n', '364ff5f362097c96a2ad12596b5ff9fd', '2020-11-20 00:00:00', '2021-07-23 09:21:25', 'nacos', '0:0:0:0:0:0:0:1', '', '', '认证中心', 'null', 'null', 'yaml', 'null'),
|
||||
(4, 'ruoyi-monitor-dev.yml', 'DEFAULT_GROUP', '# spring\r\nspring: \r\n security:\r\n user:\r\n name: ruoyi\r\n password: 123456\r\n boot:\r\n admin:\r\n ui:\r\n title: 若依服务状态监控\r\n', 'd8997d0707a2fd5d9fc4e8409da38129', '2020-11-20 00:00:00', '2020-12-21 16:28:07', NULL, '0:0:0:0:0:0:0:1', '', '', '监控中心', 'null', 'null', 'yaml', 'null'),
|
||||
(5, 'ruoyi-system-dev.yml', 'DEFAULT_GROUP', '# spring配置\nspring: \n redis:\n host: tingsun-znc.f3322.net \n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n # seata: true # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭\n\n# seata配置\nseata:\n # 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启\n enabled: false\n # Seata 应用编号,默认为 ${spring.application.name}\n application-id: ${spring.application.name}\n # Seata 事务组编号,用于 TC 集群名\n tx-service-group: ${spring.application.name}-group\n # 关闭自动代理\n enable-auto-data-source-proxy: false\n # 服务配置项\n service:\n # 虚拟组和分组的映射\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 172.31.183.135:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 172.31.183.135:8848\n namespace:\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.xhpc\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip', '58d5723fa8c81b12563941261fd7e758', '2020-11-20 00:00:00', '2021-07-28 10:44:08', 'nacos', '0:0:0:0:0:0:0:1', '', '', '系统模块', 'null', 'null', 'yaml', 'null'),
|
||||
(5, 'ruoyi-system-dev.yml', 'DEFAULT_GROUP', '# spring配置\nspring: \n redis:\n host: tingsun-znc.f3322.net \n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n # seata: true # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭\n\n# seata配置\nseata:\n # 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启\n enabled: false\n # Seata 应用编号,默认为 ${spring.application.name}\n application-id: ${spring.application.name}\n # Seata 事务组编号,用于 TC 集群名\n tx-service-group: ${spring.application.name}-group\n # 关闭自动代理\n enable-auto-data-source-proxy: false\n # 服务配置项\n service:\n # 虚拟组和分组的映射\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 127.0.0.1:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 127.0.0.1:8848\n namespace:\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.xhpc\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip', '58d5723fa8c81b12563941261fd7e758', '2020-11-20 00:00:00', '2021-07-28 10:44:08', 'nacos', '0:0:0:0:0:0:0:1', '', '', '系统模块', 'null', 'null', 'yaml', 'null'),
|
||||
(6, 'ruoyi-gen-dev.yml', 'DEFAULT_GROUP', '# spring配置\r\nspring: \r\n redis:\r\n host: tingsun-znc.f3322.net \r\n port: 6379\r\n password: tingsun@7645313\r\n datasource: \r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: ry-cloud\r\n password: xiaohua123\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.xhpc.gen.domain\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n\r\n# swagger配置\r\nswagger:\r\n title: 代码生成接口文档\r\n license: Powered By ruoyi\r\n licenseUrl: https://ruoyi.vip\r\n\r\n# 代码生成\r\ngen: \r\n # 作者\r\n author: ruoyi\r\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\r\n packageName: com.xhpc.system\r\n # 自动去除表前缀,默认是false\r\n autoRemovePre: false\r\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\r\n tablePrefix: sys_\r\n', 'a21c5fa4c7c5731e62453614cf2e7d3f', '2020-11-20 00:00:00', '2021-07-24 14:16:06', NULL, '0:0:0:0:0:0:0:1', '', '', '代码生成', 'null', 'null', 'yaml', 'null'),
|
||||
(7, 'ruoyi-job-dev.yml', 'DEFAULT_GROUP', '# spring配置\nspring: \n redis:\n host: tingsun-znc.f3322.net \n port: 6379\n password: tingsun@7645313\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/quartz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: quartz\n password: quartz123\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.xhpc.job\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n', 'e9233f5ce3b3de95233ad88bb1a4231a', '2020-11-20 00:00:00', '2021-07-29 08:51:36', 'nacos', '0:0:0:0:0:0:0:1', '', '', '定时任务', 'null', 'null', 'yaml', 'null'),
|
||||
(8, 'ruoyi-file-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313 \n jackson:\n date-format: yyyy-MM-dd HH:mm:ss\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 172.31.183.135:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 172.31.183.135:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.file\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n call-setters-on-nulls: true\n\n# 本地文件上传 \nfile:\n domain: http://127.0.0.1:9300\n path: D:/ruoyi/uploadPath\n prefix: /statics\n\n# FastDFS配置\nfdfs:\n domain: http://8.129.231.12\n soTimeout: 3000\n connectTimeout: 2000\n trackerList: 8.129.231.12:22122\n\n# Minio配置\nminio:\n url: http://8.129.231.12:9000\n accessKey: minioadmin\n secretKey: minioadmin\n bucketName: test\n#oss默认配置\noss:\n enabled: true\n name: qiniu\n tenant-mode: true\n endpoint: oss-accelerate.aliyuncs.com\n access-key: LTAIhOKfUxeutGeh\n secret-key: 2TvKIoX03bnP5WRLxtTaEYQufrtbav\n bucket-name: dx-gzxh\n', '435441353d3fbaa4ee8165d6f4b0374b', '2020-11-20 00:00:00', '2021-07-29 02:42:04', 'nacos', '171.88.42.96', '', '', '文件服务', 'null', 'null', 'yaml', 'null'),
|
||||
(8, 'ruoyi-file-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313 \n jackson:\n date-format: yyyy-MM-dd HH:mm:ss\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 127.0.0.1:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 127.0.0.1:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.file\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n call-setters-on-nulls: true\n\n# 本地文件上传 \nfile:\n domain: http://127.0.0.1:9300\n path: D:/ruoyi/uploadPath\n prefix: /statics\n\n# FastDFS配置\nfdfs:\n domain: http://8.129.231.12\n soTimeout: 3000\n connectTimeout: 2000\n trackerList: 8.129.231.12:22122\n\n# Minio配置\nminio:\n url: http://8.129.231.12:9000\n accessKey: minioadmin\n secretKey: minioadmin\n bucketName: test\n#oss默认配置\noss:\n enabled: true\n name: qiniu\n tenant-mode: true\n endpoint: oss-accelerate.aliyuncs.com\n access-key: LTAIhOKfUxeutGeh\n secret-key: 2TvKIoX03bnP5WRLxtTaEYQufrtbav\n bucket-name: dx-gzxh\n', '435441353d3fbaa4ee8165d6f4b0374b', '2020-11-20 00:00:00', '2021-07-29 02:42:04', 'nacos', '171.88.42.96', '', '', '文件服务', 'null', 'null', 'yaml', 'null'),
|
||||
(9, 'sentinel-ruoyi-gateway', 'DEFAULT_GROUP', '[\r\n {\r\n "resource": "ruoyi-auth",\r\n "count": 500,\r\n "grade": 1,\r\n "limitApp": "default",\r\n "strategy": 0,\r\n "controlBehavior": 0\r\n },\r\n {\r\n "resource": "ruoyi-system",\r\n "count": 1000,\r\n "grade": 1,\r\n "limitApp": "default",\r\n "strategy": 0,\r\n "controlBehavior": 0\r\n },\r\n {\r\n "resource": "ruoyi-gen",\r\n "count": 200,\r\n "grade": 1,\r\n "limitApp": "default",\r\n "strategy": 0,\r\n "controlBehavior": 0\r\n },\r\n {\r\n "resource": "ruoyi-job",\r\n "count": 300,\r\n "grade": 1,\r\n "limitApp": "default",\r\n "strategy": 0,\r\n "controlBehavior": 0\r\n }\r\n]', '9f3a3069261598f74220bc47958ec252', '2020-11-20 00:00:00', '2020-11-20 00:00:00', NULL, '0:0:0:0:0:0:0:1', '', '', '限流策略', 'null', 'null', 'json', 'null'),
|
||||
(20, 'xhpc-power-pile-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 172.31.183.135:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 172.31.183.135:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.pp\n mapperLocations: classpath:mapper/**/*.xml\n', 'e1cad28a4df29955413fa360a40a03dc', '2021-07-19 06:40:44', '2021-07-23 09:05:47', 'nacos', '0:0:0:0:0:0:0:1', '', '', '充电桩协议服务', '', '', 'yaml', ''),
|
||||
(22, 'xhpc-charging-station-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 172.31.183.135:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 172.31.183.135:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc\n mapperLocations: classpath:mapper/**/*.xml\n', '5c9e25c8e8775649c0d5dcb5aed95715', '2021-07-19 08:22:12', '2021-07-28 08:51:17', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', ''),
|
||||
(23, 'xhpc-general-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 172.31.183.135:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 172.31.183.135:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.general\n mapperLocations: classpath:mapper/**/*.xml\n', 'c31f612a8d2c67dc69888b7c02bae5d0', '2021-07-20 20:39:06', '2021-07-21 10:03:06', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', ''),
|
||||
(24, 'xhpc-user', 'DEFAULT_GROUP', 'spring: \r\n redis:\r\n host: tingsun-znc.f3322.net\r\n port: 6379\r\n password: tingsun@7645313 \r\n jackson:\r\n date-format: yyyy-MM-dd HH:mm:ss\r\n time-zone: GMT+8\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: ry-cloud\r\n password: xiaohua123\r\n\r\nseata:\r\n enabled: false\r\n application-id: ${spring.application.name}\r\n tx-service-group: ${spring.application.name}-group\r\n enable-auto-data-source-proxy: false\r\n service:\r\n vgroup-mapping:\r\n ruoyi-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 172.31.183.135:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 172.31.183.135:8848\r\n namespace: \r\n\r\nmybatis:\r\n typeAliasesPackage: com.xhpc.user\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n call-setters-on-nulls: true\r\n', 'a5bc394601350c323c9ebe171864089b', '2021-07-21 12:11:14', '2021-07-29 16:21:37', NULL, '0:0:0:0:0:0:0:1', '', '', 'null', 'null', 'null', 'yaml', 'null'),
|
||||
(20, 'xhpc-power-pile-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 127.0.0.1:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 127.0.0.1:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.pp\n mapperLocations: classpath:mapper/**/*.xml\n', 'e1cad28a4df29955413fa360a40a03dc', '2021-07-19 06:40:44', '2021-07-23 09:05:47', 'nacos', '0:0:0:0:0:0:0:1', '', '', '充电桩协议服务', '', '', 'yaml', ''),
|
||||
(22, 'xhpc-charging-station-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 127.0.0.1:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 127.0.0.1:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc\n mapperLocations: classpath:mapper/**/*.xml\n', '5c9e25c8e8775649c0d5dcb5aed95715', '2021-07-19 08:22:12', '2021-07-28 08:51:17', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', ''),
|
||||
(23, 'xhpc-general-dev.yml', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 127.0.0.1:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 127.0.0.1:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.general\n mapperLocations: classpath:mapper/**/*.xml\n', 'c31f612a8d2c67dc69888b7c02bae5d0', '2021-07-20 20:39:06', '2021-07-21 10:03:06', 'nacos', '0:0:0:0:0:0:0:1', '', '', '', '', '', 'yaml', ''),
|
||||
(24, 'xhpc-user', 'DEFAULT_GROUP', 'spring: \r\n redis:\r\n host: tingsun-znc.f3322.net\r\n port: 6379\r\n password: tingsun@7645313 \r\n jackson:\r\n date-format: yyyy-MM-dd HH:mm:ss\r\n time-zone: GMT+8\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: ry-cloud\r\n password: xiaohua123\r\n\r\nseata:\r\n enabled: false\r\n application-id: ${spring.application.name}\r\n tx-service-group: ${spring.application.name}-group\r\n enable-auto-data-source-proxy: false\r\n service:\r\n vgroup-mapping:\r\n ruoyi-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 127.0.0.1:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 127.0.0.1:8848\r\n namespace: \r\n\r\nmybatis:\r\n typeAliasesPackage: com.xhpc.user\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n call-setters-on-nulls: true\r\n', 'a5bc394601350c323c9ebe171864089b', '2021-07-21 12:11:14', '2021-07-29 16:21:37', NULL, '0:0:0:0:0:0:0:1', '', '', 'null', 'null', 'null', 'yaml', 'null'),
|
||||
(32, 'xhpc-payment', 'DEFAULT_GROUP', 'spring: \n redis:\n host: tingsun-znc.f3322.net\n port: 6379\n password: tingsun@7645313 \n jackson:\n date-format: yyyy-MM-dd HH:mm:ss\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: ry-cloud\n password: xiaohua123\n\nseata:\n enabled: false\n application-id: ${spring.application.name}\n tx-service-group: ${spring.application.name}-group\n enable-auto-data-source-proxy: false\n service:\n vgroup-mapping:\n ruoyi-system-group: default\n config:\n type: nacos\n nacos:\n serverAddr: 118.24.137.203:8848\n group: SEATA_GROUP\n namespace:\n registry:\n type: nacos\n nacos:\n application: seata-server\n server-addr: 118.24.137.203:8848\n namespace: \n\nmybatis:\n typeAliasesPackage: com.xhpc.payment\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n call-setters-on-nulls: true\n', '406756afa55d157cb60305f89f29ec0c', '2021-07-22 16:44:26', '2021-07-22 11:10:56', 'nacos', '110.184.240.136', '', '', '', '', '', 'yaml', ''),
|
||||
(45, 'xhpc-order', 'DEFAULT_GROUP', 'spring: \r\n redis:\r\n host: tingsun-znc.f3322.net\r\n port: 6379\r\n password: tingsun@7645313 \r\n jackson:\r\n date-format: yyyy-MM-dd HH:mm:ss\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: ry-cloud\r\n password: xiaohua123\r\n\r\nseata:\r\n enabled: false\r\n application-id: ${spring.application.name}\r\n tx-service-group: ${spring.application.name}-group\r\n enable-auto-data-source-proxy: false\r\n service:\r\n vgroup-mapping:\r\n ruoyi-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 172.31.183.135:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 172.31.183.135:8848\r\n namespace: \r\n\r\nmybatis:\r\n typeAliasesPackage: com.xhpc.order\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n call-setters-on-nulls: true\r\n', 'dda0f504b5a217c72b8e9cc62f449da5', '2021-07-26 15:35:37', '2021-07-26 15:35:37', NULL, '0:0:0:0:0:0:0:1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
(45, 'xhpc-order', 'DEFAULT_GROUP', 'spring: \r\n redis:\r\n host: tingsun-znc.f3322.net\r\n port: 6379\r\n password: tingsun@7645313 \r\n jackson:\r\n date-format: yyyy-MM-dd HH:mm:ss\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://182.140.223.172:8036/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: ry-cloud\r\n password: xiaohua123\r\n\r\nseata:\r\n enabled: false\r\n application-id: ${spring.application.name}\r\n tx-service-group: ${spring.application.name}-group\r\n enable-auto-data-source-proxy: false\r\n service:\r\n vgroup-mapping:\r\n ruoyi-system-group: default\r\n config:\r\n type: nacos\r\n nacos:\r\n serverAddr: 127.0.0.1:8848\r\n group: SEATA_GROUP\r\n namespace:\r\n registry:\r\n type: nacos\r\n nacos:\r\n application: seata-server\r\n server-addr: 127.0.0.1:8848\r\n namespace: \r\n\r\nmybatis:\r\n typeAliasesPackage: com.xhpc.order\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n call-setters-on-nulls: true\r\n', 'dda0f504b5a217c72b8e9cc62f449da5', '2021-07-26 15:35:37', '2021-07-26 15:35:37', NULL, '0:0:0:0:0:0:0:1', '', '', NULL, NULL, NULL, 'yaml', NULL);
|
||||
/*!40000 ALTER TABLE `config_info` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
|
||||
@ -65,8 +65,7 @@ public class XhpcActivityInternetController extends BaseController {
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
domain.setTenantId(loginUser.getTenantId());
|
||||
domain.setStatus(Short.valueOf("1"));
|
||||
|
||||
return R.ok(internetService.insertDomain(domain));
|
||||
return internetService.insertDomain(domain);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,4 +30,9 @@ public interface XhpcActivityInternetMapper {
|
||||
List<XhpcActivityInternetDomain> selectByDateBetween(@Param("internetName")String internetName, @Param("stationList")List<String> stationList, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||
|
||||
int updateStatusByExpireNow();
|
||||
}
|
||||
|
||||
//获取场站时间段
|
||||
List<Map<String,Object>> getXhpcRateTimes(@Param("chargingStationId")Long chargingStationId);
|
||||
|
||||
String getChargingStation(@Param("chargingStationId")Long chargingStationId);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xhpc.activity.service;
|
||||
|
||||
import com.xhpc.activity.domain.XhpcActivityFormulaDomain;
|
||||
import com.xhpc.activity.domain.XhpcActivityInternetDomain;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -14,7 +15,7 @@ public interface XhpcActivityInternetService {
|
||||
|
||||
XhpcActivityInternetDomain getDomainByPk(Integer activityId);
|
||||
|
||||
boolean insertDomain(XhpcActivityInternetDomain domain);
|
||||
R insertDomain(XhpcActivityInternetDomain domain);
|
||||
|
||||
boolean updateDomain(XhpcActivityInternetDomain domain);
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import com.xhpc.activity.mapper.XhpcActivityFormulaMapper;
|
||||
import com.xhpc.activity.mapper.XhpcActivityInternetMapper;
|
||||
import com.xhpc.activity.service.XhpcActivityInternetService;
|
||||
import com.xhpc.activity.utils.AreaCodeUtil;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.util.DateUtil;
|
||||
@ -13,11 +14,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -54,13 +51,47 @@ public class XhpcActivityInternetServiceImpl implements XhpcActivityInternetServ
|
||||
|
||||
|
||||
@Override
|
||||
public boolean insertDomain(XhpcActivityInternetDomain domain) {
|
||||
public R insertDomain(XhpcActivityInternetDomain domain) {
|
||||
//判断流量方时间段和场站时间段是否一致
|
||||
String s = AreaCodeUtil.removeAreaCode(domain.getStationList());
|
||||
List<XhpcActivityFormulaDomain> formulaList = domain.getFormulaList();
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
for (int i = 0; i <formulaList.size() ; i++) {
|
||||
XhpcActivityFormulaDomain xhpcActivityFormulaDomain = formulaList.get(i);
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("startTime",xhpcActivityFormulaDomain.getStartTime());
|
||||
map.put("endTime",xhpcActivityFormulaDomain.getEndTime());
|
||||
mapList.add(map);
|
||||
}
|
||||
String[] split = s.split(",");
|
||||
for (int i = 0; i <split.length ; i++) {
|
||||
Long chargingStationId = Long.valueOf(split[i]);
|
||||
List<Map<String, Object>> xhpcRateTimes = internetMapper.getXhpcRateTimes(chargingStationId);
|
||||
if(mapList.size() ==xhpcRateTimes.size()){
|
||||
for (Map map:mapList) {
|
||||
boolean flag = false;
|
||||
for (Map rateMap:xhpcRateTimes) {
|
||||
if(rateMap.get("startTime").toString().equals(map.get("startTime").toString()) && rateMap.get("endTime").toString().equals(map.get("endTime").toString())){
|
||||
flag =true;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
return R.fail("与"+chargingStation+"场站时间段端不一致");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String chargingStation = internetMapper.getChargingStation(chargingStationId);
|
||||
return R.fail("与"+chargingStation+"场站时间段端不一致");
|
||||
}
|
||||
}
|
||||
|
||||
domain.setStationList(AreaCodeUtil.removeAreaCode(domain.getStationList()));
|
||||
internetMapper.insert(domain);
|
||||
|
||||
List<XhpcActivityFormulaDomain> formulaDomainList = getFormulaFullList(domain);
|
||||
formulaMapper.insertBatch(formulaDomainList);
|
||||
return true;
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ -143,7 +174,6 @@ public class XhpcActivityInternetServiceImpl implements XhpcActivityInternetServ
|
||||
}
|
||||
boolean checkFlag = checkFormulaList(formulaDomains);
|
||||
if(!checkFlag){
|
||||
System.out.println(" ==================== 费率列表 ======================== ");
|
||||
System.out.println(formulaDomains);
|
||||
throw new CustomException("费率设置错误,请检查");
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
activity_id
|
||||
, activity_name, internet_name, compute_type, power_price, service_price, compute_formula, start_time,
|
||||
end_time, station_list, tenant_id, `status`, del_flag, create_by, create_time, update_by,
|
||||
end_time, station_list, tenant_id, `status`, del_flag, create_by, create_time, update_by,
|
||||
update_time, check_by, check_time
|
||||
</sql>
|
||||
|
||||
@ -151,4 +151,17 @@
|
||||
update xhpc_activity_internet set status=4 where status=3 and del_flag=0 and end_time <![CDATA[<=]]> now()
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
<select id="getXhpcRateTimes" resultType="map">
|
||||
select
|
||||
start_time as startTime,
|
||||
replace(end_time, '00:00:00', '24:00:00') AS endTime
|
||||
from xhpc_rate_time
|
||||
where charging_station_id =#{chargingStationId} and del_flag =0
|
||||
order by rate_time_id
|
||||
</select>
|
||||
|
||||
<select id="getChargingStation" resultType="string">
|
||||
select name from xhpc_charging_station where charging_station_id =#{chargingStationId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -49,7 +49,7 @@ public class XhpcMessageBoardApiController extends BaseController {
|
||||
* @date 2022/1/13 18:15
|
||||
* @since version-1.0
|
||||
*/
|
||||
@GetMapping("/user/message")
|
||||
@GetMapping("/user/messageYu")
|
||||
public AjaxResult queryUserMessage(UserQueryCondition userQueryCondition) {
|
||||
|
||||
QueryUserMassageResponse queryUserMassageResponse = xhpcMessageBoardService.queryUserMessage(userQueryCondition);
|
||||
@ -70,4 +70,4 @@ public class XhpcMessageBoardApiController extends BaseController {
|
||||
return AjaxResult.success(avatarAddress);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +36,6 @@ public class XhpcChargingStationApiController extends BaseController {
|
||||
//@PreAuthorize(hasPermi = "system:station:list")
|
||||
@GetMapping("/getWXList")
|
||||
public TableDataInfo getWXList(String name, String serviceFacilities, Integer code, String longitude, String latitude,String tenantId) {
|
||||
System.out.println("========tenantId======="+tenantId);
|
||||
System.out.println("========tenantId======="+tenantId);
|
||||
System.out.println("========tenantId======="+tenantId);
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcChargingStationService.getWXList(name, serviceFacilities, code, longitude, latitude,tenantId);
|
||||
return getDataTable(list);
|
||||
|
||||
@ -275,5 +275,7 @@ public interface XhpcChargingStationMapper {
|
||||
List<XhpcActivityDiscountDto> getActivityDiscountTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("userType")Integer userType, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
//获取运营商信息
|
||||
Map<String, Object> getXhpcOperator(@Param("operatorId") Long operatorId);
|
||||
|
||||
}
|
||||
|
||||
@ -470,6 +470,13 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
BeanUtils.copyProperties(xhpcChargingStationDto, xhpcChargingStation);
|
||||
xhpcChargingStation.setRateModelId(rateModelId);
|
||||
xhpcChargingStation.setTenantId(tenantId);
|
||||
Map<String, Object> xhpcOperator = xhpcChargingStationMapper.getXhpcOperator(xhpcChargingStation.getOperatorId());
|
||||
if(xhpcOperator !=null &&xhpcOperator.get("operatorIdEvcs") !=null){
|
||||
xhpcChargingStation.setOperatorIdEvcs(xhpcOperator.get("operatorIdEvcs").toString());
|
||||
}else{
|
||||
return AjaxResult.error("1005", "运营商少监管平台推送编号");
|
||||
}
|
||||
|
||||
int j = xhpcChargingStationMapper.insertxhpcChargingStation(xhpcChargingStation);
|
||||
if (j == 0) {
|
||||
return AjaxResult.error("1006", "电站基本信息添加失败");
|
||||
@ -792,7 +799,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
stringList = Arrays.asList(split);
|
||||
}
|
||||
String date = DateUtil.formatTime(new Date());
|
||||
|
||||
|
||||
List<Map<String, Object>> list = xhpcChargingStationMapper.getWXList(name, stringList, code, longitude, latitude, 2,date,tenantId);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
@ -31,9 +31,6 @@ public class QrImgUtils {
|
||||
//生成桩的二维码图片
|
||||
//1.生成二维码链接内容:
|
||||
StringBuilder prefix = new StringBuilder(environment.getProperty("img.qrLinkContent"));
|
||||
System.out.println("========prefix===========》"+environment.getProperty("img.qrLinkContent"));
|
||||
System.out.println("========prefix===========》"+environment.getProperty("img.qrLinkContent"));
|
||||
System.out.println("========prefix===========》"+environment.getProperty("img.qrLinkContent"));
|
||||
String QrContent = prefix.append(xhpcTerminal.getSerialNumber()).toString();
|
||||
try {
|
||||
//2.生成二维码图片:
|
||||
@ -53,7 +50,7 @@ public class QrImgUtils {
|
||||
String.valueOf(letterMap.get(forIndex)),
|
||||
new File(environment.getProperty("fullImgDestPath") + finallyImgFileName)
|
||||
);
|
||||
System.out.println("===================》完整二维码图片生成成功");
|
||||
|
||||
//4.上传图片至服务器
|
||||
// 创建OSSClient实例
|
||||
OSSClient ossClient = new OSSClient(environment.getProperty("oss.endpoint"), environment.getProperty("oss.access-key"), environment.getProperty("oss.secret-key"));
|
||||
@ -62,22 +59,20 @@ public class QrImgUtils {
|
||||
String aLiYunUploadLocation = "QrCodeImg/" + xhpcTerminal.getChargingStationId() + "/" + xhpcTerminal.getPileSerialNumber() + "/" + finallyImgFileName;
|
||||
ossClient.putObject(environment.getProperty("oss.bucket-name"), aLiYunUploadLocation, new File(environment.getProperty("destPath") + File.separatorChar + finallyImgFileName));
|
||||
ossClient.shutdown();
|
||||
System.out.println("===================》将完整二维码上传至阿里云成功");
|
||||
//System.out.println("===================》将完整二维码上传至阿里云成功");
|
||||
//5.将放在阿里云上的生成的图片的路径和图片所对应的终端的id放入数据库xhpc_img表中
|
||||
Long terminalId = xhpcTerminal.getTerminalId();
|
||||
xhpcImgMapper.insert(aLiYunUploadLocation, terminalId);
|
||||
System.out.println("===================》将阿里云上的图片地址放入数据库");
|
||||
//6.删除生成的二维码图片
|
||||
File QrImg = new File(environment.getProperty("destPath") + File.separatorChar + qrFileName);
|
||||
QrImg.delete();
|
||||
//7.删除本地生成的完整图片
|
||||
File finallyImg = new File(environment.getProperty("fullImgDestPath") + finallyImgFileName);
|
||||
finallyImg.delete();
|
||||
System.out.println("==================》已删除本地生成的完成二维码图片");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
System.out.println("二维码生成图片失败,请检查生成二维码所需要的资源路径是否正确");
|
||||
//System.out.println("二维码生成图片失败,请检查生成二维码所需要的资源路径是否正确");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -988,4 +988,11 @@
|
||||
and xad.start_time <=#{startTime} and xad.end_time > #{startTime}
|
||||
order by xad.start_time asc
|
||||
</select>
|
||||
|
||||
<select id="getXhpcOperator" resultType="map">
|
||||
select
|
||||
operator_id operatorId,
|
||||
operator_id_evcs as operatorIdEvcs
|
||||
from xhpc_operator where operator_id= #{operatorId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -40,7 +40,8 @@
|
||||
|
||||
<select id="getXhpcTimeType" resultType="map">
|
||||
select ra.power_fee as powerFee,
|
||||
ra.service_fee as serviceFee
|
||||
ra.service_fee as serviceFee,
|
||||
ifnull((ra.power_fee+ ra.service_fee), 0) as totalAmount
|
||||
from xhpc_rate as ra
|
||||
where ra.charging_station_id = #{datchargingStationId}
|
||||
and ra.status = 0
|
||||
|
||||
@ -91,4 +91,15 @@ public interface PileOrderService {
|
||||
*/
|
||||
@GetMapping("/chargeOrder/pileRimeOrderBms")
|
||||
R pileRimeOrderBms(@RequestParam(value = "orderNo") String orderNo);
|
||||
|
||||
|
||||
/**
|
||||
* soc达到系统设置值
|
||||
* @param orderNo 订单号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/api/chargeOrder/constantSoc")
|
||||
R constantSoc(@RequestParam(value = "orderNo") String orderNo,@RequestParam(value = "soc") String soc);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -70,6 +70,18 @@ public class PileOrderFallbackFactory implements FallbackFactory<PileOrderServic
|
||||
public R pileRimeOrderBms(String orderNo) {
|
||||
return R.fail("充电过程 BMS 需求与充电机输出失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* soc达到系统设置值
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
* @param soc
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R constantSoc(String orderNo, String soc) {
|
||||
return R.fail("soc达到系统设置值输出失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -517,7 +517,7 @@ public class DateUtil {
|
||||
String dateStr1 = "2017-03-01 22:33:23";
|
||||
Date date1 = cn.hutool.core.date.DateUtil.parse(dateStr1);
|
||||
|
||||
String dateStr2 = "2017-04-01 20:33:23";
|
||||
String dateStr2 = "2017-04-01 20:03:23";
|
||||
Date date2 =cn.hutool.core.date.DateUtil.parse(dateStr2);
|
||||
|
||||
long between = cn.hutool.core.date.DateUtil.between(date1, date2, DateUnit.MINUTE);
|
||||
@ -525,8 +525,11 @@ public class DateUtil {
|
||||
String formatDate = cn.hutool.core.date.DateUtil.format(date2, "yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("formatDate:"+formatDate);
|
||||
|
||||
|
||||
|
||||
String formatDate1 = cn.hutool.core.date.DateUtil.formatTime(new Date());
|
||||
String [] st =formatDate1.split(":");
|
||||
for (int i = 0; i <st.length ; i++) {
|
||||
System.out.println("formatDate1:"+st[i]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -59,4 +59,6 @@ public class AliyunTemplateKeyWord {
|
||||
* 运营商提现到银行账户
|
||||
*/
|
||||
public static final String OPERATOR_CASHED = "提现到银行账户";
|
||||
|
||||
public static final String OPERATOR_CODE= "您的验证码是";
|
||||
}
|
||||
|
||||
@ -76,7 +76,10 @@ public class XhpcSmsController extends BaseController {
|
||||
paramMap.remove("phone");
|
||||
paramMap.remove("content");
|
||||
//判断内容是什么,调用相应的模板
|
||||
if (content.contains(AliyunTemplateKeyWord.DIRECT_STREAM_PILE_STOP_CHARGE)) {
|
||||
if (content.contains(AliyunTemplateKeyWord.OPERATOR_CODE)) {
|
||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||
templateId = AliyunTemplate.VALIDATE_CODE;
|
||||
}else if (content.contains(AliyunTemplateKeyWord.DIRECT_STREAM_PILE_STOP_CHARGE)) {
|
||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||
templateId = AliyunTemplate.DIRECT_STREAM_PILE_STOP_CHARGE;
|
||||
} else if (content.contains(AliyunTemplateKeyWord.INTERFLOW_STREAM_PILE_STOP_CHARGE)) {
|
||||
|
||||
@ -223,13 +223,11 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
//获取阿里云的返回值json字符串
|
||||
SendSmsResponseBody body = sendSmsResponse.getBody();
|
||||
String jsonResult = JSONUtil.toJsonStr(body);
|
||||
System.out.println("阿里云返回值的json字符串=============》" + jsonResult);
|
||||
//存放后面需要使用的返回值
|
||||
HashMap<String, String> valueParam = new HashMap<>();
|
||||
valueParam.put("statusCode", statusCode);
|
||||
valueParam.put("templateContent", templateContent);
|
||||
valueParam.put("jsonResult", jsonResult);
|
||||
System.out.println(("valueParam的值===========》" + valueParam));
|
||||
return valueParam;
|
||||
}
|
||||
|
||||
|
||||
@ -121,6 +121,15 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 支付宝sdk -->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>${alipay.sdk.message}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.xhpc.order.api;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.WebSocketService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -192,5 +195,16 @@ public class XhpcChargeOrderController extends BaseController {
|
||||
return iXhpcChargeOrderService.pileVin(serialNumber,vinNumber);
|
||||
}
|
||||
|
||||
@GetMapping("/constantSoc")
|
||||
public R constantSoc(@RequestParam(value = "orderNo") String orderNo,@RequestParam(value = "soc") String soc) {
|
||||
iXhpcChargeOrderService.constantSoc(orderNo, soc);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/zhbSoc")
|
||||
public R zhbSoc(@RequestParam(value = "orderNo") String orderNo,@RequestParam(value = "soc") String soc) {
|
||||
iXhpcChargeOrderService.zhbSoc(orderNo, soc);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
BigDecimal bigDecimal = new BigDecimal(10000);
|
||||
BigDecimal totalPowerQuantity = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal totalPowerQuantity = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,4,BigDecimal.ROUND_HALF_UP);
|
||||
if(totalPowerQuantity.compareTo(new BigDecimal(250)) > -1){
|
||||
logger.info("结算电量大于250度>>"+totalPowerQuantity+">>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
@ -471,29 +471,29 @@ public class XhpcPileOrderController extends BaseController {
|
||||
//因桩有误差,电费和服务费重新计算
|
||||
if(!"0".equals(cacheOrderData.getT1PowerQuantity().toString())){
|
||||
totalPower =totalPower+cacheOrderData.getT1PowerQuantity();
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(t1powerFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(t1serviceFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(t1powerFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT1PowerQuantity()).divide(bigDecimal).multiply(t1serviceFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
powerPrice=powerPrice.add(multiply1);
|
||||
servicePrice=servicePrice.add(multiply2);
|
||||
}
|
||||
if(!"0".equals(cacheOrderData.getT2PowerQuantity().toString())){
|
||||
totalPower =totalPower+cacheOrderData.getT2PowerQuantity();
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(t2powerFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(t2serviceFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(t2powerFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT2PowerQuantity()).divide(bigDecimal).multiply(t2serviceFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
powerPrice=powerPrice.add(multiply1);
|
||||
servicePrice=servicePrice.add(multiply2);
|
||||
}
|
||||
if(!"0".equals(cacheOrderData.getT3PowerQuantity().toString())){
|
||||
totalPower =totalPower+cacheOrderData.getT3PowerQuantity();
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(t3powerFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(t3serviceFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(t3powerFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT3PowerQuantity()).divide(bigDecimal).multiply(t3serviceFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
powerPrice=powerPrice.add(multiply1);
|
||||
servicePrice=servicePrice.add(multiply2);
|
||||
}
|
||||
if(!"0".equals(cacheOrderData.getT4PowerQuantity().toString())){
|
||||
totalPower =totalPower+cacheOrderData.getT4PowerQuantity();
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(t4powerFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(t4serviceFee).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply1 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(t4powerFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal multiply2 = new BigDecimal(cacheOrderData.getT4PowerQuantity()).divide(bigDecimal).multiply(t4serviceFee).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
powerPrice=powerPrice.add(multiply1);
|
||||
servicePrice=servicePrice.add(multiply2);
|
||||
}
|
||||
@ -578,8 +578,11 @@ public class XhpcPileOrderController extends BaseController {
|
||||
double mins = (double) (tiem / 60);
|
||||
xhpcChargeOrder.setChargingTime(new BigDecimal(mins).setScale(0) + "分");
|
||||
}
|
||||
if(!"".equals(cacheOrderData.getVinNormal())||cacheOrderData.getVinNormal() !=null){
|
||||
xhpcChargeOrder.setVinNormal(cacheOrderData.getVinNormal());
|
||||
}
|
||||
xhpcChargeOrder.setChargingTimeNumber(tiem);
|
||||
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,2, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,4, BigDecimal.ROUND_HALF_UP);
|
||||
xhpcChargeOrder.setChargingDegree(divide);
|
||||
xhpcChargeOrder.setAmountCharged(money);
|
||||
String stopReason = cacheOrderData.getStopReason();
|
||||
@ -821,5 +824,19 @@ public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String i
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startTime1="2023-07-11 11:55:34";
|
||||
String endTime1="2023-07-11 12:52:27";
|
||||
Date startTime = DateUtil.parse(startTime1);
|
||||
Date endTime = DateUtil.parse(endTime1);
|
||||
System.out.println("=========="+DateUtil.formatDateTime(startTime));
|
||||
System.out.println("=========="+DateUtil.formatDateTime(endTime));
|
||||
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
||||
System.out.println("=========="+betweenDay);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
package com.xhpc.order.controller;
|
||||
|
||||
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.order.service.IXhpcChargingStationPowerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-06-28 14:11
|
||||
*/
|
||||
@EnableScheduling
|
||||
@RestController
|
||||
@RequestMapping("/chargingStationPower")
|
||||
public class XhpcChargingStationPowerController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IXhpcChargingStationPowerService xhpcChargingStationPowerService;
|
||||
|
||||
@GetMapping("/test1")
|
||||
@Scheduled(cron = "0 0/30 0/1 * * ? ")
|
||||
public void test1(){
|
||||
xhpcChargingStationPowerService.addChargingStationPower();
|
||||
}
|
||||
|
||||
//列表
|
||||
@GetMapping("/getListPage")
|
||||
public TableDataInfo getListPage(
|
||||
@RequestParam(required = false)String tenantId,
|
||||
@RequestParam(required = false)Long chargingStationId,
|
||||
@RequestParam(required = false)Long chargingPileId,
|
||||
@RequestParam(required = false)Long terminalId,
|
||||
@RequestParam(required = false)Long operatorId,
|
||||
@RequestParam(required = true)String startTime,
|
||||
@RequestParam(required = true)String endTime
|
||||
) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId",tenantId);
|
||||
params.put("chargingStationId",chargingStationId);
|
||||
params.put("chargingPileId",chargingPileId);
|
||||
params.put("terminalId",terminalId);
|
||||
params.put("operatorId",operatorId);
|
||||
params.put("startTime",startTime);
|
||||
params.put("endTime",endTime);
|
||||
List<Map<String, Object>> listPage = xhpcChargingStationPowerService.getListPage(params);
|
||||
return getDataTable(listPage);
|
||||
}
|
||||
|
||||
|
||||
//获取所有场站
|
||||
@GetMapping("/getChargingStationList")
|
||||
public R getChargingStationList(){
|
||||
return R.ok(xhpcChargingStationPowerService.getChargingStationList());
|
||||
}
|
||||
|
||||
//择线图(时间为准)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -136,7 +136,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 日期统计\场站统计\终端统计
|
||||
*/
|
||||
@GetMapping("/test1")
|
||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test1(){
|
||||
add(3000,1);
|
||||
}
|
||||
@ -426,7 +426,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 小时统计
|
||||
*/
|
||||
@GetMapping("/test")
|
||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//小时统计
|
||||
@ -889,7 +889,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 24小时异常订单自动结算
|
||||
*/
|
||||
@GetMapping("/test4")
|
||||
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test4(){
|
||||
//获取异常的订单 24小时之外的异常订单
|
||||
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
|
||||
@ -916,13 +916,13 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* @param
|
||||
*/
|
||||
@GetMapping("/test5")
|
||||
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test5(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
|
||||
chargeOrderService.updateStatus();
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
@GetMapping("/getInvoiceInfo")
|
||||
public void getInvoiceInfo(){
|
||||
logger.info("++++++++++++每1分钟,扫描一次,异常订单,自动生成工单++++++++++++++++");
|
||||
@ -951,7 +951,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
|
||||
|
||||
//检查统计没有入库的订单(小时)
|
||||
// @Scheduled(cron = "0 5 * * * ?")
|
||||
@Scheduled(cron = "0 5 * * * ?")
|
||||
@GetMapping("/getInvoTime")
|
||||
public void getNoStatisticsOrderTime(){
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(3000);
|
||||
@ -1016,7 +1016,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
}
|
||||
}
|
||||
//检查统计没有入库的订单(日期、电站)
|
||||
// @Scheduled(cron = "0 30 * * * ?")
|
||||
@Scheduled(cron = "0 30 * * * ?")
|
||||
@GetMapping("/getInvoDay")
|
||||
public void getInvoDay(){
|
||||
List<XhpcChargeHistoryOrder> listOrder = xhpcHistoryOrderService.getNoStatisticsOrderDay(500);
|
||||
|
||||
@ -83,11 +83,11 @@ public class XhpcRealTimeOrderController extends BaseController {
|
||||
List<Map<String,Object>> list = xhpcRealTimeOrderService.timeBmsList(chargingOrderId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
/**
|
||||
* 实时/异常订单详情数据图表(PC)
|
||||
* @param chargingOrderId
|
||||
* @return
|
||||
*/
|
||||
// /**
|
||||
// * 实时/异常订单详情数据图表(PC)
|
||||
// * @param chargingOrderId
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/timeChartList")
|
||||
// public AjaxResult timeChartList(@RequestParam Long chargingOrderId)
|
||||
// {
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.xhpc.order.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-06-28 13:32
|
||||
*/
|
||||
@Data
|
||||
public class XhpcChargingStationPower extends BaseEntity {
|
||||
|
||||
|
||||
|
||||
private Long chargingStationPowerId;
|
||||
/**
|
||||
* 场站订单id
|
||||
*/
|
||||
private Long chargeOrderId;
|
||||
/**
|
||||
* 48个时段场站使用功率
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
private Double voltage;
|
||||
|
||||
/**
|
||||
* 电流
|
||||
*/
|
||||
private Double current;
|
||||
/**
|
||||
* 场站id
|
||||
*/
|
||||
private Long chargingStationId;
|
||||
/**
|
||||
* 桩id
|
||||
*/
|
||||
private Long chargingPileId;
|
||||
/**
|
||||
* 桩id
|
||||
*/
|
||||
private Long terminalId;
|
||||
/**
|
||||
* 删除表彰
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 装机安装总功率
|
||||
*/
|
||||
private Double installedTotalPower;
|
||||
|
||||
|
||||
}
|
||||
@ -3,6 +3,8 @@ package com.xhpc.order.domain;
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/8/31 17:32
|
||||
@ -29,5 +31,5 @@ public class XhpcRealTimeOrderBms extends BaseEntity {
|
||||
private String chargingTimeSummary; //累计充电时间
|
||||
private Integer monoBatteryVoltGroupId; // BMS 最高单体动力蓄电池电压所在组号ID
|
||||
private Long chargingOrderId;
|
||||
|
||||
private Date createTime;
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import com.xhpc.order.domain.XhpcChargingStationPower;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-06-28 14:19
|
||||
*/
|
||||
public interface XhpcChargingStationPowerMapper {
|
||||
|
||||
//获取所有场站
|
||||
List<Map<String,Object>> getChargingStationId();
|
||||
|
||||
//查询是否已统计(订单编号、时间段)
|
||||
List<Map<String,Object>> getXhpcRealTimeOrderList(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") Long terminalId,@Param("sterTime")String sterTime,@Param("endTime")String endTime,@Param("number")Integer number,@Param("subTime")String subTime);
|
||||
|
||||
//查询是否已统计
|
||||
int duplicateStatistics(@Param("chargingStationId") Long chargingStationId,@Param("terminalId") Long terminalId,@Param("number")Integer number,@Param("subTime")String subTime);
|
||||
|
||||
//获取终端
|
||||
List<Map<String,Object>> getXhpcTerminals(@Param("chargingStationId") Long chargingStationId);
|
||||
|
||||
void addXhpcChargingStationPower(XhpcChargingStationPower xhpcChargingStationPower);
|
||||
|
||||
List<Map<String,Object>> getListPage(@Param("params") Map<String, Object> params);
|
||||
}
|
||||
@ -175,4 +175,8 @@ public interface IXhpcChargeOrderService {
|
||||
|
||||
//根据终端号查询最近的一个在充电的订单
|
||||
Map<String,Object> getSerialNumberOrder(String serialNumber);
|
||||
|
||||
void constantSoc(String orderNo,String soc);
|
||||
|
||||
void zhbSoc(String orderNo,String soc);
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.order.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-06-28 14:13
|
||||
*/
|
||||
public interface IXhpcChargingStationPowerService {
|
||||
|
||||
|
||||
//列表
|
||||
|
||||
//定时任务:没半分钟执行一次
|
||||
void addChargingStationPower();
|
||||
|
||||
List<Map<String,Object>> getListPage(Map<String, Object> params);
|
||||
|
||||
List<Map<String,Object>> getChargingStationList();
|
||||
|
||||
}
|
||||
@ -1,15 +1,27 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.domain.AlipayOpenAppMiniTemplatemessageSendModel;
|
||||
import com.alipay.api.internal.util.AntCertificationUtil;
|
||||
import com.alipay.api.request.AlipayOpenAppMiniTemplatemessageSendRequest;
|
||||
import com.alipay.api.response.AlipayOpenAppMiniTemplatemessageSendResponse;
|
||||
import com.alipay.api.FileItem;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.constant.Constants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.data.redis.StaticBeanUtil;
|
||||
import com.xhpc.common.domain.XhpcRate;
|
||||
@ -63,6 +75,8 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
@Autowired
|
||||
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
||||
@ -160,9 +174,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
if (terminalSerialNumber.length() != 16 || !m.matches()) {
|
||||
return AjaxResult.error(1104, "无效的终端编号");
|
||||
}
|
||||
System.out.println("============tenantId================="+tenantId);
|
||||
System.out.println("============tenantId================="+tenantId);
|
||||
System.out.println("============tenantId================="+tenantId);
|
||||
//终端信息
|
||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber,tenantId);
|
||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||
@ -253,16 +264,20 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
int number =0;
|
||||
if(!"".equals(userMessage.get("socUser")) && userMessage.get("socUser") !=null && userMessage.get("socProtect") !=null && !"0".equals(userMessage.get("socProtect").toString())){
|
||||
number =Integer.parseInt(userMessage.get("socUser").toString());
|
||||
logger.info("=========用户、桩、平台(最小的)===number==="+number);
|
||||
}
|
||||
//平台
|
||||
String soc = redisService.getCacheObject("global:"+tenantId+":SOC");
|
||||
logger.info("=========用户、桩、平台(最小的)===soc==="+soc);
|
||||
if(!"".equals(soc) && soc!=null){
|
||||
if(number!=0){
|
||||
if(Integer.parseInt(soc)-number<0){
|
||||
number=Integer.parseInt(soc);
|
||||
logger.info("=========用户、桩、平台(最小的)1===number==="+number);
|
||||
}
|
||||
}else{
|
||||
number=Integer.parseInt(soc);
|
||||
logger.info("=========用户、桩、平台(最小的)2===number==="+number);
|
||||
}
|
||||
}
|
||||
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(xhpcTerminal.getChargingStationId());
|
||||
@ -270,9 +285,11 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
if(number!=0){
|
||||
if(Integer.parseInt(operatorMessage.get("soc").toString())-number<0){
|
||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||
logger.info("=========用户、桩、平台(最小的)3===number==="+number);
|
||||
}
|
||||
}else{
|
||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||
logger.info("=========用户、桩、平台(最小的)4===number==="+number);
|
||||
}
|
||||
}
|
||||
if(number !=0){
|
||||
@ -325,8 +342,6 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
});
|
||||
logger.info("<<<<<<<<<1111<<<<<<<<<<<<<<<C端订单号>>>>>>>>>>>>>>>>>:" + orderNo+"用户id:"+userId);
|
||||
logger.info("<<<<<<<<<2222<<<<<<<<<<<<<<<C端订单号>>>>>>>>>>>>>>>>>:" + orderNo+"用户id:"+userId);
|
||||
logger.info("<<<<<<<<<3333<<<<<<<<<<<<<<<C端订单号>>>>>>>>>>>>>>>>>:" + orderNo+"用户id:"+userId);
|
||||
logger.info("<<<<<<<<<4444<<<<<<<<<<<<<<<C端订单号>>>>>>>>>>>>>>>>>:" + orderNo+"用户id:"+userId);
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
|
||||
@ -1095,6 +1110,47 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
return xhpcChargeOrderMapper.getSerialNumberOrder(serialNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void constantSoc(String orderNo, String soc) {
|
||||
try{
|
||||
|
||||
XhpcChargeOrder serialNumberMessage = xhpcChargeOrderMapper.getSerialNumberMessage(orderNo);
|
||||
|
||||
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(serialNumberMessage.getChargingStationId());
|
||||
if(UserTypeUtil.USER_TYPE.equals(serialNumberMessage.getSource())){
|
||||
Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(serialNumberMessage.getUserId());
|
||||
if(serialNumberMessage.getChargingMode().equals("微信")){
|
||||
String phoneObject = redisService.getCacheObject("WXToken:wxd0a48e00319ef8a7");
|
||||
String serialNumber = serialNumberMessage.getSerialNumber();
|
||||
int zhuang = Integer.parseInt(serialNumber.substring(10,14));
|
||||
int qiang = Integer.parseInt(serialNumber.substring(14,16));
|
||||
String spear = "A";
|
||||
if(qiang==2){
|
||||
spear = "B";
|
||||
}else if(qiang==3){
|
||||
spear = "C";
|
||||
}else if(qiang==4){
|
||||
spear = "D";
|
||||
}
|
||||
operatorMessage.get("chargingStationName").toString().replace("小华充电","");
|
||||
String str = operatorMessage.get("chargingStationName").toString().replace("小华充电", "");
|
||||
if(str.length()>13){
|
||||
str =str.substring(0,13);
|
||||
}
|
||||
WxMessageSend(userMessage.get("weixinOpenId").toString(),phoneObject,str+"-"+zhuang+"桩"+"-"+spear+"枪",soc);
|
||||
}else if(serialNumberMessage.getChargingMode().equals("支付宝")){
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("battery", soc);
|
||||
paramMap.put("phone", userMessage.get("phone").toString());
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" + soc + "%)。");
|
||||
smsService.sendNotice(paramMap);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidDate(String str) {
|
||||
try {
|
||||
if (0 != str.length()) {
|
||||
@ -1199,4 +1255,90 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void WxMessageSend(String openid,String token,String chargingStationName,String soc){
|
||||
try{
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + token;
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("touser", openid);
|
||||
map.put("template_id", "z7Eh6_fjwMQ-JYtpD2K0KegtGaDsKZwd7h8IZznAm1k");
|
||||
map.put("page", "pages/transition/transition");
|
||||
map.put("miniprogram_state", "developer");
|
||||
map.put("lang", "zh_CN");
|
||||
|
||||
Map<String, Object> map1 = new LinkedHashMap<>();
|
||||
map1.put("value", chargingStationName);
|
||||
Map<String, Object> map11 = new LinkedHashMap<>();
|
||||
map11.put("thing1", map1);
|
||||
|
||||
Map<String, Object> map2 = new LinkedHashMap<>();
|
||||
map2.put("value", "车辆已充电达至设定的SOC:"+soc+"%");
|
||||
Map<String, Object> map22 = new LinkedHashMap<>();
|
||||
map22.put("thing2", map2);
|
||||
map11.putAll(map22);
|
||||
Map<String, Object> map3 = new LinkedHashMap<>();
|
||||
map3.put("value", "充电已完成请尽快离场,超时要收占位费哟");
|
||||
Map<String, Object> map33 = new LinkedHashMap<>();
|
||||
map33.put("thing3", map3);
|
||||
map11.putAll(map33);
|
||||
|
||||
Map<String, Object> map4 = new LinkedHashMap<>();
|
||||
map4.put("value", "028-87500096");
|
||||
Map<String, Object> map44 = new LinkedHashMap<>();
|
||||
map44.put("phone_number4", map4);
|
||||
map11.putAll(map44);
|
||||
|
||||
map.put("data", map11);
|
||||
JSONObject json = new JSONObject(map);
|
||||
System.out.println("json :"+json);
|
||||
String result = HttpUtils.post(url, json);
|
||||
JSONObject jsonObject =JSON.parseObject(result);
|
||||
System.out.println("jsonObject :"+jsonObject);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void zhbSoc(String orderNo, String soc) {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
// //String alipayPublicKey1 = getAlipayPublicKey("C:\\Users\\Administrator\\Downloads\\alipayCertPublicKey_RSA2.crt");
|
||||
// //System.out.println("alipayPublicKey1:"+alipayPublicKey1);
|
||||
// String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ" ;
|
||||
// //String alipayPublicKey ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjHDksTgZTpf0wh7oeTVRp0h3SqzTM2smjEJnx9jF1+q3WSXLRB4OzSzq7VsJ/szcyK10ZGO5PxeQ4u9GAG/U+7xhs7ei1cJB/Er55Sg9SbjfkTpwlDv181UJCRJJ/IAcqyqezwTpB8e2trYmHKovUdt0KR9/tVkGa7hsNd5GfxTOUaAFc3zADqRVM+wGimtG0NYfOF2f8tkmBEAiMMLKq5pbAnHU723a1cm/nfVp7gvXfsnO0k2GvRuHzb8mxIhWLiAnwdK9gEu5za/jWxo/xIvf2sdJPYdWj+yfyzA2e1fJkx4uRUzX31CXxZvP2/tfEcnTdI0gxN+OH2eAMiPVswIDAQAB";
|
||||
// String alipayPublicKey ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjHDksTgZTpf0wh7oeTVRp0h3SqzTM2smjEJnx9jF1+q3WSXLRB4OzSzq7VsJ/szcyK10ZGO5PxeQ4u9GAG/U+7xhs7ei1cJB/Er55Sg9SbjfkTpwlDv181UJCRJJ/IAcqyqezwTpB8e2trYmHKovUdt0KR9/tVkGa7hsNd5GfxTOUaAFc3zADqRVM+wGimtG0NYfOF2f8tkmBEAiMMLKq5pbAnHU723a1cm/nfVp7gvXfsnO0k2GvRuHzb8mxIhWLiAnwdK9gEu5za/jWxo/xIvf2sdJPYdWj+yfyzA2e1fJkx4uRUzX31CXxZvP2/tfEcnTdI0gxN+OH2eAMiPVswIDAQAB";
|
||||
// AlipayConfig alipayConfig = new AlipayConfig();
|
||||
// alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
// alipayConfig.setAppId("2021002156615717");
|
||||
// alipayConfig.setPrivateKey(privateKey);
|
||||
// alipayConfig.setFormat("json");
|
||||
// alipayConfig.setCharset("GBK");
|
||||
// alipayConfig.setAlipayPublicKey(alipayPublicKey);
|
||||
// alipayConfig.setSignType("RSA2");
|
||||
// //构造client
|
||||
// AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||
// AlipayOpenAppMiniTemplatemessageSendRequest request = new AlipayOpenAppMiniTemplatemessageSendRequest();
|
||||
// AlipayOpenAppMiniTemplatemessageSendModel model = new AlipayOpenAppMiniTemplatemessageSendModel();
|
||||
// //model.setFormId("2017010100000000580012345678");
|
||||
// model.setData("{\"keyword1\": {\"value\" : \"测试站点\"},\"keyword2\": {\"value\" : \"10.5kwh\"},\"keyword3\": {\"value\" : \"未检测到充电电流\"},\"keyword4\": {\"value\" : \"充电结束取出电池后关闭仓门\"}}");
|
||||
// model.setPage("page/component/index");
|
||||
// model.setUserTemplateId("3eaa5ea872894d018be2a900d9d6b12d");
|
||||
// model.setToUserId("2088102122458832");
|
||||
// request.setBizModel(model);
|
||||
// AlipayOpenAppMiniTemplatemessageSendResponse response = alipayClient.execute(request);
|
||||
// System.out.println(response.getBody());
|
||||
// if (response.isSuccess()) {
|
||||
// System.out.println("调用成功");
|
||||
// } else {
|
||||
// System.out.println("调用失败");
|
||||
// }
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,248 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.order.domain.XhpcChargingStationPower;
|
||||
import com.xhpc.order.mapper.XhpcChargingStationPowerMapper;
|
||||
import com.xhpc.order.service.IXhpcChargingStationPowerService;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-06-28 14:19
|
||||
*/
|
||||
@Service
|
||||
public class XhpcChargingStationPowerServiceImpl extends BaseService implements IXhpcChargingStationPowerService {
|
||||
|
||||
@Resource
|
||||
TokenService tokenService;
|
||||
@Resource
|
||||
private XhpcChargingStationPowerMapper xhpcChargingStationPowerMapper;
|
||||
|
||||
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",
|
||||
"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"};
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addChargingStationPower() {
|
||||
|
||||
//获取所有场站
|
||||
List<Map<String, Object>> chargingStationS = xhpcChargingStationPowerMapper.getChargingStationId();
|
||||
|
||||
if(chargingStationS !=null && chargingStationS.size()>0){
|
||||
//获取时间
|
||||
String now = DateUtil.now();
|
||||
int hh = Integer.parseInt(now.substring(11,13));
|
||||
int mm = Integer.parseInt(now.substring(14,16));
|
||||
int dd = Integer.parseInt(now.substring(17,19));
|
||||
int numbrt =0;
|
||||
String sterTime = "";
|
||||
String endTime = "";
|
||||
String substr = now.substring(0,13);
|
||||
if(mm>=30){
|
||||
numbrt = hh*2+1;
|
||||
sterTime = substr+":29:25";
|
||||
endTime = substr+":30:08";
|
||||
}else{
|
||||
numbrt = hh*2;
|
||||
sterTime = substr+":00:00";
|
||||
endTime = substr+":00:16";
|
||||
}
|
||||
for (int i = 0; i <chargingStationS.size() ; i++) {
|
||||
Map<String, Object> objectMap = chargingStationS.get(i);
|
||||
|
||||
Long chargingStationId =Long.valueOf(objectMap.get("chargingStationId").toString());
|
||||
String tenantId = objectMap.get("tenantId").toString();
|
||||
//查询是否已统计(订单编号、时间段)
|
||||
String subTime = now.substring(0,10);
|
||||
List<Map<String, Object>> xhpcTerminals = xhpcChargingStationPowerMapper.getXhpcTerminals(chargingStationId);
|
||||
|
||||
for (int j = 0; j < xhpcTerminals.size(); j++) {
|
||||
|
||||
Map<String, Object> terminal = xhpcTerminals.get(j);
|
||||
Long terminalId = Long.valueOf(terminal.get("terminalId").toString());
|
||||
int determine = xhpcChargingStationPowerMapper.duplicateStatistics(chargingStationId, terminalId,numbrt, subTime);
|
||||
if(determine==0){
|
||||
List<Map<String, Object>> xhpcRealTimeOrderList = xhpcChargingStationPowerMapper.getXhpcRealTimeOrderList(chargingStationId,terminalId, sterTime, endTime, numbrt,subTime);
|
||||
int finalNumbrt = numbrt;
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(xhpcRealTimeOrderList !=null && xhpcRealTimeOrderList.size()>0){
|
||||
for (int j = 0; j < xhpcRealTimeOrderList.size(); j++) {
|
||||
Map<String, Object> map = xhpcRealTimeOrderList.get(j);
|
||||
map.put("number", finalNumbrt);
|
||||
addXhpcChargingStationPower(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getListPage(Map<String, Object> params) {
|
||||
|
||||
|
||||
//桩的统计、该时段金额
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
//!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())
|
||||
if(false){
|
||||
Long logUserId = SecurityUtils.getUserId();
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
startPage();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
params.put("number",1);
|
||||
params.put("user",logOperatorId);
|
||||
//运营商看自己的场站
|
||||
list = xhpcChargingStationPowerMapper.getListPage(params);
|
||||
}else{
|
||||
params.put("number",2);
|
||||
params.put("user",logUserId);
|
||||
//查询赋值的场站
|
||||
list = xhpcChargingStationPowerMapper.getListPage(params);
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
params.put("number",0);
|
||||
params.put("user",1);
|
||||
list =xhpcChargingStationPowerMapper.getListPage(params);
|
||||
}
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
String[] shuzu ={"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47"};
|
||||
Map<String, Object> map = list.get(i);
|
||||
String status = map.get("status").toString();
|
||||
String[] split = status.split(",");
|
||||
String power = map.get("power").toString();
|
||||
String[] powerSplit = power.split(",");
|
||||
System.out.println("====i==="+i);
|
||||
System.out.println("====split.length==="+split.length);
|
||||
System.out.println("====chargingStationName==="+map.get("chargingStationName").toString());
|
||||
System.out.println("====time==="+map.get("time").toString());
|
||||
System.out.println("====powerSplit.length==="+powerSplit.length);
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
int time = Integer.parseInt(split[j]);
|
||||
if(map.get(enumeration[time]) !=null){
|
||||
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 v = aDouble + aDouble1;
|
||||
map.put(enumeration[time],new Formatter().format("%.2f", v).toString());
|
||||
}else{
|
||||
map.put(enumeration[time],new Formatter().format("%.2f", Double.valueOf(powerSplit[j].toString())).toString());
|
||||
}
|
||||
shuzu[time] ="0.00";
|
||||
}
|
||||
for (int j = 0; j < shuzu.length; j++) {
|
||||
if(!shuzu[j].equals("0.00")){
|
||||
map.put(enumeration[j],"0.00");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getChargingStationList() {
|
||||
return xhpcChargingStationPowerMapper.getChargingStationId();
|
||||
}
|
||||
|
||||
private void addXhpcChargingStationPower(Map<String, Object> map){
|
||||
XhpcChargingStationPower xhpcChargingStationPower =new XhpcChargingStationPower();
|
||||
if(map.get("chargeOrderId")!=null){
|
||||
xhpcChargingStationPower.setChargeOrderId(Long.valueOf(map.get("chargeOrderId").toString()));
|
||||
}
|
||||
if(map.get("number")!=null){
|
||||
xhpcChargingStationPower.setStatus(Integer.valueOf(map.get("number").toString()));
|
||||
}
|
||||
if(map.get("voltage")!=null){
|
||||
xhpcChargingStationPower.setVoltage(Double.valueOf(map.get("voltage").toString()));
|
||||
}
|
||||
if(map.get("electriccurrent")!=null){
|
||||
xhpcChargingStationPower.setCurrent(Double.valueOf(map.get("electriccurrent").toString()));
|
||||
}
|
||||
if(map.get("chargingStationId")!=null){
|
||||
xhpcChargingStationPower.setChargingStationId(Long.valueOf(map.get("chargingStationId").toString()));
|
||||
}
|
||||
if(map.get("chargingPileId")!=null){
|
||||
xhpcChargingStationPower.setChargingPileId(Long.valueOf(map.get("chargingPileId").toString()));
|
||||
}
|
||||
if(map.get("terminalId")!=null){
|
||||
xhpcChargingStationPower.setTerminalId(Long.valueOf(map.get("terminalId").toString()));
|
||||
}
|
||||
if(map.get("tenantId")!=null){
|
||||
xhpcChargingStationPower.setTenantId(map.get("tenantId").toString());
|
||||
}
|
||||
if(map.get("installedTotalPower")!=null){
|
||||
xhpcChargingStationPower.setInstalledTotalPower(Double.valueOf(map.get("installedTotalPower").toString()));
|
||||
}
|
||||
xhpcChargingStationPower.setCreateTime(new Date());
|
||||
xhpcChargingStationPowerMapper.addXhpcChargingStationPower(xhpcChargingStationPower);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getStatistics(String time){
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("chargingDegree","0.00");
|
||||
map.put("chargingTime","0.00");
|
||||
map.put("chargingNumber","0.00");
|
||||
map.put("powerPrice","0.00");
|
||||
map.put("servicePrice","0.00");
|
||||
map.put("totalPrice","0.00");
|
||||
map.put("activityPowerPriceTotal","0.00");
|
||||
map.put("activityServicePriceTotal","0.00");
|
||||
map.put("activityTotalPrice","0.00");
|
||||
map.put("promotionDiscount","0.00");
|
||||
map.put("actPrice","0.00");
|
||||
map.put("actPowerPrice","0.00");
|
||||
map.put("actServicePrice","0.00");
|
||||
map.put("internetCommission","0.00");
|
||||
map.put("internetSvcCommission","0.00");
|
||||
map.put("internetDegreeCommission","0.00");
|
||||
map.put("platformCommission","0.00");
|
||||
map.put("platformSvcCommisssion","0.00");
|
||||
map.put("operationCommission","0.00");
|
||||
map.put("operationSvcCommission","0.00");
|
||||
map.put("time",time);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
//获取时间
|
||||
String now = DateUtil.now();
|
||||
int hh = Integer.parseInt(now.substring(11,13));
|
||||
int mm = Integer.parseInt(now.substring(14,16));
|
||||
int dd = Integer.parseInt(now.substring(17,19));
|
||||
int numbrt =0;
|
||||
String sterTime = "";
|
||||
String endTime = "";
|
||||
String substr = now.substring(0,10);
|
||||
|
||||
System.out.println(substr);
|
||||
}
|
||||
|
||||
}
|
||||
@ -239,7 +239,7 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
|
||||
R r = workOrderService.addNewOrder("13","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber);
|
||||
}else{
|
||||
String rateModelId = cachePile.get("rateModelId").toString();
|
||||
System.out.println("============rateModelId===================="+rateModelId);
|
||||
|
||||
if(!modelId.equals(rateModelId)){
|
||||
R r = workOrderService.addNewOrder("13","费率不一致","该桩费率和场站设置的费率不一致","",chargingStationId,"PILE",serialNumber);
|
||||
}
|
||||
@ -253,16 +253,6 @@ public class XhpcPileRegularInspectServiceImpl extends BaseService implements IX
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str="3.9-08\\u0000\\u0000";
|
||||
for (int i = 0; i <str.length() ; i++) {
|
||||
if(i==0){
|
||||
System.out.println("============123456789===================="+str.substring(i,i+1));
|
||||
}else{
|
||||
System.out.println("============123456789===================="+str.substring(i-1,i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,14 @@ package com.xhpc.order.service.impl;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.ActivityInternetService;
|
||||
import com.xhpc.common.api.RefundOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.service.BaseService;
|
||||
@ -40,6 +43,7 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
@ -1106,8 +1110,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
|
||||
//电量的钱
|
||||
promotionDiscount = chargingDegree.multiply(new BigDecimal(userDiscount.get("servicePreferential").toString())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
logger.info("=============电量优惠==="+promotionDiscount);
|
||||
logger.info("=============服务费==="+surplusServicePrice);
|
||||
//当电量的折扣大于服务费时,电量==服务费
|
||||
if(surplusServicePrice.compareTo(promotionDiscount)>-1){
|
||||
surplusServicePrice= surplusServicePrice.subtract(promotionDiscount);
|
||||
@ -1299,7 +1301,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||
}
|
||||
|
||||
logger.info("<<<<<<<<<<<<<<<<33333>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||
logger.info("<<<<<<<<<<<<<<<<33333>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("source",xhpcChargeOrder.getSource());
|
||||
@ -1364,12 +1365,51 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||
if(userMessage !=null && userMessage.get("phone") != null){
|
||||
if("1".equals(xhpcChargingPile.get("type").toString())){
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
||||
paramMap.put("sumMoney", balance.toString());
|
||||
paramMap.put("phone", userMessage.get("phone").toString());
|
||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
if(UserTypeUtil.USER_TYPE.equals(source)){
|
||||
if(xhpcHistoryOrder.getChargingMode().equals("微信")){
|
||||
String phoneObject = redisService.getCacheObject("WXToken:wxd0a48e00319ef8a7");
|
||||
String serialNumber = xhpcHistoryOrder.getSerialNumber();
|
||||
int zhuang = Integer.parseInt(serialNumber.substring(10,14));
|
||||
int qiang = Integer.parseInt(serialNumber.substring(14,16));
|
||||
String spear = "A";
|
||||
if(qiang==2){
|
||||
spear = "B";
|
||||
}else if(qiang==3){
|
||||
spear = "C";
|
||||
}else if(qiang==4){
|
||||
spear = "D";
|
||||
}
|
||||
String str = operatorMessage.get("chargingStationName").toString().replace("小华充电", "");
|
||||
if(str.length()>13){
|
||||
str =str.substring(0,13);
|
||||
}
|
||||
WxMessageSend(userMessage.get("weixinOpenId").toString(),phoneObject,str+"-"+zhuang+"桩"+"-"+spear+"枪",xhpcHistoryOrder.getEndSoc(),xhpcHistoryOrder.getActPrice().toString(),xhpcChargeOrder.getChargingTime());
|
||||
}else if(xhpcHistoryOrder.getChargingMode().equals("支付宝")){
|
||||
String phone =userMessage.get("phone").toString();
|
||||
String phoneObject = redisService.getCacheObject(phone+":"+balance.toString());
|
||||
if (phoneObject == null || "".equals(phoneObject)) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
||||
paramMap.put("sumMoney", balance.toString());
|
||||
paramMap.put("phone", phone);
|
||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
redisService.setCacheObject(phone+":"+balance.toString(), balance.toString(), 300L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String phone =userMessage.get("phone").toString();
|
||||
String phoneObject = redisService.getCacheObject(phone+":"+balance.toString());
|
||||
if (phoneObject == null || "".equals(phoneObject)) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("elec", xhpcChargeOrder.getEndSoc());
|
||||
paramMap.put("sumMoney", balance.toString());
|
||||
paramMap.put("phone", phone);
|
||||
paramMap.put("content", "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + balance + "元,充电费用明细,请查询小华充电小程序,谢谢。");
|
||||
smsService.sendNotice(paramMap);
|
||||
redisService.setCacheObject(phone+":"+balance.toString(), balance.toString(), 300L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("sumMoney", balance.toString());
|
||||
@ -1946,4 +1986,67 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
return map;
|
||||
}
|
||||
|
||||
//发送充电成功订阅消息
|
||||
public static void WxMessageSend(String openid,String token,String chargingStationName,String soc,String money,String time){
|
||||
try{
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + token;
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("touser", openid);
|
||||
map.put("template_id", "a0N2aNLbgMEUKNIujRPuMM14Xw6qsfBZz9w2uVEmjlE");
|
||||
map.put("page", "pages/transition/transition");
|
||||
map.put("miniprogram_state", "developer");
|
||||
map.put("lang", "zh_CN");
|
||||
|
||||
Map<String, Object> map1 = new LinkedHashMap<>();
|
||||
map1.put("value", chargingStationName);
|
||||
Map<String, Object> map11 = new LinkedHashMap<>();
|
||||
map11.put("thing6", map1);
|
||||
|
||||
Map<String, Object> map2 = new LinkedHashMap<>();
|
||||
map2.put("value", soc);
|
||||
Map<String, Object> map22 = new LinkedHashMap<>();
|
||||
map22.put("character_string29", map2);
|
||||
map11.putAll(map22);
|
||||
Map<String, Object> map3 = new LinkedHashMap<>();
|
||||
map3.put("value", money);
|
||||
Map<String, Object> map33 = new LinkedHashMap<>();
|
||||
map33.put("amount33", map3);
|
||||
map11.putAll(map33);
|
||||
|
||||
|
||||
|
||||
Map<String, Object> map4 = new LinkedHashMap<>();
|
||||
map4.put("value", time);
|
||||
Map<String, Object> map44 = new LinkedHashMap<>();
|
||||
map44.put("thing8", map4);
|
||||
map11.putAll(map44);
|
||||
Map<String, Object> map5 = new LinkedHashMap<>();
|
||||
map5.put("value", "充电已完成请尽快离场,超时要收占位费哟");
|
||||
Map<String, Object> map55 = new LinkedHashMap<>();
|
||||
map55.put("thing35", map5);
|
||||
map11.putAll(map55);
|
||||
map.put("data", map11);
|
||||
JSONObject json = new JSONObject(map);
|
||||
System.out.println("json :"+json);
|
||||
String result = HttpUtils.post(url, json);
|
||||
JSONObject jsonObject =JSON.parseObject(result);
|
||||
System.out.println("jsonObject :"+jsonObject);
|
||||
System.out.println("========101010===========sessionKey:============1010===============");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// WxMessageSend("ot6ul4nlSC5ZZOC4rTLS5hedFTGk","69_G2hFrelhCsfOPuFB6OPP5I8j_DKdP-N6QF-shvpUFT2mQ-KjonSxbS_mrP5P9nYyat9OsJLZAcbYA4g5rWdn0i6whxueiU3hWfguoeqSnick1zAGvu7SKa50_VkKPAcAGABGR","黄金东二路","80","76.6");
|
||||
|
||||
String st ="小华充电润茂酒店用品城汽车充电站1";
|
||||
String str = st.replace("小华充电", "").substring(0,13);
|
||||
System.out.println(str);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -113,6 +113,8 @@
|
||||
<select id="getUserMessage" resultType="map">
|
||||
select
|
||||
app_user_id as appUserId,
|
||||
weixin_open_id as weixinOpenId,
|
||||
alipay_open_id as alipayOpenId,
|
||||
balance as balance,
|
||||
phone as phone,
|
||||
soc as soc,
|
||||
@ -428,8 +430,11 @@
|
||||
operator_id_evcs as operatorIdEvcs,
|
||||
soc as soc,
|
||||
platform_commission_rate as platformCommissionRate,
|
||||
(select name from xhpc_charging_station where charging_station_id=#{chargingStationId}) chargingStationName,
|
||||
maintenance_commission_rate as maintenanceCommissionRate
|
||||
from xhpc_operator where operator_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
from xhpc_operator
|
||||
|
||||
where operator_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</select>
|
||||
|
||||
<select id="getXhpcChargingPileById" resultType="map">
|
||||
|
||||
@ -0,0 +1,285 @@
|
||||
<?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.order.mapper.XhpcChargingStationPowerMapper">
|
||||
|
||||
<resultMap type="com.xhpc.order.domain.XhpcChargingStationPower" id="XhpcChargingStationPowerResult">
|
||||
<result column="charging_station_power_id" property="chargingStationPowerId"/>
|
||||
<result column="charging_station_id" property="chargingStationId"/>
|
||||
<result column="charge_order_id" property="chargeOrderId"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="voltage" property="voltage"/>
|
||||
<result column="current" property="current"/>
|
||||
<result column="charging_pile_id" property="chargingPileId"/>
|
||||
<result column="terminal_id" property="terminalId"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getChargingStationId" resultType="map">
|
||||
select
|
||||
charging_station_id as chargingStationId,
|
||||
tenant_id as tenantId
|
||||
from xhpc_charging_station where del_flag =0 and status=0
|
||||
</select>
|
||||
|
||||
<select id="getXhpcRealTimeOrderList" resultType="map">
|
||||
SELECT
|
||||
xrto.charging_order_id as chargeOrderId,
|
||||
xrto.voltage as voltage,
|
||||
xrto.electric_current as electriccurrent,
|
||||
xrto.charging_station_id as chargingStationId,
|
||||
xt.charging_pile_id as chargingPileId,
|
||||
xt.tenant_id as tenantId,
|
||||
xt.terminal_id as terminalId,
|
||||
(xcp.max_voltage * xcp.max_electric_current) installedTotalPower
|
||||
FROM
|
||||
xhpc_real_time_order AS xrto
|
||||
LEFT JOIN xhpc_charge_order AS xco ON xrto.charging_order_id =xco.charge_order_id
|
||||
LEFT JOIN xhpc_terminal as xt on xt.terminal_id = xco.terminal_id
|
||||
LEFT JOIN xhpc_charging_pile as xcp on xcp.charging_pile_id = xt.charging_pile_id
|
||||
where xrto.voltage is not null and xrto.electric_current is not null
|
||||
and xrto.create_time >= #{sterTime} and xrto.create_time <=#{endTime}
|
||||
and xrto.create_time like concat(#{subTime}, '%')
|
||||
and xrto.charging_station_id = #{chargingStationId}
|
||||
and xco.terminal_id =#{terminalId}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="duplicateStatistics" resultType="int">
|
||||
select count(*) from xhpc_charging_station_power where `status`=#{number} and charging_station_id=#{chargingStationId} and terminal_id =#{terminalId} and create_time like concat(#{subTime}, '%')
|
||||
</select>
|
||||
|
||||
<select id="getXhpcTerminals" resultType="map">
|
||||
SELECT terminal_id terminalId from xhpc_terminal where charging_station_id =#{chargingStationId} and del_flag =0
|
||||
</select>
|
||||
|
||||
<insert id="addXhpcChargingStationPower">
|
||||
insert into xhpc_charging_station_power
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargeOrderId ">
|
||||
charge_order_id,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != voltage ">
|
||||
voltage,
|
||||
</if>
|
||||
<if test="null != current ">
|
||||
current,
|
||||
</if>
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != chargingPileId ">
|
||||
charging_pile_id,
|
||||
</if>
|
||||
<if test="null != terminalId ">
|
||||
terminal_id,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy ">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy ">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark ">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargeOrderId ">
|
||||
#{chargeOrderId},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != voltage ">
|
||||
#{voltage},
|
||||
</if>
|
||||
<if test="null != current ">
|
||||
#{current},
|
||||
</if>
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != chargingPileId ">
|
||||
#{chargingPileId},
|
||||
</if>
|
||||
<if test="null != terminalId ">
|
||||
#{terminalId},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy ">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy ">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark ">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="getListPage" resultType="map">
|
||||
select
|
||||
xcs.name as chargingStationName,
|
||||
DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') time,
|
||||
GROUP_CONCAT(REPLACE((xcsp.voltage*xcsp.current), ',', ''))as power,
|
||||
GROUP_CONCAT(xcsp.status) status
|
||||
from xhpc_charging_station_power as xcsp
|
||||
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcsp.charging_station_id
|
||||
left join xhpc_charging_pile as xcp on xcp.charging_pile_id = xcsp.charging_pile_id
|
||||
left join xhpc_terminal as xt on xt.terminal_id = xcsp.terminal_id
|
||||
where xcsp.del_flag = 0
|
||||
<if test="params.chargingStationId !=null">
|
||||
and xcsp.charging_station_id =#{params.chargingStationId}
|
||||
</if>
|
||||
<if test="params.chargingPileId !=null">
|
||||
and xcsp.charging_pile_id =#{params.chargingPileId}
|
||||
</if>
|
||||
<if test="params.terminalId !=null">
|
||||
and xcsp.terminal_id =#{params.terminalId}
|
||||
</if>
|
||||
<if test="params.operatorId !=null">
|
||||
and xcsp.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.startTime !=null and params.startTime !=''">
|
||||
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') >=#{params.startTime}
|
||||
</if>
|
||||
<if test="params.endTime !=null and params.endTime !=''">
|
||||
and DATE_FORMAT(xcsp.create_time,'%Y-%m-%d') <= #{params.endTime}
|
||||
</if>
|
||||
<if test="params.number==1">
|
||||
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
||||
</if>
|
||||
<if test="params.number==2">
|
||||
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
||||
</if>
|
||||
GROUP BY xcsp.charging_station_id,DATE_FORMAT(xcsp.create_time,'%Y-%m-%d')
|
||||
ORDER BY DATE_FORMAT(xcsp.create_time,'%Y-%m-%d'),xcsp.charging_station_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- <select id="getListPage" resultType="map">-->
|
||||
<!-- select-->
|
||||
<!-- xcs.name as chargingStationName,-->
|
||||
<!-- xcsp.status as status,-->
|
||||
<!-- xcsp.voltage as voltage,-->
|
||||
<!-- xcsp.current as current,-->
|
||||
<!-- format(ifnull((xcsp.voltage*xcsp.current),0),2) as power,-->
|
||||
<!-- case when xcsp.status=0 then "00:00"-->
|
||||
<!-- when xcsp.status=1 then "00:30"-->
|
||||
<!-- when xcsp.status=2 then "01:00"-->
|
||||
<!-- when xcsp.status=3 then "01:30"-->
|
||||
<!-- when xcsp.status=4 then "02:00"-->
|
||||
<!-- when xcsp.status=5 then "02:30"-->
|
||||
<!-- when xcsp.status=6 then "03:00"-->
|
||||
<!-- when xcsp.status=7 then "03:30"-->
|
||||
<!-- when xcsp.status=8 then "04:00"-->
|
||||
<!-- when xcsp.status=9 then "04:30"-->
|
||||
<!-- when xcsp.status=10 then "05:00"-->
|
||||
<!-- when xcsp.status=11 then "05:30"-->
|
||||
<!-- when xcsp.status=12 then "06:00"-->
|
||||
<!-- when xcsp.status=13 then "06:30"-->
|
||||
<!-- when xcsp.status=14 then "07:00"-->
|
||||
<!-- when xcsp.status=15 then "07:30"-->
|
||||
<!-- when xcsp.status=16 then "08:00"-->
|
||||
<!-- when xcsp.status=17 then "08:30"-->
|
||||
<!-- when xcsp.status=18 then "09:00"-->
|
||||
<!-- when xcsp.status=19 then "09:30"-->
|
||||
<!-- when xcsp.status=20 then "10:00"-->
|
||||
<!-- when xcsp.status=21 then "10:30"-->
|
||||
<!-- when xcsp.status=22 then "11:00"-->
|
||||
<!-- when xcsp.status=23 then "11:30"-->
|
||||
<!-- when xcsp.status=24 then "12:00"-->
|
||||
<!-- when xcsp.status=25 then "12:30"-->
|
||||
<!-- when xcsp.status=26 then "13:00"-->
|
||||
<!-- when xcsp.status=27 then "13:30"-->
|
||||
<!-- when xcsp.status=28 then "14:30"-->
|
||||
<!-- when xcsp.status=29 then "15:00"-->
|
||||
<!-- when xcsp.status=30 then "15:00"-->
|
||||
<!-- when xcsp.status=31 then "15:30"-->
|
||||
<!-- when xcsp.status=32 then "16:00"-->
|
||||
<!-- when xcsp.status=33 then "16:30"-->
|
||||
<!-- when xcsp.status=34 then "17:00"-->
|
||||
<!-- when xcsp.status=35 then "17:30"-->
|
||||
<!-- when xcsp.status=36 then "18:00"-->
|
||||
<!-- when xcsp.status=37 then "18:30"-->
|
||||
<!-- when xcsp.status=38 then "19:00"-->
|
||||
<!-- when xcsp.status=39 then "19:30"-->
|
||||
<!-- when xcsp.status=40 then "20:00"-->
|
||||
<!-- when xcsp.status=41 then "20:30"-->
|
||||
<!-- when xcsp.status=42 then "21:00"-->
|
||||
<!-- when xcsp.status=43 then "21:30"-->
|
||||
<!-- when xcsp.status=44 then "22:00"-->
|
||||
<!-- when xcsp.status=45 then "22:30"-->
|
||||
<!-- when xcsp.status=46 then "23:00"-->
|
||||
<!-- when xcsp.status=47 then "23:30"-->
|
||||
<!-- end time-->
|
||||
<!-- from xhpc_charging_station_power as xcsp-->
|
||||
<!-- left join xhpc_charging_station as xcs on xcs.charging_station_id = xcsp.charging_station_id-->
|
||||
<!-- left join xhpc_charging_pile as xcp on xcp.charging_pile_id = xcsp.charging_pile_id-->
|
||||
<!-- left join xhpc_terminal as xt on xt.terminal_id = xcsp.terminal_id-->
|
||||
<!-- where xcsp.del_flag = 0-->
|
||||
<!-- <if test="params.chargingStationId !=null">-->
|
||||
<!-- and xcsp.charging_station_id =#{params.chargingStationId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.chargingPileId !=null">-->
|
||||
<!-- and xcsp.charging_pile_id =#{params.chargingPileId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.terminalId !=null">-->
|
||||
<!-- and xcsp.terminal_id =#{params.terminalId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.operatorId !=null">-->
|
||||
<!-- and xcsp.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.startTime !=null and params.startTime !=''">-->
|
||||
<!-- and xcsp.terminal_id =#{params.startTime}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.endTime !=null and params.endTime !=''">-->
|
||||
<!-- and xcsp.terminal_id =#{params.endTime}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.number==1">-->
|
||||
<!-- and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="params.number==2">-->
|
||||
<!-- and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY xcsp.status-->
|
||||
<!-- </select>-->
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -120,7 +120,7 @@ public class AlipayPaymentController {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", BigDecimal.valueOf(Double.parseDouble(amount)), "2", orderNumber,userType);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", new BigDecimal(amount), "2", orderNumber,userType);
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
|
||||
/** 初始化 **/
|
||||
|
||||
@ -117,18 +117,17 @@ public class WxPaymentController {
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
}
|
||||
Double amount1 = Double.parseDouble(amount) * 100;
|
||||
BigDecimal amount1 = new BigDecimal(amount).multiply(new BigDecimal(100));
|
||||
String orderNumber = StringUtils.numFormat(Long.parseLong(userId), 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
if (0.0 == amount1) {
|
||||
if (amount1.compareTo(new BigDecimal(0.0))==0) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为0");
|
||||
}
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, tenantId);
|
||||
if(xhpcSettingConfig ==null){
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
}
|
||||
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), "1", orderNumber,userType);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, new BigDecimal(amount), "1", orderNumber,userType);
|
||||
//附加数据(否)
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
//商品描述(是)
|
||||
|
||||
@ -30,9 +30,7 @@ public class XhpcCommonPaymentController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/settingConfig")
|
||||
public R settingConfig(Integer status, String tenantId) {
|
||||
System.out.println("==================获取支付配置========================");
|
||||
System.out.println("==================获取支付配置========status==============="+status);
|
||||
System.out.println("==================获取支付配置========tenantId================"+tenantId);
|
||||
|
||||
return R.ok(xhpcCommonPayment.getXhpcSettingConfigTenantId(status, tenantId));
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +87,11 @@ public class XhpcRechargeOrderController extends BaseController {
|
||||
return AjaxResult.success(iXhpcRechargeOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId));
|
||||
}
|
||||
|
||||
@GetMapping("/sumUserMoney")
|
||||
@ApiOperation(value = "充值金额")
|
||||
public AjaxResult sumUserMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId) {
|
||||
return AjaxResult.success(iXhpcRechargeOrderService.sumUserMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,source,userId));
|
||||
}
|
||||
/**
|
||||
* 每隔30分钟,清理一次未支付的订单
|
||||
*/
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
@ -14,6 +16,7 @@ import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.utils.WXPayUtil;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
@ -257,8 +260,13 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
}else{
|
||||
phone=xhpcRefundOrder.get("communityPhone").toString();
|
||||
}
|
||||
logger.info("++++++++++++xhpcRefundOrder++++++++++++++++");
|
||||
logger.info("++++++++++++xhpcRefundOrder++++++++++++++++"+xhpcRefundOrder.toString());
|
||||
logger.info("++++++++++++xhpcRefundOrder++++++++++++++++");
|
||||
|
||||
String userId = StringUtils.valueOf(xhpcRefundOrder.get("userId"));
|
||||
Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount")));
|
||||
BigDecimal amount = new BigDecimal(xhpcRefundOrder.get("amount").toString());
|
||||
logger.info("++++++++++++amount++++++++++++++++"+amount);
|
||||
String amountRefundOrder = "-" + amount.toString();
|
||||
String tenantId = StringUtils.valueOf(xhpcRefundOrder.get("tenantId"));
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, xhpcRefundOrder.get("tenantId").toString());
|
||||
@ -298,7 +306,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
String openId = StringUtils.valueOf(xhpcRefundOrder.get("openId"));
|
||||
//Double amount = Double.parseDouble(StringUtils.valueOf(xhpcRefundOrder.get("amount")));
|
||||
//退款金额单位为分
|
||||
Double value = amount * 100;
|
||||
BigDecimal value = amount.multiply(new BigDecimal(100));
|
||||
Integer refund_fee = value.intValue();
|
||||
if (refund_fee <= 0) {
|
||||
refundOrder.setStatus(2);
|
||||
@ -315,7 +323,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
updateXhpcRefundOrder(refundOrder,amountRefundOrder,userId,phone,2,source,tenantId);
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
}
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(amount);
|
||||
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("余额不足");
|
||||
@ -331,7 +339,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "用户不存在");
|
||||
}
|
||||
String balance = StringUtils.valueOf(communityPersonnel.get("balance"));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(BigDecimal.valueOf(amount));
|
||||
BigDecimal surplus = BigDecimal.valueOf(Double.valueOf(balance)).subtract(amount);
|
||||
if (surplus.compareTo(BigDecimal.ZERO) == -1) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark("余额不足");
|
||||
@ -363,7 +371,10 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
} finally {
|
||||
httpPost.abort();
|
||||
}
|
||||
return parseXml(result, xhpcRefundAudit.getRefundOrderId(), BigDecimal.valueOf(amount), userId,phone,source,tenantId);
|
||||
logger.info("++++++++++++amount++++++++++++++++"+amount);
|
||||
logger.info("++++++++++++amount++++++++++++++++"+amount);
|
||||
logger.info("++++++++++++amount++++++++++++++++"+amount);
|
||||
return parseXml(result, xhpcRefundAudit.getRefundOrderId(), amount, userId,phone,source,tenantId);
|
||||
}
|
||||
|
||||
|
||||
@ -461,6 +472,9 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
try {
|
||||
Map<String, String> map = WXPayUtil.xmlToMap(result);
|
||||
String result_code = map.get("result_code");
|
||||
logger.info("++++++++++++退款信息++++++++++++++++");
|
||||
logger.info("++++++++++++退款信息++++++++++++++++"+map.toString());
|
||||
logger.info("++++++++++++退款信息++++++++++++++++");
|
||||
if ("FAIL".equals(result_code)) {
|
||||
refundOrder.setStatus(2);
|
||||
refundOrder.setRemark(map.get("err_code_des").toString());
|
||||
@ -484,6 +498,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
BigDecimal surplus =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(amount);
|
||||
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(Long.parseLong(userId), surplus,null);
|
||||
}
|
||||
|
||||
refundOrder.setStatus(1);
|
||||
refundOrder.setRemark("微信退款成功");
|
||||
refundOrder.setPaymentNo(map.get("payment_no").toString());
|
||||
@ -745,6 +760,7 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
//后期可以增加短信通知
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0/10 * * * ?")
|
||||
@GetMapping("/moneyPageTime")
|
||||
public void moneyPageTime(){
|
||||
|
||||
@ -61,11 +61,14 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
return AjaxResult.error(HttpStatus.ERROR_STATUS, "大客户不支持退款");
|
||||
}
|
||||
String amount = StringUtils.valueOf(map.get("amount"));
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
if (StringUtils.isEmpty(amount)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能为空");
|
||||
} else {
|
||||
if (new BigDecimal(1).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款金额不能少于1元");
|
||||
if("1".equals(type)){
|
||||
if (new BigDecimal(0.3).compareTo(new BigDecimal(amount)) == 1) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "微信平台规定退款金额不能少于0.3元");
|
||||
}
|
||||
}
|
||||
}
|
||||
//用户信息id
|
||||
@ -78,7 +81,7 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
|
||||
}
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
|
||||
}
|
||||
@ -165,6 +168,11 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
return AjaxResult.success(iXhpcRefundOrderService.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type));
|
||||
}
|
||||
|
||||
@GetMapping("/sumUserMoney")
|
||||
@ApiOperation(value = "退款统计订单")
|
||||
public AjaxResult sumUserMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer userId) {
|
||||
return AjaxResult.success(iXhpcRefundOrderService.sumUserMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type,userId));
|
||||
}
|
||||
/**
|
||||
* 自动申请退款
|
||||
*/
|
||||
|
||||
@ -61,6 +61,7 @@ public interface XhpcRechargeOrderMapper {
|
||||
*/
|
||||
public Map<String, Object> sumMoney(@Param("phone")String phone,@Param("rechargeOrderNumber") String rechargeOrderNumber,@Param("status") String status,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId,@Param("tenantId")String tenantId,@Param("time1")String time1,@Param("time2")String time2,@Param("time3")String time3,@Param("time4")String time4);
|
||||
|
||||
public Map<String, Object> sumUserMoney(@Param("phone")String phone,@Param("rechargeOrderNumber") String rechargeOrderNumber,@Param("status") String status,@Param("createTimeStart") String createTimeStart,@Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("source")Integer source,@Param("userId")Integer userId,@Param("tenantId")String tenantId);
|
||||
|
||||
/**
|
||||
* 查询充值订单详情
|
||||
|
||||
@ -79,6 +79,8 @@ public interface XhpcRefundOrderMapper {
|
||||
public Map<String, Object> sumMoney(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("time1")String time1,@Param("time2")String time2,@Param("time3")String time3,@Param("time4")String time4);
|
||||
|
||||
|
||||
public Map<String, Object> sumUserMoney(@Param("phone") String phone, @Param("refundOrderNumber") String refundOrderNumber, @Param("status") String status, @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd,@Param("type")Integer type,@Param("tenantId")String tenantId,@Param("userId")Integer userId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户id查询未完成充电订单
|
||||
|
||||
@ -68,6 +68,8 @@ public interface IXhpcRechargeOrderService {
|
||||
*/
|
||||
public Map<String, Object> sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId);
|
||||
|
||||
public Map<String, Object> sumUserMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer source,Integer userId);
|
||||
|
||||
/**
|
||||
* 新增 充值订单
|
||||
*
|
||||
@ -100,4 +102,4 @@ public interface IXhpcRechargeOrderService {
|
||||
* 每隔30分钟,清理一次未支付的订单
|
||||
*/
|
||||
public void updateRechargeOrderStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,8 @@ public interface IXhpcRefundOrderService {
|
||||
*/
|
||||
public Map<String, Object> sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
|
||||
|
||||
public Map<String, Object> sumUserMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type,Integer userId);
|
||||
|
||||
/**
|
||||
* 新增 退款订单
|
||||
*
|
||||
@ -113,4 +115,4 @@ public interface IXhpcRefundOrderService {
|
||||
* type 1 小于101元 2大于100元
|
||||
*/
|
||||
public List<Long> moneyPage(Integer type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,10 +216,7 @@ public class AlipayService implements AlipayInterface {
|
||||
AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest();
|
||||
request.setBizContent("{\"out_request_no\":\"" + outRequestNo + "\",\"trade_no\":\"" + tradeNo + "\",\"royalty_parameters\":[{\"trans_in\":\"" + transIn + "\",\"amount\":" + amount + ",\"trans_in_type\":\"userId\"}]}");
|
||||
AlipayTradeOrderSettleResponse response = alipayClient.certificateExecute(request);
|
||||
System.out.println("==============================================");
|
||||
System.out.println(response);
|
||||
System.out.println("==============================================");
|
||||
System.out.println(response.getBody());
|
||||
|
||||
if (response.isSuccess()) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@ -140,6 +140,12 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
return xhpcRechargeOrderMapper.sumMoney(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd, type,source,userId,loginUser.getTenantId(),time1,time2,time3,time4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> sumUserMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer source,Integer userId) {
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
//昨日用户的活跃度
|
||||
return xhpcRechargeOrderMapper.sumUserMoney(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd, type,source,userId,loginUser.getTenantId());
|
||||
}
|
||||
/**
|
||||
* 新增 充值订单
|
||||
*
|
||||
|
||||
@ -149,6 +149,11 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
return xhpcRefundOrderMapper.sumMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd, type,loginUser.getTenantId(),time1,time2,time3,time4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> sumUserMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type,Integer userId) {
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
return xhpcRefundOrderMapper.sumUserMoney(phone, refundOrderNumber, status, createTimeStart, createTimeEnd, type,loginUser.getTenantId(),userId);
|
||||
}
|
||||
/**
|
||||
* 新增 退款订单
|
||||
*
|
||||
@ -245,4 +250,4 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
return xhpcRefundOrderMapper.moneyPage(type);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +224,13 @@
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="sumUserMoney" resultType="map">
|
||||
select
|
||||
ifnull(sum(xro.amount),0) amount
|
||||
from xhpc_recharge_order xro
|
||||
where xro.del_flag = 0 and xro.user_id =#{userId}
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="infoRechargeOrderNumber" parameterType="java.lang.String" resultMap="XhpcRechargeOrderResult">
|
||||
select *
|
||||
@ -236,4 +242,4 @@
|
||||
<update id="updateRechargeOrderStatus">
|
||||
update xhpc_recharge_order set del_flag =1 where status=0 and TIMESTAMPDIFF(MINUTE,create_time,now())>30
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -256,6 +256,14 @@
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="sumUserMoney" resultType="map">
|
||||
select
|
||||
ifnull(sum(xro.amount),0) amount
|
||||
from xhpc_refund_order xro
|
||||
where xro.del_flag = 0 and xro.examine_status=1 and xro.status =1 and xro.user_id =#{userId}
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getNotChargeOrder" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
select xco.*
|
||||
from xhpc_charge_order xco
|
||||
@ -338,4 +346,4 @@
|
||||
<update id="updateRefundApplication">
|
||||
UPDATE xhpc_community_personnel set is_refund_application=#{isRefundApplication} where community_personnel_id=#{userId}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -395,4 +396,26 @@ public class ChargingController {
|
||||
return HexUtils.toBytes(msg);
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Integer f70C0000 = HexUtils.reverseHexInt("16D6870400");
|
||||
System.out.println("f70C0000 转化成="+f70C0000);
|
||||
|
||||
Integer f70C0001 = HexUtils.reverseHexInt("D8B68A0400");
|
||||
System.out.println("f70C0001 转化成="+f70C0001);
|
||||
|
||||
Integer f70C0002 = HexUtils.reverseHexInt("C2E00200");
|
||||
System.out.println("f70C0002 转化成="+f70C0002);
|
||||
// String s = toHexInt(3532);
|
||||
// System.out.println("3532 转化成BIN码="+s);
|
||||
// byte[] bytes = HexUtils.toBytes("80836000150001022305301518050003");
|
||||
// System.out.println("String 转化成Byte[]="+ Arrays.toString(bytes));
|
||||
// String msg = HexUtils.toHex(bytes);
|
||||
// System.out.println("Byte 转化成String="+ msg);
|
||||
double vs = 76011030;
|
||||
double v = vs / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
System.out.println(df.format(v));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ 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.enums.StationDeviceEnum;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.logic.RateModelRequestLogic;
|
||||
import com.xhpc.pp.logic.RemoteRebootDataLogic;
|
||||
@ -13,6 +14,7 @@ import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.utils.HexUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quickserver.net.server.ClientHandler;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -48,6 +50,8 @@ public class PileController {
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
|
||||
|
||||
@PostMapping("pile/whitelist/add/{stationId}/{version}")
|
||||
public Object addWhitelist(@PathVariable("stationId") Long stationId,
|
||||
@PathVariable("version") String version,
|
||||
@ -74,8 +78,23 @@ public class PileController {
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(pkey);
|
||||
cachePile.put("stationId", stationId);
|
||||
cachePile.put("version", version);
|
||||
REDIS.setCacheMap(pkey, cachePile);
|
||||
XhpcChargingPile pileExample = new XhpcChargingPile();
|
||||
pileExample.setSerialNumber(pileNo);
|
||||
Example<XhpcChargingPile> example = Example.of(pileExample);
|
||||
XhpcChargingPile xhpcChargingPile = deviceMessageMapper.getXhpcChargingPile(pileNo);
|
||||
if (xhpcChargingPile != null) {
|
||||
cachePile.put("connectorType", xhpcChargingPile.getConnectorType() == null ? 4 :
|
||||
xhpcChargingPile.getConnectorType());
|
||||
cachePile.put("voltageUpperLimits", xhpcChargingPile.getMaxVoltage().intValue());
|
||||
cachePile.put("voltageLowerLimits", xhpcChargingPile.getMinVoltage().intValue());
|
||||
cachePile.put("currentLimit", xhpcChargingPile.getCurrent());
|
||||
cachePile.put("power", xhpcChargingPile.getPower());
|
||||
cachePile.put("nationalStandard", xhpcChargingPile.getNationalStandard().equals("2011") ? 1 : 2);
|
||||
cachePile.put("equipmentType", xhpcChargingPile.getEquipmentType());
|
||||
REDIS.setCacheMap("pile:".concat(pileNo), cachePile);
|
||||
}
|
||||
}
|
||||
//添加桩和枪信息
|
||||
log.info("station [{}] pile whitelist add: [{}]", stationId, Arrays.toString(pileNoSet.toArray()));
|
||||
return R.ok();
|
||||
}
|
||||
@ -107,6 +126,7 @@ public class PileController {
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("native/pile/{pileNo}/rateModel")
|
||||
public Object configRateModel(@PathVariable("pileNo") String pileNo, @RequestBody String msg) {
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.pp.server.ChargingPileServer.default_version;
|
||||
@ -176,12 +177,17 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
String tel = (String) cacheOrder.get("tel");
|
||||
if (alerted == null && tel != null) {
|
||||
if (r.getCode() == 200) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("battery", stopSoc.toString());
|
||||
paramMap.put("phone", tel);
|
||||
paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" + stopSoc + "%)。");
|
||||
smsService.sendNotice(paramMap);
|
||||
cacheOrder.put("socalerted", "true");
|
||||
String phoneObject = REDIS.getCacheObject(tel+":"+stopSoc.toString());
|
||||
if (phoneObject == null || "".equals(phoneObject)) {
|
||||
// HashMap<String, String> paramMap = new HashMap<>();
|
||||
// paramMap.put("battery", stopSoc.toString());
|
||||
// paramMap.put("phone", tel);
|
||||
// paramMap.put("content", "【小华充电】尊敬的用户,你的车辆已充电达至设定的SOC(" + stopSoc + "%)。");
|
||||
// smsService.sendNotice(paramMap);
|
||||
// cacheOrder.put("socalerted", "true");
|
||||
// REDIS.setCacheObject(tel+":"+stopSoc.toString(), stopSoc.toString(), 300L, TimeUnit.SECONDS);
|
||||
pileOrderService.constantSoc(orderNo,stopSoc.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ public class RemoteStartReplyDataLogic implements ServiceLogic {
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
RemoteStartReplyData remoteStartReplyData = objectMapper.convertValue(req, RemoteStartReplyData.class);
|
||||
|
||||
@ -21,10 +21,10 @@ public class ServiceMainLogic {
|
||||
private Map<String, ServiceLogic> serviceLogics;
|
||||
|
||||
public ServiceResult process(ServiceParameter sp) {
|
||||
|
||||
ServiceResult result;
|
||||
try {
|
||||
ServiceLogic logic = getServiceLogic(sp.getServiceName());
|
||||
|
||||
// startTransaction(sp);
|
||||
if (sp.getParameters() == null) {
|
||||
throw TxException.INVALID_PARAMETER;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.xhpc.pp.mapper;
|
||||
|
||||
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface XhpcDeviceMessageMapper {
|
||||
@ -11,4 +13,7 @@ public interface XhpcDeviceMessageMapper {
|
||||
|
||||
|
||||
void deleteByLastThreeMonth(String expireDate);
|
||||
|
||||
XhpcChargingPile getXhpcChargingPile(@Param("pileNo") String pileNo);
|
||||
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
||||
if (len > data.length) {
|
||||
String hex = toHex(data);
|
||||
if (!hex.startsWith("25", 10)) {
|
||||
log.error("incorrect input data|{}| len[{}]", hex, data.length);
|
||||
log.error("104incorrect input data|{}| len[{}]", hex, data.length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,6 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
||||
}
|
||||
|
||||
private Map<String, Object> analysis(byte[] data, String service, String ver) throws TxException {
|
||||
|
||||
List<ServiceField> fieldList = FieldLogic.fieldList(ver, service);
|
||||
if (fieldList == null || fieldList.isEmpty())
|
||||
throw TxException.INNER_ERROR("field mapper not found");
|
||||
@ -243,4 +242,14 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
|
||||
return toHex(ArrayUtils.subarray(data, 3, 5));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
byte[] data ={104, 34, 0, -125, 0, 1, -128, -125, 96, 0, 6, 0, 1, 1, 2, 12, 78, 71, 53, 46, 52, 46, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -89, -69};
|
||||
|
||||
byte[] datas ={100,101,102,103,104,105,106,107,108,10,11,12,13,14,15,16,17,18,19,109};
|
||||
int i = HexUtils.toInteger(datas, 1, 2) ;
|
||||
|
||||
System.out.println(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.tx;
|
||||
|
||||
import com.xhpc.pp.logic.ServiceMainLogic;
|
||||
import com.xhpc.pp.server.ChargingPileBinaryHandler;
|
||||
import com.xhpc.pp.utils.JSONUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -22,6 +25,8 @@ public class ServiceController {
|
||||
@Autowired
|
||||
private ServiceMainLogic servicemainLogic;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ServiceController.class);
|
||||
|
||||
@RequestMapping(value = "/api")
|
||||
@ResponseBody
|
||||
public String index(@RequestBody Map<String, Object> req) throws IOException {
|
||||
|
||||
@ -48,4 +48,10 @@
|
||||
delete from xhpc_message
|
||||
where create_time <![CDATA[ <= ]]> #{expireDate};
|
||||
</delete>
|
||||
|
||||
<select id="getXhpcChargingPile" parameterType="com.xhpc.evcs.domain.XhpcChargingPile">
|
||||
select * from xhpc_charging_pile where serial_number =#{pileNo} and del_flag =0 limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -2,9 +2,11 @@ package com.xhpc.user.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.internal.util.AlipayEncrypt;
|
||||
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
||||
import com.xhpc.common.api.SettingConfigService;
|
||||
@ -18,11 +20,14 @@ import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.user.service.IXhpcAppUserUserService;
|
||||
import com.xhpc.user.util.WechatDecryptDataUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
@ -35,6 +40,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* C端用户
|
||||
@ -53,6 +59,9 @@ public class XhpcAppUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* C端用户详情
|
||||
*/
|
||||
@ -68,8 +77,8 @@ public class XhpcAppUserController extends BaseController {
|
||||
*/
|
||||
//@PreAuthorize(hasPermi = "app:user:page")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(HttpServletRequest request,String phone) {
|
||||
List<Map<String, Object>> list = iXhpcAppUserUserService.selectAppUserList(request,phone);
|
||||
public TableDataInfo page(HttpServletRequest request, String phone) {
|
||||
List<Map<String, Object>> list = iXhpcAppUserUserService.selectAppUserList(request, phone);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -91,6 +100,7 @@ public class XhpcAppUserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@ -100,7 +110,6 @@ public class XhpcAppUserController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 以下为小程序接口
|
||||
*/
|
||||
@ -124,6 +133,16 @@ public class XhpcAppUserController extends BaseController {
|
||||
return iXhpcAppUserUserService.login(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* C端用户授权登录
|
||||
*/
|
||||
@ApiOperation("授权登录")
|
||||
@PostMapping("/loginPhone")
|
||||
public R<?> loginPhone(@RequestBody Map<String, Object> map) {
|
||||
return iXhpcAppUserUserService.loginPhone(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户详情
|
||||
*/
|
||||
@ -158,24 +177,26 @@ public class XhpcAppUserController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/jscode2session")
|
||||
@ApiOperation(value = "获取微信权限标识", notes = "jsCode")
|
||||
public R<?> jsCode(String jsCode, String encryptedData, String iv,String tenantId) {
|
||||
public R<?> jsCode(String jsCode, String encryptedData, String iv, String tenantId, String phoneCode) {
|
||||
if (StringUtils.isEmpty(jsCode)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "信息不完整");
|
||||
}
|
||||
encryptedData =encryptedData.replace(' ','+');
|
||||
if("".equals(tenantId) || null==tenantId){
|
||||
tenantId="000000";
|
||||
encryptedData = encryptedData.replace(' ', '+');
|
||||
if ("".equals(tenantId) || null == tenantId) {
|
||||
tenantId = "000000";
|
||||
}
|
||||
R r = settingConfigService.settingConfig(1, tenantId);
|
||||
if(r !=null && r.getCode()==200){
|
||||
Map<String, Object> mapConfig = (Map<String, Object>)r.getData();
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid="+mapConfig.get("wxAppId").toString()+"&secret="+mapConfig.get("wxAppSecret").toString()+"&js_code="+ jsCode + "&grant_type=authorization_code";
|
||||
if (r != null && r.getCode() == 200) {
|
||||
System.out.println("===========111========sessionKey:==============111=============");
|
||||
Map<String, Object> mapConfig = (Map<String, Object>) r.getData();
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
|
||||
String result = HttpUtils.get(url);
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
logger.info("========222===========sessionKey:============222===============");
|
||||
if (null != json) {
|
||||
String openid = json.getString("openid");
|
||||
String sessionKey = json.getString("session_key");
|
||||
System.out.println("sessionKey:"+sessionKey);
|
||||
logger.info("========333===========sessionKey:============333===============");
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
@ -184,24 +205,128 @@ public class XhpcAppUserController extends BaseController {
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("openid", openid);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if ((!"".equals(encryptedData) && encryptedData != null) && (!"".equals(iv) && iv != null)) {
|
||||
jsonObject = getPhoneNumber(encryptedData, sessionKey, iv);
|
||||
if (jsonObject !=null) {
|
||||
map.put("name", jsonObject.get("nickName"));
|
||||
map.put("sex", jsonObject.get("gender"));
|
||||
map.put("avatar", jsonObject.get("avatarUrl"));
|
||||
map.put("phone", jsonObject.get("purePhoneNumber"));
|
||||
if (phoneCode != null && !phoneCode.equals("")) {
|
||||
System.out.println("phoneCode:" + phoneCode);
|
||||
//小程序登录获取token
|
||||
String accesToken = getAccesToken(mapConfig.get("wxAppId").toString(), mapConfig.get("wxAppSecret").toString());
|
||||
//获取手机号
|
||||
String phoneCode1 = getPhoneCode(phoneCode, accesToken);
|
||||
if(phoneCode1 !=null &&!phoneCode1.equals("")){
|
||||
map.put("phone", phoneCode1);
|
||||
}
|
||||
logger.info("1111phone:"+ phoneCode1);
|
||||
}
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if ((!"".equals(encryptedData) && encryptedData != null) && (!"".equals(iv) && iv != null)) {
|
||||
// jsonObject = getPhoneNumber(encryptedData, sessionKey, iv);
|
||||
// if (jsonObject !=null) {
|
||||
// map.put("name", jsonObject.get("nickName"));
|
||||
// map.put("sex", jsonObject.get("gender"));
|
||||
// map.put("avatar", jsonObject.get("avatarUrl"));
|
||||
// map.put("phone", jsonObject.get("purePhoneNumber"));
|
||||
// }
|
||||
// }
|
||||
return R.ok(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
|
||||
@PostMapping("/jscodeSession")
|
||||
@ApiOperation(value = "获取微信权限标识", notes = "jsCode")
|
||||
public R<?> jscodeSession(String jsCode, String encryptedData, String iv, String tenantId, String phoneCode) {
|
||||
if (StringUtils.isEmpty(jsCode)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "信息不完整");
|
||||
}
|
||||
if ("".equals(tenantId) || null == tenantId) {
|
||||
tenantId = "000000";
|
||||
}
|
||||
R r = settingConfigService.settingConfig(1, tenantId);
|
||||
if (r != null && r.getCode() == 200) {
|
||||
System.out.println("========444===========sessionKey:============444===============");
|
||||
Map<String, Object> mapConfig = (Map<String, Object>) r.getData();
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
|
||||
String result = HttpUtils.get(url);
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
logger.info("========555===========sessionKey:============5555===============");
|
||||
if (null != json) {
|
||||
String openid = json.getString("openid");
|
||||
redisService.setCacheObject("WXToken:" + openid, openid, 115L, TimeUnit.MINUTES);
|
||||
String sessionKey = json.getString("session_key");
|
||||
logger.info("========666===========sessionKey:============666==============="+sessionKey);
|
||||
logger.info("========666===========sessionKey:============666===============");
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
if (StringUtils.isEmpty(sessionKey)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("openid", openid);
|
||||
if (phoneCode != null && !phoneCode.equals("")) {
|
||||
System.out.println("phoneCode:" + phoneCode);
|
||||
//小程序登录获取token
|
||||
String accesToken = getAccesToken(mapConfig.get("wxAppId").toString(), mapConfig.get("wxAppSecret").toString());
|
||||
//获取手机号
|
||||
String phoneCode1 = getPhoneCode(phoneCode, accesToken);
|
||||
if(phoneCode1 !=null &&!phoneCode1.equals("")){
|
||||
map.put("phone", phoneCode1);
|
||||
}
|
||||
logger.info("========666===========phoneCode1:============666==============="+phoneCode1);
|
||||
map.put("type",1);
|
||||
map.put("tenantId","000000");
|
||||
return loginPhone(map);
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "请重新授权登录");
|
||||
}
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "请重新授权登录");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//小程序登录获取token
|
||||
@ApiOperation("微信小程序登录token")
|
||||
@GetMapping("/getAccesToken")
|
||||
public String getAccesToken(String appid, String secret) {
|
||||
String captcha = redisService.getCacheObject("WXToken:" + appid);
|
||||
if (captcha == null || "".equals(captcha)) {
|
||||
logger.info("========777===========phoneCode1:============777===============");
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret;
|
||||
String result = HttpUtils.get(url);
|
||||
logger.info("========888===========phoneCode1:============888===============");
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
String accessToken = json.getString("access_token");
|
||||
redisService.setCacheObject("WXToken:" + appid, accessToken, 115L, TimeUnit.MINUTES);
|
||||
return accessToken;
|
||||
}
|
||||
return captcha;
|
||||
}
|
||||
|
||||
|
||||
//小程序获取手机号
|
||||
@ApiOperation("小程序获取手机号")
|
||||
@GetMapping("/getPhoneCode")
|
||||
public String getPhoneCode(String code, String token) {
|
||||
System.out.println("========888===========sessionKey:============888===============");
|
||||
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + token;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", code);
|
||||
JSONObject json = new JSONObject(map);
|
||||
String result = HttpUtils.post(url, json);
|
||||
System.out.println("========999===========sessionKey:============999===============");
|
||||
JSONObject jsonObject = JSON.parseObject(result);
|
||||
String errmsg = jsonObject.getString("errmsg");
|
||||
if ("ok".equals(errmsg)) {
|
||||
String phoneInfo = jsonObject.getString("phone_info");
|
||||
JSONObject jsonPhone = JSON.parseObject(phoneInfo);
|
||||
String phoneNumber = jsonPhone.getString("phoneNumber");
|
||||
return phoneNumber;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO 微信获取手机号
|
||||
* @author fjd
|
||||
@ -246,14 +371,13 @@ public class XhpcAppUserController extends BaseController {
|
||||
*/
|
||||
@ApiOperation("支付宝授权")
|
||||
@PostMapping("/alipayEmpower")
|
||||
public AjaxResult alipayEmpower(@RequestParam String code,String tenantId) throws Exception {
|
||||
if("".equals(tenantId) || null==tenantId){
|
||||
tenantId="000000";
|
||||
public R<?> alipayEmpower(@RequestParam String code, String tenantId) throws Exception {
|
||||
if ("".equals(tenantId) || null == tenantId) {
|
||||
tenantId = "000000";
|
||||
}
|
||||
R r = settingConfigService.settingConfig(2, tenantId);
|
||||
System.out.println("======================r========================="+r.getCode());
|
||||
if(r !=null && r.getCode()==200){
|
||||
Map<String, Object> map = (Map<String, Object>)r.getData();
|
||||
if (r != null && r.getCode() == 200) {
|
||||
Map<String, Object> map = (Map<String, Object>) r.getData();
|
||||
/** 初始化 **/
|
||||
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
||||
/** 支付宝网关 **/
|
||||
@ -286,13 +410,54 @@ public class XhpcAppUserController extends BaseController {
|
||||
if (response.isSuccess()) {
|
||||
System.out.println("调用成功");
|
||||
} else {
|
||||
return AjaxResult.error("获取失败!");
|
||||
return R.fail(500,"获取失败!");
|
||||
}
|
||||
return AjaxResult.success(response);
|
||||
return R.ok(response);
|
||||
}
|
||||
return AjaxResult.error("获取失败");
|
||||
return R.fail(500,"获取失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝授权
|
||||
*/
|
||||
@ApiOperation("支付宝授权手机号登录")
|
||||
@PostMapping("/alipayEmpowerPhone")
|
||||
public R<?> alipayEmpowerPhone(@RequestBody Map<String, Object> map) throws Exception {
|
||||
String openid = map.get("openid").toString();
|
||||
String tenantId = map.get("tenantId").toString();
|
||||
String response = map.get("response").toString();
|
||||
if ("".equals(tenantId) || null == tenantId) {
|
||||
tenantId = "000000";
|
||||
}
|
||||
if(response==null || "".equals(response)){
|
||||
return R.fail("获取失败");
|
||||
}
|
||||
// JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
// String accessToken = jsonObject.getString("response");
|
||||
try {
|
||||
String encryptType = "AES";
|
||||
String decryptKey ="RK+OjbMPhWuSEsnAX4Yjuw==";
|
||||
String charset = "UTF-8";
|
||||
String plainData = AlipayEncrypt.decryptContent(response, encryptType, decryptKey, charset);
|
||||
JSONObject phone = JSON.parseObject(plainData);
|
||||
String mobile = phone.getString("mobile");
|
||||
Map maps = new HashMap();
|
||||
maps.put("phone", mobile);
|
||||
maps.put("openid", openid);
|
||||
maps.put("type",2);
|
||||
maps.put("tenantId",tenantId);
|
||||
return loginPhone(maps);
|
||||
} catch (AlipayApiException e) {
|
||||
//解密异常, 记录日志
|
||||
//throw new Exception("解密异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return R.fail("获取手机号失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝授权
|
||||
*/
|
||||
@ -343,42 +508,83 @@ public class XhpcAppUserController extends BaseController {
|
||||
*/
|
||||
@ApiOperation("注销账号")
|
||||
@PostMapping("/logout")
|
||||
public R<?> logout(HttpServletRequest request,String phone, String code) {
|
||||
return iXhpcAppUserUserService.logout(request,phone, code);
|
||||
public R<?> logout(HttpServletRequest request, String phone, String code) {
|
||||
return iXhpcAppUserUserService.logout(request, phone, code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置小程序用户自动退款功能
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@ApiOperation("设置小程序用户自动退款功能")
|
||||
@PostMapping("/updateIsRefund")
|
||||
public R<?> updateIsRefund(@RequestBody Map<String, Object> map) {
|
||||
if(map !=null){
|
||||
if (map != null) {
|
||||
Long userId = Long.parseLong(map.get("userId").toString());
|
||||
Integer userType = Integer.parseInt(map.get("userType").toString());
|
||||
Integer isRefund = Integer.parseInt(map.get("isRefund").toString());
|
||||
return iXhpcAppUserUserService.updateIsRefund(userId,userType,isRefund);
|
||||
return iXhpcAppUserUserService.updateIsRefund(userId, userType, isRefund);
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置小程序用户电池保护
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@ApiOperation("设置小程序用户电池保护")
|
||||
@PostMapping("/batteryProtect")
|
||||
public R<?> batteryProtect(HttpServletRequest request,@RequestBody Map<String, Object> map) {
|
||||
if(map !=null){
|
||||
public R<?> batteryProtect(HttpServletRequest request, @RequestBody Map<String, Object> map) {
|
||||
if (map != null) {
|
||||
Integer soc = Integer.parseInt(map.get("soc").toString());
|
||||
Integer socProtect = Integer.parseInt(map.get("socProtect").toString());
|
||||
Integer userType = Integer.parseInt(map.get("userType").toString());
|
||||
return iXhpcAppUserUserService.batteryProtect(request,soc,socProtect,userType);
|
||||
return iXhpcAppUserUserService.batteryProtect(request, soc, socProtect, userType);
|
||||
}
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置每小时运行一次获取微信token
|
||||
* @param
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
@GetMapping("/getAccesTokenYu")
|
||||
public void getAccesTokenYu() {
|
||||
System.out.println("===================设置每小时运行一次获取微信token=========================");
|
||||
getAccesToken("wxd0a48e00319ef8a7", "e26d9088b58e24af69411d5933cece47");
|
||||
System.out.println("===================设置每小时运行一次获取微信token=========================");
|
||||
}
|
||||
|
||||
|
||||
//微信消息开通
|
||||
@GetMapping("/getPushMessage")
|
||||
public String getPushMessage(@RequestParam Map<String, String> params)throws Exception {
|
||||
// 微信发送的请求中 会有四个参数
|
||||
// 微信加密签名,signature结合了开发者填写的 token 参数和请求中的 timestamp 参数、nonce参数。
|
||||
String signature = params.get("signature");
|
||||
// 随机字符串
|
||||
String echostr = params.get("echostr");
|
||||
// 时间戳
|
||||
String timestamp = params.get("timestamp");
|
||||
// 随机数
|
||||
String nonce = params.get("nonce");
|
||||
// 消息推送配置中的 Token(令牌)
|
||||
String token = "sichuanxianghuakejiyouxiangongsi";
|
||||
// 验证
|
||||
String msgSignature = WechatDecryptDataUtil.getSHA1(token, timestamp, nonce);
|
||||
// 验证失败
|
||||
if (!signature.equals(msgSignature)) {
|
||||
return "false";
|
||||
}
|
||||
// 验证成功 将 echostr 原格式返回 ,即可完成验证
|
||||
return echostr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -66,6 +66,8 @@ public interface IXhpcAppUserUserService {
|
||||
*/
|
||||
public R<?> login(Map<String, Object> map);
|
||||
|
||||
public R<?> loginPhone(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 小程序用户退出
|
||||
*
|
||||
|
||||
@ -235,6 +235,18 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
return appLogin(phone, type, openid, tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> loginPhone(Map<String, Object> map) {
|
||||
String phone = StringUtils.valueOf(map.get("phone"));
|
||||
String type = StringUtils.valueOf(map.get("type"));
|
||||
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||
String openid = StringUtils.valueOf(map.get("openid"));
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.NOT_NULL, "openid不能为空");
|
||||
}
|
||||
return appLogin(phone, type, openid, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@ -301,8 +313,8 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
|
||||
redisService.deleteObject("pvToken:" + username);
|
||||
// 获取登录token
|
||||
|
||||
Map<String, Object> token = tokenService.createToken(userInfo);
|
||||
token.put("phone",username);
|
||||
return R.ok(token);
|
||||
}else{
|
||||
return R.fail(HttpStatus.DATA_ERROR, "无此账号,请重新输入账号登录");
|
||||
@ -363,6 +375,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId,new Date());
|
||||
// 获取登录token
|
||||
Map<String, Object> token = tokenService.createToken(userInfo);
|
||||
token.put("phone",username);
|
||||
return R.ok(token);
|
||||
}
|
||||
|
||||
|
||||
@ -2,13 +2,14 @@ package com.xhpc.user.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.bouncycastle.util.Arrays;
|
||||
import java.util.Arrays;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.Key;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.Security;
|
||||
|
||||
/**
|
||||
@ -87,4 +88,46 @@ public class WechatDecryptDataUtil {
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用SHA1算法生成安全签名
|
||||
*/
|
||||
public static String getSHA1(String... values) throws Exception {
|
||||
|
||||
try {
|
||||
String[] array = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
array[i] = values[i];
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// 字符串排序
|
||||
Arrays.sort(array);
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
sb.append(array[i]);
|
||||
}
|
||||
String str = sb.toString();
|
||||
// SHA1签名生成
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||
md.update(str.getBytes());
|
||||
byte[] digest = md.digest();
|
||||
|
||||
StringBuffer hexstr = new StringBuffer();
|
||||
String shaHex = "";
|
||||
for (int i = 0; i < digest.length; i++) {
|
||||
shaHex = Integer.toHexString(digest[i] & 0xFF);
|
||||
if (shaHex.length() < 2) {
|
||||
hexstr.append(0);
|
||||
}
|
||||
hexstr.append(shaHex);
|
||||
}
|
||||
return hexstr.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception("SHA1加密失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
<select id="getAppUser" resultType="map">
|
||||
select
|
||||
xau.app_user_id as appUserId,
|
||||
xau.weixin_open_id as weixinOpenId,
|
||||
xau.alipay_open_id as alipayOpenId,
|
||||
xau.phone as phone,
|
||||
xau.is_refund_application as isRefundApplication,
|
||||
xau.is_refund as isRefund,
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
create_by createBy ,create_time createTime,
|
||||
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
|
||||
from sys_user
|
||||
WHERE del_flag = 0 and user_type = '00'
|
||||
WHERE del_flag = 0 and user_type = '00' and user_id !=1
|
||||
<if test="userName != null and userName != ''">
|
||||
and user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user