package com.newfiber.termite.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.newfiber.common.core.utils.StringUtils; import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.security.utils.UserUtils; import com.newfiber.system.api.domain.SysUser; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; @Data @TableName("ter_project_info") @EqualsAndHashCode(callSuper = true) @ApiModel(value = "项目信息表", description = "项目信息表") public class ProjectInfo extends BaseEntity { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "用户编号") private Long userId; /** * 项目编码 */ @ApiModelProperty(value = "项目编码") private String projectCode; /** * 项目名称 */ @ApiModelProperty(value = "项目名称") private String projectName; /** * 上传地址 */ @ApiModelProperty(value = "上传地址") private String uploadApi; /** * 字段解释 */ @ApiModelProperty(value = "字段解释") private String fieldExplain; /** * 生产人员 */ @ApiModelProperty(value = "生产人员") private String productionUsers; /** * 安装人员 */ @ApiModelProperty(value = "安装人员") private String installUsers; /** * 分析人员 */ @ApiModelProperty(value = "分析人员") private String analysisUsers; /** * 地图中心点 */ @ApiModelProperty(value = "地图中心点") private String centerPoint; /** * 航拍图坐标 */ @ApiModelProperty(value = "航拍图坐标") private String aerialCoordinate; /** * 航拍图 */ @ApiModelProperty(value = "航拍图") private String aerialPicture; /** * 短信通知人(,隔开) */ @ApiModelProperty(value = "短信通知人(,隔开)") private String smsNotifyPhones; /** * 生产人员 */ @TableField(exist = false) @ApiModelProperty(value = "生产人员") private String productionUserNames; /** * 安装人员 */ @TableField(exist = false) @ApiModelProperty(value = "安装人员") private String installUserNames; /** * 分析人员 */ @TableField(exist = false) @ApiModelProperty(value = "分析人员") private String analysisUserNames; /** * 项目人员(生产+安装+分析) */ @TableField(exist = false) @ApiModelProperty(value = "项目人员(生产+安装+分析)", hidden = true) private String projectUsers; public String getProjectUsers() { return productionUsers + "," + installUsers + "," + analysisUsers; } public String getProductionUserNames() { return getUserNames(productionUsers); } public String getInstallUserNames() { return getUserNames(installUsers); } public String getAnalysisUserNames() { return getUserNames(analysisUsers); } private String getUserNames(String userIds) { List<String> userName = new ArrayList<>(); if(StringUtils.isNotEmpty(userIds)){ for(String userId : userIds.split(",")){ SysUser sysUser = UserUtils.getUser(Long.parseLong(userId)); if(null != sysUser){ userName.add(sysUser.getNickName()); } } } return StringUtils.joinWith(",", userName); } }