From 31291b441366caf87089bca2f8ea8a14eefe0021 Mon Sep 17 00:00:00 2001 From: yuyongle <1150359267@qq.com> Date: Wed, 23 Jul 2025 20:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=A5=E5=8D=95=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EnumFetcherController.java | 5 +- .../domain/CustomerContingenPlanRecord.java | 51 +++++++++ .../property/domain/ResidentPerson.java | 8 ++ .../bo/CustomerContingenPlanRecordBo.java | 53 +++++++++ .../property/domain/bo/ResidentPersonBo.java | 7 +- .../vo/CustomerContingenPlanRecordVo.java | 67 ++++++++++++ .../domain/vo/CustomerContingenPlanVo.java | 7 +- .../property/domain/vo/CustomerNoticesVo.java | 10 ++ .../property/domain/vo/ResidentPersonVo.java | 5 +- .../domain/vo/ServiceWorkOrderAnalysisVo.java | 91 ++++++++-------- .../CustomerContingenPlanRecordMapper.java | 17 +++ .../property/service/EnumFetcherService.java | 3 +- .../ICustomerContingenPlanService.java | 1 + .../property/service/IMeetAttachService.java | 2 +- .../property/service/IMeetBookingService.java | 2 +- .../property/service/IMeetService.java | 2 +- .../impl/CostCarChargeServiceImpl.java | 2 + .../impl/CostHouseChargeServiceImpl.java | 1 - .../service/impl/CostItemsServiceImpl.java | 4 + .../impl/CostMeterTypeServiceImpl.java | 4 + .../impl/CostMeterWaterServiceImpl.java | 4 + .../impl/CostPayFeeAuditServiceImpl.java | 4 + .../impl/CostReturnPayFeeServiceImpl.java | 3 + .../CustomerContingenPlanServiceImpl.java | 51 ++++++++- .../impl/CustomerFeedbacksServiceImpl.java | 3 + .../impl/CustomerNoticesServiceImpl.java | 53 +++++++-- .../service/impl/EnumFetcherServiceImpl.java | 54 +++++++--- .../impl/InspectionItemServiceImpl.java | 4 + .../impl/InspectionPlanServiceImpl.java | 2 + .../impl/InspectionPlanStaffServiceImpl.java | 4 + .../impl/InspectionPointServiceImpl.java | 4 + .../impl/InspectionRouteServiceImpl.java | 4 + .../impl/InspectionStaffServiceImpl.java | 4 + .../impl/InspectionTaskDetailServiceImpl.java | 4 + .../impl/InspectionTaskServiceImpl.java | 5 + .../service/impl/MeetAttachServiceImpl.java | 7 +- .../service/impl/MeetBookingServiceImpl.java | 34 +++--- .../service/impl/MeetServiceImpl.java | 28 +++-- .../impl/ServiceWorkOrdersServiceImpl.java | 102 +++++++++++++++--- .../CustomerContingenPlanRecordMapper.xml | 7 ++ 40 files changed, 593 insertions(+), 130 deletions(-) create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerContingenPlanRecord.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerContingenPlanRecordBo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanRecordVo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/CustomerContingenPlanRecordMapper.java create mode 100644 ruoyi-modules/Property/src/main/resources/mapper/Property/CustomerContingenPlanRecordMapper.xml diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/EnumFetcherController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/EnumFetcherController.java index 5ff66972..f9ce45d0 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/EnumFetcherController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/EnumFetcherController.java @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; import java.util.Map; /** @@ -28,8 +29,8 @@ public class EnumFetcherController { */ @GetMapping("/enum-values/{name}") - public R> getEnumValues(@PathVariable("name") String name) { - Map map = enumFetcherService.getEnumValues(name); + public R>> getEnumValues(@PathVariable("name") String name) { + List> map = enumFetcherService.getEnumValues(name); return R.ok(map); } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerContingenPlanRecord.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerContingenPlanRecord.java new file mode 100644 index 00000000..ec7bec52 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerContingenPlanRecord.java @@ -0,0 +1,51 @@ +package org.dromara.property.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 客户服务-应急预案审核记录对象 customer_contingen_plan_record + * + * @author mocheng + * @date 2025-07-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("customer_contingen_plan_record") +public class CustomerContingenPlanRecord extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(value = "id") + private Long id; + + /** + * 工单id + */ + private Long contingenPlanId; + + /** + * 状态(0.待审核1.待进行2.已完成) + */ + private String status; + + /** + * 责任人 + */ + private Long dutyPersion; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java index 83d92414..e01618bb 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ResidentPerson.java @@ -42,6 +42,14 @@ public class ResidentPerson extends TenantEntity { * 联系电话 */ private String phone; + /** + * 身份证号 + */ + private String idCard; + /** + * 邮箱 + */ + private String email; /** * 性别 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerContingenPlanRecordBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerContingenPlanRecordBo.java new file mode 100644 index 00000000..da223889 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerContingenPlanRecordBo.java @@ -0,0 +1,53 @@ +package org.dromara.property.domain.bo; + +import org.dromara.property.domain.CustomerContingenPlanRecord; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 客户服务-应急预案审核记录业务对象 customer_contingen_plan_record + * + * @author mocheng + * @date 2025-07-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = CustomerContingenPlanRecord.class, reverseConvertGenerate = false) +public class CustomerContingenPlanRecordBo extends BaseEntity { + + /** + * id + */ + @NotNull(message = "id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 工单id + */ + @NotNull(message = "工单id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long contingenPlanId; + + /** + * 状态(0.待审核1.待进行2.已完成) + */ + @NotBlank(message = "状态(0.待审核1.待进行2.已完成)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 责任人 + */ + @NotNull(message = "责任人不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long dutyPersion; + + /** + * 搜索值 + */ + private String searchValue; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java index 91223f28..492a3157 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/ResidentPersonBo.java @@ -30,7 +30,7 @@ public class ResidentPersonBo extends BaseEntity { /** * 用户id */ - @NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long userId; /** @@ -44,7 +44,10 @@ public class ResidentPersonBo extends BaseEntity { */ @NotBlank(message = "联系电话不能为空", groups = { AddGroup.class, EditGroup.class }) private String phone; - + /** + * 邮箱 + */ + private String email; /** * 性别 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanRecordVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanRecordVo.java new file mode 100644 index 00000000..20a0a5d1 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanRecordVo.java @@ -0,0 +1,67 @@ +package org.dromara.property.domain.vo; + +import org.dromara.property.domain.CustomerContingenPlanRecord; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 客户服务-应急预案审核记录视图对象 customer_contingen_plan_record + * + * @author mocheng + * @date 2025-07-23 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = CustomerContingenPlanRecord.class) +public class CustomerContingenPlanRecordVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ExcelProperty(value = "id") + private Long id; + + /** + * 工单id + */ + @ExcelProperty(value = "工单id") + private Long contingenPlanId; + + /** + * 状态(0.待审核1.待进行2.已完成) + */ + @ExcelProperty(value = "状态(0.待审核1.待进行2.已完成)") + private String status; + + /** + * 责任人 + */ + @ExcelProperty(value = "责任人") + private Long dutyPersion; + /** + * 责任人姓名 + */ + @ExcelProperty(value = "责任人姓名") + private String dutyPersionName; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanVo.java index 756de321..ca146869 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerContingenPlanVo.java @@ -9,7 +9,7 @@ import org.dromara.property.domain.CustomerContingenPlan; import java.io.Serial; import java.io.Serializable; import java.util.Date; - +import java.util.List; /** @@ -98,6 +98,9 @@ public class CustomerContingenPlanVo implements Serializable { */ @ExcelProperty(value = "最后更新时间") private Date updateTime; - + /** + * 预案记录列表 + */ + List contingenPlanRecordVos; } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerNoticesVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerNoticesVo.java index cce342c9..b1a0e8b7 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerNoticesVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/CustomerNoticesVo.java @@ -52,6 +52,11 @@ public class CustomerNoticesVo implements Serializable { */ @ExcelProperty(value = "通知人") private String noticePersion; + /** + * 通知人姓名 + */ + @ExcelProperty(value = "通知人姓名") + private String noticePersionName; /** * 备注 @@ -88,6 +93,11 @@ public class CustomerNoticesVo implements Serializable { */ @ExcelProperty(value = "发布人") private Long issuers; + /** + * 发布人姓名 + */ + @ExcelProperty(value = "发布人姓名") + private String issuersName; /** * 搜索值 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java index 93c16ac1..6363dfa1 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ResidentPersonVo.java @@ -49,7 +49,10 @@ public class ResidentPersonVo implements Serializable { */ @ExcelProperty(value = "联系电话") private String phone; - + /** + * 邮箱 + */ + private String email; /** * 性别 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java index dad2ec70..f8b81c43 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java @@ -5,9 +5,10 @@ import lombok.experimental.Accessors; import java.util.List; -@Accessors(chain = true) @Data +@Accessors(chain = true) public class ServiceWorkOrderAnalysisVo { + /** * 工单看板当前周折线图 */ @@ -18,12 +19,29 @@ public class ServiceWorkOrderAnalysisVo { private String dayOfWeek; private long count; + public LineChartVo() {} + public LineChartVo(String date, String dayOfWeek, long count) { this.date = date; this.dayOfWeek = dayOfWeek; this.count = count; } - + } + @Data + @Accessors(chain = true) + public static class BarChartVo { + private String month; // 月份,如 "2025-02" + private int orderCount; // 工单数量 + } + /** + * 满意度图表数据对象 + */ + @Data + @Accessors(chain = true) + public static class SatisfactionChartVo { + private String name; // 满意度名称:如“满意” + private Long value; // 数量 + private Double rate; // 占比(百分比) } /** @@ -33,18 +51,30 @@ public class ServiceWorkOrderAnalysisVo { @Accessors(chain = true) public static class PieChartVo { private String type; // 工单类型 - private Long quantity; // 工单类型 + private Long quantity; // 工单数量 private double percentage; // 占比 - public PieChartVo(String type, Long quantity, double percentage) { - this.type = type; - this.quantity = quantity; - this.percentage = percentage; + public PieChartVo(String string, Long count, double percentage) { } - - // Getters and Setters } + private int workOrdersTotal; + private int notWorkOrdersTotal; + private int novertimeOrdersTotal; + private int inHandOrdersTotal; + private double novertimeOrdersRate; + private int monthOrdersTotal; + private int outTimeOrdersTotal; + private double monthoSatisfaction; + private int satisfaction; + private List recentWeekWorkOrders; + private List satisfactionRateList; + private List satisfactionChartList; + private List recentSixMonthWorkOrders; + + // 私有构造函数,确保使用Builder模式构建对象 + private ServiceWorkOrderAnalysisVo() {} + // Builder Pattern for ServiceWorkOrderAnalysisVo @Data @Accessors(chain = true) @@ -59,24 +89,9 @@ public class ServiceWorkOrderAnalysisVo { private double monthoSatisfaction; private int satisfaction; private List recentWeekWorkOrders; - private List workOrderTypeDistribution; - - // Setters - public ServiceWorkOrderCount setWorkOrdersTotal(int workOrdersTotal) { - this.workOrdersTotal = workOrdersTotal; - return this; - } - // ...其他Setter... - - public ServiceWorkOrderCount setRecentWeekWorkOrders(List recentWeekWorkOrders) { - this.recentWeekWorkOrders = recentWeekWorkOrders; - return this; - } - - public ServiceWorkOrderCount setWorkOrderTypeDistribution(List workOrderTypeDistribution) { - this.workOrderTypeDistribution = workOrderTypeDistribution; - return this; - } + private List satisfactionRateList; + private List satisfactionChartList; + private List recentSixMonthWorkOrders; public ServiceWorkOrderAnalysisVo build() { ServiceWorkOrderAnalysisVo vo = new ServiceWorkOrderAnalysisVo(); @@ -90,26 +105,10 @@ public class ServiceWorkOrderAnalysisVo { vo.monthoSatisfaction = this.monthoSatisfaction; vo.satisfaction = this.satisfaction; vo.recentWeekWorkOrders = this.recentWeekWorkOrders; - vo.workOrderTypeDistribution = this.workOrderTypeDistribution; + vo.satisfactionRateList = this.satisfactionRateList; + vo.satisfactionChartList = this.satisfactionChartList; + vo.recentSixMonthWorkOrders = this.recentSixMonthWorkOrders; return vo; } } - - private int workOrdersTotal; - private int notWorkOrdersTotal; - private int novertimeOrdersTotal; - private int inHandOrdersTotal; - private double novertimeOrdersRate; - private int monthOrdersTotal; - private int outTimeOrdersTotal; - private double monthoSatisfaction; - private int satisfaction; - private List recentWeekWorkOrders; - private List workOrderTypeDistribution; - - // Constructor is private to enforce use of builder pattern - public ServiceWorkOrderAnalysisVo() { - } - - // Getters... } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/CustomerContingenPlanRecordMapper.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/CustomerContingenPlanRecordMapper.java new file mode 100644 index 00000000..cc7f0381 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/mapper/CustomerContingenPlanRecordMapper.java @@ -0,0 +1,17 @@ +package org.dromara.property.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.dromara.property.domain.CustomerContingenPlanRecord; +import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 客户服务-应急预案审核记录Mapper接口 + * + * @author mocheng + * @date 2025-07-23 + */ +@Mapper +public interface CustomerContingenPlanRecordMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/EnumFetcherService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/EnumFetcherService.java index 7d6436a9..0662c638 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/EnumFetcherService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/EnumFetcherService.java @@ -1,5 +1,6 @@ package org.dromara.property.service; +import java.util.List; import java.util.Map; /** @@ -13,5 +14,5 @@ public interface EnumFetcherService { * @param type 大驼峰格式 * @return */ - MapgetEnumValues(String type); + List> getEnumValues(String type); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICustomerContingenPlanService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICustomerContingenPlanService.java index b781d8bd..b530a3bd 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICustomerContingenPlanService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/ICustomerContingenPlanService.java @@ -65,4 +65,5 @@ public interface ICustomerContingenPlanService { * @return 是否删除成功 */ Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetAttachService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetAttachService.java index 614576f2..0f5930b3 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetAttachService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetAttachService.java @@ -72,5 +72,5 @@ public interface IMeetAttachService { * 获取下拉接口数据 * @param type */ - Map getMeetAttachSelectDate(String type); + List> getMeetAttachSelectDate(String type); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetBookingService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetBookingService.java index e808321d..3b018da5 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetBookingService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetBookingService.java @@ -84,6 +84,6 @@ public interface IMeetBookingService { * @param type * @return */ - Map getMeetBooking(String type); + List> getMeetBooking(String type); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetService.java index caf6cb53..28a439f2 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IMeetService.java @@ -72,5 +72,5 @@ public interface IMeetService { * 获取下拉接口数据 * @param type */ - Map getMeetSelectDate(String type); + List> getMeetSelectDate(String type); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostCarChargeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostCarChargeServiceImpl.java index b775aa92..5797df16 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostCarChargeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostCarChargeServiceImpl.java @@ -171,6 +171,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostCarChargeBo bo) { CostCarCharge update = MapstructUtils.convert(bo, CostCarCharge.class); validEntityBeforeSave(update); @@ -192,6 +193,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 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 8c23dee8..dd7050e0 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 @@ -211,7 +211,6 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService { */ @Override @Transactional(rollbackFor = Exception.class) - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 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 c30245ae..8cf98820 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 @@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostItemsVo; import org.dromara.property.domain.CostItems; import org.dromara.property.mapper.CostItemsMapper; import org.dromara.property.service.ICostItemsService; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -98,6 +99,7 @@ public class CostItemsServiceImpl implements ICostItemsService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CostItemsBo bo) { CostItems add = MapstructUtils.convert(bo, CostItems.class); add.setChargeNo( RandomUtil.randomNumbers(11)); @@ -116,6 +118,7 @@ public class CostItemsServiceImpl implements ICostItemsService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostItemsBo bo) { CostItems update = MapstructUtils.convert(bo, CostItems.class); validEntityBeforeSave(update); @@ -137,6 +140,7 @@ public class CostItemsServiceImpl implements ICostItemsService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterTypeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterTypeServiceImpl.java index 878c5b81..a0009535 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterTypeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterTypeServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CostMeterTypeVo; import org.dromara.property.domain.CostMeterType; import org.dromara.property.mapper.CostMeterTypeMapper; import org.dromara.property.service.ICostMeterTypeService; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -87,6 +88,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CostMeterTypeBo bo) { CostMeterType add = MapstructUtils.convert(bo, CostMeterType.class); validEntityBeforeSave(add); @@ -104,6 +106,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostMeterTypeBo bo) { CostMeterType update = MapstructUtils.convert(bo, CostMeterType.class); validEntityBeforeSave(update); @@ -125,6 +128,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterWaterServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterWaterServiceImpl.java index bf4a053f..87110271 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterWaterServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostMeterWaterServiceImpl.java @@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostMeterWaterVo; import org.dromara.property.domain.CostMeterWater; import org.dromara.property.mapper.CostMeterWaterMapper; import org.dromara.property.service.ICostMeterWaterService; +import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @@ -94,6 +95,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CostMeterWaterBo bo) { CostMeterWater add = MapstructUtils.convert(bo, CostMeterWater.class); add.setCurReadingTime(new Date()); @@ -112,6 +114,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostMeterWaterBo bo) { CostMeterWater update = MapstructUtils.convert(bo, CostMeterWater.class); validEntityBeforeSave(update); @@ -133,6 +136,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java index 32b4dc2b..8c9611cd 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostPayFeeAuditServiceImpl.java @@ -21,6 +21,7 @@ import org.dromara.property.domain.vo.*; import org.dromara.property.mapper.*; import org.dromara.property.service.ICostPayFeeAuditService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -135,6 +136,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CostPayFeeAuditBo bo) { CostPayFeeAudit add = MapstructUtils.convert(bo, CostPayFeeAudit.class); validEntityBeforeSave(add); @@ -152,6 +154,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostPayFeeAuditBo bo) { CostPayFeeAudit update = MapstructUtils.convert(bo, CostPayFeeAudit.class); validEntityBeforeUpdate(update); @@ -204,6 +207,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostReturnPayFeeServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostReturnPayFeeServiceImpl.java index 0971fa67..13028282 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostReturnPayFeeServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CostReturnPayFeeServiceImpl.java @@ -20,6 +20,7 @@ import org.dromara.property.mapper.CostHouseChargeMapper; import org.dromara.property.mapper.CostReturnPayFeeMapper; import org.dromara.property.service.ICostReturnPayFeeService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -100,6 +101,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CostReturnPayFeeBo bo) { CostReturnPayFee add = MapstructUtils.convert(bo, CostReturnPayFee.class); validEntityBeforeSave(add); @@ -117,6 +119,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CostReturnPayFeeBo bo) { CostReturnPayFee update = MapstructUtils.convert(bo, CostReturnPayFee.class); validEntityBeforeUpdate(update); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java index d13415b8..8e57177d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerContingenPlanServiceImpl.java @@ -11,15 +11,20 @@ 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.common.translation.annotation.Translation; import org.dromara.property.domain.CustomerContingenPlan; +import org.dromara.property.domain.CustomerContingenPlanRecord; import org.dromara.property.domain.ResidentPerson; import org.dromara.property.domain.bo.CustomerContingenPlanBo; +import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo; import org.dromara.property.domain.vo.CustomerContingenPlanVo; import org.dromara.property.domain.vo.ResidentUnitVo; import org.dromara.property.mapper.CustomerContingenPlanMapper; +import org.dromara.property.mapper.CustomerContingenPlanRecordMapper; import org.dromara.property.mapper.ResidentPersonMapper; import org.dromara.property.service.ICustomerContingenPlanService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -38,6 +43,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS private final CustomerContingenPlanMapper baseMapper; private final ResidentPersonMapper residentPersonMapper; + private final CustomerContingenPlanRecordMapper customerContingenPlanRecordMapper; /** * 查询客户服务-应急预案 @@ -49,9 +55,18 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS public CustomerContingenPlanVo queryById(Long id) { CustomerContingenPlanVo customerContingenPlanVo = baseMapper.selectVoById(id); ResidentPerson residentPerson = residentPersonMapper.selectById(customerContingenPlanVo.getInitiat()); - customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson)?residentPerson.getUserName():null); + customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson) ? residentPerson.getUserName() : null); ResidentPerson dutyPerson = residentPersonMapper.selectById(customerContingenPlanVo.getDutyPersion()); - customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson)?dutyPerson.getUserName():null); + customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson) ? dutyPerson.getUserName() : null); + LambdaQueryWrapper recordQueryWrapper = new LambdaQueryWrapper<>(); + recordQueryWrapper.eq(CustomerContingenPlanRecord::getContingenPlanId, id); + List contingenPlanRecordVos = customerContingenPlanRecordMapper.selectVoList(recordQueryWrapper); + if (CollUtil.isNotEmpty(contingenPlanRecordVos)) { + contingenPlanRecordVos.stream().forEach(s -> { + s.setDutyPersionName(customerContingenPlanVo.getDutyPersionName()); + }); + customerContingenPlanVo.setContingenPlanRecordVos(contingenPlanRecordVos); + } return customerContingenPlanVo; } @@ -71,10 +86,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS result.getRecords().stream().forEach(s -> { ResidentPerson residentInitiatVo = residentPeoplelist.stream() .filter(vo -> vo.getId() != null && vo.getId().equals(s.getInitiat())).findFirst().orElse(null); - s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo)?residentInitiatVo.getUserName():null); + s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo) ? residentInitiatVo.getUserName() : null); ResidentPerson residentDutyVo = residentPeoplelist.stream() .filter(vo -> vo.getId() != null && vo.getId().equals(s.getDutyPersion())).findFirst().orElse(null); - s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo)?residentDutyVo.getUserName():null); + s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo) ? residentDutyVo.getUserName() : null); }); } return TableDataInfo.build(result); @@ -97,6 +112,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.orderByAsc(CustomerContingenPlan::getId); lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanType()), CustomerContingenPlan::getContingenPlanType, bo.getContingenPlanType()); + lqw.eq(ObjectUtil.isNotEmpty(bo.getDutyPersion()), CustomerContingenPlan::getDutyPersion, bo.getDutyPersion()); lqw.like(StringUtils.isNotBlank(bo.getContingenPlanName()), CustomerContingenPlan::getContingenPlanName, bo.getContingenPlanName()); lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanContent()), CustomerContingenPlan::getContingenPlanContent, bo.getContingenPlanContent()); lqw.eq(ObjectUtil.isNotEmpty(bo.getInitiat()), CustomerContingenPlan::getInitiat, bo.getInitiat()); @@ -112,6 +128,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CustomerContingenPlanBo bo) { CustomerContingenPlan add = MapstructUtils.convert(bo, CustomerContingenPlan.class); add.setStatus("0"); @@ -119,6 +136,11 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); + CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord(); + customerContingenPlanRecord.setStatus(add.getStatus()); + customerContingenPlanRecord.setContingenPlanId(add.getId()); + customerContingenPlanRecord.setDutyPersion(add.getDutyPersion()); + customerContingenPlanRecordMapper.insert(customerContingenPlanRecord); } return flag; } @@ -130,9 +152,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CustomerContingenPlanBo bo) { CustomerContingenPlan update = MapstructUtils.convert(bo, CustomerContingenPlan.class); - validEntityBeforeSave(update); + validEntityBeforeUpdate(update); return baseMapper.updateById(update) > 0; } @@ -143,6 +166,23 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS //TODO 做一些数据校验,如唯一约束 } + /** + * 保存前的数据校验 + */ + private void validEntityBeforeUpdate(CustomerContingenPlan entity) { + //TODO 做一些数据校验,如唯一约束 + boolean exists = customerContingenPlanRecordMapper.exists(new LambdaQueryWrapper() + .eq(CustomerContingenPlanRecord::getContingenPlanId, entity.getId()) + .eq(CustomerContingenPlanRecord::getStatus, entity.getStatus())); + if (!exists) { + CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord(); + customerContingenPlanRecord.setStatus(entity.getStatus()); + customerContingenPlanRecord.setContingenPlanId(entity.getId()); + customerContingenPlanRecord.setDutyPersion(entity.getDutyPersion()); + customerContingenPlanRecordMapper.insert(customerContingenPlanRecord); + } + } + /** * 校验并批量删除客户服务-应急预案信息 * @@ -151,6 +191,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerFeedbacksServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerFeedbacksServiceImpl.java index ed412d4f..4756ee2f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerFeedbacksServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerFeedbacksServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CustomerFeedbacksVo; import org.dromara.property.mapper.CustomerFeedbacksMapper; import org.dromara.property.service.ICustomerFeedbacksService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -94,6 +95,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CustomerFeedbacksBo bo) { CustomerFeedbacks add = MapstructUtils.convert(bo, CustomerFeedbacks.class); validEntityBeforeSave(add); @@ -111,6 +113,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CustomerFeedbacksBo bo) { CustomerFeedbacks update = MapstructUtils.convert(bo, CustomerFeedbacks.class); validEntityBeforeSave(update); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerNoticesServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerNoticesServiceImpl.java index c3dbfb45..7d0bcd42 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerNoticesServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/CustomerNoticesServiceImpl.java @@ -1,7 +1,10 @@ package org.dromara.property.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; import org.apache.dubbo.config.annotation.DubboReference; +import org.dromara.common.core.domain.R; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -11,14 +14,19 @@ 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.common.satoken.utils.LoginHelper; +import org.dromara.property.domain.ResidentPerson; +import org.dromara.property.domain.vo.ResidentUnitVo; import org.dromara.property.mapper.ResidentPersonMapper; import org.dromara.resource.api.RemoteMessageService; +import org.dromara.system.api.model.LoginUser; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.CustomerNoticesBo; import org.dromara.property.domain.vo.CustomerNoticesVo; import org.dromara.property.domain.CustomerNotices; import org.dromara.property.mapper.CustomerNoticesMapper; import org.dromara.property.service.ICustomerNoticesService; +import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; @@ -49,7 +57,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { * @return 客户服务-通知公告 */ @Override - public CustomerNoticesVo queryById(Long id){ + public CustomerNoticesVo queryById(Long id) { return baseMapper.selectVoById(id); } @@ -64,6 +72,28 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { public TableDataInfo queryPageList(CustomerNoticesBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + if (CollUtil.isNotEmpty(result.getRecords())) { + List residentPeople = residentPersonMapper.selectList(); + if (CollUtil.isNotEmpty(residentPeople)) { + result.getRecords().stream().forEach(s -> { + ResidentPerson residentPerson = residentPeople.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getIssuers())).findFirst().orElse(null); + s.setIssuersName(residentPerson.getUserName()); + if (ObjectUtil.isNotEmpty(s.getNoticePersion())) { + List list = Arrays.asList(s.getNoticePersion().split(",")); + List filteredList = residentPeople.stream() + .filter(person -> list.contains(person.getId().toString())) + .collect(Collectors.toList()); + String usernames = filteredList.stream() + .map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法 + .collect(Collectors.joining(",")); + s.setIssuersName(usernames); + } + + }); + } + + } return TableDataInfo.build(result); } @@ -100,21 +130,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(CustomerNoticesBo bo) { CustomerNotices add = MapstructUtils.convert(bo, CustomerNotices.class); validEntityBeforeSave(add); boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); - if(bo.getIsAll().equals("0")){ + if (bo.getIsAll().equals("0")) { remoteMessageService.publishAll(bo.getTitle()); } - if(bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())){ + if (bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())) { String[] noticePersion = bo.getNoticePersion().split(","); List userIdList = Arrays.stream(noticePersion) .map(Long::valueOf) .collect(Collectors.toList()); - remoteMessageService.publishMessage(userIdList,bo.getTitle()); + remoteMessageService.publishMessage(userIdList, bo.getTitle()); } } return flag; @@ -127,6 +158,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(CustomerNoticesBo bo) { CustomerNotices update = MapstructUtils.convert(bo, CustomerNotices.class); validEntityBeforeUpdate(update); @@ -136,15 +168,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { /** * 保存前的数据校验 */ - private void validEntityBeforeSave(CustomerNotices entity){ + private void validEntityBeforeSave(CustomerNotices entity) { //TODO 做一些数据校验,如唯一约束 + LoginUser user = LoginHelper.getLoginUser(); + ResidentPerson residentPerson = residentPersonMapper.selectOne(new LambdaQueryWrapper() + .eq(ResidentPerson::getUserId, user.getUserId())); + Assert.isTrue(ObjectUtil.isNotEmpty(residentPerson), "该发布人未入住"); + entity.setIssuers(residentPerson.getId()); } + /** * 修改前的数据校验 */ - private void validEntityBeforeUpdate(CustomerNotices entity){ + private void validEntityBeforeUpdate(CustomerNotices entity) { //TODO 做一些数据校验,如唯一约束 } + /** * 校验并批量删除客户服务-通知公告信息 * @@ -154,7 +193,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { */ @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/EnumFetcherServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/EnumFetcherServiceImpl.java index aee09632..2c28ce82 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/EnumFetcherServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/EnumFetcherServiceImpl.java @@ -12,6 +12,9 @@ import org.dromara.property.service.IMeetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -31,7 +34,7 @@ public class EnumFetcherServiceImpl implements EnumFetcherService { private IMeetBookingService meetBookingService; @Override - public Map getEnumValues(String type) { + public List> getEnumValues(String type) { switch (type) { case "getMeetName": return meetService.getMeetSelectDate(type); @@ -56,23 +59,48 @@ public class EnumFetcherServiceImpl implements EnumFetcherService { } } - Map getMeetStatus() { - return java.util.Arrays.stream(MeetStatusEnum.values()) - .collect(Collectors.toMap(MeetStatusEnum::getValue, MeetStatusEnum::getName)); + List> getMeetStatus() { + return Arrays.stream(MeetStatusEnum.values()) + .map(e -> { + Map map = new HashMap<>(); + map.put("value", e.getValue()); + map.put("name", e.getName()); + return map; + }) + .collect(Collectors.toList()); } - Map getMeetAttachStatus() { - return java.util.Arrays.stream(MeetAttachStatusEnum.values()) - .collect(Collectors.toMap(MeetAttachStatusEnum::getValue, MeetAttachStatusEnum::getName)); + List> getMeetAttachStatus() { + return Arrays.stream(MeetAttachStatusEnum.values()) + .map(e -> { + Map map = new HashMap<>(); + map.put("value", e.getValue()); + map.put("name", e.getName()); + return map; + }) + .collect(Collectors.toList()); } - Map getMeetBookingPayStatus() { - return java.util.Arrays.stream(BookingPayStatusEnum.values()) - .collect(Collectors.toMap(BookingPayStatusEnum::getValue, BookingPayStatusEnum::getName)); + List> getMeetBookingPayStatus() { + return Arrays.stream(BookingPayStatusEnum.values()) + .map(e -> { + Map map = new HashMap<>(); + map.put("value", e.getValue()); + map.put("name", e.getName()); + return map; + }) + .collect(Collectors.toList()); } - Map getMeetBookingStatus() { - return java.util.Arrays.stream(BookingStatusEnum.values()) - .collect(Collectors.toMap(BookingStatusEnum::getValue, BookingStatusEnum::getName)); + + List> getMeetBookingStatus() { + return Arrays.stream(BookingStatusEnum.values()) + .map(e -> { + Map map = new HashMap<>(); + map.put("value", e.getValue()); + map.put("name", e.getName()); + return map; + }) + .collect(Collectors.toList()); } } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionItemServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionItemServiceImpl.java index f897b352..246203f1 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionItemServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionItemServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionItemVo; import org.dromara.property.mapper.InspectionItemMapper; import org.dromara.property.service.IInspectionItemService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -86,6 +87,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionItemBo bo) { InspectionItem add = MapstructUtils.convert(bo, InspectionItem.class); validEntityBeforeSave(add); @@ -103,6 +105,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionItemBo bo) { InspectionItem update = MapstructUtils.convert(bo, InspectionItem.class); validEntityBeforeSave(update); @@ -124,6 +127,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanServiceImpl.java index 8860f09e..199e7915 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanServiceImpl.java @@ -161,6 +161,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionPlanBo bo) { InspectionPlan update = MapstructUtils.convert(bo, InspectionPlan.class); validEntityBeforeSave(update); @@ -182,6 +183,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanStaffServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanStaffServiceImpl.java index 9a3e4a68..2da869e4 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanStaffServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPlanStaffServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionPlanStaffVo; import org.dromara.property.mapper.InspectionPlanStaffMapper; import org.dromara.property.service.IInspectionPlanStaffService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -89,6 +90,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionPlanStaffBo bo) { InspectionPlanStaff add = MapstructUtils.convert(bo, InspectionPlanStaff.class); validEntityBeforeSave(add); @@ -106,6 +108,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionPlanStaffBo bo) { InspectionPlanStaff update = MapstructUtils.convert(bo, InspectionPlanStaff.class); validEntityBeforeSave(update); @@ -127,6 +130,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPointServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPointServiceImpl.java index 1bed47e4..a7501f6f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPointServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionPointServiceImpl.java @@ -18,6 +18,7 @@ import org.dromara.property.mapper.InspectionPlanMapper; import org.dromara.property.mapper.InspectionPointMapper; import org.dromara.property.service.IInspectionPointService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -104,6 +105,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionPointBo bo) { InspectionPoint add = MapstructUtils.convert(bo, InspectionPoint.class); validEntityBeforeSave(add); @@ -121,6 +123,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionPointBo bo) { InspectionPoint update = MapstructUtils.convert(bo, InspectionPoint.class); validEntityBeforeSave(update); @@ -142,6 +145,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java index e3fae498..7a4e1dbf 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionRouteServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionRouteVo; import org.dromara.property.mapper.InspectionRouteMapper; import org.dromara.property.service.IInspectionRouteService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -86,6 +87,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionRouteBo bo) { InspectionRoute add = MapstructUtils.convert(bo, InspectionRoute.class); validEntityBeforeSave(add); @@ -103,6 +105,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionRouteBo bo) { InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class); validEntityBeforeSave(update); @@ -124,6 +127,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionStaffServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionStaffServiceImpl.java index 1631223e..3d3bc201 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionStaffServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionStaffServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionStaffVo; import org.dromara.property.mapper.InspectionStaffMapper; import org.dromara.property.service.IInspectionStaffService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -89,6 +90,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionStaffBo bo) { InspectionStaff add = MapstructUtils.convert(bo, InspectionStaff.class); validEntityBeforeSave(add); @@ -106,6 +108,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionStaffBo bo) { InspectionStaff update = MapstructUtils.convert(bo, InspectionStaff.class); validEntityBeforeSave(update); @@ -127,6 +130,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java index 056f717f..86c0ed9d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskDetailServiceImpl.java @@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionTaskDetailVo; import org.dromara.property.mapper.InspectionTaskDetailMapper; import org.dromara.property.service.IInspectionTaskDetailService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -95,6 +96,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionTaskDetailBo bo) { InspectionTaskDetail add = MapstructUtils.convert(bo, InspectionTaskDetail.class); validEntityBeforeSave(add); @@ -112,6 +114,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionTaskDetailBo bo) { InspectionTaskDetail update = MapstructUtils.convert(bo, InspectionTaskDetail.class); validEntityBeforeSave(update); @@ -133,6 +136,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskServiceImpl.java index c7ad69e0..4860dd5a 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/InspectionTaskServiceImpl.java @@ -19,6 +19,7 @@ import org.dromara.property.mapper.InspectionTaskMapper; import org.dromara.property.service.IInspectionTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Collection; import java.util.List; @@ -116,6 +117,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService { * @return 是否新增成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(InspectionTaskBo bo) { InspectionTask add = MapstructUtils.convert(bo, InspectionTask.class); validEntityBeforeSave(add); @@ -133,6 +135,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService { * @return 是否修改成功 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(InspectionTaskBo bo) { InspectionTask update = MapstructUtils.convert(bo, InspectionTask.class); validEntityBeforeSave(update); @@ -154,6 +157,8 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService { * @return 是否删除成功 */ @Override + @Transactional(rollbackFor = Exception.class) + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetAttachServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetAttachServiceImpl.java index bbae6f15..4a0866d5 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetAttachServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetAttachServiceImpl.java @@ -145,18 +145,17 @@ public class MeetAttachServiceImpl implements IMeetAttachService { * 下拉接口数据 */ @Override - public Map getMeetAttachSelectDate(String type){ - + public List> getMeetAttachSelectDate(String type){ switch (type) { case "getMeetAttachName": - return getList().stream() + return (List>) getList().stream() .collect(Collectors.toMap( MeetAttach::getProjectName, MeetAttach::getProjectName, (oldValue, newValue) -> oldValue )); case "getMeetAttachType": - return getList().stream() + return (List>) getList().stream() .collect(Collectors.toMap( MeetAttach::getType, MeetAttach::getType, 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 521d268d..99ff5043 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 @@ -62,7 +62,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService { meetBookingDetailVo.setLocationName(ObjectUtil.isNotEmpty(locationName)?locationName:null); ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(Long.valueOf(meetBookingVo.getPerson())); meetBookingDetailVo.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getUserName():null); - meetBookingDetailVo.setPhone(residentPersonVo.getPhone()); + meetBookingDetailVo.setPhone(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getPhone():null); ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBookingVo.getUnit())); meetBookingDetailVo.setUnitName(ObjectUtil.isNotEmpty(residentPersonVo)?residentUnitVo.getName():null); return meetBookingDetailVo; @@ -119,7 +119,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService { if (CollectionUtil.isEmpty(meetBookings)) { return new ArrayList<>(); } - List meetBookingAppointmentVoList = MapstructUtils.convert(meetBookings, MeetBookingAppointmentVo.class); + List meetBookingAppointmentVoList = BeanUtil.copyToList(meetBookings, MeetBookingAppointmentVo.class); SimpleDateFormat df = new SimpleDateFormat("HH"); List residentUnitVolist = residentUnitMapper.selectVoList(); List residentPersonsVolist = residentPersonMapper.selectVoList(); @@ -176,7 +176,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService { if (CollectionUtil.isEmpty(meetBookingVoList)) { return new ArrayList<>(); } - List meetBookingWeekVoList = MapstructUtils.convert(meetBookingVoList, MeetBookingWeekVo.class); + List meetBookingWeekVoList = BeanUtil.copyToList(meetBookingVoList, MeetBookingWeekVo.class); String[] weekStr = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; List meetBookingWeekList = new ArrayList<>(); SimpleDateFormat df = new SimpleDateFormat("HH"); @@ -283,18 +283,22 @@ public class MeetBookingServiceImpl implements IMeetBookingService { } @Override - public Map 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> getMeetBooking(String type) { + return switch (type) { + case "getMeetBookingPerson" -> getList().stream() + .map(MeetBooking::getPerson) + .filter(Objects::nonNull) + .distinct() + .map(person -> { + Map map = new HashMap<>(); + map.put("value", person); + map.put("name", person); + return map; + }) + .collect(Collectors.toList()); + + default -> throw new IllegalArgumentException("Unknown type: " + type); + }; } public List getList() { diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java index 5cafdb2f..931d9e89 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/MeetServiceImpl.java @@ -212,23 +212,29 @@ public class MeetServiceImpl implements IMeetService { * 下拉接口数据 */ @Override - public Map getMeetSelectDate(String type){ + public List> getMeetSelectDate(String type){ switch (type) { case "getMeetName": - Map meetMap = new HashMap<>(); + List> result = new ArrayList<>(); for (Meet meet : getList()) { - // 如果键不存在,则直接放入;如果存在,则保留第一个遇到的值 - meetMap.putIfAbsent("value", meet.getId()); - meetMap.putIfAbsent("name", meet.getName()); + Map map = new HashMap<>(); + map.put("value", meet.getId()); + map.put("name", meet.getName()); + result.add(map); } - return meetMap; + return result; case "getMeetPrincipals": + // 提取所有不同的 principals,并包装成 List> return getList().stream() - .collect(Collectors.toMap( - Meet::getPrincipals, - Meet::getPrincipals, - (oldValue, newValue) -> oldValue - )); + .map(Meet::getPrincipals) + .distinct() + .map(principal -> { + Map map = new HashMap<>(); + map.put("value", principal); + map.put("name", principal); + return map; + }) + .collect(Collectors.toList()); default: throw new IllegalArgumentException("Unknown type: " + type); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java index 116bb6ee..1f9f52ad 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/ServiceWorkOrdersServiceImpl.java @@ -255,7 +255,10 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { public ServiceWorkOrderAnalysisVo counts() { List serviceWorkOrdersList = baseMapper.selectList(new QueryWrapper<>()); - // 原有逻辑不变... + // 当前时间 + LocalDate today = LocalDate.now(); + String currentMonth = today.format(DateTimeFormatter.ofPattern("yyyy-MM")); + // 总工单数 int workOrdersTotal = serviceWorkOrdersList.size(); @@ -263,6 +266,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { int notWorkOrdersTotal = (int) serviceWorkOrdersList.stream() .filter(order -> "0".equals(order.getStatus())) .count(); + // 未闭环且超时的工单(status ≠ "4" 且 isTimeOut = "1") int novertimeOrdersTotal = (int) serviceWorkOrdersList.stream() .filter(order -> !"4".equals(order.getStatus()) && "1".equals(order.getIsTimeOut())) @@ -273,9 +277,6 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .filter(order -> "3".equals(order.getStatus())) .count(); - // 当前月份(格式:2025-07) - String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM")); - // 当月工单数(创建时间在当月) int monthOrdersTotal = (int) serviceWorkOrdersList.stream() .filter(order -> currentMonth.equals(order.getCreateTime())) @@ -286,13 +287,13 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .filter(order -> "1".equals(order.getIsTimeOut()) && currentMonth.equals(order.getCreateTime())) .count(); - // 计算当月工单超时率(保留两位小数) + // 当月工单超时率(保留两位小数) double novertimeOrdersRate = monthOrdersTotal == 0 ? 0.0 : - (double) outTimeOrdersTotal / monthOrdersTotal * 100; + Math.round(((double) outTimeOrdersTotal / monthOrdersTotal) * 10000) / 100.0; - // 满意数(假设 satisfactionLevel >= 4 表示满意) + // 满意数(serviceEvalua >= 4) int satisfaction = (int) serviceWorkOrdersList.stream() - .filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua()>= 4) + .filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua() >= 4) .count(); // 当月满意度(当月工单中满意的占比) @@ -303,14 +304,19 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .count(); double monthoSatisfaction = monthOrdersTotal == 0 ? 0.0 : - (double) monthSatisfactionCount / monthOrdersTotal * 100; - ServiceWorkOrderAnalysisVo serviceWorkOrderAnalysisVo =new ServiceWorkOrderAnalysisVo(); + Math.round(((double) monthSatisfactionCount / monthOrdersTotal) * 10000) / 100.0; + // 获取近一周的工单统计 - List recentWeekData = getRecentWeekWorkOrders(serviceWorkOrdersList); + List recentWeekWorkOrders = getRecentWeekWorkOrders(serviceWorkOrdersList); - // 计算工单类型分布 - List workOrderTypeDistribution = calculateWorkOrderTypeDistribution(serviceWorkOrdersList); + // 获取工单类型分布 + List satisfactionChartList = calculateWorkOrderTypeDistribution(serviceWorkOrdersList); + // 获取满意度分布 + List satisfactionRateList = calculateSatisfactionRate(serviceWorkOrdersList); + // 获取近半年工单柱状图数据 + List recentSixMonthWorkOrders = getRecentSixMonthsWorkOrders(serviceWorkOrdersList); + // 构建 VO 并返回 return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount() .setWorkOrdersTotal(workOrdersTotal) .setNotWorkOrdersTotal(notWorkOrdersTotal) @@ -321,11 +327,50 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .setOutTimeOrdersTotal(outTimeOrdersTotal) .setMonthoSatisfaction(monthoSatisfaction) .setSatisfaction(satisfaction) - .setRecentWeekWorkOrders(recentWeekData) - .setWorkOrderTypeDistribution(workOrderTypeDistribution) + .setRecentWeekWorkOrders(recentWeekWorkOrders) + .setSatisfactionRateList(satisfactionRateList) + .setSatisfactionChartList(satisfactionChartList) + .setRecentSixMonthWorkOrders(recentSixMonthWorkOrders) .build(); - } + } /** + * 计算满意度指数占比 + * + * @return 满意度比例列表 + */ + private List calculateSatisfactionRate(List ordersList) { + List evaluatedOrders = ordersList.stream() + .filter(order -> order.getServiceEvalua() != null) + .collect(Collectors.toList()); + int totalSatisfactionCount = evaluatedOrders.size(); + + Map satisfactionCounts = evaluatedOrders.stream() + .collect(Collectors.groupingBy(ServiceWorkOrders::getServiceEvalua, Collectors.counting())); + + List satisfactionRateList = new ArrayList<>(); + + for (int level = 1; level <= 5; level++) { + long count = satisfactionCounts.getOrDefault(level, 0L); + double rate = totalSatisfactionCount == 0 ? 0.0 : + Math.round(((double) count / totalSatisfactionCount) * 10000) / 100.0; + + String name = switch (level) { + case 1 -> "非常不满意"; + case 2 -> "不满意"; + case 3 -> "一般"; + case 4 -> "满意"; + case 5 -> "非常满意"; + default -> "未知"; + }; + + satisfactionRateList.add(new ServiceWorkOrderAnalysisVo.SatisfactionChartVo() + .setName(name) + .setValue((long) count) + .setRate(rate)); + } + + return satisfactionRateList; + } // 近一周工单统计方法 private List getRecentWeekWorkOrders(List serviceWorkOrdersList) { LocalDate today = LocalDate.now(); @@ -378,8 +423,31 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { String typeName = serviceWorkOrdersType != null ? serviceWorkOrdersType.getOrderTypeName() : "未知类型"; // 计算占比(保留两位小数) double percentage = Math.round(((double) count / total) * 10000) / 100.0; - result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName, count, percentage)); + result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName.toString(), count, percentage)); } return result; } + private List getRecentSixMonthsWorkOrders(List ordersList) { + LocalDate today = LocalDate.now(); + + // 获取近6个月的日期范围(含当月) + List months = new ArrayList<>(); + for (int i = 5; i >= 0; i--) { + months.add(today.minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM"))); + } + Map orderCountMap = ordersList.stream() + .filter(order -> order.getCreateTime() != null) + .collect(Collectors.groupingBy( + ServiceWorkOrders::getCreateTime, + Collectors.counting() + )); + + // 构建柱状图数据 + return months.stream() + .map(month -> new ServiceWorkOrderAnalysisVo.BarChartVo() + .setMonth(month) + .setOrderCount(Math.toIntExact(orderCountMap.getOrDefault(month, 0L))) + ) + .collect(Collectors.toList()); + } } diff --git a/ruoyi-modules/Property/src/main/resources/mapper/Property/CustomerContingenPlanRecordMapper.xml b/ruoyi-modules/Property/src/main/resources/mapper/Property/CustomerContingenPlanRecordMapper.xml new file mode 100644 index 00000000..db577bc8 --- /dev/null +++ b/ruoyi-modules/Property/src/main/resources/mapper/Property/CustomerContingenPlanRecordMapper.xml @@ -0,0 +1,7 @@ + + + + +