Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java into zcc
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TaihuWelfareDao extends MPJBaseMapper<TaihuWelfareEntity> {
|
||||
}
|
||||
@@ -1,4 +1,27 @@
|
||||
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("taihu_welfare")
|
||||
public class TaihuWelfareEntity {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String url;
|
||||
|
||||
private String content;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
||||
@@ -15,4 +15,6 @@ public class ParamTo {
|
||||
|
||||
private String keywords;
|
||||
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.R;
|
||||
@@ -33,13 +34,10 @@ public class ShopStoreController {
|
||||
*/
|
||||
@RequestMapping("/getStoreList")
|
||||
public R getStoreList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<ShopStore> wrapper = new MPJLambdaWrapper();
|
||||
if (params.containsKey("name")&&!"".equals(params.get("name").toString())){
|
||||
wrapper.like(ShopStore::getName,params.get("name").toString());
|
||||
}
|
||||
Page<ShopStore> page = shopStoreService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
LambdaQueryWrapper<ShopStore> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByAsc(ShopStore::getSort);
|
||||
List<ShopStore> shopStores = shopStoreService.getBaseMapper().selectList(wrapper);
|
||||
return R.ok().put("list",shopStores);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getStoreById")
|
||||
@@ -51,7 +49,7 @@ public class ShopStoreController {
|
||||
@RequestMapping(path = "/saveOrUpdateStore")
|
||||
public R saveOrUpdateStore(@RequestBody ShopStore store) {
|
||||
shopStoreService.saveOrUpdate(store);
|
||||
return R.ok();
|
||||
return R.ok().put("result",store);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delStore")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.TaihuWelfareService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("masterTaihuWelfare")
|
||||
@RequestMapping("master/taihuWelfare")
|
||||
public class TaihuWelfareController {
|
||||
@Autowired
|
||||
private TaihuWelfareService taihuWelfareService;
|
||||
|
||||
@RequestMapping("/getArticleList")
|
||||
public R getArticleList(@RequestBody ParamTo param){
|
||||
Page articleList = taihuWelfareService.getArticleList(param.getPage(), param.getLimit());
|
||||
return R.ok().put("page",articleList);
|
||||
}
|
||||
|
||||
@RequestMapping("/addArticle")
|
||||
public R addArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
|
||||
taihuWelfareService.save(taihuWelfareEntity);
|
||||
return R.ok().put("result",taihuWelfareEntity);
|
||||
}
|
||||
|
||||
@RequestMapping("/editArticle")
|
||||
public R editArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
|
||||
taihuWelfareService.updateById(taihuWelfareEntity);
|
||||
return R.ok().put("result",taihuWelfareEntity);
|
||||
}
|
||||
|
||||
@RequestMapping("/delArticle")
|
||||
public R delArticle(@RequestBody Map<String,Integer> map){
|
||||
int id = map.get("id");
|
||||
taihuWelfareService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||
|
||||
public interface TaihuWelfareService extends IService<TaihuWelfareEntity> {
|
||||
|
||||
Page getArticleList(int page,int limit);
|
||||
}
|
||||
@@ -44,7 +44,8 @@ public class ShopStoreToProductServiceImpl extends ServiceImpl<ShopStoreToProduc
|
||||
.stream().map(ShopStoreToProductEntity::getProductId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<ShopProduct> shopProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
shopProductLambdaQueryWrapper.like(StringUtils.isNotBlank(param.getKeywords()),ShopProduct::getProductName,param.getKeywords());
|
||||
shopProductLambdaQueryWrapper.notIn(ShopProduct::getProductId,collect);
|
||||
shopProductLambdaQueryWrapper.eq(param.getType().equals("00"),ShopProduct::getGoodsType,param.getType());
|
||||
shopProductLambdaQueryWrapper.notIn(collect.size()>0,ShopProduct::getProductId,collect);
|
||||
Page<ShopProduct> shopProductPage = shopProductDao.selectPage(new Page<>(param.getPage(), param.getLimit()), shopProductLambdaQueryWrapper);
|
||||
return shopProductPage;
|
||||
}
|
||||
@@ -69,6 +70,9 @@ public class ShopStoreToProductServiceImpl extends ServiceImpl<ShopStoreToProduc
|
||||
@Override
|
||||
public R editStoreProductSort(Map<String, Integer> map) {
|
||||
ShopStoreToProductEntity info = this.getById(map.get("id"));
|
||||
if (info==null){
|
||||
return R.error("查找失败!");
|
||||
}
|
||||
info.setSort(map.get("sort"));
|
||||
this.updateById(info);
|
||||
return R.ok().put("result",info);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.TaihuWelfareDao;
|
||||
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||
import com.peanut.modules.master.service.TaihuWelfareService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("masterTaihuWelfareService")
|
||||
public class TaihuWelfareServiceImpl extends ServiceImpl<TaihuWelfareDao, TaihuWelfareEntity> implements TaihuWelfareService {
|
||||
|
||||
@Override
|
||||
public Page getArticleList(int page, int limit) {
|
||||
LambdaQueryWrapper<TaihuWelfareEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByAsc(TaihuWelfareEntity::getSort);
|
||||
Page<TaihuWelfareEntity> taihuWelfareEntityPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
return taihuWelfareEntityPage;
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,16 @@ public class CourseController {
|
||||
return R.ok().put("data",chapterDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开通免费课程
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/startStudyForMF")
|
||||
public R startStudyForMF(@RequestBody Map<String,Integer> map){
|
||||
return courseService.startStudyForMF(map.get("catalogueId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取课程详情
|
||||
* @param param
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.peanut.modules.sociology.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseCatalogueChapterEntity;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
@@ -25,4 +26,6 @@ public interface CourseService extends IService<CourseEntity> {
|
||||
List getMyCourse(int type);
|
||||
|
||||
List getCoursePrice();
|
||||
|
||||
R startStudyForMF(int catalogueId);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.modules.common.dao.*;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
@@ -157,6 +158,36 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R startStudyForMF(int catalogueId) {
|
||||
Integer uId = ShiroUtils.getUId();
|
||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueDao.selectById(catalogueId);
|
||||
if(courseCatalogueEntity.getType()!=0){
|
||||
return R.error("领取失败,此课程为非免费课程");
|
||||
}
|
||||
LambdaQueryWrapper<UserCourseBuyEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UserCourseBuyEntity::getUserId,uId);
|
||||
wrapper.eq(UserCourseBuyEntity::getCatalogueId,catalogueId);
|
||||
wrapper.lt(UserCourseBuyEntity::getEndTime,new Date());
|
||||
Integer integer = userCourseBuyDao.selectCount(wrapper);
|
||||
if(integer>0){
|
||||
return R.error("您已拥有本门课程,无需领取");
|
||||
}
|
||||
UserCourseBuyEntity userCourseBuyEntity = new UserCourseBuyEntity();
|
||||
userCourseBuyEntity.setUserId(uId);
|
||||
userCourseBuyEntity.setCourseId(courseCatalogueEntity.getCourseId());
|
||||
userCourseBuyEntity.setCatalogueId(catalogueId);
|
||||
userCourseBuyEntity.setDays(30);
|
||||
userCourseBuyEntity.setCreateTime(new Date());
|
||||
userCourseBuyEntity.setStartTime(new Date());
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
cal.add(Calendar.DAY_OF_MONTH,30);
|
||||
userCourseBuyEntity.setEndTime(cal.getTime());
|
||||
userCourseBuyDao.insert(userCourseBuyEntity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private Integer catalogueCompletion(CourseCatalogueEntity c){
|
||||
List<CourseCatalogueChapterEntity> courseCatalogueChapterEntities = courseCatalogueChapterDao.selectList(new LambdaQueryWrapper<CourseCatalogueChapterEntity>().eq(CourseCatalogueChapterEntity::getCatalogueId, c.getId()));
|
||||
Integer act = 0;
|
||||
|
||||
@@ -210,8 +210,8 @@
|
||||
|
||||
<!-- <!– 4.2 生产环境:输出到文档–>-->
|
||||
<springProfile name="test,prod">
|
||||
<logger name="com.peanut" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="DEBUG_FILE"/>
|
||||
<logger name="com.peanut" level="ERROR" additivity="false">
|
||||
<!-- <appender-ref ref="DEBUG_FILE"/>-->
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</logger>
|
||||
<root level="info">
|
||||
|
||||
Reference in New Issue
Block a user