From 99c15c311fe6c2743674b05c0cc9b51cde2e5741 Mon Sep 17 00:00:00 2001 From: yuyongle <1150359267@qq.com> Date: Wed, 23 Jul 2025 15:01:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E8=AE=B0=E5=BD=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerContingenPlanController.java | 2 +- .../controller/CustomerServeceController.java | 6 +- .../property/domain/CustomerFeedbacks.java | 4 + .../property/domain/ServiceWorkOrders.java | 2 +- .../domain/bo/CustomerFeedbacksBo.java | 4 +- .../domain/vo/ServeceCustomerCountVo.java | 52 -------- .../domain/vo/ServiceWorkOrderAnalysisVo.java | 115 ++++++++++++++++++ .../service/IServiceWorkOrdersService.java | 4 +- .../CustomerContingenPlanServiceImpl.java | 11 +- .../impl/CustomerNoticesServiceImpl.java | 28 ++++- .../service/impl/MeetBookingServiceImpl.java | 34 +++--- .../impl/ServiceWorkOrdersServiceImpl.java | 80 +++++++++++- 12 files changed, 251 insertions(+), 91 deletions(-) delete mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServeceCustomerCountVo.java create mode 100644 ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerContingenPlanController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerContingenPlanController.java index 5971ef68..2c9d0f77 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerContingenPlanController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerContingenPlanController.java @@ -40,7 +40,7 @@ public class CustomerContingenPlanController extends BaseController { /** * 查询客户服务-应急预案列表 */ - @SaCheckPermission("system:contingenPlan:list") + // @SaCheckPermission("system:contingenPlan:list") @GetMapping("/list") public TableDataInfo list(CustomerContingenPlanBo bo, PageQuery pageQuery) { return customerContingenPlanService.queryPageList(bo, pageQuery); diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerServeceController.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerServeceController.java index 40761a81..87a52429 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerServeceController.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/controller/CustomerServeceController.java @@ -3,7 +3,7 @@ package org.dromara.property.controller; import lombok.RequiredArgsConstructor; import org.dromara.common.core.domain.R; import org.dromara.common.web.core.BaseController; -import org.dromara.property.domain.vo.ServeceCustomerCountVo; +import org.dromara.property.domain.vo.ServiceWorkOrderAnalysisVo; import org.dromara.property.service.IServiceWorkOrdersService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController; /** * @Author:yuyongle * @Date:2025/7/21 15:25 - * @Description:客户服务控制器 + * @Description:工单看板控制器 **/ @Validated @RequiredArgsConstructor @@ -25,7 +25,7 @@ public class CustomerServeceController extends BaseController { * 查询客户服务工单看板统计 */ @GetMapping("/counts") - public R counts() { + public R counts() { return R.ok(serviceWorkOrdersService.counts()); } diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerFeedbacks.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerFeedbacks.java index 7ac186e2..8de2dee7 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerFeedbacks.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/CustomerFeedbacks.java @@ -57,6 +57,10 @@ public class CustomerFeedbacks extends TenantEntity { */ private String feedbackImg; + /** + * 是否转至工单 + */ + private Long orderId; /** * 是否转至工单 */ diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ServiceWorkOrders.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ServiceWorkOrders.java index 5fe92a6b..fb90a2d4 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ServiceWorkOrders.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/ServiceWorkOrders.java @@ -42,7 +42,7 @@ public class ServiceWorkOrders extends TenantEntity { /** * 工单类型 */ - private Long type; + private Long type; /** * 状态 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerFeedbacksBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerFeedbacksBo.java index 6bb5d29f..6228455d 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerFeedbacksBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/CustomerFeedbacksBo.java @@ -59,7 +59,7 @@ public class CustomerFeedbacksBo extends BaseEntity { /** * 反馈图片 */ - @NotBlank(message = "反馈图片不能为空", groups = { AddGroup.class, EditGroup.class }) + // @NotBlank(message = "反馈图片不能为空", groups = { AddGroup.class, EditGroup.class }) private String feedbackImg; /** @@ -68,7 +68,7 @@ public class CustomerFeedbacksBo extends BaseEntity { private String isWorkOrder; /** - * 状态(1待处理2处理中3处理完成) + * 状态(0待处理1处理中2处理完成) */ private String status; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServeceCustomerCountVo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServeceCustomerCountVo.java deleted file mode 100644 index 62a9e9ad..00000000 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServeceCustomerCountVo.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.dromara.property.domain.vo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * @Author:yuyongle - * @Date:2025/7/21 15:29 - * @Description:客户服务工单统计看板 - **/ -@Data -@Accessors(chain = true) -public class ServeceCustomerCountVo implements Serializable { - /** - * 工单总数 - */ - private Integer workOrdersTotal; - /** - * 未派工单总数 - */ - private Integer notWorkOrdersTotal; - /** - * 未半结超时工单 - */ - private Integer novertimeOrdersTotal; - /** - * 处理中工单 - */ - private Integer InHandOrdersTotal; - /** - * 当月工单超时率 - */ - private Double novertimeOrdersRate; - /** - * 当月工单数 - */ - private Integer monthOrdersTotal; - /** - * 超时工单数 - */ - private Integer outTimeOrdersTotal; - /** - * 当月满意度 - */ - private Double monthoSatisfaction; - /** - * 满意数 - */ - private Integer satisfaction; -} 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 new file mode 100644 index 00000000..dad2ec70 --- /dev/null +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/vo/ServiceWorkOrderAnalysisVo.java @@ -0,0 +1,115 @@ +package org.dromara.property.domain.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +@Accessors(chain = true) +@Data +public class ServiceWorkOrderAnalysisVo { + /** + * 工单看板当前周折线图 + */ + @Data + @Accessors(chain = true) + public static class LineChartVo { + private String date; + private String dayOfWeek; + private long count; + + public LineChartVo(String date, String dayOfWeek, long count) { + this.date = date; + this.dayOfWeek = dayOfWeek; + this.count = count; + } + + } + + /** + * 工单看板饼型图 + */ + @Data + @Accessors(chain = true) + public static class PieChartVo { + private String type; // 工单类型 + private Long quantity; // 工单类型 + private double percentage; // 占比 + + public PieChartVo(String type, Long quantity, double percentage) { + this.type = type; + this.quantity = quantity; + this.percentage = percentage; + } + + // Getters and Setters + } + + // Builder Pattern for ServiceWorkOrderAnalysisVo + @Data + @Accessors(chain = true) + public static class ServiceWorkOrderCount { + 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; + + // 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; + } + + public ServiceWorkOrderAnalysisVo build() { + ServiceWorkOrderAnalysisVo vo = new ServiceWorkOrderAnalysisVo(); + vo.workOrdersTotal = this.workOrdersTotal; + vo.notWorkOrdersTotal = this.notWorkOrdersTotal; + vo.novertimeOrdersTotal = this.novertimeOrdersTotal; + vo.inHandOrdersTotal = this.inHandOrdersTotal; + vo.novertimeOrdersRate = this.novertimeOrdersRate; + vo.monthOrdersTotal = this.monthOrdersTotal; + vo.outTimeOrdersTotal = this.outTimeOrdersTotal; + vo.monthoSatisfaction = this.monthoSatisfaction; + vo.satisfaction = this.satisfaction; + vo.recentWeekWorkOrders = this.recentWeekWorkOrders; + vo.workOrderTypeDistribution = this.workOrderTypeDistribution; + 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/service/IServiceWorkOrdersService.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IServiceWorkOrdersService.java index f9dc1d63..aa992bdb 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IServiceWorkOrdersService.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/IServiceWorkOrdersService.java @@ -3,7 +3,7 @@ package org.dromara.property.service; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.property.domain.bo.ServiceWorkOrdersBo; -import org.dromara.property.domain.vo.ServeceCustomerCountVo; +import org.dromara.property.domain.vo.ServiceWorkOrderAnalysisVo; import org.dromara.property.domain.vo.ServiceWorkOrdersInfoVo; import org.dromara.property.domain.vo.ServiceWorkOrdersVo; @@ -72,6 +72,6 @@ public interface IServiceWorkOrdersService { * 工单服务看板 * @return */ - ServeceCustomerCountVo counts(); + ServiceWorkOrderAnalysisVo counts(); } 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 da55aaf3..d13415b8 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 @@ -47,7 +47,12 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS */ @Override public CustomerContingenPlanVo queryById(Long id) { - return baseMapper.selectVoById(id); + CustomerContingenPlanVo customerContingenPlanVo = baseMapper.selectVoById(id); + ResidentPerson residentPerson = residentPersonMapper.selectById(customerContingenPlanVo.getInitiat()); + customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson)?residentPerson.getUserName():null); + ResidentPerson dutyPerson = residentPersonMapper.selectById(customerContingenPlanVo.getDutyPersion()); + customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson)?dutyPerson.getUserName():null); + return customerContingenPlanVo; } /** @@ -65,10 +70,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS if (CollUtil.isNotEmpty(residentPeoplelist)) { result.getRecords().stream().forEach(s -> { ResidentPerson residentInitiatVo = residentPeoplelist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getInitiat())).findFirst().orElse(null); + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getInitiat())).findFirst().orElse(null); s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo)?residentInitiatVo.getUserName():null); ResidentPerson residentDutyVo = residentPeoplelist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getDutyPersion())).findFirst().orElse(null); + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getDutyPersion())).findFirst().orElse(null); s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo)?residentDutyVo.getUserName():null); }); } 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 f2e5f01b..c3dbfb45 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,5 +1,7 @@ package org.dromara.property.service.impl; +import cn.hutool.core.util.ObjectUtil; +import org.apache.dubbo.config.annotation.DubboReference; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -9,6 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.dromara.property.mapper.ResidentPersonMapper; +import org.dromara.resource.api.RemoteMessageService; import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.CustomerNoticesBo; import org.dromara.property.domain.vo.CustomerNoticesVo; @@ -16,9 +20,11 @@ import org.dromara.property.domain.CustomerNotices; import org.dromara.property.mapper.CustomerNoticesMapper; import org.dromara.property.service.ICustomerNoticesService; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.stream.Collectors; /** * 客户服务-通知公告Service业务层处理 @@ -32,6 +38,9 @@ import java.util.Collection; public class CustomerNoticesServiceImpl implements ICustomerNoticesService { private final CustomerNoticesMapper baseMapper; + private final ResidentPersonMapper residentPersonMapper; + @DubboReference + private RemoteMessageService remoteMessageService; /** * 查询客户服务-通知公告 @@ -97,6 +106,16 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); + if(bo.getIsAll().equals("0")){ + remoteMessageService.publishAll(bo.getTitle()); + } + 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()); + } } return flag; } @@ -110,7 +129,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { @Override public Boolean updateByBo(CustomerNoticesBo bo) { CustomerNotices update = MapstructUtils.convert(bo, CustomerNotices.class); - validEntityBeforeSave(update); + validEntityBeforeUpdate(update); return baseMapper.updateById(update) > 0; } @@ -120,7 +139,12 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService { private void validEntityBeforeSave(CustomerNotices entity){ //TODO 做一些数据校验,如唯一约束 } - + /** + * 修改前的数据校验 + */ + private void validEntityBeforeUpdate(CustomerNotices entity){ + //TODO 做一些数据校验,如唯一约束 + } /** * 校验并批量删除客户服务-通知公告信息 * 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 a0a71154..9ae00baa 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 @@ -1,6 +1,7 @@ package org.dromara.property.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -78,30 +79,25 @@ public class MeetBookingServiceImpl implements IMeetBookingService { public TableDataInfo queryPageList(MeetBookingBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - - List units = result.getRecords().stream() - .map(vo -> vo.getUnit()) - .distinct() - .collect(Collectors.toList()); - List persons = result.getRecords().stream() - .map(vo -> vo.getPerson()) - .distinct() - .collect(Collectors.toList()); - List residentUnitVolist = residentUnitMapper.selectVoByIds(units); - List residentPersonsVolist = residentPersonMapper.selectVoByIds(persons); + List residentUnitVolist = residentUnitMapper.selectVoList(); + List residentPersonsVolist = residentPersonMapper.selectVoList(); List meetBookingVoList = new ArrayList<>(); result.getRecords().stream().forEach(s -> { - ResidentUnitVo residentUnitVo = residentUnitVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); - s.setUnitName(residentUnitVo.getName()); - ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); - s.setPersonName(residentPersonVo.getUserName()); - s.setPhone(residentPersonVo.getPhone()); + if (CollUtil.isNotEmpty(residentUnitVolist)) { + ResidentUnitVo residentUnitVo = residentUnitVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); + s.setUnitName(ObjectUtil.isNotEmpty(residentUnitVo) ? residentUnitVo.getName() : null); + } + if (CollUtil.isNotEmpty(residentPersonsVolist)) { + ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); + s.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo) ? residentPersonVo.getUserName() : null); + s.setPhone(ObjectUtil.isNotEmpty(residentPersonVo) ? residentPersonVo.getPhone() : null); + } meetBookingVoList.add(s); }); - return TableDataInfo.build(new Page().setRecords(meetBookingVoList)); + return TableDataInfo.build(new Page().setRecords(meetBookingVoList).setTotal(result.getTotal())); } /** 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 921918c5..116bb6ee 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 @@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; -import cn.idev.excel.event.Order; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -49,6 +48,7 @@ import java.util.stream.Collectors; public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { private final ServiceWorkOrdersMapper baseMapper; + private final ServiceWorkOrdersTypeMapper serviceWorkOrdersTypeMapper; private final ServiceWorkOrdersTypeMapper typesMapper; private final ResidentPersonMapper residentPersonMapper; private final ServiceWorkOrdersRecordMapper workOrdersRecordMapper; @@ -248,13 +248,15 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { /** * 工单服务看板 + * * @return */ @Override - public ServeceCustomerCountVo counts() { + public ServiceWorkOrderAnalysisVo counts() { List serviceWorkOrdersList = baseMapper.selectList(new QueryWrapper<>()); - // 总工单数 + // 原有逻辑不变... + // 总工单数 int workOrdersTotal = serviceWorkOrdersList.size(); // 待派送工单(status = "0") @@ -293,7 +295,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua()>= 4) .count(); - // 当月满意度(当月工单中满意的占比) + // 当月满意度(当月工单中满意的占比) int monthSatisfactionCount = (int) serviceWorkOrdersList.stream() .filter(order -> currentMonth.equals(order.getCreateTime()) && order.getServiceEvalua() != null @@ -302,8 +304,14 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { double monthoSatisfaction = monthOrdersTotal == 0 ? 0.0 : (double) monthSatisfactionCount / monthOrdersTotal * 100; + ServiceWorkOrderAnalysisVo serviceWorkOrderAnalysisVo =new ServiceWorkOrderAnalysisVo(); + // 获取近一周的工单统计 + List recentWeekData = getRecentWeekWorkOrders(serviceWorkOrdersList); - return new ServeceCustomerCountVo() + // 计算工单类型分布 + List workOrderTypeDistribution = calculateWorkOrderTypeDistribution(serviceWorkOrdersList); + + return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount() .setWorkOrdersTotal(workOrdersTotal) .setNotWorkOrdersTotal(notWorkOrdersTotal) .setNovertimeOrdersTotal(novertimeOrdersTotal) @@ -312,6 +320,66 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService { .setMonthOrdersTotal(monthOrdersTotal) .setOutTimeOrdersTotal(outTimeOrdersTotal) .setMonthoSatisfaction(monthoSatisfaction) - .setSatisfaction(satisfaction); + .setSatisfaction(satisfaction) + .setRecentWeekWorkOrders(recentWeekData) + .setWorkOrderTypeDistribution(workOrderTypeDistribution) + .build(); + } + + // 近一周工单统计方法 + private List getRecentWeekWorkOrders(List serviceWorkOrdersList) { + LocalDate today = LocalDate.now(); + List dateList = new ArrayList<>(); + for (int i = 6; i >= 0; i--) { + dateList.add(today.minusDays(i)); + } + + Map workOrdersByDate = serviceWorkOrdersList.stream() + .filter(order -> { + try { + LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime()); + return !createTime.isBefore(today.minusDays(7)); + } catch (Exception e) { + return false; + } + }) + .collect(Collectors.groupingBy( + order -> LocalDate.parse((CharSequence) order.getCreateTime()).format(DateTimeFormatter.ISO_LOCAL_DATE), + Collectors.counting() + )); + + DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter dayOfWeekFormatter = DateTimeFormatter.ofPattern("E"); + + List result = new ArrayList<>(); + for (LocalDate date : dateList) { + String dateStr = date.format(dateFormatter); + String dayOfWeek = date.format(dayOfWeekFormatter); + result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, workOrdersByDate.getOrDefault(dateStr, 0L))); + } + + return result; + } + + // 计算工单类型分布 + private List calculateWorkOrderTypeDistribution(List serviceWorkOrdersList) { + // 按 typeId 分组统计数量 + Map workOrderTypeCounts = serviceWorkOrdersList.stream() + .collect(Collectors.groupingBy(ServiceWorkOrders::getType, Collectors.counting())); + + long total = serviceWorkOrdersList.size(); + List result = new ArrayList<>(); + + for (Map.Entry entry : workOrderTypeCounts.entrySet()) { + Long typeId = entry.getKey(); + Long count = entry.getValue(); + // 查询类型名称 + ServiceWorkOrdersType serviceWorkOrdersType = serviceWorkOrdersTypeMapper.selectById(typeId); + String typeName = serviceWorkOrdersType != null ? serviceWorkOrdersType.getOrderTypeName() : "未知类型"; + // 计算占比(保留两位小数) + double percentage = Math.round(((double) count / total) * 10000) / 100.0; + result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName, count, percentage)); + } + return result; } } From e026c73627c6cb769221089aef222bd3fb1c2d2d Mon Sep 17 00:00:00 2001 From: yuyongle <1150359267@qq.com> Date: Wed, 23 Jul 2025 15:20:06 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E8=AE=B0=E5=BD=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CostPayFeeAuditServiceImpl.java | 34 +++++----- .../service/impl/MeetBookingServiceImpl.java | 64 ++++++++----------- 2 files changed, 43 insertions(+), 55 deletions(-) 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 32875ac2..32b4dc2b 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 @@ -76,27 +76,23 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService { if (CollUtil.isEmpty(result.getRecords())) { return TableDataInfo.build(result); } - List itemIdList = result.getRecords().stream() - .map(vo -> vo.getItemId()) - .distinct() - .collect(Collectors.toList()); - List roomIdList = result.getRecords().stream() - .map(vo -> vo.getChargeId()) - .distinct() - .collect(Collectors.toList()); - List costItemsVoList = costItemsMapper.selectVoByIds(itemIdList); - List roomVoList = roomMapper.selectVoByIds(roomIdList); + + List costItemsVoList = costItemsMapper.selectVoList(); + List roomVoList = roomMapper.selectVoList(); List costPayFeeAuditVoList = new ArrayList<>(); result.getRecords().stream().forEach(s -> { - CostItemsVo costItemsVo = costItemsVoList.stream() - .filter(vo -> vo.getId() != null && vo.getId().equals(s.getItemId())).findFirst().orElse(null); - s.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null); - s.setCostType(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getCostType() : null); - s.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null); - TbRoomVo tbRoomVo = roomVoList.stream() - .filter(vo -> vo.getId() != null && vo.getId().equals(s.getChargeId())).findFirst().orElse(null); - s.setRoomNumber(ObjectUtil.isNotEmpty(tbRoomVo) ? tbRoomVo.getRoomNumber() : null); - + if (CollUtil.isNotEmpty(costItemsVoList)) { + CostItemsVo costItemsVo = costItemsVoList.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getItemId())).findFirst().orElse(null); + s.setChargeItem(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeItem() : null); + s.setCostType(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getCostType() : null); + s.setChargeCycle(ObjectUtil.isNotEmpty(costItemsVo) ? costItemsVo.getChargeCycle() : null); + } + if (CollUtil.isNotEmpty(roomVoList)) { + TbRoomVo tbRoomVo = roomVoList.stream() + .filter(vo -> vo.getId() != null && vo.getId().equals(s.getChargeId())).findFirst().orElse(null); + s.setRoomNumber(ObjectUtil.isNotEmpty(tbRoomVo) ? tbRoomVo.getRoomNumber() : null); + } costPayFeeAuditVoList.add(s); }); Page costPayFeeAuditVoPage = new Page() 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 9ae00baa..521d268d 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 @@ -59,12 +59,12 @@ public class MeetBookingServiceImpl implements IMeetBookingService { MeetBookingDetailVo meetBookingDetailVo = BeanUtil.copyProperties(meetBookingVo, MeetBookingDetailVo.class); MeetVo meetVo = meetMapper.selectVoById(meetBookingDetailVo.getMeetId()); String locationName = roomMapper.queryRoomName(Long.valueOf(meetVo.getLocation())); - meetBookingDetailVo.setLocationName(locationName); + meetBookingDetailVo.setLocationName(ObjectUtil.isNotEmpty(locationName)?locationName:null); ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(Long.valueOf(meetBookingVo.getPerson())); - meetBookingDetailVo.setPersonName(residentPersonVo.getUserName()); + meetBookingDetailVo.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getUserName():null); meetBookingDetailVo.setPhone(residentPersonVo.getPhone()); ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBookingVo.getUnit())); - meetBookingDetailVo.setUnitName(residentUnitVo.getName()); + meetBookingDetailVo.setUnitName(ObjectUtil.isNotEmpty(residentPersonVo)?residentUnitVo.getName():null); return meetBookingDetailVo; } @@ -121,25 +121,21 @@ public class MeetBookingServiceImpl implements IMeetBookingService { } List meetBookingAppointmentVoList = MapstructUtils.convert(meetBookings, MeetBookingAppointmentVo.class); SimpleDateFormat df = new SimpleDateFormat("HH"); - List units = meetBookingAppointmentVoList.stream() - .map(vo -> vo.getUnit()) - .distinct() - .collect(Collectors.toList()); - List persons = meetBookingAppointmentVoList.stream() - .map(vo -> vo.getPerson()) - .distinct() - .collect(Collectors.toList()); - List residentUnitVolist = residentUnitMapper.selectVoByIds(units); - List residentPersonsVolist = residentPersonMapper.selectVoByIds(persons); + List residentUnitVolist = residentUnitMapper.selectVoList(); + List residentPersonsVolist = residentPersonMapper.selectVoList(); meetBookingAppointmentVoList.stream().forEach( s -> { - ResidentUnitVo residentUnitVo = residentUnitVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); - s.setUnitName(residentUnitVo.getName()); - ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); - s.setPersonName(residentPersonVo.getUserName()); - s.setPhone(residentPersonVo.getPhone()); + if (CollUtil.isNotEmpty(residentUnitVolist)) { + ResidentUnitVo residentUnitVo = residentUnitVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); + s.setUnitName(residentUnitVo.getName()); + } + if (CollUtil.isNotEmpty(residentPersonsVolist)) { + ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); + s.setPersonName(residentPersonVo.getUserName()); + s.setPhone(residentPersonVo.getPhone()); + } String str = df.format(s.getScheduledStarttime()); int a = Integer.parseInt(str); s.setSlots(a <= 12 ? "上午" : "下午"); @@ -184,23 +180,19 @@ public class MeetBookingServiceImpl implements IMeetBookingService { String[] weekStr = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; List meetBookingWeekList = new ArrayList<>(); SimpleDateFormat df = new SimpleDateFormat("HH"); - List units = meetBookingVoList.stream() - .map(vo -> vo.getUnit()) - .distinct() - .collect(Collectors.toList()); - List persons = meetBookingVoList.stream() - .map(vo -> vo.getPerson()) - .distinct() - .collect(Collectors.toList()); - List residentUnitVolist = residentUnitMapper.selectVoByIds(units); - List residentPersonsVolist = residentPersonMapper.selectVoByIds(persons); + List residentUnitVolist = residentUnitMapper.selectVoList(); + List residentPersonsVolist = residentPersonMapper.selectVoList(); meetBookingWeekVoList.stream().forEach(s -> { - ResidentUnitVo residentUnitVo = residentUnitVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); - s.setUnitName(residentUnitVo.getName()); - ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() - .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); - s.setPersonName(residentPersonVo.getUserName()); + if (CollUtil.isNotEmpty(residentUnitVolist)) { + ResidentUnitVo residentUnitVo = residentUnitVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getUnit())).findFirst().orElse(null); + s.setUnitName(residentUnitVo.getName()); + } + if (CollUtil.isNotEmpty(residentPersonsVolist)) { + ResidentPersonVo residentPersonVo = residentPersonsVolist.stream() + .filter(vo -> vo.getId() != null && String.valueOf(vo.getId()).equals(s.getPerson())).findFirst().orElse(null); + s.setPersonName(residentPersonVo.getUserName()); + } //设置指定的Date对象不设置默认返回当天的星期 calendar.setTime(s.getScheduledStarttime()); //获取当前时间的星期 From 5da06650920f7ad137d5ddd3d94263a615ccfd6a Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Wed, 23 Jul 2025 16:20:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=80=83=E5=8B=A4=E7=BB=84bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../property/domain/bo/AttendanceGroupBo.java | 4 +- .../AttendanceArrangementServiceImpl.java | 24 +++------ .../impl/AttendanceGroupServiceImpl.java | 49 ++++++++++--------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java index 68925240..e4d67b5f 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java @@ -9,6 +9,7 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import org.dromara.property.domain.AttendanceWeekSet; import java.util.Date; import java.util.List; @@ -51,7 +52,8 @@ public class AttendanceGroupBo extends BaseEntity { private Long shiftId; - List weekList; + List numList; + List weekSetList; //前端传必须打卡还是无需打卡 private Integer mustNoCheck; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java index 1a2543df..5181deca 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceArrangementServiceImpl.java @@ -1,32 +1,24 @@ package org.dromara.property.service.impl; -import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; -import com.alibaba.druid.sql.ast.statement.SQLIfStatement; -import org.dromara.common.core.utils.MapstructUtils; -import org.dromara.common.core.utils.StringUtils; -import org.dromara.common.mybatis.core.page.TableDataInfo; -import org.dromara.common.mybatis.core.page.PageQuery; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +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.*; -import org.dromara.property.domain.constant.StatusConstant; -import org.dromara.property.domain.vo.AttendanceWeekSetVo; -import org.dromara.property.mapper.*; -import org.springframework.beans.BeanUtils; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; import org.dromara.property.domain.bo.AttendanceArrangementBo; +import org.dromara.property.domain.constant.StatusConstant; import org.dromara.property.domain.vo.AttendanceArrangementVo; +import org.dromara.property.mapper.*; import org.dromara.property.service.IAttendanceArrangementService; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDate; -import java.time.LocalTime; -import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java index ba0b113f..c5b1c5f6 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java @@ -154,21 +154,26 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { //2.固定班制 if (Objects.equals(add.getAttendanceType(), FIXEDSCHEDULE)) { //2.1固定班制,向周期表插入数据 - //拿到考勤组的id,遍历weekList - for (Integer week : bo.getWeekList()) { - //向工作表中插入数据 - AttendanceWeekSet weekSet = new AttendanceWeekSet(); - weekSet.setGroupId(add.getId()); - weekSet.setDayOfWeek(week); - } - //通过考勤组的id拿到周期表的所有关联id - List weekSets = weekSetMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceWeekSet::getGroupId, add.getId())); - //2.2遍历周期表,向班次和周设置表的中间表插入数据 - for (AttendanceWeekSet weekSet : weekSets) { - AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); - attendanceWeeksetShift.setWeekSetId(weekSet.getId()); - attendanceWeeksetShift.setShiftId(bo.getShiftId()); - } + + //判断前端传进来有几条数据 + bo.getWeekSetList().forEach( + weekSet -> { + //向周期表插入数据 + AttendanceWeekSet attendanceWeekSet = new AttendanceWeekSet(); + BeanUtils.copyProperties(weekSet, attendanceWeekSet); + attendanceWeekSet.setGroupId(add.getId()); + attendanceWeekSet.setDayOfWeek(weekSet.getDayOfWeek()); + weekSetMapper.insert(attendanceWeekSet); + //查询出周期表的id + Long weekSetId = attendanceWeekSet.getId(); + //向中间表插入周期的id + AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); + attendanceWeeksetShift.setWeekSetId(weekSetId); + attendanceWeeksetShift.setShiftId(bo.getShiftId()); + attendanceWeeksetShiftMapper.insert(attendanceWeeksetShift); + } + ); + //todo: 法定节假日自动排休 //2.3.新增打卡日期表 @@ -188,17 +193,17 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { //2.2排班制,向天数表中插入数据 AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle(); //循环向周期表中插入数据 - for (Integer week : bo.getWeekList()) { + for (Integer week : bo.getNumList()) { attendanceScheduleCycle.setGroupId(add.getId()); attendanceScheduleCycle.setDayNumber(week); - } - //通过考勤组id拿到日期表的所有关联id - List scheduleCycles = attendanceScheduleCycleMapper.selectList(Wrappers.lambdaQuery().eq(AttendanceScheduleCycle::getGroupId, add.getId())); - //2.3遍历日期表,向班次和周设置表的中间表插入数据 - for (AttendanceScheduleCycle scheduleCycle : scheduleCycles) { + attendanceScheduleCycleMapper.insert(attendanceScheduleCycle); + //获取周期表的id + Long scheduleId = attendanceScheduleCycle.getId(); + //向中间表插入周期的id AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); - attendanceWeeksetShift.setScheduleId(scheduleCycle.getId()); + attendanceWeeksetShift.setWeekSetId(scheduleId); attendanceWeeksetShift.setShiftId(bo.getShiftId()); + attendanceWeeksetShiftMapper.insert(attendanceWeeksetShift); } } From 919d0937cd0013e593f30b7c5e82c3e14e0ad23f Mon Sep 17 00:00:00 2001 From: dy <2389062315@qq.com> Date: Wed, 23 Jul 2025 17:13:41 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=80=83=E5=8B=A4=E7=BB=84bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../property/domain/bo/AttendanceGroupBo.java | 3 ++- .../impl/AttendanceGroupServiceImpl.java | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java index e4d67b5f..3f184391 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/domain/bo/AttendanceGroupBo.java @@ -9,6 +9,7 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import org.dromara.property.domain.AttendanceScheduleCycle; import org.dromara.property.domain.AttendanceWeekSet; import java.util.Date; @@ -52,7 +53,7 @@ public class AttendanceGroupBo extends BaseEntity { private Long shiftId; - List numList; + List numList; List weekSetList; //前端传必须打卡还是无需打卡 diff --git a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java index c5b1c5f6..1d6856e2 100644 --- a/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java +++ b/ruoyi-modules/Property/src/main/java/org/dromara/property/service/impl/AttendanceGroupServiceImpl.java @@ -193,18 +193,21 @@ public class AttendanceGroupServiceImpl implements IAttendanceGroupService { //2.2排班制,向天数表中插入数据 AttendanceScheduleCycle attendanceScheduleCycle = new AttendanceScheduleCycle(); //循环向周期表中插入数据 - for (Integer week : bo.getNumList()) { - attendanceScheduleCycle.setGroupId(add.getId()); - attendanceScheduleCycle.setDayNumber(week); - attendanceScheduleCycleMapper.insert(attendanceScheduleCycle); - //获取周期表的id - Long scheduleId = attendanceScheduleCycle.getId(); - //向中间表插入周期的id - AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); - attendanceWeeksetShift.setWeekSetId(scheduleId); - attendanceWeeksetShift.setShiftId(bo.getShiftId()); - attendanceWeeksetShiftMapper.insert(attendanceWeeksetShift); - } + bo.getNumList().forEach( + num -> { + attendanceScheduleCycle.setGroupId(add.getId()); + attendanceScheduleCycle.setDayNumber(num.getDayNumber()); + attendanceScheduleCycleMapper.insert(attendanceScheduleCycle); + //获取周期表的id + Long scheduleId = attendanceScheduleCycle.getId(); + //向中间表插入周期的id + AttendanceWeeksetShift attendanceWeeksetShift = new AttendanceWeeksetShift(); + attendanceWeeksetShift.setWeekSetId(scheduleId); + attendanceWeeksetShift.setShiftId(bo.getShiftId()); + attendanceWeeksetShiftMapper.insert(attendanceWeeksetShift); + } + ); + }