From 6b7bbf4c2a9470bb9c674dd5a866004e4f061031 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 25 七月 2023 17:45:48 +0800
Subject: [PATCH] 删除管理后台无用代码
---
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 85 ++++++++++++++++++++----------------------
1 files changed, 40 insertions(+), 45 deletions(-)
diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index f1accb7..ea5d476 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -38,6 +38,10 @@
import com.dsh.account.util.*;
import com.dsh.account.util.akeylogin.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
@@ -149,29 +153,19 @@
classInfoVo.setBodyStatus(BMIBodyUtil.getBodyStatus(tStudent.getBmi()));
List<RegisteredCourse> courseList = new ArrayList<>();
-// 总学时数
- int total = 0;
-// 已扣数
- int deduct = 0;
-// 剩余数
- int remain = 0;
- List<StuCourseResp> stuCoursePayment = paymentClient.getStuCoursePayment();
+ List<StuCourseResp> stuCoursePayment = paymentClient.getStuCoursePayment(tStudent.getId());
if (stuCoursePayment.size() > 0){
for (StuCourseResp tCoursePackagePayment : stuCoursePayment) {
RegisteredCourse course = new RegisteredCourse();
course.setCourseId(tCoursePackagePayment.getCourseId());
course.setCourseName(tCoursePackagePayment.getCourseName());
- total = total + (ToolUtil.isEmpty(tCoursePackagePayment.getTotalCourseNums()) ? 0 : tCoursePackagePayment.getTotalCourseNums());
- deduct = deduct + (ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums());
- remain = remain + (ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums());
+ course.setTotalNums(ToolUtil.isEmpty(tCoursePackagePayment.getTotalCourseNums()) ? 0 : tCoursePackagePayment.getTotalCourseNums());
+ course.setDeductedNums(ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums());
+ course.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums());
courseList.add(course);
}
}
classInfoVo.setCourseList(courseList);
-
- classInfoVo.setTotalNums(total);
- classInfoVo.setDeductedNums(deduct);
- classInfoVo.setRemainingNums(remain);
List<ExerciseVideo> videos = new ArrayList<>();
@@ -494,9 +488,8 @@
}
@Override
- public BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId, Integer appUserId) {
- BillingDetailsVo vo = new BillingDetailsVo();
- List<BillingDetailsVo.ConsumeDetail> details = new ArrayList<>();
+ public List<ConsumeDetail> queryUserBillingDetails(String yearMonth, Integer recordId, Integer appUserId) {
+ List<ConsumeDetail> details = new ArrayList<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm");
Date monthStart = null;
@@ -512,7 +505,7 @@
List<PaymentCompetition> allCompetitionPayRecord = deducClient.getAllCompetitionPayRecord(appUserId);
if (allCompetitionPayRecord.size() > 0 ){
for (PaymentCompetition paymentCompetition : allCompetitionPayRecord) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
consumeDetail.setConsumeName(RechargeRecordEnum.EVENT_REGISTRATION.getMsg());
consumeDetail.setConsumeTime(simpleDateFormat.format(paymentCompetition.getInsertTime()));
consumeDetail.setConsumeAmount("-" + paymentCompetition.getAmount());
@@ -523,7 +516,7 @@
List<PaymentCompetition> cancelOrderOfUserPayRecord = deducClient.getCancelOrderOfUserPayRecord(appUserId);
if (cancelOrderOfUserPayRecord.size() > 0 ){
for (PaymentCompetition paymentCompetition : cancelOrderOfUserPayRecord) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_EVENT_REGISTRATION.getMsg());
consumeDetail.setConsumeTime(simpleDateFormat.format(paymentCompetition.getInsertTime()));
consumeDetail.setConsumeAmount("+" + paymentCompetition.getAmount());
@@ -534,7 +527,7 @@
List<TCoursePackagePayment> amountPayRecord = paymentClient.getAmountPayRecord(appUserId);
if (amountPayRecord.size() > 0 ){
for (TCoursePackagePayment coursePackagePayment : amountPayRecord) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg());
consumeDetail.setConsumeTime(simpleDateFormat.format(coursePackagePayment.getInsertTime()));
consumeDetail.setConsumeAmount("-" + coursePackagePayment.getCashPayment());
@@ -545,7 +538,7 @@
List<SiteBooking> allSiteBookingList = stClient.getAllSiteBookingList(appUserId);
if (allSiteBookingList.size() > 0){
for (SiteBooking booking : allSiteBookingList) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
if (booking.getStatus() != 5){
consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg());
consumeDetail.setConsumeAmount("-" + booking.getPayMoney());
@@ -567,7 +560,7 @@
.between("insertTime", monthStart, monthEnd));
if (vipPayments.size() > 0) {
for (VipPayment vipPayment : vipPayments) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
consumeDetail.setConsumeName(RechargeRecordEnum.ANNUAL_MEMBERSHIP.getMsg());
consumeDetail.setConsumeTime(simpleDateFormat.format(vipPayment.getInsertTime()));
consumeDetail.setConsumeAmount("-" + vipPayment.getAmount());
@@ -581,7 +574,7 @@
.between("insertTime", monthStart, monthEnd));
if (rechargeRecords.size() > 0) {
for (RechargeRecords rechargeRecord : rechargeRecords) {
- BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail();
+ ConsumeDetail consumeDetail = new ConsumeDetail();
consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":" + rechargeRecord.getPlayPaiCoins());
consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime()));
consumeDetail.setConsumeAmount("-" + rechargeRecord.getAmount());
@@ -589,9 +582,9 @@
}
}
if (details.size() > 0 ){
- Collections.sort(details, new Comparator<BillingDetailsVo.ConsumeDetail>() {
+ Collections.sort(details, new Comparator<ConsumeDetail>() {
@Override
- public int compare(BillingDetailsVo.ConsumeDetail record1, BillingDetailsVo.ConsumeDetail record2) {
+ public int compare(ConsumeDetail record1, ConsumeDetail record2) {
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd HH:mm");
Date date1 = null;
Date date2 = null;
@@ -606,8 +599,7 @@
}
});
}
- vo.setDetails(details);
- return vo;
+ return details;
}
@Override
@@ -627,11 +619,12 @@
if (rechargeConfig.size() > 0 ){
for (Map<String, Object> stringObjectMap : rechargeConfig) {
RechargeCentVo vo = new RechargeCentVo();
- vo.setAmount("¥ "+stringObjectMap.get("money"));
+ vo.setChargeId((Integer) stringObjectMap.get("money"));
+ vo.setAmount(""+stringObjectMap.get("money"));
if (tAppUser.getIsVip() == 1){
- vo.setWpGold(stringObjectMap.get("MemberCoins")+"币");
+ vo.setWpGold(stringObjectMap.get("MemberCoins")+"");
}else {
- vo.setWpGold(stringObjectMap.get("usersCoins")+"币");
+ vo.setWpGold(stringObjectMap.get("usersCoins")+"");
}
centVos.add(vo);
}
@@ -640,14 +633,8 @@
}
@Override
- public PointMallDetailsResponse queryAppUserIntegral(MallRequest request, Integer userIdFormRedis) {
- PointMallDetailsResponse detailsResponse = new PointMallDetailsResponse();
- List<PointMallDetailsResponse.Goods> goods = new ArrayList<>();
-
- TAppUser tAppUser = this.baseMapper.selectById(userIdFormRedis);
- detailsResponse.setName(tAppUser.getName());
- detailsResponse.setIntegral(tAppUser.getIntegral());
- detailsResponse.setHeadImg(tAppUser.getHeadImg());
+ public List<Goods> queryAppUserIntegral(MallRequest request ) {
+ List<Goods> goods = new ArrayList<>();
CommodityRequest commodityRequest = new CommodityRequest();
commodityRequest.setLon(request.getLon());
@@ -655,7 +642,7 @@
List<PointsMerchandise> vicinityGoods = mcClient.getVicinityGoods(commodityRequest);
if (vicinityGoods.size() > 0) {
for (PointsMerchandise vicinityGood : vicinityGoods) {
- PointMallDetailsResponse.Goods commodity = new PointMallDetailsResponse.Goods();
+ Goods commodity = new Goods();
switch (vicinityGood.getType()) {
case 1:
commodity.setGoodId(vicinityGood.getId());
@@ -712,7 +699,7 @@
List<Coupon> allCoupons = ucponClient.getAllCoupons(commodityRequest);
if (allCoupons.size() > 0) {
for (Coupon allCoupon : allCoupons) {
- PointMallDetailsResponse.Goods commodity = new PointMallDetailsResponse.Goods();
+ Goods commodity = new Goods();
commodity.setGoodId(allCoupon.getId());
commodity.setGoodName(allCoupon.getName());
commodity.setCondition(allCoupon.getRedemptionMethod());
@@ -738,17 +725,17 @@
switch (request.getRank()){
case 1:
goods = goods.stream()
- .sorted(Comparator.comparing(PointMallDetailsResponse.Goods::getIntegral).reversed())
+ .sorted(Comparator.comparing(Goods::getIntegral).reversed())
.collect(Collectors.toList());
break;
case 2:
goods = goods.stream()
- .sorted(Comparator.comparing(PointMallDetailsResponse.Goods::getIntegral))
+ .sorted(Comparator.comparing(Goods::getIntegral))
.collect(Collectors.toList());
break;
case 3:
goods = goods.stream()
- .sorted(Comparator.comparing(PointMallDetailsResponse.Goods::getNums).reversed())
+ .sorted(Comparator.comparing(Goods::getNums).reversed())
.collect(Collectors.toList());
break;
default:
@@ -761,8 +748,16 @@
.filter(merchandise -> merchandise.getGoodsType().equals(request.getGoodsType()))
.collect(Collectors.toList());
}
- detailsResponse.setGoods(goods);
- return detailsResponse;
+ Pageable pageable = PageRequest.of(request.getPageNum() - 1, request.getPageSize());
+ Page<Goods> page = getPage(goods, pageable);
+ return page.getContent();
+ }
+
+ // 对数据进行分页处理的方法
+ private static Page<Goods> getPage(List<Goods> dataList, Pageable pageable) {
+ int start = (int) pageable.getOffset();
+ int end = Math.min((start + pageable.getPageSize()), dataList.size());
+ return new PageImpl<>(dataList.subList(start, end), pageable, dataList.size());
}
@Override
--
Gitblit v1.7.1