first commit

This commit is contained in:
duliyang 2024-10-26 15:28:51 +08:00
commit 4d56117b48
327 changed files with 20958 additions and 0 deletions

39
.gitignore vendored Normal file
View File

@ -0,0 +1,39 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
/data/**
hawkeye**
project_**
**.DS_Store
project_run.log.2021-12-31
project_run.log.2022-02-14
project_run.log.2022-02-15

31
car-common/.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

189
car-common/pom.xml Normal file
View File

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>carmis</artifactId>
<groupId>com.weiqi</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>car-common</artifactId>
<dependencies>
<dependency>
<groupId>com.weiqi</groupId>
<artifactId>car-dao</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.61</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.19.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.29</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<!--<build>-->
<!--<plugins>-->
<!--<plugin>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--<configuration>-->
<!--<classifier>exec</classifier>-->
<!--</configuration>-->
<!--</plugin>-->
<!--</plugins>-->
<!--</build>-->
<!--定义snapshots库和releases库的nexus地址-->
<distributionManagement>
<repository>
<id>releases</id>
<url>
http://repo.corpweiqi.com/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>
http://repo.corpweiqi.com/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</project>

View File

@ -0,0 +1,780 @@
package com.weiqi.mis;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.util.StringUtils;
/**
* Created by yinqingzhun on 2024/6/1.
*/
@Slf4j
public class DateHelper {
public final static String DATEFORMAT_FULL = "yyyy-MM-dd HH:mm:ss.SSS";
public final static String DATEFORMAT_STANDARD = "yyyy-MM-dd HH:mm:ss";
public final static String DATEFORMAT_STANDARD_HH_MM = "yyyy-MM-dd HH:mm";
public final static String DATEFORMAT_ONLY_MONTH = "yyyy-MM";
public final static String DATEFORMAT_ONLY_DATE = "yyyy-MM-dd";
public final static String DATEFORMAT_ONLY_DATE_SHORT = "yyyyMMdd";
public final static String DATEFORMAT_NEW = "yyyy/MM/dd HH:mm:ss";
public final static String DATEFORMAT_FULL_PURE_NUMBER = "yyyyMMddHHmmssSSS";
public final static String DATEFORMAT_FULL_PURE_NUMBER_SHORT = "yyyyMMddHHmmss";
public final static String FULL_TIME_PATTERN = "HH:mm:ss.SSS";
public final static String FULL_TIME_PATTERN_SHORT = "HH:mm:ss";
public final static String FULL_TIME_PATTERN_SHORT_T = "HHmmss";
public final static String DATEFORMONTH_PATTERN_SHORT = "MM-dd HH:mm";
public final static String DATEFORMONTH_PATTERN_SHORT2 = "MM-dd HH:mm:ss";
/**
* "2019-01-30T13:16:06.950+0000"
* "2019-01-30T13:16:06.950"
* "2019-01-30T13:16:06"
*/
public final static String DATEFORMAT_SPECIAL_T = "yyyy-MM-dd'T'HH:mm:ss";
public final static LocalDateTime UNIX_START_LOCAL_DATE_TIME = LocalDateTime.of(1970, 1, 1, 0, 0, 0);
public static long getDiffDays(Date date1, Date date2) {
LocalDateTime l1 = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
LocalDateTime l2 = date2.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
if (l1.isAfter(l2)) {
LocalDateTime temp;
temp = l2;
l2 = l1;
l1 = temp;
}
Duration between = Duration.between(l1, l2);
return between.toDays();
}
public static long getDiffDays(LocalDate date1, LocalDate date2) {
Duration between = Duration.between(date1, date2);
return between.toDays();
}
// public static void main(String[] args) {
// System.out.println(getDiffDays(deserialize("2022-10-01","yyyy-MM-dd"),deserialize("2022-10-02",
// "yyyy-MM-dd")));
// }
public static Date getLastDayOfMonth() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
String dayTime = serialize(cal.getTime(), DATEFORMAT_ONLY_DATE) + " 00:00:00";
return deserialize(dayTime, DATEFORMAT_STANDARD);
}
public static Date deserialize(String source, String... dateFormat) {
Date date = null;
if (dateFormat != null && dateFormat.length > 0) {
for (String df : dateFormat) {
try {
date = new SimpleDateFormat(df).parse(source);
break;
} catch (Exception e) {
log.debug(e.getMessage());
}
}
} else {
// sample: /Date(1528805593000)/
Matcher matcher = Pattern.compile("\\/Date\\((-?\\d+)\\)\\/").matcher(source);
if (matcher.matches()) {
date = new Date(Long.valueOf(matcher.group(1)));
} else {
try {
date = parse(source);
} catch (ParseException e) {
log.debug(e.getMessage());
}
}
}
Preconditions.checkNotNull(date, String.format("date %s can't be resolved", source));
return date;
}
/**
* 使用dateFormat格式化Date对象
*
* @param date
* @param dateFormat
* @return
*/
public static String serialize(Date date, String dateFormat) {
DateFormat df = new SimpleDateFormat(dateFormat);
String str = df.format(date);
return str;
}
/**
* 使用dateFormat格式化LocalDateTime对象
*
* @param date
* @param dateFormat
* @return
*/
public static String serialize(LocalDateTime date, String dateFormat) {
DateFormat df = new SimpleDateFormat(dateFormat);
String str = df.format(localDateTimeToDate(date));
return str;
}
/**
* 使用dateFormat格式化LocalDate对象
*
* @param date
* @param dateFormat
* @return
*/
public static String serialize(LocalDate date, String dateFormat) {
DateFormat df = new SimpleDateFormat(dateFormat);
String str = df.format(localDateToDate(date));
return str;
}
/**
* 使用yyyy-MM-dd HH:mm:ss.SSS格式化date对象
*
* @param date
* @return
*/
public static String serialize(Date date) {
DateFormat df = new SimpleDateFormat(DateHelper.DATEFORMAT_FULL);
String str = df.format(date);
return str;
}
/**
* 返回代表当前时间格式化的字符串格式yyyy-MM-dd HH:mm:ss.SSS
*
* @return
*/
public static String getNowString() {
return serialize(getNow(), DATEFORMAT_FULL);
}
/**
* 返回代表当前日期格式化的字符串的数字格式yyyyMMdd
*
* @return
*/
public static int getNowOnlyDateShortString() {
return Integer.parseInt(serialize(getNow(), DATEFORMAT_ONLY_DATE_SHORT));
}
/**
* 返回代表当前时间格式化的字符串
*
* @return
*/
public static String getNowString(String dateFormat) {
return serialize(getNow(), dateFormat);
}
/**
* 返回一个代表当前时间的Date对象
*
* @return
*/
public static Date getNow() {
return Calendar.getInstance().getTime();
}
/**
* 返回代表当前时间的毫秒数
*
* @return
*/
public static long getNowInInMillis() {
return Calendar.getInstance().getTimeInMillis();
}
/**
* 获取当前日期加上指定时间长度以后的Date
*
* @param timeUnit 时间单位
* @param account 添加到calendarTimeField的时间或日期数量
* @return
*/
public static Date getDate(TimeUnit timeUnit, int account) {
Calendar calendar = Calendar.getInstance();
calendar.add(timeUnit.getValue(), account);
return calendar.getTime();
}
/**
* 加减指定单位的时间
*
* @param date
* @param timeUnit
* @param account
* @return
*/
public static Date add(Date date, TimeUnit timeUnit, int account) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(timeUnit.getValue(), account);
return calendar.getTime();
}
public static String add(Date date, TimeUnit timeUnit, int account,String dateformat) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(timeUnit.getValue(), account);
Date time = calendar.getTime();
DateFormat format = new SimpleDateFormat(dateformat);
return format.format(time);
}
/**
* 获取指定的timestamp
*
* @param timeUnit 时间单位
* @param account 添加到calendarTimeField的时间或日期数量
* @return
*/
public static long getTimeInMillis(TimeUnit timeUnit, int account) {
Calendar calendar = Calendar.getInstance();
calendar.add(timeUnit.getValue(), account);
return calendar.getTimeInMillis();
}
/**
* 函数功能描述:UTC时间转本地时间格式
*
* @param datetime 日期字符串
* @return 本地日期
*/
private static Date parse(String datetime) throws ParseException {
boolean isUTC = false;
String utcTimePattern = "yyyy-MM-dd";
String subTime = datetime.substring(10);// UTC时间格式以 yyyy-MM-dd 开头,将utc时间的前10位截取掉,之后是含有多时区时间格式信息的数据
// 处理当后缀为:+8:00时,转换为:+08:00 -8:00转换为-08:00
if (subTime.indexOf("+") != -1) {
subTime = changeUtcSuffix(subTime, "+");
} else if (subTime.indexOf("-") != -1) {
subTime = changeUtcSuffix(subTime, "-");
}
datetime = datetime.substring(0, 10) + subTime;
// 依据传入函数的utc时间,得到对应的utc时间格式
// 步骤一:处理 T
if (datetime.indexOf("T") != -1) {
utcTimePattern += "'T'";
}
// 步骤二:处理毫秒SSS
if (StringUtils.hasText(subTime)) {
if (datetime.indexOf(".") != -1) {
utcTimePattern = utcTimePattern + "HH:mm:ss.SSS";
} else if (subTime.indexOf("+") == -1 || subTime.indexOf("-") == -1 || subTime.indexOf("Z") == -1) {
List<String> list = Arrays.asList("HH:mm:ss".split("[:]"));
utcTimePattern = utcTimePattern + String.join(":", list.subList(0, subTime.split("[:]").length));
} else {
utcTimePattern = utcTimePattern + "HH:mm:ss";
}
}
// 步骤三:处理时区问题
if (subTime.indexOf("+") != -1 || subTime.indexOf("-") != -1) {
utcTimePattern += "XXX";
isUTC = true;
} else if (subTime.indexOf("Z") != -1) {
utcTimePattern += "'Z'";
isUTC = true;
}
SimpleDateFormat utcFormater = new SimpleDateFormat(utcTimePattern);
if (isUTC) {
utcFormater.setTimeZone(TimeZone.getTimeZone("UTC"));
}
Date date = utcFormater.parse(datetime);
return date;
}
/**
* 函数功能描述:修改时间格式后缀
* 函数使用场景:处理当后缀为:+8:00时,转换为:+08:00 -8:00转换为-08:00
*
* @param subTime
* @param sign
* @return
*/
private static String changeUtcSuffix(String subTime, String sign) {
String timeSuffix = null;
String[] splitTimeArrayOne = subTime.split("[" + sign + "]");
String[] splitTimeArrayTwo = splitTimeArrayOne[1].split(":");
if (splitTimeArrayTwo[0].length() < 2) {
timeSuffix = sign + "0" + splitTimeArrayTwo[0] + ":" + splitTimeArrayTwo[1];
subTime = splitTimeArrayOne[0] + timeSuffix;
return subTime;
}
return subTime;
}
public static long pastDays(Date date) {
long t = System.currentTimeMillis() - date.getTime();
return t / (24 * 60 * 60 * 1000);
}
public static Date addDays(Date date, int days) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, days); // minus number would decrement the days
return cal.getTime();
}
public static Date localDateToDate(LocalDate localDate) {
ZoneId zoneId = ZoneId.systemDefault();
ZonedDateTime zdt = localDate.atStartOfDay(zoneId);
Date date = Date.from(zdt.toInstant());
return date;
}
public static LocalDate dateToLocalDate(Date date) {
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return localDate;
}
public static LocalDate stringToLcalDate(String timeStr, String format) {
LocalDate parse = LocalDate.parse(timeStr, DateTimeFormatter.ofPattern(format));
return parse;
}
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
ZoneId zoneId = ZoneId.systemDefault();
ZonedDateTime zdt = localDateTime.atZone(zoneId);
Date date = Date.from(zdt.toInstant());
return date;
}
public static LocalDateTime dateToLocalDateTime(Date date) {
LocalDateTime LocalDateTime = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
return LocalDateTime;
}
public static String getRemainingTime(Date future) {
long seconds = (future.getTime() - System.currentTimeMillis()) / 1000;
int secondsPerDay = 86400;
int secondsPerHour = 3600;
int secondsPerMinute = 60;
if (seconds < 0) {
return "-";
}
StringBuilder stringBuilder = new StringBuilder();
if (seconds > secondsPerDay) {
stringBuilder.append(seconds / secondsPerDay).append("");
seconds -= seconds / secondsPerDay * secondsPerDay;
}
if (seconds > secondsPerHour) {
stringBuilder.append(seconds / secondsPerHour).append("");
seconds -= seconds / secondsPerHour * secondsPerHour;
} else if (stringBuilder.length() > 0) {
stringBuilder.append(0).append("");
}
if (seconds > secondsPerMinute) {
stringBuilder.append(seconds / secondsPerMinute).append("");
seconds -= seconds / secondsPerMinute * secondsPerMinute;
} else if (stringBuilder.length() > 0) {
stringBuilder.append(0).append("");
}
stringBuilder.append(seconds).append("");
return stringBuilder.toString();
}
public static Long getTimeDifference(Date beginDate, Date endDate, TimeUnit timeUnit) {
long beginTime = beginDate.getTime();
long endTime = endDate.getTime();
int unit = 1;
if (timeUnit.getValue() == Calendar.DAY_OF_YEAR) {
unit = 1000 * 60 * 60 * 24;
}
// 其他单位待完善
long betweenDays = (long) ((endTime - beginTime) / unit + 0.5);
return betweenDays;
}
/**
* 获取当日剩余时间单位
*
* @return
*/
public static long getTodayRemainingTimeInSecond() {
Instant end = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).plusDays(1).plus(-1, ChronoUnit.SECONDS)
.toInstant();
long seconds = Duration.between(Instant.now(), end).toMillis() / 1000;
return seconds;
}
/**
* 获取距离指定日期的剩余时间单位
*
* @return
*/
public static Integer getRemainSecondsOneDay(LocalDateTime localDateTime) {
long seconds = ChronoUnit.SECONDS.between(LocalDateTime.now(), localDateTime);
return (int) seconds;
}
/**
* 获取N日内剩余时间单位
*
* @return
*/
public static long getDaysRemainingTimeInSecond(Long days) {
Instant end = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).plusDays(days).plus(-1, ChronoUnit.SECONDS)
.toInstant();
long seconds = Duration.between(Instant.now(), end).toMillis() / 1000;
return seconds;
}
/**
* 解析字符串为LocalTime
*
* @param source
* @return
*/
public static LocalTime parseTime(String source) {
String timePattern = "";
if (source.indexOf(".") != -1) {
timePattern = FULL_TIME_PATTERN;
} else {
timePattern = FULL_TIME_PATTERN.substring(0, FULL_TIME_PATTERN.indexOf("."));
timePattern = Joiner.on(":")
.join(Arrays.asList(timePattern.split("[:]")).subList(0, source.split("[:]").length));
}
return LocalTime.parse(source, DateTimeFormatter.ofPattern(timePattern));
}
/**
* 产生指定日期的随机时间点
*
* @param localDate
* @param startTime
* @param endTime
* @return
*/
public static Date getRandomTime(LocalDate localDate, LocalTime startTime, LocalTime endTime) {
int offsetSeconds = 0;
int compared = startTime.compareTo(endTime);
if (compared != 0) {
Duration duration = Duration.between(startTime, endTime);
offsetSeconds = new Random().nextInt((int) Math.abs(duration.toMillis() / 1000));
}
LocalTime randomTime = (compared < 0 ? startTime : endTime).plusSeconds(offsetSeconds);
return Date.from(LocalDateTime.of(localDate, randomTime).atZone(ZoneOffset.systemDefault()).toInstant());
}
/**
* 合并localDate和localTime为Date
*
* @param localDate
* @param localTime
* @return
*/
public static Date combine(LocalDate localDate, LocalTime localTime) {
return Date.from(LocalDateTime.of(localDate, localTime).atZone(ZoneOffset.systemDefault()).toInstant());
}
public static LocalTime min(LocalTime a, LocalTime b) {
return a.isBefore(b) ? a : b;
}
public static LocalTime max(LocalTime a, LocalTime b) {
return a.isAfter(b) ? a : b;
}
public static long getMinutesBetween(LocalDateTime a, LocalDateTime b) {
val duration = Duration.between(a, b);
return duration.toMinutes();
}
public static LocalDateTime getMinLocalDateTime() {
return LocalDateTime.of(1900, 1, 1, 0, 0, 0);
}
public static LocalDate getMinLocalDate() {
return LocalDate.of(1900, 1, 1);
}
public static int compare(LocalDateTime small, LocalDateTime large) {
return small.isBefore(large) ? -1 : small.equals(large) ? 0 : 1;
}
public static String escapeBy(LocalDateTime start, LocalDateTime now) {
Duration duration = Duration.between(start, now);
if (duration.toHours() < 1) {
return "刚刚";
} else if (duration.toDays() < 1) {
return String.format("%d小时前", duration.toHours());
} else {
return String.format("%d天前", duration.toDays());
}
}
public static LocalDateTime parseStringToDateTime(String dateTime) {
if (StringUtils.isEmpty(dateTime)) {
return null;
}
LocalDateTime localDateTime = LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern(DATEFORMAT_STANDARD));
return localDateTime;
}
/**
* 获取当前小时
*
* @return
*/
public static int getHour() {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY); // 24小时制
return hour;
}
public enum TimeUnit {
YEAR(Calendar.YEAR),
MONTH(Calendar.MONTH),
DAY(Calendar.DAY_OF_YEAR),
HOUR(Calendar.HOUR_OF_DAY),
MINUTE(Calendar.MINUTE),
SECOND(Calendar.SECOND),
MILLISECOND(Calendar.MILLISECOND);
private int v;
TimeUnit(int value) {
this.v = value;
}
int getValue() {
return this.v;
}
}
public static LocalDateTime strToLocalDateTime(String strLocalTime, String dft) {
// 1.具有转换功能的对象
DateTimeFormatter df = DateTimeFormatter.ofPattern(dft);
// 2.要转换的对象
LocalDateTime time = LocalDateTime.now();
// 3.发动功能
String localTime = df.format(time);
System.out.println("LocalDateTime转成String类型的时间" + localTime);
// 3.LocalDate发动将字符串转换成 df格式的LocalDateTime对象的功能
LocalDateTime LocalTime = LocalDateTime.parse(strLocalTime, df);
return LocalTime;
}
public static int getMonth(LocalDate localDate) {
return localDate.getMonthValue();
}
public static int getWeekOfYear(String date,String format) {
SimpleDateFormat df=new SimpleDateFormat(format);
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(df.parse(date));
} catch (ParseException e) {
e.printStackTrace();
}
//设置每周第一天为周一 默认每周第一天为周日
calendar.setFirstDayOfWeek(Calendar.MONDAY);
//获取当前日期所在周周日
calendar.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
return calendar.get(Calendar.WEEK_OF_YEAR);
}
// public static void main(String[] args) {
// System.out.println(DateHelper.getWeekOfYear(DateHelper.serialize(DateHelper.addDays(new Date(),-6),"yyyy-MM-dd"),"yyyy-MM-dd"));
// }
public static LocalDate parseLocalDate(String localDateStr, String dateFormat) {
return LocalDate.parse(localDateStr, DateTimeFormatter.ofPattern(dateFormat));
}
public static LocalDate getFirstDayOfMonth(LocalDate localDate){
return localDate.with(TemporalAdjusters.firstDayOfMonth());
}
public static LocalDate getLastDayOfMonth(LocalDate localDate){
return localDate.with(TemporalAdjusters.lastDayOfMonth());
}
/**
* 获取两时间间隔天数
* @param statrDate
* @param endDate
* @return
*/
public static Long getDateIntervalDay(String statrDate,String endDate){
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
try {
Date star = dft.parse(statrDate);//开始时间
Date endDay=dft.parse(endDate);//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
return num/24/60/60/1000;
} catch (ParseException e) {
e.printStackTrace();
}
return 0L;
}
//获得前一天对应的月份第一天
public static String getPerDayMonthFirstDay(String dt,int month) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date star = null;
try {
star = sdf.parse(dt);//开始时间
} catch (ParseException e) {
e.printStackTrace();
}
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(star);
rightNow.add(Calendar.DAY_OF_YEAR, -1);
rightNow.set(Calendar.DAY_OF_MONTH, 1);
Date dt1 = rightNow.getTime();
return getDateMonthFirstDay(dt1,-(month - 1));
}
public static String getPerDayMonthFirstDay(Date dt,int month) {
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.DAY_OF_YEAR, -1);
rightNow.set(Calendar.DAY_OF_MONTH, 1);
Date dt1 = rightNow.getTime();
return getDateMonthFirstDay(dt1,-(month - 1));
}
//获得指定月份第一天
public static String getDateMonthFirstDay(Date dt,int month) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.MONTH, month);
rightNow.set(Calendar.DAY_OF_MONTH, 1);
Date dt1 = rightNow.getTime();
String reStr = sdf.format(dt1);
return reStr;
}
/**
* 获取指定日期所属季度
* @param localDate
* @return
*/
public static int getQuarter(LocalDate localDate){
int month = localDate.getMonthValue();
int quarter = (month + 2) / 3;
System.out.println("当前季度为:" + quarter);
return quarter;
}
/**
* 获取今年第一天
* @return
*/
public static String getFirstDayByYear(){
Calendar currCal=Calendar.getInstance();
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR,currCal.get(Calendar.YEAR));
Date time = calendar.getTime();
SimpleDateFormat format = new SimpleDateFormat(DateHelper.DATEFORMAT_STANDARD);
String firstday = format.format(time);
return firstday;
}
public static Boolean isNullOrEmpty(LocalDateTime localDateTime){
return localDateTime == null || localDateTime.equals(UNIX_START_LOCAL_DATE_TIME);
}
/**
* 获取当前时间前一天零点
* @return
*/
public static LocalDateTime getPreDayStart(){
// 获取当前日期和时间
LocalDateTime now = LocalDateTime.now();
// 获取当前日期
LocalDate currentDate = now.toLocalDate();
// 使用当前日期减去一天得到前一天的日期
LocalDate previousDate = currentDate.minusDays(1);
// 构造前一天的零点时间
LocalDateTime previousDayStart = LocalDateTime.of(previousDate, LocalTime.MIN);
return previousDayStart;
}
public static int getWeekday(String dateStr) {
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 解析字符串为LocalDate对象
LocalDate date = LocalDate.parse(dateStr, formatter);
// 获取本周第一天
LocalDate firstDayOfWeek = date.with(DayOfWeek.MONDAY);
// 计算与本周第一天相差的天数加1得到本周第几天星期一为第一天
return date.getDayOfWeek().getValue() - firstDayOfWeek.getDayOfWeek().getValue() + 1;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,622 @@
package com.weiqi.mis;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.http.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class HttpUtil {
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
private static CloseableHttpClient httpClient;
private static PoolingHttpClientConnectionManager cm;
static {
init();
closeExpiredConnectionsPeriodTask(60);
}
static void init() {
cm = new PoolingHttpClientConnectionManager();
// max connections
cm.setMaxTotal(300);
// max connections per route
cm.setDefaultMaxPerRoute(60);
// set max connections for a specified route
cm.setMaxPerRoute(new HttpRoute(new HttpHost("locahost")), 100);
cm.setValidateAfterInactivity(500);
final RequestConfig requestConfig = RequestConfig.custom()
// the socket timeout (SO_TIMEOUT) in milliseconds
.setSocketTimeout(15000)
// the timeout in milliseconds until a connection is established.
.setConnectTimeout(15000)
// the timeout in milliseconds used when requesting a connection from the connection pool.
.setConnectionRequestTimeout(15000)
.build();
httpClient = HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).build();
}
public static String sendGetRequest(String url, Map<String, String> paramMap) {
return sendGetRequestSetEncoding(url, paramMap, "UTF-8");
}
public static String sendGetRequest(String url){
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader("User-Agent", "");
// httpGet.setHeader("Cookie", "Token=49FCFB0599EC33D5F89141535CF90849");
//httpGet.setHeader();
HttpResponse response;
String startTime = null;
try {
startTime = DateUtils.getCurrDateTimeStr();
response = httpClient.execute(httpGet);
return parseResponse(url, response, "UTF-8");
}catch (ConnectTimeoutException e){
logger.error("request url:" + url + "startTime:" + startTime + ",ConnectTimeout", e);
return null;
}catch (SocketTimeoutException e){
logger.error("request url:" + url + "startTime:" + startTime + ",SocketTimeout", e);
return null;
}catch (Exception e) {
logger.error("request url:" + url + ",error", e);
return null;
}
}
public static String sendGetRequestSetEncoding(String url, Map<String, String> paramMap, String encoding) {
StringBuilder urlBuffer = new StringBuilder(url);
if (url.indexOf("?") < 0) {
urlBuffer.append("?");
}
if (paramMap != null && !paramMap.isEmpty()) {
Iterator<String> iterator = paramMap.keySet().iterator();
while (iterator.hasNext()) {
String paramName = iterator.next();
if (urlBuffer.toString().endsWith("?")) {
urlBuffer.append(paramName).append("=").append(paramMap.get(paramName).toString());
} else {
urlBuffer.append("&").append(paramName).append("=").append(paramMap.get(paramName).toString());
}
}
}
String requestUrl = urlBuffer.toString();
HttpGet httpGet = new HttpGet(requestUrl);
httpGet.setHeader("User-Agent", "");
HttpResponse response;
String startTime = null;
try {
startTime = DateUtils.getCurrDateTimeStr();
response = httpClient.execute(httpGet);
return parseResponse(requestUrl, response, encoding);
}catch (ConnectTimeoutException e){
logger.error("request url:" + requestUrl + "startTime:" + startTime + ",ConnectTimeout", e);
return null;
}catch (SocketTimeoutException e){
logger.error("request url:" + requestUrl + "startTime:" + startTime + ",SocketTimeout", e);
return null;
}catch (Exception e) {
logger.error("request url:" + requestUrl + ",error", e);
return null;
}
}
/**
* post方式请求
*
* @param url
* @param paramMap
* @return
*/
public static String sendPostRequest(String url, Map<String, String> paramMap,String host) {
return sendPostRequest(url, paramMap, "UTF-8",host);
}
public static String sendPostRequestByJson(String url, Map<String, String> paramMap) {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
// httpPost.setHeader("Host", "ngmgapi.in.weiqi.com.cn");
StringEntity se = null;
try {
se = new StringEntity(JSON.toJSONString(paramMap), "UTF-8");
se.setContentType("application/json;charset=UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
httpPost.setEntity(se);
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (Exception e) {
logger.error("request url:" + url + ",error", e);
throw new RuntimeException(e);
}
return parseResponse(url, response, "UTF-8");
}
public static String sendPostRequestByJson(String url, String param) {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
httpPost.setHeader("Host", "ngmgapi.in.weiqi.com.cn");
StringEntity se = null;
try {
se = new StringEntity(param, "UTF-8");
se.setContentType("application/json;charset=UTF-8");
// System.out.println("------" + JSON.toJSONString(paramMap));
} catch (Exception e) {
e.printStackTrace();
}
httpPost.setEntity(se);
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (Exception e) {
logger.error("request url:" + url + ",error", e);
throw new RuntimeException(e);
}
return parseResponse(url, response, "UTF-8");
}
public static String sendPostRequestByJsonObject(String url, Map<String, Object> paramMap) {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
StringEntity se = null;
try {
se = new StringEntity(JSON.toJSONString(paramMap), "UTF-8");
se.setContentType("application/json;charset=UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
httpPost.setEntity(se);
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (Exception e) {
logger.error("request url:" + url + ",error", e);
throw new RuntimeException(e);
}
return parseResponse(url, response, "UTF-8");
}
public static String sendPostRequestByJsonObject2(String url, Map<String, Object> paramMap) {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Accept","text/plain");
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
StringEntity se = null;
try {
se = new StringEntity(JSON.toJSONString(paramMap), "UTF-8");
se.setContentType("application/json;charset=UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
httpPost.setEntity(se);
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (Exception e) {
logger.error("request url:" + url + ",error", e);
throw new RuntimeException(e);
}
return parseResponse(url, response, "UTF-8");
}
/**
* post方式请求
*
* @param url
* @param paramMap
* @return
*/
public static String sendPostRequest(String url, Map<String, String> paramMap, String enc,String host) {
HttpPost httpPost = new HttpPost(url);
if(host!=null&&host.length()>1){
httpPost.setHeader("Host", host);
}
// httpPost.setHeader("pcpopclub", "551521767E62D76CB2A5CE5BACC7772E5BC73D0B47947C7B1F84A434A0A74FA89754DD632F25BCD867D9AD6BD27DCDE2E5AA36A609F398CC5948C80AB4957C30AD32453CA0BBFB1B97DCB5D54D118997D734E111D8A0B1B38AB7B6CB55DADD4FD3A9C3C7649F940238A4D1A023E4D174254BAD9DD9E3DE3FA46F6C4AAF84D2A96E6956FB750D91B6AB2B84478EC883A8EC02DE35D320DB91CA0EBA9B25E6C604C338845EB4540B22E88CCB5A44051AE17237B39BF3966E999FA0FF0B92112273771ABDE0AF84D11B4C03869FC0E803743AB680D17F2C6EF17EA73EEC11F46C9E1D66B6A8AE52FDEE8E81F7138277BC8700F341A7610A19667A5F855C6CF02EB62FB1FA76BC94C5D3EFDDEC58EBBFA62C5669C9BD5AB4BEEF069C6E47251733576F5C3DC82484A61CE1356E1269EDB0FED256A3AC1E1FFE12B43BDD0F".toUpperCase());
if (paramMap != null && !paramMap.isEmpty()) {
Iterator<String> iterator = paramMap.keySet().iterator();
List<BasicNameValuePair> params = new ArrayList<>(paramMap.size());
while (iterator.hasNext()) {
String paramName = iterator.next();
params.add(new BasicNameValuePair(paramName, paramMap.get(paramName).toString()));
}
try {
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
} catch (Exception e) {
logger.error("can not request url:" + url, e);
throw new RuntimeException(e);
}
}
HttpResponse response = null;
try {
response = httpClient.execute(httpPost);
} catch (Exception e) {
logger.error("request url:" + url + ",error", e);
throw new RuntimeException(e);
}
return parseResponse(url, response, enc);
}
/**
* 解析返回结果
*
* @param url
* @param response
* @return
*/
private static String parseResponse(String url, HttpResponse response, String encoding) {
if (response == null) {
logger.error("can not parse httpResponse,beacuse is null,url:" + url);
return null;
}
InputStream inputStream = null;
try {
StatusLine status = response.getStatusLine();
HttpEntity entity = response.getEntity();
inputStream = entity.getContent();
if (status.getStatusCode() != 200) {
throw new RuntimeException("request url:" + url + ", status error, status is " + status.getStatusCode());
}
return IOUtils.toString(inputStream, encoding);
} catch (Exception e) {
logger.error("parse response error", e);
throw new RuntimeException("parse response error", e);
} finally {
IOUtils.closeQuietly(inputStream);
}
}
private static void closeExpiredConnectionsPeriodTask(int timeUnitBySecond) {
Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
TimeUnit.SECONDS.sleep(timeUnitBySecond);
} catch (InterruptedException e) {
e.printStackTrace();
}
cm.closeExpiredConnections();
}
}
});
}
public static String multipartFormPost(String url, MultipartEntityBuilder builder) {
try {
String result = "";
HttpPost httppost = new HttpPost(url);
httppost.setEntity(builder.build());
HttpResponse response = httpClient.execute(httppost);
if (response.getStatusLine().getStatusCode() == 200) {
result = EntityUtils.toString(response.getEntity());
}
return result;
} catch (Exception e) {
logger.error("parse multipartFormPost error", e);
throw new RuntimeException("parse multipartFormPost error", e);
}
}
/**post请求 raw 类型
*
* @param uri
* @param content
* @return
*/
public static String postBodyRaw(String uri, String content) {
String result = null;
try{
HttpPost httpPost = new HttpPost(uri);
StringEntity requestEntity = new StringEntity(content, "UTF-8");
requestEntity.setContentType("application/json");
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
}catch (Exception e){
logger.error("uri={},content={},异常={}",uri,content,e);
}
return result;
}
/**
*
* @param url 提交地址
* @param charset 编码
* @param params 提交参数
* @return
*/
public static String postHttpText(String url, String charset,String params) {
URL myFileUrl = null;
BufferedReader in = null;
HttpURLConnection conn =null;
OutputStreamWriter out=null;
String result="";
try {
if(charset==null || "".equals(charset)){
charset = "UTF-8";
}
myFileUrl = new URL(url);
conn = (HttpURLConnection) myFileUrl.openConnection();
conn.setRequestMethod("POST");//
conn.setConnectTimeout(20*1000);
conn.setReadTimeout(20*1000);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.connect();
out = new OutputStreamWriter(conn.getOutputStream(), charset); // utf-8编码
out.append(params);
out.flush();
out.close();
out=null;
if (conn.getResponseCode() == 200) {
in = new BufferedReader(
new InputStreamReader(conn.getInputStream(),charset));
String line="";
while ((line=in.readLine())!=null){
result+=line;
}
in.close();
in=null;
conn.disconnect();
conn=null;
} else {
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if(null!=out){
out.close();
out=null;
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
try {
if(null!=in){
in.close();
in=null;
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
if(null!=conn){
conn.disconnect();
conn=null;
}
}
return result;
}
public static void main(String[] args) {
// Map<String, String> map = new HashMap();
// map.put("_appid", "jiage");
// map.put("type", "2");
// map.put("userid", "123");
// map.put("info", "123");
// System.out.println(HttpUtil.sendPostRequestByJson("http://dealercloudinnerapi.lq.weiqi.com.cn/api/ugc/sharepricecallback?_appid=jiage", map));
//
// SavePriceVo savePriceVo = new SavePriceVo();
// savePriceVo.setFeelContent("1");
// savePriceVo.setweiqiua("iPhone\t11.0.0\tdealercloudapp\t2.0.0\tiPhone");
// savePriceVo.setCityId(110100 + "");
// savePriceVo.setUseTax(new BigDecimal(300));
// savePriceVo.setPurchaseTax(new BigDecimal(8000));
// savePriceVo.setInsurer(new BigDecimal(3000));
// savePriceVo.set_appid("dealercloud.ios");
// savePriceVo.setNakedPrice(new BigDecimal(100000));
// savePriceVo.setLicenseFee(new BigDecimal(2000));
//
// savePriceVo.setSeriesId(526 + "");
// savePriceVo.setSpecId(24194 + "");
// savePriceVo.setProvinceId(110000 + "");
// savePriceVo.setPriceType(0);
// savePriceVo.setInvoiceUrl("WER");
// savePriceVo.setBrandId(3 + "");
// savePriceVo.setUc_ticket("e58dd17110914d16ad574b38a1ed060a000f54eb");
// savePriceVo.setBuycartime("2024-12-01");
// savePriceVo.setTrafficInsurance(new BigDecimal(0.0));
// savePriceVo.setFeellevel(2 + "");
// savePriceVo.setDealerId(1111 + "");
// Map m = new HashMap();
// m.put("feelContent", "1");
// m.put("weiqiua", "iPhone\t11.0.0\tdealercloudapp\t2.0.0\tiPhone");
// m.put("cityId", "110100");
// m.put("useTax", "300");
// m.put("purchaseTax", "8000");
// m.put("insurer", "3000");
// m.put("_appid", "dealercloud.ios");
// m.put("nakedPrice", "100000");
// m.put("licenseFee", "2000");
// m.put("SeriesId", "526");
// m.put("SpecId", "24194");
// m.put("provinceId", "110000");
// m.put("invoiceUrl", "WER");
// m.put("brandId", "3");
// m.put("SeriesId", "526");
// m.put("uc_ticket", "0AAB882A705D0507E90C10E41165878B53E75B2545201EB474022E0EA48B5CE2F410A34F816F06974D895F88159FE5057DC412FA83FD21CD2F2E584321A4074D21B907E1C9A6E2E4011F8CC86FF292692B2B03D53A68FFDC5AE7E5E152A5B349BB224635011C033E3EA307F1D3ACF2ED9F67862515D196DEEC1BC394CBDB57501A1A8BCD8D2445647AE6CB3316F803B8C75FBFEAAAA98B554614653DBB7FE8A50065E53E11F9E9F6094285B88137DB2512157578A28636C75AC4956792ECB0CBCA95DBA6458FD751ABD9277500B96A7AEF82434F7F4CAB851D1DE59B37ABF661AEFA16EDF94BBE07D762070285C2E2FD840047D48F149D5BAD2B5BACCC29F2C2CF9985397ACF6A55DA64FC7AFDFD94D543290D91052D5FB9101325DCF375923D075110781DC7023061C271AEF347FEAADFC4D478");
// m.put("buycartime", "2024-12-01");
// m.put("trafficInsurance", "0");
// m.put("feellevel", "2");
// m.put("dealerId", "111");
// System.out.println(HttpUtil.sendPostRequest("http://jiage.api.weiqi.com.cn/api/carprice/SavePrice", m));
JSONObject js = new JSONObject();
js.put("dt","2019-01-01");
js.put("category_type","浏览用户" );
js.put("page","1");
js.put("pageSize","10");
// HttpClient httpClient = new DefaultHttpClient();
// HttpPost post = new HttpPost("http://api.bdp.weiqi.com.cn/datacenter/common/output/ol/interactive_carowner_price_consult?APPKEY=008B97BF6F5F4A6A2C3058127FBA96A0");
// StringEntity postingString = new StringEntity(js.toString());// json传递
// post.setEntity(postingString);
// post.addHeader("Content-type","application/json; charset=utf-8");
//
// HttpResponse response = httpClient.execute(post);
// String content = EntityUtils.toString(response.getEntity());
// System.out.println(content);
// String ret = postBodyRaw("http://api.bdp.weiqi.com.cn/datacenter/common/output/ol/interactive_carowner_price_consult?APPKEY=008B97BF6F5F4A6A2C3058127FBA96A0",js.toString());
// System.out.println(ret);
// String str = "{\"data\":{\"cms_series_ids\":3170,\"jump_url\":\"http://jiage.m.weiqi.com.cn/mobile/pricenew?priceid=540f9026-cc80-4f51-917f-034147c0c83f\",\"recommend_time\":\"2019-03-21 15:46:45\",\"img_url\":\"https://car3.autoimg.cn/cardfs/product/g26/M05/8F/7E/weiqicar__ChcCP1wE9RCAMsnDAAamtqJFuJg855.jpg\",\"city\":\"北京\",\"publish_time\":\"2019-02-22 00:00:00\",\"modify_time\":\"\",\"img_url2\":\"\",\"cms_spec_ids\":36623,\"title\":\"加价8.19万 当前热门奥迪A3 2019款 Sportback 35 TFSI 时尚型 国V真实车主价是多少\",\"view_count\":\"\",\"city_id\":110100},\"object_class_id\":\"0027\",\"biz_type\":60200,\"object_line_id\":0018,\"biz_id\":1953664,\"push_time\":\"2019-03-21 15:47:02\",\"operation\":0}";
String str = "{\n" +
"\"scheme_url\":\"weiqi://insidebrowserwk?url=https://fs.weiqi.com.cn/spa/activity_calendar\",\n" +
"\"extra_kwargs\":{\"plan_id\":355,\"bizCode\":\"duanxin001\"},\n" +
"\"html_url\":\"https://fs.weiqi.com.cn/views/shorturl_comm_launch/index.html\",\n" +
"\"_appid\":\"sms\"}";
JSONObject js11 = JSON.parseObject(str);
String ret = postBodyRaw("https://fs.weiqi.com.cn/api/shorten/createShortUrl",js11.toString());
System.out.println(ret);
}
public static String getURLEncoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
public static String URLDecoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = URLDecoder.decode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
/**
* post请求 raw 类型 返回token 华为专用
*
* @param uri
* @param content
* @return
*/
public static String postBodyRawReturnToken(String uri, String content) {
String result = null;
try {
HttpPost httpPost = new HttpPost(uri);
StringEntity requestEntity = new StringEntity(content, "UTF-8");
requestEntity.setContentType("application/json");
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);
Header[] headers = response.getHeaders("X-Subject-Token");
result = headers[0].getValue();
} catch (Exception e) {
logger.error("uri={},content={},异常={}", uri, content, e);
}
return result;
}
/**
* post请求 raw 类型
*
* @param uri
* @param content
* @return
*/
public static String postBodyRawHuawei(String uri, String content,String token) {
String result = null;
try {
HttpPost httpPost = new HttpPost(uri);
StringEntity requestEntity = new StringEntity(content, "UTF-8");
requestEntity.setContentType("application/json");
if(token!=null&token.length()>0){
httpPost.addHeader("X-Auth-Token", token);
}
httpPost.setEntity(requestEntity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
} catch (Exception e) {
logger.error("uri={},content={},异常={}", uri, content, e);
}
return result;
}
}

View File

@ -0,0 +1,164 @@
package com.weiqi.mis;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.net.*;
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
import org.apache.commons.lang3.StringUtils;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.regex.Pattern;
public class IPUtil {
private final static String IP_SEPARATOR = ",";
/**
* return 机器名
*/
public static String getHostName() {
try {
InetAddress ia = InetAddress.getByName("127.0.0.1");
return ia.getHostName();
} catch (UnknownHostException e) {
return null;
}
}
public static String[] getIps() {
List<String> ips = new ArrayList<String>();
try {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets)) {
if (netint.getHardwareAddress() != null) {
List<InterfaceAddress> list = netint.getInterfaceAddresses();
for (InterfaceAddress interfaceAddress : list) {
String localIp = interfaceAddress.getAddress().getHostAddress();
if (StringUtils.isNoneBlank(localIp)) {
ips.add(localIp);
}
}
}
}
} catch (SocketException e1) {
return null;
}
return ips.toArray(new String[ips.size()]);
}
//
// public static String getIP(HttpServletRequest request) {
//
// String ip = request.getHeader("X-Real-IP");
//
// if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
// ip = request.getHeader("x-forwarded-for");
// } else {
// return ip;
// }
//
// if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
// ip = request.getHeader("Proxy-Client-IP");
// } else {
// //当有多级反向代理时x-forwarded-for值为多个时取第一个ip地址
// if (ip.indexOf(IP_SEPARATOR) != -1) {
// ip = ip.substring(0, ip.indexOf(IP_SEPARATOR));
// }
// return ip;
// }
//
// if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
// ip = request.getHeader("WL-Proxy-Client-IP");
// } else {
// return ip;
// }
//
// if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
// ip = request.getRemoteAddr();
// } else {
// return ip;
// }
//
// if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
// ip = "";
// }
// return ip;
// }
/**
* @Author : Jiaobailong
* @Summary : getIpAddress
* @Date : 2016/12/15 15:52
*/
public static String getIpAddress(HttpServletRequest request) {
String ip = null;
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Forwarded-For");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CIP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
if (!Strings.isNullOrEmpty(ip)) {
ip = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(ip).get(0);
}
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("REMOTE_ADDR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CDN_SRC_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if (ip != null && ip.startsWith("::")) {
ip = "127.0.0.1";
}
return ip;
}
private static final Pattern lanIp = Pattern.compile(
"(10|172|192)\\\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]?)\\\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]?)\\\\.([0-1][0-9]{0,2}|[2][0-5]{0,2}|[3-9][0-9]?)");
/**
* @Author : Jiaobailong
* @Summary : isLanClient
* @Date : 2016/12/15 16:07
*/
public static boolean isLanClient(String ip) {
/**
* 华为云139开头
*/
return !StringUtils.isEmpty(ip) && (ip.equals("localhost") || ip.equals("0:0:0:0:0:0:0:1")
|| ip.startsWith("127.") || ip.startsWith("10.") || ip.startsWith("192.168.") || lanIp.matcher(ip).find());
}
}

View File

@ -0,0 +1,292 @@
package com.weiqi.mis;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import com.google.common.base.Preconditions;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@Slf4j
public class JacksonHelper {
private static ObjectMapper mapper = new ObjectMapper();
static {
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDateTime.class,
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
javaTimeModule.addDeserializer(LocalDateTime.class,
new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")));
javaTimeModule.addSerializer(Date.class,
new DateSerializer(false, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")));
javaTimeModule.addDeserializer(Date.class, new CustomDateDeserializer());
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false)
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
.registerModule(new ParameterNamesModule())
.registerModule(javaTimeModule);
;
mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"));
}
private JacksonHelper() {
}
public static ObjectMapper getMapper() {
return mapper;
}
@SneakyThrows
public static String serialize(Object o) {
return mapper.writeValueAsString(o);
}
@SneakyThrows
public static String serialize(Object o, boolean pretty) {
if (pretty) {
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(o);
}
return mapper.writeValueAsString(o);
}
@SneakyThrows
public static <T> T deserialize(String s, Class<T> clazz) {
if (s == null || s.length() == 0) {
return null;
}
T t = mapper.readValue(s, clazz);
return t;
}
@SneakyThrows
public static <T> T deserialize(String s, JavaType javaType) {
if (s == null || s.length() == 0) {
return null;
}
T t = mapper.readValue(s, javaType);
return t;
}
@SneakyThrows
public static <T> T deserialize(String s, TypeReference<T> clazz) {
if (s == null || s.length() == 0) {
return null;
}
T t = (T) mapper.readValue(s, clazz);
return t;
}
public static <T> T deserialize(String s, Class<T> parametrized, Class<?>... parameterClasses) {
if (s == null || s.length() == 0) {
return null;
}
try {
if (parameterClasses == null || parameterClasses.length == 0) {
T t = mapper.readValue(s, parametrized);
}
T t = mapper.readValue(s,
TypeFactory.defaultInstance().constructParametricType(parametrized, parameterClasses));
return t;
} catch (IOException e) {
log.error(s + ", " + e.getMessage());
}
return null;
}
@SneakyThrows
public static JsonNode deserialize(String s) {
if (s == null || s.length() == 0) {
return null;
}
JsonNode t = mapper.readTree(s);
return t;
}
/**
* Description 将json数据按规则组装成List<Map>格式
*
* @param jsonList 列表json数据
* @param map 对应规则 old -> new
* @param flag 是否允许旧字段值为空
* @return
*/
@SneakyThrows
public static List<Map<String, String>> reloadData(String jsonList, Map<String, String> map, boolean flag) {
List<Map<String, String>> dataMaps = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNodes = objectMapper.readTree(jsonList);
Iterator<JsonNode> jsonNodeIterator = jsonNodes.iterator();
boolean isList = jsonNodes.isArray();
if (isList) {
while (jsonNodeIterator.hasNext()) {
Map<String, String> item = new HashMap();
JsonNode jsonNode = jsonNodeIterator.next();
//获取新旧字段对应规则
Set<Map.Entry<String, String>> entries = map.entrySet();
for (Map.Entry<String, String> entry : entries) {
JsonNode jsonNodeItem = jsonNode;
String oldFiled = entry.getKey();
String newFiled = entry.getValue();
Preconditions.checkArgument(StringUtils.isNotEmpty(oldFiled), "oldFiled must not be empty");
Preconditions.checkArgument(StringUtils.isNotEmpty(newFiled), "newFiled must not be empty");
String[] split = oldFiled.split("-");
if (split.length >= 2) {
for (int i = 0; i < split.length - 1; i++) {
jsonNodeItem = jsonNodeItem.get(split[i]);
if (i == split.length - 2) {
oldFiled = split[split.length - 1];
}
}
}
//旧字段值
String oldValue = null;
try {
oldValue = jsonNodeItem.get(oldFiled).asText();
} catch (Exception e) {
if (!flag) {
log.error(oldFiled + " : get oldValue is empty" + jsonNodes.toString());
}
} finally {
item.put(newFiled, oldValue);
}
if (!flag) {
Preconditions.checkArgument(StringUtils.isNotEmpty(oldValue), "oldValue must not be empty");
}
}
if (item.size() == entries.size()) {
dataMaps.add(item);
}
}
} else {
Map<String, String> item = new HashMap();
//获取新旧字段对应规则
Set<Map.Entry<String, String>> entries = map.entrySet();
for (Map.Entry<String, String> entry : entries) {
JsonNode jsonNodeItem = jsonNodes;
String oldFiled = entry.getKey();
String newFiled = entry.getValue();
Preconditions.checkArgument(StringUtils.isNotEmpty(oldFiled), "oldFiled must not be empty");
Preconditions.checkArgument(StringUtils.isNotEmpty(newFiled), "newFiled must not be empty");
//旧字段值
String[] split = oldFiled.split("-");
if (split.length >= 2) {
for (int i = 0; i < split.length - 1; i++) {
jsonNodeItem = jsonNodeItem.get(split[i]);
if (i == split.length - 2) {
oldFiled = split[split.length - 1];
}
}
}
String oldValue = null;
try {
oldValue = jsonNodeItem.get(oldFiled).asText();
} catch (Exception e) {
if (!flag) {
log.error(oldFiled + " : get oldValue is empty" + jsonNodes.toString());
}
} finally {
item.put(newFiled, oldValue);
}
if (!flag) {
Preconditions.checkArgument(StringUtils.isNotEmpty(oldValue), "oldValue must not be empty");
}
}
if (item.size() == entries.size()) {
dataMaps.add(item);
}
}
return dataMaps;
}
public static TypeFactory getTypeFactory() {
return mapper.getTypeFactory();
}
public static <T> T toObject(JsonNode node, Class<T> clazz) {
if (node == null) {
return null;
}
if (node.isArray()) {
log.error("error when converting jsonNode to object. node is array. node: " + node);
return null;
}
T t = null;
try {
t = mapper.treeToValue(node, clazz);
} catch (Exception ex) {
log.error("error when converting jsonNode to object. node: " + node, ex);
}
return t;
}
static class CustomDateDeserializer extends DateDeserializers.DateDeserializer {
@Override
public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
Date date = null;
try {
date = super.deserialize(p, ctxt);
} catch (IOException e) {
}
if (date == null) {
date = DateHelper.deserialize(p.getText());
}
return date;
}
}
}

View File

@ -0,0 +1,71 @@
package com.weiqi.mis;
import com.google.common.base.Charsets;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
import org.springframework.util.DigestUtils;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Util {
/**
* @Author : yyy
* @Summary : md5
* @Date : 2019/07/09 15:40
*/
public final static byte[] md5(byte[] data) {
Hasher hasher = Hashing.md5().newHasher();
hasher.putBytes(data);
return hasher.hash().asBytes();
}
/**
* @Author : yyy
* @Summary : md5
* @Date : 2019/07/09 15:40
*/
public final static String md5(String data) {
Hasher hasher = Hashing.md5().newHasher();
hasher.putString(data, Charsets.UTF_8);
return hasher.hash().toString().toUpperCase();
}
public static void main(String[] args) {
System.out.println(DigestUtils.md5DigestAsHex("abc".getBytes()));
System.out.println(md5("abc").toLowerCase());
//System.out.println(getMD5Str("abc"));
}
/**
* description: 聚通达专用
*
* @param sourceStr
* @return java.lang.String
*/
public static String getMD5(String sourceStr) {
String resultStr = "";
try {
byte[] temp = sourceStr.getBytes();
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(temp);
byte[] b = md5.digest();
for (int i = 0; i < b.length; i++) {
char[] digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F'};
char[] ob = new char[2];
ob[0] = digit[(b[i] >>> 4) & 0X0F];
ob[1] = digit[b[i] & 0X0F];
resultStr += new String(ob);
}
return resultStr;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,87 @@
package com.weiqi.mis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.util.function.Consumer;
/**
* Created by sky on 2019/7/24.
*/
@Configuration
//@PropertySource("classpath:redis.properties")
public class RedisUtil {
@Value("${spring.redis.host:192.168.0.1}")
private String host;
@Value("${spring.redis.port:6793}")
private int port;
@Value("${spring.redis.timeout:5000}")
private int timeout;
@Value("${spring.redis.jedis.pool.max-idle:1}")
private int maxIdle;
@Value("${spring.redis.jedis.pool.max-wait:0}")
private long maxWaitMillis;
@Value("${spring.redis.block-when-exhausted:0}")
private boolean blockWhenExhausted;
@Bean
public JedisPool redisPoolFactory() throws Exception{
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxIdle(maxIdle);
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
// 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
// 是否启用pool的jmx管理功能, 默认true
jedisPoolConfig.setJmxEnabled(true);
JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
return jedisPool;
}
public static JedisPool pool=null;
@Autowired
void init(JedisPool _pool)
{
pool=_pool;
}
public static void call(Consumer<Jedis> fun)
{
try (Jedis jedis = pool.getResource()) {
fun.accept(jedis);
}
}
private static final String SCRIPT="local t= redis.call('time')[1]\n return redis.call('incrby',KEYS[1]..':'..KEYS[2]..':'..t,ARGV[1])";
public static Long qpsOK(String key, Integer value) {
try (Jedis jedis = pool.getResource()) {
return (Long) jedis.eval(SCRIPT,2,"incrOK",key, String.valueOf(value));
}
}
public static Long qpsERROR(String key, Integer value) {
try (Jedis jedis = pool.getResource()) {
return (Long) jedis.eval(SCRIPT,2,"incrERROR",key, String.valueOf(value));
}
}
}

View File

@ -0,0 +1,113 @@
package com.weiqi.mis;
import java.util.HashMap;
import java.util.Map;
/**
* Created by yyy on 2024/3/22.
*/
public enum ReturnCode {
UNREGISTER(104, "_appid未注册(请联系接口提供方)~"),
SIGNERROR(107, "_sign签名无效~"),
TIMESTAMPERROR(108, "_timestamp无效~"),
TIMESTAMPEXPIRES(109, "_timestamp已过期~"),
INVALID(0, "无效"),
LACK_PARAM(101, "缺少必要的请求参数"),
FORMAT_ERROR(102, "请求参数格式错误"),
LACK_APPID(103, "缺少参数_appid"),
APPID_WITHOUT(104, "该appid不存在"),
APPID_STOP(105, "该_appid已停用"),
LACK_AUTOGRAPH(106, "缺少签名"),
AUTOGRAPH_ERROR(107, "缺少签名"),
LACK_TIMESTAMP(108, "缺少参数_timestamp"),
REQUEST_INVALID(109, "请求已过期"),
REDIRECT(110, "请求重发"),
NOT_HTTPGET(111, "HTTP请求非get方式"),
NOT_HTTPPOST(112, "HTTP请求非post方式"),
API_NOT_EXIST(113, "接口版本不存在"),
NOT_API_AUTH(114, "没有接口访问权限"),
API_STOP(115, "接口已停用"),
API_OFFLINE(116, "接口不处于上线状态"),
BEYOND_FREQUENCY(117, "已超限频阀值"),
BEYOND_CURRENT_LIMIT(118, "已超限流阀值"),
IP_INVALID(119, "ip限制不能访问资源"),
WITHOUT_PCPOPCLUB(120, "获取不到pcpopclub值"),
PCPOPCLUB_ERROR(121, "pcpopclub解密失败"),
INFO_ERROR(122, "用户名或密码验证失败"),
REQUEST_ILLEGAL(123, "请求被拒绝.用来处理业务上认为定义的非法请求"),
PHONE_ERROR(124, "pcpopclub解密成功未验证手机号"),
NOT_MODIFY(125, "pcpopclub解密成功未修改初始用户名"),
WITHOUT_RESULT(126, "查询内容不存在"),
API_ERROR(127, "接口系统错误"),
TRADE_NO_EXIST(128, "交易号已经存在,重复推送数据"),
USER_NO_LOGIN(129, "用户未登录"),
OCR_NO_RESULT(130, "OCR接口识别失败"),
BAD_SOURCE(131, "source错误"),
UPLOAD_FAILE(2150137, "上传失败:请上传购车发票"),
PIC_FORMAT_ERROR(2150138, "上传失败:图片格式错误"),
USERINFO_ERROR(2150139, "调用用户中心获取用户信息失败"),
NAKED_PRICE_LACK(2150101, "缺少裸车价"),
BUY_TIME_LACK(2150102, "缺少购车时间"),
BUY_TIME_F(2150103, "购车时间不正确"),
CARPRICE_STATISTICS_EXIST(2160301, "该价格您已经点击过有帮助,不允许重复提交"),
MARKET_PRICE_EXIST(2160101, "该价格已经保存过,不允许重复保存"),
MARKET_PRICE_NOT_EXIST(2160102, "该价格不存在"),
MARKET_INVITE_NOT_EXIST(2160102, "该邀请信息不存在"),
IS_CURRENT_MEMBER(2160103, "不允许自己邀请自己"),
MARKET_PRICE_REWARD_EXIST(2160104, "已经发过奖励,不允许再次发送"),
FILE_LENGTH_OUT_OF_RANGE(105, "字节流超出范围"),
NOT_BRAND_LACK(2170002, "缺少品牌信息"),
NOT_SERIES_LACK(2170003, "缺少车系信息"),
NOT_SPEC_LACK(2170004, "缺少车型信息"),
NOT_PROVICE_LACK(2170005, "缺少省份信息"),
NOT_CITY_LACK(2170006, "缺少城市信息"),
NOT_JXS_LACK(2170007, "缺少经销商信息"),
NOT_SHOW_TIME_LACK(2170008, "缺少车展日期信息"),
NOT_CUSTOMER_NAME_LACK(2170009, "缺少客户名称信息"),
NOT_VERDOR_NAME_LACK(2170010, "缺少商家名称信息"),
SEND_AUTOSHOW_STATUS_ERROR(2170011, "发送审核状态失败"),
SEND_OCR_TOOL_CALLBACK_ERROR(2170012, "发送审核状态失败"),
SEND_CAR_OWNER_STATUS_ERROR(2170013, "发送审核状态失败"),
NOT_PKUUID_LACK(2170014,"缺少pkuuid"),
// 验证码相关
VCODE_MISSING_GVCODE(3000100, "请输入图片验证码"),
VCODE_BAD_GVCODE(3000201, "图片验证码错误"),
VCODE_SEND_FAILED(3001101, "验证码发送失败");
private int code;
private String desc;
private ReturnCode(int code, String desc) {
this.code = code;
this.desc = desc;
}
private static Map<Integer, ReturnCode> codes = new HashMap<Integer, ReturnCode>();
public int getCode() {
return this.code;
}
public String getDesc() {
return this.desc;
}
public static ReturnCode getReturnCode(int code) {
ReturnCode[] types = values();
for (ReturnCode ct : types) {
if (ct.getCode() == code) {
return ct;
}
}
return null;
}
}

View File

@ -0,0 +1,99 @@
package com.weiqi.mis;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.util.Map;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({"code", "msg", "data"})
public class ReturnValue<T> implements Serializable {
@JsonProperty("code")
private int code;
private String msg;
private int count;
private T data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public static <T> ReturnValue<T> buildSuccessdata(T obj) {
ReturnValue<T> rt = new ReturnValue<>();
rt.setCode(0);
rt.setData(obj);
rt.setMsg("");
return rt;
}
public static <T> ReturnValue<T> buildSuccessdata(T obj,int count) {
ReturnValue<T> rt = new ReturnValue<>();
rt.setCode(0);
rt.setData(obj);
rt.setCount(count);
rt.setMsg("");
return rt;
}
public static ReturnValue buildErrordata(int code, String msg) {
ReturnValue rt = new ReturnValue();
rt.setCode(code);
rt.setMsg(msg);
return rt;
}
public static Map<String, Object> buildSuccessdata() {
return ImmutableMap.of("code", 0, "msg", "");
}
public static Map buildErrormsg(int code, String msg) {
return ImmutableMap.of("code", code, "msg", msg);
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "ReturnValue{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

View File

@ -0,0 +1,80 @@
package com.weiqi.mis;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.util.Map;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({"returnCode", "message", "result"})
public class ReturnValueApi<T> implements Serializable {
@JsonProperty("returncode")
private int returnCode;
private String message;
private T result;
public int getReturnCode() {
return returnCode;
}
public void setReturnCode(int returnCode) {
this.returnCode = returnCode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
public static <T> ReturnValueApi<T> buildSuccessResult(T obj) {
ReturnValueApi<T> rt = new ReturnValueApi<>();
rt.setReturnCode(0);
rt.setResult(obj);
rt.setMessage("");
return rt;
}
public static ReturnValueApi buildErrorResult(int returnCode, String message) {
ReturnValueApi rt = new ReturnValueApi();
rt.setReturnCode(returnCode);
rt.setMessage(message);
return rt;
}
public static Map<String, Object> buildSuccessResult() {
return ImmutableMap.of("returncode", 0, "message", "");
}
public static Map buildErrorMessage(int returnCode, String message) {
return ImmutableMap.of("returncode", returnCode, "message", message);
}
@Override
public String toString() {
return "ReturnValue{" +
"returnCode=" + returnCode +
", message='" + message + '\'' +
", result=" + result +
'}';
}
}

View File

@ -0,0 +1,99 @@
package com.weiqi.mis;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.util.Map;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({"code", "msg", "data"})
public class ReturnValuePage<T> implements Serializable {
@JsonProperty("code")
private int code;
private String msg;
private int count;
private T data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public static <T> ReturnValuePage<T> buildSuccessdata(T obj) {
ReturnValuePage<T> rt = new ReturnValuePage<>();
rt.setCode(0);
rt.setData(obj);
rt.setMsg("");
return rt;
}
public static <T> ReturnValuePage<T> buildSuccessdata(T obj,int count) {
ReturnValuePage<T> rt = new ReturnValuePage<>();
rt.setCode(0);
rt.setData(obj);
rt.setCount(count);
rt.setMsg("");
return rt;
}
public static ReturnValuePage buildErrordata(int code, String msg) {
ReturnValuePage rt = new ReturnValuePage();
rt.setCode(code);
rt.setMsg(msg);
return rt;
}
public static Map<String, Object> buildSuccessdata() {
return ImmutableMap.of("code", 0, "msg", "");
}
public static Map buildErrormsg(int code, String msg) {
return ImmutableMap.of("code", code, "msg", msg);
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "ReturnValuePage{" +
"code=" + code +
", msg='" + msg + '\'' +
", count=" + count +
", data=" + data +
'}';
}
}

View File

@ -0,0 +1,39 @@
package com.weiqi.mis;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class SpAddr {
public static String path = "";
public static Map<String,Long> selfOkMap = new TreeMap<>();
public static Map<String,Long> selfErrMap = new TreeMap<>();
public static Map<String,String> yzMap = new TreeMap<>();
public static Map<String,String> js1Map = new TreeMap<>();
public static Map<String,String> yzMapF = new TreeMap<>();
public static Map<String,String> js1MapF = new TreeMap<>();
//流量图表请求地址
static {
//流量机器
// yzMapF.put("10.168.12.81:4000","初始化");
// yzMapF.put("10.27.156.9","初始化");
}
}

View File

@ -0,0 +1,59 @@
package com.weiqi.mis;
import java.util.HashMap;
import java.util.Map;
public class StringUtils {
/**
* 反转
*
* @param str
* @return
*/
public static String reverse(String str) {
char[] chars = str.toCharArray();
String reverse = "";
for (int i = chars.length - 1; i >= 0; i--) {
reverse += chars[i];
}
return reverse;
}
/**
* 切割项目名称
*
* @param path
* @return
*/
public static String getPath(String path) {
// String path1 = "/data/jiage-sms-mis/deploy/jiage-sms-mis_9081/WEB-INF/classes/";
String patharr[] = path.split("/");
if (patharr.length > 5) {
return patharr[4];
}
return path;
}
/**
* 格式化body
*
* @param str 目标字符串
* @param values 储值对象
* @return
*/
public static String fmtByObj(String str, Map<String, String> values) {
for (String key : values.keySet()) {
str = str.replace("{" + key + "}", values.get(key));
}
return str;
}
}

View File

@ -0,0 +1,39 @@
package com.weiqi.mis;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by yyy on 2018/5/29.
*/
@Configuration
public class ThreadPoolConfig {
private int corePoolSize = 30;//线程池维护线程的最少数量
private int maxPoolSize = 50;//线程池维护线程的最大数量
private int queueCapacity = 100; //缓存队列
private int keepAlive = 60;//允许的空闲时间
@Bean(name = "threadPool")
public Executor getThreadPool(){
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("carPriceExecutor-");
// rejection-policy当pool已经达到max size的时候如何处理新任务
// CALLER_RUNS不在新线程中执行任务而是由调用者所在的线程来执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //对拒绝task的处理策略
executor.setKeepAliveSeconds(keepAlive);
executor.initialize();
return executor;
}
}

View File

@ -0,0 +1,15 @@
package com.weiqi.mis;
public class URLEncodeUtil {
//生成urlencode方法
public static String urlEncode(String str) {
String result = "";
try {
result = java.net.URLEncoder.encode(str, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}

View File

@ -0,0 +1,48 @@
package com.weiqi.mis;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class XmlUtil {
/**
* xml map
* @param soap
* @return
*/
public static Map xml2Map(String soap) {
Map<String, Object> map = new HashMap<String, Object>();
Document doc = null;// 报文转成doc对象
try {
doc = DocumentHelper.parseText(soap);
} catch (DocumentException e) {
e.printStackTrace();
return map;
}
Element root = doc.getRootElement();// 获取根元素准备递归解析这个XML树
getCode(root, map);
return map;
}
public static void getCode(Element root, Map<String, Object> map) {
if (root.elements() != null) {
List<Element> list = root.elements();// 如果当前跟节点有子节点找到子节点
for (Element e : list) {// 遍历每个节点
if (e.elements().size() > 0) {
getCode(e, map);// 当前节点不为空的话递归遍历子节点
}
if (e.elements().size() == 0) {
map.put(e.getName(), e.getTextTrim());
} // 如果为叶子节点那么直接把名字和值放入map
}
}
}
}

View File

@ -0,0 +1,974 @@
package com.weiqi.mis;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StopWatch;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
// import com.weiqi.chat.common.model.FilePart;
/**
* Created by lindaohui on 2018/3/22.
*/
public final class Z {
private final static Logger logger = LoggerFactory.getLogger(Z.class);
public static ObjectMapper objectMapper;
public static MapperFacade orikaMapper;
/**
* 服务器 IP
*/
public static final String SERVER_IP;
static {
String hostAddress;
try {
hostAddress = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
hostAddress = "Unknown";
}
SERVER_IP = hostAddress;
}
/**
* 默认时间格式
*/
private static final SimpleDateFormat defaultDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static {
// jackson
objectMapper = new ObjectMapper();
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); // 缺字段不报异常
objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); // @class
// 信息
// objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); // 驼峰变下滑线
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
// orika
MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
orikaMapper = mapperFactory.getMapperFacade();
}
/**
* 字符串合并方法返回一个合并后的字符串,.net里的format函数
*
* @param str
* @param args
* @return
*/
public static String fmt(String str, Object... args) {
if (str == null || "".equals(str) || args.length == 0)
return str;
String result = str.intern();
Pattern p = Pattern.compile("\\{(\\d+)\\}");
java.util.regex.Matcher m = p.matcher(str);
while (m.find()) {
int index = Z.parseInt(m.group(1));
if (index < args.length) {
result = result.replace(m.group(), args[index] == null ? "" : args[index].toString());
}
}
return result;
}
public static int parseInt(String s) {
return parseInt(s, 0);
}
public static Integer parseInt(String s, int def) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
return def;
}
}
public static <T> T fromJSON(final TypeReference<T> typeReference, final String jsonString) throws Exception {
T data = Z.objectMapper.readValue(jsonString, typeReference);
return data;
}
public static <T> T fromJSON(final Class<T> tClass, final String jsonString) throws Exception {
T data = Z.objectMapper.readValue(jsonString, tClass);
return data;
}
public static String toJSON(Object val) throws Exception {
String str = Z.objectMapper.writeValueAsString(val);
return str;
}
public static String safeToJSON(Object val) {
String str = "";
try {
str = Z.toJSON(val);
} catch (Exception e) {
logger.debug("toJSON 发生异常errMsg{}val{}", e.getMessage(), val, e);
}
return str;
}
public static <T> T safeFromJSON(final Class<T> tClass, final String jsonString) {
T data = null;
try {
data = Z.objectMapper.readValue(jsonString, tClass);
} catch (IOException e) {
logger.debug("safeFromJSON 发生异常errMsg{}jsonString{}", e.getMessage(), jsonString, e);
}
return data;
}
/**
* 简单的复制出新类型对象
*
* @param source
* @param destinationClass
* @param <S>
* @param <D>
* @return
*/
public static <S, D> D map(S source, Class<D> destinationClass) {
return orikaMapper.map(source, destinationClass);
}
/**
* 简单的复制出新类型对象
*
* @param source
* @param destinationClass
* @param <S>
* @param <D>
* @return
*/
public static <S, D> List<D> mapAsList(Iterable<S> source, Class<D> destinationClass) {
return orikaMapper.mapAsList(source, destinationClass);
}
// /**
// * @param min 这个正则过于严格无法满足需求
// * 最小值
// * @param max
// * 最大值会返回最大值
// * @return
// */
// public static int getRandom(int min, int max) {
// return (int)(min + Math.random() * (max - min + 1));
// }
//
// public static boolean isMobile(String mobile) {
// if (mobile == null) {
// return false;
// }
// Pattern pattern = Pattern.compile("^0?1[34578]\\d{9}$");
// Matcher matcher = pattern.matcher(mobile);
// return matcher.matches();
// }
public static boolean isNullOrEmpty(String content) {
return content == null || content.length() == 0;
}
/**
* 是否为 null 或者小于1
*
* @param value
* @return
*/
public static boolean isNullOrLessOne(Integer value) {
return value == null || value < 1;
}
/**
* 是否为 null 或者长度为0
*
* @param collection
* @return
*/
public static boolean isNullOrEmpty(Collection collection) {
return collection == null || collection.size() == 0;
}
public static String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("F443CIP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CIP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
if (!isNullOrEmpty(ip)) {
ip = ip.split(",")[0];
}
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("REMOTE_ADDR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CDN_SRC_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
if (ip != null && ip.startsWith("::")) {
ip = "127.0.0.1";
}
return ip;
}
/**
* 获取本地主机名字
*
* @return
*/
public static String getLocalHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
return "unknown";
}
}
public static String getParameter(HttpServletRequest request, String name) {
Enumeration<String> parameterNames = request.getParameterNames();
while (parameterNames.hasMoreElements()) {
String key = parameterNames.nextElement();
if (name.equalsIgnoreCase(key)) {
return request.getParameter(key);
}
}
return "";
}
public static int getParameterForInt(HttpServletRequest request, String name, int defaultValue) {
String str = getParameter(request, name);
if (isNullOrEmpty(str)) {
return defaultValue;
}
try {
return Integer.parseInt(str);
} catch (Exception e) {
return defaultValue;
}
}
public static Cookie getCookie(Cookie[] cookies, String name) {
if (cookies != null) {
for (Cookie cookie : cookies) {
if (name.equalsIgnoreCase(cookie.getName())) {
return cookie;
}
}
}
return null;
}
public static String joinString(Object[] array, String regex) {
int length = array.length;
if (length < 1) {
return "";
}
if (length == 1) {
return array[0].toString();
}
StringBuilder sb = new StringBuilder(array[0].toString());
for (int i = 1; i < length; i++) {
sb.append(regex);
sb.append(array[i]);
}
return sb.toString();
}
public static String formatLogContent(String url, String queryString, String message) {
String args = message;
if (url != null && !url.isEmpty()) {
args += "," + Z.safeURLEncode(url);
}
if (queryString != null && !queryString.isEmpty()) {
args += "," + Z.safeURLEncode(queryString);
}
return args;
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd*HH:mm:ss");
// String args = "host_str=&url_str=" + url + "&query_str=";
// try {
// args += URLEncoder.encode(queryString, "utf-8");
// } catch (Exception e) {
// }
// return String.format("`%s`cyqchat`%s`%s", simpleDateFormat.format(new Date()).replace('*', 'T'), args,
// message);
}
public static String formatLogContent(String message) {
return formatLogContent("", "", message);
}
public static String httpGet(String url) throws Exception {
return httpGet(url, 0, "utf-8", null);
}
public static String httpGet(String url, Map<String, String> headerMap) throws Exception {
return httpGet(url, 0, "utf-8", headerMap);
}
public static String httpGet(String url, Integer timeout, String receiveEncoding) throws Exception {
return httpGet(url, timeout, receiveEncoding, null);
}
public static String httpGet(String url, Integer timeout, String receiveEncoding, Map<String, String> headerMap)
throws Exception {
if (isNullOrEmpty(url)) {
throw new Exception("url is empty");
}
logger.debug("httpGet url:{}, timeout:{}, receiveEncoding:{}, headerMap:{}", url, timeout, receiveEncoding,
headerMap);
// 计时开始
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// 调用接口
URL httpUrl = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection)httpUrl.openConnection();
httpConnection.setRequestMethod("GET");
if (timeout > 0) {
httpConnection.setConnectTimeout(timeout);
httpConnection.setReadTimeout(timeout);
}
if (headerMap != null) {
for (Map.Entry<String, String> mapEntry : headerMap.entrySet()) {
httpConnection.setRequestProperty(mapEntry.getKey(), mapEntry.getValue());
}
}
httpConnection.setRequestProperty("Accept-Charset", receiveEncoding);
BufferedReader inputBufferedReader = new BufferedReader(new InputStreamReader(
httpConnection.getResponseCode() == 200 ? httpConnection.getInputStream() : httpConnection.getErrorStream(),
receiveEncoding));
StringBuilder sb = new StringBuilder();
String readLine = null;
while ((readLine = inputBufferedReader.readLine()) != null) {
sb.append(readLine);
// sb.append("\r\n");
}
inputBufferedReader.close();
httpConnection.disconnect();
// 计时结束
stopWatch.stop();
Long pastTime = stopWatch.getLastTaskTimeMillis();
if (pastTime > 200) {
logger.warn(formatLogContent(url, "", "request tired - httpGet, " + pastTime + "ms"));
}
logger.debug("httpGet response{}", sb.toString());
return sb.toString();
}
/**
* 获取请求响应状态码
*
* @param url
* @param timeout
* @return
* @throws IOException
*/
public static Integer httpGetResponseCode(String url, Integer timeout) {
Integer code;
try {
URL httpUrl = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection)httpUrl.openConnection();
if (timeout > 0) {
httpConnection.setConnectTimeout(timeout);
httpConnection.setReadTimeout(timeout);
}
httpConnection.setRequestMethod("GET");
code = httpConnection.getResponseCode();
httpConnection.disconnect();
} catch (IOException e) {
code = 500;
logger.error("获取请求响应状态码发送异常errMsg{}url{}timeout{}", e.getMessage(), url, timeout, e);
}
return code;
}
public static String httpPost(String url, String data, Map<String, String> headerMap) throws Exception {
return httpPost(url, 0, "utf-8", "utf-8", data, headerMap);
}
public static String httpPost(String url, Integer timeout, String sendEncoding, String receiveEncoding, String data,
Map<String, String> headerMap) throws Exception {
if (isNullOrEmpty(url)) {
throw new Exception("url is empty");
}
logger.debug("发起 HTTP POST 请求,请求地址:{},超时时间:{},发送编码:{},接收编码:{},数据:{},请求头:{}", url, timeout, sendEncoding,
receiveEncoding, data, headerMap);
// 计时开始
StopWatch stopWatch = new StopWatch();
stopWatch.start();
// 调用接口
URL httpUrl = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection)httpUrl.openConnection();
httpConnection.setRequestMethod("POST");
if (timeout > 0) {
httpConnection.setConnectTimeout(timeout);
httpConnection.setReadTimeout(timeout);
}
// 默认headers
httpConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if (headerMap != null) {
for (Map.Entry<String, String> mapEntry : headerMap.entrySet()) {
httpConnection.setRequestProperty(mapEntry.getKey(), mapEntry.getValue());
}
}
httpConnection.setRequestProperty("Content-Length", String.valueOf(data.length()));
httpConnection.setRequestProperty("Accept-Charset", receiveEncoding);
// 发送 post 必须
httpConnection.setDoOutput(true);
httpConnection.setDoInput(true);
// 输出参数
BufferedWriter outputBufferedWriter =
new BufferedWriter(new OutputStreamWriter(httpConnection.getOutputStream(), sendEncoding));
outputBufferedWriter.write(data);
outputBufferedWriter.flush();
outputBufferedWriter.close();
// 输入内容
BufferedReader inputBufferedReader = new BufferedReader(new InputStreamReader(
httpConnection.getResponseCode() == 200 ? httpConnection.getInputStream() : httpConnection.getErrorStream(),
receiveEncoding));
StringBuilder sb = new StringBuilder();
String readLine = null;
while ((readLine = inputBufferedReader.readLine()) != null) {
sb.append(readLine);
// sb.append("\r\n");
}
inputBufferedReader.close();
httpConnection.disconnect();
// 计时结束
stopWatch.stop();
Long pastTime = stopWatch.getLastTaskTimeMillis();
if (pastTime > 100) {
logger.warn(formatLogContent(url, "", "request tired - httpPost, " + pastTime + "ms"));
}
logger.debug("HTTP POST 请求结束,响应内容:{}", sb.toString());
return sb.toString();
}
/**
* 检查是否包含特殊字符
*
* @param content
* @return
*/
public static boolean isSpecialChar(String content) {
String pattern =
"^[\u4e00-\u9fa5A-Za-z0-9\u0000-\u00FF\uFF00-\uFFFF ———……》、『 【 € ■ ○ ◆\"\":;。,!…—·ˉˇ¨〃|`'∶‖‘’〔〕〈〉《》「」『』.〖〗【】()"
+ ((char)8220) + "" + ((char)8221) + "[]{}々~/?《、]+$";
return !content.matches(pattern);
}
/**
* 将值转换为整数 转换失败使用默认值
*
* @param value
* @param defaultValue
* @return
*/
public static Integer valueOfInteger(String value, Integer defaultValue) {
try {
if (value == null || !value.matches("\\d+")) {
return defaultValue;
}
return Z.valueOfInteger(value);
} catch (Exception e) {
logger.error("valueOfInteger error, value:{}, defaultValue:{}", value, defaultValue);
return defaultValue;
}
}
/**
* 将值转换为整数
*
* @param value
* @return
*/
public static Integer valueOfInteger(String value) {
return Integer.valueOf(value);
}
/**
* Map转keyvalue
*
* @param map
* @return
*/
public static String mapConvertParams(Map<String, String> map) {
StringBuffer sb = new StringBuffer();
if (map == null) {
return sb.toString();
}
for (Map.Entry<String, String> entry : map.entrySet()) {
sb.append("&").append(entry.getKey()).append("=").append(Z.safeURLEncode(entry.getValue()));
}
return sb.substring(1);
}
/**
* 格式化日期
*
* @param date
* @return
*/
public static String formatDate(Date date) {
return defaultDateFormat.format(date);
}
/**
* 转换时间
*
* @param date
* @return
*/
public static Optional<Date> convertDate(String date) {
try {
return Optional.ofNullable(defaultDateFormat.parse(date));
} catch (ParseException e) {
logger.error("转换时间发生异常errMsg{}date{}", e.getMessage(), date, e);
return Optional.empty();
}
}
public static Optional<Date> convertDate(String date, String pattern) {
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
return Optional.ofNullable(dateFormat.parse(date));
} catch (ParseException e) {
logger.error("转换时间发生异常errMsg{}date{}", e.getMessage(), date, e);
return Optional.empty();
}
}
/**
* 获取请求响应流
*
* @param url
* @param timeout
* @return
* @throws IOException
*/
public static InputStream httpGetInputStream(String url, Integer timeout) throws IOException {
URL httpUrl = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection)httpUrl.openConnection();
if (timeout > 0) {
httpConnection.setConnectTimeout(timeout);
httpConnection.setReadTimeout(timeout);
}
httpConnection.setRequestMethod("GET");
InputStream inputStream = httpConnection.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while ((len = inputStream.read(buffer)) > -1) {
baos.write(buffer, 0, len);
}
baos.flush();
httpConnection.disconnect();
return new ByteArrayInputStream(baos.toByteArray());
}
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
/**
* 将集合根据指定长度进行分区 分区集合为原集合的子集合 修改原集合对象分区内的信息也会改变 具体可参看测试用例
*
* @param list
* 原集合
* @param size
* 长度
* @param <T>
* @return 分区后的集合对象
*/
public static <T> List<List<T>> partition(List<T> list, Integer size) {
List<List<T>> lists = new ArrayList<>();
for (int i = 0; i < list.size(); i += size) {
// i + size 大于集合长度时截止位置为集合长度
int end = Math.min(list.size(), i + size);
lists.add(list.subList(i, end));
}
return lists;
}
/**
* 安全的 URL 编码 发生异常返回空字符串
*
* @param content
* 内容
* @param encoding
* 编码
* @return
*/
public static String safeURLEncode(String content, String encoding) {
try {
return URLEncoder.encode(content, encoding);
} catch (UnsupportedEncodingException e) {
return "";
}
}
/**
* 使用 UTF-8 编码 安全的 URL 编码 发生异常返回空字符串
*
* @param content
* 内容
* @return
*/
public static String safeURLEncode(String content) {
return safeURLEncode(content, "UTF-8");
}
/**
* @param list
* 使用分隔符连接集合
* @param delimiter
* 连接后的字符串
* @return
*/
public static <T> String joinString(List<T> list, String delimiter) {
String result = list.stream().map(i -> i.toString()).collect(Collectors.joining(delimiter));
return result;
}
/**
* 字符串按指定字元打断成List<Long> 无效成员被忽略永远不抛异常默认按照逗号打断
*
* @param submitid
* @param splitChar
* @return
*/
public static List<Long> SplitToLongList(String submitid, char splitChar) {
List<Long> list = new ArrayList<>();
if (submitid.isEmpty()) {
return list;
}
if (splitChar == '\0') {
splitChar = ',';
}
String[] split = submitid.split(String.valueOf(splitChar));
for (String s : split) {
try {
Long aLong = Long.valueOf(s);
list.add(aLong);
} catch (NumberFormatException e) {
// e.printStackTrace();
}
}
return list;
}
/**
* 字符串按指定字元打断成List<String>
*
* @param msgid
* @param c
* @return
*/
public static List<String> SplitToStringList(String msgid, char c) {
List<String> list = new ArrayList<>();
String[] split = msgid.split(String.valueOf(c));
for (String s : split) {
if(s.length()==0){
//防止空字符问题
continue;
}
list.add(s);
}
return list;
}
/**
* 对字符串拆分并去重
*
* @param mobile
* @param s
* @return
*/
public static List<String> SplitAndDistinct(String mobile, String s) {
List<String> list = new ArrayList<>();
String[] split = mobile.split(s);
for (String s1 : split) {
if (!list.contains(s1)) {
list.add(s1);
}
}
return list;
}
/**
* 读取ip配置列表支撑多种分隔符及ip段表示法
*
* @param ipConfigValue
* @return
*/
public static List<String> ReadIpConfig(String ipConfigValue) {
List<String> list = new ArrayList<>();
if (StringUtils.isBlank(ipConfigValue)) {
return list;
}
String ipSplit =
ipConfigValue.replace(" ", "").replace(" ", "").replace("\t", "").replace("\r\n", ",").replace("\n", ",");
String[] split = ipSplit.split("[;,|]");
List<String> arr = new ArrayList<>();
for (String s : split) {
if (s.length() > 0) {
arr.add(s);
}
}
for (String ip : arr) {
if (ip.contains("-")) {
list.addAll(readIpSection(ip));
} else {
list.add(ip);
}
}
return list;
}
public static List<String> readIpSection(String ip) {
List<String> list = new ArrayList<>();
String[] arr = ip.split("\\.|\\,|\\-");
if (arr.length == 5) {
String network = arr[0] + "." + arr[1] + "." + arr[2] + ".";
int ipStart = Integer.parseInt(arr[3]);
int ipEnd = Integer.parseInt(arr[4]);
for (int i = ipStart; i <= ipEnd; i++) {
list.add(network + i);
}
}
return list;
}
public static String objectToJson(Object obj) {
String json = null;
if (obj == null) {
return null;
}
try {
json = Z.objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
logger.error(e.getMessage(), e);
}
return json;
}
public static <T> T jsonToObject(Class<T> objType, String json) {
T obj = null;
try {
obj = Z.objectMapper.readValue(json, objType);
} catch (IOException ie) {
logger.error(ie.getMessage(), ie);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return obj;
}
/**
* 模板的用这个
*/
public static <T> T jsonToObject(final TypeReference<T> type, final String jsonPacket) {
if (org.springframework.util.StringUtils.isEmpty(jsonPacket)) {
return null;
}
T data = null;
try {
data = Z.objectMapper.readValue(jsonPacket, type);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return data;
}
public static long getCurrentTime() {
return System.currentTimeMillis() / 1000;
}
public static long getRandom() {
return (new Random(getCurrentTime())).nextInt(900000) + 100000;
}
static String md5(String password) {
String encodeStr = DigestUtils.md5Hex(password + "SMmsEncryptKey");
return encodeStr.toUpperCase();
}
public static String calculateSignature(String accountId, String password, long random, long timestamp,
String mobile) {
StringBuilder builder =
new StringBuilder("AccountId=").append(accountId).append("&PhoneNos=").append(mobile).append("&Password=")
.append(md5(password)).append("&Random=").append(random).append("&Timestamp=").append(timestamp);
return sha256(builder.toString());
}
/**
* SHA256 加密
*
* @param str
* @return
*/
private static String sha256(String str) {
MessageDigest messageDigest;
String encodestr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes("UTF-8"));
encodestr = byte2Hex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodestr;
}
/**
* 将byte转为16进制
*
* @param bytes
* @return
*/
private static String byte2Hex(byte[] bytes) {
StringBuffer buffer = new StringBuffer();
String temp = null;
for (int i = 0; i < bytes.length; i++) {
temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length() == 1) {
buffer.append("0");
}
buffer.append(temp);
}
return buffer.toString();
}
/**
* 获取精确到秒的时间戳
*
* @param date
* @return
*/
public static int getSecondTimestamp(Date date) {
if (null == date) {
return 0;
}
String timestamp = String.valueOf(date.getTime());
int length = timestamp.length();
if (length > 3) {
return Integer.valueOf(timestamp.substring(0, length - 3));
} else {
return 0;
}
}
public static void main(String[] args) throws Exception {
}
public static String dealDateFormat(String oldDate) {
Date date1 = null;
DateFormat df2 = null;
try {
oldDate = oldDate.replace("Z", " UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
Date date = df.parse(oldDate);
SimpleDateFormat df1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
date1 = df1.parse(date.toString());
df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
} catch (ParseException e) {
e.printStackTrace();
}
return df2.format(date1);
}
public static String Base64Encode(String message) {
/*String encode = "";
try {
encode = URLEncoder.encode(message, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
byte[] bytes = encode.getBytes();
return Base64.getEncoder().encodeToString(bytes);*/
byte[] utf8s = null;
try {
utf8s = message.getBytes("utf8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return Base64.getEncoder().encodeToString(utf8s);
}
}

View File

@ -0,0 +1,454 @@
package com.weiqi.util;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
public class DingTalkUtils {
private static final Logger log = LoggerFactory.getLogger(DingTalkUtils.class);
/**
* 钉钉群设置 webhook, 支持重置
*/
// private static String ACCESS_TOKEN= "https://oapi.dingtalk.com/robot/send?access_token=d35626c41065d6d6e300a1493bb90a7a16c24a4143a9f0455ce631f1c12a5139";
// private static final String SECRET = "SEC6c7d9617b9d767a382b524295a3bb47b5376e75a399a658db6192de33e65238e";
/**
* 钉钉报警群
*/
private static String ACCESS_TOKEN= "https://oapi.dingtalk.com/robot/send?access_token=1bcda404d18977ab2fce2c0e723e17f4d795ce4289d59c67ce968462509dde96";
private static final String SECRET = "SECc0e2b27d818994ab113c7972509da627f32c0e1e94a6564bad91b2032ae600fd";
public static final List<String> PHONE = Arrays.asList("18975045528");
/**
* 消息类型
*/
private static final String MSG_TYPE_TEXT = "text";
private static final String MSG_TYPE_LINK = "link";
private static final String MSG_TYPE_MARKDOWN = "markdown";
private static final String MSG_TYPE_ACTION_CARD = "actionCard";
private static final String MSG_TYPE_FEED_CARD = "feedCard";
/**
* 客户端实例
*/
private static DingTalkClient client;
static {
try {
client = new DefaultDingTalkClient(ACCESS_TOKEN + sign());
} catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) {
e.printStackTrace();
}
}
/**
* 官方演示示例
* title 是消息列表下透出的标题
* text 是进入群后看到的消息内容
* 注意事项
* 1.文本链接Markdown会存在覆盖推送最后一个定义的消息
* 2.自定义机器人关键字要包含在content或title中text.setContent("");link.setTitle("");markdown.setTitle("");
*
* @return OapiRobotSendResponse
*/
public static void sdkDemoJava() {
//请求对象
OapiRobotSendRequest request = new OapiRobotSendRequest();
//链接
request.setMsgtype("link");
OapiRobotSendRequest.Link link = new OapiRobotSendRequest.Link();
link.setMessageUrl("https://www.dingtalk.com/");
link.setPicUrl("");
link.setTitle("时代的火车向前开");
link.setText("这个即将发布的新版本创始人阿Q称它为红树林。而在此之前每当面临重大升级产品经理们都会取一个应景的代号这一次为什么是红树林");
request.setLink(link);
//Markdown
request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
markdown.setTitle("南京的天气真好呀");
markdown.setText("#### 南京的天气真好呀 @130****1239\n" +
"> 9度西北风1级空气良89相对温度73%\n\n" +
"> ![screenshot](https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png)\n" +
"> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n");
request.setMarkdown(markdown);
//文本
request.setMsgtype("text");
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent("大家好!我是 DingTalkRobot 机器人,很高兴为你们服务!");
request.setText(text);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(Arrays.asList("130****1239"));
// isAtAll类型如果不为Boolean请升级至最新SDK
at.setIsAtAll(true);
at.setAtUserIds(Arrays.asList("109929", "32099"));
request.setAt(at);
try {
OapiRobotSendResponse response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】消息发送演示示例 响应参数:" + JSON.toJSONString(response));
} catch ( com.taobao.api.ApiException e) {
log.error("[ApiException]: 消息发送演示示例, 异常捕获{}", e.getMessage());
}
}
/**
* 发送普通文本消息
*
* @param content 文本消息
* @param mobileList 指定@ 联系人
* @param isAtAll 是否@ 全部联系人
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByText(String content, List<String> mobileList, boolean isAtAll) {
if (StringUtils.isEmpty(content)) {
return null;
}
//参数 参数类型 必须 说明
//msgtype String 消息类型此时固定为text
//content String 消息内容
//atMobiles Array @人的手机号(在content里添加@人的手机号)
//isAtAll bool @所有人时true否则为false
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent(content);
OapiRobotSendRequest request = new OapiRobotSendRequest();
if (!CollectionUtils.isEmpty(mobileList)) {
// 发送消息并@ 以下手机号联系人
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setAtMobiles(mobileList);
at.setIsAtAll(isAtAll);
request.setAt(at);
}
request.setMsgtype(DingTalkUtils.MSG_TYPE_TEXT);
request.setText(text);
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】发送普通文本消息 响应参数:" + JSON.toJSONString(response));
} catch ( com.taobao.api.ApiException e) {
log.error("[发送普通文本消息]: 发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 发送link 类型消息
*
* @param title 消息标题
* @param text 消息内容
* @param messageUrl 点击消息后跳转的url
* @param picUrl 插入图片的url
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByLink(String title, String text, String messageUrl, String picUrl) {
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(text) || StringUtils.isEmpty(messageUrl)) {
return null;
}
//参数 参数类型 必须 说明
//msgtype String 消息类型此时固定为link
//title String 消息标题
//text String 消息内容如果太长只会部分展示
//messageUrl String 点击消息跳转的URL
//picUrl String 图片URL
OapiRobotSendRequest.Link link = new OapiRobotSendRequest.Link();
link.setTitle(title);
link.setText(text);
link.setMessageUrl(messageUrl);
link.setPicUrl(picUrl);
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype(DingTalkUtils.MSG_TYPE_LINK);
request.setLink(link);
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】发送link 响应参数:" + JSON.toJSONString(response));
} catch (com.taobao.api.ApiException e) {
log.error("[发送link 类型消息]: 发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 发送Markdown 编辑格式的消息
*
* @param title 标题
* @param markdownText 支持markdown 编辑格式的文本信息
* @param mobileList 消息@ 联系人
* @param isAtAll 是否@ 全部
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByMarkdown(String title, String markdownText, List<String> mobileList, boolean isAtAll) {
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(markdownText)) {
return null;
}
//参数 类型 必选 说明
//msgtype String 此消息类型为固定markdown
//title String 首屏会话透出的展示内容
//text String markdown格式的消息
//atMobiles Array @人的手机号(在text内容里要有@手机号)
//isAtAll bool @所有人时true否则为false
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
markdown.setTitle(title);
markdown.setText(markdownText);
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype(DingTalkUtils.MSG_TYPE_MARKDOWN);
request.setMarkdown(markdown);
if (!CollectionUtils.isEmpty(mobileList)) {
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setIsAtAll(isAtAll);
at.setAtMobiles(mobileList);
request.setAt(at);
}
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
// System.out.println("【DingTalkUtils】发送link 响应参数:" + JSON.toJSONString(response));
} catch ( com.taobao.api.ApiException e) {
log.error("[发送link 类型消息]: 发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 整体跳转ActionCard类型的消息发送
*
* @param title 消息标题, 会话消息会展示标题
* @param markdownText markdown格式的消息
* @param singleTitle 单个按钮的标题
* @param singleURL 单个按钮的跳转链接
* @param btnOrientation 是否横向排列(true 横向排列, false 纵向排列)
* @param hideAvatar 是否隐藏发消息者头像(true 隐藏头像, false 不隐藏)
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByActionCardSingle(String title, String markdownText, String singleTitle, String singleURL, boolean btnOrientation, boolean hideAvatar) {
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(markdownText)) {
return null;
}
//参数 类型 必选 说明
// msgtype string true 此消息类型为固定actionCard
// title string true 首屏会话透出的展示内容
// text string true markdown格式的消息
// singleTitle string true 单个按钮的方案(设置此项和singleURL后btns无效)
// singleURL string true 点击singleTitle按钮触发的URL
// btnOrientation string false 0-按钮竖直排列1-按钮横向排列
// hideAvatar string false 0-正常发消息者头像1-隐藏发消息者头像
OapiRobotSendRequest.Actioncard actionCard = new OapiRobotSendRequest.Actioncard();
actionCard.setTitle(title);
actionCard.setText(markdownText);
actionCard.setSingleTitle(singleTitle);
actionCard.setSingleURL(singleURL);
// 此处默认为0
actionCard.setBtnOrientation(btnOrientation ? "1" : "0");
// 此处默认为0
actionCard.setHideAvatar(hideAvatar ? "1" : "0");
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype(DingTalkUtils.MSG_TYPE_ACTION_CARD);
request.setActionCard(actionCard);
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】整体跳转ActionCard类型的发送消息 响应参数:" + JSON.toJSONString(response));
} catch (com.taobao.api.ApiException e) {
log.error("[发送ActionCard 类型消息]: 整体跳转ActionCard类型的发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 独立跳转ActionCard类型 消息发送
*
* @param title 标题
* @param markdownText 文本
* @param btns 按钮列表
* @param btnOrientation 是否横向排列(true 横向排列, false 纵向排列)
* @param hideAvatar 是否隐藏发消息者头像(true 隐藏头像, false 不隐藏)
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByActionCardMulti(String title, String markdownText, List<OapiRobotSendRequest.Btns> btns, boolean btnOrientation, boolean hideAvatar) {
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(markdownText) || CollectionUtils.isEmpty(btns)) {
return null;
}
//参数 类型 必选 说明
//msgtype string true 此消息类型为固定actionCard
//title string true 首屏会话透出的展示内容
//text string true markdown格式的消息
//btns array true 按钮的信息title-按钮方案actionURL-点击按钮触发的URL
//btnOrientation string false 0-按钮竖直排列1-按钮横向排列
//hideAvatar string false 0-正常发消息者头像1-隐藏发消息者头像
OapiRobotSendRequest.Actioncard actionCard = new OapiRobotSendRequest.Actioncard();
actionCard.setTitle(title);
actionCard.setText(markdownText);
// 此处默认为0
actionCard.setBtnOrientation(btnOrientation ? "1" : "0");
// 此处默认为0
actionCard.setHideAvatar(hideAvatar ? "1" : "0");
actionCard.setBtns(btns);
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype(DingTalkUtils.MSG_TYPE_ACTION_CARD);
request.setActionCard(actionCard);
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】独立跳转ActionCard类型发送消息 响应参数:" + JSON.toJSONString(response));
} catch ( com.taobao.api.ApiException e) {
log.error("[发送ActionCard 类型消息]: 独立跳转ActionCard类型发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 发送FeedCard类型消息
*
* @param links
* @return OapiRobotSendResponse
*/
public static OapiRobotSendResponse sendMessageByFeedCard(List<OapiRobotSendRequest.Links> links) {
if (CollectionUtils.isEmpty(links)) {
return null;
}
//msgtype string true 此消息类型为固定feedCard
//title string true 单条信息文本
//messageURL string true 点击单条信息到跳转链接
//picURL string true 单条信息后面图片的URL
OapiRobotSendRequest.Feedcard feedcard = new OapiRobotSendRequest.Feedcard();
feedcard.setLinks(links);
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype(DingTalkUtils.MSG_TYPE_FEED_CARD);
request.setFeedCard(feedcard);
OapiRobotSendResponse response = new OapiRobotSendResponse();
try {
response = DingTalkUtils.client.execute(request);
System.out.println("【DingTalkUtils】独立跳转ActionCard类型发送消息 响应参数:" + JSON.toJSONString(response));
} catch ( com.taobao.api.ApiException e) {
log.error("[发送ActionCard 类型消息]: 独立跳转ActionCard类型发送消息失败, 异常捕获{}", e.getMessage());
}
return response;
}
/**
* 获取签名
* 把timestamp+"\n"+密钥当做签名字符串使用HmacSHA256算法计算签名然后进行Base64 encode最后再把签名参数再进行urlEncode得到最终的签名需要使用UTF-8字符集
* timestamp 当前时间戳单位是毫秒与请求调用时间误差不能超过1小时
* secret 密钥机器人安全设置页面加签一栏下面显示的SEC开头的字符串
*
* @param
* @return java.lang.String
*/
private static String sign() throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
Long timestamp = System.currentTimeMillis();
String stringToSign = timestamp + "\n" + SECRET;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(SECRET.getBytes("UTF-8"), "HmacSHA256"));
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");
return "&timestamp=" + timestamp + "&sign=" + sign;
}
/**
* 测试
*
* @param args
* @return void
*/
public static void main(String args[]) {
//官方演示示例
// sdkDemoJava();
//发送普通文本消息
// ArrayList<String> userList = new ArrayList<>();
// userList.add("18975045528");
// sendMessageByText("大家好!我是 DingTalkRobot 机器人,很高兴为你们服务!", userList, true);
//发送link 类型消息
// String title = "这是标题";
// String text = "这是消息内容";
// String messageUrl = "https://hotspot.corpweiqi.com/index.html#/hotspots/manage/index.html?pk=100393";
// String picUrl = "https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png";
// sendMessageByLink(title, text, messageUrl, picUrl);
//发送Markdown 编辑格式的消息
String title = "测试标题";
//// String markdownText2 = "#### 南京的天气真好呀 @130****1239\n" +
//// "> 9度西北风1级空气良89相对温度73%\n\n" +
//// "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n";
//
String markdownText = "|appid|mobile| 发送条数|业务线负责人|\n" +
"|--|--|--|--|\n" +
" | 2sc | 5528| weaewae | jack |\n" +
" | 2sc | 2000| weaewae | jack |\n" ;
List<String> mobileList = Arrays.asList("18975045528");
boolean isAtAll = true;
sendMessageByMarkdown(title, markdownText, mobileList, isAtAll);
//整体跳转ActionCard类型的消息发送
//String title = "南京的天气真好呀";
//String markdownText = "#### 南京的天气真好呀 @130****1239\n" +
// "> 9度西北风1级空气良89相对温度73%\n\n" +
// "> ![screenshot](https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png)\n" +
// "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n";
//String singleTitle = "百度一下,啥也不知道";
//String singleURL = "https://www.baidu.com/";
//boolean btnOrientation = true;
//boolean hideAvatar = false;
//sendMessageByActionCardSingle(title, markdownText, singleTitle, singleURL, btnOrientation, hideAvatar);
//独立跳转ActionCard类型 消息发送
//String title = "南京的天气真好呀";
//String markdownText = "#### 南京的天气真好呀 @130****1239\n" +
// "> 9度西北风1级空气良89相对温度73%\n\n" +
// "> ![screenshot](https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png)\n" +
// "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n";
//
//OapiRobotSendRequest.Btns btn = new OapiRobotSendRequest.Btns();
//btn.setTitle("按钮-钉钉开放文档");
//btn.setActionURL("https://open.dingtalk.com/");
//List<OapiRobotSendRequest.Btns> btns = Arrays.asList(btn);
//boolean btnOrientation = true;
//boolean hideAvatar = false;
//sendMessageByActionCardMulti(title, markdownText, btns, btnOrientation, hideAvatar);
//发送FeedCard类型消息
// OapiRobotSendRequest.Links link = new OapiRobotSendRequest.Links();
// link.setTitle("时代的火车向前开");
// link.setMessageURL("https://www.dingtalk.com/");
// link.setPicURL("https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png");
// List<OapiRobotSendRequest.Links> links = Arrays.asList(link);
// sendMessageByFeedCard(links);
}
}

View File

@ -0,0 +1,93 @@
package com.weiqi.util;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SmsTools {
private static final Logger logger = LoggerFactory.getLogger(SmsTools.class);
private static int SmsGlobalIndex = -1;
// 项目启动时通过数据库加载数据项目运行中通过页面控制修改每家流量
public static List<com.weiqi.vo.SmsGlobalIndex> sv = new ArrayList<>();
public static int sendTotalNum = 200000;
public static boolean isRedisStatistic = true;
public static boolean isRedisStatisticUP = false;
// 模版总开关
public static boolean isTemplateOpen = false;
// 收集是否开启如果开启则经过模版到保存到数据库
public static boolean isMatching = false;
// 拦截开关如果开启则将不符合到直接拦截掉
public static boolean isIntercept = false;
public static ConcurrentHashMap<String, Long> FLOW_MAP = new ConcurrentHashMap<>();
public static final String API_INCR_KEY = "api_key:";
public static final String DISPATHER_INCR_KEY = "dispather_key:";
public static final String TOOLS_INCR_KEY = "tools_key:";
public static final String KEY_FREQUENCY_SWITCH_S = "sms:frequencySwitch:s";
public static final String KEY_FREQUENCY_SWITCH_Y = "sms:frequencySwitch:y";
public static final String KEY_FREQUENCY_SWITCH_MASTER = "sms:frequencySwitch:MasterSwitch";
public static final String KEY_ONE_HOUR_LIMIT_S = "ONE_HOUR_LIMIT_S";
public static final String KEY_SAME_CONTENT_LIMIT_S = "SAME_CONTENT_LIMIT_S";
public static final String KEY_SENDING_TIMES_LIMIT_S = "SENDING_TIMES_LIMIT_S";
public static final String KEY_ONE_HOUR_LIMIT_Y = "ONE_HOUR_LIMIT_Y";
public static final String KEY_SAME_CONTENT_LIMIT_Y = "SAME_CONTENT_LIMIT_Y";
public static final String KEY_SENDING_TIMES_LIMIT_Y = "SENDING_TIMES_LIMIT_Y";
public static int ONE_HOUR_LIMIT_S = 1;
public static int SAME_CONTENT_LIMIT_S = 1;
public static int SENDING_TIMES_LIMIT_S = 20;
public static int ONE_HOUR_LIMIT_Y = 1;
public static int SAME_CONTENT_LIMIT_Y = 1;
public static int SENDING_TIMES_LIMIT_Y = 20;
public static String nextServerIndex() {
int total = 0;
int size = sv.size();
if (size == 0)
return "string.Empty;";// 不匹配任何sp
for (int i = 0; i < size; i++) {
sv.get(i).setCurrent(sv.get(i).getCurrent() + sv.get(i).getWeight());
total += sv.get(i).getWeight();
if (SmsGlobalIndex == -1 || sv.get(SmsGlobalIndex).getCurrent() < sv.get(i).getCurrent()) {
SmsGlobalIndex = i;
}
}
sv.get(SmsGlobalIndex).setCurrent(sv.get(SmsGlobalIndex).getCurrent() - total);
logger.info("sv===={},{}", sv.toString(), sv.get(SmsGlobalIndex).getName());
return sv.get(SmsGlobalIndex).getName();
}
public static void main(String[] args) {
for (int i = 0; i < 1000; i++) {
System.out.println(nextServerIndex());
}
}
public void add(String key, int inrc) {
key = key + System.currentTimeMillis() / 1000;
if (FLOW_MAP.get(key) == null) {
synchronized (this) {
if (FLOW_MAP.get(key) == null) {
FLOW_MAP.put(key, 0L);
}
}
}
synchronized (this) {
FLOW_MAP.put(key, FLOW_MAP.get(key) + inrc);
}
}
}

View File

@ -0,0 +1,50 @@
package com.weiqi.vo;
public class AddrVo implements Comparable<AddrVo> {
private String addr;
private String ip;
private String des;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
@Override
public String toString() {
return "AddrVo{" +
"addr='" + addr + '\'' +
", ip='" + ip + '\'' +
", des='" + des + '\'' +
'}';
}
@Override
public int compareTo(AddrVo o) {
return o.getIp().compareTo(o.getIp()) ;
}
}

View File

@ -0,0 +1,152 @@
package com.weiqi.vo;
import java.io.Serializable;
public class AutoBiStatisticSpVo implements Serializable {
private String spName;
private double spProdSuccessRate;
private double spProdResponseTime;
private int spProdSubmitCount;
private int spProdSuccessCount;
private int spProdFailCount;
private int spMarketingSubmitCount;
private int spMarketingSuccessCount;
private int spMarketingFailCount;
private double spMarketingSuccessRate;
private int spFinMarketingSubmitCount;
private int spFinMarketingSuccessCount;
private int spFinMarketingFailCount;
private double spFinMarketingSuccessRate;
public String getSpName() {
return spName;
}
public void setSpName(String spName) {
this.spName = spName;
}
public double getSpProdSuccessRate() {
return spProdSuccessRate;
}
public void setSpProdSuccessRate(double spProdSuccessRate) {
this.spProdSuccessRate = spProdSuccessRate;
}
public double getSpProdResponseTime() {
return spProdResponseTime;
}
public void setSpProdResponseTime(double spProdResponseTime) {
this.spProdResponseTime = spProdResponseTime;
}
public int getSpProdSubmitCount() {
return spProdSubmitCount;
}
public void setSpProdSubmitCount(int spProdSubmitCount) {
this.spProdSubmitCount = spProdSubmitCount;
}
public int getSpProdSuccessCount() {
return spProdSuccessCount;
}
public void setSpProdSuccessCount(int spProdSuccessCount) {
this.spProdSuccessCount = spProdSuccessCount;
}
public int getSpProdFailCount() {
return spProdFailCount;
}
public void setSpProdFailCount(int spProdFailCount) {
this.spProdFailCount = spProdFailCount;
}
public int getSpMarketingSubmitCount() {
return spMarketingSubmitCount;
}
public void setSpMarketingSubmitCount(int spMarketingSubmitCount) {
this.spMarketingSubmitCount = spMarketingSubmitCount;
}
public int getSpMarketingSuccessCount() {
return spMarketingSuccessCount;
}
public void setSpMarketingSuccessCount(int spMarketingSuccessCount) {
this.spMarketingSuccessCount = spMarketingSuccessCount;
}
public int getSpMarketingFailCount() {
return spMarketingFailCount;
}
public void setSpMarketingFailCount(int spMarketingFailCount) {
this.spMarketingFailCount = spMarketingFailCount;
}
public double getSpMarketingSuccessRate() {
return spMarketingSuccessRate;
}
public void setSpMarketingSuccessRate(double spMarketingSuccessRate) {
this.spMarketingSuccessRate = spMarketingSuccessRate;
}
public int getSpFinMarketingSubmitCount() {
return spFinMarketingSubmitCount;
}
public void setSpFinMarketingSubmitCount(int spFinMarketingSubmitCount) {
this.spFinMarketingSubmitCount = spFinMarketingSubmitCount;
}
public int getSpFinMarketingSuccessCount() {
return spFinMarketingSuccessCount;
}
public void setSpFinMarketingSuccessCount(int spFinMarketingSuccessCount) {
this.spFinMarketingSuccessCount = spFinMarketingSuccessCount;
}
public int getSpFinMarketingFailCount() {
return spFinMarketingFailCount;
}
public void setSpFinMarketingFailCount(int spFinMarketingFailCount) {
this.spFinMarketingFailCount = spFinMarketingFailCount;
}
public double getSpFinMarketingSuccessRate() {
return spFinMarketingSuccessRate;
}
public void setSpFinMarketingSuccessRate(double spFinMarketingSuccessRate) {
this.spFinMarketingSuccessRate = spFinMarketingSuccessRate;
}
@Override
public String toString() {
return "AutoBiStatisticSpVo{" +
"spName='" + spName + '\'' +
", spProdSuccessRate=" + spProdSuccessRate +
", spProdResponseTime=" + spProdResponseTime +
", spProdSubmitCount=" + spProdSubmitCount +
", spProdSuccessCount=" + spProdSuccessCount +
", spProdFailCount=" + spProdFailCount +
", spMarketingSubmitCount=" + spMarketingSubmitCount +
", spMarketingSuccessCount=" + spMarketingSuccessCount +
", spMarketingFailCount=" + spMarketingFailCount +
", spMarketingSuccessRate=" + spMarketingSuccessRate +
", spFinMarketingSubmitCount=" + spFinMarketingSubmitCount +
", spFinMarketingSuccessCount=" + spFinMarketingSuccessCount +
", spFinMarketingFailCount=" + spFinMarketingFailCount +
", spFinMarketingSuccessRate=" + spFinMarketingSuccessRate +
'}';
}
}

View File

@ -0,0 +1,93 @@
package com.weiqi.vo;
import java.io.Serializable;
import java.util.List;
public class AutoBiStatisticVo implements Serializable {
private int submitCount;
private int prodSubmitCount;
private int marketingSubmitCount;
private int finMarketingSubmitCount;
private int prodSuccessCount;
private int marketingSuccessCount;
private int finMarketingSuccessCount;
private List<AutoBiStatisticSpVo> splist;
public int getSubmitCount() {
return submitCount;
}
public void setSubmitCount(int submitCount) {
this.submitCount = submitCount;
}
public int getProdSubmitCount() {
return prodSubmitCount;
}
public void setProdSubmitCount(int prodSubmitCount) {
this.prodSubmitCount = prodSubmitCount;
}
public int getMarketingSubmitCount() {
return marketingSubmitCount;
}
public void setMarketingSubmitCount(int marketingSubmitCount) {
this.marketingSubmitCount = marketingSubmitCount;
}
public int getProdSuccessCount() {
return prodSuccessCount;
}
public void setProdSuccessCount(int prodSuccessCount) {
this.prodSuccessCount = prodSuccessCount;
}
public int getMarketingSuccessCount() {
return marketingSuccessCount;
}
public void setMarketingSuccessCount(int marketingSuccessCount) {
this.marketingSuccessCount = marketingSuccessCount;
}
public List<AutoBiStatisticSpVo> getSplist() {
return splist;
}
public void setSplist(List<AutoBiStatisticSpVo> splist) {
this.splist = splist;
}
public int getFinMarketingSubmitCount() {
return finMarketingSubmitCount;
}
public void setFinMarketingSubmitCount(int finMarketingSubmitCount) {
this.finMarketingSubmitCount = finMarketingSubmitCount;
}
public int getFinMarketingSuccessCount() {
return finMarketingSuccessCount;
}
public void setFinMarketingSuccessCount(int finMarketingSuccessCount) {
this.finMarketingSuccessCount = finMarketingSuccessCount;
}
@Override
public String toString() {
return "AutoBiStatisticVo{" +
"submitCount=" + submitCount +
", prodSubmitCount=" + prodSubmitCount +
", marketingSubmitCount=" + marketingSubmitCount +
", finMarketingSubmitCount=" + finMarketingSubmitCount +
", prodSuccessCount=" + prodSuccessCount +
", marketingSuccessCount=" + marketingSuccessCount +
", finMarketingSuccessCount=" + finMarketingSuccessCount +
", splist=" + splist +
'}';
}
}

View File

@ -0,0 +1,19 @@
package com.weiqi.vo;
public class BusinessException extends RuntimeException {
private int code;
public BusinessException(int code, String message) {
super(message);
this.code = code;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}

View File

@ -0,0 +1,74 @@
package com.weiqi.vo;
import java.io.Serializable;
import java.util.Date;
/**
* Created by
*/
public class MisUserinfo implements Serializable {
private int id;
private int userid;
private String username;
private transient Date gmtCreate;
private transient Date gmtModify;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModify() {
return gmtModify;
}
public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}
@Override
public String toString() {
return "MisUserinfo{" +
"id=" + id +
", userid=" + userid +
", username='" + username + '\'' +
", gmtCreate=" + gmtCreate +
", gmtModify=" + gmtModify +
'}';
}
}

View File

@ -0,0 +1,462 @@
package com.weiqi.vo;
import java.util.Date;
public class OrderInfoVo {
private int page;//第几页
private int limit;//每页显示条数
private String beginTime;
private String endTime;
private Integer id;
private String orderno;
private Integer mid;
private String mname;
private Integer orderuserid;
private String orderusername;
private Date admissiontime;
private Date constructionstarttime;
private String platenumber;
private String vin;
private String registertime;
private Float kilometers;
private String drivinglicensesrc;
private String vehiclesrc;
private String vehicletype;
private String linkname;
private String linktel;
private Integer gaugingschemeid;
private String gaugingschemename;
private Integer maintenanceschemeid;
private String maintenanceschemename;
private Integer brandid;
private String brandname;
private Integer seriesid;
private String seriesname;
private String productionyear;
private String enginestructure;
private Integer enginestructurenumber;
private String electronicfueltype;
private String transmissioncase;
private String drivetype;
private String emissionstandard;
private Integer status;
private Date createTime;
private Date updateTime;
private Integer wxXrPemsUserId;
private Integer checkUpResult;
private String wxXrPemsUserName;
private String exhauststructure;
private Integer factoryid;
private String factoryname;
private String vinContent;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderno() {
return orderno;
}
public void setOrderno(String orderno) {
this.orderno = orderno == null ? null : orderno.trim();
}
public Integer getMid() {
return mid;
}
public void setMid(Integer mid) {
this.mid = mid;
}
public String getMname() {
return mname;
}
public void setMname(String mname) {
this.mname = mname == null ? null : mname.trim();
}
public Integer getOrderuserid() {
return orderuserid;
}
public void setOrderuserid(Integer orderuserid) {
this.orderuserid = orderuserid;
}
public String getOrderusername() {
return orderusername;
}
public void setOrderusername(String orderusername) {
this.orderusername = orderusername == null ? null : orderusername.trim();
}
public Date getAdmissiontime() {
return admissiontime;
}
public void setAdmissiontime(Date admissiontime) {
this.admissiontime = admissiontime;
}
public Date getConstructionstarttime() {
return constructionstarttime;
}
public void setConstructionstarttime(Date constructionstarttime) {
this.constructionstarttime = constructionstarttime;
}
public String getPlatenumber() {
return platenumber;
}
public void setPlatenumber(String platenumber) {
this.platenumber = platenumber == null ? null : platenumber.trim();
}
public String getVin() {
return vin;
}
public void setVin(String vin) {
this.vin = vin == null ? null : vin.trim();
}
public String getRegistertime() {
return registertime;
}
public void setRegistertime(String registertime) {
this.registertime = registertime == null ? null : registertime.trim();
}
public Float getKilometers() {
return kilometers;
}
public void setKilometers(Float kilometers) {
this.kilometers = kilometers;
}
public String getDrivinglicensesrc() {
return drivinglicensesrc;
}
public void setDrivinglicensesrc(String drivinglicensesrc) {
this.drivinglicensesrc = drivinglicensesrc == null ? null : drivinglicensesrc.trim();
}
public String getVehiclesrc() {
return vehiclesrc;
}
public void setVehiclesrc(String vehiclesrc) {
this.vehiclesrc = vehiclesrc == null ? null : vehiclesrc.trim();
}
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype == null ? null : vehicletype.trim();
}
public String getLinkname() {
return linkname;
}
public void setLinkname(String linkname) {
this.linkname = linkname == null ? null : linkname.trim();
}
public String getLinktel() {
return linktel;
}
public void setLinktel(String linktel) {
this.linktel = linktel == null ? null : linktel.trim();
}
public Integer getGaugingschemeid() {
return gaugingschemeid;
}
public void setGaugingschemeid(Integer gaugingschemeid) {
this.gaugingschemeid = gaugingschemeid;
}
public String getGaugingschemename() {
return gaugingschemename;
}
public void setGaugingschemename(String gaugingschemename) {
this.gaugingschemename = gaugingschemename == null ? null : gaugingschemename.trim();
}
public Integer getMaintenanceschemeid() {
return maintenanceschemeid;
}
public void setMaintenanceschemeid(Integer maintenanceschemeid) {
this.maintenanceschemeid = maintenanceschemeid;
}
public String getMaintenanceschemename() {
return maintenanceschemename;
}
public void setMaintenanceschemename(String maintenanceschemename) {
this.maintenanceschemename = maintenanceschemename == null ? null : maintenanceschemename.trim();
}
public Integer getBrandid() {
return brandid;
}
public void setBrandid(Integer brandid) {
this.brandid = brandid;
}
public String getBrandname() {
return brandname;
}
public void setBrandname(String brandname) {
this.brandname = brandname == null ? null : brandname.trim();
}
public Integer getSeriesid() {
return seriesid;
}
public void setSeriesid(Integer seriesid) {
this.seriesid = seriesid;
}
public String getSeriesname() {
return seriesname;
}
public void setSeriesname(String seriesname) {
this.seriesname = seriesname == null ? null : seriesname.trim();
}
public String getProductionyear() {
return productionyear;
}
public void setProductionyear(String productionyear) {
this.productionyear = productionyear == null ? null : productionyear.trim();
}
public String getEnginestructure() {
return enginestructure;
}
public void setEnginestructure(String enginestructure) {
this.enginestructure = enginestructure == null ? null : enginestructure.trim();
}
public Integer getEnginestructurenumber() {
return enginestructurenumber;
}
public void setEnginestructurenumber(Integer enginestructurenumber) {
this.enginestructurenumber = enginestructurenumber;
}
public String getElectronicfueltype() {
return electronicfueltype;
}
public void setElectronicfueltype(String electronicfueltype) {
this.electronicfueltype = electronicfueltype == null ? null : electronicfueltype.trim();
}
public String getTransmissioncase() {
return transmissioncase;
}
public void setTransmissioncase(String transmissioncase) {
this.transmissioncase = transmissioncase == null ? null : transmissioncase.trim();
}
public String getDrivetype() {
return drivetype;
}
public void setDrivetype(String drivetype) {
this.drivetype = drivetype == null ? null : drivetype.trim();
}
public String getEmissionstandard() {
return emissionstandard;
}
public void setEmissionstandard(String emissionstandard) {
this.emissionstandard = emissionstandard == null ? null : emissionstandard.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getWxXrPemsUserId() {
return wxXrPemsUserId;
}
public void setWxXrPemsUserId(Integer wxXrPemsUserId) {
this.wxXrPemsUserId = wxXrPemsUserId;
}
public Integer getCheckUpResult() {
return checkUpResult;
}
public void setCheckUpResult(Integer checkUpResult) {
this.checkUpResult = checkUpResult;
}
public String getWxXrPemsUserName() {
return wxXrPemsUserName;
}
public void setWxXrPemsUserName(String wxXrPemsUserName) {
this.wxXrPemsUserName = wxXrPemsUserName == null ? null : wxXrPemsUserName.trim();
}
public String getExhauststructure() {
return exhauststructure;
}
public void setExhauststructure(String exhauststructure) {
this.exhauststructure = exhauststructure == null ? null : exhauststructure.trim();
}
public Integer getFactoryid() {
return factoryid;
}
public void setFactoryid(Integer factoryid) {
this.factoryid = factoryid;
}
public String getFactoryname() {
return factoryname;
}
public void setFactoryname(String factoryname) {
this.factoryname = factoryname == null ? null : factoryname.trim();
}
public String getVinContent() {
return vinContent;
}
public void setVinContent(String vinContent) {
this.vinContent = vinContent == null ? null : vinContent.trim();
}
}

View File

@ -0,0 +1,82 @@
package com.weiqi.vo;
public class RouteInfoVo {
private Integer id;
private Integer operatorType;//1增 2删 3改
//业务线
private String appId;
private String appName;
//原sp
private String sourceSpId;
private String sourceSpName;
//目标sp
private String targetSpId;
private String targetSpName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOperatorType() {
return operatorType;
}
public void setOperatorType(Integer operatorType) {
this.operatorType = operatorType;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getSourceSpId() {
return sourceSpId;
}
public void setSourceSpId(String sourceSpId) {
this.sourceSpId = sourceSpId;
}
public String getSourceSpName() {
return sourceSpName;
}
public void setSourceSpName(String sourceSpName) {
this.sourceSpName = sourceSpName;
}
public String getTargetSpId() {
return targetSpId;
}
public void setTargetSpId(String targetSpId) {
this.targetSpId = targetSpId;
}
public String getTargetSpName() {
return targetSpName;
}
public void setTargetSpName(String targetSpName) {
this.targetSpName = targetSpName;
}
}

View File

@ -0,0 +1,236 @@
package com.weiqi.vo;
public class RouteVo {
private int page;//第几页
private int limit;//每页显示条数
private String appid;
private String mobile;
private String message;
private String appendid;
private String sp;
private String begintime;
private String endtime;
private Integer id;
private Integer oldId;
private Integer operatorType;//1增 2删 3改 6批量切换
private Integer ruleindex;
private String operators;
private Boolean enabled;
private String remark;
private String appids;
/**
* 原sp路由批量切换路由使用
*/
private String originalSp;
/**
* 目标sp路由批量切换路由使用
*/
private String targetSp;
/**
* 批量切换数量
*/
private int bacthChangeNum;
public int getBacthChangeNum() {
return bacthChangeNum;
}
public void setBacthChangeNum(int bacthChangeNum) {
this.bacthChangeNum = bacthChangeNum;
}
public String getOriginalSp() {
return originalSp;
}
public void setOriginalSp(String originalSp) {
this.originalSp = originalSp;
}
public String getTargetSp() {
return targetSp;
}
public void setTargetSp(String targetSp) {
this.targetSp = targetSp;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getAppendid() {
return appendid;
}
public void setAppendid(String appendid) {
this.appendid = appendid;
}
public String getSp() {
return sp;
}
public void setSp(String sp) {
this.sp = sp;
}
public String getBegintime() {
return begintime;
}
public void setBegintime(String begintime) {
this.begintime = begintime;
}
public String getEndtime() {
return endtime;
}
public void setEndtime(String endtime) {
this.endtime = endtime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getOldId() {
return oldId;
}
public void setOldId(Integer oldId) {
this.oldId = oldId;
}
public Integer getOperatorType() {
return operatorType;
}
public void setOperatorType(Integer operatorType) {
this.operatorType = operatorType;
}
public Integer getRuleindex() {
return ruleindex;
}
public void setRuleindex(Integer ruleindex) {
this.ruleindex = ruleindex;
}
public String getOperators() {
return operators;
}
public void setOperators(String operators) {
this.operators = operators;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getAppids() {
return appids;
}
public void setAppids(String appids) {
this.appids = appids;
}
@Override
public String toString() {
return "RouteVo{" +
"page=" + page +
", limit=" + limit +
", appid='" + appid + '\'' +
", mobile='" + mobile + '\'' +
", message='" + message + '\'' +
", appendid='" + appendid + '\'' +
", sp='" + sp + '\'' +
", begintime='" + begintime + '\'' +
", endtime='" + endtime + '\'' +
", id=" + id +
", oldId=" + oldId +
", operatorType=" + operatorType +
", ruleindex=" + ruleindex +
", operators='" + operators + '\'' +
", enabled=" + enabled +
", remark='" + remark + '\'' +
", appids='" + appids + '\'' +
", originalSp='" + originalSp + '\'' +
", targetSp='" + targetSp + '\'' +
", bacthChangeNum=" + bacthChangeNum +
'}';
}
}

View File

@ -0,0 +1,43 @@
package com.weiqi.vo;
public class SmsGlobalIndex {
// 服务名称
private String name;
// 初始权重
private int weight;
// 当前权重
private int current;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
@Override
public String toString() {
return "SmsGlobalIndex{" +
"name='" + name + '\'' +
", weight=" + weight +
", current=" + current +
'}';
}
}

View File

@ -0,0 +1,237 @@
package com.weiqi.vo;
import java.util.Date;
public class SmsSendVo {
private String msgid;
private int page;//第几页
private int limit;//每页显示条数
private String appid;
private String mobile;
private String message;
private String appendid;
private String sp;
private String fixedSp;
private String beginTime;
private String endTime;
private String clientIp;
private Byte splitCount;
private Byte splitCountOk;
private Byte splitCountFail;
private Date reportTime;
private String reportDesc;
private String rsaMobile;
private String md5Mobile;
private String status;
private Byte sendStatus;
public Byte getSendStatus() {
return sendStatus;
}
public void setSendStatus(Byte sendStatus) {
this.sendStatus = sendStatus;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsgid() {
return msgid;
}
public void setMsgid(String msgid) {
this.msgid = msgid == null ? null : msgid.trim();
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid == null ? null : appid.trim();
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile == null ? null : mobile.trim();
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message == null ? null : message.trim();
}
public String getAppendid() {
return appendid;
}
public void setAppendid(String appendid) {
this.appendid = appendid == null ? null : appendid.trim();
}
public String getSp() {
return sp;
}
public void setSp(String sp) {
this.sp = sp == null ? null : sp.trim();
}
public String getFixedSp() {
return fixedSp;
}
public void setFixedSp(String fixedSp) {
this.fixedSp = fixedSp == null ? null : fixedSp.trim();
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp == null ? null : clientIp.trim();
}
public Byte getSplitCount() {
return splitCount;
}
public void setSplitCount(Byte splitCount) {
this.splitCount = splitCount;
}
public Byte getSplitCountOk() {
return splitCountOk;
}
public void setSplitCountOk(Byte splitCountOk) {
this.splitCountOk = splitCountOk;
}
public Byte getSplitCountFail() {
return splitCountFail;
}
public void setSplitCountFail(Byte splitCountFail) {
this.splitCountFail = splitCountFail;
}
public Date getReportTime() {
return reportTime;
}
public void setReportTime(Date reportTime) {
this.reportTime = reportTime;
}
public String getReportDesc() {
return reportDesc;
}
public void setReportDesc(String reportDesc) {
this.reportDesc = reportDesc == null ? null : reportDesc.trim();
}
public String getRsaMobile() {
return rsaMobile;
}
public void setRsaMobile(String rsaMobile) {
this.rsaMobile = rsaMobile == null ? null : rsaMobile.trim();
}
public String getMd5Mobile() {
return md5Mobile;
}
public void setMd5Mobile(String md5Mobile) {
this.md5Mobile = md5Mobile == null ? null : md5Mobile.trim();
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
@Override
public String toString() {
return "SmsSendVo{" +
"msgid='" + msgid + '\'' +
", page=" + page +
", limit=" + limit +
", appid='" + appid + '\'' +
", mobile='" + mobile + '\'' +
", message='" + message + '\'' +
", appendid='" + appendid + '\'' +
", sp='" + sp + '\'' +
", fixedSp='" + fixedSp + '\'' +
", beginTime='" + beginTime + '\'' +
", endTime='" + endTime + '\'' +
", clientIp='" + clientIp + '\'' +
", splitCount=" + splitCount +
", splitCountOk=" + splitCountOk +
", splitCountFail=" + splitCountFail +
", reportTime=" + reportTime +
", reportDesc='" + reportDesc + '\'' +
", rsaMobile='" + rsaMobile + '\'' +
", md5Mobile='" + md5Mobile + '\'' +
", status='" + status + '\'' +
", sendStatus=" + sendStatus +
'}';
}
}

View File

@ -0,0 +1,86 @@
package com.weiqi.vo;
public class WightVo {
private int id;
private String getTime;
private String ip;
private String sp206;
private String sp116;
private String flow;
private String cluster;
private String type;
private String des;
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGetTime() {
return getTime;
}
public void setGetTime(String getTime) {
this.getTime = getTime;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getSp206() {
return sp206;
}
public void setSp206(String sp206) {
this.sp206 = sp206;
}
public String getSp116() {
return sp116;
}
public void setSp116(String sp116) {
this.sp116 = sp116;
}
public String getFlow() {
return flow;
}
public void setFlow(String flow) {
this.flow = flow;
}
public String getCluster() {
return cluster;
}
public void setCluster(String cluster) {
this.cluster = cluster;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

31
car-dao/.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

60
car-dao/pom.xml Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>carmis</artifactId>
<groupId>com.weiqi</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>car-dao</artifactId>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.1</version>
</dependency>
</dependencies>
<!--<build>-->
<!--<plugins>-->
<!--<plugin>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--<configuration>-->
<!--<classifier>exec</classifier>-->
<!--</configuration>-->
<!--</plugin>-->
<!--</plugins>-->
<!--</build>-->
<!--定义snapshots库和releases库的nexus地址-->
<distributionManagement>
<repository>
<id>releases</id>
<url>
http://repo.corpweiqi.com/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>
http://repo.corpweiqi.com/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</project>

BIN
car-dao/src/main/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,12 @@
//
//
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//@SpringBootApplication
//public class DaoApplication {
//
// public static void main(String[] args) {
// SpringApplication.run(DaoApplication.class, args);
// }
//
//}

View File

@ -0,0 +1,44 @@
package com.weiqi.mis.bo;
/**
* @author duly
* @date 2020/5/14
*/
public class StisticByDay {
private String splitCount;
private String splitCountOk;
private String accountType;
private String sp;
public String getSplitCount() {
return splitCount;
}
public void setSplitCount(String splitCount) {
this.splitCount = splitCount;
}
public String getSplitCountOk() {
return splitCountOk;
}
public void setSplitCountOk(String splitCountOk) {
this.splitCountOk = splitCountOk;
}
public String getAccountType() {
return accountType;
}
public void setAccountType(String accountType) {
this.accountType = accountType;
}
public String getSp() {
return sp;
}
public void setSp(String sp) {
this.sp = sp;
}
}

View File

@ -0,0 +1,65 @@
package com.weiqi.mis.domain;
import java.util.Date;
public class AdminUserInfo {
private Integer id;
private String userName;
private String password;
private Date gmtCreate;
private Date gmtModify;
private Integer isDel;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModify() {
return gmtModify;
}
public void setGmtModify(Date gmtModify) {
this.gmtModify = gmtModify;
}
public Integer getIsDel() {
return isDel;
}
public void setIsDel(Integer isDel) {
this.isDel = isDel;
}
}

View File

@ -0,0 +1,581 @@
package com.weiqi.mis.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class AdminUserInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AdminUserInfoExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andPasswordIsNull() {
addCriterion("password is null");
return (Criteria) this;
}
public Criteria andPasswordIsNotNull() {
addCriterion("password is not null");
return (Criteria) this;
}
public Criteria andPasswordEqualTo(String value) {
addCriterion("password =", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotEqualTo(String value) {
addCriterion("password <>", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThan(String value) {
addCriterion("password >", value, "password");
return (Criteria) this;
}
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
addCriterion("password >=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThan(String value) {
addCriterion("password <", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLessThanOrEqualTo(String value) {
addCriterion("password <=", value, "password");
return (Criteria) this;
}
public Criteria andPasswordLike(String value) {
addCriterion("password like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordNotLike(String value) {
addCriterion("password not like", value, "password");
return (Criteria) this;
}
public Criteria andPasswordIn(List<String> values) {
addCriterion("password in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordNotIn(List<String> values) {
addCriterion("password not in", values, "password");
return (Criteria) this;
}
public Criteria andPasswordBetween(String value1, String value2) {
addCriterion("password between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andPasswordNotBetween(String value1, String value2) {
addCriterion("password not between", value1, value2, "password");
return (Criteria) this;
}
public Criteria andGmtCreateIsNull() {
addCriterion("gmt_create is null");
return (Criteria) this;
}
public Criteria andGmtCreateIsNotNull() {
addCriterion("gmt_create is not null");
return (Criteria) this;
}
public Criteria andGmtCreateEqualTo(Date value) {
addCriterion("gmt_create =", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotEqualTo(Date value) {
addCriterion("gmt_create <>", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThan(Date value) {
addCriterion("gmt_create >", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThanOrEqualTo(Date value) {
addCriterion("gmt_create >=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThan(Date value) {
addCriterion("gmt_create <", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThanOrEqualTo(Date value) {
addCriterion("gmt_create <=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateIn(List<Date> values) {
addCriterion("gmt_create in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotIn(List<Date> values) {
addCriterion("gmt_create not in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateBetween(Date value1, Date value2) {
addCriterion("gmt_create between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotBetween(Date value1, Date value2) {
addCriterion("gmt_create not between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtModifyIsNull() {
addCriterion("gmt_modify is null");
return (Criteria) this;
}
public Criteria andGmtModifyIsNotNull() {
addCriterion("gmt_modify is not null");
return (Criteria) this;
}
public Criteria andGmtModifyEqualTo(Date value) {
addCriterion("gmt_modify =", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyNotEqualTo(Date value) {
addCriterion("gmt_modify <>", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyGreaterThan(Date value) {
addCriterion("gmt_modify >", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyGreaterThanOrEqualTo(Date value) {
addCriterion("gmt_modify >=", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyLessThan(Date value) {
addCriterion("gmt_modify <", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyLessThanOrEqualTo(Date value) {
addCriterion("gmt_modify <=", value, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyIn(List<Date> values) {
addCriterion("gmt_modify in", values, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyNotIn(List<Date> values) {
addCriterion("gmt_modify not in", values, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyBetween(Date value1, Date value2) {
addCriterion("gmt_modify between", value1, value2, "gmtModify");
return (Criteria) this;
}
public Criteria andGmtModifyNotBetween(Date value1, Date value2) {
addCriterion("gmt_modify not between", value1, value2, "gmtModify");
return (Criteria) this;
}
public Criteria andIsDelIsNull() {
addCriterion("is_del is null");
return (Criteria) this;
}
public Criteria andIsDelIsNotNull() {
addCriterion("is_del is not null");
return (Criteria) this;
}
public Criteria andIsDelEqualTo(Integer value) {
addCriterion("is_del =", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotEqualTo(Integer value) {
addCriterion("is_del <>", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThan(Integer value) {
addCriterion("is_del >", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThanOrEqualTo(Integer value) {
addCriterion("is_del >=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThan(Integer value) {
addCriterion("is_del <", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThanOrEqualTo(Integer value) {
addCriterion("is_del <=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelIn(List<Integer> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Integer> values) {
addCriterion("is_del not in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelBetween(Integer value1, Integer value2) {
addCriterion("is_del between", value1, value2, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotBetween(Integer value1, Integer value2) {
addCriterion("is_del not between", value1, value2, "isDel");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,425 @@
package com.weiqi.mis.domain;
import java.util.Date;
public class WxXrPemsOrder {
private Integer id;
private String orderno;
private Integer mid;
private String mname;
private Integer orderuserid;
private String orderusername;
private Date admissiontime;
private Date constructionstarttime;
private String platenumber;
private String vin;
private String registertime;
private Float kilometers;
private String drivinglicensesrc;
private String vehiclesrc;
private String vehicletype;
private String linkname;
private String linktel;
private Integer gaugingschemeid;
private String gaugingschemename;
private Integer maintenanceschemeid;
private String maintenanceschemename;
private Integer brandid;
private String brandname;
private Integer seriesid;
private String seriesname;
private String productionyear;
private String enginestructure;
private Integer enginestructurenumber;
private String electronicfueltype;
private String transmissioncase;
private String drivetype;
private String emissionstandard;
private Integer status;
private Date createTime;
private Date updateTime;
private Integer wxXrPemsUserId;
private Integer checkUpResult;
private String wxXrPemsUserName;
private String exhauststructure;
private Integer factoryid;
private String factoryname;
private String vinContent;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderno() {
return orderno;
}
public void setOrderno(String orderno) {
this.orderno = orderno == null ? null : orderno.trim();
}
public Integer getMid() {
return mid;
}
public void setMid(Integer mid) {
this.mid = mid;
}
public String getMname() {
return mname;
}
public void setMname(String mname) {
this.mname = mname == null ? null : mname.trim();
}
public Integer getOrderuserid() {
return orderuserid;
}
public void setOrderuserid(Integer orderuserid) {
this.orderuserid = orderuserid;
}
public String getOrderusername() {
return orderusername;
}
public void setOrderusername(String orderusername) {
this.orderusername = orderusername == null ? null : orderusername.trim();
}
public Date getAdmissiontime() {
return admissiontime;
}
public void setAdmissiontime(Date admissiontime) {
this.admissiontime = admissiontime;
}
public Date getConstructionstarttime() {
return constructionstarttime;
}
public void setConstructionstarttime(Date constructionstarttime) {
this.constructionstarttime = constructionstarttime;
}
public String getPlatenumber() {
return platenumber;
}
public void setPlatenumber(String platenumber) {
this.platenumber = platenumber == null ? null : platenumber.trim();
}
public String getVin() {
return vin;
}
public void setVin(String vin) {
this.vin = vin == null ? null : vin.trim();
}
public String getRegistertime() {
return registertime;
}
public void setRegistertime(String registertime) {
this.registertime = registertime == null ? null : registertime.trim();
}
public Float getKilometers() {
return kilometers;
}
public void setKilometers(Float kilometers) {
this.kilometers = kilometers;
}
public String getDrivinglicensesrc() {
return drivinglicensesrc;
}
public void setDrivinglicensesrc(String drivinglicensesrc) {
this.drivinglicensesrc = drivinglicensesrc == null ? null : drivinglicensesrc.trim();
}
public String getVehiclesrc() {
return vehiclesrc;
}
public void setVehiclesrc(String vehiclesrc) {
this.vehiclesrc = vehiclesrc == null ? null : vehiclesrc.trim();
}
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype == null ? null : vehicletype.trim();
}
public String getLinkname() {
return linkname;
}
public void setLinkname(String linkname) {
this.linkname = linkname == null ? null : linkname.trim();
}
public String getLinktel() {
return linktel;
}
public void setLinktel(String linktel) {
this.linktel = linktel == null ? null : linktel.trim();
}
public Integer getGaugingschemeid() {
return gaugingschemeid;
}
public void setGaugingschemeid(Integer gaugingschemeid) {
this.gaugingschemeid = gaugingschemeid;
}
public String getGaugingschemename() {
return gaugingschemename;
}
public void setGaugingschemename(String gaugingschemename) {
this.gaugingschemename = gaugingschemename == null ? null : gaugingschemename.trim();
}
public Integer getMaintenanceschemeid() {
return maintenanceschemeid;
}
public void setMaintenanceschemeid(Integer maintenanceschemeid) {
this.maintenanceschemeid = maintenanceschemeid;
}
public String getMaintenanceschemename() {
return maintenanceschemename;
}
public void setMaintenanceschemename(String maintenanceschemename) {
this.maintenanceschemename = maintenanceschemename == null ? null : maintenanceschemename.trim();
}
public Integer getBrandid() {
return brandid;
}
public void setBrandid(Integer brandid) {
this.brandid = brandid;
}
public String getBrandname() {
return brandname;
}
public void setBrandname(String brandname) {
this.brandname = brandname == null ? null : brandname.trim();
}
public Integer getSeriesid() {
return seriesid;
}
public void setSeriesid(Integer seriesid) {
this.seriesid = seriesid;
}
public String getSeriesname() {
return seriesname;
}
public void setSeriesname(String seriesname) {
this.seriesname = seriesname == null ? null : seriesname.trim();
}
public String getProductionyear() {
return productionyear;
}
public void setProductionyear(String productionyear) {
this.productionyear = productionyear == null ? null : productionyear.trim();
}
public String getEnginestructure() {
return enginestructure;
}
public void setEnginestructure(String enginestructure) {
this.enginestructure = enginestructure == null ? null : enginestructure.trim();
}
public Integer getEnginestructurenumber() {
return enginestructurenumber;
}
public void setEnginestructurenumber(Integer enginestructurenumber) {
this.enginestructurenumber = enginestructurenumber;
}
public String getElectronicfueltype() {
return electronicfueltype;
}
public void setElectronicfueltype(String electronicfueltype) {
this.electronicfueltype = electronicfueltype == null ? null : electronicfueltype.trim();
}
public String getTransmissioncase() {
return transmissioncase;
}
public void setTransmissioncase(String transmissioncase) {
this.transmissioncase = transmissioncase == null ? null : transmissioncase.trim();
}
public String getDrivetype() {
return drivetype;
}
public void setDrivetype(String drivetype) {
this.drivetype = drivetype == null ? null : drivetype.trim();
}
public String getEmissionstandard() {
return emissionstandard;
}
public void setEmissionstandard(String emissionstandard) {
this.emissionstandard = emissionstandard == null ? null : emissionstandard.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getWxXrPemsUserId() {
return wxXrPemsUserId;
}
public void setWxXrPemsUserId(Integer wxXrPemsUserId) {
this.wxXrPemsUserId = wxXrPemsUserId;
}
public Integer getCheckUpResult() {
return checkUpResult;
}
public void setCheckUpResult(Integer checkUpResult) {
this.checkUpResult = checkUpResult;
}
public String getWxXrPemsUserName() {
return wxXrPemsUserName;
}
public void setWxXrPemsUserName(String wxXrPemsUserName) {
this.wxXrPemsUserName = wxXrPemsUserName == null ? null : wxXrPemsUserName.trim();
}
public String getExhauststructure() {
return exhauststructure;
}
public void setExhauststructure(String exhauststructure) {
this.exhauststructure = exhauststructure == null ? null : exhauststructure.trim();
}
public Integer getFactoryid() {
return factoryid;
}
public void setFactoryid(Integer factoryid) {
this.factoryid = factoryid;
}
public String getFactoryname() {
return factoryname;
}
public void setFactoryname(String factoryname) {
this.factoryname = factoryname == null ? null : factoryname.trim();
}
public String getVinContent() {
return vinContent;
}
public void setVinContent(String vinContent) {
this.vinContent = vinContent == null ? null : vinContent.trim();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,115 @@
package com.weiqi.mis.domain;
import java.util.Date;
public class WxXrPemsOrderPushLog {
private Integer id;
private String orderno;
private String weixiuorderno;
private String requestparam;
private String response;
private Integer step;
private Integer status;
private Date createTime;
private Date updateTime;
private Integer userId;
private String userName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderno() {
return orderno;
}
public void setOrderno(String orderno) {
this.orderno = orderno == null ? null : orderno.trim();
}
public String getWeixiuorderno() {
return weixiuorderno;
}
public void setWeixiuorderno(String weixiuorderno) {
this.weixiuorderno = weixiuorderno == null ? null : weixiuorderno.trim();
}
public String getRequestparam() {
return requestparam;
}
public void setRequestparam(String requestparam) {
this.requestparam = requestparam == null ? null : requestparam.trim();
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response == null ? null : response.trim();
}
public Integer getStep() {
return step;
}
public void setStep(Integer step) {
this.step = step;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
}

View File

@ -0,0 +1,911 @@
package com.weiqi.mis.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class WxXrPemsOrderPushLogExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public WxXrPemsOrderPushLogExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andOrdernoIsNull() {
addCriterion("OrderNo is null");
return (Criteria) this;
}
public Criteria andOrdernoIsNotNull() {
addCriterion("OrderNo is not null");
return (Criteria) this;
}
public Criteria andOrdernoEqualTo(String value) {
addCriterion("OrderNo =", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoNotEqualTo(String value) {
addCriterion("OrderNo <>", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoGreaterThan(String value) {
addCriterion("OrderNo >", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoGreaterThanOrEqualTo(String value) {
addCriterion("OrderNo >=", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoLessThan(String value) {
addCriterion("OrderNo <", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoLessThanOrEqualTo(String value) {
addCriterion("OrderNo <=", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoLike(String value) {
addCriterion("OrderNo like", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoNotLike(String value) {
addCriterion("OrderNo not like", value, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoIn(List<String> values) {
addCriterion("OrderNo in", values, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoNotIn(List<String> values) {
addCriterion("OrderNo not in", values, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoBetween(String value1, String value2) {
addCriterion("OrderNo between", value1, value2, "orderno");
return (Criteria) this;
}
public Criteria andOrdernoNotBetween(String value1, String value2) {
addCriterion("OrderNo not between", value1, value2, "orderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoIsNull() {
addCriterion("WeiXiuOrderNo is null");
return (Criteria) this;
}
public Criteria andWeixiuordernoIsNotNull() {
addCriterion("WeiXiuOrderNo is not null");
return (Criteria) this;
}
public Criteria andWeixiuordernoEqualTo(String value) {
addCriterion("WeiXiuOrderNo =", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoNotEqualTo(String value) {
addCriterion("WeiXiuOrderNo <>", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoGreaterThan(String value) {
addCriterion("WeiXiuOrderNo >", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoGreaterThanOrEqualTo(String value) {
addCriterion("WeiXiuOrderNo >=", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoLessThan(String value) {
addCriterion("WeiXiuOrderNo <", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoLessThanOrEqualTo(String value) {
addCriterion("WeiXiuOrderNo <=", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoLike(String value) {
addCriterion("WeiXiuOrderNo like", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoNotLike(String value) {
addCriterion("WeiXiuOrderNo not like", value, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoIn(List<String> values) {
addCriterion("WeiXiuOrderNo in", values, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoNotIn(List<String> values) {
addCriterion("WeiXiuOrderNo not in", values, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoBetween(String value1, String value2) {
addCriterion("WeiXiuOrderNo between", value1, value2, "weixiuorderno");
return (Criteria) this;
}
public Criteria andWeixiuordernoNotBetween(String value1, String value2) {
addCriterion("WeiXiuOrderNo not between", value1, value2, "weixiuorderno");
return (Criteria) this;
}
public Criteria andRequestparamIsNull() {
addCriterion("RequestParam is null");
return (Criteria) this;
}
public Criteria andRequestparamIsNotNull() {
addCriterion("RequestParam is not null");
return (Criteria) this;
}
public Criteria andRequestparamEqualTo(String value) {
addCriterion("RequestParam =", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamNotEqualTo(String value) {
addCriterion("RequestParam <>", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamGreaterThan(String value) {
addCriterion("RequestParam >", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamGreaterThanOrEqualTo(String value) {
addCriterion("RequestParam >=", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamLessThan(String value) {
addCriterion("RequestParam <", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamLessThanOrEqualTo(String value) {
addCriterion("RequestParam <=", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamLike(String value) {
addCriterion("RequestParam like", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamNotLike(String value) {
addCriterion("RequestParam not like", value, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamIn(List<String> values) {
addCriterion("RequestParam in", values, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamNotIn(List<String> values) {
addCriterion("RequestParam not in", values, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamBetween(String value1, String value2) {
addCriterion("RequestParam between", value1, value2, "requestparam");
return (Criteria) this;
}
public Criteria andRequestparamNotBetween(String value1, String value2) {
addCriterion("RequestParam not between", value1, value2, "requestparam");
return (Criteria) this;
}
public Criteria andResponseIsNull() {
addCriterion("Response is null");
return (Criteria) this;
}
public Criteria andResponseIsNotNull() {
addCriterion("Response is not null");
return (Criteria) this;
}
public Criteria andResponseEqualTo(String value) {
addCriterion("Response =", value, "response");
return (Criteria) this;
}
public Criteria andResponseNotEqualTo(String value) {
addCriterion("Response <>", value, "response");
return (Criteria) this;
}
public Criteria andResponseGreaterThan(String value) {
addCriterion("Response >", value, "response");
return (Criteria) this;
}
public Criteria andResponseGreaterThanOrEqualTo(String value) {
addCriterion("Response >=", value, "response");
return (Criteria) this;
}
public Criteria andResponseLessThan(String value) {
addCriterion("Response <", value, "response");
return (Criteria) this;
}
public Criteria andResponseLessThanOrEqualTo(String value) {
addCriterion("Response <=", value, "response");
return (Criteria) this;
}
public Criteria andResponseLike(String value) {
addCriterion("Response like", value, "response");
return (Criteria) this;
}
public Criteria andResponseNotLike(String value) {
addCriterion("Response not like", value, "response");
return (Criteria) this;
}
public Criteria andResponseIn(List<String> values) {
addCriterion("Response in", values, "response");
return (Criteria) this;
}
public Criteria andResponseNotIn(List<String> values) {
addCriterion("Response not in", values, "response");
return (Criteria) this;
}
public Criteria andResponseBetween(String value1, String value2) {
addCriterion("Response between", value1, value2, "response");
return (Criteria) this;
}
public Criteria andResponseNotBetween(String value1, String value2) {
addCriterion("Response not between", value1, value2, "response");
return (Criteria) this;
}
public Criteria andStepIsNull() {
addCriterion("Step is null");
return (Criteria) this;
}
public Criteria andStepIsNotNull() {
addCriterion("Step is not null");
return (Criteria) this;
}
public Criteria andStepEqualTo(Integer value) {
addCriterion("Step =", value, "step");
return (Criteria) this;
}
public Criteria andStepNotEqualTo(Integer value) {
addCriterion("Step <>", value, "step");
return (Criteria) this;
}
public Criteria andStepGreaterThan(Integer value) {
addCriterion("Step >", value, "step");
return (Criteria) this;
}
public Criteria andStepGreaterThanOrEqualTo(Integer value) {
addCriterion("Step >=", value, "step");
return (Criteria) this;
}
public Criteria andStepLessThan(Integer value) {
addCriterion("Step <", value, "step");
return (Criteria) this;
}
public Criteria andStepLessThanOrEqualTo(Integer value) {
addCriterion("Step <=", value, "step");
return (Criteria) this;
}
public Criteria andStepIn(List<Integer> values) {
addCriterion("Step in", values, "step");
return (Criteria) this;
}
public Criteria andStepNotIn(List<Integer> values) {
addCriterion("Step not in", values, "step");
return (Criteria) this;
}
public Criteria andStepBetween(Integer value1, Integer value2) {
addCriterion("Step between", value1, value2, "step");
return (Criteria) this;
}
public Criteria andStepNotBetween(Integer value1, Integer value2) {
addCriterion("Step not between", value1, value2, "step");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("Status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("Status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("Status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("Status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("Status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("Status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("Status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("Status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("Status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("Status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("Status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("Status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Integer value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Integer value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Integer value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Integer value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Integer value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Integer value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Integer> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Integer> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Integer value1, Integer value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Integer value1, Integer value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserNameIsNull() {
addCriterion("user_name is null");
return (Criteria) this;
}
public Criteria andUserNameIsNotNull() {
addCriterion("user_name is not null");
return (Criteria) this;
}
public Criteria andUserNameEqualTo(String value) {
addCriterion("user_name =", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotEqualTo(String value) {
addCriterion("user_name <>", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThan(String value) {
addCriterion("user_name >", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameGreaterThanOrEqualTo(String value) {
addCriterion("user_name >=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThan(String value) {
addCriterion("user_name <", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLessThanOrEqualTo(String value) {
addCriterion("user_name <=", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameLike(String value) {
addCriterion("user_name like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotLike(String value) {
addCriterion("user_name not like", value, "userName");
return (Criteria) this;
}
public Criteria andUserNameIn(List<String> values) {
addCriterion("user_name in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotIn(List<String> values) {
addCriterion("user_name not in", values, "userName");
return (Criteria) this;
}
public Criteria andUserNameBetween(String value1, String value2) {
addCriterion("user_name between", value1, value2, "userName");
return (Criteria) this;
}
public Criteria andUserNameNotBetween(String value1, String value2) {
addCriterion("user_name not between", value1, value2, "userName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -0,0 +1,30 @@
package com.weiqi.mis.enums;
public enum ReportStatusEnum {
SUCCESS("1", "成功"),
FAIL("-1", "失败"),
UNKNOWN("0", "未知");
private String status;
private String desc;
ReportStatusEnum(String status, String desc) {
this.status = status;
this.desc = desc;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

View File

@ -0,0 +1,24 @@
package com.weiqi.mis.mapper;
import com.weiqi.mis.domain.AdminUserInfo;
import com.weiqi.mis.domain.AdminUserInfoExample;
import java.util.List;
public interface AdminUserInfoMapper {
int countByExample(AdminUserInfoExample example);
int deleteByPrimaryKey(Integer id);
int insert(AdminUserInfo record);
int insertSelective(AdminUserInfo record);
List<AdminUserInfo> selectByExample(AdminUserInfoExample example);
AdminUserInfo selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AdminUserInfo record);
int updateByPrimaryKey(AdminUserInfo record);
}

View File

@ -0,0 +1,27 @@
package com.weiqi.mis.mapper;
import com.weiqi.mis.domain.WxXrPemsOrder;
import com.weiqi.mis.domain.WxXrPemsOrderExample;
import java.util.List;
public interface WxXrPemsOrderMapper {
int countByExample(WxXrPemsOrderExample example);
int deleteByPrimaryKey(Integer id);
int insert(WxXrPemsOrder record);
int insertSelective(WxXrPemsOrder record);
List<WxXrPemsOrder> selectByExampleWithBLOBs(WxXrPemsOrderExample example);
List<WxXrPemsOrder> selectByExample(WxXrPemsOrderExample example);
WxXrPemsOrder selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(WxXrPemsOrder record);
int updateByPrimaryKeyWithBLOBs(WxXrPemsOrder record);
int updateByPrimaryKey(WxXrPemsOrder record);
}

View File

@ -0,0 +1,23 @@
package com.weiqi.mis.mapper;
import com.weiqi.mis.domain.WxXrPemsOrderPushLog;
import com.weiqi.mis.domain.WxXrPemsOrderPushLogExample;
import java.util.List;
public interface WxXrPemsOrderPushLogMapper {
int countByExample(WxXrPemsOrderPushLogExample example);
int deleteByPrimaryKey(Integer id);
int insert(WxXrPemsOrderPushLog record);
int insertSelective(WxXrPemsOrderPushLog record);