suochencheng 6 年 前
コミット
2d52fbea6f

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/PlayerInfoMapper.java

@@ -47,5 +47,7 @@ public interface PlayerInfoMapper {
     int overTimePlayer(PlayerInfo record);
 
     List<PlayerInfo> querySettlementPlayer(PlayerInfo record);
+
+    PlayerInfo queryErrorPlayerInfo(Integer userId);
 }
 

+ 15 - 0
src/main/java/com/izouma/awesomeadmin/dao/PlayerInfoMapper.xml

@@ -1597,6 +1597,21 @@
 
     </update>
 
+    <select id="queryErrorPlayerInfo" resultType="com.izouma.awesomeadmin.model.PlayerInfo">
+        SELECT player_info.*
+        FROM player_info
+                 JOIN house_info ON player_info.house_id = house_info.id
+        WHERE player_info.begin_time IS NOT NULL
+          AND player_info.del_flag = 'N'
+          AND player_info.status_flag = 2
+          AND player_info.user_id = #{userId}
+          AND house_info.del_flag = 'N'
+          AND house_info.status_flag = 2
+        ORDER BY player_info.id DESC
+        LIMIT 1
+    </select>
+
+
 
     <resultMap id="PagePlayerInfoResult" type="com.izouma.awesomeadmin.model.PlayerInfo" extends="BaseResultMap">
 

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/PlayerInfoService.java

@@ -44,5 +44,7 @@ public interface PlayerInfoService {
     Result receiveBonus(PlayerInfo record);
 
     int endNum(PlayerInfo record);
+
+    PlayerInfo getErrorPlayerInfo(Integer id);
 }
 

+ 12 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/PlayerInfoServiceImpl.java

@@ -373,5 +373,17 @@ public class PlayerInfoServiceImpl implements PlayerInfoService {
 
         return new Result(false, "领取失败");
     }
+
+    @Override
+    public PlayerInfo getErrorPlayerInfo(Integer userId) {
+        logger.info("getErrorPlayerInfo");
+        try {
+            return playerInfoMapper.queryErrorPlayerInfo(userId);
+        } catch (Exception e) {
+            logger.error("getErrorPlayerInfo", e);
+        }
+        return null;
+    }
+
 }
 

+ 14 - 0
src/main/java/com/izouma/awesomeadmin/web/PlayerInfoController.java

@@ -5,8 +5,10 @@ import com.izouma.awesomeadmin.dto.Page;
 import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.HouseInfo;
 import com.izouma.awesomeadmin.model.PlayerInfo;
+import com.izouma.awesomeadmin.model.UserInfo;
 import com.izouma.awesomeadmin.service.*;
 import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authz.annotation.RequiresAuthentication;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -378,5 +380,17 @@ public class PlayerInfoController {
         }
         return new Result(false, "");
     }
+
+    @RequestMapping(value = "/getErrorPlayerInfo")
+    @ResponseBody
+    public Result getErrorPlayerInfo() {
+        UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
+        PlayerInfo playerInfo = playerInfoService.getErrorPlayerInfo(userInfo.getId());
+        if (playerInfo != null) {
+            return new Result(true, playerInfo);
+        }
+        return new Result(false, "失败");
+    }
+
 }
 

+ 74 - 0
src/main/java/com/izouma/weixin/web/LeYunFuController.java

@@ -226,6 +226,80 @@ public class LeYunFuController {
 
     }
 
