main^2
wubin 12 months ago
commit c0168e0371

@ -484,8 +484,10 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
} }
} }
/** /**
* *
*
* @param orderDO * @param orderDO
* @param notifyChargeOrderInfoBO * @param notifyChargeOrderInfoBO
* @return * @return
@ -502,11 +504,18 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
} }
//获取当前配置的互联互通的容许单价误差金额、总金额误差金额 //获取当前配置的互联互通的容许单价误差金额、总金额误差金额
// select * from t_dict where code = #{code} and parent_id != 0
/**
29 28 reverseOrderCheck -1 1 0-1 0 0
30 28 reverseOrderCheck 1 * 2 -01 0 0
*/
List<DictDO> dictDOList = commonMapper.getDictByCode("reverseOrderCheck"); List<DictDO> dictDOList = commonMapper.getDictByCode("reverseOrderCheck");
BigDecimal unitPrice = BigDecimal.valueOf(-1); BigDecimal unitPrice = BigDecimal.valueOf(-1);
BigDecimal totalPrice = BigDecimal.valueOf(-1); BigDecimal totalPrice = BigDecimal.valueOf(-1);
if (dictDOList.size() >= 2) { if (dictDOList.size() >= 2) {
//单价差额上限
unitPrice = new BigDecimal(Optional.ofNullable(dictDOList.get(0).getDictKey()).orElse("0.0")); unitPrice = new BigDecimal(Optional.ofNullable(dictDOList.get(0).getDictKey()).orElse("0.0"));
//总价差额上限
totalPrice = new BigDecimal(Optional.ofNullable(dictDOList.get(1).getDictKey()).orElse("0.0")); totalPrice = new BigDecimal(Optional.ofNullable(dictDOList.get(1).getDictKey()).orElse("0.0"));
} }
@ -516,11 +525,27 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
} }
//查询该充电桩的计费规则 //查询该充电桩的计费规则
List<PriceRule> lpr = commonMapper.selectPriceRule(orderDO.getEquipmentId()); /**
select
ter.charge_settle_type chargeSettleType, //电费结算类型 1 全时段电费 2 分时段电费
tept.end_time endTime,
tept.elecfee elecfee, //电费
tept.servicefee servicefee, //服务费
tept.cost,
tept.start_time startTime,
tept.time_flag as timeFlag
from
t_equipment_pricing_rule ter left join t_equipment_pricing_rule_time tept on ter.id = tept.equipment_pricing_rule_id
where
ter.equipment_id=#{equipmentId} //哪个设备,也就是哪个电桩
order by tept.end_time asc
*/
List<PriceRule> lpr = commonMapper.selectPriceRule(orderDO.getEquipmentId());//以电桩ID为条件进行查询获取此电桩的在不同时段的电费和服务费
//若是计费规则为空,则置为挂起状态,然后 //若是计费规则为空,则置为挂起状态,然后
// 电桩没有计费规则是个什么情况?
if (null == lpr || lpr.size() == 0) { if (null == lpr || lpr.size() == 0) {
orderDO.setState((byte) 5); orderDO.setState((byte) 5);//订单状态 0 创建中 1准备充电中 2 充电中 3完成 4 取消 5挂起 6需要手动补单 7结算中
orderDO.setExceptionFlag((byte) 4); orderDO.setExceptionFlag((byte) 4); //订单异常标志 0正常 1电量负数 2 vin相同,在一个有交集的时间段内出现的订单异常 3电量异常修正后订单
orderDO.setExceptionMsg("账单单价与站点计费不一致"); orderDO.setExceptionMsg("账单单价与站点计费不一致");
orderDO.setCancelMsg("账单单价与站点计费不一致"); orderDO.setCancelMsg("账单单价与站点计费不一致");
orderDO.setCancelTime(new Date()); orderDO.setCancelTime(new Date());
@ -534,11 +559,14 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
BigDecimal unitDiffPrice = BigDecimal.ZERO; BigDecimal unitDiffPrice = BigDecimal.ZERO;
BigDecimal totalDiffPrice = BigDecimal.ZERO; BigDecimal totalDiffPrice = BigDecimal.ZERO;
BigDecimal totalDetailMoney = BigDecimal.ZERO; BigDecimal totalDetailMoney = BigDecimal.ZERO;
//遍历每个互联互通账单数据
for (ChargeDetailDTO detailDTO : notifyChargeOrderInfoBO.getChargeDetails()) { for (ChargeDetailDTO detailDTO : notifyChargeOrderInfoBO.getChargeDetails()) {
long chargeStartTime = getCurrentMinute(detailDTO.getDetailStartTime()); long chargeStartTime = getCurrentMinute(detailDTO.getDetailStartTime());
//查询当前的detail的开始时间的所属计费时段 //查询当前的detail的开始时间的所属计费时段
for(PriceRule priceRule : lpr) { for (PriceRule priceRule : lpr) {//遍历每个时段
//如果当前的detail的开始时间在当前计费时段内
if (priceRule.getStartTime().longValue() <= chargeStartTime && priceRule.getEndTime().longValue() > chargeStartTime) { if (priceRule.getStartTime().longValue() <= chargeStartTime && priceRule.getEndTime().longValue() > chargeStartTime) {
//进行单价差额的计算 //进行单价差额的计算
unitDiffPrice = unitDiffPrice.add(BigDecimal.valueOf(priceRule.getElecfee()).subtract(BigDecimal.valueOf(detailDTO.getElecPrice())).abs()).setScale(2, BigDecimal.ROUND_HALF_UP); unitDiffPrice = unitDiffPrice.add(BigDecimal.valueOf(priceRule.getElecfee()).subtract(BigDecimal.valueOf(detailDTO.getElecPrice())).abs()).setScale(2, BigDecimal.ROUND_HALF_UP);
@ -559,7 +587,7 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
//判断单价的差额绝对值是否在允许范围内 //判断单价的差额绝对值是否在允许范围内
if (unitDiffPrice.compareTo(unitPrice) > 0 && unitPrice.compareTo(BigDecimal.valueOf(-1)) != 0) { if (unitDiffPrice.compareTo(unitPrice) > 0 && unitPrice.compareTo(BigDecimal.valueOf(-1)) != 0) {
orderDO.setState((byte) 5); orderDO.setState((byte) 5); //订单状态 0 创建中 1准备充电中 2 充电中 3完成 4 取消 5挂起 6需要手动补单 7结算中
orderDO.setExceptionFlag((byte) 4); orderDO.setExceptionFlag((byte) 4);
orderDO.setExceptionMsg("账单单价与站点计费不一致"); orderDO.setExceptionMsg("账单单价与站点计费不一致");
orderDO.setCancelMsg("账单单价与站点计费不一致"); orderDO.setCancelMsg("账单单价与站点计费不一致");
@ -583,13 +611,12 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
OrderTrackInfoUtil.addOrderTrackInfoCommon(new OrderTrackInfoDetail(orderDO.getOrderNo(), notifyChargeOrderInfoBO.toString(), "反向互联互通订单结算", false, "账单总金额与站点计费*充电量不一致", "")); OrderTrackInfoUtil.addOrderTrackInfoCommon(new OrderTrackInfoDetail(orderDO.getOrderNo(), notifyChargeOrderInfoBO.toString(), "反向互联互通订单结算", false, "账单总金额与站点计费*充电量不一致", ""));
return false; return false;
} }
return true; return true;
} }
/** /**
* *
*
* @param detailStartTime * @param detailStartTime
* @return * @return
*/ */
@ -837,6 +864,7 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
/** /**
* *
*
* @param orderNoList * @param orderNoList
* @return * @return
*/ */
@ -862,6 +890,8 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
} }
//获取最后一次推送过来的账单数据 //获取最后一次推送过来的账单数据
//【HuangHai】
// 互联互通的数据其它平台的数据是保存在MongoDb的 notificationChargeOrderInfoReqMongoDO 集合中
NotificationChargeOrderInfoReqMongoDO orderInfoReqMongoDO = notificationChargeOrderInfoReqDao.findOne(orderNo); NotificationChargeOrderInfoReqMongoDO orderInfoReqMongoDO = notificationChargeOrderInfoReqDao.findOne(orderNo);
if (orderInfoReqMongoDO == null) { if (orderInfoReqMongoDO == null) {
log.warn("订单{}存储mongo上的账单数据为空,对账失败", orderNo); log.warn("订单{}存储mongo上的账单数据为空,对账失败", orderNo);
@ -1287,6 +1317,7 @@ public class EvcsNotifyServiceImpl implements EvcsNotifyService {
// resp.setData(notifyChargeOrderInfoVO); // resp.setData(notifyChargeOrderInfoVO);
// return resp; // return resp;
// } // }
/** /**
* *
*/ */

@ -217,6 +217,8 @@ public class YltController extends Controller {
2 2
0 0
*/ */
//MongoDB中集合notificationChargeOrderInfoReqDao.findOne(orderNo); 可以获取到互联互通平台传送过来的账单信息,可以提供出来让人来看
//TODO
} else {//直连 } else {//直连
//最后一次通讯记录 //最后一次通讯记录
JSONObject jo = query.use("equipmentOrder").eq("_id", order_no).findOne(); JSONObject jo = query.use("equipmentOrder").eq("_id", order_no).findOne();

@ -4,6 +4,12 @@
docker ps -a docker ps -a
``` ```
#### 通过名称转为$ID$
```shell
docker ps -aqf "name=gw-charge"
```
#### 删除容器 #### 删除容器
```shell ```shell

Loading…
Cancel
Save