1、租赁订单
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 22m59s

This commit is contained in:
dev_ljl 2025-07-05 17:38:27 +08:00
parent 73b4581836
commit 9a34602030
19 changed files with 180 additions and 70 deletions

View File

@ -129,7 +129,7 @@ public class PlantsOrderMaintainController extends BaseController {
* @return * @return
*/ */
@GetMapping("/countAchievedRate") @GetMapping("/countAchievedRate")
public R<String> countAchievedRate(){ public R<Map> countAchievedRate(){
return R.ok(plantsOrderMaintainService.countAchievedRate()); return R.ok(plantsOrderMaintainService.countAchievedRate());
} }

View File

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serial; import java.io.Serial;
@ -35,19 +34,9 @@ public class PlantsOrderMaintain extends BaseEntity {
private String maintainName; private String maintainName;
/** /**
* 小区id * 房间id
*/ */
private Long communityId; private Long roomId;
/**
* 建筑id
*/
private Long buildingId;
/**
* 楼层id
*/
private Long floorId;
/** /**
* 服务类型 * 服务类型

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serial; import java.io.Serial;
import java.math.BigDecimal;
/** /**
* 绿植租赁-绿植产品对象 plants_product * 绿植租赁-绿植产品对象 plants_product
@ -55,7 +56,7 @@ public class PlantsProduct extends BaseEntity {
/** /**
* 租金 * 租金
*/ */
private Long rent; private BigDecimal rent;
/** /**
* 库存数量 * 库存数量

View File

@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -62,7 +64,7 @@ public class PlantsRentalOrder extends BaseEntity {
/** /**
* 应付总额 * 应付总额
*/ */
private Long totalAmount; private BigDecimal totalAmount;
/** /**
* 租赁方式 * 租赁方式
@ -82,7 +84,7 @@ public class PlantsRentalOrder extends BaseEntity {
/** /**
* 租赁产品数量 * 租赁产品数量
*/ */
private Long productNum; private Integer productNum;
/** /**
* 支付状态 * 支付状态

View File

@ -11,6 +11,8 @@ import jakarta.validation.constraints.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
/** /**
@ -100,5 +102,10 @@ public class PlantsOrderChargeBo extends BaseEntity {
@NotNull(message = "收费状态不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "收费状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Long chargeStatus; private Long chargeStatus;
/**
* 订单id
*/
private List<Long> orderIds;
} }

View File

@ -9,7 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import java.util.List;
/** /**
* 绿植租赁-订单养护管理业务对象 plants_order_maintain * 绿植租赁-订单养护管理业务对象 plants_order_maintain
@ -34,22 +34,10 @@ public class PlantsOrderMaintainBo extends BaseEntity {
private String maintainName; private String maintainName;
/** /**
* 小区id * 房间id
*/ */
@NotNull(message = "服务地点不能为空", groups = { AddGroup.class, EditGroup.class })
private Long communityId; private Long roomId;
/**
* 建筑id
*/
private Long buildingId;
/**
* 楼层id
*/
private Long floorId;
/** /**
* 服务类型 * 服务类型
@ -112,5 +100,10 @@ public class PlantsOrderMaintainBo extends BaseEntity {
*/ */
private Long state; private Long state;
/**
* 订单id
*/
private List<Long> orderIds;
} }

View File

