Compare commits
No commits in common. "09dfd88a12596f0d520068306cb7d157a2f3ef65" and "628c9e57bbdb2f69662828ca7aaf92789a4aa6cb" have entirely different histories.
09dfd88a12
...
628c9e57bb
|
@ -1,63 +0,0 @@
|
||||||
package com.mcwl.web.controller.communityCenter;
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.communityCenter.domain.dto.*;
|
|
||||||
import com.mcwl.communityCenter.service.QuestionCommentService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问评论
|
|
||||||
*/
|
|
||||||
@Api(tags = "提问评论")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("questionComment")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class QuestionCommentController {
|
|
||||||
|
|
||||||
private final QuestionCommentService questionCommentService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问评论
|
|
||||||
*/
|
|
||||||
@PostMapping("comment")
|
|
||||||
@ApiOperation(value = "新增提问评论")
|
|
||||||
public AjaxResult comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) {
|
|
||||||
return questionCommentService.comment(questionCommentRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取提问评论列表
|
|
||||||
* @param questionCommentPageRes 请求参数
|
|
||||||
* @return 评论列表
|
|
||||||
*/
|
|
||||||
@PostMapping("list")
|
|
||||||
@ApiOperation(value = "获取提问评论列表")
|
|
||||||
public TableDataInfo list(@RequestBody @Valid QuestionCommentPageRes questionCommentPageRes) {
|
|
||||||
return questionCommentService.listByPage(questionCommentPageRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采纳评论
|
|
||||||
*/
|
|
||||||
@PostMapping("adopt")
|
|
||||||
@ApiOperation(value = "采纳评论")
|
|
||||||
public AjaxResult adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) {
|
|
||||||
return questionCommentService.adopt(questionCommentAdoptRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,16 +2,13 @@ package com.mcwl.web.controller.communityCenter;
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes;
|
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes;
|
||||||
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
||||||
import com.mcwl.communityCenter.domain.dto.QuestionReplyRes;
|
import com.mcwl.communityCenter.domain.dto.QuestionReplyRes;
|
||||||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||||
import com.mcwl.communityCenter.service.QuestionService;
|
import com.mcwl.communityCenter.service.QuestionService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
@ -33,8 +30,6 @@ public class QuestionController {
|
||||||
|
|
||||||
private final QuestionService questionService;
|
private final QuestionService questionService;
|
||||||
|
|
||||||
private final ISysUserService sysUserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问
|
* 提问
|
||||||
*/
|
*/
|
||||||
|
@ -42,28 +37,6 @@ public class QuestionController {
|
||||||
@ApiOperation(value = "提问")
|
@ApiOperation(value = "提问")
|
||||||
public AjaxResult addQuestion(@RequestBody @Valid QuestionRes questionRes) {
|
public AjaxResult addQuestion(@RequestBody @Valid QuestionRes questionRes) {
|
||||||
|
|
||||||
// 提问类型
|
|
||||||
Integer type = questionRes.getType();
|
|
||||||
|
|
||||||
// 付费金额
|
|
||||||
Double amount = questionRes.getAmount();
|
|
||||||
|
|
||||||
// 类型为1时,付费金额不能为空
|
|
||||||
if (Objects.equals(type, 1) && Objects.isNull(amount)) {
|
|
||||||
return AjaxResult.error("付费金额不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 付费类型为1时,判断钱包余额是否充足
|
|
||||||
if (Objects.equals(type, 1)) {
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
|
||||||
Double wallet = sysUser.getWallet();
|
|
||||||
if (wallet < amount) {
|
|
||||||
return AjaxResult.error("钱包余额不足");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
questionRes.setAmount(0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return questionService.addQuestion(questionRes);
|
return questionService.addQuestion(questionRes);
|
||||||
|
|
||||||
|
@ -103,16 +76,16 @@ public class QuestionController {
|
||||||
return AjaxResult.success(questionVo);
|
return AjaxResult.success(questionVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 回复
|
* 回复
|
||||||
// */
|
*/
|
||||||
// @PostMapping("reply")
|
@PostMapping("reply")
|
||||||
// @ApiOperation(value = "回复")
|
@ApiOperation(value = "回复")
|
||||||
// public AjaxResult reply(@RequestBody @Valid QuestionReplyRes questionReplyRes) {
|
public AjaxResult reply(@RequestBody @Valid QuestionReplyRes questionReplyRes) {
|
||||||
//
|
|
||||||
// return questionService.reply(questionReplyRes);
|
return questionService.reply(questionReplyRes);
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@ import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||||
import com.mcwl.resource.domain.request.RequestModel;
|
import com.mcwl.resource.domain.request.RequestModel;
|
||||||
import com.mcwl.resource.service.*;
|
import com.mcwl.resource.service.ModelImageService;
|
||||||
|
import com.mcwl.resource.service.ModelService;
|
||||||
|
import com.mcwl.resource.service.WorkFlowService;
|
||||||
import com.mcwl.web.controller.common.OssUtil;
|
import com.mcwl.web.controller.common.OssUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
@ -41,21 +43,12 @@ public class MallProductController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelService modelService;
|
private ModelService modelService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelLikeService modelLikeService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelImageService modelImageService;
|
private ModelImageService modelImageService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkFlowService workFlowService;
|
private WorkFlowService workFlowService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WorkFlowLikeService workFlowLikeService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ModelImageLikeService modelImageLikeService;
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
|
@ -199,9 +192,9 @@ public class MallProductController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-模型列表
|
* 我的发布-模型
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的发布-模型列表")
|
@ApiOperation(value = "我的发布-模型")
|
||||||
@PostMapping("/selectByUserIdModel")
|
@PostMapping("/selectByUserIdModel")
|
||||||
public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) {
|
public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
|
@ -209,9 +202,9 @@ public class MallProductController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-工作流列表
|
* 我的发布-工作流
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的发布-工作流列表")
|
@ApiOperation(value = "我的发布-工作流")
|
||||||
@PostMapping("/selectByUserIdWorkFlow")
|
@PostMapping("/selectByUserIdWorkFlow")
|
||||||
public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) {
|
public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
|
@ -219,9 +212,9 @@ public class MallProductController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的发布-图片列表
|
* 我的发布-图片
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的发布-图片列表")
|
@ApiOperation(value = "我的发布-图片")
|
||||||
@PostMapping("/selectByUserIdImage")
|
@PostMapping("/selectByUserIdImage")
|
||||||
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) {
|
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) {
|
||||||
|
|
||||||
|
@ -229,30 +222,39 @@ public class MallProductController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的点赞-模型列表
|
* 点赞-模型
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的点赞-模型列表")
|
@ApiOperation(value = "点赞-模型")
|
||||||
@PostMapping("/likeModel")
|
@PostMapping("/likeModel")
|
||||||
public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) {
|
public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) {
|
||||||
return modelLikeService.listByPage(pageDomain);
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return modelService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的点赞-工作流列表
|
* 点赞-工作流
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的点赞-工作流列表")
|
@ApiOperation(value = "点赞-工作流")
|
||||||
@PostMapping("/likeWorkFlow")
|
@PostMapping("/likeWorkFlow")
|
||||||
public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) {
|
public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) {
|
||||||
return workFlowLikeService.listByPage(pageDomain);
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return workFlowService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的点赞-图片列表
|
* 点赞-图片
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "我的点赞-图片列表")
|
@ApiOperation(value = "点赞-图片")
|
||||||
@PostMapping("/likeImage")
|
@PostMapping("/likeImage")
|
||||||
public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) {
|
public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) {
|
||||||
return modelImageLikeService.listByPage(pageDomain);
|
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||||
|
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||||
|
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||||
|
return modelImageService.listByPage(imagePageRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.resource.domain.Report;
|
import com.mcwl.resource.domain.Report;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
import com.mcwl.resource.service.ReportService;
|
import com.mcwl.resource.service.ReportService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ public class ReportController {
|
||||||
* @param report
|
* @param report
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增举报内容")
|
|
||||||
@PostMapping("/addReport")
|
@PostMapping("/addReport")
|
||||||
public AjaxResult addReport(@RequestBody Report report){
|
public AjaxResult addReport(@RequestBody Report report){
|
||||||
|
|
||||||
|
@ -35,14 +33,11 @@ public class ReportController {
|
||||||
return AjaxResult.success("举报成功");
|
return AjaxResult.success("举报成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询举报列表
|
* 查询举报列表
|
||||||
* @param pageVo
|
* @param pageVo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "查询举报列表")
|
|
||||||
@PostMapping("/selectReport")
|
@PostMapping("/selectReport")
|
||||||
public AjaxResult selectReport(@RequestBody PageVo pageVo){
|
public AjaxResult selectReport(@RequestBody PageVo pageVo){
|
||||||
|
|
||||||
|
@ -55,7 +50,6 @@ public class ReportController {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "删除举报")
|
|
||||||
@GetMapping("/deleteReport")
|
@GetMapping("/deleteReport")
|
||||||
public AjaxResult deleteReport(@RequestParam Long id){
|
public AjaxResult deleteReport(@RequestParam Long id){
|
||||||
|
|
||||||
|
@ -68,7 +62,6 @@ public class ReportController {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "修改状态")
|
|
||||||
@GetMapping("/updateStatus")
|
@GetMapping("/updateStatus")
|
||||||
public AjaxResult updateStatus(@RequestParam Long id){
|
public AjaxResult updateStatus(@RequestParam Long id){
|
||||||
|
|
||||||
|
|
|
@ -115,11 +115,6 @@ public class SysUser extends BaseEntity
|
||||||
*/
|
*/
|
||||||
private Double freePoints;
|
private Double freePoints;
|
||||||
|
|
||||||
/**
|
|
||||||
* 钱包-金币
|
|
||||||
*/
|
|
||||||
private Double wallet;
|
|
||||||
|
|
||||||
|
|
||||||
public SysUser()
|
public SysUser()
|
||||||
{
|
{
|
||||||
|
@ -369,14 +364,6 @@ public class SysUser extends BaseEntity
|
||||||
this.freePoints = freePoints;
|
this.freePoints = freePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getWallet() {
|
|
||||||
return wallet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWallet(Double wallet) {
|
|
||||||
this.wallet = wallet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SysUser{" +
|
return "SysUser{" +
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class PageDomain
|
||||||
private String orderByColumn;
|
private String orderByColumn;
|
||||||
|
|
||||||
/** 排序的方向desc或者asc */
|
/** 排序的方向desc或者asc */
|
||||||
@ApiModelProperty(hidden = true)
|
@ApiModelProperty(value = "排序的方向desc或者asc", example = "asc")
|
||||||
private String isAsc = "asc";
|
private String isAsc = "asc";
|
||||||
|
|
||||||
/** 分页参数合理化 */
|
/** 分页参数合理化 */
|
||||||
|
|
|
@ -27,12 +27,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
try {
|
this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
|
||||||
String username = SecurityUtils.getUsername();
|
|
||||||
this.setFieldValByName("updateBy", username, metaObject);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.setFieldValByName("updateBy", "", metaObject);
|
|
||||||
}
|
|
||||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,67 +23,64 @@ import java.util.Date;
|
||||||
public class Question extends BaseEntity {
|
public class Question extends BaseEntity {
|
||||||
|
|
||||||
@TableId
|
@TableId
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id - 租户id
|
* 用户id - 租户id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "用户id - 租户id")
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社区id
|
* 社区id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "社区id")
|
||||||
private Long communityId;
|
private Long communityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问用户id
|
* 提问用户id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问用户id")
|
||||||
private Long questionUserId;
|
private Long questionUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问内容
|
* 提问内容
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问图片
|
* 提问图片
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问图片")
|
||||||
private String questionUrl;
|
private String questionUrl;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 回复内容
|
* 回复内容
|
||||||
// */
|
*/
|
||||||
// @ApiModelProperty(value = "答复内容")
|
@ApiModelProperty(value = "答复内容")
|
||||||
// private String reply;
|
private String reply;
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 回复时间
|
* 回复时间
|
||||||
// */
|
*/
|
||||||
// @ApiModelProperty(value = "答复时间")
|
@ApiModelProperty(value = "答复时间")
|
||||||
// private Date replyTime;
|
private Date replyTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否匿名
|
* 是否匿名
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "是否匿名")
|
||||||
private Integer isAnonymous;
|
private Integer isAnonymous;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 状态
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value = "状态")
|
|
||||||
// private Integer status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问类型 0免费 1付费
|
* 状态
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
/**
|
|
||||||
* 付费金额 当提问类型为付费时必填
|
|
||||||
*/
|
|
||||||
private Double amount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.mcwl.communityCenter.domain;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问评论
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("cc_question_comment")
|
|
||||||
public class QuestionComment extends BaseEntity {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 租户id
|
|
||||||
*/
|
|
||||||
private Long tenantId;
|
|
||||||
/**
|
|
||||||
* 社区id
|
|
||||||
*/
|
|
||||||
private Long communityId;
|
|
||||||
/**
|
|
||||||
* 提问id
|
|
||||||
*/
|
|
||||||
private Long questionId;
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
private String content;
|
|
||||||
/**
|
|
||||||
* 是否接受
|
|
||||||
*/
|
|
||||||
private Long isAccept;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.mcwl.communityCenter.domain.dto;
|
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(value = "采纳请求参数")
|
|
||||||
public class QuestionCommentAdoptRes {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "租户不能为空")
|
|
||||||
@ApiModelProperty(value = "租户ID", required = true)
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社区id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "社区不能为空")
|
|
||||||
@ApiModelProperty(value = "社区ID", required = true)
|
|
||||||
private Long communityId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "提问不能为空")
|
|
||||||
@ApiModelProperty(value = "提问ID", required = true)
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "评论不能为空")
|
|
||||||
@ApiModelProperty(value = "评论ID", required = true)
|
|
||||||
private Long commentId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.mcwl.communityCenter.domain.dto;
|
|
||||||
|
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel(value = "提问分页请求参数")
|
|
||||||
public class QuestionCommentPageRes extends PageDomain {
|
|
||||||
|
|
||||||
@NotNull(message = "租户不能为空")
|
|
||||||
@ApiModelProperty(value = "租户id", required = true)
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
@NotNull(message = "社区不能为空")
|
|
||||||
@ApiModelProperty(value = "社区id", required = true)
|
|
||||||
private Long communityId;
|
|
||||||
|
|
||||||
@NotNull(message = "提问不能为空")
|
|
||||||
@ApiModelProperty(value = "提问ID", required = true)
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package com.mcwl.communityCenter.domain.dto;
|
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问评论请求参数
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("提问评论请求参数")
|
|
||||||
public class QuestionCommentRes {
|
|
||||||
/**
|
|
||||||
* 租户id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "租户不能为空")
|
|
||||||
@ApiModelProperty(value = "租户ID", required = true)
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社区id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "社区不能为空")
|
|
||||||
@ApiModelProperty(value = "社区ID", required = true)
|
|
||||||
private Long communityId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "提问不能为空")
|
|
||||||
@ApiModelProperty(value = "提问ID", required = true)
|
|
||||||
private Long questionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论内容
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "评论内容不能为空")
|
|
||||||
@ApiModelProperty(value = "评论内容", required = true)
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -22,7 +22,7 @@ public class QuestionPageRes extends PageDomain {
|
||||||
@ApiModelProperty(value = "社区id", required = true)
|
@ApiModelProperty(value = "社区id", required = true)
|
||||||
private Long communityId;
|
private Long communityId;
|
||||||
|
|
||||||
// @ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
// private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.mcwl.communityCenter.domain.dto;
|
package com.mcwl.communityCenter.domain.dto;
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonView;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -45,24 +44,9 @@ public class QuestionRes {
|
||||||
/**
|
/**
|
||||||
* 是否匿名 0 否 1 是
|
* 是否匿名 0 否 1 是
|
||||||
*/
|
*/
|
||||||
|
//swagger给上默认值
|
||||||
@ApiModelProperty(value = "是否匿名", position = 5)
|
@ApiModelProperty(value = "是否匿名", position = 5)
|
||||||
@NotNull(message = "是否匿名不能为空")
|
|
||||||
private Integer isAnonymous = 0;
|
private Integer isAnonymous = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问类型 0免费 1付费
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "提问类型 0免费 1付费", required = true, position = 6)
|
|
||||||
@NotNull(message = "提问类型不能为空")
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 付费金额 当提问类型为付费时必填
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "付费金额,当提问类型为1时必填")
|
|
||||||
private Double amount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社区返回数据
|
* 社区请求参数
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("cc_community")
|
@TableName("cc_community")
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.mcwl.communityCenter.domain.vo;
|
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "提问评论")
|
|
||||||
public class QuestionCommentVo {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "id")
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 租户id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "租户id")
|
|
||||||
private Long tenantId;
|
|
||||||
/**
|
|
||||||
* 社区id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "社区id")
|
|
||||||
private Long communityId;
|
|
||||||
/**
|
|
||||||
* 提问id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "提问id")
|
|
||||||
private Long questionId;
|
|
||||||
/**
|
|
||||||
* 用户id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户id")
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "内容")
|
|
||||||
private String content;
|
|
||||||
/**
|
|
||||||
* 是否接受
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "是否接受")
|
|
||||||
private Long isAccept;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -59,23 +59,23 @@ public class QuestionVo {
|
||||||
@ApiModelProperty(value = "提问时间")
|
@ApiModelProperty(value = "提问时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 答复用户id
|
* 答复用户id
|
||||||
// */
|
*/
|
||||||
// @ApiModelProperty(value = "答复用户id")
|
@ApiModelProperty(value = "答复用户id")
|
||||||
// private Long replyUserId;
|
private Long replyUserId;
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 回复内容
|
* 回复内容
|
||||||
// */
|
*/
|
||||||
// @ApiModelProperty(value = "回复内容")
|
@ApiModelProperty(value = "回复内容")
|
||||||
// private String reply;
|
private String reply;
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 回复时间
|
* 回复时间
|
||||||
// */
|
*/
|
||||||
// @ApiModelProperty(value = "回复时间")
|
@ApiModelProperty(value = "回复时间")
|
||||||
// private Date replyTime;
|
private Date replyTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否匿名
|
* 是否匿名
|
||||||
|
@ -83,16 +83,6 @@ public class QuestionVo {
|
||||||
@ApiModelProperty(value = "是否匿名")
|
@ApiModelProperty(value = "是否匿名")
|
||||||
private Integer isAnonymous;
|
private Integer isAnonymous;
|
||||||
|
|
||||||
/**
|
|
||||||
* 提问类型 0免费 1付费
|
|
||||||
*/
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 付费金额 当提问类型为付费时必填
|
|
||||||
*/
|
|
||||||
private Double amount;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.mcwl.communityCenter.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.mcwl.communityCenter.domain.Publish;
|
|
||||||
import com.mcwl.communityCenter.domain.Question;
|
|
||||||
import com.mcwl.communityCenter.domain.QuestionComment;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface QuestionCommentMapper extends BaseMapper<QuestionComment> {
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
Page<QuestionComment> selectByTenantIdAndCommunityIdAndQuestionIdPage(Page<QuestionComment> page,
|
|
||||||
@Param("tenantId")
|
|
||||||
Long tenantId,
|
|
||||||
@Param("communityId")
|
|
||||||
Long communityId,
|
|
||||||
@Param("questionId")
|
|
||||||
Long questionId);
|
|
||||||
|
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
|
||||||
QuestionComment selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(Long commentId, Long tenantId, Long communityId, Long questionId);
|
|
||||||
}
|
|
|
@ -19,7 +19,9 @@ public interface QuestionMapper extends BaseMapper<Question> {
|
||||||
Long tenantId,
|
Long tenantId,
|
||||||
@NotNull(message = "社区不能为空")
|
@NotNull(message = "社区不能为空")
|
||||||
@Param("communityId")
|
@Param("communityId")
|
||||||
Long communityId);
|
Long communityId,
|
||||||
|
@Param("status")
|
||||||
|
Integer status);
|
||||||
|
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
Question selectByIdAndTenantIdAndCommunityId(@Param("id")
|
Question selectByIdAndTenantIdAndCommunityId(@Param("id")
|
||||||
|
@ -36,5 +38,7 @@ public interface QuestionMapper extends BaseMapper<Question> {
|
||||||
Long tenantId,
|
Long tenantId,
|
||||||
@NotNull(message = "社区不能为空")
|
@NotNull(message = "社区不能为空")
|
||||||
@Param("communityId")
|
@Param("communityId")
|
||||||
Long communityId);
|
Long communityId,
|
||||||
|
@Param("status")
|
||||||
|
Integer status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.mcwl.communityCenter.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.communityCenter.domain.Question;
|
|
||||||
import com.mcwl.communityCenter.domain.QuestionComment;
|
|
||||||
import com.mcwl.communityCenter.domain.dto.*;
|
|
||||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
public interface QuestionCommentService extends IService<QuestionComment> {
|
|
||||||
|
|
||||||
AjaxResult comment(@Valid QuestionCommentRes questionCommentRes);
|
|
||||||
|
|
||||||
TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes);
|
|
||||||
|
|
||||||
AjaxResult adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes);
|
|
||||||
}
|
|
|
@ -26,11 +26,11 @@ public interface QuestionService extends IService<Question> {
|
||||||
|
|
||||||
QuestionVo getDetail(QuestionDetailRes questionDetailRes);
|
QuestionVo getDetail(QuestionDetailRes questionDetailRes);
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 回复问题
|
* 回复问题
|
||||||
// * @param questionReplyRes 回复信息
|
* @param questionReplyRes 回复信息
|
||||||
// */
|
*/
|
||||||
// AjaxResult reply(QuestionReplyRes questionReplyRes);
|
AjaxResult reply(QuestionReplyRes questionReplyRes);
|
||||||
|
|
||||||
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
|
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
package com.mcwl.communityCenter.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.mcwl.common.constant.HttpStatus;
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.common.utils.StringUtils;
|
|
||||||
import com.mcwl.communityCenter.domain.Community;
|
|
||||||
import com.mcwl.communityCenter.domain.Question;
|
|
||||||
import com.mcwl.communityCenter.domain.QuestionComment;
|
|
||||||
import com.mcwl.communityCenter.domain.dto.*;
|
|
||||||
import com.mcwl.communityCenter.domain.vo.QuestionCommentVo;
|
|
||||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
|
||||||
import com.mcwl.communityCenter.mapper.*;
|
|
||||||
import com.mcwl.communityCenter.service.QuestionCommentService;
|
|
||||||
import com.mcwl.communityCenter.service.QuestionService;
|
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMapper, QuestionComment> implements QuestionCommentService {
|
|
||||||
|
|
||||||
private final QuestionMapper questionMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult comment(QuestionCommentRes questionCommentRes) {
|
|
||||||
|
|
||||||
Long tenantId = questionCommentRes.getTenantId();
|
|
||||||
Long communityId = questionCommentRes.getCommunityId();
|
|
||||||
Long questionId = questionCommentRes.getQuestionId();
|
|
||||||
|
|
||||||
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
|
|
||||||
|
|
||||||
if (Objects.isNull(question)) {
|
|
||||||
return AjaxResult.error("提问不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
QuestionComment questionComment = new QuestionComment();
|
|
||||||
BeanUtil.copyProperties(questionCommentRes, questionComment);
|
|
||||||
questionComment.setUserId(SecurityUtils.getUserId());
|
|
||||||
|
|
||||||
baseMapper.insert(questionComment);
|
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success("评论成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TableDataInfo listByPage(QuestionCommentPageRes questionCommentPageRes) {
|
|
||||||
|
|
||||||
Page<QuestionComment> page = initPage(questionCommentPageRes);
|
|
||||||
|
|
||||||
baseMapper.selectByTenantIdAndCommunityIdAndQuestionIdPage(page, questionCommentPageRes.getTenantId(), questionCommentPageRes.getCommunityId(), questionCommentPageRes.getQuestionId());
|
|
||||||
|
|
||||||
|
|
||||||
List<QuestionComment> questionCommentList = page.getRecords();
|
|
||||||
List<QuestionCommentVo> questionCommentVoList = new ArrayList<>();
|
|
||||||
for (QuestionComment questionComment : questionCommentList) {
|
|
||||||
QuestionCommentVo questionCommentVo = new QuestionCommentVo();
|
|
||||||
BeanUtil.copyProperties(questionComment, questionCommentVo);
|
|
||||||
questionCommentVoList.add(questionCommentVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
|
||||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
|
||||||
tableDataInfo.setMsg("查询成功");
|
|
||||||
tableDataInfo.setRows(questionCommentVoList);
|
|
||||||
tableDataInfo.setTotal(page.getTotal());
|
|
||||||
|
|
||||||
return tableDataInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult adopt(QuestionCommentAdoptRes questionCommentAdoptRes) {
|
|
||||||
|
|
||||||
Long tenantId = questionCommentAdoptRes.getTenantId();
|
|
||||||
Long communityId = questionCommentAdoptRes.getCommunityId();
|
|
||||||
Long questionId = questionCommentAdoptRes.getQuestionId();
|
|
||||||
Long commentId = questionCommentAdoptRes.getCommentId();
|
|
||||||
|
|
||||||
QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(commentId, tenantId, communityId, questionId);
|
|
||||||
if (Objects.isNull(questionComment)) {
|
|
||||||
return AjaxResult.error("评论不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (questionComment.getIsAccept() == 1) {
|
|
||||||
return AjaxResult.error("该评论已被采纳");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Page<QuestionComment> initPage(QuestionCommentPageRes questionCommentPageRes) {
|
|
||||||
|
|
||||||
Page<QuestionComment> page = new Page<>(questionCommentPageRes.getPageNum(), questionCommentPageRes.getPageSize());
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) {
|
|
||||||
questionCommentPageRes.setOrderByColumn("create_time");
|
|
||||||
}
|
|
||||||
OrderItem orderItem = OrderItem.desc(questionCommentPageRes.getOrderByColumn());
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -70,30 +70,30 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
||||||
return AjaxResult.error("租户或社区不存在");
|
return AjaxResult.error("租户或社区不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (Objects.equals(tenantId, userId)) {
|
if (Objects.equals(tenantId, userId)) {
|
||||||
// return AjaxResult.error("您不能提问自己的问题");
|
return AjaxResult.error("您不能提问自己的问题");
|
||||||
// }
|
}
|
||||||
|
|
||||||
//提问人(userId)是否在社区中
|
//提问人(userId)是否在社区中
|
||||||
// Invite invite = inviteMapper.selectByTenantIdAndCommunityIdAndInviteeUserId(tenantId, communityId, userId);
|
Invite invite = inviteMapper.selectByTenantIdAndCommunityIdAndInviteeUserId(tenantId, communityId, userId);
|
||||||
// if (Objects.isNull(invite)) {
|
if (Objects.isNull(invite)) {
|
||||||
// return AjaxResult.error("您不是该社区成员,不能提问");
|
return AjaxResult.error("您不是该社区成员,不能提问");
|
||||||
// }
|
}
|
||||||
|
|
||||||
Question question = new Question();
|
Question question = new Question();
|
||||||
BeanUtil.copyProperties(questionRes, question);
|
BeanUtil.copyProperties(questionRes, question);
|
||||||
question.setQuestionUserId(userId);
|
question.setQuestionUserId(userId);
|
||||||
// question.setStatus(StatusConstant.STATUS_UNREPLIED);
|
question.setStatus(StatusConstant.STATUS_UNREPLIED);
|
||||||
baseMapper.insert(question);
|
baseMapper.insert(question);
|
||||||
|
|
||||||
|
|
||||||
// CommunityAdvice communityAdvice = new CommunityAdvice();
|
CommunityAdvice communityAdvice = new CommunityAdvice();
|
||||||
// communityAdvice.setTenantId(tenantId);
|
communityAdvice.setTenantId(tenantId);
|
||||||
// communityAdvice.setCommunityId(communityId);
|
communityAdvice.setCommunityId(communityId);
|
||||||
// communityAdvice.setUserId(tenantId);
|
communityAdvice.setUserId(tenantId);
|
||||||
// communityAdvice.setTitle("您有新的问题");
|
communityAdvice.setTitle("您有新的问题");
|
||||||
// communityAdvice.setContent(questionRes.getContent());
|
communityAdvice.setContent(questionRes.getContent());
|
||||||
// communityAdviceMapper.insert(communityAdvice);
|
communityAdviceMapper.insert(communityAdvice);
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
@ -105,8 +105,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
||||||
|
|
||||||
Page<Question> page = initPage(questionPageRes);
|
Page<Question> page = initPage(questionPageRes);
|
||||||
|
|
||||||
// baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
||||||
baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId());
|
|
||||||
|
|
||||||
// 获取分页数据
|
// 获取分页数据
|
||||||
List<Question> questionList = page.getRecords();
|
List<Question> questionList = page.getRecords();
|
||||||
|
@ -154,44 +153,43 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
||||||
return questionVo;
|
return questionVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 回复问题
|
* 回复问题
|
||||||
// *
|
*
|
||||||
// * @param questionReplyRes 回复信息
|
* @param questionReplyRes 回复信息
|
||||||
// */
|
*/
|
||||||
// @Override
|
@Override
|
||||||
// public AjaxResult reply(QuestionReplyRes questionReplyRes) {
|
public AjaxResult reply(QuestionReplyRes questionReplyRes) {
|
||||||
//
|
|
||||||
// Long communityId = questionReplyRes.getCommunityId();
|
Long communityId = questionReplyRes.getCommunityId();
|
||||||
// Long questionId = questionReplyRes.getQuestionId();
|
Long questionId = questionReplyRes.getQuestionId();
|
||||||
// LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
||||||
// lqw.eq(Question::getId, questionId)
|
lqw.eq(Question::getId, questionId)
|
||||||
// .eq(Question::getCommunityId, communityId)
|
.eq(Question::getCommunityId, communityId)
|
||||||
// .eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
.eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
||||||
//
|
|
||||||
// // 查询问题信息
|
// 查询问题信息
|
||||||
// Question question = baseMapper.selectOne(lqw);
|
Question question = baseMapper.selectOne(lqw);
|
||||||
//
|
|
||||||
// if (Objects.isNull(question)) {
|
if (Objects.isNull(question)) {
|
||||||
// return AjaxResult.error("问题不存在或已被回复");
|
return AjaxResult.error("问题不存在或已被回复");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// question.setReply(questionReplyRes.getReply());
|
question.setReply(questionReplyRes.getReply());
|
||||||
// question.setStatus(StatusConstant.STATUS_REPLIED);
|
question.setStatus(StatusConstant.STATUS_REPLIED);
|
||||||
// question.setReplyTime(new Date());
|
question.setReplyTime(new Date());
|
||||||
//
|
|
||||||
// baseMapper.updateById(question);
|
baseMapper.updateById(question);
|
||||||
// return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo listImage(QuestionPageRes questionPageRes) {
|
public TableDataInfo listImage(QuestionPageRes questionPageRes) {
|
||||||
|
|
||||||
Page<Question> page = initPage(questionPageRes);
|
Page<Question> page = initPage(questionPageRes);
|
||||||
|
|
||||||
// baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
||||||
baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId());
|
|
||||||
|
|
||||||
// 获取分页数据
|
// 获取分页数据
|
||||||
List<Question> questionList = page.getRecords();
|
List<Question> questionList = page.getRecords();
|
||||||
|
|
|
@ -1,18 +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.communityCenter.mapper.QuestionCommentMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectByTenantIdAndCommunityIdAndQuestionIdPage"
|
|
||||||
resultType="com.mcwl.communityCenter.domain.QuestionComment">
|
|
||||||
select id, tenant_id, community_id, question_id, user_id, content, is_accept
|
|
||||||
from cc_question_comment
|
|
||||||
where tenant_id = #{tenantId}
|
|
||||||
and community_id = #{communityId}
|
|
||||||
and question_id = #{questionId}
|
|
||||||
and del_flag = '0'
|
|
||||||
order by create_time desc
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -6,52 +6,32 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="list" resultType="com.mcwl.communityCenter.domain.Question">
|
<select id="list" resultType="com.mcwl.communityCenter.domain.Question">
|
||||||
select id,
|
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||||
tenant_id,
|
|
||||||
community_id,
|
|
||||||
question_user_id,
|
|
||||||
content,
|
|
||||||
question_url,
|
|
||||||
is_anonymous,
|
|
||||||
amount,
|
|
||||||
type
|
|
||||||
from cc_question
|
from cc_question
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
order by amount desc, create_time desc
|
<if test="status != null">
|
||||||
|
and status= #{status}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Question">
|
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Question">
|
||||||
select id,
|
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||||
tenant_id,
|
|
||||||
community_id,
|
|
||||||
question_user_id,
|
|
||||||
content,
|
|
||||||
question_url,
|
|
||||||
is_anonymous,
|
|
||||||
amount,
|
|
||||||
type
|
|
||||||
from cc_question
|
from cc_question
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
<select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
|
<select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
|
||||||
select id,
|
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||||
tenant_id,
|
|
||||||
community_id,
|
|
||||||
question_user_id,
|
|
||||||
content,
|
|
||||||
question_url,
|
|
||||||
is_anonymous,
|
|
||||||
amount,
|
|
||||||
type
|
|
||||||
from cc_question
|
from cc_question
|
||||||
where del_flag = '0'
|
where del_flag = '0'
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
and question_url is not null
|
<if test="status != null">
|
||||||
order by amount desc, create_time desc
|
and status= #{status}
|
||||||
|
</if>
|
||||||
|
and question_url is not null
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -173,7 +173,7 @@ public class WorkFlow {
|
||||||
* 作品点赞数量
|
* 作品点赞数量
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "作品点赞数量")
|
@ApiModelProperty(value = "作品点赞数量")
|
||||||
private Integer likeCount = 0;
|
private Long likeCount = 0L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻译后主体
|
* 翻译后主体
|
||||||
|
|
|
@ -16,6 +16,11 @@ import java.util.Date;
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ModelImagePageRes extends PageDomain {
|
public class ModelImagePageRes extends PageDomain {
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "图片返回对象")
|
|
||||||
public class ModelImageLikeVo {
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户id", required = true)
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 用户名称
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户名称", required = true)
|
|
||||||
private String userName;
|
|
||||||
/**
|
|
||||||
* 用户头像
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户头像", required = true)
|
|
||||||
private String userAvatar;
|
|
||||||
/**
|
|
||||||
* 图片id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "图片id", required = true)
|
|
||||||
private Long modelImageId;
|
|
||||||
/**
|
|
||||||
* 图片地址(最多8张,切割)
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "图片地址(最多8张,切割)")
|
|
||||||
private String imagePaths;
|
|
||||||
/**
|
|
||||||
* 点赞数
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "点赞数")
|
|
||||||
private Integer likeNum;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "模型返回对象")
|
|
||||||
public class ModelLikeVo {
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户id", required = true)
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 用户名称
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户名称", required = true)
|
|
||||||
private String userName;
|
|
||||||
/**
|
|
||||||
* 用户头像
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户头像", required = true)
|
|
||||||
private String userAvatar;
|
|
||||||
/**
|
|
||||||
* 模型id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "模型id", required = true)
|
|
||||||
private Long modelId;
|
|
||||||
/**
|
|
||||||
* 封面图
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "封面图")
|
|
||||||
private String surfaceUrl;
|
|
||||||
/**
|
|
||||||
* 点赞数
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "点赞数")
|
|
||||||
private Integer likeNum;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
package com.mcwl.resource.domain.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "工作流请求对象")
|
|
||||||
public class WorkFlowLikeVo {
|
|
||||||
/**
|
|
||||||
* id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户id", required = true)
|
|
||||||
private Long userId;
|
|
||||||
/**
|
|
||||||
* 用户名称
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户名称", required = true)
|
|
||||||
private String userName;
|
|
||||||
/**
|
|
||||||
* 用户头像
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "用户头像", required = true)
|
|
||||||
private String userAvatar;
|
|
||||||
/**
|
|
||||||
* 工作流id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "工作流id", required = true)
|
|
||||||
private Long workFlowId;
|
|
||||||
/**
|
|
||||||
* 封面图
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "封面图")
|
|
||||||
private String converPath;
|
|
||||||
/**
|
|
||||||
* 点赞数
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "点赞数")
|
|
||||||
private Integer likeNum;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelImageLike;
|
import com.mcwl.resource.domain.ModelImageLike;
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -19,10 +16,5 @@ public interface ModelImageLikeService extends IService<ModelImageLike> {
|
||||||
|
|
||||||
List<ModelImage> fetchModelImageSortedByTopStatus();
|
List<ModelImage> fetchModelImageSortedByTopStatus();
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
* @param pageDomain 分页参数
|
|
||||||
* @return 分页数据
|
|
||||||
*/
|
|
||||||
TableDataInfo listByPage(PageDomain pageDomain);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
import com.mcwl.resource.domain.ModelLike;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,10 +16,4 @@ public interface ModelLikeService extends IService<ModelLike> {
|
||||||
|
|
||||||
void like(Long imageId);
|
void like(Long imageId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
* @param pageDomain 分页参数
|
|
||||||
* @return 分页结果
|
|
||||||
*/
|
|
||||||
TableDataInfo listByPage(PageDomain pageDomain);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
import com.mcwl.resource.domain.WorkFlowLike;
|
import com.mcwl.resource.domain.WorkFlowLike;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,5 +17,4 @@ public interface WorkFlowLikeService extends IService<WorkFlowLike> {
|
||||||
|
|
||||||
void like(Long imageId);
|
void like(Long imageId);
|
||||||
|
|
||||||
TableDataInfo listByPage(PageDomain pageDomain);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,12 @@ import java.util.Objects;
|
||||||
import java.util.function.Function;
|
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
|
@Service
|
||||||
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper,ModelCommentLike> implements ModelCommentLikeService {
|
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper,ModelCommentLike> implements ModelCommentLikeService {
|
||||||
|
|
|
@ -25,7 +25,12 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
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
|
@Service
|
||||||
public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, ModelComment> implements ModelCommentService {
|
public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, ModelComment> implements ModelCommentService {
|
||||||
|
|
|
@ -19,9 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片评论点赞
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
|
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
|
||||||
|
|
|
@ -22,9 +22,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片评论实现
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentMapper, ModelImageComment> implements ModelImageCommentService {
|
public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentMapper, ModelImageComment> implements ModelImageCommentService {
|
||||||
|
|
|
@ -1,48 +1,29 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
||||||
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.constant.HttpStatus;
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
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.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelImageLike;
|
import com.mcwl.resource.domain.ModelImageLike;
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
|
||||||
import com.mcwl.resource.domain.vo.ModelImageLikeVo;
|
|
||||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
|
||||||
import com.mcwl.resource.mapper.ModelImageLikeMapper;
|
import com.mcwl.resource.mapper.ModelImageLikeMapper;
|
||||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||||
import com.mcwl.resource.service.ModelImageLikeService;
|
import com.mcwl.resource.service.ModelImageLikeService;
|
||||||
import com.mcwl.resource.service.ModelImageService;
|
import com.mcwl.resource.service.ModelImageService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
|
||||||
* 图片点赞实现
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper, ModelImageLike> implements ModelImageLikeService {
|
public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper, ModelImageLike> implements ModelImageLikeService {
|
||||||
|
|
||||||
private final ModelImageMapper modelImageMapper;
|
private final ModelImageMapper modelImageMapper;
|
||||||
|
|
||||||
private final ISysUserService sysUserService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void like(Long imageId) {
|
public void like(Long imageId) {
|
||||||
|
@ -88,59 +69,4 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
||||||
public List<ModelImage> fetchModelImageSortedByTopStatus() {
|
public List<ModelImage> fetchModelImageSortedByTopStatus() {
|
||||||
return modelImageMapper.fetchModelImageSortedByTopStatus();
|
return modelImageMapper.fetchModelImageSortedByTopStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param pageDomain 分页参数
|
|
||||||
* @return 分页数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
|
||||||
|
|
||||||
Page<ModelImageLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
|
||||||
if (StringUtils.isEmpty(pageDomain.getOrderByColumn())) {
|
|
||||||
pageDomain.setOrderByColumn("create_time");
|
|
||||||
}
|
|
||||||
// 设置排序
|
|
||||||
boolean isAsc = Objects.equals(pageDomain.getIsAsc(), "desc");
|
|
||||||
OrderItem orderItem = new OrderItem(pageDomain.getOrderByColumn(), isAsc);
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
|
|
||||||
baseMapper.selectPage(page, null);
|
|
||||||
// 获取分页数据
|
|
||||||
List<ModelImageLike> modelImageList = page.getRecords();
|
|
||||||
|
|
||||||
// ModelImage数据转为ModelImagePageVo
|
|
||||||
List<ModelImageLikeVo> modelImageLikeVoList = new ArrayList<>();
|
|
||||||
for (ModelImageLike modelImageLike : modelImageList) {
|
|
||||||
ModelImageLikeVo modelImageLikeVo = new ModelImageLikeVo();
|
|
||||||
BeanUtil.copyProperties(modelImageLike, modelImageLikeVo);
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(modelImageLike.getUserId());
|
|
||||||
modelImageLikeVo.setUserName(sysUser.getUserName());
|
|
||||||
modelImageLikeVo.setUserAvatar(sysUser.getAvatar());
|
|
||||||
|
|
||||||
// 获取图片信息
|
|
||||||
ModelImage modelImage = modelImageMapper.selectById(modelImageLike.getModelImageId());
|
|
||||||
modelImageLikeVo.setImagePaths(modelImage.getImagePaths());
|
|
||||||
modelImageLikeVo.setLikeNum(modelImage.getLikeNum());
|
|
||||||
|
|
||||||
|
|
||||||
modelImageLikeVoList.add(modelImageLikeVo);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 封装分页数据
|
|
||||||
TableDataInfo rspData = new TableDataInfo();
|
|
||||||
rspData.setCode(HttpStatus.SUCCESS);
|
|
||||||
rspData.setMsg("查询成功");
|
|
||||||
rspData.setRows(modelImageLikeVoList);
|
|
||||||
rspData.setTotal(page.getTotal());
|
|
||||||
|
|
||||||
return rspData;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
ModelImage modelImage = new ModelImage();
|
ModelImage modelImage = new ModelImage();
|
||||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||||
modelImageMapper.updateById(modelImage);
|
modelImageMapper.updateById(modelImage);
|
||||||
audit(modelImage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +76,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
private void audit(ModelImage modelImage) {
|
private void audit(ModelImage modelImage) {
|
||||||
|
|
||||||
// 执行审核操作
|
// 执行审核操作
|
||||||
threadPoolTaskExecutor.execute(() -> {
|
threadPoolTaskExecutor.submit(() -> {
|
||||||
if (modelImage != null) {
|
if (modelImage != null) {
|
||||||
|
|
||||||
if (modelImage.getTitle() != null) {
|
if (modelImage.getTitle() != null) {
|
||||||
|
@ -180,12 +178,13 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
}
|
}
|
||||||
// 设置排序
|
// 设置排序
|
||||||
OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn());
|
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||||
|
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||||
page.addOrder(orderItem);
|
page.addOrder(orderItem);
|
||||||
|
|
||||||
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null, ModelImage::getStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null, ModelImage::getStatus, imagePageRes.getStatus())
|
||||||
.eq(ModelImage::getUserId, SecurityUtils.getUserId())
|
.eq(imagePageRes.getUserId() != null, ModelImage::getUserId, imagePageRes.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
||||||
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.constant.HttpStatus;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
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.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.*;
|
import com.mcwl.resource.domain.*;
|
||||||
import com.mcwl.resource.domain.vo.ModelLikeVo;
|
|
||||||
import com.mcwl.resource.mapper.ModelMapper;
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
import com.mcwl.resource.mapper.ModelLikeMapper;
|
||||||
import com.mcwl.resource.service.ModelLikeService;
|
import com.mcwl.resource.service.ModelLikeService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
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
|
@Service
|
||||||
public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike> implements ModelLikeService {
|
public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike> implements ModelLikeService {
|
||||||
|
@ -36,10 +29,6 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
@Autowired
|
@Autowired
|
||||||
private ModelMapper modelMapper;
|
private ModelMapper modelMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService sysUserService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void like(Long modelId) {
|
public void like(Long modelId) {
|
||||||
|
@ -77,53 +66,4 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
||||||
model.setNumbers(model.getNumbers() + 1);
|
model.setNumbers(model.getNumbers() + 1);
|
||||||
modelMapper.updateById(model);
|
modelMapper.updateById(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
|
||||||
Page<ModelLike> page = initPage(pageDomain);
|
|
||||||
|
|
||||||
|
|
||||||
baseMapper.selectPage(page, null);
|
|
||||||
|
|
||||||
List<ModelLike> modelLikeList = page.getRecords();
|
|
||||||
List<ModelLikeVo> modelLikeVoList = new ArrayList<>();
|
|
||||||
for (ModelLike modelLike : modelLikeList) {
|
|
||||||
ModelLikeVo modelLikeVo = new ModelLikeVo();
|
|
||||||
BeanUtil.copyProperties(modelLike, modelLikeVo);
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(modelLike.getUserId());
|
|
||||||
modelLikeVo.setUserName(sysUser.getUserName());
|
|
||||||
modelLikeVo.setUserAvatar(sysUser.getAvatar());
|
|
||||||
|
|
||||||
// 获取模型信息
|
|
||||||
ModelProduct modelProduct = modelMapper.selectById(modelLike.getModelId());
|
|
||||||
modelLikeVo.setSurfaceUrl(modelProduct.getSurfaceUrl());
|
|
||||||
modelLikeVo.setLikeNum(modelProduct.getLikeNum());
|
|
||||||
|
|
||||||
modelLikeVoList.add(modelLikeVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
|
||||||
tableDataInfo.setRows(modelLikeVoList);
|
|
||||||
tableDataInfo.setTotal(page.getTotal());
|
|
||||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
|
||||||
tableDataInfo.setMsg("查询成功");
|
|
||||||
|
|
||||||
return tableDataInfo;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Page<ModelLike> initPage(PageDomain pageDomain) {
|
|
||||||
Page<ModelLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
|
||||||
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
|
||||||
pageDomain.setOrderByColumn("create_time");
|
|
||||||
}
|
|
||||||
OrderItem orderItem = OrderItem.desc(pageDomain.getOrderByColumn());
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import com.mcwl.system.init.DictInit;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -135,15 +134,15 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
||||||
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
}
|
}
|
||||||
// 设置排序
|
// 设置排序
|
||||||
List<OrderItem> orderItemList = new ArrayList<>();
|
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||||
orderItemList.add(OrderItem.desc("is_top"));
|
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||||
orderItemList.add(OrderItem.desc(imagePageRes.getOrderByColumn()));
|
page.addOrder(new OrderItem("is_top",false));
|
||||||
page.addOrder(orderItemList);
|
page.addOrder(orderItem);
|
||||||
|
|
||||||
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
|
||||||
.eq( ModelProduct::getUserId, SecurityUtils.getUserId())
|
.eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
||||||
postMapper.selectPage(page, lqw);
|
postMapper.selectPage(page, lqw);
|
||||||
|
|
|
@ -1,33 +1,18 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
||||||
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.constant.HttpStatus;
|
|
||||||
import com.mcwl.common.core.domain.entity.SysUser;
|
|
||||||
import com.mcwl.common.core.page.PageDomain;
|
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
|
||||||
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.common.utils.StringUtils;
|
|
||||||
import com.mcwl.resource.domain.ModelLike;
|
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
|
||||||
import com.mcwl.resource.domain.WorkFlow;
|
import com.mcwl.resource.domain.WorkFlow;
|
||||||
import com.mcwl.resource.domain.WorkFlowLike;
|
import com.mcwl.resource.domain.WorkFlowLike;
|
||||||
import com.mcwl.resource.domain.vo.ModelLikeVo;
|
|
||||||
import com.mcwl.resource.domain.vo.WorkFlowLikeVo;
|
|
||||||
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
|
import com.mcwl.resource.mapper.WorkFlowLikeMapper;
|
||||||
import com.mcwl.resource.mapper.WorkFlowMapper;
|
import com.mcwl.resource.mapper.WorkFlowMapper;
|
||||||
import com.mcwl.resource.service.WorkFlowLikeService;
|
import com.mcwl.resource.service.WorkFlowLikeService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +31,6 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkFlowMapper workFlowMapper;
|
private WorkFlowMapper workFlowMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService sysUserService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void like(Long modelId) {
|
public void like(Long modelId) {
|
||||||
|
@ -87,53 +69,4 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
||||||
workFlowMapper.updateById(workFlow);
|
workFlowMapper.updateById(workFlow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
|
||||||
|
|
||||||
Page<WorkFlowLike> page = initPage(pageDomain);
|
|
||||||
|
|
||||||
|
|
||||||
baseMapper.selectPage(page, null);
|
|
||||||
|
|
||||||
List<WorkFlowLike> workFlowLikeList = page.getRecords();
|
|
||||||
List<WorkFlowLikeVo> modelLikeVoList = new ArrayList<>();
|
|
||||||
for (WorkFlowLike workFlowLike : workFlowLikeList) {
|
|
||||||
WorkFlowLikeVo workFlowLikeVo = new WorkFlowLikeVo();
|
|
||||||
BeanUtil.copyProperties(workFlowLike, workFlowLikeVo);
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
SysUser sysUser = sysUserService.selectUserById(workFlowLike.getUserId());
|
|
||||||
workFlowLikeVo.setUserName(sysUser.getUserName());
|
|
||||||
workFlowLikeVo.setUserAvatar(sysUser.getAvatar());
|
|
||||||
|
|
||||||
// 获取工作流信息
|
|
||||||
WorkFlow workFlow = workFlowMapper.selectById(workFlowLike.getWorkFlowId());
|
|
||||||
workFlowLikeVo.setConverPath(workFlow.getCoverPath());
|
|
||||||
workFlowLikeVo.setLikeNum(workFlow.getLikeCount());
|
|
||||||
|
|
||||||
modelLikeVoList.add(workFlowLikeVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
|
||||||
tableDataInfo.setRows(modelLikeVoList);
|
|
||||||
tableDataInfo.setTotal(page.getTotal());
|
|
||||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
|
||||||
tableDataInfo.setMsg("查询成功");
|
|
||||||
|
|
||||||
return tableDataInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Page<WorkFlowLike> initPage(PageDomain pageDomain) {
|
|
||||||
Page<WorkFlowLike> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
|
||||||
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
|
||||||
pageDomain.setOrderByColumn("create_time");
|
|
||||||
}
|
|
||||||
OrderItem orderItem = OrderItem.desc(pageDomain.getOrderByColumn());
|
|
||||||
page.addOrder(orderItem);
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,12 +349,13 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
||||||
imagePageRes.setOrderByColumn("create_time");
|
imagePageRes.setOrderByColumn("create_time");
|
||||||
}
|
}
|
||||||
// 设置排序
|
// 设置排序
|
||||||
OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn());
|
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||||
|
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||||
page.addOrder(orderItem);
|
page.addOrder(orderItem);
|
||||||
|
|
||||||
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(imagePageRes.getStatus() != null, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
lqw.eq(imagePageRes.getStatus() != null, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
||||||
.eq(WorkFlow::getUserId, SecurityUtils.getUserId())
|
.eq(imagePageRes.getUserId() != null, WorkFlow::getUserId, imagePageRes.getUserId())
|
||||||
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
||||||
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime());
|
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime());
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<result property="sex" column="sex" />
|
<result property="sex" column="sex" />
|
||||||
<result property="avatar" column="avatar" />
|
<result property="avatar" column="avatar" />
|
||||||
<result property="password" column="password" />
|
<result property="password" column="password" />
|
||||||
<result property="wallet" column="wallet" />
|
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
<result property="loginIp" column="login_ip" />
|
<result property="loginIp" column="login_ip" />
|
||||||
|
@ -50,7 +49,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<sql id="selectUserVo">
|
||||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,u.wallet, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.inviter_user_id, u.free_points,
|
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.inviter_user_id, u.free_points,
|
||||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||||
from sys_user u
|
from sys_user u
|
||||||
|
@ -60,7 +59,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,u.wallet u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
where u.del_flag = '0'
|
where u.del_flag = '0'
|
||||||
<if test="userId != null and userId != 0">
|
<if test="userId != null and userId != 0">
|
||||||
|
@ -89,7 +88,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber,u.wallet u.status, u.create_time
|
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
@ -106,7 +105,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber,u.wallet u.status, u.create_time
|
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
|
|
Loading…
Reference in New Issue