Explorar o código

Merge remote-tracking branch 'origin/stock2coin' into stock2coin

qlm %!s(int64=4) %!d(string=hai) anos
pai
achega
6446f80086

+ 31 - 0
src/main/java/com/xc/controller/PayApiController.java

@@ -47,6 +47,11 @@ public class PayApiController {
     @Autowired
     IUserRechargeService iUserRechargeService;
 
+    /**
+     * 入金回调
+     * @param request
+     * @return
+     */
 
     @RequestMapping({"gpayNotify365.do"})
     @ResponseBody
@@ -68,6 +73,32 @@ public class PayApiController {
         return str;
     }
 
+
+    /**
+     * 出金回调
+     * @param request
+     * @return
+     */
+//    @RequestMapping({"gpayOutNotify365.do"})
+//    @ResponseBody
+//    public String gpayOutNotify365(HttpServletRequest request){
+//        String param= null;
+//        try {
+//            BufferedReader streamReader = new BufferedReader( new InputStreamReader(request.getInputStream(), "UTF-8"));
+//            StringBuilder responseStrBuilder = new StringBuilder();
+//            String inputStr;
+//            while ((inputStr = streamReader.readLine()) != null)
+//                responseStrBuilder.append(inputStr);
+//            JSONObject jsonObject = JSONObject.parseObject(responseStrBuilder.toString());
+//            param= jsonObject.toJSONString();
+//            log.info(param);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        String str = iUserRechargeService.doNotify365(param);
+//        return str;
+//    }
+
     @RequestMapping({"juhe1Notify.do"})
     @ResponseBody
     public void juhe1Notify(HttpServletRequest request, HttpServletResponse response) throws IOException {

+ 11 - 9
src/main/java/com/xc/dao/UserWithdrawMapper.java

@@ -7,23 +7,23 @@ import org.apache.ibatis.annotations.Param;
 
 public interface UserWithdrawMapper {
   int deleteByPrimaryKey(Integer paramInteger);
-  
+
   int insert(UserWithdraw paramUserWithdraw);
-  
+
   int insertSelective(UserWithdraw paramUserWithdraw);
-  
+
   UserWithdraw selectByPrimaryKey(Integer paramInteger);
-  
+
   int updateByPrimaryKeySelective(UserWithdraw paramUserWithdraw);
-  
+
   int updateByPrimaryKey(UserWithdraw paramUserWithdraw);
-  
+
   List findUserWithList(@Param("uid") Integer paramInteger, @Param("withStatus") String paramString);
-  
+
   List listByAgent(@Param("searchId") Integer paramInteger1, @Param("realName") String paramString, @Param("state") Integer paramInteger2);
-  
+
   List listByAdmin(@Param("agentId") Integer paramInteger1, @Param("userId") Integer paramInteger2, @Param("realName") String paramString1, @Param("state") Integer paramInteger3, @Param("beginTime") String paramString2, @Param("endTime") String paramString3);
-  
+
   BigDecimal CountSpWithSumAmtByState(Integer paramInteger);
 
   BigDecimal CountSpWithSumRmbAmtByState(Integer paramInteger);
@@ -31,4 +31,6 @@ public interface UserWithdrawMapper {
   BigDecimal CountSpWithSumAmtFeeRmbByState(Integer paramInteger);
 
   int deleteByUserId(@Param("userId") Integer paramInteger);
+
+//  UserWithdraw selectByOrdersn(@Param("ordersn")String ordersn);
 }

+ 2 - 5
src/main/java/com/xc/pojo/UserWithdraw.java

@@ -30,11 +30,12 @@ public class UserWithdraw {
     private String withMsg;
     private String agentName;
     private String phone;
+//    private String ordersn;
 
 
     public UserWithdraw(Integer id, Integer userId, String nickName, Integer agentId, BigDecimal withAmt, Date applyTime, Date transTime
             , String withName, String bankNo, String bankName, String bankAddress, Integer withStatus, BigDecimal withFee, String withMsg
-            , BigDecimal withAmtRMB, BigDecimal withFeeRMB,String agentName, String phone) {
+            , BigDecimal withAmtRMB, BigDecimal withFeeRMB,String agentName, String phone ) {
         this.id = id;
         this.userId = userId;
         this.nickName = nickName;
@@ -45,13 +46,9 @@ public class UserWithdraw {
         this.withName = withName;
         this.bankNo = bankNo;
         this.bankName = bankName;
-
         this.bankAddress = bankAddress;
-
         this.withStatus = withStatus;
-
         this.withFee = withFee;
-
         this.withMsg = withMsg;
         this.withAmtRMB = withAmtRMB;
         this.withFeeRMB = withFeeRMB;

+ 1 - 1
src/main/java/com/xc/service/impl/NewsServiceImpl.java

@@ -27,7 +27,7 @@ public class NewsServiceImpl implements NewsService {
     @Autowired
     NewsMapper newsMapper;
 
-    private static final String url = "http://hjgz.vip/img/default.png";
+    final static String url= PropertiesUtil.getProperty("news.url");
 
     @Override
     public ServerResponse<News> getApiNews(Integer num, Integer start) {

+ 4 - 4
src/main/java/com/xc/service/impl/UserRechargeServiceImpl.java

@@ -104,10 +104,10 @@ public class UserRechargeServiceImpl implements IUserRechargeService {
         if (user.getIsActive() != 2) {
             return ServerResponse.createByErrorMsg("未实名认证不能发起充币");
         }
-        ServerResponse serverResponse = checkInMoney(10, user.getId());
-        if (!serverResponse.isSuccess()) {
-            return serverResponse;
-        }
+//        ServerResponse serverResponse = checkInMoney(10, user.getId());
+//        if (!serverResponse.isSuccess()) {
+//            return serverResponse;
+//        }
         //查询支付通道
         SitePay sitePay = sitePayMapper.selectByPrimaryKey(id);
         UserRecharge userRecharge = new UserRecharge();

+ 1 - 1
src/main/java/com/xc/service/impl/UserServiceImpl.java

@@ -1217,7 +1217,7 @@ public class UserServiceImpl implements IUserService {
         PageHelper.startPage(pageNum, pageSize);
         List<AgentUser> agentUserList = this.agentUserMapper.findChildren(currentAgent.getId());
 //        List<AgentUser> agentUserList = new ArrayList<>();
-////        agentUserList.add(currentAgent);
+        agentUserList.add(currentAgent);
 //        Set<Integer> pidSet = new HashSet<>();
 //        pidSet.add(currentAgent.getId());
 //        List<AgentUser> agentUserListTemp = this.agentUserMapper.selectAgentUserList();

+ 11 - 14
src/main/java/com/xc/service/impl/UserWithdrawServiceImpl.java

@@ -133,7 +133,6 @@ public class UserWithdrawServiceImpl implements IUserWithdrawService {
             user.setEnableAmt(reckon_enable_amt);
             log.info("用户提币{},金额 = {},总资金 = {},可用资金 = {}", new Object[]{user.getId(), amt, user_all_amt, enable_amt});
             log.info("提币后,总金额={},可用资金={}", reckon_all_amt, reckon_enable_amt);
-
             int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
             if (updateUserCount > 0) {
                 log.info("修改用户资金成功");
@@ -141,23 +140,21 @@ public class UserWithdrawServiceImpl implements IUserWithdrawService {
                 log.error("修改用户资金失败");
                 throw new Exception("用户提币,修改用户资金失败");
             }
-
-            BigDecimal rmb = new BigDecimal(BigInteger.ZERO);
-            BigDecimal rmbSxf = new BigDecimal(BigInteger.ZERO);
-            BigDecimal sxf = new BigDecimal(BigInteger.ZERO);
+//            BigDecimal rmb = new BigDecimal(BigInteger.ZERO);
+//            BigDecimal rmbSxf = new BigDecimal(BigInteger.ZERO);
+//            BigDecimal sxf = new BigDecimal(BigInteger.ZERO);
             //汇率
-            StockCoin stockCoin = stockCoinMapper.getSelectCoin();
-            stockCoin.getDefaultRate();
+//            StockCoin stockCoin = stockCoinMapper.getSelectCoin();
+//            stockCoin.getDefaultRate();
 //            CoinAdminListVO coinAdminListVO = this.iStockCoinService.getSelectCoin();
 //            if (0 == coinAdminListVO.getDynamicRate()){
 //                rmb = new BigDecimal(amt).multiply(new BigDecimal(coinAdminListVO.getNowPrice()));
 //            }else {
 //                rmb = new BigDecimal(amt).multiply(coinAdminListVO.getDefaultRate());
 //            }
-
-            rmb = new BigDecimal(amt).multiply(stockCoin.getDefaultRate());
-            sxf = stockCoin.getServiceCharge().divide(new BigDecimal(100), 2 ,4).multiply(new BigDecimal(amt));
-            rmbSxf = new BigDecimal(amt).multiply(stockCoin.getDefaultRate()).multiply(stockCoin.getServiceCharge()).divide(new BigDecimal(100), 2 ,4);
+//            rmb = new BigDecimal(amt).multiply(stockCoin.getDefaultRate());
+//            sxf = stockCoin.getServiceCharge().divide(new BigDecimal(100), 2 ,4).multiply(new BigDecimal(amt));
+//            rmbSxf = new BigDecimal(amt).multiply(stockCoin.getDefaultRate()).multiply(stockCoin.getServiceCharge()).divide(new BigDecimal(100), 2 ,4);
             UserWithdraw userWithdraw = new UserWithdraw();
             userWithdraw.setUserId(user.getId());
             userWithdraw.setNickName(user.getRealName());
@@ -172,9 +169,9 @@ public class UserWithdrawServiceImpl implements IUserWithdrawService {
             userWithdraw.setWithStatus(Integer.valueOf(0));
             userWithdraw.setWithAmt(new BigDecimal(amt));
 //            BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
-            userWithdraw.setWithFee(sxf);
-            userWithdraw.setWithAmtRMB(rmb);
-            userWithdraw.setWithFeeRMB(rmbSxf);
+//            userWithdraw.setWithFee(sxf);
+//            userWithdraw.setWithAmtRMB(rmb);
+//            userWithdraw.setWithFeeRMB(rmbSxf);
             int insertCount = this.userWithdrawMapper.insert(userWithdraw);
             if (insertCount > 0) {
                 messageService.sendTopicMessage(String.format("%s提币了%s", user.getRealName(), amt));

+ 31 - 8
src/main/java/com/xc/utils/pay/GpayUtil.java

@@ -34,6 +34,8 @@ public class GpayUtil {
 	final static String return_url365 = PropertiesUtil.getProperty("gpay.return_url");
 	final static String callback_url365 = PropertiesUtil.getProperty("gpay.callback_url");
 	final static String url365 = PropertiesUtil.getProperty("gpay.url365");
+	final static String url365_out = PropertiesUtil.getProperty("gpay.url365.out");
+	final static String callback_url365_out = PropertiesUtil.getProperty("gpay.callback_url_out");
 
 
 //	public static void main(String[] args) {
@@ -62,13 +64,12 @@ public class GpayUtil {
 //		notify(data);
 //	}
 
-	public static void main(String[] args) {
+//	public static void main(String[] args) {
 //		JSONObject jb = gPay("19.00" , "778899" , "55555");
 //		System.out.println(jb.getString("msg"));
 //		JSONObject data = (JSONObject) jb.get("data");
 //		JSONObject jbb = JSON.parseObject(data.getString("result"));
 //		System.out.println(jbb.getString("url"));
-
 //		JSONArray result = data.getJSONArray("result");
 //		String url = (String)jb.get("result");
 //		System.out.println(result);
@@ -76,16 +77,16 @@ public class GpayUtil {
 //		JSONObject json = JSONObject.parseObject(data);
 //		Map<String, Object> map = (Map<String, Object>) json;
 //		String sign = sign(map, SECRET);
-//
 		//回调
 //		if (!map.get("sign").toString().equals(sign)) {
 //			System.out.println("签名不一致:"+map.get("sign").toString());
 //		}
-
 //		notify365("{\"order_status\":4,\"amount\":\"110.00\",\"orderno\":\"21123\",\"seller_name\":\"200\",\"price\":\"6.56\",\"qty\":\"16.768292\",\"sign\":\"D55BF386C8E1DC24151B014E915DCB70\",\"buyer_name\":\"无\"}");
-
-//		gPay365("130.00","202012241515","测试12241514","1211");
-	}
+//		JSONObject jb = gPay365("130.00","20201224151511","测试12241514","1211");
+//		System.out.println(jb.toString());
+//		JSONObject jb = gPay365Out("566.55", "7788991", "254","卡1","3254654","中国银行", "第一分行");
+//		System.out.println(jb.toString());
+//	}
 
 	public static JSONObject gPay(String amount , String ordersn , String phone){
 		Map<String, Object> map = new HashMap();
@@ -220,7 +221,7 @@ public class GpayUtil {
 		return getPay365Sign(map, key365);
 	}
 
-
+	//入金
 	public static JSONObject gPay365(String amount,String ordersn , String phone,String userid){
 		Map<String, Object> map = new HashMap();
 		map.put("amount", amount); // 金额
@@ -238,6 +239,28 @@ public class GpayUtil {
 		return response;
 	}
 
+	//出金
+	public static JSONObject gPay365Out(String amount,String ordersn ,String userid ,String cardname,String bankno, String bankname,String branchname){
+		Map<String, Object> map = new HashMap();
+		map.put("currency", "USDT"); // 币种
+		map.put("amount", amount); // 金额
+		map.put("orderno", ordersn); // 订单号 mch_orderid
+		map.put("shopid", shopid365);  // 商户id
+		map.put("exid", userid);  //买家id
+		map.put("cardname", cardname); //持卡人姓名
+		map.put("bankno", bankno); // 卡号
+		map.put("return_url", return_url365); //订单完成后跳转地址
+		map.put("bankname", bankname); //银行名称
+		map.put("branchname", branchname); //开户支行
+		map.put("callback_url",callback_url365);  //异步回调地址
+		// 签名
+		String sign = getPay365Sign(map, key365);
+		map.put("sign", sign);
+		JSONObject json = new JSONObject(map);
+		JSONObject response  = doPost(url365_out, json);
+		return response;
+	}
+
 
 	public static String getPay365Sign(Map<String ,Object> $params , String key){
 		String $signData = ksort($params);

+ 11 - 0
src/main/java/mappers/UserWithdrawMapper.xml

@@ -21,6 +21,7 @@
       <arg column="with_fee_rMB" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
       <arg column="agent_name" jdbcType="VARCHAR" javaType="java.lang.String" />
       <arg column="phone" jdbcType="VARCHAR" javaType="java.lang.String" />
+<!--      <arg column="ordersn" jdbcType="VARCHAR" javaType="java.lang.String" />-->
     </constructor>
   </resultMap>
   <sql id="Base_Column_List" >
@@ -207,6 +208,9 @@
       <if test="phone != null" >
         phone = #{phone,jdbcType=VARCHAR},
       </if>
+<!--      <if test="ordersn != null" >-->
+<!--        ordersn = #{ordersn,jdbcType=VARCHAR},-->
+<!--      </if>-->
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -245,6 +249,13 @@
     order by id desc
   </select>
 
+<!--  <select id="selectByOrdersn" resultMap="BaseResultMap">-->
+<!--    select-->
+<!--    <include refid="Base_Column_List" />-->
+<!--    from user_withdraw-->
+<!--    where ordersn = #{ordersn,jdbcType=VARCHAR}-->
+<!--  </select>-->
+
 
 
 

+ 5 - 0
src/main/resources/stock2guo.properties

@@ -14,6 +14,9 @@ ftp.server.http.prefix=http://qwer16888.vip/public/
 #ftp.pass=fdymdM34HHsS8iB6
 #ftp.server.http.prefix=http://www.img.yfkgzq.com/
 
+#新闻图片地址
+news.url=http://qwer16888.vip/public/
+
 # redis config start
 redis1.ip=127.0.0.1
 redis1.port=6379
@@ -165,6 +168,8 @@ gpay.return_url=http://btdct.com/homes
 gpay.callback_url=http://btdct.com/api/pay/gpayNotify365.do
 #url
 gpay.url365=https://api.pay-365.xyz/api/Ct/createOrder
+gpay.url365.out=https://api.pay-365.xyz/api/Order/merchantWithdrawal
+gpay.callback_url_out=http://btdct.com/api/pay/gpayNotify3651.do
 
 
 #websocket 订阅地址 (数据解析服务器)