Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
zcxlsm 2025-08-06 20:37:29 +08:00
commit 3d6fa49e8f
5 changed files with 80 additions and 30 deletions

View File

@ -41,13 +41,22 @@ public class InspectionRoutePointVo implements Serializable {
*/ */
@ExcelProperty(value = "巡检路线id") @ExcelProperty(value = "巡检路线id")
private Long routeId; private Long routeId;
/**
* 巡检路线名称
*/
@ExcelProperty(value = "巡检路线名称")
private Long routeName;
/** /**
* 巡检点id * 巡检点id
*/ */
@ExcelProperty(value = "巡检点id") @ExcelProperty(value = "巡检点id")
private Long pointId; private Long pointId;
/**
* 巡检点名称
*/
@ExcelProperty(value = "巡检点名称")
private String pointName;
/** /**
* 开始时间 * 开始时间
*/ */

View File

@ -9,6 +9,7 @@ import org.dromara.property.domain.InspectionRoute;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
@ -57,6 +58,8 @@ public class InspectionRouteVo implements Serializable {
*/ */
@ExcelProperty(value = "搜索值") @ExcelProperty(value = "搜索值")
private String searchValue; private String searchValue;
/**
* 巡检点
*/
List<InspectionRoutePointVo> inspectionRoutePointVoList;
} }

View File

