From a42cd13388b041b29ebbae7e40071011bae31f67 Mon Sep 17 00:00:00 2001 From: lisy <linlangsur163@163.com> Date: 星期一, 10 七月 2023 11:59:22 +0800 Subject: [PATCH] 充值中心除了支付的其他接口;增加储值规则实体类 --- cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java | 79 ++++++ cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargePayRequest.java | 19 + cloud-server-other/src/main/java/com/dsh/other/controller/StoredValueConfigController.java | 79 ++++++ cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java | 9 cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java | 10 cloud-server-other/src/main/java/com/dsh/other/mapper/StoredValueConfigMapper.java | 16 + cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/ArrangeResponse.java | 16 + cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/ClasspaymentRequest.java | 4 cloud-server-account/src/main/java/com/dsh/account/feignclient/other/RechargeConfigClient.java | 17 + cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeDetailsVo.java | 32 ++ cloud-server-other/src/main/java/com/dsh/other/service/impl/StoredValueConfigServiceImpl.java | 20 + cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java | 3 cloud-server-other/src/main/resources/mapper/StoredValueConfigMapper.xml | 6 cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeCentVo.java | 17 + cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java | 3 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 127 +++++----- cloud-server-competition/src/main/java/com/dsh/competition/controller/UserCompetitionController.java | 4 cloud-server-other/src/main/java/com/dsh/other/entity/StoredValueConfig.java | 93 +++++++ cloud-server-other/src/main/java/com/dsh/other/feignclient/RechargeConfigClient.java | 18 + cloud-server-other/src/main/java/com/dsh/other/service/StoredValueConfigService.java | 16 + cloud-server-account/src/main/java/com/dsh/account/service/RechargeRecordsService.java | 7 cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java | 111 +++++++++ cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java | 6 23 files changed, 632 insertions(+), 80 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java index c08ab90..31d3460 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java @@ -3,9 +3,8 @@ import com.dsh.account.entity.TAppUser; import com.dsh.account.feignclient.other.SysLogClient; -import com.dsh.account.model.vo.userBenefitDetail.AppUserDetailsVo; -import com.dsh.account.model.vo.userBenefitDetail.BillingDetailsVo; -import com.dsh.account.model.vo.userBenefitDetail.IndexOfUserBenefirVo; +import com.dsh.account.model.vo.userBenefitDetail.*; +import com.dsh.account.service.RechargeRecordsService; import com.dsh.account.service.TAppUserService; import com.dsh.account.util.ResultUtil; import com.dsh.account.util.TokenUtil; @@ -13,10 +12,14 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.text.SimpleDateFormat; +import java.util.List; /** * 使用福利 控制器 @@ -35,6 +38,9 @@ @Resource private SysLogClient slClient; + + @Autowired + private RechargeRecordsService rechargeRService; private final SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); @@ -145,7 +151,7 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(value = "年月", name = "yearMonth", required = true, dataType = "string"), - @ApiImplicitParam(value = "记录id", name = "recordId", required = true, dataType = "int"), + @ApiImplicitParam(value = "记录(1充值 2扣除)", name = "recordId", required = true, dataType = "int"), }) public ResultUtil<BillingDetailsVo> getUserBillingDetails(String yearMonth,Integer recordId){ try { @@ -153,13 +159,74 @@ if(null == appUserId){ return ResultUtil.tokenErr(); } - return ResultUtil.success(tauService.queryUserBillingDetails(yearMonth,recordId)); + return ResultUtil.success(tauService.queryUserBillingDetails(yearMonth,recordId,appUserId)); }catch (Exception e){ return ResultUtil.runErr(); } } + @ResponseBody + @PostMapping("/api/useBenefit/voucherCenter") + @ApiOperation(value = "充值明细", tags = {"APP-使用福利"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), + @ApiImplicitParam(value = "年月", name = "yearMonth", required = true, dataType = "string"), + @ApiImplicitParam(value = "记录(1充值 2扣除)", name = "recordId", required = true, dataType = "int"), + }) + public ResultUtil<RechargeDetailsVo> wpGoldRechargeRecord(String yearMonth, Integer recordId){ + try { + Integer appUserId = tokenUtil.getUserIdFormRedis(); + if(null == appUserId){ + return ResultUtil.tokenErr(); + } + return ResultUtil.success(rechargeRService.getAppUserRechargeRecord(yearMonth,recordId,appUserId)); + }catch (Exception e){ + return ResultUtil.runErr(); + } + } + + + @ResponseBody + @PostMapping("/api/useBenefit/voucherCenter") + @ApiOperation(value = "充值中心", tags = {"APP-使用福利"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), + }) + public ResultUtil<List<RechargeCentVo>> rechargeCenterConfig(){ + try { + Integer appUserId = tokenUtil.getUserIdFormRedis(); + if(null == appUserId){ + return ResultUtil.tokenErr(); + } + return ResultUtil.success(tauService.getSysRechargeConfig(appUserId)); + }catch (Exception e){ + return ResultUtil.runErr(); + } + } + + /** + * 课时详情-支付 + */ + @ResponseBody + @PostMapping("/api/startCource/payment") + @ApiOperation(value = "充值中心-支付", tags = {"APP-开始上课"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), + }) + public ResultUtil continuationOperation(RechargePayRequest request){ + try { + Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); + if(null == userIdFormRedis){ + return ResultUtil.tokenErr(); + } + return rechargeRService.rechargePayment(userIdFormRedis,request); + }catch (Exception e){ + return ResultUtil.runErr(); + } + + } + } diff --git a/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java b/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java index a19401c..e7c77b6 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java +++ b/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java @@ -14,13 +14,15 @@ CANCEL_VENUE_RESERVATION("取消场地预约"), - ; - String msg; - RechargeRecordEnum() { - } + ; + final String msg; RechargeRecordEnum(String msg) { this.msg = msg; } + + public String getMsg() { + return msg; + } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java index 0b29b58..55af25f 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java @@ -30,4 +30,7 @@ @PostMapping("/base/coursePack/courseOfPurchased") List<PurchaseVo> getAppUsersCourseData(@RequestBody Integer appUserId); + + @PostMapping("/base/coursePack/allPaymentCourseList") + public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId); } diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/RechargeConfigClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/RechargeConfigClient.java new file mode 100644 index 0000000..141b212 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/RechargeConfigClient.java @@ -0,0 +1,17 @@ +package com.dsh.account.feignclient.other; + + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; +import java.util.Map; + + +@FeignClient(value = "mb-cloud-other") +public interface RechargeConfigClient { + + @PostMapping("/base/stored/getRechargeArrange") + List<Map<String,Object>> getRechargeConfig(); + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/ClasspaymentRequest.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/ClasspaymentRequest.java index 02166b6..5604edd 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/ClasspaymentRequest.java +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/ClasspaymentRequest.java @@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; + @Data public class ClasspaymentRequest { @@ -25,5 +27,7 @@ @ApiModelProperty(value = "课时id") private Long courseConfigId; + @ApiModelProperty(value = "支付金额") + private BigDecimal payAmount; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/ArrangeResponse.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/ArrangeResponse.java new file mode 100644 index 0000000..c946607 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/ArrangeResponse.java @@ -0,0 +1,16 @@ +package com.dsh.account.model.vo.userBenefitDetail; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ArrangeResponse { + + @ApiModelProperty(value = "玩湃币") + private String wpGold; + + @ApiModelProperty(value = "对应充值金额") + private String amount; + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeCentVo.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeCentVo.java new file mode 100644 index 0000000..a692297 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeCentVo.java @@ -0,0 +1,17 @@ +package com.dsh.account.model.vo.userBenefitDetail; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class RechargeCentVo { + + @ApiModelProperty(value = "玩湃币") + private String wpGold; + + @ApiModelProperty(value = "对应充值金额") + private String amount; + + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeDetailsVo.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeDetailsVo.java new file mode 100644 index 0000000..88c542b --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargeDetailsVo.java @@ -0,0 +1,32 @@ +package com.dsh.account.model.vo.userBenefitDetail; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class RechargeDetailsVo { + + @ApiModelProperty(value = "剩余玩湃币") + private Integer wpGold; + + @ApiModelProperty(value = "记录列表") + private List<RechargesDetail> detailList; + + @Data + public static class RechargesDetail{ + + @ApiModelProperty(value = "名称") + private String consumeName; + + @ApiModelProperty(value = "时间") + private String consumeTime; + + @ApiModelProperty(value = "金额 例如 -90 ") + private String consumeAmount; + + } + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargePayRequest.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargePayRequest.java new file mode 100644 index 0000000..a46f39f --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/RechargePayRequest.java @@ -0,0 +1,19 @@ +package com.dsh.account.model.vo.userBenefitDetail; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + + +@Data +public class RechargePayRequest { + + + @ApiModelProperty(value = "支付方式 1微信 2支付宝") + private Integer payType; + + @ApiModelProperty(value = "支付金额") + private BigDecimal payAmount; + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/RechargeRecordsService.java b/cloud-server-account/src/main/java/com/dsh/account/service/RechargeRecordsService.java index 183fd4d..1d6b382 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/RechargeRecordsService.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/RechargeRecordsService.java @@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.account.entity.RechargeRecords; +import com.dsh.account.model.vo.userBenefitDetail.RechargeDetailsVo; +import com.dsh.account.model.vo.userBenefitDetail.RechargePayRequest; +import com.dsh.account.util.ResultUtil; /** * <p> @@ -13,4 +16,8 @@ */ public interface RechargeRecordsService extends IService<RechargeRecords> { + RechargeDetailsVo getAppUserRechargeRecord(String yearMonth, Integer recordId, Integer appUserId); + + ResultUtil rechargePayment(Integer userIdFormRedis, RechargePayRequest request); + } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java index 138a47f..5b897dc 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java @@ -9,7 +9,10 @@ import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; import com.dsh.account.model.vo.userBenefitDetail.BillingDetailsVo; import com.dsh.account.model.vo.userBenefitDetail.IndexOfUserBenefirVo; +import com.dsh.account.model.vo.userBenefitDetail.RechargeCentVo; import com.dsh.account.util.ResultUtil; + +import java.util.List; /** * <p> @@ -107,7 +110,7 @@ * @param recordId 记录id * @return */ - BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId); + BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId,Integer appUserId); /** * 注销账号 @@ -115,4 +118,5 @@ */ void cancellation(Integer appUserId); + List<RechargeCentVo> getSysRechargeConfig(Integer appUserId); } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java index 83729db..32da73c 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java @@ -1,10 +1,29 @@ package com.dsh.account.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.account.entity.RechargeRecords; +import com.dsh.account.entity.TAppUser; +import com.dsh.account.enums.RechargeRecordEnum; +import com.dsh.account.feignclient.course.CoursePaymentClient; +import com.dsh.account.feignclient.course.model.TCoursePackagePayment; import com.dsh.account.mapper.RechargeRecordsMapper; +import com.dsh.account.mapper.TAppUserMapper; +import com.dsh.account.model.vo.userBenefitDetail.RechargeDetailsVo; +import com.dsh.account.model.vo.userBenefitDetail.RechargePayRequest; import com.dsh.account.service.RechargeRecordsService; +import com.dsh.account.util.DateTimeHelper; +import com.dsh.account.util.ResultUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * <p> @@ -17,4 +36,96 @@ @Service public class RechargeRecordsServiceImpl extends ServiceImpl<RechargeRecordsMapper, RechargeRecords> implements RechargeRecordsService { + @Resource + private RechargeRecordsMapper rereMapper; + + + @Resource + private TAppUserMapper tappMapper; + + @Autowired + private CoursePaymentClient cpClient; + + + @Override + public RechargeDetailsVo getAppUserRechargeRecord(String yearMonth, Integer recordId, Integer appUserId) { + RechargeDetailsVo vo = new RechargeDetailsVo(); + List<RechargeDetailsVo.RechargesDetail> details = new ArrayList<>(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); + + Date monthStart = null; + Date monthEnd = null; + if (StringUtils.hasText(yearMonth)) { + monthStart = DateTimeHelper.getCurrentIdetMouthStart(yearMonth); + monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(yearMonth); + } else { + monthStart = DateTimeHelper.getCurrentMouthStart(); + monthEnd = DateTimeHelper.getCurrentMouthEnd(); + } + + TAppUser tAppUser = tappMapper.selectById(appUserId); + if (null != tAppUser){ + vo.setWpGold(tAppUser.getPlayPaiCoins()); + }else { + vo.setWpGold(0); + } +// 1.赛事报名 + +// 2.课包购买 + List<TCoursePackagePayment> appuserCourseList = cpClient.getAppuserCourseList(appUserId); + if (appuserCourseList.size() > 0){ + for (TCoursePackagePayment tCoursePackagePayment : appuserCourseList) { + RechargeDetailsVo.RechargesDetail consumeDetail = new RechargeDetailsVo.RechargesDetail(); + consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg() ); + consumeDetail.setConsumeTime(simpleDateFormat.format(tCoursePackagePayment.getInsertTime())); + consumeDetail.setConsumeAmount("-" + tCoursePackagePayment.getPlayPaiCoin()); + details.add(consumeDetail); + } + } +// 3.场地预约 +// 4.智慧球场 + +// 5.充值 + List<RechargeRecords> rechargeRecords = rereMapper.selectList(new QueryWrapper<RechargeRecords>() + .eq("payStatus", 2) + .eq("appUserId", appUserId) + .between("insertTime", monthStart, monthEnd)); + if (rechargeRecords.size() > 0) { + for (RechargeRecords rechargeRecord : rechargeRecords) { + RechargeDetailsVo.RechargesDetail consumeDetail = new RechargeDetailsVo.RechargesDetail(); + consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.name() + ":" + rechargeRecord.getPlayPaiCoins()); + consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); + consumeDetail.setConsumeAmount("+" + rechargeRecord.getAmount()); + details.add(consumeDetail); + } + } + vo.setDetailList(details); + return vo; + } + + @Override + public ResultUtil rechargePayment(Integer userIdFormRedis, RechargePayRequest request) { + // TODO: 2023/7/10 充值支付 + switch (request.getPayType()){ + case 1: + WeChatPayment(request.getPayAmount()); + break; + case 2: + AlipayPayment(request.getPayAmount()); + break; + default: + break; + } + return ResultUtil.success(); + } + + private void AlipayPayment(BigDecimal payAmount) { + + + } + + private void WeChatPayment(BigDecimal payAmount) { + + + } } 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 de01b85..4e6c0fb 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 @@ -14,6 +14,7 @@ import com.dsh.account.feignclient.course.model.QueryStoreList; import com.dsh.account.feignclient.course.model.StuCourseResp; import com.dsh.account.feignclient.other.ImgConfigClient; +import com.dsh.account.feignclient.other.RechargeConfigClient; import com.dsh.account.feignclient.other.StoreClient; import com.dsh.account.feignclient.other.model.Store; import com.dsh.account.feignclient.other.model.TImgConfig; @@ -32,11 +33,13 @@ import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; import com.dsh.account.model.vo.userBenefitDetail.BillingDetailsVo; import com.dsh.account.model.vo.userBenefitDetail.IndexOfUserBenefirVo; +import com.dsh.account.model.vo.userBenefitDetail.RechargeCentVo; import com.dsh.account.service.TAppUserService; import com.dsh.account.util.*; import com.dsh.account.util.akeylogin.Md5Util; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestBody; import javax.annotation.Resource; @@ -94,6 +97,9 @@ @Resource private RechargeRecordsMapper rrMapper; + + @Resource + private RechargeConfigClient reconMapper; @Override public ClassInfoVo queryUserOfStus(Integer id,String latitude,String longitude) { @@ -469,82 +475,55 @@ } @Override - public BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId) { + public BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId, Integer appUserId) { BillingDetailsVo vo = new BillingDetailsVo(); List<BillingDetailsVo.ConsumeDetail> details = new ArrayList<>(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm"); - if (null != yearMonth){ - - Date monthStart = DateTimeHelper.getCurrentIdetMouthStart(yearMonth); - Date monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(yearMonth); + Date monthStart = null; + Date monthEnd = null; + if (StringUtils.hasText(yearMonth)) { + monthStart = DateTimeHelper.getCurrentIdetMouthStart(yearMonth); + monthEnd = DateTimeHelper.getCurrentIdeaMouthEnd(yearMonth); + } else { + monthStart = DateTimeHelper.getCurrentMouthStart(); + monthEnd = DateTimeHelper.getCurrentMouthEnd(); + } // 1.赛事报名 // 2.课包购买 // 3.场地预约 // 4.智慧球场 // 5.年度会员 - List<VipPayment> vipPayments = vipPaymentMapper.selectList(new QueryWrapper<VipPayment>() - .eq("payStatus",2 ) - .between("insertTime",monthStart, monthEnd)); - if (vipPayments.size() > 0){ - for (VipPayment vipPayment : vipPayments) { - BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.ANNUAL_MEMBERSHIP.name()); - consumeDetail.setConsumeTime(simpleDateFormat.format(vipPayment.getInsertTime())); - consumeDetail.setConsumeAmount("+"+vipPayment.getAmount()); - details.add(consumeDetail); - } - } -// 6.续课 -// 7.充值 - List<RechargeRecords> rechargeRecords = rrMapper.selectList(new QueryWrapper<RechargeRecords>() - .eq("payStatus", 2) - .between("insertTime",monthStart, monthEnd)); - if (rechargeRecords.size() > 0){ - for (RechargeRecords rechargeRecord : rechargeRecords) { - BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.name()+":"+rechargeRecord.getPlayPaiCoins()); - consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); - consumeDetail.setConsumeAmount("+"+rechargeRecord.getAmount()); - details.add(consumeDetail); - } - } - }else { - Date currentMouthStart = DateTimeHelper.getCurrentMouthStart(); - Date currentMouthEnd = DateTimeHelper.getCurrentMouthEnd(); -// 1.赛事报名 -// 2.课包购买 -// 3.场地预约 -// 4.智慧球场 -// 5.年度会员 - List<VipPayment> vipPayments = vipPaymentMapper.selectList(new QueryWrapper<VipPayment>() - .eq("payStatus",2 ) - .between("insertTime",currentMouthStart, currentMouthEnd)); - if (vipPayments.size() > 0){ - for (VipPayment vipPayment : vipPayments) { - BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.ANNUAL_MEMBERSHIP.name()); - consumeDetail.setConsumeTime(simpleDateFormat.format(vipPayment.getInsertTime())); - consumeDetail.setConsumeAmount("+"+vipPayment.getAmount()); - details.add(consumeDetail); - } - } -// 6.续课 -// 7.充值 - List<RechargeRecords> rechargeRecords = rrMapper.selectList(new QueryWrapper<RechargeRecords>() - .eq("payStatus", 2) - .between("insertTime",currentMouthStart, currentMouthEnd)); - if (rechargeRecords.size() > 0){ - for (RechargeRecords rechargeRecord : rechargeRecords) { - BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); - consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.name()+":"+rechargeRecord.getPlayPaiCoins()); - consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); - consumeDetail.setConsumeAmount("+"+rechargeRecord.getAmount()); - details.add(consumeDetail); - } + List<VipPayment> vipPayments = vipPaymentMapper.selectList(new QueryWrapper<VipPayment>() + .eq("payStatus", 2) + .eq("appUserId", appUserId) + .between("insertTime", monthStart, monthEnd)); + if (vipPayments.size() > 0) { + for (VipPayment vipPayment : vipPayments) { + BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); + consumeDetail.setConsumeName(RechargeRecordEnum.ANNUAL_MEMBERSHIP.getMsg()); + consumeDetail.setConsumeTime(simpleDateFormat.format(vipPayment.getInsertTime())); + consumeDetail.setConsumeAmount("+" + vipPayment.getAmount()); + details.add(consumeDetail); } } +// 6.续课 +// 7.充值 + List<RechargeRecords> rechargeRecords = rrMapper.selectList(new QueryWrapper<RechargeRecords>() + .eq("payStatus", 2) + .eq("appUserId", appUserId) + .between("insertTime", monthStart, monthEnd)); + if (rechargeRecords.size() > 0) { + for (RechargeRecords rechargeRecord : rechargeRecords) { + BillingDetailsVo.ConsumeDetail consumeDetail = new BillingDetailsVo.ConsumeDetail(); + consumeDetail.setConsumeName(RechargeRecordEnum.RECHARGE.getMsg() + ":" + rechargeRecord.getPlayPaiCoins()); + consumeDetail.setConsumeTime(simpleDateFormat.format(rechargeRecord.getInsertTime())); + consumeDetail.setConsumeAmount("+" + rechargeRecord.getAmount()); + details.add(consumeDetail); + } + } + vo.setDetails(details); return vo; } @@ -558,4 +537,24 @@ } } + @Override + public List<RechargeCentVo> getSysRechargeConfig(Integer appUserId) { + List<RechargeCentVo> centVos = new ArrayList<>(); + TAppUser tAppUser = this.baseMapper.selectById(appUserId); + List<Map<String, Object>> rechargeConfig = reconMapper.getRechargeConfig(); + if (rechargeConfig.size() > 0 ){ + for (Map<String, Object> stringObjectMap : rechargeConfig) { + RechargeCentVo vo = new RechargeCentVo(); + vo.setAmount("¥ "+stringObjectMap.get("money")); + if (tAppUser.getIsVip() == 1){ + vo.setWpGold(stringObjectMap.get("MemberCoins")+"币"); + }else { + vo.setWpGold(stringObjectMap.get("usersCoins")+"币"); + } + centVos.add(vo); + } + } + return centVos; + } + } diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/controller/UserCompetitionController.java b/cloud-server-competition/src/main/java/com/dsh/competition/controller/UserCompetitionController.java index b20a3a3..4f9111c 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/controller/UserCompetitionController.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/controller/UserCompetitionController.java @@ -1,12 +1,8 @@ package com.dsh.competition.controller; -import com.dsh.competition.util.ResultUtil; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - -import javax.xml.transform.Result; -import java.util.List; /** * <p> 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 06f3da1..ccde50b 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 @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.dsh.course.entity.PostCourseVideo; import com.dsh.course.entity.TCoursePackage; import com.dsh.course.entity.TCoursePackageDiscount; import com.dsh.course.entity.TCoursePackagePayment; @@ -308,6 +307,14 @@ return videoVos; } + @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 diff --git a/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java b/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java index 020e7b7..68b1d06 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java +++ b/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java @@ -1,6 +1,7 @@ package com.dsh.course.feignclient; +import com.dsh.course.entity.TCoursePackagePayment; import com.dsh.course.feignclient.model.*; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -32,4 +33,6 @@ @PostMapping("/base/coursePack/courseOfPurchased") public List<PurchaseVo> getAppUsersCourseData(@RequestBody Integer appUserId); + @PostMapping("/base/coursePack/allPaymentCourseList") + public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId); } diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/StoredValueConfigController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/StoredValueConfigController.java new file mode 100644 index 0000000..0f77c5a --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/StoredValueConfigController.java @@ -0,0 +1,79 @@ +package com.dsh.other.controller; + + +import com.dsh.other.entity.StoredValueConfig; +import com.dsh.other.service.StoredValueConfigService; +import com.dsh.other.util.ResultUtil; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 储值规则配置控制器 + */ + +@RestController +@RequestMapping("") +public class StoredValueConfigController { + + + @Autowired + private StoredValueConfigService svconfigService; + + @ResponseBody + + @PostMapping("/base/stored/getRechargeArrange") + public List<Map<String,Object>> getRechargeConfig(){ + List<Map<String,Object>> responses = new ArrayList<>(); + StoredValueConfig storedValueConfig = svconfigService.list().get(0); + try { + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode rulesNode = objectMapper.readTree(storedValueConfig.getContent()).path("rules"); + if (rulesNode.isArray()) { + for (JsonNode ruleNode : rulesNode) { + Map<String,Object> de = new HashMap<>(); + String money = ruleNode.get("money").asText(); + String usersCoins = ruleNode.get("usersCoins").asText(); + String MemberCoins = ruleNode.get("MemberCoins").asText(); + de.put("money",money); + de.put("usersCoins",usersCoins); + de.put("MemberCoins",MemberCoins); + responses.add(de); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return responses; + } + + + @ResponseBody + @PostMapping("/base/stored/rechargeDescription") + @ApiOperation(value = "充值中心-储值说明", tags = {"APP-使用福利"}) + @ApiImplicitParams({ + }) + public ResultUtil<String> rechargeCenterConfig(){ + try { + StoredValueConfig storedValueConfig = svconfigService.list().get(0); + return ResultUtil.success(storedValueConfig.getDescription()); + }catch (Exception e){ + return ResultUtil.runErr(); + } + } + + + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/StoredValueConfig.java b/cloud-server-other/src/main/java/com/dsh/other/entity/StoredValueConfig.java new file mode 100644 index 0000000..4077640 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/entity/StoredValueConfig.java @@ -0,0 +1,93 @@ +package com.dsh.other.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * <p> + * 储值规则配置 + * </p> + * + * @author jqs + * @since 2023-07-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("t_stored_value_config") +public class StoredValueConfig extends Model<StoredValueConfig> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 规则配置JSON +{ + "rules": [{ + "money": "100.0", + "usersCoins": "100.0", + "MemberCoins": "100.0", + "startTime": "", + "endTime": "" + }, { + "money": "200.0", + "usersCoins": "200.0", + "MemberCoins": "200.0", + "startTime": "", + "endTime": "" + }], + "time_rules": [{ + "sameTime": [{ + "money": "100.0", + "usersCoins": "100.0", + "MemberCoins": "200.0", + "startTime": "2023-06-01", + "endTime": "2023-06-15" + }, { + "money": "200.0", + "usersCoins": "200.0", + "MemberCoins": "400.0", + "startTime": "2023-06-01", + "endTime": "2023-06-15" + }] + }, { + "sameTime": [{ + "money": "100.0", + "usersCoins": "100.0", + "MemberCoins": "300.0", + "startTime": "2023-07-01", + "endTime": "2023-07-15" + }, { + "money": "200.0", + "usersCoins": "200.0", + "MemberCoins": "600.0", + "startTime": "2023-07-01", + "endTime": "2023-07-15" + }] + }] +} + */ + private String content; + /** + * 储值说明 + */ + private String description; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/RechargeConfigClient.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/RechargeConfigClient.java new file mode 100644 index 0000000..6e3383c --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/RechargeConfigClient.java @@ -0,0 +1,18 @@ +package com.dsh.other.feignclient; + + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; +import java.util.Map; + + + +@FeignClient(value = "mb-cloud-other") +public interface RechargeConfigClient { + + @PostMapping("/base/stored/getRechargeArrange") + List<Map<String,Object>> getRechargeConfig(); + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/StoredValueConfigMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/StoredValueConfigMapper.java new file mode 100644 index 0000000..d33ab68 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/StoredValueConfigMapper.java @@ -0,0 +1,16 @@ +package com.dsh.other.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dsh.other.entity.StoredValueConfig; + +/** + * <p> + * 储值规则配置 Mapper 接口 + * </p> + * + * @author jqs + * @since 2023-07-10 + */ +public interface StoredValueConfigMapper extends BaseMapper<StoredValueConfig> { + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/StoredValueConfigService.java b/cloud-server-other/src/main/java/com/dsh/other/service/StoredValueConfigService.java new file mode 100644 index 0000000..d8a1c8d --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/service/StoredValueConfigService.java @@ -0,0 +1,16 @@ +package com.dsh.other.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.dsh.other.entity.StoredValueConfig; + +/** + * <p> + * 储值规则配置 服务类 + * </p> + * + * @author jqs + * @since 2023-07-10 + */ +public interface StoredValueConfigService extends IService<StoredValueConfig> { + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/StoredValueConfigServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/StoredValueConfigServiceImpl.java new file mode 100644 index 0000000..8579e45 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/StoredValueConfigServiceImpl.java @@ -0,0 +1,20 @@ +package com.dsh.other.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dsh.other.entity.StoredValueConfig; +import com.dsh.other.mapper.StoredValueConfigMapper; +import com.dsh.other.service.StoredValueConfigService; +import org.springframework.stereotype.Service; + +/** + * <p> + * 储值规则配置 服务实现类 + * </p> + * + * @author jqs + * @since 2023-07-10 + */ +@Service +public class StoredValueConfigServiceImpl extends ServiceImpl<StoredValueConfigMapper, StoredValueConfig> implements StoredValueConfigService { + +} diff --git a/cloud-server-other/src/main/resources/mapper/StoredValueConfigMapper.xml b/cloud-server-other/src/main/resources/mapper/StoredValueConfigMapper.xml new file mode 100644 index 0000000..d71478b --- /dev/null +++ b/cloud-server-other/src/main/resources/mapper/StoredValueConfigMapper.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dsh.other.mapper.StoredValueConfigMapper"> + + +</mapper> -- Gitblit v1.7.1