diff --git b/.gitignore a/.gitignore
new file mode 100644
index 0000000..f9de1b9
--- /dev/null
+++ a/.gitignore
@@ -0,0 +1,11 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
+*.log
+/*/target/*
\ No newline at end of file
diff --git b/README.md a/README.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ a/README.md
diff --git b/fw-rp-common/pom.xml a/fw-rp-common/pom.xml
new file mode 100644
index 0000000..753282f
--- /dev/null
+++ a/fw-rp-common/pom.xml
@@ -0,0 +1,57 @@
+
+
+ 4.0.0
+
+
+ cn.fw
+ fw-rp
+ 1.0
+
+
+ fw-rp-common
+ jar
+ fw-rp-common
+
+
+
+
+ org.slf4j
+ slf4j-api
+ 1.6.4
+
+
+
+
+ com.google.zxing
+ core
+ 2.3.0
+
+
+
+
+ net.sf.json-lib
+ json-lib
+ jdk15
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.3.0
+
+
+ net.sf.json-lib
+ json-lib
+ jdk15
+ 2.3
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ commons-codec
+ commons-codec
+
+
+
\ No newline at end of file
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/constant/Constant.java a/fw-rp-common/src/main/java/cn/fw/rp/common/constant/Constant.java
new file mode 100644
index 0000000..648fecf
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/constant/Constant.java
@@ -0,0 +1,67 @@
+package cn.fw.rp.common.constant;
+
+/**
+ * @author 张志伟
+ * @date 2018-01-27 14:19
+ * @description
+ */
+public class Constant {
+
+ /**
+ * 产品名称:云通信隐私保护产品,开发者无需替换
+ */
+ public static final String PRODUCT = "Dyplsapi";
+ /**
+ * 营销活动消息通知 topic
+ */
+ public static final String MKT_PUBLISH_TITLE = "MKT_WS_MESSAGE";
+ /**
+ * 产品域名,开发者无需替换
+ */
+ public static final String DOMAIN = "dyplsapi.aliyuncs.com";
+ /**
+ * 访问ID
+ */
+ public static final String ACCESS_KEY_ID = "LTAIU865lo41xCTI";
+ /**
+ * 访问ID对应的KEY
+ */
+ public static final String ACCESS_KEY_SECRET = "C5ilXwesfPV9KtF1V74IQsaXMgR4wC";
+ /**
+ * 更新类型
+ */
+ public static final String A = "updateNoA";
+ public static final String B = "updateNoB";
+ public static final String T = "updateExpire";
+ /**
+ * 此处替换成您所需的消息类型名称
+ */
+ public static final String MESSAGE_TYPE = "SecretReport";
+ /**
+ * 在云通信页面开通相应业务消息后,就能在页面上获得对应的queueName
+ */
+ public static final String QUEUE_NAME = "Alicom-Queue-1294201731075657-SecretReport";
+ /**
+ * 成功的返回码
+ */
+ public static final String SUCCESS = "OK";
+
+ /**
+ * websocket config
+ */
+ public static class WebSocketConfig {
+ /**
+ * ws endpoint
+ */
+ public static final String WS_ENDPOINT = "marketing";
+ /**
+ * app destination prefix
+ */
+ public static final String APP_DESTINATION_PREFIX = "/app";
+ /**
+ * simple broker destination prefix
+ */
+ public static final String BROKER_DESTINATION_PREFIX = "/activity";
+
+ }
+}
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/enums/FileTypeEnums.java a/fw-rp-common/src/main/java/cn/fw/rp/common/enums/FileTypeEnums.java
new file mode 100644
index 0000000..fd19aec
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/enums/FileTypeEnums.java
@@ -0,0 +1,46 @@
+package cn.fw.rp.common.enums;
+
+/**
+ * @author suchu
+ * @since 2018/5/9 13:24
+ */
+public enum FileTypeEnums {
+ /**
+ * 图片
+ */
+ IMAGE(1, "图片"),
+
+ /**
+ * 视频
+ */
+ VIDEO(2, "视频"),
+
+ /**
+ * 文档
+ */
+ FILE(3, "附件");
+
+ private int type;
+ private String desc;
+
+ FileTypeEnums(int type, String desc) {
+ this.type = type;
+ this.desc = desc;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+}
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/util/AesUtil.java a/fw-rp-common/src/main/java/cn/fw/rp/common/util/AesUtil.java
new file mode 100644
index 0000000..3e634db
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/util/AesUtil.java
@@ -0,0 +1,208 @@
+package cn.fw.rp.common.util;
+
+import sun.misc.BASE64Decoder;
+import sun.misc.BASE64Encoder;
+
+import javax.crypto.*;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+/**
+ * Created with IntelliJ IDEA.
+ * Created By Devin
+ * Date: 2018/4/10
+ * Time: 17:14
+ * Description:
+ */
+public class AesUtil {
+
+ private final static String KEY = ")O[xfrs]6,YF}+efcaj{+oESb9d8>Zhy";
+ private final static String encoding = "UTF-8";
+
+ public static String aesDecrypt(String content) {
+ return decrypt(content, KEY);
+ }
+
+ public static String aesEncrypt(String content) {
+ return encryptAES(content, KEY);
+ }
+
+ /**
+ * AES加密
+ *
+ * @param content
+ * @param password
+ * @return
+ */
+ public static String encryptAES(String content, String password) {
+ byte[] encryptResult = encrypt(content, password);
+ String encryptResultStr = parseByte2HexStr(encryptResult);
+ // BASE64位加密
+ encryptResultStr = ebotongEncrypto(encryptResultStr);
+ return encryptResultStr;
+ }
+
+ /**
+ * AES解密
+ *
+ * @param encryptResultStr
+ * @param password
+ * @return
+ */
+ public static String decrypt(String encryptResultStr, String password) {
+ // BASE64位解密
+ String decrpt = ebotongDecrypto(encryptResultStr);
+ byte[] decryptFrom = parseHexStr2Byte(decrpt);
+ byte[] decryptResult = decrypt(decryptFrom, password);
+ return new String(decryptResult);
+ }
+
+ /**
+ * 加密字符串
+ */
+ public static String ebotongEncrypto(String str) {
+ BASE64Encoder base64encoder = new BASE64Encoder();
+ String result = str;
+ if (str != null && str.length() > 0) {
+ try {
+ byte[] encodeByte = str.getBytes(encoding);
+ result = base64encoder.encode(encodeByte);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ //base64加密超过一定长度会自动换行 需要去除换行符
+ return result.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
+ }
+
+ /**
+ * 解密字符串
+ */
+ public static String ebotongDecrypto(String str) {
+ BASE64Decoder base64decoder = new BASE64Decoder();
+ try {
+ byte[] encodeByte = base64decoder.decodeBuffer(str);
+ return new String(encodeByte);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return str;
+ }
+ }
+
+ /**
+ * 加密
+ *
+ * @param content 需要加密的内容
+ * @param password 加密密码
+ * @return
+ */
+ private static byte[] encrypt(String content, String password) {
+ try {
+ KeyGenerator kgen = KeyGenerator.getInstance("AES");
+ //防止linux下 随机生成key
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+ secureRandom.setSeed(password.getBytes());
+ kgen.init(128, secureRandom);
+ //kgen.init(128, new SecureRandom(password.getBytes()));
+ SecretKey secretKey = kgen.generateKey();
+ byte[] enCodeFormat = secretKey.getEncoded();
+ SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
+ Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+ byte[] byteContent = content.getBytes("utf-8");
+ cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
+ byte[] result = cipher.doFinal(byteContent);
+ return result; // 加密
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (NoSuchPaddingException e) {
+ e.printStackTrace();
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+ /**
+ * 解密
+ *
+ * @param content 待解密内容
+ * @param password 解密密钥
+ * @return
+ */
+ private static byte[] decrypt(byte[] content, String password) {
+ try {
+ KeyGenerator kgen = KeyGenerator.getInstance("AES");
+ //防止linux下 随机生成key
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+ secureRandom.setSeed(password.getBytes());
+ kgen.init(128, secureRandom);
+ //kgen.init(128, new SecureRandom(password.getBytes()));
+ SecretKey secretKey = kgen.generateKey();
+ byte[] enCodeFormat = secretKey.getEncoded();
+ SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
+ Cipher cipher = Cipher.getInstance("AES");// 创建密码器
+ cipher.init(Cipher.DECRYPT_MODE, key);// 初始化
+ byte[] result = cipher.doFinal(content);
+ return result; // 加密
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (NoSuchPaddingException e) {
+ e.printStackTrace();
+ } catch (InvalidKeyException e) {
+ e.printStackTrace();
+ } catch (IllegalBlockSizeException e) {
+ e.printStackTrace();
+ } catch (BadPaddingException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 将二进制转换成16进制
+ *
+ * @param buf
+ * @return
+ */
+ public static String parseByte2HexStr(byte buf[]) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < buf.length; i++) {
+ String hex = Integer.toHexString(buf[i] & 0xFF);
+ if (hex.length() == 1) {
+ hex = '0' + hex;
+ }
+ sb.append(hex.toUpperCase());
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ * 将16进制转换为二进制
+ *
+ * @param hexStr
+ * @return
+ */
+ public static byte[] parseHexStr2Byte(String hexStr) {
+ if (hexStr.length() < 1)
+ return null;
+ byte[] result = new byte[hexStr.length() / 2];
+ for (int i = 0; i < hexStr.length() / 2; i++) {
+ int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
+ int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
+ result[i] = (byte) (high * 16 + low);
+ }
+ return result;
+ }
+}
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/util/DateUtils.java a/fw-rp-common/src/main/java/cn/fw/rp/common/util/DateUtils.java
new file mode 100644
index 0000000..6f8a098
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/util/DateUtils.java
@@ -0,0 +1,725 @@
+package cn.fw.rp.common.util;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.ParsePosition;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 日期工具类
+ *
+ * @author luox
+ * @version 1.0
+ * @since 2018-04-16
+ */
+public final class DateUtils {
+
+ public static final long SECOND = 1000;
+
+ public static final long MINUTE = SECOND * 60;
+
+ public static final long HOUR = MINUTE * 60;
+
+ public static final long DAY = HOUR * 24;
+
+ public static final long WEEK = DAY * 7;
+
+ public static final long YEAR = DAY * 365;
+
+ public static final String FOMTER_TIMES = "yyyy-MM-dd HH:mm:ss";
+
+ private static final Map WEEK_DAY = new HashMap();
+ private static final Map DATE_FIELD = new HashMap();
+
+ static {
+ WEEK_DAY.put(7, "星期六");
+ WEEK_DAY.put(1, "星期天");
+ WEEK_DAY.put(2, "星期一");
+ WEEK_DAY.put(3, "星期二");
+ WEEK_DAY.put(4, "星期三");
+ WEEK_DAY.put(5, "星期四");
+ WEEK_DAY.put(6, "星期五");
+ }
+
+ static {
+ DATE_FIELD.put("y", Calendar.YEAR);
+ DATE_FIELD.put("M", Calendar.MONTH);
+ DATE_FIELD.put("d", Calendar.DATE);
+ DATE_FIELD.put("H", Calendar.HOUR);
+ DATE_FIELD.put("m", Calendar.MINUTE);
+ DATE_FIELD.put("s", Calendar.SECOND);
+ DATE_FIELD.put("w", Calendar.WEDNESDAY);
+ }
+
+ /**
+ * 解析日期
+ *
+ * @param date 日期字符串
+ * @param pattern 日期格式
+ * @return
+ */
+ public static Date parse(String date, String pattern) {
+ Date resultDate = null;
+ try {
+ resultDate = new SimpleDateFormat(pattern).parse(date);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return resultDate;
+ }
+
+ /**
+ * 解析日期 yyyy-MM-dd
+ *
+ * @param date 日期字符串
+ * @return
+ */
+ public static Timestamp parseSimple(String date) {
+ Date result = null;
+ try {
+ DateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
+ result = yyyyMMdd.parse(date);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return result != null ? new Timestamp(result.getTime()) : null;
+ }
+
+ /**
+ * 解析日期字符串
+ *
+ * @param date
+ * @return
+ */
+ public static Timestamp parseFull(String date) {
+ Date result = null;
+ try {
+ DateFormat yyyyMMddHHmmss = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss");
+ result = yyyyMMddHHmmss.parse(date);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return result != null ? new Timestamp(result.getTime()) : null;
+ }
+
+ /**
+ * 解析日期 yyyy-MM-dd
+ *
+ * @return
+ */
+ public static Timestamp parse(Object object) {
+ if (object instanceof Date) {
+ return new Timestamp(((Date) object).getTime());
+ }
+ if (StringUtils.isEmpty(object))
+ return null;
+ String date = StringUtils.asString(object);
+ try {
+ if (date.length() == 10) {
+ return parseSimple(date);
+ } else if (date.length() == 8) {
+ DateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd");
+ Date d = yyyyMMdd.parse(date);
+ return new Timestamp(d.getTime());
+ } else if (date.length() == 9) {
+ if (date.matches("\\d{4}-\\d-\\d{2}")) {//yyyy-M-dd
+ DateFormat yyyyMdd = new SimpleDateFormat("yyyy-M-dd");
+ Date d = yyyyMdd.parse(date);
+ return new Timestamp(d.getTime());
+ } else if (date.matches("\\d{4}-\\d{2}-\\d")) {//yyyy-MM-d
+ DateFormat yyyyMdd = new SimpleDateFormat("yyyy-MM-d");
+ Date d = yyyyMdd.parse(date);
+ return new Timestamp(d.getTime());
+ }
+ } else if (date.length() == 16) {//yyyy-MM-dd HH:mm
+ DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ Date d = format.parse(date);
+ return new Timestamp(d.getTime());
+ } else if (date.length() == 18) {//yyyy-MM-ddHH:mm:ss 医保返回日期可能出现
+ DateFormat format = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss");
+ Date d = format.parse(date);
+ return new Timestamp(d.getTime());
+ } else if (date.length() == 19) {//yyyy-MM-dd HH:mm:ss
+ return parseFull(date);
+ } else if (date.length() >= 20 && date.length() <= 23) {//yyyy-MM-dd HH:mm:ss.SSS
+ if (date.matches("\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}\\.\\d{1,3}")) {
+ DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ Date d = format.parse(date);
+ return new Timestamp(d.getTime());
+ }
+ } else {
+ return Timestamp.valueOf(object.toString());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 格式化日期字符串
+ *
+ * @param date 日期
+ * @param pattern 日期格式
+ * @return
+ */
+ public static String format(Date date, String pattern) {
+ if (date == null) {
+ return null;
+ }
+ DateFormat format = new SimpleDateFormat(pattern);
+ return format.format(date);
+ }
+
+ /**
+ * 格式化日期
+ *
+ * @param date
+ * @return yyyy年MM月dd日
+ */
+ public static String formatCHS(Date date) {
+ if (date == null) {
+ return null;
+ }
+ DateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
+ return format.format(date);
+ }
+
+ /**
+ * 格式化日期字符串
+ *
+ * @param date 日期
+ * @return
+ */
+ public static String format(Date date) {
+ if (date == null) {
+ return null;
+ }
+ DateFormat YYYY_MM_DD = new SimpleDateFormat("yyyy-MM-dd");
+ return YYYY_MM_DD.format(date);
+ }
+
+ /**
+ * 格式化日期
+ *
+ * @param date
+ * @return
+ */
+ public static String formatFull(Date date) {
+ DateFormat YYYY_MM_DD_HH_MM_SS = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss");
+ return YYYY_MM_DD_HH_MM_SS.format(date);
+ }
+
+ /**
+ * 取得当前日期
+ *
+ * @return
+ */
+ public static Timestamp getNow() {
+ return new Timestamp(System.currentTimeMillis());
+ }
+
+ /**
+ * 取得当前日期
+ *
+ * @return
+ */
+ public static Integer getNowYear() {
+ return getYear(getNow());
+ }
+
+ /**
+ * 取得当前月份
+ *
+ * @return
+ */
+ public static Integer getNowMonth() {
+ return getMonth(getNow());
+ }
+
+ /**
+ * 取得年度
+ *
+ * @param value
+ * @return
+ */
+ public static Integer getYear(Object value) {
+ Calendar c = Calendar.getInstance();
+ Date date = getDate(value);
+ c.setTime(date);
+ return c.get(Calendar.YEAR);
+ }
+
+ /**
+ * 取得月份
+ *
+ * @param value
+ * @return
+ */
+ public static Integer getMonth(Object value) {
+ Calendar c = Calendar.getInstance();
+ Date date = getDate(value);
+ c.setTime(date);
+ return c.get(Calendar.MONTH) + 1;
+ }
+
+ /**
+ * 取得日
+ *
+ * @param value
+ * @return
+ */
+ public static Integer getDay(Object value) {
+ Calendar c = Calendar.getInstance();
+ Date date = getDate(value);
+ c.setTime(date);
+ return c.get(Calendar.DAY_OF_MONTH);
+ }
+
+ /**
+ * 取得日期对象
+ *
+ * @param value
+ * @return
+ */
+ private static Date getDate(Object value) {
+ Date date = null;
+ if (value instanceof Date) {
+ date = (Date) value;
+ } else {
+ date = parse((String) value);
+ }
+ if (date == null) {
+ throw new RuntimeException("日期格式解析错误!date=" + value);
+ }
+ return date;
+ }
+
+ /**
+ * 取得年龄
+ *
+ * @param value
+ * @return
+ */
+ @SuppressWarnings("all")
+ public static Integer getAge(Object value) {
+ Timestamp date = DateUtils.parse(value);
+ if (date == null) {
+ return null;
+ }
+ Timestamp now = DateUtils.getNow();
+ int year1 = date.getYear(), year2 = now.getYear();
+ int month1 = date.getMonth(), month2 = now.getMonth();
+ int date1 = date.getDate(), date2 = now.getDate();
+ int months = (year2 - year1) * 12 + month2 - month1;
+ if (date1 > date2) {
+ months = months - 1;
+ }
+ int age = months / 12;
+ return age;
+ }
+
+ /**
+ * @param offsetYear
+ * @return 当前时间 + offsetYear
+ */
+ public static Timestamp getNowExpiredYear(int offsetYear) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.YEAR, offsetYear);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offset
+ * @return 当前时间 + offsetMonth
+ */
+ public static Timestamp getNowExpiredMonth(int offset) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.MONTH, offset);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offset
+ * @return 当前时间 + offsetDay
+ */
+ public static Timestamp getNowExpiredDay(int offset) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.DATE, offset);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offset
+ * @return 当前时间 + offsetDay
+ */
+ public static Timestamp getNowExpiredHour(int offset) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.HOUR, offset);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offsetSecond
+ * @return 当前时间 + offsetSecond
+ */
+ public static Timestamp getNowExpiredSecond(int offsetSecond) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.SECOND, offsetSecond);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offset
+ * @return 当前时间 + offset
+ */
+ public static Timestamp getNowExpiredMinute(int offset) {
+ Calendar now = Calendar.getInstance();
+ now.add(Calendar.MINUTE, offset);
+ return new Timestamp(now.getTime().getTime());
+ }
+
+ /**
+ * @param offset
+ * @return 指定时间 + offsetDay
+ */
+ public static Timestamp getExpiredDay(Date givenDate, int offset) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(Calendar.DATE, offset);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * 实现ORACLE中ADD_MONTHS函数功能
+ *
+ * @param offset
+ * @return 指定时间 + offsetMonth
+ */
+ public static Timestamp getExpiredMonth(Date givenDate, int offset) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(Calendar.MONTH, offset);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * @param offsetSecond
+ * @return 指定时间 + offsetSecond
+ */
+ public static Timestamp getExpiredYear(Date givenDate, int offsetHour) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(Calendar.YEAR, offsetHour);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * @param second
+ * @return 指定时间 + offsetSecond
+ */
+ public static Timestamp getExpiredSecond(Date givenDate, int second) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(Calendar.SECOND, second);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * 计算时间差
+ *
+ * @param givenDate 日期
+ * @param offset 2
+ * @param type 日期字段类型
+ * @return
+ */
+ public static Timestamp getExpired(Date givenDate, int offset, Integer type) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(type, offset);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * 根据日期取得日历
+ *
+ * @param date
+ * @return
+ */
+ public static Calendar getCalendar(Date date) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ return c;
+ }
+
+ /**
+ * @param offsetSecond
+ * @return 指定时间 + offsetSecond
+ */
+ public static Timestamp getExpiredHour(Date givenDate, int offsetHour) {
+ Calendar date = Calendar.getInstance();
+ date.setTime(givenDate);
+ date.add(Calendar.HOUR, offsetHour);
+ return new Timestamp(date.getTime().getTime());
+ }
+
+ /**
+ * @return 给出指定日期的月份的第一天
+ */
+ public static Date getMonthFirstDay(Date givenDate) {
+ Date date = DateUtils.parse(DateUtils.format(givenDate, "yyyy-MM"),
+ "yyyy-MM");
+ return date;
+ }
+
+ /**
+ * 取得当前是周几?
+ *
+ * @param givenDate
+ * @return
+ */
+ public static int getDayOfWeek(Date givenDate) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(givenDate);
+ int day = c.get(Calendar.DAY_OF_WEEK);
+ return day;
+ }
+
+ /**
+ * 取得中文星期?
+ *
+ * @param dayOfWeek
+ * @return
+ */
+ public static String getChineseDayOfWeek(int dayOfWeek) {
+ return WEEK_DAY.get(dayOfWeek);
+ }
+
+ /**
+ * 给定日期是否在范围内
+ *
+ * @param date 给定日期
+ * @param begin 开始日期
+ * @param end 结束日期
+ * @return true 在指定范围内
+ */
+ public static Boolean between(Date date, Date begin, Date end) {
+ if (date == null || begin == null || end == null) {
+ return true;
+ }
+ return date.after(begin) && date.before(end);
+ }
+
+ /**
+ * 当前日期是否在范围内
+ *
+ * @param begin 开始日期
+ * @param end 结束日期
+ * @return true 在指定范围内
+ */
+ public static Boolean between(Date begin, Date end) {
+ Date now = getNow();
+ return between(now, begin, end);
+ }
+
+ /**
+ * 取得今天零点日期
+ *
+ * @return
+ */
+ public static Calendar getTodayZero() {
+ Calendar c = Calendar.getInstance();
+ c.set(Calendar.HOUR_OF_DAY, 0);
+ c.set(Calendar.MINUTE, 0);
+ c.set(Calendar.SECOND, 0);
+ c.set(Calendar.MILLISECOND, 0);
+ return c;
+ }
+
+ /**
+ * 是否是日期格式
+ *
+ * @param value
+ * @return
+ */
+ public static boolean isDate(String value) {
+ return parse(value) != null;
+ }
+
+ /**
+ *
+ * Parses a string representing a date by trying a variety of different
+ * parsers.
+ *
+ *
+ *
+ * The parse will try each parse pattern in turn. A parse is only deemed
+ * sucessful if it parses the whole of the input string. If no parse
+ * patterns match, a ParseException is thrown.
+ *
+ *
+ * @param str the date to parse, not null
+ * @param parsePatterns the date format patterns to use, see SimpleDateFormat, not
+ * null
+ * @return the parsed date
+ * @throws IllegalArgumentException if the date string or pattern array is null
+ * @throws ParseException if none of the date patterns were suitable
+ */
+ public static Date parseDate(String str, String[] parsePatterns)
+ throws ParseException {
+ if (str == null || parsePatterns == null) {
+ throw new IllegalArgumentException(
+ "Date and Patterns must not be null");
+ }
+ SimpleDateFormat parser = null;
+ ParsePosition pos = new ParsePosition(0);
+ for (int i = 0; i < parsePatterns.length; i++) {
+ if (i == 0) {
+ parser = new SimpleDateFormat(parsePatterns[0]);
+ } else {
+ parser.applyPattern(parsePatterns[i]);
+ }
+ pos.setIndex(0);
+ Date date = parser.parse(str, pos);
+ if (date != null && pos.getIndex() == str.length()) {
+ return date;
+ }
+ }
+ throw new ParseException("Unable to parse the date: " + str, -1);
+ }
+
+ /**
+ * 取得java.sql.Date
+ *
+ * @param value
+ * @return
+ */
+ public static java.sql.Date getSqlDate(Object value) {
+ if (value == null) {
+ return null;
+ }
+ if (value instanceof Date) {
+ return new java.sql.Date(((Date) value).getTime());
+ } else if (value instanceof String) {
+ Timestamp date = parse((String) value);
+ return date != null ? new java.sql.Date(date.getTime()) : null;
+ }
+ return null;
+ }
+
+
+ /**
+ * 计算日期表达式
+ *
+ * @return
+ */
+ public static Date getExpired(Object givenDate, String off) {
+ Date date = null;
+ if (givenDate instanceof Date) {
+ date = (Date) givenDate;
+ } else {
+ date = parse(StringUtils.asString(givenDate));
+ }
+ String op = String.valueOf(off.charAt(0));
+ int offset = Integer.parseInt(String.valueOf(off.charAt(1)));
+ String type = String.valueOf(off.charAt(2));
+ Date result = null;
+ int dateField = DATE_FIELD.get(type);
+ if (op.equals("+")) {
+ result = DateUtils.getExpired(date, +offset, dateField);
+ } else if (op.equals("-")) {
+ result = DateUtils.getExpired(date, -offset, dateField);
+ }
+ return result;
+ }
+
+ /**
+ * 计算日期表达式
+ *
+ * @param expr today + 1d 或 2014-06-29 + 1d
+ * @return
+ */
+ public static Date eval(String expr) {
+ expr = expr.trim();
+ if (expr.equals("today") || expr.equals("now")) {
+ return getNow();
+ }
+ String EXPR = "(.+)\\s*(\\+|\\-)\\s*(\\w+)";
+ String p1 = expr.replaceAll(EXPR, "$1").trim();
+ String p2 = expr.replaceAll(EXPR, "$2").trim();
+ String p3 = expr.replaceAll(EXPR, "$3").trim();
+ Date date = null;
+ if (p1.equals("today")) {
+ date = getNow();
+ } else {
+ p1 = p1.replace("'", "").trim();
+ date = parse(p1);
+ }
+ Date result = null;
+ result = getExpired(date, p2 + p3);
+ return result;
+ }
+
+ /**
+ * 计算日期差
+ *
+ * @param a 日期A
+ * @param b 日期B
+ * @param type 类型
+ * @return 计算结果
+ */
+ public static Integer sub(Object a, Object b, String type) {
+ Date d1 = parse(a);//开始日期
+ Date d2 = parse(b);//截止日期
+ if (d1 == null || d2 == null) {
+ return null;
+ }
+ Long result = null;
+ long DAY = 24 * 60 * 60 * 1000;
+ long sub = d1.getTime() - d2.getTime();
+ long daysub = (sub / DAY);
+ long y1 = d1.getYear(), y2 = d2.getYear();
+ long m1 = d1.getMonth(), m2 = d2.getMonth();
+ long monthsub = (y1 - y2) * 12 + (m1 - m2);
+ if (type.equals("m")) {//月
+ result = monthsub;
+ } else if (type == "y") {//年
+ result = monthsub / 12;
+ } else if (type.equals("d")) {//天
+ result = daysub;
+ }
+ return Integer.valueOf(result.intValue());
+ }
+
+ public static void main(String[] args) {
+ System.out.println(getYear(new Date()));
+ System.out.println(getMonth(new Date()));
+ System.out.println(eval("today + 1d"));
+ System.out.println(eval("today - 1d"));
+ System.out.println(eval("today + 1M"));
+ System.out.println(eval("today - 1M"));
+ System.out.println(eval("today + 1y"));
+ System.out.println(eval("today - 1y"));
+
+ System.out.println(eval("2014-06-29 + 1d"));
+ System.out.println(eval("2014-06-29 - 1d"));
+ System.out.println(eval("2014-06-29 + 1M"));
+ System.out.println(eval("2014-06-29 - 1M"));
+ System.out.println(eval("2014-06-29 + 1y"));
+ System.out.println(eval("2014-06-29 - 1y"));
+ System.out.println(eval("2014-06-29 - 1w"));
+ System.out.println(getExpired(new Date(), "-1M"));
+ String now = DateUtils.getNow().toString();
+ System.out.println(now + "=" + now + " parse=" + parse(now) + "");
+ System.out.println(sub("2014-07-30", "2013-06-29", "d"));
+ System.out.println(getAge("1982-09-29"));
+ System.out.println(parse("2015-03-2519:35:21"));
+ }
+}
\ No newline at end of file
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/util/PublicUtil.java a/fw-rp-common/src/main/java/cn/fw/rp/common/util/PublicUtil.java
new file mode 100644
index 0000000..274e6c8
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/util/PublicUtil.java
@@ -0,0 +1,591 @@
+package cn.fw.rp.common.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Created with IntelliJ IDEA
+ * Created By Devin
+ * Date: 2018/4/3
+ * Time: 17:22
+ * Description: 通用工具类
+ */
+public class PublicUtil {
+ public static final String DATA_FORMAT = "yyyy-MM-dd";
+ public static final String DATA_FORMAT_CLEAR = "yyyyMMdd";
+ public static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ public static final String TIME_FORMAT_S = "yyyy-MM-dd HH:mm:ss.sss";
+ protected static Logger logger = LoggerFactory.getLogger(PublicUtil.class);
+
+ public PublicUtil() {
+ }
+
+ public static String toShowHtml(String str) {
+ if (str == null) {
+ return null;
+ } else {
+ String html = new String(str);
+ html = replace(html, "&", "&");
+ html = replace(html, "<", "<");
+ html = replace(html, ">", ">");
+ html = replace(html, """, "\"");
+ html = replace(html, " ", "\n");
+ return html;
+ }
+ }
+
+ public static Boolean containsStr(String source, String str) {
+ return Boolean.valueOf(isNotEmpty(source) && source.contains(str));
+ }
+
+ public static int getLength(String text) {
+ int textLength = text.length();
+ int length = textLength;
+
+ for (int i = 0; i < textLength; ++i) {
+ if (String.valueOf(text.charAt(i)).getBytes().length > 1) {
+ ++length;
+ }
+ }
+
+ return length % 2 == 0 ? length / 2 : length / 2 + 1;
+ }
+
+ public static String subMaxString(String str, Integer length) {
+ if (isNotEmpty(str) && str.length() > length.intValue()) {
+ Integer realLength = Integer.valueOf(0);
+ Integer len = Integer.valueOf(str.length());
+
+ for (int i = 0; i < len.intValue(); ++i) {
+ if (String.valueOf(str.charAt(i)).getBytes().length > 1) {
+ realLength = Integer.valueOf(realLength.intValue() + 2);
+ } else {
+ realLength = Integer.valueOf(realLength.intValue() + 1);
+ }
+
+ if (realLength.intValue() > length.intValue()) {
+ str = toAppendStr(new Object[]{replaceBlank(str).substring(0, i), "..."});
+ break;
+ }
+ }
+ }
+
+ return str;
+ }
+
+ public static String replaceBlank(String str) {
+ String dest = "";
+ if (isNotEmpty(str)) {
+ Pattern p = Pattern.compile("\\s*|\t|\r|\n");
+ Matcher m = p.matcher(str);
+ dest = m.replaceAll("");
+ }
+
+ return dest;
+ }
+
+ public static String replace(String source, String oldString, String newString) {
+ StringBuffer output = new StringBuffer();
+ if (!source.equals("") && source != null) {
+ int lengthOfSource = source.length();
+ int lengthOfOld = oldString.length();
+
+ int posStart;
+ int pos;
+ for (posStart = 0; (pos = source.indexOf(oldString, posStart)) >= 0; posStart = pos + lengthOfOld) {
+ output.append(source.substring(posStart, pos));
+ output.append(newString);
+ }
+
+ if (posStart < lengthOfSource) {
+ output.append(source.substring(posStart));
+ }
+
+ return output.toString();
+ } else {
+ return "";
+ }
+ }
+
+ public static String getAuthorizeURLBase(String url, String appId, String componentAppId) {
+// url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId
+// + "&redirect_uri=" + url
+// + "&response_type=code"
+// + "&scope=snsapi_userinfo"
+// + "&component_appid=" + componentAppId
+// + "&state=123#wechat_redirect";
+ url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId
+ + "&redirect_uri=" + url
+ + "&response_type=code"
+ + "&scope=snsapi_userinfo"
+ + "&state=123"
+ + "&component_appid=" + componentAppId
+ + "&connect_redirect=1#wechat_redirect";
+ return url;
+ }
+
+ public static String getUrlEncode(String url) {
+ try {
+ url = URLEncoder.encode(url, "utf-8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return url;
+ }
+
+ public static String replaceAll(String str, String oldStr, String newStr) {
+ int length = str.indexOf(oldStr);
+ int j = 0;
+
+ for (String temp = ""; length != -1; length = str.indexOf(oldStr)) {
+ ++j;
+ if (j == 10) {
+ break;
+ }
+
+ temp = str.substring(length + 1);
+ str = str.substring(0, length);
+ str = str + newStr + temp;
+ }
+
+ return str;
+ }
+
+ public static int parseInt(Object value, Integer defaultValue) {
+ try {
+ return Integer.parseInt(String.valueOf(value));
+ } catch (Exception var3) {
+ return defaultValue.intValue();
+ }
+ }
+
+ public static long parseLong(Object value, Long defaultValue) {
+ try {
+ return Long.parseLong(String.valueOf(value));
+ } catch (Exception var3) {
+ return defaultValue.longValue();
+ }
+ }
+
+ public static Date parseDate(Object date) {
+ return parseDate(String.valueOf(date));
+ }
+
+ public static Date parseDate(String date) {
+ try {
+ SimpleDateFormat ex = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return ex.parse(date);
+ } catch (Exception var2) {
+ return null;
+ }
+ }
+
+ public static Date parseDate(String date, String format) {
+ try {
+ SimpleDateFormat ex = new SimpleDateFormat(format);
+ return ex.parse(date);
+ } catch (Exception var3) {
+ return null;
+ }
+ }
+
+ public static String parseString(Object value, String defaultValue) {
+ return null != value && !"null".equals(String.valueOf(value).toLowerCase()) ? String.valueOf(value) : defaultValue;
+ }
+
+ public static String getCurrentTime() {
+ return getCurrentTime("yyyy-MM-dd HH:mm:ss");
+ }
+
+ public static Date getCurrentDate() {
+ return new Date();
+ }
+
+ public static String getCurrentTime(String format) {
+ Date nowTime = new Date();
+ SimpleDateFormat fmt = new SimpleDateFormat(format);
+ return fmt.format(nowTime);
+ }
+
+ public static String getMySQLDateTimeFormat() {
+ return "yyyy-MM-dd HH:mm:ss";
+ }
+
+ public static String fmtDate(Date date, String fmt) {
+ if (null == date) {
+ return "";
+ } else {
+ SimpleDateFormat f = new SimpleDateFormat(fmt);
+ return f.format(date);
+ }
+ }
+
+ public static String fmtDate(Date date) {
+ if (null == date) {
+ return "";
+ } else {
+ SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return f.format(date);
+ }
+ }
+
+ /**
+ * 转换为时间(天,时:分:秒.毫秒)
+ *
+ * @param timeMillis
+ * @return
+ */
+ public static String formatDateTime(long timeMillis) {
+ long day = timeMillis / (24 * 60 * 60 * 1000);
+ long hour = (timeMillis / (60 * 60 * 1000) - day * 24);
+ long min = ((timeMillis / (60 * 1000)) - day * 24 * 60 - hour * 60);
+ long s = (timeMillis / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+ long sss = (timeMillis - day * 24 * 60 * 60 * 1000 - hour * 60 * 60 * 1000 - min * 60 * 1000 - s * 1000);
+ return (day > 0 ? day + "," : "") + hour + ":" + min + ":" + s + "." + sss;
+ }
+
+ public static String nextId() {
+ return UUID.randomUUID().toString().replaceAll("-", "");
+ }
+
+ public static String getUUID() {
+ String uid = "0";
+ SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+ String tempId = sf.format(new Date());
+ if (Long.parseLong(uid) >= Long.parseLong(tempId)) {
+ uid = Long.parseLong(uid) + 1L + "";
+ } else {
+ uid = tempId;
+ }
+
+ return uid + getRandomString(10);
+ }
+
+ public static String getRandomString(int size) {
+ char[] c = new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'};
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < size; ++i) {
+ sb.append(c[Math.abs(random.nextInt()) % c.length]);
+ }
+
+ return sb.toString();
+ }
+
+ public static String getRandomNumber(int size) {
+ char[] c = new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < size; ++i) {
+ sb.append(c[Math.abs(random.nextInt()) % c.length]);
+ }
+
+ return sb.toString();
+ }
+
+ public static boolean isNotEmpty(Object obj) {
+ return !isEmpty(obj);
+ }
+
+ public static boolean isEmpty(Object obj) {
+ if (obj == null) {
+ return true;
+ } else if (obj instanceof String) {
+ return obj.equals("");
+ } else if (obj instanceof Collection) {
+ Collection map1 = (Collection) obj;
+ return map1.size() == 0;
+ } else if (obj instanceof Map) {
+ Map map = (Map) obj;
+ return map.size() == 0;
+ } else {
+ return obj.getClass().isArray() ? Array.getLength(obj) == 0 : false;
+ }
+ }
+
+ // 获取随机字符串
+ public static String getNonceStr() {
+ String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ String res = "";
+ for (int i = 0; i < 16; i++) {
+ Random rd = new Random();
+ res += chars.charAt(rd.nextInt(chars.length() - 1));
+ }
+ return res;
+ }
+
+ public static boolean isDigitalString(String str) {
+ if (isEmpty(str)) {
+ return false;
+ } else {
+ try {
+ Double.parseDouble(str);
+ return true;
+ } catch (Exception var2) {
+ return false;
+ }
+ }
+ }
+
+ public static boolean equalsFlag(Object str) {
+ try {
+ if (str != null && "true".equals(str)) {
+ return true;
+ }
+ } catch (Exception var2) {
+ var2.printStackTrace();
+ }
+
+ return false;
+ }
+
+ public static boolean isNumeric(String str) {
+ try {
+ return str != null && str.matches("\\d*.?\\d*");
+ } catch (Exception var2) {
+ var2.printStackTrace();
+ return false;
+ }
+ }
+
+ public static int arrayIndexOf(Object array, Object value) {
+ if (array != null && value != null) {
+ int len = Array.getLength(array);
+
+ for (int i = 0; i < len; ++i) {
+ if (value.equals(Array.get(array, i))) {
+ return i;
+ }
+ }
+
+ return -1;
+ } else {
+ return -1;
+ }
+ }
+
+ public static String toUtf8String(String s) {
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < s.length(); ++i) {
+ char c = s.charAt(i);
+ if (c >= 0 && c <= 255) {
+ sb.append(c);
+ } else {
+ byte[] b;
+ try {
+ b = Character.toString(c).getBytes("utf-8");
+ } catch (Exception var7) {
+ var7.printStackTrace();
+ b = new byte[0];
+ }
+
+ for (int j = 0; j < b.length; ++j) {
+ int k = b[j];
+ if (k < 0) {
+ k += 256;
+ }
+
+ sb.append("%" + Integer.toHexString(k).toUpperCase());
+ }
+ }
+ }
+
+ return sb.toString();
+ }
+
+ public static String sicenToComm(Object value) {
+ return value == null ? null : (value instanceof Double ? sicenToCommDouble(((Double) value).doubleValue()) : String.valueOf(value));
+ }
+
+ public static String sicenToCommDouble(double value) {
+ String retValue = null;
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumFractionDigits(0);
+ df.setMaximumFractionDigits(5);
+ retValue = df.format(value);
+ retValue = retValue.replaceAll(",", "");
+ return retValue;
+ }
+
+ public static String roundStr(Double value) {
+ DecimalFormat df = new DecimalFormat("#.00");
+ return df.format(value);
+ }
+
+ public static Double round(Double value, int count) {
+ try {
+ BigDecimal e = new BigDecimal(value.doubleValue());
+ return Double.valueOf(e.setScale(count, 4).doubleValue());
+ } catch (Exception var3) {
+ logger.warn("round double" + value);
+ return Double.valueOf(0.0D);
+ }
+ }
+
+ public static Double round(Object value, int count) {
+ return round(parseDouble(value), count);
+ }
+
+ public static Double parseDouble(Object value) {
+ return value == null ? Double.valueOf(0.0D) : parseDouble(String.valueOf(value));
+ }
+
+ public static Double parseDouble(String value) {
+ return parseDouble(value, Double.valueOf(0.0D));
+ }
+
+ public static Double parseDouble(String value, Double dafualtVal) {
+ Double r = dafualtVal;
+
+ try {
+ if (value != null) {
+ value = value.trim();
+ if (value.endsWith("%")) {
+ value = value.substring(0, value.length() - 1);
+ }
+
+ r = Double.valueOf(Double.parseDouble(value));
+ }
+ } catch (Exception var4) {
+ logger.warn("转换失败:" + var4.getMessage());
+ }
+
+ return r;
+ }
+
+ public static String toLowerCaseFirstOne(String s) {
+ return Character.isLowerCase(s.charAt(0)) ? s : Character.toLowerCase(s.charAt(0)) + s.substring(1);
+ }
+
+ public static String toUpperCaseFirstOne(String s) {
+ return Character.isUpperCase(s.charAt(0)) ? s : Character.toUpperCase(s.charAt(0)) + s.substring(1);
+ }
+
+ public static String toAppendStr(Object... strs) {
+ StringBuffer sb = new StringBuffer();
+ Object[] var2 = strs;
+ int var3 = strs.length;
+
+ for (int var4 = 0; var4 < var3; ++var4) {
+ Object str = var2[var4];
+ if (isNotEmpty(str)) {
+ sb.append(str);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ public static boolean match(String pattern, String str) {
+ Pattern p = Pattern.compile(pattern);
+ Matcher m = p.matcher(str);
+ return m.find();
+ }
+
+ public static String toStrString(Object obj) {
+ return isNotEmpty(obj) ? String.valueOf(obj) : "";
+ }
+
+ public static String toStrStringNull(Object obj) {
+ return isNotEmpty(obj) ? String.valueOf(obj) : null;
+ }
+
+ public static Object fmtDate(ZonedDateTime val, String format) {
+ return val == null ? null : val.format(DateTimeFormatter.ofPattern(format));
+ }
+
+ public static Object fmtDate(ZonedDateTime val) {
+ return fmtDate(val, "yyyy-MM-dd HH:mm:ss");
+ }
+
+ public static String getRandomBsString(int length) {
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < length; i++) {
+ int number = random.nextInt(62);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 将字符串进行sha1加密
+ *
+ * @param str 需要加密的字符串
+ * @return 加密后的内容
+ */
+ public static String sha1(String str) {
+ try {
+ MessageDigest digest = MessageDigest.getInstance("SHA-1");
+ digest.update(str.getBytes());
+ byte messageDigest[] = digest.digest();
+ // Create Hex String
+ StringBuffer hexString = new StringBuffer();
+ // 字节数组转换为 十六进制 数
+ for (int i = 0; i < messageDigest.length; i++) {
+ String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
+ if (shaHex.length() < 2) {
+ hexString.append(0);
+ }
+ hexString.append(shaHex);
+ }
+ return hexString.toString();
+
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ public static boolean isBlank(CharSequence cs) {
+ int strLen;
+ if (cs != null && (strLen = cs.length()) != 0) {
+ for (int i = 0; i < strLen; ++i) {
+ if (!Character.isWhitespace(cs.charAt(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ } else {
+ return true;
+ }
+ }
+
+ public static boolean isNotBlank(CharSequence cs) {
+ return !isBlank(cs);
+ }
+
+ /**
+ * 替换掉HTML标签方法
+ */
+ public static String replaceHtml(String html) {
+ if (isBlank(html)) {
+ return "";
+ }
+ String regEx = "<.+?>";
+ Pattern p = Pattern.compile(regEx);
+ Matcher m = p.matcher(html);
+ String s = m.replaceAll("");
+ return s;
+ }
+}
+
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/util/QRCodeKit.java a/fw-rp-common/src/main/java/cn/fw/rp/common/util/QRCodeKit.java
new file mode 100644
index 0000000..979cdec
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/util/QRCodeKit.java
@@ -0,0 +1,290 @@
+package cn.fw.rp.common.util;
+
+import com.google.zxing.*;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.codec.binary.Base64OutputStream;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * QrCodeKit
+ *
+ * @author https://www.jianshu.com/p/39c5bca32e3e
+ */
+public class QRCodeKit {
+
+ public static final String QRCODE_DEFAULT_CHARSET = "UTF-8";
+
+ public static final int QRCODE_DEFAULT_HEIGHT = 150;
+
+ public static final int QRCODE_DEFAULT_WIDTH = 150;
+
+ private static final int BLACK = 0xFF000000;
+ private static final int WHITE = 0xFFFFFFFF;
+
+ public static void main(String[] args) throws IOException, NotFoundException {
+ String data = "当然是测试的二维码啊";
+ File logoFile = new File("C:\\Users\\suchu\\Pictures\\erha_hd.jpg");
+ BufferedImage image = QRCodeKit.createQRCodeWithLogo(data, logoFile);
+ String base64Str = QRCodeKit.getImageBase64String(image);
+ System.out.println(base64Str);
+ ImageIO.write(image, "png", new File("result_with_logo.png"));
+ System.out.println("done");
+ }
+
+ /**
+ * Create qrcode with default settings
+ *
+ * @param data
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCode(String data) {
+ return createQRCode(data, QRCODE_DEFAULT_WIDTH, QRCODE_DEFAULT_HEIGHT);
+ }
+
+ /**
+ * Create qrcode with default charset
+ *
+ * @param data
+ * @param width
+ * @param height
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCode(String data, int width, int height) {
+ return createQRCode(data, QRCODE_DEFAULT_CHARSET, width, height);
+ }
+
+ /**
+ * Create qrcode with specified charset
+ *
+ * @param data
+ * @param charset
+ * @param width
+ * @param height
+ * @return
+ * @author stefli
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public static BufferedImage createQRCode(String data, String charset, int width, int height) {
+ Map hint = new HashMap();
+ hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+ hint.put(EncodeHintType.CHARACTER_SET, charset);
+
+ return createQRCode(data, charset, hint, width, height);
+ }
+
+ /**
+ * Create qrcode with specified hint
+ *
+ * @param data
+ * @param charset
+ * @param hint
+ * @param width
+ * @param height
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCode(String data, String charset, Map hint, int width,
+ int height) {
+ BitMatrix matrix;
+ try {
+ matrix = new MultiFormatWriter().encode(new String(data.getBytes(charset), charset), BarcodeFormat.QR_CODE,
+ width, height, hint);
+ return toBufferedImage(matrix);
+ } catch (WriterException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+
+ public static BufferedImage toBufferedImage(BitMatrix matrix) {
+ int width = matrix.getWidth();
+ int height = matrix.getHeight();
+ BufferedImage image = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_RGB);
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
+ }
+ }
+ return image;
+ }
+
+ /**
+ * Create qrcode with default settings and logo
+ *
+ * @param data
+ * @param logoFile
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCodeWithLogo(String data, File logoFile) {
+ return createQRCodeWithLogo(data, QRCODE_DEFAULT_WIDTH, QRCODE_DEFAULT_HEIGHT, logoFile);
+ }
+
+ /**
+ * Create qrcode with default charset and logo
+ *
+ * @param data
+ * @param width
+ * @param height
+ * @param logoFile
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCodeWithLogo(String data, int width, int height, File logoFile) {
+ return createQRCodeWithLogo(data, QRCODE_DEFAULT_CHARSET, width, height, logoFile);
+ }
+
+ /**
+ * Create qrcode with specified charset and logo
+ *
+ * @param data
+ * @param charset
+ * @param width
+ * @param height
+ * @param logoFile
+ * @return
+ * @author stefli
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public static BufferedImage createQRCodeWithLogo(String data, String charset, int width, int height, File logoFile) {
+ Map hint = new HashMap();
+ hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
+ hint.put(EncodeHintType.CHARACTER_SET, charset);
+
+ return createQRCodeWithLogo(data, charset, hint, width, height, logoFile);
+ }
+
+ /**
+ * Create qrcode with specified hint and logo
+ *
+ * @param data
+ * @param charset
+ * @param hint
+ * @param width
+ * @param height
+ * @param logoFile
+ * @return
+ * @author stefli
+ */
+ public static BufferedImage createQRCodeWithLogo(String data, String charset, Map hint,
+ int width, int height, File logoFile) {
+ try {
+ BufferedImage qrcode = createQRCode(data, charset, hint, width, height);
+
+ Graphics2D g = qrcode.createGraphics();
+ BufferedImage logo = ImageIO.read(logoFile);
+ //logo最大宽度为二维码宽度的20%
+ int widthLogo = logo.getWidth(null) > qrcode.getWidth() * 2 / 10 ?
+ (qrcode.getWidth() * 2 / 10) : logo.getWidth(null);
+ int heightLogo = logo.getHeight(null) > qrcode.getHeight() * 2 / 10 ?
+ (qrcode.getHeight() * 2 / 10) : logo.getHeight(null);
+ int x = (qrcode.getWidth() - widthLogo) / 2;
+ int y = (qrcode.getHeight() - heightLogo) / 2;
+
+ // 开始绘制图片
+ g.drawImage(logo, x, y, widthLogo, heightLogo, null);
+ g.drawRoundRect(x, y, widthLogo, heightLogo, 15, 15);
+ //边框宽度
+ g.setStroke(new BasicStroke(2));
+ //边框颜色
+ g.setColor(Color.WHITE);
+ g.drawRect(x, y, widthLogo, heightLogo);
+ g.dispose();
+ logo.flush();
+ qrcode.flush();
+ return qrcode;
+ /* BufferedImage logo = ImageIO.read(logoFile);
+ int deltaHeight = height - logo.getHeight();
+ int deltaWidth = width - logo.getWidth();
+ BufferedImage combined = new BufferedImage(height, width, BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g = (Graphics2D) combined.getGraphics();
+ g.drawImage(qrcode, 0, 0, null);
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
+ g.drawImage(logo, (int) Math.round(deltaWidth / 2), (int) Math.round(deltaHeight / 2), null);
+
+ return combined;*/
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Return base64 for image
+ *
+ * @param image
+ * @return
+ * @author stefli
+ */
+ public static String getImageBase64String(BufferedImage image) {
+ String result = null;
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ OutputStream b64 = new Base64OutputStream(os);
+ ImageIO.write(image, "png", b64);
+ result = "data:image/png;base64," + os.toString("UTF-8");
+ result = result.replaceAll("\r\n", "");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ return result;
+ }
+
+
+ public static String getPureImageBase64String(BufferedImage image) {
+ String result = null;
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ OutputStream b64 = new Base64OutputStream(os);
+ ImageIO.write(image, "jpg", b64);
+ result = os.toString("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ return result;
+ }
+
+ /**
+ * Decode the base64Image data to image
+ *
+ * @param base64ImageString
+ * @param file
+ * @author stefli
+ */
+ public static void convertBase64StringToImage(String base64ImageString, File file) {
+ FileOutputStream os;
+ try {
+ Base64 d = new Base64();
+ byte[] bs = d.decode(base64ImageString);
+ os = new FileOutputStream(file.getAbsolutePath());
+ os.write(bs);
+ os.close();
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ } catch (Exception e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+
+}
diff --git b/fw-rp-common/src/main/java/cn/fw/rp/common/util/StringUtils.java a/fw-rp-common/src/main/java/cn/fw/rp/common/util/StringUtils.java
new file mode 100644
index 0000000..d930d1b
--- /dev/null
+++ a/fw-rp-common/src/main/java/cn/fw/rp/common/util/StringUtils.java
@@ -0,0 +1,488 @@
+/*
+ * 创建日期 2011-3-16
+ *
+ * 成都天和软件公司
+ * 电话:028-85425861
+ * 传真:028-85425861-8008
+ * 邮编:610041
+ * 地址:成都市武侯区航空路6号丰德万瑞中心B座1001
+ * 版权所有
+ */
+package cn.fw.rp.common.util;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 字符串工具
+ *
+ * @author: luox
+ * @version: 1.0
+ * @since 2018-01-15
+ */
+public final class StringUtils {
+
+ /**
+ * 空字符串
+ */
+ public static final String EMPTY = "";
+
+ private StringUtils() {
+ }
+
+ /**
+ * 首字母小写
+ *
+ * @param s String
+ * @return String
+ */
+ public static String firstCharLowerCase(String s) {
+ if (isValid(s)) {
+ return s.substring(0, 1).toLowerCase() + s.substring(1);
+ }
+ return s;
+ }
+
+ /**
+ * 删除前缀
+ *
+ * @param s
+ * @param prefix
+ * @return
+ */
+ public static String removePrefix(String s, String prefix) {
+ int index = s.indexOf(prefix);
+ return index == 0 ? s.substring(prefix.length()) : s;
+ }
+
+ /**
+ * 删除后缀
+ *
+ * @param s
+ * @param suffix
+ * @return
+ */
+ public static String removeSuffix(String s, String suffix) {
+ return s.endsWith(suffix) ? s.substring(0, s.length() - suffix.length()) : s;
+ }
+
+ /**
+ * 首字母大写
+ *
+ * @param s String
+ * @return String
+ */
+ public static String firstCharUpperCase(String s) {
+ if (isValid(s)) {
+ return s.substring(0, 1).toUpperCase() + s.substring(1);
+ }
+ return s;
+ }
+
+ /**
+ * 检查对象是否有效 obj != null && obj.toString().length() > 0
+ *
+ * @param obj
+ * @return boolean
+ */
+ public static boolean isValid(Object obj) {
+ return obj != null && obj.toString().length() > 0;
+ }
+
+ /**
+ * 是否是空的
+ *
+ * @param obj
+ * @return
+ */
+ public static boolean isEmpty(Object obj) {
+ return obj == null || obj.toString().length() == 0;
+ }
+
+ /**
+ * 转化为String对象
+ *
+ * @param obj
+ * @return boolean
+ */
+ public static String asString(Object obj) {
+ return obj != null ? obj.toString() : "";
+ }
+
+ /**
+ * 返回其中一个有效的对象 value != null && value.toString().length() > 0
+ *
+ * @param values
+ */
+ public static String tryThese(Object... values) {
+ for (int i = 0; i < values.length; i++) {
+ String value = StringUtils.asString(values[i]);
+ if (!value.isEmpty()) {
+ return value;
+ }
+ }
+ return "";
+ }
+
+ /**
+ * EL表达式提供的定义方法
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static String tryThese(String v1, String v2) {
+ return tryThese(new Object[]{v1, v2});
+ }
+
+ /**
+ * 连接字符串
+ *
+ * @param list
+ * @param split
+ * @return 字符串
+ */
+ public static String join(T[] list, String split) {
+ return join(list, split, "");
+ }
+
+ /**
+ * 连接字符串
+ *
+ * @param list
+ * @param split
+ * @return 字符串
+ */
+ public static String join(T[] list, String split, String wrap) {
+ if (list == null)
+ return null;
+ StringBuilder s = new StringBuilder(128);
+ for (int i = 0; i < list.length; i++) {
+ if (i > 0) {
+ s.append(split);
+ }
+ s.append(wrap + list[i] + wrap);
+ }
+ return s.toString();
+ }
+
+ /**
+ * 连接
+ *
+ * @param list
+ * @param split
+ * @param wrap
+ * @return
+ */
+ public static String join(List list, String split, String wrap) {
+ return join(list.toArray(), split, wrap);
+ }
+
+ /**
+ * 连接字符串
+ *
+ * @param list
+ * @param split
+ * @return 字符串
+ */
+ public static String join(List> list, String split) {
+ return join(list.toArray(), split);
+ }
+
+ /**
+ * 包裹字符串 id:12, {, } 输出 {id:12}
+ *
+ * @param input 输入串
+ * @param begin {
+ * @param end }
+ * @return String
+ */
+ public static String wrap(String begin, String input, String end) {
+ if (!input.startsWith(begin)) {
+ input = begin + input;
+ }
+ if (!input.endsWith(end)) {
+ input = input + end;
+ }
+ return input;
+ }
+
+ /**
+ * 取得匹配的字符串
+ *
+ * @param input
+ * @param regex
+ * @return
+ */
+ public static List matchs(String input, String regex) {
+ return matchs(input, regex, 0);
+ }
+
+ /**
+ * 取得匹配的字符串
+ *
+ * @param input
+ * @param regex
+ * @return
+ */
+ public static List matchs(String input, String regex, int group) {
+ Pattern pattern = Pattern.compile(regex);
+ Matcher match = pattern.matcher(input);
+ List matches = new ArrayList();
+ while (match.find()) {
+ matches.add(match.group(group));
+ }
+ return matches;
+ }
+
+ /**
+ * 找到匹配的第一个字符串
+ *
+ * @param input
+ * @param regex
+ * @param group
+ * @return
+ */
+ public static String matchFirst(String input, String regex, int group) {
+ List matches = matchs(input, regex, group);
+ return matches.isEmpty() ? null : matches.get(0);
+ }
+
+ /**
+ * 截取指定长度字符串
+ *
+ * @return
+ */
+ public static String getShorterString(String str, int maxLength) {
+ return getShorterString(str, "...", maxLength);
+ }
+
+ /**
+ * 截取指定长度字符串
+ *
+ * @param input
+ * @param tail
+ * @param length
+ * @return
+ */
+ public static String getShorterString(String input, String tail, int length) {
+ tail = isValid(tail) ? tail : "";
+ StringBuffer buffer = new StringBuffer(512);
+ try {
+ int len = input.getBytes("GBK").length;
+ if (len > length) {
+ int ln = 0;
+ for (int i = 0; ln < length; i++) {
+ String temp = input.substring(i, i + 1);
+ if (temp.getBytes("GBK").length == 2)
+ ln += 2;
+ else
+ ln++;
+
+ if (ln <= length)
+ buffer.append(temp);
+ }
+ } else {
+ return input;
+ }
+ buffer.append(tail);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * 取得GBK编码
+ *
+ * @return
+ */
+ public static String getBytesString(String input, String code) {
+ try {
+ byte[] b = input.getBytes(code);
+ return Arrays.toString(b);
+ } catch (UnsupportedEncodingException e) {
+ return String.valueOf(code.hashCode());
+ }
+ }
+
+ /**
+ * 转换格式 CUST_INFO_ID - > custInfoId
+ *
+ * @param input
+ * @return
+ */
+ public static String getFieldString(String input) {
+ if (input == null) {
+ return null;
+ }
+ String field = input.toLowerCase();
+ String[] values = field.split("\\_");
+ StringBuffer b = new StringBuffer(input.length());
+ for (int i = 0; i < values.length; i++) {
+ if (i == 0)
+ b.append(values[i]);
+ else
+ b.append(firstCharUpperCase(values[i]));
+ }
+ return b.toString();
+ }
+
+ /**
+ * 转换格式 CUST_INFO_ID - > custInfoId
+ *
+ * @param columnName
+ * @return
+ */
+ public static String toFieldName(String columnName) {
+ return getFieldString(columnName);
+ }
+
+ /**
+ * 转换格式 custInfoId - > CUST_INFO_ID
+ *
+ * @param field
+ * @return
+ */
+ public static String toColumnName(String field) {
+ if (field == null) {
+ return null;
+ }
+ StringBuffer b = new StringBuffer(field.length() + 3);
+ for (int i = 0; i < field.length(); i++) {
+ Character char1 = field.charAt(i);
+ if (Character.isUpperCase(char1) && i != 0) {
+ b.append("_");
+ }
+ b.append(char1);
+ }
+ return b.toString();
+ }
+
+ /**
+ * 转化为JSON值
+ *
+ * @param value
+ * @return
+ * @throws IOException
+ */
+ public static String toJsonValue(Object value) throws IOException {
+ if (value instanceof Number) {
+ return value.toString();
+ } else {
+ return "'" + value.toString() + "'";
+ }
+ }
+
+ /**
+ * 字符串转化为UUID
+ *
+ * @param value
+ * @return
+ */
+ public static String toUUID(String value) {
+ if (value == null)
+ throw new RuntimeException("value is null!");
+ return UUID.nameUUIDFromBytes(value.getBytes()).toString();
+ }
+
+ /**
+ * 获取Style样式中样式的值
+ *
+ * @param styleString
+ * @param styleName
+ * @return 相应的值
+ */
+ public static String getStyleValue(String styleString, String styleName) {
+ String[] styles = styleString.split(";");
+ for (int i = 0; i < styles.length; i++) {
+ String tempValue = styles[i].trim();
+ if (tempValue.startsWith(styleName)) {
+ String[] style = tempValue.split(":");
+ return style[1];
+ }
+ }
+ return "";
+ }
+
+ /**
+ * 生成重复次字符
+ *
+ * @param charactor
+ * @param repeat
+ * @return
+ */
+ public static String getRepeat(String charactor, int repeat) {
+ return repeat(charactor, repeat, "");
+ }
+
+ /**
+ * 生成重复次字符
+ *
+ * @param charactor
+ * @param repeat
+ * @return
+ */
+ public static String repeat(String charactor, int repeat, String split) {
+ StringBuilder s = new StringBuilder(charactor.length() * repeat);
+ for (int i = 0; i < repeat; i++) {
+ if (i != 0) {
+ s.append(split != null ? split : "");
+ }
+ s.append(charactor);
+ }
+ return s.toString();
+ }
+
+ /**
+ * 取得长度
+ *
+ * @param text
+ * @return
+ */
+ public static int length(String text) {
+ int len = text.length();
+ try {
+ len = text.getBytes("GBK").length;//SQLServer数据库用的GBK编码
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return len;
+ }
+
+ /**
+ * 字符串替换函数
+ *
+ * @param data 字符串
+ * @param data from 旧值
+ * @param to from 新值
+ */
+ public static String replaceString(String data, String from, String to) {
+ StringBuffer buf = new StringBuffer(data.length());
+ int pos = -1;
+ int i = 0;
+ while ((pos = data.indexOf(from, i)) != -1) {
+ buf.append(data.substring(i, pos)).append(to);
+ i = pos + from.length();
+ }
+ buf.append(data.substring(i));
+ return buf.toString();
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(toUUID("1"));
+ System.out.println(removePrefix("abcd123", "ab"));
+ System.out.println(removeSuffix("abcd123", "123"));
+ System.out.println(toColumnName("usernameid"));
+ System.out.println(getFieldString(toColumnName("userNameId")));
+ System.out.println(repeat("?", 10, ","));
+ length("AAA中国()111222bb");
+ }
+}
\ No newline at end of file
diff --git b/fw-rp-dao/pom.xml a/fw-rp-dao/pom.xml
new file mode 100644
index 0000000..90b6193
--- /dev/null
+++ a/fw-rp-dao/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+ cn.fw
+ fw-rp
+ 1.0
+
+
+ fw-rp-dao
+ jar
+ fw-rp-dao
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+
+
+ cn.fw
+ fw-rp-domain
+ ${project.parent.version}
+
+
+ cn.fw
+ fw-rp-common
+ ${project.parent.version}
+
+
+ cn.fw
+ fw-data-base
+
+
+
+
diff --git b/fw-rp-dao/src/main/java/cn/fw/rp/dao/FileListDao.java a/fw-rp-dao/src/main/java/cn/fw/rp/dao/FileListDao.java
new file mode 100644
index 0000000..d60fca0
--- /dev/null
+++ a/fw-rp-dao/src/main/java/cn/fw/rp/dao/FileListDao.java
@@ -0,0 +1,15 @@
+package cn.fw.rp.dao;
+
+import cn.fw.data.base.db.dao.BaseDao;
+import cn.fw.rp.db.FileList;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 2018年5月8日 15点26分
+ *
+ * @author suchu
+ */
+@Mapper
+public interface FileListDao extends BaseDao {
+ FileList selectByFileId(String fileId);
+}
diff --git b/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemFileDao.java a/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemFileDao.java
new file mode 100644
index 0000000..ce114f0
--- /dev/null
+++ a/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemFileDao.java
@@ -0,0 +1,14 @@
+package cn.fw.rp.dao;
+
+import cn.fw.data.base.db.dao.BaseDao;
+import cn.fw.rp.db.ProblemFile;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 2018年5月8日 15点26分
+ *
+ * @author suchu
+ */
+@Mapper
+public interface ProblemFileDao extends BaseDao {
+}
diff --git b/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemListDao.java a/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemListDao.java
new file mode 100644
index 0000000..25f7d26
--- /dev/null
+++ a/fw-rp-dao/src/main/java/cn/fw/rp/dao/ProblemListDao.java
@@ -0,0 +1,21 @@
+package cn.fw.rp.dao;
+
+import cn.fw.data.base.db.dao.BaseDao;
+import cn.fw.rp.db.ProblemFile;
+import cn.fw.rp.db.ProblemList;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author suchu
+ * @since 2018/5/8 15:23
+ */
+@Mapper
+public interface ProblemListDao extends BaseDao {
+ List getFiles(@Param("flag") Integer flag, @Param("problemId") Integer problemId);
+
+ List