浏览代码

余额支付

xubh 4 年之前
父节点
当前提交
3d0b77406e

+ 21 - 8
src/main/java/com/minpay/shouhuo/deliveryaction/DeliveryAction.java

@@ -376,14 +376,13 @@ public class DeliveryAction implements IMINAction{
 
 		for (int i = 0; i < drawDtoList.size(); i++) {
 			DrawDto drawDto = drawDtoList.get(i);
-			if(drawDto.isDraw()){ //中奖的
+
 				String orderId = drawDto.getOrderId();
 				String orderDetailsId = drawDto.getOrderDetailsId();
 				//获取订单信息
 				VmOrderInf ordInf = Service.lookup(IMINDataBaseService.class)
 						.getMybatisMapper(VmOrderInfMapper.class)
 						.selectByPrimaryKey(orderId);
-
 				if(ordInf == null){
 					throw new BusinessCodeException("JINM0114");//订单信息不存在
 				}else{
@@ -396,6 +395,8 @@ public class DeliveryAction implements IMINAction{
 						.getMybatisMapper(VmOrderDetailsMapper.class)
 						.selectByPrimaryKey(orderDetailsId);
 
+			//中奖的
+			if(drawDto.isDraw()){
 				//创建提货对象
 				VmDeliveryInf dlInf = new VmDeliveryInf();
 				//获取提货表主键
@@ -424,17 +425,29 @@ public class DeliveryAction implements IMINAction{
 				Service.lookup(IMINDataBaseService.class)
 						.getMybatisMapper(VmDeliveryInfMapper.class)
 						.insertSelective(dlInf);
+
 				//更新订单详情
-				if(ordInf.getIsDraw().equals("00")){
-					detInf.setDeliveryId(dlId);
-					ordInf.setIsDraw("01");
+				detInf.setDeliveryId(dlId);
+				ordInf.setIsDraw("01");
+				detInf.setIsWinning("01");
+				Service.lookup(IMINDataBaseService.class)
+						.getMybatisMapper(VmOrderDetailsMapper.class)
+						.updateByPrimaryKeySelective(detInf);
+				if(!ordInf.equals("01") && !ordInf.equals("02")){
 					Service.lookup(IMINDataBaseService.class)
-							.getMybatisMapper(VmOrderDetailsMapper.class)
-							.updateByPrimaryKeySelective(detInf);
+							.getMybatisMapper(VmOrderInfMapper.class)
+							.updateByPrimaryKeySelective(ordInf);
 				}
-
+			/**没有中奖的*/
+			}else{
+				ordInf.setIsDraw("00");
+				detInf.setIsWinning("02");
+				Service.lookup(IMINDataBaseService.class)
+						.getMybatisMapper(VmOrderDetailsMapper.class)
+						.updateByPrimaryKeySelective(detInf);
 			}
 
+
 		}
 
 	}

+ 9 - 2
src/main/java/com/minpay/shouhuo/orderaction/PayManageAction.java

@@ -227,12 +227,19 @@ public class PayManageAction implements IMINAction {
 
 		/**1.查询订单*/
 		VmOrderInf orderInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).selectByPrimaryKey(orderId);
-		if(orderInf != null){
+		if(orderInf == null){
 			throw new MINBusinessException("无此订单!");
 		}
 		if(CommonUtil.compare(payAmt, orderInf.getOrderAmt()) != 0){
 			throw new MINBusinessException("交易异常");//支付金额不对
 		}
+		if(!user.getId().equals(orderInf.getPersonId())){
+			throw new MINBusinessException("登录账号和下单账户不符");
+		}
+		if(orderInf.getState().equals("00")){
+			throw new MINBusinessException("订单已支付");
+		}
+
 		VmPaymentInfExample paymentExp = new VmPaymentInfExample();
 		paymentExp.createCriteria().andChannelEqualTo(user.getChannel()).andTranflownoEqualTo(orderId);
 		List<VmPaymentInf> paymenList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).selectByExample(paymentExp);
@@ -252,7 +259,7 @@ public class PayManageAction implements IMINAction {
 		/**4.抽奖*/
 		//调用真实回调
 		IDrawService drawService = new DrawServiceImpl();
-		drawService.backEx(orderId, null, "TRADE_SUCCESS", payAmt,null, "", "");
+		drawService.backEx(orderId, null, "TRADE_SUCCESS", payAmt,null, "", "93");
 		// 记录操作日志
 		//String logInfo = "操作员:" + user.getName() + "会员下单,售货机编号:" + equNo+ "下单商品信息:" + detData;
 		//Service.lookup(ILogService.class).logging(session, logInfo);