Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
@@ -79,6 +79,19 @@ public class BookLabelAndMarketController {
|
||||
return R.ok().put("result", marketTopList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑商品和营销标签的排序权重
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
ShopProductToBookMarket toMarket = toMarketService.getById(map.get("id"));
|
||||
toMarket.setSort(map.get("sort"));
|
||||
toMarketService.updateById(toMarket);
|
||||
return R.ok().put("result",toMarket);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getLabelById")
|
||||
public R getLabelById(String id) {
|
||||
return R.ok().put("result",labelService.getById(id));
|
||||
@@ -279,6 +292,7 @@ public class BookLabelAndMarketController {
|
||||
if (params.containsKey("bookMarketId")&&!"".equals(params.get("bookMarketId").toString())){
|
||||
wrapper.eq(ShopProductToBookMarket::getBookMarketId,params.get("bookMarketId").toString());
|
||||
}
|
||||
wrapper.orderByAsc(ShopProductBookMarket::getSort);
|
||||
Page<ShopProductToBookMarket> page = toMarketService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToBookMarket> res = page.getRecords();
|
||||
@@ -361,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);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,13 @@ public class BuyOrderController {
|
||||
totalPrice = totalPrice.add(getShoppingAmount(buyOrder));
|
||||
|
||||
//减去积分抵扣
|
||||
totalPrice = totalPrice.subtract(buyOrder.getJfDeduction());
|
||||
|
||||
totalPrice = totalPrice.subtract(buyOrder.getJfDeduction()==null?BigDecimal.ZERO:buyOrder.getJfDeduction());
|
||||
|
||||
|
||||
if(buyOrder.getRealMoney().compareTo(totalPrice)!=0){
|
||||
return R.error("系统错误订单金额异常!");
|
||||
}
|
||||
|
||||
String orderSn = IdWorker.getTimeId().substring(0, 32);
|
||||
buyOrder.setOrderSn(orderSn);
|
||||
@@ -293,7 +299,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 +880,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);
|
||||
|
||||
@@ -247,7 +247,7 @@ public class ShopProductController {
|
||||
|
||||
|
||||
/**
|
||||
* 获取关联订单列表
|
||||
* 获取关联商品列表
|
||||
*
|
||||
* @param productId
|
||||
* @return
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.common.entity.SysCourseDirectEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysCourseDirectDao extends MPJBaseMapper<SysCourseDirectEntity> {
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -18,8 +19,17 @@ public class CourseToMedicineMarketEntity {
|
||||
|
||||
private Integer medicineMarketId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private CourseMedicineMarketEntity courseMedicineMarketEntity;
|
||||
|
||||
@TableField(exist = false)
|
||||
private CourseEntity courseEntity;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -18,8 +19,17 @@ public class CourseToSociologyMarketEntity {
|
||||
|
||||
private Integer sociologyMarketId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private CourseSociologyMarketEntity courseSociologyMarketEntity;
|
||||
|
||||
@TableField(exist = false)
|
||||
private CourseEntity courseEntity;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("sys_course_direct")
|
||||
public class SysCourseDirectEntity {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String buyRecord;
|
||||
|
||||
private String useRecord;
|
||||
|
||||
private String studyRecord;
|
||||
|
||||
private String vipRecord;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.peanut.modules.common.to;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EditCourseRecordDto {
|
||||
private Integer type;
|
||||
private Integer recordType;
|
||||
private String content;
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.EditCourseRecordDto;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterService;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterVideoService;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import com.peanut.modules.master.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -34,6 +30,8 @@ public class CourseController {
|
||||
private CourseCatalogueChapterService courseCatalogueChapterService;
|
||||
@Autowired
|
||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||
@Autowired
|
||||
private SysCourseDirectService sysCourseDirectService;
|
||||
|
||||
|
||||
@RequestMapping("/getCourseList")
|
||||
@@ -129,6 +127,26 @@ public class CourseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取课程说明
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getCourseRecord")
|
||||
public R getCourseRecord(@RequestBody Map<String,Integer> map){
|
||||
SysCourseDirectEntity info = sysCourseDirectService.getOne(new LambdaQueryWrapper<SysCourseDirectEntity>().eq(SysCourseDirectEntity::getType, map.get("type")));
|
||||
return R.ok().put("result",info);
|
||||
}
|
||||
|
||||
@RequestMapping("/editCourseRecord")
|
||||
public R editCourseRecord(@RequestBody EditCourseRecordDto editCourseRecordDto){
|
||||
SysCourseDirectEntity sysCourseDirectEntity = sysCourseDirectService.editCourseRecord(editCourseRecordDto);
|
||||
return R.ok().put("result",sysCourseDirectEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/editCourseCatalogueChapterVideo")
|
||||
public R editCourseCatalogueChapterVideo(@RequestBody CourseCatalogueChapterVideoEntity courseCatalogueChapterVideoEntity){
|
||||
courseCatalogueChapterVideoService.updateById(courseCatalogueChapterVideoEntity);
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.peanut.modules.master.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ObjectUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseMedicineMarketEntity;
|
||||
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseMedicineMarketService;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import com.peanut.modules.master.service.CourseToMedicineMarketService;
|
||||
@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController("masterCourseMedicineMarket")
|
||||
@@ -40,58 +41,41 @@ public class CourseMedicineMarketController {
|
||||
return R.ok().put("result", marketsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getMakertListByPid")
|
||||
public R getMakertListByPid(String pid) {
|
||||
LambdaQueryWrapper<CourseMedicineMarketEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(CourseMedicineMarketEntity::getPid,pid);
|
||||
wrapper.orderByAsc(CourseMedicineMarketEntity::getSort);
|
||||
wrapper.orderByAsc(CourseMedicineMarketEntity::getCreateTime);
|
||||
List<CourseMedicineMarketEntity> marketTopList = marketService.list(wrapper);
|
||||
return R.ok().put("result", marketTopList);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getMarketById")
|
||||
public R getMarketById(String id) {
|
||||
public R getMarketById(@RequestBody Map<String,Integer> map) {
|
||||
int id = map.get("id");
|
||||
return R.ok().put("result",marketService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateMarket")
|
||||
public R saveOrUpdateMarket(@RequestBody CourseMedicineMarketEntity market) {
|
||||
if (market.getId()==null){
|
||||
if(market.getPid()==0){
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}else {
|
||||
CourseMedicineMarketEntity m = marketService.getById(market.getPid());
|
||||
if (m.getIsLast()==1){
|
||||
return R.error("请将父标签设置为非最后一集");
|
||||
}else {
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (market.getIsLast() == 1){
|
||||
List mList = marketService.list(new LambdaQueryWrapper<CourseMedicineMarketEntity>()
|
||||
.eq(CourseMedicineMarketEntity::getPid,market.getId()));
|
||||
if (mList.size()>0){
|
||||
return R.error("请先删除子集,再设置为最后一集");
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
@RequestMapping("/addSociologyMarket")
|
||||
public R addSociologyMarket(@RequestBody CourseMedicineMarketEntity courseMedicineMarketEntity){
|
||||
marketService.save(courseMedicineMarketEntity);
|
||||
return R.ok().put("result",courseMedicineMarketEntity);
|
||||
}
|
||||
|
||||
@RequestMapping("/editSociologyMarket")
|
||||
public R editSociologyMarket(@RequestBody CourseMedicineMarketEntity courseMedicineMarketEntity){
|
||||
CourseMedicineMarketEntity old = marketService.getById(courseMedicineMarketEntity.getId());
|
||||
if(courseMedicineMarketEntity.getIsLast()==1&&old.getIsLast()==0){//非终节点到终结点,要排除是否存在子集
|
||||
Integer integer = marketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseMedicineMarketEntity>().eq(CourseMedicineMarketEntity::getPid, courseMedicineMarketEntity.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空子集再操作!");
|
||||
}
|
||||
}
|
||||
|
||||
if(courseMedicineMarketEntity.getIsLast()==0&&old.getIsLast()==1){
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, courseMedicineMarketEntity.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空绑定的课程后,再操作");
|
||||
}
|
||||
}
|
||||
marketService.updateById(courseMedicineMarketEntity);
|
||||
return R.ok().put("result",courseMedicineMarketEntity);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delMarket")
|
||||
public R delMarket(String id) {
|
||||
public R delMarket(@RequestBody Map<String ,Integer> map) {
|
||||
int id = map.get("id");
|
||||
CourseMedicineMarketEntity market = marketService.getById(id);
|
||||
if (market.getIsLast()==1){
|
||||
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
|
||||
@@ -114,66 +98,55 @@ public class CourseMedicineMarketController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签下课程
|
||||
*/
|
||||
@RequestMapping(path = "/getCourseByMarketId")
|
||||
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
|
||||
MPJLambdaWrapper<CourseToMedicineMarketEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToMedicineMarketEntity::getCourseId);
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,params.get("marketId"));
|
||||
Page res = toMarketService.pageMaps(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
return R.ok().put("result", res);
|
||||
public R getCourseByMarketId(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
List<CourseToMedicineMarketEntity> courseByMarketId = toMarketService.getCourseByMarketId(marketId);
|
||||
return R.ok().put("list",courseByMarketId);
|
||||
}
|
||||
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
CourseToMedicineMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未关联课程列表
|
||||
*/
|
||||
@RequestMapping("/getNotToMarketList")
|
||||
public R getNotToMarketList(@RequestBody Map params){
|
||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
if (params.containsKey("marketId")&&!"".equals(params.get("marketId").toString())){
|
||||
String sql = "select course_id from course_to_market where del_flag = 0 and market_id = "+params.get("marketId");
|
||||
wrapper.notInSql(CourseEntity::getId,sql);
|
||||
}
|
||||
Page<CourseEntity> page = courseService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
public R getNotToMarketList(@RequestBody ParamTo param){
|
||||
List<Integer> collect1 = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, param.getId())).stream().map(CourseToMedicineMarketEntity::getCourseId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CourseEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.notIn(collect1.size()>0,CourseEntity::getId,collect1);
|
||||
wrapper1.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||
Page<CourseEntity> page1 = courseService.page(new Page<>(param.getPage(), param.getLimit()), wrapper1);
|
||||
return R.ok().put("page",page1);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveToMarket")
|
||||
public R saveToMarket(@RequestBody Map params) {
|
||||
if (!StringUtils.isEmpty(params.get("courseId").toString())){
|
||||
String[] ids = params.get("courseId").toString().split(",");
|
||||
if (ids.length > 0) {
|
||||
for (String id : ids) {
|
||||
CourseToMedicineMarketEntity toMarket = new CourseToMedicineMarketEntity();
|
||||
toMarket.setMedicineMarketId(Integer.parseInt(params.get("marketId").toString()));
|
||||
toMarket.setCourseId(Integer.parseInt(id));
|
||||
toMarketService.save(toMarket);
|
||||
}
|
||||
}
|
||||
@RequestMapping("/bindCourseAndMedicineMarket")
|
||||
public R bindCourseAndMedicineMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId, marketId).eq(CourseToMedicineMarketEntity::getCourseId, courseId));
|
||||
if(integer>0){
|
||||
return R.error("不可重复绑定");
|
||||
}
|
||||
CourseToMedicineMarketEntity courseToMedicineMarketEntity = new CourseToMedicineMarketEntity();
|
||||
courseToMedicineMarketEntity.setMedicineMarketId(marketId);
|
||||
courseToMedicineMarketEntity.setCourseId(courseId);
|
||||
toMarketService.save(courseToMedicineMarketEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delToMarket")
|
||||
public R delToMarket(String marketId,String courseId) {
|
||||
if(StringUtils.isNotEmpty(courseId)){
|
||||
String[] productIds = courseId.split(",");
|
||||
for(String id : productIds){
|
||||
LambdaQueryWrapper<CourseToMedicineMarketEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId);
|
||||
wrapper.eq(CourseToMedicineMarketEntity::getCourseId,id);
|
||||
toMarketService.remove(wrapper);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("参数为空");
|
||||
@RequestMapping("/unbindCourseAndMedicineMarket")
|
||||
public R unbindCourseAndMedicineMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
toMarketService.getBaseMapper().delete(new LambdaQueryWrapper<CourseToMedicineMarketEntity>().eq(CourseToMedicineMarketEntity::getMedicineMarketId,marketId).eq(CourseToMedicineMarketEntity::getCourseId,courseId));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.peanut.modules.master.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ObjectUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController("masterCourseSociologyMarket")
|
||||
@@ -37,58 +40,41 @@ public class CourseSociologyMarketController {
|
||||
return R.ok().put("result", courseSociologyMarketEntities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getMakertListByPid")
|
||||
public R getMakertListByPid(String pid) {
|
||||
LambdaQueryWrapper<CourseSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(CourseSociologyMarketEntity::getPid,pid);
|
||||
wrapper.orderByAsc(CourseSociologyMarketEntity::getSort);
|
||||
wrapper.orderByAsc(CourseSociologyMarketEntity::getCreateTime);
|
||||
List<CourseSociologyMarketEntity> marketTopList = marketService.list(wrapper);
|
||||
return R.ok().put("result", marketTopList);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getMarketById")
|
||||
public R getMarketById(String id) {
|
||||
public R getMarketById(@RequestBody Map<String,Integer> map) {
|
||||
int id = map.get("id");
|
||||
return R.ok().put("result",marketService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateMarket")
|
||||
public R saveOrUpdateMarket(@RequestBody CourseSociologyMarketEntity market) {
|
||||
if (market.getId()==null){
|
||||
if(market.getPid()==0){
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}else {
|
||||
CourseSociologyMarketEntity m = marketService.getById(market.getPid());
|
||||
if (m.getIsLast()==1){
|
||||
return R.error("请将父标签设置为非最后一集");
|
||||
}else {
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (market.getIsLast() == 1){
|
||||
List mList = marketService.list(new LambdaQueryWrapper<CourseSociologyMarketEntity>()
|
||||
.eq(CourseSociologyMarketEntity::getPid,market.getId()));
|
||||
if (mList.size()>0){
|
||||
return R.error("请先删除子集,再设置为最后一集");
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
@RequestMapping("/addSociologyMarket")
|
||||
public R addSociologyMarket(@RequestBody CourseSociologyMarketEntity courseSociologyMarketEntity){
|
||||
marketService.save(courseSociologyMarketEntity);
|
||||
return R.ok().put("market",courseSociologyMarketEntity);
|
||||
}
|
||||
|
||||
@RequestMapping("/editSociologyMarket")
|
||||
public R editSociologyMarket(@RequestBody CourseSociologyMarketEntity courseSociologyMarketEntity){
|
||||
CourseSociologyMarketEntity old = marketService.getById(courseSociologyMarketEntity.getId());
|
||||
if(courseSociologyMarketEntity.getIsLast()==1&&old.getIsLast()==0){//非终节点到终结点,要排除是否存在子集
|
||||
Integer integer = marketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseSociologyMarketEntity>().eq(CourseSociologyMarketEntity::getPid, courseSociologyMarketEntity.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空子集再操作!");
|
||||
}
|
||||
}
|
||||
|
||||
if(courseSociologyMarketEntity.getIsLast()==0&&old.getIsLast()==1){
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, courseSociologyMarketEntity.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空绑定的课程后,再操作");
|
||||
}
|
||||
}
|
||||
marketService.updateById(courseSociologyMarketEntity);
|
||||
return R.ok().put("market",courseSociologyMarketEntity);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delMarket")
|
||||
public R delMarket(String id) {
|
||||
public R delMarket(@RequestBody Map<String ,Integer> map) {
|
||||
int id = map.get("id");
|
||||
CourseSociologyMarketEntity market = marketService.getById(id);
|
||||
if (market.getIsLast()==1){
|
||||
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
|
||||
@@ -111,66 +97,115 @@ public class CourseSociologyMarketController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
CourseToSociologyMarketEntity info = toMarketService.getOne(new LambdaQueryWrapper<CourseToSociologyMarketEntity>()
|
||||
.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<String,Integer> map){
|
||||
List<CourseToSociologyMarketEntity> marketId = toMarketService.getCourseListByMarketId(map.get("marketId"));
|
||||
return R.ok().put("list",marketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签下课程
|
||||
*/
|
||||
@RequestMapping(path = "/getCourseByMarketId")
|
||||
public R getCourseByMarket(@RequestBody Map<String, Object> params) {
|
||||
MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToSociologyMarketEntity::getCourseId);
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,params.get("marketId"));
|
||||
Page res = toMarketService.pageMaps(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
return R.ok().put("result", res);
|
||||
// @RequestMapping(path = "/getCourseByMarketId")
|
||||
// public R getCourseByMarket(@RequestBody Map<String, Object> params) {
|
||||
// MPJLambdaWrapper<CourseToSociologyMarketEntity> wrapper = new MPJLambdaWrapper();
|
||||
// wrapper.leftJoin(CourseEntity.class,CourseEntity::getId, CourseToSociologyMarketEntity::getCourseId);
|
||||
// wrapper.selectAll(CourseEntity.class);
|
||||
// wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
// wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,params.get("marketId"));
|
||||
// Page res = toMarketService.pageMaps(new Page<>(
|
||||
// Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
// return R.ok().put("result", res);
|
||||
// }
|
||||
|
||||
@RequestMapping("/getNotToMarketList")
|
||||
public R getNotToMarketList(@RequestBody ParamTo param){
|
||||
List<Integer> collect = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, param.getId())).stream().map(CourseToSociologyMarketEntity::getCourseId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.notIn(collect.size()>0,CourseEntity::getId,collect);
|
||||
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||
Page<CourseEntity> page = courseService.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||
return R.ok().put("page",page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未关联课程列表
|
||||
*/
|
||||
@RequestMapping("/getNotToMarketList")
|
||||
public R getNotToMarketList(@RequestBody Map params){
|
||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
if (params.containsKey("marketId")&&!"".equals(params.get("marketId").toString())){
|
||||
String sql = "select course_id from course_to_market where del_flag = 0 and market_id = "+params.get("marketId");
|
||||
wrapper.notInSql(CourseEntity::getId,sql);
|
||||
}
|
||||
Page<CourseEntity> page = courseService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
// @RequestMapping("/getNotToMarketList")
|
||||
// public R getNotToMarketList(@RequestBody Map params){
|
||||
// LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper();
|
||||
// wrapper.like(CourseEntity::getTitle,params.get("title"));
|
||||
// if (params.containsKey("marketId")&&!"".equals(params.get("marketId").toString())){
|
||||
// String sql = "select course_id from course_to_market where del_flag = 0 and market_id = "+params.get("marketId");
|
||||
// wrapper.notInSql(CourseEntity::getId,sql);
|
||||
// }
|
||||
// Page<CourseEntity> page = courseService.page(new Page<>(
|
||||
// Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
// return R.ok().put("result", page);
|
||||
// }
|
||||
|
||||
@RequestMapping(path = "/saveToMarket")
|
||||
public R saveToMarket(@RequestBody Map params) {
|
||||
if (!StringUtils.isEmpty(params.get("courseId").toString())){
|
||||
String[] ids = params.get("courseId").toString().split(",");
|
||||
if (ids.length > 0) {
|
||||
for (String id : ids) {
|
||||
CourseToSociologyMarketEntity toMarket = new CourseToSociologyMarketEntity();
|
||||
toMarket.setSociologyMarketId(Integer.parseInt(params.get("marketId").toString()));
|
||||
toMarket.setCourseId(Integer.parseInt(id));
|
||||
toMarketService.save(toMarket);
|
||||
}
|
||||
}
|
||||
@RequestMapping("/bindCourseAndSociologyMarket")
|
||||
public R bindCourseAndSociologyMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId, marketId).eq(CourseToSociologyMarketEntity::getCourseId, courseId));
|
||||
if(integer>0){
|
||||
return R.error("不可重复绑定");
|
||||
}
|
||||
CourseToSociologyMarketEntity courseToSociologyMarketEntity = new CourseToSociologyMarketEntity();
|
||||
courseToSociologyMarketEntity.setSociologyMarketId(marketId);
|
||||
courseToSociologyMarketEntity.setCourseId(courseId);
|
||||
toMarketService.save(courseToSociologyMarketEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delToMarket")
|
||||
public R delToMarket(String marketId,String courseId) {
|
||||
if(StringUtils.isNotEmpty(courseId)){
|
||||
String[] productIds = courseId.split(",");
|
||||
for(String id : productIds){
|
||||
LambdaQueryWrapper<CourseToSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
|
||||
wrapper.eq(CourseToSociologyMarketEntity::getCourseId,id);
|
||||
toMarketService.remove(wrapper);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("参数为空");
|
||||
@RequestMapping("/unbindCourseAndSociologyMarket")
|
||||
public R unbindCourseAndSociologyMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
toMarketService.getBaseMapper().delete(new LambdaQueryWrapper<CourseToSociologyMarketEntity>().eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId).eq(CourseToSociologyMarketEntity::getCourseId,courseId));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
// @RequestMapping(path = "/saveToMarket")
|
||||
// public R saveToMarket(@RequestBody Map params) {
|
||||
// if (!StringUtils.isEmpty(params.get("courseId").toString())){
|
||||
// String[] ids = params.get("courseId").toString().split(",");
|
||||
// if (ids.length > 0) {
|
||||
// for (String id : ids) {
|
||||
// CourseToSociologyMarketEntity toMarket = new CourseToSociologyMarketEntity();
|
||||
// toMarket.setSociologyMarketId(Integer.parseInt(params.get("marketId").toString()));
|
||||
// toMarket.setCourseId(Integer.parseInt(id));
|
||||
// toMarketService.save(toMarket);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return R.ok();
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(path = "/delToMarket")
|
||||
// public R delToMarket(String marketId,String courseId) {
|
||||
// if(StringUtils.isNotEmpty(courseId)){
|
||||
// String[] productIds = courseId.split(",");
|
||||
// for(String id : productIds){
|
||||
// LambdaQueryWrapper<CourseToSociologyMarketEntity> wrapper = new LambdaQueryWrapper();
|
||||
// wrapper.eq(CourseToSociologyMarketEntity::getSociologyMarketId,marketId);
|
||||
// wrapper.eq(CourseToSociologyMarketEntity::getCourseId,id);
|
||||
// toMarketService.remove(wrapper);
|
||||
// }
|
||||
// return R.ok();
|
||||
// }
|
||||
// return R.error("参数为空");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -116,6 +116,18 @@ public class MedicineLabelAndMarketController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品和营销标签下的排序权重
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
ShopProductToMedicineMarket toMarket = toMarketService.getById(map.get("id"));
|
||||
toMarket.setSort(map.get("sort"));
|
||||
toMarketService.updateById(toMarket);
|
||||
return R.ok().put("result",toMarket);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delLabel")
|
||||
public R delLabel(String id) {
|
||||
ShopProductMedicineLabel label = labelService.getById(id);
|
||||
@@ -279,6 +291,7 @@ public class MedicineLabelAndMarketController {
|
||||
if (params.containsKey("medicineMarketId")&&!"".equals(params.get("medicineMarketId").toString())){
|
||||
wrapper.eq(ShopProductToMedicineMarket::getMedicineMarketId,params.get("medicineMarketId").toString());
|
||||
}
|
||||
wrapper.orderByAsc(ShopProductToMedicineMarket::getSort);
|
||||
Page<ShopProductToMedicineMarket> page = toMarketService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToMedicineMarket> res = page.getRecords();
|
||||
|
||||
@@ -226,6 +226,14 @@ public class SociologyLabelAndMarketController {
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
ShopProductToSociologyMarket toMarket = toMarketService.getById(map.get("id"));
|
||||
toMarket.setSort(map.get("sort"));
|
||||
toMarketService.updateById(toMarket);
|
||||
return R.ok().put("market",toMarket);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取书标签列表
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CourseToMedicineMarketService extends IService<CourseToMedicineMarketEntity> {
|
||||
|
||||
List<CourseToMedicineMarketEntity> getCourseByMarketId(int marketId);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
|
||||
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CourseToSociologyMarketService extends IService<CourseToSociologyMarketEntity> {
|
||||
|
||||
List<CourseToSociologyMarketEntity> getCourseListByMarketId(int marketId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.SysCourseDirectEntity;
|
||||
import com.peanut.modules.common.to.EditCourseRecordDto;
|
||||
|
||||
public interface SysCourseDirectService extends IService<SysCourseDirectEntity> {
|
||||
|
||||
SysCourseDirectEntity editCourseRecord(EditCourseRecordDto editCourseRecordDto);
|
||||
}
|
||||
@@ -52,8 +52,8 @@ public class CourseMedicineServiceImpl extends ServiceImpl<CourseMedicineDao, Co
|
||||
}
|
||||
}
|
||||
if(old.getIsLast()==1&& courseMedicine.getIsLast()==0){
|
||||
CourseToMedicine courseToSociologyEntity = toMedicalDao.selectOne(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, courseMedicine.getId()));
|
||||
if(courseToSociologyEntity!=null){
|
||||
Integer integer = toMedicalDao.selectCount(new LambdaQueryWrapper<CourseToMedicine>().eq(CourseToMedicine::getMedicalId, courseMedicine.getId()));
|
||||
if(integer>0){
|
||||
return R.error(502,"更新失败,请先把此项与课程的关联关系清空后才可把此标签变成普通标签");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.dao.CourseDao;
|
||||
import com.peanut.modules.common.dao.CourseMedicineMarketDao;
|
||||
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
|
||||
import com.peanut.modules.master.service.CourseToMedicineMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterCourseToMarketService")
|
||||
public class CourseToMedicineMarketServiceImpl extends ServiceImpl<CourseToMedicineMarketDao, CourseToMedicineMarketEntity> implements CourseToMedicineMarketService {
|
||||
@Autowired
|
||||
private CourseMedicineMarketDao courseMedicineMarketDao;
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
|
||||
@Override
|
||||
public List<CourseToMedicineMarketEntity> getCourseByMarketId(int marketId) {
|
||||
List<CourseToMedicineMarketEntity> courseToMedicineMarketEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToMedicineMarketEntity>()
|
||||
.eq(CourseToMedicineMarketEntity::getMedicineMarketId, marketId)
|
||||
.orderByAsc(CourseToMedicineMarketEntity::getSort));
|
||||
for (CourseToMedicineMarketEntity c :courseToMedicineMarketEntities){
|
||||
c.setCourseMedicineMarketEntity(courseMedicineMarketDao.selectById(c.getMedicineMarketId()));
|
||||
c.setCourseEntity(courseDao.selectById(c.getCourseId()));
|
||||
}
|
||||
return courseToMedicineMarketEntities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,40 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.dao.CourseDao;
|
||||
import com.peanut.modules.common.dao.CourseSociologyMarketDao;
|
||||
import com.peanut.modules.common.dao.CourseToMedicineMarketDao;
|
||||
import com.peanut.modules.common.dao.CourseToSociologyMarketDao;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseToMedicineMarketEntity;
|
||||
import com.peanut.modules.common.entity.CourseToSociologyMarketEntity;
|
||||
import com.peanut.modules.master.service.CourseToMedicineMarketService;
|
||||
import com.peanut.modules.master.service.CourseToSociologyMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterCourseToSociologyMarketService")
|
||||
public class CourseToSociologyMarketServiceImpl extends ServiceImpl<CourseToSociologyMarketDao, CourseToSociologyMarketEntity> implements CourseToSociologyMarketService {
|
||||
@Autowired
|
||||
private CourseSociologyMarketDao courseSociologyMarketDao;
|
||||
@Autowired
|
||||
private CourseDao courseDao;
|
||||
|
||||
@Override
|
||||
public List<CourseToSociologyMarketEntity> getCourseListByMarketId(int marketId) {
|
||||
List<CourseToSociologyMarketEntity> courseToSociologyMarketEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToSociologyMarketEntity>()
|
||||
.eq(CourseToSociologyMarketEntity::getSociologyMarketId, marketId)
|
||||
.orderByAsc(CourseToSociologyMarketEntity::getSort));
|
||||
for (CourseToSociologyMarketEntity c : courseToSociologyMarketEntities){
|
||||
c.setCourseSociologyMarketEntity(courseSociologyMarketDao.selectById(c.getSociologyMarketId()));
|
||||
c.setCourseEntity(courseDao.selectById(c.getCourseId()));
|
||||
}
|
||||
return courseToSociologyMarketEntities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.SysCourseDirectDao;
|
||||
import com.peanut.modules.common.entity.SysCourseDirectEntity;
|
||||
import com.peanut.modules.common.to.EditCourseRecordDto;
|
||||
import com.peanut.modules.master.service.SysCourseDirectService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterSysCourseDirect")
|
||||
public class SysCourseDirectServiceImpl extends ServiceImpl<SysCourseDirectDao, SysCourseDirectEntity> implements SysCourseDirectService {
|
||||
|
||||
@Override
|
||||
public SysCourseDirectEntity editCourseRecord(EditCourseRecordDto editCourseRecordDto) {
|
||||
SysCourseDirectEntity one = this.getOne(new LambdaQueryWrapper<SysCourseDirectEntity>().eq(SysCourseDirectEntity::getType, editCourseRecordDto.getType()));
|
||||
switch (editCourseRecordDto.getRecordType()){
|
||||
case 0:
|
||||
one.setBuyRecord(editCourseRecordDto.getContent());
|
||||
break;
|
||||
case 1:
|
||||
one.setUseRecord(editCourseRecordDto.getContent());
|
||||
break;
|
||||
case 2:
|
||||
one.setStudyRecord(editCourseRecordDto.getContent());
|
||||
break;
|
||||
case 3:
|
||||
one.setVipRecord(editCourseRecordDto.getContent());
|
||||
break;
|
||||
}
|
||||
this.updateById(one);
|
||||
return one;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,10 @@ import com.peanut.modules.common.dao.CourseCatalogueChapterVideoDao;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterVideoEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.SysCourseDirectEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueChapterVideoService;
|
||||
import com.peanut.modules.master.service.SysCourseDirectService;
|
||||
import com.peanut.modules.sociology.service.CourseCatalogueChapterService;
|
||||
import com.peanut.modules.sociology.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +40,8 @@ public class CourseController {
|
||||
private CourseCatalogueChapterService courseCatalogueChapterService;
|
||||
@Autowired
|
||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||
@Autowired
|
||||
private SysCourseDirectService sysCourseDirectService;
|
||||
|
||||
/**
|
||||
* 获取用户最近学习课程列表
|
||||
@@ -53,7 +57,7 @@ public class CourseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签下的课程列表
|
||||
* 获取国学营销标签下的课程列表
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@@ -63,6 +67,26 @@ public class CourseController {
|
||||
return R.ok().put("courseList",marketCourseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取课程说明
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getSociologyCourseRecord")
|
||||
public R getSociologyCourseRecord(){
|
||||
SysCourseDirectEntity byId = sysCourseDirectService.getById(2);
|
||||
return R.ok().put("result",byId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国学课程价格
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getCoursePrice")
|
||||
public R getCoursePrice(){
|
||||
List coursePrice = courseService.getCoursePrice();
|
||||
return R.ok().put("list",coursePrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国学标签下的课程列表
|
||||
* @param param
|
||||
@@ -136,7 +160,7 @@ public class CourseController {
|
||||
|
||||
@RequestMapping("/getMyCourse")
|
||||
public R getMyCourse(@RequestBody Map<String,Integer> map){
|
||||
List<CourseEntity> courses = courseService.getMyCourse(map.get("type"));
|
||||
List courses = courseService.getMyCourse(map.get("type"));
|
||||
return R.ok().put("courses",courses);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,5 +22,7 @@ public interface CourseService extends IService<CourseEntity> {
|
||||
|
||||
Map<String, Object> getCourseDetail(Integer id);
|
||||
|
||||
List<CourseEntity> getMyCourse(int type);
|
||||
List getMyCourse(int type);
|
||||
|
||||
List getCoursePrice();
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
public Page<CourseEntity> getMarketCourseList(ParamTo param) {
|
||||
MPJLambdaWrapper<CourseEntity> 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<CourseEntity> courseEntityPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), CourseEntity.class, wrapper);
|
||||
return courseEntityPage;
|
||||
@@ -131,6 +131,32 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getCoursePrice() {
|
||||
//获取所有国学标签
|
||||
List<CourseSociologyEntity> courseSociologyEntities = courseSociologyDao.selectList(null);
|
||||
ArrayList<Map> flag = new ArrayList<>();
|
||||
for (CourseSociologyEntity c : courseSociologyEntities){
|
||||
HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
||||
MPJLambdaWrapper<CourseToSociologyEntity> courseToSociologyEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||
courseToSociologyEntityMPJLambdaWrapper.selectAll(CourseEntity.class);
|
||||
courseToSociologyEntityMPJLambdaWrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyEntity::getCourseId);
|
||||
courseToSociologyEntityMPJLambdaWrapper.eq(CourseToSociologyEntity::getSociologyId,c.getId());
|
||||
List<CourseEntity> courseEntities = courseToSociologyDao.selectJoinList(CourseEntity.class, courseToSociologyEntityMPJLambdaWrapper);
|
||||
if(courseEntities.size()==0){
|
||||
continue;
|
||||
}
|
||||
for (CourseEntity co:courseEntities){
|
||||
List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueDao.selectList(new LambdaQueryWrapper<CourseCatalogueEntity>().eq(CourseCatalogueEntity::getCourseId, co.getId()).orderByAsc(CourseCatalogueEntity::getSort));
|
||||
co.setCourseCatalogueEntityList(courseCatalogueEntities);
|
||||
}
|
||||
stringObjectHashMap.put("sociology",c);
|
||||
stringObjectHashMap.put("courseList",courseEntities);
|
||||
flag.add(stringObjectHashMap);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private Integer catalogueCompletion(CourseCatalogueEntity c){
|
||||
List<CourseCatalogueChapterEntity> courseCatalogueChapterEntities = courseCatalogueChapterDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterEntity>().eq(CourseCatalogueChapterEntity::getCatalogueId, c.getId()));
|
||||
Integer act = 0;
|
||||
|
||||
Reference in New Issue
Block a user