From 5df006aac405fe996fff71f7854e37c324892367 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期一, 09 十月 2023 18:27:48 +0800
Subject: [PATCH] 后台代码提交
---
cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java | 98 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 89 insertions(+), 9 deletions(-)
diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
index d97e7c7..2f691bb 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
+++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.entity.*;
+import com.dsh.course.entity.TAppUser;
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.StudentClient;
import com.dsh.course.feignclient.account.model.AppUser;
@@ -148,7 +149,10 @@
Integer absencesNumber = one.getAbsencesNumber();
// 没有过期
if (one.getUseTime().after(new Date())){
- packagePayment.setTotalClassHours(packagePayment.getClassHours()+one.getTotalClassHours());
+ if (one.getLaveClassHours()-packagePayment.getClassHours()<0){
+ return 5002;
+ }
+ packagePayment.setTotalClassHours(one.getTotalClassHours());
packagePayment.setLaveClassHours(one.getLaveClassHours()-packagePayment.getClassHours());
packagePayment.setAbsencesNumber(one.getAbsencesNumber());
}
@@ -1204,9 +1208,13 @@
@PostMapping("/base/coursePack/getCoursePackagePaymentById")
- public TCoursePackagePayment getCoursePackagePaymentById(@RequestBody Integer id){
- return packagePaymentService.getById(id);
+ public TCoursePackagePayment getCoursePackagePaymentById(@RequestBody Long id){
+ TCoursePackagePayment byId = packagePaymentService.getById(id);
+ System.out.println("======byId=========="+byId);
+ return byId;
}
+
+
@PostMapping("/base/coursePack/delPaymentCoursePackage")
public boolean delPaymentCoursePackage(@RequestBody Integer payId){
return packagePaymentService.removeById(payId);
@@ -1235,7 +1243,7 @@
return packagePaymentService.save(packagePayment);
}
-
+ @ResponseBody
@PostMapping("/base/coursePack/obtainStudentClassDetails")
public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId){
try {
@@ -1324,7 +1332,7 @@
*/
@ResponseBody
@PostMapping("/coursePackagePayment/queryCoursePackagePaymentById")
- public TCoursePackagePayment queryCoursePackagePaymentById(@RequestBody Long id){
+ public TCoursePackagePayment queryCoursePackagePaymentById(@RequestParam("id")Long id){
return packagePaymentService.getById(id);
}
@@ -1346,7 +1354,22 @@
@ResponseBody
@PostMapping("/coursePackagePayment/editCoursePackagePayment")
public void editCoursePackagePayment(TCoursePackagePayment coursePackagePayment){
+ coursePackagePayment.setAppUserId(null);
packagePaymentService.updateById(coursePackagePayment);
+ }
+
+
+
+ /**
+ * 修改数据
+ * @param coursePackagePayment
+ */
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/editCoursePackagePayment1")
+ public void editCoursePackagePayment1(@RequestBody TCoursePackagePayment coursePackagePayment){
+ System.out.println("editCoursePackagePayment1====coursePackagePayment"+coursePackagePayment);
+// coursePackagePayment.setCoursePackageId(null);
+ packagePaymentService.updateBytime(coursePackagePayment);
}
@@ -1378,8 +1401,14 @@
if (ToolUtil.isEmpty(packagePayment) || packagePayment.size()==0){
return ResultUtil.error("该用户未购买该课包");
}
+ List<CoursePackageScheduling> coursePackageSchedulings = coursePackageSchedulingMapper.selectList(new LambdaQueryWrapper<CoursePackageScheduling>()
+ .eq(CoursePackageScheduling::getCoursePackageId, Integer.valueOf(courseID))
+ .like(CoursePackageScheduling::getClassDate, time)
+ );
+
List<CoursePackageStudent> coursePackageStudent = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>()
.in(CoursePackageStudent::getCoursePackagePaymentId,packagePayment.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList()))
+ .in(CoursePackageStudent::getCoursePackageSchedulingId,coursePackageSchedulings.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()))
.eq(CoursePackageStudent::getCoursePackageId,courseID)
.eq(CoursePackageStudent::getStudentId,stuId)
.eq(CoursePackageStudent::getAppUserId,appUserId)
@@ -1397,6 +1426,7 @@
}
return ResultUtil.success();
}catch (Exception e){
+ e.printStackTrace();
return ResultUtil.runErr();
}
}
@@ -1443,10 +1473,13 @@
String classEndTime = tCoursePackage.getClassEndTime();
String[] split1 = classEndTime.split(",");
ArrayList<String> strings = new ArrayList<>();
- for (int i1 = 0; i1 < split.length; i1++) {
- String s = split[i1] + "-" + split1[i1];
- strings.add(s);
+ if(ToolUtil.isNotEmpty(classStartTime)){
+ for (int i1 = 0; i1 < split.length; i1++) {
+ String s = split[i1].substring(0,5) + "-" + split1[i1].substring(0,5);
+ strings.add(s);
+ }
}
+
detailsListVo.setTime(strings);
List<CoursePackagePaymentConfig> list2 = icppcService.list(new LambdaQueryWrapper<CoursePackagePaymentConfig>().eq(CoursePackagePaymentConfig::getCoursePackageId, tCoursePackage.getId()).orderByAsc(CoursePackagePaymentConfig::getCashPayment));
if (list2.size() > 0) {
@@ -1460,6 +1493,9 @@
.eq(CoursePackageScheduling::getCoursePackageId, tCoursePackage.getId())
.like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime())
);
+ if(list3.size()==0){
+ break;
+ }
List<Long> collect2 = list3.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList());
if(collect2.size()==0){
collect2.add(-1l);
@@ -1471,12 +1507,13 @@
in(CoursePackageStudent::getCoursePackagePaymentId, ids)
);
- detailsListVo.setType(1);
+ detailsListVo.setType(1);
if(list4.size()>0){
Integer signInOrNot = list4.get(0).getSignInOrNot();
if(signInOrNot==2){
detailsListVo.setType(3);
}
+ detailsListVo.setIsType(list4.get(0).getType());
}
} else {
@@ -1521,4 +1558,47 @@
return a;
}
+
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/queryCourseData")
+ public List<Map<String,Object>> queryCourseData(@RequestBody List<Integer> ids){
+ // 找出课程类型 找出剩余的课时数
+ List<TCoursePackageType> list = coursePackageTypeService.list();
+ if(ids.size()==0){
+ ids.add(-1);
+ }
+ List<TCoursePackagePayment> list1 = packagePaymentService.listOne(ids);
+ List<Integer> collect = list1.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList());
+ if(collect.size()==0){
+ collect.add(-1);
+ }
+ List<TCoursePackage> list2 = tcpService.list(new LambdaQueryWrapper<TCoursePackage>().in(TCoursePackage::getId, collect));
+ for (TCoursePackagePayment tCoursePackagePayment : list1) {
+ for (TCoursePackage tCoursePackage : list2) {
+ if(tCoursePackagePayment.getCoursePackageId().equals(tCoursePackage.getId())){
+ tCoursePackagePayment.setType(tCoursePackage.getType());
+ }
+ }
+ }
+
+
+ List<Map<String,Object>> mapList = new ArrayList<>();
+ for (TCoursePackageType tCoursePackageType : list) {
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("name",tCoursePackageType.getName());
+ int a =0;
+ for (TCoursePackagePayment tCoursePackagePayment : list1) {
+ if(tCoursePackagePayment.getType().equals(tCoursePackageType.getId())){
+ a += tCoursePackagePayment.getLaveClassHours();
+ }
+ }
+ map.put("value",a);
+ mapList.add(map);
+ }
+
+
+ return mapList;
+ }
+
+
}
--
Gitblit v1.7.1