完成query_equip_charge_status接口(已测试)
This commit is contained in:
parent
73ad931c6f
commit
1fecc7e1af
@ -1,16 +1,17 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.dto.ChargeInfoRequest;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.EquipChargeStatus;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.http.ServerInternalException;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -26,6 +27,8 @@ public class QueryEquipChargeStatusController {
|
||||
|
||||
@Autowired
|
||||
XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
OrderMappingRepository orderMappingRepository;
|
||||
|
||||
@PostMapping("/v1/query_equip_charge_status")
|
||||
public CommonResponse QueryEquipChargeStatus(@RequestBody CommonRequest<ChargeInfoRequest> commonRequest) throws IOException {
|
||||
@ -37,12 +40,14 @@ public class QueryEquipChargeStatusController {
|
||||
String startChargeSeq = chargeInfoRequest.getStartChargeSeq();
|
||||
equipChargeStatus.setStartChargeSeq(startChargeSeq);
|
||||
//充电订单状态
|
||||
XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderRepository.findByInternetSerialNumber(startChargeSeq).orElse(null);
|
||||
if (xhpcHistoryOrder == null) {
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
// XhpcHistoryOrder xhpcHistoryOrder = xhpcHistoryOrderRepository.findByInternetSerialNumber(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
throw new ServerInternalException("未查询到该订单编号数据");
|
||||
}
|
||||
String internalOrderNum = xhpcHistoryOrder.getSerialNumber();
|
||||
Map<String, Object> order = REDIS.getCacheMap("order" + internalOrderNum);
|
||||
// String internalOrderNum = xhpcHistoryOrder.getSerialNumber();
|
||||
String internalOrderNum = etOrderMapping.getXhOrderNo();
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
String orderStatus = (String) order.get("status");
|
||||
int startChargeSeqStat = 0;
|
||||
switch (orderStatus) {
|
||||
@ -121,6 +126,7 @@ public class QueryEquipChargeStatusController {
|
||||
CommonResponse response = new CommonResponse();
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
||||
response.setMsg("操作成功");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user