|
|
|
@ -1,13 +1,17 @@ |
|
|
|
package cn.chjyj.szwh.controller.api; |
|
|
|
|
|
|
|
import cn.chjyj.szwh.bean.Order; |
|
|
|
import cn.chjyj.szwh.bean.User; |
|
|
|
import cn.chjyj.szwh.controller.BaseController; |
|
|
|
import cn.chjyj.szwh.service.OrderService; |
|
|
|
import cn.chjyj.szwh.service.UserService; |
|
|
|
import cn.chjyj.szwh.utils.RedisUtils; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@ -21,6 +25,8 @@ import java.util.Map; |
|
|
|
public class OrderController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private OrderService orderService; |
|
|
|
@Autowired |
|
|
|
private UserService userService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取订单信息 |
|
|
|
@ -80,10 +86,21 @@ public class OrderController extends BaseController { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@RequestMapping("/createOrder") |
|
|
|
public JSONObject createOrder(@RequestBody String reqString) { |
|
|
|
public JSONObject createOrder(@RequestBody String reqString, HttpServletRequest request) { |
|
|
|
String msg=""; |
|
|
|
int code=400; |
|
|
|
String sign = request.getHeader("sign"); |
|
|
|
//redis中是否存在
|
|
|
|
String r_key="createOrder_"+sign; |
|
|
|
if(StringUtils.isNotEmpty(RedisUtils.get(r_key))){ |
|
|
|
msg="请勿重复提交"; |
|
|
|
code=400; |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(reqString)){ |
|
|
|
JSONObject json = JSONObject.parseObject(reqString); |
|
|
|
|
|
|
|
String user_isli = json.getString("user_isli"); |
|
|
|
//查找对应的用户
|
|
|
|
User dbuser = userService.getUserByIsli(user_isli); |
|
|
|
} |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|