Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 13m54s

This commit is contained in:
dy
2025-07-07 15:27:33 +08:00
60 changed files with 1421 additions and 244 deletions

View File

@@ -5,17 +5,17 @@ FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
LABEL maintainer="Lion Li"
RUN mkdir -p /ruoyi/system/logs \
/ruoyi/system/temp \
RUN mkdir -p /ruoyi/Property/logs \
/ruoyi/Property/temp \
/ruoyi/skywalking/agent
WORKDIR /ruoyi/system
WORKDIR /ruoyi/Property
ENV SERVER_PORT=9201 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
EXPOSE ${SERVER_PORT}
ADD ./target/ruoyi-system.jar ./app.jar
ADD ./target/Property.jar ./app.jar
SHELL ["/bin/bash", "-c"]

View File

@@ -0,0 +1,21 @@
services:
ruoyi-system:
# image: ruoyi/Property:2.4.0
build:
context: .
dockerfile: Dockerfile
container_name: Property
environment:
# 时区上海
TZ: Asia/Shanghai
ports:
- "10001:10001"
volumes:
# 配置文件
- /docker/Property/logs/:/ruoyi/Property/logs
# skywalking 探针
- /docker/skywalking/agent/:/ruoyi/skywalking/agent
privileged: true
network_mode: "host"

View File

@@ -0,0 +1,34 @@
package org.dromara.property.controller;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.property.service.EnumFetcherService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author yuqi
*/
@RestController
@RequestMapping("/enum-fetcher")
@RequiredArgsConstructor
public class EnumFetcherController {
private final EnumFetcherService enumFetcherService;
/**
*
* @param name
* @return 获取枚举全部值 参数以字段大驼峰格式 如:OmsOrderStatus
*/
@GetMapping("/enum-values/{name}")
public R<Map<String, String>> getEnumValues(@PathVariable("name") String name) {
Map<String, String> map = enumFetcherService.getEnumValues(name);
return R.ok(map);
}
}

View File

@@ -46,16 +46,16 @@ public class MeetAttachController extends BaseController {
return meetAttachService.queryPageList(bo, pageQuery);
}
/**
* 导出会议室增值服务列表
*/
@SaCheckPermission("property:attach:export")
@Log(title = "会议室增值服务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(MeetAttachBo bo, HttpServletResponse response) {
List<MeetAttachVo> list = meetAttachService.queryList(bo);
ExcelUtil.exportExcel(list, "会议室增值服务", MeetAttachVo.class, response);
}
///**
// * 导出会议室增值服务列表
// */
//@SaCheckPermission("property:attach:export")
//@Log(title = "会议室增值服务", businessType = BusinessType.EXPORT)
//@PostMapping("/export")
//public void export(MeetAttachBo bo, HttpServletResponse response) {
// List<MeetAttachVo> list = meetAttachService.queryList(bo);
// ExcelUtil.exportExcel(list, "会议室增值服务", MeetAttachVo.class, response);
//}
/**
* 获取会议室增值服务详细信息

View File

@@ -38,25 +38,13 @@ public class MeetBookingController extends BaseController {
private final IMeetBookingService meetBookingService;
/**
* 查询会议预约列表
* 查询会议预约记录列表
*/
@SaCheckPermission("property:meetbooking:list")
@GetMapping("/list")
public TableDataInfo<MeetBookingVo> list(MeetBookingBo bo, PageQuery pageQuery) {
return meetBookingService.queryPageList(bo, pageQuery);
}
/**
* 导出会议预约列表
*/
@SaCheckPermission("property:meetbooking:export")
@Log(title = "会议预约", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(MeetBookingBo bo, HttpServletResponse response) {
List<MeetBookingVo> list = meetBookingService.queryList(bo);
ExcelUtil.exportExcel(list, "会议预约", MeetBookingVo.class, response);
}
/**
* 获取会议预约详细信息
*
@@ -91,16 +79,16 @@ public class MeetBookingController extends BaseController {
return toAjax(meetBookingService.updateByBo(bo));
}
/**
* 删除会议预约
*
* @param ids 主键串
*/
@SaCheckPermission("property:meetbooking:remove")
@Log(title = "会议预约", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(meetBookingService.deleteWithValidByIds(List.of(ids), true));
}
///**
// * 删除会议预约
// *
// * @param ids 主键串
// */
//@SaCheckPermission("property:meetbooking:remove")
//@Log(title = "会议预约", businessType = BusinessType.DELETE)
//@DeleteMapping("/{ids}")
//public R<Void> remove(@NotEmpty(message = "主键不能为空")
// @PathVariable("ids") Long[] ids) {
// return toAjax(meetBookingService.deleteWithValidByIds(List.of(ids), true));
//}
}

View File

@@ -2,6 +2,8 @@ package org.dromara.property.controller;
import java.util.List;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
@@ -32,6 +34,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
@Validated
@RequiredArgsConstructor
@RestController
@Tag(name = " 会议室设置")
@RequestMapping("/meet")
public class MeetController extends BaseController {
@@ -40,32 +43,43 @@ public class MeetController extends BaseController {
/**
* 查询会议室管理列表
*/
@SaCheckPermission("property:meet:list")
// @SaCheckPermission("property:meet:list")
@Operation
@GetMapping("/list")
public TableDataInfo<MeetVo> list(MeetBo bo, PageQuery pageQuery) {
return meetService.queryPageList(bo, pageQuery);
}
/**
* 导出会议室管理列表
* 查询未预约会议
* @param bo
* @return
*/
@SaCheckPermission("property:meet:export")
@Log(title = "会议室管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(MeetBo bo, HttpServletResponse response) {
List<MeetVo> list = meetService.queryList(bo);
ExcelUtil.exportExcel(list, "会议室管理", MeetVo.class, response);
@Operation
@GetMapping("/notlist")
public R<List<MeetVo>> notlist(MeetBo bo) {
return R.ok(meetService.queryList(bo));
}
///**
// * 导出会议室管理列表
// */
//@SaCheckPermission("property:meet:export")
//@Log(title = "会议室管理", businessType = BusinessType.EXPORT)
//@PostMapping("/export")
//public void export(MeetBo bo, HttpServletResponse response) {
// List<MeetVo> list = meetService.queryList(bo);
// ExcelUtil.exportExcel(list, "会议室管理", MeetVo.class, response);
//}
/**
* 获取会议室管理详细信息
*
* @param id 主键
*/
@SaCheckPermission("property:meet:query")
//@SaCheckPermission("property:meet:query")
@Operation
@GetMapping("/{id}")
public R<MeetVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
public R<MeetVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) {
return R.ok(meetService.queryById(id));
}
@@ -73,6 +87,7 @@ public class MeetController extends BaseController {
* 新增会议室管理
*/
@SaCheckPermission("property:meet:add")
@Operation
@Log(title = "会议室管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()

View File

@@ -0,0 +1,39 @@
package org.dromara.property.controller;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.property.domain.bo.MeetBo;
import org.dromara.property.domain.vo.MeetVo;
import org.dromara.property.service.IMeetService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author:yuyongle
* @Date:2025/7/4 15:14
* @Description:
**/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/reservation")
public class MeetReservationController extends BaseController {
private final IMeetService meetService;
/**
* 查询会议室管理列表
*/
// @SaCheckPermission("property:meet:list")
@Operation
@GetMapping("/list")
public List<MeetVo> list(MeetBo bo) {
return meetService.queryList(bo);
}
}

View File

@@ -1,6 +1,7 @@
package org.dromara.property.controller;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
@@ -103,4 +104,35 @@ public class PlantsOrderMaintainController extends BaseController {
@PathVariable("ids") Long[] ids) {
return toAjax(plantsOrderMaintainService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 按用户评分统计养护
* @return
*/
@GetMapping("/countByCusScore")
public R<List> countByCusScore(){
return R.ok(plantsOrderMaintainService.countByCusScore());
}
/**
* 统计养护完成情况
* @return
*/
@GetMapping("/countAchieved")
public R<Map> countAchieved(){
return R.ok(plantsOrderMaintainService.countAchieved());
}
/**
* 计算绿植养护完成率
* @return
*/
@GetMapping("/countAchievedRate")
public R<Map> countAchievedRate(){
return R.ok(plantsOrderMaintainService.countAchievedRate());
}
}

View File

@@ -117,11 +117,51 @@ public class PlantsRentalOrderController extends BaseController {
}
/**
*按用户类型统计
*按用户类型统计订单数
* @return
*/
@GetMapping("/countByCusType")
public R<Map> countByCusType(){
return R.ok(plantsRentalOrderService.countByCusType());
}
/**
* 客户续租率统计
* @return
*/
@GetMapping("/countRenewRate")
public R<Map> countRenewRate(){
return R.ok(plantsRentalOrderService.countRenewRate());
}
/**
* 按租赁方式统计租赁金额
* @return
*/
@GetMapping("/countByRentalType")
public R<List> countByRentalType(){
return R.ok(plantsRentalOrderService.countByRentalType());
}
/**
* 统计订单总数和租赁金额总数
* @return
*/
@GetMapping("/countOrderAndAmount")
public R<Map> countOrderAndAmount(){
return R.ok(plantsRentalOrderService.countOrderAndAmount());
}
/**
* 统计下单客户总数
* @return
*/
@GetMapping("/countCustomers")
public R<Map> countCustomers(){
return R.ok(plantsRentalOrderService.countCustomers());
}
}

View File

@@ -58,19 +58,42 @@ public class Meet extends TenantEntity {
private Long attach;
/**
* 创建人id
* 负责人
*/
private Long createById;
private String principals;
/**
* 更新人id
* 描述
*/
private Long updateById;
private String desc;
/**
* 搜索值
* 联系电话
*/
private String searchValue;
private String phoneNo;
/**
* (0不审核,1审核)
*/
private Integer isCheck;
/**
* 预约时间
*/
private String appointmentTime;
/**
* 开放时段
*/
private String openHours;
/**
* 状态(0启用,1禁用)
*/
private Integer status;
/**
* (1免费2.付费,3面议)
*/
private Integer expenseType;
}

View File

@@ -56,6 +56,10 @@ public class MeetAttach extends TenantEntity {
* 状态
*/
private Long state;
/**
* 图片
*/
private String picture;
/**
* 创建人id

View File

@@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -47,22 +49,22 @@ public class PlantsOrderCharge extends BaseEntity {
/**
* 租金
*/
private Long rent;
private BigDecimal rent;
/**
* 押金
*/
private Long deposit;
private BigDecimal deposit;
/**
* 违约金
*/
private Long penalty;
private BigDecimal penalty;
/**
* 总金额
*/
private Long totalAmount;
private BigDecimal totalAmount;
/**
* 收费日期

View File

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

View File

@@ -37,5 +37,10 @@ public class PlantsPlanProduct extends BaseEntity {
*/
private Long productId;
/**
* 绿植产品数量
*/
private Integer productNum;
}

View File

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

View File

@@ -4,6 +4,8 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
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

@@ -23,13 +23,11 @@ public class MeetAttachBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
* 会议室id
*/
@NotNull(message = "会议室id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long meetId;
/**

View File

@@ -1,5 +1,6 @@
package org.dromara.property.domain.bo;
import com.baomidou.mybatisplus.annotation.TableId;
import org.dromara.property.domain.Meet;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
@@ -9,6 +10,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.List;
/**
* 会议室管理业务对象 meet
*
@@ -23,22 +26,25 @@ public class MeetBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
@TableId(value = "id")
private Long id;
/**
* 会议室名称
*/
@NotBlank(message = "会议室名称不能为空")
private String name;
/**
* 位置
*/
@NotBlank(message = "位置不能为空")
private String location;
/**
* 容纳人数
*/
@NotBlank(message = "容纳人数不能为空")
private Long personNumber;
/**
@@ -56,5 +62,48 @@ public class MeetBo extends BaseEntity {
*/
private Long attach;
/**
* 负责人
*/
private String principals;
/**
* 描述
*/
private String desc;
/**
* 联系电话
*/
private String phoneNo;
/**
* (0不审核,1审核)
*/
private Integer isCheck;
/**
* 预约时间
*/
private String appointmentTime;
/**
* 开放时段
*/
private String openHours;
/**
* 状态(0启用,1禁用)
*/
private Integer status;
/**
* (1免费2.付费,3面议)
*/
private Integer expenseType;
/**
* 新增图片
*/
private String picture;
}

View File

@@ -8,7 +8,11 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
@@ -49,25 +53,24 @@ public class PlantsOrderChargeBo extends BaseEntity {
* 租金
*/
@NotNull(message = "租金不能为空", groups = { AddGroup.class, EditGroup.class })
private Long rent;
private BigDecimal rent;
/**
* 押金
*/
@NotNull(message = "押金不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deposit;
private BigDecimal deposit;
/**
* 违约金
*/
@NotNull(message = "违约金不能为空", groups = { AddGroup.class, EditGroup.class })
private Long penalty;
private BigDecimal penalty;
/**
* 总金额
*/
@NotNull(message = "总金额不能为空", groups = { AddGroup.class, EditGroup.class })
private Long totalAmount;
private BigDecimal totalAmount;
/**
* 收费日期
@@ -99,5 +102,10 @@ public class PlantsOrderChargeBo extends BaseEntity {
@NotNull(message = "收费状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Long chargeStatus;
/**
* 订单id
*/
private List<Long> orderIds;
}

View File

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

View File

@@ -9,6 +9,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.List;
/**
* 绿植租赁-租赁方案-绿植业务对象 plants_plan_product
*
@@ -23,7 +25,6 @@ public class PlantsPlanProductBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
private Long id;
/**
@@ -38,5 +39,17 @@ public class PlantsPlanProductBo extends BaseEntity {
@NotNull(message = "绿植产品id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long productId;
/**
* 绿植产品数量
*/
@NotNull(message = "产品数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer productNum;
/**
* 产品id
*/
private List<Long> productIds;
}

View File

@@ -1,5 +1,7 @@
package org.dromara.property.domain.bo;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.dromara.property.domain.PlantsProduct;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
@@ -9,12 +11,16 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
/**
* 绿植租赁-绿植产品业务对象 plants_product
*
* @author mocheng
* @date 2025-06-25
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = PlantsProduct.class, reverseConvertGenerate = false)
@@ -29,7 +35,6 @@ public class PlantsProductBo extends BaseEntity {
/**
* 产品编号
*/
@NotBlank(message = "产品编号不能为空", groups = { AddGroup.class, EditGroup.class })
private String plantCode;
/**
@@ -59,13 +64,13 @@ public class PlantsProductBo extends BaseEntity {
* 租金
*/
@NotNull(message = "租金不能为空", groups = { AddGroup.class, EditGroup.class })
private Long rent;
private BigDecimal rent;
/**
* 库存数量
*/
@NotNull(message = "库存数量不能为空", groups = { AddGroup.class, EditGroup.class })
private Long inventory;
private Integer inventory;
/**
* 状态0下架 1上架
@@ -78,5 +83,9 @@ public class PlantsProductBo extends BaseEntity {
*/
private String remark;
public PlantsProductBo(Long id, Integer inventory) {
this.id = id;
this.inventory = inventory;
}
}

View File

@@ -1,5 +1,7 @@
package org.dromara.property.domain.bo;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.dromara.property.domain.PlantsRentalOrder;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
@@ -8,7 +10,11 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
@@ -17,6 +23,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
* @author mocheng
* @date 2025-06-30
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = PlantsRentalOrder.class, reverseConvertGenerate = false)
@@ -66,7 +74,7 @@ public class PlantsRentalOrderBo extends BaseEntity {
* 应付总额
*/
@NotNull(message = "应付总额不能为空", groups = { AddGroup.class, EditGroup.class })
private Long totalAmount;
private BigDecimal totalAmount;
/**
* 租赁方式
@@ -87,7 +95,7 @@ public class PlantsRentalOrderBo extends BaseEntity {
/**
* 租赁产品数量
*/
private Long productNum;
private Integer productNum;
/**
* 支付状态
@@ -114,7 +122,19 @@ public class PlantsRentalOrderBo extends BaseEntity {
*/
private Date signTime;
/**
* 产品
*/
private List<PlantsProductBo> productList;
/**
* 产品id
*/
private List<Long> productIds;
/**
* 方案id
*/
private List<Long> planIds;
}

View File

@@ -63,10 +63,10 @@ public class PlantsRentalPlanBo extends BaseEntity {
private String remarks;
/**
* 产品id
* 绿植产品
*/
@NotNull(message = "绿植产品不能为空", groups = { AddGroup.class, EditGroup.class })
private List<Long> productIds;
private List<PlantsPlanProductBo> productList;
}

View File

@@ -0,0 +1,34 @@
package org.dromara.property.domain.enums;
/**
* @Author:yuyongle
* @Date:2025/7/4 17:58
* @Description:
**/
public enum BookingPayStatusEnum {
/**
* 待确认
*/
ENAABLE("待支付", "0"),
/**
* 待提货
*/
DEACTIVATE("已支付", "1");
private final String name;
private final String value;
BookingPayStatusEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
}

View File

@@ -0,0 +1,30 @@
package org.dromara.property.domain.enums;
/**
* @Author:yuyongle
* @Date:2025/7/5 14:13
* @Description:
**/
public enum BookingStatusEnum {
READYTOSTART("待开始", "0"),
PENDINGREVIEW("待审核", "1"),
FINISHED("已结束", "1");
private final String name;
private final String value;
BookingStatusEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
}

View File

@@ -0,0 +1,34 @@
package org.dromara.property.domain.enums;
/**
* @Author:yuyongle
* @Date:2025/7/4 10:35
* @Description:
**/
public enum MeetAttachStatusEnum {
/**
* 待确认
*/
ENAABLE("上架", "0"),
/**
* 待提货
*/
DEACTIVATE("下架", "1");
private final String name;
private final String value;
MeetAttachStatusEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
}

View File

@@ -0,0 +1,34 @@
package org.dromara.property.domain.enums;
/**
* @Author:yuyongle
* @Date:2025/7/4 10:35
* @Description:
**/
public enum MeetStatusEnum {
/**
* 待确认
*/
ENAABLE("启用", "0"),
/**
* 待提货
*/
DEACTIVATE("停用", "1");
private final String name;
private final String value;
MeetStatusEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
}

View File

@@ -0,0 +1,36 @@
package org.dromara.property.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.TableId;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.property.domain.Meet;
import java.io.Serial;
import java.io.Serializable;
/**
* @Author:yuyongle
* @Date:2025/7/3 17:35
* @Description:
**/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = Meet.class)
public class MeePictureVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id")
private Long id;
/**
* 会议id
*/
private Long meetId;
/**
* 图片路径
*/
private String pictureUrl;
}

View File

@@ -41,7 +41,7 @@ public class MeetVo implements Serializable {
private String name;
/**
* 位置
* 会议室位置
*/
@ExcelProperty(value = "位置")
private String location;
@@ -51,7 +51,10 @@ public class MeetVo implements Serializable {
*/
@ExcelProperty(value = "容纳人数")
private Long personNumber;
/**
* 状态(0启用,1禁用)
*/
private Integer status;
/**
* 基础服务
*/
@@ -61,9 +64,8 @@ public class MeetVo implements Serializable {
/**
* 基础价格
*/
@ExcelProperty(value = "基础价格")
@ExcelProperty(value = "费用")
private Long basePrice;
/**
* 增值服务是否启用
*/
@@ -71,10 +73,14 @@ public class MeetVo implements Serializable {
private Long attach;
/**
* 创建时间
* 负责人
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
@ExcelProperty(value = "负责人")
private String principals;
/**
* 联系电话
*/
@ExcelProperty(value = "联系电话")
private String phoneNo;
}

View File

@@ -1,6 +1,10 @@
package org.dromara.property.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.property.domain.PlantsOrderCharge;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
@@ -59,25 +63,25 @@ public class PlantsOrderChargeVo implements Serializable {
* 租金
*/
@ExcelProperty(value = "租金")
private Long rent;
private BigDecimal rent;
/**
* 押金
*/
@ExcelProperty(value = "押金")
private Long deposit;
private BigDecimal deposit;
/**
* 违约金
*/
@ExcelProperty(value = "违约金")
private Long penalty;
private BigDecimal penalty;
/**
* 总金额
*/
@ExcelProperty(value = "总金额")
private Long totalAmount;
private BigDecimal totalAmount;
/**
* 收费日期
@@ -112,5 +116,15 @@ public class PlantsOrderChargeVo implements Serializable {
@ExcelDictFormat(dictType = "pro_charging_status")
private Long chargeStatus;
/**
* 创建时间
*/
private Date createTime;
/**
* 租赁订单
*/
private PlantsRentalOrderVo rentalOrder;
}

View File

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

View File

@@ -46,6 +46,11 @@ public class PlantsPlanProductVo implements Serializable {
@ExcelProperty(value = "绿植产品id")
private Long productId;
/**
* 绿植产品数量
*/
private Integer productNum;
/**
* 创建时间
*/

View File

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

View File

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

View File

@@ -1,9 +1,13 @@
package org.dromara.property.mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.property.domain.PlantsOrderMaintain;
import org.dromara.property.domain.vo.PlantsOrderMaintainVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
import java.util.Map;
/**
* 绿植租赁-订单养护管理Mapper接口
*
@@ -12,4 +16,27 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface PlantsOrderMaintainMapper extends BaseMapperPlus<PlantsOrderMaintain, PlantsOrderMaintainVo> {
@Select("SELECT " +
"(CASE customer_score WHEN 1 THEN '一星'" +
"WHEN 2 THEN '二星'" +
"WHEN 3 THEN '三星'" +
"WHEN 4 THEN '四星'" +
"WHEN 5 THEN '五星' END) AS score, " +
"COUNT(*) AS count " +
"FROM plants_order_maintain " +
"GROUP BY customer_score ORDER BY customer_score")
List<Map<String, Object>> countByCusScore();
@Select("SELECT serve_type AS type," +
"COUNT(*) AS total," +
"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 " +
"FROM plants_order_maintain " +
"GROUP BY serve_type")
List<Map<String, Object>> countAchieved();
@Select("SELECT ROUND(SUM(CASE WHEN state ='2' THEN 1 ELSE 0 END) * 100/NULLIF(COUNT(*),0),1) AS rate " +
"FROM plants_order_maintain")
Double countAchievedRate();
}

View File

@@ -22,14 +22,11 @@ public interface PlantsRentalOrderMapper extends BaseMapperPlus<PlantsRentalOrde
"GROUP BY HOUR(create_time)")
List<Map<String, Object>> countByDay();
@Select("SELECT " +
"CASE DAYOFWEEK(create_time) AS week," +
"COUNT(*) AS count" +
@Select("SELECT DAYOFWEEK(create_time) AS week, COUNT(*) AS count " +
"FROM plants_rental_order " +
"WHERE create_time >= DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY) " +
"AND create_time < DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY), INTERVAL 7 DAY) " +
"GROUP BY DATE(create_time) " +
"ORDER BY day")
"WHERE create_time >= DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY)" +
"AND create_time < DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY), INTERVAL 7 DAY)" +
"GROUP BY week ORDER BY week")
List<Map<String, Object>> countByWeek();
@Select("SELECT DAY(create_time) AS day, COUNT(*) AS count " +
@@ -40,4 +37,28 @@ public interface PlantsRentalOrderMapper extends BaseMapperPlus<PlantsRentalOrde
"ORDER BY day")
List<Map<String, Object>> countByMonth();
@Select("SELECT customer_type AS type, COUNT(*) AS count " +
"FROM plants_rental_order " +
"GROUP BY customer_type")
List<Map<String, Object>> countByCusType();
@Select("SELECT MONTH(create_time) AS month," +
"ROUND(SUM(CASE WHEN is_relet = 1 THEN 1 ELSE 0 END) * 100/NULLIF(COUNT(*),0),0) AS rate " +
"FROM plants_rental_order WHERE YEAR(create_time) = YEAR(CURDATE())"+
"GROUP BY MONTH(create_time)" +
"ORDER BY month")
List<Map<String, Object>> countRenewRate();
@Select("SELECT (CASE WHEN rental_type=1 THEN '单点' ELSE '套餐' END) AS type, " +
"COUNT(total_amount) AS amount " +
"FROM plants_rental_order " +
"GROUP BY rental_type")
List<Map<String, Object>> countByRentalType();
@Select("SELECT COUNT(*) AS num, " +
"COUNT(total_amount) AS amount " +
"FROM plants_rental_order")
Map<String, Object> countOrderAndAmount();
}

View File

@@ -0,0 +1,17 @@
package org.dromara.property.service;
import java.util.Map;
/**
* @Author:yuyongle
* @Date:2025/7/4 09:41
* @Description:
**/
public interface EnumFetcherService {
/**
* 获取枚举值
* @param type 大驼峰格式
* @return
*/
Map<String, String> getEnumValues(String type);
}

View File

@@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 会议室增值服务Service接口
@@ -66,4 +67,10 @@ public interface IMeetAttachService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 获取下拉接口数据
* @param type
*/
Map<String,String> getMeetAttachSelectDate(String type);
}

View File

@@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 会议预约Service接口
@@ -66,4 +67,11 @@ public interface IMeetBookingService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 查询会议接口下拉数据
* @param type
* @return
*/
Map<String, String> getMeetBooking(String type);
}

View File

@@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 会议室管理Service接口
@@ -66,4 +67,10 @@ public interface IMeetService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 获取下拉接口数据
* @param type
*/
Map<String,String> getMeetSelectDate(String type);
}

View File

@@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 绿植租赁-订单养护管理Service接口
@@ -66,4 +67,22 @@ public interface IPlantsOrderMaintainService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 按用户评分统计
* @return
*/
List<Map<String,Object>> countByCusScore();
/**
* 统计养护完成情况
* @return
*/
Map<String,List> countAchieved();
/**
* 计算绿植养护完成率
* @return
*/
Map countAchievedRate();
}

View File

@@ -66,4 +66,18 @@ public interface IPlantsProductService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 扣除商品库存
* @param products 商品
* @return 是否扣除成功
*/
Boolean deductStock(List<PlantsProductBo> products);
/**
* 添加商品库存
* @param products 商品
* @return 是否添加成功
*/
Boolean addStock(List<PlantsProductBo> products);
}

