| 
					
				 | 
			
			
				@@ -42,6 +42,8 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysDictDataService sysDictDataService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private LabelService labelService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StationOilGunService stationOilGunService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //小程序支付生成订单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @RequestMapping(value = "/AddPayOrderInfoNew", consumes = "application/json", method = RequestMethod.POST) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -54,7 +56,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AppUserInfo appUserInfo =new AppUserInfo();     //查询客户信息传递参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PayOrder payOrder = new PayOrder();             //生成订单参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(StringUtils.isNotBlank(payOrderRequest.getUserType()) && StringUtils.isNotBlank(payOrderRequest.getOpenId()) && StringUtils.isNotBlank(payOrderRequest.getOilName()) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                StringUtils.isNotBlank(payOrderRequest.getOilGun()) && payOrderRequest.getReceivableAmt() !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                StringUtils.isNotBlank(payOrderRequest.getOilGun()) && payOrderRequest.getReceivableAmt() !=null ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             appUserInfo.setUserType(payOrderRequest.getUserType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             switch (payOrderRequest.getUserType()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "1":       //小程序 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,7 +77,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 resultMap.put("stationName", stationInfos.getStationName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 appUserInfo.setStationId(stationInfos.getGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 AppUserInfo appUserInfos = appUserInfoService.getAppUserInfo(appUserInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(appUserInfos !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(appUserInfos !=null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //payOrderRequest存放参数原因:用于其他方法形参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrderRequest.setCardEnabledFlagGroup(stationInfos.getCardEnabledFlagGroup());        //集团是否开启电子卡 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrderRequest.setCardRuleFlagGroup(stationInfos.getCardRuleFlagGroup());              //集团是否共享 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,11 +94,11 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setConsumer(appUserInfos.getBlogNickName());             //昵称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setConsumerId(appUserInfos.getUserId());                 //用户id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Random random = new Random(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String result=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for(int i=0;i<6;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        result+=random.nextInt(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String result = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    for (int i = 0; i < 6; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        result += random.nextInt(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String ordNo=System.nanoTime()+result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String ordNo = System.nanoTime() + result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setOrderNo(ordNo);                                             //订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     logger.info("生成的订单号:" + ordNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setDiscountCouponAmt(payOrderRequest.getDiscountCouponAmt());  //优惠劵金额 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -112,7 +114,7 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setOrderType(payOrderRequest.getOrderType());  //订单类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setOilGun(payOrderRequest.getOilGun());        //油枪号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setReceivableAmt(Double.valueOf(payOrderRequest.getReceivableAmt()));                //订单应收金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String oilName =payOrderRequest.getOilName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String oilName = payOrderRequest.getOilName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取该油品所属哪一类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Oil oil = new Oil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     oil.setOilName(oilName); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -123,24 +125,37 @@ public class PayOrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     logger.info("订单油品类型:" + oilsType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrderRequest.setCardOilsType(oilInfo.getOilsType());                 //电子卡类型;注:用于获取客户电子卡参数查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     payOrder.setOilName(oilName);                   //油品名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //根据油站和油枪获取加油员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    HashMap<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    params.put("oliGunNo", payOrderRequest.getOilGun()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    params.put("stationId", payOrderRequest.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.info("加油员信息:"+ mapResultList.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(mapResultList != null && mapResultList.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String oilPersonnel = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (Map per : mapResultList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if(per.containsKey("personelName") && per.get("personelName").toString() !=null && per.get("personelName").toString() !=""){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                oilPersonnel += per.get("personelName").toString() +","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (payOrderRequest.getPersonnelId() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Map<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        params.put("personnelId", payOrderRequest.getPersonnelId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<Map<String, Object>> list = stationOilGunService.selectOilGunByPersonalId(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            payOrder.setOilPersonnel(list.get(0).get("personnelName").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            payOrder.setOilPersonnel("--"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(oilPersonnel !=""){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //根据油站和油枪获取加油员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        HashMap<String, Object> params = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        params.put("oliGunNo", payOrderRequest.getOilGun()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        params.put("stationId", payOrderRequest.getStationId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<Map> mapResultList = payOrderMapper.selectPersonelName(params);    //使用list原因:一个枪号对应多个加油员场景 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.info("加油员信息:"+ mapResultList.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(mapResultList != null && mapResultList.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            String oilPersonnel = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for (Map per : mapResultList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if(per.containsKey("personnelName") && per.get("personnelName").toString() !=null && per.get("personnelName").toString() !=""){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    oilPersonnel += per.get("personnelName").toString() +","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(oilPersonnel !=""){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                payOrder.setOilPersonnel(oilPersonnel.substring(0, oilPersonnel.length()-1));   //加油员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            payOrder.setOilPersonnel("--"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        payOrder.setOilPersonnel("--"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if(oilsType.equals("3")){                                                  //订单类型是油品时计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         payOrder.setOrderType("2"); 
			 |