JEECG-BOOT 2.0.2版本发布

This commit is contained in:
zhangdaihao
2019-07-05 15:38:38 +08:00
parent 2917239a9d
commit 31422b1ea8
424 changed files with 34593 additions and 20808 deletions

View File

@ -1,11 +1,9 @@
package org.jeecg.common.api.vo;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.jeecg.common.constant.CommonConstant;
import lombok.Data;
/**
@ -43,10 +41,6 @@ public class Result<T> implements Serializable {
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
public Result() {
}
/**
* 时间戳
@ -54,29 +48,24 @@ public class Result<T> implements Serializable {
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
public void error500(String message) {
public Result() {
}
public Result<T> error500(String message) {
this.message = message;
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
public void success(String message) {
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
public static Result<Object> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<Object> error(int code, String msg) {
Result<Object> r = new Result<Object>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public static Result<Object> ok() {
Result<Object> r = new Result<Object>();
@ -101,4 +90,23 @@ public class Result<T> implements Serializable {
r.setResult(data);
return r;
}
public static Result<Object> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<Object> error(int code, String msg) {
Result<Object> r = new Result<Object>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
/**
* 无权限访问返回结果
*/
public static Result<Object> noauth(String msg) {
return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
}
}

View File

@ -0,0 +1,26 @@
package org.jeecg.common.constant;
/**
* @author: huangxutao
* @date: 2019-06-14
* @description: 缓存常量
*/
public interface CacheConstant {
/**
* 字典信息缓存
*/
public static final String DICT_CACHE = "dictCache";
/**
* 权限信息缓存
*/
public static final String PERMISSION_CACHE = "permission";
/**
* 登录用户规则缓存
*/
public static final String LOGIN_USER_RULES_CACHE = "loginUser_cacheRules";
}

View File

