瀏覽代碼

Merge branch 'master' of http://git.dayaedu.com/yonge/cooleshow

liujunchi 3 年之前
父節點
當前提交
6d7ace2c6c

+ 38 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/sdk/WithdrawSdk.java

@@ -50,6 +50,8 @@ public class WithdrawSdk {
     //结算第三方url
     @Value("${withdraw.apiUrl}")
     private String apiUrl;
+    @Value("${withdraw.privateKey}")
+    private String privateKey;
 
     /**
      * 签署协议
@@ -243,4 +245,40 @@ public class WithdrawSdk {
         }
         return null;
     }
+
+    /**
+     * 查询商户余额(单位为:分,范围:1~10000000000)
+     * @return
+     */
+    public String balanceQuery(){
+        Map<String, Object> requestMap = new HashMap<>();
+        requestMap.put("outMemberNo", memberNo);
+        requestMap.put("charset", "UTF-8");
+        requestMap.put("service", "bpotop.zx.pay.order");
+        requestMap.put("version", "2.0");
+        requestMap.put("signType", "RSA");
+
+        String jsonStr = JSONObject.toJSONString(requestMap);
+        String encryptStr = null;
+        try {
+            encryptStr = RSA.encryptPub(jsonStr, publicKey);
+            requestMap.put("sign", encryptStr);
+            logger.info("查询余额请求参数:{}", requestMap);
+        } catch (Exception e) {
+            throw new ThirdpartyException("加密失败:{}", e.getMessage());
+        }
+
+        String resultJsonStr = null;
+        try {
+            resultJsonStr = HttpUtil.postForHttp(apiUrl + "/bpotop_trade/balance_query", JSONObject.toJSONString(requestMap), null);
+            logger.info("查询余额响应参数:{}", resultJsonStr);
+
+            String decryptStr = RSA.decryptPri(resultJsonStr, privateKey);
+            Map stringToMap =  JSONObject.parseObject(decryptStr);
+            return String.valueOf(stringToMap.get("balance"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml

@@ -746,7 +746,7 @@
         </if>
     </select>
     <select id="studentSign" resultType="com.yonge.cooleshow.biz.dal.vo.StudentSignVo">
-        SELECT
+        SELECT DISTINCT
         p.course_id_ AS courseId,
         p.user_id_ AS userId,
         u.username_ AS userName,