From 92cae12061d5e25901492c1f8658f5c5cc684bcf Mon Sep 17 00:00:00 2001 From: mashuai Date: Tue, 26 Nov 2024 13:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/device/domain/vo/DevInfoVo.java | 6 ++++ .../material/device/mapper/DevInfoMapper.java | 14 ++++++++- .../service/impl/DevInfoServiceImpl.java | 13 +++++++- .../mapper/material/device/DevInfoMapper.xml | 30 ++++++++++++++----- 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java index df9412a..574e8d6 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java @@ -137,6 +137,12 @@ public class DevInfoVo extends DevInfo { @ApiModelProperty(value = "出租记录信息") private List leaseList; + @ApiModelProperty(value = "公司上架装备数量") + private Integer devUapNum; + + @ApiModelProperty(value = "公司访问数量") + private Integer companyVisitNum; + @ApiModelProperty(value = "开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String startTime; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index 32e6694..9acea69 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -47,7 +47,12 @@ public interface DevInfoMapper { */ List getFilesByMaId(Long maId); - Long getCompanyUpNum(Long ownCo); + /** + * 获取企业设备浏览量 + * @param companyId + * @return + */ + int getCompanyUpNum(String companyId); /** * 查询设备信息列表 @@ -133,5 +138,12 @@ public interface DevInfoMapper { * @return */ BookCarInfoDto getBookCar(@Param("maId") Long maId, @Param("userId") Long userId); + + /** + * 查询企业上架装备数 + * @param companyId + * @return + */ + int selectCompany(String companyId); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 56926a2..3fd631f 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -5,6 +5,7 @@ import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.domain.*; import com.bonus.common.biz.enums.MaStatusEnum; import com.bonus.common.core.exception.ServiceException; +import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.bean.BeanUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.security.utils.SecurityUtils; @@ -69,7 +70,10 @@ public class DevInfoServiceImpl implements DevInfoService { if (devInfoVo != null) { //更新搜索量 try { - updateHotSearch(maId); + //只针对于上架状态装备更新浏览量 + if (devInfoVo.getMaStatus().equals(MaStatusEnum.LISTING.getCode())) { + updateHotSearch(maId); + } } catch (Exception e) { System.err.println("更新设备搜索量失败,不影响主业务流程"); } @@ -89,6 +93,13 @@ public class DevInfoServiceImpl implements DevInfoService { } }); } + //根据设备id查询所属公司上架装备数以及公司访问量 + if (StringUtils.isNotBlank(devInfoVo.getCompanyId())) { + int devNum = devInfoMapper.selectCompany(devInfoVo.getCompanyId()); + int companyVisitNum = devInfoMapper.getCompanyUpNum(devInfoVo.getCompanyId()); + devInfoVo.setCompanyVisitNum(companyVisitNum); + devInfoVo.setDevUapNum(devNum); + } //根据设备id及用户id去预约表中查询是否已经加入预约车 BookCarInfoDto bookCarInfoDto = devInfoMapper.getBookCar(maId, userId); if (bookCarInfoDto != null) { diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index fbf3d5c..e9afaf3 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -226,10 +226,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt2.type_name as secondName, mt1.type_id as firstId, mt1.type_name as firstName, - GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName + GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName, + h.search_num as searchNum FROM ma_dev_info d LEFT JOIN bm_company_info c ON d.own_co = c.company_id + LEFT JOIN ma_hot_search h ON d.ma_id = h.ma_id LEFT JOIN ma_type mt4 ON mt4.type_id = d.type_id and mt4.del_flag = '0' LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0' LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0' @@ -245,12 +247,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE d.ma_id = #{maId} and d.is_active='1' and s.dic_id in (0,1,2,3) - - insert into ma_dev_info @@ -625,4 +621,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + +