From d42f32d6c6ff2cbaab2fbdabbeefb2367e72d446 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 25 三月 2024 17:08:31 +0800
Subject: [PATCH] 新增加功能
---
cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java | 92 ++++++++++++++++++++++++++++-----------------
1 files changed, 57 insertions(+), 35 deletions(-)
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java b/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
index 21c51fa..8b004c1 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
@@ -12,7 +12,9 @@
import com.dsh.competition.entity.UserCompetition;
import com.dsh.competition.feignclient.account.AppUserClient;
import com.dsh.competition.feignclient.account.StudentClient;
+import com.dsh.competition.feignclient.account.StudentHonorClient;
import com.dsh.competition.feignclient.account.model.AppUser;
+import com.dsh.competition.feignclient.account.model.StudentHonor;
import com.dsh.competition.feignclient.account.model.TStudent;
import com.dsh.competition.feignclient.course.CoursePackagePaymentClient;
import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour;
@@ -81,6 +83,12 @@
@Autowired
private AppUserClient appUserClient;
+
+ @Resource
+ private StudentHonorClient studentHonorClient;
+
+
+
/**
* 根据门店ids 获取对应的赛事 根据赛事支付记录获取用户ids
@@ -352,13 +360,10 @@
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
-
public synchronized ResultUtil paymentCompetition(PaymentCompetitionVo paymentCompetitionVo) {
try {
Competition byId = competitionService.getById(paymentCompetitionVo.getId());
Date date = byId.getEndTime();
- // Assuming you have a Date object
- // Check if the date is past the current time
boolean isPast = date.after(new Date());
if (!isPast) {
return new ResultUtil(0, "已超过截至报名时间");
@@ -565,8 +570,9 @@
String code = map.get("out_refund_no");
String refund_id = map.get("refund_id");
String result = map.get("result");
- PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("code", code).eq("payType", 1));
- if (paymentCompetition.getPayStatus() == 1) {
+ PaymentCompetition paymentCompetition = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>()
+ .eq("code", code).eq("payType", 1));
+ if (paymentCompetition.getPayStatus() == 2) {
paymentCompetition.setPayStatus(3);
paymentCompetition.setRefundTime(new Date());
paymentCompetition.setRefundOrderNo(refund_id);
@@ -576,11 +582,12 @@
Competition competition = cttService.getById(paymentCompetition.getCompetitionId());
competition.setApplicantsNumber(competition.getApplicantsNumber() - 1);
cttService.updateById(competition);
+
+ PrintWriter out = response.getWriter();
+ out.write(result);
+ out.flush();
+ out.close();
}
- PrintWriter out = response.getWriter();
- out.write(result);
- out.flush();
- out.close();
}
} catch (Exception e) {
e.printStackTrace();
@@ -695,9 +702,27 @@
} else {
competition.setStatus(3);
}
+
+ if(competition.getStatus() == 2){
+ //添加勋章数据
+ List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>()
+ .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1));
+ Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet());
+ for (Integer integer : collect) {
+ int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>()
+ .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1));
+ StudentHonor studentHonor = new StudentHonor();
+ studentHonor.setAppUserId(integer);
+ studentHonor.setHonorType(2);
+ studentHonor.setNumber(count);
+ studentHonorClient.saveStudentHonor(studentHonor);
+ }
+ }
}
competition.setInsertTime(new Date());
cttService.save(competition);
+
+
} catch (Exception e) {
e.printStackTrace();
}
@@ -715,8 +740,26 @@
} else {
competition.setStatus(3);
}
+
+ if(competition.getStatus() == 2){
+ //添加勋章数据
+ List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>()
+ .eq("competitionId", competition.getId()).eq("payStatus", 2).eq("state", 1));
+ Set<Integer> collect = list.stream().map(PaymentCompetition::getAppUserId).collect(Collectors.toSet());
+ for (Integer integer : collect) {
+ int count = paymentCompetitionService.count(new QueryWrapper<PaymentCompetition>()
+ .eq("appUserId", integer).eq("payStatus", 2).eq("state", 1));
+ StudentHonor studentHonor = new StudentHonor();
+ studentHonor.setAppUserId(integer);
+ studentHonor.setHonorType(2);
+ studentHonor.setNumber(count);
+ studentHonorClient.saveStudentHonor(studentHonor);
+ }
+ }
}
cttService.updateById(competition);
+
+
} catch (Exception e) {
e.printStackTrace();
}
@@ -746,7 +789,8 @@
String payOrderNo = paymentCompetition.getPayOrderNo();
if (paymentCompetition.getPayType() == 1) {//微信支付
- Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), "/base/competition/weChatCancelPaymentCompetitionCallback");
+ Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(),
+ "/base/competition/weChatCancelPaymentCompetitionCallback");
String return_code = map.get("return_code");
if (!"SUCCESS".equals(return_code)) {
// return ResultUtil.error(map.get("return_msg"));
@@ -754,10 +798,9 @@
}
String refund_id = map.get("refund_id");
paymentCompetition.setRefundOrderNo(refund_id);
+ paymentCompetition.setAppUserId(null);
paymentCompetitionService.updateById(paymentCompetition);
-
storeClient.addBackRecord(paymentCompetition.getAmount() + "_" + paymentCompetition.getAppUserId());
-
}
if (paymentCompetition.getPayType() == 2) {//支付宝支付
@@ -837,30 +880,9 @@
@Resource
private StudentClient studentClient;
@PostMapping("/base/competition/getPeopleFromId1")
- public List<CompetitionUser> getPeopleFromId1(@RequestBody GetPeopleQuery getPeopleQuery) {
+ public Page<CompetitionUser> getPeopleFromId1(@RequestBody GetPeopleQuery getPeopleQuery) {
try {
- Page<UserCompetition> participantPage = new Page<>(getPeopleQuery.getOffset(), getPeopleQuery.getLimit());
- List<CompetitionUser> page = participantService.getPeopleFromId1(participantPage, getPeopleQuery.getId(), getPeopleQuery.getState());
-
- List<CompetitionUser> users = new ArrayList<>();
- List<UserCompetition> coms = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", getPeopleQuery.getId()));
- for (UserCompetition com : coms) {
- int number = com.getParticipantId();
- String numberString = Integer.toString(number);
- int digitCount = numberString.length();
- if (digitCount!=9){
- TStudent tStudent = studentClient.queryById(number);
- CompetitionUser competitionUser = new CompetitionUser();
- competitionUser.setName(tStudent.getName());
- competitionUser.setPhone(tStudent.getPhone());
- competitionUser.setSex(tStudent.getSex());
- competitionUser.setIdCard(tStudent.getIdCard());
- competitionUser.setState(tStudent.getState());
- users.add(competitionUser);
- }
- }
- page.addAll(users);
-
+ Page<CompetitionUser> page = participantService.getPeopleFromId1(getPeopleQuery.getOffset(), getPeopleQuery.getLimit(), getPeopleQuery.getId(), getPeopleQuery.getState());
return page;
} catch (Exception e) {
e.printStackTrace();
--
Gitblit v1.7.1