前端-胡立永 1 month ago
parent
commit
f34bd41122
15 changed files with 128 additions and 48 deletions
  1. +14
    -0
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiBooksController.java
  2. +2
    -6
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiLoginController.java
  3. +11
    -12
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiMemberController.java
  4. +6
    -6
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiPromotionController.java
  5. +19
    -0
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/entity/StatisticsVo.java
  6. +2
    -0
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiBooksService.java
  7. +3
    -1
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiCouponService.java
  8. +3
    -0
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiWaterService.java
  9. +25
    -8
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiBooksServiceImpl.java
  10. +5
    -3
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiCouponServiceImpl.java
  11. +4
    -1
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiIndexServiceImpl.java
  12. +22
    -3
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiWaterServiceImpl.java
  13. +6
    -4
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletBooks/entity/AppletBooks.java
  14. +2
    -0
      jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletWithdrawal/entity/AppletWithdrawal.java
  15. +4
    -4
      jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/pay_weixin.properties

+ 14
- 0
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiBooksController.java View File

@ -55,6 +55,20 @@ public class AppletApiBooksController {
return Result.OK(list);
}
/**
* 查询书籍详情
*
* @return 查询书籍详情
*/
@Operation(summary = "查询书籍详情", description = "查询书籍详情")
@GetMapping(value = "/list")
@IgnoreAuth
public Result<AppletBooks> list(@Parameter(description = "书籍id") String id) {
log.info("查询书籍详情");
return Result.OK(appletApiBooksService.detail(id));
}
/**
* 查询书籍标签
*


+ 2
- 6
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiLoginController.java View File

@ -39,8 +39,7 @@ public class AppletApiLoginController {
@Operation(summary = "微信小程序登录", description = "通过微信code进行小程序登录")
@IgnoreAuth
public Result<Map<String, Object>> wxLogin(
@Parameter(description = "微信登录code", required = true)
String code,
@Parameter(description = "微信登录code", required = true) String code,
@Parameter(description = "邀请人") String inviter) {
if (StringUtils.isBlank(code)) {
@ -61,9 +60,7 @@ public class AppletApiLoginController {
@Operation(summary = "获取用户手机号", description = "通过微信code获取用户手机号")
@IgnoreAuth
public Result<String> getPhoneNumber(
@Parameter(description = "手机号获取code", required = true)
String code) {
@Parameter(description = "手机号获取code", required = true) String code) {
if (StringUtils.isBlank(code)) {
return Result.error("手机号获取code不能为空");
}
@ -105,7 +102,6 @@ public class AppletApiLoginController {
/**
* 更新用户信息
*
* @param userInfo 用户信息
* @return 更新结果
*/


+ 11
- 12
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiMemberController.java View File

