v1.1
1、提货点 2、客服(腾讯云智服) 3、接口权限控制 4、复制第三方商品可配置 4、优化附件上传配置 5、手机端核销订单 6、手机端订单统计、订单管理 7、短信优化 8、订阅消息全自动化
This commit is contained in:
@@ -234,22 +234,22 @@ public final class DateUtil {
|
||||
/**
|
||||
* convert long to date
|
||||
*
|
||||
* @param dateLong
|
||||
* @return
|
||||
* @param date 待转换时间戳
|
||||
* @return 转换后时间
|
||||
*/
|
||||
public static Date longToDate(long dateLong) {
|
||||
return new Date(dateLong);
|
||||
public static Date timeStamp11ToDate(Integer date) {
|
||||
return new Date(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert long to date string
|
||||
*
|
||||
* @param dateLong
|
||||
* @param DATE_FORMAT
|
||||
* @return
|
||||
* @param date 待转换时间戳
|
||||
* @param DATE_FORMAT 格式化时间
|
||||
* @return 格式化后的时间
|
||||
*/
|
||||
public static String longToDate(long dateLong, String DATE_FORMAT) {
|
||||
return dateToStr(new Date(dateLong), DATE_FORMAT);
|
||||
public static String timeStamp11ToDate(Integer date, String DATE_FORMAT) {
|
||||
return dateToStr(new Date(date), DATE_FORMAT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,4 +518,28 @@ public final class DateUtil {
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 两个日期之前的相差天数
|
||||
* @param starDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 相差天数
|
||||
*/
|
||||
public static int daysBetween(Date starDate,Date endDate){
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
cal.setTime(starDate);
|
||||
|
||||
long time1 = cal.getTimeInMillis();
|
||||
|
||||
cal.setTime(endDate);
|
||||
|
||||
long time2 = cal.getTimeInMillis();
|
||||
|
||||
long between_days=(time2-time1)/(1000*3600*24);
|
||||
|
||||
return Integer.parseInt(String.valueOf(between_days));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
63
crmeb/src/main/java/com/utils/PinYinUtil.java
Normal file
63
crmeb/src/main/java/com/utils/PinYinUtil.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.utils;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||
|
||||
/**
|
||||
* 汉字转换为拼音
|
||||
* @author Red
|
||||
*/
|
||||
public class PinYinUtil {
|
||||
/**
|
||||
* 获取字符串拼音的第一个字母
|
||||
* @param chinese
|
||||
* @return
|
||||
*/
|
||||
public static String toFirstChar(String chinese){
|
||||
StringBuilder pinyinStr = new StringBuilder();
|
||||
char[] newChar = chinese.toCharArray(); //转为单个字符
|
||||
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
|
||||
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
for (char c : newChar) {
|
||||
if (c > 128) {
|
||||
try {
|
||||
pinyinStr.append(PinyinHelper.toHanyuPinyinStringArray(c, defaultFormat)[0].charAt(0));
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
pinyinStr.append(c);
|
||||
}
|
||||
}
|
||||
return pinyinStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字转为拼音
|
||||
* @param chinese
|
||||
* @return
|
||||
*/
|
||||
public static String toPinyin(String chinese){
|
||||
StringBuilder pinyinStr = new StringBuilder();
|
||||
char[] newChar = chinese.toCharArray();
|
||||
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
|
||||
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
for (char c : newChar) {
|
||||
if (c > 128) {
|
||||
try {
|
||||
pinyinStr.append(PinyinHelper.toHanyuPinyinStringArray(c, defaultFormat)[0]);
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
pinyinStr.append(c);
|
||||
}
|
||||
}
|
||||
return pinyinStr.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package com.utils;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.druid.util.Base64;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Random;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.druid.util.Base64;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 验证码生成工具类
|
||||
@@ -24,7 +21,7 @@ import org.springframework.stereotype.Component;
|
||||
public class ValidateCodeUtil {
|
||||
private static Validate validate = null; //验证码类,用于最后返回此对象,包含验证码图片base64和真值
|
||||
private static Random random = new Random(); //随机类,用于生成随机参数
|
||||
private static String randString = "0123456789abcdefghijkmnpqrtyABCDEFGHIJLMNQRTY";//随机生成字符串的取值范围
|
||||
private static String randString = "0123456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";//随机生成字符串的取值范围
|
||||
|
||||
private static int width = 80; //图片宽度
|
||||
private static int height = 34; //图片高度
|
||||
@@ -103,9 +100,9 @@ public class ValidateCodeUtil {
|
||||
Graphics2D g2d = (Graphics2D) graphics;
|
||||
g2d.setFont(getFont()); //设置字体
|
||||
g2d.setColor(new Color(random.nextFloat(), random.nextFloat(), random.nextFloat()));//设置颜色
|
||||
String randChar = String.valueOf(getRandomChar(random.nextInt(randString.length())));
|
||||
String randChar = getRandomChar(random.nextInt(randString.length()));
|
||||
randomString += randChar; //组装
|
||||
int rot = getRandomNum(5,10);
|
||||
int rot = getRandomNum(1,10);
|
||||
g2d.translate(random.nextInt(3), random.nextInt(3));
|
||||
g2d.rotate(rot * Math.PI / 180);
|
||||
g2d.drawString(randChar, 13*i, 20);
|
||||
|
||||
Reference in New Issue
Block a user