|
@@ -2,7 +2,6 @@ package com.ym.mec.collectfee.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.alibaba.fastjson.parser.Feature;
|
|
|
import com.ym.mec.collectfee.common.web.BaseController;
|
|
|
import com.ym.mec.collectfee.entity.*;
|
|
|
import com.ym.mec.collectfee.service.*;
|
|
@@ -12,10 +11,10 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
-import org.apache.ibatis.session.defaults.DefaultSqlSession;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
+import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -23,17 +22,17 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
-import java.io.SyncFailedException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Api("支付")
|
|
|
@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("yqpay")
|
|
|
+@EnableScheduling // 2.开启定时任务
|
|
|
public class YqPayController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@@ -214,15 +213,20 @@ public class YqPayController extends BaseController {
|
|
|
Integer buyCount = mecCourse4json.getBuyCount();
|
|
|
BigDecimal amount = new BigDecimal("0"); //课程总价
|
|
|
String remark = "";
|
|
|
+ List<MecCourse> pickCourses = null;
|
|
|
for (int i = 0; i < courses.size(); i++) {
|
|
|
MecCourse course = courses.get(i);
|
|
|
if (mecCourse4json.getCourseId().equals(course.getCourseId().intValue())) {
|
|
|
- BigDecimal price = course.getClassType().equals(1)? course.getPrice().multiply(BigDecimal.valueOf(buyCount)) : course.getPrice().multiply(BigDecimal.valueOf(course.getBuyCount()));
|
|
|
+ BigDecimal price = course.getClassType().equals(1) ? course.getPrice().multiply(BigDecimal.valueOf(buyCount)) : course.getPrice().multiply(BigDecimal.valueOf(course.getBuyCount()));
|
|
|
amount = amount.add(price);
|
|
|
remark += course.getClassName();
|
|
|
+ if (course.getClassType().equals(1)) {
|
|
|
+ course.setBuyCount(buyCount);
|
|
|
+ }
|
|
|
+ pickCourses.add(course);
|
|
|
}
|
|
|
}
|
|
|
- if (courses.size() == 0) {
|
|
|
+ if (pickCourses.size() == 0) {
|
|
|
return failed("请选择续费课程");
|
|
|
}
|
|
|
|
|
@@ -256,7 +260,7 @@ public class YqPayController extends BaseController {
|
|
|
List<Map> tempRoutingList = new ArrayList();
|
|
|
tempRoutingList.add(routingList);
|
|
|
|
|
|
- renewalsService.addRenewalsOrder(renewals, amount, orderNo, courses, routingMerNo, remark);
|
|
|
+ renewalsService.addRenewalsOrder(renewals, amount, orderNo, pickCourses, routingMerNo, remark);
|
|
|
|
|
|
/*订单信息*/
|
|
|
String orderBody = "大雅乐盟培训课程";
|
|
@@ -433,7 +437,7 @@ public class YqPayController extends BaseController {
|
|
|
}
|
|
|
orderService.update(order);
|
|
|
ApplyInfo applyInfo = applyInfoService.get(order.getUserId());
|
|
|
- applyInfoService.userRegister(applyInfo.getPatriarchPhone()); //推送mec
|
|
|
+ applyInfoService.userRegister(applyInfo.getPatriarchPhone(),order.getId()); //推送mec
|
|
|
|
|
|
msg.setCode("000000");
|
|
|
msg.setMsg("success");
|
|
@@ -442,9 +446,11 @@ public class YqPayController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //@Scheduled(cron = "0/3 40 11 * * ?")
|
|
|
- @RequestMapping("/getOrderStatus")
|
|
|
+ @Scheduled(cron = "0/5 * * * * ?")
|
|
|
+ //@RequestMapping("/getOrderStatus")
|
|
|
public void getOrderStatus() throws Exception {
|
|
|
+ System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
|
|
|
+
|
|
|
List<Order> payingOrders = orderService.findPayingOrders();
|
|
|
|
|
|
String merOrderNos = ""; //
|
|
@@ -494,7 +500,12 @@ public class YqPayController extends BaseController {
|
|
|
//推送mec
|
|
|
if (order.getTuiFee() != null) {
|
|
|
ApplyInfo applyInfo = applyInfoService.get(order.getUserId());
|
|
|
- applyInfoService.userRegister(applyInfo.getPatriarchPhone()); //推送mec
|
|
|
+ applyInfo.setStatus(1);
|
|
|
+ applyInfoService.update(applyInfo);
|
|
|
+ applyInfoService.userRegister(applyInfo.getPatriarchPhone(),order.getId()); //推送mec
|
|
|
+ } else {
|
|
|
+ //RenewBean renewals = renewalsService.getRenewalsByOrderId(order.getId());
|
|
|
+ //applyInfoService.pushRenew(renewals);
|
|
|
}
|
|
|
}
|
|
|
//失败减去已收款金额,减去报名人数
|