From fbfbad7708f68c55c057440713d6e95d932a4152 Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Thu, 9 Sep 2021 11:02:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=B4=B9=E7=8E=87=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8=E5=81=9C=E6=AD=A2=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcChargingStationController.java | 9 - .../XhpcChargingStationServiceImpl.java | 133 ++++++++++- .../mapper/XhpcChargingStationMapper.xml | 4 +- .../order/api/XhpcChargeOrderController.java | 18 +- .../XhpcHistoryOrderController.java | 208 ++++++++++++------ .../order/dto/XhpcChargeHistoryOrder.java | 15 ++ .../mapper/XhpcStatisticsServiceMapper.java | 7 + .../service/IXhpcHistoryOrderService.java | 8 + .../order/service/IXhpcStatisticsService.java | 8 + .../impl/XhpcChargeOrderServiceImpl.java | 35 ++- .../impl/XhpcHistoryOrderServiceImpl.java | 5 + .../impl/XhpcRealTimeOrderServiceImpl.java | 10 +- .../impl/XhpcStatisticsServiceImpl.java | 6 + .../mapper/XhpcChargeOrderMapper.xml | 14 +- .../mapper/XhpcHistoryOrderMapper.xml | 9 +- .../resources/mapper/XhpcStatisticsMapper.xml | 165 +++++++++++++- .../socket/OrderNotificationWebSocket.java | 1 + 17 files changed, 549 insertions(+), 106 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java index c5e210af..2d22985a 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingStationController.java @@ -161,15 +161,6 @@ public class XhpcChargingStationController extends BaseController { } - - - - - - - - - /** * 编辑电站(基本信息) * diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 7efb6f15..d51898cc 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -17,6 +17,8 @@ import com.xhpc.common.domain.XhpcRate; import com.xhpc.common.domain.XhpcRateModel; import com.xhpc.common.domain.XhpcRateTime; import com.xhpc.common.redis.service.RedisService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -47,6 +49,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi @Autowired private RedisService redisService; + private static final Logger logger = LoggerFactory.getLogger(XhpcChargingStationServiceImpl.class); /** * 查询电站 * @@ -398,7 +401,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi tfPricesSeq[number] = rateValues; number = number + 1; } - } else if (k < list.size()) { + } else if (k < list.size()-1) { //判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段 String endTimeK = list.get(k - 1).getEndTime(); if (!endTimeK.equals(startTime)) { @@ -445,9 +448,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi } if (!endTime.equals("24:00:00")) { //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, startTime, "24:00:00", sort, 2, rateValue); + sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTime, "24:00:00", sort, 2, rateValue); //时间差 - long betweenDay3 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse("24:00:00"), DateUnit.SECOND); + long betweenDay3 = DateUtil.between(DateUtil.parse(endTime), DateUtil.parse("24:00:00"), DateUnit.SECOND); int day7 = Math.toIntExact(betweenDay3 / 1800); for (int l = 0; l < day7; l++) { tfPricesSeq[number] = rateValue; @@ -563,6 +566,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRateTime.setSort(sort); xhpcRateTime.setType(type); xhpcRateTime.setRateValue(rateValue); + xhpcRateTime.setCreateTime(Calendar.getInstance().getTime()); xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime); return sort++; } @@ -814,6 +818,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi } //默认费率类型值 String rateValue = xhpcChargingStationDto.getDefaultPeriodId(); + + String[] tfPricesSeq = new String[48]; + int number = 0; int sort = 1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); @@ -825,32 +832,146 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if (!"00:00:00".equals(xhpcRateTimeDto.getStartTime())) { //添加一条默认费率时段 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, "00:00:00", startTime, sort, 2, rateValue); + //时间差 + long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse(startTime), DateUnit.SECOND); + int day1 = Math.toIntExact(betweenDay / 1800); + for (int l = 0; l < day1; l++) { + logger.info("下发费率>>>>>tfPricesSeq:["+number+"]"+rateValue); + tfPricesSeq[number] = rateValue; + number = number + 1; + } } //并把本条数据也添加上 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); - } else if (k < list.size()) { + //时间差 + long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND); + int day2 = Math.toIntExact(betweenDay / 1800); + for (int l = 0; l < day2; l++) { + logger.info("下发费率>>>>>tfPricesSeq:["+number+"]"+rateValues); + tfPricesSeq[number] = rateValues; + number = number + 1; + } + } else if (k < list.size()-1) { //判断上条数据的结束时间是否等于现在这条数据的开始时间,不等于添加一条默认费率时段 String endTimeK = list.get(k - 1).getEndTime(); if (!endTimeK.equals(startTime)) { //添加一条默认费率时段 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue); + //时间差 + long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND); + int day3 = Math.toIntExact(betweenDay / 1800); + for (int l = 0; l < day3; l++) { + logger.info("下发费率>>>>>tfPricesSeq:["+number+"]"+rateValue); + tfPricesSeq[number] = rateValue; + number = number + 1; + } } //并把本条数据也添加上 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); + //时间差 + long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND); + int day4 = Math.toIntExact(betweenDay / 1800); + for (int l = 0; l < day4; l++) { + logger.info("下发费率>>>>>tfPricesSeq:["+number+"]"+rateValues); + tfPricesSeq[number] = rateValues; + number = number + 1; + } } else { - String endTimeK = list.get(k - 1).getEndTime(); + String endTimeK = list.get(k-1).getEndTime(); if (!endTimeK.equals(startTime)) { //添加一条默认费率时段 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue); + //时间差 + long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND); + int day5 = Math.toIntExact(betweenDay / 1800); + for (int l = 0; l < day5; l++) { + logger.info("下发费率最后1>>>>>tfPricesSeq:["+number+"]"+rateValue); + tfPricesSeq[number] = rateValue; + number = number + 1; + } } //并把本条数据也添加上 sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); + //时间差 + long betweenDay1 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND); + int day6 = Math.toIntExact(betweenDay1 / 1800); + for (int l = 0; l < day6; l++) { + logger.info("下发费率最后2>>>>>tfPricesSeq:["+number+"]"+rateValues); + tfPricesSeq[number] = rateValues; + number = number + 1; + } if (!endTime.equals("24:00:00")) { //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, startTime, "24:00:00", sort, 2, rateValue); + sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTime, "24:00:00", sort, 2, rateValue); + //时间差 + long betweenDay3 = DateUtil.between(DateUtil.parse(endTime), DateUtil.parse("24:00:00"), DateUnit.SECOND); + int day7 = Math.toIntExact(betweenDay3 / 1800); + for (int l = 0; l < day7; l++) { + logger.info("下发费率最后3>>>>>tfPricesSeq:["+number+"]"+rateValue); + tfPricesSeq[number] = rateValue; + number = number + 1; + } } } } + + + //设置费率模型 + CacheRateModel cacheRateModel = new CacheRateModel(); + cacheRateModel.setLossRate(0); + BigDecimal valueSec = new BigDecimal(100000); + boolean t1 = true; + boolean t2 = true; + boolean t3 = true; + boolean t4 = true; + for (XhpcRateDto xhpcRateDto : xhpcRateList) { + BigDecimal powerFee = xhpcRateDto.getPowerFee(); + BigDecimal serviceFee = xhpcRateDto.getServiceFee(); + String id = xhpcRateDto.getId(); + int i1 = powerFee.multiply(valueSec).intValue(); + int i2 = serviceFee.multiply(valueSec).intValue(); + if ("00".equals(id)) { + cacheRateModel.setT1Price(i1); + cacheRateModel.setT1SvcPrice(i2); + t1 = false; + } else if ("01".equals(id)) { + cacheRateModel.setT2Price(i1); + cacheRateModel.setT2SvcPrice(i2); + t2 = false; + } else if ("02".equals(id)) { + cacheRateModel.setT3Price(i1); + cacheRateModel.setT3SvcPrice(i2); + t3 = false; + } else if ("03".equals(id)) { + cacheRateModel.setT4Price(i1); + cacheRateModel.setT4SvcPrice(i2); + t4 = false; + } + } + if (t1) { + cacheRateModel.setT1Price(0); + cacheRateModel.setT1SvcPrice(0); + } + if (t2) { + cacheRateModel.setT2Price(0); + cacheRateModel.setT2SvcPrice(0); + } + if (t3) { + cacheRateModel.setT3Price(0); + cacheRateModel.setT3SvcPrice(0); + } + if (t4) { + cacheRateModel.setT4Price(0); + cacheRateModel.setT4SvcPrice(0); + } + cacheRateModel.setTfPricesSeq(tfPricesSeq); + logger.info("下发费率>>>>>chargingStationId:"+chargingStationId); + logger.info("下发费率>>>>>rateModelId:"+rateModelId); + logger.info("cacheRateModel>>>>>cacheRateModel:"+cacheRateModel.toString()); + R r = powerPileService.setStationRateModel(chargingStationId, rateModelId, cacheRateModel); + System.out.println(r.getCode()); + System.out.println(r.getMsg()); + return AjaxResult.success(); } diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index c52ed662..8c7ba7b7 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -170,7 +170,7 @@ business_instructions = #{businessInstructions}, reminder_instructions = #{reminderInstructions}, img_id = #{imgId}, - station_type = #{stationType}, + station_type = #{stationType} where charging_station_id = #{chargingStationId} @@ -741,7 +741,7 @@ #{rateModelId}, - sort, + #{sort}, #{status}, diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java index f958b31f..9b580b3e 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcChargeOrderController.java @@ -10,6 +10,8 @@ import com.xhpc.common.util.ConnectionRabbitMQUtil; import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService; import io.swagger.annotations.Api; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -35,7 +37,7 @@ public class XhpcChargeOrderController extends BaseController { @Autowired private IXhpcHistoryOrderService xhpcHistoryOrderService; - + private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderController.class); /** * 实时订单(微信) */ @@ -68,7 +70,8 @@ public class XhpcChargeOrderController extends BaseController { */ @GetMapping("/startUp") public AjaxResult startUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Integer type){ - + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>"); return iXhpcChargeOrderService.startUp(userId, serialNumber, type); } @@ -82,7 +85,8 @@ public class XhpcChargeOrderController extends BaseController { */ @GetMapping("/stopUp") public AjaxResult stopUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){ - + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>"); return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId); } @@ -122,6 +126,10 @@ public class XhpcChargeOrderController extends BaseController { @GetMapping("/getOrderMessage") public void getOrderMessage(@RequestParam Long userId) { + logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>>"+userId); + logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>"+userId); + logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>"); Map orderMessage = iXhpcChargeOrderService.getOrderMessage(userId); Map map =new HashMap<>(); map.put("code", 200); @@ -140,13 +148,17 @@ public class XhpcChargeOrderController extends BaseController { data.put("power", "0"); data.put("chargingDegree", decimal); data.put("remainingTime","0"); + data.put("chargingTimeNumber",0); data.put("serialNumber","0"); data.put("parkingInstructions","在非充电情况下占用车位按照0.30元/分钟收费"); map.put("data", data); }else{ map.put("data",orderMessage); } + JSONObject json = new JSONObject(map); + + logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+json.toString()); rabbimt(userId + "##" + json); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 95d592e4..8365c805 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -5,10 +5,12 @@ import cn.hutool.core.date.DateUtil; 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.domain.XhpcHistoryOrder; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService; +import com.xhpc.order.service.IXhpcStatisticsService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.math.RoundingMode; +import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; @@ -35,7 +38,7 @@ public class XhpcHistoryOrderController extends BaseController { @Autowired private IXhpcHistoryOrderService xhpcHistoryOrderService; @Autowired - private IXhpcChargeOrderService xhpcChargeOrderService; + private IXhpcStatisticsService xhpcStatisticsService; /** * 历史订单 @@ -48,7 +51,7 @@ public class XhpcHistoryOrderController extends BaseController { * @param startTime 订单开始时间 * @param endTime 订单结束时间 * @param userId 用户id - * @param status 1 平台 2 运营商 3流量方 + * @param status 1 平台 2 运营商 3流量方 * @return */ @GetMapping("/getListPage") @@ -85,83 +88,159 @@ public class XhpcHistoryOrderController extends BaseController { Long userId =xhpcChargeHistoryOrder.getUserId(); Long operatorId =xhpcChargeHistoryOrder.getOperatorId(); Long chargeOrderId =xhpcChargeHistoryOrder.getChargeOrderId(); + Long chargingStationId = xhpcChargeHistoryOrder.getChargingStationId(); + Long terminalId = xhpcChargeHistoryOrder.getTerminalId(); + Date data = Calendar.getInstance().getTime(); //充电时长 Long chargingTimeNumber =xhpcChargeHistoryOrder.getChargingTimeNumber(); - //电费 - BigDecimal powerPrice =new BigDecimal(0); - //服务费 - BigDecimal servicePrice =new BigDecimal(0); - //订单总价 - BigDecimal totalPrice =new BigDecimal(0); - //电站活动抵扣--抵扣的总金额 - BigDecimal promotionDiscount =new BigDecimal(0); - //实际价格-用户支付的钱 - BigDecimal actPrice =new BigDecimal(0); - //实收电费-运营商电费 - BigDecimal actPowerPrice =new BigDecimal(0); - //实收服务费-运营商服务费 - BigDecimal actServicePrice =new BigDecimal(0); - //流量方总金额抽成 - BigDecimal internetCommission =new BigDecimal(0); - //流量方服务费抽成 - BigDecimal internetSvcCommission =new BigDecimal(0); - //平台总金额抽成 - BigDecimal platformCommission =new BigDecimal(0); - //平台服务费抽成 - BigDecimal platformSvcCommission =new BigDecimal(0); - //运维总抽成 - BigDecimal operationCommission =new BigDecimal(0); - //运维服务费抽成 - BigDecimal operationSvcCommission =new BigDecimal(0); long betweenDay = DateUtil.between(DateUtil.parse(xhpcChargeHistoryOrder.getStartTime().toString(), "yyyy-MM-dd"), DateUtil.parse(xhpcChargeHistoryOrder.getEndTime().toString(), "yyyy-MM-dd"), DateUnit.DAY); if(betweenDay==0){ //没有跨天 //获取费率 + //电费 + BigDecimal powerPrice =xhpcChargeHistoryOrder.getActPowerPrice(); + //服务费 + BigDecimal servicePrice =xhpcChargeHistoryOrder.getActServicePrice(); + //订单总价 + BigDecimal totalPrice =xhpcChargeHistoryOrder.getTotalPrice(); + //电站活动抵扣--抵扣的总金额 + BigDecimal promotionDiscount =xhpcChargeHistoryOrder.getPromotionDiscount(); + //实际价格-用户支付的钱 + BigDecimal actPrice =xhpcChargeHistoryOrder.getActPrice(); + //实收电费-运营商电费 + BigDecimal actPowerPrice =xhpcChargeHistoryOrder.getActPowerPrice(); + //实收服务费-运营商服务费 + BigDecimal actServicePrice =xhpcChargeHistoryOrder.getActServicePrice(); + //流量方总金额抽成 + BigDecimal internetCommission =xhpcChargeHistoryOrder.getInternetCommission(); + //流量方服务费抽成 + BigDecimal internetSvcCommission =xhpcChargeHistoryOrder.getInternetSvcCommission(); + //平台总金额抽成 + BigDecimal platformCommission =xhpcChargeHistoryOrder.getPlatformCommission(); + //平台服务费抽成 + BigDecimal platformSvcCommission =xhpcChargeHistoryOrder.getPlatformSvcCommisssion(); + //运维总抽成 + BigDecimal operationCommission =xhpcChargeHistoryOrder.getOperationCommission(); + //运维服务费抽成 + BigDecimal operationSvcCommission =xhpcChargeHistoryOrder.getOperationSvcCommission(); + //每分钟都少钱 + BigDecimal pp1 = powerPrice.divide(new BigDecimal(chargingTimeNumber / 60), 2, RoundingMode.HALF_UP); + BigDecimal sp1 = servicePrice.divide(new BigDecimal(chargingTimeNumber / 60), 2, RoundingMode.HALF_UP); + String startTime1 = DateUtil.formatTime(startTime); String endTime1 = DateUtil.formatTime(endTime); int startHour = DateUtil.hour(startTime, true); int endHour = DateUtil.hour(endTime, true); if(endHour==startHour){ //没有跨时段 - List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime1, endTime1, rateModelId); - for (Map mapTime:reatTimeList) { - int size = reatTimeList.size(); - if(size==1){ - BigDecimal totalPrice1 = xhpcChargeHistoryOrder.getTotalPrice(); - BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()); - powerPrice = powerFee.multiply(totalPrice1).setScale(2, RoundingMode.HALF_UP); - BigDecimal serviceFee = new BigDecimal(reatTimeList.get(0).get("serviceFee").toString()); - servicePrice=serviceFee.multiply(totalPrice1).setScale(2, RoundingMode.HALF_UP); + XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval(); + xhpc.setStatus(endHour+1); + xhpc.setChargingDegree(xhpcChargeHistoryOrder.getChargingDegree()); + xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP)); + xhpc.setChargingNumber(1); + xhpc.setPowerPrice(powerPrice); + xhpc.setServicePrice(servicePrice); + xhpc.setTotalPrice(totalPrice); + xhpc.setPromotionDiscount(promotionDiscount); + xhpc.setActPrice(actPrice); + xhpc.setActPowerPrice(actPowerPrice); + xhpc.setActServicePrice(actServicePrice); + xhpc.setInternetCommission(internetCommission); + xhpc.setInternetSvcCommission(internetSvcCommission); + xhpc.setPlatformCommission(platformCommission); + xhpc.setPlatformSvcCommisssion(platformSvcCommission); + xhpc.setOperationCommission(operationCommission); + xhpc.setOperationSvcCommission(operationSvcCommission); + xhpc.setOperatorId(chargeOrderId); + xhpc.setChargingStationId(chargingStationId); + xhpc.setCreateTime(data); + xhpc.setTerminalId(terminalId); + xhpcStatisticsService.addStatisticsTime(xhpc); + //修改历史订单表状态 + XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); + xhpcHistoryOrder.setHistoryOrderId(xhpcChargeHistoryOrder.getHistoryOrderId()); + xhpcHistoryOrder.setState(1); + xhpcHistoryOrderService.update(xhpcHistoryOrder); + }else{ - XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval(); - xhpc.setStatus(endHour+1); - xhpc.setChargingDegree(totalPrice1); - xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP)); - xhpc.setChargingNumber(1); - xhpc.setPowerPrice(powerPrice); - xhpc.setServicePrice(servicePrice); - xhpc.setTotalPrice(totalPrice); - xhpc.setPromotionDiscount(promotionDiscount); - xhpc.setActPrice(actPrice); - xhpc.setActPowerPrice(actPowerPrice); - xhpc.setActServicePrice(actServicePrice); - xhpc.setInternetCommission(internetCommission); - xhpc.setInternetSvcCommission(internetSvcCommission); - xhpc.setPlatformCommission(platformCommission); - xhpc.setPlatformSvcCommisssion(platformSvcCommission); - xhpc.setOperationCommission(operationCommission); - xhpc.setOperationSvcCommission(operationSvcCommission); - xhpc.setOperatorId(operatorId); + //跨时段,跨多少时段,每个时段单独算 + //每个时段折扣 + BigDecimal pd = new BigDecimal(0); + if(promotionDiscount.compareTo(pd)==1){ + pd = promotionDiscount.divide(new BigDecimal(endHour + 1)); + } + for (int i = startHour; i <=endHour+1 ; i++) { + //获取费率 + if(i==startHour){ + String end=i+1+":59:59"; + long time1 = DateUtil.parse(end).getTime(); + long time2 = DateUtil.parse(startTime1).getTime(); + BigDecimal time = new BigDecimal((time1-time2)/6000); + List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime1, end, rateModelId); + if(reatTimeList!=null && reatTimeList.size()>0){ + if(reatTimeList.size()==1){ + XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval(); + xhpc.setStatus(endHour+1); + xhpc.setChargingDegree(xhpcChargeHistoryOrder.getChargingDegree()); + xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP)); + xhpc.setChargingNumber(1); + BigDecimal decimal1 = time.multiply(pp1).setScale(2, RoundingMode.HALF_UP); + BigDecimal decimal2 = time.multiply(sp1).setScale(2, RoundingMode.HALF_UP); + xhpc.setPowerPrice(decimal1); + xhpc.setServicePrice(decimal2); + xhpc.setTotalPrice(decimal1.add(decimal2)); + xhpc.setPromotionDiscount(pd); + xhpc.setActPrice(decimal1.add(decimal2).subtract(pd)); + + + powerPrice.subtract(decimal1); + servicePrice.subtract(decimal2); + + + + + + + + + + + + xhpc.setActPowerPrice(xhpcChargeHistoryOrder.getActPowerPrice()); + xhpc.setActServicePrice(xhpcChargeHistoryOrder.getActServicePrice()); + xhpc.setInternetCommission(xhpcChargeHistoryOrder.getInternetCommission()); + xhpc.setInternetSvcCommission(xhpcChargeHistoryOrder.getInternetSvcCommission()); + xhpc.setPlatformCommission(xhpcChargeHistoryOrder.getPlatformCommission()); + xhpc.setPlatformSvcCommisssion(xhpcChargeHistoryOrder.getPlatformSvcCommisssion()); + xhpc.setOperationCommission(xhpcChargeHistoryOrder.getOperationCommission()); + xhpc.setOperationSvcCommission(xhpcChargeHistoryOrder.getOperationSvcCommission()); + xhpc.setOperatorId(xhpcChargeHistoryOrder.getOperatorId()); + xhpc.setChargingStationId(xhpcChargeHistoryOrder.getChargingStationId()); + xhpc.setCreateTime(data); + xhpc.setTerminalId(xhpcChargeHistoryOrder.getTerminalId()); + xhpcStatisticsService.addStatisticsTime(xhpc); + //修改历史订单表状态 + XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); + xhpcHistoryOrder.setHistoryOrderId(xhpcChargeHistoryOrder.getHistoryOrderId()); + xhpcHistoryOrder.setState(1); + xhpcHistoryOrderService.update(xhpcHistoryOrder); + } + } + }else{ + String sta=i+":00:00"; + String end=i+1+":59:59"; } + + + + + + } - - - - } } @@ -170,16 +249,7 @@ public class XhpcHistoryOrderController extends BaseController { } public static void main(String[] args) { - String dateStr = "2017-03-01 22:33:23"; - Date date = DateUtil.parse(dateStr); - int hour = DateUtil.hour(date, true); - String dateStr1 = "2017-03-01 02:33:23"; - Date date1 = DateUtil.parse(dateStr1); - int hour1 = DateUtil.hour(date1, true); - System.out.println("hour>>>"+hour); - - System.out.println("hour1>>>"+hour1); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/dto/XhpcChargeHistoryOrder.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/dto/XhpcChargeHistoryOrder.java index 7f40bff6..ff164693 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/dto/XhpcChargeHistoryOrder.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/dto/XhpcChargeHistoryOrder.java @@ -103,6 +103,11 @@ public class XhpcChargeHistoryOrder { */ private Long chargingTimeNumber; + /** + * 电量 + */ + private BigDecimal chargingDegree; + /** * 运营商id */ @@ -338,4 +343,14 @@ public class XhpcChargeHistoryOrder { this.rateModelId = rateModelId; } + public BigDecimal getChargingDegree() { + + return chargingDegree; + } + + public void setChargingDegree(BigDecimal chargingDegree) { + + this.chargingDegree = chargingDegree; + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java index b91cc040..a9b06e50 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcStatisticsServiceMapper.java @@ -1,5 +1,6 @@ package com.xhpc.order.mapper; +import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -122,4 +123,10 @@ public interface XhpcStatisticsServiceMapper { * @return */ List> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type); + + /** + * 添加时段订单统计 + * @param xhpcStatisticsTimeInterval + */ + void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java index 35d0b05c..cc209cab 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcHistoryOrderService.java @@ -21,6 +21,14 @@ public interface IXhpcHistoryOrderService { */ List> list(Long userId); + /** + * 更新 历史订单信息 + * + * @param xhpcHistoryOrder 历史订单信息 + * @return 结果 + */ + int update(XhpcHistoryOrder xhpcHistoryOrder); + /** * 用户订单详情 * @param userId diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java index 04327408..d0cfd36d 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcStatisticsService.java @@ -1,6 +1,7 @@ package com.xhpc.order.service; import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import java.util.List; import java.util.Map; @@ -128,4 +129,11 @@ public interface IXhpcStatisticsService { * @return */ AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type); + + /** + * 添加时段订单统计 + * @param xhpcStatisticsTimeInterval + */ + void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval); + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 296bba9d..0127ba42 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -13,6 +13,7 @@ import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcOrderRedisRecord; import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.service.IXhpcChargeOrderService; +import org.checkerframework.checker.units.qual.C; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -108,6 +109,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { //终端状态是否空闲 //是否插枪 Map cacheMap = REDIS.getCacheMap("gun:" + serialNumber); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+serialNumber); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"+cacheMap.toString()); + logger.info("<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"); + if(cacheMap==null){ return AjaxResult.error(1105, "未注册的终端,请选择其他终端充电"); }else{ @@ -137,6 +143,12 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { } //余额 String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString(); + + + //获取桩信息 + Map xhpcChargingPileById = + xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId()); + //启动充电 StartChargingData startChargingData = new StartChargingData(); //订单流水号 终端号+年月日时分秒+自增4位 共32位 @@ -152,7 +164,12 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber()); startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14)); startChargingData.setBalance(Double.valueOf(balance).intValue()); - startChargingData.setVersion("0A"); + if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){ + startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString()); + }else{ + startChargingData.setVersion("0A"); + } + //用户、桩、平台(最小的) int number =0; if(!"".equals(userMessage.get("soc")) && userMessage.get("soc") !=null && !"".equals(userMessage.get("soc"))){ @@ -182,9 +199,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { if (r1.getCode() != 200) { return AjaxResult.error(r1.getMsg()); } - //获取桩信息 - Map xhpcChargingPileById = - xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId()); + //创建充电订单(充电启动soc初始值,结束是获取,并修改状态) XhpcChargeOrder xhpcChargeOrder = new XhpcChargeOrder(); @@ -203,7 +218,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { } else { xhpcChargeOrder.setChargingMode("小华充电支付宝"); } - xhpcChargeOrder.setCreateTime(date); + xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime()); xhpcChargeOrder.setType(40); xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder); @@ -224,7 +239,15 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) { return AjaxResult.error(1104, "无效的终端编号"); } - R oa = powerPileService.stopCharging(xhpcTerminal.getPileSerialNumber(), xhpcTerminal.getSerialNumber(), "OA"); + + //获取桩信息 + Map xhpcChargingPileById = + xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId()); + String version ="0A"; + if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){ + version=xhpcChargingPileById.get("communicationProtocolVersion").toString(); + } + R oa = powerPileService.stopCharging(xhpcTerminal.getPileSerialNumber(), xhpcTerminal.getSerialNumber(), version); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电返回>>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getCode()+">>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getMsg()+">>>>>>>>>>>>>>>>>"); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 1e7d54f8..29a7c675 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -35,6 +35,11 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { return xhpcHistoryOrderMapper.list(userId); } + @Override + public int update(XhpcHistoryOrder xhpcHistoryOrder) { + return xhpcHistoryOrderMapper.update(xhpcHistoryOrder); + } + @Override public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId,Integer type,Long chargingOrderId) { return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId)); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index d9df8bad..6c73af48 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -121,7 +121,11 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { BigDecimal chargingDegree = chargeOrder.getChargingDegree(); BigDecimal powerPriceTotal =new BigDecimal(0); //1时间没有跨天 - long betweenDay = DateUtil.between(DateUtil.parse(startTime2.toString(),"yyyy-MM-dd"), DateUtil.parse(updateTime2.toString(),"yyyy-MM-dd"), DateUnit.DAY); + DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); + DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); + System.out.println(parse.toString()); + System.out.println(parse.toString()); + long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY); if(betweenDay==0){ powerPriceTotal = getBigDecimal(rateModelId, startTime2, updateTime2, chargingDegree, powerPriceTotal); }else{ @@ -499,6 +503,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { Date date = new Date(); Long chargeOrderId = xhpcChargeOrder.getChargeOrderId(); XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder(); + xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId()); xhpcRealTimeOrder.setTransactionNumber(orderNo); xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo()); @@ -563,7 +568,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { xhpcRealTimeOrder.setUserId(xhpcChargeOrder.getUserId()); Long chargingStationId = xhpcChargeOrder.getChargingStationId(); xhpcRealTimeOrder.setChargingStationId(chargingStationId); - + xhpcRealTimeOrder.setChargingTimeNumber(cacheRealtimeData.getChargingTime()); addXhpcRealTimeOrder(xhpcRealTimeOrder); //实时数据存入MYsql、soc、电流、电压 @@ -592,6 +597,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { data.put("amountCharged",divide); data.put("gunNumber",gunId); data.put("chargingOrderId",chargeOrderId); + data.put("chargingTimeNumber",cacheRealtimeData.getChargingTime()); data.put("soc",soc); data.put("chargingTime",xhpcRealTimeOrder.getChargingTime()); data.put("electricCurrent",c); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java index 101905e9..f8a8d76e 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcStatisticsServiceImpl.java @@ -2,6 +2,7 @@ package com.xhpc.order.service.impl; import com.xhpc.common.core.web.domain.AjaxResult; +import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.mapper.XhpcStatisticsServiceMapper; import com.xhpc.order.service.IXhpcStatisticsService; import org.springframework.beans.factory.annotation.Autowired; @@ -204,6 +205,11 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, userId, type)); } + @Override + public void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval) { + + } + private boolean getJudge(Long internetUserId, Long operatorId, Integer type) { if (type == null) { diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml index ee8b01ee..7e8aed79 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -82,7 +82,8 @@ rto.real_time_order_id as realTimeOrderId, rto.charging_order_id as chargingOrderId, rto.voltage as voltage, - rto.gun_number as seriaNumber, + rto.charging_time_number as chargingTimeNumber, + concat(rto.pile_number,"",rto.gun_number)as seriaNumber, rto.electric_current as electricCurrent, (select power from xhpc_charging_pile where charging_pile_id= (select charging_pile_id from xhpc_charging_pile where serial_number=rto.pile_number and del_flag=0 LIMIT 1))power, @@ -188,7 +189,10 @@ amount_charged, - power + power, + + + create_time @@ -250,7 +254,10 @@ #{amountCharged}, - #{power} + #{power}, + + + #{createTime} @@ -332,6 +339,7 @@ diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index 85e0afbd..5a169737 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -274,9 +274,7 @@ start_soc = #{startSoc}, end_soc = #{endSoc}, - reconciliation_status = - #{reconciliationStatus}, - + reconciliation_status =#{reconciliationStatus}, sorting_status = #{sortingStatus}, type = #{type}, status = #{status}, @@ -286,8 +284,9 @@ update_time = #{updateTime}, update_by = #{updateBy}, remark = #{remark}, - power_price_total = #{powerPriceTotal}, - service_price_total = #{servicePriceTotal} + state = #{state}, + power_price_total = #{powerPriceTotal}, + service_price_total = #{servicePriceTotal} WHERE history_order_id = #{historyOrderId} diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 487122ec..a2666b5f 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -246,7 +246,7 @@ and ss.create_time <=#{endTime} - and ss.internet_user_id + and ss.internet_user_id in #{internetId} @@ -339,4 +339,167 @@ and charging_station_id =#{chargingStationId} + + + insert into xhpc_statistics_time_interval + + + status, + + + charging_degree, + + + charging_time, + + + charging_number, + + + power_price, + + + service_price, + + + total_price, + + + promotion_discount, + + + act_price, + + + act_power_price, + + + act_service_price, + + + internet_commission, + + + internet_svc_commission, + + + remaining_time, + + + platform_commission, + + + platform_svc_commisssion, + + + operation_commission, + + + operation_svc_commission, + + + internet_user_id, + + + operator_id, + + + charging_station_id, + + + del_flag, + + + create_time, + + + remark, + + + terminal_id + + + + + #{status}, + + + #{chargingDegree}, + + + #{chargingTime}, + + + #{chargingNumber}, + + + #{powerPrice}, + + + #{servicePrice}, + + + #{totalPrice}, + + + #{promotionDiscount}, + + + #{actPrice}, + + + #{actPowerPrice}, + + + #{actServicePrice}, + + + #{internetCommission}, + + + #{internetSvcCommission}, + + + #{remainingTime}, + + + #{platformCommission}, + + + #{platformSvcCommisssion}, + + + #{operationCommission}, + + + #{operationSvcCommission}, + + + #{internetUserId}, + + + #{operatorId}, + + + #{chargingStationId}, + + + #{delFlag}, + + + #{createTime}, + + + #{remark}, + + + #{terminalId}, + + + #{chargingTimeNumber} + + + + + diff --git a/xhpc-modules/xhpc-wxma/src/main/java/com/xhpc/wxma/socket/OrderNotificationWebSocket.java b/xhpc-modules/xhpc-wxma/src/main/java/com/xhpc/wxma/socket/OrderNotificationWebSocket.java index 9c66c10c..60e39e9b 100644 --- a/xhpc-modules/xhpc-wxma/src/main/java/com/xhpc/wxma/socket/OrderNotificationWebSocket.java +++ b/xhpc-modules/xhpc-wxma/src/main/java/com/xhpc/wxma/socket/OrderNotificationWebSocket.java @@ -104,6 +104,7 @@ public class OrderNotificationWebSocket { data.put("amountCharged",decimal); data.put("gunNumber","0"); data.put("chargingOrderId",0L); + data.put("chargingTimeNumber",0); data.put("soc",0); data.put("chargingTime","0"); data.put("electricCurrent",decimal);