From 689d2413100bbf7b959809bb6dfec5d95d75f6ce Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 22 May 2024 14:10:28 +0800 Subject: [PATCH] bug --- .../controller/BookLabelAndMarketController.java | 3 ++- .../modules/book/controller/BuyOrderController.java | 8 ++++++-- .../controller/CourseMedicineMarketController.java | 12 ++++++++++-- .../controller/CourseSociologyMarketController.java | 10 ++++++++++ .../sociology/controller/CourseController.java | 2 +- .../sociology/service/impl/CourseServiceImpl.java | 4 ++-- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java b/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java index 5bd4d76e..9259ed9f 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java @@ -375,7 +375,8 @@ public class BookLabelAndMarketController { wrapper.eq(ShopProductToBookLabel::getBookLabelId,labelId); wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToBookLabel::getProductId); wrapper.selectAll(ShopProduct.class); - wrapper.orderByAsc(ShopProductToBookLabel::getSort); +// wrapper.orderByAsc(ShopProductToBookLabel::getSort); + wrapper.orderByDesc(ShopProduct::getSumSales); List list = toLabelService.listMaps(wrapper); return R.ok().put("result", list); } diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index 5e3fb3fc..8179a363 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -247,7 +247,8 @@ public class BuyOrderController { totalPrice = totalPrice.add(getShoppingAmount(buyOrder)); //减去积分抵扣 - totalPrice = totalPrice.subtract(buyOrder.getJfDeduction()); + + totalPrice = totalPrice.subtract(buyOrder.getJfDeduction()==null?BigDecimal.ZERO:buyOrder.getJfDeduction()); String orderSn = IdWorker.getTimeId().substring(0, 32); buyOrder.setOrderSn(orderSn); @@ -293,7 +294,7 @@ public class BuyOrderController { recordTransaction(buyOrder, user, totalPrice); } //记录用户积分消费情况 - if(buyOrder.getJfDeduction().compareTo(BigDecimal.ZERO) > 0){ + if(buyOrder.getJfDeduction()!=null&&buyOrder.getJfDeduction().compareTo(BigDecimal.ZERO) > 0){ recordJfTransaction(buyOrder, user, buyOrder.getJfDeduction()); } //消费用户积分并记录用户积分消费记录 @@ -874,6 +875,9 @@ public class BuyOrderController { private boolean useJfCoin(MyUserEntity user,BigDecimal jf){ + if(jf==null){ + return true; + } if(user.getJf().compareTo(jf)>=0){ user.setJf(user.getJf().subtract(jf)); this.myUserService.updateById(user); diff --git a/src/main/java/com/peanut/modules/master/controller/CourseMedicineMarketController.java b/src/main/java/com/peanut/modules/master/controller/CourseMedicineMarketController.java index a407aab1..6f87d88f 100644 --- a/src/main/java/com/peanut/modules/master/controller/CourseMedicineMarketController.java +++ b/src/main/java/com/peanut/modules/master/controller/CourseMedicineMarketController.java @@ -50,7 +50,7 @@ public class CourseMedicineMarketController { @RequestMapping("/addSociologyMarket") public R addSociologyMarket(@RequestBody CourseMedicineMarketEntity courseMedicineMarketEntity){ marketService.save(courseMedicineMarketEntity); - return R.ok().put("market",courseMedicineMarketEntity); + return R.ok().put("result",courseMedicineMarketEntity); } @RequestMapping("/editSociologyMarket") @@ -70,7 +70,7 @@ public class CourseMedicineMarketController { } } marketService.updateById(courseMedicineMarketEntity); - return R.ok().put("market",courseMedicineMarketEntity); + return R.ok().put("result",courseMedicineMarketEntity); } @RequestMapping(path = "/delMarket") @@ -105,6 +105,14 @@ public class CourseMedicineMarketController { return R.ok().put("list",courseByMarketId); } + @RequestMapping("/editMarketSort") + public R editMarketSort(@RequestBody Map map){ + CourseToMedicineMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper().eq(CourseToMedicineMarketEntity::getCourseId, map.get("courseId")).eq(CourseToMedicineMarketEntity::getMedicineMarketId, map.get("marketId")),false); + info.setSort(map.get("sort")); + toMarketService.updateById(info); + return R.ok().put("result",info); + } + /** * 获取未关联课程列表 */ diff --git a/src/main/java/com/peanut/modules/master/controller/CourseSociologyMarketController.java b/src/main/java/com/peanut/modules/master/controller/CourseSociologyMarketController.java index f5620c9a..7f1ecc21 100644 --- a/src/main/java/com/peanut/modules/master/controller/CourseSociologyMarketController.java +++ b/src/main/java/com/peanut/modules/master/controller/CourseSociologyMarketController.java @@ -97,6 +97,16 @@ public class CourseSociologyMarketController { } } + @RequestMapping("/editMarketSort") + public R editMarketSort(@RequestBody Map map){ + CourseToSociologyMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper() + .eq(CourseToSociologyMarketEntity::getSociologyMarketId, map.get("marketId")) + .eq(CourseToSociologyMarketEntity::getCourseId, map.get("courseId")), false); + info.setSort(map.get("sort")); + toMarketService.updateById(info); + return R.ok().put("result",info); + } + @RequestMapping("/getCourseListByMarketId") public R getCourseListByMarketId(@RequestBody Map map){ List marketId = toMarketService.getCourseListByMarketId(map.get("marketId")); diff --git a/src/main/java/com/peanut/modules/sociology/controller/CourseController.java b/src/main/java/com/peanut/modules/sociology/controller/CourseController.java index ac1b48b4..ec3086cf 100644 --- a/src/main/java/com/peanut/modules/sociology/controller/CourseController.java +++ b/src/main/java/com/peanut/modules/sociology/controller/CourseController.java @@ -53,7 +53,7 @@ public class CourseController { } /** - * 获取营销标签下的课程列表 + * 获取国学营销标签下的课程列表 * @param param * @return */ diff --git a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java index 67c1b77e..b260b1d6 100644 --- a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java +++ b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java @@ -77,8 +77,8 @@ public class CourseServiceImpl extends ServiceImpl impl public Page getMarketCourseList(ParamTo param) { MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(CourseEntity.class); - wrapper.leftJoin(CourseToMedicineMarketEntity.class, CourseToMedicineMarketEntity::getCourseId,CourseEntity::getId); - wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,param.getId()); + wrapper.leftJoin(CourseToSociologyMarketEntity.class, CourseToSociologyMarketEntity::getCourseId,CourseEntity::getId); + wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,param.getId()); wrapper.orderByAsc(CourseToSociologyEntity::getSort); Page courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper); return courseEntityPage;