From 50a63e32817bcd08ed34dce2d5b84146c17578b5 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Wed, 11 Sep 2024 15:40:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E4=B8=AD=E7=9A=84=E8=AF=95?= =?UTF-8?q?=E5=8D=B7=E4=BF=AE=E6=94=B9=20=E6=96=B0=E5=A2=9E=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ClassExamServiceImpl.java | 12 ++++++---- .../controller/ShopProductController.java | 22 ------------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/peanut/modules/common/service/impl/ClassExamServiceImpl.java b/src/main/java/com/peanut/modules/common/service/impl/ClassExamServiceImpl.java index 93743062..87d60f9d 100644 --- a/src/main/java/com/peanut/modules/common/service/impl/ClassExamServiceImpl.java +++ b/src/main/java/com/peanut/modules/common/service/impl/ClassExamServiceImpl.java @@ -242,10 +242,14 @@ public class ClassExamServiceImpl extends ServiceImpl i public R examingPaper() { ClassExamUser classExamUser = classExamUserDao.selectOne(new LambdaQueryWrapper() .eq(ClassExamUser::getUserId,ShiroUtils.getUId()).eq(ClassExamUser::getScoreSuccess,0)); - ClassEntity classEntity = classEntityDao.selectById(classExamUser.getClassId()); - ClassModel classModel = classModelDao.selectById(classEntity.getModelId()); - return R.ok().put("classExamUser",classExamUser) - .put("planEndTime",DateUtils.addDateMinutes(classExamUser.getStartTime(),classModel.getExamTime())); + if (classExamUser!=null){ + ClassEntity classEntity = classEntityDao.selectById(classExamUser.getClassId()); + ClassModel classModel = classModelDao.selectById(classEntity.getModelId()); + return R.ok().put("classExamUser",classExamUser) + .put("planEndTime",DateUtils.addDateMinutes(classExamUser.getStartTime(),classModel.getExamTime())); + }else { + return R.ok().put("classExamUser",null).put("planEndTime",null); + } } @Override diff --git a/src/main/java/com/peanut/modules/master/controller/ShopProductController.java b/src/main/java/com/peanut/modules/master/controller/ShopProductController.java index 0c19b16c..b3d1ebe4 100644 --- a/src/main/java/com/peanut/modules/master/controller/ShopProductController.java +++ b/src/main/java/com/peanut/modules/master/controller/ShopProductController.java @@ -32,8 +32,6 @@ public class ShopProductController { @Autowired private ShopProductService shopProductService; - @Autowired - private ShopProductBookService shopProductBookService; /** * 列表 @@ -61,27 +59,7 @@ public class ShopProductController { @RequestMapping("/addProduct") public R addProduct(@RequestBody ShopProduct shopProduct){ shopProduct.setCreateTime(new Date()); - String bkids = ""; - for (String s : shopProduct.getBookids()) { - bkids += s + ","; - } - if (bkids != null && !bkids.isEmpty()) { - String substring = bkids.substring(0, bkids.length() - 1); - shopProduct.setBookId(substring); - } else { - shopProduct.setBookId(""); - } shopProductService.save(shopProduct); - ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity(); - for (String s : shopProduct.getBookids()) { - String bookIdList = s; - if (bookIdList != null) { - Integer product = shopProduct.getProductId(); - shopProductBookEntity.setProductId(product); - shopProductBookEntity.setBookId(Integer.valueOf(bookIdList)); - shopProductBookService.save(shopProductBookEntity); - } - } return R.ok(); }