yanghui
2022-11-26 0c9874c42bfa88f9b86112a3dbf9cf77f4393880
#feat 商家浏览量计算
1个文件已修改
31 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -125,7 +125,7 @@
        if (isNull(convenientMerchantDO)) {
            return R.fail("商家不存在");
        }
        if (nonNull(merchantDO)&&!merchantDO.getId().equals(convenientMerchantDO.getId())) {
        if (nonNull(merchantDO) && !merchantDO.getId().equals(convenientMerchantDO.getId())) {
            R.fail("该微信手机号:" + mobilePhone + "已被使用!请更换");
        }
        Long communityId = convenientMerchantDTO.getCommunityId();
@@ -252,7 +252,7 @@
    public R<ConvenientMerchantVO> getMerchantInfoByAccount(String account) {
        try {
            List<ConvenientMerchantVO> merchantDetailByAccount = this.baseMapper.getMerchantDetailByAccount(account);
            if (CollUtil.isEmpty(merchantDetailByAccount)){
            if (CollUtil.isEmpty(merchantDetailByAccount)) {
                return R.fail(500, "该账号不存在");
            }
            ConvenientMerchantVO convenientMerchantVO = merchantDetailByAccount.get(0);
@@ -480,12 +480,31 @@
    @Override
    public R getMerchantByUserId(Long userId) {
        ConvenientMerchantVO convenientMerchantVO = this.baseMapper.selectMerchantByUserId(userId);
        if (nonNull(convenientMerchantVO)) {
            List<Long> serviceIds = convenientServiceCategoryDAO.selectServiceIdsForMerchant(convenientMerchantVO.getId());
            convenientMerchantVO.setServiceIds(serviceIds);
        if (isNull(convenientMerchantVO)) {
            return R.fail("商家不存在");
        }
        BigDecimal score = comShopFlowerEvaluateDAO.statisticsScore(convenientMerchantVO.getId());
        Long merchantId = convenientMerchantVO.getId();
        List<Long> serviceIds = convenientServiceCategoryDAO.selectServiceIdsForMerchant(merchantId);
        convenientMerchantVO.setServiceIds(serviceIds);
        BigDecimal score = comShopFlowerEvaluateDAO.statisticsScore(merchantId);
        convenientMerchantVO.setScore(null == score ? BigDecimal.ZERO : NumberUtil.round(score, 1));
        Date nowDate = new Date();
        SimpleDateFormat mothFormat = new SimpleDateFormat("yyyy-MM");
        SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
        String moth = mothFormat.format(nowDate);
        String day = dayFormat.format(nowDate);
        int consultationCount = convenientConsultationStatisticsDAO.selectTotalConsultationVolume(merchantId);
        int monthConsultationVolume = convenientConsultationStatisticsDAO.selectMonthConsultationVolume(merchantId, moth);
        int dayConsultationVolume = convenientConsultationStatisticsDAO.selectDayConsultationVolume(merchantId, day);
        Integer viewCount = convenientViewStatisticsDAO.selectTotalViewNum(merchantId);
        int monthViewNum = convenientViewStatisticsDAO.selectMonthViewNum(merchantId, moth);
        int dayViewNum = convenientViewStatisticsDAO.selectDayViewNum(merchantId, day);
        convenientMerchantVO.setConsultationVolume(consultationCount);
        convenientMerchantVO.setViewNum(viewCount);
        convenientMerchantVO.setMonthConsultationVolume(monthConsultationVolume);
        convenientMerchantVO.setDayConsultationVolume(dayConsultationVolume);
        convenientMerchantVO.setMonthViewNum(monthViewNum);
        convenientMerchantVO.setDayViewNum(dayViewNum);
        return R.ok(convenientMerchantVO);
    }
}