心灵空间

This commit is contained in:
wuchunlei
2025-02-07 17:10:49 +08:00
parent d8e7c90c01
commit 26d08a5f8b
28 changed files with 1027 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import com.peanut.common.utils.R;
import com.peanut.modules.common.dao.ShopProductToLabelDao;
import com.peanut.modules.book.service.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.CoursePsycheService;
import com.peanut.modules.common.service.MessageService;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.medical.service.CourseMedicalService;
@@ -18,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -58,6 +60,8 @@ public class VisitorController {
private MessageService messageService;
@Autowired
private com.peanut.modules.sociology.service.ShopProductService medicineShopProductService;
@Autowired
private CoursePsycheService coursePsycheService;
//新书
@RequestMapping("/getNewBook")
@@ -223,6 +227,7 @@ public class VisitorController {
wrapper.eq(message.getIsBook()==1,Message::getIsBook,1);
wrapper.eq(message.getIsMedical()==1,Message::getIsMedical,1);
wrapper.eq(message.getIsSociology()==1,Message::getIsSociology,1);
wrapper.eq(message.getIsPsyche()==1,Message::getIsPsyche,1);
wrapper.orderByDesc(Message::getCreateTime);
List<Message> messages = messageService.getBaseMapper().selectList(wrapper);
return R.ok().put("messages", messages);
@@ -262,4 +267,38 @@ public class VisitorController {
Page<CourseEntity> marketCourseList = sociologyCourseService.getMarketCourseList(param);
return R.ok().put("courseList",marketCourseList);
}
//获取心灵空间标签树
@RequestMapping("/getCoursePsycheTree")
public R getCoursePsycheTree(){
List<CoursePsyche> psychesTree = coursePsycheService.getCoursePsycheTree();
return R.ok().put("labels",psychesTree);
}
/**
* 心灵空间营销标签下商品列表
*/
@RequestMapping("/getPsycheMarketShopProductList")
public R getPsycheMarketShopProductList(@RequestBody Map params){
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper();
wrapper.selectAll(ShopProduct.class);
wrapper.rightJoin(ShopProductToPsycheMarket.class,ShopProductToPsycheMarket::getProductId,ShopProduct::getProductId);
if (params.containsKey("psycheMarketId")&&!"".equals(params.get("psycheMarketId").toString())){
wrapper.eq(ShopProductToPsycheMarket::getPsycheMarketId,params.get("psycheMarketId").toString());
}
Page<ShopProduct> page = productService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
//心灵空间营销标签下的课程列表
@RequestMapping("/getPsycheMarketCourseList")
public R getPsycheMarketCourseList(@RequestBody Map params){
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(CourseEntity.class);
wrapper.leftJoin(CourseToPsycheMarket.class, CourseToPsycheMarket::getCourseId,CourseEntity::getId);
wrapper.eq(CourseToPsycheMarket::getPsycheMarketId,params.get("id"));
wrapper.orderByAsc(CourseToPsyche::getSort);
Page<CourseEntity> courseEntityPage = courseService.page(new Page<>(
Long.parseLong(params.get("page").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("courseList",courseEntityPage);
}
}

View File

@@ -44,5 +44,9 @@ public class SysUserTokenEntity implements Serializable {
private String tokenSociology;
//更新时间
private Date sociologyUpdateTime;
//token
private String tokenPsyche;
//更新时间
private Date psycheUpdateTime;
}

View File

@@ -95,6 +95,8 @@ public class OAuth2Realm extends AuthorizingRealm {
tokenEntity.setMedicalUpdateTime(now);
}else if ("sociology".equals(appType)){
tokenEntity.setSociologyUpdateTime(now);
}else if ("psyche".equals(appType)){
tokenEntity.setPsycheUpdateTime(now);
}
sysUserTokenService.updateById(tokenEntity);
}

View File

@@ -53,6 +53,9 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
}else if ("sociology".equals(appType)){
tokenEntity.setTokenSociology(token);
tokenEntity.setSociologyUpdateTime(now);
}else if ("psyche".equals(appType)){
tokenEntity.setTokenPsyche(token);
tokenEntity.setPsycheUpdateTime(now);
}
tokenEntity.setUserId(userId);
tokenEntity.setExpireTime(expireTime);