Browse Source

资产添加字段org_id,指标空指针问题处理

develop
ljlong_2630 11 months ago
parent
commit
ace1b894be
  1. BIN
      .DS_Store
  2. 1
      .gitignore
  3. BIN
      lzbi-admin/.DS_Store
  4. 62
      lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetInfo.java
  5. 29
      lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java

BIN
.DS_Store

Binary file not shown.

1
.gitignore

@ -27,6 +27,7 @@ target/
### JRebel ### ### JRebel ###
rebel.xml rebel.xml
.DS_Store
### NetBeans ### ### NetBeans ###
nbproject/private/ nbproject/private/

BIN
lzbi-admin/.DS_Store

Binary file not shown.

62
lzbi-module/src/main/java/com/lzbi/asset/domain/DcBaseAssetInfo.java

@ -3,6 +3,7 @@ package com.lzbi.asset.domain;
import com.lzbi.common.annotation.Excel; import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity; import com.lzbi.module.base.BaseModuleEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -17,59 +18,56 @@ import lombok.experimental.Accessors;
public class DcBaseAssetInfo extends BaseModuleEntity { public class DcBaseAssetInfo extends BaseModuleEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 统计单元名称 */
* 资产名称 @Excel(name = "统计单元名称")
*/ @ApiModelProperty(name = "统计单元名称",notes = "assetName")
@Excel(name = "资产名称")
private String assetName; private String assetName;
/** /** 统计单元编码 */
* 资产编码 @Excel(name = "统计单元编码")
*/ @ApiModelProperty(name = "统计单元编码",notes = "assetCode")
@Excel(name = "资产编码")
private String assetCode; private String assetCode;
/** /** 统计单元别名 */
* 资产类别;设备型资产管理型资产 @Excel(name = "统计单元别名")
*/ @ApiModelProperty(name = "统计单元别名",notes = "assetNameAlias")
@Excel(name = "资产类别;设备型资产;管理型资产;") private String assetNameAlias;
/** 统计单元类别;设备型;管理型; */
@Excel(name = "统计单元类别;设备型;管理型;")
@ApiModelProperty(name = "统计单元类别;设备型;管理型;",notes = "assetClass")
private String assetClass; private String assetClass;
/** /** 部门共享;0不共享;1限定部门共享;2所有部门可见 */
* 部门共享;0不共享1限定部门共享2所有部门可见
*/
@Excel(name = "部门共享;0不共享;1限定部门共享;2所有部门可见") @Excel(name = "部门共享;0不共享;1限定部门共享;2所有部门可见")
@ApiModelProperty(name = "部门共享;0不共享;1限定部门共享;2所有部门可见",notes = "flagValidateDept")
private String flagValidateDept; private String flagValidateDept;
/** /** 角色内共享;0不共享;1限定角色共享;2所有角色可见 */
* 角色内共享;0不共享1限定角色共享2所有角色可见
*/
@Excel(name = "角色内共享;0不共享;1限定角色共享;2所有角色可见") @Excel(name = "角色内共享;0不共享;1限定角色共享;2所有角色可见")
@ApiModelProperty(name = "角色内共享;0不共享;1限定角色共享;2所有角色可见",notes = "flagValidateRole")
private String flagValidateRole; private String flagValidateRole;
/** /** 用户共享;0不共享;1限定用户共享;2所有用户可见 */
* 用户共享;0不共享1限定用户共享2所有用户可见
*/
@Excel(name = "用户共享;0不共享;1限定用户共享;2所有用户可见") @Excel(name = "用户共享;0不共享;1限定用户共享;2所有用户可见")
@ApiModelProperty(name = "用户共享;0不共享;1限定用户共享;2所有用户可见",notes = "flagValidateUser")
private String flagValidateUser; private String flagValidateUser;
/** /** 统计单元状态 */
* 资产状态 @Excel(name = "统计单元状态")
*/ @ApiModelProperty(name = "统计单元状态",notes = "statusAsset")
@Excel(name = "资产状态")
private String statusAsset; private String statusAsset;
/** /** 所属公司 */
* 所属公司
*/
@Excel(name = "所属公司") @Excel(name = "所属公司")
@ApiModelProperty(name = "所属公司",notes = "comanyId")
private Long comanyId; private Long comanyId;
/** /** 所属组织结构 */
* 所属组织结构
*/
@Excel(name = "所属组织结构") @Excel(name = "所属组织结构")
private Long deptId; @ApiModelProperty(name = "所属组织结构",notes = "orgId")
private Long orgId;
public String getValue() { public String getValue() {
return this.assetCode; return this.assetCode;
} }

29
lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java

@ -193,11 +193,18 @@ public class DcBaseAssetTargetController extends BaseController
@GetMapping("/listUsedModel") @GetMapping("/listUsedModel")
public AjaxResult listUsedModel(DcBaseAssetTargetExpand dcBaseAssetTarget) { public AjaxResult listUsedModel(DcBaseAssetTargetExpand dcBaseAssetTarget) {
List<DcBaseAssetTargetExpand> list = dcBaseAssetTargetService.selectDcBaseAssetTargetExpandList(dcBaseAssetTarget); List<DcBaseAssetTargetExpand> list = dcBaseAssetTargetService.selectDcBaseAssetTargetExpandList(dcBaseAssetTarget);
if (list == null) {
// 处理列表为空的情况
return AjaxResult.error("列表为空");
}
// 去重 // 去重
List<DcBaseAssetTargetExpand> distinctList = list.stream() List<DcBaseAssetTargetExpand> distinctList = list.stream()
.filter(Objects::nonNull) // 过滤掉空对象
.collect(Collectors.collectingAndThen( .collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DcBaseAssetTargetExpand::getFieldCode) Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DcBaseAssetTargetExpand::getFieldCode, Comparator.nullsFirst(String::compareTo))
.thenComparing(DcBaseAssetTargetExpand::getTargetModelCode))), .thenComparing(DcBaseAssetTargetExpand::getTargetModelCode, Comparator.nullsFirst(String::compareTo)))),
ArrayList::new)); ArrayList::new));
// 分组 // 分组
@ -206,5 +213,23 @@ public class DcBaseAssetTargetController extends BaseController
return AjaxResult.success(groupedMap); return AjaxResult.success(groupedMap);
} }
// @PreAuthorize("@ss.hasPermi('target:target:list')")
// @GetMapping("/listUsedModel")
// public AjaxResult listUsedModel(DcBaseAssetTargetExpand dcBaseAssetTarget) {
// List<DcBaseAssetTargetExpand> list = dcBaseAssetTargetService.selectDcBaseAssetTargetExpandList(dcBaseAssetTarget);
// // 去重
// List<DcBaseAssetTargetExpand> distinctList = list.stream()
// .collect(Collectors.collectingAndThen(
// Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DcBaseAssetTargetExpand::getFieldCode)
// .thenComparing(DcBaseAssetTargetExpand::getTargetModelCode))),
// ArrayList::new));
//
// // 分组
// Map<String, List<DcBaseAssetTargetExpand>> groupedMap = distinctList.stream()
// .collect(Collectors.groupingBy(DcBaseAssetTargetExpand::getFieldCode));
//
// return AjaxResult.success(groupedMap);
// }
} }

Loading…
Cancel
Save