View File

@@ -80,4 +80,32 @@ public interface IPlantsRentalOrderService {
* @return
*/
Map<String,List> countByCusType();
/**
* 客户续租率统计
* @return
*/
Map<String,List> countRenewRate();
/**
* 按租赁方式统计订单数
* @return
*/
List<Map<String,Object>> countByRentalType();
/**
* 统计订单总数和租赁金额总数
* @return
*/
Map<String,Object> countOrderAndAmount();
/**
* 统计下单客户总数
* @return
*/
Map<String,Integer> countCustomers();
}

View File

@@ -0,0 +1,78 @@
package org.dromara.property.service.impl;
import lombok.RequiredArgsConstructor;
import org.dromara.property.domain.enums.BookingPayStatusEnum;
import org.dromara.property.domain.enums.BookingStatusEnum;
import org.dromara.property.domain.enums.MeetAttachStatusEnum;
import org.dromara.property.domain.enums.MeetStatusEnum;
import org.dromara.property.service.EnumFetcherService;
import org.dromara.property.service.IMeetAttachService;
import org.dromara.property.service.IMeetBookingService;
import org.dromara.property.service.IMeetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author:yuyongle
* @Date:2025/7/4 09:41
* @Description:
**/
@Service
@RequiredArgsConstructor
public class EnumFetcherServiceImpl implements EnumFetcherService {
@Autowired
private IMeetService meetService;
@Autowired
private IMeetAttachService meetAttachService;
@Autowired
private IMeetBookingService meetBookingService;
@Override
public Map<String, String> getEnumValues(String type) {
switch (type) {
case "getMeetName":
return meetService.getMeetSelectDate(type);
case "getMeetPrincipals":
return meetService.getMeetSelectDate(type);
case "getMeetStatus":
return getMeetStatus();
case "getMeetAttachName":
return meetAttachService.getMeetAttachSelectDate(type);
case "getMeetAttachType":
return meetAttachService.getMeetAttachSelectDate(type);
case "getMeetAttachStatus":
return getMeetAttachStatus();
case "getMeetBookingPerson":
return meetBookingService.getMeetBooking(type);
case "getMeetBookingPayStatus":
return getMeetBookingPayStatus();
case "getMeetBookingStatus":
return getMeetBookingStatus();
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
}
Map<String, String> getMeetStatus() {
return java.util.Arrays.stream(MeetStatusEnum.values())
.collect(Collectors.toMap(MeetStatusEnum::getValue, MeetStatusEnum::getName));
}
Map<String, String> getMeetAttachStatus() {
return java.util.Arrays.stream(MeetAttachStatusEnum.values())
.collect(Collectors.toMap(MeetAttachStatusEnum::getValue, MeetAttachStatusEnum::getName));
}
Map<String, String> getMeetBookingPayStatus() {
return java.util.Arrays.stream(BookingPayStatusEnum.values())
.collect(Collectors.toMap(BookingPayStatusEnum::getValue, BookingPayStatusEnum::getName));
}
Map<String, String>getMeetBookingStatus() {
return java.util.Arrays.stream(BookingStatusEnum.values())
.collect(Collectors.toMap(BookingStatusEnum::getValue, BookingStatusEnum::getName));
}
}

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.Meet;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.MeetAttachBo;
import org.dromara.property.domain.vo.MeetAttachVo;
@@ -19,6 +20,7 @@ import org.dromara.property.service.IMeetAttachService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 会议室增值服务Service业务层处理
@@ -134,4 +136,34 @@ public class MeetAttachServiceImpl implements IMeetAttachService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 下拉接口数据
*/
@Override
public Map<String, String> getMeetAttachSelectDate(String type){
switch (type) {
case "getMeetAttachName":
return getList().stream()
.collect(Collectors.toMap(
MeetAttach::getProjectName,
MeetAttach::getProjectName,
(oldValue, newValue) -> oldValue
));
case "getMeetAttachType":
return getList().stream()
.collect(Collectors.toMap(
MeetAttach::getType,
MeetAttach::getType,
(oldValue, newValue) -> oldValue
));
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
}
public List<MeetAttach> getList(){
LambdaQueryWrapper<MeetAttach> meetQueryWrapper = new LambdaQueryWrapper<>();
return baseMapper.selectList(meetQueryWrapper);
}
}

View File

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.Meet;
import org.dromara.property.domain.MeetAttach;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.MeetBookingBo;
import org.dromara.property.domain.vo.MeetBookingVo;
@@ -19,6 +21,7 @@ import org.dromara.property.service.IMeetBookingService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 会议预约Service业务层处理
@@ -141,4 +144,24 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public Map<String, String> getMeetBooking(String type) {
switch (type) {
case "getMeetBookingPerson()":
return getList().stream()
.collect(Collectors.toMap(
MeetBooking::getPerson,
MeetBooking::getPerson,
(oldValue, newValue) -> oldValue
));
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
}
public List<MeetBooking> getList(){
LambdaQueryWrapper<MeetBooking> meetQueryWrapper = new LambdaQueryWrapper<>();
return baseMapper.selectList(meetQueryWrapper);
}
}

View File

@@ -19,6 +19,7 @@ import org.dromara.property.service.IMeetService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 会议室管理Service业务层处理
@@ -110,6 +111,7 @@ public class MeetServiceImpl implements IMeetService {
public Boolean updateByBo(MeetBo bo) {
Meet update = MapstructUtils.convert(bo, Meet.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
@@ -134,4 +136,34 @@ public class MeetServiceImpl implements IMeetService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 下拉接口数据
*/
@Override
public Map<String, String> getMeetSelectDate(String type){
switch (type) {
case "getMeetName":
return getList().stream()
.collect(Collectors.toMap(
Meet::getName,
Meet::getName,
(oldValue, newValue) -> oldValue
));
case "getMeetPrincipals":
return getList().stream()
.collect(Collectors.toMap(
Meet::getPrincipals,
Meet::getPrincipals,
(oldValue, newValue) -> oldValue
));
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
}
public List<Meet> getList(){
LambdaQueryWrapper<Meet> meetQueryWrapper = new LambdaQueryWrapper<>();
return baseMapper.selectList(meetQueryWrapper);
}
}

View File

@@ -1,5 +1,6 @@
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.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -9,6 +10,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.PlantsOrderMaintain;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.service.IPlantsRentalOrderService;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsOrderChargeBo;
import org.dromara.property.domain.vo.PlantsOrderChargeVo;
@@ -33,6 +37,7 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
private final PlantsOrderChargeMapper baseMapper;
private final IPlantsRentalOrderService plantsRentalOrderService;
/**
* 查询绿植租赁-订单收费
*
@@ -41,7 +46,12 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
*/
@Override
public PlantsOrderChargeVo queryById(Long id){
return baseMapper.selectVoById(id);
PlantsOrderChargeVo orderChargeVo = baseMapper.selectVoById(id);
if(orderChargeVo!=null&&orderChargeVo.getOrderId()!=null){
PlantsRentalOrderVo orderVo = plantsRentalOrderService.queryById(orderChargeVo.getOrderId());
orderChargeVo.setRentalOrder(orderVo);
}
return orderChargeVo;
}
/**
@@ -86,6 +96,7 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
lqw.eq(bo.getInvoiceStatus() != null, PlantsOrderCharge::getInvoiceStatus, bo.getInvoiceStatus());
lqw.eq(bo.getInvoiceType() != null, PlantsOrderCharge::getInvoiceType, bo.getInvoiceType());
lqw.eq(bo.getChargeStatus() != null, PlantsOrderCharge::getChargeStatus, bo.getChargeStatus());
lqw.in(CollectionUtils.isNotEmpty(bo.getOrderIds()), PlantsOrderCharge::getOrderId,bo.getOrderIds());
return lqw;
}
@@ -123,7 +134,9 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService {
* 保存前的数据校验
*/
private void validEntityBeforeSave(PlantsOrderCharge entity){
//TODO 做一些数据校验,如唯一约束
if(entity.getRent()!=null&&entity.getDeposit()!=null&&entity.getPenalty()!=null){
entity.setTotalAmount(entity.getRent().add(entity.getDeposit()).add(entity.getPenalty()));
}
}
/**

View File

@@ -1,5 +1,6 @@
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.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -9,6 +10,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
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.domain.vo.RemoteDictDataVo;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsOrderMaintainBo;
import org.dromara.property.domain.vo.PlantsOrderMaintainVo;
@@ -16,9 +22,7 @@ import org.dromara.property.domain.PlantsOrderMaintain;
import org.dromara.property.mapper.PlantsOrderMaintainMapper;
import org.dromara.property.service.IPlantsOrderMaintainService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 绿植租赁-订单养护管理Service业务层处理
@@ -33,6 +37,12 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
private final PlantsOrderMaintainMapper baseMapper;
private final RemoteDictService dictService;
private final IPlantsRentalOrderService plantsRentalOrderService;
private final ITbRoomService roomService;
/**
* 查询绿植租赁-订单养护管理
*
@@ -40,8 +50,15 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
* @return 绿植租赁-订单养护管理
*/
@Override
public PlantsOrderMaintainVo queryById(Long id){
return baseMapper.selectVoById(id);
public PlantsOrderMaintainVo queryById(Long 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;
}
/**
@@ -75,9 +92,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
LambdaQueryWrapper<PlantsOrderMaintain> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(PlantsOrderMaintain::getId);
lqw.like(StringUtils.isNotBlank(bo.getMaintainName()), PlantsOrderMaintain::getMaintainName, bo.getMaintainName());
lqw.eq(bo.getCommunityId() != null, PlantsOrderMaintain::getCommunityId, bo.getCommunityId());
lqw.eq(bo.getBuildingId() != null, PlantsOrderMaintain::getBuildingId, bo.getBuildingId());
lqw.eq(bo.getFloorId() != null, PlantsOrderMaintain::getFloorId, bo.getFloorId());
lqw.eq(bo.getRoomId() != null, PlantsOrderMaintain::getRoomId, bo.getRoomId());
lqw.eq(bo.getServeType() != null, PlantsOrderMaintain::getServeType, bo.getServeType());
lqw.eq(bo.getPeriodType() != null, PlantsOrderMaintain::getPeriodType, bo.getPeriodType());
lqw.eq(bo.getPeriodFrequency() != null, PlantsOrderMaintain::getPeriodFrequency, bo.getPeriodFrequency());
@@ -89,6 +104,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
lqw.eq(bo.getCustomerScore() != null, PlantsOrderMaintain::getCustomerScore, bo.getCustomerScore());
lqw.eq(StringUtils.isNotBlank(bo.getCustomerAdvice()), PlantsOrderMaintain::getCustomerAdvice, bo.getCustomerAdvice());
lqw.eq(bo.getState() != null, PlantsOrderMaintain::getState, bo.getState());
lqw.in(CollectionUtils.isNotEmpty(bo.getOrderIds()),PlantsOrderMaintain::getOrderId,bo.getOrderIds());
return lqw;
}
@@ -125,7 +141,7 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(PlantsOrderMaintain entity){
private void validEntityBeforeSave(PlantsOrderMaintain entity) {
//TODO 做一些数据校验,如唯一约束
}
@@ -138,9 +154,76 @@ public class PlantsOrderMaintainServiceImpl implements IPlantsOrderMaintainServi
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 按用户评分统计
*
* @return
*/
@Override
public List<Map<String, Object>> countByCusScore() {
List<Map<String, Object>> maps = baseMapper.countByCusScore();
return maps;
}
/**
* 统计养护完成情况
*
* @return
*/
@Override
public Map<String, List> countAchieved() {
List<String> type = new ArrayList<>();
List<Object> total = new ArrayList<>();
List<Object> finish = new ArrayList<>();
List<Object> rate = new ArrayList<>();
List<RemoteDictDataVo> typeList = dictService.selectDictDataByType("pro_service_type");
if (CollectionUtils.isNotEmpty(typeList)) {
typeList.forEach(item -> {
type.add(item.getDictValue());
});
total.addAll(Collections.nCopies(typeList.size(), 0));
finish.addAll(Collections.nCopies(typeList.size(), 0));
rate.addAll(Collections.nCopies(typeList.size(), 0));
List<Map<String, Object>> maps = baseMapper.countAchieved();
maps.forEach(item -> {
String typeVal = item.get("type").toString();
int index = type.indexOf(typeVal);
int totalVal = Integer.valueOf(item.get("total").toString());
int finishVal = Integer.valueOf(item.get("finish").toString());
int rateVal = Integer.valueOf(item.get("rate").toString());
total.set(index, totalVal);
finish.set(index, finishVal);
rate.set(index, rateVal);
});
}
Map<String, List> map = new HashMap<>();
map.put("type", type);
map.put("total", total);
map.put("finish", finish);
map.put("rate", rate);
return map;
}
/**
* 计算绿植养护完成率
*
* @return 绿植养护完成率
*/
@Override
public Map<String,String> countAchievedRate() {
Double rate = baseMapper.countAchievedRate();
Map<String,String> map = new HashMap<>();
String s="0%";
if (rate != null) {
s= rate + "%";
}
map.put("rate", s);
return map;
}
}

View File

@@ -1,5 +1,6 @@
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.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -76,6 +77,7 @@ public class PlantsPlanProductServiceImpl implements IPlantsPlanProductService {
lqw.orderByAsc(PlantsPlanProduct::getId);
lqw.eq(bo.getPlanId() != null, PlantsPlanProduct::getPlanId, bo.getPlanId());
lqw.eq(bo.getProductId() != null, PlantsPlanProduct::getProductId, bo.getProductId());
lqw.in(CollectionUtils.isNotEmpty(bo.getProductIds()), PlantsPlanProduct::getProductId, bo.getProductIds());
return lqw;
}

View File

@@ -1,5 +1,7 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -9,12 +11,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.bo.PlantsPlanProductBo;
import org.dromara.property.domain.bo.PlantsRentalOrderBo;
import org.dromara.property.domain.vo.PlantsPlanProductVo;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.service.IPlantsPlanProductService;
import org.dromara.property.service.IPlantsRentalOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsProductBo;
import org.dromara.property.domain.vo.PlantsProductVo;
import org.dromara.property.domain.PlantsProduct;
import org.dromara.property.mapper.PlantsProductMapper;
import org.dromara.property.service.IPlantsProductService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -27,11 +38,17 @@ import java.util.Collection;
* @date 2025-06-25
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class PlantsProductServiceImpl implements IPlantsProductService {
private final PlantsProductMapper baseMapper;
@Autowired
private PlantsProductMapper baseMapper;
@Autowired
@Lazy
private IPlantsRentalOrderService rentalOrderService;
@Autowired
@Lazy
private IPlantsPlanProductService planProductService;
/**
* 查询绿植租赁-绿植产品
@@ -40,7 +57,7 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
* @return 绿植租赁-绿植产品
*/
@Override
public PlantsProductVo queryById(Long id){
public PlantsProductVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@@ -81,7 +98,7 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), PlantsProduct::getSpecification, bo.getSpecification());
lqw.eq(bo.getRent() != null, PlantsProduct::getRent, bo.getRent());
lqw.eq(bo.getState() != null, PlantsProduct::getState, bo.getState());
lqw.gt(bo.getInventory()!=null,PlantsProduct::getInventory, bo.getInventory());
lqw.gt(bo.getInventory() != null, PlantsProduct::getInventory, bo.getInventory());
return lqw;
}
@@ -98,7 +115,7 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
add.setPlantCode("LZ"+add.getId());
add.setPlantCode("LZ" + add.getId());
baseMapper.updateById(add);
}
return flag;
@@ -120,8 +137,8 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(PlantsProduct entity){
//TODO 做一些数据校验,如唯一约束
private void validEntityBeforeSave(PlantsProduct entity) {
}
/**
@@ -133,9 +150,58 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
if (isValid) {
PlantsRentalOrderBo order = new PlantsRentalOrderBo();
order.setProductIds(ids.stream().toList());
List<PlantsRentalOrderVo> orderVos = rentalOrderService.queryList(order);
PlantsPlanProductBo plantsPlanProductBo = new PlantsPlanProductBo();
plantsPlanProductBo.setProductIds(ids.stream().toList());
List<PlantsPlanProductVo> planProductVos = planProductService.queryList(plantsPlanProductBo);
if(CollectionUtils.isNotEmpty(orderVos)||CollectionUtils.isNotEmpty(planProductVos)){
throw new ServiceException("当前选中绿植产品不可删除。");
}
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 扣除商品库存
*
* @param products 商品
* @return 是否扣除成功
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean deductStock(List<PlantsProductBo> products) {
Boolean flag = false;
for (PlantsProductBo product : products) {
PlantsProduct p = baseMapper.selectById(product.getId());
if (p.getInventory() >= product.getInventory()) {
p.setInventory(p.getInventory() - product.getInventory());
flag = baseMapper.updateById(p) > 0;
} else {
throw new ServiceException("绿植产品" + p.getPlantName() + "库存不足,无法租赁。");
}
}
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

@@ -1,6 +1,7 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -8,14 +9,20 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.vo.*;
import org.dromara.property.service.*;
import org.dromara.system.api.RemoteDictService;
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsRentalOrderBo;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.domain.PlantsRentalOrder;
import org.dromara.property.mapper.PlantsRentalOrderMapper;
import org.dromara.property.service.IPlantsRentalOrderService;
import java.time.YearMonth;
import java.util.*;
@@ -27,11 +34,24 @@ import java.util.*;
* @date 2025-06-30
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
private final PlantsRentalOrderMapper baseMapper;
@Autowired
private PlantsRentalOrderMapper baseMapper;
@Autowired
private RemoteDictService dictService;
@Autowired
private IPlantsProductService productService;
@Autowired
@Lazy
private IPlantsPlanProductService planProductService;
@Autowired
@Lazy
private IPlantsOrderMaintainService maintainService;
@Autowired
@Lazy
private IPlantsOrderChargeService chargeService;
/**
* 查询绿植租赁-订单管理
@@ -41,7 +61,22 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
*/
@Override
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;
}
/**
@@ -89,6 +124,8 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
lqw.eq(bo.getIsRelet() != null, PlantsRentalOrder::getIsRelet, bo.getIsRelet());
lqw.eq(bo.getContractStatus() != null, PlantsRentalOrder::getContractStatus, bo.getContractStatus());
lqw.eq(bo.getSignTime() != null, PlantsRentalOrder::getSignTime, bo.getSignTime());
lqw.in(CollectionUtils.isNotEmpty(bo.getProductIds()),PlantsRentalOrder::getProductId,bo.getProductIds());
lqw.in(CollectionUtils.isNotEmpty(bo.getPlanIds()),PlantsRentalOrder::getPlanId,bo.getPlanIds());
return lqw;
}
@@ -101,7 +138,7 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
@Override
public Boolean insertByBo(PlantsRentalOrderBo bo) {
PlantsRentalOrder add = MapstructUtils.convert(bo, PlantsRentalOrder.class);
validEntityBeforeSave(add);
validEntityBeforeSave(bo);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
@@ -120,15 +157,32 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
@Override
public Boolean updateByBo(PlantsRentalOrderBo bo) {
PlantsRentalOrder update = MapstructUtils.convert(bo, PlantsRentalOrder.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(PlantsRentalOrder entity) {
//TODO 做一些数据校验,如唯一约束
private void validEntityBeforeSave(PlantsRentalOrderBo bo) {
//租赁方式 1单点 2套餐
if ("1".equals(bo.getRentalType())) {
if (bo.getProductId() != null&&bo.getProductNum()!=null) {
ArrayList<PlantsProductBo> products = new ArrayList<>();
PlantsProductBo plantsProduct = new PlantsProductBo(bo.getProductId(),bo.getProductNum());
products.add(plantsProduct);
productService.deductStock(products);
}else {
throw new ServiceException("租赁产品不能为空");
}
} else {
List<PlantsProductBo> productList = bo.getProductList();
if(CollectionUtils.isNotEmpty(productList)){
productService.deductStock(productList);
}else {
throw new ServiceException("租赁套餐不能为空");
}
}
}
/**
@@ -141,7 +195,39 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean 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;
}
@@ -197,17 +283,15 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
List<Map<String, Object>> maps = baseMapper.countByWeek();
String[] time = new String[]{"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
List<Integer> counts = new ArrayList<>(Collections.nCopies(7, 0));
for (int i = 0; i < maps.size(); i++) {
if (i == 0) {
int count = Integer.valueOf(maps.get(i).get("count").toString());
counts.set(6, count);
} else if (i + 1 < maps.size()) {
int week = Integer.valueOf(maps.get(i + 1).get("week").toString());
int count = Integer.valueOf(maps.get(i + 1).get("count").toString());
counts.set(week, count);
maps.forEach(item -> {
int week = Integer.valueOf(item.get("week").toString());
int count = Integer.valueOf(item.get("count").toString());
if (week == 1) {
counts.set(7, count);
} else if (week > 1 && week < 7) {
counts.set(week - 2, count);
}
}
});
Map<String, List> map = new HashMap<>();
map.put("time", Arrays.asList(time));
map.put("counts", counts);
@@ -216,14 +300,15 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
/**
* 统计月订单数
*
* @return
*/
public Map<String, List> countByMonth() {
List<Map<String, Object>> maps = baseMapper.countByMonth();
int days = YearMonth.now().lengthOfMonth();
List<Integer> time = new ArrayList<>();
for (int i = 1; i <=days; i++) {
time.add(i);
for (int i = 1; i <= days; i++) {
time.add(i);
}
List<Integer> counts = new ArrayList<>(Collections.nCopies(days, 0));
maps.forEach(item -> {
@@ -239,8 +324,92 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
return map;
}
/**
* 按客户类型统计订单数
*
* @return
*/
@Override
public Map<String, List> countByCusType() {
return Map.of();
List<String> type = new ArrayList<>();
List<Integer> counts = new ArrayList<>();
List<RemoteDictDataVo> typeList = dictService.selectDictDataByType("wy_khlx");
if (CollectionUtils.isNotEmpty(typeList)) {
counts.addAll(Collections.nCopies(typeList.size(), 0));
typeList.forEach(item -> {
type.add(item.getDictValue());
});
List<Map<String, Object>> maps = baseMapper.countByCusType();
maps.forEach(item -> {
String typeVal = item.get("type").toString();
int index = type.indexOf(typeVal);
int count = Integer.valueOf(item.get("count").toString());
counts.set(index, count);
});
}
Map<String, List> map = new HashMap<>();
map.put("type", type);
map.put("counts", counts);
return map;
}
/**
* 客户续租率统计
*
* @return
*/
@Override
public Map<String, List> countRenewRate() {
List<String> monthList = new ArrayList<>();
for (int i = 1; i <= 12; i++) {
monthList.add(i + "");
}
List<Integer> rateList = new ArrayList<>(Collections.nCopies(12, 0));
List<Map<String, Object>> maps = baseMapper.countRenewRate();
maps.forEach(item -> {
int month = Integer.valueOf(item.get("month").toString());
int index = monthList.indexOf(month + "");
int rate = Integer.valueOf(item.get("rate").toString());
rateList.set(index, rate);
});
Map<String, List> map = new HashMap<>();
map.put("month", monthList);
map.put("rate", rateList);
return map;
}
/**
* 按租赁方式统计订单数
*
* @return
*/
@Override
public List<Map<String, Object>> countByRentalType() {
List<Map<String, Object>> maps = baseMapper.countByRentalType();
return maps;
}
/**
* 统计订单总数和租赁金额总数
*
* @return
*/
@Override
public Map<String, Object> countOrderAndAmount() {
return baseMapper.countOrderAndAmount();
}
/**
* 统计下单客户总数
* @return
*/
@Override
public Map<String, Integer> countCustomers() {
LambdaQueryWrapper<PlantsRentalOrder> lqw = Wrappers.lambdaQuery();
lqw.groupBy(PlantsRentalOrder::getCustomerName);
Map<String, Integer> map = new HashMap<>();
map.put("count",baseMapper.selectVoList(lqw).size());
return map;
}
}

View File

@@ -1,6 +1,7 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -11,9 +12,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.PlantsPlanProduct;
import org.dromara.property.domain.bo.PlantsPlanProductBo;
import org.dromara.property.domain.bo.PlantsRentalOrderBo;
import org.dromara.property.domain.vo.PlantsPlanProductVo;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.property.service.IPlantsPlanProductService;
import org.dromara.property.service.IPlantsProductService;
import org.dromara.property.service.IPlantsRentalOrderService;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsRentalPlanBo;
import org.dromara.property.domain.vo.PlantsRentalPlanVo;
@@ -38,6 +43,8 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
private final IPlantsPlanProductService planProductService;
private final IPlantsRentalOrderService rentalOrderService;
/**
* 查询绿植租赁-租赁方案
*
@@ -105,12 +112,13 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
if (flag) {
Long planId = add.getId();
bo.setId(planId);
if(CollectionUtils.isNotEmpty(bo.getProductIds())){
if(CollectionUtils.isNotEmpty(bo.getProductList())){
List<PlantsPlanProduct> list = new ArrayList<>();
for (Long productId : bo.getProductIds()) {
for (PlantsPlanProductBo planProductBo : bo.getProductList()) {
PlantsPlanProduct planProduct = new PlantsPlanProduct();
planProduct.setPlanId(planId);
planProduct.setProductId(productId);
planProduct.setProductId(planProductBo.getProductId());
planProduct.setProductNum(planProductBo.getProductNum());
list.add(planProduct);
}
planProductService.saveBatch(list);
@@ -129,12 +137,13 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
public Boolean updateByBo(PlantsRentalPlanBo bo) {
PlantsRentalPlan update = MapstructUtils.convert(bo, PlantsRentalPlan.class);
validEntityBeforeSave(update);
if(CollectionUtils.isNotEmpty(bo.getProductIds())){
if(CollectionUtils.isNotEmpty(bo.getProductList())){
List<PlantsPlanProduct> list = new ArrayList<>();
for (Long productId : bo.getProductIds()) {
for (PlantsPlanProductBo planProductBo : bo.getProductList()) {
PlantsPlanProduct planProduct = new PlantsPlanProduct();
planProduct.setPlanId(update.getId());
planProduct.setProductId(productId);
planProduct.setProductId(planProductBo.getProductId());
planProduct.setProductNum(planProductBo.getProductNum());
list.add(planProduct);
}
planProductService.updateByPlanId(list,update.getId());
@@ -159,7 +168,12 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
PlantsRentalOrderBo plantsRentalOrderBo = new PlantsRentalOrderBo();
plantsRentalOrderBo.setPlanIds(ids.stream().toList());
List<PlantsRentalOrderVo> plantsRentalOrderVos = rentalOrderService.queryList(plantsRentalOrderBo);
if(CollectionUtils.isNotEmpty(plantsRentalOrderVos)){
throw new ServiceException("当前选中租赁方案不可删除");
}
}
return baseMapper.deleteByIds(ids) > 0;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.property.mapper.MeetPictureMapper">
</mapper>

View File

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

View File

@@ -98,7 +98,7 @@ public class SisPersonLibImgController extends BaseController {
*/
@SaCheckPermission("sis:personLibImg:remove")
@Log(title = "人像信息", businessType = BusinessType.DELETE)
@DeleteMapping("del/{ids}")
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable("ids") Long[] ids) {
return toAjax(tbPersonLibImgService.deleteWithValidByIds(List.of(ids), true));

View File

@@ -41,7 +41,7 @@ public class SisPersonLibImgBo extends BaseEntity {
/**
* 图片ossId
*/
@NotBlank(message = "图片ossId不能为空", groups = {AddGroup.class, EditGroup.class})
@NotNull(message = "图片ossId不能为空", groups = {AddGroup.class, EditGroup.class})
private Long imgOssId;
/**

View File

@@ -1,10 +1,10 @@
package org.dromara.sis.service.impl;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
@@ -30,11 +30,10 @@ import org.dromara.sis.sdk.unview.model.UvModel;
import org.dromara.sis.service.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* 授权记录Service业务层处理
@@ -182,7 +181,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
// 宇视添加人像
UvModel.AddPersonParams addPersonParams = new UvModel.AddPersonParams();
addPersonParams.setPerson_name(imgVo.getImgName());
addPersonParams.setImage_base64(Base64.getEncoder().encodeToString(imageByte));
addPersonParams.setImage_base64(base64Helper(imageByte));
addPersonParams.setLib_id(Math.toIntExact(eqp_lib_id));
addPersonParams.setSex(imgVo.getSex());
addPersonParams.setEmail(imgVo.getEmail());
@@ -195,7 +194,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
eqp_lib_img_id = addResult.getPerson_id();
} else {
UvModel.WorkClothesInfo addResult = unViewAiBoxApi.addWorkClothes(systemInfo, Math.toIntExact(eqp_lib_id), Base64.getEncoder().encodeToString(imageByte));
UvModel.WorkClothesInfo addResult = unViewAiBoxApi.addWorkClothes(systemInfo, Math.toIntExact(eqp_lib_id), base64Helper(imageByte));
eqp_lib_img_id = addResult.getWorkclothes_id();
}
Assert.notNull(eqp_lib_img_id, "图片上传宇视盒子失败");
@@ -295,6 +294,21 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
return true;
}
public String base64Helper(byte[] imageByte) throws IOException {
// 1. 将字节数组解码为BufferedImage对象
ByteArrayInputStream bis = new ByteArrayInputStream(imageByte);
// 2. 将图片重新编码为JPG格式的字节数组
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImgUtil.convert(bis, "jpg", bos);
byte[] jpgBytes = bos.toByteArray();
// 3. 将JPG字节数组转为Base64字符串
return Base64.getEncoder().encodeToString(jpgBytes);
}
@Override
public Boolean singleAuth(SingleAuthRecordBo bo) {
return null;