Merge remote-tracking branch 'origin/zcc'

This commit is contained in:
wangjinlei
2024-05-24 16:37:07 +08:00
11 changed files with 313 additions and 53 deletions

View File

@@ -27,20 +27,18 @@ public class MessageController {
@RequestMapping("/listByPage")
public R listByPage(@RequestBody Map<String, Object> params) {
LambdaQueryWrapper<Message> wrapper = new LambdaQueryWrapper();
if (params.containsKey("title")&& StringUtils.isNotEmpty(params.get("title").toString())) {
if (StringUtils.isNotEmpty(params.get("title").toString())) {
wrapper.like(Message::getTitle,params.get("title"));
}
if (params.containsKey("type")&& StringUtils.isNotEmpty(params.get("type").toString())) {
if (StringUtils.isNotEmpty(params.get("type").toString())) {
wrapper.eq(Message::getType,params.get("type"));
}
if (params.containsKey("isBook")&& StringUtils.isNotEmpty(params.get("isBook").toString())) {
wrapper.eq(Message::getIsBook,params.get("isBook"));
}
if (params.containsKey("isMedical")&& StringUtils.isNotEmpty(params.get("isMedical").toString())) {
wrapper.eq(Message::getIsBook,params.get("isMedical"));
}
if (params.containsKey("isSociology")&& StringUtils.isNotEmpty(params.get("isSociology").toString())) {
wrapper.eq(Message::getIsBook,params.get("isSociology"));
if (StringUtils.isNotEmpty(params.get("isBook").toString())||
StringUtils.isNotEmpty(params.get("isMedical").toString())||
StringUtils.isNotEmpty(params.get("isSociology").toString())) {
wrapper.and(t->t.eq("1".equals(params.get("isBook").toString()),Message::getIsBook,params.get("isBook"))
.or().eq("1".equals(params.get("isMedical").toString()),Message::getIsMedical,params.get("isMedical"))
.or().eq("1".equals(params.get("isSociology").toString()),Message::getIsSociology,params.get("isSociology")));
}
wrapper.orderByDesc(Message::getCreateTime);
Page<Message> page = messageService.page(new Page<>(

View File

@@ -0,0 +1,75 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.MyUserEntity;
import com.peanut.modules.common.entity.UserContribution;
import com.peanut.modules.master.service.MyUserService;
import com.peanut.modules.master.service.UserContributionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
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.List;
import java.util.Map;
/**
* 湖分管理
*/
@Slf4j
@RestController("masterUserContribution")
@RequestMapping("master/userContribution")
public class UserContributionController {
@Autowired
private UserContributionService contributionService;
@Autowired
private MyUserService userService;
@RequestMapping("/listByPage")
public R listByPage(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<UserContribution> wrapper = new MPJLambdaWrapper();
wrapper.selectAll(UserContribution.class);
wrapper.leftJoin(MyUserEntity.class, MyUserEntity::getId, UserContribution::getUserId);
if (params.containsKey("userName")&& StringUtils.isNotEmpty(params.get("userName").toString())) {
wrapper.like(MyUserEntity::getName,params.get("userName"));
wrapper.like(MyUserEntity::getNickname,params.get("userName"));
}
if (params.containsKey("tel")&& StringUtils.isNotEmpty(params.get("tel").toString())) {
wrapper.like(MyUserEntity::getTel,params.get("tel"));
}
if (params.containsKey("email")&& StringUtils.isNotEmpty(params.get("email").toString())) {
wrapper.like(MyUserEntity::getEmail,params.get("email"));
}
if (params.containsKey("type")&& StringUtils.isNotEmpty(params.get("type").toString())) {
wrapper.eq(UserContribution::getType,params.get("type"));
}
wrapper.orderByDesc(UserContribution::getCreateTime);
Page<UserContribution> page = contributionService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
List<UserContribution> userContributions = page.getRecords();
if (userContributions.size() > 0){
for (UserContribution contribution : userContributions) {
contribution.setUser(userService.getById(contribution.getUserId()));
}
}
return R.ok().put("result", page);
}
@RequestMapping("/saveUserContribution")
public R saveUserContribution(@RequestBody UserContribution contribution) {
contributionService.save(contribution);
return R.ok();
}
@RequestMapping("/delUserContribution")
public R delMessage(String id) {
contributionService.removeById(id);
return R.ok();
}
}

View File

@@ -0,0 +1,7 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.UserContribution;
public interface UserContributionService extends IService<UserContribution> {
}

View File

@@ -15,7 +15,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -126,34 +128,41 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
continue;
}
CourseEntity one = this.getOne(new LambdaQueryWrapper<CourseEntity>().eq(CourseEntity::getId, c.getCourseId()));
ShopProduct shopProduct = new ShopProduct();
shopProduct.setProductName(one.getTitle()+"."+c.getTitle()+"(半年)");
shopProduct.setPrice(c.getHalfFee());
shopProduct.setGoodsType("05");
shopProduct.setProductStock(2000);
shopProductDao.insert(shopProduct);
//添加半年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
shopProductCourseEntity.setProductId(shopProduct.getProductId());
shopProductCourseEntity.setCourseId(c.getCourseId());
shopProductCourseEntity.setCatalogueId(c.getId());
shopProductCourseEntity.setDays(180);
shopProductCourseDao.insert(shopProductCourseEntity);
//添加一年期商品
ShopProduct shopProduct1 = new ShopProduct();
shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)");
shopProduct1.setPrice(c.getFee());
shopProduct1.setGoodsType("05");
shopProduct1.setProductStock(2000);
shopProductDao.insert(shopProduct1);
//添加一年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
shopProductCourseEntity1.setProductId(shopProduct1.getProductId());
shopProductCourseEntity1.setCourseId(c.getCourseId());
shopProductCourseEntity1.setCatalogueId(c.getId());
shopProductCourseEntity1.setDays(365);
shopProductCourseDao.insert(shopProductCourseEntity1);
if (c.getHalfFee().compareTo(new BigDecimal(0))==1) {
ShopProduct shopProduct = new ShopProduct();
shopProduct.setProductName(one.getTitle() + "." + c.getTitle() + "(半年)");
shopProduct.setPrice(c.getHalfFee());
shopProduct.setGoodsType("05");
shopProduct.setProductStock(2000);
shopProduct.setCreateTime(new Date());
shopProduct.setProductImages(one.getImage());
shopProductDao.insert(shopProduct);
//添加半年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity = new ShopProductCourseEntity();
shopProductCourseEntity.setProductId(shopProduct.getProductId());
shopProductCourseEntity.setCourseId(c.getCourseId());
shopProductCourseEntity.setCatalogueId(c.getId());
shopProductCourseEntity.setDays(180);
shopProductCourseDao.insert(shopProductCourseEntity);
}
if (c.getFee().compareTo(new BigDecimal(0))==1){
//添加一年期商品
ShopProduct shopProduct1 = new ShopProduct();
shopProduct1.setProductName(one.getTitle()+"."+c.getTitle()+"(一年)");
shopProduct1.setPrice(c.getFee());
shopProduct1.setGoodsType("05");
shopProduct1.setProductStock(2000);
shopProduct1.setCreateTime(new Date());
shopProduct1.setProductImages(one.getImage());
shopProductDao.insert(shopProduct1);
//添加一年期的商品课程对应关系
ShopProductCourseEntity shopProductCourseEntity1 = new ShopProductCourseEntity();
shopProductCourseEntity1.setProductId(shopProduct1.getProductId());
shopProductCourseEntity1.setCourseId(c.getCourseId());
shopProductCourseEntity1.setCatalogueId(c.getId());
shopProductCourseEntity1.setDays(365);
shopProductCourseDao.insert(shopProductCourseEntity1);
}
}
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.UserContributionDao;
import com.peanut.modules.common.entity.UserContribution;
import com.peanut.modules.master.service.UserContributionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterUserContributionService")
public class UserContributionServiceImpl extends ServiceImpl<UserContributionDao, UserContribution> implements UserContributionService {
}