|
@@ -38,7 +38,7 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|
|
for(int i=0;i<6;i++){
|
|
|
result+=random.nextInt(10);
|
|
|
}
|
|
|
- System.out.println("随机生成6位数result :"+result);
|
|
|
+ //System.out.println("随机生成6位数result :"+result);
|
|
|
String ordNo=System.nanoTime()+result;
|
|
|
payOrder.setOrderNo(ordNo);
|
|
|
payOrder.setOilName(payOrderRequest.getOilName()); //油品名称
|
|
@@ -51,22 +51,23 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|
|
}else if(StringUtils.isNotBlank(payOrderRequest.getUserType())&& payOrderRequest.getUserType().equals("2")){
|
|
|
payOrder.setPayWay("03");
|
|
|
}
|
|
|
- payOrder.setPayDate(new Date()); //支付时间
|
|
|
+ //payOrder.setPayDate(new Date()); //支付时间
|
|
|
payOrder.setCreatedDate(new Date()); //创建时间
|
|
|
payOrder.setOrderType(payOrderRequest.getOrderType()); //订单类型
|
|
|
//根据油站和油枪获取油枪编号和价格
|
|
|
HashMap<String, Object> params = new HashMap<>();
|
|
|
params.put("oilGunId", payOrderRequest.getOilGun());
|
|
|
params.put("stationId", payOrderRequest.getStationId());
|
|
|
- Map mapResult = payOrderMapper.selectOilGunNoAndOilPrice(params);
|
|
|
- if(mapResult.containsKey("oliGunNo") && mapResult.get("oliGunNo").toString() !=null){
|
|
|
- payOrder.setOilGun(mapResult.get("oliGunNo").toString()); //存入油枪号
|
|
|
- }
|
|
|
- if(mapResult.containsKey("personnelName") && mapResult.get("personnelName").toString() !=null){
|
|
|
- payOrder.setOilPersonnel(mapResult.get("personnelName").toString()); //加油员
|
|
|
- }
|
|
|
- if(mapResult.containsKey("stationName") && mapResult.get("stationName").toString() !=null){
|
|
|
- payOrder.setStationName(mapResult.get("stationName").toString()); //油站名称
|
|
|
+ String oilPersonnel = "";
|
|
|
+ //使用list原因:一个枪号对应多个加油员场景
|
|
|
+ List<Map> mapResultList = payOrderMapper.selectOilGunNoAndOilPrice(params);
|
|
|
+ if(mapResultList != null && mapResultList.size() > 0){
|
|
|
+ for (Map per : mapResultList){
|
|
|
+ oilPersonnel += per.get("personelName").toString() +",";
|
|
|
+ }
|
|
|
+ payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1)); //加油员
|
|
|
+ payOrder.setOilGun(mapResultList.get(0).get("oliGunNo").toString()); //存入油枪号
|
|
|
+ payOrder.setStationName(mapResultList.get(0).get("stationName").toString()); //油站名称
|
|
|
}
|
|
|
//根据油品名称和油站id获取当前油品调价信息
|
|
|
params.put("oilName", payOrderRequest.getOilName());
|
|
@@ -84,8 +85,8 @@ public class PayOrderServiceImpl implements PayOrderService {
|
|
|
}
|
|
|
}
|
|
|
}else { //若没有油价调整时则使用原始油价计算加油升数
|
|
|
- if(mapResult.containsKey("oilPrice") && mapResult.get("oilPrice").toString() !=null && !mapResult.get("oilPrice").toString().equals("")){
|
|
|
- String oilPrice = mapResult.get("oilPrice").toString(); //原始价格
|
|
|
+ if(mapResultList.get(0).containsKey("oilPrice") && mapResultList.get(0).get("oilPrice").toString() !=null && !mapResultList.get(0).get("oilPrice").toString().equals("")){
|
|
|
+ String oilPrice = mapResultList.get(0).get("oilPrice").toString(); //原始价格
|
|
|
payOrder.setOilPirce(oilPrice);
|
|
|
payOrder.setOrderLiters(recKonOrderLiters(amt, oilPrice, 2)); //计算油价升数存放
|
|
|
}
|