mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-06 15:08:05 +08:00
add 查询业务策略信息接口
This commit is contained in:
@@ -19,6 +19,12 @@ public class QueryStartChargeDTO {
|
|||||||
@JsonProperty(value = "StartChargeSeq")
|
@JsonProperty(value = "StartChargeSeq")
|
||||||
private String startChargeSeq;
|
private String startChargeSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务策略查询流水号
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "EquipBizSeq")
|
||||||
|
private String equipBizSeq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备接口编码
|
* 充电设备接口编码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.jsowell.pile.vo.zdl;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务策略信息体VO
|
||||||
|
*
|
||||||
|
* @author Lemon
|
||||||
|
* @Date 2024/1/3 16:24:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class EquipBusinessPolicyVO {
|
||||||
|
/**
|
||||||
|
* 业务策略查询流水号
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "equipBizSeq")
|
||||||
|
private String equipBizSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电设备接口编码
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "ConnectorID")
|
||||||
|
private String connectorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作结果
|
||||||
|
* 0:成功
|
||||||
|
* 1:失败
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "SuccStat")
|
||||||
|
private Integer succStat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败原因
|
||||||
|
* 0:无
|
||||||
|
* 1:此充电桩业务策略不存在
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "FailReason")
|
||||||
|
private Integer failReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时段数
|
||||||
|
* 0-32
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "SumPeriod")
|
||||||
|
private Integer sumPeriod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费信息
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "PolicyInfos")
|
||||||
|
private List<PolicyInfo> policyInfos;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class PolicyInfo {
|
||||||
|
/**
|
||||||
|
* 时段开始时间
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "StartTime")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电费
|
||||||
|
* 保留小数点后四位
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "ElecPrice")
|
||||||
|
private BigDecimal elecPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费
|
||||||
|
* 保留小数点后四位
|
||||||
|
*/
|
||||||
|
@JsonProperty(value = "SevicePrice")
|
||||||
|
private BigDecimal servicePrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,10 @@ import com.jsowell.pile.service.*;
|
|||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||||
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||||
|
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||||
@@ -74,6 +77,9 @@ public class ZDLServiceImpl implements ZDLService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IThirdPartyStationRelationService thirdPartyStationRelationService;
|
private IThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPileBillingTemplateService pileBillingTemplateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取令牌
|
* 获取令牌
|
||||||
* @param dto
|
* @param dto
|
||||||
@@ -353,13 +359,63 @@ public class ZDLServiceImpl implements ZDLService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 查询业务策略信息结果
|
* 查询业务策略信息结果
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
||||||
return null;
|
List<EquipBusinessPolicyVO.PolicyInfo> policyInfoList = new ArrayList<>();
|
||||||
|
String pileConnectorCode = dto.getConnectorID();
|
||||||
|
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||||
|
if (configInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 截取桩号
|
||||||
|
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||||
|
// 查询该桩的站点id
|
||||||
|
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||||
|
// 根据桩号查询正在使用的计费模板
|
||||||
|
List<BillingPriceVO> billingPriceVOList = pileBillingTemplateService.queryBillingPrice(String.valueOf(pileBasicInfo.getStationId()));
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(billingPriceVOList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EquipBusinessPolicyVO.PolicyInfo policyInfo = null;
|
||||||
|
for (BillingPriceVO billingPriceVO : billingPriceVOList) {
|
||||||
|
// 将时段开始时间、电费、服务费信息进行封装
|
||||||
|
policyInfo = new EquipBusinessPolicyVO.PolicyInfo();
|
||||||
|
policyInfo.setStartTime(billingPriceVO.getStartTime());
|
||||||
|
policyInfo.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||||
|
policyInfo.setServicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
||||||
|
|
||||||
|
policyInfoList.add(policyInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼装所需要的数据格式
|
||||||
|
EquipBusinessPolicyVO vo = EquipBusinessPolicyVO.builder()
|
||||||
|
.equipBizSeq(dto.getEquipBizSeq())
|
||||||
|
.connectorId(dto.getConnectorID())
|
||||||
|
.succStat(0)
|
||||||
|
.failReason(0)
|
||||||
|
.sumPeriod(policyInfoList.size())
|
||||||
|
.policyInfos(policyInfoList)
|
||||||
|
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 加密
|
||||||
|
Map<String, String> resultMap = Maps.newLinkedHashMap();
|
||||||
|
// 加密数据
|
||||||
|
byte[] encryptText = Cryptos.aesEncrypt(JSONObject.toJSONString(vo).getBytes(),
|
||||||
|
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
||||||
|
String encryptData = Encodes.encodeBase64(encryptText);
|
||||||
|
|
||||||
|
resultMap.put("Data", encryptData);
|
||||||
|
// 生成sig
|
||||||
|
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
|
||||||
|
resultMap.put("Sig", resultSign);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user