接口联调

This commit is contained in:
mashuai 2024-11-28 18:17:12 +08:00
parent 356bf9b5e9
commit 2738a8912d
8 changed files with 60 additions and 13 deletions

View File

@ -98,8 +98,9 @@ public class DevInfoController extends BaseController {
//@RequiresPermissions("equip:info:query")
@ApiOperation(value = "装备详情")
@GetMapping(value = "/getInfo/{maId}")
public AjaxResult getInfo(@PathVariable("maId") Long maId) {
return success(devInfoService.selectDevInfoByMaId(maId));
public AjaxResult getInfo(@PathVariable("maId") Long maId,
@RequestParam(value = "isHome", required = false) Boolean isHome) {
return success(devInfoService.selectDevInfoByMaId(maId, isHome));
}

View File

@ -0,0 +1,21 @@
package com.bonus.material.device.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/** 最新装备返回分类设备vo
* @Author ma_sh
* @create 2024/11/28 16:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DevNameVo {
private String typeName;
private List<DevInfoVo> devInfoList;
}

View File

@ -20,9 +20,10 @@ public interface DevInfoService {
* 查询设备信息
*
* @param maId 设备信息主键
* @param isHome 是否是首页进入
* @return 设备信息
*/
DevInfoVo selectDevInfoByMaId(Long maId);
DevInfoVo selectDevInfoByMaId(Long maId, Boolean isHome);
/**
* 查询装备共享大厅列表

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.DevNameVo;
import com.bonus.material.device.domain.vo.LeaseVo;
import com.bonus.material.device.mapper.BmFileInfoMapper;
import com.bonus.material.device.mapper.DevInfoMapper;
@ -64,15 +65,15 @@ public class DevInfoServiceImpl implements DevInfoService {
* @return 设备信息
*/
@Override
public DevInfoVo selectDevInfoByMaId(Long maId) {
public DevInfoVo selectDevInfoByMaId(Long maId, Boolean isHome) {
DevInfoVo devInfoVo = devInfoMapper.selectDevInfoByMaId(maId);
//判断该装备是否已经被该企业或个人加入预约车不能重复加入
Long userId = SecurityUtils.getLoginUser().getUserid();
if (devInfoVo != null) {
//更新搜索量
try {
//只针对于上架状态装备更新浏览量
if (devInfoVo.getMaStatus().equals(MaStatusEnum.LISTING.getCode())) {
//只针对于首页上架状态装备更新浏览量去除后台查看浏览量更新
if (isHome != null && isHome && devInfoVo.getMaStatus().equals(MaStatusEnum.LISTING.getCode())) {
updateHotSearch(maId);
}
} catch (Exception e) {
@ -178,6 +179,7 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public AjaxResult selectDevInfoHotList(DevInfoVo devInfo) {
List<DevNameVo> voList = new ArrayList<>();
List<DevInfoVo> hotList = devInfoMapper.selectDevInfoHotList(devInfo);
if (CollectionUtil.isEmpty(hotList)) {
return AjaxResult.success(Collections.emptyMap());
@ -187,7 +189,18 @@ public class DevInfoServiceImpl implements DevInfoService {
Map<String, List<DevInfoVo>> groupedByFirstName = hotList.stream()
.filter(info -> info.getFirstName() != null)
.collect(Collectors.groupingBy(DevInfoVo::getFirstName));
return AjaxResult.success(groupedByFirstName);
// 遍历 Map 中的每个条目将数据转化成 DevNameVo 对象
for (Map.Entry<String, List<DevInfoVo>> entry : groupedByFirstName.entrySet()) {
String typeName = entry.getKey();
List<DevInfoVo> devInfoList = entry.getValue();
// 创建一个 DevNameVo 对象并设置相应的字段
DevNameVo devNameVo = new DevNameVo();
devNameVo.setTypeName(typeName);
devNameVo.setDevInfoList(devInfoList);
// DevNameVo 对象添加到 voList
voList.add(devNameVo);
}
return AjaxResult.success(voList);
}
/**

View File

@ -63,9 +63,10 @@ public class MaLeaseInfoController extends BaseController {
@ApiOperation(value = "查询出租方需求列表")
@GetMapping("/rentList")
public AjaxResult rentList(MaLeaseDto dto) {
startPage();
List<MaLeaseVo> list = leaseInfoService.rentList(dto);
return AjaxResult.success(getDataTable(list));
Integer pageIndex = Convert.toInt(dto.getPageNum(), 1);
Integer pageSize = Convert.toInt(dto.getPageSize(), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**

View File

@ -45,6 +45,12 @@ public class MaLease {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@ApiModelProperty("预估天数(字符串转换)")
private String rentDay;
@ApiModelProperty("预估数量(字符串转换)")
private String rentNum;
/**
* 需求截止日期(年月日)
*/

View File

@ -15,6 +15,9 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class MaLeaseDto extends BaseEntity {
private Integer pageNum;
private Integer pageSize;
/**
* 需求名称
*/

View File

@ -174,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and DATE_FORMAT(m.end_time,'%Y-%m-%d') between #{finishStartTime} and #{finishEndTime}
</if>
GROUP BY m.lease_code
ORDER BY m.start_time DESC
</select>
<select id="getHotSearchCountByLeaseId" resultType="java.lang.Integer">
@ -252,10 +253,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 == 0">
<if test="rentDay != null and rentDay == 'ASC'">
,m.lease_day
</if>
<if test="leaseDay != null and leaseDay == 1">
<if test="rentDay != null and rentDay == 'DESC'">
,m.lease_day DESC
</if>
<if test="endTime != '' and endTime == 'ASC'">
@ -264,10 +265,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 == 0">
<if test="rentNum != null and rentNum == 'ASC'">
,m.lease_num
</if>
<if test="leaseNum != null and leaseNum == 1">
<if test="rentNum != null and rentNum == 'DESC'">
,m.lease_num DESC
</if>
</select>