This commit is contained in:
mashuai 2024-11-26 13:41:00 +08:00
parent 32e17988ae
commit 92cae12061
4 changed files with 54 additions and 9 deletions

View File

@ -137,6 +137,12 @@ public class DevInfoVo extends DevInfo {
@ApiModelProperty(value = "出租记录信息")
private List<LeaseVo> leaseList;
@ApiModelProperty(value = "公司上架装备数量")
private Integer devUapNum;
@ApiModelProperty(value = "公司访问数量")
private Integer companyVisitNum;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;

View File

@ -47,7 +47,12 @@ public interface DevInfoMapper {
*/
List<SysFileInfo> 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);
}

View File

@ -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 {
//只针对于上架状态装备更新浏览量
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) {

View File

@ -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)
</select>
<select id="getCompanyUpNum" parameterType="Long" resultType="Long">
select count(d.ma_id) from ma_dev_info d
where d.own_co= #{ownCo} and d.ma_status in(16,17) and d.is_active='1'
GROUP BY d.own_co
</select>
<insert id="insertDevInfo" parameterType="com.bonus.material.device.domain.DevInfo" useGeneratedKeys="true" keyProperty="maId">
insert into ma_dev_info
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -625,4 +621,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getMaStatusByMaId" resultType="java.lang.Integer">
select ma_status from ma_dev_info where ma_id = #{maId}
</select>
<select id="selectCompany" resultType="java.lang.Integer">
select COUNT(1) from ma_dev_info where ma_status = '2' and company_id = #{companyId}
</select>
<select id="getCompanyUpNum" resultType="java.lang.Integer">
SELECT
SUM( h.search_num ) AS num
FROM
ma_hot_search h
LEFT JOIN ma_dev_info m ON h.ma_id = m.ma_id
AND m.is_active = '1'
LEFT JOIN bm_company_info c ON m.own_co = c.company_id
WHERE
m.ma_status = '2'
AND m.own_co = #{companyId}
GROUP BY
m.own_co
</select>
</mapper>