From b27efc697f2f81e0d0f247a2708e58af52a5df9b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 23 十月 2025 15:14:33 +0800
Subject: [PATCH] bug修改,后台新增修改用户积分
---
cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java | 162 ++++++++++++++++++++++++++++-------------------------
1 files changed, 86 insertions(+), 76 deletions(-)
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
index 80911e2..0a35d62 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/CompetitionServiceImpl.java
@@ -22,6 +22,7 @@
import com.dsh.competition.feignclient.account.StudentClient;
import com.dsh.competition.feignclient.account.model.AppUser;
import com.dsh.competition.feignclient.account.model.Student;
+import com.dsh.competition.feignclient.account.model.TStudent;
import com.dsh.competition.feignclient.course.CoursePackagePaymentClient;
import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour;
import com.dsh.competition.feignclient.model.CompetitionUser;
@@ -285,9 +286,23 @@
paymentCompetition.setInsertTime(new Date());
paymentCompetitionService.save(paymentCompetition);
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Integer id = jsonObject.getInteger("id");
+
+ TStudent tStudent = studentClient.queryById(id);
+ if(tStudent==null || tStudent.getIdCard()==null || "".equals(tStudent.getIdCard())){
+ return ResultUtil.error("选择人员未进行实名认证!");
+ }
+
+
+ if (competition.getStartAge() > (Integer.valueOf(sdf1.format(new Date())) - Integer.valueOf(sdf1.format(tStudent.getBirthday())))) {
+ return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求");
+ }
+ if (competition.getEndAge() < (Integer.valueOf(sdf1.format(new Date())) - Integer.valueOf(sdf1.format(tStudent.getBirthday())))) {
+ return ResultUtil.error("【" + tStudent.getName() + "】年龄不符合要求");
+ }
Integer isStudent = jsonObject.getInteger("isStudent");
UserCompetition userCompetition = new UserCompetition();
userCompetition.setAppUserId(uid);
@@ -300,7 +315,10 @@
}
if (paymentCompetitionVo.getPayType() == 1) {//微信
Competition byId = competitionService.getById(paymentCompetitionVo.getId());
- Integer operatorId = byId.getOperatorId();
+ String[] split = byId.getStoreId().split(",");
+
+ Store store = storeClient.queryStoreById(Integer.valueOf(split[0]));
+ Integer operatorId = store.getOperatorId();
if (operatorId!=null && operatorId != 0){
// 运营商
String s = storeClient.getmerchantNumberByOperatorId(operatorId);
@@ -318,9 +336,13 @@
}
if (paymentCompetitionVo.getPayType() == 2) {//支付宝
+ String resSmid=smid;
// 判断当前赛事属于哪个运营商
Competition byId = competitionService.getById(paymentCompetitionVo.getId());
- Integer operatorId = byId.getOperatorId();
+ String[] split = byId.getStoreId().split(",");
+
+ Store store = storeClient.queryStoreById(Integer.valueOf(split[0]));
+ Integer operatorId = store.getOperatorId();
if (operatorId == null || operatorId == 0 ){
// 说明是平台
return aliPaymentCompetition(operatorId,smid,code, money);
@@ -406,82 +428,70 @@
* @throws Exception
*/
public ResultUtil aliPaymentCompetition(Integer operatorId,String smid,String code, BigDecimal money) throws Exception {
+ String resSmid=smid;
ResultUtil alipay = payMoneyUtil.alipay
(smid,"报名赛事", "", "", code, money.toString(), "/base/competition/aliPaymentCompetitionCallback");
-// if (alipay.getCode() == 200) {
-// new Thread(new Runnable() {
-// @Override
-// public void run() {
-// try {
-// int num = 1;
-// int wait = 0;
-// while (num <= 10) {
-// int min = 5000;
-// wait += (min * num);
-// Thread.sleep(wait);
-// PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", code).eq("payType", 2));
-// if (paymentCompetition.getPayStatus() == 2) {
-// break;
-// }
-// AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
-// if (resultUtil.getCode().equals("10000") && paymentCompetition.getPayStatus() == 1) {
-// /**
-// * WAIT_BUYER_PAY(交易创建,等待买家付款)、
-// * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
-// * TRADE_SUCCESS(交易支付成功)、
-// * TRADE_FINISHED(交易结束,不可退款)
-// */
-//// Map<String, String> data1 = resultUtil.getData();
-//// String s = data1.get("tradeStatus");
-//// String tradeNo = data1.get("tradeNo");
-// String tradeNo = resultUtil.getTradeNo();
-// String s = resultUtil.getTradeStatus();
-//
-// if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
-// paymentCompetition.setAppUserId(null);
-// paymentCompetition.setState(3);
-// userCompetitionService.remove(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId()));
-//
-// break;
-// }
-// if ("TRADE_SUCCESS".equals(s)) {
-// paymentCompetition.setAppUserId(null);
-// paymentCompetition.setPayStatus(2);
-// paymentCompetition.setPayTime(new Date());
-// paymentCompetition.setPayOrderNo(tradeNo);
-// paymentCompetitionService.updateById(paymentCompetition);
-//
-// Competition competition = cttService.getById(paymentCompetition.getCompetitionId());
-// competition.setApplicantsNumber(competition.getApplicantsNumber() + 1);
-// cttService.updateById(competition);
-//
-// // 结算资金到商户账号
-// payMoneyUtil.confirm(smid,code,tradeNo,money.toString());
-// if (operatorId == null || operatorId == 0){
-// // 属于平台的赛事 资金不做冻结 不做分账处理
-// payMoneyUtil.confirm1(smid,code,tradeNo,money.toString());
-// }else{
-// // 资金冻结
-// payMoneyUtil.confirm(smid,code,tradeNo,money.toString());
-// // 分账处理
-// extracted(operatorId, money, tradeNo);
-// }
-// // 结算资金到商户账号
-// //分账
-//// moneyOut(tradeNo, tradeNo,code);
-// break;
-// }
-// if ("WAIT_BUYER_PAY".equals(s)) {
-// num++;
-// }
-// }
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-// }).start();
-// }
+ if (alipay.getCode() == 200) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ int num = 1;
+ int wait = 0;
+ while (num <= 10) {
+ int min = 5000;
+ wait += (min * num);
+ Thread.sleep(wait);
+ PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", code).eq("payType", 2));
+ if (paymentCompetition.getPayStatus() == 2) {
+ break;
+ }
+ AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
+ if (resultUtil.getCode().equals("10000") && paymentCompetition.getPayStatus() == 1) {
+ /**
+ * WAIT_BUYER_PAY(交易创建,等待买家付款)、
+ * TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
+ * TRADE_SUCCESS(交易支付成功)、
+ * TRADE_FINISHED(交易结束,不可退款)
+ */
+// Map<String, String> data1 = resultUtil.getData();
+// String s = data1.get("tradeStatus");
+// String tradeNo = data1.get("tradeNo");
+ String tradeNo = resultUtil.getTradeNo();
+ String s = resultUtil.getTradeStatus();
+
+ if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
+ paymentCompetition.setAppUserId(null);
+ paymentCompetition.setState(3);
+ userCompetitionService.remove(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId()));
+
+ break;
+ }
+ if ("TRADE_SUCCESS".equals(s)) {
+ paymentCompetition.setAppUserId(null);
+ paymentCompetition.setPayStatus(2);
+ paymentCompetition.setPayTime(new Date());
+ paymentCompetition.setPayOrderNo(tradeNo);
+ paymentCompetitionService.updateById(paymentCompetition);
+ Competition competition = cttService.getById(paymentCompetition.getCompetitionId());
+ competition.setApplicantsNumber(competition.getApplicantsNumber() + 1);
+ cttService.updateById(competition);
+ // 结算资金到商户账号
+ Thread.sleep(30000);
+ payMoneyUtil.confirm(resSmid,code,tradeNo,money.toString());
+ break;
+ }
+ if ("WAIT_BUYER_PAY".equals(s)) {
+ num++;
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ }
return alipay;
}
private void extracted(Integer operatorId, BigDecimal money, String tradeNo) throws Exception {
--
Gitblit v1.7.1