dos 1 сар өмнө
parent
commit
58d40e43ab

+ 12 - 0
game-business/pom.xml

@@ -59,6 +59,18 @@
             <artifactId>game-system</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>xml-apis</groupId>
+                    <artifactId>xml-apis</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 85 - 3
game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java

@@ -1,20 +1,30 @@
 package com.game.business.controller;
 
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
-import com.game.business.domain.AppUser;
-import com.game.business.domain.FinTranRecord;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.game.business.domain.*;
+import com.game.business.service.IAppChargeChannelService;
 import com.game.business.service.IAppUserService;
+import com.game.business.service.IAppUsersCashAccountService;
 import com.game.business.task.AppUserCountTask;
+import com.game.business.util.other.PayOrderUtils;
+import com.game.common.annotation.Anonymous;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.FinTranAddedInfo;
 import com.game.common.constant.finance.FinTranType1;
 import com.game.common.constant.finance.FinTranType3;
 import com.game.common.constant.finance.TranCurrencyType;
 import com.game.common.core.domain.R;
+import com.game.common.exception.ServiceException;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -33,10 +43,10 @@ import com.game.common.annotation.DataSource;
 import com.game.common.enums.DataSourceType;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import com.game.business.domain.AppUsersCashrecord;
 import com.game.business.service.IAppUsersCashrecordService;
 import com.game.common.utils.poi.ExcelUtil;
 import com.game.common.core.page.TableDataInfo;
+import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * 提现记录Controller
@@ -58,6 +68,12 @@ public class AppUsersCashrecordController extends BaseController
     @Autowired
     private AppUserCountTask appUserCountTask;
 
+    @Autowired
+    private IAppUsersCashAccountService appUsersCashAccountService;
+
+    @Autowired
+    private IAppChargeChannelService appChargeChannelService;
+
     /**
      * 查询提现记录列表
      */
@@ -136,6 +152,41 @@ public class AppUsersCashrecordController extends BaseController
         if(rest < 1){
             return R.fail("审核失败");
         }
+        if(1 == appUsersCashrecord.getStatus().intValue() && null != appUsersCashrecord.getCashChannelId() && appUsersCashrecord.getCashChannelId() > 0){
+            //审核通过
+            AppChargeChannel appChargeChannel = appChargeChannelService.selectAppChargeChannelById(appUsersCashrecord.getCashChannelId());
+            if(null == appChargeChannel && StringUtils.isNotBlank(appChargeChannel.getChannelKey())){
+                String extra = "";
+                if(Arrays.asList("8092","8095").contains(appChargeChannel.getChannelKey())){
+                    //钱包提现
+                    extra = appUsersCashrecord.getAccount();
+                }else{
+                    AppUsersCashAccount appUsersCashAccount = appUsersCashAccountService.selectAppUsersCashAccountById(appUsersCashrecord.getCashAccountId());
+                    if(null != appUsersCashAccount) {
+                        JSONObject jsonObject = new JSONObject();
+                        jsonObject.put("cardNumber", appUsersCashrecord.getAccount());
+                        jsonObject.put("bankName", appUsersCashrecord.getAccountBank());
+                        jsonObject.put("branchName", appUsersCashAccount.getBranch());
+                        jsonObject.put("ownerName", appUsersCashAccount.getName());
+                    }else{
+                        logger.info("调起第三方失败,用户提现账号不存在");
+                        throw new Exception("审核失败,用户提现账号不存在");
+                    }
+                }
+                Double amount = (appUsersCashrecord.getMoney().doubleValue() - appUsersCashrecord.getService().doubleValue()) * 100;
+                Map<String, Object> map = PayOrderUtils.getPayUrl(String.valueOf(appUsersCashrecord.getOrderno()),appChargeChannel.getChannelKey(),amount.intValue(),extra);
+                String url = "";
+                if("1".equals(String.valueOf(map.get("code")))){
+                    url = map.get("data").toString();
+                    AppUsersCashrecord cashRecord = new AppUsersCashrecord();
+                    cashRecord.setId(appUsersCashrecord.getId());
+                    cashRecord.setCashOutStatus(3L); //转出中
+                    appUsersCashrecordService.updateAppUsersCashrecord(cashRecord);
+                }else{
+                    throw new ServiceException("发起支付失败: " + map.get("msg"));
+                }
+            }
+        }
         if(2 == appUsersCashrecord.getStatus().intValue()){
 
             //审核驳回 回退用户金额
@@ -164,4 +215,35 @@ public class AppUsersCashrecordController extends BaseController
     {
         return toAjax(appUsersCashrecordService.deleteAppUsersCashrecordByIds(ids));
     }
+
+    @ApiOperation(value = "第三方支付回调", notes = "第三方支付回调  1校验成功")
+    @RequestMapping(value = "/otherCallback")
+    @Anonymous
+    public String otherPayCallBack(@ApiIgnore HttpServletRequest request) {
+        Map<String, Object> map =  PayOrderUtils.getOrderStatus(request);
+        if("1".equals(String.valueOf(map.get("code")))){
+            //支付回调成功
+            String orderNo = map.get("data").toString();
+            String tradeNo = map.get("tradeNo").toString();
+            //验证回调订单
+            Map<String, Object> checkMap = PayOrderUtils.checkOrder(orderNo,tradeNo);
+            if(!"1".equals(String.valueOf(checkMap.get("code")))){
+                return "failed";
+            }
+            LambdaQueryWrapper<AppUsersCashrecord> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(AppUsersCashrecord::getOrderno,orderNo);
+            AppUsersCashrecord appUsersCashrecord = appUsersCashrecordService.getOne(queryWrapper);
+            if(null == appUsersCashrecord){
+                return "failed";
+            }
+            AppUsersCashrecord update = new AppUsersCashrecord();
+            update.setId(appUsersCashrecord.getId());
+            update.setCashOutStatus(1L);
+            update.setCashOutOrderId(tradeNo);
+            appUsersCashrecordService.updateAppUsersCashrecord(update);
+            return "success";
+        }else{
+            return "failed";
+        }
+    }
 }

