Commit a6dcfc58 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents eafa54a0 054afc56
...@@ -33,6 +33,10 @@ public class CommonConstant { ...@@ -33,6 +33,10 @@ public class CommonConstant {
// 否 // 否
public static final Integer NO_0 = 0; public static final Integer NO_0 = 0;
// 是 // 是
public static final String YES_S1 = "1";
// 否
public static final String NO_S0 = "0";
// 是
public static final String YES = "Y"; public static final String YES = "Y";
// 否 // 否
public static final String NO = "N"; public static final String NO = "N";
...@@ -88,6 +92,8 @@ public class CommonConstant { ...@@ -88,6 +92,8 @@ public class CommonConstant {
public static final String PROJ_ID = "projId"; public static final String PROJ_ID = "projId";
// 企业管理员 // 企业管理员
public static final String COMPANY_MANAGE = "companyManage"; public static final String COMPANY_MANAGE = "companyManage";
// ADMIN
public static final String ADMIN = "ADMIN";
} }
/** /**
......
...@@ -40,9 +40,9 @@ public class UserSessionUtils extends UserSession { ...@@ -40,9 +40,9 @@ public class UserSessionUtils extends UserSession {
*/ */
public static User getUser() { public static User getUser() {
EiInfo eiInfo = new EiInfo(); EiInfo eiInfo = new EiInfo();
eiInfo.set("userId", UserSession.getUserId()); eiInfo.set("loginName", UserSession.getLoginName());
eiInfo.set(EiConstant.serviceName, "HGXSUser"); eiInfo.set(EiConstant.serviceName, "HGXSUser");
eiInfo.set(EiConstant.methodName, "getUser"); eiInfo.set(EiConstant.methodName, "getUserByLogin");
EiInfo outInfo = XLocalManager.call(eiInfo); EiInfo outInfo = XLocalManager.call(eiInfo);
// -1表示报错 // -1表示报错
if (outInfo.getStatus() == -1) { if (outInfo.getStatus() == -1) {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
A.ID as "id", A.ID as "id",
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 --> A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 --> A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.COMPANY_NAME as "companyName", <!-- 公司名称 --> A.COMPANY_NAME as "companyName", <!-- 公司名称 -->
A.PROJ_CODE as "projCode", <!-- 项目编码 --> A.PROJ_CODE as "projCode", <!-- 项目编码 -->
...@@ -24,15 +23,11 @@ ...@@ -24,15 +23,11 @@
<sql id="condition"> <sql id="condition">
AND A.DELETE_FLAG = 0 AND A.DELETE_FLAG = 0
AND B.BIZ_TYPE = 'WD'
<include refid="HGXSDataAuth.authConditionA"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
A.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%') A.COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty> </isNotEmpty>
......
...@@ -60,6 +60,40 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -60,6 +60,40 @@ public class ServiceHGXSUser extends ServiceBase {
} }
/** /**
* 获取用户信息
*
* @param eiInfo
* @return
*/
public EiInfo getUserByLogin(EiInfo eiInfo) {
EiInfo outInfo = new EiInfo();
int status = 0;
String msg = "";
try {
String loginName = eiInfo.getString("loginName");
if (StringUtils.isNotEmpty(loginName)) {
Map map = new HashMap();
map.put("loginName", loginName);
List<User> users = dao.query("HGXSUser.query", map);
if (users != null && users.size() > 0) {
status = 1;
msg = "用户存在!";
outInfo.set("result", users.get(0));
} else {
msg = "用户信息不存在!";
}
} else {
msg = "传入用户名不能为空!";
}
outInfo.setStatus(status);
outInfo.setMsg(msg);
} catch (Exception e) {
LogUtils.setDetailMsg(outInfo, e, "平台调用用户信息异常");
}
return outInfo;
}
/**
* 查询用户下拉框 * 查询用户下拉框
* *
* @param inInfo * @param inInfo
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
<sqlMap namespace="HGXSDataAuth"> <sqlMap namespace="HGXSDataAuth">
<sql id="authCondition"> <sql id="authCondition">
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<!-- 无权限时使用 --> <!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode"> <isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode# DEP_CODE = #authDepCode#
...@@ -24,4 +27,29 @@ ...@@ -24,4 +27,29 @@
</isNotEqual> </isNotEqual>
</sql> </sql>
<sql id="authConditionA">
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
A.DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(A.CREATED_BY = #authOnlyPeople# OR A.DEP_CODE IN <iterate close=")" open="(" conjunction=","
property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
A.CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
A.DEP_CODE IN
<iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
</sqlMap> </sqlMap>
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<sql id="condition"> <sql id="condition">
AND IS_DELETED = '0' AND IS_DELETED = '0'
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEqual prepend=" AND " property="accountCode" compareValue="ADMIN">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEqual>
<isNotEmpty prepend=" AND " property="orgEname"> <isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname# ORG_ENAME = #orgEname#
</isNotEmpty> </isNotEmpty>
......
...@@ -190,7 +190,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -190,7 +190,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
if (StringUtils.startsWithAny(name, serviceFilter)) { if (StringUtils.startsWithAny(name, serviceFilter)) {
return; return;
} }
((Map) parameters).put("accountCode", UserSessionUtils.getAccountCode()); // 本来是BUG,避免业务代码改动依然保持原逻辑ADMIN时依然置空
String accountCode = UserSessionUtils.getAccountCode();
((Map) parameters).put("accountCode", CommonConstant.Field.ADMIN.equals(accountCode) ? "" : accountCode);
} }
/** /**
...@@ -211,7 +213,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -211,7 +213,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
return; return;
} }
String authEnable = PlatApplicationContext.getProperty("iplat4j.page.auth.enable"); String authEnable = PlatApplicationContext.getProperty("iplat4j.page.auth.enable");
if (StringUtils.isNotBlank(authEnable) && CommonConstant.YesNo.NO_0.equals(authEnable)) { if (StringUtils.isNotBlank(authEnable) && CommonConstant.YesNo.NO_S0.equals(authEnable)) {
return; return;
} }
// 当前用户所有角色 // 当前用户所有角色
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
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;
...@@ -36,7 +37,7 @@ public class ServiceXSOG0800 extends TreeService { ...@@ -36,7 +37,7 @@ public class ServiceXSOG0800 extends TreeService {
HashMap<String, String> map = new HashMap(); HashMap<String, String> map = new HashMap();
List<HashMap> list = new ArrayList(); List<HashMap> list = new ArrayList();
String accountCode = UserSessionUtils.getAccountCode(); String accountCode = UserSessionUtils.getAccountCode();
if (StringUtils.isEmpty(accountCode)) { if (StringUtils.isEmpty(accountCode) || CommonConstant.Field.ADMIN.equals(accountCode)) {
map.put("label", "root"); map.put("label", "root");
map.put("text", "组织机构"); map.put("text", "组织机构");
} else { } else {
...@@ -57,9 +58,8 @@ public class ServiceXSOG0800 extends TreeService { ...@@ -57,9 +58,8 @@ public class ServiceXSOG0800 extends TreeService {
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("node", parentLabel); queryMap.put("node", parentLabel);
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16 // 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { queryMap.put("accountCode", LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
queryMap.put("accountCode", UserSessionUtils.getAccountCode()); ? CommonConstant.Field.ADMIN : UserSessionUtils.getAccountCode());
}
List<Map> ret = this.dao.query("XSOG01.queryOrganiation", queryMap, 0, -999999); List<Map> ret = this.dao.query("XSOG01.queryOrganiation", queryMap, 0, -999999);
Map parentOrgMap = new HashMap(); Map parentOrgMap = new HashMap();
......
...@@ -4,11 +4,8 @@ import com.baosight.hggp.core.constant.CommonConstant; ...@@ -4,11 +4,8 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
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.AssertUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
...@@ -412,9 +409,8 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -412,9 +409,8 @@ public class ServiceXSOG0801 extends ServiceBase {
inInfo.set("inqu_status-0-orgType", inInfo.get("inqu_status2-0-orgType")); inInfo.set("inqu_status-0-orgType", inInfo.get("inqu_status2-0-orgType"));
} }
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16 // 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { inInfo.set("inqu_status-0-accountCode", LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode()); ? CommonConstant.Field.ADMIN : UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XSOG01.query", new XSOG01()); EiInfo outInfo = super.query(inInfo, "XSOG01.query", new XSOG01());
r2Block.setRows(outInfo.getBlock(EiConstant.resultBlock).getRows()); r2Block.setRows(outInfo.getBlock(EiConstant.resultBlock).getRows());
outInfo.addBlock(r2Block); outInfo.addBlock(r2Block);
......
...@@ -85,15 +85,14 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -85,15 +85,14 @@ public class ServiceXSOG0801A extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String parentOrgId = MapUtils.getString(queryRow, "parentOrgId"); String parentOrgId = MapUtils.getString(queryMap, "parentOrgId");
if ("".equals(parentOrgId)) { if ("".equals(parentOrgId)) {
return inInfo; return inInfo;
} }
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16 // 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { queryMap.put("accountCode", LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
queryRow.put("accountCode", UserSessionUtils.getAccountCode()); ? CommonConstant.Field.ADMIN : UserSessionUtils.getAccountCode());
}
inInfo = super.query(inInfo, "XSOG01.query", new XSOG01()); inInfo = super.query(inInfo, "XSOG01.query", new XSOG01());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase; ...@@ -17,6 +17,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager; import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.og.domain.XSOG01; import com.baosight.xservices.xs.og.domain.XSOG01;
import com.baosight.xservices.xs.util.LoginUserDetails;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -76,12 +77,14 @@ public class ServiceXSOG0801B extends ServiceEPBase { ...@@ -76,12 +77,14 @@ public class ServiceXSOG0801B extends ServiceEPBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String orgId = MapUtils.getString(queryRow, "orgId"); String orgId = MapUtils.getString(queryMap, "orgId");
if ("".equals(orgId)) { if ("".equals(orgId)) {
return inInfo; return inInfo;
} }
queryRow.put("accountCode", UserSessionUtils.getAccountCode()); // 非管理员仅查询所属企业用户 added by songx at 2024-01-16
queryMap.put("accountCode", LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
? CommonConstant.Field.ADMIN : UserSessionUtils.getAccountCode());
inInfo = super.query(inInfo, "XSOG01.query", new XSOG01()); inInfo = super.query(inInfo, "XSOG01.query", new XSOG01());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="XSOG01"> <sqlMap namespace="XSOG01">
<select id="queryOrgInfo" parameterClass="java.util.HashMap" <select id="queryOrgInfo" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT SELECT
ORG_ID as "orgId", <!-- 组织ID --> ORG_ID as "orgId", <!-- 组织ID -->
ORG_ENAME as "orgEname", <!-- 组织编码 --> ORG_ENAME as "orgEname", <!-- 组织编码 -->
...@@ -125,9 +123,8 @@ ...@@ -125,9 +123,8 @@
ORDER BY ORG_ENAME,SORT_INDEX ASC ORDER BY ORG_ENAME,SORT_INDEX ASC
</select> </select>
<!--条件查询组织机构--> <!-- 条件查询组织机构 -->
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT SELECT
ORG_ID as "orgId", <!-- 组织ID --> ORG_ID as "orgId", <!-- 组织ID -->
ORG_ENAME as "orgEname", <!-- 组织编码 --> ORG_ENAME as "orgEname", <!-- 组织编码 -->
...@@ -161,13 +158,13 @@ ...@@ -161,13 +158,13 @@
<isNotEmpty prepend=" AND " property="orgType"> <isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE like ('%$orgType$%') ORG_TYPE like ('%$orgType$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEqual prepend=" AND " property="accountCode" compareValue="ADMIN">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEqual>
ORDER BY SORT_INDEX ASC ORDER BY SORT_INDEX ASC
</select> </select>
<!--条件查询组织机构--> <!-- 条件查询组织机构 -->
<select id="count" parameterClass="java.util.HashMap" resultClass="int"> <select id="count" parameterClass="java.util.HashMap" resultClass="int">
SELECT COUNT(1) SELECT COUNT(1)
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
...@@ -188,9 +185,9 @@ ...@@ -188,9 +185,9 @@
<isNotEmpty prepend=" AND " property="orgType"> <isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE like ('%$orgType$%') ORG_TYPE like ('%$orgType$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEqual prepend=" AND " property="accountCode" compareValue="ADMIN">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEqual>
</select> </select>
<!-- 根据id查询组织机构 --> <!-- 根据id查询组织机构 -->
...@@ -265,7 +262,7 @@ ...@@ -265,7 +262,7 @@
</isNotEmpty> </isNotEmpty>
</select> </select>
<!--组织机构子节点树查询--> <!-- 组织机构子节点树查询 -->
<select id="queryOrganiation" resultClass="java.util.HashMap"> <select id="queryOrganiation" resultClass="java.util.HashMap">
SELECT SELECT
ORG_ID as "label", ORG_ID as "label",
...@@ -282,9 +279,9 @@ ...@@ -282,9 +279,9 @@
<isNotEmpty prepend=" AND " property="node"> <isNotEmpty prepend=" AND " property="node">
PARENT_ORG_ID = #node# PARENT_ORG_ID = #node#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode"> <isNotEqual prepend=" AND " property="accountCode" compareValue="ADMIN">
ACCOUNT_CODE = #accountCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEqual>
order by SORT_INDEX asc order by SORT_INDEX asc
</select> </select>
......
...@@ -20,6 +20,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -20,6 +20,7 @@ import org.apache.commons.lang.StringUtils;
* @date:2024/1/26,11:26 * @date:2024/1/26,11:26
*/ */
public class ServiceXS0710 extends MenuTreeService { public class ServiceXS0710 extends MenuTreeService {
private EiBlockMeta eiMetadata = null; private EiBlockMeta eiMetadata = null;
public ServiceXS0710() { public ServiceXS0710() {
......
...@@ -36,6 +36,7 @@ import java.util.Map; ...@@ -36,6 +36,7 @@ import java.util.Map;
public class ServiceXS3002 extends ServiceEPBase { public class ServiceXS3002 extends ServiceEPBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXS3002.class); private static final Logger logger = LoggerFactory.getLogger(ServiceXS3002.class);
private String USER_TYPE = "USER"; private String USER_TYPE = "USER";
public ServiceXS3002() { public ServiceXS3002() {
......
...@@ -92,5 +92,6 @@ ...@@ -92,5 +92,6 @@
<!-- 文档库 --> <!-- 文档库 -->
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001.xml"/> <sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/wd/sql/HGWD002.xml"/>
</sqlMapConfig> </sqlMapConfig>
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