@ -1,6 +1,8 @@
package org.jeecg.modules.applet.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
@ -27,38 +29,35 @@ public class AppletApiMemberController {
@Autowired
private AppletApiCouponService appletCouponService;
@Operation(summary = "获取会员列表", description = "获取会员列表")
@GetMapping(value = "/list")
@IgnoreAuth
public Result<List<AppletVip>> list(AppletVip appletVip) {
List<AppletVip> vipList = appletApiVipService.getList(appletVip);
public Result<List<AppletVip>> list() {
List<AppletVip> vipList = appletApiVipService.getList(null);
return Result.OK(vipList);
}
@Operation(summary = "开通会员", description = "参数会员id 套餐id 优惠价id")
@Operation(summary = "开通会员", description = "参数会员id 套餐id 优惠卷id")
@PostMapping(value = "/open")
public Result<Object> open(AppletMemberOrder appletMemberOrder) {
Object open = appletApiVipService.getOpe(appletMemberOrder);
return Result.OK(open);
}
@IgnoreAuth
@PostMapping("/payNotify")
public Object payNotify(@RequestBody String requestBody) {
return appletApiVipService.payNotify(requestBody);
}
@Operation(summary = "获取优惠劵", description = "获取优惠劵")
@GetMapping(value = "/coupon")
public Result<List<AppletCoupon>> coupon(AppletCoupon appletCoupon) {
List<AppletCoupon> couponList = appletCouponService.getcoupon(appletCoupon);
return Result.OK(couponList);
public Result<IPage<AppletCoupon>> coupon(
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
String status) {
Page<AppletCoupon> page = new Page<>(pageNo, pageSize);
return Result.OK(appletCouponService.getCoupon(page, status));
}
}

+ 6
- 6
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/controller/AppletApiPromotionController.java View File

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.AppletUser;
import org.jeecg.config.shiro.IgnoreAuth;
import org.jeecg.modules.applet.entity.StatisticsVo;
import org.jeecg.modules.applet.service.AppletApiWaterService;
import org.jeecg.modules.demo.appletWater.entity.AppletWater;
import org.jeecg.modules.demo.appletWithdrawal.entity.AppletWithdrawal;
@ -23,6 +24,7 @@ import java.util.List;
@RestController
@RequestMapping("/appletApi/promotion")
public class AppletApiPromotionController {
@Autowired
private AppletApiWaterService appletApiWaterService;
@ -41,7 +43,6 @@ public class AppletApiPromotionController {
return Result.OK(UserList);
}
@IgnoreAuth
@Operation(summary = "佣金流水", description = "佣金流水")
@GetMapping(value = "/water")
@ -53,18 +54,17 @@ public class AppletApiPromotionController {
return Result.OK(list);
}
@Operation(summary = "提现【待开发】", description = "参数:提现人 提现金额")
@Operation(summary = "提现", description = "参数:提现人 提现金额")
@PostMapping(value = "/withdraw")
public Result<AppletWithdrawal> withdraw(AppletWithdrawal appletWithdrawal) {
AppletWithdrawal With = appletApiWaterService.getWithdraw(appletWithdrawal);
return Result.OK(With);
}
@Operation(summary = "推广统计【待开发】", description = "推广统计")
@Operation(summary = "推广统计", description = "推广统计")
@GetMapping(value = "/statistics")
public Result<?> statistics() {
return Result.OK();
public Result<StatisticsVo> statistics() {
return Result.OK(appletApiWaterService.statistics());
}
}

+ 19
- 0
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/entity/StatisticsVo.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.applet.entity;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StatisticsVo {
@Schema(description = "推广人数")
private Long num;
}

+ 2
- 0
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiBooksService.java View File

@ -50,4 +50,6 @@ public interface AppletApiBooksService {
List<AppletLabel> getLabel();
List<AppletCategorize> category();
AppletBooks detail(String id);
}

+ 3
- 1
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiCouponService.java View File

@ -1,9 +1,11 @@
package org.jeecg.modules.applet.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.demo.appletCoupon.entity.AppletCoupon;
import java.util.List;
public interface AppletApiCouponService {
List<AppletCoupon> getcoupon(AppletCoupon appletCoupon);
IPage<AppletCoupon> getCoupon(Page<AppletCoupon> page, String type);
}

+ 3
- 0
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/AppletApiWaterService.java View File

@ -3,6 +3,7 @@ package org.jeecg.modules.applet.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.system.vo.AppletUser;
import org.jeecg.modules.applet.entity.StatisticsVo;
import org.jeecg.modules.demo.appletWater.entity.AppletWater;
import org.jeecg.modules.demo.appletWithdrawal.entity.AppletWithdrawal;
@ -34,4 +35,6 @@ public interface AppletApiWaterService {
*/
AppletWithdrawal getWithdraw(AppletWithdrawal appletWithdrawal);
StatisticsVo statistics();
}

+ 25
- 8
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiBooksServiceImpl.java View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jodd.util.StringUtil;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.util.AppletUserUtil;
import org.jeecg.common.system.vo.AppletUser;
import org.jeecg.modules.applet.query.AppletBookQuery;
import org.jeecg.modules.applet.service.AppletApiBooksService;
import org.jeecg.modules.demo.appletBookStand.entity.AppletBookStand;
@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -51,13 +53,16 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService {
*/
@Override
public IPage<AppletBooks> getBooks(Page<AppletBooks> page, String title, String category, String label) {
return appletBooksService
Page<AppletBooks> list = appletBooksService
.lambdaQuery()
.like(StringUtil.isNotEmpty(title), AppletBooks::getBooksName, title)
.eq(StringUtil.isNotEmpty(category), AppletBooks::getBooksClassification, category)
.like(StringUtil.isNotEmpty(label), AppletBooks::getBooksLabel, label)
.eq(AppletBooks::getStatus, "Y")
.page(page);
return list;
}
/**
@ -104,6 +109,9 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService {
appletBookStand.setUserId(userId);
appletBookStand.setBookId(id);
appletBookStandService.save(appletBookStand);
}else {
one.setUpdateTime(new Date());
appletBookStandService.updateById(one);
}
}
@ -127,23 +135,16 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService {
/**
* 获取课程列表
*
* @param id
* @return
*/
@Override
public IPage<AppletCourse> getCourses(Page<AppletCourse> coursePage, String id) {
// 先验证书籍是否存在
AppletBooks book = appletBooksService.getById(id);
if (book == null) {
throw new JeecgBootException("书籍不存在");
}
// 根据书籍ID查询关联的课程列表
IPage<AppletCourse> pageResult = appletCourseService
.lambdaQuery()
.eq(AppletCourse::getBookId, id)
.page(coursePage);
return pageResult;
}
@ -157,4 +158,20 @@ public class AppletApiBooksServiceImpl implements AppletApiBooksService {
return appletCategorizeService.list();
}
@Override
public AppletBooks detail(String id) {
AppletBooks book = appletBooksService.getById(id);
AppletUser user = AppletUserUtil.getAppletUserFromRequest();
if (user != null){
book.setIsStand(appletBookStandService.lambdaQuery()
.eq(AppletBookStand::getBookId, book.getId())
.eq(AppletBookStand::getUserId, user.getId())
.one() != null);
}
return book;
}
}

+ 5
- 3
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiCouponServiceImpl.java View File

@ -1,5 +1,7 @@
package org.jeecg.modules.applet.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.applet.service.AppletApiCouponService;
import org.jeecg.modules.demo.appletCoupon.entity.AppletCoupon;
import org.jeecg.modules.demo.appletCoupon.service.IAppletCouponService;
@ -11,17 +13,17 @@ import java.util.List;
@Service
public class AppletApiCouponServiceImpl implements AppletApiCouponService {
@Autowired
private IAppletCouponService appletCouponService;
/**
* 获取优惠卷
*
* @param appletCoupon
* @return
*/
@Override
public List<AppletCoupon> getcoupon(AppletCoupon appletCoupon) {
return appletCouponService.list();
public IPage<AppletCoupon> getCoupon(Page<AppletCoupon> page, String status) {
return appletCouponService.page(page);
}
}

+ 4
- 1
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiIndexServiceImpl.java View File

@ -42,7 +42,10 @@ public class AppletApiIndexServiceImpl implements AppletApiIndexService {
*/
@Override
public List<AppletLink> getLink() {
return appletLinkService.list();
return appletLinkService
.lambdaQuery()
.select(AppletLink::getId, AppletLink::getImg)
.list();
}
/**


+ 22
- 3
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiWaterServiceImpl.java View File

@ -6,6 +6,7 @@ import org.jeecg.common.api.IAppletUserService;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.util.AppletUserUtil;
import org.jeecg.common.system.vo.AppletUser;
import org.jeecg.modules.applet.entity.StatisticsVo;
import org.jeecg.modules.applet.service.AppletApiWaterService;
import org.jeecg.modules.common.IdUtils;
import org.jeecg.modules.demo.appletWater.entity.AppletWater;
@ -71,7 +72,6 @@ public class AppletApiWaterServiceImpl implements AppletApiWaterService {
}
//获得用户id
String userId = AppletUserUtil.getCurrentAppletUserId();
appletWithdrawal.setUserId(userId);
AppletUser currentUser = AppletUserUtil.getCurrentAppletUser();
if (currentUser.getCommission() == null || currentUser.getCommission().compareTo(appletWithdrawal.getMoney()) < 0) {
@ -79,20 +79,39 @@ public class AppletApiWaterServiceImpl implements AppletApiWaterService {
}
//添加流水记录
appletWaterService.save(AppletWater.builder()
AppletWater water = AppletWater.builder()
.user(appletWithdrawal.getUserId())
.money((appletWithdrawal.getMoney()))
.number(IdUtils.generateNoLS())
.oldMoney(currentUser.getCommission())
.title("提现")
.type("2")
.build());
.build();
appletWaterService.save(water);
BigDecimal subtract = currentUser.getCommission().subtract(appletWithdrawal.getMoney());
currentUser.setCommission(subtract);
appletUserService.updateById(currentUser);
//保存提现记录
appletWithdrawal.setWaterId(water.getId());
appletWithdrawal.setWithdrawStatus("0");
appletWithdrawal.setUserId(userId);
appletWithdrawalService.save(appletWithdrawal);
return appletWithdrawal;
}
@Override
public StatisticsVo statistics() {
String userId = AppletUserUtil.getCurrentAppletUserId();
Long count = appletUserService.lambdaQuery()
.eq(AppletUser::getInviter, userId)
.count();
return StatisticsVo.builder()
.num(count)
.build();
}
}

+ 6
- 4
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletBooks/entity/AppletBooks.java View File

@ -4,10 +4,8 @@ import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
@ -88,4 +86,8 @@ public class AppletBooks implements Serializable {
@Excel(name = "会员", width = 15)
@Schema(description = "会员")
private java.lang.String vip;
@TableField(exist = false)
@Schema(description = "是否加入书桌")
private Boolean isStand;
}

+ 2
- 0
jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletWithdrawal/entity/AppletWithdrawal.java View File

@ -87,4 +87,6 @@ public class AppletWithdrawal implements Serializable {
@Dict(dicCode = "applet_withdraw_type")
@Schema(description = "提现状态")
private java.lang.String withdrawStatus;
@Schema(description = "流水号")
private java.lang.String waterId;
}

+ 4
- 4
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/pay_weixin.properties View File

@ -2,7 +2,7 @@ pay.mchId=1711030469
pay.appId=wx8ff2ab9559aa6387
pay.mchKey=0fdb77429ffdf206c151af76a663041c
pay.keyPath=classpath:apiclient_cert.pem
pay.notifyUrl=https://www.petualmedical.com/health-admin/appletApi/member/payNotify
pay.notifyUrlDev=https://www.petualmedical.com/health-admin/appletApi/member/payNotify
pay.notifyOneUrl=https://www.petualmedical.com/health-admin/appletApi/member/payNotify
pay.notifyUrlOneDev=https://www.petualmedical.com/health-admin/appletApi/member/payNotify
pay.notifyUrl=https://www.multipleculture.com/englishread-admin/appletApi/member/payNotify
pay.notifyUrlDev=https://www.multipleculture.com/englishread-admin/appletApi/member/payNotify
pay.notifyOneUrl=https://www.multipleculture.com/englishread-admin/appletApi/member/payNotify
pay.notifyUrlOneDev=https://www.multipleculture.com/englishread-admin/appletApi/member/payNotify

Loading…
Cancel
Save