Merge remote-tracking branch 'origin/master'
# Conflicts:
# cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java
| | |
| | | @MapperScan("com.dsh.account.mapper") |
| | | public class AccountApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(AccountApplication.class, args); |
| | | try { |
| | | SpringApplication.run(AccountApplication.class, args); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Bean |
| | |
| | | |
| | | 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.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.ResultUtil; |
| | | import com.dsh.account.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | 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; |
| | | |
| | | /** |
| | | * 使用福利 控制器 |
| | |
| | | |
| | | @Resource |
| | | private SysLogClient slClient; |
| | | |
| | | @Autowired |
| | | private RechargeRecordsService rechargeRService; |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService uicService; |
| | | |
| | | private final SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | |
| | | @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 { |
| | |
| | | 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/voucherDetail") |
| | | @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/useBenefit/payment") |
| | | @ApiOperation(value = "充值中心-支付", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil rechargeCenPayment(RechargePayRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return rechargeRService.rechargeCenPayment(userIdFormRedis,request); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 积分商城 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/integralMallList") |
| | | @ApiOperation(value = "积分商城", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<PointMallDetailsResponse> pointsMallList(MallRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | // TODO: 2023/7/10 积分商品列表查询 |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 积分明细 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/integralDetails") |
| | | @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<IntegralDetailsResponse> pointDetails(String yearMonth, Integer recordId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(uicService.queryUserPointsDetails(yearMonth,recordId,userIdFormRedis)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
New file |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.Version; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户积分变动记录 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-10 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_user_integral_changes") |
| | | public class UserIntegralChanges extends Model<UserIntegralChanges> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 历史积分 |
| | | */ |
| | | private Integer oldIntegral; |
| | | /** |
| | | * 新积分 |
| | | */ |
| | | private Integer newIntegral; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Date insertTime; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
| | |
| | | CANCEL_VENUE_RESERVATION("取消场地预约"), |
| | | |
| | | |
| | | ; |
| | | String msg; |
| | | |
| | | RechargeRecordEnum() { |
| | | } |
| | | ; |
| | | final String msg; |
| | | |
| | | RechargeRecordEnum(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | } |
| | |
| | | |
| | | @PostMapping("/base/coursePack/courseOfPurchased") |
| | | List<PurchaseVo> getAppUsersCourseData(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/base/coursePack/allPaymentCourseList") |
| | | public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId); |
| | | } |
New file |
| | |
| | | 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(); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.mapper; |
| | | |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户积分变动记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-10 |
| | | */ |
| | | public interface UserIntegralChangesMapper extends BaseMapper<UserIntegralChanges> { |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ClasspaymentRequest { |
| | | |
| | |
| | | @ApiModelProperty(value = "课时id") |
| | | private Long courseConfigId; |
| | | |
| | | @ApiModelProperty(value = "支付金额") |
| | | private BigDecimal payAmount; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class IntegralDetailsResponse { |
| | | |
| | | @ApiModelProperty(value = "可用积分") |
| | | private Integer wpGold; |
| | | |
| | | @ApiModelProperty(value = "记录列表") |
| | | private List<IntegralsData> detailList; |
| | | |
| | | @Data |
| | | public static class IntegralsData{ |
| | | |
| | | @ApiModelProperty(value = "名称") |
| | | private String consumeName; |
| | | |
| | | @ApiModelProperty(value = "时间") |
| | | private String consumeTime; |
| | | |
| | | @ApiModelProperty(value = "金额 例如 -90 ") |
| | | private String consumeAmount; |
| | | |
| | | @ApiModelProperty(value = "1扣减 2增加") |
| | | private Integer detailsType; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MallRequest { |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String lon; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "排序规则 1积分高到低 2积分从低到高 3兑换从高到低") |
| | | private Integer rank; |
| | | |
| | | @ApiModelProperty(value = "商品类型: 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodsType; |
| | | |
| | | @ApiModelProperty(value = "搜索内容") |
| | | private String search; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.userBenefitDetail; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointMallDetailsResponse { |
| | | |
| | | @ApiModelProperty(value = "头像") |
| | | private String headImg; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "可用积分") |
| | | private Integer integral; |
| | | |
| | | @ApiModelProperty(value = "商品列表") |
| | | private List<Goods> goods; |
| | | |
| | | |
| | | @Data |
| | | public static class Goods{ |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private Integer goodId; |
| | | |
| | | @ApiModelProperty(value = "商品封面图") |
| | | private String goodImg; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodName; |
| | | |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value = "积分") |
| | | private Integer integral; |
| | | |
| | | @ApiModelProperty(value = "适用范围: 1 仅限会员 2仅限学员 3全部用户") |
| | | private Integer belongsType; |
| | | |
| | | @ApiModelProperty(value = "商品类型: 1实物 2课包 3门票 4优惠券") |
| | | private Integer goodsType; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | |
| | | 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> |
| | |
| | | */ |
| | | public interface RechargeRecordsService extends IService<RechargeRecords> { |
| | | |
| | | RechargeDetailsVo getAppUserRechargeRecord(String yearMonth, Integer recordId, Integer appUserId); |
| | | |
| | | ResultUtil rechargeCenPayment(Integer userIdFormRedis, RechargePayRequest request); |
| | | |
| | | } |
| | |
| | | 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> |
| | |
| | | * @param recordId 记录id |
| | | * @return |
| | | */ |
| | | BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId); |
| | | BillingDetailsVo queryUserBillingDetails(String yearMonth, Integer recordId,Integer appUserId); |
| | | |
| | | /** |
| | | * 注销账号 |
| | |
| | | */ |
| | | void cancellation(Integer appUserId); |
| | | |
| | | List<RechargeCentVo> getSysRechargeConfig(Integer appUserId); |
| | | } |
New file |
| | |
| | | package com.dsh.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户积分变动记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-10 |
| | | */ |
| | | public interface UserIntegralChangesService extends IService<UserIntegralChanges> { |
| | | |
| | | IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis); |
| | | |
| | | } |
| | |
| | | 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> |
| | |
| | | @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 rechargeCenPayment(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) { |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private RechargeRecordsMapper rrMapper; |
| | | |
| | | @Resource |
| | | private RechargeConfigClient reconMapper; |
| | | |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id,String latitude,String longitude) { |
| | |
| | | } |
| | | |
| | | @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; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.UserIntegralChangesMapper; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户积分变动记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-10 |
| | | */ |
| | | @Service |
| | | public class UserIntegralChangesServiceImpl extends ServiceImpl<UserIntegralChangesMapper, UserIntegralChanges> implements UserIntegralChangesService { |
| | | |
| | | @Resource |
| | | private TAppUserMapper tauMapper; |
| | | |
| | | @Override |
| | | public IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis) { |
| | | IntegralDetailsResponse vo = new IntegralDetailsResponse(); |
| | | List<IntegralDetailsResponse.IntegralsData> 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(); |
| | | } |
| | | List<UserIntegralChanges> userIntegralChanges = this.baseMapper.selectList(new EntityWrapper<UserIntegralChanges>() |
| | | .eq("appUserId",userIdFormRedis ) |
| | | .between("insertTime",monthStart,monthEnd) |
| | | .orderBy("insertTime",false)); |
| | | if (userIntegralChanges.size() > 0 ){ |
| | | for (UserIntegralChanges userIntegralChange : userIntegralChanges) { |
| | | IntegralDetailsResponse.IntegralsData detail= new IntegralDetailsResponse.IntegralsData(); |
| | | switch (userIntegralChange.getType()){ |
| | | case 1: |
| | | detail.setConsumeAmount("+"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("赠送积分"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | case 2: |
| | | detail.setConsumeAmount("-"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("兑换商品"); |
| | | detail.setDetailsType(1); |
| | | break; |
| | | case 3: |
| | | detail.setConsumeAmount("+"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("完成课后练习"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | case 4: |
| | | detail.setConsumeAmount("+"+(userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeTime(simpleDateFormat.format(userIntegralChange.getInsertTime())); |
| | | detail.setConsumeName("观看教学视频"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | detail.setConsumeTime(simpleDateFormat.format(userIntegralChange.getInsertTime())); |
| | | details.add(detail); |
| | | } |
| | | if (null != recordId){ |
| | | details = details.stream() |
| | | .filter(obj -> obj instanceof IntegralDetailsResponse.IntegralsData) |
| | | .filter(obj -> Objects.equals(obj.getDetailsType(), recordId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | TAppUser tAppUser = tauMapper.selectById(userIdFormRedis); |
| | | vo.setWpGold(tAppUser.getIntegral()); |
| | | vo.setDetailList(details); |
| | | } |
| | | return vo; |
| | | } |
| | | } |
New file |
| | |
| | | <?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.account.mapper.UserIntegralChangesMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | 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> |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackageDiscountService tcpdService; |
| | | |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | /** |
| | | * 根据id获取课包 |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 本周福利列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/useBenefit/weekLimitedBenefit") |
| | | @ApiOperation(value = "本周福利-限时折扣列表", tags = {"APP-使用福利"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "discountType",value = "默认显示 限时折扣 (1限时折扣 2赠送课时)") |
| | | }) |
| | | public ResultUtil<WeekLimitedResponse> thisWeeksBenefitList(Integer discountType,String lon,String lat){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(tcpdService.getWeeksBenefitCourse(appUserId,discountType,lon,lat)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.entity.TCoursePackageType; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.model.*; |
| | |
| | | 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 |
| | |
| | | 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; |
| | |
| | | @PostMapping("/base/coursePack/courseOfPurchased") |
| | | public List<PurchaseVo> getAppUsersCourseData(@RequestBody Integer appUserId); |
| | | |
| | | @PostMapping("/base/coursePack/allPaymentCourseList") |
| | | public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId); |
| | | } |
| | |
| | | package com.dsh.course.feignclient.other; |
| | | |
| | | import com.dsh.course.feignclient.other.model.GetDistanceVo; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | @PostMapping("/store/queryStoreById") |
| | | Store queryStoreById(Integer id); |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/distanceCal") |
| | | public long calculateDistance(@RequestBody GetDistanceVo distanceVo); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient.other.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GetDistanceVo { |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | private Integer storeId; |
| | | |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class DiscountJsonDto { |
| | | |
| | | /** |
| | | * type为1,为会员折扣现金支付金额;type为3,为限时折扣现金支付金额 |
| | | */ |
| | | @ApiModelProperty(value = "课时数") |
| | | private Integer courseHours; |
| | | /** |
| | | * type为1,为会员折扣现金支付金额;type为3,为限时折扣现金支付金额 |
| | | */ |
New file |
| | |
| | | package com.dsh.course.model.vo.response; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class WeekLimitedResponse { |
| | | |
| | | @ApiModelProperty(value = "折扣类型 1限时折扣 2赠送课时") |
| | | private Integer discountType; |
| | | |
| | | @ApiModelProperty(value = "数据列表") |
| | | private List<Details> list; |
| | | |
| | | @Data |
| | | public static class Details{ |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String image; |
| | | |
| | | @ApiModelProperty(value = "课包名称") |
| | | private String coursePackageName; |
| | | |
| | | @ApiModelProperty(value = "课包课时数") |
| | | private Integer courseHours; |
| | | |
| | | @ApiModelProperty(value = "赠送课时数(赠送课时取改字段)") |
| | | private Integer donateHours; |
| | | |
| | | @ApiModelProperty(value = "今日/明日/周x") |
| | | private String dataTime; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private Date date; |
| | | |
| | | @ApiModelProperty(value = "原价") |
| | | private Integer originalPrice; |
| | | |
| | | @ApiModelProperty(value = "折后价") |
| | | private Integer discountPrice; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "门店距离") |
| | | private long storeDistance; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface TCoursePackageDiscountService extends IService<TCoursePackageDiscount> { |
| | | |
| | | WeekLimitedResponse getWeeksBenefitCourse(Integer appUserId,Integer discountType,String lon,String lat); |
| | | |
| | | } |
| | |
| | | package com.dsh.course.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.GetDistanceVo; |
| | | import com.dsh.course.mapper.TCoursePackageDiscountMapper; |
| | | import com.dsh.course.mapper.TCoursePackageMapper; |
| | | import com.dsh.course.model.vo.response.WeekLimitedResponse; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.util.DateTimeHelper; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCoursePackageDiscountServiceImpl extends ServiceImpl<TCoursePackageDiscountMapper, TCoursePackageDiscount> implements TCoursePackageDiscountService { |
| | | |
| | | |
| | | @Resource |
| | | private TCoursePackageMapper tcpMapper; |
| | | |
| | | |
| | | @Resource |
| | | private StoreClient sreClient; |
| | | |
| | | |
| | | @Override |
| | | public WeekLimitedResponse getWeeksBenefitCourse(Integer appUserId,Integer discountType,String lon,String lat) { |
| | | Date start = DateTimeHelper.getTodayTime(); |
| | | Date lastTime = DateTimeHelper.getWeekOfLastDay(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | WeekLimitedResponse response= new WeekLimitedResponse(); |
| | | List<WeekLimitedResponse.Details> list = new ArrayList<>(); |
| | | QueryWrapper<TCoursePackageDiscount> tCoursePackageDiscountQueryWrapper = new QueryWrapper<>(); |
| | | tCoursePackageDiscountQueryWrapper.eq("auditStatus",2 ); |
| | | List<TCoursePackageDiscount> tCoursePackageDiscounts = new ArrayList<>(); |
| | | if (null == discountType || discountType == 1){ |
| | | tCoursePackageDiscountQueryWrapper.eq("type",3); |
| | | response.setDiscountType(1); |
| | | tCoursePackageDiscounts = this.baseMapper.selectList(tCoursePackageDiscountQueryWrapper); |
| | | if (tCoursePackageDiscounts.size() > 0){ |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | WeekLimitedResponse.Details ls = new WeekLimitedResponse.Details(); |
| | | |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode rootNode = null; |
| | | rootNode = objectMapper.readTree(tCoursePackageDiscount.getContent()); |
| | | String courseHours = rootNode.get("courseHours").asText(); |
| | | String lifespanEnd = rootNode.get("lifespanEnd").asText(); |
| | | Date endTime = simpleDateFormat.parse(lifespanEnd); |
| | | if (endTime.compareTo(lastTime) < 0){ |
| | | continue; |
| | | } |
| | | TCoursePackage coursePackage = tcpMapper.selectById(tCoursePackageDiscount.getCoursePackageId()); |
| | | GetDistanceVo distanceVo = new GetDistanceVo(); |
| | | distanceVo.setLatitude(lat); |
| | | distanceVo.setLongitude(lon); |
| | | distanceVo.setStoreId(coursePackage.getStoreId()); |
| | | ls.setStoreDistance(sreClient.calculateDistance(distanceVo)); |
| | | // TODO: 2023/7/10 限时折扣查询 |
| | | list.add(ls); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | tCoursePackageDiscountQueryWrapper.eq("type",4); |
| | | response.setDiscountType(2); |
| | | tCoursePackageDiscounts = this.baseMapper.selectList(tCoursePackageDiscountQueryWrapper); |
| | | if (tCoursePackageDiscounts.size() > 0){ |
| | | for (TCoursePackageDiscount tCoursePackageDiscount : tCoursePackageDiscounts) { |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | JsonNode rootNode = null; |
| | | rootNode = objectMapper.readTree(tCoursePackageDiscount.getContent()); |
| | | String courseHours = rootNode.get("courseHours").asText(); |
| | | String lifespanStart = rootNode.get("lifespanStart").asText(); |
| | | String lifespanEnd = rootNode.get("lifespanEnd").asText(); |
| | | String classHours = rootNode.get("classHours").asText(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return response; |
| | | } |
| | | } |
| | |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.*; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | /*public static void main(String[] args) throws ParseException { |
| | | List<Date> allTheDateOftheMonth = getAllTheDateOftheMonth(new Date()); |
| | | Date date = allTheDateOftheMonth.get(11); |
| | | System.out.println(date.toLocaleString()); |
| | | int i = daysBetween(new Date(), date); |
| | | System.out.println(i); |
| | | }*/ |
| | | public static Date getTodayTime(){ |
| | | // 获取当天的开始时间(0点) |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN); |
| | | return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | public static Date getWeekOfLastDay(){ |
| | | // 获取本周的最后一天的时间(23点59分59秒) |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate lastDayOfWeek = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); |
| | | LocalDateTime endOfDay = LocalDateTime.of(lastDayOfWeek, LocalTime.MAX); |
| | | return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.Store; |
| | | import com.dsh.other.feignclient.model.GetAllNearbyStoreList; |
| | | import com.dsh.other.feignclient.model.StoreDetailOfCourse; |
| | | import com.dsh.other.feignclient.model.StoreInfo; |
| | | import com.dsh.other.feignclient.model.StoreLonLatList; |
| | | import com.dsh.other.feignclient.model.*; |
| | | import com.dsh.other.model.BaseVo; |
| | | import com.dsh.other.model.QueryStoreList; |
| | | import com.dsh.other.service.StoreService; |
| | | import com.dsh.other.util.GDMapGeocodingUtil; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import com.dsh.other.util.ToolUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | return storeInfos; |
| | | } |
| | | |
| | | /** |
| | | * 根据门店坐标与传入坐标,计算距离 |
| | | * @param distanceVo |
| | | * @return |
| | | */ |
| | | @PostMapping("/base/protocol/storeDetail/distanceCal") |
| | | public long calculateDistance(@RequestBody GetDistanceVo distanceVo){ |
| | | String current = distanceVo.getLongitude()+","+distanceVo.getLatitude(); |
| | | Store store = storeService.getById(distanceVo.getStoreId()); |
| | | String result = store.getLon()+","+store.getLat(); |
| | | String distanceTOKilometer = gdMapGeocodingUtil.getDistanceTOKilometer(current, result); |
| | | return Long.parseLong(distanceTOKilometer); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/storeOfLonLat") |
| | | public List<StoreLonLatList> getAllStoreLonLats(@RequestBody GetAllNearbyStoreList list ){ |
New file |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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(); |
| | | |
| | | } |
| | |
| | | package com.dsh.other.feignclient; |
| | | |
| | | import com.dsh.other.feignclient.model.GetAllNearbyStoreList; |
| | | import com.dsh.other.feignclient.model.StoreDetailOfCourse; |
| | | import com.dsh.other.feignclient.model.StoreInfo; |
| | | import com.dsh.other.feignclient.model.StoreLonLatList; |
| | | import com.dsh.other.feignclient.model.*; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/storeOfLonLat") |
| | | List<StoreLonLatList> getAllStoreLonLats(@RequestBody GetAllNearbyStoreList list); |
| | | |
| | | |
| | | @PostMapping("/base/protocol/storeDetail/distanceCal") |
| | | public long calculateDistance(@RequestBody GetDistanceVo distanceVo); |
| | | } |
New file |
| | |
| | | package com.dsh.other.feignclient.model; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GetDistanceVo { |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | private Integer storeId; |
| | | |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | } |
New file |
| | |
| | | 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> { |
| | | |
| | | } |
New file |
| | |
| | | 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 { |
| | | |
| | | } |
New file |
| | |
| | | <?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> |