| | |
| | | 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 com.panzhihua.common.utlis.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | 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)表服务实现类 |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |