From b1e207a90d3f395973b4cd1eee92dbcbbafd6e78 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期五, 14 一月 2022 14:57:35 +0800 Subject: [PATCH] jsapi支付修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java | 64 ++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 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..e9072ee 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,17 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static org.apache.commons.lang3.StringUtils.isNotEmpty; import javax.annotation.Resource; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; +import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO; +import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO; +import com.panzhihua.common.utlis.DateUtils; +import com.panzhihua.service_community.util.NearbyUtil; +import com.spatial4j.core.shape.Rectangle; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -124,6 +131,10 @@ } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); + if (nonNull(mcsMerchant.getExpireAt())) { + int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt()); + topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); + } Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsMerchant.getId()); @@ -200,4 +211,57 @@ } 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()); + String lat = pageMcsInformationDTO.getLat(); + String lon = pageMcsInformationDTO.getLon(); + Integer distance = pageMcsInformationDTO.getDistance(); + IPage<McsInformationVO> mcsInfos; + if (isNotEmpty(lat) && isNotEmpty(lon) && nonNull(distance)) { + Rectangle rectangle =new NearbyUtil().getRectangle(pageMcsInformationDTO.getDistance(), + Double.parseDouble(pageMcsInformationDTO.getLon()), Double.parseDouble(pageMcsInformationDTO.getLat())); + mcsInfos = this.baseMapper.pageH5McsInfo(page, rectangle.getMinX(), rectangle.getMaxX(), + rectangle.getMinY(), rectangle.getMaxY(), pageMcsInformationDTO); + } else { + mcsInfos = this.baseMapper.pageH5McsInfo(page, null, null, null, null, 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