Commit 3a408c03 by 宋祥

1.企业管理

parent 750bcb2f
......@@ -68,11 +68,11 @@ public class OperationLogAspect {
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
if (opLog != null) {
try {
String companyCode;
String accountCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
accountCode = UserSessionUtils.getAccountCode();
} catch (Exception e) {
companyCode = "";
accountCode = "";
}
String userId = UserSession.getLoginName();
String loginName = UserSession.getLoginCName();
......@@ -80,7 +80,7 @@ public class OperationLogAspect {
String operType = opLog.operType();
String operDesc = opLog.operDesc();
boolean saveContet = opLog.saveContent();
String sql = "INSERT INTO ${metaSchema}.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
String sql = "INSERT INTO HGGP.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection()
......@@ -96,7 +96,7 @@ public class OperationLogAspect {
} else {
ps.setString(4, "");
}
ps.setString(5, companyCode);
ps.setString(5, accountCode);
ps.setString(6, userId);
ps.setString(7, loginName);
ps.setString(8, DateUtils.shortDateTime());
......
......@@ -105,10 +105,10 @@ public class DaoUtils {
log.warn("写入创建人姓名失败", e);
}
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
BeanUtils.setProperty(bean, "companyCode", companyCode);
BeanUtils.setProperty(bean, "accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......@@ -159,10 +159,10 @@ public class DaoUtils {
map.put("createdName", userName);
map.put("updatedName", "");
// 创建人企业编码
String companyCode = UserSessionUtils.getCompanyCode();
AssertUtils.isEmpty(companyCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
String accountCode = UserSessionUtils.getAccountCode();
AssertUtils.isEmpty(accountCode, "当前用户未绑定公司,无法操作数据,请联系管理员!");
try {
map.put("companyCode", companyCode);
map.put("accountCode", accountCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
......
......@@ -8,6 +8,7 @@ public enum OrgTypeEnum {
FACTORY("factory", "厂区"),
DEPT("dept", "部门"),
COMPANY("dept", "公司"),
PROD_GROUP("prodGroup", "生产组"),
CUT_GROUP("cutGroup", "下料组"),
SYN_GROUP("synGroup", "综合组"),
......
......@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentMap;
*/
public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap ACCOUNT_MAP = new ConcurrentHashMap();
/**
* 获取用户信息
......@@ -52,22 +52,22 @@ public class UserSessionUtils extends UserSession {
}
/**
* 获取登录用户的公司编码
* 获取登录用户的企业编码
*
* @return
*/
public static String getCompanyCode() {
public static String getAccountCode() {
String loginName = getLoginName();
if (loginName == null) {
return null;
}
String companyCode = MapUtils.getString(companyMap, loginName);
if (companyCode == null) {
String accountCode = MapUtils.getString(ACCOUNT_MAP, loginName);
if (accountCode == null) {
User user = getUser();
companyCode = user == null || user.getCompanyCode() == null ? "" : user.getCompanyCode();
companyMap.put(loginName, companyCode);
accountCode = user == null || user.getAccountCode() == null ? "" : user.getAccountCode();
ACCOUNT_MAP.put(loginName, accountCode);
}
return companyCode;
return accountCode;
}
/**
......
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.Hgpz009;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
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.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 企业管理
*
* @author:songx
* @date:2024/1/15,11:20
*/
public class ServiceHGPZ009 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new Hgpz009().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, Hgpz009.QUERY, new Hgpz009());
String projectEnv = ProjectInfo.getProjectEnv();
inInfo.setCell(EiConstant.resultBlock, ACConstants.ROW_CODE_0, "projectEnv", projectEnv);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "插入", operDesc = "保存")
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++) {
Hgpz009 fPz009 = new Hgpz009();
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++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fPz009.getAccountName(), "企业名称不能为空");
AssertUtils.isEmpty(fPz009.getLoginPrefix(), "登录前缀不能为空");
AssertUtils.isNull(fPz009.getValidFlag(), "是否启用不能为空");
}
}
/**
* 新增企业信息
*
* @param fPz009
* @throws Exception
*/
private void add(Hgpz009 fPz009) throws Exception {
// 生成企业编码
fPz009.setAccountCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.COMPANY_CODE));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
fPz009.setCreatedBy(UserSession.getLoginName());
fPz009.setCreatedName(UserSession.getLoginCName());
fPz009.setCreatedTime(DateUtils.shortDateTime());
// 此处不能使用DaoUtils方法insert
dao.insert(Hgpz009.INSERT, fPz009);
// 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null);
// 关联企业管理员角色
this.insertGroupMember(fPz009, userId);
}
/**
* 修改数据
*
* @param fPz009
*/
private void modify(Hgpz009 fPz009) {
DaoUtils.update(Hgpz009.UPDATE, fPz009);
}
/**
* 新增操作.
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "配置管理", operType = "新增", operDesc = "新增")
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++) {
Hgpz009 fPz009 = new Hgpz009();
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 hgpz009
* @param userId
*/
private void insertGroupMember(Hgpz009 hgpz009, String userId) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("memberId", userId);
inInfoRowMap.put("memberName", hgpz009.getAccountName());
// 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
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "修改", operDesc = "修改操作")
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++) {
Hgpz009 hppz009 = new Hgpz009();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update(Hgpz009.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
*/
@OperationLogAnnotation(operModul = "企业管理", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
Hgpz009 fPz009 = new Hgpz009();
fPz009.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HGXSTools.XsUser.countByCompany(fPz009.getAccountCode());
if (count > 0) {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", fPz009.getAccountName()));
}
DaoUtils.update(Hgpz009.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="HGPZ009">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
ACCOUNT_NAME as "accountName", <!-- 企业名称 -->
VALID_FLAG as "validFlag", <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 -->
DOC_ID_PC as "docIdPc",
DOC_ID_APP as "docIdApp",
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", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除:1.是,0.否 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" " property="dataAuthCondition">
$dataAuthCondition$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="validFlag">
VALID_FLAG = #validFlag#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="accountName">
ACCOUNT_NAME LIKE CONCAT('%', #accountName#, '%')
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME DESC
</isEmpty>
</dynamic>
</sql>
<!-- 查询品种大类配置 -->
<select id="query" resultClass="com.baosight.hggp.hg.pz.domain.Hgpz009">
SELECT
<include refid="column"/>
FROM ${metaSchema}.HGPZ009
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<include refid="orderBy"/>
</select>
<!-- 查询记录数 -->
<select id="count" resultClass="int">
SELECT COUNT(1)
FROM ${metaSchema}.HGPZ009
WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${metaSchema}.HGPZ009 (
ACCOUNT_CODE, <!-- 企业编码 -->
ACCOUNT_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX, <!-- 登录前缀 -->
DOC_ID_PC,
DOC_ID_APP,
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#accountCode#, #accountName#, #validFlag#, #loginPrefix#, #docIdPc#,
#docIdApp#, #remark#, #createdBy#, #createdName#, #createdTime#
)
</insert>
<!-- 修改 -->
<update id="update">
UPDATE ${metaSchema}.HGPZ009
SET
ACCOUNT_NAME = #accountName#,
DOC_ID_PC = #docIdPc#,
DOC_ID_APP = #docIdApp#,
VALID_FLAG = #validFlag#,
REMARK = #remark#,
<include refid="updateRevise"/>
WHERE ACCOUNT_CODE = #accountCode#
</update>
<!-- 删除 -->
<update id="delete">
UPDATE ${metaSchema}.HGPZ009
SET
DELETE_FLAG = 1,
<include refid="updateRevise"/>
WHERE ACCOUNT_CODE = #accountCode#
</update>
</sqlMap>
......@@ -14,7 +14,7 @@ public class User implements Serializable {
public static final String FIELD_GENDER = "gender"; /* 性别*/
public static final String FIELD_MOBILE = "mobile"; /* 手机号*/
public static final String FIELD_EMAIL = "email"; /* 邮箱*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业代码*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 帐套代码*/
/**
* 用户ID
......@@ -49,7 +49,7 @@ public class User implements Serializable {
/**
* 企业代码
*/
private String companyCode;
private String accountCode;
public String getUserId() {
return userId;
......@@ -91,12 +91,12 @@ public class User implements Serializable {
this.email = email;
}
public String getCompanyCode() {
return companyCode;
public String getAccountCode() {
return accountCode;
}
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
public String getGender() {
......
......@@ -67,7 +67,7 @@ public class ServiceHGXSUser extends ServiceBase {
public EiInfo queryComboBox(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap.put("companyCode", UserSessionUtils.getAccountCode());
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.USER_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, queryMap);
......@@ -91,7 +91,7 @@ public class ServiceHGXSUser extends ServiceBase {
}
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.COMPANY_RECORD_BLOCK_ID);
queryMap.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap.put("companyCode", UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, list, queryMap, false);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询企业失败");
......
......@@ -15,21 +15,21 @@
<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 prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
<select id="query" resultClass="com.baosight.hggp.hg.xs.domain.User">
SELECT
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
COMPANY_CODE as "companyCode" <!-- 企业编码 -->
USER_ID as "userId", <!-- 用户id -->
USER_NAME as "userName", <!-- 用户名 -->
LOGIN_NAME as "loginName", <!-- 登录id -->
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="condition"/>
......@@ -47,13 +47,13 @@
</select>
<!-- 查询用户企业 -->
<select id="queryCompanyComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
<select id="queryAccountComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
B.COMPANY_NAME as "companyName" <!-- 企业名称 -->
FROM ${platSchema}.XS_USER A, ${metaSchema}.T_HPPZ009 B
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
B.ACCOUNT_NAME as "accountName" <!-- 企业名称 -->
FROM ${platSchema}.XS_USER A, ${metaSchema}.HGPZ009 B
WHERE 1=1
AND A.COMPANY_CODE = B.COMPANY_CODE
AND A.ACCOUNT_CODE = B.ACCOUNT_CODE
AND A.LOGIN_NAME = #loginName#
</select>
......@@ -68,8 +68,8 @@
<!-- id查询 -->
<select id="queryParentId" resultClass="java.util.LinkedHashMap">
SELECT
MEMBER_ID as "memberId", <!-- 成员id -->
PARENT_ID as "parentId" <!-- 父节点id -->
MEMBER_ID as "memberId", <!-- 成员id -->
PARENT_ID as "parentId" <!-- 父节点id -->
FROM ${platSchema}.XS_USER_GROUP_MEMBER
WHERE 1=1
AND MEMBER_ID = #memberId#
......
......@@ -234,12 +234,12 @@ public class HGXSTools {
* @return
*/
public static Map<String, List<Org>> queryAllFactoryMap() {
String companyCode = UserSessionUtils.getCompanyCode();
if (StringUtils.isBlank(companyCode)) {
String accountCode = UserSessionUtils.getAccountCode();
if (StringUtils.isBlank(accountCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
queryMap.put("accountCode", accountCode);
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_ALL, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
......
......@@ -43,7 +43,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-15
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
return outInfo;
......@@ -143,7 +143,7 @@ public class ServiceXS3001 extends ServiceEPBase {
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS3001.queryGroupOutOfUser", new XS02());
EiBlock eiBlock = new EiBlock("result3");
......@@ -172,7 +172,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.queryUserParentGroups", new XS02());
EiBlock eiBlock = new EiBlock("result1");
......@@ -201,7 +201,7 @@ public class ServiceXS3001 extends ServiceEPBase {
inInfo.set("inqu_status-0-userName", authCopyUserName);
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo resultInfo = super.query(inInfo, "XS03.queryForMemberUsers", new XS01());
EiBlock resultBBlock = new EiBlock("result4");
......@@ -293,7 +293,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
EiBlock eiBlock = new EiBlock("result8");
......@@ -360,7 +360,7 @@ public class ServiceXS3001 extends ServiceEPBase {
}
// 非超级管理只能看到所属企业的角色 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS01.query", new XS01());
EiBlock eiBlock = new EiBlock("result9");
......
......@@ -199,7 +199,7 @@ public class ServiceXS3201 extends ServiceEPBase {
}
// 非管理员仅查询所属企业用户 added by songx at 2024-01-16
if (!LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
inInfo.set("inqu_status-0-companyCode", UserSessionUtils.getCompanyCode());
inInfo.set("inqu_status-0-accountCode", UserSessionUtils.getAccountCode());
}
EiInfo outInfo = super.query(inInfo, "XS3002.queryUserOutOfUserGroup", new XS01());
EiBlock eiBlock = new EiBlock("result6");
......
......@@ -25,7 +25,7 @@
PWD_REVISOR,
ARCHIVE_FLAG,
USER_GROUP_ENAME,
COMPANY_CODE
ACCOUNT_CODE
) VALUES (
#userId#,
#loginName#,
......@@ -48,7 +48,7 @@
#pwdRevisor#,
#archiveFlag#,
#userGroupEname#,
#companyCode#
#accountCode#
)
</insert>
<select id="query" resultClass="java.util.HashMap">
......@@ -73,7 +73,7 @@
t1.pwd_revisor as "pwdRevisor",
t1.archive_flag as "archiveFlag",
t1.USER_GROUP_ENAME as "userGroupEname",
t1.COMPANY_CODE as "companyCode",
t1.ACCOUNT_CODE as "accountCode",
t2.group_cname as "userGroupCname"
FROM ${platSchema}.XS_USER t1
left join ${platSchema}.XS_USER_GROUP t2 on t2.group_ename=t1.USER_GROUP_ENAME
......@@ -99,8 +99,8 @@
<isNotEmpty prepend=" AND " property="isLocked">
t1.is_locked = #isLocked#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
t1.company_code = #companyCode#
<isNotEmpty prepend=" AND " property="accountCode">
t1.account_code = #accountCode#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -254,8 +254,8 @@
SELECT DISTINCT PARENT_ID from ${platSchema}.XS_USER_GROUP_MEMBER
where MEMBER_TYPE = 'USER' and MEMBER_ID = #userIdForParentGroups#
)
<isNotEmpty prepend="AND" property="companyCode">
COMPANY_CODE = #companyCode#
<isNotEmpty prepend="AND" property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</select>
......@@ -266,8 +266,8 @@
SELECT DISTINCT PARENT_ID from ${platSchema}.XS_USER_GROUP_MEMBER
where MEMBER_TYPE = 'USER' and MEMBER_ID = #userIdForParentGroups#
)
<isNotEmpty prepend="AND" property="companyCode">
COMPANY_CODE = #companyCode#
<isNotEmpty prepend="AND" property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</select>
......@@ -332,7 +332,7 @@
JOB_ID,
JOB_NAME,
EHR_ORG_ID,
COMPANY_CODE
ACCOUNT_CODE
) VALUES (
#userId#,
#loginName#,
......@@ -358,7 +358,7 @@
#jobId#,
#jobName#,
#ehrOrgId#,
#companyCode#
#accountCode#
)
</insert>
......
$(function () {
$.extend(true, IPLATUI.Config, {
// EFGrid: {
// height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
// }
});
IPLATUI.EFGrid.result = {
copyToAdd: false,
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "docIdPc",
title: "PC端log",
template: function (item) {
let docId = item.docIdPc;
let template = '';
if (docId != null && docId.trim().length > 0) {
let src = downloadHref(docId);
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;background-color: #e7e7e7" '
+ 'href="' + src + '" target="_blank"><img src="' + src
+ '" style="width:200px;height:50px;background-image: none;" alt="PC端log"/></a>';
}
return template;
}
}, {
field: "docIdApp",
title: "APP端log",
template: function (item) {
let docId = item.docIdApp;
let template = '';
if (docId != null && docId.trim().length > 0) {
let src = downloadHref(docId);
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;background-color: #e7e7e7" '
+ 'href="' + src + '" target="_blank"><img src="' + src
+ '" style="width:200px;height:50px;background-image: none;" alt="APP端log"/></a>';
}
return template;
}
}],
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onAdd: function (e) {
e.preventDefault();
$("#type").val("insert")
$("#accountName").val("");
$("#loginPrefix").val("");
$("#loginPrefix").removeAttr("readonly");
$("#validFlag").val(1);
$("#PCfileDocId").val("");
$("#APPfileDocId").val("");
$("#remark").val("");
$("#id").val("");
$("#accountCode").val("");
$("#insertGroup_wnd_title").text("新增企业管理");
clealImgLabel($("#app-img"));
clealImgLabel($("#pc-img"));
addCompany($("#insertGroup"));
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
updateCompany();
},
onDelete: function (e) {
// 阻止后台删除请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
/**
*
* @param e
* e.sender kendoGridresultGrid
* e.model kendo.data.Model
* e.row
* e.tr tr, jquery
*/
onRowClick: function (e) {
/*WindowUtil({
"title": "",
"content": "<div class='kendo-del-message'>" + e.row + "</div>"
})*/
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
//$("#BTN_SAVE").on("click", save);
// 删除
$("#BTN_DELETE").on("click", deleteFunc);
IPLATUI.EFUpload = {
docIdApp: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
loadComplete: function(e) {
var uploader = e.sender.uploader;
uploader.clearAllFiles();
// 清空所有历史上传文件
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#APPfileDocId").val(docId);
addImgLabel($("#app-img"),docId);
//$("#app-img").attr("src",downloadHref(docId));
NotificationUtil("附件上传成功");
},
},
docIdPc: {
showFileList:false,
validation: {
allowedExtensions: [".jpg",".png",".gif"], //
maxFileSize: 900000,
minFileSize: 300
},
// 不支持格式提示信息
localization: {
invalidFileExtension: "文件格式不支持, 上传失败"
},
loadComplete: function(e) {
var uploader = e.sender.uploader;
uploader.clearAllFiles();
// 清空所有历史上传文件
},
success: function(e) {
let docId = e.response.docId;
if (isBlank(docId)) {
return;
}
$("#PCfileDocId").val(docId);
addImgLabel($("#pc-img"),docId);
/*$("#pc-img").attr("src",downloadHref(docId));*/
NotificationUtil("附件上传成功");
},
}
};
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
};
let save = function (){
var btnNode = $(this);
btnNode.attr("disabled", true);
var ei = new EiInfo();
let type = $("#type").val();
if (type === "update") {
ei.set("result-0-accountCode", $("#accountCode").val());
}
ei.set("result-0-accountName", $("#accountName").val());
ei.set("result-0-loginPrefix", $("#loginPrefix").val());
ei.set("result-0-validFlag", $("#validFlag").val());
ei.set("result-0-docIdPc", $("#PCfileDocId").val());
ei.set("result-0-docIdApp", $("#APPfileDocId").val());
ei.set("result-0-remark", $("#remark").val());
ei.set("result-0-id", $("#id").val());
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HGPZ009", "save", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
$("#insertGroup").data("kendoWindow").close();
// 清除上传队列
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
};
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ009", "delete", true);
}
});
}
/**
* 点击添加
*
* @param id
*/
function addCompany(id) {
$(".k-upload-status-total").remove();
id.data("kendoWindow").open().center();
}
function updateCompany() {
//获取grid选中数据
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let app = $("#app-img"),
pc = $("#pc-img");
$("#type").val("update");
$("#accountCode").val(rows[0]["accountCode"]);
$("#accountName").val(rows[0]["accountName"]);
$("#loginPrefix").val(rows[0]["loginPrefix"]);
$("#loginPrefix").attr("readonly","true");
$("#validFlag").val(rows[0]["validFlag"]);
$("#PCfileDocId").val(rows[0]["docIdPc"]);
$("#APPfileDocId").val(rows[0]["docIdApp"]);
$("#remark").val(rows[0]["remark"]);
$("#id").val(rows[0]["id"]);
addImgLabel(app,rows[0]["docIdApp"]);
addImgLabel(pc,rows[0]["docIdPc"]);
$("#insertGroup_wnd_title").text("修改企业管理");
addCompany($("#insertGroup"));
}
$("#update").click(function () {
var btnNode = $(this);
btnNode.attr("disabled", true);
// 创建 EiInfo
var ei = new EiInfo();
ei.setByNodeObject(document.body);
// 获取 数据
// 调用请求 onSuccess 成功回掉函数
EiCommunicator.send("HGPZ009", "update", ei, {
onSuccess: function (ei) {
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
// onFail 表示失败回掉函数
}, onFail: function (ei) {
// 发生异常
btnNode.attr("disabled", false);
NotificationUtil(ei);
}
});
});
/**
* 附件上传回调
*
* @param e
*/
function addCompanyCallback(e) {
resultGrid.dataSource.page(1);
}
function addImgLabel (id,docId) {
clealImgLabel(id);
if (isBlank(docId)){
return;
}
let src = downloadHref(docId)
let img=`<img src="${src}" style='width:200px;height:55px;background-image: none;'/>`;
id.html(img);
}
function clealImgLabel(id) {
id.html("");
}
<!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="accountCode" blockId="inqu_status" row="0"/>
<EF:EFInput cname="企业名称:" ename="accountName" blockId="inqu_status" row="0"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="single" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn cname="企业编码" ename="accountCode" enable="false" width="120" height="50" align="center"/>
<EF:EFColumn cname="企业名称" ename="accountName" width="140" align="center" required="true"/>
<EF:EFColumn cname="登录前缀" ename="loginPrefix" width="80" align="center" readonly="true"/>
<EF:EFColumn cname="PC端log" ename="docIdPc" align="center" width="200" readonly="true" enable="false"/>
<EF:EFColumn cname="APP端log" ename="docIdApp" align="center" width="200" readonly="true"
enable="false"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="90" 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>
<br/>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账号和密码与企业编码相同</span>
</EF:EFRegion>
</EF:EFPage>
<EF:EFWindow id="insertGroup" title="企业管理" top="100px" left="280px" width="40%" height="70%">
<form>
<div class="row">
<label for="accountName" class="col-sm-2 col-form-label col-form-label-sm">企业名称</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="accountName" placeholder="企业名称" aria-label="企业名称"
required="required">
</div>
</div>
<div class="form-group row">
<label for="loginPrefix" class="col-sm-2 col-form-label col-form-label-sm">登录前缀</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="loginPrefix" placeholder="登录前缀" aria-label="登录前缀">
</div>
</div>
<div class="form-group row">
<label for="validFlag" class="col-sm-2 col-form-label col-form-label-sm">是否启用</label>
<div class="col-sm-6">
<select class="form-control" id="validFlag">
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="form-group row">
<label for="docIdPc" class="col-sm-2 col-form-label">PC端log</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdPc" cname="PC上传" docTag="hk_filePc" path="A"/>
<div class="side-header" id="pc-img" style="background-color: whitesmoke">
<img src="${ctx}/hpjx-logo.png" style="width:200px;height:55px;background-image: none;" alt="pc端log"/>
</div>
</div>
<input type="hidden" id="PCfileDocId" value="">
</div>
<div class="form-group row">
<label for="docIdApp" class="col-sm-2 col-form-label">APP端log</label>
<div class="col-sm-6">
<EF:EFUpload ename="docIdApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<div class="side-header" id="app-img" style="background-color: whitesmoke">
<img src="${ctx}/hpjx-logo.png" style="width:200px;height:55px;background-image: none;" alt="app端log"/>
</div>
</div>
<input type="hidden" id="APPfileDocId" value="">
</div>
<div class="form-group row">
<label for="remark" class="col-sm-2 col-form-label col-form-label-sm">备注</label>
<div class="col-sm-6">
<textarea id="remark" class="form-control" placeholder="备注" aria-label="备注"></textarea>
</div>
</div>
<input type="hidden" id="type" value="insert">
<input type="hidden" id="id" value="">
<input type="hidden" id="accountCode" value="">
<div class="form-group col-md-6 col-sm-6 col-sm-offset-9">
<button type="button" onclick="save()" class="btn btn-primary">确认</button>
</div>
</form>
</EF:EFWindow>
<EF:EFWindow id="updateGroup" top="100px" left="280px" width="58%" height="80%">
<EF:EFRegion id="updateResult">
<EF:EFInput ename="accountName" colWidth="6" cname="企业名称"/>
<EF:EFInput ename="loginPrefix" colWidth="6" cname="登录前缀"/>
<EF:EFSelect ename="validFlag" cname="是否启动"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#"
required="true" defaultValue="China"> <%--enable="false":不可下拉--%>
<EF:EFOptions blockId="made_country_block_id" textField="country_ch_name" valueField="country"/>
</EF:EFSelect>
<EF:EFUpload ename="uploadFilePc" cname="PC上传" docTag="hk_filePc" path="A"/>
<EF:EFUpload ename="uploadFileApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<EF:EFInput ename="remark" colWidth="6" cname="备注"/>
<EF:EFInput ename="PCfileDocId" cname="" hidden="true"/>
<EF:EFInput ename="APPfileDocId" cname="" hidden="true"/>
<EF:EFButton ename="update" cname="确认" layout="1" class="k-button"/>
</EF:EFRegion>
</EF:EFWindow>
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