@ -5,76 +5,120 @@ public interface CommonConstant {
/**
* 正常状态
*/
Integer STATUS_NORMAL = 0;
public static final Integer STATUS_NORMAL = 0;
/**
* 禁用状态
*/
Integer STATUS_DISABLE = -1;
public static final Integer STATUS_DISABLE = -1;
/**
* 删除标志
*/
Integer DEL_FLAG_1 = 1;
public static final Integer DEL_FLAG_1 = 1;
/**
* 未删除
*/
Integer DEL_FLAG_0 = 0;
public static final Integer DEL_FLAG_0 = 0;
/**
* 系统日志类型: 登录
*/
int LOG_TYPE_1 = 1;
public static final int LOG_TYPE_1 = 1;
/**
* 系统日志类型: 操作
*/
int LOG_TYPE_2 = 2;
public static final int LOG_TYPE_2 = 2;
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
public static final Integer SC_OK_200 = 200;
/**访问权限认证未通过 510*/
public static final Integer SC_JEECG_NO_AUTHZ=510;
/** 登录用户拥有角色缓存KEY前缀 */
public static String LOGIN_USER_CACHERULES_ROLE = "loginUser_cacheRules::Roles_";
/** 登录用户拥有权限缓存KEY前缀 */
public static String LOGIN_USER_CACHERULES_PERMISSION = "loginUser_cacheRules::Permissions_";
/** 登录用户令牌缓存KEY前缀 */
public static int TOKEN_EXPIRE_TIME = 3600; //3600秒即是一小时
public static final int TOKEN_EXPIRE_TIME = 3600; //3600秒即是一小时
public static String PREFIX_USER_TOKEN = "PREFIX_USER_TOKEN_";
public static final String PREFIX_USER_TOKEN = "PREFIX_USER_TOKEN_";
/**
* 0一级菜单
*/
public static Integer MENU_TYPE_0 = 0;
public static final Integer MENU_TYPE_0 = 0;
/**
* 1子菜单
*/
public static Integer MENU_TYPE_1 = 1;
public static final Integer MENU_TYPE_1 = 1;
/**
* 2按钮权限
*/
public static Integer MENU_TYPE_2 = 2;
public static final Integer MENU_TYPE_2 = 2;
/**通告对象类型USER:指定用户ALL:全体用户)*/
public static String MSG_TYPE_UESR = "USER";
public static String MSG_TYPE_ALL = "ALL";
public static final String MSG_TYPE_UESR = "USER";
public static final String MSG_TYPE_ALL = "ALL";
/**发布状态0未发布1已发布2已撤销*/
public static String NO_SEND = "0";
public static String HAS_SEND = "1";
public static String HAS_CANCLE = "2";
public static final String NO_SEND = "0";
public static final String HAS_SEND = "1";
public static final String HAS_CANCLE = "2";
/**阅读状态0未读1已读*/
public static String HAS_READ_FLAG = "1";
public static String NO_READ_FLAG = "0";
public static final String HAS_READ_FLAG = "1";
public static final String NO_READ_FLAG = "0";
/**优先级L低M中H高*/
public static String PRIORITY_L = "L";
public static String PRIORITY_M = "M ";
public static String PRIORITY_H = "H";
public static final String PRIORITY_L = "L";
public static final String PRIORITY_M = "M";
public static final String PRIORITY_H = "H";
/**
* 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板
*/
public static final String SMS_TPL_TYPE_0 = "0";
public static final String SMS_TPL_TYPE_1 = "1";
public static final String SMS_TPL_TYPE_2 = "2";
/**
* 状态(0无效1有效)
*/
public static final String STATUS_0 = "0";
public static final String STATUS_1 = "1";
/**
* 同步工作流引擎1同步0不同步
*/
public static final String ACT_SYNC_0 = "0";
public static final String ACT_SYNC_1 = "1";
/**
* 消息类型1:通知公告2:系统消息
*/
public static final String MSG_CATEGORY_1 = "1";
public static final String MSG_CATEGORY_2 = "2";
/**
* 是否配置菜单的数据权限 1是0否
*/
public static final Integer RULE_FLAG_0 = 0;
public static final Integer RULE_FLAG_1 = 1;
/**
* 是否用户已被冻结 1(解冻)正常 2冻结
*/
public static final Integer USER_UNFREEZE = 1;
public static final Integer USER_FREEZE = 2;
/**字典翻译文本后缀*/
public static final String DICT_TEXT_SUFFIX = "_dictText";
}

View File

@ -7,9 +7,9 @@ package org.jeecg.common.constant;
*/
public interface CommonSendStatus {
String UNPUBLISHED_STATUS_0 = "0"; //未发布
public static final String UNPUBLISHED_STATUS_0 = "0"; //未发布
String PUBLISHED_STATUS_1 = "1"; //已发布
public static final String PUBLISHED_STATUS_1 = "1"; //已发布
String REVOKE_STATUS_2 = "2"; //撤销
public static final String REVOKE_STATUS_2 = "2"; //撤销
}

View File

