From 43f0578e80af82ecae6c61b51bd0539c6b960603 Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期二, 16 八月 2022 19:08:32 +0800 Subject: [PATCH] 服务范围优化 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 3 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java index 7718ea4..0139e47 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java @@ -1,10 +1,12 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.Date; import javax.annotation.Resource; -import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -12,19 +14,20 @@ 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.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsInformationDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO; +import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.TopStatisticsVO; +import com.panzhihua.common.utlis.DateUtils; import com.panzhihua.service_community.dao.McsGameDAO; import com.panzhihua.service_community.dao.McsInformationDAO; import com.panzhihua.service_community.dao.McsMerchantDAO; import com.panzhihua.service_community.entity.McsInformation; import com.panzhihua.service_community.entity.McsMerchant; import com.panzhihua.service_community.service.McsInformationService; - -import java.util.Date; /** * (McsInformation)表服务实现类 @@ -124,6 +127,10 @@ } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); + if (nonNull(mcsMerchant.getExpireAt())) { + int surplusLitDays = DateUtils.retrieveRemainingDays(mcsMerchant.getExpireAt()); + topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); + } Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsMerchant.getId()); @@ -200,4 +207,46 @@ } return R.fail("发布失败,请重新尝试"); } + + /** + * h5分页查询戳戳资讯 + * @param pageMcsInformationDTO + * @return + */ + @Override + public R pageH5McsInfo(PageMcsInformationDTO pageMcsInformationDTO) { + Page page = new Page<>(); + page.setSize(pageMcsInformationDTO.getPageSize()); + page.setCurrent(pageMcsInformationDTO.getPageNum()); + IPage<McsInformationVO> mcsInfos = this.baseMapper.pageH5McsInfo(page, pageMcsInformationDTO); + return R.ok(mcsInfos); + } + + /** + * 资讯详情 + * @param infoId + * @return + */ + @Override + public R getMcsInfo(Long infoId) { + McsInformation mcsInformation = this.baseMapper.selectById(infoId); + if (isNull(mcsInformation)) { + return R.fail("资源不存在"); + } + McsInformationVO mcsInformationVO = new McsInformationVO(); + BeanUtils.copyProperties(mcsInformation, mcsInformationVO); + McsMerchant mcsMerchant = mcsMerchantDAO.selectById(mcsInformation.getMerchantId()); + McsMerchantVO mcsMerchantVO = new McsMerchantVO(); + if (nonNull(mcsMerchant)) { + mcsMerchantVO.setId(mcsMerchant.getId()); + mcsMerchantVO.setName(mcsMerchant.getName()); + mcsMerchantVO.setLogo(mcsMerchant.getLogo()); + mcsMerchantVO.setIntroduction(mcsMerchant.getIntroduction()); + mcsMerchantVO.setLat(mcsMerchant.getLat()); + mcsMerchantVO.setLon(mcsMerchant.getLon()); + mcsMerchantVO.setAddress(mcsMerchant.getAddress()); + } + mcsInformationVO.setMerchantInfo(mcsMerchantVO); + return R.ok(mcsInformationVO); + } } -- Gitblit v1.7.1