Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
dy
2025-08-06 16:48:15 +08:00
26 changed files with 672 additions and 93 deletions

View File

@@ -65,7 +65,7 @@ public class ServiceWorkOrdersTypeController extends BaseController {
@SaCheckPermission("system:workOrdersType:query")
@GetMapping("/{id}")
public R<ServiceWorkOrdersTypeVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("id") Long id) {
@PathVariable("id") Long id) {
return R.ok(serviceWorkOrdersTypeService.queryById(id));
}
@@ -110,6 +110,18 @@ public class ServiceWorkOrdersTypeController extends BaseController {
@SaCheckPermission("system:workOrdersType:list")
@GetMapping("/typeTree")
public R<List<ServiceWorkOrdersTypeVo>> typeTree() {
return R.ok(serviceWorkOrdersTypeService.typeTree()) ;
return R.ok(serviceWorkOrdersTypeService.typeTree());
}
/**
* 工单类型不分页查询
*
* @param bo 工单类型
* @return 工单类型列表
*/
@SaCheckPermission("system:workOrdersType:list")
@GetMapping("/queryList")
public R<List<ServiceWorkOrdersTypeVo>> queryList(ServiceWorkOrdersTypeBo bo) {
return R.ok(serviceWorkOrdersTypeService.queryList(bo));
}
}

View File

@@ -65,6 +65,7 @@ public class ServiceWorkOrdersType extends TenantEntity {
/**
*上级类型id
*/
@TableField(updateStrategy = FieldStrategy.ALWAYS)
private Long parentId;
}

View File

@@ -65,4 +65,11 @@ public class ServiceWorkOrdersTypeBo extends BaseEntity {
*/
private Long parentId;
/**
* 是否过滤子级
*/
private Boolean filterSubNodes;
private Long excludeId;
}

View File

@@ -41,13 +41,22 @@ public class InspectionRoutePointVo implements Serializable {
*/
@ExcelProperty(value = "巡检路线id")
private Long routeId;
/**
* 巡检路线名称
*/
@ExcelProperty(value = "巡检路线名称")
private Long routeName;
/**
* 巡检点id
*/
@ExcelProperty(value = "巡检点id")
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.Serializable;
import java.util.Date;
import java.util.List;
/**
@@ -57,6 +58,8 @@ public class InspectionRouteVo implements Serializable {
*/
@ExcelProperty(value = "搜索值")
private String searchValue;
/**
* 巡检点
*/
List<InspectionRoutePointVo> inspectionRoutePointVoList;
}

View File

@@ -5,17 +5,14 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.core.domain.TreeNode;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.property.api.RemoteFloorService;
import org.dromara.property.api.domain.vo.RemoteFloorVo;
import org.dromara.property.domain.vo.TbBuildingVo;
import org.dromara.property.domain.vo.TbCommunityVo;
import org.dromara.property.domain.vo.TbFloorVo;
import org.dromara.property.domain.vo.TbUnitVo;
import org.dromara.property.service.ITbBuildingService;
import org.dromara.property.service.ITbCommunityService;
import org.dromara.property.service.ITbFloorService;
import org.dromara.property.service.ITbUnitService;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +29,6 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
private final ITbCommunityService tbCommunityService;
private final ITbBuildingService tbBuildingService;
private final ITbUnitService unitService;
private final ITbFloorService floorService;
@Override
@@ -72,20 +68,6 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
return node;
}).toList();
treeList.addAll(l2);
List<TbUnitVo> tbUnitVos = unitService.queryAll();
if (tbUnitVos == null || tbUnitVos.isEmpty()) {
return treeList;
}
List<TreeNode<Long>> l3 = tbUnitVos.stream().map(item -> {
TreeNode<Long> node = new TreeNode<>();
node.setLevel(3);
node.setCode(item.getId());
node.setParentCode(item.getBuildingId());
node.setLabel(item.getUnitName());
return node;
}).toList();
treeList.addAll(l3);
List<TbFloorVo> tbFloorVos = floorService.queryAll();
if (tbFloorVos == null || tbFloorVos.isEmpty()) {
return treeList;
@@ -94,7 +76,7 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
TreeNode<Long> node = new TreeNode<>();
node.setLevel(4);
node.setCode(item.getId());
node.setParentCode(item.getUnitId());
node.setParentCode(item.getBuildingId());
node.setLabel(item.getFloorName());
return node;
}).toList();
@@ -109,7 +91,7 @@ public class RemoteFloorServiceImpl implements RemoteFloorService {
* @return 楼层
*/
@Override
public List<RemoteFloorVo> queryByBuildingId(Long buildingId){
public List<RemoteFloorVo> queryByBuildingId(Long buildingId) {
List<TbFloorVo> tbFloorVo = floorService.queryByBuildingId(buildingId);
List<RemoteFloorVo> remoteFloorVos = new ArrayList<>();

View File

@@ -156,7 +156,7 @@ public class DepotLogServiceImpl implements IDepotLogService {
}
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()));
}

View File

@@ -1,5 +1,7 @@
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.StringUtils;
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.InspectionRoutePoint;
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.mapper.InspectionPointMapper;
import org.dromara.property.mapper.InspectionRouteMapper;
import org.dromara.property.mapper.InspectionRoutePointMapper;
import org.dromara.property.service.IInspectionRouteService;
@@ -37,6 +43,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
private final InspectionRouteMapper baseMapper;
private final InspectionRoutePointMapper routePointMapper;
private final InspectionPointMapper pointMapper;
/**
* 查询巡检路线
@@ -45,8 +52,11 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
* @return 巡检路线
*/
@Override
public InspectionRouteVo queryById(Long id){
return baseMapper.selectVoById(id);
public InspectionRouteVo queryById(Long 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) {
LambdaQueryWrapper<InspectionRoute> lqw = buildQueryWrapper(bo);
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);
}
@@ -84,6 +99,20 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
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) {
bo.setId(add.getId());
List<InspectionRoutePoint> routePointList = bo.getInspectionRoutePointBoList().stream()
.map(pointBo -> {
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
point.setRouteId(add.getId());
return point;
})
.collect(Collectors.toList());
.map(pointBo -> {
InspectionRoutePoint point = MapstructUtils.convert(pointBo, InspectionRoutePoint.class);
point.setRouteId(add.getId());
return point;
})
.collect(Collectors.toList());
routePointMapper.insertBatch(routePointList);
}
return flag;
@@ -120,17 +149,36 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionRouteBo bo) {
InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class);
validEntityBeforeSave(update);
validEntityBeforeUpdate(bo);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(InspectionRoute entity){
private void validEntityBeforeSave(InspectionRoute entity) {
//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
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;

View File

@@ -1,6 +1,8 @@
package org.dromara.property.service.impl;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -43,7 +45,7 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
* @return 【工单类型】
*/
@Override
public ServiceWorkOrdersTypeVo queryById(Long id){
public ServiceWorkOrdersTypeVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@@ -81,6 +83,8 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
lqw.like(StringUtils.isNotBlank(bo.getOrderTypeName()), ServiceWorkOrdersType::getOrderTypeName, bo.getOrderTypeName());
lqw.eq(StringUtils.isNotBlank(bo.getOperationMode()), ServiceWorkOrdersType::getOperationMode, bo.getOperationMode());
lqw.eq(StringUtils.isNotBlank(bo.getSearchValue()), ServiceWorkOrdersType::getSearchValue, bo.getSearchValue());
lqw.isNull(bo.getFilterSubNodes() != null && bo.getFilterSubNodes(), ServiceWorkOrdersType::getParentId);
lqw.ne(bo.getExcludeId()!=null,ServiceWorkOrdersType::getId,bo.getExcludeId());
return lqw;
}
@@ -120,7 +124,7 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(ServiceWorkOrdersType entity){
private void validEntityBeforeSave(ServiceWorkOrdersType entity) {
//TODO 做一些数据校验,如唯一约束
}
@@ -134,7 +138,11 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<ServiceWorkOrdersType>().in(ServiceWorkOrdersType::getParentId, ids));
if (count > 0) {
throw new ServiceException("当前工单类型下存在子级类型,无法直接删除。");
}
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
@@ -142,18 +150,20 @@ public class ServiceWorkOrdersTypeServiceImpl implements IServiceWorkOrdersTypeS
/**
* 查询【工单类型】树结构
*
* @return 工单类型树结构
*/
@Override
public List<ServiceWorkOrdersTypeVo> typeTree() {
List<ServiceWorkOrdersTypeVo> list = baseMapper.selectVoList();
return buildTree(list,null);
return buildTree(list, null);
}
/**
* 递归构建树结构
* @param types 所有类型列表
*
* @param types 所有类型列表
* @param parentId 父节点id
* @return 树结构列表
*/