Commit 56ed24e0 by 宋祥

1.企业管理增加登录前缀

2.企业在注册用户时登录号前强制增加登录前缀
parent 4c5cac02
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* @author:songx
* @date:2024/1/16,17:33
* Project: <br>
* Title:THppz009.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-02-01 19:34:25 create
*/
public class HPPZ009 extends DaoEPBase {
......@@ -20,6 +25,7 @@ public class HPPZ009 extends DaoEPBase {
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 企业名称*/
public static final String FIELD_VALID_FLAG = "validFlag"; /* 是否启用:1.启用,0.停用*/
public static final String FIELD_LOGIN_PREFIX = "loginPrefix"; /* 登录前缀*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
......@@ -33,6 +39,7 @@ public class HPPZ009 extends DaoEPBase {
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 企业名称*/
public static final String COL_VALID_FLAG = "VALID_FLAG"; /* 是否启用:1.启用,0.停用*/
public static final String COL_LOGIN_PREFIX = "LOGIN_PREFIX"; /* 登录前缀*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......@@ -48,10 +55,11 @@ public class HPPZ009 extends DaoEPBase {
public static final String UPDATE = "HPPZ009.update";
public static final String DELETE = "HPPZ009.delete";
private Long id = null;
private Long id;
private String companyCode = " "; /* 企业编码*/
private String companyName = " "; /* 企业名称*/
private Integer validFlag = null; /* 是否启用:1.启用,0.停用*/
private Integer validFlag; /* 是否启用:1.启用,0.停用*/
private String loginPrefix = " "; /* 登录前缀*/
private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
......@@ -59,14 +67,7 @@ public class HPPZ009 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag = null; /* 是否删除:1.是,0.否*/
/**
* the constructor.
*/
public HPPZ009() {
initMetaData();
}
private Integer deleteFlag; /* 是否删除:1.是,0.否*/
/**
* initialize the metadata.
......@@ -91,6 +92,10 @@ public class HPPZ009 extends DaoEPBase {
eiColumn.setDescName("是否启用:1.启用,0.停用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LOGIN_PREFIX);
eiColumn.setDescName("登录前缀");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
......@@ -123,11 +128,18 @@ public class HPPZ009 extends DaoEPBase {
eiColumn.setDescName("是否删除:1.是,0.否");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPPZ009() {
initMetaData();
}
/**
* get the id .
*
* @return the id
*/
public Long getId() {
......@@ -142,10 +154,8 @@ public class HPPZ009 extends DaoEPBase {
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码.
*
* @return the companyCode
*/
public String getCompanyCode() {
......@@ -160,10 +170,8 @@ public class HPPZ009 extends DaoEPBase {
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the companyName - 企业名称.
*
* @return the companyName
*/
public String getCompanyName() {
......@@ -178,10 +186,8 @@ public class HPPZ009 extends DaoEPBase {
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
/**
* get the validFlag - 是否启用:1.启用,0.停用.
*
* @return the validFlag
*/
public Integer getValidFlag() {
......@@ -196,10 +202,24 @@ public class HPPZ009 extends DaoEPBase {
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
/**
* get the loginPrefix - 登录前缀.
* @return the loginPrefix
*/
public String getLoginPrefix() {
return this.loginPrefix;
}
/**
* get the remark - 备注.
* set the loginPrefix - 登录前缀.
*
* @param loginPrefix - 登录前缀
*/
public void setLoginPrefix(String loginPrefix) {
this.loginPrefix = loginPrefix;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
......@@ -214,10 +234,8 @@ public class HPPZ009 extends DaoEPBase {
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the createdBy - 创建人.
*
* @return the createdBy
*/
public String getCreatedBy() {
......@@ -232,7 +250,6 @@ public class HPPZ009 extends DaoEPBase {
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
......@@ -249,10 +266,8 @@ public class HPPZ009 extends DaoEPBase {
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
*
* @return the createdTime
*/
public String getCreatedTime() {
......@@ -267,10 +282,8 @@ public class HPPZ009 extends DaoEPBase {
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
*
* @return the updatedBy
*/
public String getUpdatedBy() {
......@@ -285,7 +298,6 @@ public class HPPZ009 extends DaoEPBase {
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 更新人名称.
* @return the updatedName
......@@ -302,10 +314,8 @@ public class HPPZ009 extends DaoEPBase {
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
*
* @return the updatedTime
*/
public String getUpdatedTime() {
......@@ -320,10 +330,8 @@ public class HPPZ009 extends DaoEPBase {
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除:1.是,0.否.
*
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
......@@ -338,7 +346,6 @@ public class HPPZ009 extends DaoEPBase {
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the value from Map.
*
......@@ -351,6 +358,7 @@ public class HPPZ009 extends DaoEPBase {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setValidFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_VALID_FLAG)), validFlag));
setLoginPrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOGIN_PREFIX)), loginPrefix));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
......@@ -372,6 +380,7 @@ public class HPPZ009 extends DaoEPBase {
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_VALID_FLAG, StringUtils.toString(validFlag, eiMetadata.getMeta(FIELD_VALID_FLAG)));
map.put(FIELD_LOGIN_PREFIX, StringUtils.toString(loginPrefix, eiMetadata.getMeta(FIELD_LOGIN_PREFIX)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......@@ -383,5 +392,4 @@ public class HPPZ009 extends DaoEPBase {
return map;
}
}
......@@ -106,6 +106,7 @@ public class ServiceHPPZ009 extends ServiceBase {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
AssertUtils.isEmpty(hppz009.getCompanyName(), "企业名称不能为空");
AssertUtils.isEmpty(hppz009.getLoginPrefix(), "登录前缀不能为空");
AssertUtils.isNull(hppz009.getValidFlag(), "是否启用不能为空");
}
}
......
......@@ -2,28 +2,33 @@
<!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">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
COMPANY_NAME as "companyName", <!-- 企业名称 -->
VALID_FLAG as "validFlag", <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 -->
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" <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除:1.是,0.否 -->
</sql>
<sql id="conditions">
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="validFlag">
VALID_FLAG = #validFlag#
</isNotEmpty>
</sql>
<sql id="queryConditions">
<sql id="queryCondition">
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
......@@ -50,11 +55,11 @@
<!-- 查询品种大类配置 -->
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ009">
SELECT
<include refid="columns"/>
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ009
WHERE 1=1
<include refid="conditions" />
<include refid="queryConditions"/>
<include refid="condition" />
<include refid="queryCondition"/>
<include refid="dynamic"/>
</select>
......@@ -63,8 +68,8 @@
SELECT COUNT(1)
FROM ${hpjxSchema}.T_HPPZ009
WHERE 1=1
<include refid="conditions" />
<include refid="queryConditions"/>
<include refid="condition" />
<include refid="queryCondition"/>
</select>
<insert id="insert">
......@@ -72,12 +77,13 @@
COMPANY_CODE, <!-- 企业编码 -->
COMPANY_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX, <!-- 登录前缀 -->
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #companyName#, #validFlag#, #remark#, #createdBy#,
#companyCode#, #companyName#, #validFlag#, #loginPrefix#, #remark#, #createdBy#,
#createdName#, #createdTime#
)
</insert>
......
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.cache.CacheManager;
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.exception.PlatException;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
......
......@@ -18,6 +18,7 @@
<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" required="true"/>
<EF:EFColumn cname="登录前缀" ename="loginPrefix" width="100" align="center" readonly="true"/>
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
......
<%@ page import="com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext" %>
<%@ page import="com.baosight.xservices.xs.constants.LoginConstants" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="com.baosight.hpjx.hp.pz.tools.HPPZTools" %>
<%@ page import="com.baosight.hpjx.core.security.UserSessionUtils" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......@@ -99,12 +101,14 @@
String passwordDesc = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.checkpassword.desc"), "密码必须包含英文及数字");
String loginPublicKey = LoginConstants.loginRsaPublicKey;
String cryptoPasswordEnable = LoginConstants.cryptoPasswordEnable;
String companyCode = UserSessionUtils.getCompanyCode();
String loginPrefix = StringUtils.isBlank(companyCode) ? "" : HPPZTools.getPz009(companyCode).getLoginPrefix();
%>
<c:set var="pwdRgx" value="<%=passwordRegex%>"/>
<c:set var="pwdDesc" value="<%=passwordDesc%>"/>
<c:set var="login_PublicKey" value="<%=loginPublicKey%>"/>
<c:set var="crypto_PasswordEnable" value="<%=cryptoPasswordEnable%>"/>
<c:set var="loginPrefix" value="<%=loginPrefix%>"/>
<EF:EFPage>
<script>
var ctx = "${ctx}";
......@@ -343,9 +347,11 @@
</div>
<div class="col-xs-3">
<EF:EFInput cname="登录账号" ename="details-0-loginName"
data-regex="/^[_a-zA-Z0-9]{1,64}$/" value=""
data-regex="/^[_a-zA-Z0-9]{1,64}$/"
data-errorPrompt="对不起,登录账号只能是不超过64位的英文字母或者数字字符或下划线"
validateGroupName="group1" required="required" inline="true"/>
validateGroupName="group1" required="required" inline="true"
value="${loginPrefix}"
oninput="this.value='${loginPrefix}' + this.value.slice(this.value.indexOf('${loginPrefix}')+('${loginPrefix}'.length));"/>
</div>
<div class="col-xs-7">
<span id="details-0-loginName-prompt">【登录账号只能由不超过64位的英文字母或者数字字符或者下划线组成。】</span>
......
......@@ -2,6 +2,8 @@
<%@ page import="com.baosight.xservices.xs.constants.LoginConstants" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="com.baosight.xservices.xs.util.UserSession" %>
<%@ page import="com.baosight.hpjx.core.security.UserSessionUtils" %>
<%@ page import="com.baosight.hpjx.hp.pz.tools.HPPZTools" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......@@ -18,6 +20,8 @@
} else {
request.setAttribute("passwordTip", "密码由不超过255位的英文字母或者数字字符或下划线组成。");
}
String companyCode = UserSessionUtils.getCompanyCode();
String loginPrefix = StringUtils.isBlank(companyCode) ? "" : HPPZTools.getPz009(companyCode).getLoginPrefix();
String username = UserSession.getUser().getUsername();
String passwordRegex = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.checkpassword.regex"), "^(?=.*?[a-zA-Z])(?=.*?[0-9]).{1,}$");
String passwordDesc = StringUtils.defaultIfEmpty(PlatApplicationContext.getProperty("xservices.security.checkpassword.desc"), "密码必须包含英文及数字");
......@@ -29,6 +33,7 @@
<c:set var="login_PublicKey" value="<%=loginPublicKey%>"/>
<c:set var="crypto_PasswordEnable" value="<%=cryptoPasswordEnable%>"/>
<c:set var="username" value="<%=username%>"/>
<c:set var="loginPrefix" value="<%=loginPrefix%>"/>
<script>
let username = "${username}"
</script>
......@@ -253,12 +258,15 @@
</div>
<div class="col-xs-3">
<EF:EFInput cname="登录账号" ename="details-0-loginName"
data-regex="/^[_a-zA-Z0-9]{1,64}$/" value=""
data-regex="/^[_a-zA-Z0-9]{1,64}$/"
data-errorPrompt="对不起,登录账号只能是不超过64位的英文字母或者数字字符或下划线"
validateGroupName="group1" required="required" inline="true"/>
validateGroupName="group1" required="required" inline="true"
value="${loginPrefix}"
oninput="this.value='${loginPrefix}' + this.value.slice(this.value.indexOf('${loginPrefix}')+('${loginPrefix}'.length));"/>
</div>
<div class="col-xs-7">
<span id="details-0-loginName-prompt">【登录账号只能由不超过64位的英文字母或者数字字符或者下划线组成。】</span>
<span id="details-0-loginName-prompt">【登录账号只能由不超过64位的英文字母或者数字字符或者下划线组成。】</span><br/>
<span id="details-0-loginName-prompt1" style="color: red">【登录账号由"固定前缀+自定义输入值"组成。】</span>
</div>
</div>
</br>
......
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