|
@@ -68,7 +68,7 @@ public class YqPayController extends BaseController {
|
|
BigDecimal amount = new BigDecimal("0");
|
|
BigDecimal amount = new BigDecimal("0");
|
|
//1、判断已报名人数
|
|
//1、判断已报名人数
|
|
CourseGroupInfo courseGroupInfo = CourseGroupInfoService.get(order.getCourseId());
|
|
CourseGroupInfo courseGroupInfo = CourseGroupInfoService.get(order.getCourseId());
|
|
- if (courseGroupInfo.getRegNum() >= courseGroupInfo.getPlanNum()) {
|
|
|
|
|
|
+ if (courseGroupInfo.getRegNum().compareTo(courseGroupInfo.getPlanNum()) >= 0) {
|
|
return failed("乐团人数暂时已满,请稍后再试");
|
|
return failed("乐团人数暂时已满,请稍后再试");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -76,12 +76,12 @@ public class YqPayController extends BaseController {
|
|
BigDecimal courseFee = courseGroupInfo.getFeeAmount();
|
|
BigDecimal courseFee = courseGroupInfo.getFeeAmount();
|
|
amount = amount.add(courseFee);
|
|
amount = amount.add(courseFee);
|
|
|
|
|
|
- ClassPathResource classPathResource = new ClassPathResource("instruments.json");
|
|
|
|
|
|
+ //获取乐器的价格
|
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("instruments.json"); //解析乐器数据
|
|
|
|
|
|
BigDecimal instrumentPrice = new BigDecimal("0");//乐器价格
|
|
BigDecimal instrumentPrice = new BigDecimal("0");//乐器价格
|
|
String instrumentName = "";//乐器名称
|
|
String instrumentName = "";//乐器名称
|
|
|
|
|
|
- //获取乐器的价格
|
|
|
|
String instrumentId = order.getInstrument();
|
|
String instrumentId = order.getInstrument();
|
|
String jsonString = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
|
|
String jsonString = IOUtils.toString(new InputStreamReader(classPathResource.getInputStream(), "UTF-8"));
|
|
Instrument instrument = JSONObject.parseObject(jsonString, Instrument.class);
|
|
Instrument instrument = JSONObject.parseObject(jsonString, Instrument.class);
|
|
@@ -109,8 +109,8 @@ public class YqPayController extends BaseController {
|
|
adjunctName += (String) instrument.getAuxiliaries().get(adjunctId).get("name") + "|";
|
|
adjunctName += (String) instrument.getAuxiliaries().get(adjunctId).get("name") + "|";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
amount = amount.add(adjunctPrice);
|
|
amount = amount.add(adjunctPrice);
|
|
|
|
+
|
|
order.setGroupId(courseGroupInfo.getId());
|
|
order.setGroupId(courseGroupInfo.getId());
|
|
order.setAmount(amount);
|
|
order.setAmount(amount);
|
|
order.setRemark(instrumentName);
|
|
order.setRemark(instrumentName);
|
|
@@ -120,17 +120,17 @@ public class YqPayController extends BaseController {
|
|
order.setSdFee(adjunctPrice);
|
|
order.setSdFee(adjunctPrice);
|
|
|
|
|
|
|
|
|
|
|
|
+ String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
|
|
|
|
+ order.setOrderNo(orderNo);
|
|
|
|
+ order.setCreateTime(new Date()); //订单提交时间
|
|
|
|
+ order.setStatus(1); //订单状态
|
|
|
|
+
|
|
School school = schoolService.get(order.getClassId());
|
|
School school = schoolService.get(order.getClassId());
|
|
String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
|
|
String notifyUrl = "http://47.99.212.176:9000/yqpay/notify"; //异步通知地址
|
|
String returnUrl = "http://pay.dayaedu.com/#/login?schoolId=" + school.getSchoolId() + "&classId=" + order.getClassId() + "&cityId=" + school.getCityId();//支付后返回页面
|
|
String returnUrl = "http://pay.dayaedu.com/#/login?schoolId=" + school.getSchoolId() + "&classId=" + order.getClassId() + "&cityId=" + school.getCityId();//支付后返回页面
|
|
String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
|
|
String payUrl = "https://qyfapi.95epay.com/api/api/hPay/toPayHtml";//支付跳转页
|
|
String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
|
|
String payChannels = "{\"weChatPay\":true,\"weChatPayMobile\":false,\"aliPay\":true,\"fastpayXy\":true,\"aliPayMobile\":false,\"balancePay\":false}";//支付方式配置
|
|
|
|
|
|
- String orderNo = GenerateNum.getInstance().GenerateOrderNo(); //自己系统订单号
|
|
|
|
- order.setOrderNo(orderNo);
|
|
|
|
- order.setCreateTime(new Date()); //订单提交时间
|
|
|
|
- order.setStatus(1); //订单状态
|
|
|
|
-
|
|
|
|
//获取支付成功跟支付中的订单数
|
|
//获取支付成功跟支付中的订单数
|
|
Integer branchId = 1001;//order.getBranchId();
|
|
Integer branchId = 1001;//order.getBranchId();
|
|
int payOrderNums = orderService.getPayOrderNums();
|
|
int payOrderNums = orderService.getPayOrderNums();
|
|
@@ -542,11 +542,19 @@ public class YqPayController extends BaseController {
|
|
applyInfoService.pushRenew(renewBean);
|
|
applyInfoService.pushRenew(renewBean);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //失败减去已收款金额,减去报名人数
|
|
|
|
- if (status == 0 && order.getTuiFee() != null) {
|
|
|
|
- CourseGroupInfo courseGroupInfo = CourseGroupInfoService.get(order.getGroupId());
|
|
|
|
- courseGroupInfo.setRegNum(courseGroupInfo.getRegNum() - 1);
|
|
|
|
- CourseGroupInfoService.upByIdAndVersion(courseGroupInfo);
|
|
|
|
|
|
+ if (status == 0) {
|
|
|
|
+ //失败减去已收款金额
|
|
|
|
+ Account account = accountService.getAccountByBranchId(Integer.parseInt(order.getUAccount()));
|
|
|
|
+ BigDecimal HasRouting = account.getHasRouting().subtract(order.getAmount());
|
|
|
|
+ account.setHasRouting(HasRouting);
|
|
|
|
+ accountService.upByIdAndVersion(account);
|
|
|
|
+
|
|
|
|
+ //减去报名人数
|
|
|
|
+ if (order.getTuiFee() != null) {
|
|
|
|
+ CourseGroupInfo courseGroupInfo = CourseGroupInfoService.get(order.getGroupId());
|
|
|
|
+ courseGroupInfo.setRegNum(courseGroupInfo.getRegNum() - 1);
|
|
|
|
+ CourseGroupInfoService.upByIdAndVersion(courseGroupInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
orderService.update(order);
|
|
orderService.update(order);
|
|
}
|
|
}
|