@ -11,6 +11,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.math.BigDecimal;
/** /**
* 绿植租赁-绿植产品业务对象 plants_product * 绿植租赁-绿植产品业务对象 plants_product
* *
@ -62,13 +64,13 @@ public class PlantsProductBo extends BaseEntity {
* 租金 * 租金
*/ */
@NotNull(message = "租金不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "租金不能为空", groups = { AddGroup.class, EditGroup.class })
private Long rent; private BigDecimal rent;
/** /**
* 库存数量 * 库存数量
*/ */
@NotNull(message = "库存数量不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "库存数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long inventory; private Integer inventory;
/** /**
* 状态0下架 1上架 * 状态0下架 1上架
@ -81,7 +83,7 @@ public class PlantsProductBo extends BaseEntity {
*/ */
private String remark; private String remark;
public PlantsProductBo(Long id, Long inventory) { public PlantsProductBo(Long id, Integer inventory) {
this.id = id; this.id = id;
this.inventory = inventory; this.inventory = inventory;
} }

View File

@ -10,6 +10,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -72,7 +74,7 @@ public class PlantsRentalOrderBo extends BaseEntity {
* 应付总额 * 应付总额
*/ */
@NotNull(message = "应付总额不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "应付总额不能为空", groups = { AddGroup.class, EditGroup.class })
private Long totalAmount; private BigDecimal totalAmount;
/** /**
* 租赁方式 * 租赁方式
@ -93,7 +95,7 @@ public class PlantsRentalOrderBo extends BaseEntity {
/** /**
* 租赁产品数量 * 租赁产品数量
*/ */
private Long productNum; private Integer productNum;
/** /**
* 支付状态 * 支付状态

View File

@ -43,22 +43,16 @@ public class PlantsOrderMaintainVo implements Serializable {
private String maintainName; private String maintainName;
/** /**
* 小区id * 房间id
*/ */
@ExcelProperty(value = "小区id")
private Long communityId; private Long roomId;
/** /**
* 建筑id * 服务地点
*/ */
@ExcelProperty(value = "建筑id") @ExcelProperty(value = "服务地点")
private Long buildingId; private String roomName;
/**
* 楼层id
*/
@ExcelProperty(value = "楼层id")
private Long floorId;
/** /**
* 服务类型 * 服务类型
@ -127,5 +121,10 @@ public class PlantsOrderMaintainVo implements Serializable {
@ExcelProperty(value = "处理状态") @ExcelProperty(value = "处理状态")
private Long state; private Long state;
/**
* 租赁订单
*/
private PlantsRentalOrderVo rentalOrder;
} }

View File

@ -10,6 +10,7 @@ import lombok.Data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -68,7 +69,7 @@ public class PlantsProductVo implements Serializable {
* 租金 * 租金
*/ */
@ExcelProperty(value = "租金") @ExcelProperty(value = "租金")
private Long rent; private BigDecimal rent;
/** /**
* 库存数量 * 库存数量
@ -95,5 +96,10 @@ public class PlantsProductVo implements Serializable {
@ExcelProperty(value = "创建时间") @ExcelProperty(value = "创建时间")
private Date createTime; private Date createTime;
/**
* 方案产品数量
*/
private Integer planProNumber;
} }

View File

@ -1,6 +1,8 @@
package org.dromara.property.domain.vo; package org.dromara.property.domain.vo;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.PlantsRentalOrder; import org.dromara.property.domain.PlantsRentalOrder;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
@ -13,7 +15,7 @@ import lombok.Data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
@ -78,7 +80,7 @@ public class PlantsRentalOrderVo implements Serializable {
* 应付总额 * 应付总额
*/ */
@ExcelProperty(value = "应付总额") @ExcelProperty(value = "应付总额")
private Long totalAmount; private BigDecimal totalAmount;
/** /**
* 租赁方式 * 租赁方式
@ -102,7 +104,7 @@ public class PlantsRentalOrderVo implements Serializable {
* 租赁产品数量 * 租赁产品数量
*/ */
@ExcelProperty(value = "租赁产品数量") @ExcelProperty(value = "租赁产品数量")
private Long productNum; private Integer productNum;
/** /**
* 支付状态 * 支付状态
@ -125,6 +127,7 @@ public class PlantsRentalOrderVo implements Serializable {
/** /**
* 合同编号 * 合同编号
*/ */
@ExcelProperty(value = "合同编号")
private String contractCode; private String contractCode;
/** /**
@ -133,5 +136,10 @@ public class PlantsRentalOrderVo implements Serializable {
@ExcelProperty(value = "签署时间") @ExcelProperty(value = "签署时间")
private Date signTime; private Date signTime;
/**
* 绿植产品
*/
private List<PlantsProductVo> productList;
} }

View File

@ -17,7 +17,7 @@ import java.util.Map;
public interface PlantsOrderMaintainMapper extends BaseMapperPlus<PlantsOrderMaintain, PlantsOrderMaintainVo> { public interface PlantsOrderMaintainMapper extends BaseMapperPlus<PlantsOrderMaintain, PlantsOrderMaintainVo> {
@Select("SELECT " + @Select("SELECT " +
"(CASE WHEN 1 THEN '一星'" + "(CASE customer_score WHEN 1 THEN '一星'" +
"WHEN 2 THEN '二星'" + "WHEN 2 THEN '二星'" +
"WHEN 3 THEN '三星'" + "WHEN 3 THEN '三星'" +
"WHEN 4 THEN '四星'" + "WHEN 4 THEN '四星'" +
@ -32,7 +32,7 @@ public interface PlantsOrderMaintainMapper extends BaseMapperPlus<PlantsOrderMai
"COUNT(*) AS total," + "COUNT(*) AS total," +
"SUM(CASE WHEN state ='2' THEN 1 ELSE 0 END) AS finish," + "SUM(CASE WHEN state ='2' THEN 1 ELSE 0 END) AS finish," +
"ROUND(SUM(CASE WHEN state ='2' THEN 1 ELSE 0 END) * 100/NULLIF(COUNT(*),0),0) AS rate " + "ROUND(SUM(CASE WHEN state ='2' THEN 1 ELSE 0 END) * 100/NULLIF(COUNT(*),0),0) AS rate " +
"FROM plants_order_maintain" + "FROM plants_order_maintain " +
"GROUP BY serve_type") "GROUP BY serve_type")
List<Map<String, Object>> countAchieved(); List<Map<String, Object>> countAchieved();

View File

@ -84,5 +84,5 @@ public interface IPlantsOrderMaintainService {
* 计算绿植养护完成率 * 计算绿植养护完成率
* @return * @return
*/ */
String countAchievedRate(); Map countAchievedRate();
} }

View File

@ -73,4 +73,11 @@ public interface IPlantsProductService {
* @return 是否扣除成功 * @return 是否扣除成功
*/ */
Boolean deductStock(List<PlantsProductBo> products); Boolean deductStock(List<PlantsProductBo> products);
/**
* 添加商品库存
* @param products 商品
* @return 是否添加成功
*/
Boolean addStock(List<PlantsProductBo> products);
} }

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.PlantsOrderMaintain;
import org.dromara.property.domain.vo.PlantsRentalOrderVo; import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.service.IPlantsRentalOrderService; import org.dromara.property.service.IPlantsRentalOrderService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -94,6 +96,7 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
lqw.eq(bo.getInvoiceStatus() != null, PlantsOrderCharge::getInvoiceStatus, bo.getInvoiceStatus()); lqw.eq(bo.getInvoiceStatus() != null, PlantsOrderCharge::getInvoiceStatus, bo.getInvoiceStatus());
lqw.eq(bo.getInvoiceType() != null, PlantsOrderCharge::getInvoiceType, bo.getInvoiceType()); lqw.eq(bo.getInvoiceType() != null, PlantsOrderCharge::getInvoiceType, bo.getInvoiceType());
lqw.eq(bo.getChargeStatus() != null, PlantsOrderCharge::getChargeStatus, bo.getChargeStatus()); lqw.eq(bo.getChargeStatus() != null, PlantsOrderCharge::getChargeStatus, bo.getChargeStatus());
lqw.in(CollectionUtils.isNotEmpty(bo.getOrderIds()), PlantsOrderCharge::getOrderId,bo.getOrderIds());
return lqw; return lqw;
} }

View File

@ -10,6 +10,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.service.IPlantsRentalOrderService;
import org.dromara.property.service.ITbRoomService;
import org.dromara.system.api.RemoteDictService; import org.dromara.system.api.RemoteDictService;
import org.dromara.system.api.domain.vo.RemoteDictDataVo; import org.dromara.system.api.domain.vo.RemoteDictDataVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,6 +39,10 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
private final RemoteDictService dictService; private final RemoteDictService dictService;
private final IPlantsRentalOrderService plantsRentalOrderService;
private final ITbRoomService roomService;
/** /**
* 查询绿植租赁-订单养护管理 * 查询绿植租赁-订单养护管理
* *
@ -44,7 +51,14 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
*/ */
@Override @Override
public PlantsOrderMaintainVo queryById(Long id) { public PlantsOrderMaintainVo queryById(Long id) {
return baseMapper.selectVoById(id); PlantsOrderMaintainVo vo = baseMapper.selectVoById(id);
if(vo!=null){
PlantsRentalOrderVo orderVo = plantsRentalOrderService.queryById(vo.getOrderId());
vo.setRentalOrder(orderVo);
String roomName = roomService.queryRoomName(vo.getRoomId());
vo.setRoomName(roomName);
}
return vo;
} }
/** /**
@ -78,9 +92,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
LambdaQueryWrapper<PlantsOrderMaintain> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<PlantsOrderMaintain> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(PlantsOrderMaintain::getId); lqw.orderByAsc(PlantsOrderMaintain::getId);
lqw.like(StringUtils.isNotBlank(bo.getMaintainName()), PlantsOrderMaintain::getMaintainName, bo.getMaintainName()); lqw.like(StringUtils.isNotBlank(bo.getMaintainName()), PlantsOrderMaintain::getMaintainName, bo.getMaintainName());
lqw.eq(bo.getCommunityId() != null, PlantsOrderMaintain::getCommunityId, bo.getCommunityId()); lqw.eq(bo.getRoomId() != null, PlantsOrderMaintain::getRoomId, bo.getRoomId());
lqw.eq(bo.getBuildingId() != null, PlantsOrderMaintain::getBuildingId, bo.getBuildingId());
lqw.eq(bo.getFloorId() != null, PlantsOrderMaintain::getFloorId, bo.getFloorId());
lqw.eq(bo.getServeType() != null, PlantsOrderMaintain::getServeType, bo.getServeType()); lqw.eq(bo.getServeType() != null, PlantsOrderMaintain::getServeType, bo.getServeType());
lqw.eq(bo.getPeriodType() != null, PlantsOrderMaintain::getPeriodType, bo.getPeriodType()); lqw.eq(bo.getPeriodType() != null, PlantsOrderMaintain::getPeriodType, bo.getPeriodType());
lqw.eq(bo.getPeriodFrequency() != null, PlantsOrderMaintain::getPeriodFrequency, bo.getPeriodFrequency()); lqw.eq(bo.getPeriodFrequency() != null, PlantsOrderMaintain::getPeriodFrequency, bo.getPeriodFrequency());
@ -92,6 +104,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
lqw.eq(bo.getCustomerScore() != null, PlantsOrderMaintain::getCustomerScore, bo.getCustomerScore()); lqw.eq(bo.getCustomerScore() != null, PlantsOrderMaintain::getCustomerScore, bo.getCustomerScore());
lqw.eq(StringUtils.isNotBlank(bo.getCustomerAdvice()), PlantsOrderMaintain::getCustomerAdvice, bo.getCustomerAdvice()); lqw.eq(StringUtils.isNotBlank(bo.getCustomerAdvice()), PlantsOrderMaintain::getCustomerAdvice, bo.getCustomerAdvice());
lqw.eq(bo.getState() != null, PlantsOrderMaintain::getState, bo.getState()); lqw.eq(bo.getState() != null, PlantsOrderMaintain::getState, bo.getState());
lqw.in(CollectionUtils.isNotEmpty(bo.getOrderIds()),PlantsOrderMaintain::getOrderId,bo.getOrderIds());
return lqw; return lqw;
} }
@ -169,7 +182,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
List<Object> total = new ArrayList<>(); List<Object> total = new ArrayList<>();
List<Object> finish = new ArrayList<>(); List<Object> finish = new ArrayList<>();
List<Object> rate = new ArrayList<>(); List<Object> rate = new ArrayList<>();
List<RemoteDictDataVo> typeList = dictService.selectDictDataByType(""); List<RemoteDictDataVo> typeList = dictService.selectDictDataByType("pro_service_type");
if (CollectionUtils.isNotEmpty(typeList)) { if (CollectionUtils.isNotEmpty(typeList)) {
typeList.forEach(item -> { typeList.forEach(item -> {
type.add(item.getDictValue()); type.add(item.getDictValue());
@ -203,11 +216,14 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
* @return 绿植养护完成率 * @return 绿植养护完成率
*/ */
@Override @Override
public String countAchievedRate() { public Map<String,String> countAchievedRate() {
Double rate = baseMapper.countAchievedRate(); Double rate = baseMapper.countAchievedRate();
Map<String,String> map = new HashMap<>();
String s="0%";
if (rate != null) { if (rate != null) {
return rate + "%"; s= rate + "%";
} }
return "0%"; map.put("rate", s);
return map;
} }
} }

View File

@ -162,4 +162,23 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
} }
return flag; return flag;
} }
/**
* 添加商品库存
* @param products 商品
* @return 是否添加成功
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean addStock(List<PlantsProductBo> products) {
Boolean flag = false;
for (PlantsProductBo product : products) {
PlantsProduct p = baseMapper.selectById(product.getId());
if(p!=null){
p.setInventory(p.getInventory() + product.getInventory());
flag = baseMapper.updateById(p) > 0;
}
}
return flag;
}
} }

View File

@ -12,16 +12,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.PlantsProduct; import org.dromara.property.domain.PlantsProduct;
import org.dromara.property.domain.bo.PlantsOrderChargeBo;
import org.dromara.property.domain.bo.PlantsOrderMaintainBo;
import org.dromara.property.domain.bo.PlantsProductBo; import org.dromara.property.domain.bo.PlantsProductBo;
import org.dromara.property.service.IPlantsProductService; import org.dromara.property.domain.vo.*;
import org.dromara.property.service.*;
import org.dromara.system.api.RemoteDictService; import org.dromara.system.api.RemoteDictService;
import org.dromara.system.api.domain.vo.RemoteDictDataVo; import org.dromara.system.api.domain.vo.RemoteDictDataVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsRentalOrderBo; import org.dromara.property.domain.bo.PlantsRentalOrderBo;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.domain.PlantsRentalOrder; import org.dromara.property.domain.PlantsRentalOrder;
import org.dromara.property.mapper.PlantsRentalOrderMapper; import org.dromara.property.mapper.PlantsRentalOrderMapper;
import org.dromara.property.service.IPlantsRentalOrderService;
import java.time.YearMonth; import java.time.YearMonth;
import java.util.*; import java.util.*;
@ -43,6 +44,12 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
private final IPlantsProductService productService; private final IPlantsProductService productService;
private final IPlantsPlanProductService planProductService;
// private final IPlantsOrderMaintainService maintainService;
//
// private final IPlantsOrderChargeService chargeService;
/** /**
* 查询绿植租赁-订单管理 * 查询绿植租赁-订单管理
* *
@ -51,7 +58,22 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
*/ */
@Override @Override
public PlantsRentalOrderVo queryById(Long id) { public PlantsRentalOrderVo queryById(Long id) {
return baseMapper.selectVoById(id); PlantsRentalOrderVo orderVo = baseMapper.selectVoById(id);
ArrayList<PlantsProductVo> list = new ArrayList<>();
if("1".equals(orderVo.getRentalType())){
PlantsProductVo productVo = productService.queryById(orderVo.getProductId());
productVo.setPlanProNumber(orderVo.getProductNum());
list.add(productVo);
}else {
List<PlantsPlanProductVo> planProductVos = planProductService.queryPlanProductsInfo(orderVo.getPlanId());
for (PlantsPlanProductVo planProductVo : planProductVos) {
PlantsProductVo product = planProductVo.getProduct();
product.setPlanProNumber(planProductVo.getProductNum());
list.add(product);
}
}
orderVo.setProductList(list);
return orderVo;
} }
/** /**
@ -168,7 +190,39 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
@Override @Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) { if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验 //有订单收费或订单维护数据不可删除
// PlantsOrderChargeBo chargeBo = new PlantsOrderChargeBo();
// chargeBo.setOrderIds(ids.stream().toList());
// List<PlantsOrderChargeVo> chargeList = chargeService.queryList(chargeBo);
// PlantsOrderMaintainBo maintainBo = new PlantsOrderMaintainBo();
// maintainBo.setOrderIds(ids.stream().toList());
// List<PlantsOrderMaintainVo> maintainList = maintainService.queryList(maintainBo);
// if(CollectionUtils.isNotEmpty(maintainList)||CollectionUtils.isNotEmpty(chargeList)){
// throw new ServiceException("所选订单不可删除");
// }else {
// //恢复产品库存
// ArrayList<PlantsProductBo> productList = new ArrayList<>();
// for (Long id : ids) {
// PlantsRentalOrder order = baseMapper.selectById(id);
// if("1".equals(order.getRentalType())){
// Long productId = order.getProductId();
// Integer productNum = order.getProductNum();
// productList.add(new PlantsProductBo(productId,productNum));
// }else {
// Long planId = order.getPlanId();
// List<PlantsPlanProductVo> planProductVos = planProductService.queryPlanProductsInfo(planId);
// for (PlantsPlanProductVo planProductVo : planProductVos) {
// productList.add(new PlantsProductBo(planProductVo.getProductId(),planProductVo.getProductNum()));
// }
// }
// }
// if(CollectionUtils.isNotEmpty(productList)){
// Boolean b = productService.addStock(productList);
// if(!b){
// throw new ServiceException("删除订单失败。");
// }
// }
// }
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;
} }

View File

@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="pid"/> <result property="id" column="pid"/>
<result property="planId" column="plan_id"/> <result property="planId" column="plan_id"/>
<result property="productId" column="product_id"/> <result property="productId" column="product_id"/>
<result property="productNum" column="product_num"/>
<association property="product" javaType="org.dromara.property.domain.vo.PlantsProductVo"> <association property="product" javaType="org.dromara.property.domain.vo.PlantsProductVo">
<id property="id" column="id"/> <id property="id" column="id"/>
<result property="plantCode" column="plant_code"/> <result property="plantCode" column="plant_code"/>
@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.id pid, c.id pid,
c.plan_id, c.plan_id,
c.product_id, c.product_id,
c.product_num,
p.* p.*
from plants_plan_product c from plants_plan_product c
left join plants_product p on c.product_id = p.id left join plants_product p on c.product_id = p.id