Commit 06610fdf by liuyang

2024-07-16 设备管理优化根据用户角色查询用户所属公司用户

parent 36abee8b
...@@ -279,7 +279,7 @@ public enum DdynamicEnum { ...@@ -279,7 +279,7 @@ public enum DdynamicEnum {
put("orgType", OrgTypeEnum.COMPANY.getCode()); put("orgType", OrgTypeEnum.COMPANY.getCode());
}}), }}),
USER_ID_BOX_BLOCK_ID("user_block_id","loginName","userName","XSOG0801.queryUserByOrgIdBack"), USER_ID_BOX_BLOCK_ID("user_block_id","loginName","userName","companyCode","XSOG0801.queryUserByOrgIdBack"),
/** /**
* 模块:工序编码 * 模块:工序编码
......
...@@ -45,7 +45,7 @@ public class ServiceHGSB001 extends ServiceEPBase { ...@@ -45,7 +45,7 @@ public class ServiceHGSB001 extends ServiceEPBase {
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
//角色公司 //角色公司
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,roleCompanyCode); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败!"); LogUtils.setDetailMsg(inInfo,e,"初始化失败!");
......
...@@ -44,7 +44,7 @@ public class ServiceHGSB002 extends ServiceEPBase { ...@@ -44,7 +44,7 @@ public class ServiceHGSB002 extends ServiceEPBase {
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
//角色公司 //角色公司
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,roleCompanyCode); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败"); LogUtils.setDetailMsg(inInfo,e,"初始化失败");
......
...@@ -36,12 +36,12 @@ public class ServiceHGSB002A extends ServiceEPBase { ...@@ -36,12 +36,12 @@ public class ServiceHGSB002A extends ServiceEPBase {
String companyCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB001.FIELD_COMPANY_CODE); String companyCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB001.FIELD_COMPANY_CODE);
String groupCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB002A.FIELD_GROUP_CODE); String groupCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB002A.FIELD_GROUP_CODE);
inInfo = super.query(inInfo, HGSB002A.QUERY, new HGSB002A()); inInfo = super.query(inInfo, HGSB002A.QUERY, new HGSB002A());
Map qarma = new HashMap(); /*Map qarma = new HashMap();
Map userCompany = HGSBTools.getUserCompany(); Map userCompany = HGSBTools.getUserCompany();
if (!userCompany.isEmpty()) { if (!userCompany.isEmpty()) {
qarma.put(Org.FIELD_PARENT_ORG_ID,userCompany.get(HGSB002.FIELD_COMPANY_CODE)); qarma.put(Org.FIELD_PARENT_ORG_ID,userCompany.get(HGSB002.FIELD_COMPANY_CODE));
} }*/
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID),qarma); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
//CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),null); //CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID), CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID),
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
......
...@@ -45,7 +45,7 @@ public class ServiceHGSB003 extends ServiceEPBase { ...@@ -45,7 +45,7 @@ public class ServiceHGSB003 extends ServiceEPBase {
EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
//角色公司 //角色公司
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,roleCompanyCode); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID)); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.DEVICE_CODE_BOX_BLOCK_ID));
......
...@@ -43,7 +43,7 @@ public class ServiceHGSB004 extends ServiceEPBase { ...@@ -43,7 +43,7 @@ public class ServiceHGSB004 extends ServiceEPBase {
Map<String,Object> qarma = new HashMap<>(); Map<String,Object> qarma = new HashMap<>();
EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,roleCompanyCode); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败"); LogUtils.setDetailMsg(inInfo,e,"初始化失败");
......
...@@ -41,8 +41,8 @@ public class ServiceHGSB004B extends ServiceEPBase { ...@@ -41,8 +41,8 @@ public class ServiceHGSB004B extends ServiceEPBase {
Map<String,Object> qarma = new HashMap<>(); Map<String,Object> qarma = new HashMap<>();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
List<String> orgIds = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,orgIds); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败"); LogUtils.setDetailMsg(inInfo,e,"初始化失败");
......
...@@ -44,8 +44,8 @@ public class ServiceHGSB005 extends ServiceEPBase { ...@@ -44,8 +44,8 @@ public class ServiceHGSB005 extends ServiceEPBase {
EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(outInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID));
//角色公司 //角色公司
List<String> orgIds = HGSBTools.getRoleCompanyCode(); List<String> roleCompanyCode = HGSBTools.getRoleCompanyCode();
qarma.put(Org.FIELD_ORG_ID,orgIds); qarma.put(HGSB001.FIELD_COMPANY_CODES,roleCompanyCode);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma); CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
}catch (Exception e){ }catch (Exception e){
LogUtils.setDetailMsg(inInfo,e,"初始化失败"); LogUtils.setDetailMsg(inInfo,e,"初始化失败");
......
package com.baosight.hggp.hg.xs.service; package com.baosight.hggp.hg.xs.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
...@@ -64,6 +65,32 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -64,6 +65,32 @@ public class ServiceHGXSUser extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "用户管理",operType = "查询",operDesc = "用户所属公司所有用户")
public EiInfo queryOrgUserBox(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("accountCode", UserSessionUtils.getAccountCode());
Object isSplicingSymbol = queryMap.get("isSplicingSymbol");
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.USER_ID_BOX_BLOCK_ID);
if (isSplicingSymbol != null){
CommonMethod.initBlock(inInfo, list, queryMap, true);
}else {
CommonMethod.initBlock(inInfo, list, queryMap, false);
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败");
}
return inInfo;
}
/**
* 查询用户下拉框
*
* @param inInfo
* @return
*/
public EiInfo queryComboBox(EiInfo inInfo) { public EiInfo queryComboBox(EiInfo inInfo) {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
......
...@@ -137,6 +137,7 @@ ...@@ -137,6 +137,7 @@
t1.ORG_ID AS "orgId", t1.ORG_ID AS "orgId",
t1.ORG_ENAME AS "orgEname", t1.ORG_ENAME AS "orgEname",
t1.ORG_CNAME AS "orgCname", t1.ORG_CNAME AS "orgCname",
t1.COMPANY_CODE AS "companyCode",
t2.rec_create_time AS "recCreateTime", t2.rec_create_time AS "recCreateTime",
t2.USER_ID AS userId FROM ${platSchema}.txsog01 t1 LEFT JOIN ${platSchema}.txsog02 t2 ON t1.ORG_ID = t2.ORG_ID t2.USER_ID AS userId FROM ${platSchema}.txsog01 t1 LEFT JOIN ${platSchema}.txsog02 t2 ON t1.ORG_ID = t2.ORG_ID
INNER JOIN ${platSchema}.xs_user xu ON t2.USER_ID = xu.USER_ID INNER JOIN ${platSchema}.xs_user xu ON t2.USER_ID = xu.USER_ID
...@@ -145,6 +146,12 @@ ...@@ -145,6 +146,12 @@
<isNotEmpty prepend="AND" property="accountCode"> <isNotEmpty prepend="AND" property="accountCode">
t1.ACCOUNT_CODE = #accountCode# t1.ACCOUNT_CODE = #accountCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend="AND" property="companyCode">
t1.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend="AND" property="companyCodes">
t1.COMPANY_CODE IN <iterate property="companyCodes" open="(" close=")" conjunction=","> #companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend="AND" property="orgCname"> <isNotEmpty prepend="AND" property="orgCname">
t1.ORG_CNAME LIKE ('%$orgCname$%') t1.ORG_CNAME LIKE ('%$orgCname$%')
</isNotEmpty> </isNotEmpty>
......
...@@ -2,6 +2,7 @@ $(function () { ...@@ -2,6 +2,7 @@ $(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows(); var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows(); var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows();
var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
...@@ -112,7 +113,18 @@ $(function () { ...@@ -112,7 +113,18 @@ $(function () {
},{ },{
field: "deviceCode", field: "deviceCode",
title: "设备编码", title: "设备编码",
},{
field: "deviceUserId",
title: "设备负责人",
filter: function (option) {
let companyCode = option.model['companyCode'];
if (companyCode){
return _.filter(userIdBox, function (item) {
return item["param1Field"]==companyCode;
})
}
return option.values
},
} }
], ],
exportGrid: { exportGrid: {
......
...@@ -4,6 +4,7 @@ $(function () { ...@@ -4,6 +4,7 @@ $(function () {
var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows(); var groupCodeBox = __eiInfo.getBlock("group_record_block_id").getMappedRows();
var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows(); var userIdBox = __eiInfo.getBlock("user_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
...@@ -128,6 +129,15 @@ $(function () { ...@@ -128,6 +129,15 @@ $(function () {
}, { }, {
field: "planUserId", field: "planUserId",
title: "计划人", title: "计划人",
filter: function (option) {
let companyCode = option.model['companyCode'];
if (companyCode){
return _.filter(userIdBox, function (item) {
return item["param1Field"]==companyCode;
})
}
return option.values
},
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < userIdBox.length; i++) { for (let i = 0; i < userIdBox.length; i++) {
if (userIdBox[i]['valueField'] === dataItem['planUserId']){ if (userIdBox[i]['valueField'] === dataItem['planUserId']){
......
...@@ -111,6 +111,15 @@ $(function () { ...@@ -111,6 +111,15 @@ $(function () {
},*/ { },*/ {
field: "applyUserId", field: "applyUserId",
title: "申请人", title: "申请人",
filter: function (option) {
let companyCode = option.model['companyCode'];
if (companyCode){
return _.filter(userIdBox, function (item) {
return item["param1Field"]==companyCode;
})
}
return option.values
},
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < userIdBox.length; i++) { for (let i = 0; i < userIdBox.length; i++) {
if (userIdBox[i]['valueField'] === dataItem['applyUserId']){ if (userIdBox[i]['valueField'] === dataItem['applyUserId']){
......
...@@ -93,6 +93,15 @@ $(function () { ...@@ -93,6 +93,15 @@ $(function () {
}, { }, {
field: "inspecUserId", field: "inspecUserId",
title: "点检人", title: "点检人",
filter: function (option) {
let companyCode = option.model['companyCode'];
if (companyCode){
return _.filter(userIdBox, function (item) {
return item["param1Field"]==companyCode;
})
}
return option.values
},
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < userIdBox.length; i++) { for (let i = 0; i < userIdBox.length; i++) {
if (userIdBox[i]['valueField'] === dataItem['inspecUserId']){ if (userIdBox[i]['valueField'] === dataItem['inspecUserId']){
......
...@@ -84,6 +84,15 @@ $(function () { ...@@ -84,6 +84,15 @@ $(function () {
}, { }, {
field: "upkeepUserId", field: "upkeepUserId",
title: "保养人", title: "保养人",
filter: function (option) {
let companyCode = option.model['companyCode'];
if (companyCode){
return _.filter(userIdBox, function (item) {
return item["param1Field"]==companyCode;
})
}
return option.values
},
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < userIdBox.length; i++) { for (let i = 0; i < userIdBox.length; i++) {
if (userIdBox[i]['valueField'] === dataItem['upkeepUserId']){ if (userIdBox[i]['valueField'] === dataItem['upkeepUserId']){
......
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