浏览代码

调整支付1.2

xubh 4 年之前
父节点
当前提交
d4e024bd98

+ 4 - 5
src/main/java/com/minpay/common/pay/ShouhuoPay.java

@@ -6,10 +6,8 @@ import com.min.des.DesUtils;
 import com.minpay.common.bean.User;
 import com.minpay.common.exception.BusinessCodeException;
 import com.minpay.common.pay.bean.Huilianpay;
-import com.minpay.common.service.IAccountService;
-import com.minpay.common.service.IHuilianPayService;
-import com.minpay.common.service.IPropertiesService;
-import com.minpay.common.service.IPublicService;
+import com.minpay.common.service.*;
+import com.minpay.common.service.impl.DrawServiceImpl;
 import com.minpay.common.service.impl.HuilianPayServiceImpl;
 import com.minpay.common.util.CommonUtil;
 import com.minpay.common.util.DateUtil;
@@ -363,7 +361,8 @@ public class ShouhuoPay implements IMINAction{
 		String sysorderno = resMap.get("OrderNo").toString();
 		//查询订单如果已支付状态表示已经回调过
         //调用真实回调
-        backEx(orderno, sysorderno, "TRADE_SUCCESS", amt,payOrderno, "", "");
+        IDrawService drawService = new DrawServiceImpl();
+        drawService.backEx(orderno, sysorderno, "TRADE_SUCCESS", amt,payOrderno, "", "");
 		return res;
 	}
 	

+ 22 - 0
src/main/java/com/minpay/common/service/IDrawService.java

@@ -37,4 +37,26 @@ public interface IDrawService extends IMINLocalService {
 	public List<DrawDto> orderDrawGame(VmOrderInf orderInf, VmProEquRel proEquRel, VmOrderDetails vmOrderDetails
 									 ) throws BusinessCodeException, MINBusinessException;
 
+
+	/**
+	 * 支付回调接口
+	 * @param orderno	订单号
+	 * @param sysorderno 	交易流水号
+	 * @param status	状态
+	 * @param amt	交易金额
+	 * @param payOrderno
+	 * @param failReason
+	 * @param payChannel	支付通道(04快捷支付 91微信支付92支付宝支付 93钱包支付)
+	 * @throws BusinessCodeException
+	 * @throws MINBusinessException
+	 */
+	public void backEx(
+			String orderno,
+			String sysorderno,
+			String status,
+			String amt,
+			String payOrderno,
+			String failReason,
+			String payChannel
+	) throws BusinessCodeException, MINBusinessException;
 }

+ 85 - 0
src/main/java/com/minpay/common/service/impl/DrawServiceImpl.java

@@ -2,11 +2,15 @@ package com.minpay.common.service.impl;
 
 import com.minpay.common.bean.DrawDto;
 import com.minpay.common.exception.BusinessCodeException;
+import com.minpay.common.service.IAccountService;
 import com.minpay.common.service.IDrawService;
 import com.minpay.common.service.IPublicService;
 import com.minpay.common.util.CommonUtil;
+import com.minpay.common.util.DateUtil;
 import com.minpay.db.table.mapper.*;
 import com.minpay.db.table.model.*;
+import com.minpay.shouhuo.deliveryaction.DeliveryAction;
+import com.minpay.shouhuo.orderdrawaction.OrderDrawAction;
 import com.startup.minpay.frame.exception.MINBusinessException;
 import com.startup.minpay.frame.service.base.IMINDataBaseService;
 import com.startup.minpay.frame.service.base.Service;
@@ -138,5 +142,86 @@ public class DrawServiceImpl implements IDrawService {
         return drawDtoList;
     }
 
+    @Override
+    public void backEx(String orderno, String sysorderno, String status, String amt, String payOrderno, String failReason, String payChannel) throws BusinessCodeException, MINBusinessException {
+        // 交易流水号
+        VmPaymentInfExample paymentExp = new VmPaymentInfExample();
+        paymentExp.createCriteria().andTranflownoEqualTo(orderno);
+        List<VmPaymentInf>  payMentList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).selectByExample(paymentExp);
+        if(payMentList.size() == 0) {
+            throw new MINBusinessException("error");
+        }
+        // 0 初始状态 --如果已经通知过返回
+        // 3在途
+        if(!"0".equals(payMentList.get(0).getStatus())
+                && !"3".equals(payMentList.get(0).getStatus())) {
+            throw new MINBusinessException("error");
+        }
+        VmPaymentInf payMentInf = new VmPaymentInf();
+        payMentInf.setBankflowno(sysorderno);
+        // 支付方式(01 账户支付、02 预付卡支付、03 网银支付、04快捷支付 91微信支付92支付宝支付)
+        if(CommonUtil.isNotEmpty(payChannel)) {
+            payMentInf.setPaytype(payChannel);
+        }
+
+
+        VmOrderInf orderInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).selectByPrimaryKey(orderno);
+        orderInf.setState("92"); //  92:支付中
+        //		TRADE_SUCCESS:交易成功,用户付款成功
+        //		TRADE_FINISHED:交易结束,付款金额已结算给商户
+        //		TRADE_CLOSED:交易关闭,交易失败
+        if("TRADE_SUCCESS".equals(status)
+                || "TRADE_FINISHED".equals(status)) {
+            // 交易状态(0 初始状态,1成功,2失败,3在途,4待审核,5已审核)
+            payMentInf.setStatus("1");
+            payMentInf.setSuccamount(amt);//支付成功返还金额
+            //支付成功时间
+            payMentInf.setSucctime(DateUtil.getCurrentDateTimeString());
+            orderInf.setState("00"); 			//  00:已支付
+            orderInf.setPayOrderno(payOrderno); //  支付平台订单号(微信、支付宝订单号)
+        }
+        else if("TRADE_CLOSED".equals(status)) {
+            // 交易状态(0 初始状态,1成功,2失败,3在途,4待审核,5已审核)
+            payMentInf.setStatus("2");
+            orderInf.setState("93"); //  93:支付失败
+        }
+        // 不是空
+        if(!CommonUtil.isEmpty(failReason)) {
+            payMentInf.setRemarktwo(failReason);
+        }
+
+        Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).updateByExampleSelective(payMentInf, paymentExp);
+        // 变更待结算账户
+        IAccountService service = Service.lookup(IAccountService.class);
+        orderInf.setId(orderno);
+        Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).updateByPrimaryKeySelective(orderInf);
+        if("00".equals(orderInf.getState())){
+            if("01".equals(orderInf.getProType())){
+                //抽奖的商品走这里
+                OrderDrawAction drawAction = new OrderDrawAction();
+                drawAction.editOrderDraw(orderInf,sysorderno);
+            }else if("00".equals(orderInf.getProType())){
+                //购买商品走这里
+                DeliveryAction.purchaseCreateDeliveryInfo(orderno,"");
+                //执行推货
+//				toMachine(orderInf.getChannel(), orderno);
+            }
+            // 充值
+            else if("02".equals(orderInf.getProType())) {
+
+                /**查询调账金额*/
+                VmRechargeRule vmRechargeRule = Service.lookup(IMINDataBaseService.class)
+                        .getMybatisMapper(VmRechargeRuleMapper.class).selectByPrimaryKey(orderInf.getRechareRuleId());
+                if(vmRechargeRule == null){
+                    throw new MINBusinessException("error");
+                }
+                String giveAmt =  vmRechargeRule.getGiveAmt();
+                String rechargeAmt = vmRechargeRule.getRechargeAmt();
+                String allAmt = CommonUtil.add(giveAmt, rechargeAmt);
+                // 00充值(CZ)
+                service.modfiyAccount(orderInf.getChannel(), orderInf.getPersonId(), "01", allAmt, "00", payMentList.get(0).getFlowno(), "充值",orderInf.getEquipmentId());
+            }
+        }
+    }
 
 }

