Merge remote-tracking branch 'origin/preview' into preview
commit
019ff6943f
|
@ -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);
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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{" +
|
||||
|
|
|
@ -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 String id;
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private String communityId;
|
||||
/**
|
||||
* 提问id
|
||||
*/
|
||||
private String questionId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 是否接受
|
||||
*/
|
||||
private String isAccept;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
|
@ -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 {
|
||||
|
|
|
@ -18,6 +18,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 图片点赞实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper, ModelImageLike> implements ModelImageLikeService {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -11,6 +13,7 @@ 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.common.utils.baidu.BaiduCensor;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
|
@ -22,12 +25,17 @@ import com.mcwl.system.init.DictInit;
|
|||
import com.mcwl.system.service.ISysDictDataService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelImage> implements ModelImageService {
|
||||
|
@ -40,6 +48,8 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
|
||||
private final ISysDictDataService sysDictDataService;
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +60,7 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
ModelImage modelImage = new ModelImage();
|
||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||
modelImageMapper.updateById(modelImage);
|
||||
audit(modelImage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,11 +72,98 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
|
|||
modelImage.setStatus(3);
|
||||
modelImageMapper.insert(modelImage);
|
||||
|
||||
|
||||
audit(modelImage);
|
||||
}
|
||||
|
||||
private void audit(ModelImage modelImage) {
|
||||
|
||||
// 执行审核操作
|
||||
threadPoolTaskExecutor.execute(() -> {
|
||||
if (modelImage != null) {
|
||||
|
||||
if (modelImage.getTitle() != null) {
|
||||
|
||||
//审核名称
|
||||
String s = BaiduCensor.TextCensor(modelImage.getTitle() + "," + modelImage.getTags() + ","
|
||||
+ modelImage.getDescription());
|
||||
// 解析 JSON 字符串
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
// 获取 'conclusion' 字段的值
|
||||
String conclusion = jsonObject.getString("conclusion");
|
||||
|
||||
if (conclusion.equals("不合规")) {
|
||||
|
||||
//更改状态,添加原因 -> 结束任务
|
||||
// 获取 'data' 数组
|
||||
JSONArray dataArray = jsonObject.getJSONArray("data");
|
||||
|
||||
// 存储所有的失败原因
|
||||
List<String> failureReasons = new ArrayList<>();
|
||||
// 遍历 'data' 数组中的每个元素
|
||||
for (Object itemObj : dataArray) {
|
||||
JSONObject item = (JSONObject) itemObj;
|
||||
String msg = item.getString("msg");
|
||||
failureReasons.add(msg);
|
||||
}
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelImage.setAuditText(concatenatedReasons);
|
||||
|
||||
//修改状态以及失败原因
|
||||
modelImage.setStatus(4);
|
||||
log.info("执行111");
|
||||
modelImageMapper.updateById(modelImage);
|
||||
log.info("图片审核未通过");
|
||||
//结束任务
|
||||
return;
|
||||
}
|
||||
|
||||
//修改为合格
|
||||
modelImage.setAuditText("");
|
||||
modelImage.setStatus(1);
|
||||
baseMapper.updateById(modelImage);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelImage.getImagePaths() == null) {
|
||||
return;
|
||||
}
|
||||
//审核图片
|
||||
String[] split = modelImage.getImagePaths().split(",");
|
||||
for (String path : split) {
|
||||
String s2 = BaiduCensor.ImageCnesor(path);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(s2);
|
||||
if (jsonObject2.getString("conclusion").equals("不合规")) {
|
||||
|
||||
//修改状态->跳出循环 判断下一个版本
|
||||
// 获取 'data' 数组
|
||||
JSONArray dataArray2 = jsonObject2.getJSONArray("data");
|
||||
// 存储所有的失败原因
|
||||
List<String> failureReasons = new ArrayList<>();
|
||||
// 遍历 'data' 数组中的每个元素
|
||||
for (Object itemObj : dataArray2) {
|
||||
JSONObject item = (JSONObject) itemObj;
|
||||
String msg = item.getString("msg");
|
||||
failureReasons.add(msg);
|
||||
}
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelImage.setAuditText(concatenatedReasons);
|
||||
modelImage.setStatus(4);
|
||||
baseMapper.updateById(modelImage);
|
||||
log.info("图片审核未通过");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//修改版本成功审核状态
|
||||
modelImage.setAuditText("");
|
||||
modelImage.setStatus(1);
|
||||
baseMapper.updateById(modelImage);
|
||||
log.info("全部通过审核");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,12 +15,7 @@ import java.util.Date;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.service.impl
|
||||
* @Filename:ModelLikeServiceImpl
|
||||
* @Description TODO
|
||||
* @Date:2025/1/12 12:05
|
||||
* 模型点赞
|
||||
*/
|
||||
@Service
|
||||
public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike> implements ModelLikeService {
|
||||
|
|
|
@ -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