功能提交
This commit is contained in:
@@ -21,6 +21,9 @@ import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.DeptLineTreeVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.device.pq.service.TerminalTreeService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
@@ -60,6 +63,8 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
private final TreeMapper treeMapper;
|
||||
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
|
||||
/**
|
||||
* 台账页面终端树
|
||||
*
|
||||
@@ -78,10 +83,20 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> lineList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserReportPO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam);
|
||||
userReportPOList = userReportPOList.stream().filter(it->StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String,List<UserReportPO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserReportPO::getStationId));
|
||||
|
||||
|
||||
|
||||
subvList.forEach(subv -> subv.setChildren(getChildren(subv, lineList)));
|
||||
devList.forEach(dev -> dev.setChildren(getChildren(dev, subvList)));
|
||||
subList.forEach(sub -> sub.setChildren(getChildren(sub, devList)));
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(specialDealSubChildren(sub, devList,userMap.get(sub.getId()))));
|
||||
|
||||
|
||||
//subList.forEach(sub -> sub.setChildren(getChildren(sub, devList)));
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
projectList.forEach(project -> project.setChildren(getChildren(project, provinceList)));
|
||||
@@ -99,6 +114,29 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
return taiZhang;
|
||||
}
|
||||
|
||||
|
||||
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> devList,List<UserReportPO> userReportPOList){
|
||||
List<TerminalTree> list = new ArrayList<>();
|
||||
List<TerminalTree> devTree = devList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(devTree)){
|
||||
list.addAll(devTree);
|
||||
}
|
||||
for(UserReportPO userReportPO:userReportPOList){
|
||||
List<TerminalTree> dev = devList.stream().filter(it->it.getPid().equals(userReportPO.getId())).collect(Collectors.toList());
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setId(userReportPO.getId());
|
||||
terminalTree.setPid(userReportPO.getStationId());
|
||||
terminalTree.setPowerFlag(1);
|
||||
terminalTree.setLevel(7);
|
||||
terminalTree.setChildren(dev);
|
||||
list.add(terminalTree);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 5层树排除设备 母线监测点合并
|
||||
*
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.supervision.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.api.fallback.UserLedgerFeignClientFallbackFactory;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例 Api 接口
|
||||
*
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserLedgerFeignClientFallbackFactory.class)
|
||||
public interface UserLedgerFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/selectUserList")
|
||||
List<UserReportPO> selectUserList(@RequestBody UserReportParam userReportParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.supervision.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.supervision.api.TempLineRunTestFeignClient;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class UserLedgerFeignClientFallbackFactory implements FallbackFactory<UserLedgerFeignClient> {
|
||||
@Override
|
||||
public UserLedgerFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new UserLedgerFeignClient() {
|
||||
|
||||
@Override
|
||||
public List<UserReportPO> selectUserList(UserReportParam userReportParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "查询用户台账", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -19,6 +20,7 @@ import java.time.LocalDate;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@@ -124,6 +126,11 @@ public class UserReportPO extends BaseEntity {
|
||||
@TableField(value = "data_type")
|
||||
private Integer dataType;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 终端id
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.supervision.service.user.IUserReportNormalService;
|
||||
import com.njcn.supervision.service.user.UserReportPOService;
|
||||
@@ -239,4 +240,15 @@ public class UserReportManageController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "/selectUserList")
|
||||
@ApiOperation("查询用户台账")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
public HttpResult<List<UserReportPO>> selectUserList(@RequestBody UserReportParam userReportParam) {
|
||||
String methodDescribe = getMethodDescribe("selectUserList");
|
||||
List<UserReportPO> b = userReportPOService.selectUserList(userReportParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface UserReportPOService extends IBpmService<UserReportPO> {
|
||||
void importSensitiveReportData(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
Boolean deleteUserReport(List<String> supervisionId);
|
||||
|
||||
List<UserReportPO> selectUserList(UserReportParam userReportParam);
|
||||
}
|
||||
|
||||
@@ -1154,6 +1154,18 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
.in(UserReportPO::getId, supervisionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserReportPO> selectUserList(UserReportParam userReportParam) {
|
||||
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if(StrUtil.isNotBlank(userReportParam.getCity())){
|
||||
lambdaQueryWrapper.in(UserReportPO::getCity,Stream.of(userReportParam.getCity()).collect(Collectors.toList()));
|
||||
}
|
||||
this.list(lambdaQueryWrapper);
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Map<String, String> getTreeString(String name, List<SysDicTreePO> treeVOS) {
|
||||
Map<String, String> info = new LinkedHashMap<>();
|
||||
for (SysDicTreePO sysMenuDtoChild : treeVOS) {
|
||||
|
||||
Reference in New Issue
Block a user