+ 97 - 0
src/main/java/com/minpay/db/table/mapper/VmHlAccountMapper.java

@@ -0,0 +1,97 @@
+package com.minpay.db.table.mapper;
+
+import com.minpay.db.table.model.VmHlAccount;
+import com.minpay.db.table.model.VmHlAccountExample;
+import com.startup.minpay.frame.jdbc.IMINMybatisEntityMapper;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface VmHlAccountMapper extends IMINMybatisEntityMapper<VmHlAccount, String, VmHlAccountExample> {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int countByExample(VmHlAccountExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int deleteByExample(VmHlAccountExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int deleteByPrimaryKey(String id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int insert(VmHlAccount record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int insertSelective(VmHlAccount record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    List<VmHlAccount> selectByExample(VmHlAccountExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    VmHlAccount selectByPrimaryKey(String id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int updateByExampleSelective(@Param("record") VmHlAccount record, @Param("example") VmHlAccountExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int updateByExample(@Param("record") VmHlAccount record, @Param("example") VmHlAccountExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int updateByPrimaryKeySelective(VmHlAccount record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table vm_hl_account
+     *
+     * @mbggenerated
+     */
+    int updateByPrimaryKey(VmHlAccount record);
+}

+ 453 - 0
src/main/java/com/minpay/db/table/model/VmHlAccount.java

@@ -0,0 +1,453 @@
+package com.minpay.db.table.model;
+
+import com.startup.minpay.frame.data.AbstractMINBean;
+
+public class VmHlAccount extends AbstractMINBean {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_ID
+     *
+     * @mbggenerated
+     */
+    private String id;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_CHANNEL
+     *
+     * @mbggenerated
+     */
+    private String channel;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_USRID
+     *
+     * @mbggenerated
+     */
+    private String usrid;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_TYPE
+     *
+     * @mbggenerated
+     */
+    private String type;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_NAME
+     *
+     * @mbggenerated
+     */
+    private String name;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_NUMBER
+     *
+     * @mbggenerated
+     */
+    private String number;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_AMT
+     *
+     * @mbggenerated
+     */
+    private String amt;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_AVA_AMT
+     *
+     * @mbggenerated
+     */
+    private String avaAmt;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_CREATE_USER
+     *
+     * @mbggenerated
+     */
+    private String createUser;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_CREATE_TIME
+     *
+     * @mbggenerated
+     */
+    private String createTime;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_MODIFY_USER
+     *
+     * @mbggenerated
+     */
+    private String modifyUser;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_MODIFY_TIME
+     *
+     * @mbggenerated
+     */
+    private String modifyTime;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_STATE
+     *
+     * @mbggenerated
+     */
+    private String state;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_hl_account.ACT_EQUIPMENT_ID
+     *
+     * @mbggenerated
+     */
+    private String equipmentId;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_ID
+     *
+     * @return the value of vm_hl_account.ACT_ID
+     *
+     * @mbggenerated
+     */
+    public String getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_ID
+     *
+     * @param id the value for vm_hl_account.ACT_ID
+     *
+     * @mbggenerated
+     */
+    public void setId(String id) {
+        this.id = id == null ? null : id.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_CHANNEL
+     *
+     * @return the value of vm_hl_account.ACT_CHANNEL
+     *
+     * @mbggenerated
+     */
+    public String getChannel() {
+        return channel;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_CHANNEL
+     *
+     * @param channel the value for vm_hl_account.ACT_CHANNEL
+     *
+     * @mbggenerated
+     */
+    public void setChannel(String channel) {
+        this.channel = channel == null ? null : channel.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_USRID
+     *
+     * @return the value of vm_hl_account.ACT_USRID
+     *
+     * @mbggenerated
+     */
+    public String getUsrid() {
+        return usrid;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_USRID
+     *
+     * @param usrid the value for vm_hl_account.ACT_USRID
+     *
+     * @mbggenerated
+     */
+    public void setUsrid(String usrid) {
+        this.usrid = usrid == null ? null : usrid.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_TYPE
+     *
+     * @return the value of vm_hl_account.ACT_TYPE
+     *
+     * @mbggenerated
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_TYPE
+     *
+     * @param type the value for vm_hl_account.ACT_TYPE
+     *
+     * @mbggenerated
+     */
+    public void setType(String type) {
+        this.type = type == null ? null : type.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_NAME
+     *
+     * @return the value of vm_hl_account.ACT_NAME
+     *
+     * @mbggenerated
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_NAME
+     *
+     * @param name the value for vm_hl_account.ACT_NAME
+     *
+     * @mbggenerated
+     */
+    public void setName(String name) {
+        this.name = name == null ? null : name.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_NUMBER
+     *
+     * @return the value of vm_hl_account.ACT_NUMBER
+     *
+     * @mbggenerated
+     */
+    public String getNumber() {
+        return number;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_NUMBER
+     *
+     * @param number the value for vm_hl_account.ACT_NUMBER
+     *
+     * @mbggenerated
+     */
+    public void setNumber(String number) {
+        this.number = number == null ? null : number.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_AMT
+     *
+     * @return the value of vm_hl_account.ACT_AMT
+     *
+     * @mbggenerated
+     */
+    public String getAmt() {
+        return amt;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_AMT
+     *
+     * @param amt the value for vm_hl_account.ACT_AMT
+     *
+     * @mbggenerated
+     */
+    public void setAmt(String amt) {
+        this.amt = amt == null ? null : amt.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_AVA_AMT
+     *
+     * @return the value of vm_hl_account.ACT_AVA_AMT
+     *
+     * @mbggenerated
+     */
+    public String getAvaAmt() {
+        return avaAmt;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_AVA_AMT
+     *
+     * @param avaAmt the value for vm_hl_account.ACT_AVA_AMT
+     *
+     * @mbggenerated
+     */
+    public void setAvaAmt(String avaAmt) {
+        this.avaAmt = avaAmt == null ? null : avaAmt.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_CREATE_USER
+     *
+     * @return the value of vm_hl_account.ACT_CREATE_USER
+     *
+     * @mbggenerated
+     */
+    public String getCreateUser() {
+        return createUser;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_CREATE_USER
+     *
+     * @param createUser the value for vm_hl_account.ACT_CREATE_USER
+     *
+     * @mbggenerated
+     */
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser == null ? null : createUser.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_CREATE_TIME
+     *
+     * @return the value of vm_hl_account.ACT_CREATE_TIME
+     *
+     * @mbggenerated
+     */
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_CREATE_TIME
+     *
+     * @param createTime the value for vm_hl_account.ACT_CREATE_TIME
+     *
+     * @mbggenerated
+     */
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime == null ? null : createTime.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_MODIFY_USER
+     *
+     * @return the value of vm_hl_account.ACT_MODIFY_USER
+     *
+     * @mbggenerated
+     */
+    public String getModifyUser() {
+        return modifyUser;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_MODIFY_USER
+     *
+     * @param modifyUser the value for vm_hl_account.ACT_MODIFY_USER
+     *
+     * @mbggenerated
+     */
+    public void setModifyUser(String modifyUser) {
+        this.modifyUser = modifyUser == null ? null : modifyUser.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_MODIFY_TIME
+     *
+     * @return the value of vm_hl_account.ACT_MODIFY_TIME
+     *
+     * @mbggenerated
+     */
+    public String getModifyTime() {
+        return modifyTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_MODIFY_TIME
+     *
+     * @param modifyTime the value for vm_hl_account.ACT_MODIFY_TIME
+     *
+     * @mbggenerated
+     */
+    public void setModifyTime(String modifyTime) {
+        this.modifyTime = modifyTime == null ? null : modifyTime.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_STATE
+     *
+     * @return the value of vm_hl_account.ACT_STATE
+     *
+     * @mbggenerated
+     */
+    public String getState() {
+        return state;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_STATE
+     *
+     * @param state the value for vm_hl_account.ACT_STATE
+     *
+     * @mbggenerated
+     */
+    public void setState(String state) {
+        this.state = state == null ? null : state.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_hl_account.ACT_EQUIPMENT_ID
+     *
+     * @return the value of vm_hl_account.ACT_EQUIPMENT_ID
+     *
+     * @mbggenerated
+     */
+    public String getEquipmentId() {
+        return equipmentId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_hl_account.ACT_EQUIPMENT_ID
+     *
+     * @param equipmentId the value for vm_hl_account.ACT_EQUIPMENT_ID
+     *
+     * @mbggenerated
+     */
+    public void setEquipmentId(String equipmentId) {
+        this.equipmentId = equipmentId == null ? null : equipmentId.trim();
+    }
+}

文件差异内容过多而无法显示
+ 1373 - 0
src/main/java/com/minpay/db/table/model/VmHlAccountExample.java


+ 39 - 20
src/main/java/com/minpay/shouhuo/orderaction/PayManageAction.java

@@ -3,10 +3,10 @@ package com.minpay.shouhuo.orderaction;
 import com.min.util.DateUtil;
 import com.minpay.common.bean.User;
 import com.minpay.common.exception.BusinessCodeException;
+import com.minpay.common.pay.ShouhuoPay;
 import com.minpay.common.pay.bean.Huilianpay;
-import com.minpay.common.service.IHuilianPayService;
-import com.minpay.common.service.IOrderService;
-import com.minpay.common.service.IPublicService;
+import com.minpay.common.service.*;
+import com.minpay.common.service.impl.DrawServiceImpl;
 import com.minpay.common.service.impl.HuilianPayServiceImpl;
 import com.minpay.common.util.CommonUtil;
 import com.minpay.db.table.mapper.*;
@@ -206,34 +206,53 @@ public class PayManageAction implements IMINAction {
 
 
 	/**
-	 * 回调
+	 * 余额支付
 	 * @param session
 	 * @return
 	 * @throws MINBusinessException
 	 */
 	@MINAction(value = BALANCE_PAY,transaction = IMINTransactionEnum.CMT)
 	public MINActionResult balancePay(
-			@MINParam(key = "equNo")String equNo,
-			@MINParam(key = "proType")String proType,
-			@MINParam(key = "proState")String proState,
-			@MINParam(key = "detData")String detData,
-			@MINParam(key = "payType")String payType,
-			@MINParam(key = "gameRule")String gameRule,
+			@MINParam(key = "payAmt") String payAmt,
+			@MINParam(key = "orderId") String orderId,
+			@MINParam(key = "payType", defaultValue = "93") String payType,
 			MINSession session) throws MINBusinessException{
 		//创建返回值对象
 		MINActionResult res = new MINActionResult();
-		if(CommonUtil.isEmpty(equNo)){
-			throw new BusinessCodeException("JINM1101");//售货机异常,请联系工作人员
+		//获取操作员信息
+		User user = session.getUser();
+		if(CommonUtil.isEmpty(orderId)){
+			throw new MINBusinessException("订单号不能为空");
+		}
+
+		/**1.查询订单*/
+		VmOrderInf orderInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).selectByPrimaryKey(orderId);
+		if(orderInf != null){
+			throw new MINBusinessException("无此订单!");
+		}
+		if(CommonUtil.compare(payAmt, orderInf.getOrderAmt()) != 0){
+			throw new MINBusinessException("交易异常");//支付金额不对
 		}
-		//解密售货机编号
-		//String equNoNew = OffSetUtil.deScanCode(equNo);
-		String orderId = Service.lookup(IOrderService.class).createOrderInf(equNo, proType, proState, payType, "", detData, session,gameRule);
-		//调用支付流水生产接口
-		if(!CommonUtil.isEmpty(orderId)){
-			String totalAmt = PaymentAction.addPaymentInfo(orderId, session);
-			res.set("totalAmt", totalAmt);
+		VmPaymentInfExample paymentExp = new VmPaymentInfExample();
+		paymentExp.createCriteria().andChannelEqualTo(user.getChannel()).andTranflownoEqualTo(orderId);
+		List<VmPaymentInf> paymenList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).selectByExample(paymentExp);
+		if(paymenList.size() > 1){
+			throw new MINBusinessException("交易异常");
 		}
-		res.set("orderId", orderId);
+		VmPaymentInf payment = paymenList.get(0);
+		/**2.调账*/
+		Service.lookup(IAccountService.class).modfiyAccount(orderInf.getChannel(), orderInf.getPersonId(), "01", "-".concat(payAmt), "00", payment.getFlowno(), "充值",orderInf.getEquipmentId());
+		/**3.更新订单表和支付表*/
+		/*payment.setStatus("1");
+		Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).updateByPrimaryKeySelective(payment);
+		// 变更待结算账户
+		orderInf.setId(orderId);
+		orderInf.setState("00");
+		Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).updateByPrimaryKeySelective(orderInf);*/
+		/**4.抽奖*/
+		//调用真实回调
+		IDrawService drawService = new DrawServiceImpl();
+		drawService.backEx(orderId, null, "TRADE_SUCCESS", payAmt,null, "", "");
 		// 记录操作日志
 		//String logInfo = "操作员:" + user.getName() + "会员下单,售货机编号:" + equNo+ "下单商品信息:" + detData;
 		//Service.lookup(ILogService.class).logging(session, logInfo);

+ 413 - 0
src/main/resources/com/minpay/db/table/mapper/VmHlAccountMapper.xml

@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.minpay.db.table.mapper.VmHlAccountMapper">
+  <resultMap id="BaseResultMap" type="com.minpay.db.table.model.VmHlAccount">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    <id column="ACT_ID" jdbcType="VARCHAR" property="id" />
+    <result column="ACT_CHANNEL" jdbcType="VARCHAR" property="channel" />
+    <result column="ACT_USRID" jdbcType="VARCHAR" property="usrid" />
+    <result column="ACT_TYPE" jdbcType="VARCHAR" property="type" />
+    <result column="ACT_NAME" jdbcType="VARCHAR" property="name" />
+    <result column="ACT_NUMBER" jdbcType="VARCHAR" property="number" />
+    <result column="ACT_AMT" jdbcType="VARCHAR" property="amt" />
+    <result column="ACT_AVA_AMT" jdbcType="VARCHAR" property="avaAmt" />
+    <result column="ACT_CREATE_USER" jdbcType="VARCHAR" property="createUser" />
+    <result column="ACT_CREATE_TIME" jdbcType="VARCHAR" property="createTime" />
+    <result column="ACT_MODIFY_USER" jdbcType="VARCHAR" property="modifyUser" />
+    <result column="ACT_MODIFY_TIME" jdbcType="VARCHAR" property="modifyTime" />
+    <result column="ACT_STATE" jdbcType="VARCHAR" property="state" />
+    <result column="ACT_EQUIPMENT_ID" jdbcType="VARCHAR" property="equipmentId" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    ACT_ID, ACT_CHANNEL, ACT_USRID, ACT_TYPE, ACT_NAME, ACT_NUMBER, ACT_AMT, ACT_AVA_AMT, 
+    ACT_CREATE_USER, ACT_CREATE_TIME, ACT_MODIFY_USER, ACT_MODIFY_TIME, ACT_STATE, ACT_EQUIPMENT_ID
+  </sql>
+  <select id="selectByExample" parameterType="com.minpay.db.table.model.VmHlAccountExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from vm_hl_account
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from vm_hl_account
+    where ACT_ID = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    delete from vm_hl_account
+    where ACT_ID = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.minpay.db.table.model.VmHlAccountExample">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    delete from vm_hl_account
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.minpay.db.table.model.VmHlAccount">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    insert into vm_hl_account (ACT_ID, ACT_CHANNEL, ACT_USRID, 
+      ACT_TYPE, ACT_NAME, ACT_NUMBER, 
+      ACT_AMT, ACT_AVA_AMT, ACT_CREATE_USER, 
+      ACT_CREATE_TIME, ACT_MODIFY_USER, ACT_MODIFY_TIME, 
+      ACT_STATE, ACT_EQUIPMENT_ID)
+    values (#{id,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{usrid,jdbcType=VARCHAR}, 
+      #{type,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, 
+      #{amt,jdbcType=VARCHAR}, #{avaAmt,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=VARCHAR}, #{modifyUser,jdbcType=VARCHAR}, #{modifyTime,jdbcType=VARCHAR}, 
+      #{state,jdbcType=VARCHAR}, #{equipmentId,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.minpay.db.table.model.VmHlAccount">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    insert into vm_hl_account
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        ACT_ID,
+      </if>
+      <if test="channel != null">
+        ACT_CHANNEL,
+      </if>
+      <if test="usrid != null">
+        ACT_USRID,
+      </if>
+      <if test="type != null">
+        ACT_TYPE,
+      </if>
+      <if test="name != null">
+        ACT_NAME,
+      </if>
+      <if test="number != null">
+        ACT_NUMBER,
+      </if>
+      <if test="amt != null">
+        ACT_AMT,
+      </if>
+      <if test="avaAmt != null">
+        ACT_AVA_AMT,
+      </if>
+      <if test="createUser != null">
+        ACT_CREATE_USER,
+      </if>
+      <if test="createTime != null">
+        ACT_CREATE_TIME,
+      </if>
+      <if test="modifyUser != null">
+        ACT_MODIFY_USER,
+      </if>
+      <if test="modifyTime != null">
+        ACT_MODIFY_TIME,
+      </if>
+      <if test="state != null">
+        ACT_STATE,
+      </if>
+      <if test="equipmentId != null">
+        ACT_EQUIPMENT_ID,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="channel != null">
+        #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="usrid != null">
+        #{usrid,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="number != null">
+        #{number,jdbcType=VARCHAR},
+      </if>
+      <if test="amt != null">
+        #{amt,jdbcType=VARCHAR},
+      </if>
+      <if test="avaAmt != null">
+        #{avaAmt,jdbcType=VARCHAR},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=VARCHAR},
+      </if>
+      <if test="modifyUser != null">
+        #{modifyUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifyTime != null">
+        #{modifyTime,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=VARCHAR},
+      </if>
+      <if test="equipmentId != null">
+        #{equipmentId,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.minpay.db.table.model.VmHlAccountExample" resultType="java.lang.Integer">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    select count(*) from vm_hl_account
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    update vm_hl_account
+    <set>
+      <if test="record.id != null">
+        ACT_ID = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.channel != null">
+        ACT_CHANNEL = #{record.channel,jdbcType=VARCHAR},
+      </if>
+      <if test="record.usrid != null">
+        ACT_USRID = #{record.usrid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null">
+        ACT_TYPE = #{record.type,jdbcType=VARCHAR},
+      </if>
+      <if test="record.name != null">
+        ACT_NAME = #{record.name,jdbcType=VARCHAR},
+      </if>
+      <if test="record.number != null">
+        ACT_NUMBER = #{record.number,jdbcType=VARCHAR},
+      </if>
+      <if test="record.amt != null">
+        ACT_AMT = #{record.amt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.avaAmt != null">
+        ACT_AVA_AMT = #{record.avaAmt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createUser != null">
+        ACT_CREATE_USER = #{record.createUser,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
+        ACT_CREATE_TIME = #{record.createTime,jdbcType=VARCHAR},
+      </if>
+      <if test="record.modifyUser != null">
+        ACT_MODIFY_USER = #{record.modifyUser,jdbcType=VARCHAR},
+      </if>
+      <if test="record.modifyTime != null">
+        ACT_MODIFY_TIME = #{record.modifyTime,jdbcType=VARCHAR},
+      </if>
+      <if test="record.state != null">
+        ACT_STATE = #{record.state,jdbcType=VARCHAR},
+      </if>
+      <if test="record.equipmentId != null">
+        ACT_EQUIPMENT_ID = #{record.equipmentId,jdbcType=VARCHAR},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    update vm_hl_account
+    set ACT_ID = #{record.id,jdbcType=VARCHAR},
+      ACT_CHANNEL = #{record.channel,jdbcType=VARCHAR},
+      ACT_USRID = #{record.usrid,jdbcType=VARCHAR},
+      ACT_TYPE = #{record.type,jdbcType=VARCHAR},
+      ACT_NAME = #{record.name,jdbcType=VARCHAR},
+      ACT_NUMBER = #{record.number,jdbcType=VARCHAR},
+      ACT_AMT = #{record.amt,jdbcType=VARCHAR},
+      ACT_AVA_AMT = #{record.avaAmt,jdbcType=VARCHAR},
+      ACT_CREATE_USER = #{record.createUser,jdbcType=VARCHAR},
+      ACT_CREATE_TIME = #{record.createTime,jdbcType=VARCHAR},
+      ACT_MODIFY_USER = #{record.modifyUser,jdbcType=VARCHAR},
+      ACT_MODIFY_TIME = #{record.modifyTime,jdbcType=VARCHAR},
+      ACT_STATE = #{record.state,jdbcType=VARCHAR},
+      ACT_EQUIPMENT_ID = #{record.equipmentId,jdbcType=VARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.minpay.db.table.model.VmHlAccount">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    update vm_hl_account
+    <set>
+      <if test="channel != null">
+        ACT_CHANNEL = #{channel,jdbcType=VARCHAR},
+      </if>
+      <if test="usrid != null">
+        ACT_USRID = #{usrid,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        ACT_TYPE = #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        ACT_NAME = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="number != null">
+        ACT_NUMBER = #{number,jdbcType=VARCHAR},
+      </if>
+      <if test="amt != null">
+        ACT_AMT = #{amt,jdbcType=VARCHAR},
+      </if>
+      <if test="avaAmt != null">
+        ACT_AVA_AMT = #{avaAmt,jdbcType=VARCHAR},
+      </if>
+      <if test="createUser != null">
+        ACT_CREATE_USER = #{createUser,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        ACT_CREATE_TIME = #{createTime,jdbcType=VARCHAR},
+      </if>
+      <if test="modifyUser != null">
+        ACT_MODIFY_USER = #{modifyUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifyTime != null">
+        ACT_MODIFY_TIME = #{modifyTime,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        ACT_STATE = #{state,jdbcType=VARCHAR},
+      </if>
+      <if test="equipmentId != null">
+        ACT_EQUIPMENT_ID = #{equipmentId,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where ACT_ID = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.minpay.db.table.model.VmHlAccount">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+    -->
+    update vm_hl_account
+    set ACT_CHANNEL = #{channel,jdbcType=VARCHAR},
+      ACT_USRID = #{usrid,jdbcType=VARCHAR},
+      ACT_TYPE = #{type,jdbcType=VARCHAR},
+      ACT_NAME = #{name,jdbcType=VARCHAR},
+      ACT_NUMBER = #{number,jdbcType=VARCHAR},
+      ACT_AMT = #{amt,jdbcType=VARCHAR},
+      ACT_AVA_AMT = #{avaAmt,jdbcType=VARCHAR},
+      ACT_CREATE_USER = #{createUser,jdbcType=VARCHAR},
+      ACT_CREATE_TIME = #{createTime,jdbcType=VARCHAR},
+      ACT_MODIFY_USER = #{modifyUser,jdbcType=VARCHAR},
+      ACT_MODIFY_TIME = #{modifyTime,jdbcType=VARCHAR},
+      ACT_STATE = #{state,jdbcType=VARCHAR},
+      ACT_EQUIPMENT_ID = #{equipmentId,jdbcType=VARCHAR}
+    where ACT_ID = #{id,jdbcType=VARCHAR}
+  </update>
+</mapper>