From 161e27e08b1495c04cd3f35906c1d7dd873f1d60 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期一, 17 一月 2022 11:38:20 +0800
Subject: [PATCH] 商业街bug修改
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 1 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 5f3bc53..5952e34 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
@@ -2,11 +2,16 @@
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;
@@ -127,7 +132,7 @@
TopStatisticsVO topStatisticsVO = new TopStatisticsVO();
topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt());
if (nonNull(mcsMerchant.getExpireAt())) {
- int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt());
+ int surplusLitDays = DateUtils.retrieveRemainingDays(mcsMerchant.getExpireAt());
topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0);
}
@@ -206,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