租赁需求大厅

This commit is contained in:
mashuai 2024-11-28 15:53:12 +08:00
parent 108adcd1b8
commit d674b880e7
9 changed files with 112 additions and 49 deletions

View File

@ -67,8 +67,11 @@ public class BookCarServiceImpl implements BookCarService {
BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(bookCarDetail.getMaId());
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
bookCarDetail.setBmFileInfoList(fileList);
bmFileInfo.setFileType(0L);
List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
if (!CollectionUtils.isEmpty(mainFileInfoList)) {
bookCarDetail.setPicUrl(mainFileInfoList.get(0).getFileUrl());
}
}
// 根据 companyName, person, personPhone 进行分组
Map<CompanyPersonPhoneKey, List<DevInfoVo>> groupedByKey = bookCarDetails.stream()

View File

@ -88,10 +88,8 @@ public class DevInfoController extends BaseController {
// @RequiresPermissions("equip:info:list")
@ApiOperation(value = "装备推荐列表")
@GetMapping("/hotList")
public TableDataInfo hotList(DevInfoVo devInfo) {
startPage();
List<DevInfoVo> list = devInfoService.selectDevInfoHotList(devInfo);
return getDataTable(list);
public AjaxResult hotList(DevInfoVo devInfo) {
return devInfoService.selectDevInfoHotList(devInfo);
}
/**

View File

@ -1,10 +1,14 @@
package com.bonus.material.device.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出租方信息vo
* @Author ma_sh
@ -28,11 +32,13 @@ public class LeaseVo {
private String leaseName;
@ApiModelProperty("租赁开始时间")
private String leaseStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseStartTime;
@ApiModelProperty("租赁结束时间")
private String leaseEndTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseEndTime;
@ApiModelProperty("租赁费用")
private String leasePrice;
private BigDecimal leasePrice;
}

View File

@ -6,6 +6,7 @@ import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo;
import com.bonus.material.device.domain.vo.LeaseVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -52,7 +53,7 @@ public interface DevInfoMapper {
* @param companyId
* @return
*/
int getCompanyUpNum(String companyId);
DevInfoVo getCompanyUpNum(String companyId);
/**
* 查询设备信息列表
@ -145,5 +146,12 @@ public interface DevInfoMapper {
* @return
*/
int selectCompany(String companyId);
/**
* 查询该设备的出租记录
* @param maId
* @return
*/
List<LeaseVo> getLeaseList(Long maId);
}

View File

@ -34,7 +34,7 @@ public interface DevInfoService {
List<DevInfoVo> selectUserCollectList(DevInfoVo devInfo);
List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo);
AjaxResult selectDevInfoHotList(DevInfoVo devInfo);
/**
* 修改设备信息

View File

@ -13,6 +13,7 @@ import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.device.domain.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo;
import com.bonus.material.device.domain.vo.LeaseVo;
import com.bonus.material.device.mapper.BmFileInfoMapper;
import com.bonus.material.device.mapper.DevInfoMapper;
import com.bonus.material.device.service.DevInfoService;
@ -96,8 +97,9 @@ 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 infoVo = devInfoMapper.getCompanyUpNum(devInfoVo.getCompanyId());
devInfoVo.setCompanyVisitNum(infoVo.getCompanyVisitNum());
devInfoVo.setCompanyCreateTime(infoVo.getCompanyCreateTime());
devInfoVo.setDevUapNum(devNum);
}
//根据设备id及用户id去预约表中查询是否已经加入预约车
@ -107,6 +109,11 @@ public class DevInfoServiceImpl implements DevInfoService {
} else {
devInfoVo.setIsBookCar(1);
}
//查询该设备的出租记录
List<LeaseVo> leaseList = devInfoMapper.getLeaseList(maId);
if (!CollectionUtils.isEmpty(leaseList)) {
devInfoVo.setLeaseList(leaseList);
}
}
return devInfoVo;
}
@ -170,10 +177,17 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo) {
public AjaxResult selectDevInfoHotList(DevInfoVo devInfo) {
List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo);
if (CollectionUtil.isEmpty(hotList)) {
return AjaxResult.success(Collections.emptyMap());
}
extractedFile(hotList);
return hotList;
// 按照一级设备类型进行分组
Map<String, List<DevInfoVo>> groupedByFirstName = hotList.stream()
.filter(info -> info.getFirstName() != null)
.collect(Collectors.groupingBy(DevInfoVo::getFirstName));
return AjaxResult.success(groupedByFirstName);
}
/**

View File

@ -216,7 +216,26 @@ public class MaLeaseInfoServiceImpl implements MaLeaseInfoService {
*/
@Override
public List<MaLeaseVo> leaseList(MaLease maLease) {
return leaseInfoMapper.leaseList(maLease);
List<MaLeaseVo> list = new ArrayList<>();
list = leaseInfoMapper.leaseList(maLease);
int result = 0;
//查询列表中数据如果需求截止日期超过当前则修改状态为已过期
for (MaLeaseVo maLeaseVo : list) {
Date endTime = maLeaseVo.getEndTime();
if (maLeaseVo.getLeaseStatus().equals(LeaseInfoEnum.LEASE_PENDING_ORDER.getStatus())
&& endTime != null && endTime.before(new Date())) {
//根据id修改状态为已过期
MaLeaseInfo maLeaseInfo = new MaLeaseInfo();
maLeaseInfo.setId(maLeaseVo.getId());
maLeaseInfo.setLeaseStatus(LeaseInfoEnum.LEASE_PAST_DUE.getStatus());
maLeaseInfo.setUpdateTime(DateUtils.getNowDate());
result = leaseInfoMapper.updateDevInfo(maLeaseInfo);
}
}
if (result > 0) {
list = leaseInfoMapper.leaseList(maLease);
}
return list;
}
/**

View File

@ -173,6 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.device_name as deviceName,
d.device_weight as deviceWeight,
d.type_id as typeId,
mt4.type_name as typeName,
d.ma_status as maStatus,
d.brand as brand,
d.model_name as modelName,
@ -186,10 +187,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.company_name as companyName,
c.company_id as companyId,
c.operate_address as operateAddress,
d.create_time as createTime
d.create_time as createTime,
mt3.type_id as thirdId,
mt3.type_name as thirdName,
mt2.type_id as secondId,
mt2.type_name as secondName,
mt1.type_id as firstId,
mt1.type_name as firstName
FROM
ma_dev_info d
LEFT JOIN bm_company_info c ON d.own_co = c.company_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'
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
where
d.is_active='1'
and d.ma_status = '2'
@ -410,13 +421,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertHotSearch">
INSERT INTO ma_hot_search (ma_id, search_num)
VALUES (#{maId}, 1)
INSERT INTO ma_hot_search (ma_id, search_num, create_time)
VALUES (#{maId}, 1, now())
</insert>
<update id="updateHotSearchByMaId" parameterType="Long">
update ma_hot_search
set search_num = search_num + 1
set search_num = search_num + 1,
update_time = now()
where ma_id = #{maId}
</update>
@ -630,9 +642,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select COUNT(1) from ma_dev_info where ma_status = '2' and own_co = #{companyId}
</select>
<select id="getCompanyUpNum" resultType="java.lang.Integer">
<select id="getLeaseList" resultType="com.bonus.material.device.domain.vo.LeaseVo">
SELECT
SUM( h.search_num ) AS num
m.order_id as orderId,
m.ma_id as maId,
m1.`code` as orderCode,
su.nick_name as leaseName,
m.rent_begin_time as leaseStartTime,
m.rent_end_time as leaseEndTime,
m.costs as leasePrice
FROM
ma_order_details m
LEFT JOIN ma_order_info m1 ON m.order_id = m1.order_id
LEFT JOIN sys_user su ON m1.order_user = su.user_id
WHERE
m.ma_id = #{maId}
</select>
<select id="getCompanyUpNum" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
SELECT
SUM( h.search_num ) AS companyVisitNum,
c.create_time as companyCreateTime
FROM
ma_hot_search h
LEFT JOIN ma_dev_info m ON h.ma_id = m.ma_id

View File

@ -98,13 +98,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.person as person,
m.person_phone as personPhone,
m.description as description,
h.lease_num as searchNum,
IFNULL(h.lease_num, 0) AS searchNum,
mt3.type_id as thirdId,
mt3.type_name as thirdName,
mt2.type_id as secondId,
mt2.type_name as secondName,
mt1.type_id as firstId,
mt1.type_name as firstName
mt1.type_name as firstName,
GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName,
m.publish_user as publishUser
FROM
ma_lease_info m
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
@ -137,26 +139,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.id as id,
m.lease_name as leaseName,
m.lease_code as leaseCode,
m.type_id as typeId,
mt4.type_name as typeName,
m.company_id as companyId,
c.company_name as companyName,
c.operate_address as operateAddress,
m.lease_status as leaseStatus,
m.lease_day as leaseDay,
m.lease_num as leaseNum,
m.start_time as startTime,
m.end_time as endTime,
m.person as person,
m.person_phone as personPhone,
m.description as description,
mt3.type_id as thirdId,
mt3.type_name as thirdName,
mt2.type_id as secondId,
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,
CASE
WHEN lease_status = 0 THEN '待接单'
WHEN lease_status = 1 THEN '已接单'
@ -169,10 +157,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ma_lease_info m
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
LEFT JOIN sys_user su ON m.publish_user = su.user_id
LEFT JOIN ma_type mt4 ON mt4.type_id = m.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'
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
WHERE 1 = 1 and m.create_by = #{createBy}
<if test="leaseCode != null and leaseCode != ''">
and m.lease_code like concat('%',#{leaseCode},'%')
@ -221,7 +205,8 @@ 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,
m.publish_user as publishUser
FROM
ma_lease_info m
LEFT JOIN bm_company_info c ON m.company_id = c.company_id
@ -234,7 +219,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null">
<choose>
<when test="level != null and level == 4">
and d.type_id = #{typeId}
and m.type_id = #{typeId}
</when>
<when test="level != null and level == 3">
and mt3.type_id = #{typeId}
@ -267,10 +252,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="startTime != '' and startTime == 'DESC'">
,m.start_time DESC
</if>
<if test="leaseDay != null and leaseDay == 'ASC'">
<if test="leaseDay != null and leaseDay == 0">
,m.lease_day
</if>
<if test="leaseDay != null and leaseDay == 'DESC'">
<if test="leaseDay != null and leaseDay == 1">
,m.lease_day DESC
</if>
<if test="endTime != '' and endTime == 'ASC'">
@ -279,10 +264,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != '' and endTime == 'DESC'">
,m.end_time DESC
</if>
<if test="leaseNum != null and leaseNum == 'ASC'">
<if test="leaseNum != null and leaseNum == 0">
,m.lease_num
</if>
<if test="leaseNum != null and leaseNum == 'DESC'">
<if test="leaseNum != null and leaseNum == 1">
,m.lease_num DESC
</if>
</select>