@ -45,7 +45,7 @@ public class JeecgBootExceptionHandler {
@ExceptionHandler({UnauthorizedException.class, AuthorizationException.class})
public Result<?> handleAuthorizationException(AuthorizationException e){
log.error(e.getMessage(), e);
return Result.error("没有权限,请联系管理员授权");
return Result.noauth("没有权限,请联系管理员授权");
}
@ExceptionHandler(Exception.class)

View File

@ -2,6 +2,7 @@ package org.jeecg.common.system.api;
import java.sql.SQLException;
import java.util.List;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
@ -49,6 +50,9 @@ public interface ISysBaseAPI {
*/
public List<DictModel> queryDictItemsByCode(String code);
/** 查询所有的父级字典按照create_time排序 */
public List<DictModel> queryAllDict();
/**
* 获取表数据字典
* @param table
@ -72,4 +76,5 @@ public interface ISysBaseAPI {
* @param msgContent 消息内容
*/
public void sendSysAnnouncement(String fromUser,String toUser,String title, String msgContent);
}

View File

@ -81,9 +81,13 @@ public class JeecgController<T extends JeecgEntity, S extends JeecgService<T>> {
params.setNeedSave(true);
try {
List<T> list = ExcelImportUtil.importExcel(file.getInputStream(), clazz, params);
for (T t : list) {
service.save(t);
}
//update-begin-author:taoyan date:20190528 for:批量插入数据
long start = System.currentTimeMillis();
service.saveBatch(list);
//400条 saveBatch消耗时间1592毫秒 循环插入消耗时间1947毫秒
//1200条 saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
log.info("消耗时间"+(System.currentTimeMillis()-start)+"毫秒");
//update-end-author:taoyan date:20190528 for:批量插入数据
return Result.ok("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(), e);

View File

@ -1,5 +1,6 @@
package org.jeecg.common.system.base.entity;
import java.io.Serializable;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@ -21,10 +22,11 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class JeecgEntity {
public class JeecgEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** ID */
@TableId(type = IdType.UUID)
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "ID")
private java.lang.String id;
/** 创建人 */

View File

@ -16,8 +16,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.beanutils.PropertyUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.util.JeecgDataAutorUtils;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysPermissionDataRule;
import org.springframework.util.NumberUtils;
@ -174,6 +176,13 @@ public class QueryGenerator {
}
log.debug("排序规则>>列:"+column+",排序方式:"+order);
if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
//字典字段,去掉字典翻译文本后缀
if(column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) {
column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX));
}
//SQL注入check
SqlInjectionUtil.filterContent(column);
if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
} else {

View File

@ -11,8 +11,10 @@ import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
@ -123,11 +125,16 @@ public class JwtUtil {
* @param user
* @return
*/
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
if(user==null) {
user = JeecgDataAutorUtils.loadUserInfo();
}
//#{sys_user_code}%
// 获取登录用户信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String moshi = "";
if(key.indexOf("}")!=-1){
moshi = key.substring(key.indexOf("}")+1);
@ -141,16 +148,28 @@ public class JwtUtil {
}
//替换为系统登录用户帐号
if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
returnValue = user.getSysUserCode();
if(user==null) {
returnValue = sysUser.getUsername();
}else {
returnValue = user.getSysUserCode();
}
}
//替换为系统登录用户真实名字
if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
returnValue = user.getSysUserName();
if(user==null) {
returnValue = sysUser.getRealname();
}else {
returnValue = user.getSysUserName();
}
}
//替换为系统用户登录所使用的机构编码
if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
returnValue = user.getSysOrgCode();
if(user==null) {
returnValue = sysUser.getOrgCode();
}else {
returnValue = user.getSysOrgCode();
}
}
//替换为系统用户所拥有的所有机构编码
if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)) {

View File

@ -11,6 +11,14 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class DictModel implements Serializable{
private static final long serialVersionUID = 1L;
public DictModel() {
}
public DictModel(String value, String text) {
this.value = value;
this.text = text;
}
/**
* 字典value
@ -28,4 +36,5 @@ public class DictModel implements Serializable{
public String getTitle() {
return this.text;
}
}

View File

@ -0,0 +1,105 @@
package org.jeecg.common.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
/**
* Created on 17/6/7.
* 短信API产品的DEMO程序,工程中包含了一个SmsDemo类直接通过
* 执行main函数即可体验短信产品API功能(只需要将AK替换成开通了云通信-短信产品功能的AK即可)
* 工程依赖了2个jar包(存放在工程的libs目录下)
* 1:aliyun-java-sdk-core.jar
* 2:aliyun-java-sdk-dysmsapi.jar
*
* 备注:Demo工程编码采用UTF-8
* 国际短信发送请勿参照此DEMO
*/
public class DySmsHelper {
private final static Logger logger=LoggerFactory.getLogger(DySmsHelper.class);
//产品名称:云通信短信API产品,开发者无需替换
static final String product = "Dysmsapi";
//产品域名,开发者无需替换
static final String domain = "dysmsapi.aliyuncs.com";
// TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
static final String accessKeyId = "?";
static final String accessKeySecret = "?";
/**
* 登陆时采用的短信发送模板编码
*/
public static final String LOGIN_TEMPLATE_CODE="SMS_167040816";
/**
* 忘记密码时采用的短信发送模板编码
*/
public static final String FORGET_PASSWORD_TEMPLATE_CODE="SMS_167040816";
/**
* 注册时采用的短信发送模板编码
*/
public static final String REGISTER_TEMPLATE_CODE="SMS_144146309";
/**
* 必填:短信签名-可在短信控制台中找到
*/
public static final String signName="JEECG";
public static boolean sendSms(String phone,String code,String templateCode) throws ClientException {
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(phone);
//必填:短信签名-可在短信控制台中找到
request.setSignName(signName);
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_167040816");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\""+code+"\"}");
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//request.setOutId("yourOutId");
boolean result = false;
//hint 此处可能会抛出异常注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
logger.info("短信接口返回的数据----------------");
logger.info("{Code:" + sendSmsResponse.getCode()+",Message:" + sendSmsResponse.getMessage()+",RequestId:"+ sendSmsResponse.getRequestId()+",BizId:"+sendSmsResponse.getBizId()+"}");
if ("OK".equals(sendSmsResponse.getCode())) {
result = true;
}
return result;
}
public static void main(String[] args) throws ClientException, InterruptedException {
sendSms("13800138000", "123456", FORGET_PASSWORD_TEMPLATE_CODE);
}
}

View File

@ -1,11 +1,11 @@
package org.jeecg.common.util;
import com.alibaba.druid.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
/**
* IP地址
*

View File

@ -0,0 +1,80 @@
package org.jeecg.common.util;
import lombok.extern.slf4j.Slf4j;
/**
* sql注入处理工具类
*
* @author zhoujf
*/
@Slf4j
public class SqlInjectionUtil {
final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
/**
* sql注入过滤处理遇到注入关键字抛异常
*
* @param value
* @return
*/
public static void filterContent(String value) {
if (value == null || "".equals(value)) {
return;
}
value = value.toLowerCase();// 统一转为小写
String[] xssArr = xssStr.split("\\|");
for (int i = 0; i < xssArr.length; i++) {
if (value.indexOf(xssArr[i]) > -1) {
log.error("请注意值可能存在SQL注入风险!---> {}", value);
throw new RuntimeException("请注意值可能存在SQL注入风险!--->" + value);
}
}
return;
}
/**
* sql注入过滤处理遇到注入关键字抛异常
*
* @param value
* @return
*/
public static void filterContent(String[] values) {
String[] xssArr = xssStr.split("\\|");
for (String value : values) {
if (value == null || "".equals(value)) {
return;
}
value = value.toLowerCase();// 统一转为小写
for (int i = 0; i < xssArr.length; i++) {
if (value.indexOf(xssArr[i]) > -1) {
log.error("请注意值可能存在SQL注入风险!---> {}", value);
throw new RuntimeException("请注意值可能存在SQL注入风险!--->" + value);
}
}
}
return;
}
/**
* @特殊方法(不通用) 仅用于字典条件SQL参数注入过滤
* @param value
* @return
*/
@Deprecated
public static void specialFilterContent(String value) {
String specialXssStr = "exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|+|,";
String[] xssArr = specialXssStr.split("\\|");
if (value == null || "".equals(value)) {
return;
}
value = value.toLowerCase();// 统一转为小写
for (int i = 0; i < xssArr.length; i++) {
if (value.indexOf(xssArr[i]) > -1) {
log.error("请注意值可能存在SQL注入风险!---> {}", value);
throw new RuntimeException("请注意值可能存在SQL注入风险!--->" + value);
}
}
return;
}
}

View File

@ -0,0 +1,124 @@
package org.jeecg.common.util.encryption;
import org.apache.shiro.codec.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
* AES 加密
*/
public class AesEncryptUtil {
//使用AES-128-CBC加密模式key需要为16位,key和iv可以相同
private static String KEY = EncryptedString.key;
private static String IV = EncryptedString.iv;
/**
* 加密方法
* @param data 要加密的数据
* @param key 加密key
* @param iv 加密iv
* @return 加密的结果
* @throws Exception
*/
public static String encrypt(String data, String key, String iv) throws Exception {
try {
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
int blockSize = cipher.getBlockSize();
byte[] dataBytes = data.getBytes();
int plaintextLength = dataBytes.length;
if (plaintextLength % blockSize != 0) {
plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
}
byte[] plaintext = new byte[plaintextLength];
System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
byte[] encrypted = cipher.doFinal(plaintext);
return new Base64().encodeToString(encrypted);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 解密方法
* @param data 要解密的数据
* @param key 解密key
* @param iv 解密iv
* @return 解密的结果
* @throws Exception
*/
public static String desEncrypt(String data, String key, String iv) throws Exception {
try {
byte[] encrypted1 = new Base64().decode(data);
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
byte[] original = cipher.doFinal(encrypted1);
String originalString = new String(original);
return originalString;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 使用默认的key和iv加密
* @param data
* @return
* @throws Exception
*/
public static String encrypt(String data) throws Exception {
return encrypt(data, KEY, IV);
}
/**
* 使用默认的key和iv解密
* @param data
* @return
* @throws Exception
*/
public static String desEncrypt(String data) throws Exception {
return desEncrypt(data, KEY, IV);
}
/**
* 测试
*/
public static void main(String args[]) throws Exception {
String test1 = "sa";
String test =new String(test1.getBytes(),"UTF-8");
String data = null;
String key = KEY;
String iv = IV;
// /g2wzfqvMOeazgtsUVbq1kmJawROa6mcRAzwG1/GeJ4=
data = encrypt(test, key, iv);
System.out.println("数据:"+test);
System.out.println("加密:"+data);
String jiemi =desEncrypt(data, key, iv).trim();
System.out.println("解密:"+jiemi);
}
}

View File

@ -0,0 +1,12 @@
package org.jeecg.common.util.encryption;
import lombok.Data;
@Data
public class EncryptedString {
public static String key = "1234567890adbcde";//长度为16个字符
public static String iv = "1234567890hjlkew";//长度为16个字符
}

View File

@ -0,0 +1,82 @@
package org.jeecg.common.util.jsonschema.validate;
import java.util.HashMap;
import java.util.Map;
import org.jeecg.common.util.jsonschema.CommonProperty;
import com.alibaba.fastjson.JSONObject;
/**
* 字典属性
* @author 86729
*
*/
public class DictProperty extends CommonProperty {
private static final long serialVersionUID = 3786503639885610767L;
//字典三属性
private String dictCode;
private String dictTable;
private String dictText;
public String getDictCode() {
return dictCode;
}
public void setDictCode(String dictCode) {
this.dictCode = dictCode;
}
public String getDictTable() {
return dictTable;
}
public void setDictTable(String dictTable) {
this.dictTable = dictTable;
}
public String getDictText() {
return dictText;
}
public void setDictText(String dictText) {
this.dictText = dictText;
}
public DictProperty() {}
/**
* 构造器
*/
public DictProperty(String key,String title,String dictTable,String dictCode,String dictText) {
this.type = "string";
this.view = "sel_search";
this.key = key;
this.title = title;
this.dictCode = dictCode;
this.dictTable= dictTable;
this.dictText= dictText;
}
@Override
public Map<String, Object> getPropertyJson() {
Map<String,Object> map = new HashMap<>();
map.put("key",getKey());
JSONObject prop = getCommonJson();
if(dictCode!=null) {
prop.put("dictCode",dictCode);
}
if(dictTable!=null) {
prop.put("dictTable",dictTable);
}
if(dictText!=null) {
prop.put("dictText",dictText);
}
map.put("prop",prop);
return map;
}
//TODO 重构问题:数据字典 只是字符串类的还是有存储的数值类型?只有字符串请跳过这个 只改前端
}

View File

@ -43,6 +43,8 @@ public class NumberProperty extends CommonProperty {
* 大于等于
*/
private Integer exclusiveMinimum;
private String pattern;
public Integer getMultipleOf() {
return multipleOf;
@ -83,6 +85,14 @@ public class NumberProperty extends CommonProperty {
public void setExclusiveMinimum(Integer exclusiveMinimum) {
this.exclusiveMinimum = exclusiveMinimum;
}
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
public NumberProperty() {}
@ -134,6 +144,9 @@ public class NumberProperty extends CommonProperty {
if(exclusiveMinimum!=null) {
prop.put("exclusiveMinimum",exclusiveMinimum);
}
if(pattern!=null) {
prop.put("pattern",pattern);
}
map.put("prop",prop);
return map;
}

View File

@ -22,6 +22,11 @@ public class StringProperty extends CommonProperty {
*/
private String pattern;
/**
* 错误提示信息
*/
private String errorInfo;
public Integer getMaxLength() {
return maxLength;
}
@ -46,6 +51,16 @@ public class StringProperty extends CommonProperty {
public void setPattern(String pattern) {
this.pattern = pattern;
}
public String getErrorInfo() {
return errorInfo;
}
public void setErrorInfo(String errorInfo) {
this.errorInfo = errorInfo;
}
public StringProperty() {}
@ -94,6 +109,9 @@ public class StringProperty extends CommonProperty {
if(pattern!=null) {
prop.put("pattern",pattern);
}
if(errorInfo!=null) {
prop.put("errorInfo",errorInfo);
}
map.put("prop",prop);
return map;
}

View File

@ -0,0 +1,92 @@
package org.jeecg.common.util.jsonschema.validate;
import java.util.HashMap;
import java.util.Map;
import org.jeecg.common.util.jsonschema.CommonProperty;
import com.alibaba.fastjson.JSONObject;
/**
* 字典属性
* @author 86729
*
*/
public class TreeSelectProperty extends CommonProperty {
private static final long serialVersionUID = 3786503639885610767L;
private String dict;//表名,文本,id
private String pidField;//父级字段 默认pid
private String pidValue;//父级节点的值 暂时没用到 默认为0
private String hasChildField;
public String getDict() {
return dict;
}
public void setDict(String dict) {
this.dict = dict;
}
public String getPidField() {
return pidField;
}
public void setPidField(String pidField) {
this.pidField = pidField;
}
public String getPidValue() {
return pidValue;
}
public void setPidValue(String pidValue) {
this.pidValue = pidValue;
}
public String getHasChildField() {
return hasChildField;
}
public void setHasChildField(String hasChildField) {
this.hasChildField = hasChildField;
}
public TreeSelectProperty() {}
/**
* 构造器
*/
public TreeSelectProperty(String key,String title,String dict,String pidField,String pidValue) {
this.type = "string";
this.view = "sel_tree";
this.key = key;
this.title = title;
this.dict = dict;
this.pidField= pidField;
this.pidValue= pidValue;
}
@Override
public Map<String, Object> getPropertyJson() {
Map<String,Object> map = new HashMap<>();
map.put("key",getKey());
JSONObject prop = getCommonJson();
if(dict!=null) {
prop.put("dict",dict);
}
if(pidField!=null) {
prop.put("pidField",pidField);
}
if(pidValue!=null) {
prop.put("pidValue",pidValue);
}
if(hasChildField!=null) {
prop.put("hasChildField",hasChildField);
}
map.put("prop",prop);
return map;
}
}

View File

@ -569,4 +569,23 @@ public class oConvertUtils {
fieldList.toArray(fields);
return fields;
}
/**
* 将map的key全部转成小写
* @param list
* @return
*/
public static List<Map<String, Object>> toLowerCasePageList(List<Map<String, Object>> list){
List<Map<String, Object>> select = new ArrayList<>();
for (Map<String, Object> row : list) {
Map<String, Object> resultMap = new HashMap<>();
Set<String> keySet = row.keySet();
for (String key : keySet) {
String newKey = key.toLowerCase();
resultMap.put(newKey, row.get(key));
}
select.add(resultMap);
}
return select;
}
}