From a30f3b966f6b3c1748d2976364369596327cbfba Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 21 八月 2023 17:40:04 +0800
Subject: [PATCH] 后台代码 积分商品
---
cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java | 142 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 116 insertions(+), 26 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 331c57c..a5bbd2e 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
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsh.course.entity.*;
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.StudentClient;
@@ -12,6 +13,10 @@
import com.dsh.course.feignclient.other.StoreClient;
import com.dsh.course.feignclient.other.model.Store;
import com.dsh.course.model.BaseVo;
+import com.dsh.course.model.QueryRegistrationRecord;
+import com.dsh.course.model.QueryWalkInStudentList;
+import com.dsh.course.model.BillingRequest;
+import com.dsh.course.model.BillingRequestVo;
import com.dsh.course.model.dto.DiscountJsonDto;
import com.dsh.course.model.vo.CourseDetailRequest;
import com.dsh.course.model.vo.RegisterCourseVo;
@@ -169,7 +174,7 @@
System.out.println(StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse)));
if (expirationDate.after(parse) && StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))){
CourseOfStoreVo storeVo = new CourseOfStoreVo();
- storeVo.setCourseId(packageStudent.getId());
+ storeVo.setCourseId(tCoursePackagePayment.getId());
storeVo.setCourseName(tCoursePackage.getName());
storeVo.setClassStartTime(tCoursePackage.getClassStartTime());
storeVo.setClassEndTime(tCoursePackage.getClassEndTime());
@@ -179,6 +184,7 @@
storeVo.setLat(store.getLat());
storeVo.setLon(store.getLon());
storeVo.setCoursePrice(ToolUtil.isEmpty(paymentConfig.getCashPayment()) ? (double) paymentConfig.getPlayPaiCoin():paymentConfig.getCashPayment());
+ storeVo.setStatus(1);
course.add(storeVo);
}
}
@@ -362,22 +368,36 @@
}
@PostMapping("/base/coursePack/allPaymentCourseList")
- public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId){
- return packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>()
- .eq("appUserId",appUserId)
- .eq("payType",3)
- .eq("payStatus",2)
- .eq("state",1));
+ @ResponseBody
+ public List<CouponPaymentVo> getAppuserCourseList(@RequestBody Integer appUserId){
+ List<CouponPaymentVo> paymentVos = new ArrayList<>();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm");
+ List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>()
+ .eq("appUserId", appUserId)
+ .eq("payType", 3)
+ .eq("payStatus", 2)
+ .eq("state", 1));
+ if (list.size() > 0 ){
+ for (TCoursePackagePayment tCoursePackagePayment : list) {
+ CouponPaymentVo couponPaymentVo = new CouponPaymentVo();
+ couponPaymentVo.setTime(simpleDateFormat.format(tCoursePackagePayment.getInsertTime()));
+ couponPaymentVo.setAmount( tCoursePackagePayment.getPlayPaiCoin());
+ paymentVos.add(couponPaymentVo);
+ }
+ }
+ return paymentVos;
}
+
+ @ResponseBody
@PostMapping("/base/coursePack/allAmountPayRecordOfUser")
- public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody BillingDataRequestVo billingDataRequestVo){
- return packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>()
- .eq("appUserId",billingDataRequestVo.getAppUserId())
- .notIn("payType",3)
- .eq("payStatus",2)
- .eq("state",1)
- .between("insertTime",billingDataRequestVo.getMonthStart(),billingDataRequestVo.getMonthEnd()));
+ public BillingRequestVo getAmountPayRecord(@RequestBody BillingDataRequestVo billingDataRequestVo){
+ BillingRequestVo requestVo = new BillingRequestVo();
+ List<BillingRequest> billingRequests = packagePaymentService.queryAmountDatas(billingDataRequestVo.getAppUserId(), billingDataRequestVo.getMonthStart(), billingDataRequestVo.getMonthEnd());
+ if (billingRequests.size() >0){
+ requestVo.setRequests(billingRequests);
+ }
+ return requestVo;
}
@@ -774,6 +794,7 @@
@PostMapping("/base/coursePack/savePaymentCoursePackage")
public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){
+ packagePayment.setInsertTime(new Date());
return packagePaymentService.save(packagePayment);
}
@@ -804,6 +825,56 @@
}
+ /**
+ * 获取课包报名信息列表
+ * @param queryRegistrationRecord
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/queryRegistrationRecord")
+ public Page<Map<String, Object>> queryRegistrationRecord(@RequestBody QueryRegistrationRecord queryRegistrationRecord){
+ Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(queryRegistrationRecord.getLimit(), queryRegistrationRecord.getOffset(), queryRegistrationRecord.getSort(), queryRegistrationRecord.getOrder());
+ Page<Map<String, Object>> mapPage = page.setRecords(packagePaymentService.queryRegistrationRecord(page, queryRegistrationRecord));
+ return mapPage;
+ }
+
+
+ /**
+ * 获取未预约排课学员列表
+ * @param queryWalkInStudentList
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/queryWalkInStudentList")
+ public Page<Map<String, Object>> queryWalkInStudentList(@RequestBody QueryWalkInStudentList queryWalkInStudentList){
+ Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(queryWalkInStudentList.getLimit(), queryWalkInStudentList.getOffset(), queryWalkInStudentList.getSort(), queryWalkInStudentList.getOrder());
+ Page<Map<String, Object>> mapPage = page.setRecords(packagePaymentService.queryWalkInStudentList(page, queryWalkInStudentList));
+ return mapPage;
+ }
+
+
+ /**
+ * 根据id获取数据
+ * @param id
+ * @return
+ */
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/queryCoursePackagePaymentById")
+ public TCoursePackagePayment queryCoursePackagePaymentById(@RequestBody Long id){
+ return packagePaymentService.getById(id);
+ }
+
+
+ /**
+ * 修改数据
+ * @param coursePackagePayment
+ */
+ @ResponseBody
+ @PostMapping("/coursePackagePayment/editCoursePackagePayment")
+ public void editCoursePackagePayment(TCoursePackagePayment coursePackagePayment){
+ packagePaymentService.updateById(coursePackagePayment);
+ }
+
/**
* 上课主页-预约操作
@@ -813,9 +884,9 @@
@ApiOperation(value = "上课主页-预约操作", tags = {"APP-开始上课"})
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
- @ApiImplicitParam(value = "上课记录id", name = "coursePackId", required = true, dataType = "String"),
+ @ApiImplicitParam(value = "课包id", name = "courseID", required = true, dataType = "String"),
@ApiImplicitParam(value = "时间 yyyy-MM-dd", name = "time", required = true, dataType = "String"),
- @ApiImplicitParam(value = "学员id", name = "time", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
})
public ResultUtil reverse(String courseID,String time,Integer stuId){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -824,17 +895,36 @@
if(null == appUserId){
return ResultUtil.tokenErr();
}
- CoursePackageStudent coursePackageStudent = cspsService.getOne(new LambdaQueryWrapper<CoursePackageStudent>()
- .eq(CoursePackageStudent::getId,courseID)
- .eq(CoursePackageStudent::getAppUserId,appUserId)
- .eq(CoursePackageStudent::getStudentId,stuId));
- if (ToolUtil.isEmpty(coursePackageStudent)){
- ResultUtil.error("该用户未购买该课包");
- }
- coursePackageStudent.setReservationStatus(1);
- coursePackageStudent.setInsertTime(simpleDateFormat.parse(time));
- cspsService.updateById(coursePackageStudent);
+ TCoursePackagePayment packagePayment = packagePaymentService.getOne(new LambdaQueryWrapper<TCoursePackagePayment>()
+ .eq(TCoursePackagePayment::getCoursePackageId,courseID )
+ .eq(TCoursePackagePayment::getAppUserId,appUserId)
+ .eq(TCoursePackagePayment::getStudentId,stuId)
+ );
+ if (ToolUtil.isEmpty(packagePayment)){
+ return ResultUtil.error("该用户未购买该课包");
+ }
+ CoursePackageStudent coursePackageStudent = cspsService.getOne(new LambdaQueryWrapper<CoursePackageStudent>()
+ .eq(CoursePackageStudent::getCoursePackageId,packagePayment.getCoursePackageId())
+ .eq(CoursePackageStudent::getCoursePackagePaymentId,courseID)
+ .eq(CoursePackageStudent::getStudentId,stuId)
+ .eq(CoursePackageStudent::getAppUserId,appUserId)
+ );
+
+ if (ToolUtil.isNotEmpty(coursePackageStudent) && coursePackageStudent.getReservationStatus() == 0){
+ coursePackageStudent.setReservationStatus(1);
+ coursePackageStudent.setInsertTime(simpleDateFormat.parse(time));
+ cspsService.updateById(coursePackageStudent);
+ }else {
+ coursePackageStudent = new CoursePackageStudent();
+ coursePackageStudent.setAppUserId(appUserId);
+ coursePackageStudent.setStudentId(stuId);
+ coursePackageStudent.setCoursePackageId(packagePayment.getCoursePackageId());
+ coursePackageStudent.setCoursePackagePaymentId(Long.parseLong(courseID));
+ coursePackageStudent.setReservationStatus(1);
+ coursePackageStudent.setInsertTime(simpleDateFormat.parse(time));
+ cspsService.save(coursePackageStudent);
+ }
return ResultUtil.success();
}catch (Exception e){
return ResultUtil.runErr();
--
Gitblit v1.7.1