修改小时统计金额异常问题
This commit is contained in:
parent
b1c6171bea
commit
0f11b04fe1
@ -1114,7 +1114,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
@Override
|
@Override
|
||||||
public Integer getTerminalStatus(String serialNumber) {
|
public Integer getTerminalStatus(String serialNumber) {
|
||||||
|
|
||||||
Integer status =0;
|
Integer status =5;
|
||||||
//终端状态用 redis数据
|
//终端状态用 redis数据
|
||||||
if(!"".equals(serialNumber) && serialNumber!=null){
|
if(!"".equals(serialNumber) && serialNumber!=null){
|
||||||
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+serialNumber);
|
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+serialNumber);
|
||||||
@ -1133,11 +1133,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
//充电桩
|
//充电桩
|
||||||
status = 3;
|
status = 3;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
status = 5;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
status = 5;
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,10 +169,12 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
}else{
|
}else{
|
||||||
//修改订单,判断订单
|
//修改订单,判断订单
|
||||||
}
|
}
|
||||||
|
if(xhpcChargeOrder.getSource()==0){
|
||||||
map.put("code", code);
|
map.put("code", code);
|
||||||
JSONObject json = new JSONObject(map);
|
JSONObject json = new JSONObject(map);
|
||||||
//消息对了内容
|
//消息对了内容
|
||||||
webSocketService.getMessage(userId+"",json.toString());
|
webSocketService.getMessage(userId+"",json.toString());
|
||||||
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,6 +192,7 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + orderNo + ".lord");
|
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + orderNo + ".lord");
|
||||||
|
|
||||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||||
|
if(xhpcChargeOrder.getSource()==0){
|
||||||
Long userId = xhpcChargeOrder.getUserId();
|
Long userId = xhpcChargeOrder.getUserId();
|
||||||
try {
|
try {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
@ -210,6 +213,7 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
webSocketService.getMessage(userId+"",json.toString());
|
webSocketService.getMessage(userId+"",json.toString());
|
||||||
return R.fail(500,"无实时数据");
|
return R.fail(500,"无实时数据");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +349,9 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcHistoryOrder.setTotalPower(totalPower.doubleValue()/10000);
|
xhpcHistoryOrder.setTotalPower(totalPower.doubleValue()/10000);
|
||||||
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue());
|
||||||
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue());
|
||||||
Map<String, Object> userMessage = xhpcChargeOrderService.getUserMessage(userId);
|
Map<String, Object> userMessage =new HashMap<>();
|
||||||
|
if(xhpcChargeOrder.getSource()==1 && xhpcChargeOrder.getInternetSerialNumber() !=null){
|
||||||
|
userMessage = xhpcChargeOrderService.getUserMessage(userId);
|
||||||
if (userMessage == null || userMessage.get("balance") == null) {
|
if (userMessage == null || userMessage.get("balance") == null) {
|
||||||
//订单异常
|
//订单异常
|
||||||
xhpcChargeOrder.setStatus(2);
|
xhpcChargeOrder.setStatus(2);
|
||||||
@ -354,6 +360,8 @@ public class XhpcPileOrderController extends BaseController {
|
|||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
R.ok();
|
R.ok();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//结算
|
//结算
|
||||||
xhpcRealTimeOrderService.addSettlement(powerPrice,servicePrice,money,surplusPowerPrice,surplusServicePrice,xhpcChargeOrder,userId,userMessage,1,cacheOrderData.getVinNormal(),xhpcHistoryOrder);
|
xhpcRealTimeOrderService.addSettlement(powerPrice,servicePrice,money,surplusPowerPrice,surplusServicePrice,xhpcChargeOrder,userId,userMessage,1,cacheOrderData.getVinNormal(),xhpcHistoryOrder);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|||||||
@ -87,16 +87,22 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
* 终端统计
|
* 终端统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test3")
|
@GetMapping("/test3")
|
||||||
@Scheduled(cron = "0 0 12 * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
public void test3(){
|
public void test3(){
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
add(1000,3);
|
add(1000,3);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 场站统计
|
* 场站统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test2")
|
@GetMapping("/test2")
|
||||||
@Scheduled(cron = "0 0 11 * * ?")
|
@Scheduled(cron = "0 0/30 * * * ?")
|
||||||
public void test2(){
|
public void test2(){
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
add(1000,2);
|
add(1000,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,8 +110,11 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
* 日期统计
|
* 日期统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test1")
|
@GetMapping("/test1")
|
||||||
@Scheduled(cron = "0 0 00 * * ?")
|
@Scheduled(cron = "0 0/20 * * * ?")
|
||||||
public void test1(){
|
public void test1(){
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
//获取500条待统计历史订单
|
//获取500条待统计历史订单
|
||||||
//跨时段,跨费率,计费模型
|
//跨时段,跨费率,计费模型
|
||||||
//日期统计
|
//日期统计
|
||||||
@ -188,7 +197,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
* 小时统计
|
* 小时统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
@Scheduled(cron = "0 */1 * * * ?")
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void test(){
|
public void test(){
|
||||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
|||||||
@ -117,7 +117,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
@Override
|
@Override
|
||||||
public void addXhpcChargeOrder(String orderNo,Integer type) {
|
public void addXhpcChargeOrder(String orderNo,Integer type) {
|
||||||
//(调用时间-启动时间《3分钟 自动结算)
|
//(调用时间-启动时间《3分钟 自动结算)
|
||||||
logger.info("订单异常回调接口>>>>>orderNo:" + orderNo);
|
logger.info("订单异常回调接口>>>>>orderNo:" + orderNo+" type:"+type);
|
||||||
//获取实时订单
|
//获取实时订单
|
||||||
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + orderNo + ".lord");
|
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + orderNo + ".lord");
|
||||||
if(cacheRealtimeData !=null){
|
if(cacheRealtimeData !=null){
|
||||||
|
|||||||
@ -210,7 +210,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
|
xhpcHistoryOrder.setPowerPriceTotal(powerPrice);
|
||||||
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
|
xhpcHistoryOrder.setServicePriceTotal(servicePrice);
|
||||||
xhpcHistoryOrder.setVinNormal(vinNormal);
|
xhpcHistoryOrder.setVinNormal(vinNormal);
|
||||||
BigDecimal balance = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(100));
|
|
||||||
//电站活动抵扣--抵扣的总金额
|
//电站活动抵扣--抵扣的总金额
|
||||||
BigDecimal promotionDiscount = new BigDecimal(0);
|
BigDecimal promotionDiscount = new BigDecimal(0);
|
||||||
//实际价格-用户支付的钱
|
//实际价格-用户支付的钱
|
||||||
@ -252,6 +252,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( source== 0) {
|
if ( source== 0) {
|
||||||
|
BigDecimal balance = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(100));
|
||||||
String state = "";
|
String state = "";
|
||||||
BigDecimal discount = new BigDecimal(0);
|
BigDecimal discount = new BigDecimal(0);
|
||||||
//用户第几次充电
|
//用户第几次充电
|
||||||
@ -385,6 +386,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
xhpcHistoryOrder.setPhone(userMessage.get("phone").toString());
|
||||||
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower()));
|
||||||
|
|
||||||
|
if(source==0){
|
||||||
//扣除用户实际消费金额,添加消费记录
|
//扣除用户实际消费金额,添加消费记录
|
||||||
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
|
Map<String, Object> user = xhpcChargeOrderService.getUserMessage(userId);
|
||||||
//剩余的钱
|
//剩余的钱
|
||||||
@ -395,9 +397,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
//扣钱失败
|
//扣钱失败
|
||||||
xhpcChargeOrder.setStatus(2);
|
xhpcChargeOrder.setStatus(2);
|
||||||
xhpcChargeOrder.setErroRemark("扣钱失败");
|
xhpcChargeOrder.setErroRemark("扣钱失败");
|
||||||
}else{
|
}
|
||||||
xhpcHistoryOrderService.insert(xhpcHistoryOrder);
|
|
||||||
|
|
||||||
//添加流水
|
//添加流水
|
||||||
xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date);
|
xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date);
|
||||||
try{
|
try{
|
||||||
@ -425,13 +425,15 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
|
|||||||
logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>");
|
logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>");
|
||||||
}
|
}
|
||||||
// 另起线程处理业务上传redis数据
|
// 另起线程处理业务上传redis数据
|
||||||
// executorService.execute(new Runnable() {
|
executorService.execute(new Runnable() {
|
||||||
// @Override
|
@Override
|
||||||
// public void run() {
|
public void run() {
|
||||||
// addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
|
addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
xhpcHistoryOrderService.insert(xhpcHistoryOrder);
|
||||||
|
|
||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -610,7 +610,7 @@
|
|||||||
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
|
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 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
|
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
|
where ho.status =0 and ho.del_flag=0 and ho.total_price !=null
|
||||||
<if test="type !=null">
|
<if test="type !=null">
|
||||||
and ho.type=#{type}
|
and ho.type=#{type}
|
||||||
</if>
|
</if>
|
||||||
@ -670,8 +670,8 @@
|
|||||||
from xhpc_rate_time as rt
|
from xhpc_rate_time as rt
|
||||||
left join xhpc_rate ra on rt.rate_id =ra.rate_id
|
left join xhpc_rate ra on rt.rate_id =ra.rate_id
|
||||||
where rt.rate_model_id=#{rateModelId}
|
where rt.rate_model_id=#{rateModelId}
|
||||||
and ((rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{startTime})
|
and ((rt.start_time < #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') > #{startTime})
|
||||||
or (rt.start_time <= #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime}))
|
or (rt.start_time < #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') > #{endTime}))
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getById" resultType="map">
|
<select id="getById" resultType="map">
|
||||||
@ -772,7 +772,7 @@
|
|||||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||||
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
||||||
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
where ho.state = #{state} and ho.total_price >0 and ho.end_time > ho.start_time
|
where ho.state = #{state} and ho.total_price >0 and ho.end_time > ho.start_time and ho.vin_normal !="2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2D" and ho.power_price_total !=0
|
||||||
limit 0,#{number}
|
limit 0,#{number}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@ -16,10 +16,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 172.31.183.135:8848
|
server-addr: 127.0.0.1:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 172.31.183.135:8848
|
server-addr: 127.0.0.1:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user