+ 5 - 0
game-business/src/main/java/com/game/business/domain/AppUsersCashAccount.java

@@ -75,6 +75,11 @@ private static final long serialVersionUID=1L;
     @TableField(value = "type")
     private Long type;
 
+    @ApiModelProperty(value = "渠道id")
+    @Excel(name = "渠道id")
+    @TableField(value = "channelId")
+    private Long channelId;
+
     /** 用户ID */
     @ApiModelProperty(value = "用户ID")
     @Excel(name = "用户ID")

+ 12 - 0
game-business/src/main/java/com/game/business/domain/AppUsersCashrecord.java

@@ -113,6 +113,18 @@ private static final long serialVersionUID=1L;
     @TableField(value = "cash_type")
     private Long cashType;
 
+    /** 提现渠道id */
+    @ApiModelProperty(value = "提现渠道id")
+    @Excel(name = "提现渠道id")
+    @TableField(value = "cash_channel_id")
+    private Long cashChannelId;
+
+    /** 提现账号id */
+    @ApiModelProperty(value = "提现账号id")
+    @Excel(name = "提现账号id")
+    @TableField(value = "cash_account_id")
+    private Long cashAccountId;
+
     /** 公会ID */
     @ApiModelProperty(value = "公会ID")
     @Excel(name = "公会ID")

+ 48 - 0
game-business/src/main/java/com/game/business/util/other/MD5.java

@@ -0,0 +1,48 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.game.business.util.other;
+
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.UnsupportedEncodingException;
+
+public class MD5 {
+    public MD5() {
+    }
+
+    public static void main(String[] args) {
+        String str = "appId=wx8632a91376b81e24&callback_url=http://u.shdplan.com/usr/details.html?paySuc=true&awaId=AID201508100946430003&money=1.99&nonceStr=1441076469693&package=prepay_id=wx2015090111010993f0dd52c80787614418&signType=MD5&status=0&timeStamp=1441076469693";
+        System.out.println(sign(str, "&key=8748fd966d0ffc47abd59e97", "utf-8"));
+    }
+
+    public static String sign(String text, String key, String input_charset) {
+        text = text + key;
+        System.out.println(text);
+        return DigestUtils.md5Hex(getContentBytes(text, input_charset)).toUpperCase();
+    }
+
+    public static String sign(String text, String input_charset) {
+        return DigestUtils.md5Hex(getContentBytes(text, input_charset)).toLowerCase();
+    }
+
+    public static boolean verify(String text, String sign, String key, String input_charset) {
+        text = text + key;
+        String mysign = DigestUtils.md5Hex(getContentBytes(text, input_charset));
+        return mysign.equals(sign);
+    }
+
+    private static byte[] getContentBytes(String content, String charset) {
+        if (charset != null && !"".equals(charset)) {
+            try {
+                return content.getBytes(charset);
+            } catch (UnsupportedEncodingException var3) {
+                throw new RuntimeException("MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset);
+            }
+        } else {
+            return content.getBytes();
+        }
+    }
+}

+ 51 - 0
game-business/src/main/java/com/game/business/util/other/MD5Util.java

@@ -0,0 +1,51 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.game.business.util.other;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+
+public class MD5Util {
+  public MD5Util() {
+  }
+
+  public static String string2MD5(String inStr) {
+    MessageDigest md5 = null;
+
+    try {
+      md5 = MessageDigest.getInstance("MD5");
+    } catch (Exception var8) {
+      var8.printStackTrace();
+      return "";
+    }
+
+    byte[] byteArray = null;
+
+    try {
+      byteArray = inStr.getBytes("utf-8");
+    } catch (UnsupportedEncodingException var7) {
+      var7.printStackTrace();
+    }
+
+    byte[] md5Bytes = md5.digest(byteArray);
+    StringBuffer hexValue = new StringBuffer();
+
+    for(int i = 0; i < md5Bytes.length; ++i) {
+      int val = md5Bytes[i] & 255;
+      if (val < 16) {
+        hexValue.append("0");
+      }
+
+      hexValue.append(Integer.toHexString(val));
+    }
+
+    return hexValue.toString();
+  }
+
+  public static void main(String[] args) {
+    System.out.println(string2MD5("amount=1100&bank_account=王海燕&bank_cardno=6222031611004591781&bank_code=102&channel_code=1054&down_sn=S01202105112233526490003&notify_url=http://baidu.com&key=562e39c8c87fa26f5dc1796f7461e1d2"));
+  }
+}

+ 134 - 0
game-business/src/main/java/com/game/business/util/other/PayHttpUtil.java

@@ -0,0 +1,134 @@
+package com.game.business.util.other;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.util.Args;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import java.io.*;
+import java.util.*;
+
+public class PayHttpUtil {
+
+    private static final Logger _log = LoggerFactory.getLogger(PayHttpUtil.class);
+
+    public static String getSign(Map<String, Object> map, String key) {
+        StringBuffer sb = new StringBuffer();
+        Set es = map.entrySet();
+        Iterator it = es.iterator();
+        String sign = "";
+
+        while(it.hasNext()) {
+            Map.Entry entry = (Map.Entry)it.next();
+            String v = (String)entry.getValue();
+            if (StringUtils.isNotBlank(v)) {
+                sb.append(v);
+            }
+        }
+
+        sign = sb.toString();
+        String signStr = sign + key;
+
+        try {
+            _log.info("待签名串:{}", new Object[]{signStr});
+            sign = MD5Util.string2MD5(signStr);
+            _log.info("签名结果:{}", new Object[]{sign});
+        } catch (Exception var8) {
+            var8.printStackTrace();
+        }
+
+        return sign;
+    }
+
+    /**
+     * InputStream转换成String
+     * 注意:流关闭需要自行处理
+     * @param entity
+     * @param encoding 编码
+     * @return String
+     * @throws Exception
+     */
+    public static String InputStreamTOString(HttpEntity entity, String encoding) throws IOException {
+        Args.notNull(entity, "Entity");
+        InputStream instream = entity.getContent();
+        if (instream == null) {
+            return null;
+        }else{
+            return new String(InputStreamTOByte(instream),encoding);
+        }
+    }
+
+    /**
+     * InputStream转换成Byte
+     * 注意:流关闭需要自行处理
+     * @param in
+     * @return byte
+     * @throws Exception
+     */
+    public static byte[] InputStreamTOByte(InputStream in) throws IOException {
+
+        int BUFFER_SIZE = 4096;
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+        byte[] data = new byte[BUFFER_SIZE];
+        int count = -1;
+
+        while((count = in.read(data,0,BUFFER_SIZE)) != -1)
+            outStream.write(data, 0, count);
+
+        data = null;
+        byte[] outByte = outStream.toByteArray();
+        outStream.close();
+
+        return outByte;
+    }
+
+    /** <一句话功能简述>
+     * <功能详细描述>request转字符串
+     * @param request
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static String parseRequst(HttpServletRequest request){
+        String body = "";
+        try {
+            ServletInputStream inputStream = request.getInputStream();
+            BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+            while(true){
+                String info = br.readLine();
+                if(info == null){
+                    break;
+                }
+                if(body == null || "".equals(body)){
+                    body = info;
+                }else{
+                    body += info;
+                }
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return body;
+    }
+
+
+    public static String getParamsFromFormDataByNames(HttpServletRequest request){
+        Map<String, String> map =new HashMap<>();
+        Enumeration<String> er = request.getParameterNames();
+        while (er.hasMoreElements()) {
+            String name = (String) er.nextElement();
+            String value = request.getParameter(name);
+            map.put(name, value);
+        }
+        return JSONObject.toJSONString(map);
+    }
+
+}
+
+
+

+ 234 - 0
game-business/src/main/java/com/game/business/util/other/PayOrderUtils.java

@@ -0,0 +1,234 @@
+package com.game.business.util.other;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public class PayOrderUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(PayOrderUtils.class);
+
+    private static final String key = "EKCAUP9FWRVGCCR2FVN3WZWVAXAQXINN45IGYD8QKVRYUYWHLRYZRKSOHY0ABEUHEW0SUVMIA1H7UCCKZ2UAC7YIPH5FZCMDPT1FTDUYFKHSU2DB3CJ24FDW97K2YPBP";
+/*    private static final String reqUrl = "http://samsunghook.xyz/api/pay/create_order";
+    private static final String queryUrl = "http://samsunghook.xyz/api/pay/query_order";*/
+    private static final String reqUrl = "http://10.0.0.11:3021/api/pay/create_order";
+    private static final String queryUrl = "http://10.0.0.11:3021/api/pay/query_order";
+    private static final String mchId = "20000380";
+    private static final String wxCode = "8086";
+    private static final String zfbCode = "8085";
+    private static final String notifyUrl = "/business/cashrecord/otherCallback";
+
+    public static Map<String, Object> getPayUrl(String orderNo, String payType, Integer amount,String extra){
+
+        String url = "http://10.0.0.14:8080";
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("code", 0);
+        resultMap.put("mgs", "获取支付地址失败!");
+        resultMap.put("data", "");
+
+        SortedMap<String, String> signMap = new TreeMap<>();
+
+        signMap.put("mchId", mchId);
+        signMap.put("productId", payType);
+        signMap.put("mchOrderNo", orderNo);
+        signMap.put("amount", amount.toString());
+        signMap.put("currency", "cny");
+        signMap.put("notifyUrl", url + notifyUrl);
+        signMap.put("subject", "gamesubject");
+        signMap.put("body", "gamebody");
+        signMap.put("reqTime", System.currentTimeMillis() + "");
+        signMap.put("version", "1.0");
+        signMap.put("extra", extra);
+
+        Map<String, String> params = SignUtils.paraFilter(signMap);
+        StringBuilder buf = new StringBuilder((params.size() +1) * 10);
+        SignUtils.buildPayParams(buf, params, false);
+        String preStr = buf.toString();
+
+        //获得签名
+        String sign = MD5.sign(preStr, "&key=" + key, "utf-8");
+        signMap.put("sign", sign);
+
+        HttpPost httpPost = new HttpPost(reqUrl);
+        CloseableHttpResponse response;
+        CloseableHttpClient client = null;
+
+        try {
+
+            String req = JSON.toJSONString(signMap);
+            logger.info("{}请求数据:{}, 请求地址:{}", new Object[]{"getPayUrl", req, reqUrl});
+
+            MultipartEntityBuilder mu = MultipartEntityBuilder.create();
+            for (String mapKey : signMap.keySet()){
+                StringBody stringBody = new StringBody(MapUtils.getString(signMap, mapKey), ContentType.TEXT_PLAIN);
+                mu.addPart(mapKey, stringBody);
+            }
+            HttpEntity reqEntity = mu.build();
+            httpPost.setEntity(reqEntity);
+
+            client = HttpClients.createDefault();
+            response = client.execute(httpPost);
+
+            if(response != null && response.getEntity() != null){
+
+                String result = PayHttpUtil.InputStreamTOString(response.getEntity(), "utf-8");
+                logger.info("{}返回数据:{}", new Object[]{"getPayUrl", result});
+
+                JSONObject jsonObject = JSON.parseObject(result);
+                String code = jsonObject.getString("retCode");
+                if(code == null || !code.equals("0")){
+                    resultMap.put("msg", "调起通道失败[通道提示:请联系客服!]");
+                }
+
+                String payUrl = jsonObject.getString("payUrl");
+                payUrl = payUrl.replaceAll("\\\\" , "");
+                resultMap.put("code", 1);
+                resultMap.put("data", payUrl);
+                return resultMap;
+            }else{
+                resultMap.put("msg", "调起通道失败[通道提示:请联系客服!]");
+            }
+
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return resultMap;
+    }
+
+    public static Map<String, Object> getOrderStatus(HttpServletRequest request) {
+
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("code", 0);
+        resultMap.put("mgs", "订单回调失败!");
+        resultMap.put("data", "");
+        resultMap.put("tradeNo", "");
+
+        Map<String, Object> params = null;
+
+        String resString;
+        try {
+            request.setCharacterEncoding("utf-8");
+            resString = PayHttpUtil.parseRequst(request);
+            logger.info("通知内容:" + resString);
+
+            if (StringUtils.isEmpty(resString)) {
+                resString = PayHttpUtil.getParamsFromFormDataByNames(request);
+                logger.info("表单通知内容:" + resString);
+            }
+
+            params = JSONObject.parseObject(resString, Map.class);
+
+        } catch (UnsupportedEncodingException var16) {
+            logger.error("处理订单支付回调】回调解析异常");
+            var16.printStackTrace();
+            return resultMap;
+        }
+
+        String returncode = params.get("status").toString();
+        String orderid = params.get("mchOrderNo").toString();
+        String tradeNo = params.get("payOrderId").toString();
+
+        if (returncode == null || (!returncode.equals("2") && !returncode.equals("3"))) {
+            logger.error("状态错误 ,payOrderId={}, status={}", new Object[]{orderid, returncode});
+            return resultMap;
+        } else {
+            Map<String, String> params1 = SignUtils.paraFilterObjectSign(params);
+            if (!SignUtils.checkParam(params1, key)) {
+                logger.error("验证签名失败. payOrderId={}, ", new Object[]{orderid});
+                return resultMap;
+            } else {
+                resultMap.put("code", 1);
+                resultMap.put("data", orderid);
+                resultMap.put("tradeNo", tradeNo);
+                return resultMap;
+            }
+        }
+    }
+
+    public static Map<String, Object> checkOrder(String orderNo, String tradeNo) {
+
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("code", 0);
+        resultMap.put("mgs", "校验订单失败!");
+
+        SortedMap<String, String> signMap = new TreeMap<>();
+
+        signMap.put("mchId", mchId);
+        signMap.put("payOrderId", tradeNo);
+        signMap.put("mchOrderNo", orderNo);
+        signMap.put("reqTime", System.currentTimeMillis() + "");
+        signMap.put("version", "1.0");
+
+        Map<String, String> params = SignUtils.paraFilter(signMap);
+        StringBuilder buf = new StringBuilder((params.size() +1) * 10);
+        SignUtils.buildPayParams(buf, params, false);
+        String preStr = buf.toString();
+
+        //获得签名
+        String sign = MD5.sign(preStr, "&key=" + key, "utf-8");
+        signMap.put("sign", sign);
+
+        HttpPost httpPost = new HttpPost(queryUrl);
+        CloseableHttpResponse response;
+        CloseableHttpClient client = null;
+
+        try {
+
+            String req = JSON.toJSONString(signMap);
+            logger.info("{}请求数据:{}, 请求地址:{}", new Object[]{"checkOrder", req, reqUrl});
+
+            MultipartEntityBuilder mu = MultipartEntityBuilder.create();
+            for (String mapKey : signMap.keySet()){
+                StringBody stringBody = new StringBody(MapUtils.getString(signMap, mapKey), ContentType.TEXT_PLAIN);
+                mu.addPart(mapKey, stringBody);
+            }
+            HttpEntity reqEntity = mu.build();
+            httpPost.setEntity(reqEntity);
+
+            client = HttpClients.createDefault();
+            response = client.execute(httpPost);
+
+            if(response != null && response.getEntity() != null){
+
+                String result = PayHttpUtil.InputStreamTOString(response.getEntity(), "utf-8");
+                logger.info("{}返回数据:{}", new Object[]{"checkOrder", result});
+
+                JSONObject jsonObject = JSON.parseObject(result);
+                String code = jsonObject.getString("retCode");
+                if(code == null || !code.equals("0")){
+                    resultMap.put("msg", "调起查询失败[通道提示:请联系客服!]");
+                }
+
+                String status = jsonObject.getString("status");
+                if("2".equals(status) || "3".equals(status)){
+                    resultMap.put("code", 1);
+                    resultMap.put("mgs", "校验订单号成功!");
+                }
+                return resultMap;
+            }else{
+                resultMap.put("msg", "调起查询失败[通道提示:请联系客服!]");
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return resultMap;
+    }
+}

+ 289 - 0
game-business/src/main/java/com/game/business/util/other/SignUtils.java

@@ -0,0 +1,289 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.game.business.util.other;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.xml.sax.InputSource;
+
+import java.io.StringReader;
+import java.net.URLEncoder;
+import java.util.*;
+
+public class SignUtils {
+    public SignUtils() {
+    }
+
+    public static boolean checkParamOld(Map<String, String> params, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParamsOld(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, "&key=" + key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static boolean checkParam(Map<String, String> params, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParams(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, "&key=" + key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static boolean checkParamKey(Map<String, String> params, String keyName, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = (String)params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParams(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, "&" + keyName + "=" + key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static boolean checkParamNot(Map<String, String> params, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = (String)params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParams(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static boolean checkParamNotObject(Map<String, Object> params, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = (String)params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParamsObject(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static boolean checkParamObject(Map<String, Object> params, String keyName, String key) {
+        boolean result = false;
+        if (params.containsKey("sign")) {
+            String sign = (String)params.get("sign");
+            params.remove("sign");
+            StringBuilder buf = new StringBuilder((params.size() + 1) * 10);
+            buildPayParamsObject(buf, params, false);
+            String preStr = buf.toString();
+            String signRecieve = MD5.sign(preStr, "&" + keyName + "=" + key, "utf-8");
+            result = sign.equalsIgnoreCase(signRecieve);
+        }
+
+        return result;
+    }
+
+    public static Map<String, String> paraFilterSign(Map<String, String> sArray) {
+        Map<String, String> result = new HashMap(sArray.size());
+        if (sArray != null && sArray.size() > 0) {
+            Iterator var2 = sArray.keySet().iterator();
+
+            while(var2.hasNext()) {
+                String key = (String)var2.next();
+                String value = (String)sArray.get(key);
+                if (value != null && !value.equals("")) {
+                    result.put(key, value);
+                }
+            }
+
+            return result;
+        } else {
+            return result;
+        }
+    }
+
+    public static Map<String, String> paraFilterObjectSign(Map<String, Object> sArray) {
+        Map<String, String> result = new HashMap(sArray.size());
+        if (sArray != null && sArray.size() > 0) {
+            Iterator<String> var2 = sArray.keySet().iterator();
+
+            while(var2.hasNext()) {
+                String key = var2.next();
+                if(sArray.get(key) != null){
+                    String value = sArray.get(key).toString();
+                    if (value != null && !value.equals("")) {
+                        result.put(key, value);
+                    }
+                }
+            }
+            return result;
+        } else {
+            return result;
+        }
+    }
+
+    public static Map<String, String> paraFilter(Map<String, String> sArray) {
+        Map<String, String> result = new HashMap(sArray.size());
+        if (sArray != null && sArray.size() > 0) {
+            Iterator var2 = sArray.keySet().iterator();
+
+            while(var2.hasNext()) {
+                String key = (String)var2.next();
+                String value = (String)sArray.get(key);
+                if (value != null && !value.equals("") && !key.equalsIgnoreCase("sign")) {
+                    result.put(key, value);
+                }
+            }
+
+            return result;
+        } else {
+            return result;
+        }
+    }
+
+    public static Map<String, Object> paraFilterObject(Map<String, Object> sArray) {
+        Map<String, Object> result = new HashMap(sArray.size());
+        if (sArray != null && sArray.size() > 0) {
+            Iterator var2 = sArray.keySet().iterator();
+
+            while(var2.hasNext()) {
+                String key = var2.next().toString();
+                String value = sArray.get(key).toString();
+                if (value != null && !value.equals("") && !key.equalsIgnoreCase("sign")) {
+                    result.put(key, value);
+                }
+            }
+
+            return result;
+        } else {
+            return result;
+        }
+    }
+
+    public static String payParamsToString(Map<String, String> payParams) {
+        return payParamsToString(payParams, false);
+    }
+
+    public static String payParamsToString(Map<String, String> payParams, boolean encoding) {
+        return payParamsToString(new StringBuilder(), payParams, encoding);
+    }
+
+    public static String payParamsToString(StringBuilder sb, Map<String, String> payParams, boolean encoding) {
+        buildPayParams(sb, payParams, encoding);
+        return sb.toString();
+    }
+
+    /**
+     * @author
+     * @param payParams
+     * @return
+     */
+    public static void buildPayParamsOld(StringBuilder sb,Map<String, String> payParams,boolean encoding){
+        List<String> keys = new ArrayList<String>(payParams.keySet());
+        Collections.sort(keys);
+        for(String key : keys){
+            if(StringUtils.isEmpty(payParams.get(key))){
+                continue;
+            }
+            sb.append(key).append("=");
+            if(encoding){
+                sb.append(urlEncode(payParams.get(key)));
+            }else{
+                sb.append(payParams.get(key));
+            }
+            sb.append("&");
+        }
+        sb.setLength(sb.length() - 1);
+    }
+
+    public static void buildPayParams(StringBuilder sb, Map<String, String> payParams, boolean encoding) {
+        List<String> keys = new ArrayList(payParams.keySet());
+        Collections.sort(keys);
+
+        for(Iterator var4 = keys.iterator(); var4.hasNext(); sb.append("&")) {
+            String key = (String)var4.next();
+            if(StringUtils.isEmpty(payParams.get(key))){
+                continue;
+            }
+            sb.append(key).append("=");
+            if (encoding) {
+                sb.append(urlEncode((String)payParams.get(key)));
+            } else {
+                sb.append((String)payParams.get(key));
+            }
+        }
+
+        sb.setLength(sb.length() - 1);
+    }
+
+    public static void buildPayParamsObject(StringBuilder sb, Map<String, Object> payParams, boolean encoding) {
+        List<String> keys = new ArrayList(payParams.keySet());
+        Collections.sort(keys);
+
+        for(Iterator var4 = keys.iterator(); var4.hasNext(); sb.append("&")) {
+            String key = (String)var4.next();
+            sb.append(key).append("=");
+            if (encoding) {
+                sb.append(urlEncode(payParams.get(key).toString()));
+            } else {
+                sb.append(payParams.get(key).toString());
+            }
+        }
+
+        sb.setLength(sb.length() - 1);
+    }
+
+    public static String urlEncode(String str) {
+        try {
+            return URLEncoder.encode(str, "UTF-8");
+        } catch (Throwable var2) {
+            return str;
+        }
+    }
+
+    public static Element readerXml(String body, String encode) throws DocumentException {
+        SAXReader reader = new SAXReader(false);
+        InputSource source = new InputSource(new StringReader(body));
+        source.setEncoding(encode);
+        Document doc = reader.read(source);
+        Element element = doc.getRootElement();
+        return element;
+    }
+
+    public static void main(String[] args) {
+        String resultStr = "{\"transaction_id\":\"20230315002838545452\",\"amount\":\"100.0000\",\"datetime\":\"20230315003947\",\"orderid\":\"P01202303150028375450000\",\"returncode\":\"00\",\"sign\":\"BAF79ABCE136E6967A432FE72C8C4D04\",\"attach\":\"\",\"memberid\":\"10127\"}";
+        Map<String, String> params =  JSONObject.parseObject(resultStr, Map.class);
+
+        if (!SignUtils.checkParam(params, "gvj63m2vzv7txe7r6cu4g3b5f06nyvao")) {
+            System.out.println("111");
+        }
+    }
+}

+ 6 - 1
game-business/src/main/resources/mapper/business/AppUsersCashAccountMapper.xml

@@ -13,11 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isDefault"    column="is_default"    />
         <result property="name"    column="name"    />
         <result property="type"    column="type"    />
+        <result property="channelId"    column="channel_id"    />
         <result property="uid"    column="uid"    />
     </resultMap>
 
     <sql id="selectAppUsersCashAccountVo">
-        select id, account, account_bank, addtime, branch, is_default, name, type, uid from app_users_cash_account
+        select id, account, account_bank, addtime, branch, is_default, name, type, uid,channel_id from app_users_cash_account
     </sql>
 
     <select id="selectAppUsersCashAccountList" parameterType="com.game.business.domain.AppUsersCashAccount" resultMap="AppUsersCashAccountResult">
@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="type != null "> and type = #{type}</if>
             <if test="uid != null "> and uid = #{uid}</if>
+            <if test="channelId != null "> and channel_id = #{channelId}</if>
         </where>
     </select>
     
@@ -50,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDefault != null">is_default,</if>
             <if test="name != null">name,</if>
             <if test="type != null">type,</if>
+            <if test="channelId != null">channel_id,</if>
             <if test="uid != null">uid,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -61,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDefault != null">#{isDefault},</if>
             <if test="name != null">#{name},</if>
             <if test="type != null">#{type},</if>
+            <if test="channelId != null">#{channelId},</if>
             <if test="uid != null">#{uid},</if>
          </trim>
     </insert>
@@ -75,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isDefault != null">is_default = #{isDefault},</if>
             <if test="name != null">name = #{name},</if>
             <if test="type != null">type = #{type},</if>
+            <if test="channelId != null">channel_id = #{channelId},</if>
             <if test="uid != null">uid = #{uid},</if>
         </trim>
         where id = #{id}

+ 11 - 1
game-business/src/main/resources/mapper/business/AppUsersCashrecordMapper.xml

@@ -35,10 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="unitType"    column="unit_type"    />
         <result property="uptime"    column="uptime"    />
         <result property="votes"    column="votes"    />
+        <result property="cashChannelId"    column="cash_channel_id"    />
+        <result property="cashAccountId"    column="cash_account_id"    />
     </resultMap>
 
     <sql id="selectAppUsersCashrecordVo">
-        select id, account, account_bank, actual_money, addtime, after_amount, auditby, before_amount, cash_out_biz_no, cash_out_order_id, cash_out_pay_order_id, cash_out_remark, cash_out_status, cash_type, guild_id, money, name, orderno, platform_service, reason, remarks, service, status, status_name, trade_no, type, uid, unit_type, uptime, votes from app_users_cashrecord
+        select id, account, account_bank, actual_money, addtime, after_amount, auditby, before_amount, cash_out_biz_no, cash_out_order_id, cash_out_pay_order_id, cash_out_remark, cash_out_status, cash_type, cash_channel_id, cash_account_id, guild_id, money, name, orderno, platform_service, reason, remarks, service, status, status_name, trade_no, type, uid, unit_type, uptime, votes from app_users_cashrecord
     </sql>
 
     <select id="selectAppUsersCashrecordList" parameterType="com.game.business.domain.AppUsersCashrecord" resultMap="AppUsersCashrecordResult">
@@ -57,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cashOutRemark != null  and cashOutRemark != ''"> and cash_out_remark = #{cashOutRemark}</if>
             <if test="cashOutStatus != null "> and cash_out_status = #{cashOutStatus}</if>
             <if test="cashType != null "> and cash_type = #{cashType}</if>
+            <if test="cashChannelId != null "> and cash_channel_id = #{cashChannelId}</if>
+            <if test="cashAccountId != null "> and cash_account_id = #{cashAccountId}</if>
             <if test="guildId != null "> and guild_id = #{guildId}</if>
             <if test="money != null "> and money = #{money}</if>
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
@@ -100,6 +104,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cashOutRemark != null">cash_out_remark,</if>
             <if test="cashOutStatus != null">cash_out_status,</if>
             <if test="cashType != null">cash_type,</if>
+            <if test="cashChannelId != null">cash_channel_id,</if>
+            <if test="cashAccountId != null">cash_account_id,</if>
             <if test="guildId != null">guild_id,</if>
             <if test="money != null">money,</if>
             <if test="name != null">name,</if>
@@ -132,6 +138,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cashOutRemark != null">#{cashOutRemark},</if>
             <if test="cashOutStatus != null">#{cashOutStatus},</if>
             <if test="cashType != null">#{cashType},</if>
+            <if test="cashChannelId != null">#{cashChannelId},</if>
+            <if test="cashAccountId != null">#{cashAccountId},</if>
             <if test="guildId != null">#{guildId},</if>
             <if test="money != null">#{money},</if>
             <if test="name != null">#{name},</if>
@@ -167,6 +175,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cashOutRemark != null">cash_out_remark = #{cashOutRemark},</if>
             <if test="cashOutStatus != null">cash_out_status = #{cashOutStatus},</if>
             <if test="cashType != null">cash_type = #{cashType},</if>
+            <if test="cashChannelId != null">cash_channel_id = #{cashChannelId},</if>
+            <if test="cashAccountId != null">cash_account_id = #{cashAccountId},</if>
             <if test="guildId != null">guild_id = #{guildId},</if>
             <if test="money != null">money = #{money},</if>
             <if test="name != null">name = #{name},</if>

+ 6 - 6
game-ui/src/views/business/cashrecord/index.vue

@@ -101,6 +101,11 @@
           <dict-tag :options="dict.type.app_user_cash_status" :value="scope.row.status"/>
         </template>
       </el-table-column>
+      <el-table-column label="转出状态" align="center" prop="cashOutStatus">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.app_user_cash_out_status" :value="scope.row.cashOutStatus"/>
+        </template>
+      </el-table-column>
       <el-table-column label="申请时间" align="center" prop="addtime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.addtime) }}</span>
@@ -113,11 +118,6 @@
       </el-table-column>
       <el-table-column label="转出备注" align="center" prop="cashOutRemark" />
       <el-table-column label="审核人" align="center" prop="auditby" />
-      <el-table-column label="账号类型" align="center" prop="type">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.app_user_cash_account" :value="scope.row.type"/>
-        </template>
-      </el-table-column>
       <el-table-column label="银行名称" align="center" prop="accountBank" />
       <el-table-column label="账号" align="center" prop="account" />
       <el-table-column label="姓名" align="center" prop="name" />
@@ -216,7 +216,7 @@ import { listCashrecord, getCashrecord, delCashrecord, addCashrecord, updateCash
 
 export default {
   name: "Cashrecord",
-  dicts: ['app_user_cash_unit', 'app_user_cash_status', 'app_cash_type', 'app_user_cash_account'],
+  dicts: ['app_user_cash_unit', 'app_user_cash_status', 'app_cash_type', 'app_user_cash_account','app_user_cash_out_status'],
   data() {
     return {
       // 遮罩层

+ 5 - 5
game-ui/src/views/business/channel/index.vue

@@ -177,8 +177,8 @@
       <el-table-column type="selection" width="55" align="center" />
 <!--      <el-table-column label="${comment}" align="center" prop="id" />-->
       <el-table-column label="名称" align="center" prop="name" />
-      <el-table-column label="渠道key" align="center" prop="channelKey" />
-      <el-table-column label="渠道编码" align="center" prop="channelNo" />
+      <el-table-column label="提现渠道" align="center" prop="channelKey" />
+      <el-table-column label="充值渠道" align="center" prop="channelNo" />
       <el-table-column label="充值手续费" align="center" prop="rate">
         <template slot-scope="scope">
           {{(scope.row.rate * 100).toFixed(2) + "%"}}
@@ -241,10 +241,10 @@
         <el-form-item label="名称" prop="name">
           <el-input v-model="form.name" placeholder="请输入名称" />
         </el-form-item>
-        <el-form-item label="渠道key" prop="channelKey">
-          <el-input v-model="form.channelKey" placeholder="请输入渠道key" />
+        <el-form-item label="提现渠道" prop="channelKey">
+          <el-input v-model="form.channelKey" placeholder="请输入渠道key" disabled/>
         </el-form-item>
-        <el-form-item label="渠道编码" prop="channelNo">
+        <el-form-item label="充值渠道" prop="channelNo">
           <el-input v-model="form.channelNo" placeholder="请输入渠道编码" />
         </el-form-item>
         <el-form-item label="充值手续费(%)" prop="rate">

+ 7 - 3
game-ui/src/views/index.vue

@@ -94,10 +94,10 @@
                 </thead>
                 <tbody>
                 <tr>
-                  <td class="el-table__cell is-leaf" rowspan="4"><div class="cell">充值总额</div></td>
+                  <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">充值总额</div></td>
                   <td class="el-table__cell is-leaf"><div class="cell">支付宝:{{getVal(getCharge('8085'),0)}}</div></td>
-                  <td class="el-table__cell is-leaf" rowspan="4"><div class="cell">充值:{{getVal(getCharge('4'),1)}}</div></td>
-                  <td class="el-table__cell is-leaf" rowspan="4"><div class="cell">总额:{{getTotal()}}</div></td>
+                  <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">充值:{{getVal(getCharge('4'),1)}}</div></td>
+                  <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">总额:{{getTotal()}}</div></td>
                 </tr>
                 <tr>
                   <td class="el-table__cell is-leaf"><div class="cell" >微信:{{getVal(getCharge('8086'),0)}}</div></td>
@@ -109,6 +109,10 @@
                 </tr>
                 <tr>
                   <td class="el-table__cell is-leaf"><div class="cell" >cbpay:{{getVal(getCharge('8088'),0)}}</div></td>
+<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                </tr>
+                <tr>
+                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡:{{getVal(getCharge('8087'),0)}}</div></td>
 <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                 </tr>
                 <tr>