Commit ad8d6013 by 宋祥

1.组织机构功能优化

parent 6dfef862
...@@ -10,7 +10,7 @@ public class HPConstants { ...@@ -10,7 +10,7 @@ public class HPConstants {
public static final String BLOCK_DETAIL = "detail"; public static final String BLOCK_DETAIL = "detail";
//公司編碼 //公司編碼
public static final String SQL_FIELD_COMPANYCODE = "companyCode"; public static final String SQL_FIELD_ACCOUNT_CODE = "accountCode";
//創建人 //創建人
public static final String SQL_FIELD_CREATED_BY = "createdBy"; public static final String SQL_FIELD_CREATED_BY = "createdBy";
......
...@@ -6,9 +6,9 @@ package com.baosight.hggp.core.enums; ...@@ -6,9 +6,9 @@ package com.baosight.hggp.core.enums;
*/ */
public enum OrgTypeEnum { public enum OrgTypeEnum {
COMPANY("company", "公司"),
FACTORY("factory", "厂区"), FACTORY("factory", "厂区"),
DEPT("dept", "部门"), DEPT("dept", "部门"),
COMPANY("dept", "公司"),
PROD_GROUP("prodGroup", "生产组"), PROD_GROUP("prodGroup", "生产组"),
CUT_GROUP("cutGroup", "下料组"), CUT_GROUP("cutGroup", "下料组"),
SYN_GROUP("synGroup", "综合组"), SYN_GROUP("synGroup", "综合组"),
......
package com.baosight.hggp.core.enums;
/**
* @author:songx
* @date:2024/3/1,17:29
*/
public enum ValidFlagEnum {
STOP(0, "停用"),
ONLINE(1, "启用"),
VIRTUALLY(2, "虚拟"),
;
private Integer code;
private String name;
ValidFlagEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
...@@ -92,7 +92,9 @@ public class UserSessionUtils extends UserSession { ...@@ -92,7 +92,9 @@ public class UserSessionUtils extends UserSession {
List<String> factoryCodes = new ArrayList<>(); List<String> factoryCodes = new ArrayList<>();
for (String orgId : orgIds) { for (String orgId : orgIds) {
Org org = HGXSTools.XsOrg.queryFactory(orgId); Org org = HGXSTools.XsOrg.queryFactory(orgId);
factoryCodes.add(org.getOrgId()); if (org != null) {
factoryCodes.add(org.getOrgId());
}
} }
return factoryCodes; return factoryCodes;
} }
......
...@@ -3,11 +3,13 @@ package com.baosight.hggp.hg.pz.service; ...@@ -3,11 +3,13 @@ package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.ValidFlagEnum;
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.domain.HGPZ009;
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.AssertUtils;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo; import com.baosight.iplat4j.core.ProjectInfo;
...@@ -58,6 +60,9 @@ public class ServiceHGPZ009 extends ServiceBase { ...@@ -58,6 +60,9 @@ public class ServiceHGPZ009 extends ServiceBase {
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// 排除虚拟企业
queryRow.put("exValidFlag", ValidFlagEnum.VIRTUALLY.getCode());
inInfo = super.query(inInfo, HGPZ009.QUERY, new HGPZ009()); inInfo = super.query(inInfo, HGPZ009.QUERY, new HGPZ009());
String projectEnv = ProjectInfo.getProjectEnv(); String projectEnv = ProjectInfo.getProjectEnv();
inInfo.setCell(EiConstant.resultBlock, ACConstants.ROW_CODE_0, "projectEnv", projectEnv); inInfo.setCell(EiConstant.resultBlock, ACConstants.ROW_CODE_0, "projectEnv", projectEnv);
...@@ -238,7 +243,7 @@ public class ServiceHGPZ009 extends ServiceBase { ...@@ -238,7 +243,7 @@ public class ServiceHGPZ009 extends ServiceBase {
HGPZ009 fPz009 = new HGPZ009(); HGPZ009 fPz009 = new HGPZ009();
fPz009.fromMap(resultRows.get(i)); fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户 // 校验企业下是否存在用户
int count = HGXSTools.XsUser.countByCompany(fPz009.getAccountCode()); int count = HGXSTools.XsUser.countByAccount(fPz009.getAccountCode());
if (count > 0) { if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getAccountName())); throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getAccountName()));
} }
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
<isNotEmpty prepend=" AND " property="validFlag"> <isNotEmpty prepend=" AND " property="validFlag">
VALID_FLAG = #validFlag# VALID_FLAG = #validFlag#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="exValidFlag">
VALID_FLAG != #exValidFlag#
</isNotEmpty>
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
......
...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.pz.tools; ...@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.pz.tools;
import com.baosight.hggp.core.constant.CommonConstant; 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.enums.ValidFlagEnum;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -30,13 +31,13 @@ public class HGPZTools { ...@@ -30,13 +31,13 @@ public class HGPZTools {
/** /**
* 查询企业信息 * 查询企业信息
* *
* @param companyCode * @param accountCode
* @return * @return
*/ */
public static HGPZ009 getByCode(String companyCode) { public static HGPZ009 getByCode(String accountCode) {
AssertUtils.isEmpty(companyCode, "企业编码不能为空"); AssertUtils.isEmpty(accountCode, "企业编码不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode); queryMap.put("accountCode", accountCode);
List<HGPZ009> pz009s = DaoBase.getInstance().query(HGPZ009.QUERY, queryMap); List<HGPZ009> pz009s = DaoBase.getInstance().query(HGPZ009.QUERY, queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0); return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
} }
...@@ -52,7 +53,7 @@ public class HGPZTools { ...@@ -52,7 +53,7 @@ public class HGPZTools {
if (pz009 == null) { if (pz009 == null) {
return false; return false;
} }
return CommonConstant.YesNo.YES_1.equals(pz009.getValidFlag()); return !ValidFlagEnum.STOP.getCode().equals(pz009.getValidFlag());
} }
} }
......
...@@ -13,7 +13,7 @@ import java.util.Map; ...@@ -13,7 +13,7 @@ import java.util.Map;
*/ */
public class Org extends DaoEPBase { public class Org extends DaoEPBase {
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/ public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/ public static final String FIELD_ORG_ID = "orgId"; /* 组织机构ID*/
public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/ public static final String FIELD_ORG_ENAME = "orgEname"; /* 组织机构名称*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/ public static final String FIELD_ORG_CNAME = "orgCname"; /* 组织机构名称*/
...@@ -23,7 +23,7 @@ public class Org extends DaoEPBase { ...@@ -23,7 +23,7 @@ public class Org extends DaoEPBase {
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 手机号*/ public static final String FIELD_FACTORY_NAME = "factoryName"; /* 手机号*/
public static final String FIELD_LEVEL = "level"; /* 邮箱*/ public static final String FIELD_LEVEL = "level"; /* 邮箱*/
private String companyCode = ""; /* 企业编码 */ private String accountCode = ""; /* 企业编码 */
private String orgId = ""; /* 组织ID */ private String orgId = ""; /* 组织ID */
private String orgEname = ""; /* 组织英文名 */ private String orgEname = ""; /* 组织英文名 */
private String orgCname = ""; /* 组织中文名 */ private String orgCname = ""; /* 组织中文名 */
...@@ -39,7 +39,7 @@ public class Org extends DaoEPBase { ...@@ -39,7 +39,7 @@ public class Org extends DaoEPBase {
public void initMetaData() { public void initMetaData() {
EiColumn eiColumn; EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_COMPANY_CODE); eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码"); eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -84,12 +84,12 @@ public class Org extends DaoEPBase { ...@@ -84,12 +84,12 @@ public class Org extends DaoEPBase {
initMetaData(); initMetaData();
} }
public String getCompanyCode() { public String getAccountCode() {
return companyCode; return accountCode;
} }
public void setCompanyCode(String companyCode) { public void setAccountCode(String accountCode) {
this.companyCode = companyCode; this.accountCode = accountCode;
} }
public String getOrgId() { public String getOrgId() {
...@@ -164,7 +164,7 @@ public class Org extends DaoEPBase { ...@@ -164,7 +164,7 @@ public class Org extends DaoEPBase {
@Override @Override
public void fromMap(Map map) { public void fromMap(Map map) {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId)); setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname)); setOrgEname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ENAME)), orgEname));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname)); setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
...@@ -182,7 +182,7 @@ public class Org extends DaoEPBase { ...@@ -182,7 +182,7 @@ public class Org extends DaoEPBase {
public Map toMap() { public Map toMap() {
Map map = new HashMap(); Map map = new HashMap();
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID))); map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME))); map.put(FIELD_ORG_ENAME, StringUtils.toString(orgEname, eiMetadata.getMeta(FIELD_ORG_ENAME)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME))); map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
......
...@@ -67,7 +67,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -67,7 +67,7 @@ public class ServiceHGXSUser extends ServiceBase {
public EiInfo queryComboBox(EiInfo inInfo) { public EiInfo queryComboBox(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("companyCode", UserSessionUtils.getAccountCode()); queryMap.put("accountCode", UserSessionUtils.getAccountCode());
List<DdynamicEnum> list = new ArrayList<>(); List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.USER_BLOCK_ID); list.add(DdynamicEnum.USER_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, queryMap); CommonMethod.initBlock(inInfo, list, queryMap);
...@@ -83,7 +83,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -83,7 +83,7 @@ public class ServiceHGXSUser extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo queryCompanyComboBox(EiInfo inInfo) { public EiInfo queryAccountComboBox(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
if (ObjectUtils.isNullBlank(queryMap.get("loginName"))) { if (ObjectUtils.isNullBlank(queryMap.get("loginName"))) {
...@@ -91,7 +91,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -91,7 +91,7 @@ public class ServiceHGXSUser extends ServiceBase {
} }
List<DdynamicEnum> list = new ArrayList<>(); List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID); list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID);
queryMap.put("companyCode", UserSessionUtils.getAccountCode()); queryMap.put("accountCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, list, queryMap, false); CommonMethod.initBlock(inInfo, list, queryMap, false);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败"); LogUtils.setMsg(inInfo, e, "查询企业失败");
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<sql id="condition"> <sql id="condition">
AND IS_DELETED = '0' AND IS_DELETED = '0'
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="accountCode">
COMPANY_CODE = #companyCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="orgEname"> <isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname# ORG_ENAME = #orgEname#
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
(SELECT @CODES:=GROUP_CONCAT(ORG_ID) (SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES) WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode# AND ACCOUNT_CODE = #accountCode#
AND IS_DELETED = 0 AND IS_DELETED = 0
) AS T1, ) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL @LEVEL:=@LEVEL+1 AS LEVEL
...@@ -106,22 +106,22 @@ ...@@ -106,22 +106,22 @@
FROM ( FROM (
SELECT SELECT
@CODES as CODES, @CODES as CODES,
(SELECT @CODES:=GROUP_CONCAT(PARENT_ORG_ID) FROM IPLAT.TXSOG01 WHERE FIND_IN_SET(ORG_ID, @CODES) (SELECT @CODES:=GROUP_CONCAT(PARENT_ORG_ID) FROM ${platSchema}.TXSOG01 WHERE FIND_IN_SET(ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode# AND ACCOUNT_CODE = #accountCode#
AND IS_DELETED = 0 AND IS_DELETED = 0
) as T1, ) as T1,
@LEVEL:=@LEVEL+1 as level @LEVEL:=@LEVEL+1 as level
FROM IPLAT.TXSOG01, FROM ${platSchema}.TXSOG01,
(select @CODES:=#orgId#, @LEVEL:= 0) T4 (select @CODES:=#orgId#, @LEVEL:= 0) T4
where @CODES is not null where @CODES is not null
) T2, ) T2,
IPLAT.TXSOG01 T3 ${platSchema}.TXSOG01 T3
WHERE 1=1 WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES) AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
<isNotEmpty prepend=" AND " property="orgType"> <isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType# ORG_TYPE = #orgType#
</isNotEmpty> </isNotEmpty>
AND COMPANY_CODE = #companyCode# AND ACCOUNT_CODE = #accountCode#
ORDER BY T2.LEVEL, T3.ORG_ID ORDER BY T2.LEVEL, T3.ORG_ID
</select> </select>
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
(SELECT @CODES:=GROUP_CONCAT(ORG_ID) (SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES) WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode# AND ACCOUNT_CODE = #accountCode#
AND IS_DELETED = 0 AND IS_DELETED = 0
) AS T1, ) AS T1,
@LEVEL:=@LEVEL+1 AS LEVEL @LEVEL:=@LEVEL+1 AS LEVEL
...@@ -187,9 +187,9 @@ ...@@ -187,9 +187,9 @@
<select id="queryAppGroup" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryAppGroup" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
select c.ORG_ID as "groupCode",c.ORG_CNAME as "groupName",c.FACTORY_CODE as "factoryCode" select c.ORG_ID as "groupCode",c.ORG_CNAME as "groupName",c.FACTORY_CODE as "factoryCode"
from iplat.txsog02 a from ${platSchema}.txsog02 a
join iplat.xs_user b on a.USER_ID=b.USER_ID join ${platSchema}.xs_user b on a.USER_ID=b.USER_ID
join iplat.txsog01 c on c.ORG_ID = a.ORG_ID and c.IS_DELETED = 0 join ${platSchema}.txsog01 c on c.ORG_ID = a.ORG_ID and c.IS_DELETED = 0
where 1=1 and c.ORG_TYPE = 'prodGroup' where 1=1 and c.ORG_TYPE = 'prodGroup'
<isNotEmpty prepend=" AND " property="userId"> <isNotEmpty prepend=" AND " property="userId">
b.USER_ID = #userId# b.USER_ID = #userId#
...@@ -197,39 +197,12 @@ ...@@ -197,39 +197,12 @@
</select> </select>
<!-- 查询组织信息 --> <!-- 查询组织信息 -->
<select id="queryList" resultClass="com.baosight.hggp.hg.pz.domain.HPPZ011">
SELECT
A.ORG_ENAME AS "groupCode",
A.ORG_CNAME AS "groupName",
A.PARENT_ORG_ID AS "factoryCode",
B.ORG_CNAME AS "factoryName"
FROM iplat.TXSOG01 A LEFT JOIN (
SELECT
ORG_ENAME,
ORG_CNAME
FROM iplat.TXSOG01 WHERE COMPANY_CODE=#companyCode#
) B ON A.PARENT_ORG_ID=B.ORG_ENAME
WHERE A.ORG_TYPE = 'prodGroup' AND A.COMPANY_CODE=#companyCode#
<isNotEmpty prepend=" AND " property="factoryCode">
A.PARENT_ORG_ID=#factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
B.ORG_CNAME LIKE CONCAT('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
A.ORG_CNAME LIKE CONCAT('%', #groupName#, '%')
</isNotEmpty>
</select>
<!-- 查询组织信息 -->
<select id="queryTedcm01" resultClass="java.util.HashMap"> <select id="queryTedcm01" resultClass="java.util.HashMap">
SELECT SELECT
ITEM_CODE AS "itemCode", ITEM_CODE AS "itemCode",
ITEM_CNAME AS "itemCname" ITEM_CNAME AS "itemCname"
FROM iplat.TEDCM01 FROM ${platSchema}.TEDCM01
WHERE CODESET_CODE = 'hpjx.hpjx.poorType' WHERE CODESET_CODE = 'hpjx.hpjx.poorType'
</select> </select>
</sqlMap> </sqlMap>
...@@ -17,7 +17,8 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -17,7 +17,8 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager; import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.constants.LoginConstants; import com.baosight.xservices.xs.constants.LoginConstants;
import org.springframework.util.CollectionUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -82,12 +83,12 @@ public class HGXSTools { ...@@ -82,12 +83,12 @@ public class HGXSTools {
/** /**
* 统计企业下的用户数量 * 统计企业下的用户数量
* *
* @param companyCode * @param accountCode
* @return * @return
*/ */
public static int countByCompany(String companyCode) { public static int countByAccount(String accountCode) {
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode); paramMap.put("accountCode", accountCode);
List<Integer> results = DaoBase.getInstance().query("HGXSUser.count", paramMap); List<Integer> results = DaoBase.getInstance().query("HGXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0); return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
} }
...@@ -211,8 +212,7 @@ public class HGXSTools { ...@@ -211,8 +212,7 @@ public class HGXSTools {
queryMap.put("orgId", orgId); queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode()); queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode());
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_PARENT, queryMap); List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_PARENT, queryMap);
AssertUtils.isEmpty(results, String.format("组织[%s]不存在厂区信息", orgId)); return CollectionUtils.isEmpty(results) ? null : results.get(0);
return results.get(0);
} }
/** /**
......
...@@ -116,7 +116,7 @@ public class CommonMethod { ...@@ -116,7 +116,7 @@ public class CommonMethod {
String time = DateUtils.curDateTimeStr14(); String time = DateUtils.curDateTimeStr14();
for(int i=0; i < block.getRowCount(); i++){ for(int i=0; i < block.getRowCount(); i++){
//TODO 公司代码待补充 //TODO 公司代码待补充
block.setCell(i, HPConstants.SQL_FIELD_COMPANYCODE, ""); block.setCell(i, HPConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HPConstants.SQL_FIELD_CREATED_BY, userId); block.setCell(i, HPConstants.SQL_FIELD_CREATED_BY, userId);
block.setCell(i, HPConstants.SQL_FIELD_CREATED_NAME, userName); block.setCell(i, HPConstants.SQL_FIELD_CREATED_NAME, userName);
block.setCell(i, HPConstants.SQL_FIELD_CREATED_TIME, time); block.setCell(i, HPConstants.SQL_FIELD_CREATED_TIME, time);
...@@ -135,7 +135,7 @@ public class CommonMethod { ...@@ -135,7 +135,7 @@ public class CommonMethod {
String time = DateUtils.curDateTimeStr14(); String time = DateUtils.curDateTimeStr14();
for(int i=0; i < block.getRowCount(); i++){ for(int i=0; i < block.getRowCount(); i++){
//TODO 公司代码待补充 //TODO 公司代码待补充
block.setCell(i, HPConstants.SQL_FIELD_COMPANYCODE, ""); block.setCell(i, HPConstants.SQL_FIELD_ACCOUNT_CODE, "");
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_BY, userId); block.setCell(i, HPConstants.SQL_FIELD_UPDATED_BY, userId);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_NAME, userName); block.setCell(i, HPConstants.SQL_FIELD_UPDATED_NAME, userName);
block.setCell(i, HPConstants.SQL_FIELD_UPDATED_TIME, time); block.setCell(i, HPConstants.SQL_FIELD_UPDATED_TIME, time);
......
...@@ -169,7 +169,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -169,7 +169,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
parameters = new HashMap(); parameters = new HashMap();
} }
// 设置企业信息 // 设置企业信息
this.setCompanyCode(name, parameters); this.setAccountCode(name, parameters);
// 设置数据查询权限 // 设置数据查询权限
this.setDataAuth(name, parameters); this.setDataAuth(name, parameters);
} }
...@@ -180,7 +180,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -180,7 +180,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
* @param name * @param name
* @param parameters * @param parameters
*/ */
private void setCompanyCode(String name, Object parameters) { private void setAccountCode(String name, Object parameters) {
// 需要过滤部分sql name,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HGXSUser", "HPPZ009.query"}; String[] serviceFilter = {"HGXSUser", "HPPZ009.query"};
if (StringUtils.startsWithAny(name, serviceFilter)) { if (StringUtils.startsWithAny(name, serviceFilter)) {
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta; import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
...@@ -34,7 +35,13 @@ public class ServiceXSOG0800 extends TreeService { ...@@ -34,7 +35,13 @@ 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();
map.put("label", "root"); map.put("label", "root");
map.put("text", "组织机构"); //
String accountCode = UserSessionUtils.getAccountCode();
if (StringUtils.isEmpty(accountCode)) {
map.put("text", "组织机构");
} else {
map.put("text", HGPZTools.HgPz009.getByCode(accountCode).getAccountName());
}
map.put("leaf", "0"); map.put("leaf", "0");
map.put("parent", "0"); map.put("parent", "0");
list.add(map); list.add(map);
......
...@@ -310,18 +310,13 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -310,18 +310,13 @@ public class ServiceXSOG0801 extends ServiceBase {
List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < rows.size(); ++i) { for (int i = 0; i < rows.size(); ++i) {
Map row = rows.get(i); Map row = rows.get(i);
// 厂区工人不能同时存在多个组
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("userId", row.get("userId")); queryMap.put("userId", row.get("userId"));
// List<HPPZ013> dbPz013s = dao.query(HPPZ013.QUERY, queryMap); List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", queryMap);
// if (dbPz013s.size() > 0) { if (userResults.size() > 0) {
// 用户是工人时,只能有一个组织 errorMsg = errorMsg + "\n添加用户[" + row.get("loginName") + "]失败,用户已为其他组织机构成员";
// List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", queryMap); continue;
// if (userResults.size() > 0) { }
// errorMsg = errorMsg + "\n添加用户[" + row.get("loginName") + "]失败,选择用户已为其他组织机构成员";
// continue;
// }
// }
row.put("recCreator", UserSession.getLoginName()); row.put("recCreator", UserSession.getLoginName());
insertList.add(row); insertList.add(row);
} }
......
...@@ -48,10 +48,23 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -48,10 +48,23 @@ public class ServiceXSOG0801A extends ServiceEPBase {
String parentOrgId = MapUtils.getString(queryMap, "parentOrgId"); String parentOrgId = MapUtils.getString(queryMap, "parentOrgId");
String condition; String condition;
if (CommonConstant.Field.ROOT.equals(parentOrgId)) { if (CommonConstant.Field.ROOT.equals(parentOrgId)) {
condition = String.format(" ITEM_CODE = '%s'", OrgTypeEnum.FACTORY.getCode()); condition = String.format(" ITEM_CODE IN ('%s', '%s')", OrgTypeEnum.COMPANY.getCode(),
OrgTypeEnum.DEPT.getCode());
} else { } else {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s', '%s')", OrgTypeEnum.DEPT.getCode(), // 查询组织
OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode(),OrgTypeEnum.SYN_GROUP.getCode()); Org org = HGXSTools.XsOrg.get(parentOrgId);
if (OrgTypeEnum.COMPANY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.COMPANY.getCode(),
OrgTypeEnum.FACTORY.getCode(), OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s')", OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.DEPT.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s', '%s')", OrgTypeEnum.DEPT.getCode(),
OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode(),
OrgTypeEnum.SYN_GROUP.getCode());
} else {
condition = " ITEM_CODE = 'NOT CODE'";
}
} }
List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.XsOg.ORG_TYPE, condition); List<Map> orgTypes = CodeValueTools.getCodeValues(CodesetConstant.XsOg.ORG_TYPE, condition);
inInfo.addBlock("orgTypeBlock").addRows(orgTypes); inInfo.addBlock("orgTypeBlock").addRows(orgTypes);
...@@ -120,8 +133,8 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -120,8 +133,8 @@ public class ServiceXSOG0801A extends ServiceEPBase {
} else { } else {
// 查询所属厂 // 查询所属厂
Org factoryOrg = HGXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString()); Org factoryOrg = HGXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString());
row.put("factoryCode", factoryOrg.getOrgId()); row.put("factoryCode", factoryOrg == null ? "" : factoryOrg.getOrgId());
row.put("factoryName", factoryOrg.getOrgCname()); row.put("factoryName", factoryOrg == null ? "" : factoryOrg.getOrgCname());
} }
newRows.add(row); newRows.add(row);
} }
......
...@@ -167,6 +167,32 @@ ...@@ -167,6 +167,32 @@
ORDER BY SORT_INDEX ASC ORDER BY SORT_INDEX ASC
</select> </select>
<!--条件查询组织机构-->
<select id="count" parameterClass="java.util.HashMap" resultClass="int">
SELECT COUNT(1)
FROM ${platSchema}.TXSOG01
WHERE 1=1
AND IS_DELETED = '0'
<isNotEmpty prepend=" and UPPER(ORG_ENAME) like " property="orgEname">
UPPER ('%$orgEname$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentOrgId">
PARENT_ORG_ID = #parentOrgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgId">
ORG_ID = #orgId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgCname">
ORG_CNAME like ('%$orgCname$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE like ('%$orgType$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</select>
<!-- 根据id查询组织机构 --> <!-- 根据id查询组织机构 -->
<select id="queryByOrgId" parameterClass="java.util.HashMap" <select id="queryByOrgId" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap"> resultClass="java.util.HashMap">
......
...@@ -680,8 +680,8 @@ ...@@ -680,8 +680,8 @@
<isNotEmpty prepend=" AND " property="orgCname"> <isNotEmpty prepend=" AND " property="orgCname">
ORG_CNAME LIKE ('%$orgCname$%') ORG_CNAME LIKE ('%$orgCname$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="accountCode">
COMPANY_CODE = #companyCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
</select> </select>
......
...@@ -143,7 +143,7 @@ public class ServiceXS3001 extends ServiceEPBase { ...@@ -143,7 +143,7 @@ public class ServiceXS3001 extends ServiceEPBase {
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16 // 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getAccountCode()); inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
} }
EiInfo outInfo = super.query(inInfo, "XS3001.queryGroupOutOfUser", new XS02()); EiInfo outInfo = super.query(inInfo, "XS3001.queryGroupOutOfUser", new XS02());
EiBlock eiBlock = new EiBlock("result3"); EiBlock eiBlock = new EiBlock("result3");
......
...@@ -268,7 +268,7 @@ public class ServiceXSOrgManage extends ServiceEPBase { ...@@ -268,7 +268,7 @@ public class ServiceXSOrgManage extends ServiceEPBase {
insertMap.put("recReviseTime", " "); insertMap.put("recReviseTime", " ");
insertMap.put("archiveFlag", " "); insertMap.put("archiveFlag", " ");
insertMap.put("isDeleted", "0"); insertMap.put("isDeleted", "0");
insertMap.put("companyCode", inInfoRowMap.get("companyCode")); insertMap.put("accountCode", inInfoRowMap.get("accountCode"));
insertMap.put("factoryCode", inInfoRowMap.get("factoryCode")); insertMap.put("factoryCode", inInfoRowMap.get("factoryCode"));
insertMap.put("factoryName", inInfoRowMap.get("factoryName")); insertMap.put("factoryName", inInfoRowMap.get("factoryName"));
if (insertFlag) { if (insertFlag) {
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
and MEMBER_ID = #currentUserId# and MEMBER_ID = #currentUserId#
) )
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend="AND" property="companyCode"> <isNotEmpty prepend="AND" property="accountCode">
COMPANY_CODE = #companyCode# ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
ORDER BY SORT_INDEX,ID ORDER BY SORT_INDEX,ID
</select> </select>
......
...@@ -98,8 +98,8 @@ ...@@ -98,8 +98,8 @@
<isNotEmpty prepend=" AND " property="userName"> <isNotEmpty prepend=" AND " property="userName">
t1.user_name like ('%$userName$%') t1.user_name like ('%$userName$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="accountCode">
t1.COMPANY_CODE = #companyCode# t1.account_code = #accountCode#
</isNotEmpty> </isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
......
...@@ -2265,7 +2265,7 @@ ...@@ -2265,7 +2265,7 @@
} }
}); });
// 对于超长的 菜单项,显示叠层 // 对于超长的 菜单项,显示叠层
...@@ -2446,9 +2446,9 @@ $(function () { ...@@ -2446,9 +2446,9 @@ $(function () {
try { try {
if (loginName !== "admin"){ if (loginName !== "admin"){
var info = new EiInfo() var info = new EiInfo()
info.set("inqu_status-0-companyCode",loginName) info.set("inqu_status-0-accountCode", loginName)
EiCommunicator.send("HPPZ009", "query", info, { EiCommunicator.send("HGPZ009", "query", info, {
onSuccess: function (ei) {//返回结果集 onSuccess: function (ei) {//返回结果集
if (ei.blocks.result !== undefined){ if (ei.blocks.result !== undefined){
let results = ei.getBlock("result").getMappedRows(); let results = ei.getBlock("result").getMappedRows();
if (results.length>0 && results[0].docIdPc.trim().length>0){ if (results.length>0 && results[0].docIdPc.trim().length>0){
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<%@ page import="com.baosight.xservices.xs.constants.LoginConstants" %> <%@ page import="com.baosight.xservices.xs.constants.LoginConstants" %>
<%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="com.baosight.hggp.core.security.UserSessionUtils" %> <%@ page import="com.baosight.hggp.core.security.UserSessionUtils" %>
<%@ page import="com.baosight.hggp.hg.pz.tools.HGPZTools" %>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
...@@ -100,8 +101,8 @@ ...@@ -100,8 +101,8 @@
String passwordDesc = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.checkpassword.desc"), "密码必须包含英文及数字"); String passwordDesc = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.checkpassword.desc"), "密码必须包含英文及数字");
String loginPublicKey = LoginConstants.loginRsaPublicKey; String loginPublicKey = LoginConstants.loginRsaPublicKey;
String cryptoPasswordEnable = LoginConstants.cryptoPasswordEnable; String cryptoPasswordEnable = LoginConstants.cryptoPasswordEnable;
String companyCode = UserSessionUtils.getCompanyCode(); String accountCode = UserSessionUtils.getAccountCode();
String loginPrefix = "";//StringUtils.isBlank(companyCode) ? "" : HPPZTools.HpPz009.getByCode(companyCode).getLoginPrefix(); String loginPrefix = StringUtils.isBlank(accountCode) ? "" : HGPZTools.HgPz009.getByCode(accountCode).getLoginPrefix();
%> %>
<c:set var="pwdRgx" value="<%=passwordRegex%>"/> <c:set var="pwdRgx" value="<%=passwordRegex%>"/>
<c:set var="pwdDesc" value="<%=passwordDesc%>"/> <c:set var="pwdDesc" value="<%=passwordDesc%>"/>
......
...@@ -52,13 +52,14 @@ ...@@ -52,13 +52,14 @@
<div class="col-xs-9" style="text-align: right" id="inqu_inside"></div> <div class="col-xs-9" style="text-align: right" id="inqu_inside"></div>
</div> </div>
<hr> <hr>
<%-- </EF:EFRegion>--%>
<%-- <EF:EFRegion id="result" title="用户信息" fitHeight="true">--%>
<EF:EFGrid blockId="result" autoDraw="no" personal="true"> <EF:EFGrid blockId="result" autoDraw="no" personal="true">
<%-- <EF:EFGrid blockId="result" autoBind="true" personal="true">--%>
<EF:EFColumn ename="loginName" cname="登录账号" readonly="true" style="text-align:left;"/> <EF:EFColumn ename="loginName" cname="登录账号" readonly="true" style="text-align:left;"/>
<EF:EFColumn ename="userName" cname="用户姓名" style="text-align:left;"/> <EF:EFColumn ename="userName" cname="用户姓名" style="text-align:left;"/>
<EF:EFColumn ename="companyCode" cname="企业编码" readonly="true" style="text-align:left;"/> <EF:EFColumn ename="accountCode" cname="企业编码" readonly="true" style="text-align:left;"/>
<EF:EFComboColumn ename="isManager" cname="是否管理员" valueField="valueField" textField="textField"
columnTemplate="#=textField#" align="center">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="gender" cname="性别" valueField="valueField" textField="textField" <EF:EFComboColumn ename="gender" cname="性别" valueField="valueField" textField="textField"
columnTemplate="#=textField#" align="center"> columnTemplate="#=textField#" align="center">
<EF:EFCodeOption codeName="xservices.xs.sex"/> <EF:EFCodeOption codeName="xservices.xs.sex"/>
......
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