Commit 4a539323 by jscat

nyx javaapp: 功能更新

1. 基于app流程, 将获取prepay_id的输入参数变为userId
parent 10c6f395
...@@ -19,5 +19,6 @@ public interface Rockwell_userService { ...@@ -19,5 +19,6 @@ public interface Rockwell_userService {
JSONResult Rockwell_userServiceReg(String userId); JSONResult Rockwell_userServiceReg(String userId);
JSONResult Rockwell_userServiceGetT_userinfo(String userId); JSONResult Rockwell_userServiceGetT_userinfo(String userId);
JSONResult webLogin(Rockwell_userT_user rockwell_userT_user); JSONResult webLogin(Rockwell_userT_user rockwell_userT_user);
Rockwell_userT_user Rockwell_userServiceGetT_user(String userId);
} }
...@@ -263,4 +263,17 @@ public class Rockwell_userServiceImpl implements Rockwell_userService { ...@@ -263,4 +263,17 @@ public class Rockwell_userServiceImpl implements Rockwell_userService {
return userName; return userName;
} }
/*
通过userid获取 Rockwell_userT_user
*/
public Rockwell_userT_user Rockwell_userServiceGetT_user(String userId)
{
Rockwell_userT_userQuery rockwell_userT_userQuery = new Rockwell_userT_userQuery();
rockwell_userT_userQuery.setId(userId);
Rockwell_userT_user user = rockwell_userMapper.queryUserByid(rockwell_userT_userQuery);
return user;
}
} }
...@@ -7,6 +7,8 @@ package cn.com.fun.nyxkey.api.web.controller; ...@@ -7,6 +7,8 @@ package cn.com.fun.nyxkey.api.web.controller;
*/ */
import cn.com.fun.nyxkey.api.common.JSONResult; import cn.com.fun.nyxkey.api.common.JSONResult;
import cn.com.fun.nyxkey.api.domain.Rockwell_userT_user;
import cn.com.fun.nyxkey.api.service.Rockwell_userService;
import cn.com.fun.nyxkey.api.utils.PayUtil; import cn.com.fun.nyxkey.api.utils.PayUtil;
import cn.com.fun.nyxkey.api.web.common.HttpRequest; import cn.com.fun.nyxkey.api.web.common.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -16,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParams; ...@@ -16,6 +18,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -58,6 +61,9 @@ public class PayApiController { ...@@ -58,6 +61,9 @@ public class PayApiController {
@Value("${weixin.notifyUrl}") @Value("${weixin.notifyUrl}")
public String notifyUrl; public String notifyUrl;
@Autowired
private Rockwell_userService userService;
private static final Logger LOGGER = LoggerFactory.getLogger(PayApiController.class); private static final Logger LOGGER = LoggerFactory.getLogger(PayApiController.class);
/** /**
...@@ -76,13 +82,13 @@ public class PayApiController { ...@@ -76,13 +82,13 @@ public class PayApiController {
*/ */
@ApiOperation(value="微信支付统一下单", notes="微信支付统一下单") @ApiOperation(value="微信支付统一下单", notes="微信支付统一下单")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "openId", value = "openId", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "userId", value = "用户名", required = true, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "money", value = "标价金额", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "money", value = "标价金额", required = true, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "body", value = "商品描述", required = true, dataType = "String", defaultValue = "1") @ApiImplicitParam(name = "body", value = "商品描述", required = true, dataType = "String", defaultValue = "1")
}) })
@RequestMapping(value = "/nyx/wx/pay/orders", method = RequestMethod.GET) @RequestMapping(value = "/nyx/wx/pay/orders", method = RequestMethod.GET)
public Map<String, Object> orders( public Map<String, Object> orders(
@RequestParam(value = "openId", required = true, defaultValue = "1") String openId, @RequestParam(value = "userId", required = true, defaultValue = "1") String userId,
@RequestParam(value = "money", required = true, defaultValue = "1") Double money, @RequestParam(value = "money", required = true, defaultValue = "1") Double money,
@RequestParam(value = "body", required = true, defaultValue = "0") String body, @RequestParam(value = "body", required = true, defaultValue = "0") String body,
HttpServletRequest request HttpServletRequest request
...@@ -115,6 +121,9 @@ public class PayApiController { ...@@ -115,6 +121,9 @@ public class PayApiController {
ip = ips[0].trim(); ip = ips[0].trim();
} }
Rockwell_userT_user user = userService.Rockwell_userServiceGetT_user(userId);
String openId = user.getOpenid();
paraMap.put("appid", appid); // 商家平台ID paraMap.put("appid", appid); // 商家平台ID
paraMap.put("body", body); // 商家名称-销售商品类目、String(128) paraMap.put("body", body); // 商家名称-销售商品类目、String(128)
paraMap.put("mch_id", mchid); // 商户ID paraMap.put("mch_id", mchid); // 商户ID
...@@ -188,7 +197,6 @@ public class PayApiController { ...@@ -188,7 +197,6 @@ public class PayApiController {
System.out.println("微信返回给回调函数的信息为:"+xml); System.out.println("微信返回给回调函数的信息为:"+xml);
if(notifyMap.get("return_code").equals("SUCCESS")){ if(notifyMap.get("return_code").equals("SUCCESS")){
if(notifyMap.get("result_code").equals("SUCCESS")){ if(notifyMap.get("result_code").equals("SUCCESS")){
String ordersSn = notifyMap.get("out_trade_no");// 商户订单号 String ordersSn = notifyMap.get("out_trade_no");// 商户订单号
...@@ -199,7 +207,6 @@ public class PayApiController { ...@@ -199,7 +207,6 @@ public class PayApiController {
* 以下是自己的业务处理------仅做参考 更新order对应字段/已支付金额/状态码 * 以下是自己的业务处理------仅做参考 更新order对应字段/已支付金额/状态码
*/ */
System.out.println("===notify===回调方法已经被调!!!"); System.out.println("===notify===回调方法已经被调!!!");
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论