|
@@ -651,7 +651,7 @@ public class YqPayController extends BaseController {
|
|
|
return;
|
|
|
}
|
|
|
Calendar beforeTime = Calendar.getInstance();
|
|
|
- beforeTime.add(Calendar.MINUTE, -15);// 5分钟之前的时间
|
|
|
+ beforeTime.add(Calendar.MINUTE, -30);// 30分钟之前的时间
|
|
|
Date beforeDate = beforeTime.getTime();
|
|
|
Map<String, Object> rqMap = new HashMap<>();
|
|
|
rqMap.put("orderNoList", orderNoList);
|
|
@@ -687,29 +687,39 @@ public class YqPayController extends BaseController {
|
|
|
* @return String
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
-// @ApiOperation(value = "续费支付", notes = "续费支付")
|
|
|
+// @ApiOperation(value = "双11活动小课续费支付", notes = "双11活动小课续费支付")
|
|
|
@PostMapping("/promotionPay")
|
|
|
- public Object promotionPay(@ModelAttribute @Validated Renewals renewals) throws Exception {
|
|
|
- MecUser mecUser = applyInfoService.findMecUser(renewals.getUserId());
|
|
|
+ public Object promotionPay(Integer userId,Integer BranchId,BigDecimal amount) throws Exception {
|
|
|
+ MecUser mecUser = applyInfoService.findMecUser(userId);
|
|
|
if (mecUser == null) {
|
|
|
return failed("续费用户不存在");
|
|
|
}
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("branchRule.json"); //规则json
|
|
|
String branchRuleJson = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
|
|
|
- List<BranchRule> branchRules = JSONArray.parseObject(branchRuleJson, List.class);
|
|
|
+ List<BranchRule> branchRules = JSONObject.parseArray(branchRuleJson, BranchRule.class);
|
|
|
|
|
|
- BigDecimal amount = new BigDecimal("0");
|
|
|
+ BigDecimal price = new BigDecimal("0");
|
|
|
for (BranchRule branchRule : branchRules) {
|
|
|
if (!branchRule.getBranchId().equals(mecUser.getBranchId())) continue;
|
|
|
- amount = branchRule.getBranchPrice();
|
|
|
+ price = branchRule.getBranchPrice();
|
|
|
}
|
|
|
|
|
|
- if (!amount.equals(renewals.getPay())) {
|
|
|
- return failed("金额有误!请勿非法请求");
|
|
|
+ if (price.equals(new BigDecimal(0))) {
|
|
|
+ price = new BigDecimal("180");
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal courseAmount;
|
|
|
+ BigDecimal courseTimes = new BigDecimal("20");
|
|
|
+
|
|
|
+ if (price.compareTo(new BigDecimal("220")) >= 0) {
|
|
|
+ courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("1111")).add(new BigDecimal("111"));
|
|
|
+ } else {
|
|
|
+ courseAmount = price.multiply(courseTimes).subtract(new BigDecimal("777")).add(new BigDecimal("11.11"));
|
|
|
}
|
|
|
- if (amount.equals(new BigDecimal(0))) {
|
|
|
- return failed("分部没有相应的活动");
|
|
|
+
|
|
|
+ if (!courseAmount.equals(amount)) {
|
|
|
+ return failed("金额有误!请勿非法请求");
|
|
|
}
|
|
|
|
|
|
String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
|
|
@@ -727,13 +737,13 @@ public class YqPayController extends BaseController {
|
|
|
@RequestMapping("/getPayStatus")
|
|
|
public Object getPayStatus(String orderNo) throws Exception {
|
|
|
Order order = orderService.getOrderStatusByOrderNo(orderNo);
|
|
|
- if(order == null){
|
|
|
+ if (order == null) {
|
|
|
return failed("订单信息不存在");
|
|
|
}
|
|
|
- if(order.getStatus().equals(2)){
|
|
|
+ if (order.getStatus().equals(2)) {
|
|
|
return succeed("SUCCESS");
|
|
|
}
|
|
|
- if(order.getStatus().equals(1)){
|
|
|
+ if (order.getStatus().equals(1)) {
|
|
|
return succeed("ING");
|
|
|
}
|
|
|
return succeed("FAIL");
|