编辑费率,修改启动停止版本号

This commit is contained in:
yuyang 2021-09-09 11:02:28 +08:00
parent 5c9c71a4a3
commit fbfbad7708
17 changed files with 549 additions and 106 deletions

View File

@ -161,15 +161,6 @@ public class XhpcChargingStationController extends BaseController {
} }
/** /**
* 编辑电站基本信息 * 编辑电站基本信息
* *

View File

@ -17,6 +17,8 @@ import com.xhpc.common.domain.XhpcRate;
import com.xhpc.common.domain.XhpcRateModel; import com.xhpc.common.domain.XhpcRateModel;
import com.xhpc.common.domain.XhpcRateTime; import com.xhpc.common.domain.XhpcRateTime;
import com.xhpc.common.redis.service.RedisService; import com.xhpc.common.redis.service.RedisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -47,6 +49,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
private static final Logger logger = LoggerFactory.getLogger(XhpcChargingStationServiceImpl.class);
/** /**
* 查询电站 * 查询电站
* *
@ -398,7 +401,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
tfPricesSeq[number] = rateValues; tfPricesSeq[number] = rateValues;
number = number + 1; number = number + 1;
} }
} else if (k < list.size()) { } else if (k < list.size()-1) {
//判断上条数据的结束时间是否等于现在这条数据的开始时间不等于添加一条默认费率时段 //判断上条数据的结束时间是否等于现在这条数据的开始时间不等于添加一条默认费率时段
String endTimeK = list.get(k - 1).getEndTime(); String endTimeK = list.get(k - 1).getEndTime();
if (!endTimeK.equals(startTime)) { if (!endTimeK.equals(startTime)) {
@ -445,9 +448,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
} }
if (!endTime.equals("24:00:00")) { if (!endTime.equals("24:00:00")) {
//添加一条默认费率时段 //添加一条默认费率时段
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, startTime, "24:00:00", sort, 2, rateValue); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTime, "24:00:00", sort, 2, rateValue);
//时间差 //时间差
long betweenDay3 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse("24:00:00"), DateUnit.SECOND); long betweenDay3 = DateUtil.between(DateUtil.parse(endTime), DateUtil.parse("24:00:00"), DateUnit.SECOND);
int day7 = Math.toIntExact(betweenDay3 / 1800); int day7 = Math.toIntExact(betweenDay3 / 1800);
for (int l = 0; l < day7; l++) { for (int l = 0; l < day7; l++) {
tfPricesSeq[number] = rateValue; tfPricesSeq[number] = rateValue;
@ -563,6 +566,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
xhpcRateTime.setSort(sort); xhpcRateTime.setSort(sort);
xhpcRateTime.setType(type); xhpcRateTime.setType(type);
xhpcRateTime.setRateValue(rateValue); xhpcRateTime.setRateValue(rateValue);
xhpcRateTime.setCreateTime(Calendar.getInstance().getTime());
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime); xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
return sort++; return sort++;
} }
@ -814,6 +818,9 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
} }
//默认费率类型值 //默认费率类型值
String rateValue = xhpcChargingStationDto.getDefaultPeriodId(); String rateValue = xhpcChargingStationDto.getDefaultPeriodId();
String[] tfPricesSeq = new String[48];
int number = 0;
int sort = 1; int sort = 1;
for (int k = 0; k < list.size(); k++) { for (int k = 0; k < list.size(); k++) {
XhpcRateTimeDto xhpcRateTimeDto = list.get(k); XhpcRateTimeDto xhpcRateTimeDto = list.get(k);
@ -825,32 +832,146 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
if (!"00:00:00".equals(xhpcRateTimeDto.getStartTime())) { if (!"00:00:00".equals(xhpcRateTimeDto.getStartTime())) {
//添加一条默认费率时段 //添加一条默认费率时段
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, "00:00:00", startTime, sort, 2, rateValue); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, "00:00:00", startTime, sort, 2, rateValue);
//时间差
long betweenDay = DateUtil.between(DateUtil.parse("00:00:00"), DateUtil.parse(startTime), DateUnit.SECOND);
int day1 = Math.toIntExact(betweenDay / 1800);
for (int l = 0; l < day1; l++) {
logger.info("下发费率>>>>>tfPricesSeq["+number+"]"+rateValue);
tfPricesSeq[number] = rateValue;
number = number + 1;
}
} }
//并把本条数据也添加上 //并把本条数据也添加上
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues);
} else if (k < list.size()) { //时间差
long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
int day2 = Math.toIntExact(betweenDay / 1800);
for (int l = 0; l < day2; l++) {
logger.info("下发费率>>>>>tfPricesSeq["+number+"]"+rateValues);
tfPricesSeq[number] = rateValues;
number = number + 1;
}
} else if (k < list.size()-1) {
//判断上条数据的结束时间是否等于现在这条数据的开始时间不等于添加一条默认费率时段 //判断上条数据的结束时间是否等于现在这条数据的开始时间不等于添加一条默认费率时段
String endTimeK = list.get(k - 1).getEndTime(); String endTimeK = list.get(k - 1).getEndTime();
if (!endTimeK.equals(startTime)) { if (!endTimeK.equals(startTime)) {
//添加一条默认费率时段 //添加一条默认费率时段
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue);
//时间差
long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND);
int day3 = Math.toIntExact(betweenDay / 1800);
for (int l = 0; l < day3; l++) {
logger.info("下发费率>>>>>tfPricesSeq["+number+"]"+rateValue);
tfPricesSeq[number] = rateValue;
number = number + 1;
}
} }
//并把本条数据也添加上 //并把本条数据也添加上
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues);
//时间差
long betweenDay = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
int day4 = Math.toIntExact(betweenDay / 1800);
for (int l = 0; l < day4; l++) {
logger.info("下发费率>>>>>tfPricesSeq["+number+"]"+rateValues);
tfPricesSeq[number] = rateValues;
number = number + 1;
}
} else { } else {
String endTimeK = list.get(k - 1).getEndTime(); String endTimeK = list.get(k-1).getEndTime();
if (!endTimeK.equals(startTime)) { if (!endTimeK.equals(startTime)) {
//添加一条默认费率时段 //添加一条默认费率时段
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTimeK, startTime, sort, 2, rateValue);
//时间差
long betweenDay = DateUtil.between(DateUtil.parse(endTimeK), DateUtil.parse(startTime), DateUnit.SECOND);
int day5 = Math.toIntExact(betweenDay / 1800);
for (int l = 0; l < day5; l++) {
logger.info("下发费率最后1>>>>>tfPricesSeq["+number+"]"+rateValue);
tfPricesSeq[number] = rateValue;
number = number + 1;
}
} }
//并把本条数据也添加上 //并把本条数据也添加上
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodIdMap, startTime, endTime, sort, 1, rateValues);
//时间差
long betweenDay1 = DateUtil.between(DateUtil.parse(startTime), DateUtil.parse(endTime), DateUnit.SECOND);
int day6 = Math.toIntExact(betweenDay1 / 1800);
for (int l = 0; l < day6; l++) {
logger.info("下发费率最后2>>>>>tfPricesSeq["+number+"]"+rateValues);
tfPricesSeq[number] = rateValues;
number = number + 1;
}
if (!endTime.equals("24:00:00")) { if (!endTime.equals("24:00:00")) {
//添加一条默认费率时段 //添加一条默认费率时段
sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, startTime, "24:00:00", sort, 2, rateValue); sort = addXhpcRateTime(chargingStationId, rateModelId, defaultPeriodId, endTime, "24:00:00", sort, 2, rateValue);
//时间差
long betweenDay3 = DateUtil.between(DateUtil.parse(endTime), DateUtil.parse("24:00:00"), DateUnit.SECOND);
int day7 = Math.toIntExact(betweenDay3 / 1800);
for (int l = 0; l < day7; l++) {
logger.info("下发费率最后3>>>>>tfPricesSeq["+number+"]"+rateValue);
tfPricesSeq[number] = rateValue;
number = number + 1;
}
} }
} }
} }
//设置费率模型
CacheRateModel cacheRateModel = new CacheRateModel();
cacheRateModel.setLossRate(0);
BigDecimal valueSec = new BigDecimal(100000);
boolean t1 = true;
boolean t2 = true;
boolean t3 = true;
boolean t4 = true;
for (XhpcRateDto xhpcRateDto : xhpcRateList) {
BigDecimal powerFee = xhpcRateDto.getPowerFee();
BigDecimal serviceFee = xhpcRateDto.getServiceFee();
String id = xhpcRateDto.getId();
int i1 = powerFee.multiply(valueSec).intValue();
int i2 = serviceFee.multiply(valueSec).intValue();
if ("00".equals(id)) {
cacheRateModel.setT1Price(i1);
cacheRateModel.setT1SvcPrice(i2);
t1 = false;
} else if ("01".equals(id)) {
cacheRateModel.setT2Price(i1);
cacheRateModel.setT2SvcPrice(i2);
t2 = false;
} else if ("02".equals(id)) {
cacheRateModel.setT3Price(i1);
cacheRateModel.setT3SvcPrice(i2);
t3 = false;
} else if ("03".equals(id)) {
cacheRateModel.setT4Price(i1);
cacheRateModel.setT4SvcPrice(i2);
t4 = false;
}
}
if (t1) {
cacheRateModel.setT1Price(0);
cacheRateModel.setT1SvcPrice(0);
}
if (t2) {
cacheRateModel.setT2Price(0);
cacheRateModel.setT2SvcPrice(0);
}
if (t3) {
cacheRateModel.setT3Price(0);
cacheRateModel.setT3SvcPrice(0);
}
if (t4) {
cacheRateModel.setT4Price(0);
cacheRateModel.setT4SvcPrice(0);
}
cacheRateModel.setTfPricesSeq(tfPricesSeq);
logger.info("下发费率>>>>>chargingStationId"+chargingStationId);
logger.info("下发费率>>>>>rateModelId"+rateModelId);
logger.info("cacheRateModel>>>>>cacheRateModel"+cacheRateModel.toString());
R r = powerPileService.setStationRateModel(chargingStationId, rateModelId, cacheRateModel);
System.out.println(r.getCode());
System.out.println(r.getMsg());
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -170,7 +170,7 @@
<if test="businessInstructions != null">business_instructions = #{businessInstructions},</if> <if test="businessInstructions != null">business_instructions = #{businessInstructions},</if>
<if test="reminderInstructions != null">reminder_instructions = #{reminderInstructions},</if> <if test="reminderInstructions != null">reminder_instructions = #{reminderInstructions},</if>
<if test="imgId != null">img_id = #{imgId},</if> <if test="imgId != null">img_id = #{imgId},</if>
<if test="stationType != null">station_type = #{stationType},</if> <if test="stationType != null">station_type = #{stationType}</if>
</trim> </trim>
where charging_station_id = #{chargingStationId} where charging_station_id = #{chargingStationId}
</update> </update>
@ -741,7 +741,7 @@
#{rateModelId}, #{rateModelId},
</if> </if>
<if test="null != sort "> <if test="null != sort ">
sort, #{sort},
</if> </if>
<if test="null != status "> <if test="null != status ">
#{status}, #{status},

View File

@ -10,6 +10,8 @@ import com.xhpc.common.util.ConnectionRabbitMQUtil;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -35,7 +37,7 @@ public class XhpcChargeOrderController extends BaseController {
@Autowired @Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService; private IXhpcHistoryOrderService xhpcHistoryOrderService;
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderController.class);
/** /**
* 实时订单(微信) * 实时订单(微信)
*/ */
@ -68,7 +70,8 @@ public class XhpcChargeOrderController extends BaseController {
*/ */
@GetMapping("/startUp") @GetMapping("/startUp")
public AjaxResult startUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Integer type){ public AjaxResult startUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Integer type){
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
return iXhpcChargeOrderService.startUp(userId, serialNumber, type); return iXhpcChargeOrderService.startUp(userId, serialNumber, type);
} }
@ -82,7 +85,8 @@ public class XhpcChargeOrderController extends BaseController {
*/ */
@GetMapping("/stopUp") @GetMapping("/stopUp")
public AjaxResult stopUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){ public AjaxResult stopUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Long chargingOrderId){
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电>>>>>>>>>>>>>>>>>");
return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId); return iXhpcChargeOrderService.stopUp(userId, serialNumber, chargingOrderId);
} }
@ -122,6 +126,10 @@ public class XhpcChargeOrderController extends BaseController {
@GetMapping("/getOrderMessage") @GetMapping("/getOrderMessage")
public void getOrderMessage(@RequestParam Long userId) public void getOrderMessage(@RequestParam Long userId)
{ {
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>>"+userId);
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>"+userId);
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<实时数据接口>>>>>>>>>>>>>>>>>");
Map<String, Object> orderMessage = iXhpcChargeOrderService.getOrderMessage(userId); Map<String, Object> orderMessage = iXhpcChargeOrderService.getOrderMessage(userId);
Map<String,Object> map =new HashMap<>(); Map<String,Object> map =new HashMap<>();
map.put("code", 200); map.put("code", 200);
@ -140,13 +148,17 @@ public class XhpcChargeOrderController extends BaseController {
data.put("power", "0"); data.put("power", "0");
data.put("chargingDegree", decimal); data.put("chargingDegree", decimal);
data.put("remainingTime","0"); data.put("remainingTime","0");
data.put("chargingTimeNumber",0);
data.put("serialNumber","0"); data.put("serialNumber","0");
data.put("parkingInstructions","在非充电情况下占用车位按照0.30元/分钟收费"); data.put("parkingInstructions","在非充电情况下占用车位按照0.30元/分钟收费");
map.put("data", data); map.put("data", data);
}else{ }else{
map.put("data",orderMessage); map.put("data",orderMessage);
} }
JSONObject json = new JSONObject(map); JSONObject json = new JSONObject(map);
logger.info("<<<<<<<<<<再次<<<<<<<<<<<<<<json实时数据接口>>>>>>>>>>>>>>>>>"+json.toString());
rabbimt(userId + "##" + json); rabbimt(userId + "##" + json);
} }

View File

@ -5,10 +5,12 @@ import cn.hutool.core.date.DateUtil;
import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.order.domain.XhpcHistoryOrder;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval; import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import com.xhpc.order.dto.XhpcChargeHistoryOrder; import com.xhpc.order.dto.XhpcChargeHistoryOrder;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService; import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcStatisticsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -35,7 +38,7 @@ public class XhpcHistoryOrderController extends BaseController {
@Autowired @Autowired
private IXhpcHistoryOrderService xhpcHistoryOrderService; private IXhpcHistoryOrderService xhpcHistoryOrderService;
@Autowired @Autowired
private IXhpcChargeOrderService xhpcChargeOrderService; private IXhpcStatisticsService xhpcStatisticsService;
/** /**
* 历史订单 * 历史订单
@ -48,7 +51,7 @@ public class XhpcHistoryOrderController extends BaseController {
* @param startTime 订单开始时间 * @param startTime 订单开始时间
* @param endTime 订单结束时间 * @param endTime 订单结束时间
* @param userId 用户id * @param userId 用户id
* @param status 1 平台 2 运营商 3流量方 * @param status 1 平台 2 运营商 3流量方
* @return * @return
*/ */
@GetMapping("/getListPage") @GetMapping("/getListPage")
@ -85,83 +88,159 @@ public class XhpcHistoryOrderController extends BaseController {
Long userId =xhpcChargeHistoryOrder.getUserId(); Long userId =xhpcChargeHistoryOrder.getUserId();
Long operatorId =xhpcChargeHistoryOrder.getOperatorId(); Long operatorId =xhpcChargeHistoryOrder.getOperatorId();
Long chargeOrderId =xhpcChargeHistoryOrder.getChargeOrderId(); Long chargeOrderId =xhpcChargeHistoryOrder.getChargeOrderId();
Long chargingStationId = xhpcChargeHistoryOrder.getChargingStationId();
Long terminalId = xhpcChargeHistoryOrder.getTerminalId();
Date data = Calendar.getInstance().getTime();
//充电时长 //充电时长
Long chargingTimeNumber =xhpcChargeHistoryOrder.getChargingTimeNumber(); Long chargingTimeNumber =xhpcChargeHistoryOrder.getChargingTimeNumber();
//电费
BigDecimal powerPrice =new BigDecimal(0);
//服务费
BigDecimal servicePrice =new BigDecimal(0);
//订单总价
BigDecimal totalPrice =new BigDecimal(0);
//电站活动抵扣--抵扣的总金额
BigDecimal promotionDiscount =new BigDecimal(0);
//实际价格-用户支付的钱
BigDecimal actPrice =new BigDecimal(0);
//实收电费-运营商电费
BigDecimal actPowerPrice =new BigDecimal(0);
//实收服务费-运营商服务费
BigDecimal actServicePrice =new BigDecimal(0);
//流量方总金额抽成
BigDecimal internetCommission =new BigDecimal(0);
//流量方服务费抽成
BigDecimal internetSvcCommission =new BigDecimal(0);
//平台总金额抽成
BigDecimal platformCommission =new BigDecimal(0);
//平台服务费抽成
BigDecimal platformSvcCommission =new BigDecimal(0);
//运维总抽成
BigDecimal operationCommission =new BigDecimal(0);
//运维服务费抽成
BigDecimal operationSvcCommission =new BigDecimal(0);
long betweenDay = DateUtil.between(DateUtil.parse(xhpcChargeHistoryOrder.getStartTime().toString(), "yyyy-MM-dd"), DateUtil.parse(xhpcChargeHistoryOrder.getEndTime().toString(), "yyyy-MM-dd"), DateUnit.DAY); long betweenDay = DateUtil.between(DateUtil.parse(xhpcChargeHistoryOrder.getStartTime().toString(), "yyyy-MM-dd"), DateUtil.parse(xhpcChargeHistoryOrder.getEndTime().toString(), "yyyy-MM-dd"), DateUnit.DAY);
if(betweenDay==0){ if(betweenDay==0){
//没有跨天 //没有跨天
//获取费率 //获取费率
//电费
BigDecimal powerPrice =xhpcChargeHistoryOrder.getActPowerPrice();
//服务费
BigDecimal servicePrice =xhpcChargeHistoryOrder.getActServicePrice();
//订单总价
BigDecimal totalPrice =xhpcChargeHistoryOrder.getTotalPrice();
//电站活动抵扣--抵扣的总金额
BigDecimal promotionDiscount =xhpcChargeHistoryOrder.getPromotionDiscount();
//实际价格-用户支付的钱
BigDecimal actPrice =xhpcChargeHistoryOrder.getActPrice();
//实收电费-运营商电费
BigDecimal actPowerPrice =xhpcChargeHistoryOrder.getActPowerPrice();
//实收服务费-运营商服务费
BigDecimal actServicePrice =xhpcChargeHistoryOrder.getActServicePrice();
//流量方总金额抽成
BigDecimal internetCommission =xhpcChargeHistoryOrder.getInternetCommission();
//流量方服务费抽成
BigDecimal internetSvcCommission =xhpcChargeHistoryOrder.getInternetSvcCommission();
//平台总金额抽成
BigDecimal platformCommission =xhpcChargeHistoryOrder.getPlatformCommission();
//平台服务费抽成
BigDecimal platformSvcCommission =xhpcChargeHistoryOrder.getPlatformSvcCommisssion();
//运维总抽成
BigDecimal operationCommission =xhpcChargeHistoryOrder.getOperationCommission();
//运维服务费抽成
BigDecimal operationSvcCommission =xhpcChargeHistoryOrder.getOperationSvcCommission();
//每分钟都少钱
BigDecimal pp1 = powerPrice.divide(new BigDecimal(chargingTimeNumber / 60), 2, RoundingMode.HALF_UP);
BigDecimal sp1 = servicePrice.divide(new BigDecimal(chargingTimeNumber / 60), 2, RoundingMode.HALF_UP);
String startTime1 = DateUtil.formatTime(startTime); String startTime1 = DateUtil.formatTime(startTime);
String endTime1 = DateUtil.formatTime(endTime); String endTime1 = DateUtil.formatTime(endTime);
int startHour = DateUtil.hour(startTime, true); int startHour = DateUtil.hour(startTime, true);
int endHour = DateUtil.hour(endTime, true); int endHour = DateUtil.hour(endTime, true);
if(endHour==startHour){ if(endHour==startHour){
//没有跨时段 //没有跨时段
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime1, endTime1, rateModelId); XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval();
for (Map<String, Object> mapTime:reatTimeList) { xhpc.setStatus(endHour+1);
int size = reatTimeList.size(); xhpc.setChargingDegree(xhpcChargeHistoryOrder.getChargingDegree());
if(size==1){ xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP));
BigDecimal totalPrice1 = xhpcChargeHistoryOrder.getTotalPrice(); xhpc.setChargingNumber(1);
BigDecimal powerFee = new BigDecimal(reatTimeList.get(0).get("powerFee").toString()); xhpc.setPowerPrice(powerPrice);
powerPrice = powerFee.multiply(totalPrice1).setScale(2, RoundingMode.HALF_UP); xhpc.setServicePrice(servicePrice);
BigDecimal serviceFee = new BigDecimal(reatTimeList.get(0).get("serviceFee").toString()); xhpc.setTotalPrice(totalPrice);
servicePrice=serviceFee.multiply(totalPrice1).setScale(2, RoundingMode.HALF_UP); xhpc.setPromotionDiscount(promotionDiscount);
xhpc.setActPrice(actPrice);
xhpc.setActPowerPrice(actPowerPrice);
xhpc.setActServicePrice(actServicePrice);
xhpc.setInternetCommission(internetCommission);
xhpc.setInternetSvcCommission(internetSvcCommission);
xhpc.setPlatformCommission(platformCommission);
xhpc.setPlatformSvcCommisssion(platformSvcCommission);
xhpc.setOperationCommission(operationCommission);
xhpc.setOperationSvcCommission(operationSvcCommission);
xhpc.setOperatorId(chargeOrderId);
xhpc.setChargingStationId(chargingStationId);
xhpc.setCreateTime(data);
xhpc.setTerminalId(terminalId);
xhpcStatisticsService.addStatisticsTime(xhpc);
//修改历史订单表状态
XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder();
xhpcHistoryOrder.setHistoryOrderId(xhpcChargeHistoryOrder.getHistoryOrderId());
xhpcHistoryOrder.setState(1);
xhpcHistoryOrderService.update(xhpcHistoryOrder);
}else{
XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval(); //跨时段跨多少时段每个时段单独算
xhpc.setStatus(endHour+1); //每个时段折扣
xhpc.setChargingDegree(totalPrice1); BigDecimal pd = new BigDecimal(0);
xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP)); if(promotionDiscount.compareTo(pd)==1){
xhpc.setChargingNumber(1); pd = promotionDiscount.divide(new BigDecimal(endHour + 1));
xhpc.setPowerPrice(powerPrice); }
xhpc.setServicePrice(servicePrice); for (int i = startHour; i <=endHour+1 ; i++) {
xhpc.setTotalPrice(totalPrice); //获取费率
xhpc.setPromotionDiscount(promotionDiscount); if(i==startHour){
xhpc.setActPrice(actPrice); String end=i+1+":59:59";
xhpc.setActPowerPrice(actPowerPrice); long time1 = DateUtil.parse(end).getTime();
xhpc.setActServicePrice(actServicePrice); long time2 = DateUtil.parse(startTime1).getTime();
xhpc.setInternetCommission(internetCommission); BigDecimal time = new BigDecimal((time1-time2)/6000);
xhpc.setInternetSvcCommission(internetSvcCommission);
xhpc.setPlatformCommission(platformCommission);
xhpc.setPlatformSvcCommisssion(platformSvcCommission);
xhpc.setOperationCommission(operationCommission);
xhpc.setOperationSvcCommission(operationSvcCommission);
xhpc.setOperatorId(operatorId);
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(startTime1, end, rateModelId);
if(reatTimeList!=null && reatTimeList.size()>0){
if(reatTimeList.size()==1){
XhpcStatisticsTimeInterval xhpc = new XhpcStatisticsTimeInterval();
xhpc.setStatus(endHour+1);
xhpc.setChargingDegree(xhpcChargeHistoryOrder.getChargingDegree());
xhpc.setChargingTime(new BigDecimal(chargingTimeNumber/3600).setScale(2, RoundingMode.HALF_UP));
xhpc.setChargingNumber(1);
BigDecimal decimal1 = time.multiply(pp1).setScale(2, RoundingMode.HALF_UP);
BigDecimal decimal2 = time.multiply(sp1).setScale(2, RoundingMode.HALF_UP);
xhpc.setPowerPrice(decimal1);
xhpc.setServicePrice(decimal2);
xhpc.setTotalPrice(decimal1.add(decimal2));
xhpc.setPromotionDiscount(pd);
xhpc.setActPrice(decimal1.add(decimal2).subtract(pd));
powerPrice.subtract(decimal1);
servicePrice.subtract(decimal2);
xhpc.setActPowerPrice(xhpcChargeHistoryOrder.getActPowerPrice());
xhpc.setActServicePrice(xhpcChargeHistoryOrder.getActServicePrice());
xhpc.setInternetCommission(xhpcChargeHistoryOrder.getInternetCommission());
xhpc.setInternetSvcCommission(xhpcChargeHistoryOrder.getInternetSvcCommission());
xhpc.setPlatformCommission(xhpcChargeHistoryOrder.getPlatformCommission());
xhpc.setPlatformSvcCommisssion(xhpcChargeHistoryOrder.getPlatformSvcCommisssion());
xhpc.setOperationCommission(xhpcChargeHistoryOrder.getOperationCommission());
xhpc.setOperationSvcCommission(xhpcChargeHistoryOrder.getOperationSvcCommission());
xhpc.setOperatorId(xhpcChargeHistoryOrder.getOperatorId());
xhpc.setChargingStationId(xhpcChargeHistoryOrder.getChargingStationId());
xhpc.setCreateTime(data);
xhpc.setTerminalId(xhpcChargeHistoryOrder.getTerminalId());
xhpcStatisticsService.addStatisticsTime(xhpc);
//修改历史订单表状态
XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder();
xhpcHistoryOrder.setHistoryOrderId(xhpcChargeHistoryOrder.getHistoryOrderId());
xhpcHistoryOrder.setState(1);
xhpcHistoryOrderService.update(xhpcHistoryOrder);
}
}
}else{
String sta=i+":00:00";
String end=i+1+":59:59";
} }
} }
} }
} }
@ -170,16 +249,7 @@ public class XhpcHistoryOrderController extends BaseController {
} }
public static void main(String[] args) { public static void main(String[] args) {
String dateStr = "2017-03-01 22:33:23";
Date date = DateUtil.parse(dateStr);
int hour = DateUtil.hour(date, true);
String dateStr1 = "2017-03-01 02:33:23";
Date date1 = DateUtil.parse(dateStr1);
int hour1 = DateUtil.hour(date1, true);
System.out.println("hour>>>"+hour);
System.out.println("hour1>>>"+hour1);
} }
} }

View File

@ -103,6 +103,11 @@ public class XhpcChargeHistoryOrder {
*/ */
private Long chargingTimeNumber; private Long chargingTimeNumber;
/**
* 电量
*/
private BigDecimal chargingDegree;
/** /**
* 运营商id * 运营商id
*/ */
@ -338,4 +343,14 @@ public class XhpcChargeHistoryOrder {
this.rateModelId = rateModelId; this.rateModelId = rateModelId;
} }
public BigDecimal getChargingDegree() {
return chargingDegree;
}
public void setChargingDegree(BigDecimal chargingDegree) {
this.chargingDegree = chargingDegree;
}
} }

View File

@ -1,5 +1,6 @@
package com.xhpc.order.mapper; package com.xhpc.order.mapper;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -122,4 +123,10 @@ public interface XhpcStatisticsServiceMapper {
* @return * @return
*/ */
List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type); List<Map<String, Object>> getTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("userId")Long userId,@Param("type")Integer type);
/**
* 添加时段订单统计
* @param xhpcStatisticsTimeInterval
*/
void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval);
} }

View File

@ -21,6 +21,14 @@ public interface IXhpcHistoryOrderService {
*/ */
List<Map<String,Object>> list(Long userId); List<Map<String,Object>> list(Long userId);
/**
* 更新 历史订单信息
*
* @param xhpcHistoryOrder 历史订单信息
* @return 结果
*/
int update(XhpcHistoryOrder xhpcHistoryOrder);
/** /**
* 用户订单详情 * 用户订单详情
* @param userId * @param userId

View File

@ -1,6 +1,7 @@
package com.xhpc.order.service; package com.xhpc.order.service;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -128,4 +129,11 @@ public interface IXhpcStatisticsService {
* @return * @return
*/ */
AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type); AjaxResult getTerminalList(Long chargingStationId,Long userId,Integer type);
/**
* 添加时段订单统计
* @param xhpcStatisticsTimeInterval
*/
void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval);
} }

View File

@ -13,6 +13,7 @@ import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcOrderRedisRecord; import com.xhpc.order.domain.XhpcOrderRedisRecord;
import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.mapper.XhpcChargeOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService; import com.xhpc.order.service.IXhpcChargeOrderService;
import org.checkerframework.checker.units.qual.C;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -108,6 +109,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
//终端状态是否空闲 //终端状态是否空闲
//是否插枪 //是否插枪
Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + serialNumber); Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + serialNumber);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>"+serialNumber);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>"+cacheMap.toString());
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
if(cacheMap==null){ if(cacheMap==null){
return AjaxResult.error(1105, "未注册的终端,请选择其他终端充电"); return AjaxResult.error(1105, "未注册的终端,请选择其他终端充电");
}else{ }else{
@ -137,6 +143,12 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
} }
//余额 //余额
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString(); String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
//启动充电 //启动充电
StartChargingData startChargingData = new StartChargingData(); StartChargingData startChargingData = new StartChargingData();
//订单流水号 终端号+年月日时分秒+自增4位 共32位 //订单流水号 终端号+年月日时分秒+自增4位 共32位
@ -152,7 +164,12 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber()); startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14)); startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
startChargingData.setBalance(Double.valueOf(balance).intValue()); startChargingData.setBalance(Double.valueOf(balance).intValue());
startChargingData.setVersion("0A"); if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString());
}else{
startChargingData.setVersion("0A");
}
//用户平台最小的 //用户平台最小的
int number =0; int number =0;
if(!"".equals(userMessage.get("soc")) && userMessage.get("soc") !=null && !"".equals(userMessage.get("soc"))){ if(!"".equals(userMessage.get("soc")) && userMessage.get("soc") !=null && !"".equals(userMessage.get("soc"))){
@ -182,9 +199,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
if (r1.getCode() != 200) { if (r1.getCode() != 200) {
return AjaxResult.error(r1.getMsg()); return AjaxResult.error(r1.getMsg());
} }
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
//创建充电订单(充电启动soc初始值结束是获取,并修改状态) //创建充电订单(充电启动soc初始值结束是获取,并修改状态)
XhpcChargeOrder xhpcChargeOrder = new XhpcChargeOrder(); XhpcChargeOrder xhpcChargeOrder = new XhpcChargeOrder();
@ -203,7 +218,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
} else { } else {
xhpcChargeOrder.setChargingMode("小华充电支付宝"); xhpcChargeOrder.setChargingMode("小华充电支付宝");
} }
xhpcChargeOrder.setCreateTime(date); xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
xhpcChargeOrder.setType(40); xhpcChargeOrder.setType(40);
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder); xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
@ -224,7 +239,15 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) { if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
return AjaxResult.error(1104, "无效的终端编号"); return AjaxResult.error(1104, "无效的终端编号");
} }
R oa = powerPileService.stopCharging(xhpcTerminal.getPileSerialNumber(), xhpcTerminal.getSerialNumber(), "OA");
//获取桩信息
Map<String, Object> xhpcChargingPileById =
xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
String version ="0A";
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
version=xhpcChargingPileById.get("communicationProtocolVersion").toString();
}
R oa = powerPileService.stopCharging(xhpcTerminal.getPileSerialNumber(), xhpcTerminal.getSerialNumber(), version);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电返回>>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<停止充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getCode()+">>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getCode()+">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getMsg()+">>>>>>>>>>>>>>>>>"); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<"+oa.getMsg()+">>>>>>>>>>>>>>>>>");

