This commit is contained in:
parent
81ebb3e8c1
commit
c49bc001bb
@ -40,7 +40,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
/**
|
||||
* 查询客户服务-通知公告列表
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:list")
|
||||
//@SaCheckPermission("domain:notices:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CustomerNoticesVo> list(CustomerNoticesBo bo, PageQuery pageQuery) {
|
||||
return customerNoticesService.queryPageList(bo, pageQuery);
|
||||
@ -62,7 +62,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:query")
|
||||
//@SaCheckPermission("domain:notices:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<CustomerNoticesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
|
@ -22,7 +22,7 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
|
||||
public LineChartVo() {}
|
||||
|
||||
public LineChartVo(String date, String dayOfWeek, long count) {
|
||||
public LineChartVo(String date, String dayOfWeek, long count,long weekCount) {
|
||||
this.date = date;
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
this.count = count;
|
||||
|
@ -73,7 +73,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
String usernames = filteredList.stream()
|
||||
.map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法
|
||||
.collect(Collectors.joining(","));
|
||||
customerNoticesVo.setIssuersName(StringUtils.isNotBlank(usernames)?usernames:null);
|
||||
customerNoticesVo.setNoticePersionName(StringUtils.isNotBlank(usernames)?usernames:null);
|
||||
}
|
||||
}
|
||||
return customerNoticesVo;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -147,7 +148,7 @@ public class MachineTypeServiceImpl implements IMachineTypeService {
|
||||
if (CollUtil.isEmpty(machineTypeVoList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = MapstructUtils.convert(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = BeanUtil.copyToList(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
// 2. 构建树结构
|
||||
return buildMachineTypeTree(machineTypeTreeVoList);
|
||||
|
||||
|
@ -379,33 +379,52 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
dateList.add(today.minusDays(i));
|
||||
}
|
||||
|
||||
Map<String, Long> 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()
|
||||
));
|
||||
// 按日期分组:统计总数量 和 已处理数量
|
||||
Map<String, Long> totalWorkOrdersByDate = new HashMap<>();
|
||||
Map<String, Long> processedWorkOrdersByDate = new HashMap<>();
|
||||
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
|
||||
|
||||
for (ServiceWorkOrders order : serviceWorkOrdersList) {
|
||||
try {
|
||||
LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime());
|
||||
if (createTime.isBefore(today.minusDays(7))) {
|
||||
continue; // 跳过超过7天的数据
|
||||
}
|
||||
|
||||
String dateStr = createTime.format(dateFormatter);
|
||||
|
||||
// 总数 +1
|
||||
totalWorkOrdersByDate.put(dateStr, totalWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
|
||||
// 如果已处理,processed +1
|
||||
if (isProcessed(order)) {
|
||||
processedWorkOrdersByDate.put(dateStr, processedWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 忽略格式错误的日期
|
||||
}
|
||||
}
|
||||
|
||||
DateTimeFormatter dateFormatterFull = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dayOfWeekFormatter = DateTimeFormatter.ofPattern("E");
|
||||
|
||||
List<ServiceWorkOrderAnalysisVo.LineChartVo> result = new ArrayList<>();
|
||||
for (LocalDate date : dateList) {
|
||||
String dateStr = date.format(dateFormatter);
|
||||
String dateStr = date.format(dateFormatterFull);
|
||||
String dayOfWeek = date.format(dayOfWeekFormatter);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, workOrdersByDate.getOrDefault(dateStr, 0L)));
|
||||
long total = totalWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
long processed = processedWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, total, processed));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isProcessed(ServiceWorkOrders order) {
|
||||
// 假设有一个字段 status 表示状态,"COMPLETED" 表示已处理
|
||||
return "4".equalsIgnoreCase(order.getStatus());
|
||||
}
|
||||
// 计算工单类型分布
|
||||
private List<ServiceWorkOrderAnalysisVo.PieChartVo> calculateWorkOrderTypeDistribution(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||
// 按 typeId 分组统计数量
|
||||
|
Loading…
Reference in New Issue
Block a user