装备共享大厅

This commit is contained in:
mashuai 2024-11-25 14:46:39 +08:00
parent baf144e412
commit 7df56e43cc
14 changed files with 182 additions and 35 deletions

View File

@ -39,12 +39,12 @@ public class BookCarInfoDto {
private String orderStatus;
@ApiModelProperty(value = "下单用户id")
private Integer orderUser;
private Long orderUser;
@ApiModelProperty(value = "下单用户手机号")
private String phoneNumber;
@ApiModelProperty(value = "下单企业")
@ApiModelProperty(value = "下单企业")
private String orderCompany;
@ApiModelProperty(value = "创建人")

View File

@ -42,6 +42,7 @@ public class BookCarServiceImpl implements BookCarService {
public Integer addBookCar(BookCarInfoDto bookCarInfoDto) {
Long userid = SecurityUtils.getLoginUser().getUserid();
bookCarInfoDto.setCreater(userid.toString());
bookCarInfoDto.setOrderUser(userid);
return bookCarMapper.addBookCarDetail(bookCarInfoDto);
}

View File

@ -35,8 +35,8 @@ public class DevInfoController extends BaseController {
*/
// @RequiresPermissions("equip:info:list")
@ApiOperation(value = "装备列表")
@PostMapping("/list")
public TableDataInfo list(@RequestBody DevInfoVo devInfo) {
@GetMapping("/list")
public TableDataInfo list(DevInfoVo devInfo) {
startPage();
List<DevInfoVo> list = devInfoService.selectDevInfoList(devInfo);
return getDataTable(list);

View File

@ -22,6 +22,9 @@ public class DevInfoVo extends DevInfo {
private long parentId;
private Long maId;
@ApiModelProperty(value = "下单用户id")
private Long orderUser;
/* 装备组别 parent */
@ApiModelProperty(value = "装备组别")
@ -70,10 +73,10 @@ public class DevInfoVo extends DevInfo {
@ApiModelProperty(value = "搜索月租金最大值")
private Integer monthLeasePriceMax;
@ApiModelProperty(value = "搜索天租金最")
@ApiModelProperty(value = "搜索天租金最")
private Integer dayLeasePriceMin;
@ApiModelProperty(value = "搜索租金最大值")
@ApiModelProperty(value = "搜索租金最大值")
private Integer dayLeasePriceMax;
@ApiModelProperty(value = "搜索装备年份最小值")
@ -89,13 +92,13 @@ public class DevInfoVo extends DevInfo {
private Integer workingHoursMax;
@ApiModelProperty(value = "搜索装备月租金排序 ASC or DESC")
private String monthLeasePriceOrderBy;
private String dayLeasePriceOrderBy;
@ApiModelProperty(value = "搜索装备更新时间排序 ASC or DESC")
private String updateTimeOrderBy;
@ApiModelProperty(value = "装备分类级别")
private Integer level;
private String level;
@ApiModelProperty(value = "装备状态")
private String maStatusStr;
@ -138,4 +141,10 @@ public class DevInfoVo extends DevInfo {
@ApiModelProperty(value = "装备三级类目名称")
private String thirdName;
@ApiModelProperty(value = "是否加入预约车0 是1 否)")
private Integer isBookCar;
@ApiModelProperty(value = "出租记录信息")
private List<LeaseVo> leaseList;
}

View File

@ -0,0 +1,38 @@
package com.bonus.material.device.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 出租方信息vo
* @Author ma_sh
* @create 2024/11/25 11:19
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LeaseVo {
@ApiModelProperty("订单id")
private Long orderId;
@ApiModelProperty("装备id")
private Long maId;
@ApiModelProperty("订单编号")
private String orderCode;
@ApiModelProperty("租赁方")
private String leaseName;
@ApiModelProperty("租赁开始时间")
private String leaseStartTime;
@ApiModelProperty("租赁结束时间")
private String leaseEndTime;
@ApiModelProperty("租赁费用")
private String leasePrice;
}

View File

@ -2,6 +2,7 @@ package com.bonus.material.device.mapper;
import com.bonus.common.biz.domain.*;
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;
@ -45,7 +46,7 @@ public interface DevInfoMapper {
* @param devInfo 设备信息
* @return 设备信息集合
*/
List<DevInfoVo> selectDevInfoList(DevInfo devInfo);
List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo);
List<UserCollect> selectUserCollectByUserId(Long userId);
@ -108,5 +109,13 @@ public interface DevInfoMapper {
List<BmCompanyInfo> selectCompanyList(BmCompanyInfo obj);
int updateUpDown(@Param("maIds") List<Long> maIds, @Param("maStatus")String maStatus);
/**
* 查询预约车详情
* @param maId
* @param userId
* @return
*/
BookCarInfoDto getBookCar(@Param("maId") Long maId, @Param("userId") Long userId);
}

View File

@ -6,6 +6,7 @@ import com.bonus.common.biz.enums.MaStatusEnum;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.bean.BeanUtils;
import com.bonus.common.security.utils.SecurityUtils;
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;
@ -62,6 +63,8 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public DevInfoVo selectDevInfoByMaId(Long maId) {
DevInfoVo devInfoVo = devInfoMapper.selectDevInfoByMaId(maId);
//判断该装备是否已经被该企业或个人加入预约车不能重复加入
Long userId = SecurityUtils.getLoginUser().getUserid();
if (devInfoVo != null) {
//更新搜索量
updateHotSearch(maId);
@ -70,6 +73,13 @@ public class DevInfoServiceImpl implements DevInfoService {
bmFileInfo.setTaskType(17);
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
devInfoVo.setBmFileInfoList(fileList);
//根据设备id及用户id去预约表中查询是否已经加入预约车
BookCarInfoDto bookCarInfoDto = devInfoMapper.getBookCar(maId, userId);
if (bookCarInfoDto != null) {
devInfoVo.setIsBookCar(0);
} else {
devInfoVo.setIsBookCar(1);
}
}
return devInfoVo;
}
@ -91,7 +101,9 @@ public class DevInfoServiceImpl implements DevInfoService {
*/
@Override
public List<DevInfoVo> selectDevInfoList(DevInfoVo devInfo) {
return devInfoMapper.selectDevInfoList(devInfo);
List<DevInfoVo> voList = devInfoMapper.selectDevInfoList(devInfo);
extractedFile(voList);
return voList;
}
/**
@ -129,16 +141,27 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public List<DevInfoVo> selectDevInfoHotList(DevInfoVo devInfo) {
List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo);
extractedFile(hotList);
return hotList;
}
/**
* 提取主图文件地址方便用于列表页面回显
* @param hotList
*/
private void extractedFile(List<DevInfoVo> hotList) {
if (CollectionUtil.isNotEmpty(hotList)) {
for (DevInfoVo devInfoVo : hotList) {
BmFileInfo bmFileInfo = new BmFileInfo();
bmFileInfo.setModelId(devInfoVo.getMaId());
bmFileInfo.setTaskType(17);
List<BmFileInfo> fileList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
devInfoVo.setBmFileInfoList(fileList);
bmFileInfo.setFileType(0L);
List<BmFileInfo> mainFileInfoList = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
if (!CollectionUtils.isEmpty(mainFileInfoList)) {
devInfoVo.setPicUrl(mainFileInfoList.get(0).getUrl());
}
}
}
return hotList;
}
private void fillInMaStatusStr(List<DevInfoVo> list) {

View File

@ -1,6 +1,7 @@
package com.bonus.material.home.controller;
import cn.hutool.core.lang.tree.Tree;
import com.bonus.common.biz.domain.TypeInfo;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
@ -38,6 +39,23 @@ public class MaTypeInfoController extends BaseController {
return getDataTable(list);
}
/**
* 装备共享页面之一级设备类型
* @param typeInfo
* @return
*/
@ApiOperation("装备共享页面之一级设备类型")
@GetMapping("/getTypeList")
public AjaxResult getTypeList(TypeInfo typeInfo) {
List<TypeInfo> list = maTypeInfoSevice.getTypeList(typeInfo);
return AjaxResult.success(list);
}
/**
* 首页搜索热搜装备
* @param devInfoVo
* @return
*/
@ApiOperation("首页搜索热搜装备")
@GetMapping("/getHotSearch")
public AjaxResult getHotSearch(DevInfoVo devInfoVo) {

View File

@ -24,4 +24,11 @@ public interface MaTypeInfoMapper {
* @return
*/
List<DevInfoVo> getHotSearch(DevInfoVo devInfoVo);
/**
* 查询设备类型
* @param typeInfo
* @return
*/
List<TypeInfo> getTypeList(TypeInfo typeInfo);
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.home.service;
import cn.hutool.core.lang.tree.Tree;
import com.bonus.common.biz.domain.TypeInfo;
import com.bonus.material.device.domain.vo.DevInfoVo;
import java.util.List;
@ -22,4 +23,11 @@ public interface MaTypeInfoSevice {
* @return
*/
List<DevInfoVo> getHotSearch(DevInfoVo devInfoVo);
/**
* 装备共享页面之一级设备类型
* @return
*/
List<TypeInfo> getTypeList(TypeInfo typeInfo);
}

View File

@ -42,6 +42,15 @@ public class MaTypeInfoServiceImpl implements MaTypeInfoSevice {
return maTypeInfoMapper.getHotSearch(devInfoVo);
}
/**
* 装备共享页面之一级设备类型
* @return
*/
@Override
public List<TypeInfo> getTypeList(TypeInfo typeInfo) {
return maTypeInfoMapper.getTypeList(typeInfo);
}
/**
* 获取节点转换函数方法抽取
* @return

View File

@ -5,8 +5,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.bonus.material.book.mapper.BookCarMapper">
<insert id="addBookCarDetail">
insert into book_car_detail(ma_id, order_status, order_company, creater, create_time)
values(#{maId}, 0, #{orderCompany}, #{creater}, now())
insert into book_car_detail(ma_id, order_status, order_company, order_user, creater, create_time)
values(#{maId}, 0, #{orderCompany}, #{orderUser}, #{creater}, now())
</insert>
<select id="getBookCarDetails" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
@ -29,7 +29,8 @@ 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,
bcd.order_user as orderUser
FROM ma_dev_info d
LEFT JOIN bm_company_info c ON d.own_co = c.company_id
LEFT JOIN book_car_detail bcd ON d.ma_id = bcd.ma_id

View File

@ -70,6 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.day_lease_price as dayLeasePrice,
d.person as person,
d.person_phone as personPhone,
d.create_time as createTime,
d.update_time as updateTime,
c.company_name as companyName,
c.operate_address as operateAddress,
mt3.type_id as thirdId,
@ -87,21 +89,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
<where>
<if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if>
<if test="deviceName != null and deviceName != ''">
and d.device_name like concat('%',#{deviceName},'%')
</if>
<if test="typeId != null">
<if test="level != null and level == '4'">
and d.type_id = #{typeId}
</if>
<if test="thirdId != null">
and mt3.type_id = #{thirdId}
<if test="level != null and level == '3'">
and mt3.type_id = #{typeId}
</if>
<if test="secondId != null">
and mt2.type_id = #{secondId}
<if test="level != null and level == '2'">
and mt2.type_id = #{typeId}
</if>
<if test="level != null and level == '1'">
and mt1.type_id = #{typeId}
</if>
<if test="firstId != null">
and mt1.type_id = #{firstId}
</if>
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if>
@ -119,14 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax}
</if>
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
<!--<if test="monthLeasePriceMin != null and monthLeasePriceMax != null">
and d.month_lease_price &gt;= #{monthLeasePriceMin} and d.month_lease_price &lt;= #{monthLeasePriceMax}
</if>-->
<if test="dayLeasePriceMin != null and dayLeasePriceMax != null">
and d.day_lease_price &gt;= #{dayLeasePriceMin} and d.day_lease_price &lt;= #{dayLeasePriceMax}
</if>
<if test="jsMonthPrice != null and jsMonthPrice != ''"> and d.js_month_price = #{jsMonthPrice}</if>
<if test="jsDayPrice != null and jsDayPrice != ''"> and d.js_day_price = #{jsDayPrice}</if>
<if test="description != null and description != ''"> and d.description = #{description}</if>
<if test="gpsCode != null and gpsCode != ''"> and d.gps_code = #{gpsCode}</if>
<if test="companyId != null "> and d.own_co = #{companyId}</if>
@ -149,11 +149,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by
d.is_active
<if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'ASC'">
,d.month_lease_price
<if test="dayLeasePriceOrderBy != null and dayLeasePriceOrderBy == 'ASC'">
,d.day_lease_price
</if>
<if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'DESC'">
,d.month_lease_price DESC
<if test="dayLeasePriceOrderBy != null and dayLeasePriceOrderBy == 'DESC'">
,d.day_lease_price DESC
</if>
<if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'">
,d.update_time
@ -493,4 +493,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="getBookCar" resultType="com.bonus.material.book.domain.BookCarInfoDto">
SELECT
ma_id as maId,
order_user as orderUser,
order_company as orderCompany
FROM
book_car_detail
WHERE
order_user = #{userId}
AND ma_id = #{maId}
</select>
</mapper>

View File

@ -59,5 +59,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY h.search_num DESC
</select>
<select id="getTypeList" resultType="com.bonus.common.biz.domain.TypeInfo">
select type_id as typeId, parent_id as parentId, type_name as typeName, `level` as level, del_flag as delFlag
from ma_type
where del_flag = '0' and level = '1'
<if test="typeName != null and typeName != ''">
and type_name like concat('%',#{typeName},'%')
</if>
<if test="parentId != null and parentId != ''">
and parent_id = #{parentId}
</if>
</select>
</mapper>