View File

@ -35,6 +35,11 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
return xhpcHistoryOrderMapper.list(userId); return xhpcHistoryOrderMapper.list(userId);
} }
@Override
public int update(XhpcHistoryOrder xhpcHistoryOrder) {
return xhpcHistoryOrderMapper.update(xhpcHistoryOrder);
}
@Override @Override
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId,Integer type,Long chargingOrderId) { public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId,Integer type,Long chargingOrderId) {
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId)); return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId));

View File

@ -121,7 +121,11 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
BigDecimal chargingDegree = chargeOrder.getChargingDegree(); BigDecimal chargingDegree = chargeOrder.getChargingDegree();
BigDecimal powerPriceTotal =new BigDecimal(0); BigDecimal powerPriceTotal =new BigDecimal(0);
//1时间没有跨天 //1时间没有跨天
long betweenDay = DateUtil.between(DateUtil.parse(startTime2.toString(),"yyyy-MM-dd"), DateUtil.parse(updateTime2.toString(),"yyyy-MM-dd"), DateUnit.DAY); DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd");
System.out.println(parse.toString());
System.out.println(parse.toString());
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
if(betweenDay==0){ if(betweenDay==0){
powerPriceTotal = getBigDecimal(rateModelId, startTime2, updateTime2, chargingDegree, powerPriceTotal); powerPriceTotal = getBigDecimal(rateModelId, startTime2, updateTime2, chargingDegree, powerPriceTotal);
}else{ }else{
@ -499,6 +503,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
Date date = new Date(); Date date = new Date();
Long chargeOrderId = xhpcChargeOrder.getChargeOrderId(); Long chargeOrderId = xhpcChargeOrder.getChargeOrderId();
XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder(); XhpcRealTimeOrder xhpcRealTimeOrder = new XhpcRealTimeOrder();
xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId()); xhpcRealTimeOrder.setChargingOrderId(xhpcChargeOrder.getChargeOrderId());
xhpcRealTimeOrder.setTransactionNumber(orderNo); xhpcRealTimeOrder.setTransactionNumber(orderNo);
xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo()); xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo());
@ -563,7 +568,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcRealTimeOrder.setUserId(xhpcChargeOrder.getUserId()); xhpcRealTimeOrder.setUserId(xhpcChargeOrder.getUserId());
Long chargingStationId = xhpcChargeOrder.getChargingStationId(); Long chargingStationId = xhpcChargeOrder.getChargingStationId();
xhpcRealTimeOrder.setChargingStationId(chargingStationId); xhpcRealTimeOrder.setChargingStationId(chargingStationId);
xhpcRealTimeOrder.setChargingTimeNumber(cacheRealtimeData.getChargingTime());
addXhpcRealTimeOrder(xhpcRealTimeOrder); addXhpcRealTimeOrder(xhpcRealTimeOrder);
//实时数据存入MYsqlsoc电流电压 //实时数据存入MYsqlsoc电流电压
@ -592,6 +597,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
data.put("amountCharged",divide); data.put("amountCharged",divide);
data.put("gunNumber",gunId); data.put("gunNumber",gunId);
data.put("chargingOrderId",chargeOrderId); data.put("chargingOrderId",chargeOrderId);
data.put("chargingTimeNumber",cacheRealtimeData.getChargingTime());
data.put("soc",soc); data.put("soc",soc);
data.put("chargingTime",xhpcRealTimeOrder.getChargingTime()); data.put("chargingTime",xhpcRealTimeOrder.getChargingTime());
data.put("electricCurrent",c); data.put("electricCurrent",c);

View File

@ -2,6 +2,7 @@ package com.xhpc.order.service.impl;
import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
import com.xhpc.order.mapper.XhpcStatisticsServiceMapper; import com.xhpc.order.mapper.XhpcStatisticsServiceMapper;
import com.xhpc.order.service.IXhpcStatisticsService; import com.xhpc.order.service.IXhpcStatisticsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -204,6 +205,11 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, userId, type)); return AjaxResult.success(xhpcStatisticsServiceMapper.getTerminalList(chargingStationId, userId, type));
} }
@Override
public void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval) {
}
private boolean getJudge(Long internetUserId, Long operatorId, Integer type) { private boolean getJudge(Long internetUserId, Long operatorId, Integer type) {
if (type == null) { if (type == null) {

View File

@ -82,7 +82,8 @@
rto.real_time_order_id as realTimeOrderId, rto.real_time_order_id as realTimeOrderId,
rto.charging_order_id as chargingOrderId, rto.charging_order_id as chargingOrderId,
rto.voltage as voltage, rto.voltage as voltage,
rto.gun_number as seriaNumber, rto.charging_time_number as chargingTimeNumber,
concat(rto.pile_number,"",rto.gun_number)as seriaNumber,
rto.electric_current as electricCurrent, rto.electric_current as electricCurrent,
(select power from xhpc_charging_pile where charging_pile_id= (select power from xhpc_charging_pile where charging_pile_id=
(select charging_pile_id from xhpc_charging_pile where serial_number=rto.pile_number and del_flag=0 LIMIT 1))power, (select charging_pile_id from xhpc_charging_pile where serial_number=rto.pile_number and del_flag=0 LIMIT 1))power,
@ -188,7 +189,10 @@
amount_charged, amount_charged,
</if> </if>
<if test="null != power "> <if test="null != power ">
power power,
</if>
<if test="null != createTime ">
create_time
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -250,7 +254,10 @@
#{amountCharged}, #{amountCharged},
</if> </if>
<if test="null != power "> <if test="null != power ">
#{power} #{power},
</if>
<if test="null != createTime ">
#{createTime}
</if> </if>
</trim> </trim>
</insert> </insert>
@ -332,6 +339,7 @@
<select id="getXhpcChargingPileById" resultType="map"> <select id="getXhpcChargingPileById" resultType="map">
select select
charging_pile_id as chargingPileId, charging_pile_id as chargingPileId,
communication_protocol_version as communicationProtocolVersion,
power as power power as power
from xhpc_charging_pile where charging_pile_id=#{chargingPileid} from xhpc_charging_pile where charging_pile_id=#{chargingPileid}
</select> </select>

View File

@ -274,9 +274,7 @@
</if> </if>
<if test="null != startSoc and '' != startSoc">start_soc = #{startSoc},</if> <if test="null != startSoc and '' != startSoc">start_soc = #{startSoc},</if>
<if test="null != endSoc and '' != endSoc">end_soc = #{endSoc},</if> <if test="null != endSoc and '' != endSoc">end_soc = #{endSoc},</if>
<if test="null != reconciliationStatus ">reconciliation_status = <if test="null != reconciliationStatus ">reconciliation_status =#{reconciliationStatus},</if>
#{reconciliationStatus},
</if>
<if test="null != sortingStatus ">sorting_status = #{sortingStatus},</if> <if test="null != sortingStatus ">sorting_status = #{sortingStatus},</if>
<if test="null != type">type = #{type},</if> <if test="null != type">type = #{type},</if>
<if test="null != status">status = #{status},</if> <if test="null != status">status = #{status},</if>
@ -286,8 +284,9 @@
<if test="null != updateTime">update_time = #{updateTime},</if> <if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark},</if> <if test="null != remark and '' != remark">remark = #{remark},</if>
<if test="null != powerPriceTotal and '' != remark">power_price_total = #{powerPriceTotal},</if> <if test="null != state and '' != state">state = #{state},</if>
<if test="null != servicePriceTotal and '' != remark">service_price_total = #{servicePriceTotal}</if> <if test="null != powerPriceTotal and '' != powerPriceTotal">power_price_total = #{powerPriceTotal},</if>
<if test="null != servicePriceTotal and '' != servicePriceTotal">service_price_total = #{servicePriceTotal}</if>
</set> </set>
WHERE history_order_id = #{historyOrderId} WHERE history_order_id = #{historyOrderId}
</update> </update>

View File

@ -246,7 +246,7 @@
and ss.create_time &lt;=#{endTime} and ss.create_time &lt;=#{endTime}
</if> </if>
<if test="internetIds !=null and internetIds.size()>0"> <if test="internetIds !=null and internetIds.size()>0">
and ss.internet_user_id and ss.internet_user_id in
<foreach collection="internetIds" open="(" item="internetId" separator="," close=")" > <foreach collection="internetIds" open="(" item="internetId" separator="," close=")" >
#{internetId} #{internetId}
</foreach> </foreach>
@ -339,4 +339,167 @@
and charging_station_id =#{chargingStationId} and charging_station_id =#{chargingStationId}
</if> </if>
</select> </select>
<insert id="addStatisticsTime">
insert into xhpc_statistics_time_interval
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != status ">
status,
</if>
<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 != remainingTime ">
remaining_time,
</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 != 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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != status ">
#{status},
</if>
<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 != remainingTime ">
#{remainingTime},
</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 != 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 != chargingTimeNumber ">
#{chargingTimeNumber}
</if>
</trim>
</insert>
</mapper> </mapper>

View File

@ -104,6 +104,7 @@ public class OrderNotificationWebSocket {
data.put("amountCharged",decimal); data.put("amountCharged",decimal);
data.put("gunNumber","0"); data.put("gunNumber","0");
data.put("chargingOrderId",0L); data.put("chargingOrderId",0L);
data.put("chargingTimeNumber",0);
data.put("soc",0); data.put("soc",0);
data.put("chargingTime","0"); data.put("chargingTime","0");
data.put("electricCurrent",decimal); data.put("electricCurrent",decimal);