订单来源,订单数据维度
This commit is contained in:
parent
5d6bf27d5a
commit
94553d7a73
@ -251,6 +251,11 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
*/
|
||||
private Long rateModelId;
|
||||
|
||||
/**
|
||||
* 充电方式
|
||||
*/
|
||||
private String chargingMode;
|
||||
|
||||
public Integer getConfirmResult() {
|
||||
|
||||
return confirmResult;
|
||||
@ -704,4 +709,11 @@ public class XhpcHistoryOrder extends BaseEntity {
|
||||
this.rateModelId = rateModelId;
|
||||
}
|
||||
|
||||
public String getChargingMode() {
|
||||
return chargingMode;
|
||||
}
|
||||
|
||||
public void setChargingMode(String chargingMode) {
|
||||
this.chargingMode = chargingMode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
|
||||
@Override
|
||||
public AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap) {
|
||||
|
||||
logger.info("---------------1111phone---------------"+phone);
|
||||
//调用接口
|
||||
String pattern = "^([1][0-9]{10})";
|
||||
Pattern compile = Pattern.compile(pattern);
|
||||
@ -74,20 +74,22 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
if (!isMatch) {
|
||||
return AjaxResult.error("1003", "请输入正确的手机号");
|
||||
}
|
||||
logger.info("---------------2222---------------");
|
||||
//添加短信记录
|
||||
XhpcSms xhpcSms =new XhpcSms();
|
||||
try {
|
||||
logger.info("---------------33333---------------");
|
||||
//用户使用的Key
|
||||
String pvToken = "pvToken:" + phone;
|
||||
//用户频繁调用的判断的Key
|
||||
String token = "token:" + phone;
|
||||
logger.info("------------------------------");
|
||||
logger.info("-------------4444-----------------");
|
||||
String cacheObject = REDIS.getCacheObject(token);
|
||||
System.out.println("过了redis");
|
||||
if (cacheObject != null) {
|
||||
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
||||
}
|
||||
logger.info("------------------------------");
|
||||
logger.info("--------------555----------------");
|
||||
//使用阿里云发送通知短信
|
||||
Map<String, String> neededParam = null;
|
||||
try {
|
||||
@ -103,7 +105,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
}
|
||||
xhpcSms.setPhone(phone);
|
||||
xhpcSms.setContent(neededParam.get("templateContent"));
|
||||
logger.info("============================");
|
||||
logger.info("===============666=============");
|
||||
xhpcSms.setCreateTime(new Date());
|
||||
xhpcSms.setRemark(neededParam.get("jsonResult"));
|
||||
|
||||
@ -115,7 +117,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
REDIS.setCacheObject(token, random, 60L, TimeUnit.SECONDS);
|
||||
xhpcSms.setStatus(0);
|
||||
xhpcSmsMapper.addXhpcSms(xhpcSms);
|
||||
logger.info("****************************");
|
||||
logger.info("************777****************");
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
xhpcSms.setStatus(1);
|
||||
@ -123,7 +125,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
||||
return AjaxResult.error(1012, "服务器繁忙,请稍后再试");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("++++++++++++++++++++++++++++");
|
||||
logger.info("+++++++++++888+++++++++++++++++");
|
||||
e.printStackTrace();
|
||||
xhpcSms.setStatus(3);
|
||||
xhpcSmsMapper.addXhpcSms(xhpcSms);
|
||||
|
||||
@ -1,24 +1,18 @@
|
||||
package com.xhpc.order.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.utils.poi.ExcelUtil;
|
||||
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.XhpcChargeOrder;
|
||||
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;
|
||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||
import com.xhpc.order.service.IXhpcStatisticsService;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -27,11 +21,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -64,17 +56,28 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* @param chargingStationName 电站名称
|
||||
* @param operatorId 运营商id
|
||||
* @param source 用户类型 0C端用户 1流量用户
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param beginStartTim 订单开始-开始时间
|
||||
* @param beginEndTime 订单开始-结束时间
|
||||
* @param userId 用户id
|
||||
* @param status 1 平台 2 运营商 3流量方
|
||||
* @param affiliationOrganization 归属机构
|
||||
* @param evcsOrderNo 互联单号
|
||||
* @param plateNum 车牌号
|
||||
* @param internetId 流量方名称
|
||||
* @param internetSerialNumber 流量方订单号
|
||||
* @param terminalName 终端名称
|
||||
* @param vinCode VIN码
|
||||
* @param overStartTime 订单结束-开始时间
|
||||
* @param overEndTime 订单结束-开始时间
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getListPage")
|
||||
public TableDataInfo getListPage(String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,@RequestParam("userId") Long userId, Integer type)
|
||||
public TableDataInfo getListPage(String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,@RequestParam("userId") Long userId, Integer type,
|
||||
String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime)
|
||||
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||
List<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
return getDataTable(listPage);
|
||||
}
|
||||
|
||||
@ -92,7 +95,6 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
/**
|
||||
* 历史订单导出
|
||||
* @param response 返回数据流
|
||||
* @param map 参数集
|
||||
* @throws IOException 文件创建异常
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@ -103,44 +105,31 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
String chargingStationName,
|
||||
Long operatorId,
|
||||
Integer source,
|
||||
String startTime,
|
||||
String endTime,
|
||||
String beginStartTime,
|
||||
String beginEndTime,
|
||||
@RequestParam("userId") Long userId,
|
||||
Integer type) throws IOException {
|
||||
Integer type,
|
||||
String affiliationOrganization,
|
||||
String evcsOrderNo,
|
||||
String plateNum,
|
||||
Integer internetId,
|
||||
String internetSerialNumber,
|
||||
String terminalName,
|
||||
String vinCode,
|
||||
String overStartTime,
|
||||
String overEndTime) throws IOException {
|
||||
|
||||
xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||
xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 终端统计
|
||||
*/
|
||||
@GetMapping("/test3")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test3(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
add(1000,3);
|
||||
}
|
||||
/**
|
||||
* 场站统计
|
||||
*/
|
||||
@GetMapping("/test2")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test2(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
add(1000,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期统计
|
||||
* 日期统计\场站统计\终端统计
|
||||
*/
|
||||
@GetMapping("/test1")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test1(){
|
||||
add(1000,1);
|
||||
add(500,1);
|
||||
}
|
||||
/**
|
||||
* 日期统计(已废弃)
|
||||
@ -148,284 +137,278 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
@GetMapping("/test7")
|
||||
//@Scheduled(cron = "0 0/6 * * * ?")
|
||||
public void test7(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//获取500条待统计历史订单
|
||||
//跨时段,跨费率,计费模型
|
||||
//日期统计
|
||||
int type =1;
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(1000,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);
|
||||
|
||||
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
//每分钟多少度电
|
||||
BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
if(decimal.compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
BigDecimal divide = xhpc.getChargingDegree().divide(decimal,2,BigDecimal.ROUND_DOWN);
|
||||
|
||||
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);
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1);
|
||||
}else{
|
||||
//跨天
|
||||
DateTime tomorrow = DateUtil.offsetDay(startTime,1);
|
||||
Date startTime3 =DateUtil.beginOfDay(tomorrow);
|
||||
|
||||
Map<String, BigDecimal> map =addStatisticsStation(new HashMap<String,BigDecimal>(),xhpc, DateUtil.formatTime(startTime), "23:59:59",divide,1,1);
|
||||
|
||||
addStatisticsStation(map,xhpc, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime),divide,2,1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// int type =1;
|
||||
// List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(1000,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);
|
||||
//
|
||||
// if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
// continue;
|
||||
// }
|
||||
// if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
// continue;
|
||||
// }
|
||||
// //每分钟多少度电
|
||||
// BigDecimal decimal = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
// if(decimal.compareTo(new BigDecimal(0)) !=1){
|
||||
// continue;
|
||||
// }
|
||||
// BigDecimal divide = xhpc.getChargingDegree().divide(decimal,2,BigDecimal.ROUND_DOWN);
|
||||
//
|
||||
// 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);
|
||||
// xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
// xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
// //修改历史订单表状态
|
||||
// xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1);
|
||||
// }else{
|
||||
// //跨天
|
||||
// DateTime tomorrow = DateUtil.offsetDay(startTime,1);
|
||||
// Date startTime3 =DateUtil.beginOfDay(tomorrow);
|
||||
//
|
||||
// Map<String, BigDecimal> map =addStatisticsStation(new HashMap<String,BigDecimal>(),xhpc, DateUtil.formatTime(startTime), "23:59:59",divide,1,1);
|
||||
//
|
||||
// addStatisticsStation(map,xhpc, DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime),divide,2,1);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private Map<String,BigDecimal> addStatisticsStation(Map<String,BigDecimal> map1, XhpcChargeHistoryOrder xhpc, String startTime, String endTime, BigDecimal divide,int number,int type) {
|
||||
|
||||
//总金额
|
||||
BigDecimal totalPrice =new BigDecimal(0);
|
||||
//总电费
|
||||
BigDecimal powerPriceTotal =new BigDecimal(0);
|
||||
//总服务费
|
||||
BigDecimal servicePriceTotal =new BigDecimal(0);
|
||||
//实收电费
|
||||
BigDecimal actPowerPrice =new BigDecimal(0);
|
||||
//实收服务费
|
||||
BigDecimal actServicePrice =new BigDecimal(0);
|
||||
//总充电电量
|
||||
BigDecimal chargingDegree =new BigDecimal(0);
|
||||
//电站活动抵扣--抵扣的总金额
|
||||
BigDecimal promotionDiscount =new BigDecimal(0);
|
||||
//实际价格-用户支付的钱
|
||||
BigDecimal actPrice =new BigDecimal(0);
|
||||
if(number ==2){
|
||||
totalPrice =map1.get("totalPrice");
|
||||
powerPriceTotal =map1.get("powerPriceTotal");
|
||||
servicePriceTotal =map1.get("servicePriceTotal");
|
||||
actPowerPrice =map1.get("actPowerPrice");
|
||||
actServicePrice =map1.get("actServicePrice");
|
||||
chargingDegree =map1.get("chargingDegree");
|
||||
promotionDiscount =map1.get("promotionDiscount");
|
||||
actPrice =map1.get("actPrice");
|
||||
}else{
|
||||
totalPrice = xhpc.getTotalPrice();
|
||||
powerPriceTotal =xhpc.getPowerPriceTotal();
|
||||
servicePriceTotal =xhpc.getServicePriceTotal();
|
||||
actPowerPrice =xhpc.getActPowerPrice();
|
||||
actServicePrice =xhpc.getActServicePrice();
|
||||
chargingDegree =xhpc.getChargingDegree();
|
||||
promotionDiscount = xhpc.getPromotionDiscount();
|
||||
actPrice = xhpc.getActPrice();
|
||||
}
|
||||
|
||||
//叠加总电费
|
||||
BigDecimal powerPriceTotal1 =new BigDecimal(0);
|
||||
//叠加总服务费
|
||||
BigDecimal servicePriceTotal1 =new BigDecimal(0);
|
||||
|
||||
|
||||
//时长
|
||||
BigDecimal timeInterval = new BigDecimal(0);
|
||||
//时长
|
||||
BigDecimal chargingDegree2 = new BigDecimal(0);
|
||||
|
||||
|
||||
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime, endTime, xhpc.getRateModelId());
|
||||
for (int i = 0; i <reatTimeList.size() ; i++) {
|
||||
BigDecimal powerFee =new BigDecimal(0);
|
||||
BigDecimal serviceFee =new BigDecimal(0);
|
||||
String startTime1 =startTime;
|
||||
String endTime1 =endTime;
|
||||
Map<String, Object> map = reatTimeList.get(i);
|
||||
//获取费率
|
||||
if(reatTimeList.size()==1){
|
||||
powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
}else if (i==0){
|
||||
powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
endTime1 = map.get("endTime").toString();
|
||||
if("00:00:00".equals(endTime1)){
|
||||
endTime1="23:59:59";
|
||||
}
|
||||
}else if(i!=reatTimeList.size()-1){
|
||||
powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
startTime1 = map.get("startTime").toString();
|
||||
endTime1 = map.get("endTime").toString();
|
||||
if("00:00:00".equals(endTime1)){
|
||||
endTime1="23:59:59";
|
||||
}
|
||||
}else{
|
||||
powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
startTime1 = map.get("startTime").toString();
|
||||
}
|
||||
timeInterval =timeInterval.add(new BigDecimal((DateUtil.parse(endTime1).getTime()-DateUtil.parse(startTime1).getTime())).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN));
|
||||
powerPriceTotal1 = powerPriceTotal1.add(powerFee.multiply(divide).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
servicePriceTotal1 = servicePriceTotal1.add(serviceFee.multiply(divide).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
chargingDegree2 =chargingDegree2.add(timeInterval.multiply(divide).setScale(2,BigDecimal.ROUND_DOWN));
|
||||
}
|
||||
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
||||
xhpcSt.setChargingDegree(chargingDegree2);
|
||||
xhpcSt.setChargingTime(timeInterval.divide(new BigDecimal(60),2,BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setChargingNumber(1);
|
||||
xhpcSt.setPowerPrice(powerPriceTotal1);
|
||||
xhpcSt.setServicePrice(servicePriceTotal1);
|
||||
xhpcSt.setActPowerPrice(powerPriceTotal1);
|
||||
xhpcSt.setActServicePrice(servicePriceTotal1);
|
||||
xhpcSt.setTotalPrice(powerPriceTotal1.add(servicePriceTotal1));
|
||||
BigDecimal actPrice2 =powerPriceTotal1.add(servicePriceTotal1);
|
||||
BigDecimal promotion =new BigDecimal(2);
|
||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
if(number==1){
|
||||
BigDecimal internetCommission = xhpcSt.getInternetCommission();
|
||||
if(internetCommission.compareTo(new BigDecimal(0))!=0){
|
||||
actPrice2 = actPrice2.subtract(internetCommission);
|
||||
}else{
|
||||
actPrice2 =actPrice2.subtract(xhpcSt.getInternetSvcCommission());
|
||||
}
|
||||
actPrice2 = actPrice2.subtract(xhpcSt.getPromotionDiscount());
|
||||
xhpcSt.setActPrice(actPrice2);
|
||||
//总金额
|
||||
BigDecimal totalPrice1 = xhpcSt.getTotalPrice();
|
||||
if(totalPrice.compareTo(totalPrice1)==1){
|
||||
totalPrice=totalPrice.subtract(totalPrice1);
|
||||
}else{
|
||||
xhpcSt.setTotalPrice(totalPrice);
|
||||
}
|
||||
//总电费
|
||||
BigDecimal powerPrice1 = xhpcSt.getPowerPrice();
|
||||
if(powerPriceTotal.compareTo(powerPrice1)==1){
|
||||
powerPriceTotal=powerPriceTotal.subtract(powerPrice1);
|
||||
}else{
|
||||
xhpcSt.setPowerPrice(powerPriceTotal);
|
||||
}
|
||||
//总服务费
|
||||
BigDecimal servicePrice1 = xhpcSt.getServicePrice();
|
||||
if(servicePriceTotal.compareTo(servicePrice1)==1){
|
||||
servicePriceTotal=servicePriceTotal.subtract(servicePrice1);
|
||||
}else{
|
||||
xhpcSt.setServicePrice(servicePriceTotal);
|
||||
}
|
||||
//实收电费
|
||||
BigDecimal actPowerPrice1 = xhpcSt.getActPowerPrice();
|
||||
if(actPowerPrice.compareTo(actPowerPrice1)==1){
|
||||
actPowerPrice=actPowerPrice.subtract(actPowerPrice1);
|
||||
}else{
|
||||
xhpcSt.setActPowerPrice(actPowerPrice);
|
||||
}
|
||||
//实收服务费
|
||||
BigDecimal actServicePrice1 = xhpcSt.getActServicePrice();
|
||||
if(actServicePrice.compareTo(actServicePrice1)==1){
|
||||
actServicePrice=actServicePrice.subtract(actServicePrice1);
|
||||
}else{
|
||||
xhpcSt.setActServicePrice(actServicePrice);
|
||||
}
|
||||
//总充电电量
|
||||
BigDecimal chargingDegree1 = xhpcSt.getChargingDegree();
|
||||
if(chargingDegree.compareTo(chargingDegree1)==1){
|
||||
chargingDegree=chargingDegree.subtract(chargingDegree1);
|
||||
}else{
|
||||
xhpcSt.setChargingDegree(chargingDegree);
|
||||
}
|
||||
|
||||
//实际价格-用户支付的钱
|
||||
BigDecimal actPrice1 = xhpcSt.getActPrice();
|
||||
if(actPrice.compareTo(actPrice1)==1){
|
||||
actPrice=actPrice.subtract(actPrice1);
|
||||
}else{
|
||||
xhpcSt.setActPrice(actPrice);
|
||||
}
|
||||
}else{
|
||||
xhpcSt.setPowerPrice(powerPriceTotal);
|
||||
xhpcSt.setServicePrice(servicePriceTotal);
|
||||
xhpcSt.setTotalPrice(totalPrice);
|
||||
xhpcSt.setPromotionDiscount(promotionDiscount);
|
||||
xhpcSt.setActPrice(actPrice);
|
||||
xhpcSt.setActPowerPrice(actPowerPrice);
|
||||
xhpcSt.setActServicePrice(actServicePrice);
|
||||
xhpcSt.setChargingDegree(chargingDegree);
|
||||
}
|
||||
|
||||
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);
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1);
|
||||
|
||||
// //总金额
|
||||
// BigDecimal totalPrice =new BigDecimal(0);
|
||||
// //总电费
|
||||
// BigDecimal powerPriceTotal =new BigDecimal(0);
|
||||
// //总服务费
|
||||
// BigDecimal servicePriceTotal =new BigDecimal(0);
|
||||
// //实收电费
|
||||
// BigDecimal actPowerPrice =new BigDecimal(0);
|
||||
// //实收服务费
|
||||
// BigDecimal actServicePrice =new BigDecimal(0);
|
||||
// //总充电电量
|
||||
// BigDecimal chargingDegree =new BigDecimal(0);
|
||||
// //电站活动抵扣--抵扣的总金额
|
||||
// BigDecimal promotionDiscount =new BigDecimal(0);
|
||||
// //实际价格-用户支付的钱
|
||||
// BigDecimal actPrice =new BigDecimal(0);
|
||||
// if(number ==2){
|
||||
// totalPrice =map1.get("totalPrice");
|
||||
// powerPriceTotal =map1.get("powerPriceTotal");
|
||||
// servicePriceTotal =map1.get("servicePriceTotal");
|
||||
// actPowerPrice =map1.get("actPowerPrice");
|
||||
// actServicePrice =map1.get("actServicePrice");
|
||||
// chargingDegree =map1.get("chargingDegree");
|
||||
// promotionDiscount =map1.get("promotionDiscount");
|
||||
// actPrice =map1.get("actPrice");
|
||||
// }else{
|
||||
// totalPrice = xhpc.getTotalPrice();
|
||||
// powerPriceTotal =xhpc.getPowerPriceTotal();
|
||||
// servicePriceTotal =xhpc.getServicePriceTotal();
|
||||
// actPowerPrice =xhpc.getActPowerPrice();
|
||||
// actServicePrice =xhpc.getActServicePrice();
|
||||
// chargingDegree =xhpc.getChargingDegree();
|
||||
// promotionDiscount = xhpc.getPromotionDiscount();
|
||||
// actPrice = xhpc.getActPrice();
|
||||
// }
|
||||
//
|
||||
// //叠加总电费
|
||||
// BigDecimal powerPriceTotal1 =new BigDecimal(0);
|
||||
// //叠加总服务费
|
||||
// BigDecimal servicePriceTotal1 =new BigDecimal(0);
|
||||
//
|
||||
//
|
||||
// //时长
|
||||
// BigDecimal timeInterval = new BigDecimal(0);
|
||||
// //时长
|
||||
// BigDecimal chargingDegree2 = new BigDecimal(0);
|
||||
//
|
||||
//
|
||||
// List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime, endTime, xhpc.getRateModelId());
|
||||
// for (int i = 0; i <reatTimeList.size() ; i++) {
|
||||
// BigDecimal powerFee =new BigDecimal(0);
|
||||
// BigDecimal serviceFee =new BigDecimal(0);
|
||||
// String startTime1 =startTime;
|
||||
// String endTime1 =endTime;
|
||||
// Map<String, Object> map = reatTimeList.get(i);
|
||||
// //获取费率
|
||||
// if(reatTimeList.size()==1){
|
||||
// powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
// serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
// }else if (i==0){
|
||||
// powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
// serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
// endTime1 = map.get("endTime").toString();
|
||||
// if("00:00:00".equals(endTime1)){
|
||||
// endTime1="23:59:59";
|
||||
// }
|
||||
// }else if(i!=reatTimeList.size()-1){
|
||||
// powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
// serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
// startTime1 = map.get("startTime").toString();
|
||||
// endTime1 = map.get("endTime").toString();
|
||||
// if("00:00:00".equals(endTime1)){
|
||||
// endTime1="23:59:59";
|
||||
// }
|
||||
// }else{
|
||||
// powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||
// serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||
// startTime1 = map.get("startTime").toString();
|
||||
// }
|
||||
// timeInterval =timeInterval.add(new BigDecimal((DateUtil.parse(endTime1).getTime()-DateUtil.parse(startTime1).getTime())).divide(new BigDecimal(60000),2, BigDecimal.ROUND_DOWN));
|
||||
// powerPriceTotal1 = powerPriceTotal1.add(powerFee.multiply(divide).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
// servicePriceTotal1 = servicePriceTotal1.add(serviceFee.multiply(divide).setScale(2, BigDecimal.ROUND_DOWN));
|
||||
// chargingDegree2 =chargingDegree2.add(timeInterval.multiply(divide).setScale(2,BigDecimal.ROUND_DOWN));
|
||||
// }
|
||||
// XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
||||
// xhpcSt.setChargingDegree(chargingDegree2);
|
||||
// xhpcSt.setChargingTime(timeInterval.divide(new BigDecimal(60),2,BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setChargingNumber(1);
|
||||
// xhpcSt.setPowerPrice(powerPriceTotal1);
|
||||
// xhpcSt.setServicePrice(servicePriceTotal1);
|
||||
// xhpcSt.setActPowerPrice(powerPriceTotal1);
|
||||
// xhpcSt.setActServicePrice(servicePriceTotal1);
|
||||
// xhpcSt.setTotalPrice(powerPriceTotal1.add(servicePriceTotal1));
|
||||
// BigDecimal actPrice2 =powerPriceTotal1.add(servicePriceTotal1);
|
||||
// BigDecimal promotion =new BigDecimal(2);
|
||||
// xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setInternetCommission(xhpc.getInternetCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setPlatformCommission(xhpc.getPlatformCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setOperationCommission(xhpc.getOperationCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission().divide(promotion,2, BigDecimal.ROUND_DOWN));
|
||||
// if(number==1){
|
||||
// BigDecimal internetCommission = xhpcSt.getInternetCommission();
|
||||
// if(internetCommission.compareTo(new BigDecimal(0))!=0){
|
||||
// actPrice2 = actPrice2.subtract(internetCommission);
|
||||
// }else{
|
||||
// actPrice2 =actPrice2.subtract(xhpcSt.getInternetSvcCommission());
|
||||
// }
|
||||
// actPrice2 = actPrice2.subtract(xhpcSt.getPromotionDiscount());
|
||||
// xhpcSt.setActPrice(actPrice2);
|
||||
// //总金额
|
||||
// BigDecimal totalPrice1 = xhpcSt.getTotalPrice();
|
||||
// if(totalPrice.compareTo(totalPrice1)==1){
|
||||
// totalPrice=totalPrice.subtract(totalPrice1);
|
||||
// }else{
|
||||
// xhpcSt.setTotalPrice(totalPrice);
|
||||
// }
|
||||
// //总电费
|
||||
// BigDecimal powerPrice1 = xhpcSt.getPowerPrice();
|
||||
// if(powerPriceTotal.compareTo(powerPrice1)==1){
|
||||
// powerPriceTotal=powerPriceTotal.subtract(powerPrice1);
|
||||
// }else{
|
||||
// xhpcSt.setPowerPrice(powerPriceTotal);
|
||||
// }
|
||||
// //总服务费
|
||||
// BigDecimal servicePrice1 = xhpcSt.getServicePrice();
|
||||
// if(servicePriceTotal.compareTo(servicePrice1)==1){
|
||||
// servicePriceTotal=servicePriceTotal.subtract(servicePrice1);
|
||||
// }else{
|
||||
// xhpcSt.setServicePrice(servicePriceTotal);
|
||||
// }
|
||||
// //实收电费
|
||||
// BigDecimal actPowerPrice1 = xhpcSt.getActPowerPrice();
|
||||
// if(actPowerPrice.compareTo(actPowerPrice1)==1){
|
||||
// actPowerPrice=actPowerPrice.subtract(actPowerPrice1);
|
||||
// }else{
|
||||
// xhpcSt.setActPowerPrice(actPowerPrice);
|
||||
// }
|
||||
// //实收服务费
|
||||
// BigDecimal actServicePrice1 = xhpcSt.getActServicePrice();
|
||||
// if(actServicePrice.compareTo(actServicePrice1)==1){
|
||||
// actServicePrice=actServicePrice.subtract(actServicePrice1);
|
||||
// }else{
|
||||
// xhpcSt.setActServicePrice(actServicePrice);
|
||||
// }
|
||||
// //总充电电量
|
||||
// BigDecimal chargingDegree1 = xhpcSt.getChargingDegree();
|
||||
// if(chargingDegree.compareTo(chargingDegree1)==1){
|
||||
// chargingDegree=chargingDegree.subtract(chargingDegree1);
|
||||
// }else{
|
||||
// xhpcSt.setChargingDegree(chargingDegree);
|
||||
// }
|
||||
//
|
||||
// //实际价格-用户支付的钱
|
||||
// BigDecimal actPrice1 = xhpcSt.getActPrice();
|
||||
// if(actPrice.compareTo(actPrice1)==1){
|
||||
// actPrice=actPrice.subtract(actPrice1);
|
||||
// }else{
|
||||
// xhpcSt.setActPrice(actPrice);
|
||||
// }
|
||||
// }else{
|
||||
// xhpcSt.setPowerPrice(powerPriceTotal);
|
||||
// xhpcSt.setServicePrice(servicePriceTotal);
|
||||
// xhpcSt.setTotalPrice(totalPrice);
|
||||
// xhpcSt.setPromotionDiscount(promotionDiscount);
|
||||
// xhpcSt.setActPrice(actPrice);
|
||||
// xhpcSt.setActPowerPrice(actPowerPrice);
|
||||
// xhpcSt.setActServicePrice(actServicePrice);
|
||||
// xhpcSt.setChargingDegree(chargingDegree);
|
||||
// }
|
||||
//
|
||||
// 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);
|
||||
// xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
// xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
//
|
||||
// //修改历史订单表状态
|
||||
// xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1);
|
||||
//
|
||||
Map<String,BigDecimal> map2 =new HashMap<>();
|
||||
map2.put("totalPrice",totalPrice);
|
||||
map2.put("powerPriceTotal",powerPriceTotal);
|
||||
map2.put("servicePriceTotal",servicePriceTotal);
|
||||
map2.put("actPowerPrice",actPowerPrice);
|
||||
map2.put("actServicePrice",actServicePrice);
|
||||
map2.put("chargingDegree",chargingDegree);
|
||||
map2.put("promotionDiscount",promotionDiscount);
|
||||
map2.put("actPrice",actPrice);
|
||||
// map2.put("totalPrice",totalPrice);
|
||||
// map2.put("powerPriceTotal",powerPriceTotal);
|
||||
// map2.put("servicePriceTotal",servicePriceTotal);
|
||||
// map2.put("actPowerPrice",actPowerPrice);
|
||||
// map2.put("actServicePrice",actServicePrice);
|
||||
// map2.put("chargingDegree",chargingDegree);
|
||||
// map2.put("promotionDiscount",promotionDiscount);
|
||||
// map2.put("actPrice",actPrice);
|
||||
return map2;
|
||||
|
||||
}
|
||||
@ -439,90 +422,74 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//小时统计
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(500,0);
|
||||
if(list !=null && list.size()>0){
|
||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||
//小时统计
|
||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(500,0);
|
||||
if(list !=null && list.size()>0){
|
||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||
|
||||
try{
|
||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||
Date startTime = xhpc.getStartTime();
|
||||
Date endTime = xhpc.getEndTime();
|
||||
Long rateModelId = xhpc.getRateModelId();
|
||||
Long operatorId =xhpc.getOperatorId();
|
||||
Long chargingStationId = xhpc.getChargingStationId();
|
||||
Long terminalId = xhpc.getTerminalId();
|
||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||
Date data = Calendar.getInstance().getTime();
|
||||
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
//每分钟多少度电
|
||||
BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
if(v.compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
int endHour = DateUtil.hour(endTime, true);
|
||||
|
||||
//没有跨时段
|
||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||
xhpcSt.setStatus(endHour+1);
|
||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setChargingNumber(1);
|
||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||
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.setOperatorId(operatorId);
|
||||
xhpcSt.setChargingStationId(chargingStationId);
|
||||
xhpcSt.setCreateTime(data);
|
||||
xhpcSt.setTerminalId(terminalId);
|
||||
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||
if(xhpc.getSource()==1){
|
||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||
}
|
||||
|
||||
//时间没有跨天
|
||||
// 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);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// if(betweenDay==0){
|
||||
// List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), rateModelId);
|
||||
// map = reatTimeList.get(0);
|
||||
// }else{
|
||||
// //明天
|
||||
// DateTime tomorrow = DateUtil.offsetDay(startTime,1);
|
||||
// Date startTime3 =DateUtil.beginOfDay(tomorrow);
|
||||
// List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime3), DateUtil.formatTime(endTime), rateModelId);
|
||||
// map = reatTimeList.get(0);
|
||||
// }
|
||||
// xhpcSt.setElecPriceEvcs(new BigDecimal(map.get("powerFee").toString()));
|
||||
// xhpcSt.setServicePriceEvcs(new BigDecimal(map.get("serviceFee").toString()));
|
||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||
}catch (Exception e){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||
try{
|
||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||
Date startTime = xhpc.getStartTime();
|
||||
Date endTime = xhpc.getEndTime();
|
||||
Long rateModelId = xhpc.getRateModelId();
|
||||
Long operatorId =xhpc.getOperatorId();
|
||||
Long chargingStationId = xhpc.getChargingStationId();
|
||||
Long terminalId = xhpc.getTerminalId();
|
||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||
Date data = Calendar.getInstance().getTime();
|
||||
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
//每分钟多少度电
|
||||
BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
|
||||
if(v.compareTo(new BigDecimal(0)) !=1){
|
||||
continue;
|
||||
}
|
||||
int endHour = DateUtil.hour(endTime, true);
|
||||
|
||||
//没有跨时段
|
||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||
xhpcSt.setStatus(endHour+1);
|
||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN));
|
||||
xhpcSt.setChargingNumber(1);
|
||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||
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.setOperatorId(operatorId);
|
||||
xhpcSt.setChargingStationId(chargingStationId);
|
||||
xhpcSt.setCreateTime(data);
|
||||
xhpcSt.setTerminalId(terminalId);
|
||||
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||
if(xhpc.getSource()==1){
|
||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||
}
|
||||
|
||||
//时间没有跨天
|
||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||
}catch (Exception e){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -846,9 +813,9 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
xhpcSt.setServicePrice(servicePriceTotal);
|
||||
xhpcSt.setTotalPrice(totalPrice);
|
||||
xhpcSt.setPromotionDiscount(promotionDiscount);
|
||||
xhpcSt.setActPrice(actPrice);
|
||||
xhpcSt.setActPrice(actPrice);
|
||||
xhpcSt.setActPowerPrice(actPowerPrice);
|
||||
xhpcSt.setActServicePrice(actServicePrice);
|
||||
xhpcSt.setActServicePrice(actServicePrice);
|
||||
xhpcSt.setChargingDegree(chargingDegree);
|
||||
}
|
||||
xhpcSt.setActPrice(xhpcSt.getTotalPrice().subtract(xhpcSt.getPromotionDiscount()));
|
||||
@ -896,7 +863,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
@GetMapping("/test4")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test4(){
|
||||
//获取异常的订单 24小时之外的异常订单
|
||||
//获取异常的订单 24小时之外的异常订单
|
||||
List<XhpcChargeOrder> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2, 0);
|
||||
|
||||
if(xhpcChargeOrderList !=null && xhpcChargeOrderList.size()>0){
|
||||
@ -949,43 +916,19 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
xhpcSt.setChargingStationId(xhpc.getChargingStationId());
|
||||
xhpcSt.setCreateTime(Calendar.getInstance().getTime());
|
||||
xhpcSt.setTerminalId(xhpc.getTerminalId());
|
||||
xhpcSt.setChargingMode(xhpc.getChargingMode());
|
||||
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
|
||||
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
|
||||
xhpcSt.setType(type);
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
|
||||
for (int i = type; i <4 ; i++) {
|
||||
xhpcSt.setType(i);
|
||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||
}
|
||||
//修改历史订单表状态
|
||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// String dateStr = "2017-03-01 20:33:23";
|
||||
// Date date = DateUtil.parse(dateStr);
|
||||
//
|
||||
//
|
||||
// String dateStr1 = "2017-03-01 22:33:23";
|
||||
// Date date1 = DateUtil.parse(dateStr1);
|
||||
//
|
||||
// System.out.println(date1.getTime()-date.getTime());
|
||||
//
|
||||
//
|
||||
// DateTime startTime = DateUtil.parse("2021-10-19 17:35:19");
|
||||
// DateTime endTime = DateUtil.parse("2021-10-19 17:36:02");
|
||||
//
|
||||
// //充电时长
|
||||
// Long tiem = (endTime.getTime() - startTime.getTime())/1000;
|
||||
// System.out.println(">>>>"+tiem);
|
||||
//
|
||||
//
|
||||
// BigDecimal decimal = new BigDecimal(72);
|
||||
// BigDecimal decimal1 = new BigDecimal(3600);
|
||||
//
|
||||
// System.out.println(decimal.divide(decimal1,2,BigDecimal.ROUND_DOWN));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,13 +40,18 @@ public class XhpcRealTimeOrderController extends BaseController {
|
||||
* @param status 状态(-1准备充电 0开始充电 1自动结算,2异常,3平台结算)
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @param affiliationOrganization 归属机构(暂不查询)
|
||||
* @param plateNum 车牌号
|
||||
* @param internetId 流量方名称
|
||||
* @param internetSerialNumber 流量方订单号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,@RequestParam("status") Integer status,@RequestParam("userId") Long userId,@RequestParam("type") Integer type)
|
||||
public TableDataInfo list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,@RequestParam("status") Integer status,@RequestParam("userId") Long userId,@RequestParam("type") Integer type,
|
||||
String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type);
|
||||
List<Map<String,Object>> list = xhpcRealTimeOrderService.list(phone, transactionNumber, source, chargingStationName,terminalName, operatorId, startTime, endTime,status,userId,type,affiliationOrganization,plateNum,internetId,internetSerialNumber);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -207,20 +207,29 @@ public class XhpcStatisticsController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单来源(第三方、支付宝、微信、运营商),权限划分
|
||||
* @param chargingStationId 电站id
|
||||
* 订单来源地方,权限划分
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSourceList")
|
||||
public AjaxResult getSourceList(Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
|
||||
if (type == null || type == 3) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return xhpcStatisticsService.getTerminalList(chargingStationId, userId, type);
|
||||
public AjaxResult getSourceList(@RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
|
||||
return xhpcStatisticsService.getSourceList(userId, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单来源(第三方、支付宝、微信、运营商),权限划分
|
||||
* @param internetUserIds 订单来源集合
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getSumSourceList")
|
||||
public TableDataInfo getSumSourceList(String startTime, String endTime, String internetUserIds,@RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getSumSourceList(startTime,endTime,internetUserIds,userId, type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
// -------- 导出数据 ------------
|
||||
|
||||
@ -119,4 +119,9 @@ public class XhpcStatisticsStation extends BaseEntity {
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 充电方式
|
||||
*/
|
||||
private String chargingMode;
|
||||
|
||||
}
|
||||
|
||||
@ -257,6 +257,11 @@ public class XhpcChargeHistoryOrder {
|
||||
*/
|
||||
private Double meterValueEndEvcs;
|
||||
|
||||
/**
|
||||
* 充电方式
|
||||
*/
|
||||
private String chargingMode;
|
||||
|
||||
public Date getCreateTime() {
|
||||
|
||||
return createTime;
|
||||
@ -742,4 +747,11 @@ public class XhpcChargeHistoryOrder {
|
||||
this.internetUserId = internetUserId;
|
||||
}
|
||||
|
||||
public String getChargingMode() {
|
||||
return chargingMode;
|
||||
}
|
||||
|
||||
public void setChargingMode(String chargingMode) {
|
||||
this.chargingMode = chargingMode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public interface XhpcHistoryOrderMapper {
|
||||
* 历史订单记录(PC)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number);
|
||||
List<Map<String,Object>> getListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime);
|
||||
|
||||
/**
|
||||
* 获取费率时段
|
||||
|
||||
@ -59,7 +59,8 @@ public interface XhpcRealTimeOrderMapper {
|
||||
* @param number 0 都没有 1 phone 有 2 用户类型有 3 都有
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> list(@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("number") Integer number,@Param("status")Integer status,@Param("userId")Long userId,@Param("type")Integer type);
|
||||
List<Map<String,Object>> list(@Param("phone") String phone,@Param("transactionNumber") String transactionNumber,@Param("source") Integer source,@Param("chargingStationName") String chargingStationName,@Param("terminalName")String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("number") Integer number,@Param("status")Integer status,@Param("userId")Long userId,@Param("type")Integer type,
|
||||
@Param("affiliationOrganization")String affiliationOrganization,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber);
|
||||
|
||||
/**
|
||||
* 实时订单详情接口(PC端)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.order.domain.XhpcStatisticsStation;
|
||||
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -138,4 +139,24 @@ public interface XhpcStatisticsServiceMapper {
|
||||
* @param xhpcStatisticsStation
|
||||
*/
|
||||
void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);
|
||||
|
||||
/**
|
||||
* 获取流量方列表
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,String>> getInternetList(@Param("userId")Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 订单来源列表
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type);
|
||||
|
||||
/**
|
||||
* 获取登陆用户信息
|
||||
*/
|
||||
Map<String, Object> getLandUser(@Param("userId")Long userId);
|
||||
}
|
||||
|
||||
@ -52,14 +52,14 @@ public interface IXhpcHistoryOrderService {
|
||||
* 历史订单记录(PC)
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,Long userId,Integer type);
|
||||
List<Map<String,Object>> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime);
|
||||
|
||||
|
||||
/**
|
||||
* 历史订单记录导出(PC)
|
||||
* @return
|
||||
*/
|
||||
void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) throws IOException;
|
||||
void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -30,7 +30,7 @@ public interface IXhpcRealTimeOrderService {
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,Integer status,Long userId,Integer type);
|
||||
List<Map<String,Object>> list(String phone,String transactionNumber,Integer source,String chargingStationName,String terminalName,Long operatorId,String startTime,String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber);
|
||||
|
||||
/**
|
||||
* 实时订单详情接口(PC端)
|
||||
|
||||
@ -134,6 +134,22 @@ public interface IXhpcStatisticsService {
|
||||
*/
|
||||
AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type);
|
||||
|
||||
/**
|
||||
* 订单来源列表
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getSourceList(Long userId,Integer type);
|
||||
|
||||
/**
|
||||
* 订单来源列表
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getSumSourceList(String startTime, String endTime, String sourceIds,Long userId,Integer type);
|
||||
|
||||
/**
|
||||
* 添加时段订单统计
|
||||
* @param xhpcStatisticsTimeInterval
|
||||
|
||||
@ -226,9 +226,9 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
||||
}
|
||||
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
|
||||
if (type == 1) {
|
||||
xhpcChargeOrder.setChargingMode("小华充电微信");
|
||||
xhpcChargeOrder.setChargingMode("微信");
|
||||
} else {
|
||||
xhpcChargeOrder.setChargingMode("小华充电支付宝");
|
||||
xhpcChargeOrder.setChargingMode("支付宝");
|
||||
}
|
||||
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
|
||||
xhpcChargeOrder.setType(40);
|
||||
|
||||
@ -85,7 +85,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) {
|
||||
public List<Map<String, Object>> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) {
|
||||
|
||||
Integer number = 0;
|
||||
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
|
||||
@ -106,25 +106,25 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||
if ("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())) {
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
//运营商看自己的场站
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, startTime, endTime, logOperatorId, type, number);
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
} else {
|
||||
//查询赋值的场站
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, startTime, endTime, logUserId, type, number);
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, startTime, endTime, userId, type, number);
|
||||
list = xhpcHistoryOrderMapper.getListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) throws IOException {
|
||||
public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime) throws IOException {
|
||||
|
||||
List<Map<String, Object>> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||
List<Map<String, Object>> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime);
|
||||
// 通过工具类创建writer,默认创建xls格式
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
writer.addHeaderAlias("historyOrderId", "历史订单ID");
|
||||
|
||||
@ -55,7 +55,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcRealTimeOrderServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime,Integer status,Long userId,Integer type) {
|
||||
public List<Map<String, Object>> list(String phone, String transactionNumber, Integer source, String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime,Integer status,Long userId,Integer type,String affiliationOrganization,String plateNum,Integer internetId,String internetSerialNumber) {
|
||||
|
||||
|
||||
//获取登陆用户
|
||||
@ -83,15 +83,15 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
if("01".equals(landUser.get("userType").toString()) || "03".equals(landUser.get("userType").toString())){
|
||||
Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString());
|
||||
//运营商看自己的场站
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logOperatorId,1);
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logOperatorId,1,affiliationOrganization,plateNum,internetId,internetSerialNumber);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,2);
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,2,affiliationOrganization,plateNum,internetId,internetSerialNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0);
|
||||
list = xhpcRealTimeOrderMapper.list(phone,transactionNumber,source,chargingStationName,terminalName,operatorId,startTime,endTime,number,status,logUserId,0,affiliationOrganization,plateNum,internetId,internetSerialNumber);
|
||||
}
|
||||
|
||||
return list;
|
||||
@ -515,6 +515,9 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
||||
//增加流水订单号
|
||||
if(operatorMessage!=null && operatorMessage.get("operatorId")!=null){
|
||||
String evcs = EvcsUtil.transferInternetOrderNo(xhpcChargeOrder.getSerialNumber(), operatorMessage.get("operatorId").toString());
|
||||
logger.info("》》》》evcs》》》:"+evcs);
|
||||
logger.info("》》》》evcs》》》:"+evcs);
|
||||
logger.info("》》》》evcs》》》:"+evcs);
|
||||
xhpcHistoryOrder.setEvcsOrderNo(evcs);
|
||||
}
|
||||
|
||||
|
||||
@ -387,6 +387,40 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getSourceList(Long userId, Integer type) {
|
||||
//获取登陆用户
|
||||
Long logUserId = SecurityUtils.getUserId();
|
||||
//桩的统计、该时段金额
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
Map<String, Object> landUser = xhpcStatisticsServiceMapper.getLandUser(logUserId);
|
||||
if (landUser != null) {
|
||||
if (landUser.get("userType") != null && "02".equals(landUser.get("userType").toString())) {
|
||||
list = xhpcStatisticsServiceMapper.getInternetList(logUserId);
|
||||
}else{
|
||||
list = xhpcStatisticsServiceMapper.getInternetList(null);
|
||||
Map<String, String> map1 =new HashMap<>();
|
||||
Map<String, String> map2 =new HashMap<>();
|
||||
map1.put("name","微信");
|
||||
map1.put("id","微信");
|
||||
map2.put("name","支付宝");
|
||||
map2.put("id","支付宝");
|
||||
list.add(map1);
|
||||
list.add(map2);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getSumSourceList(String startTime, String endTime, String sourceIds, Long userId, Integer type) {
|
||||
List<String> sourceList =new ArrayList<>();
|
||||
if(!"".equals(sourceIds) && sourceIds !=null){
|
||||
sourceList= Arrays.asList(sourceIds.split(","));
|
||||
}
|
||||
return xhpcStatisticsServiceMapper.getSumSourceList(startTime, endTime, sourceList, userId, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval) {
|
||||
xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval);
|
||||
|
||||
@ -598,7 +598,9 @@
|
||||
ho.type as orderType,
|
||||
ho.start_soc as startSoc,
|
||||
ho.end_soc as endSoc,
|
||||
ho.vin_normal as vinCode,
|
||||
ho.internet_serial_number as internetSerialNumber,
|
||||
ho.evcs_order_no as evcsOrderNo,
|
||||
ho.total_price as totalPrice,
|
||||
ho.act_price as actPrice,
|
||||
ho.confirm_Result as confirmResult,
|
||||
@ -610,9 +612,9 @@
|
||||
co.source as source,
|
||||
co.Plate_num as plateNum,
|
||||
dispute_order_status as disputeOrderStatus,
|
||||
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
|
||||
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone,
|
||||
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName
|
||||
inu.phone as internetUserPhone,
|
||||
inu.name as internetName,
|
||||
apu.phone as appUserPhone
|
||||
from xhpc_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
@ -620,18 +622,44 @@
|
||||
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join et_dispute_orders as ed on ed.start_charge_seq = ho.internet_serial_number and ed.dispute_order_status !=2
|
||||
where ho.status =0 and ho.del_flag=0 and ho.total_price !=0
|
||||
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null
|
||||
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null
|
||||
where ho.status =0 and ho.del_flag=0
|
||||
<if test="type !=null">
|
||||
and ho.type=#{type}
|
||||
</if>
|
||||
<if test="source !=null">
|
||||
and co.source=#{source}
|
||||
</if>
|
||||
<if test="startTime !=null and startTime !=''">
|
||||
and ho.start_time >= #{startTime}
|
||||
<if test="plateNum !=null and plateNum !=''">
|
||||
and co.Plate_num=#{plateNum}
|
||||
</if>
|
||||
<if test="endTime !=null and endTime !=''">
|
||||
and ho.start_time <= #{endTime}
|
||||
<if test="internetId !=null">
|
||||
and inu.internet_user_id=#{internetId}
|
||||
</if>
|
||||
<if test="internetSerialNumber !=null and internetSerialNumber !=''">
|
||||
and ho.internet_serial_number like concat('%', #{internetSerialNumber}, '%')
|
||||
</if>
|
||||
<if test="terminalName !=null and terminalName !=''">
|
||||
and ter.name like concat('%', #{terminalName}, '%')
|
||||
</if>
|
||||
<if test="vinCode !=null and vinCode !=''">
|
||||
and ho.vin_normal like concat('%', #{vinCode}, '%')
|
||||
</if>
|
||||
<if test="evcsOrderNo !=null and evcsOrderNo !=''">
|
||||
and co.evcs_order_no like concat('%', #{evcsOrderNo}, '%')
|
||||
</if>
|
||||
<if test="beginStartTime !=null and beginStartTime !=''">
|
||||
and ho.start_time >= #{beginStartTime}
|
||||
</if>
|
||||
<if test="beginEndTime !=null and beginEndTime !=''">
|
||||
and ho.start_time <= #{beginEndTime}
|
||||
</if>
|
||||
<if test="overStartTime !=null and overStartTime !=''">
|
||||
and ho.end_time >= #{overStartTime}
|
||||
</if>
|
||||
<if test="overEndTime !=null and overEndTime !=''">
|
||||
and ho.end_time <= #{overEndTime}
|
||||
</if>
|
||||
<if test="transactionNumber !=null and transactionNumber !=''">
|
||||
and ho.serial_number like concat('%', #{transactionNumber}, '%')
|
||||
@ -786,6 +814,7 @@
|
||||
te.charging_pile_id as chargingPileId,
|
||||
co.user_id as userId,
|
||||
co.user_id as internetUserId,
|
||||
ho.charging_mode as chargingMode,
|
||||
ho.create_time as createTime
|
||||
from xhpc_history_order ho
|
||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||
|
||||
@ -392,21 +392,36 @@
|
||||
co.erro_remark as erroRemark,
|
||||
co.create_time as createTime,
|
||||
co.start_time as startTime,
|
||||
(select real_time_order_id from xhpc_real_time_order where co.charge_order_id= charging_order_id order by real_time_order_id desc limit 1) realTimeOrderId,
|
||||
(select soc from xhpc_real_time_order where co.charge_order_id= charging_order_id order by real_time_order_id desc limit 1) soc,
|
||||
(select charging_degree from xhpc_real_time_order where co.charge_order_id= charging_order_id order by real_time_order_id desc limit 1) chargingDegree,
|
||||
(select charging_time from xhpc_real_time_order where co.charge_order_id= charging_order_id order by real_time_order_id desc limit 1) chargingTime,
|
||||
ro.real_time_order_id as realTimeOrderId,
|
||||
ro.soc as soc,
|
||||
ro.charging_degree as chargingDegree,
|
||||
ro.charging_time as chargingTime,
|
||||
co.source as source,
|
||||
co.internet_serial_number as internetSerialNumber,
|
||||
co.Plate_num as plateNum,
|
||||
(SELECT phone FROM xhpc_app_user where app_user_id = co.user_id) as appUserPhone,
|
||||
(SELECT phone from xhpc_internet_user where internet_user_id = co.user_id) as internetUserPhone,
|
||||
(SELECT name from xhpc_internet_user where internet_user_id = co.user_id and co.source =1) as internetName
|
||||
inu.name as internetName,
|
||||
inu.phone as internetUserPhone,
|
||||
apu.phone as appUserPhone
|
||||
from xhpc_charge_order co
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = co.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_terminal as ter on ter.terminal_id = co.terminal_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
|
||||
left join xhpc_internet_user as inu on inu.internet_user_id = co.user_id and co.source =1
|
||||
left join xhpc_app_user as apu on apu.app_user_id = co.user_id and co.source =0
|
||||
left join (select charging_order_id, real_time_order_id, soc, charging_degree, charging_time from xhpc_real_time_order ro0 order by ro0.real_time_order_id desc limit 1) ro on ro.charging_order_id = co.charge_order_id
|
||||
where co.status=#{status} and co.del_flag=0
|
||||
<if test="internetId !=null">
|
||||
and co.source =1
|
||||
and inu.internet_user_id=#{internetId}
|
||||
</if>
|
||||
<if test="internetSerialNumber !=null and internetSerialNumber !=''">
|
||||
and co.source =1
|
||||
and inu.name like concat('%', #{internetSerialNumber}, '%')
|
||||
</if>
|
||||
<if test="plateNum !=null and plateNum !=''">
|
||||
and co.Plate_num like concat('%', #{plateNum}, '%')
|
||||
</if>
|
||||
<if test="source !=null">
|
||||
and co.source =#{source}
|
||||
</if>
|
||||
|
||||
@ -733,4 +733,57 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getInternetList" resultType="map">
|
||||
SELECT
|
||||
internet_user_id as id,name
|
||||
FROM
|
||||
xhpc_internet_user
|
||||
WHERE
|
||||
del_flag = 0
|
||||
<if test="userId !=null">
|
||||
and internet_user_id=#{userId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getLandUser" resultType="map">
|
||||
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
|
||||
</select>
|
||||
|
||||
<select id="getSumSourceList" resultType="map">
|
||||
select
|
||||
sum(ss.charging_degree) chargingDegree,
|
||||
sum(ss.charging_time) chargingTime,
|
||||
sum(ss.charging_number) chargingNumber,
|
||||
sum(ss.power_price) powerPrice,
|
||||
sum(ss.service_price) servicePrice,
|
||||
sum(ss.total_price) totalPrice,
|
||||
sum(ss.act_price) actPrice,
|
||||
sum(ss.act_power_price) actPowerPrice,
|
||||
sum(ss.act_service_price) actServicePrice,
|
||||
sum(ss.promotion_discount) promotionDiscount,
|
||||
sum(ss.internet_commission) internetCommission,
|
||||
sum(ss.internet_svc_commission) internetSvcCommission,
|
||||
sum(ss.platform_commission) platformCommission,
|
||||
sum(ss.platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(ss.operation_commission) operationCommission,
|
||||
sum(ss.operation_svc_commission) operationSvcCommission,
|
||||
IF(SUM(iu.name) IS NULL,ss.charging_mode, iu.name) as internetUserName,
|
||||
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station as ss
|
||||
left join xhpc_internet_user as iu on iu.internet_user_id = ss.charging_mode
|
||||
where ss.del_flag=0 and ss.type=2
|
||||
<if test="startTime !=null and startTime !=''">
|
||||
and ss.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and endTime !=''">
|
||||
and ss.create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="sourceIds !=null and sourceIds.size()>0">
|
||||
and ss.charging_mode in
|
||||
<foreach collection="sourceIds" open="(" item="sourceId" separator="," close=")" >
|
||||
#{sourceId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by ss.charging_mode
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -56,7 +56,7 @@ public class XhpcInternetUserController extends BaseController {
|
||||
sysUser.setUserType(StatusConstants.INTERNET_USER_TYPE);
|
||||
sysUser.setDataPowerType(StatusConstants.INTERNET_POWER_TYPE);
|
||||
sysUser.setCreateBy(SecurityUtils.getUsername());
|
||||
sysUser.setPassword(xhpcInternetUser.getPhone());
|
||||
sysUser.setPassword("123456");
|
||||
sysUser.setAvatar("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png");
|
||||
Long[] role = new Long[1];
|
||||
role[0] = 4L;
|
||||
@ -110,6 +110,7 @@ public class XhpcInternetUserController extends BaseController {
|
||||
sysUser.setUserName(xhpcInternetUser.getPhone());
|
||||
sysUser.setNickName(xhpcInternetUser.getName());
|
||||
sysUser.setPhonenumber(xhpcInternetUser.getPhone());
|
||||
sysUser.setUserName(xhpcInternetUser.getPhone());
|
||||
iXhpcUserService.updateUser(sysUser);
|
||||
return toAjax(iXhpcInternetUserService.update(xhpcInternetUser));
|
||||
}
|
||||
|
||||
@ -83,6 +83,7 @@ public class XhpcOperatorController extends BaseController {
|
||||
sysUser.setUserType(StatusConstants.OPERATION_USER_TYPE);
|
||||
sysUser.setDataPowerType(1);
|
||||
sysUser.setCreateBy(SecurityUtils.getUsername());
|
||||
sysUser.setAvatar("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png");
|
||||
sysUser.setPassword("123456");
|
||||
Long[] roleIds = new Long[1];
|
||||
roleIds[0] = 3L;
|
||||
@ -112,6 +113,7 @@ public class XhpcOperatorController extends BaseController {
|
||||
sysUser.setNickName(xhpcOperator.getName());
|
||||
sysUser.setEmail(xhpcOperator.getEmail());
|
||||
sysUser.setPhonenumber(xhpcOperator.getPhone());
|
||||
sysUser.setUserName(xhpcOperator.getPhone());
|
||||
iXhpcUserService.updateUser(sysUser);
|
||||
return toAjax(iXhpcOperatorService.update(xhpcOperator));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user