From 2dff7f26adc08af4fcf0b77ff0ddda99d75c77c4 Mon Sep 17 00:00:00 2001 From: yanghui <2536613402@qq.com> Date: 星期五, 18 十一月 2022 15:21:25 +0800 Subject: [PATCH] #feat 修改库存 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java index 571f957..419c1cb 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java @@ -5,6 +5,7 @@ import javax.annotation.Resource; +import com.panzhihua.common.model.vos.community.DataCount; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; @@ -25,6 +26,8 @@ import com.panzhihua.service_community.service.ComActDynService; import lombok.extern.slf4j.Slf4j; + +import static java.util.Objects.nonNull; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -66,10 +69,14 @@ List<ComActDynVO> records = iPage.getRecords(); if (!ObjectUtils.isEmpty(records)) { records.forEach(comActDynVO1 -> { - String content = comActDynVO1.getContent(); - if (!ObjectUtils.isEmpty(content)) { - String text = RichTextUtil.getText(content); - comActDynVO1.setContentText(text); + if(comActDynVO1.getCategory()!=null&&comActDynVO1.getCategory()==4){ + comActDynVO1.setContent(null); + }else { + String content = comActDynVO1.getContent(); + if (!ObjectUtils.isEmpty(content)) { + String text = RichTextUtil.getText(content); + comActDynVO1.setContentText(text); + } } }); } @@ -89,14 +96,28 @@ if (ObjectUtils.isEmpty(comActDynDO)) { return R.fail("社区动态不存在"); } - ComActDO comActDO = comActDAO.selectById(comActDynDO.getCommunityId()); + Integer category = comActDynDO.getCategory(); Integer count = comActDynUserDAO .selectCount(new QueryWrapper<ComActDynUserDO>().lambda().eq(ComActDynUserDO::getDynId, id)); ComActDynVO comActDynVO = new ComActDynVO(); BeanUtils.copyProperties(comActDynDO, comActDynVO); comActDynVO.setReadNum(count); - comActDynVO.setCommunityName(comActDO.getName()); - return R.ok(comActDynVO); + if (nonNull(category) && !category.equals(3)) { + ComActDO comActDO = comActDAO.selectById(comActDynDO.getCommunityId()); + if(comActDO!=null){ + comActDynVO.setCommunityName(comActDO.getName()); + } + } + if(comActDynDO.getCategory()==4){ + if(comActDynDO.getReadNum()!=null){ + comActDynDO.setReadNum(comActDynDO.getReadNum()+1); + } + else { + comActDynDO.setReadNum(1); + } + comActDynDAO.updateById(comActDynDO); + } + return R.ok(comActDynDO); } /** @@ -179,4 +200,5 @@ return R.ok(iPage); } + } -- Gitblit v1.7.1