修改桩订单结束回调问题
This commit is contained in:
parent
8c33942c04
commit
559ef3caba
@ -564,8 +564,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
|||||||
xhpcRateTime.setType(type);
|
xhpcRateTime.setType(type);
|
||||||
xhpcRateTime.setRateValue(rateValue);
|
xhpcRateTime.setRateValue(rateValue);
|
||||||
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
xhpcChargingStationMapper.addXhpcRateTime(xhpcRateTime);
|
||||||
sort = sort + 1;
|
return sort++;
|
||||||
return sort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -621,7 +621,10 @@
|
|||||||
remark,
|
remark,
|
||||||
</if>
|
</if>
|
||||||
<if test="null != rateValue">
|
<if test="null != rateValue">
|
||||||
rate_value
|
rate_value,
|
||||||
|
</if>
|
||||||
|
<if test="null != rateModelId">
|
||||||
|
rate_model_id
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -659,8 +662,12 @@
|
|||||||
#{remark},
|
#{remark},
|
||||||
</if>
|
</if>
|
||||||
<if test="null != rateValue">
|
<if test="null != rateValue">
|
||||||
#{rateValue}
|
#{rateValue},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="null != rateModelId">
|
||||||
|
#{rateModelId}
|
||||||
|
</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@ -141,11 +141,10 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService{
|
|||||||
}else {
|
}else {
|
||||||
xhpcSms.setStatus(1);
|
xhpcSms.setStatus(1);
|
||||||
}
|
}
|
||||||
xhpcSmsMapper.addXhpcSms(xhpcSms);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
xhpcSms.setStatus(3);
|
xhpcSms.setStatus(3);
|
||||||
xhpcSmsMapper.addXhpcSms(xhpcSms);
|
|
||||||
}
|
}
|
||||||
|
xhpcSmsMapper.addXhpcSms(xhpcSms);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.rabbitmq.client.Channel;
|
import com.rabbitmq.client.Channel;
|
||||||
import com.rabbitmq.client.Connection;
|
import com.rabbitmq.client.Connection;
|
||||||
|
import com.xhpc.common.api.SmsService;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.data.redis.CacheOrderData;
|
import com.xhpc.common.data.redis.CacheOrderData;
|
||||||
@ -45,6 +46,9 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
private IXhpcRealTimeOrderService xhpcRealTimeOrderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SmsService smsService;
|
||||||
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HxpcPileOrderController.class);
|
private static final Logger logger = LoggerFactory.getLogger(HxpcPileOrderController.class);
|
||||||
/**
|
/**
|
||||||
@ -186,13 +190,14 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
//解析订单编号
|
//解析订单编号
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
//总金额
|
//总金额
|
||||||
BigDecimal money = new BigDecimal((cacheOrderData.getCost()/10000));
|
BigDecimal bigDecimal = new BigDecimal(10000);
|
||||||
|
BigDecimal money = new BigDecimal(cacheOrderData.getCost()).divide(bigDecimal);
|
||||||
int sumCost =cacheOrderData.getT1Cost()+cacheOrderData.getT2Cost()+cacheOrderData.getT3Cost()+cacheOrderData.getT4Cost();
|
int sumCost =cacheOrderData.getT1Cost()+cacheOrderData.getT2Cost()+cacheOrderData.getT3Cost()+cacheOrderData.getT4Cost();
|
||||||
int sumService = cacheOrderData.getCost()-sumCost;
|
int sumService = cacheOrderData.getCost()-sumCost;
|
||||||
//总电费
|
//总电费
|
||||||
BigDecimal powerPrice = new BigDecimal((sumCost/10000));
|
BigDecimal powerPrice = new BigDecimal(sumCost).divide(bigDecimal);
|
||||||
//总服务费
|
//总服务费
|
||||||
BigDecimal servicePrice = new BigDecimal((sumService/10000));
|
BigDecimal servicePrice = new BigDecimal(sumService).divide(bigDecimal);
|
||||||
//剩余的电费
|
//剩余的电费
|
||||||
BigDecimal surplusPowerPrice = powerPrice;
|
BigDecimal surplusPowerPrice = powerPrice;
|
||||||
//剩余的服务费
|
//剩余的服务费
|
||||||
@ -212,17 +217,18 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
hxpcChargeOrder.setEndTime(endTime);
|
hxpcChargeOrder.setEndTime(endTime);
|
||||||
|
|
||||||
//充电时长
|
//充电时长
|
||||||
Long tiem = endTime.getTime()-startTime.getTime();
|
Long tiem = (endTime.getTime()-startTime.getTime())%1000;
|
||||||
|
|
||||||
if(tiem>60000){
|
if(tiem>60){
|
||||||
long mins = tiem % 60000;
|
long mins = tiem % 60;
|
||||||
long hours = tiem / 60000;
|
long hours = tiem / 60;
|
||||||
hxpcChargeOrder.setChargingTime(hours+"时"+mins+"分");
|
hxpcChargeOrder.setChargingTime(hours+"时"+mins+"分");
|
||||||
}else{
|
}else{
|
||||||
long mins = tiem % 60000;
|
long mins = tiem % 60;
|
||||||
hxpcChargeOrder.setChargingTime(mins+"分");
|
hxpcChargeOrder.setChargingTime(mins+"分");
|
||||||
}
|
}
|
||||||
hxpcChargeOrder.setChargingDegree(cacheOrderData.getTotalPowerQuantity().toString());
|
BigDecimal divide = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal);
|
||||||
|
hxpcChargeOrder.setChargingDegree(divide.toString());
|
||||||
hxpcChargeOrder.setAmountCharged(money.toString());
|
hxpcChargeOrder.setAmountCharged(money.toString());
|
||||||
String stopReason = cacheOrderData.getStopReason();
|
String stopReason = cacheOrderData.getStopReason();
|
||||||
hxpcChargeOrder.setErroRemark(stopReason);
|
hxpcChargeOrder.setErroRemark(stopReason);
|
||||||
@ -381,9 +387,34 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
xhpcHistoryOrder.setReconciliationStatus(0);
|
xhpcHistoryOrder.setReconciliationStatus(0);
|
||||||
xhpcHistoryOrder.setCreateTime(date);
|
xhpcHistoryOrder.setCreateTime(date);
|
||||||
|
|
||||||
xhpcHistoryOrderService.insert(xhpcHistoryOrder);
|
|
||||||
|
//扣除用户实际消费金额,添加消费记录
|
||||||
|
Map<String, Object> user = hxpcChargeOrderService.getUserMessage(userId);
|
||||||
|
//剩余的钱
|
||||||
|
BigDecimal balance1 =(BigDecimal) user.get("balance");
|
||||||
|
BigDecimal subtract = balance1.subtract(actPrice);
|
||||||
|
int i = hxpcChargeOrderService.updateUserBalance(userId, subtract);
|
||||||
|
if(i==0){
|
||||||
|
//扣钱失败
|
||||||
|
xhpcHistoryOrder.setStatus(2);
|
||||||
|
xhpcHistoryOrder.setRemark("扣钱失败");
|
||||||
|
}else{
|
||||||
|
xhpcHistoryOrderService.insert(xhpcHistoryOrder);
|
||||||
|
addPileEndOrder(xhpcHistoryOrder,hxpcChargeOrder,cacheMap,orderNo);
|
||||||
|
//添加流水
|
||||||
|
hxpcChargeOrderService.addUserAccountStatement(userId,actPrice.negate(),subtract,hxpcChargeOrder.getChargeOrderId(),3,date);
|
||||||
|
try{
|
||||||
|
//发送短信
|
||||||
|
if(user.get("phone") !=null){
|
||||||
|
String content="【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:"+hxpcChargeOrder.getChargingDegree()+",总费用为:"+actPrice+"元,充电费用明细,请查询小华充电小程序,谢谢。";
|
||||||
|
smsService.sendNotice(user.get("phone").toString(),content);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
|
hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder);
|
||||||
addPileEndOrder(xhpcHistoryOrder,hxpcChargeOrder,cacheMap,orderNo);
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("code", 500);
|
map.put("code", 500);
|
||||||
map.put("userId", userId);
|
map.put("userId", userId);
|
||||||
@ -442,6 +473,12 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
if(cacheMap.get("rateModelId") !=null){
|
if(cacheMap.get("rateModelId") !=null){
|
||||||
xhpcOrderRedisRecord.setRateModelId(cacheMap.get("rateModelId").toString());
|
xhpcOrderRedisRecord.setRateModelId(cacheMap.get("rateModelId").toString());
|
||||||
}
|
}
|
||||||
|
if(cacheMap.get("lt5alerted") !=null){
|
||||||
|
xhpcOrderRedisRecord.setLt5alerted(cacheMap.get("lt5alerted").toString());
|
||||||
|
}
|
||||||
|
if(cacheMap.get("orderData") !=null){
|
||||||
|
xhpcOrderRedisRecord.setOrderData(cacheMap.get("orderData").toString());
|
||||||
|
}
|
||||||
xhpcOrderRedisRecord.setCreateTime(date);
|
xhpcOrderRedisRecord.setCreateTime(date);
|
||||||
hxpcChargeOrderService.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
hxpcChargeOrderService.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
||||||
|
|
||||||
@ -512,7 +549,8 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
BigDecimal chargingDegree = new BigDecimal(cacheRealtimeData.getChargingDegree()).divide(decimal);
|
BigDecimal chargingDegree = new BigDecimal(cacheRealtimeData.getChargingDegree()).divide(decimal);
|
||||||
xhpcRealTimeOrder.setChargingDegree(chargingDegree);
|
xhpcRealTimeOrder.setChargingDegree(chargingDegree);
|
||||||
xhpcRealTimeOrder.setLossChargingDegree(divide);
|
xhpcRealTimeOrder.setLossChargingDegree(divide);
|
||||||
xhpcRealTimeOrder.setAmountCharged(divide);
|
BigDecimal amountCharged = new BigDecimal(cacheRealtimeData.getAmountCharged()).divide(decimal);
|
||||||
|
xhpcRealTimeOrder.setAmountCharged(amountCharged);
|
||||||
xhpcRealTimeOrder.setHardwareFault(cacheRealtimeData.getHardwareFault());
|
xhpcRealTimeOrder.setHardwareFault(cacheRealtimeData.getHardwareFault());
|
||||||
if("00".equals(cacheRealtimeData.getStatus())){
|
if("00".equals(cacheRealtimeData.getStatus())){
|
||||||
xhpcRealTimeOrder.setStatus(0);
|
xhpcRealTimeOrder.setStatus(0);
|
||||||
@ -623,18 +661,26 @@ public class HxpcPileOrderController extends BaseController {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
long time = DateUtil.parse("2021-08-18 12:12:12").getTime();
|
// long time = DateUtil.parse("2021-08-18 12:12:12").getTime();
|
||||||
|
//
|
||||||
|
// long time1 = DateUtil.parse("2021-08-19 12:12:12").getTime();
|
||||||
|
// String orderNo="order:69852145896547022108191121220010";
|
||||||
|
// //解析订单编号
|
||||||
|
// String s = orderNo.split("\\.")[0];
|
||||||
|
// String s1 = s.split(":")[1];
|
||||||
|
// String s2 = orderNo.substring(6);
|
||||||
|
//
|
||||||
|
// String s3 = s2.substring(0,16);
|
||||||
|
// System.out.println(s);
|
||||||
|
// System.out.println("<<<<"+s2);
|
||||||
|
// System.out.println("<<<<"+s3);
|
||||||
|
|
||||||
long time1 = DateUtil.parse("2021-08-19 12:12:12").getTime();
|
int cacheRealtimeData =3000;
|
||||||
String orderNo="order:69852145896547022108191121220010";
|
int mins = cacheRealtimeData % 60;
|
||||||
//解析订单编号
|
int hours = cacheRealtimeData / 60;
|
||||||
String s = orderNo.split("\\.")[0];
|
|
||||||
String s1 = s.split(":")[1];
|
System.out.println("<<<<"+mins);
|
||||||
String s2 = orderNo.substring(6);
|
System.out.println("<<<<"+hours);
|
||||||
|
|
||||||
String s3 = s2.substring(0,16);
|
|
||||||
System.out.println(s);
|
|
||||||
System.out.println("<<<<"+s2);
|
|
||||||
System.out.println("<<<<"+s3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class XhpcOrderRedisRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String startResult;
|
private String startResult;
|
||||||
/**
|
/**
|
||||||
* 实时数据
|
* 实时数据集合
|
||||||
*/
|
*/
|
||||||
private String realtimeDataList;
|
private String realtimeDataList;
|
||||||
/**
|
/**
|
||||||
@ -60,6 +60,16 @@ public class XhpcOrderRedisRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String lt5alerted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时数据
|
||||||
|
*/
|
||||||
|
private String orderData;
|
||||||
|
|
||||||
public Long getOrderRedisRecordId() {
|
public Long getOrderRedisRecordId() {
|
||||||
|
|
||||||
return orderRedisRecordId;
|
return orderRedisRecordId;
|
||||||
@ -190,4 +200,24 @@ public class XhpcOrderRedisRecord extends BaseEntity {
|
|||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLt5alerted() {
|
||||||
|
|
||||||
|
return lt5alerted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLt5alerted(String lt5alerted) {
|
||||||
|
|
||||||
|
this.lt5alerted = lt5alerted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderData() {
|
||||||
|
|
||||||
|
return orderData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderData(String orderData) {
|
||||||
|
|
||||||
|
this.orderData = orderData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import com.xhpc.order.domain.HxpcChargeOrder;
|
|||||||
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -39,6 +41,13 @@ public interface HxpcChargeOrderMapper {
|
|||||||
*/
|
*/
|
||||||
Map<String,Object> getUserMessage(@Param("userId")Long userId);
|
Map<String,Object> getUserMessage(@Param("userId")Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改余额
|
||||||
|
* @param userId
|
||||||
|
* @param balance
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateUserBalance(@Param("userId")Long userId, @Param("balance")BigDecimal balance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断用户是否在充电中
|
* 判断用户是否在充电中
|
||||||
@ -111,4 +120,17 @@ public interface HxpcChargeOrderMapper {
|
|||||||
*/
|
*/
|
||||||
void addXhpcOrderRedisRecord(XhpcOrderRedisRecord xhpcOrderRedisRecord);
|
void addXhpcOrderRedisRecord(XhpcOrderRedisRecord xhpcOrderRedisRecord);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加流水
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param amount 流水金额
|
||||||
|
* @param remainingSum 余额
|
||||||
|
* @param chargeOrderId 充电订单id
|
||||||
|
* @param type 类型(1充值 2退款 3充电)
|
||||||
|
* @param date 时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int addUserAccountStatement(@Param("userId") Long userId,@Param("amount") BigDecimal amount,@Param("remainingSum") BigDecimal remainingSum,@Param("chargeOrderId") Long chargeOrderId,@Param("type") Integer type,@Param("date") Date date);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,11 +100,11 @@ public interface XhpcRealTimeOrderMapper {
|
|||||||
/**
|
/**
|
||||||
* 删除之前的实时订单数据
|
* 删除之前的实时订单数据
|
||||||
*/
|
*/
|
||||||
void deleteRealTimeOrder(@Param("chargingStationId")Long chargingOrderId);
|
void deleteRealTimeOrder(@Param("chargingOrderId")Long chargingOrderId);
|
||||||
|
|
||||||
void deleteChargeVoltage(@Param("chargingStationId")Long chargingOrderId);
|
void deleteChargeVoltage(@Param("chargingOrderId")Long chargingOrderId);
|
||||||
|
|
||||||
void deleteChargeOrderSoc(@Param("chargingStationId")Long chargingOrderId);
|
void deleteChargeOrderSoc(@Param("chargingOrderId")Long chargingOrderId);
|
||||||
|
|
||||||
void deleteChargeOrderCurrent(@Param("chargingStationId")Long chargingOrderId);
|
void deleteChargeOrderCurrent(@Param("chargingOrderId")Long chargingOrderId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import com.xhpc.order.domain.HxpcChargeOrder;
|
|||||||
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -82,6 +84,14 @@ public interface IHxpcChargeOrderService {
|
|||||||
*/
|
*/
|
||||||
Map<String,Object> getUserMessage(Long userId);
|
Map<String,Object> getUserMessage(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改余额
|
||||||
|
* @param userId
|
||||||
|
* @param balance
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateUserBalance(Long userId, BigDecimal balance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取运营商信息
|
* 获取运营商信息
|
||||||
* @param chargingStationId
|
* @param chargingStationId
|
||||||
@ -95,4 +105,15 @@ public interface IHxpcChargeOrderService {
|
|||||||
*/
|
*/
|
||||||
void addXhpcOrderRedisRecord(XhpcOrderRedisRecord xhpcOrderRedisRecord);
|
void addXhpcOrderRedisRecord(XhpcOrderRedisRecord xhpcOrderRedisRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加流水
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param amount 流水金额
|
||||||
|
* @param remainingSum 余额
|
||||||
|
* @param chargeOrderId 充电订单id
|
||||||
|
* @param type 类型(1充值 2退款 3充电)
|
||||||
|
* @param date 时间
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId, Integer type, Date date);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -229,6 +229,11 @@ public class HxpcChargeOrderServiceImpl implements IHxpcChargeOrderService {
|
|||||||
return hxpcChargeOrderMapper.getUserMessage(userId);
|
return hxpcChargeOrderMapper.getUserMessage(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateUserBalance(Long userId, BigDecimal balance) {
|
||||||
|
return hxpcChargeOrderMapper.updateUserBalance(userId,balance);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getOperatorMessage(Long chargingStationId) {
|
public Map<String, Object> getOperatorMessage(Long chargingStationId) {
|
||||||
return hxpcChargeOrderMapper.getOperatorMessage(chargingStationId);
|
return hxpcChargeOrderMapper.getOperatorMessage(chargingStationId);
|
||||||
@ -239,5 +244,10 @@ public class HxpcChargeOrderServiceImpl implements IHxpcChargeOrderService {
|
|||||||
hxpcChargeOrderMapper.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
hxpcChargeOrderMapper.addXhpcOrderRedisRecord(xhpcOrderRedisRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId, Integer type, Date date) {
|
||||||
|
return hxpcChargeOrderMapper.addUserAccountStatement(userId, amount, remainingSum, chargeOrderId, type, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
package com.xhpc.order.service.impl;
|
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.HxpcChargeOrder;
|
||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
|
import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
|
||||||
|
import com.xhpc.order.service.IHxpcChargeOrderService;
|
||||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -21,6 +24,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IHxpcChargeOrderService xhpcChargeOrderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> list(Long userId) {
|
public List<Map<String, Object>> list(Long userId) {
|
||||||
return xhpcHistoryOrderMapper.list(userId);
|
return xhpcHistoryOrderMapper.list(userId);
|
||||||
@ -49,5 +56,28 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
return xhpcHistoryOrderMapper.getListPage(phone,transactionNumber,status,chargingStationName,operatorId,source,startTime,endTime,userId,type,number);
|
return xhpcHistoryOrderMapper.getListPage(phone,transactionNumber,status,chargingStationName,operatorId,source,startTime,endTime,userId,type,number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史信息费率时段
|
||||||
|
*/
|
||||||
|
private void getRateTime(){
|
||||||
|
String serialNumber="";
|
||||||
|
//充电订单信息
|
||||||
|
HxpcChargeOrder chargeOrder = xhpcChargeOrderService.getSerialNumberMessage(serialNumber);
|
||||||
|
|
||||||
|
//累计充电时间、计费模型、开始时间、结束时间、已充金额
|
||||||
|
int i = Integer.valueOf(chargeOrder.getChargingTime()).intValue();
|
||||||
|
Long rateModelId = chargeOrder.getRateModelId();
|
||||||
|
Date startTime = chargeOrder.getStartTime();
|
||||||
|
Date endTime = chargeOrder.getEndTime();
|
||||||
|
String amountCharged = chargeOrder.getAmountCharged();
|
||||||
|
|
||||||
|
//每分钟充电度数=累计时间/60
|
||||||
|
//Double rate =(Double) i%60;
|
||||||
|
//获取费率时段集合
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,10 @@
|
|||||||
from xhpc_app_user
|
from xhpc_app_user
|
||||||
where del_flag=0 and app_user_id=#{userId}
|
where del_flag=0 and app_user_id=#{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateUserBalance">
|
||||||
|
update xhpc_app_user set balance=#{balance} where app_user_id=#{userId}
|
||||||
|
</update>
|
||||||
<select id="countXhpcRealTimeOrder" resultType="String">
|
<select id="countXhpcRealTimeOrder" resultType="String">
|
||||||
select charge_order_id as chargeOrderId from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0 limit 1
|
select charge_order_id as chargeOrderId from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0 limit 1
|
||||||
</select>
|
</select>
|
||||||
@ -412,4 +416,8 @@
|
|||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<insert id="addUserAccountStatement">
|
||||||
|
INSERT INTO xhpc_user_account_statement(user_id,amount,remaining_sum,charge_order_id,type,create_time) values(#{userId},#{amount},#{remainingSum},#{chargeOrderId},#{type},#{date})
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -383,16 +383,16 @@
|
|||||||
and ho.type=#{type}
|
and ho.type=#{type}
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime !=null and startTime !=''">
|
<if test="startTime !=null and startTime !=''">
|
||||||
and ho.start_time >= #{startTime}
|
and co.start_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime !=null and endTime !=''">
|
<if test="endTime !=null and endTime !=''">
|
||||||
and ho.start_time <= #{startTime}
|
and co.start_time <= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="transactionNumber !=null and transactionNumber !=''">
|
<if test="transactionNumber !=null and transactionNumber !=''">
|
||||||
and ho.serial_number like concat('%', #{transactionNumber}, '%')
|
and ho.serial_number like concat('%', #{transactionNumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="chargingStationName !=null and chargingStationName !=''">
|
<if test="chargingStationName !=null and chargingStationName !=''">
|
||||||
and co.serial_number like concat('%', #{transactionNumber}, '%')
|
and ct.name like concat('%', #{transactionNumber}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and op.operator_id =#{operatorId}
|
and op.operator_id =#{operatorId}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user