This commit is contained in:
2023-03-15 09:12:09 +08:00
parent 57a95ee7ee
commit 0ed9826cfc
3 changed files with 43 additions and 4 deletions

View File

@@ -6,11 +6,13 @@ import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
import com.jsowell.service.PileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -24,6 +26,9 @@ public class JumpController extends BaseController {
@Autowired
private PileService pileService;
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
/**
* 查询充电桩详情
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
@@ -67,4 +72,16 @@ public class JumpController extends BaseController {
logger.info("app-xcx-h5查询充电枪口详情 result:{}", JSONObject.toJSONString(response));
return response;
}
/**
* 迁移异常订单到订单主表
* 临时接口,使用完删除
* http://localhost:8080/app-xcx-h5/moveAbnormalOrder
* @return
*/
@PostMapping("/moveAbnormalOrder")
public RestApiResponse<?> moveAbnormalOrder() {
orderBasicInfoService.moveAbnormalOrder();
return null;
}
}

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