Compare commits
9 Commits
628c9e57bb
...
09dfd88a12
Author | SHA1 | Date |
---|---|---|
|
09dfd88a12 | |
|
c6a92b1e62 | |
|
bcf7cb7e3d | |
|
1594bc4a74 | |
|
019ff6943f | |
|
8316bd1e76 | |
|
93efb588e2 | |
|
3cd55dbbb9 | |
|
cf6dcdee4c |
|
@ -0,0 +1,63 @@
|
|||
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,13 +2,16 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
|
||||
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.communityCenter.domain.dto.QuestionDetailRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionReplyRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
import com.mcwl.communityCenter.service.QuestionService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -30,6 +33,8 @@ public class QuestionController {
|
|||
|
||||
private final QuestionService questionService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 提问
|
||||
*/
|
||||
|
@ -37,6 +42,28 @@ public class QuestionController {
|
|||
@ApiOperation(value = "提问")
|
||||
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);
|
||||
|
||||
|
@ -76,16 +103,16 @@ public class QuestionController {
|
|||
return AjaxResult.success(questionVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复
|
||||
*/
|
||||
@PostMapping("reply")
|
||||
@ApiOperation(value = "回复")
|
||||
public AjaxResult reply(@RequestBody @Valid QuestionReplyRes questionReplyRes) {
|
||||
|
||||
return questionService.reply(questionReplyRes);
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 回复
|
||||
// */
|
||||
// @PostMapping("reply")
|
||||
// @ApiOperation(value = "回复")
|
||||
// public AjaxResult reply(@RequestBody @Valid QuestionReplyRes questionReplyRes) {
|
||||
//
|
||||
// return questionService.reply(questionReplyRes);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@ import com.mcwl.common.utils.SecurityUtils;
|
|||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import com.mcwl.resource.service.*;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
@ -43,12 +41,21 @@ public class MallProductController extends BaseController {
|
|||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
@Autowired
|
||||
private ModelLikeService modelLikeService;
|
||||
|
||||
@Autowired
|
||||
private ModelImageService modelImageService;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowService workFlowService;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowLikeService workFlowLikeService;
|
||||
|
||||
@Autowired
|
||||
private ModelImageLikeService modelImageLikeService;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
|
@ -192,9 +199,9 @@ public class MallProductController extends BaseController {
|
|||
|
||||
|
||||
/**
|
||||
* 我的发布-模型
|
||||
* 我的发布-模型列表
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-模型")
|
||||
@ApiOperation(value = "我的发布-模型列表")
|
||||
@PostMapping("/selectByUserIdModel")
|
||||
public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -202,9 +209,9 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 我的发布-工作流
|
||||
* 我的发布-工作流列表
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-工作流")
|
||||
@ApiOperation(value = "我的发布-工作流列表")
|
||||
@PostMapping("/selectByUserIdWorkFlow")
|
||||
public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -212,9 +219,9 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 我的发布-图片
|
||||
* 我的发布-图片列表
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-图片")
|
||||
@ApiOperation(value = "我的发布-图片列表")
|
||||
@PostMapping("/selectByUserIdImage")
|
||||
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -222,39 +229,30 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 点赞-模型
|
||||
* 我的点赞-模型列表
|
||||
*/
|
||||
@ApiOperation(value = "点赞-模型")
|
||||
@ApiOperation(value = "我的点赞-模型列表")
|
||||
@PostMapping("/likeModel")
|
||||
public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||
return modelService.listByPage(imagePageRes);
|
||||
return modelLikeService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞-工作流
|
||||
* 我的点赞-工作流列表
|
||||
*/
|
||||
@ApiOperation(value = "点赞-工作流")
|
||||
@ApiOperation(value = "我的点赞-工作流列表")
|
||||
@PostMapping("/likeWorkFlow")
|
||||
public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||
return workFlowService.listByPage(imagePageRes);
|
||||
return workFlowLikeService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞-图片
|
||||
* 我的点赞-图片列表
|
||||
*/
|
||||
@ApiOperation(value = "点赞-图片")
|
||||
@ApiOperation(value = "我的点赞-图片列表")
|
||||
@PostMapping("/likeImage")
|
||||
public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
BeanUtil.copyProperties(pageDomain, imagePageRes);
|
||||
imagePageRes.setUserId(SecurityUtils.getUserId());
|
||||
return modelImageService.listByPage(imagePageRes);
|
||||
return modelImageLikeService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.mcwl.common.core.domain.AjaxResult;
|
|||
import com.mcwl.resource.domain.Report;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.service.ReportService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -26,6 +27,7 @@ public class ReportController {
|
|||
* @param report
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增举报内容")
|
||||
@PostMapping("/addReport")
|
||||
public AjaxResult addReport(@RequestBody Report report){
|
||||
|
||||
|
@ -33,11 +35,14 @@ public class ReportController {
|
|||
return AjaxResult.success("举报成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询举报列表
|
||||
* @param pageVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询举报列表")
|
||||
@PostMapping("/selectReport")
|
||||
public AjaxResult selectReport(@RequestBody PageVo pageVo){
|
||||
|
||||
|
@ -50,6 +55,7 @@ public class ReportController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除举报")
|
||||
@GetMapping("/deleteReport")
|
||||
public AjaxResult deleteReport(@RequestParam Long id){
|
||||
|
||||
|
@ -62,6 +68,7 @@ public class ReportController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改状态")
|
||||
@GetMapping("/updateStatus")
|
||||
public AjaxResult updateStatus(@RequestParam Long id){
|
||||
|
||||
|
|
|
@ -115,6 +115,11 @@ public class SysUser extends BaseEntity
|
|||
*/
|
||||
private Double freePoints;
|
||||
|
||||
/**
|
||||
* 钱包-金币
|
||||
*/
|
||||
private Double wallet;
|
||||
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
@ -364,6 +369,14 @@ public class SysUser extends BaseEntity
|
|||
this.freePoints = freePoints;
|
||||
}
|
||||
|
||||
public Double getWallet() {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
public void setWallet(Double wallet) {
|
||||
this.wallet = wallet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUser{" +
|
||||
|
|
|
@ -29,7 +29,7 @@ public class PageDomain
|
|||
private String orderByColumn;
|
||||
|
||||
/** 排序的方向desc或者asc */
|
||||
@ApiModelProperty(value = "排序的方向desc或者asc", example = "asc")
|
||||
@ApiModelProperty(hidden = true)
|
||||
private String isAsc = "asc";
|
||||
|
||||
/** 分页参数合理化 */
|
||||
|
|
|
@ -27,7 +27,12 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
|||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
|
||||
try {
|
||||
String username = SecurityUtils.getUsername();
|
||||
this.setFieldValByName("updateBy", username, metaObject);
|
||||
} catch (Exception e) {
|
||||
this.setFieldValByName("updateBy", "", metaObject);
|
||||
}
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
@ -23,64 +24,67 @@ import java.util.Date;
|
|||
public class Question extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id - 租户id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 提问用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "提问用户id")
|
||||
private Long questionUserId;
|
||||
|
||||
/**
|
||||
* 提问内容
|
||||
*/
|
||||
@ApiModelProperty(value = "提问内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提问图片
|
||||
*/
|
||||
@ApiModelProperty(value = "提问图片")
|
||||
private String questionUrl;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@ApiModelProperty(value = "答复内容")
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
@ApiModelProperty(value = "答复时间")
|
||||
private Date replyTime;
|
||||
// /**
|
||||
// * 回复内容
|
||||
// */
|
||||
// @ApiModelProperty(value = "答复内容")
|
||||
// private String reply;
|
||||
//
|
||||
// /**
|
||||
// * 回复时间
|
||||
// */
|
||||
// @ApiModelProperty(value = "答复时间")
|
||||
// private Date replyTime;
|
||||
|
||||
/**
|
||||
* 是否匿名
|
||||
*/
|
||||
@ApiModelProperty(value = "是否匿名")
|
||||
private Integer isAnonymous;
|
||||
|
||||
// /**
|
||||
// * 状态
|
||||
// */
|
||||
// @ApiModelProperty(value = "状态")
|
||||
// private Integer status;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* 提问类型 0免费 1付费
|
||||
*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 付费金额 当提问类型为付费时必填
|
||||
*/
|
||||
private Double amount;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
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;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
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;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
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;
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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)
|
||||
private Long communityId;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
// @ApiModelProperty(value = "状态")
|
||||
// private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -44,9 +45,24 @@ public class QuestionRes {
|
|||
/**
|
||||
* 是否匿名 0 否 1 是
|
||||
*/
|
||||
//swagger给上默认值
|
||||
@ApiModelProperty(value = "是否匿名", position = 5)
|
||||
@NotNull(message = "是否匿名不能为空")
|
||||
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;
|
||||
|
||||
/**
|
||||
* 社区请求参数
|
||||
* 社区返回数据
|
||||
*/
|
||||
@Data
|
||||
@TableName("cc_community")
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
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 = "提问时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 答复用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "答复用户id")
|
||||
private Long replyUserId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@ApiModelProperty(value = "回复内容")
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
@ApiModelProperty(value = "回复时间")
|
||||
private Date replyTime;
|
||||
// /**
|
||||
// * 答复用户id
|
||||
// */
|
||||
// @ApiModelProperty(value = "答复用户id")
|
||||
// private Long replyUserId;
|
||||
//
|
||||
// /**
|
||||
// * 回复内容
|
||||
// */
|
||||
// @ApiModelProperty(value = "回复内容")
|
||||
// private String reply;
|
||||
//
|
||||
// /**
|
||||
// * 回复时间
|
||||
// */
|
||||
// @ApiModelProperty(value = "回复时间")
|
||||
// private Date replyTime;
|
||||
|
||||
/**
|
||||
* 是否匿名
|
||||
|
@ -83,6 +83,16 @@ public class QuestionVo {
|
|||
@ApiModelProperty(value = "是否匿名")
|
||||
private Integer isAnonymous;
|
||||
|
||||
/**
|
||||
* 提问类型 0免费 1付费
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 付费金额 当提问类型为付费时必填
|
||||
*/
|
||||
private Double amount;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
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,9 +19,7 @@ public interface QuestionMapper extends BaseMapper<Question> {
|
|||
Long tenantId,
|
||||
@NotNull(message = "社区不能为空")
|
||||
@Param("communityId")
|
||||
Long communityId,
|
||||
@Param("status")
|
||||
Integer status);
|
||||
Long communityId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Question selectByIdAndTenantIdAndCommunityId(@Param("id")
|
||||
|
@ -38,7 +36,5 @@ public interface QuestionMapper extends BaseMapper<Question> {
|
|||
Long tenantId,
|
||||
@NotNull(message = "社区不能为空")
|
||||
@Param("communityId")
|
||||
Long communityId,
|
||||
@Param("status")
|
||||
Integer status);
|
||||
Long communityId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
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);
|
||||
|
||||
/**
|
||||
* 回复问题
|
||||
* @param questionReplyRes 回复信息
|
||||
*/
|
||||
AjaxResult reply(QuestionReplyRes questionReplyRes);
|
||||
// /**
|
||||
// * 回复问题
|
||||
// * @param questionReplyRes 回复信息
|
||||
// */
|
||||
// AjaxResult reply(QuestionReplyRes questionReplyRes);
|
||||
|
||||
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
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("租户或社区不存在");
|
||||
}
|
||||
|
||||
if (Objects.equals(tenantId, userId)) {
|
||||
return AjaxResult.error("您不能提问自己的问题");
|
||||
}
|
||||
// if (Objects.equals(tenantId, userId)) {
|
||||
// return AjaxResult.error("您不能提问自己的问题");
|
||||
// }
|
||||
|
||||
//提问人(userId)是否在社区中
|
||||
Invite invite = inviteMapper.selectByTenantIdAndCommunityIdAndInviteeUserId(tenantId, communityId, userId);
|
||||
if (Objects.isNull(invite)) {
|
||||
return AjaxResult.error("您不是该社区成员,不能提问");
|
||||
}
|
||||
// Invite invite = inviteMapper.selectByTenantIdAndCommunityIdAndInviteeUserId(tenantId, communityId, userId);
|
||||
// if (Objects.isNull(invite)) {
|
||||
// return AjaxResult.error("您不是该社区成员,不能提问");
|
||||
// }
|
||||
|
||||
Question question = new Question();
|
||||
BeanUtil.copyProperties(questionRes, question);
|
||||
question.setQuestionUserId(userId);
|
||||
question.setStatus(StatusConstant.STATUS_UNREPLIED);
|
||||
// question.setStatus(StatusConstant.STATUS_UNREPLIED);
|
||||
baseMapper.insert(question);
|
||||
|
||||
|
||||
CommunityAdvice communityAdvice = new CommunityAdvice();
|
||||
communityAdvice.setTenantId(tenantId);
|
||||
communityAdvice.setCommunityId(communityId);
|
||||
communityAdvice.setUserId(tenantId);
|
||||
communityAdvice.setTitle("您有新的问题");
|
||||
communityAdvice.setContent(questionRes.getContent());
|
||||
communityAdviceMapper.insert(communityAdvice);
|
||||
// CommunityAdvice communityAdvice = new CommunityAdvice();
|
||||
// communityAdvice.setTenantId(tenantId);
|
||||
// communityAdvice.setCommunityId(communityId);
|
||||
// communityAdvice.setUserId(tenantId);
|
||||
// communityAdvice.setTitle("您有新的问题");
|
||||
// communityAdvice.setContent(questionRes.getContent());
|
||||
// communityAdviceMapper.insert(communityAdvice);
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
|
@ -105,7 +105,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
|
||||
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();
|
||||
|
@ -153,43 +154,44 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
return questionVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复问题
|
||||
*
|
||||
* @param questionReplyRes 回复信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult reply(QuestionReplyRes questionReplyRes) {
|
||||
|
||||
Long communityId = questionReplyRes.getCommunityId();
|
||||
Long questionId = questionReplyRes.getQuestionId();
|
||||
LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(Question::getId, questionId)
|
||||
.eq(Question::getCommunityId, communityId)
|
||||
.eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
||||
|
||||
// 查询问题信息
|
||||
Question question = baseMapper.selectOne(lqw);
|
||||
|
||||
if (Objects.isNull(question)) {
|
||||
return AjaxResult.error("问题不存在或已被回复");
|
||||
}
|
||||
|
||||
question.setReply(questionReplyRes.getReply());
|
||||
question.setStatus(StatusConstant.STATUS_REPLIED);
|
||||
question.setReplyTime(new Date());
|
||||
|
||||
baseMapper.updateById(question);
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 回复问题
|
||||
// *
|
||||
// * @param questionReplyRes 回复信息
|
||||
// */
|
||||
// @Override
|
||||
// public AjaxResult reply(QuestionReplyRes questionReplyRes) {
|
||||
//
|
||||
// Long communityId = questionReplyRes.getCommunityId();
|
||||
// Long questionId = questionReplyRes.getQuestionId();
|
||||
// LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
||||
// lqw.eq(Question::getId, questionId)
|
||||
// .eq(Question::getCommunityId, communityId)
|
||||
// .eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
||||
//
|
||||
// // 查询问题信息
|
||||
// Question question = baseMapper.selectOne(lqw);
|
||||
//
|
||||
// if (Objects.isNull(question)) {
|
||||
// return AjaxResult.error("问题不存在或已被回复");
|
||||
// }
|
||||
//
|
||||
// question.setReply(questionReplyRes.getReply());
|
||||
// question.setStatus(StatusConstant.STATUS_REPLIED);
|
||||
// question.setReplyTime(new Date());
|
||||
//
|
||||
// baseMapper.updateById(question);
|
||||
// return AjaxResult.success();
|
||||
//
|
||||
// }
|
||||
|
||||
@Override
|
||||
public TableDataInfo listImage(QuestionPageRes 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();
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?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,32 +6,52 @@
|
|||
|
||||
|
||||
<select id="list" resultType="com.mcwl.communityCenter.domain.Question">
|
||||
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
question_user_id,
|
||||
content,
|
||||
question_url,
|
||||
is_anonymous,
|
||||
amount,
|
||||
type
|
||||
from cc_question
|
||||
where del_flag = '0'
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
<if test="status != null">
|
||||
and status= #{status}
|
||||
</if>
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
order by amount desc, create_time desc
|
||||
</select>
|
||||
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Question">
|
||||
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
question_user_id,
|
||||
content,
|
||||
question_url,
|
||||
is_anonymous,
|
||||
amount,
|
||||
type
|
||||
from cc_question
|
||||
where id = #{id}
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
<select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
|
||||
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
question_user_id,
|
||||
content,
|
||||
question_url,
|
||||
is_anonymous,
|
||||
amount,
|
||||
type
|
||||
from cc_question
|
||||
where del_flag = '0'
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
<if test="status != null">
|
||||
and status= #{status}
|
||||
</if>
|
||||
and question_url is not null
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and question_url is not null
|
||||
order by amount desc, create_time desc
|
||||
</select>
|
||||
</mapper>
|
|
@ -173,7 +173,7 @@ public class WorkFlow {
|
|||
* 作品点赞数量
|
||||
*/
|
||||
@ApiModelProperty(value = "作品点赞数量")
|
||||
private Long likeCount = 0L;
|
||||
private Integer likeCount = 0;
|
||||
|
||||
/**
|
||||
* 翻译后主体
|
||||
|
|
|
@ -16,11 +16,6 @@ import java.util.Date;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ModelImagePageRes extends PageDomain {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
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;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
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,8 +1,11 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
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.ModelImageLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,5 +19,10 @@ public interface ModelImageLikeService extends IService<ModelImageLike> {
|
|||
|
||||
List<ModelImage> fetchModelImageSortedByTopStatus();
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageDomain 分页参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -16,4 +18,10 @@ public interface ModelLikeService extends IService<ModelLike> {
|
|||
|
||||
void like(Long imageId);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageDomain 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -17,4 +19,5 @@ public interface WorkFlowLikeService extends IService<WorkFlowLike> {
|
|||
|
||||
void like(Long imageId);
|
||||
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,7 @@ 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 {
|
||||
|
|
|
@ -25,12 +25,7 @@ import java.util.List;
|
|||
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 {
|
||||
|
|
|
@ -19,6 +19,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 图片评论点赞
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
|
||||
|
|
|
@ -22,6 +22,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 图片评论实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentMapper, ModelImageComment> implements ModelImageCommentService {
|
||||
|
|
|
@ -1,29 +1,48 @@
|
|||
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.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.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
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.ModelImageMapper;
|
||||
import com.mcwl.resource.service.ModelImageLikeService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 图片点赞实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper, ModelImageLike> implements ModelImageLikeService {
|
||||
|
||||
private final ModelImageMapper modelImageMapper;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long imageId) {
|
||||
|
@ -69,4 +88,59 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
|
|||
public List<ModelImage> 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,6 +31,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -59,6 +60,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
ModelImage modelImage = new ModelImage();
|
||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||
modelImageMapper.updateById(modelImage);
|
||||
audit(modelImage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +78,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
private void audit(ModelImage modelImage) {
|
||||
|
||||
// 执行审核操作
|
||||
threadPoolTaskExecutor.submit(() -> {
|
||||
threadPoolTaskExecutor.execute(() -> {
|
||||
if (modelImage != null) {
|
||||
|
||||
if (modelImage.getTitle() != null) {
|
||||
|
@ -178,13 +180,12 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
imagePageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
// 设置排序
|
||||
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||
OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn());
|
||||
page.addOrder(orderItem);
|
||||
|
||||
LambdaQueryWrapper<ModelImage> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(imagePageRes.getStatus() != null, ModelImage::getStatus, imagePageRes.getStatus())
|
||||
.eq(imagePageRes.getUserId() != null, ModelImage::getUserId, imagePageRes.getUserId())
|
||||
.eq(ModelImage::getUserId, SecurityUtils.getUserId())
|
||||
.ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime())
|
||||
.le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime());
|
||||
|
||||
|
|
|
@ -1,26 +1,33 @@
|
|||
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.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.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.*;
|
||||
import com.mcwl.resource.domain.vo.ModelLikeVo;
|
||||
import com.mcwl.resource.mapper.ModelMapper;
|
||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
||||
import com.mcwl.resource.service.ModelLikeService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
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 {
|
||||
|
@ -29,6 +36,10 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
@Autowired
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long modelId) {
|
||||
|
@ -66,4 +77,53 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
model.setNumbers(model.getNumbers() + 1);
|
||||
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,6 +31,7 @@ import com.mcwl.system.init.DictInit;
|
|||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -134,15 +135,15 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
if (StringUtils.isEmpty(imagePageRes.getOrderByColumn())) {
|
||||
imagePageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
// 设置排序
|
||||
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||
page.addOrder(new OrderItem("is_top",false));
|
||||
page.addOrder(orderItem);
|
||||
// 设置排序
|
||||
List<OrderItem> orderItemList = new ArrayList<>();
|
||||
orderItemList.add(OrderItem.desc("is_top"));
|
||||
orderItemList.add(OrderItem.desc(imagePageRes.getOrderByColumn()));
|
||||
page.addOrder(orderItemList);
|
||||
|
||||
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
|
||||
.eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId())
|
||||
.eq( ModelProduct::getUserId, SecurityUtils.getUserId())
|
||||
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
|
||||
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
|
||||
postMapper.selectPage(page, lqw);
|
||||
|
|
|
@ -1,18 +1,33 @@
|
|||
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.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.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.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.WorkFlowMapper;
|
||||
import com.mcwl.resource.service.WorkFlowLikeService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +46,9 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
|||
@Autowired
|
||||
private WorkFlowMapper workFlowMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long modelId) {
|
||||
|
@ -69,4 +87,53 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl<WorkFlowLikeMapper, Wor
|
|||
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,13 +349,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
imagePageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
// 设置排序
|
||||
boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc);
|
||||
OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn());
|
||||
page.addOrder(orderItem);
|
||||
|
||||
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(imagePageRes.getStatus() != null, WorkFlow::getAuditStatus, imagePageRes.getStatus())
|
||||
.eq(imagePageRes.getUserId() != null, WorkFlow::getUserId, imagePageRes.getUserId())
|
||||
.eq(WorkFlow::getUserId, SecurityUtils.getUserId())
|
||||
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
|
||||
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime());
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="password" column="password" />
|
||||
<result property="wallet" column="wallet" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loginIp" column="login_ip" />
|
||||
|
@ -49,7 +50,7 @@
|
|||
</resultMap>
|
||||
|
||||
<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.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.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,
|
||||
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
|
||||
from sys_user u
|
||||
|
@ -59,7 +60,7 @@
|
|||
</sql>
|
||||
|
||||
<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.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.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
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
|
@ -88,7 +89,7 @@
|
|||
</select>
|
||||
|
||||
<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.status, u.create_time
|
||||
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
|
||||
from sys_user u
|
||||
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
|
||||
|
@ -105,7 +106,7 @@
|
|||
</select>
|
||||
|
||||
<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.status, u.create_time
|
||||
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
|
||||
from sys_user u
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue