This commit is contained in:
Lemon
2023-03-15 09:12:46 +08:00
3 changed files with 43 additions and 4 deletions

View File

@@ -130,6 +130,8 @@ public interface IOrderBasicInfoService {
*/
void saveAbnormalOrder(TransactionRecordsData data);
void moveAbnormalOrder();
/**
* 获取充电实时数据
* @param orderCode 订单编号

View File

@@ -22,8 +22,10 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.bean.BeanUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.pile.domain.OrderAbnormalRecord;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.OrderDetail;
import com.jsowell.pile.domain.OrderPayRecord;
@@ -688,9 +690,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
@Override
public void saveAbnormalOrder(TransactionRecordsData data) {
// OrderAbnormalRecord record = new OrderAbnormalRecord();
// BeanUtils.copyBeanProp(record, data);
// orderAbnormalRecordService.insertOrderAbnormalRecord(record);
OrderAbnormalRecord record = new OrderAbnormalRecord();
BeanUtils.copyBeanProp(record, data);
orderAbnormalRecordService.insertOrderAbnormalRecord(record);
// 保存到订单主表
// 订单基本信息
@@ -733,11 +735,17 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
// 支付时间
orderBasicInfo.setPayTime(null);
// 订单金额
orderBasicInfo.setOrderAmount(null);
orderBasicInfo.setOrderAmount(new BigDecimal(data.getConsumptionAmount()));
// 充电开始时间
orderBasicInfo.setChargeStartTime(DateUtils.parseDate(data.getStartTime()));
// 充电结束时间
orderBasicInfo.setChargeEndTime(DateUtils.parseDate(data.getEndTime()));
// 停止原因
orderBasicInfo.setReason(data.getStopReasonMsg());
// 结算时间
orderBasicInfo.setSettlementTime(DateUtils.getNowDate());
// 创建人
orderBasicInfo.setCreateBy(data.getLogicCard());
// 订单详情
@@ -805,6 +813,18 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
}
@Override
public void moveAbnormalOrder() {
List<OrderAbnormalRecord> list = orderAbnormalRecordService.selectOrderAbnormalRecordList(null);
for (OrderAbnormalRecord record : list) {
logger.info("异常订单记录 record:{}", record);
TransactionRecordsData data = new TransactionRecordsData();
BeanUtils.copyBeanProp(data, record);
data.setTransactionCode(record.getOrderCode());
logger.info("异常订单记录 data:{}", data);
}
}
/**
* 根据订单编号获取充电实时数据 时间倒序
* 订单只有在充电中才会把实时数据保存到redis