From 70aa6a6b27fc5789a19f3deb0454bb6c855f0a44 Mon Sep 17 00:00:00 2001 From: yang <2119157836@qq.com> Date: Wed, 22 Jan 2025 17:34:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=97=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mcwl/communityCenter/domain/Question.java | 9 +++--- .../domain/QuestionComment.java | 4 +-- .../mapper/QuestionCommentMapper.java | 23 +++++++++----- .../impl/QuestionCommentServiceImpl.java | 30 +++++++++++++++++-- .../service/impl/QuestionServiceImpl.java | 12 ++++++++ .../communityCenter/QuestionCommentMapper.xml | 10 +++++++ .../resources/mapper/system/SysUserMapper.xml | 1 + 7 files changed, 72 insertions(+), 17 deletions(-) diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Question.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Question.java index 7da7e45..432eb2e 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Question.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Question.java @@ -70,11 +70,10 @@ public class Question extends BaseEntity { */ private Integer isAnonymous; -// /** -// * 状态 -// */ -// @ApiModelProperty(value = "状态") -// private Integer status; + /** + * 状态 0未解决 1已解决 + */ + private Integer status; /** * 提问类型 0免费 1付费 diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java index 9b7279d..91432bf 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java @@ -41,9 +41,9 @@ public class QuestionComment extends BaseEntity { */ private String content; /** - * 是否接受 + * 是否接受 0未接受 1已接受 */ - private Long isAccept; + private Integer isAccept; diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java index d149957..1285719 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java @@ -15,15 +15,22 @@ import javax.validation.constraints.NotNull; public interface QuestionCommentMapper extends BaseMapper { @InterceptorIgnore(tenantLine = "true") - Page selectByTenantIdAndCommunityIdAndQuestionIdPage(Page page, - @Param("tenantId") - Long tenantId, - @Param("communityId") - Long communityId, - @Param("questionId") - Long questionId); + Page selectByTenantIdAndCommunityIdAndQuestionIdPage(Page 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); + QuestionComment selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(@Param("tenantId") + Long tenantId, + @Param("communityId") + Long communityId, + @Param("questionId") + Long questionId, + @Param("commentId") + Long commentId); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java index 6214d05..7aaf1fc 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java @@ -24,6 +24,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -34,6 +35,8 @@ public class QuestionCommentServiceImpl extends ServiceImpl i // question.setStatus(StatusConstant.STATUS_UNREPLIED); baseMapper.insert(question); + SysUser sysUser = sysUserService.selectUserById(userId); + + BigDecimal sysWallet = new BigDecimal(sysUser.getWallet().toString()); + BigDecimal amount = new BigDecimal(questionRes.getAmount().toString()); + + // 扣除钱包 + BigDecimal subtract = sysWallet.subtract(amount); + + sysUser.setWallet(subtract.doubleValue()); + sysUserService.updateUser(sysUser); + // CommunityAdvice communityAdvice = new CommunityAdvice(); // communityAdvice.setTenantId(tenantId); diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml index f2d5454..855ef92 100644 --- a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml @@ -15,4 +15,14 @@ and del_flag = '0' order by create_time desc + \ No newline at end of file diff --git a/mcwl-system/src/main/resources/mapper/system/SysUserMapper.xml b/mcwl-system/src/main/resources/mapper/system/SysUserMapper.xml index 6e640e1..83fb171 100644 --- a/mcwl-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/mcwl-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -210,6 +210,7 @@ sex = #{sex}, avatar = #{avatar}, password = #{password}, + wallet = #{wallet}, status = #{status}, login_ip = #{loginIp}, login_date = #{loginDate},