diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java index 50251e06..428a8791 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -50,9 +50,8 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService { @Transactional public AjaxResult addXhpcChargingPile(XhpcChargingPile xhpcChargingPile) { - - if(xhpcChargingPile.getGunNumber() !=null || xhpcChargingPile.getGunNumber()>9){ - return AjaxResult.error("终端数量不能大于8"); + if(xhpcChargingPile.getGunNumber() ==null || xhpcChargingPile.getGunNumber()>26){ + return AjaxResult.error("终端数量不能大于26"); } Long chargingStationId = xhpcChargingPile.getChargingStationId(); @@ -76,7 +75,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService { XhpcTerminal xhpcTerminal = new XhpcTerminal(); xhpcTerminal.setChargingStationId(chargingStationId); xhpcTerminal.setChargingPileId(chargingPileId); - xhpcTerminal.setName(serialNumber + "-" + (i)); + xhpcTerminal.setName(xhpcChargingPile.getName() + "-" + (i)); xhpcTerminal.setSerialNumber(serialNumber + "0" + i); xhpcTerminal.setPileSerialNumber(serialNumber); xhpcTerminal.setWorkStatus(2); @@ -105,7 +104,9 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService { if (xhpc.getSerialNumber() != xhpc.getSerialNumber()) { return AjaxResult.error("桩编号不能编辑"); } - + if(xhpcChargingPile.getGunNumber() ==null || xhpcChargingPile.getGunNumber()>26){ + return AjaxResult.error("终端数量不能大于26"); + } if (!xhpcChargingPile.getGunNumber().equals(xhpc.getGunNumber())) { //删除之前的终端 xhpcChargingPileMapper.updateXhpcTerminal(chargingPileId); 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 d51898cc..25da444a 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 @@ -218,6 +218,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if (xhpcChargingStationDto.getOperatorId() == null) { return AjaxResult.error(1001, "运营商不能为空"); } + if (xhpcChargingStationDto.getName().length()> 16) { + return AjaxResult.error(1001, "电站名称不能超过16字"); + } if (xhpcChargingStationDto.getAreaCode() == null) { return AjaxResult.error(1001, "电站地址不能为空"); } @@ -698,6 +701,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if (xhpcChargingStation.getChargingStationId() == null) { return AjaxResult.error("1001", "电站id为空"); } + if (xhpcChargingStation.getName().length()> 16) { + return AjaxResult.error(1001, "电站名称不能超过16字"); + } //获取之前的模板id XhpcChargingStation xhpc = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcChargingStation.getChargingStationId()); xhpcChargingStation.setRateModelId(xhpc.getRateModelId()); 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 8c7ba7b7..98251245 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 @@ -312,7 +312,7 @@ where charging_station_id = charging_station_id and del_flag = 0 and status = 0 limit 1) as type, - (select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=charging_station_id) as common, + (select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=#{chargingStationId}) as common, (select GROUP_CONCAT(serial_number) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=charging_station_id) as serialNumbers, (select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,service_facilities ) and code= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName, name as name, 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 47039883..fee28ecd 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 @@ -2,17 +2,13 @@ package com.xhpc.order.api; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; -import com.rabbitmq.client.Channel; -import com.rabbitmq.client.Connection; import com.xhpc.common.api.WebSocketService; 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.common.util.ConnectionRabbitMQUtil; import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService; import io.swagger.annotations.Api; -import org.checkerframework.checker.units.qual.A; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -165,25 +161,9 @@ public class XhpcChargeOrderController extends BaseController { } JSONObject json = new JSONObject(map); webSocketService.getMessage(""+userId,json.toString()); + logger.info("<<<<<<<<<<发送数据<<<<<<<<<<<<<<"+ json.toString()+">>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<发送时间<<<<<<<<<<<<<<"+ DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")+">>>>>>>>>>>>>>>>>"); } - private void rabbimt(String message) { - //发送消息队列 - try { - // 1、获取到连接 - Connection connection = ConnectionRabbitMQUtil.getConnection(); - // 2、从连接中创建通道,使用通道才能完成消息相关的操作 - Channel channel = connection.createChannel(); - // 3、声明(创建)队列 - channel.queueDeclare("webSocket", false, false, false, null); - // 4、消息内容 - channel.basicPublish("", "webSocket", null, message.getBytes()); - channel.close(); - connection.close(); - } catch (Exception e) { - - } - } } 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 59218eae..b9c99e43 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 @@ -7,6 +7,7 @@ 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.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.service.IXhpcChargeOrderService; @@ -73,12 +74,213 @@ public class XhpcHistoryOrderController extends BaseController { return xhpcHistoryOrderService.getById(historyOrderId); } + /** + * 终端统计 + */ + @GetMapping("/test3") + public void test3(){ + add(500,3); + } + /** + * 场站统计 + */ + @GetMapping("/test2") + public void test2(){ + add(500,2); + } + + + public void add(int number,int type){ + //获取500条待统计历史订单 + List list = xhpcHistoryOrderService.getStatistisList(number,type); + //场站、运营商、流量方 + if(list !=null && list.size()>0){ + for (XhpcChargeHistoryOrder xhpc:list) { + XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); + xhpcSt.setChargingDegree(xhpc.getChargingDegree()); + BigDecimal decimal = new BigDecimal(xhpc.getChargingTimeNumber() / 3600).setScale(2, RoundingMode.HALF_UP); + xhpcSt.setChargingTime(decimal); + xhpcSt.setChargingNumber(1); + xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); + xhpcSt.setServicePrice(xhpc.getServicePriceTotal()); + xhpcSt.setTotalPrice(xhpc.getTotalPrice()); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount()); + xhpcSt.setActPrice(xhpc.getActPrice()); + xhpcSt.setInternetCommission(xhpc.getInternetCommission()); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission()); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission()); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion()); + xhpcSt.setOperationCommission(xhpc.getOperationCommission()); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission()); + xhpcSt.setActPowerPrice(xhpc.getActPowerPrice()); + xhpcSt.setActServicePrice(xhpc.getActServicePrice()); + if(xhpc.getSource()==1){ + xhpcSt.setInternetUserId(xhpc.getUserId()); + } + xhpcSt.setOperatorId(xhpc.getOperatorId()); + xhpcSt.setChargingStationId(xhpc.getChargingStationId()); + xhpcSt.setCreateTime(Calendar.getInstance().getTime()); + xhpcSt.setTerminalId(xhpc.getTerminalId()); + xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcSt.setChargingPileId(xhpc.getChargingPileId()); + xhpcSt.setType(type); + xhpcStatisticsService.addStatisticsStation(xhpcSt); + + + //修改历史订单表状态 + XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); + xhpcHistoryOrder.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcHistoryOrder.setState(type+1); + xhpcHistoryOrderService.update(xhpcHistoryOrder); + } + } + } + /** + * 日期统计 + */ + @GetMapping("/test1") + public void test1(){ + //获取500条待统计历史订单 + //跨时段,跨费率,计费模型 + //日期统计 + int type =1; + List list = xhpcHistoryOrderService.getStatistisList(500,type); + //是否跨天 + if(list !=null && list.size()>0){ + for (XhpcChargeHistoryOrder xhpc:list) { + //是否跨天 + Date startTime = xhpc.getStartTime(); + Date endTime = xhpc.getEndTime(); + //1时间没有跨天 + 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); + + BigDecimal decimal = new BigDecimal(xhpc.getChargingTimeNumber() / 3600).setScale(2, RoundingMode.HALF_UP); + //每分钟多少度点 + BigDecimal divide = xhpc.getChargingDegree().divide(decimal, 2, RoundingMode.HALF_UP); + + if(betweenDay==0){ + XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); + xhpcSt.setChargingDegree(xhpc.getChargingDegree()); + xhpcSt.setChargingTime(decimal); + xhpcSt.setChargingNumber(1); + xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); + xhpcSt.setServicePrice(xhpc.getServicePriceTotal()); + xhpcSt.setTotalPrice(xhpc.getTotalPrice()); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount()); + xhpcSt.setActPrice(xhpc.getActPrice()); + xhpcSt.setInternetCommission(xhpc.getInternetCommission()); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission()); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission()); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion()); + xhpcSt.setOperationCommission(xhpc.getOperationCommission()); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission()); + xhpcSt.setActPowerPrice(xhpc.getActPowerPrice()); + xhpcSt.setActServicePrice(xhpc.getActServicePrice()); + if(xhpc.getSource()==1){ + xhpcSt.setInternetUserId(xhpc.getUserId()); + } + xhpcSt.setOperatorId(xhpc.getOperatorId()); + xhpcSt.setChargingStationId(xhpc.getChargingStationId()); + xhpcSt.setCreateTime(Calendar.getInstance().getTime()); + xhpcSt.setTerminalId(xhpc.getTerminalId()); + xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcSt.setChargingPileId(xhpc.getChargingPileId()); + xhpcSt.setType(type); + xhpcStatisticsService.addStatisticsStation(xhpcSt); + }else{ + //跨天 + BigDecimal dec = new BigDecimal(DateUtil.between(startTime, DateUtil.endOfDay(startTime), DateUnit.MINUTE)/ 60).setScale(2, RoundingMode.HALF_UP); + //添加 + addStation(xhpc, dec,type,DateUtil.formatTime(startTime),"23:59:59",divide); + + DateTime tomorrow = DateUtil.offsetDay(startTime,1); + Date startTime3 =DateUtil.beginOfDay(tomorrow); + BigDecimal tim = new BigDecimal(DateUtil.between(DateUtil.beginOfDay(tomorrow), DateUtil.endOfDay(endTime), DateUnit.MINUTE)/ 60).setScale(2, RoundingMode.HALF_UP); + //明天 + addStation(xhpc, tim,type, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime),divide); + } + + //修改历史订单表状态 + XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); + xhpcHistoryOrder.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcHistoryOrder.setState(type+1); + xhpcHistoryOrderService.update(xhpcHistoryOrder); + + } + } + } + + + + private void addStation(XhpcChargeHistoryOrder xhpc,BigDecimal chargingTime,int type,String startTime,String endTime,BigDecimal divide) { + + BigDecimal chargingDegree1 =new BigDecimal(0); + BigDecimal powerPrice1 =new BigDecimal(0); + BigDecimal servicePrice1 =new BigDecimal(0); + List> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime, endTime, xhpc.getRateModelId()); + if(reatTimeList !=null && reatTimeList.size()>0){ + for (int i = 0; i objectMap = reatTimeList.get(i); + BigDecimal powerPrice =new BigDecimal(objectMap.get("powerFee").toString()); + BigDecimal servicePrice =new BigDecimal(objectMap.get("serviceFee").toString()); + String startTime1 = objectMap.get("startTime").toString(); + String endTime1 = objectMap.get("endTime").toString(); + //总度数 + BigDecimal chargingDegree2 = new BigDecimal((DateUtil.parse(endTime1).getTime() - DateUtil.parse(startTime1).getTime())/60000).multiply(divide).setScale(2, RoundingMode.HALF_UP); + chargingDegree1 =chargingDegree1.add(chargingDegree2); + powerPrice1 =powerPrice1.add(powerPrice.multiply(chargingDegree2).setScale(2, RoundingMode.HALF_UP)); + servicePrice1 =servicePrice1.add(servicePrice.multiply(chargingDegree2).setScale(2, RoundingMode.HALF_UP)); + } + } + + XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); + xhpcSt.setChargingDegree(chargingDegree1); + xhpcSt.setChargingTime(chargingTime); + xhpcSt.setChargingNumber(1); + xhpcSt.setPowerPrice(powerPrice1); + xhpcSt.setServicePrice(servicePrice1); + xhpcSt.setTotalPrice(powerPrice1.add(servicePrice1)); + BigDecimal promotion =new BigDecimal(2); + xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setActPrice(xhpcSt.getTotalPrice().subtract(xhpcSt.getPromotionDiscount())); + xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(promotion,2, RoundingMode.HALF_UP)); + xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(promotion,2, RoundingMode.HALF_UP)); + + //抽成费用 + BigDecimal money = xhpcSt.getPlatformCommission().add(xhpcSt.getPlatformSvcCommisssion()) + .add(xhpcSt.getInternetCommission()).add(xhpcSt.getInternetSvcCommission()) + .add(xhpcSt.getOperationCommission()).add(xhpcSt.getOperationSvcCommission()); + xhpcSt.setActPowerPrice(powerPrice1.subtract(money)); + xhpcSt.setActServicePrice(servicePrice1.subtract(money)); + if(xhpc.getSource()==1){ + xhpcSt.setInternetUserId(xhpc.getUserId()); + } + xhpcSt.setOperatorId(xhpc.getOperatorId()); + xhpcSt.setChargingStationId(xhpc.getChargingStationId()); + xhpcSt.setCreateTime(Calendar.getInstance().getTime()); + xhpcSt.setTerminalId(xhpc.getTerminalId()); + xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId()); + xhpcSt.setChargingPileId(xhpc.getChargingPileId()); + xhpcSt.setType(type); + xhpcStatisticsService.addStatisticsStation(xhpcSt); + } + + + /** + * 小时统计 + */ @GetMapping("/test") public void test(){ //获取500条待统计历史订单 //跨时段,跨费率,计费模型 //小时统计 - List list = xhpcHistoryOrderService.getStatistisList(500); + List list = xhpcHistoryOrderService.getStatistisList(500,0); if(list !=null && list.size()>0){ for (XhpcChargeHistoryOrder xhpc:list) { //开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间 @@ -278,6 +480,18 @@ public class XhpcHistoryOrderController extends BaseController { } public static void main(String[] args) { - System.out.println(">>>>>"+DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")); + + String dateStr1 = "02:00:00"; + Date date1 = DateUtil.parse(dateStr1); + + String dateStr2 = "23:59:59"; + Date date2 = DateUtil.parse(dateStr2); + + //相差一个月,31天 + long betweenDay = DateUtil.between(date1, date2, DateUnit.MINUTE); + + System.out.println("betweenDay:"+betweenDay); + + //System.out.println(">>>>>"+DateUtil.format(Calendar.getInstance().getTime(), "yyyy-MM-dd HH:mm:ss")); } } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcStatisticsStation.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcStatisticsStation.java new file mode 100644 index 00000000..2dd0502d --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcStatisticsStation.java @@ -0,0 +1,122 @@ +package com.xhpc.order.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author yuyang + * @date 2021/9/13 11:29 + * @Version 1.0 + */ +@Data +public class XhpcStatisticsStation extends BaseEntity { + + /** + * 数据id + */ + private Long statisticsStationId; + /** + * 电量 + */ + private BigDecimal chargingDegree; + /** + * 充电时长(小时) + */ + private BigDecimal chargingTime; + /** + * 充电次数 + */ + private Integer chargingNumber; + /** + * 电费 + */ + private BigDecimal powerPrice; + /** + * 服务费 + */ + private BigDecimal servicePrice; + /** + * 订单总价 + */ + private BigDecimal totalPrice; + /** + * 电站活动抵扣--抵扣的总金额 + */ + private BigDecimal promotionDiscount; + /** + * 实际价格-用户支付的钱 + */ + private BigDecimal actPrice; + /** + * 实收电费-运营商电费 + */ + private BigDecimal actPowerPrice; + /** + * 实收服务费-运营商服务费 + */ + private BigDecimal actServicePrice; + /** + * 流量方总金额抽成 + */ + private BigDecimal internetCommission; + /** + * 流量方服务费抽成 + */ + private BigDecimal internetSvcCommission; + /** + * 平台总金额抽成 + */ + private BigDecimal platformCommission; + /** + * 平台服务费抽成 + */ + private BigDecimal platformSvcCommisssion; + /** + * 运维总金额抽成 + */ + private BigDecimal operationCommission; + /** + * 运维服务费抽成 + */ + private BigDecimal operationSvcCommission; + /** + * 流量方id + */ + private Long internetUserId; + /** + * 运营商id + */ + private Long operatorId; + + /** + * 电桩id + */ + private Long chargingPileId; + /** + * 电站id + */ + private Long chargingStationId; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private Integer delFlag; + + /** + * 终端id + */ + private Long terminalId; + + /** + * 历史订单id + */ + private Long historyOrderId; + + /** + * 1.日期 2.场站 3.桩 + */ + private Integer type; + +} 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 ff164693..0c7608a1 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 @@ -123,6 +123,19 @@ public class XhpcChargeHistoryOrder { */ private Long rateModelId; + /** + * 电桩id + */ + private Long chargingPileId; + /** + * 总电费 + */ + private BigDecimal powerPriceTotal; + /** + * 总服务费 + */ + private BigDecimal servicePriceTotal; + public Long getHistoryOrderId() { return historyOrderId; @@ -353,4 +366,34 @@ public class XhpcChargeHistoryOrder { this.chargingDegree = chargingDegree; } + public Long getChargingPileId() { + + return chargingPileId; + } + + public void setChargingPileId(Long chargingPileId) { + + this.chargingPileId = chargingPileId; + } + + public BigDecimal getPowerPriceTotal() { + + return powerPriceTotal; + } + + public void setPowerPriceTotal(BigDecimal powerPriceTotal) { + + this.powerPriceTotal = powerPriceTotal; + } + + public BigDecimal getServicePriceTotal() { + + return servicePriceTotal; + } + + public void setServicePriceTotal(BigDecimal servicePriceTotal) { + + this.servicePriceTotal = servicePriceTotal; + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index 14f77f42..97f18b14 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -99,5 +99,5 @@ public interface XhpcHistoryOrderMapper { * @param number * @return */ - List getStatistisList(@Param("number")int number); + List getStatistisList(@Param("number")int number,@Param("state")int state); } 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 a9b06e50..a0825df9 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.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import org.apache.ibatis.annotations.Param; @@ -129,4 +130,10 @@ public interface XhpcStatisticsServiceMapper { * @param xhpcStatisticsTimeInterval */ void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval); + + /** + * 添加订单统计 + * @param xhpcStatisticsStation + */ + void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation); } 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 cc209cab..93205aa0 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 @@ -73,6 +73,6 @@ public interface IXhpcHistoryOrderService { * @param number * @return */ - List getStatistisList(int number); + List getStatistisList(int number,int state); } 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 d0cfd36d..db209e5d 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.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import java.util.List; @@ -136,4 +137,11 @@ public interface IXhpcStatisticsService { */ void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval); + + /** + * 添加订单统计 + * @param xhpcStatisticsStation + */ + void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation); + } 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 4e59dae0..03df4725 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 @@ -78,8 +78,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { } @Override - public List getStatistisList(int number) { - return xhpcHistoryOrderMapper.getStatistisList(number); + public List getStatistisList(int number,int state) { + return xhpcHistoryOrderMapper.getStatistisList(number,state); } /** @@ -176,7 +176,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { private Map getRateTimeList(String startTime,String endTime,BigDecimal s,BigDecimal powerPrice,BigDecimal servicePrice){ Map map =new HashMap<>(); - BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())%60000).multiply(s); + BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime())/60000).multiply(s); BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, RoundingMode.HALF_UP); map.put("time",startTime+"-"+endTime); map.put("powerPrice",powerPrice); 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 cd71f32c..5677c833 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.XhpcStatisticsStation; import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.mapper.XhpcStatisticsServiceMapper; import com.xhpc.order.service.IXhpcStatisticsService; @@ -210,6 +211,11 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService { xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval); } + @Override + public void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation) { + xhpcStatisticsServiceMapper.addStatisticsStation(xhpcStatisticsStation); + } + private boolean getJudge(Long internetUserId, Long operatorId, Integer type) { if (type == null) { 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 9b27eecf..40df51c7 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -523,6 +523,8 @@ \ No newline at end of file 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 5bd92d97..a7d9f05e 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -382,9 +382,6 @@ internet_svc_commission, - - remaining_time, - platform_commission, @@ -462,9 +459,6 @@ #{internetSvcCommission}, - - #{remainingTime}, - #{platformCommission}, @@ -507,5 +501,170 @@ + + insert into xhpc_statistics_station + + + 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, + + + platform_commission, + + + platform_svc_commisssion, + + + operation_commission, + + + operation_svc_commission, + + + internet_user_id, + + + operator_id, + + + charging_pile_id, + + + charging_station_id, + + + del_flag, + + + create_time, + + + remark, + + + terminal_id, + + + type, + + + history_order_id + + + + + #{chargingDegree}, + + + #{chargingTime}, + + + #{chargingNumber}, + + + #{powerPrice}, + + + #{servicePrice}, + + + #{totalPrice}, + + + #{promotionDiscount}, + + + #{actPrice}, + + + #{actPowerPrice}, + + + #{actServicePrice}, + + + #{internetCommission}, + + + #{internetSvcCommission}, + + + #{platformCommission}, + + + #{platformSvcCommisssion}, + + + #{operationCommission}, + + + #{operationSvcCommission}, + + + #{internetUserId}, + + + #{operatorId}, + + + #{chargingPileId}, + + + #{chargingStationId}, + + + #{delFlag}, + + + #{createTime}, + + + #{remark}, + + + #{terminalId}, + + + #{type}, + + + #{historyOrderId} + + + + +