puhanshu
2021-09-24 232ba6884fc96e251184a2a1b0fc1499fbe899b0
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -11,6 +11,7 @@
import javax.annotation.Resource;
import com.panzhihua.common.model.vos.community.convenient.ExportMerchantVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -159,6 +160,15 @@
        page.setSize(pageConvenientMerchantDTO.getPageSize());
        page.setCurrent(pageConvenientMerchantDTO.getPageNum());
        IPage<ConvenientMerchantVO> iPage = this.baseMapper.pageMerchant(page, pageConvenientMerchantDTO);
        if (nonNull(pageConvenientMerchantDTO.getServiceId())) {
            List<ConvenientMerchantVO> records = iPage.getRecords();
            if (!records.isEmpty()) {
                records.forEach(record -> {
                    String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId());
                    record.setServiceScope(serviceScope);
                });
            }
        }
        return R.ok(iPage);
    }
@@ -261,6 +271,13 @@
        page.setSize(pageClassifyMerchantDTO.getPageSize());
        page.setCurrent(pageClassifyMerchantDTO.getPageNum());
        IPage<ConvenientMerchantVO> merchantVOList = this.baseMapper.getClassifyMerchants(page, pageClassifyMerchantDTO, currentMon);
        List<ConvenientMerchantVO> records = merchantVOList.getRecords();
        if (!records.isEmpty()) {
            records.forEach(record -> {
                String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(record.getId());
                record.setServiceScope(serviceScope);
            });
        }
        return R.ok(merchantVOList);
    }
@@ -313,6 +330,10 @@
    @Override
    public R consultMerchant(Long merchantId) {
        ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId);
        if (isNull(merchantDO)) {
            return R.fail("商家不存在");
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = simpleDateFormat.format(new Date());
        ConvenientConsultationStatisticsDO statisticsDO = convenientConsultationStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientConsultationStatisticsDO>()
@@ -327,6 +348,10 @@
    @Override
    public R incrMerchantView(Long merchantId) {
        ConvenientMerchantDO merchantDO = this.baseMapper.selectById(merchantId);
        if (isNull(merchantDO)) {
            return R.fail("商家不存在");
        }
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = simpleDateFormat.format(new Date());
        ConvenientViewStatisticsDO statisticsDO = convenientViewStatisticsDAO.selectOne(new LambdaQueryWrapper<ConvenientViewStatisticsDO>()
@@ -341,7 +366,19 @@
    @Override
    public R exportMerchant(ExportMerchantDTO exportMerchantDTO) {
        return R.ok(this.baseMapper.exportMerchant(exportMerchantDTO));
        List<Long> needExportIds = exportMerchantDTO.getIds();
        if (nonNull(needExportIds) && !needExportIds.isEmpty()) {
            //根据id导出
            return R.ok(this.baseMapper.exportMerchantByIds(needExportIds));
        }
        List<ExportMerchantVO> exportMerchantVOList = this.baseMapper.exportMerchantBySearch(exportMerchantDTO);
        if (nonNull(exportMerchantDTO.getServiceId()) && !exportMerchantVOList.isEmpty()) {
            exportMerchantVOList.forEach(merchant -> {
                String serviceScope = convenientServiceCategoryDAO.selectServiceScopeByMerchantId(merchant.getId());
                merchant.setServiceScope(serviceScope);
            });
        }
        return R.ok(exportMerchantVOList);
    }
    /**