From ed9c9f07d1f9a5ed027e06feb8f0f5ed2d1756bc Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期五, 07 六月 2024 10:39:25 +0800 Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit --- server/system_service/src/main/java/com/doumee/service/system/impl/NoticesServiceImpl.java | 82 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 80 insertions(+), 2 deletions(-) diff --git a/server/system_service/src/main/java/com/doumee/service/system/impl/NoticesServiceImpl.java b/server/system_service/src/main/java/com/doumee/service/system/impl/NoticesServiceImpl.java index 67cbee2..68ab7e8 100644 --- a/server/system_service/src/main/java/com/doumee/service/system/impl/NoticesServiceImpl.java +++ b/server/system_service/src/main/java/com/doumee/service/system/impl/NoticesServiceImpl.java @@ -4,21 +4,26 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.doumee.core.constants.ResponseStatus; +import com.doumee.core.exception.BusinessException; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.model.PageData; import com.doumee.core.model.PageWrap; import com.doumee.core.utils.Constants; import com.doumee.core.utils.Utils; +import com.doumee.dao.system.dto.NoticesDTO; import com.doumee.dao.system.join.NoticesJoinMapper; import com.doumee.dao.system.model.Notices; import com.doumee.service.system.NoticesService; import com.github.xiaoymin.knife4j.core.util.CollectionUtils; import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** * 绯荤粺娑堟伅淇℃伅琛⊿ervice瀹炵幇 @@ -93,8 +98,6 @@ IPage<Notices> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); MPJLambdaWrapper<Notices> queryWrapper = new MPJLambdaWrapper<>(); Utils.MP.blankToNull(pageWrap.getModel()); - LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - queryWrapper.selectAll(Notices.class); if (pageWrap.getModel().getIsdeleted() != null) { queryWrapper.eq(Notices::getIsdeleted, pageWrap.getModel().getIsdeleted()); @@ -140,7 +143,82 @@ return noticesMapper.selectCount(wrapper); } + @Override + public PageData<Notices> taskCanterPage(PageWrap<NoticesDTO> pageWrap) { + IPage<Notices> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); + MPJLambdaWrapper<Notices> queryWrapper = new MPJLambdaWrapper<>(); + Utils.MP.blankToNull(pageWrap.getModel()); + queryWrapper.selectAll(Notices.class); + NoticesDTO noticesDTO = pageWrap.getModel(); + if(Objects.isNull(noticesDTO) + || Objects.isNull(noticesDTO.getMemberId()) + || Objects.isNull(noticesDTO.getQueryType())){ + queryWrapper.eq("1","2"); + } + if(noticesDTO.getQueryType().equals(Constants.ZERO)){ + queryWrapper.eq(Notices::getStatus,Constants.ZERO); + queryWrapper.eq(Notices::getSendacopy,Constants.ZERO); + queryWrapper.eq(Notices::getUserId, noticesDTO.getMemberId()); + } else if(noticesDTO.getQueryType().equals(Constants.ONE)){ + queryWrapper.eq(Notices::getStatus,Constants.ONE); + queryWrapper.eq(Notices::getSendacopy,Constants.ZERO); + } else if(noticesDTO.getQueryType().equals(Constants.TWO)){ + queryWrapper.eq(Notices::getParam3, noticesDTO.getMemberId()); + } else if (noticesDTO.getQueryType().equals(Constants.THREE)) { + queryWrapper.eq(Notices::getUserId, noticesDTO.getMemberId()); + queryWrapper.eq(Notices::getSendacopy,Constants.ONE); + if(Objects.nonNull(noticesDTO.getNoRead())&&Constants.equalsInteger(noticesDTO.getNoRead(),Constants.ONE)){ + queryWrapper.eq(Notices::getReaded,Constants.ONE); + } + }else{ + queryWrapper.eq("1","2"); + } + queryWrapper.ge(noticesDTO.getStartDate() != null, Notices::getCreateDate, Utils.Date.getStart(noticesDTO.getStartDate() )); + queryWrapper.le(noticesDTO.getStartDate() != null, Notices::getCreateDate, Utils.Date.getEnd(noticesDTO.getStartDate() )); + queryWrapper.ge(noticesDTO.getEndDate() != null, Notices::getCreateDate, Utils.Date.getStart(noticesDTO.getEndDate() )); + queryWrapper.le(noticesDTO.getEndDate() != null, Notices::getCreateDate, Utils.Date.getEnd(noticesDTO.getEndDate() )); + queryWrapper.eq(Objects.nonNull(noticesDTO.getType()),Notices::getType,noticesDTO.getType()); + queryWrapper.eq(StringUtils.isNotBlank(noticesDTO.getTitle()),Notices::getTitle,noticesDTO.getTitle()); + queryWrapper.orderByDesc(Notices::getCreateDate); + PageData<Notices> pageData = PageData.from(noticesMapper.selectJoinPage(page,Notices.class, queryWrapper)); + return pageData; + } + /** + * 鏍囪宸茶 + * @param noticesId + */ + @Override + public void signReadById(Integer noticesId){ + if(Objects.isNull(noticesId)){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + Notices notices = noticesMapper.selectById(noticesId); + if(Objects.isNull(notices)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY); + } + if(Constants.equalsInteger(notices.getSendacopy(),Constants.ONE)){ + if(Constants.equalsInteger(Constants.ZERO,notices.getReaded())){ + noticesMapper.update(null,new UpdateWrapper<Notices>().lambda() + .set(Notices::getReaded,Constants.ONE).eq(Notices::getId,notices)); + } + }else{ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴妱閫佹暟鎹�,鏃犳硶杩涜鏍囪"); + } + } + + /** + * 鎵归噺鏍囪宸茶 + * @param memberId + */ + @Override + public void signRead(Integer memberId) { + noticesMapper.update(null, new UpdateWrapper<Notices>().lambda() + .set(Notices::getReaded, Constants.ONE) + .eq(Notices::getSendacopy,Constants.ONE) + .eq(Notices::getReaded,Constants.ZERO) + .eq(Notices::getUserId, memberId)); + } } -- Gitblit v1.9.3