订单回调 优化
This commit is contained in:
parent
52813b95a0
commit
ebb38883f7
|
|
@ -26,6 +26,7 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||||
Double statisticsIncomeMoney(@Param("time") String time, @Param("flag") Integer flag, @Param("ordersType") Integer ordersType);
|
Double statisticsIncomeMoney(@Param("time") String time, @Param("flag") Integer flag, @Param("ordersType") Integer ordersType);
|
||||||
|
|
||||||
Orders selectOrdersByCourseIdAndUserId(Long userId, Long courseId);
|
Orders selectOrdersByCourseIdAndUserId(Long userId, Long courseId);
|
||||||
|
Orders getById(Long orderId, Long userId);
|
||||||
|
|
||||||
List<Orders> selectOrdersMoneyList(Integer flag, String time);
|
List<Orders> selectOrdersMoneyList(Integer flag, String time);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.orders.dto.SummaryDTO;
|
import com.sqx.modules.orders.dto.SummaryDTO;
|
||||||
import com.sqx.modules.orders.entity.Orders;
|
import com.sqx.modules.orders.entity.Orders;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
public interface OrdersService extends IService<Orders> {
|
public interface OrdersService extends IService<Orders> {
|
||||||
/**
|
/**
|
||||||
* 处理所有订单
|
* 处理所有订单
|
||||||
|
|
@ -14,6 +16,8 @@ public interface OrdersService extends IService<Orders> {
|
||||||
*/
|
*/
|
||||||
Result insertOrders(Orders orders);
|
Result insertOrders(Orders orders);
|
||||||
|
|
||||||
|
Orders getById(Long orderId, Long userId);
|
||||||
|
|
||||||
Result payMoney(Long orderId);
|
Result payMoney(Long orderId);
|
||||||
|
|
||||||
Result insertCourseOrders(Long courseId, Long courseDetailsId, Long userId);
|
Result insertCourseOrders(Long courseId, Long courseDetailsId, Long userId);
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,12 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Orders getById(Long orderId, Long userId) {
|
||||||
|
return baseMapper.getById(orderId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result insertOrders(Orders orders) {
|
public Result insertOrders(Orders orders) {
|
||||||
//如果订单的种类是短剧
|
//如果订单的种类是短剧
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.sqx.common.annotation.Debounce;
|
import com.sqx.common.annotation.Debounce;
|
||||||
import com.sqx.common.annotation.Limiting;
|
import com.sqx.common.annotation.Limiting;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||||
import com.sqx.modules.app.service.UserMoneyService;
|
import com.sqx.modules.app.service.UserMoneyService;
|
||||||
import com.sqx.modules.app.service.UserService;
|
import com.sqx.modules.app.service.UserService;
|
||||||
|
|
@ -78,9 +79,10 @@ public class WuyouController {
|
||||||
|
|
||||||
@Debounce(interval = 1000, value = "#orderId")
|
@Debounce(interval = 1000, value = "#orderId")
|
||||||
@ApiOperation("支付订单")
|
@ApiOperation("支付订单")
|
||||||
|
@Login
|
||||||
@GetMapping("/payOrder/{orderId}")
|
@GetMapping("/payOrder/{orderId}")
|
||||||
public Result payOrder(HttpServletRequest request, @PathVariable("orderId") Long orderId, @RequestParam(value = "payType", required = false) String payType) {
|
public Result payOrder(HttpServletRequest request,@RequestAttribute("userId") Long userId, @PathVariable("orderId") Long orderId, @RequestParam(value = "payType", required = false) String payType) {
|
||||||
Orders order = ordersService.getById(orderId);
|
Orders order = ordersService.getById(orderId,userId);
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
return Result.error("订单不存在");
|
return Result.error("订单不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -142,16 +144,15 @@ public class WuyouController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询订单支付结果")
|
@ApiOperation("查询订单支付结果")
|
||||||
|
@Login
|
||||||
@GetMapping("/queryOrder/{orderId}")
|
@GetMapping("/queryOrder/{orderId}")
|
||||||
@Debounce(value = "#orderId")
|
public Result queryOrder(HttpServletRequest request,@RequestAttribute("userId") Long userId, @PathVariable("orderId") Long orderId) {
|
||||||
@Limiting(limitNum = 20)
|
Orders order = ordersService.getById(orderId,userId);
|
||||||
public Result queryOrder(HttpServletRequest request, @PathVariable("orderId") Long orderId) {
|
|
||||||
Orders order = ordersService.getById(orderId);
|
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
return Result.error("订单不存在");
|
return Result.error("订单不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
PayDetails payDetails = payDetailsDao.selectByOrderIdAndUserId(order.getOrdersNo(),userId);
|
||||||
if (payDetails == null) {
|
if (payDetails == null) {
|
||||||
return Result.error("订单支付信息不存在");
|
return Result.error("订单支付信息不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -160,17 +161,17 @@ public class WuyouController {
|
||||||
return Result.success().put("data", 1);
|
return Result.success().put("data", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseResp baseResp = wuyouPay.queryOrder(payDetails.getTradeNo(), order.getUserId(), order.getPayMoney().toString(), request.getHeader("User-Agent"));
|
// BaseResp baseResp = wuyouPay.queryOrder(payDetails.getTradeNo(), order.getUserId(), order.getPayMoney().toString(), request.getHeader("User-Agent"));
|
||||||
if (baseResp.getCode() == null || baseResp.getCode() != 200) {
|
// if (baseResp.getCode() == null || baseResp.getCode() != 200) {
|
||||||
return Result.success().put("data", 0);
|
// return Result.success().put("data", 0);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if ("SUCCESS".equals(baseResp.getPayStatus())) {
|
// if ("SUCCESS".equals(baseResp.getPayStatus())) {
|
||||||
payDetails.setThirdOrderNo(baseResp.getData().getOrder_sn());
|
// payDetails.setThirdOrderNo(baseResp.getData().getOrder_sn());
|
||||||
// ordersTask.updateOrderStatus(payDetails, order);
|
//// ordersTask.updateOrderStatus(payDetails, order);
|
||||||
return Result.success().put("data", 1);
|
// return Result.success().put("data", 1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return Result.success().put("data", 0);
|
return Result.success().put("data", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ public interface PayDetailsDao extends BaseMapper<PayDetails> {
|
||||||
PayDetails selectByRemark(@Param("remark") String remark);
|
PayDetails selectByRemark(@Param("remark") String remark);
|
||||||
|
|
||||||
PayDetails selectByOrderId(@Param("orderId") String orderId);
|
PayDetails selectByOrderId(@Param("orderId") String orderId);
|
||||||
|
PayDetails selectByOrderIdAndUserId(@Param("orderId") String orderId, @Param("userId") Long userId);
|
||||||
PayDetails selectOneByLimit(@Param("orderId") String ordersNo);
|
PayDetails selectOneByLimit(@Param("orderId") String ordersNo);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,10 @@
|
||||||
select * from orders where user_id=#{userId} and course_id=#{courseId} and status=1 order by create_time desc limit 1
|
select * from orders where user_id=#{userId} and course_id=#{courseId} and status=1 order by create_time desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getById" resultType="com.sqx.modules.orders.entity.Orders">
|
||||||
|
select * from orders where user_id=#{userId} and orders_id=#{orderId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectOrdersMoneyList" resultType="com.sqx.modules.orders.entity.Orders">
|
<select id="selectOrdersMoneyList" resultType="com.sqx.modules.orders.entity.Orders">
|
||||||
select o.*,c.title from orders o
|
select o.*,c.title from orders o
|
||||||
left join tb_user u on u.user_id=o.user_id
|
left join tb_user u on u.user_id=o.user_id
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
select * from pay_details d where d.order_id=#{orderId}
|
select * from pay_details d where d.order_id=#{orderId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByOrderIdAndUserId" resultType="com.sqx.modules.pay.entity.PayDetails">
|
||||||
|
select * from pay_details d where d.order_id=#{orderId} and d.user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectOneByLimit" resultType="com.sqx.modules.pay.entity.PayDetails">
|
<select id="selectOneByLimit" resultType="com.sqx.modules.pay.entity.PayDetails">
|
||||||
select * from pay_details d where d.order_id=#{orderId} order by id desc limit 1
|
select * from pay_details d where d.order_id=#{orderId} order by id desc limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue