修改场站名称长度,统计日期、场站、终端

This commit is contained in:
yuyang 2021-09-13 19:09:15 +08:00
parent 57ec8bae00
commit 61c042af5a
15 changed files with 591 additions and 41 deletions

View File

@ -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);

View File

@ -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());

View File

@ -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,

View File

@ -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) {
}
}
}

View File

@ -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<XhpcChargeHistoryOrder> 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<XhpcChargeHistoryOrder> 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<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime, endTime, xhpc.getRateModelId());
if(reatTimeList !=null && reatTimeList.size()>0){
for (int i = 0; i <reatTimeList.size() ; i++) {
Map<String, Object> 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<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(500);
List<XhpcChargeHistoryOrder> 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"));
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -99,5 +99,5 @@ public interface XhpcHistoryOrderMapper {
* @param number
* @return
*/
List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number);
List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number,@Param("state")int state);
}

View File

@ -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);
}

View File

@ -73,6 +73,6 @@ public interface IXhpcHistoryOrderService {
* @param number
* @return
*/
List<XhpcChargeHistoryOrder> getStatistisList(int number);
List<XhpcChargeHistoryOrder> getStatistisList(int number,int state);
}

View File

@ -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);
}

View File

@ -78,8 +78,8 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
}
@Override
public List<XhpcChargeHistoryOrder> getStatistisList(int number) {
return xhpcHistoryOrderMapper.getStatistisList(number);
public List<XhpcChargeHistoryOrder> getStatistisList(int number,int state) {
return xhpcHistoryOrderMapper.getStatistisList(number,state);
}
/**
@ -176,7 +176,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
private Map<String, Object> getRateTimeList(String startTime,String endTime,BigDecimal s,BigDecimal powerPrice,BigDecimal servicePrice){
Map<String, Object> 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);

View File

@ -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) {

View File

@ -523,6 +523,8 @@
<select id="getStatistisList" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
select
ho.history_order_id as historyOrderId,
ho.power_price_total as powerPriceTotal,
ho.service_price_total as servicePriceTotal,
ho.promotion_discount as promotionDiscount,
ho.total_price as totalPrice,
ho.act_price as actPrice,
@ -544,10 +546,12 @@
co.charging_degree as chargingDegree,
co.rate_model_id as rateModelId,
cs.operator_id as operatorId,
te.charging_pile_id as chargingPileId,
co.user_id as userId
from xhpc_history_order ho
left join xhpc_charge_order co on co.charge_order_id =ho.charge_order_id
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
where state =0 limit 0,#{number}
left join xhpc_terminal as te on te.terminal_id =ho.terminal_id
where state =#{state} limit 0,#{number}
</select>
</mapper>

View File

@ -382,9 +382,6 @@
<if test="null != internetSvcCommission ">
internet_svc_commission,
</if>
<if test="null != remainingTime ">
remaining_time,
</if>
<if test="null != platformCommission ">
platform_commission,
</if>
@ -462,9 +459,6 @@
<if test="null != internetSvcCommission ">
#{internetSvcCommission},
</if>
<if test="null != remainingTime ">
#{remainingTime},
</if>
<if test="null != platformCommission ">
#{platformCommission},
</if>
@ -507,5 +501,170 @@
</trim>
</insert>
<insert id="addStatisticsStation">
insert into xhpc_statistics_station
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != chargingDegree ">
charging_degree,
</if>
<if test="null != chargingTime ">
charging_time,
</if>
<if test="null != chargingNumber ">
charging_number,
</if>
<if test="null != powerPrice ">
power_price,
</if>
<if test="null != servicePrice ">
service_price,
</if>
<if test="null != totalPrice ">
total_price,
</if>
<if test="null != promotionDiscount ">
promotion_discount,
</if>
<if test="null != actPrice ">
act_price,
</if>
<if test="null != actPowerPrice ">
act_power_price,
</if>
<if test="null != actServicePrice ">
act_service_price,
</if>
<if test="null != internetCommission ">
internet_commission,
</if>
<if test="null != internetSvcCommission ">
internet_svc_commission,
</if>
<if test="null != platformCommission ">
platform_commission,
</if>
<if test="null != platformSvcCommisssion ">
platform_svc_commisssion,
</if>
<if test="null != operationCommission ">
operation_commission,
</if>
<if test="null != operationSvcCommission ">
operation_svc_commission,
</if>
<if test="null != internetUserId ">
internet_user_id,
</if>
<if test="null != operatorId ">
operator_id,
</if>
<if test="null != chargingPileId ">
charging_pile_id,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != delFlag ">
del_flag,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != remark ">
remark,
</if>
<if test="null != terminalId ">
terminal_id,
</if>
<if test="null != type ">
type,
</if>
<if test="null != historyOrderId ">
history_order_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != chargingDegree ">
#{chargingDegree},
</if>
<if test="null != chargingTime ">
#{chargingTime},
</if>
<if test="null != chargingNumber ">
#{chargingNumber},
</if>
<if test="null != powerPrice ">
#{powerPrice},
</if>
<if test="null != servicePrice ">
#{servicePrice},
</if>
<if test="null != totalPrice ">
#{totalPrice},
</if>
<if test="null != promotionDiscount ">
#{promotionDiscount},
</if>
<if test="null != actPrice ">
#{actPrice},
</if>
<if test="null != actPowerPrice ">
#{actPowerPrice},
</if>
<if test="null != actServicePrice ">
#{actServicePrice},
</if>
<if test="null != internetCommission ">
#{internetCommission},
</if>
<if test="null != internetSvcCommission ">
#{internetSvcCommission},
</if>
<if test="null != platformCommission ">
#{platformCommission},
</if>
<if test="null != platformSvcCommisssion ">
#{platformSvcCommisssion},
</if>
<if test="null != operationCommission ">
#{operationCommission},
</if>
<if test="null != operationSvcCommission ">
#{operationSvcCommission},
</if>
<if test="null != internetUserId ">
#{internetUserId},
</if>
<if test="null != operatorId ">
#{operatorId},
</if>
<if test="null != chargingPileId ">
#{chargingPileId},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != remark ">
#{remark},
</if>
<if test="null != terminalId ">
#{terminalId},
</if>
<if test="null != type ">
#{type},
</if>
<if test="null != historyOrderId ">
#{historyOrderId}
</if>
</trim>
</insert>
</mapper>