From 7f3b989b56b0f61dacfc25d2adffd6bd5c9b0ea9 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Sun, 1 Dec 2024 19:17:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=89=BF=E7=A7=9F=E4=BA=BA?= =?UTF-8?q?=E4=B8=AA=E5=87=BA=E7=A7=9F=E6=96=B9=E6=95=B0=E6=8D=AE=E9=9A=94?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/device/domain/vo/DevInfoVo.java | 1 - .../material/device/mapper/DevInfoMapper.java | 2 ++ .../device/service/impl/DevInfoServiceImpl.java | 11 ++++++++++- .../bonus/material/order/domain/OrderInfoDto.java | 10 ++++++++-- .../order/service/impl/OrderServiceImpl.java | 9 +++++++-- .../mapper/material/device/DevInfoMapper.xml | 4 ++++ .../mapper/material/order/OrderInfoMapper.xml | 15 ++++++++++----- 7 files changed, 41 insertions(+), 11 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java index 574e8d6..0f92e65 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java @@ -25,7 +25,6 @@ public class DevInfoVo extends DevInfo { @ApiModelProperty(value = "下单用户id") private Long orderUser; - /* 装备组别 parent */ @ApiModelProperty(value = "装备组别") private String groupName; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index ed8fb77..d5a366e 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -156,5 +156,7 @@ public interface DevInfoMapper { List getLeaseList(Long maId); String selectTaskNumByMonth(@Param("date") Date nowDate); + + Integer upMaStatus(DevInfoVo devInfoVo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 15f08a3..4fa9194 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -184,11 +184,20 @@ public class DevInfoServiceImpl implements DevInfoService { List voList = new ArrayList<>(); List hotList = devInfoMapper.selectDevInfoHotList(devInfo); if (CollectionUtil.isEmpty(hotList)) { + return AjaxResult.success(Collections.emptyMap()); } extractedFile(hotList); + for (DevInfoVo devInfoVo : hotList) { + if (devInfoVo.getDeviceCount() <= 0){ + // 下架 + devInfoVo.setMaStatus(1); + devInfoMapper.upMaStatus(devInfoVo); + } + } + List collect = hotList.stream().filter(t -> t.getMaStatus() != 1).collect(Collectors.toList()); // 按照一级设备类型进行分组 - Map> groupedByFirstName = hotList.stream() + Map> groupedByFirstName = collect.stream() .filter(info -> info.getFirstName() != null) .collect(Collectors.groupingBy(DevInfoVo::getFirstName)); // 遍历 Map 中的每个条目,将数据转化成 DevNameVo 对象 diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java index d6a70b8..68c7a9d 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/domain/OrderInfoDto.java @@ -50,8 +50,11 @@ public class OrderInfoDto { @ApiModelProperty(value = "下单地址") private String address; - @ApiModelProperty(value = "下单用户id") - private Long orderUser; + @ApiModelProperty(value = "买方承租方用户id") + private String buyerId; + + @ApiModelProperty(value = "卖方出租方用户id") + private String sellerId; @ApiModelProperty(value = "创建人") private Long creater; @@ -94,4 +97,7 @@ public class OrderInfoDto { private String ids; + @ApiModelProperty(value = "0:出租方 1:承租方") + private String flag; + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java index ef68561..7d5cb8d 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/order/service/impl/OrderServiceImpl.java @@ -57,7 +57,7 @@ public class OrderServiceImpl implements OrderService { String code = "D" + System.currentTimeMillis(); orderInfoDto.setCode(code); Long userid = SecurityUtils.getLoginUser().getUserid(); - orderInfoDto.setOrderUser(userid); + orderInfoDto.setBuyerId(userid.toString()); orderInfoDto.setCreater(userid); Integer i = orderMapper.insertOrderInfo(orderInfoDto); if (i > 0) { @@ -71,7 +71,12 @@ public class OrderServiceImpl implements OrderService { @Override public List getOrderDetails(OrderInfoDto orderInfoDto) throws Exception { - orderInfoDto.setOrderUser(SecurityUtils.getLoginUser().getUserid()); + if (orderInfoDto.getFlag() != null && "0".equals(orderInfoDto.getFlag())){ + orderInfoDto.setSellerId(SecurityUtils.getLoginUser().getUserid().toString()); + }else { + orderInfoDto.setBuyerId(SecurityUtils.getLoginUser().getUserid().toString()); + } + List orderInfoDtos = orderMapper.getOrderDetails(orderInfoDto); for (OrderInfoDto dto : orderInfoDtos) { List list = new ArrayList(); diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 180266b..64f530a 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -171,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" d.ma_id as maId, d.code as code, d.device_name as deviceName, + d.device_count as deviceCount, d.device_weight as deviceWeight, d.type_id as typeId, mt4.type_name as typeName, @@ -453,6 +454,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update ma_dev_info set ma_status = #{maStatus} where ma_id = #{maId} and is_active = 1 +