@ -67,9 +67,7 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
//将排班人员信息添加到排班信息中 //将排班人员信息添加到排班信息中
AttendanceArrangementVo vo = baseMapper.selectVoById(id); AttendanceArrangementVo vo = baseMapper.selectVoById(id);
vo.setUserGroupList(userGroupList); vo.setUserGroupList(userGroupList);
return vo;
return baseMapper.selectVoById(id);
} }
/** /**
@ -318,8 +316,6 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
// // 2. 根据日历的开始时间和结束时间查询出每一天的排班信息 // // 2. 根据日历的开始时间和结束时间查询出每一天的排班信息
// // 2.1 循环日历的开始时间和结束时间判断 calendarStartDate 在哪些排班中 // // 2.1 循环日历的开始时间和结束时间判断 calendarStartDate 在哪些排班中
// List<AttendanceArrangementVo> result = new ArrayList<>(); // List<AttendanceArrangementVo> result = new ArrayList<>();
//
//
// //查询所有排班信息 // //查询所有排班信息
// List<AttendanceArrangement> arrangementList1 = baseMapper.selectList(); // List<AttendanceArrangement> arrangementList1 = baseMapper.selectList();
// //取出排班的开始时间和结束时间 // //取出排班的开始时间和结束时间
@ -335,25 +331,16 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
// if (count >= startDateList.size() || count >= endDateList.size()){ // if (count >= startDateList.size() || count >= endDateList.size()){
// continue; // continue;
// } // }
//
//
//
//// // 查询指定日期在哪些排班中 //// // 查询指定日期在哪些排班中
//// List<AttendanceArrangement> arrangementList = baseMapper.selectList( //// List<AttendanceArrangement> arrangementList = baseMapper.selectList(
//// Wrappers.<AttendanceArrangement>lambdaQuery() //// Wrappers.<AttendanceArrangement>lambdaQuery()
//// .between(AttendanceArrangement::getStartDate, date.atStartOfDay(ZoneId.systemDefault()).toInstant(), //// .between(AttendanceArrangement::getStartDate, date.atStartOfDay(ZoneId.systemDefault()).toInstant(),
//// date.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1))); //// date.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1)));
//
//
// // 查询指定日期在哪些排班中 // // 查询指定日期在哪些排班中
// List<AttendanceArrangement> arrangementList = baseMapper.selectList( // List<AttendanceArrangement> arrangementList = baseMapper.selectList(
// Wrappers.<AttendanceArrangement>lambdaQuery() // Wrappers.<AttendanceArrangement>lambdaQuery()
// .between(AttendanceArrangement::getStartDate, startDateList.get(count).atStartOfDay(ZoneId.systemDefault()).toInstant(), // .between(AttendanceArrangement::getStartDate, startDateList.get(count).atStartOfDay(ZoneId.systemDefault()).toInstant(),
// endDateList.get(count).atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1))); // endDateList.get(count).atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant().minusSeconds(1)));
//
//
//
//
//// //根据arrangementList查询出排班的id //// //根据arrangementList查询出排班的id
//// List<Long> scheduleIdList = arrangementList.stream().map(AttendanceArrangement::getId).toList(); //// List<Long> scheduleIdList = arrangementList.stream().map(AttendanceArrangement::getId).toList();
//// //根据排班的id查询出排班的人员详细信息 //// //根据排班的id查询出排班的人员详细信息
@ -407,7 +394,6 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
// count++; // count++;
// } // }
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@ -511,6 +497,10 @@ public class AttendanceArrangementServiceImpl implements IAttendanceArrangementS
*/ */
private void validEntityBeforeSave(AttendanceArrangement entity) { private void validEntityBeforeSave(AttendanceArrangement entity) {
//TODO 做一些数据校验,如唯一约束 //TODO 做一些数据校验,如唯一约束
//新增时判断在该时间段内是否有排班
} }
/** /**

View File

@ -156,7 +156,7 @@ public class DepotLogServiceImpl implements IDepotLogService {
} }
depotLogVo.setAssetName(CollUtil.isNotEmpty(assetNamesByIds)?assetNamesByIds.get(depotLogVo.getAssetId()):null); depotLogVo.setAssetName(CollUtil.isNotEmpty(assetNamesByIds)?assetNamesByIds.get(depotLogVo.getAssetId()):null);
depotLogVo.setDepotName(CollUtil.isNotEmpty(depotNamesByIds)?depotNamesByIds.get(depotLogVo.getDepotName()):null); depotLogVo.setDepotName(CollUtil.isNotEmpty(depotNamesByIds)?depotNamesByIds.get(depotLogVo.getDepotId()):null);
depotLogVo.setUserName(CollUtil.isNotEmpty(userNamesByIds)?userNamesByIds.get(depotLogVo.getUserId()):remoteUserService.selectNicknameById(depotLogVo.getUserId())); depotLogVo.setUserName(CollUtil.isNotEmpty(userNamesByIds)?userNamesByIds.get(depotLogVo.getUserId()):remoteUserService.selectNicknameById(depotLogVo.getUserId()));
} }

View File

@ -1,5 +1,7 @@
package org.dromara.property.service.impl; package org.dromara.property.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -12,7 +14,11 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.InspectionRoute; import org.dromara.property.domain.InspectionRoute;
import org.dromara.property.domain.InspectionRoutePoint; import org.dromara.property.domain.InspectionRoutePoint;
import org.dromara.property.domain.bo.InspectionRouteBo; import org.dromara.property.domain.bo.InspectionRouteBo;
import org.dromara.property.domain.bo.InspectionRoutePointBo;
import org.dromara.property.domain.vo.InspectionPointVo;
import org.dromara.property.domain.vo.InspectionRoutePointVo;
import org.dromara.property.domain.vo.InspectionRouteVo; import org.dromara.property.domain.vo.InspectionRouteVo;
import org.dromara.property.mapper.InspectionPointMapper;
import org.dromara.property.mapper.InspectionRouteMapper; import org.dromara.property.mapper.InspectionRouteMapper;
import org.dromara.property.mapper.InspectionRoutePointMapper; import org.dromara.property.mapper.InspectionRoutePointMapper;
import org.dromara.property.service.IInspectionRouteService; import org.dromara.property.service.IInspectionRouteService;
@ -37,6 +43,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
private final InspectionRouteMapper baseMapper; private final InspectionRouteMapper baseMapper;
private final InspectionRoutePointMapper routePointMapper; private final InspectionRoutePointMapper routePointMapper;
private final InspectionPointMapper pointMapper;
/** /**
* 查询巡检路线 * 查询巡检路线
@ -45,8 +52,11 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
* @return 巡检路线 * @return 巡检路线
*/ */
@Override @Override
public InspectionRouteVo queryById(Long id){ public InspectionRouteVo queryById(Long id) {
return baseMapper.selectVoById(id); InspectionRouteVo inspectionRouteVo= baseMapper.selectVoById(id);
List<InspectionPointVo> inspectionPointVoList = pointMapper.selectVoList();
processingData(inspectionRouteVo,inspectionPointVoList);
return inspectionRouteVo;
} }
/** /**
@ -60,6 +70,11 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
public TableDataInfo<InspectionRouteVo> queryPageList(InspectionRouteBo bo, PageQuery pageQuery) { public TableDataInfo<InspectionRouteVo> queryPageList(InspectionRouteBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<InspectionRoute> lqw = buildQueryWrapper(bo); LambdaQueryWrapper<InspectionRoute> lqw = buildQueryWrapper(bo);
Page<InspectionRouteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); Page<InspectionRouteVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
List<InspectionPointVo> inspectionPointVoList = pointMapper.selectVoList();
result.getRecords().stream().forEach(s->{
processingData(s,inspectionPointVoList);
});
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
@ -84,6 +99,20 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
return lqw; return lqw;
} }
/**
* 处理数据
*/
private void processingData(InspectionRouteVo inspectionRouteVo, List<InspectionPointVo> inspectionPointVoList) {
LambdaQueryWrapper<InspectionRoutePoint> routePointLambdaQueryWrapper = new LambdaQueryWrapper<>();
routePointLambdaQueryWrapper.eq(InspectionRoutePoint::getRouteId, inspectionRouteVo.getId());
List<InspectionRoutePointVo> inspectionRoutePointVoList = routePointMapper.selectVoList(routePointLambdaQueryWrapper);
inspectionRoutePointVoList.stream().forEach(s->{
InspectionPointVo inspectionPointVo = inspectionPointVoList.stream().filter(vo -> vo.getId() != null && vo.getId().equals(s.getPointId())).findFirst().orElse(null);
s.setPointName(ObjectUtil.isNotEmpty(inspectionPointVo)? inspectionPointVo.getPointName():null);
});
inspectionRouteVo.setInspectionRoutePointVoList(inspectionRoutePointVoList);
}
/** /**
* 新增巡检路线 * 新增巡检路线
* *
@ -99,12 +128,12 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
if (flag) { if (flag) {
bo.setId(add.getId()); bo.setId(add.getId());
List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream() List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream()
.map(pointBo -> { .map(pointBo -> {
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class); InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
point.setRouteId(add.getId()); point.setRouteId(add.getId());
return point; return point;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
routePointMapper.insertBatch(routePointList); routePointMapper.insertBatch(routePointList);
} }
return flag; return flag;
@ -120,17 +149,36 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionRouteBo bo) { public Boolean updateByBo(InspectionRouteBo bo) {
InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class); InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class);
validEntityBeforeSave(update); validEntityBeforeUpdate(bo);
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;
} }
/** /**
* 保存前的数据校验 * 保存前的数据校验
*/ */
private void validEntityBeforeSave(InspectionRoute entity){ private void validEntityBeforeSave(InspectionRoute entity) {
//TODO 做一些数据校验,如唯一约束 //TODO 做一些数据校验,如唯一约束
} }
/**
* 保存前的数据校验
*/
private void validEntityBeforeUpdate(InspectionRouteBo bo) {
//TODO 做一些数据校验,如唯一约束
LambdaQueryWrapper<InspectionRoutePoint> routePointLambdaQueryWrapper = new LambdaQueryWrapper<>();
routePointLambdaQueryWrapper.eq(InspectionRoutePoint::getRouteId, bo.getId());
routePointMapper.delete(routePointLambdaQueryWrapper);
List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream()
.map(pointBo -> {
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
point.setRouteId(bo.getId());
return point;
})
.collect(Collectors.toList());
routePointMapper.insertBatch(routePointList);
}
/** /**
* 校验并批量删除巡检路线信息 * 校验并批量删除巡检路线信息
* *
@ -141,7 +189,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){ if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验 //TODO 做一些业务上的校验,判断是否需要校验
} }
return baseMapper.deleteByIds(ids) > 0; return baseMapper.deleteByIds(ids) > 0;