Commit 27211fbb by 宋祥

1.企业管理

2.用户管理
3.角色管理
4.菜单授权管理
5.组织管理
parent 2604b973
package com.baosight.hpjx.core.constant;
/**
* @author:songx
* @date:2022/11/1,17:08
*/
public class CommonConstant {
/**
* 是否
*
* @author:songx
* @date:2022/11/1,17:09
*/
public static class YesNo {
// 是
public static final Integer YES_1 = 1;
// 否
public static final Integer NO_0 = 0;
// 是
public static final String YES = "Y";
// 否
public static final String NO = "N";
}
}
package com.baosight.hpjx.core.dao;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
/**
* 数据库操作辅助类
*
* @author:songx
* @date:2022/5/9,15:41
*/
public class DaoBase {
private DaoBase() {
}
/**
* 获取DAO
*
* @return
*/
public static Dao getInstance() {
return SingletonHolder.dao;
}
/**
* 获取DAO
*
* @return
*/
public static Dao getPlatInstance() {
return SingletonHolder.platDao;
}
/**
* 静态内部类用于初始化
*
* @author:songx
* @date:2022/5/9,15:48
*/
private static class SingletonHolder {
/**
* 默认DAO
*/
private final static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* platDao
*/
private final static Dao platDao = (Dao) PlatApplicationContext.getBean("platDao");
}
}
package com.baosight.hpjx.core.dao;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2023/10/18,16:35
*/
@Slf4j
public class DaoUtils {
/**
* count 查询
*
* @param sqlName
* @param paramMap
* @return
*/
public static int count(String sqlName, Map paramMap) {
AssertUtils.isEmpty(sqlName, "sql name不能为空!");
List<Integer> countMaps = DaoBase.getInstance().query(sqlName, paramMap);
return CollectionUtils.isEmpty(countMaps) ? 0 : countMaps.get(0).intValue();
}
/**
* insert method.
*
* @param sql
* @param obj
*/
public static void insert(String sql, Object obj) throws PlatException {
if (obj instanceof DaoEPBase) {
setCreator((DaoEPBase) obj);
} else if (obj instanceof Map) {
setCreator((Map) obj);
}
DaoBase.getInstance().insert(sql, obj);
}
/**
* update method.
*
* @param sql
* @param obj
*/
public static int update(String sql, Object obj) {
if (obj instanceof DaoEPBase) {
setRevisor((DaoEPBase) obj, true);
} else if (obj instanceof Map) {
setRevisor((Map) obj, true);
}
return DaoBase.getInstance().update(sql, obj);
}
/**
* 创建人工号 创建人姓名 创建人岗号 创建时刻
*
* @param bean
*/
private static void setCreator(DaoEPBase bean) {
// 创建人ID
String userId;
try {
userId = UserSession.getLoginName();
userId = userId == null || userId.length() > 32 ? "System" : userId;
} catch (Exception e) {
userId = "System";
}
try {
BeanUtils.setProperty(bean, "createdBy", userId);
BeanUtils.setProperty(bean, "updatedBy", "");
} catch (Exception e) {
log.warn("写入创建人ID失败", e);
}
// 创建人姓名
try {
String userName;
try {
userName = UserSession.getLoginCName();
} catch (Exception e) {
userName = "System";
}
BeanUtils.setProperty(bean, "createdName", userName);
BeanUtils.setProperty(bean, "updatedName", "");
} catch (Exception e) {
log.warn("写入创建人姓名失败", e);
}
// 创建时刻
try {
BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime());
BeanUtils.setProperty(bean, "updatedTime", "");
} catch (Exception e) {
log.error("写入创建时刻失败:{}", e.getMessage(), e);
}
}
/**
* 创建人工号 创建人姓名 创建时刻.
*
* @param map
*/
public static void setCreator(Map map) {
// 创建人工号
String userId = MapUtils.getString(map, "createdBy");
try {
if (StringUtils.isEmpty(userId)) {
userId = UserSession.getLoginName();
userId = userId == null || userId.length() > 32 ? "System" : userId;
}
} catch (Exception e) {
userId = "System";
}
map.put("createdBy", userId);
map.put("updatedBy", "");
// 创建人姓名
String userName = MapUtils.getString(map, "createdName");
try {
if (StringUtils.isEmpty(userName)) {
userName = UserSession.getLoginCName();
}
} catch (Exception e) {
userName = "System";
}
map.put("createdName", userName);
map.put("updatedName", "");
// 创建时刻
try {
map.put("createdTime", DateUtils.shortDateTime());
map.put("updatedTime", "");
} catch (PlatException e) {
log.warn("写入创建时刻失败", e);
}
}
/**
* 修改人工号 修改人姓名 修改人岗号 修改时刻 记录修改代理人工号 记录修改代理人姓名.
*
* @param bean
* @param addJobId
*/
private static void setRevisor(DaoEPBase bean, Boolean addJobId) {
// 修改人ID
String userId;
try {
userId = UserSession.getLoginName();
userId = userId == null || userId.length() > 32 ? "System" : userId;
} catch (Exception e) {
userId = "System";
}
try {
BeanUtils.setProperty(bean, "updatedBy", userId);
} catch (Exception e) {
log.warn("写入修改人ID失败", e);
}
// 修改人名称
try {
String userName = UserSession.getLoginCName();
BeanUtils.setProperty(bean, "updatedName", userName);
} catch (Exception e) {
log.warn("写入修改人名称失败", e);
}
// 修改时刻
try {
BeanUtils.setProperty(bean, "updatedTime", DateUtils.shortDateTime());
} catch (Exception e) {
log.warn("写入修改时刻失败", e);
}
}
/**
* 修改人工号 修改人姓名 修改人岗号 修改时刻 记录修改代理人工号 记录修改代理人姓名.
*
* @param map
* @param addJobId
*/
private static void setRevisor(Map map, Boolean addJobId) {
String userId;
try {
userId = MapUtils.getString(map, "updatedBy");
if (StringUtils.isEmpty(userId)) {
userId = UserSession.getLoginName();
userId = userId == null || userId.length() > 32 ? "System" : userId;
}
} catch (Exception e) {
userId = "System";
}
map.put("updatedBy", userId);
// 修改人名称
String userName = MapUtils.getString(map, "updatedName");
try {
if (StringUtils.isEmpty(userName)) {
userName = UserSession.getLoginCName();
}
} catch (Exception e) {
userName = "System";
}
map.put("updatedName", userName);
// 修改时间
map.put("updatedTime", DateUtils.shortDateTime());
}
}
package com.baosight.hpjx.core.security;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* @author:songx
* @date:2024/1/15,14:48
*/
public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap();
/**
* 获取用户信息
*
* @return
*/
public static User getUser() {
EiInfo eiInfo = new EiInfo();
eiInfo.set("loginName", UserSession.getLoginName());
eiInfo.set(EiConstant.serviceName, "HPXSUser");
eiInfo.set(EiConstant.methodName, "getUser");
EiInfo outInfo = XLocalManager.call(eiInfo);
// -1表示报错
if (outInfo.getStatus() == -1) {
throw new PlatException("无法调用用户信息");
}
// 状态为0表示不存在此用户
if (outInfo.getStatus() == 0) {
return null;
}
// 其它状态,异常
if (outInfo.getStatus() != 1) {
throw new PlatException(outInfo.getMsg());
}
// 状态为1表示用户存在
return (User) outInfo.get(EiConstant.resultBlock);
}
/**
* 获取登录用户的公司编码
*
* @return
*/
public static String getCompanyCode() {
String loginName = getLoginName();
String companyCode = MapUtils.getString(companyMap, loginName);
if (StringUtils.isBlank(companyCode)) {
companyCode = getUser().getCompanyCode();
companyCode = companyCode == null ? "" : companyCode;
companyMap.put(loginName, companyCode);
}
return companyCode;
}
}
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 公司管理
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHPPZ009 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ009().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPPZ009.query", new HPPZ009());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
if (fPz009.getId() == null || fPz009.getId() == 0) {
this.add(fPz009);
} else {
this.modify(fPz009);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
AssertUtils.isEmpty(hppz009.getCompanyName(), "企业名称不能为空");
AssertUtils.isNull(hppz009.getValidFlag(), "是否启用不能为空");
}
}
/**
* 新增企业信息
*
* @param fPz009
* @throws Exception
*/
private void add(HPPZ009 fPz009) throws Exception {
// 生成企业编码
fPz009.setCompanyCode(SequenceGenerator.getNextSequence("COMPANY_CODE"));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert("HPPZ009.insert", fPz009);
// 默认新增企业管理员账号
this.initUser(fPz009);
// 关联企业管理员角色
this.insertGroupMember(fPz009);
}
/**
* 修改数据
*
* @param fPz009
*/
private void modify(HPPZ009 fPz009) {
DaoUtils.update("HPPZ009.update", fPz009);
}
/**
* 新增操作.
*
* @param inInfo
* @return
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
this.add(fPz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 初始化用户
*
* @param hppz009
*/
private void initUser(HPPZ009 hppz009) throws Exception {
String companyCode = hppz009.getCompanyCode();
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", companyCode);
inInfoRowMap.put("loginName", companyCode);
inInfoRowMap.put("userName", hppz009.getCompanyName());
// 使用公钥加密密码
String password = RsaUtils.encryptByPublicKey(LoginConstants.rsaPublicKey, companyCode);
inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", password);
inInfoRowMap.put("email", " ");
inInfoRowMap.put("mobile", " ");
inInfoRowMap.put("companyCode", hppz009.getCompanyCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS0102");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 用户关联角色
*
* @param hppz009
*/
private void insertGroupMember(HPPZ009 hppz009) {
String companyCode = hppz009.getCompanyCode();
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("memberId", companyCode);
inInfoRowMap.put("memberName", hppz009.getCompanyName());
// TODO 该用户组固定不能修改,代码中其他地方有写死的地方
inInfoRowMap.put("parentId", "companyManage");
inInfoRowMap.put("parentName", "企业管理员");
inInfoRowMap.put("memberType", "USER");
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XS03");
inInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update("HPPZ009.update", hppz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 fPz009 = new HPPZ009();
fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HPXSUserTools.countByCompany(fPz009.getCompanyCode());
if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户",
fPz009.getCompanyName()));
}
DaoUtils.update("HPPZ009.delete", fPz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
<?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="HPPZ009">
<sql id="columns">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
COMPANY_NAME as "companyName", <!-- 企业名称 -->
VALID_FLAG as "validFlag", <!-- 是否启用:1.启用,0.停用 -->
REMARK as "remark", <!-- 备注 -->
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="conditions">
AND DELETE_FLAG = '0'
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql id="queryConditions">
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="dynamic">
<dynamic prepend="ORDER BY">
<isNotEmpty property="dynamic">
$dynamic$
</isNotEmpty>
<isEmpty property="dynamic">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询品种大类配置 -->
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ009">
SELECT
<include refid="columns"/>
FROM ${hpjxSchema}.T_HPPZ009
WHERE 1=1
<include refid="conditions" />
<include refid="queryConditions"/>
<include refid="dynamic"/>
</select>
<!-- 查询记录数 -->
<select id="count" resultClass="int">
SELECT COUNT(1)
FROM ${hpjxSchema}.T_HPPZ009
WHERE 1=1
<include refid="conditions" />
<include refid="queryConditions"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ009 (
COMPANY_CODE, <!-- 企业编码 -->
COMPANY_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #companyName#, #validFlag#, #remark#, #createdBy#,
#createdName#, #createdTime#
)
</insert>
<!-- 修改 -->
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ009
SET
COMPANY_NAME = #companyName#,
VALID_FLAG = #validFlag#,
REMARK = #remark#,
<include refid="updateRevise"/>
WHERE COMPANY_CODE = #companyCode#
</update>
<!-- 删除 -->
<update id="delete">
UPDATE ${hpjxSchema}.T_HPPZ009
SET
DELETE_FLAG = 1,
<include refid="updateRevise"/>
WHERE COMPANY_CODE = #companyCode#
</update>
</sqlMap>
package com.baosight.hpjx.hp.pz.tools;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.util.AssertUtils;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/16,10:48
*/
public class HPPZTools {
/**
* 查询企业信息
*
* @param companyCode
* @return
*/
public static HPPZ009 getPz009(String companyCode) {
AssertUtils.isEmpty(companyCode, "企业编码不能为空");
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<HPPZ009> pz009s = DaoBase.getInstance().query("HPPZ009.query", queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
}
/**
* 企业是否启用
*
* @param companyCode
* @return
*/
public static boolean isValid(String companyCode) {
HPPZ009 pz009 = getPz009(companyCode);
if (pz009 == null) {
return false;
}
return CommonConstant.YesNo.YES_1.equals(pz009.getValidFlag());
}
}
package com.baosight.hpjx.hp.xs.domain;
import java.io.Serializable;
/**
* @author:songx
* @date:2024/1/15,14:50
*/
public class User implements Serializable {
/**
* 用户ID
*/
private String userId;
/**
* 用户中文名
*/
private String userName;
/**
* 登录ID
*/
private String loginName;
/**
* 手机号
*/
private String mobile;
/**
* 邮箱
*/
private String email;
/**
* 企业代码
*/
private String companyCode;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getCompanyCode() {
return companyCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
}
package com.baosight.hpjx.hp.xs.service;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.lang.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/15,15:08
*/
public class ServiceHPXSUser extends ServiceBase {
/**
* 获取用户信息
*
* @param eiInfo
* @return
*/
public EiInfo getUser(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("HPXSUser.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;
}
}
<?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="HPXSUser">
<sql id="conditions">
<isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="loginNames">
LOGIN_NAME IN <iterate close=")" open="(" conjunction="," property="loginNames">#loginNames[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userIds">
USER_ID IN <iterate close=")" open="(" conjunction="," property="userIds">#userIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hpjx.hp.xs.domain.User">
SELECT
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
COMPANY_CODE as "companyCode" <!-- 企业编码 -->
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="conditions"/>
</select>
<!-- 统计用户 -->
<select id="count" resultClass="int">
SELECT COUNT(1)
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="conditions"/>
</select>
<!-- id查询 -->
<select id="queryParentId" resultClass="java.util.LinkedHashMap">
SELECT
MEMBER_ID as "memberId", <!-- 成员id -->
PARENT_ID as "parentId" <!-- 父节点id -->
FROM ${platSchema}.XS_USER_GROUP_MEMBER
WHERE 1=1
AND MEMBER_ID = #memberId#
</select>
<!-- 用户组查询 -->
<select id="queryGroupEname" resultClass="java.util.LinkedHashMap">
SELECT
ID as "id", <!-- id -->
GROUP_ENAME as "groupEname", <!-- 用户组id -->
GROUP_CNAME as "groupCname" <!-- 用户组名字 -->
FROM ${platSchema}.XS_USER_GROUP
WHERE 1=1
AND ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</select>
</sqlMap>
package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/15,15:23
*/
public class HPXSUserTools {
/**
* 统计企业下的用户数量
*
* @param companyCode
* @return
*/
public static int countByCompany(String companyCode) {
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
List<Integer> results = DaoBase.getInstance().query("HPXSUser.count", paramMap);
return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
}
}
package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.Collection;
import java.util.Map;
/**
*
*
* @author:songx
* @date:2021/7/22,14:16
*/
public class AssertUtils {
/**
* object is null
*
* @param object
* @param message
*/
public static void isNull(Object object, String message) {
if (object == null) {
throw new PlatException(message);
}
}
/**
* object is not null
*
* @param object
* @param message
*/
public static void isNotNull(Object object, String message) {
if (object != null) {
throw new PlatException(message);
}
}
/**
* str is empty
*
* @param str
* @param message
*/
public static void isEmpty(String str, String message) {
if (StringUtils.isBlank(str)) {
throw new PlatException(message);
}
}
/**
* str is not empty
*
* @param str
* @param message
*/
public static void isNotEmpty(String str, String message) {
if (!StringUtils.isBlank(str)) {
throw new PlatException(message);
}
}
/**
* array is empty
*
* @param array
* @param message
*/
public static void isEmpty(Collection array, String message) {
if (CollectionUtils.isEmpty(array)) {
throw new PlatException(message);
}
}
/**
* array is not empty
*
* @param array
* @param message
*/
public static void isNotEmpty(Collection array, String message) {
if (!CollectionUtils.isEmpty(array)) {
throw new PlatException(message);
}
}
/**
* map is empty
*
* @param map
* @param message
*/
public static void isEmpty(Map<?, ?> map, String message) {
if (CollectionUtils.isEmpty(map)) {
throw new PlatException(message);
}
}
/**
* map is not empty
*
* @param map
* @param message
*/
public static void isNotEmpty(Map<?, ?> map, String message) {
if (!CollectionUtils.isEmpty(map)) {
throw new PlatException(message);
}
}
/**
* array is empty
*
* @param array
* @param message
*/
public static void isEmpty(Object[] array, String message) {
if (ObjectUtils.isEmpty(array)) {
throw new PlatException(message);
}
}
/**
* array is not empty
*
* @param array
* @param message
*/
public static void isNotEmpty(Object[] array, String message) {
if (!ObjectUtils.isEmpty(array)) {
throw new PlatException(message);
}
}
/**
* bool is true
*
* @param bool
* @param message
*/
public static void isTrue(boolean bool, String message) {
if (bool) {
throw new PlatException(message);
}
}
}
/**
*
*/
package com.baosight.hpjx.util;
import org.apache.commons.lang.StringUtils;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
/**
* jdk8中新增的日期处理类,更安全、更精确也更明确
*
* @author:songx
* @date:2017/7/20,9:33
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static final DateTimeFormatter DATETIME_ALL = DateTimeFormatter.ofPattern("yyyy-MM-dd\'T\'HH:mm:ss");
public static final DateTimeFormatter TIME = DateTimeFormatter.ofPattern("HHmmss");
public static final DateTimeFormatter SHORT_YMDHMSS = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
public static final DateTimeFormatter SHORT_DATETIME = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
public static final DateTimeFormatter DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static final DateTimeFormatter SHORT_DATE = DateTimeFormatter.ofPattern("yyyyMMdd");
public static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM");
/**
* 获取上个月的1号日期
*
* @param date 2023-09-06 or 20230906
* @return
*/
public static String getYesMonth(String date) {
LocalDate endLocalDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);
endLocalDate = endLocalDate.minusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
return endLocalDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
}
/**
* 获取当前的日期字符串(yyyy-MM)
*
* @return yyyy-MM
*/
public static String yearMonth() {
return LocalDate.now().format(YEAR_MONTH);
}
/**
* 获取当前日期字符串(yyyy-MM-dd)
*
* @return
*/
public static String date() {
return date(null);
}
/**
* 获取日期字符串(yyyy-MM-dd)
*
* @return
*/
public static String date(LocalDate date) {
return date == null ? LocalDate.now().format(DATE) : date.format(DATE);
}
/**
* 获取当前日期字符串(yyyyMMdd)
*
* @return
*/
public static String shortDate() {
return shortDate(null);
}
/**
* 获取日期字符串(yyyyMMdd)
*
* @return
*/
public static String shortDate(LocalDate date) {
return date == null ? LocalDate.now().format(SHORT_DATE) : date.format(DATE);
}
/**
* 获取当前的时间字符串(HHmmss)
*
* @return
*/
public static String time() {
return LocalDateTime.now().format(TIME);
}
/**
* 获取当前的日期字符串(yyyy-MM-dd HH:mm:ss)
*
* @return
*/
public static String dateTime() {
return LocalDateTime.now().format(DATETIME);
}
/**
* 获取当前的日期字符串(yyyyMMddHHmmss)
*
* @return
*/
public static String shortDateTime() {
return LocalDateTime.now().format(SHORT_DATETIME);
}
/**
* 获取当前的日期字符串(yyyyMMddHHmmssSSS)
*
* @return
*/
public static String shortYmdhmss() {
return LocalDateTime.now().format(SHORT_YMDHMSS);
}
/**
* 时间戳转换成字符串格式的时间
*
* @param time
* @return
*/
public static String toString(long time) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()).toString()
.replace("T", " ");
}
/**
* 时间戳转换成时间
*
* @param time
* @return
*/
public static LocalDateTime toDateTime(long time) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
}
/**
* 校验数据格式
*
* @param date
* @return
*/
public static boolean checkFormat(String date) {
try {
LocalDate.parse(date);
} catch (Exception e) {
return false;
}
return true;
}
/**
* 秒转换小时-分-秒analytics/util/DateUtil.java
*
* @param mses 毫秒秒为单位
* @return 比如...2小时3分钟52秒23毫秒
*/
public static String mseToTimeCurr(long mses) {
return mseToTime(System.currentTimeMillis() - mses);
}
/**
* 秒转换小时-分-秒analytics/util/DateUtil.java
*
* @param mses 毫秒秒为单位
* @return 比如...2小时3分钟52秒23毫秒
*/
public static String mseToTime(long mses) {
long hour = mses / 1000 / 3600;
long minute = (mses - hour * 3600 * 1000) / 60 / 1000;
long second = (mses - hour * 3600 * 1000 - minute * 60 * 1000) / 1000;
long mse = (mses - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000);
StringBuffer sb = new StringBuffer();
if (hour > 0) {
sb.append(hour + "小时");
}
if (minute > 0) {
sb.append(minute + "分");
}
if (second > 0) {
sb.append(second + "秒");
}
sb.append(mse + "毫秒");
return sb.toString();
}
/**
* 格式化数据格式
*
* @return
*/
public static String formatShort(String dateTime) {
if (StringUtils.isBlank(dateTime)) {
return dateTime;
}
return dateTime.replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");
}
}
package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.BaseObject;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.MapUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2021/7/2,13:34
*/
public class EiInfoUtils {
/**
* 获取block中第一个row,默认取query
*
* @param eiInfo
* @return
*/
public static Map getFirstRow(EiInfo eiInfo) {
return getFirstRow(eiInfo, EiConstant.queryBlock);
}
/**
* 获取block中第一个row
*
* @param eiInfo
* @param blockId
* @return
*/
public static Map getFirstRow(EiInfo eiInfo, String blockId) {
Map rowMap = eiInfo.getRow(blockId, 0);
if (rowMap == null) {
rowMap = new HashMap();
eiInfo.addRow(blockId, rowMap);
}
return rowMap;
}
/**
* 获取字符串,EiInfo集合中第一行
*
* @param baseObject
* @param key
* @return
*/
public static String getEmpty(BaseObject baseObject, String key) {
return ObjectUtils.toEmptyString(baseObject.getString(key));
}
/**
* 获取字符串,EiInfo集合中第一行
*
* @param inInfo
* @param key
* @return
*/
public static String getFirstEmpty(EiInfo inInfo, String key) {
return getFirstEmpty(inInfo, EiConstant.queryBlock, key);
}
/**
* 获取字符串,EiInfo集合中第一行
*
* @param eiInfo
* @param blockId
* @param key
* @return
*/
public static String getFirstEmpty(EiInfo eiInfo, String blockId, String key) {
Map queryRowMap = eiInfo.getRow(blockId, 0);
if (MapUtils.isEmpty(queryRowMap)) {
return " ";
}
return ObjectUtils.toEmptyString(queryRowMap.get(key));
}
/**
* inqu_status 填充值
*
* @param eiInfo
* @param key
* @param value
*/
public static void setFirstRow(EiInfo eiInfo, String key, String value) {
setFirstRow(eiInfo, EiConstant.queryBlock, key, value);
}
/**
* inqu_status 填充值
*
* @param eiInfo
* @param blockId
* @param key
* @param value
*/
public static void setFirstRow(EiInfo eiInfo, String blockId, String key, String value) {
Map rowMap = eiInfo.getRow(blockId, 0);
if (rowMap == null) {
rowMap = new HashMap();
eiInfo.addRow(blockId, rowMap);
}
rowMap.put(key, value);
}
}
package com.baosight.hpjx.util;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 日志工具类
*
* @author:songx
* @date:2021/10/14,15:35
*/
public class LogUtils {
private static final Logger logger = LoggerFactory.getLogger(LogUtils.class);
/**
* 设置并打印日志信息
*
* @param inInfo EiInfo
* @param e 异常堆栈
* @param title 标题
* @return
*/
public static void setDetailMsg(EiInfo inInfo, Exception e, String title) {
title = StringUtils.isEmpty(title) ? "服务异常" : title;
// 打印日志
print(e, title);
// 设置EiInfo错误消息
if (inInfo == null) {
return;
}
inInfo.setMsg(title.concat(",原因:"));
if (e == null) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setDetailMsg("未知");
return;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo.setMsg(inInfo.getMsg().concat(e.getMessage()));
inInfo.setDetailMsg(e.getMessage());
if (e instanceof PlatException) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
}
/**
* 设置并打印日志信息
*
* @param inInfo EiInfo
* @param e 异常堆栈
* @param title 标题
* @return
*/
public static void setMsg(EiInfo inInfo, Exception e, String title) {
title = StringUtils.isEmpty(title) ? "服务异常" : title;
// 打印日志
print(e, title);
// 设置EiInfo错误消息
if (inInfo == null) {
return;
}
String msg = title.concat(",原因:");
if (e == null) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg(msg.concat("未知"));
inInfo.setDetailMsg("未知");
return;
}
inInfo.setMsg(msg.concat(e.getMessage()));
inInfo.setDetailMsg(e.getMessage());
if (e instanceof PlatException) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
}
}
/**
* 打印日志
*
* @param e 异常堆栈
* @param title 标题
*/
private static void print(Exception e, String title) {
if (e != null) {
logger.error(title.concat(":{}"), e.getMessage(), e);
}
}
}
package com.baosight.hpjx.util;
import org.apache.commons.lang.StringUtils;
/**
* 重写Apache.ObjectUtils类方法
*
* @author:songx
* @date:2021/5/11,8:43
*/
public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
/**
* Gets the toString of an Object returning an null if null input.
* ObjectUtils.toString(null) = null
* ObjectUtils.toString("") = ""
* ObjectUtils.toString("bat") = "bat"
* ObjectUtils.toString(Boolean.TRUE) = "true"
*
* @param obj
* @return
*/
public static String toString(Object obj) {
return obj == null ? null : obj.toString();
}
/**
* Gets the toString of an Object returning an null if null input.
* ObjectUtils.toString(null) = null
* ObjectUtils.toString("") = ""
* ObjectUtils.toString("bat") = "bat"
* ObjectUtils.toString(Boolean.TRUE) = "true"
*
* @param obj
* @return
*/
public static String toStringTrim(Object obj) {
return obj == null ? null : obj.toString().trim();
}
/**
* Gets the toString of an Object returning an null if null input.
* ObjectUtils.toString(null) = " "
* ObjectUtils.toString("") = " "
* ObjectUtils.toString("bat") = "bat"
* ObjectUtils.toString(Boolean.TRUE) = "true"
*
* @param obj
* @return
*/
public static String toEmptyString(Object obj) {
if (obj == null || "".equals(obj)) {
return " ";
} else {
return obj.toString();
}
//return obj == null ? " " : obj.toString();
}
/**
* 检查object是empty或null
*
* @param object
* @return
*/
public static boolean isEmpty(Object object) {
if (object == null) {
return true;
}
return StringUtils.isEmpty(object.toString());
}
/**
* 检查object是empty或null
*
* @param object
* @return
*/
public static boolean isNullBlank(Object object) {
if (object == null) {
return true;
}
return StringUtils.isBlank(object.toString());
}
}
package com.baosight.hpjx.util;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* RSA非对称加密工具类
*
* @author:songx
* @date:2020/7/22,18:05
*/
public class RsaUtils {
/**
* 公钥解密
*
* @param publicKeyText 公钥
* @param text 待解密的信息
* @return /
* @throws Exception /
*/
public static String decryptByPublicKey(String publicKeyText, String text) throws Exception {
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
* 私钥加密
*
* @param privateKeyText 私钥
* @param text 待加密的信息
* @return /
* @throws Exception /
*/
public static String encryptByPrivateKey(String privateKeyText, String text) throws Exception {
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(
Base64.decodeBase64(privateKeyText));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
* 私钥解密
*
* @param privateKeyText 私钥
* @param text 待解密的文本
* @return 解密后字符串
* @throws Exception
*/
public static String decryptByPrivateKey(String privateKeyText, String text) throws Exception {
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(
Base64.decodeBase64(privateKeyText));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
return new String(result);
}
/**
* 公钥加密
*
* @param publicKeyText 公钥
* @param text 待加密的文本
* @return 加密后字符串
*/
public static String encryptByPublicKey(String publicKeyText, String text) throws Exception {
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyText));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] result = cipher.doFinal(text.getBytes());
return Base64.encodeBase64String(result);
}
/**
* 构建RSA密钥对
*
* @return
* @throws NoSuchAlgorithmException
*/
public static RSAKeyPair generateKeyPair() throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
return new RSAKeyPair(publicKeyString, privateKeyString);
}
public static void main(String[] args) {
String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAXl+j5RvU7hu5I2j8fwt7I/a5U/80/6TEkWE6I2fIYa9tfqRLOz7qaEYfdc67idNyfxOyDzQTvcbpDbQwHfMePWjWiE0hwQhrIzKzyuAGAxwwy1hJBiVUAU6YQw0SGaAJf3Of4nE7M2CwyTjyLWlxmOdVxJDxnI64V6kyn68IewIDAQAB";
String password = "123456";
try {
System.out.println(generateKeyPair().getPublicKey());
System.out.println(generateKeyPair().getPrivateKey());
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* RSA密钥对对象
*
* @author:songx
* @date:2018/9/3,13:15
*/
public static class RSAKeyPair {
/**
* 公钥
*/
private final String publicKey;
/**
* 私钥
*/
private final String privateKey;
public RSAKeyPair(String publicKey, String privateKey) {
this.publicKey = publicKey;
this.privateKey = privateKey;
}
public String getPublicKey() {
return publicKey;
}
public String getPrivateKey() {
return privateKey;
}
}
}
package com.baosight.xservices.xs.og.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.ef.ui.tree.TreeService;
import com.baosight.xservices.xs.service.ServiceXSTreeNode;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
*
* @author:songx
* @date:2024/1/18,11:21
*/
public class ServiceXSOG0800 extends TreeService {
private EiBlockMeta eiMetadata = null;
public ServiceXSOG0800() {
}
public List getTopNodes() {
HashMap<String, String> map = new HashMap();
List<HashMap> list = new ArrayList();
map.put("label", "root");
map.put("text", "组织机构");
map.put("leaf", "0");
map.put("parent", "0");
list.add(map);
return list;
}
public List getChildNodes(String parentLabel) {
if (StringUtils.isEmpty(parentLabel) || "$".equals(parentLabel)) {
parentLabel = "root";
}
Map queryMap = new HashMap();
queryMap.put("node", parentLabel);
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
}
List<Map> ret = this.dao.query("XSOG01.queryOrganiation", queryMap, 0, -999999);
Map parentOrgMap = new HashMap();
String orgId;
for(int i = 0; i < ret.size(); ++i) {
Map org = (Map)ret.get(i);
orgId = (String)org.get("parentOrgId");
if (parentOrgMap.get(orgId) == null) {
parentOrgMap.put(orgId, new ArrayList());
}
((List)parentOrgMap.get(orgId)).add(org);
}
List result = (List)parentOrgMap.get(parentLabel);
for(int i = 0; i < result.size(); ++i) {
orgId = (String)((Map)result.get(i)).get("label");
String hasChild = parentOrgMap.get(orgId) != null ? "2" : "1";
((Map)result.get(i)).put("leaf", hasChild);
}
return result;
}
public EiInfo search(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
outInfo = super.query(inInfo, "XSOG0100.search");
} catch (PlatException var5) {
var5.printStackTrace();
EiBlock block = new EiBlock(EiConstant.resultBlock);
outInfo.setBlock(block);
}
return outInfo;
}
public EiInfo expandPath(EiInfo inInfo) {
EiInfo outInfo = super.query(inInfo, "XSOG0100.expandPath");
return outInfo;
}
public EiBlockMeta initMetaData() {
if (this.eiMetadata == null) {
this.eiMetadata = new EiBlockMeta();
EiColumn eiColumn = new EiColumn("label");
eiColumn.setDescName("label");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("parent");
eiColumn.setDescName("parent");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("text");
eiColumn.setDescName("text");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("leaf");
eiColumn.setDescName("leaf");
eiColumn.setType(EiConstant.COLUMN_TYPE_NUMBER);
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
}
return this.eiMetadata;
}
public EiInfo searchNodePath(EiInfo inInfo) {
String leafName = (String)inInfo.get("leafName");
Map map = new HashMap();
List queryNodeList = this.dao.query("XSOG01.queryOrganiation", map);
List nodeList = new ArrayList();
Iterator var6 = queryNodeList.iterator();
while(var6.hasNext()) {
Object node = var6.next();
String parentId = (String)((HashMap)node).get("parentOrgId");
if (!"".equals(parentId.trim())) {
((HashMap)node).put("parentId", parentId);
nodeList.add(node);
}
}
ServiceXSTreeNode root = ServiceXSTreeNode.buildTree(nodeList);
List allPath = ServiceXSTreeNode.findAllPath(root, nodeList, leafName);
inInfo.set("allPath", allPath);
return inInfo;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author:songx
* @date:2024/1/17,10:57
*/
public class ServiceXS02 extends ServiceEPBase {
private static Logger logger = LogManager.getLogger(ServiceXS02.class);
public ServiceXS02() {
}
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo, new XS02());
outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outInfo;
}
public EiInfo insert(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.remove("groupId");
inInfoRowMap.put("recCreator", UserSession.getUser().getUsername());
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_18");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo query(EiInfo inInfo) {
// 非超级管理只能看到所属企业的信息 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
}
EiInfo outInfo = super.query(inInfo, "XS02.query", new XS02());
return outInfo;
}
public EiInfo update(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_20");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo delete(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_19");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public int getAllRecordCount(StringBuffer buffer, Map param) {
try {
List aa = this.dao.query("XS02.count", param);
int count = (Integer)aa.get(0);
return count;
} catch (Exception var5) {
buffer.append(var5.getMessage()).append("\n");
return -1;
}
}
/** @deprecated */
@Deprecated
public EiInfo insertAll(EiInfo inInfo) {
StringBuffer buffer = new StringBuffer();
StringBuffer detail = new StringBuffer();
List list = inInfo.getBlock("result").getRows();
try {
this.dao.insert("XS02.insertAll", list);
} catch (Exception var6) {
buffer.append("新增记录失败\n" + var6.getMessage());
inInfo.setStatus(-1);
inInfo.setMsg(buffer.toString());
detail.append(var6.getCause().toString());
logger.error(var6.getCause().getMessage());
return inInfo;
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
return inInfo;
}
public EiInfo queryManageGroup(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("resultA")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("resultA").getAttr());
inInfo.setBlock(inBlock);
}
EiInfo outInfo = super.query(inInfo, "XS02.queryManageGroup", new XS02());
EiBlock eiBlock = new EiBlock("resultA");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("resultA")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
outInfo.setMsg("");
return outInfo;
}
public EiInfo queryManageGroup33(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("resultD")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("resultD").getAttr());
inInfo.setBlock(inBlock);
}
EiInfo outInfo = super.query(inInfo, "XS02.queryManageGroup", new XS02());
EiBlock eiBlock = new EiBlock("resultD");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("resultD")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
outInfo.setMsg("");
return outInfo;
}
public EiInfo checkUserGroup(EiInfo inInfo) {
int status = -1;
String msg = "";
String groupEname = inInfo.get("groupEname").toString();
Map map = new HashMap();
map.put("groupEname", groupEname);
List groupList = null;
try {
groupList = this.dao.query("XSUserManage.queryUserGroup", map);
} catch (Exception var8) {
inInfo.setStatus(status);
inInfo.setMsg(var8.getMessage());
return inInfo;
}
if (groupList != null && groupList.size() > 0) {
msg = "这个用户组英文名已存在,请重新填写";
} else {
msg = "可以使用这个用户组英文名";
status = 1;
}
inInfo.setStatus(status);
inInfo.setMsg(msg);
return inInfo;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.xservices.xs.domain.XS07;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author:songx
* @date:2024/1/17,16:18
*/
public class ServiceXS0702 extends ServiceEPBase {
private static Logger logger = LogManager.getLogger(ServiceXS0702.class);
public ServiceXS0702() {
}
public EiInfo initLoad(EiInfo inInfo) {
String objectName = (String)inInfo.get("inqu_status-0-objectName");
EiInfo outInfo = null;
if (null != objectName && !"".equals(objectName)) {
outInfo = this.query(inInfo);
} else {
outInfo = super.initLoad(inInfo, new XS07());
}
outInfo.setMsg("");
return outInfo;
}
public EiInfo query(EiInfo inInfo) {
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
}
EiInfo outInfo = super.query(inInfo, "XS07.query", new XS07());
return outInfo;
}
public EiInfo delete(EiInfo inInfo) {
inInfo.set(EiConstant.serviceName, "XS07");
inInfo.set(EiConstant.methodName, "delete");
EiInfo outInfo = XLocalManager.call(inInfo);
return outInfo;
}
public EiInfo update(EiInfo inInfo) {
inInfo.set(EiConstant.serviceName, "XS07");
inInfo.set(EiConstant.methodName, "update");
EiInfo outInfo = XLocalManager.call(inInfo);
return outInfo;
}
public EiInfo queryForGridSubject(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("resultA")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("resultA").getAttr());
inInfo.setBlock(inBlock);
}
EiInfo outInfo = super.query(inInfo, "XS02.query", new XS07());
EiBlock eiBlock = new EiBlock("resultA");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("resultA")) {
eiBlock.setAttr(inInfo.getBlock("resultA").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
outInfo.setMsg("");
return outInfo;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.FrameworkInfo;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.ef.ui.tree.MenuTreeService;
import com.baosight.xservices.xs.authentication.AuthenticationInfo;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author:songx
* @date:2024/1/17,14:28
*/
public class ServiceXS0705 extends MenuTreeService {
private EiBlockMeta eiMetadata = null;
public ServiceXS0705() {
}
public List getTopNodes() {
String project = FrameworkInfo.getProjectEname();
List projectNodes = this.getChildNodes(project);
List rootNodes = this.getChildNodes("");
List all = new ArrayList();
all.addAll(projectNodes);
all.addAll(rootNodes);
return all;
}
public List getChildNodes(String parentLabel) {
String manageSwitch = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.manage.switch"), "off");
Map params = new HashMap();
if (StringUtils.isEmpty(parentLabel) || "$".equals(parentLabel)) {
parentLabel = "root";
}
params.put("node", parentLabel);
// 非管理员仅查询指定菜单权限 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
// root:根节点
if ("root".equals(parentLabel)) {
params.put("notNodeEnames", new String[]{"EP"});
}
// EP:系统平台
if ("EP".equals(parentLabel)) {
params.put("nodeEnames", new String[]{"OG", "XS"});
}
// OG:组织机构
if ("OG".equals(parentLabel)) {
params.put("nodeEnames", new String[]{"XS40", "XSOG0801"});
}
// XS:安全管理
if ("XS".equals(parentLabel)) {
params.put("nodeEnames", new String[]{"XS30", "XS32"});
}
}
String stmt = "XS0702.query";
List ret = this.dao.query(stmt, params);
if ("off".equals(manageSwitch)) {
return ret;
} else {
List ret2 = new ArrayList();
for(int i = 0; i < ret.size(); ++i) {
Map node = (Map)ret.get(i);
String text = node.get("text").toString();
if (text.indexOf("[页面]") > 0) {
ret2.add(0, ret.get(i));
} else {
ret2.add(ret.get(i));
}
}
String loginName = UserSession.getUser().getUsername();
List authorized = new ArrayList();
if (!LoginUserDetails.isUserAdmin(loginName)) {
if (AuthenticationInfo.userManageAuthentication.get(loginName) == null) {
AuthenticationInfo.getUserManageAuthentication(loginName);
}
List authManageList = (List)AuthenticationInfo.userManageAuthentication.get(loginName);
for(int i = 0; i < ret2.size(); ++i) {
Map node = (Map)ret.get(i);
BigDecimal nodeLeaf = new BigDecimal("1");
BigDecimal leaf = (BigDecimal)node.get("leaf");
if (nodeLeaf.equals(leaf)) {
String label = (String)node.get("label");
if (this.isManageResource(label, authManageList)) {
authorized.add(node);
}
} else {
authorized.add(node);
}
}
} else {
authorized = ret2;
}
return authorized;
}
}
private boolean isManageResource(String label, List authManageList) {
if (authManageList.size() < 1) {
return false;
} else {
boolean flag = false;
for(int i = 0; i < authManageList.size(); ++i) {
Map authManageMap = (Map)authManageList.get(i);
if (authManageMap.get("objectName") != null && label.equals(authManageMap.get("objectName").toString()) || authManageMap.get("resourceName") != null && label.equals(authManageMap.get("resourceName").toString())) {
flag = true;
}
}
return flag;
}
}
public EiBlockMeta initMetaData() {
if (this.eiMetadata == null) {
this.eiMetadata = new EiBlockMeta();
EiColumn eiColumn = new EiColumn("label");
eiColumn.setDescName("label");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("text");
eiColumn.setDescName("text");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("leaf");
eiColumn.setDescName("leaf");
eiColumn.setType(EiConstant.COLUMN_TYPE_NUMBER);
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
}
return this.eiMetadata;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.domain.XS01;
import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import java.util.Map;
public class ServiceXS3002 extends ServiceEPBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXS3002.class);
private String USER_TYPE = "USER";
public ServiceXS3002() {
}
public EiInfo insert(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
String companyCode = UserSessionUtils.getCompanyCode();
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.remove("groupId");
inInfoRowMap.put("recCreator", UserSession.getUser().getUsername());
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
// 设置所属企业 added by songx at 2024-01-16
inInfoRowMap.put("companyCode", companyCode);
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_18");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo query(EiInfo inInfo) {
// 非管理员仅查询所属企业用户组 added by songx at 2024-01-15
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
}
EiInfo outInfo = super.query(inInfo, "XS02.query", new XS02());
return outInfo;
}
public EiInfo update(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_20");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo delete(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_19");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo queryUserOutOfUserGroup(EiInfo inInfo) {
if (null != inInfo.getBlock("resultC")) {
inInfo.setBlock(new EiBlock("result"));
inInfo.getBlock("result").setAttr(inInfo.getBlock("resultC").getAttr());
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
}
EiInfo outInfo = super.query(inInfo, "XS3002.queryUserOutOfUserGroup", new XS01());
EiBlock eiBlock = new EiBlock("resultC");
eiBlock.setRows(outInfo.getBlock("result").getRows());
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
outInfo.setBlock(eiBlock);
return outInfo;
}
public EiInfo queryUserByGroup(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("resultB")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("resultB").getAttr());
inInfo.setBlock(inBlock);
}
String parentId = (String)inInfo.get("inqu_statusB-0-parentId");
if (!"".equals(parentId)) {
inInfo.set("inqu_status-0-parentId", parentId);
inInfo.set("inqu_status-0-memberType", this.USER_TYPE);
EiInfo outInfo = super.query(inInfo, "XS3002.queryUserByGroup", new XS01());
EiBlock eiBlock = new EiBlock("resultB");
eiBlock.setRows(outInfo.getBlock("result").getRows());
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
outInfo.setBlock(eiBlock);
if (outInfo.getStatus() != -1) {
outInfo.setMsg("");
}
return outInfo;
} else {
return inInfo;
}
}
}
package com.baosight.xservices.xs.service;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.domain.XS04;
import com.baosight.xservices.xs.domain.XS05;
import com.baosight.xservices.xs.util.UserSession;
import java.util.List;
import java.util.Map;
/**
*
* @author:songx
* @date:2024/1/16,15:49
*/
public class ServiceXS3101 extends ServiceEPBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXS3101.class);
public ServiceXS3101() {
}
public EiInfo insert(EiInfo inInfo) {
EiInfo call = new EiInfo();
List rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach((m) -> {
Map row = (Map)m;
row.put("resourceId", "");
row.put("recCreator", UserSession.getUser().getUsername());
});
call.set("list", rows);
call.set(EiConstant.serviceId, "S_XS_23");
EiInfo result = XServiceManager.call(call);
return result;
}
public EiInfo query(EiInfo inInfo) {
EiInfo outInfo = super.query(inInfo, "XS04.queryResource", new XS04());
return outInfo;
}
public EiInfo delete(EiInfo inInfo) {
EiInfo call = new EiInfo();
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
call.set(EiConstant.serviceId, "S_XS_24");
EiInfo result = XServiceManager.call(call);
return result;
}
public EiInfo update(EiInfo inInfo) {
EiInfo call = new EiInfo();
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
call.set(EiConstant.serviceId, "S_XS_25");
EiInfo result = XServiceManager.call(call);
return result;
}
public EiInfo queryResourceGroupsByResource(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("result1")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("result1").getAttr());
inInfo.setBlock(inBlock);
}
if (null != inInfo.getBlock("inqu_status1")) {
if ("".equals(inInfo.getBlock("inqu_status1").getRow(0).get("resourceId"))) {
return inInfo;
}
inInfo.getBlock("inqu_status").setRows(inInfo.getBlock("inqu_status1").getRows());
}
EiInfo outInfo = super.query(inInfo, "XS3101.queryResourceGroupsByResource", new XS05());
EiBlock r1Block = new EiBlock("result1");
r1Block.setAttr(outInfo.getBlock(EiConstant.resultBlock).getAttr());
r1Block.setRows(outInfo.getBlock(EiConstant.resultBlock).getRows());
outInfo.setBlock(r1Block);
if (outInfo.getStatus() != -1) {
outInfo.setMsg("");
}
return outInfo;
}
public EiInfo queryResourceGroupOutOfResource(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("resultRG")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("resultRG").getAttr());
inInfo.setBlock(inBlock);
}
if ("".equals(inInfo.getBlock("inqu_status").getRow(0).get("resourceId")) && !"".equals(inInfo.getBlock("inqu_status1").getRow(0).get("resourceId"))) {
inInfo.getBlock("inqu_status").getRow(0).put("resourceId", inInfo.getBlock("inqu_status1").getRow(0).get("resourceId"));
}
EiInfo outInfo = super.query(inInfo, "XS3101.queryResourceGroupOutOfResource", new XS05());
EiBlock eiBlock = new EiBlock("resultRG");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("resultRG")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
return outInfo;
}
public EiInfo deleteResourceGroup(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_44");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
public EiInfo addResourceGroup(EiInfo inInfo) {
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.remove("resourceGroupId");
inInfoRowMap.put("recCreator", UserSession.getUser().getUsername());
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_43");
EiInfo outInfo = XServiceManager.call(eiInfo);
return outInfo;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.xservices.xs.domain.XS01;
import com.baosight.xservices.xs.domain.XS04;
import com.baosight.xservices.xs.domain.XS05;
import com.baosight.xservices.xs.domain.XS07;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author:songx
* @date:2024/1/18,15:11
*/
public class ServiceXS3201 extends ServiceEPBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXS3201.class);
public ServiceXS3201() {
}
public EiInfo queryResourceAndGroupByUserGroup(EiInfo inInfo) {
if ("".equals(inInfo.getBlock("inqu_status").getRow(0).get("subjectId"))) {
return inInfo;
} else {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("result3")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("result3").getAttr());
inInfo.setBlock(inBlock);
}
EiInfo outInfo = super.query(inInfo, "XS07.query", new XS07());
EiBlock eiBlock = new EiBlock("result3");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("result3")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
if (outInfo.getStatus() != -1) {
outInfo.setMsg("");
}
return outInfo;
}
}
public EiInfo deleteResourceAndGroupByUserGroup(EiInfo inInfo) {
if (null == inInfo.getBlock(EiConstant.resultBlock) && null != inInfo.getBlock("result3")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("result3").getAttr());
inBlock.setRows(inInfo.getBlock("result3").getRows());
inInfo.setBlock(inBlock);
}
EiInfo eiInfo = new EiInfo();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
}
eiInfo.addBlock(inInfo.getBlock(EiConstant.resultBlock));
eiInfo.set(EiConstant.serviceId, "S_XS_46");
EiInfo outInfo = XServiceManager.call(eiInfo);
EiBlock inBlock = new EiBlock("result3");
inBlock.setAttr(inInfo.getBlock(EiConstant.resultBlock).getAttr());
inBlock.setRows(inInfo.getBlock(EiConstant.resultBlock).getRows());
outInfo.setBlock(inBlock);
return outInfo;
}
public EiInfo updateResourceAndGroupByUserGroup(EiInfo inInfo) {
StringBuffer buffer = new StringBuffer();
StringBuffer detail = new StringBuffer();
List updatedAuthList = new ArrayList();
EiBlock eiBlock;
if (null == inInfo.getBlock(EiConstant.resultBlock) && null != inInfo.getBlock("result3")) {
eiBlock = new EiBlock("result");
eiBlock.setAttr(inInfo.getBlock("result3").getAttr());
eiBlock.setRows(inInfo.getBlock("result3").getRows());
inInfo.setBlock(eiBlock);
}
eiBlock = inInfo.getBlock("result");
int rowCount = eiBlock.getRowCount();
for(int i = 0; i < rowCount; ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.put("recRevisor", UserSession.getUser().getUsername());
inInfoRowMap.put("recReviseTime", DateUtils.curDateTimeStr14());
try {
this.dao.update("XS07.update", inInfoRowMap);
buffer.append("更新授权主体:" + inInfo.getBlock("result").getCell(i, "subjectName") + " 授权客体:" + inInfo.getBlock("result").getCell(i, "objectName") + " 的记录成功\n");
String subjectId = inInfoRowMap.get("subjectId").toString();
String objectId = inInfoRowMap.get("objectId").toString();
Map map = new HashMap();
map.put("subjectId", subjectId);
map.put("objectId", objectId);
List updateAuthList = this.dao.query("XS07.query", map);
Map updateAuthMap = (Map)updateAuthList.get(0);
updatedAuthList.add(updateAuthMap);
} catch (Exception var14) {
buffer.append("更新授权主体:" + inInfo.getBlock("result").getCell(i, "subjectName") + " 授权客体:" + inInfo.getBlock("result").getCell(i, "objectName") + " 的记录失败\n");
inInfo.setStatus(-1);
detail.append(var14.getMessage());
logger.error(var14.getMessage());
}
}
if (inInfo.getStatus() != -1) {
inInfo.setStatus(1);
}
inInfo.setMsg(buffer.toString());
inInfo.setDetailMsg(detail.toString());
if (updatedAuthList.size() > 0) {
eiBlock.setRows(updatedAuthList);
}
inInfo.getBlock("result3").setAttr(inInfo.getBlock(EiConstant.resultBlock).getAttr());
inInfo.getBlock("result3").setRows(inInfo.getBlock(EiConstant.resultBlock).getRows());
return inInfo;
}
public EiInfo queryResourceGroupOutOfAuth(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("result4")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("result4").getAttr());
inInfo.setBlock(inBlock);
}
EiInfo outInfo = super.query(inInfo, "XS3201.queryResourceGroupOutOfAuth", new XS05());
EiBlock eiBlock = new EiBlock("result4");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("result4")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
if (outInfo.getStatus() == 0) {
outInfo.setMsg("");
}
return outInfo;
}
public EiInfo queryResourceOutOfAuth(EiInfo inInfo) {
if (null == inInfo.getBlock("result") && null != inInfo.getBlock("result5")) {
EiBlock inBlock = new EiBlock("result");
inBlock.setAttr(inInfo.getBlock("result5").getAttr());
inInfo.setBlock(inBlock);
}
// 非管理员不显示XS、OG等开头的系统平台资源 added by songx at 2024-01-16
inInfo.set("inqu_status-0-isUserAdmin", LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
? "1" : "0");
EiInfo outInfo = super.query(inInfo, "XS3201.queryResourceOutOfAuth", new XS04());
EiBlock eiBlock = new EiBlock("result5");
eiBlock.setRows(outInfo.getBlock("result").getRows());
if (null != inInfo.getBlock("result5")) {
eiBlock.setAttr(inInfo.getBlock("result").getAttr());
} else {
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
}
outInfo.setBlock(eiBlock);
if (outInfo.getStatus() == 0) {
outInfo.setMsg("");
}
return outInfo;
}
public EiInfo queryUserOutOfUserGroup(EiInfo inInfo) {
if (null != inInfo.getBlock("result6")) {
inInfo.setBlock(new EiBlock("result"));
inInfo.getBlock("result").setAttr(inInfo.getBlock("result6").getAttr());
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
}
EiInfo outInfo = super.query(inInfo, "XS3002.queryUserOutOfUserGroup", new XS01());
EiBlock eiBlock = new EiBlock("result6");
eiBlock.setRows(outInfo.getBlock("result").getRows());
eiBlock.setAttr(outInfo.getBlock("result").getAttr());
outInfo.setBlock(eiBlock);
return outInfo;
}
}
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.ef.ui.tree.MenuTreeService;
import com.baosight.xservices.xs.util.LoginUserDetails;
import com.baosight.xservices.xs.util.UserSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author:songx
* @date:2024/1/18,13:49
*/
public class ServiceXS4000 extends MenuTreeService {
private static Logger logger = LogManager.getLogger(ServiceXS0302.class);
private EiBlockMeta eiMetadata = null;
public ServiceXS4000() {
}
public List getTopNodes() {
return this.getChildNodes("root");
}
public List getChildNodes(String parentId) {
String manageSwitch = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.manage.switch"), "off");
List ret = null;
String loginName = UserSession.getUser().getUsername();
HashMap params = new HashMap();
params.put("parentId", parentId);
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
params.put("companyCode", UserSessionUtils.getCompanyCode());
}
if ("off".equals(manageSwitch)) {
ret = this.dao.query("XS03.queryNodes", params);
} else if (LoginUserDetails.isUserAdmin(loginName)) {
ret = this.dao.query("XS03.queryNodes", params);
} else {
Map map = new HashMap();
map.put("loginName", loginName);
if ("root".equals(parentId)) {
ret = this.dao.query("XS03.queryManagerGroupNodesWithRoot", map);
} else {
map.put("parentId", parentId);
ret = this.dao.query("XS03.queryManagerGroupNodes", map);
}
}
return ret;
}
public EiInfo search(EiInfo inInfo) {
EiInfo outInfo = super.query(inInfo, "XS03.queryGroupInfo");
return outInfo;
}
public EiInfo expandPath(EiInfo inInfo) {
EiInfo outInfo = super.query(inInfo, "XS03.expandPath");
return outInfo;
}
public EiInfo dragend(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
String parentId = inInfo.getString("parentId");
String memberId = inInfo.getString("memberId");
String newParentId = inInfo.getString("newParentId");
if (StringUtils.isNotEmpty(parentId) && StringUtils.isNotEmpty(memberId) && StringUtils.isNotEmpty(newParentId)) {
try {
Map patameter = new HashMap();
patameter.put("parentId", parentId);
patameter.put("memberId", memberId);
patameter.put("newParentId", newParentId);
this.dao.update("XS03.dragendUpdate", patameter);
outInfo.setMsg("拖拽成功!");
outInfo.setStatus(1);
} catch (Exception var7) {
outInfo.setMsg("拖拽失败!-" + var7.getMessage());
outInfo.setStatus(-1);
}
} else {
outInfo.setMsg("拖拽失败!");
outInfo.setStatus(-1);
}
return outInfo;
}
public EiBlockMeta initMetaData() {
if (this.eiMetadata == null) {
this.eiMetadata = new EiBlockMeta();
EiColumn eiColumn = new EiColumn("label");
eiColumn.setDescName("label");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("text");
eiColumn.setDescName("text");
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("leaf");
eiColumn.setDescName("leaf");
eiColumn.setType(EiConstant.COLUMN_TYPE_NUMBER);
eiColumn.setNullable(false);
eiColumn.setPrimaryKey(false);
this.eiMetadata.addMeta(eiColumn);
}
return this.eiMetadata;
}
}
<?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="XS3002">
<select id="queryUserByGroup" resultClass="java.util.HashMap">
SELECT
t1.user_id as "userId",
t1.login_name as "loginName",
t1.password as "password",
t1.status as "status",
t1.user_name as "userName",
t1.GENDER as "gender",
t1.mobile as "mobile",
t1.email as "email",
t1.user_type as "userType",
t1.account_expire_date as "accountExpireDate",
t1.pwd_expire_date as "pwdExpireDate",
t1.is_locked as "isLocked",
t1.rec_creator as "recCreator",
t1.rec_create_time as "recCreateTime",
t1.rec_revisor as "recRevisor",
t1.rec_revise_time as "recReviseTime",
t1.pwd_revise_date as "pwdReviseDate",
t1.pwd_revisor as "pwdRevisor",
t1.archive_flag as "archiveFlag",
t1.USER_GROUP_ENAME as "userGroupEname"
FROM ${platSchema}.XS_USER t1
where t1.USER_ID in
(
SELECT
MEMBER_ID
FROM ${platSchema}.XS_USER_GROUP_MEMBER t2
where 1 = 1
<isNotEmpty prepend=" AND " property="memberType">
t2.MEMBER_TYPE = #memberType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
t2.PARENT_ID = #parentId#
</isNotEmpty>
)
<isNotEmpty prepend=" AND " property="loginName">
t1.login_name like ('%$loginName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
t1.user_name like ('%$userName$%')
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
<isNotEmpty prepend="AND" property="sql">
$sql$
</isNotEmpty>
</select>
<select id="queryUserOutOfUserGroup" resultClass="java.util.HashMap">
SELECT
t1.user_id as "userId",
t1.login_name as "loginName",
t1.password as "password",
t1.status as "status",
t1.user_name as "userName",
t1.GENDER as "gender",
t1.mobile as "mobile",
t1.email as "email",
t1.user_type as "userType",
t1.account_expire_date as "accountExpireDate",
t1.pwd_expire_date as "pwdExpireDate",
t1.is_locked as "isLocked",
t1.rec_creator as "recCreator",
t1.rec_create_time as "recCreateTime",
t1.rec_revisor as "recRevisor",
t1.rec_revise_time as "recReviseTime",
t1.pwd_revise_date as "pwdReviseDate",
t1.pwd_revisor as "pwdRevisor",
t1.archive_flag as "archiveFlag",
t1.USER_GROUP_ENAME as "userGroupEname"
FROM ${platSchema}.XS_USER t1
where t1.USER_ID not in
(
SELECT
MEMBER_ID
FROM ${platSchema}.XS_USER_GROUP_MEMBER t2
where 1 = 1
<isNotEmpty prepend=" AND " property="memberType">
t2.MEMBER_TYPE = #memberType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
t2.PARENT_ID = #parentId#
</isNotEmpty>
)
<isNotEmpty prepend=" AND " property="loginName">
t1.login_name like ('%$loginName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
t1.user_name like ('%$userName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
t1.COMPANY_CODE = #companyCode#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
<isNotEmpty prepend="AND" property="sql">
$sql$
</isNotEmpty>
</select>
</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="XS3201">
<select id="queryResourceGroupOutOfAuth" resultClass="java.util.HashMap">
SELECT
id as "resourceGroupId",
resource_group_ename as "resourceGroupEname",
resource_group_cname as "resourceGroupCname",
resource_group_type as "resourceGroupType",
sort_index as "sortIndex",
rec_creator as "recCreator",
rec_create_time as "recCreateTime",
rec_revisor as "recRevisor",
rec_revise_time as "recReviseTime",
archive_flag as "archiveFlag"
FROM ${platSchema}.XS_RESOURCE_GROUP where 1=1
and resource_group_ename != 'ROOT'
<isNotEmpty prepend=" AND " property="resourceGroupId">
id = #resourceGroupId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceGroupEname">
resource_group_ename like ('%$resourceGroupEname$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceGroupCname">
resource_group_cname like ('%$resourceGroupCname$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceGroupType">
resource_group_type = #resourceGroupType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subjectId">
id not in (
select object_id
from ${platSchema}.XS_AUTHORIZATION
where subject_id = #subjectId#
and object_type = 'RESOURCE_GROUP'
)
</isNotEmpty>
ORDER BY SORT_INDEX,ID
</select>
<select id="queryResourceOutOfAuth" resultClass="java.util.HashMap">
SELECT
DISTINCT t1.resource_ename AS "resourceEname",
CASE type
WHEN 'PAGE' THEN t2.form_cname
WHEN 'BUTTON' THEN temp03.buttoncname
WHEN 'SERVICE' THEN e.SERVICE_DESC
ELSE f.event_desc
END AS "resourceCname",
t1.id as "resourceId",
t1.type as "type",
t1.is_auth as "isAuth",
t1.sort_index as "sortIndex",
t1.rec_creator as "recCreator",
t1.rec_create_time as "recCreateTime",
t1.rec_revisor as "recRevisor",
t1.rec_revise_time as "recReviseTime",
t1.archive_flag as "archiveFlag"
from ${platSchema}.XS_RESOURCE t1
LEFT OUTER JOIN ${platSchema}.TEDFA00 t2 ON t2.form_ename=t1.resource_ename
LEFT OUTER JOIN (SELECT
concat(concat(c.form_ename, '.'), d.button_ename) AS buttonename,
concat(concat(c.form_cname, '-'), d.button_cname) AS buttoncname
FROM ${platSchema}.TEDFA00 c, ${platSchema}.TEDFA01 d WHERE c.FORM_ENAME = d.form_ename) temp03
ON t1.resource_ename =temp03.buttonename
LEFT OUTER JOIN ${platSchema}.ED_XM_SERVICE e ON t1.resource_ename = e.service_id
LEFT OUTER JOIN ${platSchema}.ED_XM_EVENT f ON t1.resource_ename = f.event_id
where 1=1
<isNotEmpty prepend=" AND " property="subjectId">
id not in (
select object_id
from ${platSchema}.XS_AUTHORIZATION
where subject_id = #subjectId#
and object_type = 'RESOURCE'
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceCname">
(t2.form_cname like ('%$resourceCname$%') or temp03.buttoncname like ('%$resourceCname$%')
or e.SERVICE_DESC like ('%$resourceCname$%') or f.event_desc like ('%$resourceCname$%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceId">
t1.id = #resourceId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="resourceEname">
t1.resource_ename like ('%$resourceEname$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="type">
t1.type = #type#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isAuth">
t1.is_auth = #isAuth#
</isNotEmpty>
<isEqual property="isUserAdmin" compareValue="0">
and t1.resource_ename not like 'XS%'
</isEqual>
ORDER BY t1.SORT_INDEX,t1.ID
</select>
</sqlMap>
<%--html body结束前--%>
<script src="${iPlatStaticURL}/kendoui/js/kendo.virtuallist.min.js"></script>
<script src="${iPlatStaticURL}/kendoui/js/kendo.ooxml.min.js"></script>
<script>
var oldonunload = window.onunload;
window.onunload = function () {
oldonunload && typeof oldonunload === "function" && oldonunload.call(this);
if (window.opener) {
var childWindows = window.opener.childWindows;
var length = childWindows.length;
var index = -1;
while (++index < length) {
if (childWindows[index].name === "") {
Array.prototype.splice.call(childWindows, index--, 1);
length--;
}
}
}
}
</script>
<script src="${ctx}/common/js/common.js"></script>
<script src="${ctx}/common/js/jsUtils.js"></script>
...@@ -24,11 +24,12 @@ eplatSchema=EPLAT ...@@ -24,11 +24,12 @@ eplatSchema=EPLAT
lowcodedbSchema=lowcodedb lowcodedbSchema=lowcodedb
lowCodeSchema=LOWCODEDB lowCodeSchema=LOWCODEDB
projectSchema=LOWCODEDB projectSchema=LOWCODEDB
hpjxSchema=hpjx
#customerName=\u4E2D\u56FD\u5B9D\u6B66\u94A2\u94C1\u96C6\u56E2\u6709\u9650\u516C\u53F8 #customerName=\u4E2D\u56FD\u5B9D\u6B66\u94A2\u94C1\u96C6\u56E2\u6709\u9650\u516C\u53F8
#enterpriseName=\u5b9d\u4fe1\u8f6f\u4ef6\u5e73\u53f0\u7814\u7a76\u4e8c\u6240 #enterpriseName=\u5B9D\u4FE1\u8F6F\u4EF6\u5E73\u53F0\u7814\u7A76\u4E8C\u6240
customerName=\u6b66\u6c49\u5b9d\u4fe1\u5927\u6570\u636e\u4e8b\u4e1a\u90e8 customerName=\u6B66\u6C49\u5B9D\u4FE1\u5927\u6570\u636E\u4E8B\u4E1A\u90E8
enterpriseName=\u6b66\u6c49\u5b9d\u4fe1\u5927\u6570\u636e\u4e8b\u4e1a\u90e8 enterpriseName=\u6B66\u6C49\u5B9D\u4FE1\u5927\u6570\u636E\u4E8B\u4E1A\u90E8
datasource.type=dbcp datasource.type=dbcp
jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8 jdbc.url=jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</Properties> </Properties>
<Appenders> <!--<Console name="Console" target="SYSTEM_OUT" follow="true">--> <!--<PatternLayout pattern="${LOG_PATTERN}"/>--> <!--</Console>--> <!-- 用来定义输出到控制台的配置 --> <Appenders> <!--<Console name="Console" target="SYSTEM_OUT" follow="true">--> <!--<PatternLayout pattern="${LOG_PATTERN}"/>--> <!--</Console>--> <!-- 用来定义输出到控制台的配置 -->
<Console name="Console" target="SYSTEM_OUT"> <!-- 设置控制台只输出error及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)--> <Console name="Console" target="SYSTEM_OUT"> <!-- 设置控制台只输出error及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
<ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY" /> <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="${LOG_PATTERN}" /> <PatternLayout pattern="${LOG_PATTERN}" />
</Console> </Console>
<RollingRandomAccessFile name="MyFile" fileName="apps/logs/iplat.log" filePattern="apps/logs/iplat.%d{yyyy-MM-dd}-%i.log.gz"> <RollingRandomAccessFile name="MyFile" fileName="apps/logs/iplat.log" filePattern="apps/logs/iplat.%d{yyyy-MM-dd}-%i.log.gz">
......
#������ʱ��������λ���� #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u02B1\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03BB\uFFFD\uFFFD\uFFFD\uFFFD
xservices.job.startupDelay=60 xservices.job.startupDelay=60
org.quartz.scheduler.instanceName = iPlat4j_Scheduler org.quartz.scheduler.instanceName = iPlat4j_Scheduler
...@@ -7,23 +7,23 @@ org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool ...@@ -7,23 +7,23 @@ org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 20 org.quartz.threadPool.threadCount = 20
org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadPriority = 5
org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.misfireThreshold = 60000
#�ڴ淽ʽ #\uFFFD\u06B4\u6DFD\u02BD
#org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore #org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
#���ݿⷽʽ�־û���ʱ���� #\uFFFD\uFFFD\uFFFD\u077F\u2DFD\u02BD\uFFFD\u05BE\u00FB\uFFFD\uFFFD\uFFFD\u02B1\uFFFD\uFFFD\uFFFD\uFFFD
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties = false org.quartz.jobStore.useProperties = false
org.quartz.jobStore.dataSource = appDS org.quartz.jobStore.dataSource = appDS
org.quartz.jobStore.tablePrefix = EJ_QRTZ_ org.quartz.jobStore.tablePrefix = EJ_QRTZ_
#��Ⱥģʽ������Ϊtrue #\uFFFD\uFFFD\u023A\u0123\u02BD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue
org.quartz.jobStore.isClustered = true org.quartz.jobStore.isClustered = true
##JNDI���÷�ʽ ##JNDI\uFFFD\uFFFD\uFFFD\u00F7\uFFFD\u02BD
#org.quartz.dataSource.appDS.jndiURL=appDS #org.quartz.dataSource.appDS.jndiURL=appDS
#�˴��������ݿ�־û��������ݿ���ص���Ϣ #\uFFFD\u02F4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u077F\uFFFD\u05BE\u00FB\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u077F\uFFFD\uFFFD\uFFFD\u0635\uFFFD\uFFFD\uFFFD\u03E2
org.quartz.jobStore.clusterCheckinInterval = 20000 org.quartz.jobStore.clusterCheckinInterval = 20000
org.quartz.dataSource.appDS.driver = com.mysql.jdbc.Driver org.quartz.dataSource.appDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.appDS.URL = jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8 org.quartz.dataSource.appDS.URL = jdbc:mysql://10.24.1.94:3306/iplat?useSSL=false&useUnicode=true&characterEncoding=utf-8
...@@ -31,8 +31,8 @@ org.quartz.dataSource.appDS.user = root ...@@ -31,8 +31,8 @@ org.quartz.dataSource.appDS.user = root
org.quartz.dataSource.appDS.password =fnvu~aKs9LTDYUxe org.quartz.dataSource.appDS.password =fnvu~aKs9LTDYUxe
org.quartz.dataSource.appDS.maxConnections = 30 org.quartz.dataSource.appDS.maxConnections = 30
#�����ֱ����־��¼��� #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05B1\uFFFD\uFFFD\uFFFD\uFFFD\u05BE\uFFFD\uFFFD\u00BC\uFFFD\uFFFD\uFFFD
org.quartz.plugin.logging.class = com.baosight.xservices.ej.job.quartz.JobLoggingPluginWithPartition org.quartz.plugin.logging.class = com.baosight.xservices.ej.job.quartz.JobLoggingPluginWithPartition
org.quartz.plugin.logging.tablePrefix = EJ_QRTZ_P_ org.quartz.plugin.logging.tablePrefix = EJ_QRTZ_
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
}
// 查询
$("#QUERY").on("click", query);
// 保存
$("#BTN_SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ009", "save", true);
}
});
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ009", "delete", 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 id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="企业编码:" ename="companyCode" blockId="inqu_status" row="0"/>
<EF:EFInput cname="企业名称:" ename="companyName" blockId="inqu_status" row="0"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn cname="企业编码" ename="companyCode" enable="false" width="120" align="center"/>
<EF:EFColumn cname="企业名称" ename="companyName" width="140" editType="textarea" required="true"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
<EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人名称" ename="createdName" enable="false" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
<EF:EFColumn cname="修改人名称" ename="updatedName" enable="false" align="center"/>
<EF:EFColumn cname="修改时间" ename="updatedTime" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<%--<script src="${iPlatStaticURL}/common/js/common.js"></script>--%>
<%--<script src="${iPlatStaticURL}/common/js/jsUtils.js"></script>--%>
$(function () {
$(window).load(function () {
resultGrid.setEiInfo(__eiInfo);
});
$(document.body).on("click", "#QUERY", function (e) {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid = {
"result": {
onDelete: function (e) {
if (resultGrid.getCheckedRows().length == 0) {
IPLAT.alert("请勾选数据!");
e.preventDefault();
}
}
}
}
});
\ No newline at end of file
<!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>
<EF:EFRegion id="inqu" title="查询条件" type="query" efRegionShowClear="true" efRegionSave="true">
<div class="row">
<div class="col-xs-3">
<div class="form-group">
<label class="col-md-4 control-label">
资源英文名
</label>
<div class="col-md-8">
<input name="inqu_status-0-resourceEname" data-query="gt" class="k-textbox input-time query-need" placeholder="请输入资源英文名" />
</div>
</div>
</div>
<div class="col-xs-3">
<div class="form-group">
<label class="col-md-4 control-label">
资源中文名
</label>
<div class="col-md-8">
<input name="inqu_status-0-resourceCname" data-query="gt" class="k-textbox input-time query-need" placeholder="请输入资源英文名" />
</div>
</div>
</div>
<EF:EFSelect cname="资源类型" blockId="inqu_status" colWidth="3" ename="type" row="0" defaultValue="全部">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="services.xs.resourcesTypes" textField="label" valueField="value"/>
</EF:EFSelect>
<div class="col-md-3" style="text-align: right" id="inqu_inside"></div>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="resourceId" cname="资源ID" hidden="true" readonly="false" primaryKey="true"/>
<EF:EFColumn ename="resourceEname" cname="资源英文名" style="text-align:left;" readonly="true" required="true" locked="true" />
<EF:EFColumn ename="resourceCname" cname="资源中文名" style="text-align:left;" />
<EF:EFComboColumn ename="type" cname="资源类型" defaultValue="PAGE" style="text-align:center;">
<EF:EFCodeOption codeName="services.xs.resourcesTypes" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="isAuth" hidden="true" cname="是否授权" defaultValue="0" style="text-align:center;">
<EF:EFCodeOption codeName="services.xs.isAuth" textField="label" valueField="value"/>
</EF:EFComboColumn>
<EF:EFColumn ename="sortIndex" cname="排序" style="text-align:right;"/>
<EF:EFColumn ename="recCreator" cname="创建人" enable="false" style="text-align:left;"/>
<EF:EFColumn ename="recCreateTime" cname="创建时间" enable="false" editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" dateFormat="yyyy-MM-dd HH:mm:ss" displayType="datetime" style="text-align:right;"/>
<EF:EFColumn ename="recRevisor" cname="修改人" enable="false" style="text-align:left;"/>
<EF:EFColumn ename="recReviseTime" cname="修改时间" enable="false" editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']" dateFormat="yyyy-MM-dd HH:mm:ss" displayType="datetime" style="text-align:right;"/>
<EF:EFColumn ename="archiveFlag" cname="归档标记" style="text-align:right;"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
const fileUploader = function (options) {
const GET_IMP_INFO = "getImpInfo";
var element = $("#" + options.id);
// 执行导入前先在后台检测导入信息是否合法
var saveUrl = IPLATUI.CONTEXT_PATH + "/XS/UP/XSUPImport.jsp?ename="
+ options.ename + "&serviceName=" + options.serviceName
+ "&methodName=" + GET_IMP_INFO;
$.extend(options, {
async: {
saveUrl: saveUrl
},
success: function (data) {
// 前置检查成功时,执行导入
let eiInfo = new EiInfo()
eiInfo.set("impUser", true);
eiInfo.set("impUserGroup", true);
eiInfo.set("impUserGroupMember", true);
eiInfo.set("impModel", options.impModel)
EiCommunicator.send(options.serviceName, options.methodName, eiInfo, {
onSuccess: function (response) {
IPLAT.alert(response.msg);
}, onFail: function (errorMsg, status, e) { /* errorMsg 是平台格式化后的异常消息, status, e的含义和$.ajax的含义相同,请参考jQuery文档 */
console.log(errorMsg);
}
});
},
error: function (data) {
IPLAT.alert(data?.response?.msg);
}
});
return element.kendoUpload(options).data("kendoUpload");
};
fileUploader({
id: "fileAll_0",
ename: "fileAll_0",
serviceName: "XS30",
methodName: "impUserAndGroupXlxs",
impModel: "0"
});
fileUploader({
id: "fileAll_1",
ename: "fileAll_1",
serviceName: "XS30",
methodName: "impUserAndGroupXlxs",
impModel: "1"
});
fileUploader({
id: "fileAll_2",
ename: "fileAll_2",
serviceName: "XS30",
methodName: "impUserAndGroupXlxs",
impModel: "2"
});
});
window.onload = () => {
waitForLoad(0);
function waitForLoad(count) {
const orgHeight = $(window).height();
if (count < 10 && orgHeight < 300) {
setTimeout(() => {
waitForLoad(++count);
}, 200)
} else {
$("#info1").height(orgHeight - 90)
$("#info2").height(orgHeight - 90)
$("#XS30").css("padding", "0px")
// 初始加载
let src = $("#info1")[0].src.split('?');
if (!src[0].endsWith("01")) {
let back = src.length > 1 ? '?' + src[1] : '';
$("#info1")[0].src = src[0] + '01' + back;
$("#my-button-1").css("border-bottom", `2px solid #237CF0`);
$("#my-button-2").css("border-bottom", `2px solid transparent`);
// 防止初始加载时切换按钮被高频反复点击,导致iframe加载不全
$(".my-head").css("pointer-events", "none");
setTimeout(() => {
$(".my-head").css("pointer-events", "");
}, 1500)
}
const themeStr = document.body.className
if (~themeStr.indexOf("deepblue")) {
$(".my-head").css("background", "#16286b")
$("#my-text1").css("color", "#57cfff")
$("#my-text2").css("color", "#ffffff")
$("#my-button-1").css("border-bottom", `2px solid #57cfff`);
deepblue = true
}
if (~themeStr.indexOf("large")) {
$(".my-head").css("height", "2.75rem")
$(".my-text").css("font-size", "1rem")
$(".my-text").css("height", "2.75rem")
}
$("#my-container").css("display", "block")
}
}
}
let deepblue = false;
const switchWindow = (option) => {
if (option) {
// 初始加载
let src = $("#info2")[0].src.split('?');
if (!src[0].endsWith("02")) {
let back = src.length > 1 ? '?' + src[1] : '';
$("#info2")[0].src = src[0] + '02' + back;
// 防止初始加载时切换按钮被高频反复点击,导致iframe加载不全
$(".my-head").css("pointer-events", "none");
setTimeout(() => {
$(".my-head").css("pointer-events", "");
}, 1500)
}
$("#info2").css("display", "block")
$("#info1").css("display", "none")
$("#my-text1").css("color", `${!deepblue && "rgba(0,0,0,0.85)" || "#ffffff"}`)
$("#my-text2").css("color", `${(!deepblue && "#2f80ed") || "#57cfff"}`)
$("#my-button-1").css("border-bottom", `2px solid transparent`);
$("#my-button-2").css("border-bottom", `2px solid ${!deepblue && "#237CF0" || "#57cfff"}`);
return
}
$("#info1").css("display", "block")
$("#info2").css("display", "none")
$("#my-text2").css("color", `${!deepblue && "rgba(0,0,0,0.85)" || "#ffffff"}`)
$("#my-text1").css("color", `${(!deepblue && "#2f80ed") || "#57cfff"}`)
$("#my-button-2").css("border-bottom", `2px solid transparent`);
$("#my-button-1").css("border-bottom", `2px solid ${!deepblue && "#237CF0" || "#57cfff"}`);
}
/**
* 导出
*/
const exportFunc = () => {
const info = new EiInfo();
EiCommunicator.send("XS30", "exUserAndGroupXlxs", info, {
onSuccess: function (response) {
if (response.status == 0) {
NotificationUtil("导出成功");
let fileName = response.get("fileName");
let url = "../lessees/user/export/" + fileName;
window.open(url);
}
}, onFail: function (errorMsg, status, e) { /* errorMsg 是平台格式化后的异常消息, status, e的含义和$.ajax的含义相同,请参考jQuery文档 */
console.log(errorMsg);
}
});
}
/**
* 导入
*/
const importFunc = () => {
$("#importWindow").data("kendoWindow").open();
}
<!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}"/>
<script src="${ctx}/iplatui/js/jsencrypt.js"></script>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage>
<div id="my-container" style="display: none">
<div class="my-head">
<div id="my-front">
<button id="my-button-1" class="my-button" onclick="switchWindow(0)">
<span class="my-text" id="my-text1">用户管理</span>
</button>
<button id="my-button-2" class="my-button" onclick="switchWindow(1)">
<span class="my-text" id="my-text2">用户组管理</span>
</button>
</div>
<%--<div id="my-behind">
<button class="i-btn-lg" id="import" type="button" onclick="importFunc()">
<span>导入</span>
</button>
<button class="i-btn-lg" id="export" type="button" onclick="exportFunc()">
<span>导出</span>
</button>
</div>--%>
</div>
<div>
<iframe src="" width="100%" frameborder="none" id="info1" style="display: block"></iframe>
</div>
<div>
<iframe src="" width="100%" frameborder="none" id="info2" style="display: none"></iframe>
</div>
</div>
</EF:EFPage>
<EF:EFWindow id="importWindow" width="58%" height="75%" top="100px" left="280px" title="用户、用户组信息导入">
<EF:EFRegion id="uploadAll_0" title="增量导入(不覆盖重复项)">
<EF:EFInput ename="fileAll_0" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
<EF:EFRegion id="uploadAll_1" title="增量导入(覆盖重复项)">
<EF:EFInput ename="fileAll_1" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
<EF:EFRegion id="uploadAll_2" title="全量导入">
<EF:EFInput ename="fileAll_2" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
</EF:EFWindow>
<style>
.my-head {
display: flex;
padding-right: 12px;
background: #ffffff;
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.12);
margin-bottom: 3px;
}
#my-front {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-start;
}
#my-behind {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-end;
padding-right: 4px;
}
.my-button {
border: none;
background: transparent;
margin-bottom: 2px;
margin-left: 16px;
}
.my-text {
font-size: .875rem;
height: 1.75rem;
line-height: 1;
letter-spacing: 0;
font-weight: 500;
overflow: hidden;
box-sizing: border-box;
display: inline-flex;
align-items: center;
}
#my-text1 {
color: #3088F4;
}
#my-text2 {
color: rgba(0, 0, 0, 0.85);
}
</style>
$(function () {
const fileUploader = function (options) {
const GET_IMP_INFO = "getImpInfo";
var element = $("#" + options.id);
// 执行导入前先在后台检测导入信息是否合法
var saveUrl = IPLATUI.CONTEXT_PATH + "/XS/UP/XSUPImport.jsp?ename="
+ options.ename + "&serviceName=" + options.serviceName
+ "&methodName=" + GET_IMP_INFO;
$.extend(options, {
async: {
saveUrl: saveUrl
},
success: function (data) {
// 前置检查成功时,执行导入
let eiInfo = new EiInfo()
eiInfo.set("impModel", options.impModel)
EiCommunicator.send(options.serviceName, options.methodName, eiInfo, {
onSuccess: function (response) {
IPLAT.alert(response.msg);
}, onFail: function (errorMsg, status, e) { /* errorMsg 是平台格式化后的异常消息, status, e的含义和$.ajax的含义相同,请参考jQuery文档 */
console.log(errorMsg);
}
});
},
error: function (data) {
IPLAT.alert(data?.response?.msg);
}
});
return element.kendoUpload(options).data("kendoUpload");
};
fileUploader({
id: "fileAll_0",
ename: "fileAll_0",
serviceName: "XS32",
methodName: "impAuthorizationXlxs",
impModel: "0"
});
fileUploader({
id: "fileAll_1",
ename: "fileAll_1",
serviceName: "XS32",
methodName: "impAuthorizationXlxs",
impModel: "1"
});
fileUploader({
id: "fileAll_2",
ename: "fileAll_2",
serviceName: "XS32",
methodName: "impAuthorizationXlxs",
impModel: "2"
});
});
window.onload = () => {
waitForLoad(0);
function waitForLoad(count) {
const orgHeight = $(window).height();
if (count < 10 && orgHeight < 300) {
setTimeout(() => {
waitForLoad(++count);
}, 200)
} else {
$("#info1").height(orgHeight - 90)
$("#info2").height(orgHeight - 90)
$("#info3").height(orgHeight - 90)
$("#XS32").css("padding", "0px")
// 初始加载
let src = $("#info1")[0].src.split('?');
if (!src[0].endsWith("01")) {
let back = src.length > 1 ? '?' + src[1] : '';
$("#info1")[0].src = src[0] + '01' + back;
$("#my-button-1").css("border-bottom", `2px solid #237CF0`);
$("#my-button-2").css("border-bottom", `2px solid transparent`);
$("#my-button-3").css("border-bottom", `2px solid transparent`);
// 防止初始加载时切换按钮被高频反复点击,导致iframe加载不全
$(".my-head").css("pointer-events", "none");
setTimeout(() => {
$(".my-head").css("pointer-events", "");
}, 1500)
}
const themeStr = document.body.className
if (~themeStr.indexOf("deepblue")) {
$(".my-head").css("background", "#16286b")
$("#my-text1").css("color", "#57cfff")
$("#my-text2").css("color", "#ffffff")
$("#my-text3").css("color", "#ffffff")
$("#my-button-1").css("border-bottom", `2px solid #57cfff`);
deepblue = true
}
if (~themeStr.indexOf("large")) {
$(".my-head").css("height", "2.75rem")
$(".my-text").css("font-size", "1rem")
$(".my-text").css("height", "2.75rem")
}
$("#my-container").css("display", "block")
}
}
}
let deepblue = false;
const switchWindow = (option) => {
if (option) {
$("#info1").css("display", "none")
$("#info2").css("display", "none")
$("#info3").css("display", "none")
$("#my-text1").css("color", `${!deepblue && "rgba(0,0,0,0.85)" || "#ffffff"}`)
$("#my-text2").css("color", `${!deepblue && "rgba(0,0,0,0.85)" || "#ffffff"}`)
$("#my-text3").css("color", `${!deepblue && "rgba(0,0,0,0.85)" || "#ffffff"}`)
$("#my-button-1").css("border-bottom", `2px solid transparent`);
$("#my-button-2").css("border-bottom", `2px solid transparent`);
$("#my-button-3").css("border-bottom", `2px solid transparent`);
let src;
switch (option) {
case 1:
break;
case 2:
// 初始加载
src = $("#info2")[0].src.split('?');
if (!src[0].endsWith("02")) {
let back = src.length > 1 ? '?' + src[1] : '';
$("#info2")[0].src = src[0] + '02' + back;
// 防止初始加载时切换按钮被高频反复点击,导致iframe加载不全
$(".my-head").css("pointer-events", "none");
setTimeout(() => {
$(".my-head").css("pointer-events", "");
}, 1500)
}
break;
case 3:
// 初始加载
src = $("#info3")[0].src.split('?');
if (!src[0].endsWith("XS0702")) {
let back = src.length > 1 ? '?' + src[1] : '';
$("#info3")[0].src = src[0].split('XS32')[0] + 'XS0702' + back;
// 防止初始加载时切换按钮被高频反复点击,导致iframe加载不全
$(".my-head").css("pointer-events", "none");
setTimeout(() => {
$(".my-head").css("pointer-events", "");
}, 1500)
}
break;
}
$(`#info${option}`).css("display", "block")
$(`#my-text${option}`).css("color", `${(!deepblue && "#2f80ed") || "#57cfff"}`)
$(`#my-button-${option}`).css("border-bottom", `2px solid ${!deepblue && "#237CF0" || "#57cfff"}`);
}
}
/**
* 导出
*/
const exportFunc = () => {
const info = new EiInfo();
EiCommunicator.send("XS32", "exAuthorizationXlxs", info, {
onSuccess: function (response) {
if (response.status == 0) {
NotificationUtil("导出成功");
let fileName = response.get("fileName");
let url = "../lessees/user/export/" + fileName;
window.open(url);
}
}, onFail: function (errorMsg, status, e) { /* errorMsg 是平台格式化后的异常消息, status, e的含义和$.ajax的含义相同,请参考jQuery文档 */
console.log(errorMsg);
}
});
}
/**
* 导入
*/
const importFunc = () => {
$("#importWindow").data("kendoWindow").open();
}
<!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}"/>
<script src="${ctx}/iplatui/js/jsencrypt.js"></script>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage>
<div id="my-container" style="display: none">
<div class="my-head">
<div id="my-front">
<button id="my-button-1" class="my-button" onclick="switchWindow(1)">
<span class="my-text" id="my-text1">用户组授权</span>
</button>
<%--<button id="my-button-2" class="my-button" onclick="switchWindow(2)">
<span class="my-text" id="my-text2">资源授权</span>
</button>--%>
<button id="my-button-3" class="my-button" onclick="switchWindow(3)">
<span class="my-text" id="my-text3">菜单授权</span>
</button>
</div>
<%--<div id="my-behind">
<button class="i-btn-lg" id="import" type="button" onclick="importFunc()">
<span>导入</span>
</button>
<button class="i-btn-lg" id="export" type="button" onclick="exportFunc()">
<span>导出</span>
</button>
</div>--%>
</div>
<div>
<iframe src="" width="100%" frameborder="none" id="info1" style="display: block"></iframe>
</div>
<div>
<iframe src="" width="100%" frameborder="none" id="info2" style="display: none"></iframe>
</div>
<div>
<iframe src="" width="100%" frameborder="none" id="info3" style="display: none"></iframe>
</div>
</div>
</EF:EFPage>
<EF:EFWindow id="importWindow" width="58%" height="75%" top="100px" left="280px" title="授权信息导入">
<EF:EFRegion id="uploadAll_0" title="增量导入(不覆盖重复项)">
<EF:EFInput ename="fileAll_0" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
<EF:EFRegion id="uploadAll_1" title="增量导入(覆盖重复项)">
<EF:EFInput ename="fileAll_1" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
<EF:EFRegion id="uploadAll_2" title="全量导入">
<EF:EFInput ename="fileAll_2" type="file" accept=".xlsx" colWidth="12"/>
</EF:EFRegion>
</EF:EFWindow>
<style>
.my-head {
display: flex;
padding-right: 12px;
background: #ffffff;
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.12);
margin-bottom: 3px;
}
#my-front {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-start;
}
#my-behind {
width: 50%;
display: flex;
align-items: center;
text-align: center;
justify-content: flex-end;
padding-right: 4px;
}
.my-button {
border: none;
background: transparent;
margin-bottom: 2px;
margin-left: 16px;
}
.my-text {
font-size: .875rem;
height: 1.75rem;
line-height: 1;
letter-spacing: 0;
font-weight: 500;
overflow: hidden;
box-sizing: border-box;
display: inline-flex;
align-items: center;
}
#my-text1 {
color: #3088F4;
}
#my-text2 {
color: rgba(0, 0, 0, 0.85);
}
</style>
/**
* 判断是否为null
*
* @param value
* @returns {boolean}
*/
function isBlank(data) {
return data == null || data === undefined || data === 'null' || $.trim(data) === '' ||
data === 'undefined' || data === 'unknown';
}
/**
* 是否数字
*
* @param val
* @returns {boolean}
*/
function isNumber(val) {
return !isNaN(parseFloat(val)) && isFinite(val);
}
/**
* 是否整数
*
* @param obj
* @returns {boolean}
*/
function isInteger(obj) {
return (obj | 0) == obj;
}
/**
* 消息提示
*
* @param msg
*/
function message(msg) {
WindowUtil({
title: "提示:",
content: "<div class='kendo-del-message'>" + msg + "</div>"
});
};
/**
* 获取窗口宽度
*
* @returns {number}
*/
function getWindowWidth() {
var winWidth = 1024;
if (window.innerWidth) {
winWidth = window.innerWidth;
} else if ((document.body) && (document.body.clientWidth)) {
winWidth = document.body.clientWidth;
}
if (document.documentElement && document.documentElement.clientWidth) {
winWidth = document.documentElement.clientWidth;
}
return winWidth;
}
/**
* 获取窗口高度
*
* @returns {number}
*/
function getWindowHeight() {
var winHeight = 600;
if (window.innerHeight) {
winHeight = window.innerHeight;
} else if ((document.body) && (document.body.clientHeight)) {
winHeight = document.body.clientHeight;
}
// 通过深入 Document 内部对 body 进行检测,获取窗口大小
if (document.documentElement && document.documentElement.clientHeight) {
winHeight = document.documentElement.clientHeight;
}
return winHeight;
}
/**
* cookie 操作
*
* @param c_name
* @param value
* @param expiredays
*/
function setCookie(c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
/**
*
* @param c_name
* @returns {string}
*/
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return ""
}
/**
*
* @param date
* @param fmt
* @returns {*}
*/
function dateFormate(date, fmt) {
var o = {
"M+": date.getMonth() + 1, //月份
"d+": date.getDate(), //日
"h+": date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, //小时
"H+": date.getHours(), //小时
"m+": date.getMinutes(), //分
"s+": date.getSeconds(), //秒
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
var week = {
"0": "\u65e5",
"1": "\u4e00",
"2": "\u4e8c",
"3": "\u4e09",
"4": "\u56db",
"5": "\u4e94",
"6": "\u516d"
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
}
if (/(E+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1,
((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "\u661f\u671f" : "\u5468") : "")
+ week[date.getDay() + ""]
);
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.$1,
(RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))
);
}
}
return fmt;
}
/**
*
* @param AddDayCount
* @param fmt
* @returns {*}
*/
function getDateStr(AddDayCount, fmt) {
var dt = new Date();
dt.setDate(dt.getDate() + AddDayCount);//获取AddDayCount天后的日期
return dateFormate(dt, fmt);
}
/**
*
* @param AddDayCount
* @param fmt
* @returns {*}
*/
function getDateStrAndClearTime(AddDayCount, fmt) {
var dt = new Date();
dt.setDate(dt.getDate() + AddDayCount);//获取AddDayCount天后的日期
clearTime(dt);
return dateFormate(dt, fmt);
}
/**
* 清除时间
*/
function clearTime(date) {
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
return date;
}
/**
* 绘制表格
*
* @param blockId
* @param jsonObj
* @param gridIdSuffix
* @param descNameInited
*/
function drawGrid(blockId, jsonObj, gridIdSuffix, descNameInited) {
var blk = jsonObj.getBlock(blockId);
var colsECName = jsonObj.get('colsECNameMap');
var colsWidth = jsonObj.get('colsWidth') || {};
var metas = blk.getBlockMeta().getMetas();
var __grid_ef_grid_result = new efgrid(blockId, "ef_grid_" + gridIdSuffix);
var matas_arr = [];
var index = {};
for (var attr in metas) {
var meta = metas[attr];
if (colsECName != null && !descNameInited) {
meta.descName = colsECName[meta.name];
if (!meta.descName) {
meta.descName = meta.name == 'rn' ? '行号' : meta.descName;
}
}
var pos = parseInt(meta.pos);
index[attr] = pos;
var newMeta = {};
matas_arr[pos] = newMeta;
newMeta.name = meta.name;
newMeta.descName = $.trim(meta.descName) || meta.name;
newMeta.primaryKey = meta.primaryKey;
newMeta.width = colsWidth[meta.name] || meta.width;
newMeta.sumType = "none";
newMeta.attr = {enable: true};
newMeta.pos = pos;
newMeta.align = meta.align || '';
if (meta.name == 'rn') {
newMeta.align = 'center';
}
}
var custom_cols = {"index": index, "metas": matas_arr, "groupIndex": {}, "columnGroups": []};
__grid_ef_grid_result.setToolBarPosition("");
__grid_ef_grid_result.setEnable(false);
__grid_ef_grid_result.setReadonly(true);
__grid_ef_grid_result.setAjax(true);
__grid_ef_grid_result.setCanPageAll(false);
__grid_ef_grid_result.setAutoDraw('yes');
__grid_ef_grid_result.setServiceName("");
__grid_ef_grid_result.setQueryMethod("query");
__grid_ef_grid_result.setCustomColumns(custom_cols);
__grid_ef_grid_result.setXlsExportMode("");
__grid_ef_grid_result.setButtonBarId("");
__grid_ef_grid_result.setButtonBarPosition("");
__grid_ef_grid_result.setData(jsonObj);
__grid_ef_grid_result.setStyle({"toolBar": "true"});
$(document).ready(function () {
__grid_ef_grid_result.paint();
});
};
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