|
@@ -28,6 +28,12 @@ import com.zhongzheng.modules.course.domain.Course;
|
|
|
import com.zhongzheng.modules.course.service.ICourseService;
|
|
|
import com.zhongzheng.modules.exam.service.IExamNoteService;
|
|
|
|
|
|
+import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
|
|
|
+import com.zhongzheng.modules.order.domain.Order;
|
|
|
+import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
+import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
import com.zhongzheng.modules.polyv.bo.PolyvVideoAddBo;
|
|
|
import com.zhongzheng.modules.polyv.bo.PolyvVideoEditBo;
|
|
|
import com.zhongzheng.modules.polyv.bo.PolyvVideoQueryBo;
|
|
@@ -105,7 +111,8 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
@Autowired
|
|
|
private IOrderPossessUserService iOrderPossessUserService;
|
|
|
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IOrderService iOrderService;
|
|
|
|
|
|
@Autowired
|
|
|
private ICourseService iCourseService;
|
|
@@ -113,6 +120,9 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
@Autowired
|
|
|
private IUserService iUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IOrderGoodsService iOrderGoodsService;
|
|
|
+
|
|
|
|
|
|
private String gzh_tokenUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
|
|
|
|
@@ -218,10 +228,10 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
String transaction_id = notifyMap.get("transaction_id");
|
|
|
String TenantId = notifyMap.get("attach");
|
|
|
ServletUtils.getRequestAttributes().getResponse().setHeader("TenantId",TenantId);
|
|
|
- /*if(dealOrder(out_trade_no,transaction_id)){
|
|
|
+ if(dealOrder(out_trade_no,transaction_id)){
|
|
|
xmlBack = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
|
|
|
return xmlBack;
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@@ -270,4 +280,29 @@ public class WxPayServiceImpl implements IWxPayService {
|
|
|
}
|
|
|
return access_token;
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean dealOrder(String out_trade_no,String transaction_id){
|
|
|
+ Order order = iOrderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderSn, out_trade_no));
|
|
|
+ if(order!=null&&order.getOrderStatus()==0){
|
|
|
+ order.setOrderStatus(Order.PAY_FULL);
|
|
|
+ order.setPayTime(DateUtils.getNowTime());
|
|
|
+ order.setTransid(transaction_id);
|
|
|
+ order.setOrderGeneral(out_trade_no);
|
|
|
+ order.setStatus(1);
|
|
|
+ if(iOrderService.updateById(order)){
|
|
|
+ OrderGoodsQueryBo bo = new OrderGoodsQueryBo();
|
|
|
+ bo.setOrderSn(out_trade_no);
|
|
|
+ List<OrderGoods> goodsList = iOrderGoodsService.list(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderSn, out_trade_no));
|
|
|
+ for (OrderGoods g : goodsList) {
|
|
|
+ g.setPayStatus(OrderGoods.PAY_FULL);
|
|
|
+ g.setGoodsReceived(g.getGoodsRealPrice()
|
|
|
+ );
|
|
|
+ iOrderGoodsService.updateById(g);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(System.currentTimeMillis());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|