feat: 模型评论模块
parent
d8d3bd97dd
commit
9cd41fe268
|
@ -0,0 +1,77 @@
|
||||||
|
//package com.mcwl.web.controller.comment;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//import com.mcwl.comment.domain.ProductCommentConditionEntity;
|
||||||
|
//import com.mcwl.comment.domain.ProductCommentEntity;
|
||||||
|
//import com.mcwl.comment.service.impl.CommentServiceImpl;
|
||||||
|
//import com.mcwl.common.utils.ResponsePageEntity;
|
||||||
|
//import com.mcwl.resource.domain.MallProduct;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//
|
||||||
|
//import javax.validation.constraints.NotNull;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @Author:ChenYan
|
||||||
|
// * @Project:McWl
|
||||||
|
// * @Package:com.mcwl.web.controller.comment
|
||||||
|
// * @Filename:CommentController
|
||||||
|
// * @Description TODO
|
||||||
|
// * @Date:2025/1/4 18:56
|
||||||
|
// */
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("/comment")
|
||||||
|
//public class CommentController {
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private CommentServiceImpl commentService;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 通过id查询商品评论信息
|
||||||
|
// *
|
||||||
|
// * @param id 系统ID
|
||||||
|
// * @return 商品评论信息
|
||||||
|
// */
|
||||||
|
// @GetMapping("/findById")
|
||||||
|
// public MallProduct findById(Long id) {
|
||||||
|
// return commentService.findById(id);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 添加商品评论
|
||||||
|
// *
|
||||||
|
// * @param productCommentEntity 商品评论实体
|
||||||
|
// * @return 影响行数
|
||||||
|
// */
|
||||||
|
// @PostMapping("/insert")
|
||||||
|
// public int insert(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||||
|
// return commentService.insert(productCommentEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改商品评论
|
||||||
|
// *
|
||||||
|
// * @param productCommentEntity 商品评论实体
|
||||||
|
// * @return 影响行数
|
||||||
|
// */
|
||||||
|
// @PostMapping("/update")
|
||||||
|
// public int update(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||||
|
// return commentService.update(productCommentEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 批量删除商品评论
|
||||||
|
// *
|
||||||
|
// * @param ids 商品评论ID集合
|
||||||
|
// * @return 影响行数
|
||||||
|
// */
|
||||||
|
// @PostMapping("/deleteByIds")
|
||||||
|
// public int deleteByIds(@RequestBody @NotNull List<Long> ids) {
|
||||||
|
// return commentService.deleteByIds(ids);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
|
@ -2,35 +2,41 @@ package com.mcwl.web.controller.pay.AliPay;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.lang.UUID;
|
import cn.hutool.core.lang.UUID;
|
||||||
|
import cn.hutool.db.sql.Order;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.*;
|
||||||
import com.alipay.api.AlipayClient;
|
import com.alipay.api.AlipayClient;
|
||||||
import com.alipay.api.AlipayConfig;
|
|
||||||
import com.alipay.api.DefaultAlipayClient;
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
import com.alipay.api.domain.AlipayFundAccountQueryModel;
|
import com.alipay.api.domain.*;
|
||||||
import com.alipay.api.domain.AlipayFundTransToaccountTransferModel;
|
|
||||||
import com.alipay.api.request.AlipayFundAccountQueryRequest;
|
import com.alipay.api.request.AlipayFundAccountQueryRequest;
|
||||||
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
||||||
|
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
||||||
import com.alipay.api.response.AlipayFundAccountQueryResponse;
|
import com.alipay.api.response.AlipayFundAccountQueryResponse;
|
||||||
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
||||||
|
import com.alipay.api.CertAlipayRequest;
|
||||||
|
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||||
import com.alipay.easysdk.factory.Factory;
|
import com.alipay.easysdk.factory.Factory;
|
||||||
import com.alipay.easysdk.kernel.Config;
|
import com.alipay.easysdk.kernel.Config;
|
||||||
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
|
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
|
||||||
import com.mcwl.common.core.redis.RedisCache;
|
import com.mcwl.common.core.redis.RedisCache;
|
||||||
import com.mcwl.common.exception.ServiceException;
|
import com.mcwl.common.exception.ServiceException;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
|
import com.mcwl.memberCenter.domain.Member;
|
||||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||||
import com.mcwl.memberCenter.service.MemberLevelService;
|
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||||
import com.mcwl.memberCenter.service.MemberService;
|
import com.mcwl.memberCenter.service.MemberService;
|
||||||
import com.mcwl.pay.config.AliConfig;
|
import com.mcwl.pay.config.AliConfig;
|
||||||
import com.mcwl.pay.domain.OrderTrade;
|
import com.mcwl.pay.domain.OrderTrade;
|
||||||
import com.mcwl.pay.domain.OrderTradeDto;
|
import com.mcwl.pay.domain.OrderTradeDto;
|
||||||
|
import com.mcwl.resource.service.MallProductService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -44,10 +50,17 @@ public class AliPayIntegration {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MemberService memberService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberLevelService memberLevelService;
|
private MemberLevelService memberLevelService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MallProductService mallProductService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AliConfig aliConfig;
|
private AliConfig aliConfig;
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
package com.mcwl.web.controller.resource;
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
|
||||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
|
||||||
import com.mcwl.resource.service.ModelCommentService;
|
|
||||||
import com.mcwl.resource.service.ModelLikeService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.web.controller.resource
|
|
||||||
* @Filename:ModelCommentcontroller
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 11:36
|
|
||||||
*/
|
|
||||||
@RequestMapping("/ModelComment")
|
|
||||||
@RestController
|
|
||||||
public class ModelCommentController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelLikeService modelLikeService;
|
|
||||||
@Autowired
|
|
||||||
private ModelCommentService modelCommentService;
|
|
||||||
@Autowired
|
|
||||||
private ModelCommentLikeService modelCommentLikeService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型点赞/取消
|
|
||||||
*/
|
|
||||||
@GetMapping("/imageLike/{imageId}")
|
|
||||||
public AjaxResult like(@PathVariable Long imageId) {
|
|
||||||
modelLikeService.like(imageId);
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型评论发布
|
|
||||||
*/
|
|
||||||
@PostMapping("/comment")
|
|
||||||
public AjaxResult comment(@RequestBody ModelComment modelComment) {
|
|
||||||
modelCommentService.comment(modelComment);
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型评论点赞/取消
|
|
||||||
*/
|
|
||||||
@GetMapping("/commentLike/{commentId}")
|
|
||||||
public AjaxResult commentLike(@PathVariable Long commentId) {
|
|
||||||
modelCommentLikeService.like(commentId);
|
|
||||||
return AjaxResult.error();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.mcwl</groupId>
|
||||||
|
<artifactId>mcwl</artifactId>
|
||||||
|
<version>3.8.8</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>mcwl-comment</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<description>
|
||||||
|
评论模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mcwl</groupId>
|
||||||
|
<artifactId>mcwl-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- <!– 资源中心–>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.mcwl</groupId>-->
|
||||||
|
<!-- <artifactId>mcwl-resource</artifactId>-->
|
||||||
|
<!-- <version>3.8.8</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>${mybatis-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mcwl</groupId>
|
||||||
|
<artifactId>mcwl-resource</artifactId>
|
||||||
|
<version>3.8.8</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -1,48 +0,0 @@
|
||||||
package com.mcwl.resource.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型评论
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
@TableName("model_comment")
|
|
||||||
public class ModelComment extends BaseEntity {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型id
|
|
||||||
*/
|
|
||||||
private Long modelId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论内容
|
|
||||||
*/
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 父评论id
|
|
||||||
*/
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点赞数
|
|
||||||
*/
|
|
||||||
private Integer likeNum;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package com.mcwl.resource.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型评论点赞
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
@TableName("model_comment_like")
|
|
||||||
public class ModelCommentLike extends BaseEntity {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型评论id
|
|
||||||
*/
|
|
||||||
private Long modelCommentId;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.mcwl.resource.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型点赞表
|
|
||||||
*/
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
@TableName("model_like")
|
|
||||||
public class ModelLike extends BaseEntity {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模型id
|
|
||||||
*/
|
|
||||||
private Long modelId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.mcwl.resource.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.mcwl.resource.domain.ModelCommentLike;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.mapper
|
|
||||||
* @Filename:ModelCommentLikeMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:02
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface ModelCommentLikeMapper extends BaseMapper<ModelCommentLike> {
|
|
||||||
ModelCommentLike getLikeComment(@Param("userId") Long userId, @Param("commentId") Long commentId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.mcwl.resource.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.mapper
|
|
||||||
* @Filename:ModelCommentMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:04
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface ModelCommentMapper extends BaseMapper<ModelComment> {
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.mcwl.resource.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.mapper
|
|
||||||
* @Filename:ModelLikeMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:05
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface ModelLikeMapper extends BaseMapper<ModelLike> {
|
|
||||||
ModelLike getLike(@Param("userId") Long userId, @Param("modelId") Long modelId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.mcwl.resource.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.mcwl.resource.domain.ModelCommentLike;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service
|
|
||||||
* @Filename:ModelCommentLikeService
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 11:58
|
|
||||||
*/
|
|
||||||
public interface ModelCommentLikeService extends IService<ModelCommentLike> {
|
|
||||||
void like(Long commentId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.mcwl.resource.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service
|
|
||||||
* @Filename:ModelCommentService
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 11:58
|
|
||||||
*/
|
|
||||||
public interface ModelCommentService extends IService<ModelComment> {
|
|
||||||
void comment(ModelComment modelComment);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.mcwl.resource.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service
|
|
||||||
* @Filename:ModelLikeService
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 11:57
|
|
||||||
*/
|
|
||||||
public interface ModelLikeService extends IService<ModelLike> {
|
|
||||||
|
|
||||||
|
|
||||||
void like(Long imageId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**模型 业务实现层
|
/**
|
||||||
* @Author:ChenYan
|
* @Author:ChenYan
|
||||||
* @Project:McWl
|
* @Project:McWl
|
||||||
* @Package:com.mcwl.resource.service.impl
|
* @Package:com.mcwl.resource.service.impl
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
package com.mcwl.resource.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.mcwl.common.exception.ServiceException;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
|
||||||
import com.mcwl.resource.domain.ModelCommentLike;
|
|
||||||
import com.mcwl.resource.domain.ModelImageComment;
|
|
||||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
|
||||||
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelCommentMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
|
||||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service.impl
|
|
||||||
* @Filename:ModelCommentLikeServiceImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:01
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper,ModelCommentLike> implements ModelCommentLikeService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelCommentMapper modelCommentMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void like(Long commentId) {
|
|
||||||
ModelComment modelComment = modelCommentMapper.selectById(commentId);
|
|
||||||
if (Objects.isNull(modelComment)) {
|
|
||||||
throw new ServiceException("该评论不存在");
|
|
||||||
}
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
ModelCommentLike modelCommentLike = baseMapper.getLikeComment(userId, commentId);
|
|
||||||
if (Objects.nonNull(modelCommentLike)) {
|
|
||||||
if (Objects.equals(modelCommentLike.getDelFlag(), "0")) {
|
|
||||||
modelCommentLike.setDelFlag("1");
|
|
||||||
modelComment.setLikeNum(modelComment.getLikeNum() - 1);
|
|
||||||
} else {
|
|
||||||
modelCommentLike.setDelFlag("0");
|
|
||||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
|
||||||
}
|
|
||||||
// 更新点赞记录
|
|
||||||
baseMapper.updateById(modelCommentLike);
|
|
||||||
// 更新图片评论点赞数
|
|
||||||
modelCommentMapper.updateById(modelComment);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加点赞记录
|
|
||||||
modelCommentLike = new ModelCommentLike();
|
|
||||||
modelCommentLike.setUserId(userId);
|
|
||||||
modelCommentLike.setModelCommentId(commentId);
|
|
||||||
modelCommentLike.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
modelCommentLike.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
modelCommentLike.setUpdateTime(new Date());
|
|
||||||
baseMapper.insert(modelCommentLike);
|
|
||||||
|
|
||||||
// 更新模型点赞数
|
|
||||||
modelComment.setLikeNum(modelComment.getLikeNum() + 1);
|
|
||||||
modelCommentMapper.updateById(modelComment);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.mcwl.resource.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelComment;
|
|
||||||
import com.mcwl.resource.domain.ModelImageComment;
|
|
||||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
|
||||||
import com.mcwl.resource.mapper.ModelCommentMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
|
||||||
import com.mcwl.resource.service.ModelCommentService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service.impl
|
|
||||||
* @Filename:ModelCommentServiceImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:03
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, ModelComment> implements ModelCommentService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelCommentMapper modelCommentMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelImageMapper modelImageMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void comment(ModelComment modelComment) {
|
|
||||||
Long parentId = modelComment.getParentId();
|
|
||||||
ModelComment mic = modelCommentMapper.selectById(parentId);
|
|
||||||
|
|
||||||
if (Objects.nonNull(parentId) && Objects.isNull(mic)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
modelComment.setUserId(SecurityUtils.getUserId());
|
|
||||||
modelComment.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
modelComment.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
modelComment.setUpdateTime(new Date());
|
|
||||||
modelCommentMapper.insert(modelComment);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +1,30 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
|
import com.mcwl.resource.domain.MallProductLike;
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelImageComment;
|
import com.mcwl.resource.domain.ModelImageComment;
|
||||||
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||||
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
|
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||||
|
import com.mcwl.resource.service.MallProductLikeService;
|
||||||
|
import com.mcwl.resource.service.MallProductService;
|
||||||
|
import com.mcwl.resource.service.ModelImageCommentService;
|
||||||
import com.mcwl.resource.service.ModelImageService;
|
import com.mcwl.resource.service.ModelImageService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
package com.mcwl.resource.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.mcwl.common.exception.ServiceException;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.*;
|
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
|
||||||
import com.mcwl.resource.mapper.MallProductMapper;
|
|
||||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
|
||||||
import com.mcwl.resource.service.ModelLikeService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import springfox.documentation.swagger2.mappers.ModelMapper;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:ChenYan
|
|
||||||
* @Project:McWl
|
|
||||||
* @Package:com.mcwl.resource.service.impl
|
|
||||||
* @Filename:ModelLikeServiceImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Date:2025/1/12 12:05
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike> implements ModelLikeService {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MallProductMapper mallProductMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void like(Long modelId) {
|
|
||||||
ModelProduct model = mallProductMapper.selectById(modelId);
|
|
||||||
if (Objects.isNull(model)) {
|
|
||||||
throw new ServiceException("该模型不存在或已下架");
|
|
||||||
}
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
ModelLike modelLike = baseMapper.getLike(userId, modelId);
|
|
||||||
if (Objects.nonNull(modelLike)) {
|
|
||||||
if (Objects.equals(modelLike.getDelFlag(), "0")) {
|
|
||||||
modelLike.setDelFlag("1");
|
|
||||||
model.setNumbers(model.getNumbers() - 1);
|
|
||||||
} else {
|
|
||||||
modelLike.setDelFlag("0");
|
|
||||||
model.setNumbers(model.getNumbers() + 1);
|
|
||||||
}
|
|
||||||
// 更新点赞记录
|
|
||||||
baseMapper.updateById(modelLike);
|
|
||||||
// 更新图片点赞数
|
|
||||||
mallProductMapper.updateById(model);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加点赞记录
|
|
||||||
modelLike = new ModelLike();
|
|
||||||
modelLike.setUserId(userId);
|
|
||||||
modelLike.setModelId(modelId);
|
|
||||||
modelLike.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
modelLike.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
modelLike.setUpdateTime(new Date());
|
|
||||||
baseMapper.insert(modelLike);
|
|
||||||
|
|
||||||
// 更新图片点赞数
|
|
||||||
model.setNumbers(model.getNumbers() + 1);
|
|
||||||
mallProductMapper.updateById(model);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**模型版本 业务实现层
|
/**
|
||||||
* @Author:ChenYan
|
* @Author:ChenYan
|
||||||
* @Project:McWl
|
* @Project:McWl
|
||||||
* @Package:com.mcwl.resource.service.impl
|
* @Package:com.mcwl.resource.service.impl
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**活动 业务实现层
|
/**
|
||||||
* @Author:ChenYan
|
* @Author:ChenYan
|
||||||
* @Project:McWl
|
* @Project:McWl
|
||||||
* @Package:com.mcwl.resource.service
|
* @Package:com.mcwl.resource.service
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.mcwl.resource.mapper.ModelCommentLikeMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getLikeComment" resultType="com.mcwl.resource.domain.ModelCommentLike">
|
|
||||||
select id,
|
|
||||||
user_id,
|
|
||||||
model_comment_id,
|
|
||||||
create_by,
|
|
||||||
create_time,
|
|
||||||
update_by,
|
|
||||||
update_time,
|
|
||||||
del_flag,
|
|
||||||
remark where user_id = #{userId} and model_comment_id = #{commentId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.mcwl.resource.mapper.ModelLikeMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<select id="getLike" resultType="com.mcwl.resource.domain.ModelLike">
|
|
||||||
select id,
|
|
||||||
user_id,
|
|
||||||
model_id,
|
|
||||||
create_by,
|
|
||||||
create_time,
|
|
||||||
update_by,
|
|
||||||
update_time,
|
|
||||||
del_flag,
|
|
||||||
remark where user_id = #{userId} and model_id = #{modelId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
1
pom.xml
1
pom.xml
|
@ -240,6 +240,7 @@
|
||||||
<module>mcwl-resource</module>
|
<module>mcwl-resource</module>
|
||||||
<module>mcwl-memberCenter</module>
|
<module>mcwl-memberCenter</module>
|
||||||
<module>mcwl-pay</module>
|
<module>mcwl-pay</module>
|
||||||
|
<module>mcwl-comment</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue