复读剔除被删除的课程
This commit is contained in:
@@ -13,8 +13,10 @@ import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.BuyOrderService;
|
||||
import com.peanut.modules.common.service.JfTransactionDetailsService;
|
||||
import com.peanut.modules.common.service.MyUserService;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
import com.peanut.modules.master.service.UserCourseBuyService;
|
||||
import com.peanut.modules.medical.service.CourseService;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
import com.peanut.modules.pay.weChatPay.service.WxpayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -43,6 +45,10 @@ public class CourseRelearnController {
|
||||
@Autowired
|
||||
private UserCourseBuyService userCourseBuyService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@Autowired
|
||||
private CourseCatalogueService courseCatalogueService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@@ -84,15 +90,21 @@ public class CourseRelearnController {
|
||||
@RequestMapping("/courseCatalogueCanRelearn")
|
||||
public R courseCatalogueCanRelearn(@RequestBody Map<String,Object> params){
|
||||
boolean flag = false;
|
||||
List<UserCourseBuyEntity> list = userCourseBuyService.list(new MPJLambdaWrapper<UserCourseBuyEntity>()
|
||||
.disableLogicDel()//查询出已删除数据
|
||||
.eq(UserCourseBuyEntity::getUserId, ShiroUtils.getUId())
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,params.get("courseCatalogueId")));
|
||||
if (list.size() > 0) {
|
||||
flag = true;
|
||||
for (UserCourseBuyEntity userCourseBuyEntity : list) {
|
||||
if (userCourseBuyEntity.getDelFlag()==0) {
|
||||
flag = false;
|
||||
CourseCatalogueEntity cc = courseCatalogueService.getById(params.get("courseCatalogueId").toString());
|
||||
if (cc != null) {
|
||||
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
||||
if (courseEntity != null) {
|
||||
List<UserCourseBuyEntity> list = userCourseBuyService.list(new MPJLambdaWrapper<UserCourseBuyEntity>()
|
||||
.disableLogicDel()//查询出已删除数据
|
||||
.eq(UserCourseBuyEntity::getUserId, ShiroUtils.getUId())
|
||||
.eq(UserCourseBuyEntity::getCatalogueId,params.get("courseCatalogueId")));
|
||||
if (list.size() > 0) {
|
||||
flag = true;
|
||||
for (UserCourseBuyEntity userCourseBuyEntity : list) {
|
||||
if (userCourseBuyEntity.getDelFlag()==0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,39 +114,45 @@ public class CourseRelearnController {
|
||||
//课程目录复读列表
|
||||
@RequestMapping("/relearnShopProductList")
|
||||
public R relearnShopProductList(@RequestBody Map<String,Object> params) {
|
||||
CourseCatalogueEntity cc = courseCatalogueService.getById(params.get("catalogueId").toString());
|
||||
if (cc != null) {
|
||||
CourseEntity courseEntity = courseService.getById(cc.getCourseId());
|
||||
if (courseEntity != null){
|
||||
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(ShopProductCourseEntity.class,ShopProductCourseEntity::getProductId,ShopProduct::getProductId);
|
||||
wrapper.selectAll(ShopProduct.class);
|
||||
wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId"));
|
||||
wrapper.eq(ShopProductCourseEntity::getDays,365);
|
||||
wrapper.orderByAsc(ShopProduct::getPrice);
|
||||
List<ShopProduct> shopProducts = shopProductService.list(wrapper);
|
||||
if (shopProducts.size()>0) {
|
||||
ShopProduct shopProduct = shopProducts.get(0);
|
||||
ShopProduct sp1 = new ShopProduct();
|
||||
sp1.setProductId(shopProduct.getProductId());
|
||||
sp1.setProductName(shopProduct.getProductName().replace("一年","一月"));
|
||||
sp1.setProductImages(shopProduct.getProductImages());
|
||||
BigDecimal sp1Price = shopProduct.getPrice().divide(new BigDecimal(12),0, RoundingMode.DOWN);
|
||||
sp1.setPrice(sp1Price);
|
||||
|
||||
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.leftJoin(ShopProductCourseEntity.class,ShopProductCourseEntity::getProductId,ShopProduct::getProductId);
|
||||
wrapper.selectAll(ShopProduct.class);
|
||||
wrapper.eq(ShopProductCourseEntity::getCatalogueId,params.get("catalogueId"));
|
||||
wrapper.eq(ShopProductCourseEntity::getDays,365);
|
||||
wrapper.orderByAsc(ShopProduct::getPrice);
|
||||
List<ShopProduct> shopProducts = shopProductService.list(wrapper);
|
||||
if (shopProducts.size()>0) {
|
||||
ShopProduct shopProduct = shopProducts.get(0);
|
||||
ShopProduct sp1 = new ShopProduct();
|
||||
sp1.setProductId(shopProduct.getProductId());
|
||||
sp1.setProductName(shopProduct.getProductName().replace("一年","一月"));
|
||||
sp1.setProductImages(shopProduct.getProductImages());
|
||||
BigDecimal sp1Price = shopProduct.getPrice().divide(new BigDecimal(12),0, RoundingMode.DOWN);
|
||||
sp1.setPrice(sp1Price);
|
||||
ShopProduct sp2 = new ShopProduct();
|
||||
sp2.setProductId(shopProduct.getProductId());
|
||||
sp2.setProductName(shopProduct.getProductName().replace("一年","三月"));
|
||||
sp2.setProductImages(shopProduct.getProductImages());
|
||||
BigDecimal sp2Price = shopProduct.getPrice().divide(new BigDecimal(4),0, RoundingMode.DOWN);
|
||||
sp2Price = sp2Price.multiply(new BigDecimal(0.6));
|
||||
sp2Price = sp2Price.setScale(0, RoundingMode.DOWN);
|
||||
sp2.setPrice(sp2Price);
|
||||
|
||||
ShopProduct sp2 = new ShopProduct();
|
||||
sp2.setProductId(shopProduct.getProductId());
|
||||
sp2.setProductName(shopProduct.getProductName().replace("一年","三月"));
|
||||
sp2.setProductImages(shopProduct.getProductImages());
|
||||
BigDecimal sp2Price = shopProduct.getPrice().divide(new BigDecimal(4),0, RoundingMode.DOWN);
|
||||
sp2Price = sp2Price.multiply(new BigDecimal(0.6));
|
||||
sp2Price = sp2Price.setScale(0, RoundingMode.DOWN);
|
||||
sp2.setPrice(sp2Price);
|
||||
|
||||
List<ShopProduct> res = new ArrayList<>();
|
||||
res.add(sp1);
|
||||
res.add(sp2);
|
||||
return R.ok().put("productList",res);
|
||||
}else {
|
||||
return R.error("未找到一年期商品");
|
||||
List<ShopProduct> res = new ArrayList<>();
|
||||
res.add(sp1);
|
||||
res.add(sp2);
|
||||
return R.ok().put("productList",res);
|
||||
}else {
|
||||
return R.error("未找到一年期商品");
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok().put("productList",new ArrayList<>());
|
||||
}
|
||||
|
||||
@RequestMapping("/relearnSave")
|
||||
|
||||
Reference in New Issue
Block a user