mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
校验是否为并充订单
This commit is contained in:
@@ -602,4 +602,21 @@ public class TempController extends BaseController {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验订单是否为并充订单
|
||||
* https://localhost:8080/temp/checkCombinedChargingOrder
|
||||
*/
|
||||
@PostMapping("/checkCombinedChargingOrder")
|
||||
public RestApiResponse<?> checkCombinedChargingOrder(@RequestBody QueryOrderDTO dto) {
|
||||
RestApiResponse<?> response;
|
||||
try {
|
||||
Map<String, List<String>> map = tempService.checkCombinedChargingOrder(dto.getOrderCodeList());
|
||||
response = new RestApiResponse<>(map);
|
||||
} catch (Exception e) {
|
||||
logger.error("校验订单是否为并充订单error", e);
|
||||
response = new RestApiResponse<>();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -81,6 +82,12 @@ public class TempService {
|
||||
@Autowired
|
||||
private PileMsgRecordMapper pileMsgRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private PileMsgRecordService pileMsgRecordService;
|
||||
|
||||
@Autowired
|
||||
private OrderMonitorDataService orderMonitorDataService;
|
||||
|
||||
/**
|
||||
* 计算订单耗电量
|
||||
* 内蒙古站点
|
||||
@@ -574,4 +581,36 @@ public class TempService {
|
||||
}
|
||||
logger.info("{} - {} 期间,共有{}笔支付单存在剩余金额, 共计:{},list:{}", dto.getStartTime(), dto.getEndTime(), paymentIdList.size(), total, JSON.toJSONString(paymentIdList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否为并充订单
|
||||
*/
|
||||
public Map<String, List<String>> checkCombinedChargingOrder(List<String> orderCodeList) throws BaseAdaPayException {
|
||||
Map<String, List<String>> resultMap = Maps.newHashMap();
|
||||
Set<String> combinedChargingOrderList = Sets.newHashSet();
|
||||
Set<String> notCombinedChargingOrderList = Sets.newHashSet();
|
||||
for (String orderCode : orderCodeList) {
|
||||
// 查询orderMonitorData
|
||||
OrderMonitorData orderMonitorData = orderMonitorDataService.selectByOrderCode(orderCode);
|
||||
if (orderMonitorData == null) {
|
||||
logger.info("订单:{}不存在", orderCode);
|
||||
continue;
|
||||
}
|
||||
JSONArray jsonArray = JSONArray.parseArray(orderMonitorData.getMonitorData());
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String outputCurrent = jsonObject.getString("outputCurrent");
|
||||
if (new BigDecimal(outputCurrent).compareTo(new BigDecimal(250)) > 0) {
|
||||
logger.info("订单:{},第{}条数据,输出电流:{},大于250,为并充订单", orderCode, i, outputCurrent);
|
||||
combinedChargingOrderList.add(orderCode);
|
||||
break;
|
||||
}
|
||||
notCombinedChargingOrderList.add(orderCode);
|
||||
}
|
||||
}
|
||||
resultMap.put("combinedChargingOrderList", Lists.newArrayList(combinedChargingOrderList));
|
||||
resultMap.put("notCombinedChargingOrderList", Lists.newArrayList(notCombinedChargingOrderList));
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user