mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-15 23:38:32 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -4,27 +4,28 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.JWTUtils;
|
||||
import com.jsowell.pile.domain.nanrui.NROrderInfo;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.PushStationInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.dto.nanrui.GetTokenDTO;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
|
||||
import com.jsowell.thirdparty.lianlian.common.CommonResult;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||
import com.jsowell.thirdparty.lianlian.util.Encodes;
|
||||
import com.jsowell.thirdparty.nanrui.service.NRService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -35,7 +36,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/nanrui")
|
||||
@RequestMapping("/jiangsu")
|
||||
public class NRController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
@@ -69,7 +70,7 @@ public class NRController extends BaseController {
|
||||
// 转换成相应对象
|
||||
QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class);
|
||||
Map<String, String> map = nrService.query_stations_info(queryStationInfoDTO);
|
||||
return CommonResult.success(0, "请求停止充电成功!", map.get("Data"), map.get("Sig"));
|
||||
return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig"));
|
||||
} catch (Exception e) {
|
||||
logger.error("南瑞平台查询充电站信息 error", e);
|
||||
}
|
||||
@@ -148,7 +149,7 @@ public class NRController extends BaseController {
|
||||
} catch (Exception e) {
|
||||
logger.error("南瑞平台查询充电电量信息 error", e);
|
||||
}
|
||||
return CommonResult.failed("查询设备接口状态异常");
|
||||
return CommonResult.failed("查询充电电量信息异常");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,4 +168,113 @@ public class NRController extends BaseController {
|
||||
return CommonResult.failed("获取token发生异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/v1/getToken")
|
||||
public String getToken(@RequestBody GetTokenDTO dto) {
|
||||
String token = nrService.getToken(dto.getUrlAddress(), dto.getOperatorId(), dto.getOperatorSecret(),
|
||||
dto.getDataSecretIv(), dto.getSignSecret(), dto.getDataSecret());
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送充电站信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/pushStationInfo")
|
||||
public RestApiResponse<?> pushStationInfo(@RequestBody PushStationInfoDTO dto) {
|
||||
logger.info("推送南瑞平台充电站信息 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String s = nrService.pushStationInfo(dto);
|
||||
response = new RestApiResponse<>(s);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("推送南瑞平台充电站信息 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("推送南瑞平台充电站信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("推送南瑞平台充电站信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送告警信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/pushAlarmInfo")
|
||||
public RestApiResponse<?> pushAlarmInfo(@RequestBody PushAlarmInfoDTO dto) {
|
||||
logger.info("推送南瑞平台告警信息 params:{}", JSONObject.toJSONString(dto));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
if (StringUtils.isBlank(String.valueOf(dto.getStationId()))) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
String s = nrService.pushAlarmInfo(dto);
|
||||
response = new RestApiResponse<>(s);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("推送南瑞平台告警信息 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("推送南瑞平台告警信息 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("推送南瑞平台告警信息 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备状态变化推送
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/v1/pushPileStatus")
|
||||
public RestApiResponse<?> pushPileStatus(@RequestBody RealTimeMonitorData data) {
|
||||
logger.info("推送南瑞平台设备状态变化推送 params:{}", JSONObject.toJSONString(data));
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String s = nrService.pushPileStatus(data);
|
||||
response = new RestApiResponse<>(s);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("推送南瑞平台设备状态变化推送 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("推送南瑞平台设备状态变化推送 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("推送南瑞平台设备状态变化推送 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充电电量信息推送
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/pushOrderInfo/{orderCode}")
|
||||
public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode") String orderCode) {
|
||||
logger.info("南瑞平台充电电量信息推送 params:{}", orderCode);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String s = nrService.pushOrderInfo(orderCode);
|
||||
response = new RestApiResponse<>(s);
|
||||
}catch (BusinessException e) {
|
||||
logger.error("南瑞平台充电电量信息推送 error",e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
}catch (Exception e) {
|
||||
logger.error("南瑞平台充电电量信息推送 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("南瑞平台充电电量信息推送 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -2336,7 +2336,7 @@ public class SpringBootTestController {
|
||||
String str = "JS160829";
|
||||
System.out.println(Md5Utils.hash(str).toUpperCase(Locale.ROOT));
|
||||
*/
|
||||
String s = RandomStringUtils.randomAlphanumeric(43).toUpperCase(Locale.ROOT);
|
||||
String s = RandomStringUtils.randomAlphanumeric(16).toUpperCase(Locale.ROOT);
|
||||
System.out.println(s);
|
||||
|
||||
Date startTimeDate = sdf.parse("2022-11-26 10:44:11");
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jsowell.pile.dto.nanrui;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/10/16 14:14
|
||||
*/
|
||||
@Data
|
||||
public class GetTokenDTO {
|
||||
private String urlAddress;
|
||||
private String operatorId;
|
||||
private String operatorSecret;
|
||||
private String dataSecretIv;
|
||||
private String signSecret;
|
||||
private String dataSecret;
|
||||
}
|
||||
@@ -162,6 +162,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService {
|
||||
// vo.setOrganizationCode(pileStationInfo.getor);
|
||||
vo.setPublicFlag(pileStationInfo.getPublicFlag());
|
||||
vo.setOpenFlag(pileStationInfo.getOpenFlag());
|
||||
vo.setOpenAllDay(pileStationInfo.getOpenAllDay());
|
||||
vo.setDeptId(pileStationInfo.getDeptId());
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
|
||||
vo.setPictures(pileStationInfo.getPictures());
|
||||
|
||||
@@ -379,8 +379,6 @@ public class DelayMerchantOrderLogic extends AbstractOrderLogic {
|
||||
// 从redis中取出实时记录保存到表中
|
||||
realTimeMonitorDataRedis2DB(orderBasicInfo.getTransactionCode(), orderBasicInfo.getOrderCode());
|
||||
|
||||
// TODO 如果该站点的停车场优惠券信息配置不为空,则需绑定一张优惠券
|
||||
|
||||
logger.info("结算订单end:{} OrderTransactionDTO:{}", orderBasicInfo.getOrderCode(), JSONObject.toJSONString(dto));
|
||||
}
|
||||
|
||||
|
||||
@@ -1170,6 +1170,7 @@
|
||||
|
||||
<select id="getNROrderInfoByOrderCode" resultType="com.jsowell.pile.vo.nanrui.NROrderInfoVO">
|
||||
SELECT
|
||||
t1.station_id as stationId,
|
||||
t1.merchant_id,
|
||||
t3.organization_code AS operatorId,
|
||||
t1.pile_connector_code AS connectorId,
|
||||
|
||||
@@ -73,4 +73,21 @@ public class NREquipmentInfo {
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorInfos")
|
||||
private List<NRConnectorInfo> connectorInfos;
|
||||
|
||||
@JsonProperty(value = "VinFlag")
|
||||
private Integer vinFlag;
|
||||
|
||||
@JsonProperty(value = "EquipmentPower")
|
||||
private BigDecimal equipmentPower;
|
||||
|
||||
@JsonProperty(value = "NewNationalStandard")
|
||||
private Integer newNationalStandard;
|
||||
|
||||
@JsonProperty(value = "ConstructionTime")
|
||||
private String constructionTime;
|
||||
|
||||
@JsonProperty(value = "ManufacturerID")
|
||||
private String manufacturerID;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -176,4 +176,52 @@ public class NRStationInfo {
|
||||
*/
|
||||
@JsonProperty(value = "EquipmentInfos")
|
||||
private List<NREquipmentInfo> equipmentInfos;
|
||||
|
||||
@JsonProperty(value = "LoungeFlag")
|
||||
private Integer loungeFlag;
|
||||
|
||||
@JsonProperty(value = "IsAloneApply")
|
||||
private Integer isAloneApply;
|
||||
|
||||
@JsonProperty(value = "PrinterFlag")
|
||||
private Integer printerFlag;
|
||||
|
||||
@JsonProperty(value = "ParkFree")
|
||||
private Integer parkFree;
|
||||
|
||||
@JsonProperty(value = "IsPublicParkingLot")
|
||||
private Integer isPublicParkingLot;
|
||||
|
||||
@JsonProperty(value = "Payment")
|
||||
private Integer payment;
|
||||
|
||||
@JsonProperty(value = "RestaurantFlag")
|
||||
private Integer restaurantFlag;
|
||||
|
||||
@JsonProperty(value = "BarrierFlag")
|
||||
private Integer barrierFlag;
|
||||
|
||||
@JsonProperty(value = "ServiceFee")
|
||||
private BigDecimal serviceFee;
|
||||
|
||||
@JsonProperty(value = "ParkingLockFlag")
|
||||
private Integer parkingLockFlag;
|
||||
|
||||
@JsonProperty(value = "ElectricityFee")
|
||||
private BigDecimal electricityFee;
|
||||
|
||||
@JsonProperty(value = "StoreFlag")
|
||||
private Integer storeFlag;
|
||||
|
||||
@JsonProperty(value = "CanopyFlag")
|
||||
private Integer canopyFlag;
|
||||
|
||||
@JsonProperty(value = "ToiletFlag")
|
||||
private Integer toiletFlag;
|
||||
|
||||
@JsonProperty(value = "SupportOrder")
|
||||
private Integer supportOrder;
|
||||
|
||||
@JsonProperty(value = "ParkFeeType")
|
||||
private Integer parkFeeType;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.jsowell.thirdparty.nanrui.domain.*;
|
||||
import com.jsowell.thirdparty.nanrui.service.NRService;
|
||||
import com.jsowell.thirdparty.nanrui.util.QEncodeUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -150,8 +151,8 @@ public class NRServiceImpl implements NRService {
|
||||
// 拼装南瑞平台所需参数
|
||||
NRStationInfo nrStationInfo = NRStationInfo.builder()
|
||||
.stationId("NR" + stationInfoVO.getId())
|
||||
.operatorID(Constants.OPERATORID_LIANLIAN)
|
||||
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.operatorID("014406554")
|
||||
.equipmentOwnerID("014406554")
|
||||
.stationName(stationInfoVO.getStationName())
|
||||
.countryCode(stationInfoVO.getCountryCode())
|
||||
.areaCode(stationInfoVO.getAreaCode())
|
||||
@@ -165,6 +166,24 @@ public class NRServiceImpl implements NRService {
|
||||
.openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay()))
|
||||
.busineHours(stationInfoVO.getBusinessHours())
|
||||
.minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice()))
|
||||
|
||||
.loungeFlag(0)
|
||||
.isAloneApply(0)
|
||||
.printerFlag(0)
|
||||
.parkFree(0)
|
||||
.isPublicParkingLot(0)
|
||||
.payment(1)
|
||||
.restaurantFlag(0)
|
||||
.barrierFlag(0)
|
||||
.serviceFee(stationInfoVO.getServicePrice())
|
||||
.parkingLockFlag(0)
|
||||
.electricityFee(stationInfoVO.getElectricityPrice())
|
||||
.storeFlag(0)
|
||||
.canopyFlag(0)
|
||||
.toiletFlag(0)
|
||||
.supportOrder(0)
|
||||
.parkFeeType(1)
|
||||
|
||||
.build();
|
||||
// 站点图片
|
||||
if (CollectionUtils.isNotEmpty(stationInfoVO.getPictureList())) {
|
||||
@@ -624,10 +643,13 @@ public class NRServiceImpl implements NRService {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String chargingTime = "30";
|
||||
Date beginTime = DateUtils.addMinute(new Date(), -Integer.parseInt(chargingTime));
|
||||
String s = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, beginTime);
|
||||
String s = RandomStringUtils.randomAlphanumeric(16).toUpperCase(Locale.ROOT);
|
||||
System.out.println(s);
|
||||
|
||||
// String chargingTime = "30";
|
||||
// Date beginTime = DateUtils.addMinute(new Date(), -Integer.parseInt(chargingTime));
|
||||
// String s = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, beginTime);
|
||||
// System.out.println(s);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,7 +677,9 @@ public class NRServiceImpl implements NRService {
|
||||
}
|
||||
// 获取桩型号信息
|
||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
|
||||
if (modelInfo == null) {
|
||||
continue;
|
||||
}
|
||||
NREquipmentInfo equipmentInfo = NREquipmentInfo.builder()
|
||||
.equipmentID(pileSn)
|
||||
.equipmentName(pileSn)
|
||||
@@ -663,6 +687,12 @@ public class NRServiceImpl implements NRService {
|
||||
.equipmentType(Integer.parseInt(modelInfo.getSpeedType()))
|
||||
.equipmentStatus(Integer.parseInt(pileStatus))
|
||||
.power(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP))
|
||||
|
||||
.vinFlag(1)
|
||||
.equipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP))
|
||||
.newNationalStandard(1)
|
||||
.constructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getProductionDate()))
|
||||
.manufacturerID("014406554")
|
||||
.build();
|
||||
// 获取枪口信息
|
||||
List<NRConnectorInfo> connectorInfos = getConnectorInfo(pileSn);
|
||||
|
||||
Reference in New Issue
Block a user