+    @RequestMapping(value = "/appUnifiedOrder", method = RequestMethod.GET)
+    @ResponseBody
+    public Map<String, String> appUnifiedOrder(@RequestParam(required = true, value = "userId") String userId,
+                                               @RequestParam(required = true, value = "productId") String productId,
+                                               @RequestParam(required = true, value = "ip") String ip) {
+        try {
+
+
+            double cash = 1;
+
+            ProductInfo productInfo = productInfoService.getProductInfoById(productId);
+
+            cash = productInfo.getMoney().doubleValue();
+
+            int total = 0;
+
+
+            total = (int) (cash * 100);
+
+            //测试为一分
+            total = 1;
+
+            JSONObject attach = new JSONObject();
+            attach.put("productId", productId);
+            attach.put("userId", userId);
+            attach.put("cash", cash);
+            attach.put("total", total);
+
+
+            String out_trade_no = MbappUtil.create_out_trade_no();
+            String nonceStr = MbappUtil.create_nonce_str();
+
+
+            Map<String, String> params = new TreeMap<>();
+            params.put("mch_id", PropertiesFileLoader.getProperties("leyunfu_mch_id"));                     //商户号
+            params.put("nonce_str", nonceStr);                 //随机串
+            params.put("amount", String.valueOf(total));                       //金额 单位分
+            params.put("body", productInfo.getProductName());            //商品或支付单简要描述
+            params.put("out_trade_no", out_trade_no);           //商户系统内部的订单号
+            params.put("notify_url", PropertiesFileLoader.getProperties("leyunfu_return_url"));     //接收支付结果异步通知回调地址
+            params.put("spbill_create_ip", ip);        //客户端IP
+            params.put("return_url", PropertiesFileLoader.getProperties("leyunfu_notify_url"));    //页面回调地址
+            params.put("payment_type", "trade.weixin.app");   //支付类型
+            params.put("attach", attach.toString());   //附加数据
+
+
+            String signSrc = getSignSrc(params);
+            String sign = DigestUtils.md5Hex(signSrc + "&key=" + PropertiesFileLoader.getProperties("leyunfu_mch_secret"));
+            params.put("sign_type", "MD5");                     //签名方式
+            params.put("sign", sign);                           //签名
+
+
+            WxpayTemp wxpayTemp = new WxpayTemp();
+            wxpayTemp.setOrderId(productId);
+            wxpayTemp.setUserId(userId);
+            wxpayTemp.setCash(BigDecimal.valueOf(cash));
+            wxpayTemp.setTotalAmount(BigDecimal.valueOf(total / 100.0));
+            wxpayTemp.setOutTradeNo(out_trade_no);
+            wxpayTemp.setTypeFlag(AppConstant.Aliapi.BUY);
+            wxpayTemp.setResultCode("NOT_PAY");
+            wxpayTemp.setCreateUser("lyf");
+            wxpayTempMapper.insertSelective(wxpayTemp);
+
+            return params;
+
+        } catch (Exception e) {
+            logger.error("leyunfu下单失败", e);
+        }
+
+
+        return null;
+
+    }
+
     @RequestMapping(value = "/orderquery", method = RequestMethod.GET)
     @ResponseBody
     public String orderquery(@RequestParam(required = true, value = "out_trade_no") String out_trade_no) {

+ 4 - 1
src/main/resources/properties/outsidews.properties

@@ -28,4 +28,7 @@ leyunfu_mch_secret=fcacce7210cbb6e31bd6cd5765da2843
 leyunfu_notify_url=http://123.58.240.138:9000/lyf/notify
 leyunfu_return_url=http://123.58.240.138:9000/
 leyunfu_pay_url=https://transaction.lejiapay.com/pay/unifiedorder
-leyunfu_query_url=https://transaction.lejiapay.com/pay/orderquery
+leyunfu_query_url=https://transaction.lejiapay.com/pay/orderquery
+leyunfu_xiaochengxu_appid=wx5d635dcd3430feed
+leyunfu_xiaochengxu_id=gh_a6a98cd9b3cd
+leyunfu_xiaochengxu_name=乐云收银小助手

+ 10 - 10
src/main/resources/spring/appWebService.xml

@@ -28,17 +28,17 @@
 	<task:annotation-driven/> <!-- 定时器开关-->
 
 	<!--自动开始房间定时任务-->
-	<bean id="houseInfoTask" class="com.izouma.awesomeadmin.web.HouseInfoController"></bean>
-	<bean id="lyfTask" class="com.izouma.weixin.web.LeYunFuController"></bean>
+<!--	<bean id="houseInfoTask" class="com.izouma.awesomeadmin.web.HouseInfoController"></bean>-->
+<!--	<bean id="lyfTask" class="com.izouma.weixin.web.LeYunFuController"></bean>-->
 
-	<task:scheduled-tasks>
-		<task:scheduled ref="houseInfoTask" method="autoBegin" cron="0 0/1 * * * ? "/>
-		<task:scheduled ref="houseInfoTask" method="autoNoStartPlay" cron="0 0/2 * * * ? "/>
-		<task:scheduled ref="houseInfoTask" method="autoEnd" cron="0 0/5 * * * ? "/>
-		<task:scheduled ref="houseInfoTask" method="updateToAnalysis" cron="0 0/3 * * * ? "/>
-		<task:scheduled ref="houseInfoTask" method="autoSettlement" cron="0 0/5 * * * ? "/>
-		<task:scheduled ref="lyfTask" method="autoCheckPayResult" cron="0/5 * * * * ? "/>
-	</task:scheduled-tasks>
+<!--	<task:scheduled-tasks>-->
+<!--		<task:scheduled ref="houseInfoTask" method="autoBegin" cron="0 0/1 * * * ? "/>-->
+<!--		<task:scheduled ref="houseInfoTask" method="autoNoStartPlay" cron="0 0/2 * * * ? "/>-->
+<!--		<task:scheduled ref="houseInfoTask" method="autoEnd" cron="0 0/5 * * * ? "/>-->
+<!--		<task:scheduled ref="houseInfoTask" method="updateToAnalysis" cron="0 0/3 * * * ? "/>-->
+<!--		<task:scheduled ref="houseInfoTask" method="autoSettlement" cron="0 0/5 * * * ? "/>-->
+<!--		<task:scheduled ref="lyfTask" method="autoCheckPayResult" cron="0/5 * * * * ? "/>-->
+<!--	</task:scheduled-tasks>-->
 
 
 </beans>