|
@@ -219,4 +219,42 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
|
|
|
public ExamRegistrationDto getExamRegistration(Integer examRegistrationId) {
|
|
|
return examRegistrationDao.getExamRegistration(examRegistrationId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Map<String, Object> repay(Integer userId, String orderNo) throws Exception {
|
|
|
+ ExamRegistrationPayment order = examRegistrationPaymentService.getByOrderNo(orderNo);
|
|
|
+ if (!order.getTransStatus().equals(TransStatusEnum.ING)) {
|
|
|
+ throw new BizException("订单不是待支付状态,请重新报名");
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ order.setTransStatus(TransStatusEnum.CLOSE);
|
|
|
+ order.setCreateTime(nowDate);
|
|
|
+ order.setUpdateTime(nowDate);
|
|
|
+ examRegistrationPaymentService.update(order);
|
|
|
+
|
|
|
+ orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
+
|
|
|
+ order.setId(null);
|
|
|
+ order.setOrderNo(orderNo);
|
|
|
+ examRegistrationPaymentService.insert(order);
|
|
|
+
|
|
|
+ ExaminationBasic examinationBasic = examinationBasicDao.get(order.getExaminationBasicId().longValue());
|
|
|
+ if (examinationBasic == null || !examinationBasic.getStatus().equals(ExamStatusEnum.APPLYING)) {
|
|
|
+ throw new BizException("项目不在报名中,请核对");
|
|
|
+ }
|
|
|
+ String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
+ Map<String, Object> payMap = payService.getPayMap(
|
|
|
+ order.getTransAmount(),
|
|
|
+ orderNo,
|
|
|
+ baseApiUrl + "/api-user/examOrder/notify",
|
|
|
+ baseApiUrl + "/api-user/examOrder/paymentResult?orderNo=" + orderNo,
|
|
|
+ examinationBasic.getName(),
|
|
|
+ examinationBasic.getName()
|
|
|
+ );
|
|
|
+ order.setTransNo((String) payMap.get("routingMerNos"));
|
|
|
+ order.setPayType((String) payMap.get("type"));
|
|
|
+ examRegistrationPaymentService.update(order);
|
|
|
+ return payMap;
|
|
|
+ }
|
|
|
}
|