mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-18 00:38:33 +08:00
校验是否为并充订单
This commit is contained in:
@@ -602,4 +602,21 @@ public class TempController extends BaseController {
|
|||||||
}
|
}
|
||||||
return response;
|
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;
|
package com.jsowell.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -81,6 +82,12 @@ public class TempService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PileMsgRecordMapper pileMsgRecordMapper;
|
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));
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.jsowell.pile.domain.PileMsgRecord;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
@@ -18,5 +19,5 @@ public interface PileMsgRecordMapper {
|
|||||||
List<PileMsgRecord> getPileFeedList(@Param("pileSn") String pileSn);
|
List<PileMsgRecord> getPileFeedList(@Param("pileSn") String pileSn);
|
||||||
|
|
||||||
List<PileMsgRecord> getPileFeedListV2(@Param("pileSn") String pileSn, @Param("frameType") String frameType,
|
List<PileMsgRecord> getPileFeedListV2(@Param("pileSn") String pileSn, @Param("frameType") String frameType,
|
||||||
@Param("startTime") String startTime, @Param("endTime") String endTime);
|
@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import com.jsowell.common.core.page.PageResponse;
|
|||||||
import com.jsowell.pile.domain.PileMsgRecord;
|
import com.jsowell.pile.domain.PileMsgRecord;
|
||||||
import com.jsowell.pile.dto.QueryPileDTO;
|
import com.jsowell.pile.dto.QueryPileDTO;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface PileMsgRecordService {
|
public interface PileMsgRecordService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,4 +27,6 @@ public interface PileMsgRecordService {
|
|||||||
PageResponse getPileFeedList(QueryPileDTO dto);
|
PageResponse getPileFeedList(QueryPileDTO dto);
|
||||||
|
|
||||||
String generateDescription(PileMsgRecord pileMsgRecord);
|
String generateDescription(PileMsgRecord pileMsgRecord);
|
||||||
|
|
||||||
|
List<PileMsgRecord> getPileFeedListV2(String pileSn, String frameType, Date startTime, Date endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ 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;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -120,6 +121,11 @@ public class PileMsgRecordServiceImpl implements PileMsgRecordService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PileMsgRecord> getPileFeedListV2(String pileSn, String frameType, Date createTime, Date updateTime) {
|
||||||
|
return pileMsgRecordMapper.getPileFeedListV2(pileSn, frameType, createTime, updateTime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析登录报文
|
* 解析登录报文
|
||||||
* @param jsonMsg
|
* @param jsonMsg
|
||||||
|
|||||||
Reference in New Issue
Block a user