From 970ed0f8df6a19e4e3dae062c4e2e2232a0b97d0 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期三, 21 四月 2021 11:06:45 +0800 Subject: [PATCH] 删除商家bug修复 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 174 insertions(+), 5 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java index 975b7ab..2b5bb1c 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java @@ -1,24 +1,40 @@ package com.panzhihua.service_community.service.impl; +import java.util.Date; +import java.util.List; + import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; +import com.panzhihua.common.model.vos.community.ComActMessageBackVO; import com.panzhihua.common.model.vos.community.ComActMessageVO; +import com.panzhihua.common.model.vos.community.PageComActMessageVO; +import com.panzhihua.common.model.vos.community.ResetComActMessageVO; import com.panzhihua.common.model.vos.partybuilding.ComPbServiceTeamVO; import com.panzhihua.common.model.vos.partybuilding.PartyCommitteeVO; +import com.panzhihua.service_community.dao.ComActMessageBackDAO; import com.panzhihua.service_community.dao.ComActMessageDAO; +import com.panzhihua.service_community.model.dos.ComActEasyPhotoUserDO; +import com.panzhihua.service_community.model.dos.ComActMessageBackDO; import com.panzhihua.service_community.model.dos.ComActMessageDO; import com.panzhihua.service_community.service.ComActMessageService; @Service -public class ComActMessageServiceImpl extends ServiceImpl<ComActMessageDAO, ComActMessageDO> implements ComActMessageService { +public class ComActMessageServiceImpl extends ServiceImpl<ComActMessageDAO, ComActMessageDO> + implements ComActMessageService { @Resource - private ComActMessageDAO comActMessageDAO; + private ComActMessageDAO comActMessageDAO; + @Resource + private ComActMessageBackDAO comActMessageBackDAO; @Override public R addMessage(ComActMessageVO comActMessageVO) { @@ -52,19 +68,172 @@ return R.fail(); } + /** + * 我发的留言 + */ @Override public R pageMyMessageApplets(ComActMessageVO comActMessageVO) { - return null; + Page page = new Page<>(); + Long pageNum = comActMessageVO.getPageNum(); + Long pageSize = comActMessageVO.getPageSize(); + if (null == pageNum || 0 == pageNum) { + pageNum = 1l; + } + if (null == pageSize || 0 == pageSize) { + pageSize = 10l; + } + page.setSize(pageSize); + page.setCurrent(pageNum); + IPage<PageComActMessageVO> iPage = comActMessageDAO.pageMyMessageApplets(page, comActMessageVO); + List<PageComActMessageVO> records = iPage.getRecords(); + if (!ObjectUtils.isEmpty(records)) { + records.forEach(comActMessageVO1 -> { + Long id = comActMessageVO1.getId(); + List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); + comActMessageVO1.setBackList(list); + }); + iPage.setRecords(records); + } + return R.ok(iPage); } + /** + * 发给我的留言 + */ @Override public R pageSendToMessageApplets(ComActMessageVO comActMessageVO) { - return null; + Page page = new Page<>(); + Long pageNum = comActMessageVO.getPageNum(); + Long pageSize = comActMessageVO.getPageSize(); + if (null == pageNum || 0 == pageNum) { + pageNum = 1l; + } + if (null == pageSize || 0 == pageSize) { + pageSize = 10l; + } + page.setSize(pageSize); + page.setCurrent(pageNum); + String phone = comActMessageVO.getPhone(); + if(ObjectUtils.isEmpty(phone)) { + IPage<PageComActMessageVO> iPage=null; + return R.ok(iPage); + } + IPage<PageComActMessageVO> iPage = comActMessageDAO.pageSendMeMessageApplets(page, comActMessageVO); + List<PageComActMessageVO> records = iPage.getRecords(); + if (!ObjectUtils.isEmpty(records)) { + records.forEach(comActMessageVO1 -> { + Long id = comActMessageVO1.getId(); + List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); + comActMessageVO1.setBackList(list); + }); + iPage.setRecords(records); + } + return R.ok(iPage); } + + /** + * 我的社区留言 + */ @Override public R pageMyCommunityMessageApplets(ComActMessageVO comActMessageVO) { - return null; + Page page = new Page<>(); + Long pageNum = comActMessageVO.getPageNum(); + Long pageSize = comActMessageVO.getPageSize(); + if (null == pageNum || 0 == pageNum) { + pageNum = 1l; + } + if (null == pageSize || 0 == pageSize) { + pageSize = 10l; + } + page.setSize(pageSize); + page.setCurrent(pageNum); + IPage<PageComActMessageVO> iPage = comActMessageDAO.pageMyCommunityMessageApplets(page, comActMessageVO); + List<PageComActMessageVO> records = iPage.getRecords(); + if (!ObjectUtils.isEmpty(records)) { + records.forEach(comActMessageVO1 -> { + Long id = comActMessageVO1.getId(); + List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); + comActMessageVO1.setBackList(list); + }); + iPage.setRecords(records); + } + return R.ok(iPage); + } + + @Override + public R addMessageBack(ComActMessageBackVO comActMessageBackVO) { + ComActMessageBackDO comActMessageBackDO=new ComActMessageBackDO(); + BeanUtils.copyProperties(comActMessageBackVO, comActMessageBackDO); + int insert = comActMessageBackDAO.insert(comActMessageBackDO); + if (insert > 0) { + ComActMessageDO selectById = comActMessageDAO.selectById(comActMessageBackDO.getMsgId()); + selectById.setStatus(2); + comActMessageDAO.updateById(selectById); + return R.ok(); + } + return R.fail(); + } + + @Override + public R pageMessageByUserApplets(ComActMessageVO comActMessageVO) { + Page page = new Page<>(); + Long pageNum = comActMessageVO.getPageNum(); + Long pageSize = comActMessageVO.getPageSize(); + if (null == pageNum || 0 == pageNum) { + pageNum = 1l; + } + if (null == pageSize || 0 == pageSize) { + pageSize = 10l; + } + page.setSize(pageSize); + page.setCurrent(pageNum); + IPage<PageComActMessageVO> iPage = comActMessageDAO.pageMessageByUserApplets(page, comActMessageVO); + List<PageComActMessageVO> records = iPage.getRecords(); + if (!ObjectUtils.isEmpty(records)) { + records.forEach(comActMessageVO1 -> { + Long id = comActMessageVO1.getId(); + List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); + comActMessageVO1.setBackList(list); + }); + iPage.setRecords(records); + } + return R.ok(iPage); + } + + @Override + public R deleteMessage(ComActMessageVO comActMessageVO) { + Long id = comActMessageVO.getId(); + comActMessageDAO.deleteById(id); + comActMessageBackDAO.deleteMsgBackByMsgId(id); +// List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); +// for (ComActMessageBackVO comActMessageBackVO : list) { +// comActMessageBackDAO.deleteById(comActMessageBackVO.getId()); +// } + return R.ok(); + } + + @Override + public R resetMessagePublic(ResetComActMessageVO resetComActMessageVO) { + if(ObjectUtils.isEmpty(resetComActMessageVO)) return R.fail(); + Integer ispublic = resetComActMessageVO.getIspublic(); + if(ispublic==null||(ispublic!=1&&ispublic!=2)) return R.fail("状态错误"); + List<Long> list = resetComActMessageVO.getIds(); + for (Long id : list) { + comActMessageDAO.updatePublic(ispublic, id); + } + return R.ok(); + } + + @Override + public R detailMessage(Long id) { + ComActMessageDO comActMessageDO = comActMessageDAO.selectById(id); + PageComActMessageVO vo=new PageComActMessageVO(); + BeanUtils.copyProperties(comActMessageDO, vo); + List<ComActMessageBackVO> list = comActMessageDAO.selectMsgBackList(id); + vo.setBackList(list); + // TODO Auto-generated method stub + return R.ok(vo); } } -- Gitblit v1.7.1