Commit ec536c21 authored by lisong's avatar lisong

修改bug

parent 59f89f21
This diff is collapsed.
This diff is collapsed.
......@@ -99,7 +99,7 @@ public class MaintenanceResourceController extends AbstractBaseController {
@ApiOperation("根据实例ID,获取维保设施资源树")
@GetMapping(value = "/findTreeById")
public List<MaintenanceResourceDto> findTreeByType(Long id) {
return maintenanceResourceService.findTreeById(id);
return maintenanceResourceService.findTreeById(id, getUserId(), getAppKey(), getProduct(), getToken());
}
/**
......
......@@ -162,4 +162,13 @@ public interface JcsFeign {
ResponseModel<List<OrgUsrDto>> getByAmosId(
@RequestParam(required = false) List<String> amosIds);
/**
* 根据amosId查询人员
*
* @return
*/
@RequestMapping(value = "/equip/getMaintenanceId", method = RequestMethod.GET, consumes = "application/json")
ResponseModel<Long> getMaintenanceId(
@RequestParam() String userId);
}
......@@ -78,7 +78,7 @@ public interface IMaintenanceResourceService extends IService<MaintenanceResourc
List<MaintenanceResourceDto> selectCompanyList(String appKey, String product, String token);
List<MaintenanceResourceDto> findTreeById(Long id);
List<MaintenanceResourceDto> findTreeById(Long id,String userId, String appKey, String product, String token);
List<MaintenanceResourceDto> selectOwnerUnitList(Long id, Integer type);
......
......@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.common.dto.WaterResourceDto;
import com.yeejoin.equipmanage.common.dto.WaterResourceTypeDto;
import com.yeejoin.equipmanage.common.entity.MaintenanceResource;
import com.yeejoin.equipmanage.common.entity.MaintenanceResourceData;
import com.yeejoin.equipmanage.common.entity.publics.BaseTreeNode;
import com.yeejoin.equipmanage.common.enums.MaintenanceResourceEnum;
import com.yeejoin.equipmanage.common.utils.TreeNodeUtil;
import com.yeejoin.equipmanage.common.vo.MaintenanceResourceDataVo;
......@@ -24,13 +25,16 @@ import com.yeejoin.equipmanage.service.IMaintenanceResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.minBy;
import static java.util.stream.Collectors.toList;
/**
* 维保设施资源树Service业务层处理
......@@ -214,14 +218,25 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
}
@Override
public List<MaintenanceResourceDto> findTreeById(Long id) {
List<MaintenanceResourceDto> list = maintenanceResourceMapper.findTreeById(id);
if (!CollectionUtils.isEmpty(list)) {
List<MaintenanceResourceDto> dtoList = TreeNodeUtil.assembleTreeNotFilter_1(list);//&& x.getId().equals(Long.toString(id)) 这一段用于生成树之后并没有把树子节点数据从list列表删除造成的脏数据的问题 by chenhao 2022-01-12
List<MaintenanceResourceDto> collect = dtoList.stream().filter(x -> !MaintenanceResourceEnum.CLASSIFY.getValue().equals(x.getType()) && x.getId().equals(Long.toString(id))).collect(Collectors.toList());
return collect;
public List<MaintenanceResourceDto> findTreeById(Long id, String userId, String appKey, String product, String token) {
ResponseModel<Long> maintenanceCompanyId = jcsFeign.getMaintenanceId(userId);
if (ObjectUtils.isEmpty(maintenanceCompanyId.getResult())){
return Lists.newArrayList();
}
return Lists.newArrayList();
List<MaintenanceResourceDto> maintenanceResourceTree = getMaintenanceResourceTree(appKey, product, token);
List<MaintenanceResourceDto> resourceTree = maintenanceResourceTree.stream().filter(x -> String.valueOf(maintenanceCompanyId.getResult()).equals(x.getId())).collect(Collectors.toList());
for (MaintenanceResourceDto maintenanceResourceDto : resourceTree) {
maintenanceResourceDto.setChildren(maintenanceResourceDto.getChildren().stream().filter(item -> id.toString().equals(item.getId())).collect(toList()));
}
// 原有代码查询 消防设施树存在重复数据 原因:mt_maintenance_resource 表中绑定机场单位id重复
// List<MaintenanceResourceDto> list = maintenanceResourceMapper.findTreeById(id);
// if (!CollectionUtils.isEmpty(list)) {
// List<MaintenanceResourceDto> dtoList = TreeNodeUtil.assembleTreeNotFilter_1(list);//&& x.getId().equals(Long.toString(id)) 这一段用于生成树之后并没有把树子节点数据从list列表删除造成的脏数据的问题 by chenhao 2022-01-12
// List<MaintenanceResourceDto> collect = dtoList.stream().filter(x -> !MaintenanceResourceEnum.CLASSIFY.getValue().equals(x.getType()) && x.getId().equals(Long.toString(id))).collect(Collectors.toList());
// return collect;
// }
return resourceTree;
}
@Override
......
......@@ -2,10 +2,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.List;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -52,4 +54,11 @@ public class EquipmentController extends BaseController {
public ResponseModel<List<MenuFrom>> getFireSystemWaterResourceList() {
return ResponseHelper.buildResponse(equipmentService.getFireSystemWaterResourceList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getMaintenanceId")
@ApiOperation(value = "查询人员绑定维保单位id")
public ResponseModel<Long> getMaintenanceId(@RequestParam() String userId) {
return ResponseHelper.buildResponse(equipmentService.getMaintenanceId(userId));
}
}
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
......@@ -8,10 +9,13 @@ import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceTypeDto;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.MaintenanceCompanyMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -34,6 +38,9 @@ public class EquipmentServiceImpl {
WaterResourceServiceImpl waterResourceServiceImpl;
@Autowired
private MaintenanceCompanyMapper maintenanceCompanyMapper;
@Autowired
private RedisUtils redisUtils;
public List<MenuFrom> getFireSystemList() {
// 导出模板增加权限
......@@ -118,4 +125,13 @@ public class EquipmentServiceImpl {
fireSystem.setChildren(children);
return fireSystemDtoList;
}
public Long getMaintenanceId(String userId){
List<MaintenanceCompany> maintenanceCompanies = maintenanceCompanyMapper.selectList(new QueryWrapper<MaintenanceCompany>()
.lambda().eq(MaintenanceCompany::getAmosId, userId).eq(MaintenanceCompany::getIsDelete, 0));
if (!CollectionUtils.isEmpty(maintenanceCompanies)){
return maintenanceCompanies.get(0).getParentId();
}else {
return null;
}
}
}
......@@ -16,6 +16,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -2131,6 +2132,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
// pageParam.put("bizType", bizType);
Page page = new Page(pageParam.getParamPageCurrent(), pageParam.getParamPageSize());
// 导入外部隐患信息已提交,不限制仅自己可见
LatentDangerBo lanDer = latentDangerMapper.getById(Long.valueOf(dangerIdList.get(0)));
if (!ObjectUtils.isEmpty(lanDer)){
if ("dangerSubmit".equals(lanDer.getDangerState())){
pageParam.remove("isDraft");
}
}
/*
* 处置隐患页面excle导入外部隐患信息无法实现,获取不到数据,以及由当前人导入的数据只能由当前人看见的权限设置------------------by
* 陈浩 on 2022-04-14--start
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment