Commit cc9e0b6a by 宋祥

1.增加文档管理员页面,授权和浏览根据管理员控制

parent fc8ae48e
...@@ -156,7 +156,7 @@ public class DaoUtils { ...@@ -156,7 +156,7 @@ public class DaoUtils {
} }
try { try {
BeanUtils.setProperty(bean, "createdBy", userId); BeanUtils.setProperty(bean, "createdBy", userId);
BeanUtils.setProperty(bean, "updatedBy", ""); BeanUtils.setProperty(bean, "updatedBy", userId);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人ID失败", e); log.warn("写入创建人ID失败", e);
} }
...@@ -169,7 +169,7 @@ public class DaoUtils { ...@@ -169,7 +169,7 @@ public class DaoUtils {
userName = "System"; userName = "System";
} }
BeanUtils.setProperty(bean, "createdName", userName); BeanUtils.setProperty(bean, "createdName", userName);
BeanUtils.setProperty(bean, "updatedName", ""); BeanUtils.setProperty(bean, "updatedName", userName);
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
...@@ -198,8 +198,9 @@ public class DaoUtils { ...@@ -198,8 +198,9 @@ public class DaoUtils {
} }
// 创建时刻 // 创建时刻
try { try {
BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime()); String dateTime = DateUtils.shortDateTime();
BeanUtils.setProperty(bean, "updatedTime", ""); BeanUtils.setProperty(bean, "createdTime", dateTime);
BeanUtils.setProperty(bean, "updatedTime", dateTime);
} catch (Exception e) { } catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e); log.error("写入创建时刻失败:{}", e.getMessage(), e);
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC101">
<sql id="column">
id as "id",
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
subcontract_code as "subcontractCode", <!-- 分包商编码 -->
subcontract_name as "subcontractName", <!-- 分包商名称 -->
genral_contract_code as "genralContractCode", <!-- 总包商编码 -->
genral_contract_name as "genralContractName", <!-- 总包商名称 -->
party_pm_name as "partyPmName", <!-- 甲方项目经理名称 -->
party_pm_hpone as "partyPmHpone", <!-- 甲方项目经理联系电话 -->
contract_name as "contractName", <!-- 合同名称 -->
contract_work_txt as "contractWorkTxt", <!-- 合同工作量 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
proj_type as "projType", <!-- 项目性质 -->
proj_status as "projStatus", <!-- 项目状态 0:在建;1:完工 -->
approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
permiss_start_date as "permissStartDate", <!-- 准许开工日期 -->
start_date as "startDate", <!-- 开工日期 -->
end_date as "endDate", <!-- 完工日期 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name like ('%$companyName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like concat('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projectName">
proj_name like concat('%', #projectName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
proj_type = #projType#
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="projCodes">
PROJ_CODE IN
<iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
EXISTS (SELECT A.PROJ_CODE FROM ${hggpSchema}.HGWD001 A, ${hggpSchema}.HGWD003 B
WHERE A.FILE_ID = B.FILE_ID AND A.PROJ_CODE = T.PROJ_CODE AND B.USER_ID = #userId#)
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC001 T
WHERE 1=1
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC001 T WHERE 1=1
<include refid="customCondition"/>
</select>
</sqlMap>
...@@ -28,6 +28,8 @@ public class HgWdSqlConstant { ...@@ -28,6 +28,8 @@ public class HgWdSqlConstant {
// 模块 // 模块
public static final String MODULE = "HGWD003."; public static final String MODULE = "HGWD003.";
// 查询
public static final String GET_BY_USER = MODULE + "getByUser";
// 修改信息 // 修改信息
public static final String UPDATE_INFO = MODULE + "updateInfo"; public static final String UPDATE_INFO = MODULE + "updateInfo";
// 批量写入 // 批量写入
...@@ -35,6 +37,20 @@ public class HgWdSqlConstant { ...@@ -35,6 +37,20 @@ public class HgWdSqlConstant {
} }
/** /**
* HGCW009 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HgWd009 {
// 模块
public static final String MODULE = "HGWD009.";
// 查询
public static final String QUERY = MODULE + "query";
}
/**
* HGCW999 SQL定义 * HGCW999 SQL定义
* *
* @author:songx * @author:songx
......
package com.baosight.hggp.hg.wd.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgwd004.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-09-23 11:36:32 create
*/
public class HGWD009 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 记录修改者*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 记录修改名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 记录修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 0-未删除,1-已删除*/
public static final String FIELD_USER_ID = "userId"; /* 用户ID*/
public static final String FIELD_USER_NAME = "userName"; /* 用户姓名*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_ORG_ID = "orgId"; /* 部门编码*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 部门名称*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 记录修改者*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 记录修改名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 记录修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 0-未删除,1-已删除*/
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_USER_NAME = "USER_NAME"; /* 用户姓名*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_ORG_ID = "ORG_ID"; /* 部门编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 部门名称*/
public static final String QUERY = "HGWD009.query";
public static final String COUNT = "HGWD009.count";
public static final String INSERT = "HGWD009.insert";
public static final String UPDATE = "HGWD009.update";
public static final String DELETE = "HGWD009.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
private String updatedBy = " "; /* 记录修改者*/
private String updatedName = " "; /* 记录修改名称*/
private String updatedTime = " "; /* 记录修改时间*/
private Integer deleteFlag; /* 0-未删除,1-已删除*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户姓名*/
private String remark = " "; /* 备注*/
private String orgId = " "; /* 部门编码*/
private String orgCname = " "; /* 部门名称*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("记录创建名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("记录创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("记录修改者");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("记录修改名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("记录修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("0-未删除,1-已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_ID);
eiColumn.setDescName("用户ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_USER_NAME);
eiColumn.setDescName("用户姓名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_CNAME);
eiColumn.setDescName("部门名称");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGWD009() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 企业编码.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 企业编码.
*
* @param accountCode - 企业编码
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the createdBy - 记录创建者.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 记录创建者.
*
* @param createdBy - 记录创建者
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 记录创建名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 记录创建名称.
*
* @param createdName - 记录创建名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 记录创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 记录创建时间.
*
* @param createdTime - 记录创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 记录修改者.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 记录修改者.
*
* @param updatedBy - 记录修改者
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 记录修改名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 记录修改名称.
*
* @param updatedName - 记录修改名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 记录修改时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 记录修改时间.
*
* @param updatedTime - 记录修改时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0-未删除,1-已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0-未删除,1-已删除.
*
* @param deleteFlag - 0-未删除,1-已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the userId - 用户ID.
* @return the userId
*/
public String getUserId() {
return this.userId;
}
/**
* set the userId - 用户ID.
*
* @param userId - 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* get the userName - 用户姓名.
* @return the userName
*/
public String getUserName() {
return this.userName;
}
/**
* set the userName - 用户姓名.
*
* @param userName - 用户姓名
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getOrgCname() {
return orgCname;
}
public void setOrgCname(String orgCname) {
this.orgCname = orgCname;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_ID)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
map.put(FIELD_USER_ID, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_USER_ID)));
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
return map;
}
}
...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC001; ...@@ -8,6 +8,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
...@@ -225,7 +226,13 @@ public class ServiceHGWD001D extends TreeService { ...@@ -225,7 +226,13 @@ public class ServiceHGWD001D extends TreeService {
*/ */
public List queryTopNode(String parentId) { public List queryTopNode(String parentId) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>()); Map queryMap = new HashMap<>();
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("userId", userId);
}
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
if (CollectionUtils.isEmpty(dbSc001s)) { if (CollectionUtils.isEmpty(dbSc001s)) {
return results; return results;
} }
......
...@@ -5,6 +5,7 @@ import com.baosight.hggp.core.constant.CommonConstant; ...@@ -5,6 +5,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
...@@ -12,6 +13,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant; ...@@ -12,6 +13,7 @@ import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -150,6 +152,7 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -150,6 +152,7 @@ public class ServiceHGWD003 extends ServiceEPBase {
fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); fWd003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.insert(HGWD003.DELETE, fWd003); DaoUtils.insert(HGWD003.DELETE, fWd003);
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + fWd003s.size() + "]条数据删除成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -184,4 +187,31 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -184,4 +187,31 @@ public class ServiceHGWD003 extends ServiceEPBase {
return inInfo; return inInfo;
} }
/**
* 是否项目经理
*
* @param inInfo
* @return
*/
public EiInfo isProjectManager(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
// 文档管理员不做校验
if (HgWdUtils.HgWd009.isManager(UserSessionUtils.getLoginName())) {
inInfo.set("isProjectManager", CommonConstant.YesNo.YES_1);
return inInfo;
}
queryMap.put(HGWD003.FIELD_USER_ID, UserSessionUtils.getLoginName());
List<HGWD003> dbWd003s = dao.query(HgWdSqlConstant.HgWd003.GET_BY_USER, queryMap);
if (CollectionUtils.isNotEmpty(dbWd003s)) {
HGWD003 dbWd003 = dbWd003s.get(0);
inInfo.set("isProjectManager", dbWd003.getIsProjectManager());
} else {
inInfo.set("isProjectManager", CommonConstant.YesNo.NO_0);
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "是否项目经理失败");
}
return inInfo;
}
} }
...@@ -31,8 +31,6 @@ import java.util.Map; ...@@ -31,8 +31,6 @@ import java.util.Map;
*/ */
public class ServiceHGWD003A extends ServiceEPBase { public class ServiceHGWD003A extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/** /**
* 画面初始化 * 画面初始化
* *
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* 文档管理员
*
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD009 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGWD009().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGWD009.QUERY, new HGWD009());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 删除用户
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo removeUser(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
List<HGWD009> fWd009s = MapUtils.toDaoEPBases(inInfo, HGWD009.class);
for (HGWD009 fWd009 : fWd009s) {
fWd009.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.insert(HGWD009.DELETE, fWd009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd009s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGWD009A extends ServiceEPBase {
private EiBlockMeta eiMetadata = null;
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "文档权限", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new User().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, "HGWD009A.query", new User());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 保存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "文档权限", operType = "保存", operDesc = "操作")
public EiInfo authUser(EiInfo inInfo) {
try {
List<HGWD009> fWd009s = MapUtils.toDaoEPBases(inInfo, HGWD009.class);
for (HGWD009 fWd009 : fWd009s) {
fWd009.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGWD009.INSERT, fWd009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fWd009s.size() + "]条数据添加成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "授权失败");
}
return inInfo;
}
}
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
B.DOWNLOAD_NUM as "downloadNum", <!-- 下载次数 --> B.DOWNLOAD_NUM as "downloadNum", <!-- 下载次数 -->
B.CREATED_BY as "createdBy", <!-- 创建人 --> B.CREATED_BY as "createdBy", <!-- 创建人 -->
B.CREATED_NAME as "createdName", <!-- 创建人名称 --> B.CREATED_NAME as "createdName", <!-- 创建人名称 -->
B.CREATED_TIME as "createdTime" <!-- 创建时间 --> B.CREATED_TIME as "createdTime", <!-- 创建时间 -->
B.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
B.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
B.UPDATED_TIME as "updatedTime" <!-- 记录修改时间 -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
......
...@@ -71,6 +71,15 @@ ...@@ -71,6 +71,15 @@
</dynamic> </dynamic>
</sql> </sql>
<select id="getByUser" resultClass="com.baosight.hggp.hg.wd.domain.HGWD003">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD003 A
WHERE 1=1
AND A.FILE_ID = #fileId#
AND A.USER_ID = #userId#
</select>
<select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD003"> <select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD003">
SELECT SELECT
<include refid="column"/>, <include refid="column"/>,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD009">
<sql id="column">
T.ID as "id",
T.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
T.DEP_CODE as "depCode", <!-- 部门编码 -->
T.CREATED_BY as "createdBy", <!-- 记录创建者 -->
T.CREATED_NAME as "createdName", <!-- 记录创建名称 -->
T.CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
T.UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
T.UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
T.UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
T.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
T.USER_ID as "userId", <!-- 用户ID -->
T.USER_NAME as "userName", <!-- 用户姓名 -->
T.REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="columnD">
D.ORG_ID as "orgId",
D.ORG_CNAME as "orgCname"
</sql>
<sql id="condition">
AND T.DELETE_FLAG = 0
<include refid="conditionD"/>
<isNotEmpty prepend=" AND " property="id">
T.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
T.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
T.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
T.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
T.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionD">
<isNotEmpty prepend=" AND " property="orgCname">
D.ORG_CNAME LIKE CONCAT('%', #orgCname#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
T.ID asc
</isEmpty>
</dynamic>
</sql>
<select id="getByUser" resultClass="com.baosight.hggp.hg.wd.domain.HGWD009">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGWD009 T
WHERE 1=1
AND USER_ID = #userId#
</select>
<select id="query" resultClass="com.baosight.hggp.hg.wd.domain.HGWD009">
SELECT
<include refid="column"/>,
<include refid="columnD"/>
FROM ${hggpSchema}.HGWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGWD009 T
INNER JOIN ${platSchema}.XS_USER B ON T.USER_ID = B.LOGIN_NAME
LEFT JOIN ${platSchema}.TXSOG02 C ON B.USER_ID = C.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 D ON C.ORG_ID = D.ORG_ID
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGWD009 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
USER_ID, <!-- 用户ID -->
USER_NAME, <!-- 用户姓名 -->
REMARK <!-- 备注 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #userId#, #userName#, #remark#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGWD009 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGWD009
SET
USER_ID = #userId#, <!-- 用户ID -->
USER_NAME = #userName#, <!-- 用户姓名 -->
REMARK = #remark#, <!-- 备注 -->
<include refid="SqlBase.updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGWD009A">
<sql id="column">
A.USER_ID as "userId", <!-- 用户id -->
A.USER_NAME as "userName", <!-- 用户名 -->
A.LOGIN_NAME as "loginName", <!-- 登录id -->
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
</sql>
<sql id="columnB">
C.ORG_ID as "depCode", <!-- 部门编码-->
C.ORG_CNAME as "depName" <!-- 部门名称-->
</sql>
<sql id="condition">
<!-- 过滤已经添加的用户 -->
AND NOT EXISTS (SELECT * FROM ${hggpSchema}.HGWD009 T WHERE A.LOGIN_NAME = T.USER_ID
AND T.DELETE_FLAG = 0
)
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginName">
A.LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
A.USER_ID LIKE CONCAT('%', #userId#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
A.USER_NAME LIKE CONCAT('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="conditionC">
<isNotEmpty prepend=" AND " property="depName">
C.ORG_CNAME LIKE CONCAT('%', #depName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.REC_CREATE_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
<include refid="column"/>,
<include refid="columnB"/>
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*)
FROM ${platSchema}.XS_USER A
LEFT JOIN ${platSchema}.TXSOG02 B ON A.USER_ID = B.USER_ID
LEFT JOIN ${platSchema}.TXSOG01 C ON B.ORG_ID = C.ORG_ID
WHERE 1=1
<include refid="condition"/>
<include refid="conditionC"/>
</select>
</sqlMap>
...@@ -115,6 +115,9 @@ ...@@ -115,6 +115,9 @@
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 --> DELETE_FLAG, <!-- 是否删除 -->
BIZ_TYPE, <!-- 业务类型 --> BIZ_TYPE, <!-- 业务类型 -->
BIZ_ID, <!-- 业务ID --> BIZ_ID, <!-- 业务ID -->
...@@ -127,6 +130,7 @@ ...@@ -127,6 +130,7 @@
OPER_STATUS OPER_STATUS
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#updatedBy#, #updatedName#, #updatedTime#,
#deleteFlag#, #bizType#, #bizId#, #docId#, #docName#, #docType#, #status#, #docVersion#, #releaseDate#, #operStatus# #deleteFlag#, #bizType#, #bizId#, #docId#, #docName#, #docType#, #status#, #docVersion#, #releaseDate#, #operStatus#
) )
</insert> </insert>
...@@ -216,4 +220,4 @@ ...@@ -216,4 +220,4 @@
WHERE DOC_ID = #docId# WHERE DOC_ID = #docId#
</update> </update>
</sqlMap> </sqlMap>
\ No newline at end of file
...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils; ...@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi; import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.constant.HgCwSqlConstant; import com.baosight.hggp.hg.cw.constant.HgCwSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW009;
import com.baosight.hggp.hg.cw.domain.HGCW999; import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.dm.domain.HGDM099; import com.baosight.hggp.hg.dm.domain.HGDM099;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD001; ...@@ -16,6 +17,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A; import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.wd.domain.HGWD099; import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
...@@ -206,6 +208,36 @@ public class HGWDTools { ...@@ -206,6 +208,36 @@ public class HGWDTools {
} }
/**
* 附件上传通知
*
* @param hgwd001 待变更的项目名称
* @param changeContent 变更内容
*/
public static void interaction(HGWD001 hgwd001, String changeContent) {
try {
if (Objects.nonNull(hgwd001)) {
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员
//HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<String> userIds = listByFile.stream()
.filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId())
&& item.getIsProjectManager() == 1)
.map(HGWD003::getExtId)
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
if (userIds.size() > 0) {
DcOpenApi.interactionAdd(
String.format("[%s]项目变更", hgwd001.getProjName()),
changeContent,
String.join(",", userIds));
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static class HgWd099 { public static class HgWd099 {
public static List<HGWD099> getByDocId(String bizType, String docId) { public static List<HGWD099> getByDocId(String bizType, String docId) {
...@@ -252,39 +284,36 @@ public class HGWDTools { ...@@ -252,39 +284,36 @@ public class HGWDTools {
public static List<HGWD099> queryByBiz(String bizType, String bizId) { public static List<HGWD099> queryByBiz(String bizType, String bizId) {
AssertUtils.isNull(bizType, "业务类型不能为空!"); AssertUtils.isNull(bizType, "业务类型不能为空!");
AssertUtils.isNull(bizId, "业务ID不能为空!"); AssertUtils.isNull(bizId, "业务ID不能为空!");
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY, List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String,Object>(){{put("bizType",bizType); put("bizId",bizId);}} new HashMap<String, Object>() {{
put("bizType", bizType);
put("bizId", bizId);
}}
); );
return results; return results;
} }
} }
/** /**
* 附件上传通知 * @author:songx
* @param hgwd001 待变更的项目名称 * @date:2024/8/19,14:57
* @param changeContent 变更内容
*/ */
public static void interaction(HGWD001 hgwd001, String changeContent){ public static class HgWd009 {
try {
if (Objects.nonNull(hgwd001)){ /**
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员 * 查询
*
//HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode()); * @param userId
*/
List<String> userIds = listByFile.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId()) && item.getIsProjectManager() == 1) public static HGWD009 getByUser(String userId) {
.map(HGWD003::getExtId) AssertUtils.isEmpty(userId, "用户ID不能为空");
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList()); Map queryMap = new HashMap();
if (userIds.size()>0){ queryMap.put(HGWD009.FIELD_USER_ID, userId);
DcOpenApi.interactionAdd( List<HGWD009> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd009.QUERY, queryMap);
String.format("[%s]项目变更", hgwd001.getProjName()), return CollectionUtils.isEmpty(results) ? null : results.get(0);
changeContent,
String.join(",",userIds));
}
}
} catch (IOException e) {
e.printStackTrace();
} }
} }
} }
package com.baosight.hggp.hg.wd.utils;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
/**
* @author:songx
* @date:2024/9/23,14:57
*/
public class HgWdUtils {
/**
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HgWd009 {
/**
* 是否管理员
*
* @param userId
* @return
*/
public static boolean isManager(String userId) {
HGWD009 dbWd009 = HGWDTools.HgWd009.getByUser(userId);
return dbWd009 != null;
}
}
}
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007B.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007B.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC101.xml"/>
<!-- 財務 --> <!-- 財務 -->
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW001.xml"/> <sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW001.xml"/>
...@@ -111,6 +112,8 @@ ...@@ -111,6 +112,8 @@
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001A.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD003.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD009.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD009A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD099.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD099.xml"/>
</sqlMapConfig> </sqlMapConfig>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/> <EF:EFColumn ename="docName" cname="文件名称" enable="false" width="220" sort="true"/>
<EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="110" align="center" sort="true"/> <EF:EFColumn ename="docType" cname="文件后缀" enable="false" width="110" align="center" sort="true"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/> <EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFColumn ename="createdTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime" <EF:EFColumn ename="updatedTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true" dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true"
required="false" enable="false" sort="true"/> required="false" enable="false" sort="true"/>
<EF:EFColumn ename="previewNum" cname="预览次数" enable="false" width="100" align="right" sort="true"/> <EF:EFColumn ename="previewNum" cname="预览次数" enable="false" width="100" align="right" sort="true"/>
......
...@@ -151,9 +151,7 @@ let save = function () { ...@@ -151,9 +151,7 @@ let save = function () {
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGWD003", "save", true, function (res) { JSUtils.submitGridsData("result", "HGWD003", "save", true);
message(res.msg);
});
} }
}); });
} }
...@@ -203,12 +201,7 @@ let removeUser = function () { ...@@ -203,12 +201,7 @@ let removeUser = function () {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"取消授权用户\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"取消授权用户\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGWD003", "removeUser", JSUtils.submitGridsData("result", "HGWD003", "removeUser",
false, function (res) { true
message(res.msg);
if (res.status !== -1) {
query();
}
}
); );
} }
}); });
...@@ -247,19 +240,37 @@ let copyUserCallback = function (res) { ...@@ -247,19 +240,37 @@ let copyUserCallback = function (res) {
* 显示授权按钮 * 显示授权按钮
*/ */
let showAuthButton = function () { let showAuthButton = function () {
let label = IPLATUI.EFTree.docTree.selectNode.treeId;
let leafType = IPLATUI.EFTree.docTree.selectNode.leafType; let leafType = IPLATUI.EFTree.docTree.selectNode.leafType;
// C:目录 // C:目录
if (leafType && leafType === 'C') { if (!leafType && leafType != 'C') {
$("#AUTH").attr("disabled", false); $("#AUTH").hide();
$("#REMOVE_USER").attr("disabled", false); $("#REMOVE_USER").hide();
$("#COPY_USER").attr("disabled", false); $("#COPY_USER").hide();
$("#SAVE").attr("disabled", false); $("#SAVE").hide();
} else { return;
$("#AUTH").attr("disabled", true);
$("#REMOVE_USER").attr("disabled", true);
$("#COPY_USER").attr("disabled", true);
$("#SAVE").attr("disabled", true);
} }
// 管理员或者是项目经理,才能进行授权和操作用户
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-fileId", label);
EiCommunicator.send('HGWD003', 'isProjectManager', inInfo, {
onSuccess: function (res) {
if (res.getStatus() >= 0 && res.extAttr.isProjectManager == 1) {
$("#AUTH").show();
$("#REMOVE_USER").show();
$("#COPY_USER").show();
$("#SAVE").show();
} else {
$("#AUTH").hide();
$("#REMOVE_USER").hide();
$("#COPY_USER").hide();
$("#SAVE").hide();
}
},
onFail: function (res) {
NotificationUtil("操作失败,原因[" + res.getMsg() + "]", "error");
}
});
} }
/** /**
......
...@@ -43,16 +43,12 @@ let authUser = function () { ...@@ -43,16 +43,12 @@ let authUser = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"授权\"操作? ", { JSUtils.submitGridsData("result", "HGWD003A", "authUser",
ok: function () { true, function (res) {
JSUtils.submitGridsData("result", "HGWD003A", "authUser", message(res.msg);
true, function (res) { if (res.status !== -1) {
message(res.msg); parent.JSColorbox.setValueCallback(res);
if (res.status !== -1) { }
parent.JSColorbox.setValueCallback(res);
}
}
);
} }
}); );
} }
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 授权
$("#AUTH").on("click", auth);
// 删除用户
$("#REMOVE_USER").on("click", removeUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 授权
*/
let auth = function () {
JSColorbox.open({
href: "HGWD009A",
title: "<div style='text-align: center;'>正在添加文档管理员</div>",
width: "70%",
height: "80%",
callbackName: authCallback
});
}
/**
* 授权回调
*/
let authCallback = function (res) {
// 刷新页面
query();
}
/**
* 删除授权用户
*/
let removeUser = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD009", "removeUser", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="文档管理员">
<EF:EFRegion title="查询区" id="inqu">
<div class="row">
<EF:EFInput cname="部门名称" ename="orgCname" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户账号" ename="userId" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="用户姓名" ename="userName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion title="结果集" id="result">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="orgCname" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="用户账号" enable="false" width="100" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 100, 150],
},
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 授权用户
$("#AUTH_USER").on("click", authUser);
});
/**
* 页面加载
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 授权用户
*/
let authUser = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"授权\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD009A", "authUser",
true, function (res) {
if (res.status !== -1) {
parent.JSColorbox.setValueCallback(res);
} else {
message(res.msg);
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="文档管理员">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="depName" cname="部门名称" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="loginName" cname="用户账号" blockId="inqu_status" row="0" colWidth="4"/>
<EF:EFInput ename="userName" cname="用户姓名" blockId="inqu_status" row="0" colWidth="4"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" height="69vh">
<EF:EFColumn ename="userId" cname="用户ID" hidden="true" primaryKey="true"/>
<EF:EFColumn ename="depName" cname="部门名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="loginName" cname="用户账号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="用户姓名" enable="false" width="120" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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