diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CostHouseChargeController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CostHouseChargeController.java index ee46a9c6..eb37a544 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CostHouseChargeController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CostHouseChargeController.java @@ -42,7 +42,7 @@ public class CostHouseChargeController extends BaseController { /** * 查询房屋收费列表 */ - @SaCheckPermission("property:houseCharge:list") + // @SaCheckPermission("property:houseCharge:list") @GetMapping("/list") public TableDataInfo list(CostHouseChargeBo bo, PageQuery pageQuery) { return costHouseChargeService.queryPageList(bo, pageQuery); @@ -85,6 +85,10 @@ public class CostHouseChargeController extends BaseController { public R returnFree( @RequestBody CostChargeReturnFeeBo bo) { return toAjax(costHouseChargeService.returnFree(bo)); } + @PostMapping("/addFee") + public R addFee( @RequestBody CostHouseChargeBo bo) { + return toAjax(costHouseChargeService.addFee(bo)); + } /** * 修改房屋收费 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/PlantsRentalOrderController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/PlantsRentalOrderController.java index ed12bc2f..30088593 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/PlantsRentalOrderController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/PlantsRentalOrderController.java @@ -39,6 +39,7 @@ public class PlantsRentalOrderController extends BaseController { private final IPlantsRentalOrderService plantsRentalOrderService; + /** * 查询绿植租赁-订单管理列表 */ @@ -47,7 +48,13 @@ public class PlantsRentalOrderController extends BaseController { public TableDataInfo list(PlantsRentalOrderBo bo, PageQuery pageQuery) { return plantsRentalOrderService.queryPageList(bo, pageQuery); } - + /** + * 查询绿植租赁-订单管理列表 + */ + @GetMapping("/notSelectList") + public R> notSelectList() { + return R.ok(plantsRentalOrderService.notSelectList()); + } /** * 导出绿植租赁-订单管理列表 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanController.java index 405073fc..5d21082e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanController.java @@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.property.domain.vo.TbRoomVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.dromara.common.idempotent.annotation.RepeatSubmit; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanOrderController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanOrderController.java index f04ce659..b563c596 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanOrderController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/cleanOrder/CleanOrderController.java @@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; import org.dromara.property.domain.bo.CleanOrderRecordBo; +import org.dromara.property.domain.vo.TbRoomVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.dromara.common.idempotent.annotation.RepeatSubmit; @@ -69,7 +70,11 @@ public class CleanOrderController extends BaseController { @PathVariable("id") Long id) { return R.ok(cleanOrderService.queryById(id)); } - + @GetMapping("/residentUnitId/{residentUnitId}") + public R> getRoomList(@NotNull(message = "主键不能为空") + @PathVariable("residentUnitId") Long residentUnitId) { + return R.ok(cleanOrderService.getRoomList(residentUnitId)); + } /** * 新增保洁订单 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Clean.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Clean.java index 48f199b1..5b1f04a1 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Clean.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/Clean.java @@ -43,9 +43,14 @@ public class Clean extends TenantEntity { private String cleanContent; /** - * 保洁面积 + * 房间id */ - private Double area; + private String roomId; + /** + * 房间id + */ + @TableField(exist = false) + private String roomText; /** * 计算方式 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostHouseCharge.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostHouseCharge.java index a06302dc..57047311 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostHouseCharge.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostHouseCharge.java @@ -39,6 +39,14 @@ public class CostHouseCharge extends TenantEntity { * 面积 */ private Float area; + /** + * 订单id + */ + private Long orderId; + /** + * 类型 + */ + private String type; /** * 业主 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostItems.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostItems.java index 9e45b3df..e3c2aee0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostItems.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CostItems.java @@ -58,9 +58,9 @@ public class CostItems extends TenantEntity { private Integer chargeCycle; /** - * 是否手机缴费 + * 缴费方式(1微信、2支付宝、3银联、4现金) */ - private String isMobilePay; + private String paymentMode; /** * 进位方式 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsOrderCharge.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsOrderCharge.java index 1630f160..e8f95424 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsOrderCharge.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsOrderCharge.java @@ -1,5 +1,8 @@ package org.dromara.property.domain; +import jakarta.validation.constraints.NotBlank; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; import org.dromara.common.mybatis.core.domain.BaseEntity; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; @@ -35,7 +38,10 @@ public class PlantsOrderCharge extends BaseEntity { * 订单id */ private Long orderId; - + /** + * 入驻单位id + */ + private Long residentUnitId; /** * 租赁人id(系统用户) */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsRentalOrder.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsRentalOrder.java index 515bcff4..fb24909d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsRentalOrder.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/PlantsRentalOrder.java @@ -40,6 +40,10 @@ public class PlantsRentalOrder extends BaseEntity { * 客户名称 */ private String customerName; + /** + * 入驻单位id + */ + private Long residentUnitId; /** * 客户类型 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java index 647c7b59..e1f3a3f9 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostHouseChargeBo.java @@ -45,10 +45,11 @@ public class CostHouseChargeBo extends BaseEntity { /** * 业主 */ - @NotNull(message = "业主不能为空", groups = { AddGroup.class, EditGroup.class }) + //@NotNull(message = "业主不能为空", groups = { AddGroup.class, EditGroup.class }) private Long personId; - + private String costType; + private String type; /** * 收费项目 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostItemsBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostItemsBo.java index 4cde0894..74c2d70f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostItemsBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CostItemsBo.java @@ -67,9 +67,10 @@ public class CostItemsBo extends BaseEntity { private Integer chargeCycle; /** - * 是否手机缴费 + * 缴费方式(1微信、2支付宝、3银联、4现金) */ - private String isMobilePay; + //@NotBlank(message = "缴费方式不能为空", groups = { AddGroup.class, EditGroup.class }) + private String paymentMode; /** * 进位方式 @@ -91,7 +92,7 @@ public class CostItemsBo extends BaseEntity { /** * 计算公式 */ - @NotBlank(message = "计算公式不能", groups = { AddGroup.class, EditGroup.class }) + @NotBlank(message = "计算公式不能为空", groups = { AddGroup.class, EditGroup.class }) private String formula; /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsOrderChargeBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsOrderChargeBo.java index 128cd027..8b122542 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsOrderChargeBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsOrderChargeBo.java @@ -36,11 +36,15 @@ public class PlantsOrderChargeBo extends BaseEntity { */ @NotNull(message = "订单id不能为空", groups = { AddGroup.class, EditGroup.class }) private Long orderId; - + /** + * 入驻单位id + */ + // @NotNull(message = "入驻单位不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long residentUnitId; /** * 租赁人id(系统用户) */ - @NotNull(message = "租赁人id(系统用户)不能为空", groups = { AddGroup.class, EditGroup.class }) + //@NotNull(message = "租赁人id(系统用户)不能为空", groups = { AddGroup.class, EditGroup.class }) private Long userId; /** diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsRentalOrderBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsRentalOrderBo.java index c9f45144..9bf1579c 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsRentalOrderBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/PlantsRentalOrderBo.java @@ -45,7 +45,11 @@ public class PlantsRentalOrderBo extends BaseEntity { */ @NotBlank(message = "客户名称不能为空", groups = { AddGroup.class, EditGroup.class }) private String customerName; - + /** + * 入驻单位id + */ + // @NotNull(message = "入驻单位不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long residentUnitId; /** * 客户类型 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/cleanOrderBo/CleanBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/cleanOrderBo/CleanBo.java index c50315f2..50b29eda 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/cleanOrderBo/CleanBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/cleanOrderBo/CleanBo.java @@ -46,10 +46,10 @@ public class CleanBo extends BaseEntity { @NotBlank(message = "计量单位不能为空", groups = { AddGroup.class, EditGroup.class }) private String measure; -// /** -// * 保洁面积 -// */ -// private Long area; + /** + * 房间id + */ + private String roomId; /** * 保洁内容 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/FeeTypeEnum.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/FeeTypeEnum.java new file mode 100644 index 00000000..549ce070 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/enums/FeeTypeEnum.java @@ -0,0 +1,40 @@ +package org.dromara.property.domain.enums; + +public enum FeeTypeEnum { + PROPERTY_MANAGEMENT_FEE("0", "物业管理费"), + MEETING_ROOM_USAGE_FEE("1", "会议室使用费"), + PARKING_FEE("2", "停车费"), + GREEN_PLANT_RENTAL_FEE("3", "绿植租赁费"), + CLEANING_SERVICE_FEE("4", "保洁服务费"), + WATER_FEE("5", "水费"), + ELECTRICITY_FEE("6", "电费"), + RENT("7", "租金"), + GAS_FEE("8", "气费"), + DEPOSIT("9", "押金"); + + private String code; + private String description; + + FeeTypeEnum(String code, String description) { + this.code = code; + this.description = description; + } + + public String getCode() { + return code; + } + + public String getDescription() { + return description; + } + + // 根据 code 获取对应的枚举 + public static FeeTypeEnum fromCode(String code) { + for (FeeTypeEnum feeType : FeeTypeEnum.values()) { + if (feeType.getCode().equals(code)) { + return feeType; + } + } + throw new IllegalArgumentException("Invalid FeeType code: " + code); + } +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeDetailVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeDetailVo.java index bea395c3..179c0ec2 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeDetailVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeDetailVo.java @@ -42,7 +42,14 @@ public class CostHouseChargeDetailVo implements Serializable { * 入驻文本 */ private String residentUnitText; - + /** + * 订单id + */ + private Long orderId; + /** + * 类型 + */ + private String type; /** * 面积 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeVo.java index 833121ef..5c7addfc 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostHouseChargeVo.java @@ -37,10 +37,20 @@ public class CostHouseChargeVo implements Serializable { /** * 主键 */ - @ExcelProperty(value = "主键") + // @ExcelProperty(value = "主键") private Long id; - - + /** + * 费用类型 + */ + private String costType; + /** + * 订单id + */ + private Long orderId; + /** + * 类型 + */ + private String type; /** * 入驻单位 */ @@ -65,13 +75,19 @@ public class CostHouseChargeVo implements Serializable { /** * 收费项目 */ - @ExcelProperty(value = "收费项目") private Long costItemsId; + /** + * 收费项目Text + */ + @ExcelProperty(value = "收费项目") + private String chargeItemText; + /** * 支付方式 */ - @ExcelProperty(value = "支付方式") + @ExcelProperty(value = "支付方式", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "wy_zffs") private String payType; /** @@ -116,7 +132,7 @@ public class CostHouseChargeVo implements Serializable { /** * 搜索值 */ - @ExcelProperty(value = "搜索值") + // @ExcelProperty(value = "搜索值") private String searchValue; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostItemsVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostItemsVo.java index e2ed7ba5..1177858c 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostItemsVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CostItemsVo.java @@ -71,10 +71,9 @@ public class CostItemsVo implements Serializable { private Integer chargeCycle; /** - * 是否手机缴费 + * 缴费方式(1微信、2支付宝、3银联、4现金) */ - @ExcelProperty(value = "是否手机缴费") - private String isMobilePay; + private String paymentMode; /** * 进位方式 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsOrderChargeVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsOrderChargeVo.java index 8d2da1a0..d03af3a0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsOrderChargeVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsOrderChargeVo.java @@ -6,6 +6,9 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; import org.dromara.property.domain.PlantsOrderCharge; import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelProperty; @@ -50,9 +53,17 @@ public class PlantsOrderChargeVo implements Serializable { * 租赁人id(系统用户) */ @ExcelProperty(value = "租赁人id", converter = ExcelDictConvert.class) - @ExcelDictFormat(readConverterExp = "系=统用户") + @ExcelDictFormat(readConverterExp = "系统用户") private Long userId; - + /** + * 入驻单位id + */ + private Long residentUnitId; + /** + * 入驻单位 + */ + @ExcelProperty(value = "入驻单位") + private String residentUnitText; /** * 租赁人名称 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsRentalOrderVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsRentalOrderVo.java index 571f7582..1c269646 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsRentalOrderVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/PlantsRentalOrderVo.java @@ -49,6 +49,15 @@ public class PlantsRentalOrderVo implements Serializable { */ @ExcelProperty(value = "客户名称") private String customerName; + /** + * 入驻单位id + */ + private Long residentUnitId; + /** + * 入驻单位text + */ + @ExcelProperty(value = "入驻单位") + private String residentUnitText; /** * 客户类型 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/cleanOrderVo/CleanVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/cleanOrderVo/CleanVo.java index 5c327911..c677b24f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/cleanOrderVo/CleanVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/cleanOrderVo/CleanVo.java @@ -43,10 +43,10 @@ public class CleanVo implements Serializable { @ExcelProperty(value = "计量单位") private String measure; -// /** -// * 保洁面积 -// */ -// private Long area; + /** + * 房间id + */ + private String roomId; /** * 计算方式 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java index 8509c52d..ec71d855 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/residentVo/ResidentUnitVo.java @@ -95,6 +95,10 @@ public class ResidentUnitVo implements Serializable { * 建筑面积(房间建筑面积和,平方千米) */ private Float area; + /** + * 房间数 + */ + private Integer roomNumber; /** * 备注 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICostHouseChargeService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICostHouseChargeService.java index 3b8836ab..254a4c6e 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICostHouseChargeService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICostHouseChargeService.java @@ -75,4 +75,6 @@ public interface ICostHouseChargeService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + Boolean addFee(CostHouseChargeBo bo); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IPlantsRentalOrderService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IPlantsRentalOrderService.java index b59bfd42..391350db 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IPlantsRentalOrderService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IPlantsRentalOrderService.java @@ -107,5 +107,9 @@ public interface IPlantsRentalOrderService { */ Map countCustomers(); - + /** + * 查询未生成收费的订单 + * @return + */ + List notSelectList(); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanOrderService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanOrderService.java index 20601470..06fb6907 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanOrderService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanOrderService.java @@ -1,6 +1,8 @@ package org.dromara.property.service.cleanOrderService; +import jakarta.validation.constraints.NotNull; import org.dromara.property.domain.bo.CleanOrderRecordBo; +import org.dromara.property.domain.vo.TbRoomVo; import org.dromara.property.domain.vo.cleanOrderVo.CleanOrderVo; import org.dromara.property.domain.bo.cleanOrderBo.CleanOrderBo; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -73,4 +75,5 @@ public interface ICleanOrderService { * @return */ int assign(CleanOrderBo bo); + List getRoomList(@NotNull(message = "主键不能为空") Long residentUnitId); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanService.java index ffd4ae8b..b4ca2bb0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/cleanOrderService/ICleanService.java @@ -1,5 +1,7 @@ package org.dromara.property.service.cleanOrderService; +import jakarta.validation.constraints.NotNull; +import org.dromara.property.domain.vo.TbRoomVo; import org.dromara.property.domain.vo.cleanOrderVo.CleanVo; import org.dromara.property.domain.bo.cleanOrderBo.CleanBo; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -65,4 +67,6 @@ public interface ICleanService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java index 01f9a82a..6f56ea4b 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostHouseChargeServiceImpl.java @@ -17,6 +17,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.dromara.property.domain.*; import org.dromara.property.domain.bo.CostChargeReturnFeeBo; +import org.dromara.property.domain.bo.CostItemsBo; import org.dromara.property.domain.entity.resident.ResidentPerson; import org.dromara.property.domain.enums.ChargeStatusEnum; import org.dromara.property.domain.vo.*; @@ -31,9 +32,11 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.math.RoundingMode; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.stream.Collectors; /** * 房屋收费Service业务层处理 @@ -89,15 +92,26 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { LambdaQueryWrapper lqw = buildQueryWrapper(bo); List residentPeoplelist = residentPersonMapper.selectList(); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - result.getRecords().stream().forEach(s -> { - if (CollUtil.isNotEmpty(residentPeoplelist)) { - ResidentPerson residentPerson = residentPeoplelist.stream() - .filter(vo -> vo.getId() != null && vo.getId().equals(s.getPersonId())).findFirst().orElse(null); - s.setPersonName(ObjectUtil.isNotEmpty(residentPerson) ? residentPerson.getUserName() : null); - ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(s.getResidentUnitId()); - s.setResidentUnitText(ObjectUtil.isNotEmpty(residentUnitVo) ? residentUnitVo.getName() : null); - } - }); + if (CollUtil.isNotEmpty(result.getRecords())) { + List itemIdList = result.getRecords().stream().map(vo -> vo.getCostItemsId()).distinct().collect(Collectors.toList()); + List itemsVos = costItemsMapper.selectVoByIds(itemIdList).stream().collect(Collectors.toList()); + result.getRecords().stream().forEach(s -> { + if (CollUtil.isNotEmpty(residentPeoplelist)) { + ResidentPerson residentPerson = residentPeoplelist.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getPersonId())).findFirst().orElse(null); + s.setPersonName(ObjectUtil.isNotEmpty(residentPerson) ? residentPerson.getUserName() : null); + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(s.getResidentUnitId()); + s.setResidentUnitText(ObjectUtil.isNotEmpty(residentUnitVo) ? residentUnitVo.getName() : null); + // 收费符合项目 + itemsVos.stream().forEach(vo -> { + if (vo.getId().equals(s.getCostItemsId())) { + s.setChargeItemText(vo.getChargeItem()); + s.setCostType(vo.getCostType()); + } + }); + } + }); + } return TableDataInfo.build(result); } @@ -110,16 +124,41 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { @Override public List queryList(CostHouseChargeBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + List costHouseChargeVos = baseMapper.selectVoList(lqw); + if (CollUtil.isNotEmpty(costHouseChargeVos)) { + List itemIdList = costHouseChargeVos.stream().map(vo -> vo.getCostItemsId()).distinct().collect(Collectors.toList()); + Map itemMap = costItemsMapper.selectVoByIds(itemIdList).stream().collect(Collectors.toMap(CostItemsVo::getId, CostItemsVo::getChargeItem)); + costHouseChargeVos.stream().forEach(s -> { + ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(s.getPersonId()); + s.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo) ? residentPersonVo.getUserName() : null); + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(s.getResidentUnitId()); + s.setResidentUnitText(ObjectUtil.isNotEmpty(residentUnitVo) ? residentUnitVo.getName() : null); + s.setChargeItemText(itemMap.get(s.getCostItemsId())); + }); + } + return costHouseChargeVos; } private LambdaQueryWrapper buildQueryWrapper(CostHouseChargeBo bo) { Map params = bo.getParams(); + //查询费用 项目 + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.orderByDesc(CostHouseCharge::getCreateTime) .orderByDesc(CostHouseCharge::getUpdateTime); + List itemIdList = new ArrayList<>(); + if(ObjectUtil.isNotEmpty(bo.getCostType())){ + List costItemsVos = costItemsMapper.selectVoList( + new LambdaQueryWrapper() + .eq(CostItems::getCostType, bo.getCostType()) + ); + //收集项目id + itemIdList = costItemsVos.stream().map(vo -> vo.getId()).distinct().collect(Collectors.toList()); + } + lqw.in(CollUtil.isNotEmpty(itemIdList), CostHouseCharge::getCostItemsId, itemIdList ); lqw.eq(bo.getResidentUnitId() != null, CostHouseCharge::getResidentUnitId, bo.getResidentUnitId()); lqw.eq(bo.getCostItemsId() != null, CostHouseCharge::getCostItemsId, bo.getCostItemsId()); + lqw.eq(bo.getType()!= null, CostHouseCharge::getType, bo.getType()); lqw.eq(StringUtils.isNotBlank(bo.getChargeCycle()), CostHouseCharge::getChargeCycle, bo.getChargeCycle()); lqw.eq(bo.getAmountReceivable() != null, CostHouseCharge::getAmountReceivable, bo.getAmountReceivable()); lqw.eq(bo.getStartTime() != null, CostHouseCharge::getStartTime, bo.getStartTime()); @@ -214,7 +253,8 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { public Boolean updateByBo(CostHouseChargeBo bo) { CostHouseCharge update = MapstructUtils.convert(bo, CostHouseCharge.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; + boolean flag = baseMapper.updateById(update) > 0; + return flag; } /** @@ -239,4 +279,26 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { } return baseMapper.deleteByIds(ids) > 0; } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean addFee(CostHouseChargeBo bo) { + CostHouseCharge update = MapstructUtils.convert(bo, CostHouseCharge.class); + validEntityBeforeSave(update); + boolean flag = baseMapper.updateById(update) > 0; + if (flag) { + CostItemsVo costItemsVo = costItemsMapper.selectVoById(bo.getCostItemsId()); + //新增缴费记录 + var CostPayFeeAudit = new CostPayFeeAudit() + .setChargeId(bo.getId()) + .setChargeType("1") + .setItemId(costItemsVo.getId()) + .setStartTime(bo.getStartTime()) + .setEndTime(bo.getEndTime()) + .setReceivableAmount(bo.getAmountReceivable()) + .setState("0"); + return costPayFeeAuditMapper.insert(CostPayFeeAudit)>0; + } + return flag; + } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostItemsServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostItemsServiceImpl.java index 7aae22d4..a7d28093 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostItemsServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostItemsServiceImpl.java @@ -84,7 +84,7 @@ public class CostItemsServiceImpl implements ICostItemsService { lqw.eq(StringUtils.isNotBlank(bo.getCostMark()), CostItems::getCostMark, bo.getCostMark()); lqw.eq(StringUtils.isNotBlank(bo.getPaymentType()), CostItems::getPaymentType, bo.getPaymentType()); lqw.eq(bo.getChargeCycle() != null, CostItems::getChargeCycle, bo.getChargeCycle()); - lqw.eq(StringUtils.isNotBlank(bo.getIsMobilePay()), CostItems::getIsMobilePay, bo.getIsMobilePay()); + lqw.eq(StringUtils.isNotBlank(bo.getPaymentMode()), CostItems::getPaymentMode, bo.getPaymentMode()); lqw.eq(StringUtils.isNotBlank(bo.getRoundingMode()), CostItems::getRoundingMode, bo.getRoundingMode()); lqw.eq(StringUtils.isNotBlank(bo.getCurrencyDecimals()), CostItems::getCurrencyDecimals, bo.getCurrencyDecimals()); lqw.eq(StringUtils.isNotBlank(bo.getState()), CostItems::getState, bo.getState()); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java index d3db408c..99fd0112 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetBookingServiceImpl.java @@ -14,10 +14,10 @@ import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.property.domain.Meet; -import org.dromara.property.domain.MeetAttachOrder; -import org.dromara.property.domain.MeetBooking; +import org.dromara.property.domain.*; import org.dromara.property.domain.bo.MeetBookingBo; +import org.dromara.property.domain.enums.ChargeStatusEnum; +import org.dromara.property.domain.enums.FeeTypeEnum; import org.dromara.property.domain.vo.*; import org.dromara.property.domain.vo.BigScreen.TodayMeetCountVo; import org.dromara.property.domain.vo.residentVo.ResidentPersonVo; @@ -53,6 +53,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService { private final TbRoomMapper roomMapper; private final MeetMapper meetMapper; private final ResidentUnitMapper residentUnitMapper; + private final CostHouseChargeMapper costHouseChargeMapper; @DubboReference private RemoteUserService remoteUserService; @@ -279,9 +280,40 @@ public class MeetBookingServiceImpl implements IMeetBookingService { public Boolean updateByBo(MeetBookingBo bo) { MeetBooking update = MapstructUtils.convert(bo, MeetBooking.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; - } + boolean flag = baseMapper.updateById(update) > 0; + if(flag){ + if(bo.getState().equals(2)){ + // 检查是否已存在关联的收费记录 + boolean exists = costHouseChargeMapper.selectCount( + new LambdaQueryWrapper() + .eq(CostHouseCharge::getOrderId, bo.getId()) + ) > 0; + if (!exists) { + handleAddPay(update); + } + } + } + return flag; + } + /** + * 处理新增缴费 + */ + private void handleAddPay(MeetBooking meetBooking) { + CostHouseCharge costHouseCharge = new CostHouseCharge(); + costHouseCharge.setOrderId(meetBooking.getId()); + costHouseCharge.setResidentUnitId(Long.valueOf(meetBooking.getUnit())); + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBooking.getUnit())); + costHouseCharge.setArea(ObjectUtil.isNotEmpty(residentUnitVo)?residentUnitVo.getArea():null); + costHouseCharge.setType(FeeTypeEnum.MEETING_ROOM_USAGE_FEE.getCode()); + costHouseCharge.setChargeStatus(ChargeStatusEnum.PAYMENT_IS_SUBJECT_TO_REVIEW.getValue()); + costHouseCharge.setAmountReceivable(meetBooking.getPrice()); + + costHouseCharge.setStartTime(meetBooking.getScheduledStarttime()); + costHouseCharge.setEndTime(meetBooking.getScheduledEndtime()); + costHouseCharge.setRemark("会议室预约订单"); + costHouseChargeMapper.insert(costHouseCharge); + } /** * 保存前的数据校验 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsOrderChargeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsOrderChargeServiceImpl.java index b78d82c3..125d4f40 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsOrderChargeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsOrderChargeServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.property.service.impl; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; @@ -10,9 +12,16 @@ 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.CostHouseCharge; import org.dromara.property.domain.Meet; import org.dromara.property.domain.PlantsOrderMaintain; +import org.dromara.property.domain.bo.cleanOrderBo.CleanOrderBo; +import org.dromara.property.domain.enums.ChargeStatusEnum; +import org.dromara.property.domain.enums.FeeTypeEnum; import org.dromara.property.domain.vo.PlantsRentalOrderVo; +import org.dromara.property.domain.vo.residentVo.ResidentUnitVo; +import org.dromara.property.mapper.CostHouseChargeMapper; +import org.dromara.property.mapper.ResidentUnitMapper; import org.dromara.property.service.IPlantsRentalOrderService; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.PlantsOrderChargeBo; @@ -21,6 +30,7 @@ import org.dromara.property.domain.PlantsOrderCharge; import org.dromara.property.mapper.PlantsOrderChargeMapper; import org.dromara.property.service.IPlantsOrderChargeService; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.Collection; @@ -37,7 +47,8 @@ import java.util.Collection; public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService { private final PlantsOrderChargeMapper baseMapper; - + private final ResidentUnitMapper residentUnitMapper; + private final CostHouseChargeMapper costHouseChargeMapper; private final IPlantsRentalOrderService plantsRentalOrderService; /** * 查询绿植租赁-订单收费 @@ -52,6 +63,11 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService { PlantsRentalOrderVo orderVo = plantsRentalOrderService.queryById(orderChargeVo.getOrderId()); orderChargeVo.setRentalOrder(orderVo); } + //查询入驻单位名称 + if(ObjectUtil.isNotEmpty(orderChargeVo.getResidentUnitId())){ + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(orderChargeVo.getResidentUnitId()); + orderChargeVo.setResidentUnitText(ObjectUtil.isNotEmpty(residentUnitVo)?residentUnitVo.getName() : null); + } return orderChargeVo; } @@ -118,10 +134,37 @@ public class PlantsOrderChargeServiceImpl implements IPlantsOrderChargeService { boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); + // 检查是否已存在关联的收费记录 + boolean exists = costHouseChargeMapper.selectCount( + new LambdaQueryWrapper() + .eq(CostHouseCharge::getOrderId, bo.getId()) + ) > 0; + if (!exists) { + handleAddPay(add); + } } return flag; } + /** + * 处理新增缴费 + */ + private void handleAddPay(PlantsOrderCharge plantsOrderCharge) { + CostHouseCharge costHouseCharge = new CostHouseCharge(); + costHouseCharge.setOrderId(plantsOrderCharge.getId()); + costHouseCharge.setResidentUnitId(plantsOrderCharge.getResidentUnitId()); + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(plantsOrderCharge.getResidentUnitId()); + costHouseCharge.setArea(ObjectUtil.isNotEmpty(residentUnitVo)?residentUnitVo.getArea():null); + costHouseCharge.setType(FeeTypeEnum.GREEN_PLANT_RENTAL_FEE.getCode()); + costHouseCharge.setChargeStatus(ChargeStatusEnum.PAYMENT_IS_SUBJECT_TO_REVIEW.getValue()); + costHouseCharge.setAmountReceivable(plantsOrderCharge.getTotalAmount()); + //查询订单详情 + PlantsRentalOrderVo orderVo = plantsRentalOrderService.queryById(plantsOrderCharge.getOrderId()); + costHouseCharge.setStartTime(orderVo.getStartTime()); + costHouseCharge.setEndTime(orderVo.getEndTime()); + costHouseCharge.setRemark("绿植订单"); + costHouseChargeMapper.insert(costHouseCharge); + } /** * 修改绿植租赁-订单收费 * diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsRentalOrderServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsRentalOrderServiceImpl.java index cd3d98d9..489ad969 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsRentalOrderServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/PlantsRentalOrderServiceImpl.java @@ -1,6 +1,9 @@ package org.dromara.property.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import lombok.RequiredArgsConstructor; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; @@ -15,6 +18,9 @@ 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.domain.vo.residentVo.ResidentUnitVo; +import org.dromara.property.mapper.PlantsOrderChargeMapper; +import org.dromara.property.mapper.ResidentUnitMapper; import org.dromara.property.service.*; import org.dromara.system.api.RemoteDictService; import org.dromara.system.api.domain.vo.RemoteDictDataVo; @@ -27,6 +33,7 @@ import org.dromara.property.mapper.PlantsRentalOrderMapper; import java.time.YearMonth; import java.util.*; +import java.util.stream.Collectors; /** * 绿植租赁-订单管理Service业务层处理 @@ -35,24 +42,27 @@ import java.util.*; * @date 2025-06-30 */ @Slf4j +@RequiredArgsConstructor @Service public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { @Autowired - private PlantsRentalOrderMapper baseMapper; + private PlantsRentalOrderMapper baseMapper; @Autowired - private RemoteDictService dictService; + private RemoteDictService dictService; @Autowired - private IPlantsProductService productService; + private IPlantsProductService productService; @Autowired @Lazy - private IPlantsPlanProductService planProductService; + private IPlantsPlanProductService planProductService; @Autowired @Lazy - private IPlantsOrderMaintainService maintainService; + private IPlantsOrderMaintainService maintainService; @Autowired @Lazy - private IPlantsOrderChargeService chargeService; + private IPlantsOrderChargeService chargeService; + private final ResidentUnitMapper residentUnitMapper; + private final PlantsOrderChargeMapper plantsOrderChargeMapper; /** * 查询绿植租赁-订单管理 @@ -64,11 +74,11 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { public PlantsRentalOrderVo queryById(Long id) { PlantsRentalOrderVo orderVo = baseMapper.selectVoById(id); ArrayList list = new ArrayList<>(); - if("1".equals(orderVo.getRentalType())){ + if ("1".equals(orderVo.getRentalType())) { PlantsProductVo productVo = productService.queryById(orderVo.getProductId()); productVo.setPlanProNumber(orderVo.getProductNum()); list.add(productVo); - }else { + } else { List planProductVos = planProductService.queryPlanProductsInfo(orderVo.getPlanId()); for (PlantsPlanProductVo planProductVo : planProductVos) { PlantsProductVo product = planProductVo.getProduct(); @@ -76,6 +86,12 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { list.add(product); } } + //查询入驻单位名称 + if (ObjectUtil.isNotEmpty(orderVo.getResidentUnitId())) { + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(orderVo.getResidentUnitId()); + orderVo.setResidentUnitText(ObjectUtil.isNotEmpty(residentUnitVo) ? residentUnitVo.getName() : null); + } + orderVo.setProductList(list); return orderVo; } @@ -126,8 +142,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()); + lqw.in(CollectionUtils.isNotEmpty(bo.getProductIds()), PlantsRentalOrder::getProductId, bo.getProductIds()); + lqw.in(CollectionUtils.isNotEmpty(bo.getPlanIds()), PlantsRentalOrder::getPlanId, bo.getPlanIds()); return lqw; } @@ -168,19 +184,19 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { private void validEntityBeforeSave(PlantsRentalOrderBo bo) { //租赁方式 1单点 2套餐 if ("1".equals(bo.getRentalType())) { - if (bo.getProductId() != null&&bo.getProductNum()!=null) { + if (bo.getProductId() != null && bo.getProductNum() != null) { ArrayList products = new ArrayList<>(); - PlantsProductBo plantsProduct = new PlantsProductBo(bo.getProductId(),bo.getProductNum()); + PlantsProductBo plantsProduct = new PlantsProductBo(bo.getProductId(), bo.getProductNum()); products.add(plantsProduct); productService.deductStock(products); - }else { + } else { throw new ServiceException("租赁产品不能为空"); } } else { List productList = bo.getProductList(); - if(CollectionUtils.isNotEmpty(productList)){ + if (CollectionUtils.isNotEmpty(productList)) { productService.deductStock(productList); - }else { + } else { throw new ServiceException("租赁套餐不能为空"); } } @@ -204,28 +220,28 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { PlantsOrderMaintainBo maintainBo = new PlantsOrderMaintainBo(); maintainBo.setOrderIds(ids.stream().toList()); List maintainList = maintainService.queryList(maintainBo); - if(CollectionUtils.isNotEmpty(maintainList)||CollectionUtils.isNotEmpty(chargeList)){ - throw new ServiceException("所选订单不可删除"); - }else { + if (CollectionUtils.isNotEmpty(maintainList) || CollectionUtils.isNotEmpty(chargeList)) { + throw new ServiceException("所选订单不可删除"); + } else { //恢复产品库存 ArrayList productList = new ArrayList<>(); for (Long id : ids) { PlantsRentalOrder order = baseMapper.selectById(id); - if("1".equals(order.getRentalType())){ + if ("1".equals(order.getRentalType())) { Long productId = order.getProductId(); Integer productNum = order.getProductNum(); - productList.add(new PlantsProductBo(productId,productNum)); - }else { + productList.add(new PlantsProductBo(productId, productNum)); + } else { Long planId = order.getPlanId(); List planProductVos = planProductService.queryPlanProductsInfo(planId); for (PlantsPlanProductVo planProductVo : planProductVos) { - productList.add(new PlantsProductBo(planProductVo.getProductId(),planProductVo.getProductNum())); + productList.add(new PlantsProductBo(planProductVo.getProductId(), planProductVo.getProductNum())); } } } - if(CollectionUtils.isNotEmpty(productList)){ + if (CollectionUtils.isNotEmpty(productList)) { Boolean b = productService.addStock(productList); - if(!b){ + if (!b) { throw new ServiceException("删除订单失败。"); } } @@ -404,13 +420,29 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService { /** * 统计下单客户总数 + * * @return */ @Override public Map countCustomers() { - Integer count= baseMapper.countDistinctCustomerName(); + Integer count = baseMapper.countDistinctCustomerName(); Map map = new HashMap<>(); - map.put("count",count); + map.put("count", count); return map; } + + /** + * 查询未生成收费的订单 + * + * @return + */ + @Override + public List notSelectList() { + //返回idLIst + List orderIdList = plantsOrderChargeMapper.selectVoList().stream().map(vo -> vo.getOrderId()).distinct().collect(Collectors.toList()); + LambdaQueryWrapper objectLambdaQueryWrapper = new LambdaQueryWrapper<>(); + objectLambdaQueryWrapper.notIn(CollUtil.isNotEmpty(orderIdList),PlantsRentalOrder::getId, orderIdList); + List notSelectList = baseMapper.selectVoList(objectLambdaQueryWrapper); + return notSelectList; + } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanOrderServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanOrderServiceImpl.java index 3482735d..b349c261 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanOrderServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanOrderServiceImpl.java @@ -2,6 +2,8 @@ package org.dromara.property.service.impl.cleanOrderImpl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; @@ -14,30 +16,31 @@ import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.property.domain.*; -import org.dromara.property.domain.bo.CleanOrderRecordBo; import org.dromara.property.domain.bo.cleanOrderBo.CleanOrderBo; -import org.dromara.property.domain.enums.WorkOrderStatusEnum; -import org.dromara.property.domain.vo.CleanOrderRecordVo; +import org.dromara.property.domain.enums.ChargeStatusEnum; +import org.dromara.property.domain.enums.FeeTypeEnum; +import org.dromara.property.domain.vo.TbRoomVo; import org.dromara.property.domain.vo.cleanOrderVo.CleanOrderVo; +import org.dromara.property.domain.vo.residentVo.ResidentUnitVo; import org.dromara.property.mapper.CleanOrderRecordMapper; +import org.dromara.property.mapper.CostHouseChargeMapper; +import org.dromara.property.mapper.ResidentUnitMapper; import org.dromara.property.mapper.TbRoomMapper; import org.dromara.property.mapper.cleanOrderMapper.CleanMapper; import org.dromara.property.mapper.cleanOrderMapper.CleanOrderMapper; import org.dromara.property.mapper.cleanOrderMapper.CleanRelationMapper; import org.dromara.property.mapper.cleanOrderMapper.CleanserverOrderMapper; +import org.dromara.property.service.ITbRoomService; import org.dromara.property.service.cleanOrderService.ICleanOrderService; import org.dromara.system.api.RemoteUserService; -import org.dromara.system.api.domain.vo.RemoteUserVo; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.math.BigDecimal; +import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; import static org.springframework.beans.BeanUtils.copyProperties; @@ -57,9 +60,11 @@ public class CleanOrderServiceImpl implements ICleanOrderService { private final CleanserverOrderMapper cleanserverOrderMapper; private final CleanMapper cleanMapper; - + private final ResidentUnitMapper residentUnitMapper; private final CleanRelationMapper cleanRelationMapper; + private final CostHouseChargeMapper costHouseChargeMapper; private final TbRoomMapper roomMapper; + private final ITbRoomService roomService; @DubboReference private RemoteUserService remoteUserService; @@ -82,7 +87,21 @@ public class CleanOrderServiceImpl implements ICleanOrderService { // 根据cleanserver_order表中的所有记录取出所有的cleanId查询出clean表中的所有记录 List cleanIds = cleanserverOrderList.stream().map(CleanserverOrder::getCleanServerId).collect(Collectors.toList()); List cleanList = cleanMapper.selectByIds(cleanIds); - + if(CollUtil.isNotEmpty(cleanList)){ + cleanList.stream().forEach(item -> { + if(ObjectUtil.isNotEmpty(item.getRoomId())){ + //分隔id,得到房间idlist + List roomIdList = Convert.toList(Long.class, item.getRoomId()); + //换成名称 + List roomNames = roomService.queryRoomNameList(roomIdList); + // 元素用,拼接成字符串 + if(CollUtil.isNotEmpty(roomNames)){ + String locationDetail = String.join(",", roomNames); + item.setRoomText(locationDetail); + } + } + }); + } //根据cleanserverOrderList中的所有记录取出所有的id,封装到list集合中 List cleanserverOrderIds = cleanserverOrderList.stream().map(CleanserverOrder::getId).collect(Collectors.toList()); //将查询出的cleanserverOrderIds与clean_relation比较,查出clean_relation表中的所有记录 @@ -113,11 +132,11 @@ public class CleanOrderServiceImpl implements ICleanOrderService { // Page result = baseMapper.selectForPage(pageQuery.build(), lqw); //List locationIdList = result.getRecords().stream().map(CleanOrderVo::getLocation).collect(Collectors.toList()); // Map longStringMap = roomMapper.queryRoomName(item.getLocation()); - //找出符合条件的房间名称 - result.getRecords().forEach(item -> { - String localName = roomMapper.queryRoomName(item.getLocation()); - item.setLocationName(localName != null ? localName : "未知房间"); - }); + //找出符合条件的房间名称 + result.getRecords().forEach(item -> { + String localName = roomMapper.queryRoomName(item.getLocation()); + item.setLocationName(localName != null ? localName : "未知房间"); + }); return TableDataInfo.build(result); } @@ -133,7 +152,7 @@ public class CleanOrderServiceImpl implements ICleanOrderService { return baseMapper.selectVoList(lqw); } - private LambdaQueryWrapperbuildQueryWrapper(CleanOrderBo bo) { + private LambdaQueryWrapper buildQueryWrapper(CleanOrderBo bo) { Map params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.orderByDesc(CleanOrder::getCreateTime) @@ -154,8 +173,6 @@ public class CleanOrderServiceImpl implements ICleanOrderService { lqw.eq(StringUtils.isNotBlank(bo.getPersion()), CleanOrder::getPersion, bo.getPersion()); lqw.eq(StringUtils.isNotBlank(bo.getPhone()), CleanOrder::getPhone, bo.getPhone()); //将lqw中的所有条件都封装到一个params对象中集合中 - - return lqw; } @@ -172,13 +189,15 @@ public class CleanOrderServiceImpl implements ICleanOrderService { // CleanOrder add = MapstructUtils.convert(bo, CleanOrder.class); CleanOrder add = new CleanOrder(); copyProperties(bo, add); + add.setStarTime(bo.getStarTime()); add.setEndTime(bo.getEndTime()); add.setIsUnbooking(NOTUNBOOKING); boolean flag = baseMapper.insert(add) > 0; - if (flag){ + if (flag) { bo.setId(add.getId()); - // validEntityBeforeSave(bo); + List cleans = BeanUtil.copyToList(bo.getCleanList(), Clean.class); + cleanMapper.updateBatchById(cleans); } //取出clean_order表中的所有clean数据 @@ -208,8 +227,8 @@ public class CleanOrderServiceImpl implements ICleanOrderService { CleanRelation cleanRelation = new CleanRelation(); cleanRelation.setCleanserverOrderId(cleanserverOrderIds.get(i)); cleanRelation.setCleanId(clean.getId()); - cleanRelation.setAreas(clean.getArea()); - cleanRelation.setSumPrice(clean.getPeices() * clean.getArea()); + // cleanRelation.setAreas(clean.getArea()); + cleanRelation.setSumPrice(bo.getSumPeices()); cleanRelationMapper.insert(cleanRelation); i++; } @@ -227,16 +246,49 @@ public class CleanOrderServiceImpl implements ICleanOrderService { @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CleanOrderBo bo) { CleanOrder update = MapstructUtils.convert(bo, CleanOrder.class); - // validEntityBeforeSave(update); + // validEntityBeforeSave(update); update.setStarTime(bo.getStarTime()); update.setEndTime(bo.getStarTime()); - return baseMapper.updateById(update) > 0; + boolean flag = baseMapper.updateById(update) > 0; + if (flag) { + if (bo.getState().equals(1)) { + // 检查是否已存在关联的收费记录 + boolean exists = costHouseChargeMapper.selectCount( + new LambdaQueryWrapper() + .eq(CostHouseCharge::getOrderId, update.getId()) + ) > 0; + if (!exists) { + handleAddPay(bo); + } + } + + } + return flag; + } + + /** + * 处理新增缴费 + */ + private void handleAddPay(CleanOrderBo bo) { + CostHouseCharge costHouseCharge = new CostHouseCharge(); + costHouseCharge.setOrderId(bo.getId()); + costHouseCharge.setResidentUnitId(bo.getUnitId()); + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(bo.getUnitId()); + costHouseCharge.setArea(residentUnitVo.getArea()); + costHouseCharge.setType(FeeTypeEnum.CLEANING_SERVICE_FEE.getCode()); + costHouseCharge.setChargeStatus(ChargeStatusEnum.PAYMENT_IS_SUBJECT_TO_REVIEW.getValue()); + costHouseCharge.setAmountReceivable(new BigDecimal(bo.getSumPeices())); + costHouseCharge.setStartTime(DateUtil.parse(bo.getStarTime())); + costHouseCharge.setEndTime(DateUtil.parse(bo.getEndTime())); + costHouseCharge.setRemark("保洁订单"); + costHouseChargeMapper.insert(costHouseCharge); } /** * 保存后的数据校验 */ - private void validEntityBeforeSave(CleanOrderBo bo) {} + private void validEntityBeforeSave(CleanOrderBo bo) { + } /** * 校验并批量删除保洁订单信息 @@ -253,16 +305,33 @@ public class CleanOrderServiceImpl implements ICleanOrderService { //todo:应该删除中间表中的数据 return baseMapper.deleteByIds(ids) > 0; } + /** * 指派保洁订单 + * * @param bo * @return */ @Override @Transactional(rollbackFor = Exception.class) public int assign(CleanOrderBo bo) { - CleanOrderRecord cleanOrderRecord= BeanUtil.copyProperties(bo.getCleanOrderRecord(), CleanOrderRecord.class); + CleanOrderRecord cleanOrderRecord = BeanUtil.copyProperties(bo.getCleanOrderRecord(), CleanOrderRecord.class); cleanOrderRecord.setStatus("2"); return cleanOrderRecordMapper.insert(cleanOrderRecord); } + @Override + public List getRoomList(Long residentUnitId) { + ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(residentUnitId); + //转成Long集合 + List locationList= Arrays.stream(residentUnitVo.getLocation().split(",")) + .map(String::trim) // 去除空格 + .filter(StringUtils::isNotBlank) // 过滤空字符串 + .map(Long::valueOf) // 转换为Long + .toList(); + residentUnitVo.getLocation().split(","); + return roomMapper.selectVoList( + Wrappers.lambdaQuery() + .in(TbRoom::getId, locationList) + ); + } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanServiceImpl.java index 15f5eefc..6ccf6811 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/cleanOrderImpl/CleanServiceImpl.java @@ -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.vo.TbRoomVo; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.cleanOrderBo.CleanBo; import org.dromara.property.domain.vo.cleanOrderVo.CleanVo; @@ -135,4 +136,6 @@ public class CleanServiceImpl implements ICleanService { } return baseMapper.deleteByIds(ids) > 0; } + + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/residentImpl/ResidentUnitServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/residentImpl/ResidentUnitServiceImpl.java index dc8453e3..cda25ab0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/residentImpl/ResidentUnitServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/residentImpl/ResidentUnitServiceImpl.java @@ -78,6 +78,11 @@ public class ResidentUnitServiceImpl implements IResidentUnitService { Long num = personService.queryPersonCount(residentUnitVo.getId()); residentUnitVo.setNumber(num); } + List idList = Arrays.stream(residentUnitVo.getLocation().split(",")) + .map(Long::parseLong) + .collect(Collectors.toList()); + List tbRoomVos = roomMapper.selectVoByIds(idList); + residentUnitVo.setRoomNumber(tbRoomVos.size()); return residentUnitVo; } @@ -92,6 +97,15 @@ public class ResidentUnitServiceImpl implements IResidentUnitService { public TableDataInfo queryPageList(ResidentUnitBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + if(CollUtil.isNotEmpty(result.getRecords())){ + result.getRecords().stream().forEach(s -> { + List idList = Arrays.stream(s.getLocation().split(",")) + .map(Long::parseLong) + .collect(Collectors.toList()); + List tbRoomVos = roomMapper.selectVoByIds(idList); + s.setRoomNumber(tbRoomVos.size()); + }); + } return TableDataInfo.build(result); }