From 4d56117b48248abc3aec646c404e350a09470c06 Mon Sep 17 00:00:00 2001
From: duliyang <>
Date: Sat, 26 Oct 2024 15:28:51 +0800
Subject: [PATCH] first commit
---
.gitignore | 39 +
car-common/.gitignore | 31 +
car-common/pom.xml | 189 ++
.../main/java/com/weiqi/mis/DateHelper.java | 780 +++++
.../src/main/java/com/weiqi/mis/DateUtil.java | 1113 +++++++
.../main/java/com/weiqi/mis/DateUtils.java | 1271 ++++++++
.../src/main/java/com/weiqi/mis/HttpUtil.java | 622 ++++
.../src/main/java/com/weiqi/mis/IPUtil.java | 164 +
.../java/com/weiqi/mis/JacksonHelper.java | 292 ++
.../src/main/java/com/weiqi/mis/MD5Util.java | 71 +
.../main/java/com/weiqi/mis/RedisUtil.java | 87 +
.../main/java/com/weiqi/mis/ReturnCode.java | 113 +
.../main/java/com/weiqi/mis/ReturnValue.java | 99 +
.../java/com/weiqi/mis/ReturnValueApi.java | 80 +
.../java/com/weiqi/mis/ReturnValuePage.java | 99 +
.../src/main/java/com/weiqi/mis/SpAddr.java | 39 +
.../main/java/com/weiqi/mis/StringUtils.java | 59 +
.../java/com/weiqi/mis/ThreadPoolConfig.java | 39 +
.../java/com/weiqi/mis/URLEncodeUtil.java | 15 +
.../src/main/java/com/weiqi/mis/XmlUtil.java | 48 +
car-common/src/main/java/com/weiqi/mis/Z.java | 974 ++++++
.../java/com/weiqi/util/DingTalkUtils.java | 454 +++
.../main/java/com/weiqi/util/SmsTools.java | 93 +
.../src/main/java/com/weiqi/vo/AddrVo.java | 50 +
.../com/weiqi/vo/AutoBiStatisticSpVo.java | 152 +
.../java/com/weiqi/vo/AutoBiStatisticVo.java | 93 +
.../java/com/weiqi/vo/BusinessException.java | 19 +
.../main/java/com/weiqi/vo/MisUserinfo.java | 74 +
.../main/java/com/weiqi/vo/OrderInfoVo.java | 462 +++
.../main/java/com/weiqi/vo/RouteInfoVo.java | 82 +
.../src/main/java/com/weiqi/vo/RouteVo.java | 236 ++
.../java/com/weiqi/vo/SmsGlobalIndex.java | 43 +
.../src/main/java/com/weiqi/vo/SmsSendVo.java | 237 ++
.../src/main/java/com/weiqi/vo/WightVo.java | 86 +
car-dao/.gitignore | 31 +
car-dao/pom.xml | 60 +
car-dao/src/main/.DS_Store | Bin 0 -> 6148 bytes
car-dao/src/main/java/DaoApplication.java | 12 +
.../java/com/weiqi/mis/bo/StisticByDay.java | 44 +
.../com/weiqi/mis/domain/AdminUserInfo.java | 65 +
.../mis/domain/AdminUserInfoExample.java | 581 ++++
.../com/weiqi/mis/domain/WxXrPemsOrder.java | 425 +++
.../mis/domain/WxXrPemsOrderExample.java | 2901 +++++++++++++++++
.../mis/domain/WxXrPemsOrderPushLog.java | 115 +
.../domain/WxXrPemsOrderPushLogExample.java | 911 ++++++
.../com/weiqi/mis/enums/ReportStatusEnum.java | 30 +
.../weiqi/mis/mapper/AdminUserInfoMapper.java | 24 +
.../weiqi/mis/mapper/WxXrPemsOrderMapper.java | 27 +
.../mapper/WxXrPemsOrderPushLogMapper.java | 23 +
.../weiqi/mis/mapper/AdminUserInfoMapper.xml | 156 +
.../weiqi/mis/mapper/WxXrPemsOrderMapper.xml | 650 ++++
.../mis/mapper/WxXrPemsOrderPushLogMapper.xml | 214 ++
car-mis/.gitignore | 31 +
car-mis/pom.xml | 275 ++
.../alibaba/excel/read/SaxAnalyserV07.java | 280 ++
.../java/com/weiqi/mis/MisApplication.java | 17 +
.../com/weiqi/mis/ServletInitializer.java | 15 +
.../java/com/weiqi/mis/config/JobLog.java | 77 +
.../com/weiqi/mis/config/ScheduleConfig.java | 23 +
.../com/weiqi/mis/config/XxlJobConfig.java | 52 +
.../weiqi/mis/contorller/BaseController.java | 86 +
.../weiqi/mis/contorller/CallableTask.java | 167 +
.../weiqi/mis/contorller/CarController.java | 102 +
.../mis/contorller/CarLogController.java | 104 +
.../weiqi/mis/contorller/CheckController.java | 93 +
.../com/weiqi/mis/contorller/CorsConfig.java | 136 +
.../com/weiqi/mis/export/SmsListExcel.java | 77 +
.../weiqi/mis/redis/RedisListenerConfig.java | 108 +
.../com/weiqi/mis/redis/RedisReceiver.java | 85 +
.../resources/application-test.properties | 37 +
.../main/resources/application-yz.properties | 57 +
.../src/main/resources/application.properties | 26 +
car-mis/src/main/resources/config.properties | 40 +
car-mis/src/main/resources/logback-prod.xml | 130 +
car-mis/src/main/resources/logback-test.xml | 135 +
.../src/main/resources/static/css/layui.css | 2 +
.../resources/static/css/layui.mobile.css | 2 +
.../resources/static/css/modules/code.css | 2 +
.../css/modules/laydate/default/laydate.css | 2 +
.../css/modules/layer/default/icon-ext.png | Bin 0 -> 5911 bytes
.../static/css/modules/layer/default/icon.png | Bin 0 -> 11493 bytes
.../css/modules/layer/default/layer.css | 2 +
.../css/modules/layer/default/loading-0.gif | Bin 0 -> 5793 bytes
.../css/modules/layer/default/loading-1.gif | Bin 0 -> 701 bytes
.../css/modules/layer/default/loading-2.gif | Bin 0 -> 1787 bytes
.../main/resources/static/font/iconfont.eot | Bin 0 -> 41712 bytes
.../main/resources/static/font/iconfont.svg | 485 +++
.../main/resources/static/font/iconfont.ttf | Bin 0 -> 41536 bytes
.../main/resources/static/font/iconfont.woff | Bin 0 -> 27256 bytes
.../main/resources/static/font/iconfont.woff2 | Bin 0 -> 23140 bytes
.../main/resources/static/images/face/0.gif | Bin 0 -> 2689 bytes
.../main/resources/static/images/face/1.gif | Bin 0 -> 5514 bytes
.../main/resources/static/images/face/10.gif | Bin 0 -> 2797 bytes
.../main/resources/static/images/face/11.gif | Bin 0 -> 4121 bytes
.../main/resources/static/images/face/12.gif | Bin 0 -> 3361 bytes
.../main/resources/static/images/face/13.gif | Bin 0 -> 7425 bytes
.../main/resources/static/images/face/14.gif | Bin 0 -> 2375 bytes
.../main/resources/static/images/face/15.gif | Bin 0 -> 1793 bytes
.../main/resources/static/images/face/16.gif | Bin 0 -> 6721 bytes
.../main/resources/static/images/face/17.gif | Bin 0 -> 4439 bytes
.../main/resources/static/images/face/18.gif | Bin 0 -> 3017 bytes
.../main/resources/static/images/face/19.gif | Bin 0 -> 3040 bytes
.../main/resources/static/images/face/2.gif | Bin 0 -> 3222 bytes
.../main/resources/static/images/face/20.gif | Bin 0 -> 5144 bytes
.../main/resources/static/images/face/21.gif | Bin 0 -> 5191 bytes
.../main/resources/static/images/face/22.gif | Bin 0 -> 9823 bytes
.../main/resources/static/images/face/23.gif | Bin 0 -> 3792 bytes
.../main/resources/static/images/face/24.gif | Bin 0 -> 8096 bytes
.../main/resources/static/images/face/25.gif | Bin 0 -> 3127 bytes
.../main/resources/static/images/face/26.gif | Bin 0 -> 3291 bytes
.../main/resources/static/images/face/27.gif | Bin 0 -> 4377 bytes
.../main/resources/static/images/face/28.gif | Bin 0 -> 2793 bytes
.../main/resources/static/images/face/29.gif | Bin 0 -> 4854 bytes
.../main/resources/static/images/face/3.gif | Bin 0 -> 4017 bytes
.../main/resources/static/images/face/30.gif | Bin 0 -> 2555 bytes
.../main/resources/static/images/face/31.gif | Bin 0 -> 2002 bytes
.../main/resources/static/images/face/32.gif | Bin 0 -> 3481 bytes
.../main/resources/static/images/face/33.gif | Bin 0 -> 2454 bytes
.../main/resources/static/images/face/34.gif | Bin 0 -> 3700 bytes
.../main/resources/static/images/face/35.gif | Bin 0 -> 1800 bytes
.../main/resources/static/images/face/36.gif | Bin 0 -> 2331 bytes
.../main/resources/static/images/face/37.gif | Bin 0 -> 1513 bytes
.../main/resources/static/images/face/38.gif | Bin 0 -> 3615 bytes
.../main/resources/static/images/face/39.gif | Bin 0 -> 6495 bytes
.../main/resources/static/images/face/4.gif | Bin 0 -> 5689 bytes
.../main/resources/static/images/face/40.gif | Bin 0 -> 3154 bytes
.../main/resources/static/images/face/41.gif | Bin 0 -> 3644 bytes
.../main/resources/static/images/face/42.gif | Bin 0 -> 5305 bytes
.../main/resources/static/images/face/43.gif | Bin 0 -> 2674 bytes
.../main/resources/static/images/face/44.gif | Bin 0 -> 4126 bytes
.../main/resources/static/images/face/45.gif | Bin 0 -> 3417 bytes
.../main/resources/static/images/face/46.gif | Bin 0 -> 3007 bytes
.../main/resources/static/images/face/47.gif | Bin 0 -> 2333 bytes
.../main/resources/static/images/face/48.gif | Bin 0 -> 2689 bytes
.../main/resources/static/images/face/49.gif | Bin 0 -> 2315 bytes
.../main/resources/static/images/face/5.gif | Bin 0 -> 4567 bytes
.../main/resources/static/images/face/50.gif | Bin 0 -> 5866 bytes
.../main/resources/static/images/face/51.gif | Bin 0 -> 2785 bytes
.../main/resources/static/images/face/52.gif | Bin 0 -> 777 bytes
.../main/resources/static/images/face/53.gif | Bin 0 -> 2127 bytes
.../main/resources/static/images/face/54.gif | Bin 0 -> 2196 bytes
.../main/resources/static/images/face/55.gif | Bin 0 -> 1971 bytes
.../main/resources/static/images/face/56.gif | Bin 0 -> 2034 bytes
.../main/resources/static/images/face/57.gif | Bin 0 -> 2705 bytes
.../main/resources/static/images/face/58.gif | Bin 0 -> 2258 bytes
.../main/resources/static/images/face/59.gif | Bin 0 -> 10311 bytes
.../main/resources/static/images/face/6.gif | Bin 0 -> 2213 bytes
.../main/resources/static/images/face/60.gif | Bin 0 -> 3245 bytes
.../main/resources/static/images/face/61.gif | Bin 0 -> 2495 bytes
.../main/resources/static/images/face/62.gif | Bin 0 -> 2017 bytes
.../main/resources/static/images/face/63.gif | Bin 0 -> 5871 bytes
.../main/resources/static/images/face/64.gif | Bin 0 -> 6448 bytes
.../main/resources/static/images/face/65.gif | Bin 0 -> 3576 bytes
.../main/resources/static/images/face/66.gif | Bin 0 -> 3029 bytes
.../main/resources/static/images/face/67.gif | Bin 0 -> 2701 bytes
.../main/resources/static/images/face/68.gif | Bin 0 -> 1424 bytes
.../main/resources/static/images/face/69.gif | Bin 0 -> 2431 bytes
.../main/resources/static/images/face/7.gif | Bin 0 -> 3398 bytes
.../main/resources/static/images/face/70.gif | Bin 0 -> 4590 bytes
.../main/resources/static/images/face/71.gif | Bin 0 -> 5304 bytes
.../main/resources/static/images/face/8.gif | Bin 0 -> 4050 bytes
.../main/resources/static/images/face/9.gif | Bin 0 -> 4221 bytes
car-mis/src/main/resources/static/jquery.js | 5 +
.../resources/static/lay/modules/carousel.js | 2 +
.../main/resources/static/lay/modules/code.js | 2 +
.../static/lay/modules/colorpicker.js | 2 +
.../resources/static/lay/modules/element.js | 2 +
.../main/resources/static/lay/modules/flow.js | 2 +
.../main/resources/static/lay/modules/form.js | 2 +
.../resources/static/lay/modules/jquery.js | 5 +
.../resources/static/lay/modules/laydate.js | 2 +
.../resources/static/lay/modules/layedit.js | 2 +
.../resources/static/lay/modules/layer.js | 2 +
.../resources/static/lay/modules/laypage.js | 2 +
.../resources/static/lay/modules/laytpl.js | 2 +
.../resources/static/lay/modules/mobile.js | 2 +
.../main/resources/static/lay/modules/rate.js | 2 +
.../resources/static/lay/modules/slider.js | 2 +
.../resources/static/lay/modules/table.js | 2 +
.../resources/static/lay/modules/transfer.js | 2 +
.../main/resources/static/lay/modules/tree.js | 2 +
.../resources/static/lay/modules/upload.js | 2 +
.../main/resources/static/lay/modules/util.js | 2 +
.../src/main/resources/static/layui.all.js | 5 +
car-mis/src/main/resources/static/layui.js | 2 +
.../resources/static/metrics/css/layui.css | 2 +
.../static/metrics/css/layui.mobile.css | 2 +
.../static/metrics/css/modules/code.css | 2 +
.../css/modules/laydate/default/laydate.css | 2 +
.../css/modules/layer/default/icon-ext.png | Bin 0 -> 5911 bytes
.../css/modules/layer/default/icon.png | Bin 0 -> 11493 bytes
.../css/modules/layer/default/layer.css | 2 +
.../css/modules/layer/default/loading-0.gif | Bin 0 -> 5793 bytes
.../css/modules/layer/default/loading-1.gif | Bin 0 -> 701 bytes
.../css/modules/layer/default/loading-2.gif | Bin 0 -> 1787 bytes
.../static/metrics/font/iconfont.eot | Bin 0 -> 41712 bytes
.../static/metrics/font/iconfont.svg | 485 +++
.../static/metrics/font/iconfont.ttf | Bin 0 -> 41536 bytes
.../static/metrics/font/iconfont.woff | Bin 0 -> 27256 bytes
.../static/metrics/font/iconfont.woff2 | Bin 0 -> 23140 bytes
.../static/metrics/highcharts/exporting.js | 48 +
.../static/metrics/highcharts/highcharts.js | 569 ++++
.../static/metrics/highcharts/oldie.js | 40 +
.../static/metrics/images/face/0.gif | Bin 0 -> 2689 bytes
.../static/metrics/images/face/1.gif | Bin 0 -> 5514 bytes
.../static/metrics/images/face/10.gif | Bin 0 -> 2797 bytes
.../static/metrics/images/face/11.gif | Bin 0 -> 4121 bytes
.../static/metrics/images/face/12.gif | Bin 0 -> 3361 bytes
.../static/metrics/images/face/13.gif | Bin 0 -> 7425 bytes
.../static/metrics/images/face/14.gif | Bin 0 -> 2375 bytes
.../static/metrics/images/face/15.gif | Bin 0 -> 1793 bytes
.../static/metrics/images/face/16.gif | Bin 0 -> 6721 bytes
.../static/metrics/images/face/17.gif | Bin 0 -> 4439 bytes
.../static/metrics/images/face/18.gif | Bin 0 -> 3017 bytes
.../static/metrics/images/face/19.gif | Bin 0 -> 3040 bytes
.../static/metrics/images/face/2.gif | Bin 0 -> 3222 bytes
.../static/metrics/images/face/20.gif | Bin 0 -> 5144 bytes
.../static/metrics/images/face/21.gif | Bin 0 -> 5191 bytes
.../static/metrics/images/face/22.gif | Bin 0 -> 9823 bytes
.../static/metrics/images/face/23.gif | Bin 0 -> 3792 bytes
.../static/metrics/images/face/24.gif | Bin 0 -> 8096 bytes
.../static/metrics/images/face/25.gif | Bin 0 -> 3127 bytes
.../static/metrics/images/face/26.gif | Bin 0 -> 3291 bytes
.../static/metrics/images/face/27.gif | Bin 0 -> 4377 bytes
.../static/metrics/images/face/28.gif | Bin 0 -> 2793 bytes
.../static/metrics/images/face/29.gif | Bin 0 -> 4854 bytes
.../static/metrics/images/face/3.gif | Bin 0 -> 4017 bytes
.../static/metrics/images/face/30.gif | Bin 0 -> 2555 bytes
.../static/metrics/images/face/31.gif | Bin 0 -> 2002 bytes
.../static/metrics/images/face/32.gif | Bin 0 -> 3481 bytes
.../static/metrics/images/face/33.gif | Bin 0 -> 2454 bytes
.../static/metrics/images/face/34.gif | Bin 0 -> 3700 bytes
.../static/metrics/images/face/35.gif | Bin 0 -> 1800 bytes
.../static/metrics/images/face/36.gif | Bin 0 -> 2331 bytes
.../static/metrics/images/face/37.gif | Bin 0 -> 1513 bytes
.../static/metrics/images/face/38.gif | Bin 0 -> 3615 bytes
.../static/metrics/images/face/39.gif | Bin 0 -> 6495 bytes
.../static/metrics/images/face/4.gif | Bin 0 -> 5689 bytes
.../static/metrics/images/face/40.gif | Bin 0 -> 3154 bytes
.../static/metrics/images/face/41.gif | Bin 0 -> 3644 bytes
.../static/metrics/images/face/42.gif | Bin 0 -> 5305 bytes
.../static/metrics/images/face/43.gif | Bin 0 -> 2674 bytes
.../static/metrics/images/face/44.gif | Bin 0 -> 4126 bytes
.../static/metrics/images/face/45.gif | Bin 0 -> 3417 bytes
.../static/metrics/images/face/46.gif | Bin 0 -> 3007 bytes
.../static/metrics/images/face/47.gif | Bin 0 -> 2333 bytes
.../static/metrics/images/face/48.gif | Bin 0 -> 2689 bytes
.../static/metrics/images/face/49.gif | Bin 0 -> 2315 bytes
.../static/metrics/images/face/5.gif | Bin 0 -> 4567 bytes
.../static/metrics/images/face/50.gif | Bin 0 -> 5866 bytes
.../static/metrics/images/face/51.gif | Bin 0 -> 2785 bytes
.../static/metrics/images/face/52.gif | Bin 0 -> 777 bytes
.../static/metrics/images/face/53.gif | Bin 0 -> 2127 bytes
.../static/metrics/images/face/54.gif | Bin 0 -> 2196 bytes
.../static/metrics/images/face/55.gif | Bin 0 -> 1971 bytes
.../static/metrics/images/face/56.gif | Bin 0 -> 2034 bytes
.../static/metrics/images/face/57.gif | Bin 0 -> 2705 bytes
.../static/metrics/images/face/58.gif | Bin 0 -> 2258 bytes
.../static/metrics/images/face/59.gif | Bin 0 -> 10311 bytes
.../static/metrics/images/face/6.gif | Bin 0 -> 2213 bytes
.../static/metrics/images/face/60.gif | Bin 0 -> 3245 bytes
.../static/metrics/images/face/61.gif | Bin 0 -> 2495 bytes
.../static/metrics/images/face/62.gif | Bin 0 -> 2017 bytes
.../static/metrics/images/face/63.gif | Bin 0 -> 5871 bytes
.../static/metrics/images/face/64.gif | Bin 0 -> 6448 bytes
.../static/metrics/images/face/65.gif | Bin 0 -> 3576 bytes
.../static/metrics/images/face/66.gif | Bin 0 -> 3029 bytes
.../static/metrics/images/face/67.gif | Bin 0 -> 2701 bytes
.../static/metrics/images/face/68.gif | Bin 0 -> 1424 bytes
.../static/metrics/images/face/69.gif | Bin 0 -> 2431 bytes
.../static/metrics/images/face/7.gif | Bin 0 -> 3398 bytes
.../static/metrics/images/face/70.gif | Bin 0 -> 4590 bytes
.../static/metrics/images/face/71.gif | Bin 0 -> 5304 bytes
.../static/metrics/images/face/8.gif | Bin 0 -> 4050 bytes
.../static/metrics/images/face/9.gif | Bin 0 -> 4221 bytes
.../main/resources/static/metrics/jquery.js | 5 +
.../static/metrics/lay/modules/carousel.js | 2 +
.../static/metrics/lay/modules/code.js | 2 +
.../static/metrics/lay/modules/colorpicker.js | 2 +
.../static/metrics/lay/modules/element.js | 2 +
.../static/metrics/lay/modules/flow.js | 2 +
.../static/metrics/lay/modules/form.js | 2 +
.../static/metrics/lay/modules/jquery.js | 5 +
.../static/metrics/lay/modules/laydate.js | 2 +
.../static/metrics/lay/modules/layedit.js | 2 +
.../static/metrics/lay/modules/layer.js | 2 +
.../static/metrics/lay/modules/laypage.js | 2 +
.../static/metrics/lay/modules/laytpl.js | 2 +
.../static/metrics/lay/modules/mobile.js | 2 +
.../static/metrics/lay/modules/rate.js | 2 +
.../static/metrics/lay/modules/slider.js | 2 +
.../static/metrics/lay/modules/table.js | 2 +
.../static/metrics/lay/modules/transfer.js | 2 +
.../static/metrics/lay/modules/tree.js | 2 +
.../static/metrics/lay/modules/upload.js | 2 +
.../static/metrics/lay/modules/util.js | 2 +
.../resources/static/metrics/layui.all.js | 5 +
.../main/resources/static/metrics/layui.js | 2 +
.../metrics/tiny-alert/css/zepto.alert.css | 52 +
.../static/metrics/tiny-alert/demo.html | 102 +
.../metrics/tiny-alert/images/alert-icons.png | Bin 0 -> 2048 bytes
.../tiny-alert/images/alert-loading.gif | Bin 0 -> 3897 bytes
.../metrics/tiny-alert/js/zepto.alert.js | 241 ++
.../resources/static/metrics/zepto.min.js | 2 +
.../static/tiny-alert/css/zepto.alert.css | 52 +
.../resources/static/tiny-alert/demo.html | 102 +
.../static/tiny-alert/images/alert-icons.png | Bin 0 -> 2048 bytes
.../tiny-alert/images/alert-loading.gif | Bin 0 -> 3897 bytes
.../static/tiny-alert/js/zepto.alert.js | 241 ++
.../src/main/resources/static/zepto.min.js | 2 +
.../resources/templates/car/orderInfo.html | 348 ++
.../resources/templates/car/orderLog.html | 269 ++
.../main/resources/templates/sms/index.html | 52 +
.../main/resources/templates/sms/login.html | 153 +
car-service/pom.xml | 68 +
.../main/java/com/weiqi/mis/MsgService.java | 26 +
.../main/java/com/weiqi/mis/UserService.java | 15 +
.../weiqi/mis/annotation/LoginRequired.java | 15 +
.../com/weiqi/mis/annotation/LoginType.java | 15 +
.../com/weiqi/mis/impl/MsgServiceImpl.java | 152 +
.../com/weiqi/mis/impl/UserServiceImpl.java | 41 +
.../mis/interceptor/AnotationInterceptor.java | 43 +
.../mis/interceptor/LoginInterceptor.java | 99 +
.../interceptor/WebAppConfigurerCommon.java | 26 +
.../weiqi/mis/redis/RedisListenerConfig.java | 105 +
.../com/weiqi/mis/redis/RedisReceiver.java | 86 +
pom.xml | 167 +
327 files changed, 20958 insertions(+)
create mode 100644 .gitignore
create mode 100644 car-common/.gitignore
create mode 100644 car-common/pom.xml
create mode 100644 car-common/src/main/java/com/weiqi/mis/DateHelper.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/DateUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/DateUtils.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/HttpUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/IPUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/JacksonHelper.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/MD5Util.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/RedisUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/ReturnCode.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/ReturnValue.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/ReturnValueApi.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/ReturnValuePage.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/SpAddr.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/StringUtils.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/ThreadPoolConfig.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/URLEncodeUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/XmlUtil.java
create mode 100644 car-common/src/main/java/com/weiqi/mis/Z.java
create mode 100644 car-common/src/main/java/com/weiqi/util/DingTalkUtils.java
create mode 100644 car-common/src/main/java/com/weiqi/util/SmsTools.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/AddrVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/AutoBiStatisticSpVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/AutoBiStatisticVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/BusinessException.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/MisUserinfo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/OrderInfoVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/RouteInfoVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/RouteVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/SmsGlobalIndex.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/SmsSendVo.java
create mode 100644 car-common/src/main/java/com/weiqi/vo/WightVo.java
create mode 100644 car-dao/.gitignore
create mode 100644 car-dao/pom.xml
create mode 100644 car-dao/src/main/.DS_Store
create mode 100644 car-dao/src/main/java/DaoApplication.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/bo/StisticByDay.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/AdminUserInfo.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/AdminUserInfoExample.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/WxXrPemsOrder.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/WxXrPemsOrderExample.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/WxXrPemsOrderPushLog.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/domain/WxXrPemsOrderPushLogExample.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/enums/ReportStatusEnum.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/mapper/AdminUserInfoMapper.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/mapper/WxXrPemsOrderMapper.java
create mode 100644 car-dao/src/main/java/com/weiqi/mis/mapper/WxXrPemsOrderPushLogMapper.java
create mode 100644 car-dao/src/main/resources/com/weiqi/mis/mapper/AdminUserInfoMapper.xml
create mode 100644 car-dao/src/main/resources/com/weiqi/mis/mapper/WxXrPemsOrderMapper.xml
create mode 100644 car-dao/src/main/resources/com/weiqi/mis/mapper/WxXrPemsOrderPushLogMapper.xml
create mode 100644 car-mis/.gitignore
create mode 100644 car-mis/pom.xml
create mode 100644 car-mis/src/main/java/com/alibaba/excel/read/SaxAnalyserV07.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/MisApplication.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/ServletInitializer.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/config/JobLog.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/config/ScheduleConfig.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/config/XxlJobConfig.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/BaseController.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/CallableTask.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/CarController.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/CarLogController.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/CheckController.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/contorller/CorsConfig.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/export/SmsListExcel.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/redis/RedisListenerConfig.java
create mode 100644 car-mis/src/main/java/com/weiqi/mis/redis/RedisReceiver.java
create mode 100644 car-mis/src/main/resources/application-test.properties
create mode 100644 car-mis/src/main/resources/application-yz.properties
create mode 100644 car-mis/src/main/resources/application.properties
create mode 100644 car-mis/src/main/resources/config.properties
create mode 100644 car-mis/src/main/resources/logback-prod.xml
create mode 100644 car-mis/src/main/resources/logback-test.xml
create mode 100644 car-mis/src/main/resources/static/css/layui.css
create mode 100644 car-mis/src/main/resources/static/css/layui.mobile.css
create mode 100644 car-mis/src/main/resources/static/css/modules/code.css
create mode 100644 car-mis/src/main/resources/static/css/modules/laydate/default/laydate.css
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/icon-ext.png
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/icon.png
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/layer.css
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/loading-0.gif
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/loading-1.gif
create mode 100644 car-mis/src/main/resources/static/css/modules/layer/default/loading-2.gif
create mode 100644 car-mis/src/main/resources/static/font/iconfont.eot
create mode 100644 car-mis/src/main/resources/static/font/iconfont.svg
create mode 100644 car-mis/src/main/resources/static/font/iconfont.ttf
create mode 100644 car-mis/src/main/resources/static/font/iconfont.woff
create mode 100644 car-mis/src/main/resources/static/font/iconfont.woff2
create mode 100644 car-mis/src/main/resources/static/images/face/0.gif
create mode 100644 car-mis/src/main/resources/static/images/face/1.gif
create mode 100644 car-mis/src/main/resources/static/images/face/10.gif
create mode 100644 car-mis/src/main/resources/static/images/face/11.gif
create mode 100644 car-mis/src/main/resources/static/images/face/12.gif
create mode 100644 car-mis/src/main/resources/static/images/face/13.gif
create mode 100644 car-mis/src/main/resources/static/images/face/14.gif
create mode 100644 car-mis/src/main/resources/static/images/face/15.gif
create mode 100644 car-mis/src/main/resources/static/images/face/16.gif
create mode 100644 car-mis/src/main/resources/static/images/face/17.gif
create mode 100644 car-mis/src/main/resources/static/images/face/18.gif
create mode 100644 car-mis/src/main/resources/static/images/face/19.gif
create mode 100644 car-mis/src/main/resources/static/images/face/2.gif
create mode 100644 car-mis/src/main/resources/static/images/face/20.gif
create mode 100644 car-mis/src/main/resources/static/images/face/21.gif
create mode 100644 car-mis/src/main/resources/static/images/face/22.gif
create mode 100644 car-mis/src/main/resources/static/images/face/23.gif
create mode 100644 car-mis/src/main/resources/static/images/face/24.gif
create mode 100644 car-mis/src/main/resources/static/images/face/25.gif
create mode 100644 car-mis/src/main/resources/static/images/face/26.gif
create mode 100644 car-mis/src/main/resources/static/images/face/27.gif
create mode 100644 car-mis/src/main/resources/static/images/face/28.gif
create mode 100644 car-mis/src/main/resources/static/images/face/29.gif
create mode 100644 car-mis/src/main/resources/static/images/face/3.gif
create mode 100644 car-mis/src/main/resources/static/images/face/30.gif
create mode 100644 car-mis/src/main/resources/static/images/face/31.gif
create mode 100644 car-mis/src/main/resources/static/images/face/32.gif
create mode 100644 car-mis/src/main/resources/static/images/face/33.gif
create mode 100644 car-mis/src/main/resources/static/images/face/34.gif
create mode 100644 car-mis/src/main/resources/static/images/face/35.gif
create mode 100644 car-mis/src/main/resources/static/images/face/36.gif
create mode 100644 car-mis/src/main/resources/static/images/face/37.gif
create mode 100644 car-mis/src/main/resources/static/images/face/38.gif
create mode 100644 car-mis/src/main/resources/static/images/face/39.gif
create mode 100644 car-mis/src/main/resources/static/images/face/4.gif
create mode 100644 car-mis/src/main/resources/static/images/face/40.gif
create mode 100644 car-mis/src/main/resources/static/images/face/41.gif
create mode 100644 car-mis/src/main/resources/static/images/face/42.gif
create mode 100644 car-mis/src/main/resources/static/images/face/43.gif
create mode 100644 car-mis/src/main/resources/static/images/face/44.gif
create mode 100644 car-mis/src/main/resources/static/images/face/45.gif
create mode 100644 car-mis/src/main/resources/static/images/face/46.gif
create mode 100644 car-mis/src/main/resources/static/images/face/47.gif
create mode 100644 car-mis/src/main/resources/static/images/face/48.gif
create mode 100644 car-mis/src/main/resources/static/images/face/49.gif
create mode 100644 car-mis/src/main/resources/static/images/face/5.gif
create mode 100644 car-mis/src/main/resources/static/images/face/50.gif
create mode 100644 car-mis/src/main/resources/static/images/face/51.gif
create mode 100644 car-mis/src/main/resources/static/images/face/52.gif
create mode 100644 car-mis/src/main/resources/static/images/face/53.gif
create mode 100644 car-mis/src/main/resources/static/images/face/54.gif
create mode 100644 car-mis/src/main/resources/static/images/face/55.gif
create mode 100644 car-mis/src/main/resources/static/images/face/56.gif
create mode 100644 car-mis/src/main/resources/static/images/face/57.gif
create mode 100644 car-mis/src/main/resources/static/images/face/58.gif
create mode 100644 car-mis/src/main/resources/static/images/face/59.gif
create mode 100644 car-mis/src/main/resources/static/images/face/6.gif
create mode 100644 car-mis/src/main/resources/static/images/face/60.gif
create mode 100644 car-mis/src/main/resources/static/images/face/61.gif
create mode 100644 car-mis/src/main/resources/static/images/face/62.gif
create mode 100644 car-mis/src/main/resources/static/images/face/63.gif
create mode 100644 car-mis/src/main/resources/static/images/face/64.gif
create mode 100644 car-mis/src/main/resources/static/images/face/65.gif
create mode 100644 car-mis/src/main/resources/static/images/face/66.gif
create mode 100644 car-mis/src/main/resources/static/images/face/67.gif
create mode 100644 car-mis/src/main/resources/static/images/face/68.gif
create mode 100644 car-mis/src/main/resources/static/images/face/69.gif
create mode 100644 car-mis/src/main/resources/static/images/face/7.gif
create mode 100644 car-mis/src/main/resources/static/images/face/70.gif
create mode 100644 car-mis/src/main/resources/static/images/face/71.gif
create mode 100644 car-mis/src/main/resources/static/images/face/8.gif
create mode 100644 car-mis/src/main/resources/static/images/face/9.gif
create mode 100644 car-mis/src/main/resources/static/jquery.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/carousel.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/code.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/colorpicker.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/element.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/flow.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/form.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/jquery.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/laydate.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/layedit.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/layer.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/laypage.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/laytpl.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/mobile.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/rate.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/slider.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/table.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/transfer.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/tree.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/upload.js
create mode 100644 car-mis/src/main/resources/static/lay/modules/util.js
create mode 100644 car-mis/src/main/resources/static/layui.all.js
create mode 100644 car-mis/src/main/resources/static/layui.js
create mode 100644 car-mis/src/main/resources/static/metrics/css/layui.css
create mode 100644 car-mis/src/main/resources/static/metrics/css/layui.mobile.css
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/code.css
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/laydate/default/laydate.css
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/icon-ext.png
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/icon.png
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/layer.css
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/loading-0.gif
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/loading-1.gif
create mode 100644 car-mis/src/main/resources/static/metrics/css/modules/layer/default/loading-2.gif
create mode 100644 car-mis/src/main/resources/static/metrics/font/iconfont.eot
create mode 100644 car-mis/src/main/resources/static/metrics/font/iconfont.svg
create mode 100644 car-mis/src/main/resources/static/metrics/font/iconfont.ttf
create mode 100644 car-mis/src/main/resources/static/metrics/font/iconfont.woff
create mode 100644 car-mis/src/main/resources/static/metrics/font/iconfont.woff2
create mode 100644 car-mis/src/main/resources/static/metrics/highcharts/exporting.js
create mode 100644 car-mis/src/main/resources/static/metrics/highcharts/highcharts.js
create mode 100644 car-mis/src/main/resources/static/metrics/highcharts/oldie.js
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/0.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/1.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/10.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/11.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/12.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/13.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/14.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/15.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/16.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/17.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/18.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/19.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/2.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/20.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/21.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/22.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/23.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/24.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/25.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/26.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/27.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/28.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/29.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/3.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/30.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/31.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/32.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/33.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/34.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/35.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/36.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/37.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/38.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/39.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/4.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/40.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/41.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/42.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/43.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/44.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/45.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/46.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/47.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/48.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/49.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/5.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/50.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/51.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/52.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/53.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/54.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/55.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/56.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/57.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/58.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/59.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/6.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/60.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/61.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/62.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/63.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/64.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/65.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/66.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/67.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/68.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/69.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/7.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/70.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/71.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/8.gif
create mode 100644 car-mis/src/main/resources/static/metrics/images/face/9.gif
create mode 100644 car-mis/src/main/resources/static/metrics/jquery.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/carousel.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/code.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/colorpicker.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/element.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/flow.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/form.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/jquery.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/laydate.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/layedit.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/layer.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/laypage.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/laytpl.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/mobile.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/rate.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/slider.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/table.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/transfer.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/tree.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/upload.js
create mode 100644 car-mis/src/main/resources/static/metrics/lay/modules/util.js
create mode 100644 car-mis/src/main/resources/static/metrics/layui.all.js
create mode 100644 car-mis/src/main/resources/static/metrics/layui.js
create mode 100644 car-mis/src/main/resources/static/metrics/tiny-alert/css/zepto.alert.css
create mode 100644 car-mis/src/main/resources/static/metrics/tiny-alert/demo.html
create mode 100644 car-mis/src/main/resources/static/metrics/tiny-alert/images/alert-icons.png
create mode 100644 car-mis/src/main/resources/static/metrics/tiny-alert/images/alert-loading.gif
create mode 100644 car-mis/src/main/resources/static/metrics/tiny-alert/js/zepto.alert.js
create mode 100644 car-mis/src/main/resources/static/metrics/zepto.min.js
create mode 100644 car-mis/src/main/resources/static/tiny-alert/css/zepto.alert.css
create mode 100644 car-mis/src/main/resources/static/tiny-alert/demo.html
create mode 100644 car-mis/src/main/resources/static/tiny-alert/images/alert-icons.png
create mode 100644 car-mis/src/main/resources/static/tiny-alert/images/alert-loading.gif
create mode 100644 car-mis/src/main/resources/static/tiny-alert/js/zepto.alert.js
create mode 100644 car-mis/src/main/resources/static/zepto.min.js
create mode 100644 car-mis/src/main/resources/templates/car/orderInfo.html
create mode 100644 car-mis/src/main/resources/templates/car/orderLog.html
create mode 100644 car-mis/src/main/resources/templates/sms/index.html
create mode 100644 car-mis/src/main/resources/templates/sms/login.html
create mode 100644 car-service/pom.xml
create mode 100644 car-service/src/main/java/com/weiqi/mis/MsgService.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/UserService.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/annotation/LoginRequired.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/annotation/LoginType.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/impl/MsgServiceImpl.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/impl/UserServiceImpl.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/interceptor/AnotationInterceptor.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/interceptor/LoginInterceptor.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/interceptor/WebAppConfigurerCommon.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/redis/RedisListenerConfig.java
create mode 100644 car-service/src/main/java/com/weiqi/mis/redis/RedisReceiver.java
create mode 100644 pom.xml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2f1b92f
--- /dev/null
+++ b/.gitignore
@@ -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
diff --git a/car-common/.gitignore b/car-common/.gitignore
new file mode 100644
index 0000000..a4c6f0c
--- /dev/null
+++ b/car-common/.gitignore
@@ -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/
diff --git a/car-common/pom.xml b/car-common/pom.xml
new file mode 100644
index 0000000..b863a7b
--- /dev/null
+++ b/car-common/pom.xml
@@ -0,0 +1,189 @@
+
+
+
+ carmis
+ com.weiqi
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ car-common
+
+
+ com.weiqi
+ car-dao
+ 0.0.1-SNAPSHOT
+
+
+
+
+ ma.glasnost.orika
+ orika-core
+ 1.5.4
+
+
+
+ com.google.guava
+ guava
+ 21.0
+
+
+
+ org.apache.commons
+ commons-email
+ 1.5
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+ io.lettuce
+ lettuce-core
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.5
+
+
+ com.google.guava
+ guava
+ 21.0
+
+
+ joda-time
+ joda-time
+
+
+ com.google.code.gson
+ gson
+ 2.8.0
+
+
+ org.javatuples
+ javatuples
+ 1.2
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.3
+
+
+ commons-io
+ commons-io
+ 2.5
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.61
+
+
+
+ com.google.zxing
+ core
+ 3.3.0
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5.3
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+ org.springframework
+ spring-web
+ 4.3.19.RELEASE
+
+
+ commons-collections
+ commons-collections
+ 3.2.2
+
+
+
+ dom4j
+ dom4j
+
+
+ com.alibaba
+ druid
+
+
+ com.alibaba
+ druid
+ 1.0.29
+
+
+
+ com.github.ben-manes.caffeine
+ caffeine
+ 2.5.5
+
+
+ redis.clients
+ jedis
+ 2.9.0
+
+
+ com.aliyun
+ alibaba-dingtalk-service-sdk
+ 2.0.0
+ compile
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ releases
+
+ http://repo.corpweiqi.com/nexus/content/repositories/releases/
+
+
+
+ snapshots
+
+ http://repo.corpweiqi.com/nexus/content/repositories/snapshots/
+
+
+
+
\ No newline at end of file
diff --git a/car-common/src/main/java/com/weiqi/mis/DateHelper.java b/car-common/src/main/java/com/weiqi/mis/DateHelper.java
new file mode 100644
index 0000000..19be092
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/DateHelper.java
@@ -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 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;
+ }
+
+
+}
diff --git a/car-common/src/main/java/com/weiqi/mis/DateUtil.java b/car-common/src/main/java/com/weiqi/mis/DateUtil.java
new file mode 100644
index 0000000..760cb80
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/DateUtil.java
@@ -0,0 +1,1113 @@
+/**
+ *
+ */
+package com.weiqi.mis;
+
+import com.google.common.base.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+
+/**
+ * @类名 DateUtil
+ * @描述: TODO
+ * @创建人 yyy
+ * @创建时间 2024年3月23日
+ * @版本 v1.0
+ */
+public class DateUtil {
+ private static final Logger logger = LoggerFactory.getLogger(DateUtil.class);
+
+ /**
+ * 字符串转换成日期
+ *
+ * @param dateString
+ * 日期串
+ * @param model
+ * 日期串的格式 ,如:yyyy-mm-dd
+ * @return
+ * @throws Exception
+ */
+ public static Date string2Date(String dateString, String model) {
+ Date date = null;
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ try {
+ date = sdf.parse(dateString);
+
+ if (!dateString.equals(sdf.format(date))) {
+ date = null;
+ }
+ } catch (ParseException e) {
+ logger.error("DateUtil.String2Date error!");
+ e.printStackTrace();
+ }
+ return date;
+ }
+
+ /**
+ * utc 时间格式转换正常格式 2018-08-07T03:41:59Z
+ *
+ * @param utcTime
+ * 时间
+ * @return
+ */
+ public static String formatStrUTCToDateStr(String utcTime) {
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ TimeZone utcZone = TimeZone.getTimeZone("UTC");
+ sf.setTimeZone(utcZone);
+ Date date = null;
+ String dateTime = "";
+ try {
+ date = sf.parse(utcTime);
+ dateTime = sdf.format(date);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return dateTime;
+ }
+
+ /**
+ * 当前日期加减n天的日期
+ *
+ * @param n
+ * 正数加,负数减
+ * @return
+ */
+ public static Date nDaysAfterNowDate(int n) {
+ Calendar rightNow = Calendar.getInstance();
+ rightNow.add(Calendar.DAY_OF_MONTH, +n);
+ return rightNow.getTime();
+ }
+
+ /**
+ * dateToDate
+ *
+ * @param date
+ * 日期
+ * @param model
+ * 转换成的格式 如:yyyy-MM-dd HH:mm:ss
+ * @return
+ */
+ public static Date getFormatDate(Date date, String model) {
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ Date formatdate = null;
+ try {
+ formatdate = sdf.parse(sdf.format(date));
+ } catch (ParseException e) {
+ logger.error("日期转换失败", e);
+ }
+ return formatdate;
+ }
+
+ /**
+ * 日期转换成字符串
+ *
+ * @param date
+ * @param model
+ * 如yyyyMMdd
+ * @return
+ */
+ public static String Date2String(Date date, String model) {
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ String strdate = sdf.format(date);
+ return strdate;
+ }
+
+ /**
+ * 返回8位当前系统时间
+ *
+ * @return
+ */
+ public static String Date2String8() {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ String strdate = sdf.format(new Date());
+ return strdate;
+ }
+
+ /**
+ * 判定传入时间是否是当天
+ *
+ * @param date
+ * 日期
+ * @return
+ */
+ public static boolean isTodayDate(Date date) {
+ boolean ret = false;
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ String compDay = null;
+ try {
+ compDay = sdf.format(date);
+ String today = sdf.format(new Date());
+ if (compDay.equals(today)) {
+ ret = true;
+ }
+ } catch (Exception e) {
+ logger.error("日期比较失败", e);
+ }
+ return ret;
+ }
+
+ /**
+ * 大于当天 true 否则 false
+ *
+ * @param str
+ * 日期
+ * @param
+ * @return
+ */
+ public static boolean compareToday(String str) {
+ boolean ret = false;
+ if (str == null || str.length() == 0) {
+ return ret;
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+ String strdate = sdf.format(new Date());
+ try {
+ if (strdate.compareTo(str) <= 0) {
+ return true;
+ } else {
+ return false;
+ }
+
+ } catch (Exception e) {
+ logger.error("日期比较失败", e);
+
+ }
+ return ret;
+ }
+
+ /**
+ * 给定时间在某一时间范围内
+ *
+ * @param start
+ * 日期格式为 yyyy-MM-dd
+ * @param end
+ * 日期格式为 yyyy-MM-dd
+ * @param appoint
+ * 日期格式为 yyyy-MM-dd
+ * @return
+ */
+ public static boolean compareBetweenAnd(String start, String end, String appoint) {
+ boolean ret = false;
+ if ((start == null || start.length() == 0) || (end == null || end.length() == 0)) {
+ return ret;
+ }
+ try {
+ if ((appoint.compareTo(start) >= 0) && (appoint.compareTo(end) <= 0)) {
+ return true;
+ } else {
+ return false;
+ }
+
+ } catch (Exception e) {
+ logger.error("日期比较失败", e);
+
+ }
+ return ret;
+ }
+
+ /**
+ * 给定时间在某一时间范围内不含等号
+ *
+ * @param start
+ * 日期格式为 yyyy-MM-dd
+ * @param end
+ * 日期格式为 yyyy-MM-dd
+ * @param appoint
+ * 日期格式为 yyyy-MM-dd
+ * @return
+ */
+ public static boolean compareBetweenAndNOT(String start, String end, String appoint) {
+ boolean ret = false;
+ if ((start == null || start.length() == 0) || (end == null || end.length() == 0)) {
+ return ret;
+ }
+ try {
+ if ((appoint.compareTo(start) < 0) || (appoint.compareTo(end) > 0)) {
+ return true;
+ } else {
+ return false;
+ }
+
+ } catch (Exception e) {
+ logger.error("日期比较失败", e);
+
+ }
+ return ret;
+ }
+
+ // 获取当天的开始时间
+ public static Date getDayBegin() {
+ Calendar cal = new GregorianCalendar();
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal.getTime();
+ }
+
+ // 获取当天的结束时间
+ public static Date getDayEnd() {
+ Calendar cal = new GregorianCalendar();
+ cal.set(Calendar.HOUR_OF_DAY, 23);
+ cal.set(Calendar.MINUTE, 59);
+ cal.set(Calendar.SECOND, 59);
+ return cal.getTime();
+ }
+
+ // 获取昨天的开始时间
+ public static Date getBeginDayOfYesterday() {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(getDayBegin());
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ return cal.getTime();
+ }
+
+ // 获取昨天的结束时间
+ public static Date getEndDayOfYesterDay() {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(getDayEnd());
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ return cal.getTime();
+ }
+
+ // 获取明天的开始时间
+ public static Date getBeginDayOfTomorrow() {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(getDayBegin());
+ cal.add(Calendar.DAY_OF_MONTH, 1);
+
+ return cal.getTime();
+ }
+
+ // 获取明天的结束时间
+ public static Date getEndDayOfTomorrow() {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(getDayEnd());
+ cal.add(Calendar.DAY_OF_MONTH, 1);
+ return cal.getTime();
+ }
+
+ // 获取本周的开始时间
+ public static Date getBeginDayOfWeek() {
+ Date date = new Date();
+ if (date == null) {
+ return null;
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
+ if (dayofweek == 1) {
+ dayofweek += 7;
+ }
+ cal.add(Calendar.DATE, 2 - dayofweek);
+ return getDayStartTime(cal.getTime());
+ }
+
+ // 获取本周的结束时间
+ public static Date getEndDayOfWeek() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(getBeginDayOfWeek());
+ cal.add(Calendar.DAY_OF_WEEK, 6);
+ Date weekEndSta = cal.getTime();
+ return getDayEndTime(weekEndSta);
+ }
+
+ // 获取本月的开始时间
+ public static Date getBeginDayOfMonth() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(getNowYear(), getNowMonth() - 1, 1);
+ return getDayStartTime(calendar.getTime());
+ }
+
+ // 指定月的开始时间
+ public static Date getBeginDayOfMonth(int year, int month) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(year, month - 1, 1);
+ return getDayStartTime(calendar.getTime());
+ }
+
+ // 获取本月的开始时间
+ public static String getBeginDayOfMonthStr() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(getNowYear(), getNowMonth() - 1, 1);
+
+ return Date2String(getDayStartTime(calendar.getTime()), "yyyy-MM-dd") + " 00:00:00";
+ }
+
+ // 获取本月的结束时间
+ public static String getEndDayOfMonth() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(getNowYear(), getNowMonth() - 1, 1);
+ int day = calendar.getActualMaximum(5);
+ calendar.set(getNowYear(), getNowMonth() - 1, day);
+
+ return Date2String(getDayEndTime(calendar.getTime()), "yyyy-MM-dd") + " 00:00:00";
+ }
+
+ // 获取本月的结束时间
+ public static Date getEndDayOfMonthStr() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(getNowYear(), getNowMonth() - 1, 1);
+ int day = calendar.getActualMaximum(5);
+ calendar.set(getNowYear(), getNowMonth() - 1, day);
+ return getDayEndTime(calendar.getTime());
+ }
+
+ // 指定月的结束时间
+ public static Date getEndDayOfMonth(int year, int month) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(year, month - 1, 1);
+ int day = calendar.getActualMaximum(5);
+ calendar.set(year, month - 1, day);
+ return getDayEndTime(calendar.getTime());
+ }
+
+ // 获取本年的开始时间
+ public static Date getBeginDayOfYear() {
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, getNowYear());
+ // cal.set
+ cal.set(Calendar.MONTH, Calendar.JANUARY);
+ cal.set(Calendar.DATE, 1);
+
+ return getDayStartTime(cal.getTime());
+ }
+
+ // 获取本年的结束时间
+ public static Date getEndDayOfYear() {
+ Calendar cal = Calendar.getInstance();
+ cal.set(Calendar.YEAR, getNowYear());
+ cal.set(Calendar.MONTH, Calendar.DECEMBER);
+ cal.set(Calendar.DATE, 31);
+ return getDayEndTime(cal.getTime());
+ }
+
+ // 获取某个日期的开始时间
+ public static Timestamp getDayStartTime(Date d) {
+ Calendar calendar = Calendar.getInstance();
+ if (null != d) {
+ calendar.setTime(d);
+ }
+ calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0,
+ 0, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ return new Timestamp(calendar.getTimeInMillis());
+ }
+
+ // 获取某个日期的结束时间
+ public static Timestamp getDayEndTime(Date d) {
+ Calendar calendar = Calendar.getInstance();
+ if (null != d) {
+ calendar.setTime(d);
+ }
+ calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 23,
+ 59, 59);
+ calendar.set(Calendar.MILLISECOND, 999);
+ return new Timestamp(calendar.getTimeInMillis());
+ }
+
+ // 获取今年是哪一年
+ public static Integer getNowYear() {
+ Date date = new Date();
+ GregorianCalendar gc = (GregorianCalendar)Calendar.getInstance();
+ gc.setTime(date);
+ return Integer.valueOf(gc.get(1));
+ }
+
+ // 获取本月是哪一月
+ public static int getNowMonth() {
+ Date date = new Date();
+ GregorianCalendar gc = (GregorianCalendar)Calendar.getInstance();
+ gc.setTime(date);
+ return gc.get(2) + 1;
+ }
+
+ // 两个日期相减得到的天数
+ public static int getDiffDays(Date beginDate, Date endDate) {
+
+ if (beginDate == null || endDate == null) {
+ throw new IllegalArgumentException("getDiffDays param is null!");
+ }
+
+ long diff = (endDate.getTime() - beginDate.getTime()) / (1000 * 60 * 60 * 24);
+
+ int days = new Long(diff).intValue();
+
+ return days + 1;
+ }
+
+ // 两个日期相减得到的毫秒数
+ public static long dateDiff(Date beginDate, Date endDate) {
+ long date1ms = beginDate.getTime();
+ long date2ms = endDate.getTime();
+ return date2ms - date1ms;
+ }
+
+ // 获取两个日期中的最大日期
+ public static Date max(Date beginDate, Date endDate) {
+ if (beginDate == null) {
+ return endDate;
+ }
+ if (endDate == null) {
+ return beginDate;
+ }
+ if (beginDate.after(endDate)) {
+ return beginDate;
+ }
+ return endDate;
+ }
+
+ // 获取两个日期中的最小日期
+ public static Date min(Date beginDate, Date endDate) {
+ if (beginDate == null) {
+ return endDate;
+ }
+ if (endDate == null) {
+ return beginDate;
+ }
+ if (beginDate.after(endDate)) {
+ return endDate;
+ }
+ return beginDate;
+ }
+
+ // 返回某月该季度的第一个月
+ public static Date getFirstSeasonDate(Date date) {
+ final int[] SEASON = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ int sean = SEASON[cal.get(Calendar.MONTH)];
+ cal.set(Calendar.MONTH, sean * 3 - 3);
+ return cal.getTime();
+ }
+
+ // 返回某个日期下几天的日期
+ public static Date getNextDay(Date date, int i) {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(date);
+ cal.set(Calendar.DATE, cal.get(Calendar.DATE) + i);
+ return cal.getTime();
+ }
+
+ // 返回某个日期前几天的日期
+ public static Date getFrontDay(Date date, int i) {
+ Calendar cal = new GregorianCalendar();
+ cal.setTime(date);
+ cal.set(Calendar.DATE, cal.get(Calendar.DATE) - i);
+ return cal.getTime();
+ }
+
+ // 获取某年某月到某年某月按天的切片日期集合(间隔天数的集合)
+ public static List getTimeList(int beginYear, int beginMonth, int endYear, int endMonth, int k) {
+ List list = new ArrayList();
+ if (beginYear == endYear) {
+ for (int j = beginMonth; j <= endMonth; j++) {
+ list.add(getTimeList(beginYear, j, k));
+
+ }
+ } else {
+ {
+ for (int j = beginMonth; j < 12; j++) {
+ list.add(getTimeList(beginYear, j, k));
+ }
+
+ for (int i = beginYear + 1; i < endYear; i++) {
+ for (int j = 0; j < 12; j++) {
+ list.add(getTimeList(i, j, k));
+ }
+ }
+ for (int j = 0; j <= endMonth; j++) {
+ list.add(getTimeList(endYear, j, k));
+ }
+ }
+ }
+ return list;
+ }
+
+ // 获取某年某月按天切片日期集合(某个月间隔多少天的日期集合)
+ public static List getTimeList(int beginYear, int beginMonth, int k) {
+ List list = new ArrayList();
+ Calendar begincal = new GregorianCalendar(beginYear, beginMonth, 1);
+ int max = begincal.getActualMaximum(Calendar.DATE);
+ for (int i = 1; i < max; i = i + k) {
+ list.add(begincal.getTime());
+ begincal.add(Calendar.DATE, k);
+ }
+ begincal = new GregorianCalendar(beginYear, beginMonth, max);
+ list.add(begincal.getTime());
+ return list;
+ }
+
+ public static String UTCToCST(String UTCStr, String format) {
+ try {
+ if (UTCStr.length() == 19) {
+ return UTCStr;
+ } else {
+ return UTCStr.substring(0, 19);
+ }
+ // if(format==null){
+ // if(UTCStr.length()==19){
+ // format = "yyyy-MM-dd'T'HH:mm:ss";
+ // }else{
+ //
+ // format = "yyyy-MM-dd'T'HH:mm:ss.SSS";
+ // }
+ // }
+ //
+ // Date date = null;
+ // SimpleDateFormat sdf = new SimpleDateFormat(format);
+ // date = sdf.parse(UTCStr);
+ //// System.out.println("UTC时间: " + date);
+ // Calendar calendar = Calendar.getInstance(); calendar.setTime(date);
+ // calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8); //calendar.getTime()
+ // 返回的是Date类型,也可以使用calendar.getTimeInMillis()获取时间戳
+ //// System.out.println("北京时间: " + calendar.getTime());
+ //
+ // SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ // String strdate = sdf1.format(calendar.getTime());
+ //
+ // return strdate;
+ } catch (Exception e) {
+ return UTCStr;
+ }
+ }
+
+ // 获取当前时间1-5秒统一归位1秒
+ public static Date getCurrentTimeFormate() {
+
+ Date d = new Date();
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ int second = now.get(Calendar.SECOND);
+ int sechigh = second / 10;
+ int sec = second % 10;
+ // System.out.println(second);
+ if (sec < 5) {
+ sec = sechigh * 10;
+ } else {
+ sec = sechigh * 10 + 5;
+ }
+ now.set(Calendar.SECOND, sec);
+ // logger.error("--------当前时间,计算时间-------{}---{}---------{}",second,sec,now.getTime());
+ return now.getTime();
+ }
+
+ // 获取当前时间1-5秒统一归位1秒
+ public static long getCurrentTimeLong() {
+
+ Date d = new Date();
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ int second = now.get(Calendar.SECOND);
+ int sechigh = second / 10;
+ int sec = second % 10;
+ // System.out.println(second);
+ if (sec < 5) {
+ sec = sechigh * 10;
+ } else {
+ sec = sechigh * 10 + 5;
+ }
+ now.set(Calendar.SECOND, sec);
+
+ // System.out.println("+++++"+now.getTime());
+ String time = now.getTime().getTime() + "";
+ String rettime = time.substring(0, 10) + "000";
+ // logger.error("--------当前时间,计算时间-------{}---{}---------{},{}",second,sec,now.getTime(),rettime);
+ return Long.valueOf(rettime);
+ }
+
+ // 获取当前时间1-5秒统一归位1秒
+ public static long getCurrentTimeLong(String date) {
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ Date d = sdf.parse(date);
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ int second = now.get(Calendar.SECOND);
+ int sechigh = second / 10;
+ int sec = second % 10;
+ if (sec < 5) {
+ sec = sechigh * 10;
+ } else {
+ sec = sechigh * 10 + 5;
+ }
+ now.set(Calendar.SECOND, sec);
+ String time = now.getTime().getTime() + "";
+ String rettime = time.substring(0, 10) + "000";
+
+ return Long.valueOf(rettime);
+ } catch (Exception e) {
+ logger.error("{}", e);
+ }
+
+ return 0;
+
+ }
+
+ public static void main(String[] args) throws ParseException {
+//
+// System.currentTimeMillis();
+// System.out.println(getCurrentTimeFormate().getTime());
+// System.out.println(getCurrentTimeLong());
+
+ System.out.println(getExpireByTtl("D",1,new Date()).getTime());
+
+ // System.out.println(formatShopTime2String("2024-12-12"));
+ //
+ // System.out.println(getDateBeforeSecond( 7));
+ // System.out.println(Date2String8().compareTo("20241109"));
+ // System.out.println(monthBeforeToString(new Date(),3));
+ // System.out.println(dayBefore(string2Date("2018-03-01", "yyyy-MM-dd"), 90, null));
+ // List local = getBetweenDates("2018-03-01", "2018-04-22","yyyy-MM-dd", true);
+ // System.out.println(local.get(0).toString());
+ // System.out.println(daysBetweenDates(string2Date("2024-07-04 11:20:20","yyyy-MM-dd
+ // HH:mm:ss"),string2Date("2024-06-30 12:30:40","yyyy-MM-dd HH:mm:ss")));
+
+ // System.out.println(getDateBeforeTimeMillis(365));
+ // System.out.println(getDateBeforeTimeMillis(0));
+ // System.out.println(getDateBefore(0));
+ // System.out.println(System.currentTimeMillis());
+
+ }
+
+ /**
+ * 返回指定格式时间
+ *
+ * @param strY
+ * 原来时间字符串
+ * @param strYGS
+ * 原时间格式
+ * @return
+ */
+ public static String string2String(String strY, String strYGS, String strMGS) {
+ SimpleDateFormat s = new SimpleDateFormat(strYGS);
+ String date = strY;
+ String dat = "";
+ Date d;
+ try {
+ d = s.parse(date);
+ SimpleDateFormat ss = new SimpleDateFormat(strMGS);
+ dat = ss.format(d);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ dat = "时间格式有误!";
+ e.printStackTrace();
+ }
+ return dat;
+ }
+
+ /**
+ * 返回时分秒
+ *
+ * @param strY
+ * 原来时间字符串
+ * @return
+ */
+ public static String string2StringSecond(String strY) {
+
+ String date = strY;
+ if (date == null || date.length() != 6) {
+ return date;
+ }
+ String HH = strY.substring(0, 2);
+ String mm = strY.substring(2, 4);
+ String ss = strY.substring(4, 6);
+ date = HH + ":" + mm + ":" + ss;
+ return date;
+ }
+
+ /**
+ * getTodayBeginTime
+ *
+ * @return 当日开始时间
+ */
+ public static Date getTodayBeginTime() {
+ Calendar c1 = new GregorianCalendar();
+ c1.set(Calendar.HOUR_OF_DAY, 0);
+ c1.set(Calendar.MINUTE, 0);
+ c1.set(Calendar.SECOND, 0);
+ return c1.getTime();
+ }
+
+ /**
+ * getTodayEndTime
+ *
+ * @return 当日开始时间
+ */
+ public static Date getTodayEndTime() {
+ Calendar c1 = new GregorianCalendar();
+ c1.set(Calendar.HOUR_OF_DAY, 23);
+ c1.set(Calendar.MINUTE, 59);
+ c1.set(Calendar.SECOND, 59);
+ return c1.getTime();
+ }
+
+ /**
+ * 得到两个日期之间相差的天数
+ *
+ * @param newDate
+ * 大的日期
+ * @param oldDate
+ * 小的日期
+ * @return newDate-oldDate相差的天数
+ */
+ public static int daysBetweenDates(Date newDate, Date oldDate) {
+ int days = 0;
+ Calendar calo = Calendar.getInstance();
+ Calendar caln = Calendar.getInstance();
+ calo.setTime(oldDate);
+ caln.setTime(newDate);
+ int oday = calo.get(Calendar.DAY_OF_YEAR);
+ int nyear = caln.get(Calendar.YEAR);
+ int oyear = calo.get(Calendar.YEAR);
+ while (nyear > oyear) {
+ calo.set(Calendar.MONTH, 11);
+ calo.set(Calendar.DATE, 31);
+ days = days + calo.get(Calendar.DAY_OF_YEAR);
+ oyear = oyear + 1;
+ calo.set(Calendar.YEAR, oyear);
+ }
+ int nday = caln.get(Calendar.DAY_OF_YEAR);
+ days = days + nday - oday;
+
+ return days;
+ }
+
+ public static String getPerDateDay(int n, String date, String model) {
+ // n为推迟的天数 -1表示前一天,1后移一天
+ SimpleDateFormat f = new SimpleDateFormat(model);
+ Calendar c = Calendar.getInstance();
+ try {
+ c.setTime(f.parse(date));
+ } catch (ParseException e) {
+ System.out.println(e);
+ }
+
+ c.add(Calendar.DATE, n);
+ String day = f.format(c.getTime());
+ return day;
+ }
+
+ /**
+ * 传递一个数据返回精准的yyyy/mm/dd hh:mm:ss
+ *
+ * @param dateStr
+ * @return
+ */
+ public static String formatDate2String(String dateStr) {
+ String str = "";
+ if (dateStr != null && dateStr.length() == 14) {
+ String y = dateStr.substring(0, 4);
+ String m = dateStr.substring(4, 6);
+ String d = dateStr.substring(6, 8);
+ String h = dateStr.substring(8, 10);
+ String fen = dateStr.substring(10, 12);
+ String sec = dateStr.substring(12, 14);
+ str = y + "/" + m + "/" + d + " " + h + ":" + fen + ":" + sec;
+ return str;
+ } else {
+ return dateStr;
+ }
+ }
+
+ /**
+ * 传递一个数据返回精准的yyyy-mm-dd 转换成 yyyy年mm月dd日
+ *
+ * @param dateStr
+ * @return
+ */
+ public static String formatShopTime2String(String dateStr) {
+ String str = "";
+ if (dateStr != null && dateStr.length() == 10) {
+ String y = dateStr.substring(0, 4);
+ String m = dateStr.substring(5, 7);
+ String d = dateStr.substring(8, 10);
+ str = y + "年" + m + "月" + d + "日";
+ return str;
+ } else {
+ return dateStr;
+ }
+ }
+
+ /**
+ * 计算几个月前时间
+ *
+ * @param month
+ * @return
+ */
+ public static Date monthBefore(int month) {
+ Date dNow = new Date(); // 当前时间
+ Date dBefore = new Date();
+ Calendar calendar = Calendar.getInstance(); // 得到日历
+ calendar.setTime(dNow);// 把当前时间赋给日历
+ calendar.add(calendar.MONTH, -month); // 设置为前3月
+ dBefore = calendar.getTime(); // 得到前3月的时间
+ // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置时间格式
+ // String defaultStartDate = sdf.format(dBefore); //格式化前3月的时间
+ // System.out.println("前"+month+"个月的时间是:" + defaultStartDate);
+ return dBefore;
+ }
+
+ /**
+ * 计算指定日期几个月前时间
+ *
+ * @param month
+ * @return
+ */
+ public static Date monthBefore(Date date, int month) {
+ Calendar calendar = Calendar.getInstance(); // 得到日历
+ calendar.setTime(date);// 把当前时间赋给日历
+ calendar.add(calendar.MONTH, -month); // 设置为前3月
+ Date dBefore = calendar.getTime(); // 得到前3月的时间
+ return dBefore;
+ }
+
+ /**
+ * 计算几天前时间
+ *
+ * @param day
+ * @return
+ */
+ public static Date dayBefore(int day) {
+ Date dNow = new Date(); // 当前时间
+ Date dBefore = new Date();
+ Calendar calendar = Calendar.getInstance(); // 得到日历
+ calendar.setTime(dNow);// 把当前时间赋给日历
+ calendar.add(calendar.DATE, -day); // 设置为前3月
+ calendar.set(Calendar.HOUR_OF_DAY, 00);
+ calendar.set(Calendar.MINUTE, 00);
+ calendar.set(Calendar.SECOND, 00);
+ dBefore = calendar.getTime(); // 得到前3月的时间
+ // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置时间格式
+ // String defaultStartDate = sdf.format(dBefore); //格式化前3月的时间
+ // System.out.println("前"+month+"个月的时间是:" + defaultStartDate);
+ return dBefore;
+ }
+
+ // 获取几天前开始时间
+ public static String getDateBefore(int day) {
+ Date d = new Date();
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
+ now.set(Calendar.HOUR_OF_DAY, 0);
+ now.set(Calendar.MINUTE, 0);
+ now.set(Calendar.SECOND, 0);
+ now.set(Calendar.MILLISECOND, 0);
+ // System.out.println(now.getTime());
+ return Date2String(now.getTime(), "yyyy-MM-dd HH:mm:ss");
+ }
+
+ // //获取几天前开始时间
+ public static long getDateBeforeTimeMillis(int day) {
+ Date d = new Date();
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
+ now.set(Calendar.HOUR_OF_DAY, 0);
+ now.set(Calendar.MINUTE, 0);
+ now.set(Calendar.SECOND, 0);
+ now.set(Calendar.MILLISECOND, 0);
+ return now.getTimeInMillis();
+ }
+
+ // 获取几天前结束时间
+ public static String getEndDateBefore(int day) {
+
+ Date d = new Date();
+ Calendar now = Calendar.getInstance();
+ now.setTime(d);
+ now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
+ now.set(Calendar.HOUR_OF_DAY, 23);
+ now.set(Calendar.MINUTE, 59);
+ now.set(Calendar.SECOND, 59);
+ return Date2String(now.getTime(), "yyyy-MM-dd HH:mm:ss");
+ }
+
+ public static List getMonthBetween(String minDate, String maxDate) throws ParseException {
+ ArrayList result = new ArrayList();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");// 格式化为年月
+
+ Calendar min = Calendar.getInstance();
+ Calendar max = Calendar.getInstance();
+
+ min.setTime(sdf.parse(minDate));
+ min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1);
+
+ max.setTime(sdf.parse(maxDate));
+ max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2);
+
+ Calendar curr = min;
+ while (curr.before(max)) {
+ result.add(sdf.format(curr.getTime()));
+ curr.add(Calendar.MONTH, 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * 获取两个日期之间的日期
+ *
+ * @param beginDate
+ * @param endDate
+ * @return
+ */
+ public static List getBetweenDates(String beginDate, String endDate, String fmt, boolean isChoose) {
+ List result = new ArrayList();
+ DateTimeFormatter formatter = null;
+ if (Strings.isNullOrEmpty(fmt)) {
+ formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ } else {
+ formatter = DateTimeFormatter.ofPattern(fmt);
+ }
+ LocalDate startTime = LocalDate.parse(beginDate, formatter);
+ if (!isChoose) {
+ startTime = startTime.plusDays(1);
+ }
+ LocalDate endTime = LocalDate.parse(endDate, formatter);
+ while (startTime.isBefore(endTime)) {
+ result.add(startTime);
+ startTime = startTime.plusDays(1);
+ }
+ if (isChoose) {
+ result.add(endTime);
+ }
+ return result;
+ }
+
+ /**
+ * 返回当前系统时间 yyyy-MM-dd HH:mm:ss
+ *
+ * @return
+ */
+ public static String getCurrentDate(String model) {
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ String strdate = sdf.format(new Date());
+ return strdate;
+ }
+
+ /**
+ * 计算到第二天凌晨0点之后点一个随机值,为了防止大面值key失效导致点服务器压力,使其在10分钟之内均匀失效
+ *
+ * @return
+ */
+ public static Long getSecondsNextEarlyMorning() {
+ int ranmin = new Random().nextInt(10);
+ int ransec = new Random().nextInt(59);
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.DAY_OF_YEAR, 1);
+ // 改成这样就好了
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ cal.set(Calendar.SECOND, ransec);
+ cal.set(Calendar.MINUTE, ranmin);
+ cal.set(Calendar.MILLISECOND, 0);
+ return (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000;
+ }
+
+
+ /**
+ * 格式为时间单位+正整数。支持年(Y)、月(M)、日(D)、时(H)、分(m)、秒(S)时间单位。 例如Y1(1年),M2(2个月),D3(3天),H4(4小时),m5(5分钟),S6(6秒)。不支持两个单位同时使用。
+ * 如果ttl为空,则默认为一个月。
+ *
+ * @param ttlTimeUnit
+ * @param ttlTime
+ * @param now
+ * @return
+ */
+ public static Date getExpireByTtl(String ttlTimeUnit, int ttlTime, Date now) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(now);
+ switch (ttlTimeUnit) {
+ case "Y":
+ calendar.add(Calendar.YEAR, ttlTime);
+ break;
+ case "M":
+ calendar.add(Calendar.MONTH, ttlTime);
+ break;
+ case "D":
+ calendar.add(Calendar.DATE, ttlTime);
+ break;
+ case "H":
+ calendar.add(Calendar.HOUR, ttlTime);
+ break;
+ case "m":
+ calendar.add(Calendar.MINUTE, ttlTime);
+ break;
+ case "S":
+ calendar.add(calendar.SECOND, ttlTime);
+ break;
+ }
+ return calendar.getTime();
+ }
+ /**
+ * 获取当前天开始时间
+ * @return
+ */
+ public static String getStartOfToday() {
+ LocalDateTime now = LocalDateTime.now(); // 获取当前时间
+ LocalDateTime startOfToday = now.withHour(0).withMinute(0).withSecond(0); // 设置时分秒为0
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 定义日期时间格式
+ String startOfTodayStr = startOfToday.format(formatter); // 格式化为字符串
+ return startOfTodayStr;
+ }
+
+ /**
+ * 返回当前小时前一个小时的时间
+ * @return
+ */
+ public static String getBefore1Hour() {
+
+ // 获取当前时间
+ LocalDateTime currentTime = LocalDateTime.now();
+
+ // 减去一小时
+ LocalDateTime previousHour = currentTime.minusHours(1);
+
+ // 格式化为字符串
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ String formattedDateTime = previousHour.format(formatter);
+
+ return formattedDateTime;
+ }
+
+ /**
+ * 返回当前系统时间 yyyy-MM-dd HH:mm:ss
+ *
+ * @return
+ */
+ // public static String getDateBefore(int n) {
+ // Calendar calendar = Calendar.getInstance();
+ // Date date = new Date(System.currentTimeMillis());
+ // calendar.setTime(date);
+ //// calendar.add(Calendar.WEEK_OF_YEAR, -1);
+ // calendar.add(Calendar.YEAR, n);
+ // date = calendar.getTime();
+ // System.out.println(date);
+ // return tt;
+ // }
+
+ // 获取当前时刻timestamp
+
+ /**
+ *
+ * @param model
+ * @return
+ */
+ public static String getTimestamp( String model) {
+ String timestamp = "";
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ timestamp = sdf.format(new Date());
+ return timestamp;
+ }
+}
diff --git a/car-common/src/main/java/com/weiqi/mis/DateUtils.java b/car-common/src/main/java/com/weiqi/mis/DateUtils.java
new file mode 100644
index 0000000..dba325e
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/DateUtils.java
@@ -0,0 +1,1271 @@
+package com.weiqi.mis;
+
+import com.google.common.base.Preconditions;
+import org.javatuples.Pair;
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
+
+ public final static int TIME_DAY_MILLISECOND = 86400000;
+
+ public final static int TIME_HOUR_MILLISECOND = 1000 * 60 * 60 * 1;
+
+ public final static int TIME_SECONDS_MILLISECOND = 1000;
+
+ // /
+ // 定义时间日期显示格式
+ // /
+ public final static String DATE_FORMAT = "yyyy-MM-dd";
+
+ public final static String DATE_FORMAT_MINUTE = "yyyy-MM-dd HH:mm";
+
+ public final static String DATE_FORMAT_HOUR = "yyyy-MM-dd HH";
+
+ public final static String DATE_FORMAT_CN = "yyyy年MM月dd日";
+
+ public final static String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+ public final static String TIME_FORMAT_SPACE = "yyyy MM dd HH:mm:ss";
+
+ public final static String TIME_FORMAT_CN = "yyyy年MM月dd日 HH:mm:ss";
+
+ public final static String MONTH_FORMAT = "yyyy-MM";
+
+ public final static String DAY_FORMAT = "yyyyMMdd";
+
+ public final static String TIME_FORMAT_NUM = "MMddHHmmss";
+
+ public final static String TIME_FORMAT_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
+
+ public final static String TIME_FORMAT_HHMMSS = "HH:mm:ss";
+
+
+ public final static String TIME_FORMAT_DATE_BANK = "MMyy";
+
+ private static final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(TIME_FORMAT);
+
+ private static final DateTimeFormatter shortDateTimeFormatter = DateTimeFormat.forPattern(TIME_FORMAT);
+
+ private static final DateTimeFormatter bankDateTimeFormatter = DateTimeFormat.forPattern(TIME_FORMAT_DATE_BANK);
+
+
+ public static String toStringOfBank(Date date) {
+ DateTime dateTime = new DateTime(date);
+ return bankDateTimeFormatter.print(dateTime);
+ }
+
+ public static String getYesterdayMonthFirstDayWithHMS() {
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_YEAR, -1);
+ calendar.set(Calendar.DAY_OF_MONTH, calendar
+ .getActualMinimum(Calendar.DAY_OF_MONTH));
+
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+
+ return format.format(calendar.getTime());
+ }
+
+
+ /**
+ * 判断昨天所在的月的第一天是
+ *
+ * @return
+ */
+ public static String getyesterDayMonthFirstDay() {
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_YEAR, -1);
+ calendar.set(Calendar.DAY_OF_MONTH, calendar
+ .getActualMinimum(Calendar.DAY_OF_MONTH));
+
+
+ return format.format(calendar.getTime());
+ }
+
+
+ public static Date getyesterDayMonthFirstDayDate() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_YEAR, -1);
+ calendar.set(Calendar.DAY_OF_MONTH, calendar
+ .getActualMinimum(Calendar.DAY_OF_MONTH));
+
+ return calendar.getTime();
+ }
+
+
+ /**
+ * 取得当前系统时间,返回java.util.Date类型
+ *
+ * @return java.util.Date 返回服务器当前系统时间
+ * @see Date
+ */
+ public static Date getCurrDate() {
+ return new Date();
+ }
+
+ /**
+ * 取得明天的开始时间,返回java.util.Date类型
+ *
+ * @return java.util.Date
+ * @see Date
+ */
+ public static Date getTomorrowBeginDate() {
+ Date date = new Date();
+ SimpleDateFormat sf = new SimpleDateFormat(DAY_FORMAT);
+ String nowDate = sf.format(date);
+ Calendar cal = Calendar.getInstance();
+ try {
+ cal.setTime(sf.parse(nowDate));
+ cal.add(Calendar.DAY_OF_YEAR, +1);
+ return cal.getTime();
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 取得今天的剩余秒数,返回剩余秒数
+ *
+ * @return int
+ */
+ public static int getCurrDateSurplusSeconds() {
+ Date currDate = getCurrDate();
+ Date tomorrowDate = getTomorrowBeginDate();
+ return getSecondsBetweenDates(currDate, tomorrowDate);
+ }
+
+
+ /**
+ * 取得当前系统时间戳
+ *
+ * @return java.sql.Timestamp 系统时间戳
+ * @see java.sql.Timestamp
+ */
+ public static java.sql.Timestamp getCurrTimestamp() {
+ return new java.sql.Timestamp(System.currentTimeMillis());
+ }
+
+ /**
+ * 返回当前时间是上午还是下午
+ *
+ * @return
+ */
+ public static Integer getCurrDateAMorPM() {
+ Calendar calendar = Calendar.getInstance();
+ return calendar.get(Calendar.AM_PM);
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy-MM-dd,如2009-10-15
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的日期,默认格式为为yyyy-MM-dd,如2009-10-15
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFormatDate(Date currDate) {
+ return getFormatDate(currDate, DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy-MM-dd,如2009-10-15
+ *
+ * @param currDate 要格式化的日期
+ * @return Date 返回格式化后的日期,默认格式为为yyyy-MM-dd,如2009-10-15
+ * @see #getFormatDate(Date)
+ */
+ public static Date getFormatDateToDate(Date currDate) {
+ return getFormatDate(getFormatDate(currDate));
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy年MM月dd日,如2009年02月15日
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的日期,默认格式为yyyy年MM月dd日,如2009年02月15日
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFormatDate_CN(Date currDate) {
+ return getFormatDate(currDate, DATE_FORMAT_CN);
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy年MM月dd日,如2009年02月15日
+ *
+ * @param currDate 要格式化的日期
+ * @return Date 返回格式化后的日期,默认格式为yyyy年MM月dd日,如2009年02月15日
+ * @see #getFormatDate_CN(String)
+ */
+ public static Date getFormatDateToDate_CN(Date currDate) {
+ return getFormatDate_CN(getFormatDate_CN(currDate));
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy-MM-dd,如2009-10-15
+ *
+ * @param currDate 要格式化的日期
+ * @return Date 返回格式化后的日期,默认格式为yyyy-MM-dd,如2009-10-15
+ * @see #getFormatDate(String, String)
+ */
+ public static Date getFormatDate(String currDate) {
+ return getFormatDate(currDate, DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的日期,格式为yyyy年MM月dd日,如2009年02月15日
+ *
+ * @param currDate 要格式化的日期
+ * @return 返回格式化后的日期,默认格式为yyyy年MM月dd日,如2009年02月15日
+ * @see #getFormatDate(String, String)
+ */
+ public static Date getFormatDate_CN(String currDate) {
+ return getFormatDate(currDate, DATE_FORMAT_CN);
+ }
+
+ /**
+ * 根据格式得到格式化后的日期
+ *
+ * @param currDate 要格式化的日期
+ * @param format 日期格式,如yyyy-MM-dd
+ * @return String 返回格式化后的日期,格式由参数format
+ * 定义,如yyyy-MM-dd,如2009-10-15
+ * @see SimpleDateFormat#format(Date)
+ */
+ public static String getFormatDate(Date currDate, String format) {
+ SimpleDateFormat dtFormatdB = null;
+ try {
+ dtFormatdB = new SimpleDateFormat(format);
+ return dtFormatdB.format(currDate);
+ } catch (Exception e) {
+ dtFormatdB = new SimpleDateFormat(DATE_FORMAT);
+ try {
+ return dtFormatdB.format(currDate);
+ } catch (Exception ex) {
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 得到格式化后的时间,格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ *
+ * @param currDate 要格式化的时间
+ * @return String 返回格式化后的时间,默认格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ * @see #getFormatDateTime(Date, String)
+ */
+ public static String getFormatDateTime(Date currDate) {
+ return getFormatDateTime(currDate, TIME_FORMAT);
+ }
+
+ public static String getNowFormatDateTime() {
+ return getFormatDateTime(new Date(), TIME_FORMAT);
+ }
+ /**
+ * 得到格式化后的时间,格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ *
+ * @param currDate 要格式环的时间
+ * @return Date 返回格式化后的时间,默认格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ * @see #getFormatDateTime(String)
+ */
+ public static Date getFormatDateTimeToTime(Date currDate) {
+ return getFormatDateTime(getFormatDateTime(currDate));
+ }
+
+ /**
+ * 得到格式化后的时间,格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ *
+ * @param currDate 要格式化的时间
+ * @return Date 返回格式化后的时间,默认格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ * @see #getFormatDateTime(String, String)
+ */
+ public static Date getFormatDateTime(String currDate) {
+ return getFormatDateTime(currDate, TIME_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的时间,格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ *
+ * @param currDate 要格式化的时间
+ * @return String 返回格式化后的时间,默认格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ * @see #getFormatDateTime(Date, String)
+ */
+ public static String getFormatDateTime_CN(Date currDate) {
+ return getFormatDateTime(currDate, TIME_FORMAT_CN);
+ }
+
+ /**
+ * 得到格式化后的时间,格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ *
+ * @param currDate 要格式化的时间
+ * @return Date 返回格式化后的时间,默认格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ * @see #getFormatDateTime_CN(String)
+ */
+ public static Date getFormatDateTimeToTime_CN(Date currDate) {
+ return getFormatDateTime_CN(getFormatDateTime_CN(currDate));
+ }
+
+ /**
+ * 得到格式化后的时间,格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ *
+ * @param currDate 要格式化的时间
+ * @return Date 返回格式化后的时间,默认格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ * @see #getFormatDateTime(String, String)
+ */
+ public static Date getFormatDateTime_CN(String currDate) {
+ return getFormatDateTime(currDate, TIME_FORMAT_CN);
+ }
+
+ /**
+ * 根据格式得到格式化后的时间
+ *
+ * @param currDate 要格式化的时间
+ * @param format 时间格式,如yyyy-MM-dd HH:mm:ss
+ * @return String 返回格式化后的时间,格式由参数format定义,如yyyy-MM-dd HH:mm:ss
+ * @see SimpleDateFormat#format(Date)
+ */
+ public static String getFormatDateTime(Date currDate, String format) {
+ SimpleDateFormat dtFormatdB = null;
+ try {
+ dtFormatdB = new SimpleDateFormat(format);
+ return dtFormatdB.format(currDate);
+ } catch (Exception e) {
+ dtFormatdB = new SimpleDateFormat(TIME_FORMAT);
+ try {
+ return dtFormatdB.format(currDate);
+ } catch (Exception ex) {
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 根据格式得到格式化后的日期
+ *
+ * @param currDate 要格式化的日期
+ * @param format 日期格式,如yyyy-MM-dd
+ * @return Date 返回格式化后的日期,格式由参数format
+ * 定义,如yyyy-MM-dd,如2009-10-15
+ * @see SimpleDateFormat#parse(String)
+ */
+ public static Date getFormatDate(String currDate, String format) {
+ SimpleDateFormat dtFormatdB = null;
+ try {
+ dtFormatdB = new SimpleDateFormat(format);
+ return dtFormatdB.parse(currDate);
+ } catch (Exception e) {
+ dtFormatdB = new SimpleDateFormat(DATE_FORMAT);
+ try {
+ return dtFormatdB.parse(currDate);
+ } catch (Exception ex) {
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * 根据格式得到格式化后的时间
+ *
+ * @param currDate 要格式化的时间
+ * @param format 时间格式,如yyyy-MM-dd HH:mm:ss
+ * @return Date 返回格式化后的时间,格式由参数format定义,如yyyy-MM-dd HH:mm:ss
+ * @see SimpleDateFormat#parse(String)
+ */
+ public static Date getFormatDateTime(String currDate, String format) {
+ SimpleDateFormat dtFormatdB = null;
+ try {
+ dtFormatdB = new SimpleDateFormat(format);
+ return dtFormatdB.parse(currDate);
+ } catch (Exception e) {
+ dtFormatdB = new SimpleDateFormat(TIME_FORMAT);
+ try {
+ return dtFormatdB.parse(currDate);
+ } catch (Exception ex) {
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param time Seconds 传入参数 秒
+ * @return 返回 格式 hh:mm:ss 秒
+ */
+ public static String getFormatHourAndMinuteTime(long time) {
+ if (time < 60) {
+ return String.valueOf(time);
+ }
+ if (time < 60 * 60) {
+ int seconds = (int) (time % 60L);
+ int minutes = (int) (time / (60L));
+ return String.valueOf(minutes) + ":" + (seconds < 10 ? ("0" + String.valueOf(seconds)) : String.valueOf(seconds));
+ }
+ int seconds = (int) (time % 60L);
+ int minutes = (int) ((time / 60L) % 60L);
+ int hours = (int) (time / (60L * 60L));
+ return hours + ":" + (minutes < 10 ? ("0" + String.valueOf(minutes)) : String.valueOf(minutes)) + ":"
+ + (seconds < 10 ? ("0" + String.valueOf(seconds)) : String.valueOf(seconds));
+ }
+
+ /**
+ * 得到本日的上月时间 如果当日为2007-9-1,那么获得2007-8-1
+ */
+ public static String getDateBeforeMonth() {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MONTH, -1);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到本日的前几个月时间 如果number=2当日为2007-9-1,那么获得2007-7-1
+ */
+ public static String getDateBeforeMonth(int number) {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MONTH, -number);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+
+ /**
+ * 得到本日的前几个月时间 如果number=2当日为2007-9-1,那么获得2007-7-1
+ */
+ public static Date getDateBeforeMonthByNum(int number) {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MONTH, -number);
+ return cal.getTime();
+ }
+
+
+ /**
+ * 获得两个Date型日期之间相差的天数(第2个减第1个)
+ *
+ * @param first
+ * @param second
+ * @return int 相差的天数
+ */
+ public static int getDaysBetweenDates(Date first, Date second) {
+ Date d1 = getFormatDateTime(getFormatDate(first), DATE_FORMAT);
+ Date d2 = getFormatDateTime(getFormatDate(second), DATE_FORMAT);
+
+ Long mils = (d2.getTime() - d1.getTime()) / (TIME_DAY_MILLISECOND);
+
+ return mils.intValue();
+ }
+
+ /**
+ * 获得两个Date型日期之间相差的小时数(第2个减第1个)
+ *
+ * @param first, Date second
+ * @return int 相差的小时数
+ */
+ public static int getHoursBetweenDates(Date first, Date second) {
+
+ Date d1 = getFormatDateTime(getFormatDate(first), DATE_FORMAT);
+ Date d2 = getFormatDateTime(getFormatDate(second), DATE_FORMAT);
+
+ Long mils = (d2.getTime() - d1.getTime()) / (TIME_HOUR_MILLISECOND);
+
+ return mils.intValue();
+
+ }
+
+ public static int getSecondsBetweenDates(Date first, Date second) {
+ Long mils = (second.getTime() - first.getTime()) / (TIME_SECONDS_MILLISECOND);
+ return mils.intValue();
+ }
+
+ /**
+ * 获得两个String型日期之间相差的天数(第2个减第1个)
+ *
+ * @param first, String second
+ * @return int 相差的天数
+ */
+ public static int getDaysBetweenDates(String first, String second) {
+ Date d1 = getFormatDateTime(first, DATE_FORMAT);
+ Date d2 = getFormatDateTime(second, DATE_FORMAT);
+
+ Long mils = (d2.getTime() - d1.getTime()) / (TIME_DAY_MILLISECOND);
+
+ return mils.intValue();
+ }
+
+
+ public static Date getDate(long times) {
+ Date date = new Date(times);
+ return date;
+ }
+
+ /**
+ * @return 获取两个Date之间的天数的列表
+ */
+ public static List getDaysListBetweenDates(Date first, Date second) {
+ List dateList = new ArrayList();
+ Date d1 = getFormatDateTime(getFormatDate(first), DATE_FORMAT);
+ Date d2 = getFormatDateTime(getFormatDate(second), DATE_FORMAT);
+ if (d1.compareTo(d2) > 0) {
+ return dateList;
+ }
+ do {
+ dateList.add(d1);
+ d1 = getDateBeforeOrAfter(d1, 1);
+ } while (d1.compareTo(d2) <= 0);
+ return dateList;
+ }
+
+
+ public static String getDateBeforeDay() {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.DAY_OF_YEAR, -1);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的当前系统日期,格式为yyyy-MM-dd,如2009-10-15
+ *
+ * @return String 返回格式化后的当前服务器系统日期,格式为yyyy-MM-dd,如2009-10-15
+ * @see #getFormatDate(Date)
+ */
+ public static String getCurrDateStr() {
+ return getFormatDate(getCurrDate());
+ }
+
+ public static int getCurrDateHour() {
+ Calendar cal = Calendar.getInstance();
+ return cal.get(Calendar.HOUR_OF_DAY);
+ }
+
+ /**
+ * 得到格式化后的当前系统时间,格式为yyyy-MM-dd HH:mm:ss,如2009-10-15 15:23:45
+ *
+ * @return String 返回格式化后的当前服务器系统时间,格式为yyyy-MM-dd HH:mm:ss,如2009-10-15
+ * 15:23:45
+ * @see #getFormatDateTime(Date)
+ */
+ public static String getCurrDateTimeStr() {
+ return getFormatDateTime(getCurrDate());
+ }
+
+ public static String getCurrDateTimeStr(String format) {
+ return getFormatDate(getCurrDate(), format);
+ }
+
+ /**
+ * 得到格式化后的当前系统日期,格式为yyyy年MM月dd日,如2009年02月15日
+ *
+ * @return String 返回当前服务器系统日期,格式为yyyy年MM月dd日,如2009年02月15日
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getCurrDateStr_CN() {
+ return getFormatDate(getCurrDate(), DATE_FORMAT_CN);
+ }
+
+ /**
+ * 得到格式化后的当前系统时间,格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日 15:23:45
+ *
+ * @return String 返回格式化后的当前服务器系统时间,格式为yyyy年MM月dd日 HH:mm:ss,如2009年02月15日
+ * 15:23:45
+ * @see #getFormatDateTime(Date, String)
+ */
+ public static String getCurrDateTimeStr_CN() {
+ return getFormatDateTime(getCurrDate(), TIME_FORMAT_CN);
+ }
+
+ /**
+ * 得到系统当前日期的前或者后几天
+ *
+ * @param iDate 如果要获得前几天日期,该参数为负数; 如果要获得后几天日期,该参数为正数
+ * @return Date 返回系统当前日期的前或者后几天
+ * @see Calendar#add(int, int)
+ */
+ public static Date getDateBeforeOrAfter(int iDate) {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.DAY_OF_MONTH, iDate);
+ return cal.getTime();
+ }
+
+ /**
+ * 得到日期的前或者后几天
+ *
+ * @param iDate 如果要获得前几天日期,该参数为负数; 如果要获得后几天日期,该参数为正数
+ * @return Date 返回参数curDate定义日期的前或者后几天
+ * @see Calendar#add(int, int)
+ */
+ public static Date getDateBeforeOrAfter(Date curDate, int iDate) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(curDate);
+ cal.add(Calendar.DAY_OF_MONTH, iDate);
+ return cal.getTime();
+ }
+
+ /**
+ * 得到格式化后的月份,格式为yyyy-MM,如2009-02
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的月份,格式为yyyy-MM,如2009-02
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFormatMonth(Date currDate) {
+ return getFormatDate(currDate, MONTH_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的日,格式为yyyyMMdd,如20090210
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的日,格式为yyyyMMdd,如20090210
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFormatDay(Date currDate) {
+ return getFormatDate(currDate, DAY_FORMAT);
+ }
+
+ public static String getFormatTime(Date currDate) {
+ return getFormatDate(currDate, TIME_FORMAT_NUM);
+ }
+
+ public static String getFormatTimeHHmmss(Date currDate) {
+ return getFormatDate(currDate, TIME_FORMAT_HHMMSS);
+ }
+
+ /**
+ * 得到格式化后的当月第一天,格式为yyyy-MM-dd,如2009-10-01
+ *
+ * @return String 返回格式化后的当月第一天,格式为yyyy-MM-dd,如2009-10-01
+ * @see Calendar#getMinimum(int)
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFirstDayOfMonth() {
+ Calendar cal = Calendar.getInstance();
+ int firstDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, firstDay);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的下月第一天,格式为yyyy-MM-dd,如2009-10-01
+ *
+ * 要格式化的日期
+ *
+ * @return String 返回格式化后的下月第一天,格式为yyyy-MM-dd,如2009-10-01
+ * @see Calendar#getMinimum(int)
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFirstDayOfNextMonth() {
+ Calendar cal = Calendar.getInstance();
+ cal.add(Calendar.MONTH, +1);
+ int firstDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, firstDay);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的当月第一天,格式为yyyy-MM-dd,如2009-10-01
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的当月第一天,格式为yyyy-MM-dd,如2009-10-01
+ * @see Calendar#getMinimum(int)
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getFirstDayOfMonth(Date currDate) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(currDate);
+ int firstDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, firstDay);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的当月最后一天,格式为yyyy-MM-dd,如2009-10-28
+ *
+ * @param currDate 要格式化的日期
+ * @return String 返回格式化后的当月最后一天,格式为yyyy-MM-dd,如2009-10-28
+ * @see Calendar#getMinimum(int)
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getLastDayOfMonth(Date currDate) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(currDate);
+ int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, lastDay);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到格式化后的当月最后一天,格式为yyyy-MM-dd,如2009-10-28
+ *
+ * 要格式化的日期
+ *
+ * @return String 返回格式化后的当月最后一天,格式为yyyy-MM-dd,如2009-10-28
+ * @see Calendar#getMinimum(int)
+ * @see #getFormatDate(Date, String)
+ */
+ public static String getLastDayOfMonth() {
+ Calendar cal = Calendar.getInstance();
+ int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+ cal.set(Calendar.DAY_OF_MONTH, lastDay);
+ return getFormatDate(cal.getTime(), DATE_FORMAT);
+ }
+
+ /**
+ * 得到日期的前或者后几小时
+ *
+ * @param iHour 如果要获得前几小时日期,该参数为负数; 如果要获得后几小时日期,该参数为正数
+ * @return Date 返回参数curDate定义日期的前或者后几小时
+ * @see Calendar#add(int, int)
+ */
+ public static Date getDateBeforeOrAfterHours(Date curDate, int iHour) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(curDate);
+ cal.add(Calendar.HOUR_OF_DAY, iHour);
+ return cal.getTime();
+ }
+
+ /**
+ * 得到日期的前或者后几分钟
+ *
+ * @param iMinute 如果要获得前几小时日期,该参数为负数; 如果要获得后几小时日期,该参数为正数
+ * @return Date 返回参数curDate定义日期的前或者后几小时
+ * @see Calendar#add(int, int)
+ */
+ public static Date getDateBeforeOrAfterMinute(Date curDate, int iMinute) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(curDate);
+ cal.add(Calendar.MINUTE, iMinute);
+ return cal.getTime();
+ }
+
+ /**
+ * 判断日期是否在当前周内
+ *
+ * @param curDate
+ * @param compareDate
+ * @return
+ */
+ public static boolean isSameWeek(Date curDate, Date compareDate) {
+ if (curDate == null || compareDate == null) {
+ return false;
+ }
+
+ Calendar calSun = Calendar.getInstance();
+ calSun.setTime(getFormatDateToDate(curDate));
+ calSun.set(Calendar.DAY_OF_WEEK, 1);
+
+ Calendar calNext = Calendar.getInstance();
+ calNext.setTime(calSun.getTime());
+ calNext.add(Calendar.DATE, 7);
+
+ Calendar calComp = Calendar.getInstance();
+ calComp.setTime(compareDate);
+ if (calComp.after(calSun) && calComp.before(calNext)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isSameDay(Date currentDate, Date compareDate) {
+ if (currentDate == null || compareDate == null) {
+ return false;
+ }
+ String current = getFormatDate(currentDate);
+ String compare = getFormatDate(compareDate);
+ if (current.equals(compare)) {
+ return true;
+ }
+ return false;
+ }
+
+ public static Date setDateCustomBeginFix(Date date, int hour) {
+ if (date == null) {
+ return null;
+ }
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, hour);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date setDateBeginFix(Date date) {
+ return setDateCustomBeginFix(date, 0);
+ }
+
+ public static Date setDateCustomEndFix(Date date, int hour) {
+ if (date == null) {
+ return null;
+ }
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, hour);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ return calendar.getTime();
+ }
+
+ public static Date setDateEndFix(Date date) {
+ return setDateCustomEndFix(date, 23);
+ }
+
+ /**
+ * 时间查询时,开始时间的 00:00:00
+ */
+ public static String addDateBeginfix(String datestring) {
+ if ((datestring == null) || "".equals(datestring)) {
+ return null;
+ }
+ return datestring + " 00:00:00";
+ }
+
+ /**
+ * 时间查询时,结束时间的 23:59:59
+ */
+ public static String addDateEndfix(String datestring) {
+ if ((datestring == null) || "".equals(datestring)) {
+ return null;
+ }
+ return datestring + " 23:59:59";
+ }
+
+ /**
+ * 返回格式化的日期
+ *
+ * @param dateStr 格式"yyyy-MM-dd 23:59:59";
+ * @return
+ */
+ public static Date getFormatDateEndfix(String dateStr) {
+ dateStr = addDateEndfix(dateStr);
+ return getFormatDateTime(dateStr);
+ }
+
+ /**
+ * 返回格式化的日期
+ *
+ * @param datePre 格式"yyyy-MM-dd HH:mm:ss";
+ * @return
+ */
+ public static Date formatEndTime(String datePre) {
+ if (datePre == null) {
+ return null;
+ }
+ String dateStr = addDateEndfix(datePre);
+ return getFormatDateTime(dateStr);
+ }
+
+ // date1加上compday天数以后的日期与当前时间比较,如果大于当前时间返回true,否则false
+ public static Boolean compareDay(Date date1, int compday) {
+ if (date1 == null) {
+ return false;
+ }
+ Date dateComp = getDateBeforeOrAfter(date1, compday);
+ Date nowdate = new Date();
+ if (dateComp.after(nowdate)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 获得年份
+ *
+ * @param
+ * @return
+ */
+ public static int getYear() {
+ Date date = new Date();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ return cal.get(Calendar.YEAR);
+ }
+
+ /**
+ * 获得月份
+ *
+ * @param date
+ * @return
+ */
+ public static int getMonth(Date date) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ return cal.get(Calendar.MONTH);
+ }
+
+ /**
+ * 获得天
+ *
+ * @param date
+ * @return
+ */
+ public static int getDay(Date date) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ return cal.get(Calendar.DAY_OF_MONTH);
+ }
+
+ /**
+ * 获得hour
+ *
+ * @param date
+ * @return
+ */
+ public static int getHour(Date date) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ return cal.get(Calendar.HOUR_OF_DAY);
+ }
+
+ public static Date fromDateString(String dataStr) {
+ if (dataStr == "") {
+ return new Date();
+ }
+ try {
+ return dateTimeFormatter.parseDateTime(dataStr).toDate();
+ } catch (Exception e) {
+ try {
+ return shortDateTimeFormatter.parseDateTime(dataStr).toDate();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return new Date();
+ }
+ }
+ }
+
+ public static Date fromDateStringWithYYYY_MM_DD_HH_MM_SS(String dateStr) {
+ try {
+ return dateTimeFormatter.parseDateTime(dateStr).toDate();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static String toDateString(Date date) {
+ DateTime dateTime = new DateTime(date);
+ return dateTimeFormatter.print(dateTime);
+ }
+
+ public static String toShortDateString(Date date) {
+ DateTime dateTime = new DateTime(date);
+ return shortDateTimeFormatter.print(dateTime);
+ }
+
+ public static long compare(Date time, long lasttime) {
+ time = Preconditions.checkNotNull(time);
+ lasttime = Preconditions.checkNotNull(lasttime);
+ return time.getTime() - lasttime;
+
+ }
+
+ public static long compare(Date currenttime, Date lasttime) {
+ currenttime = Preconditions.checkNotNull(currenttime);
+ lasttime = Preconditions.checkNotNull(lasttime);
+ return compare(currenttime, lasttime.getTime());
+ }
+
+ public static Date yesterdayBegin() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 1);
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date yesterdayLast() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - 1);
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ return calendar.getTime();
+ }
+
+ public static Date dayBegin() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date dayLast() {
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ return calendar.getTime();
+ }
+
+ public static Date dayBegin(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date dayLast(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ return calendar.getTime();
+ }
+
+
+ public static Date add(int field, int amount) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(field, amount);
+ return calendar.getTime();
+ }
+
+ public static Date add(Date date, int field, int amount) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ calendar.add(field, amount);
+ return calendar.getTime();
+ }
+
+ public static boolean inOneDay(Date currentDay, Date compareDay) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(currentDay);
+ int currentDayYears = calendar.get(Calendar.YEAR);
+ int currentDayDays = calendar.get(Calendar.DAY_OF_YEAR);
+
+ calendar.setTime(compareDay);
+ int compareDayYears = calendar.get(Calendar.YEAR);
+ int compareDayDays = calendar.get(Calendar.DAY_OF_YEAR);
+ if (currentDayYears == compareDayYears && currentDayDays == compareDayDays) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static Date weekendBegin() {
+ return getMonday(getCurrDate());
+ }
+
+ public static Date getMonday(Date day) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(day);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+ if (dayOfWeek == 0) {
+ dayOfWeek = 7;
+ }
+ calendar.add(Calendar.DATE, -dayOfWeek + 1);
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date weekendLast() {
+ return getSunday(getCurrDate());
+ }
+
+ public static Date getSunday(Date day) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(day);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+ if (dayOfWeek == 0) {
+ dayOfWeek = 7;
+ }
+ calendar.add(Calendar.DATE, -dayOfWeek + 7);
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ public static Date getLastThursday(Date day) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(day);
+ int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 5;
+ if (dayOfWeek == 0) {
+ dayOfWeek = 7;
+ }
+ if (dayOfWeek < 0) {
+ dayOfWeek = -dayOfWeek - 7;
+ }
+ if (dayOfWeek > 0) {
+ dayOfWeek = -dayOfWeek;
+ }
+ calendar.add(Calendar.DATE, dayOfWeek);
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
+ calendar.set(Calendar.MINUTE, 0);
+ calendar.set(Calendar.SECOND, 0);
+ return calendar.getTime();
+ }
+
+ /**
+ * 获取本周的起始日期
+ *
+ * @return
+ */
+ public static Pair getCurrWeek() {
+ Calendar c = Calendar.getInstance();
+ int weekday = c.get(7) - 2;
+ c.add(5, -weekday);
+ String beginDate = DateUtils.getFormatDate(c.getTime());
+ c.add(5, 6);
+ String endDate = DateUtils.getFormatDate(c.getTime());
+ return Pair.with(beginDate, endDate);
+ }
+
+ public static boolean isThisDaySaturday(Date date) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+
+ int day = c.get(Calendar.DAY_OF_WEEK);
+
+ if (day == Calendar.SUNDAY) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ public static boolean isThisDayMonday(Date date) {
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+
+ int day = c.get(Calendar.DAY_OF_WEEK);
+
+ if (day == Calendar.MONDAY) {
+ return true;
+ } else {
+ return false;
+ }
+
+ }
+
+ public static Date getAfterDate(int afterDay) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_YEAR, afterDay);
+ return calendar.getTime();
+ }
+
+ /**
+ * 某年第一天
+ *
+ * @return
+ */
+ public static Date getCurrYearFirst() {
+ Calendar currCal = Calendar.getInstance();
+ int currentYear = currCal.get(Calendar.YEAR);
+ return getYearFirst(currentYear);
+ }
+
+ /**
+ * 获取当年的最后一天
+ *
+ * @param
+ * @return
+ */
+ public static Date getCurrYearLast() {
+ Calendar currCal = Calendar.getInstance();
+ int currentYear = currCal.get(Calendar.YEAR);
+ return getYearLast(currentYear);
+ }
+
+ /**
+ * 获取某年最后一天日期
+ *
+ * @param year 年份
+ * @return Date
+ */
+ public static Date getYearLast(int year) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.YEAR, year);
+ calendar.roll(Calendar.DAY_OF_YEAR, -1);
+ Date currYearLast = calendar.getTime();
+
+ return currYearLast;
+ }
+
+ /**
+ * 获取某年第一天日期
+ *
+ * @param year 年份
+ * @return Date
+ */
+ public static Date getYearFirst(int year) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.YEAR, year);
+ Date currYearFirst = calendar.getTime();
+ return currYearFirst;
+ }
+
+ /**
+ * 获取当月第一天和最后一天
+ */
+ public static Pair getCurrentMonthFirstAndEnd(Date date) {
+ //获取当前月第一天:
+ Calendar c = Calendar.getInstance();
+ //设置为入参时间
+ c.setTime(date);
+ c.add(Calendar.MONTH, 0);
+ c.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天
+ String first = getFormatDate(c.getTime(), DATE_FORMAT);
+
+ //获取当前月最后一天
+ Calendar ca = Calendar.getInstance();
+ ca.setTime(date);
+ ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
+ String last = getFormatDate(ca.getTime(), DATE_FORMAT);
+ return Pair.with(first, last);
+ }
+
+ /**
+ * 字符串转换成日期
+ *
+ * @param dateString 日期串
+ * @param model 日期串的格式 ,如:yyyy-mm-dd
+ * @return
+ * @throws Exception
+ */
+ public static Date string2Date(String dateString, String model) {
+ Date date = null;
+ SimpleDateFormat sdf = new SimpleDateFormat(model);
+ try {
+ date = sdf.parse(dateString);
+
+ if (!dateString.equals(sdf.format(date))) {
+ date = null;
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return date;
+ }
+
+
+ public static void main(String[] args) {
+ System.out.println(getDaysBetweenDates(getFormatDateTime(getFormatDate("2024-08-31"), DATE_FORMAT),getFormatDateTime(getFormatDate("2024-11-28"), DATE_FORMAT)));
+
+
+// System.out.println(addDateBeginfix(getFirstDayOfMonth()));
+// System.out.println(addDateEndfix(getLastDayOfMonth()));
+//
+// System.out.println(addDateBeginfix(getCurrWeek().getValue0()) + " " + addDateEndfix(getCurrWeek().getValue1()));
+// System.out.println(addDateBeginfix(getFormatDate(getYearFirst(getYear(new Date())))));
+// System.out.println(addDateEndfix(getFormatDate(getYearLast(getYear(new Date())))));
+ }
+}
diff --git a/car-common/src/main/java/com/weiqi/mis/HttpUtil.java b/car-common/src/main/java/com/weiqi/mis/HttpUtil.java
new file mode 100644
index 0000000..43b6481
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/HttpUtil.java
@@ -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 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 paramMap, String encoding) {
+ StringBuilder urlBuffer = new StringBuilder(url);
+ if (url.indexOf("?") < 0) {
+ urlBuffer.append("?");
+ }
+ if (paramMap != null && !paramMap.isEmpty()) {
+ Iterator 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 paramMap,String host) {
+ return sendPostRequest(url, paramMap, "UTF-8",host);
+ }
+
+
+ public static String sendPostRequestByJson(String url, Map 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 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 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 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 iterator = paramMap.keySet().iterator();
+ List 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 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;
+ }
+
+}
diff --git a/car-common/src/main/java/com/weiqi/mis/IPUtil.java b/car-common/src/main/java/com/weiqi/mis/IPUtil.java
new file mode 100644
index 0000000..8f4aac6
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/IPUtil.java
@@ -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 ips = new ArrayList();
+ try {
+ Enumeration nets = NetworkInterface.getNetworkInterfaces();
+ for (NetworkInterface netint : Collections.list(nets)) {
+ if (netint.getHardwareAddress() != null) {
+ List 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());
+
+ }
+}
diff --git a/car-common/src/main/java/com/weiqi/mis/JacksonHelper.java b/car-common/src/main/java/com/weiqi/mis/JacksonHelper.java
new file mode 100644
index 0000000..d338ab1
--- /dev/null
+++ b/car-common/src/main/java/com/weiqi/mis/JacksonHelper.java
@@ -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 deserialize(String s, Class clazz) {
+ if (s == null || s.length() == 0) {
+ return null;
+ }
+
+
+ T t = mapper.readValue(s, clazz);
+ return t;
+
+ }
+
+ @SneakyThrows
+ public static 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 deserialize(String s, TypeReference clazz) {
+
+ if (s == null || s.length() == 0) {
+ return null;
+ }
+
+ T t = (T) mapper.readValue(s, clazz);
+ return t;
+ }
+
+ public static T deserialize(String s, Class 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