租赁需求大厅

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 bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(bookCarDetail.getMaId()); bmFileInfo.setModelId(bookCarDetail.getMaId());
bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE); bmFileInfo.setTaskType(MaterialConstants.MATERIAL_FILE_TYPE_CODE);
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo); bmFileInfo.setFileType(0L);
bookCarDetail.setBmFileInfoList(fileList); List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
if (!CollectionUtils.isEmpty(mainFileInfoList)) {
bookCarDetail.setPicUrl(mainFileInfoList.get(0).getFileUrl());
}
} }
// 根据 companyName, person, personPhone 进行分组 // 根据 companyName, person, personPhone 进行分组
Map<CompanyPersonPhoneKey, List<DevInfoVo>> groupedByKey = bookCarDetails.stream() Map<CompanyPersonPhoneKey, List<DevInfoVo>> groupedByKey = bookCarDetails.stream()

View File

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

View File

@ -1,10 +1,14 @@
package com.bonus.material.device.domain.vo; package com.bonus.material.device.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* 出租方信息vo * 出租方信息vo
* @Author ma_sh * @Author ma_sh
@ -28,11 +32,13 @@ public class LeaseVo {
private String leaseName; private String leaseName;
@ApiModelProperty("租赁开始时间") @ApiModelProperty("租赁开始时间")
private String leaseStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseStartTime;
@ApiModelProperty("租赁结束时间") @ApiModelProperty("租赁结束时间")
private String leaseEndTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date leaseEndTime;
@ApiModelProperty("租赁费用") @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.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.domain.vo.DevInfoVo;
import com.bonus.material.device.domain.vo.LeaseVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -52,7 +53,7 @@ public interface DevInfoMapper {
* @param companyId * @param companyId
* @return * @return
*/ */
int getCompanyUpNum(String companyId); DevInfoVo getCompanyUpNum(String companyId);
/** /**
* 查询设备信息列表 * 查询设备信息列表
@ -145,5 +146,12 @@ public interface DevInfoMapper {
* @return * @return
*/ */
int selectCompany(String companyId); 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> 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.DevInfo;
import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.dto.InfoMotionDto;
import com.bonus.material.device.domain.vo.DevInfoVo; 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.BmFileInfoMapper;
import com.bonus.material.device.mapper.DevInfoMapper; import com.bonus.material.device.mapper.DevInfoMapper;
import com.bonus.material.device.service.DevInfoService; import com.bonus.material.device.service.DevInfoService;
@ -96,8 +97,9 @@ public class DevInfoServiceImpl implements DevInfoService {
//根据设备id查询所属公司上架装备数以及公司访问量 //根据设备id查询所属公司上架装备数以及公司访问量
if (StringUtils.isNotBlank(devInfoVo.getCompanyId())) { if (StringUtils.isNotBlank(devInfoVo.getCompanyId())) {
int devNum = devInfoMapper.selectCompany(devInfoVo.getCompanyId()); int devNum = devInfoMapper.selectCompany(devInfoVo.getCompanyId());
int companyVisitNum = devInfoMapper.getCompanyUpNum(devInfoVo.getCompanyId()); DevInfoVo infoVo = devInfoMapper.getCompanyUpNum(devInfoVo.getCompanyId());
devInfoVo.setCompanyVisitNum(companyVisitNum); devInfoVo.setCompanyVisitNum(infoVo.getCompanyVisitNum());
devInfoVo.setCompanyCreateTime(infoVo.getCompanyCreateTime());
devInfoVo.setDevUapNum(devNum); devInfoVo.setDevUapNum(devNum);
} }
//根据设备id及用户id去预约表中查询是否已经加入预约车 //根据设备id及用户id去预约表中查询是否已经加入预约车
@ -107,6 +109,11 @@ public class DevInfoServiceImpl implements DevInfoService {
} else { } else {
devInfoVo.setIsBookCar(1); devInfoVo.setIsBookCar(1);
} }
//查询该设备的出租记录
List<LeaseVo> leaseList = devInfoMapper.getLeaseList(maId);
if (!CollectionUtils.isEmpty(leaseList)) {
devInfoVo.setLeaseList(leaseList);
}
} }
return devInfoVo; return devInfoVo;
} }
@ -170,10 +177,17 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override @Override
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo) { public AjaxResult selectDevInfoHotList(DevInfoVo devInfo) {
List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo); List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo);
if (CollectionUtil.isEmpty(hotList)) {
return AjaxResult.success(Collections.emptyMap());
}
extractedFile(hotList); 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 @Override
public List<MaLeaseVo> leaseList(MaLease maLease) { 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_name as deviceName,
d.device_weight as deviceWeight, d.device_weight as deviceWeight,
d.type_id as typeId, d.type_id as typeId,
mt4.type_name as typeName,
d.ma_status as maStatus, d.ma_status as maStatus,
d.brand as brand, d.brand as brand,
d.model_name as modelName, d.model_name as modelName,
@ -186,10 +187,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.company_name as companyName, c.company_name as companyName,
c.company_id as companyId, c.company_id as companyId,
c.operate_address as operateAddress, 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 FROM
ma_dev_info d ma_dev_info d
LEFT JOIN bm_company_info c ON d.own_co = c.company_id 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 where
d.is_active='1' d.is_active='1'
and d.ma_status = '2' and d.ma_status = '2'
@ -410,13 +421,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertHotSearch"> <insert id="insertHotSearch">
INSERT INTO ma_hot_search (ma_id, search_num) INSERT INTO ma_hot_search (ma_id, search_num, create_time)
VALUES (#{maId}, 1) VALUES (#{maId}, 1, now())
</insert> </insert>
<update id="updateHotSearchByMaId" parameterType="Long"> <update id="updateHotSearchByMaId" parameterType="Long">
update ma_hot_search update ma_hot_search
set search_num = search_num + 1 set search_num = search_num + 1,
update_time = now()
where ma_id = #{maId} where ma_id = #{maId}
</update> </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 COUNT(1) from ma_dev_info where ma_status = '2' and own_co = #{companyId}
</select> </select>
<select id="getCompanyUpNum" resultType="java.lang.Integer"> <select id="getLeaseList" resultType="com.bonus.material.device.domain.vo.LeaseVo">
SELECT 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 FROM
ma_hot_search h ma_hot_search h
LEFT JOIN ma_dev_info m ON h.ma_id = m.ma_id LEFT JOIN ma_dev_info m ON h.ma_id = m.ma_id
@ -642,7 +672,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.ma_status = '2' m.ma_status = '2'
AND m.own_co = #{companyId} AND m.own_co = #{companyId}
GROUP BY GROUP BY
m.own_co m.own_co
</select> </select>
</mapper> </mapper>

View File

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