├── .gitattributes
├── notes
├── 关于后端通过解密钥来显示用户名的问题.txt
├── 支付宝回调接口的问题.txt
├── mybatis-plus的坑.txt
├── redis中使用lua注意点.txt
├── 浏览器的坑.txt
└── 缓存的坑.txt
├── express-auth
└── src
│ ├── main
│ ├── resources
│ │ ├── express.keystore
│ │ ├── express_public_key.cer
│ │ ├── public
│ │ │ └── assets
│ │ │ │ ├── img
│ │ │ │ ├── qq.png
│ │ │ │ ├── index1.png
│ │ │ │ └── login_bg.jpg
│ │ │ │ ├── layer
│ │ │ │ └── theme
│ │ │ │ │ └── default
│ │ │ │ │ ├── icon.png
│ │ │ │ │ ├── icon-ext.png
│ │ │ │ │ ├── loading-0.gif
│ │ │ │ │ ├── loading-1.gif
│ │ │ │ │ └── loading-2.gif
│ │ │ │ ├── fonts
│ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ │ ├── css
│ │ │ │ ├── 404.css
│ │ │ │ ├── express.css
│ │ │ │ ├── completeInfo.css
│ │ │ │ └── register.css
│ │ │ │ └── js
│ │ │ │ ├── bootstrap-table-zh-CN.min.js
│ │ │ │ ├── express.js
│ │ │ │ └── http.js
│ │ └── templates
│ │ │ └── common
│ │ │ └── configJS.html
│ └── java
│ │ └── com
│ │ └── cwj
│ │ └── express
│ │ └── auth
│ │ ├── service
│ │ ├── AuthService.java
│ │ ├── SmsService.java
│ │ ├── FaceService.java
│ │ ├── SysUserService.java
│ │ ├── RedisService.java
│ │ └── impl
│ │ │ ├── SysUserServiceImpl.java
│ │ │ └── RedisServiceImpl.java
│ │ ├── dao
│ │ ├── SysUserMapper.java
│ │ └── SysRolesLevelMapper.java
│ │ ├── config
│ │ ├── thirdapi
│ │ │ ├── SmsConfig.java
│ │ │ ├── BaiduFaceConfig.java
│ │ │ ├── ThirdApiConfig.java
│ │ │ └── AipFaceConfig.java
│ │ └── auth
│ │ │ ├── AuthConfig.java
│ │ │ └── CustomUserAuthenticationConverter.java
│ │ ├── controller
│ │ └── PageController.java
│ │ └── ExpressAuthApplication.java
│ └── test
│ └── java
│ ├── CreatePassword.java
│ └── MyTest.java
├── express-ucenter
└── src
│ └── main
│ ├── resources
│ ├── public
│ │ └── assets
│ │ │ ├── img
│ │ │ ├── qq.png
│ │ │ ├── index1.png
│ │ │ └── login_bg.jpg
│ │ │ ├── layer
│ │ │ └── theme
│ │ │ │ └── default
│ │ │ │ ├── icon.png
│ │ │ │ ├── icon-ext.png
│ │ │ │ ├── loading-0.gif
│ │ │ │ ├── loading-1.gif
│ │ │ │ └── loading-2.gif
│ │ │ ├── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ ├── css
│ │ │ ├── 404.css
│ │ │ ├── express.css
│ │ │ ├── completeInfo.css
│ │ │ └── register.css
│ │ │ └── js
│ │ │ ├── bootstrap-table-zh-CN.min.js
│ │ │ └── express.js
│ ├── mapping
│ │ ├── SysUserMapper.xml
│ │ ├── UserEvaluateMapper.xml
│ │ ├── CourierSignDataMapper.xml
│ │ ├── UserEvaluateEventLogMapper.xml
│ │ ├── CourierLeaveLogMapper.xml
│ │ ├── CourierSignCountMapper.xml
│ │ ├── SysRolesLevelMapper.xml
│ │ └── UserFeedbackMapper.xml
│ ├── express_public_key.txt
│ └── templates
│ │ ├── admin
│ │ └── module
│ │ │ ├── nav.html
│ │ │ └── sidebar.html
│ │ └── common
│ │ └── nav.html
│ └── java
│ └── com
│ └── cwj
│ └── express
│ └── ucenter
│ ├── dao
│ ├── SysUserMapper.java
│ ├── UserFeedbackMapper.java
│ ├── CourierLeaveLogMapper.java
│ ├── CourierSignDataMapper.java
│ ├── SysRolesLevelMapper.java
│ ├── CourierSignCountMapper.java
│ ├── UserEvaluateEventLogMapper.java
│ └── UserEvaluateMapper.java
│ ├── service
│ ├── SysRolesLevelService.java
│ ├── UserEvaluateService.java
│ ├── UserFeedbackService.java
│ ├── impl
│ │ └── SysRolesLevelServiceImpl.java
│ ├── CourierSignService.java
│ ├── RedisService.java
│ └── SysUserService.java
│ ├── feignclient
│ ├── area
│ │ ├── AreaFeignClient.java
│ │ └── AreaFeignClientFallbackFactory.java
│ └── order
│ │ └── OrderFeignClient.java
│ ├── config
│ ├── mybatis
│ │ └── MyBatisPlusConfig.java
│ └── security
│ │ ├── JwtAuthenticationTokenFilter.java
│ │ └── RestAuthenticationEntryPoint.java
│ ├── rocketmq
│ └── EvaluateConsumer.java
│ └── ExpressUcenterApplication.java
├── express-common
└── src
│ └── main
│ └── java
│ └── com
│ └── cwj
│ └── express
│ └── common
│ ├── constant
│ ├── URLConstant.java
│ ├── LoginTypeConstant.java
│ ├── ExpressServiceListConstant.java
│ ├── RedisKeyConstant.java
│ └── SessionKeyConstant.java
│ ├── model
│ ├── request
│ │ └── RequestData.java
│ └── response
│ │ ├── ResultCode.java
│ │ ├── Response.java
│ │ ├── QueryResult.java
│ │ ├── QueryResponseResult.java
│ │ └── ResponseResult.java
│ ├── config
│ ├── ribbon
│ │ ├── RibbonConfiguration.java
│ │ └── RibbonRuleConfig.java
│ ├── auth
│ │ └── AuthorizeConfig.java
│ ├── sentinel
│ │ └── MyUrlCleaner.java
│ └── rocket
│ │ └── RocketmqConfig.java
│ ├── exception
│ ├── ExceptionCast.java
│ ├── CustomException.java
│ └── DefaultAuthException.java
│ ├── enums
│ ├── RateLimitEnum.java
│ ├── PaymentTypeEnum.java
│ ├── DataAreaLevelEnum.java
│ ├── CourierLeaveStatusEnum.java
│ ├── rocketmq
│ │ └── MessageDelayLevel.java
│ ├── OrderDeleteEnum.java
│ ├── FeedbackTypeEnum.java
│ ├── ThirdLoginTypeEnum.java
│ ├── FeedbackStatusEnum.java
│ ├── OrderTypeEnum.java
│ ├── SexEnum.java
│ ├── OrderStatusEnum.java
│ ├── SysRoleEnum.java
│ └── PaymentStatusEnum.java
│ ├── web
│ └── BaseController.java
│ └── Interceptor
│ ├── RestTempleInterceptor.java
│ └── FeignInterceptor.java
├── express-utils
├── src
│ └── main
│ │ └── java
│ │ ├── org
│ │ └── n3r
│ │ │ └── idworker
│ │ │ ├── WorkerIdStrategy.java
│ │ │ ├── InvalidSystemClock.java
│ │ │ ├── RandomCodeStrategy.java
│ │ │ ├── Test.java
│ │ │ ├── DayCode.java
│ │ │ ├── Id.java
│ │ │ ├── Code.java
│ │ │ ├── strategy
│ │ │ └── DayPrefixRandomCodeStrategy.java
│ │ │ ├── utils
│ │ │ └── Ip.java
│ │ │ └── Sid.java
│ │ └── com
│ │ └── cwj
│ │ └── express
│ │ └── utils
│ │ ├── BCryptUtil.java
│ │ ├── ExpressOauth2Util.java
│ │ ├── LocalDateTimeUtils.java
│ │ ├── CookieUtil.java
│ │ └── oldUtils
│ │ └── CookieUtil.java
└── pom.xml
├── express-area
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── cwj
│ │ └── express
│ │ └── area
│ │ ├── dao
│ │ ├── DataCompanyMapper.java
│ │ ├── DataAreaMapper.java
│ │ └── DataSchoolMapper.java
│ │ ├── service
│ │ ├── DataAreaService.java
│ │ ├── DataCompanyService.java
│ │ ├── DataSchoolService.java
│ │ ├── RedisService.java
│ │ └── impl
│ │ │ ├── RedisServiceImpl.java
│ │ │ └── DataAreaServiceImpl.java
│ │ ├── ExpressAreaWebMvcConfig.java
│ │ └── ExpressAreaApplication.java
│ └── resources
│ └── mapping
│ ├── DataCompanyMapper.xml
│ ├── DataSchoolMapper.xml
│ └── DataAreaMapper.xml
├── express-order
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── cwj
│ │ │ └── express
│ │ │ └── order
│ │ │ ├── service
│ │ │ ├── DistributionCourierService.java
│ │ │ ├── OrderPaymentService.java
│ │ │ ├── OrderEvaluateService.java
│ │ │ └── RedisService.java
│ │ │ ├── dao
│ │ │ ├── OrderPaymentMapper.java
│ │ │ ├── OrderEvaluateMapper.java
│ │ │ └── OrderInfoMapper.java
│ │ │ ├── config
│ │ │ ├── lua
│ │ │ │ └── LuaConfiguration.java
│ │ │ ├── alipay
│ │ │ │ └── AliPayConfig.java
│ │ │ ├── mybatis
│ │ │ │ └── MyBatisPlusConfig.java
│ │ │ └── security
│ │ │ │ └── JwtAuthenticationTokenFilter.java
│ │ │ ├── ExpressOrderApplication.java
│ │ │ ├── feignclient
│ │ │ ├── area
│ │ │ │ ├── AreaFeignClient.java
│ │ │ │ └── AreaFeignClientFallbackFactory.java
│ │ │ └── ucenter
│ │ │ │ ├── UcenterFeignClient.java
│ │ │ │ └── UcenterFeignClientFallbackFactory.java
│ │ │ ├── ExpressOrderWebMvcConfig.java
│ │ │ ├── rocketmq
│ │ │ ├── CancelOrderConsumer.java
│ │ │ └── DistributionCourierConsumer.java
│ │ │ └── init
│ │ │ └── InitCourierScoreTask.java
│ └── resources
│ │ ├── express_public_key.txt
│ │ ├── lua
│ │ └── distribution.lua
│ │ └── mapping
│ │ ├── OrderPaymentMapper.xml
│ │ ├── OrderEvaluateMapper.xml
│ │ └── OrderInfoMapper.xml
│ └── test
│ └── java
│ └── TimeTest.java
├── express-model
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── cwj
│ │ └── express
│ │ ├── vo
│ │ ├── order
│ │ │ ├── OrderEvaluateItemVO.java
│ │ │ ├── CourierRankVO.java
│ │ │ ├── EchartCalendarPieItemVO.java
│ │ │ ├── OrderChartParamVO.java
│ │ │ ├── OrderEvaluateVO.java
│ │ │ ├── UpdateOrderVo.java
│ │ │ ├── OrderDashboardVO.java
│ │ │ ├── OrderInfoVO.java
│ │ │ └── OrderHistoryVO.java
│ │ ├── table
│ │ │ └── BootstrapTableVO.java
│ │ └── ucenter
│ │ │ └── UserFeedbackVO.java
│ │ └── domain
│ │ ├── auth
│ │ ├── SysUserExt.java
│ │ └── request
│ │ │ └── LoginRequest.java
│ │ ├── area
│ │ ├── DataCompany.java
│ │ ├── DataSchool.java
│ │ └── DataArea.java
│ │ └── ucenter
│ │ ├── UserEvaluate.java
│ │ ├── UserEvaluateEventLog.java
│ │ ├── CourierSignData.java
│ │ ├── CourierSignCount.java
│ │ ├── SysRolesLevel.java
│ │ ├── CourierLeaveLog.java
│ │ └── UserFeedback.java
└── pom.xml
├── .gitignore
└── express-api
└── src
└── main
└── java
└── com
└── cwj
└── express
└── api
├── auth
└── AuthControllerApi.java
├── order
├── EchartOrderControllerApi.java
└── PayControllerApi.java
├── config
├── WebMvcConfig.java
└── Swagger2Configuration.java
└── area
└── AreaControllerApi.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.sql linguist-language=java
2 |
3 |
--------------------------------------------------------------------------------
/notes/关于后端通过解密钥来显示用户名的问题.txt:
--------------------------------------------------------------------------------
1 | 通过后端来解析密钥也是也是个耗费性能的点,
2 | 其实解密原理就是base64,js一样有base64解密的工具类代码
3 | 通过前端解析能节省服务器资源
--------------------------------------------------------------------------------
/notes/支付宝回调接口的问题.txt:
--------------------------------------------------------------------------------
1 | 因为回调接口是公网调用的,公网回调不可能携带认证token,
2 | 所以到生产环境要配置支付宝的ip为白名单,只有白名单才能调用
3 |
4 | 异步回调,一开始不行,后来莫名奇妙就好了
--------------------------------------------------------------------------------
/notes/mybatis-plus的坑.txt:
--------------------------------------------------------------------------------
1 | 使用3.1.0版本会无法使用通用枚举插件
2 | 应用表面现象就是账号密码一直是错的
3 | 猜测是枚举类中的属性和数据库属性对不上(后来证实并不是这个原因)
4 |
5 | 不管怎么样,换成3.1.2就好了
--------------------------------------------------------------------------------
/express-auth/src/main/resources/express.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/express.keystore
--------------------------------------------------------------------------------
/express-auth/src/main/resources/express_public_key.cer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/express_public_key.cer
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/img/qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/img/qq.png
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/img/index1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/img/index1.png
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/img/qq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/img/qq.png
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/img/login_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/img/login_bg.jpg
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/img/index1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/img/index1.png
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/img/login_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/img/login_bg.jpg
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/layer/theme/default/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/layer/theme/default/icon.png
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/layer/theme/default/icon-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/layer/theme/default/icon-ext.png
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/layer/theme/default/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/layer/theme/default/icon.png
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/layer/theme/default/loading-0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/layer/theme/default/loading-0.gif
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/layer/theme/default/loading-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/layer/theme/default/loading-1.gif
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/layer/theme/default/loading-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/layer/theme/default/loading-2.gif
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/layer/theme/default/icon-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/layer/theme/default/icon-ext.png
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-0.gif
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-1.gif
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/layer/theme/default/loading-2.gif
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-auth/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mimajiushi/express-parent/HEAD/express-ucenter/src/main/resources/public/assets/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/notes/redis中使用lua注意点.txt:
--------------------------------------------------------------------------------
1 | 我们都知道redis是单线程io多路复用模型的
2 | 而当我们在redis中使用lua脚本时,会阻塞整个redis,
3 | 所以使用lua脚本请务必测试清除,脚本不能出现任何死锁,
4 | 还有就是使用的地方最好单独配一个redis,
5 | 在本项目中分配配送员我使用了lua脚本,但使用的redis都是一个,
6 | 在生产环境中这样做是不对的,正确的做法是配置多个redis数据源,
7 | 不要让分配配送员的任务阻塞到其它缓存的使用
--------------------------------------------------------------------------------
/express-auth/src/main/resources/templates/common/configJS.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/constant/URLConstant.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.constant;
2 |
3 | public class URLConstant {
4 | public static final String LOGIN_PAGE_URL = "http://localhost:40400/page/index";
5 | }
6 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/WorkerIdStrategy.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | public interface WorkerIdStrategy {
4 | void initialize();
5 |
6 | long availableWorkerId();
7 |
8 | void release();
9 | }
10 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/InvalidSystemClock.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | public class InvalidSystemClock extends RuntimeException {
4 | public InvalidSystemClock(String message) {
5 | super(message);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/RandomCodeStrategy.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | public interface RandomCodeStrategy {
4 | void init();
5 |
6 | int prefix();
7 |
8 | int next();
9 |
10 | void release();
11 | }
12 |
--------------------------------------------------------------------------------
/notes/浏览器的坑.txt:
--------------------------------------------------------------------------------
1 | 当配置本地host express.com 解析成 127.0.0.1 时
2 | 访问 express.com:40400/auth/index 时,浏览器是禁止调用摄像头的
3 | 必须修改浏览器的启动命令, 在目标后加上 空格 + --unsafely-treat-insecure-origin-as-secure="http://express.com:40400"
4 | 详情请百度: http无法调用摄像头
5 |
6 | 目前只有谷歌浏览器能利用js获取token,qq和ie都不行
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/SysUserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/Test.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | public class Test {
4 |
5 | public static void main(String[] args) {
6 |
7 | for (int i = 0 ; i < 1000 ; i ++) {
8 | // System.out.println(Sid.nextShort());
9 | }
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/request/RequestData.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.request;
2 |
3 | import lombok.Data;
4 | import lombok.ToString;
5 |
6 | /**
7 | * Created by mrt on 2018/3/5.
8 | */
9 | @Data
10 | @ToString
11 | public class RequestData {
12 | }
13 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/response/ResultCode.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.response;
2 |
3 | public interface ResultCode {
4 | //操作是否成功,true为成功,false操作失败
5 | boolean success();
6 | //操作代码
7 | int code();
8 | //提示信息
9 | String message();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/response/Response.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.response;
2 |
3 | /**
4 | * Created by admin on 2018/3/5.
5 | */
6 | public interface Response {
7 | public static final boolean SUCCESS = true;
8 | public static final int SUCCESS_CODE = 10000;
9 | }
10 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/AuthService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service;
2 |
3 | /**
4 | * @author root
5 | */
6 | public interface AuthService {
7 | /**
8 | * 登录接口
9 | * @return token
10 | */
11 | String login(String username, String password, String clientId, String clientSecret);
12 | }
13 |
--------------------------------------------------------------------------------
/notes/缓存的坑.txt:
--------------------------------------------------------------------------------
1 | 类似于
2 | @CacheEvict(cacheNames = RedisConfig.ORDER_INFO_DASHBOARD_DATA, key = "#userId")
3 | public void A(String userId) {
4 | B();
5 | }
6 |
7 | @CacheEvict(cacheNames = RedisConfig.xxx, key = "#xxx")
8 | public void B(String xxx){
9 | xxx;
10 | }
11 | 这种,B上面的注解是失效的,即使都加上beforeInvocation = true也还是失效
12 | 这时候只能自己手写代码清除缓存
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/constant/LoginTypeConstant.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.constant;
2 |
3 | /**
4 | * @author cwj
5 | * 登录类型
6 | */
7 | public class LoginTypeConstant {
8 | public static final String PASSWORD = "password";
9 | public static final String PHONE = "phone";
10 | public static final String FACE = "face";
11 | }
12 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/dao/SysUserMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.dao;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.cwj.express.domain.ucenter.SysUser;
5 |
6 | /**
7 | *
8 | * 用户表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-10-26
13 | */
14 | public interface SysUserMapper extends BaseMapper {
15 | }
16 |
--------------------------------------------------------------------------------
/express-auth/src/test/java/CreatePassword.java:
--------------------------------------------------------------------------------
1 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
2 |
3 | public class CreatePassword {
4 | public static void main(String[] args) {
5 | BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
6 | String expressApp = bCryptPasswordEncoder.encode("ExpressApp");
7 | System.out.println(expressApp);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/SysUserMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.cwj.express.domain.ucenter.SysUser;
5 |
6 | /**
7 | *
8 | * 用户表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-02
13 | */
14 | public interface SysUserMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/dao/DataCompanyMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.dao;
2 |
3 | import com.cwj.express.domain.area.DataCompany;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * 快递公司数据表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-10-30
13 | */
14 | public interface DataCompanyMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/service/DistributionCourierService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.service;
2 |
3 | /**
4 | * @author cwj
5 | * 分配配送员业务
6 | */
7 |
8 | public interface DistributionCourierService {
9 | /**
10 | * 分配配送员
11 | * @param orderId 订单id
12 | * @param type 执行类型 first-支付之后分配 re-手动重新分配
13 | */
14 | public void distributionCourier(String orderId, String type);
15 | }
16 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/config/ribbon/RibbonConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.config.ribbon;
2 |
3 | import org.springframework.cloud.netflix.ribbon.RibbonClients;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * @author root
8 | */
9 | @Configuration
10 | @RibbonClients(defaultConfiguration = RibbonRuleConfig.class)
11 | public class RibbonConfiguration {
12 | }
13 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/dao/OrderPaymentMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.dao;
2 |
3 | import com.cwj.express.domain.order.OrderPayment;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * 订单支付表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-02
13 | */
14 | public interface OrderPaymentMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/dao/SysRolesLevelMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.dao;
2 |
3 |
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import com.cwj.express.domain.ucenter.SysRolesLevel;
6 |
7 | /**
8 | *
9 | * Mapper 接口
10 | *
11 | *
12 | * @author chenwenjie
13 | * @since 2019-11-12
14 | */
15 | public interface SysRolesLevelMapper extends BaseMapper {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/dao/OrderEvaluateMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.dao;
2 |
3 | import com.cwj.express.domain.order.OrderEvaluate;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * 订单评价表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-02
13 | */
14 | public interface OrderEvaluateMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/exception/ExceptionCast.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.exception;
2 |
3 | import com.cwj.express.common.model.response.ResultCode;
4 |
5 | /**
6 | * @author Administrator
7 | * @version 1.0
8 | * @create 2018-09-14 17:31
9 | **/
10 | public class ExceptionCast {
11 |
12 | public static void cast(ResultCode resultCode){
13 | throw new CustomException(resultCode);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/UserFeedbackMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.cwj.express.domain.ucenter.UserFeedback;
5 |
6 | /**
7 | *
8 | * 用户反馈表 Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-02
13 | */
14 | public interface UserFeedbackMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/thirdapi/SmsConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.thirdapi;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author cwj
7 | * 腾讯短信配置
8 | */
9 |
10 | @Data
11 | public class SmsConfig{
12 | private Integer appId;
13 | private String appKey;
14 | private Integer templateId;
15 | private String sign;
16 | private String intervalMin;
17 | private String validMin;
18 | }
19 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/CourierLeaveLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.cwj.express.domain.ucenter.CourierLeaveLog;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-21
13 | */
14 | public interface CourierLeaveLogMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/CourierSignDataMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.cwj.express.domain.ucenter.CourierSignData;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-24
13 | */
14 | public interface CourierSignDataMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/SysRolesLevelMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 |
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import com.cwj.express.domain.ucenter.SysRolesLevel;
6 |
7 | /**
8 | *
9 | * Mapper 接口
10 | *
11 | *
12 | * @author chenwenjie
13 | * @since 2019-11-12
14 | */
15 | public interface SysRolesLevelMapper extends BaseMapper {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/CourierSignCountMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.cwj.express.domain.ucenter.CourierSignCount;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-24
13 | */
14 | public interface CourierSignCountMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/css/404.css:
--------------------------------------------------------------------------------
1 | /*=======================================
2 | GENERAL STYLES
3 | ==================================================*/
4 | body {
5 | font-family: 'Nova Flat', cursive;
6 | background-color: #B396FF;
7 | color: #fff;
8 | }
9 | .pad-top {
10 | padding-top:60px;
11 | }
12 | .text-center {
13 | text-align:center;
14 | }
15 | #error-link {
16 | font-size:150px;
17 | padding:10px;
18 | }
19 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/css/404.css:
--------------------------------------------------------------------------------
1 | /*=======================================
2 | GENERAL STYLES
3 | ==================================================*/
4 | body {
5 | font-family: 'Nova Flat', cursive;
6 | background-color: #B396FF;
7 | color: #fff;
8 | }
9 | .pad-top {
10 | padding-top:60px;
11 | }
12 | .text-center {
13 | text-align:center;
14 | }
15 | #error-link {
16 | font-size:150px;
17 | padding:10px;
18 | }
19 |
--------------------------------------------------------------------------------
/express-order/src/main/resources/express_public_key.txt:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuwjOSVenTvhQZmNMWEuE+0t42/ILg1wAr0R1weUezV0GAiDEhaFENeqDGYgJrlkOeq4y0y2NapsK8FuiW7JGojhTaIGOQqx0xxQzqV8yi7EUJbNrXUr0WtvYoWH+e6iynSu6eW1gC9POE1LMriBqjzGbLxQIeRml1dgOqMVfyhh9p8G4c2Nk56QBigWIxejx/9Tj3lG24cOLGflxA+WhaSxHj5zf4H7aVcnToOdVseEP3+tILLgtPPNrCnb4Zi4YbsLV7QzBaLxOoM2oC8fCm1qyUxzNzSOdcAuTnIWYLoVxv3bjkZKO4ZlGb0TlG4gq3VWnxTNWc4o6kg3IASs9TQIDAQAB-----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/UserEvaluateEventLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.cwj.express.domain.ucenter.UserEvaluateEventLog;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | *
8 | * Mapper 接口
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-12-03
13 | */
14 | public interface UserEvaluateEventLogMapper extends BaseMapper {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/express_public_key.txt:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuwjOSVenTvhQZmNMWEuE+0t42/ILg1wAr0R1weUezV0GAiDEhaFENeqDGYgJrlkOeq4y0y2NapsK8FuiW7JGojhTaIGOQqx0xxQzqV8yi7EUJbNrXUr0WtvYoWH+e6iynSu6eW1gC9POE1LMriBqjzGbLxQIeRml1dgOqMVfyhh9p8G4c2Nk56QBigWIxejx/9Tj3lG24cOLGflxA+WhaSxHj5zf4H7aVcnToOdVseEP3+tILLgtPPNrCnb4Zi4YbsLV7QzBaLxOoM2oC8fCm1qyUxzNzSOdcAuTnIWYLoVxv3bjkZKO4ZlGb0TlG4gq3VWnxTNWc4o6kg3IASs9TQIDAQAB-----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/thirdapi/BaiduFaceConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.thirdapi;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author cwj
7 | * 百度人脸api配置
8 | */
9 | @Data
10 | public class BaiduFaceConfig {
11 | private String appId;
12 | private String appKey;
13 | private String secretKey;
14 | private int connTimeout;
15 | private int socketTimeOut;
16 | private int acceptScore;
17 | private String groupId;
18 | }
19 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/response/QueryResult.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.response;
2 |
3 | import lombok.Data;
4 | import lombok.ToString;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @Author: mrt.
10 | * @Description:
11 | * @Date:Created in 2018/1/24 18:33.
12 | * @Modified By:
13 | */
14 | @Data
15 | @ToString
16 | public class QueryResult {
17 | //数据列表
18 | private List list;
19 | //数据总数
20 | private long total;
21 | }
22 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderEvaluateItemVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.math.BigDecimal;
9 |
10 | @Data
11 | @Builder
12 | @NoArgsConstructor
13 | @AllArgsConstructor
14 | public class OrderEvaluateItemVO {
15 | private String orderId;
16 | private BigDecimal score;
17 | private String evaluate;
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | /target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 |
5 | ### STS ###
6 | .apt_generated
7 | .classpath
8 | .factorypath
9 | .project
10 | .settings
11 | .springBeans
12 | .sts4-cache
13 |
14 | ### IntelliJ IDEA ###
15 | .idea
16 | *.iws
17 | *.iml
18 | *.ipr
19 |
20 | ### NetBeans ###
21 | /nbproject/private/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
26 | /build/
27 |
28 | ### VS Code ###
29 | .vscode/
30 |
31 | ### Mac OS ###
32 | **/.DS_Store
33 |
34 | ### LOG ###
35 | *.log
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/SmsService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service;
2 |
3 |
4 | import com.cwj.express.common.model.response.ResponseResult;
5 |
6 | /**
7 | * 短信业务
8 | */
9 | public interface SmsService {
10 | /**
11 | * 发送短信
12 | * @param tel 手机号码
13 | * @param code 验证码
14 | */
15 | ResponseResult send(String tel, String code);
16 |
17 | /**
18 | * 校验短信
19 | */
20 | ResponseResult check(String tel, String code);
21 | }
22 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/response/QueryResponseResult.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.response;
2 |
3 | import lombok.Data;
4 | import lombok.ToString;
5 |
6 | @Data
7 | @ToString
8 | public class QueryResponseResult extends ResponseResult {
9 |
10 | QueryResult queryResult;
11 |
12 | public QueryResponseResult(ResultCode resultCode,QueryResult queryResult){
13 | super(resultCode);
14 | this.queryResult = queryResult;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/CourierRankVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import io.swagger.annotations.ApiModelProperty;
4 | import lombok.Data;
5 |
6 | /**
7 | * @Author: 森七柚子茶
8 | * @Date: 2019/11/28 18:18
9 | * @File : CourierRankVO.java
10 | * @Version 1.0
11 | */
12 | @Data
13 | public class CourierRankVO {
14 |
15 | @ApiModelProperty(value = "快递员")
16 | private String courierId;
17 |
18 | @ApiModelProperty(value = "快递员完成单数")
19 | private Integer sum;
20 | }
21 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/service/DataAreaService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.service;
2 |
3 | import com.cwj.express.domain.area.DataArea;
4 |
5 | import java.util.List;
6 |
7 | public interface DataAreaService {
8 |
9 | /**
10 | * 获取id下的所有地址
11 | * @param parentId parentId
12 | * @return 地址信息列表
13 | */
14 | List getAreasByParentId(Integer parentId);
15 |
16 | /**
17 | * 查询所有行政id(parent_id)
18 | */
19 | List selectParentIdDistinct();
20 | }
21 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/constant/ExpressServiceListConstant.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.constant;
2 |
3 | /**
4 | * @author cwj
5 | * @description express微服务名称列表
6 | */
7 |
8 | public class ExpressServiceListConstant {
9 | public static final String EXPRESS_AUTH = "express-auth";
10 | public static final String EXPRESS_AREA = "express-area";
11 | public static final String EXPRESS_ORDER = "express-order";
12 | public static final String EXPRESS_UCENTER = "express-ucenter";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/table/BootstrapTableVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.table;
2 |
3 | import lombok.Builder;
4 | import lombok.Data;
5 |
6 | import java.io.Serializable;
7 | import java.util.List;
8 |
9 | /**
10 | * @author xiangsheng.wu
11 | * @date 2019年04月23日 18:11
12 | */
13 | @Data
14 | @Builder
15 | public class BootstrapTableVO implements Serializable {
16 | /**
17 | * 总记录数
18 | */
19 | private Long total;
20 | /**
21 | * 记录
22 | */
23 | private List rows;
24 | }
25 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/service/DataCompanyService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.service;
2 |
3 | import com.cwj.express.domain.area.DataCompany;
4 |
5 | import java.util.List;
6 |
7 | public interface DataCompanyService{
8 | /**
9 | * 获取所有快递公司的信息
10 | * @return 快递公司信息列表
11 | */
12 | List listAll();
13 |
14 | /**
15 | * 根据id获取快递公司信息(缓存实现由 LoadingCache 换成 redis)
16 | * @param id 快递公司id
17 | * @return 快递公司信息
18 | */
19 | DataCompany getById(Integer id);
20 | }
21 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/thirdapi/ThirdApiConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.thirdapi;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author chenwenjie
9 | */
10 | @Data
11 | @Component("thirdApiConfig")
12 | @ConfigurationProperties(prefix = "third-api-config")
13 | public class ThirdApiConfig {
14 | private SmsConfig sms;
15 | private BaiduFaceConfig baidu;
16 | }
17 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/auth/SysUserExt.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.auth;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | /**
10 | * @author root
11 | */
12 | @Data
13 | @NoArgsConstructor
14 | @AllArgsConstructor
15 | public class SysUserExt extends SysUser {
16 | private String authType;
17 |
18 | public SysUserExt(SysUser sysUser){
19 | super(sysUser);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/config/auth/AuthorizeConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.config.auth;
2 |
3 | import com.cwj.express.common.enums.SysRoleEnum;
4 |
5 | public class AuthorizeConfig {
6 | /**
7 | * 所有付费用户角色
8 | */
9 | public static final String ALL_PAY_USER = "hasAnyRole('ROLE_USER','ROLE_VIP_USER','ROLE_SVIP_USER')";
10 |
11 | /**
12 | * 所有付费用户和配送员
13 | */
14 | public static final String PAY_USER_AND_COURIER = "hasAnyRole('ROLE_USER','ROLE_VIP_USER','ROLE_SVIP_USER','ROLE_COURIER')";
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/express-area/src/main/resources/mapping/DataCompanyMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/RateLimitEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | public enum RateLimitEnum {
4 |
5 | RRLimit_2_1("2/1"),
6 | RRLimit_5_1("5/1"),
7 | RRLimit_5_2("5/2"),
8 | RRLimit_1_5("1/5"),
9 | RRLimit_10_1("10/1"),
10 | RRLimit_1_10("1/10"),
11 | RRLimit_1_60("1/60"),
12 | ;
13 |
14 | private String limit;
15 |
16 | RateLimitEnum(final String limit) {
17 | this.limit = limit;
18 | }
19 |
20 | public String limit() {
21 | return this.limit;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/SysRolesLevelService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 |
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import com.cwj.express.domain.ucenter.SysRolesLevel;
6 |
7 | /**
8 | *
9 | * 角色业务层
10 | *
11 | *
12 | * @author chenwenjie
13 | * @since 2019-11-12
14 | */
15 | public interface SysRolesLevelService{
16 |
17 | /**
18 | * 根据用户id获取对应角色信息
19 | * @param userId 用户id
20 | * @return 角色信息(主要是折扣)
21 | */
22 | public SysRolesLevel getByUserId(String userId);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/dao/DataAreaMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.dao;
2 |
3 | import com.cwj.express.domain.area.DataArea;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import org.apache.ibatis.annotations.Select;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | *
11 | * 行政区域数据表 Mapper 接口
12 | *
13 | *
14 | * @author chenwenjie
15 | * @since 2019-10-30
16 | */
17 | public interface DataAreaMapper extends BaseMapper {
18 | @Select("select distinct(parent_id) from data_area;")
19 | List selectParentIdDistinct();
20 | }
21 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/dao/DataSchoolMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.dao;
2 |
3 | import com.cwj.express.domain.area.DataSchool;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import org.apache.ibatis.annotations.Select;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | *
11 | * 高校数据表 Mapper 接口
12 | *
13 | *
14 | * @author chenwenjie
15 | * @since 2019-10-30
16 | */
17 | public interface DataSchoolMapper extends BaseMapper {
18 | @Select("select distinct(province_id) from data_school")
19 | List selectProvincIdDistinct();
20 | }
21 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/config/ribbon/RibbonRuleConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.config.ribbon;
2 |
3 | import com.netflix.loadbalancer.IRule;
4 | import com.netflix.loadbalancer.RandomRule;
5 | import com.netflix.loadbalancer.ZoneAvoidanceRule;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | /**
10 | * @author xwj
11 | * 全局ribbon负载均衡配置
12 | */
13 | @Configuration
14 | public class RibbonRuleConfig {
15 | @Bean
16 | public IRule ribbonRule() {
17 | return new ZoneAvoidanceRule();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/exception/CustomException.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.exception;
2 |
3 | import com.cwj.express.common.model.response.ResultCode;
4 |
5 | /**
6 | * 自定义异常类型
7 | * @author Administrator
8 | * @version 1.0
9 | * @create 2018-09-14 17:28
10 | **/
11 | public class CustomException extends RuntimeException {
12 |
13 | //错误代码
14 | ResultCode resultCode;
15 |
16 | public CustomException(ResultCode resultCode){
17 | this.resultCode = resultCode;
18 | }
19 | public ResultCode getResultCode(){
20 | return resultCode;
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/auth/AuthConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.auth;
2 |
3 | import lombok.Data;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author chenwenjie
9 | */
10 | @Data
11 | @Component
12 | @ConfigurationProperties(prefix = "auth")
13 | public class AuthConfig {
14 | private Integer tokenValiditySeconds;
15 |
16 | private String clientId;
17 |
18 | private String clientSecret;
19 |
20 | private String cookieDomain;
21 |
22 | private Integer cookieMaxAge;
23 | }
24 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/EchartCalendarPieItemVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | /**
9 | * 分析图表数据结构
10 | * (因为前端有序)无序Map>
11 | * List
12 | * VO 成员变量 name 和 value
13 | */
14 |
15 | @Builder
16 | @Data
17 | @NoArgsConstructor
18 | @AllArgsConstructor
19 | public class EchartCalendarPieItemVO {
20 | /**
21 | * 类型名称
22 | */
23 | private String name;
24 |
25 | /**
26 | * 类型值
27 | */
28 | private Integer value;
29 | }
30 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/UserEvaluateMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/PaymentTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | /**
7 | * 支付方式枚举
8 | */
9 | @Getter
10 | public enum PaymentTypeEnum implements IEnum {
11 | /**
12 | * 支付宝支付
13 | */
14 | AliPay(1, "支付宝");
15 |
16 | private int type;
17 |
18 | private String name;
19 |
20 | PaymentTypeEnum(int type, String name) {
21 | this.type = type;
22 | this.name = name;
23 | }
24 |
25 | @Override
26 | public Integer getValue() {
27 | return this.type;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/service/DataSchoolService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.service;
2 |
3 | import com.cwj.express.domain.area.DataSchool;
4 |
5 | import java.util.List;
6 |
7 | public interface DataSchoolService{
8 | // boolean isExist(Integer id);
9 |
10 | /**
11 | * 根据行政id查询对应区的学校信息列表
12 | */
13 | List getListByProvinceId(Integer provinceId);
14 |
15 | /**
16 | * 获取学校行政区id (province_id)
17 | */
18 | List selectProvincIdDistinct();
19 |
20 | /**
21 | * 根据id获取学校信息
22 | */
23 | DataSchool getById(String id);
24 |
25 | List getAllSchool();
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/CourierSignDataMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/UserEvaluateEventLogMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/css/express.css:
--------------------------------------------------------------------------------
1 | .ml10 {
2 | margin-left: 10px;
3 | }
4 | .mt10 {
5 | margin-top: 10px;
6 | }
7 | .mb10 {
8 | margin-bottom: 10px;
9 | }
10 | .pt10 {
11 | padding-top: 10px;
12 | }
13 |
14 | .dis_change_textarea{
15 | resize:none;
16 | }
17 |
18 | .pay-qrcode {
19 | width: 200px;
20 | height: 200px;
21 | }
22 |
23 | .red-color {
24 | color:red;
25 | }
26 |
27 | /* jquery validate 验证 */
28 | input.error { border: 1px solid red; }
29 | textarea.error { border: 1px solid red; }
30 | label.error {
31 | padding-left: 16px;
32 |
33 | padding-bottom: 2px;
34 |
35 | font-weight: bold;
36 |
37 | color: #EA5200;
38 | }
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/exception/DefaultAuthException.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.exception;
2 |
3 |
4 | import com.cwj.express.common.enums.ResponseErrorCodeEnum;
5 | import org.springframework.security.core.AuthenticationException;
6 |
7 | /**
8 | * 自定义鉴权异常
9 | */
10 | public class DefaultAuthException extends AuthenticationException {
11 | public DefaultAuthException(String msg, Throwable t) {
12 | super(msg, t);
13 | }
14 |
15 | public DefaultAuthException(String msg) {
16 | super(msg);
17 | }
18 |
19 | public DefaultAuthException(ResponseErrorCodeEnum codeEnum) {
20 | super(codeEnum.getMsg());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderChartParamVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import io.swagger.annotations.ApiModelProperty;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | @Data
10 | @NoArgsConstructor
11 | @AllArgsConstructor
12 | @Builder
13 | public class OrderChartParamVO {
14 |
15 | @ApiModelProperty(value = "配送员id 空则搜索全部")
16 | private String courierId;
17 |
18 | @ApiModelProperty(value = "查询开始时间", required = true)
19 | private String startDate;
20 |
21 | @ApiModelProperty(value = "查询结束时间", required = true)
22 | private String endDate;
23 | }
24 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/css/express.css:
--------------------------------------------------------------------------------
1 | .ml10 {
2 | margin-left: 10px;
3 | }
4 | .mt10 {
5 | margin-top: 10px;
6 | }
7 | .mb10 {
8 | margin-bottom: 10px;
9 | }
10 | .pt10 {
11 | padding-top: 10px;
12 | }
13 |
14 | .dis_change_textarea{
15 | resize:none;
16 | }
17 |
18 | .pay-qrcode {
19 | width: 200px;
20 | height: 200px;
21 | }
22 |
23 | .red-color {
24 | color:red;
25 | }
26 |
27 | /* jquery validate 验证 */
28 | input.error { border: 1px solid red; }
29 | textarea.error { border: 1px solid red; }
30 | label.error {
31 | padding-left: 16px;
32 |
33 | padding-bottom: 2px;
34 |
35 | font-weight: bold;
36 |
37 | color: #EA5200;
38 | }
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/UserEvaluateService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 | import com.cwj.express.domain.ucenter.UserEvaluate;
4 |
5 | import java.math.BigDecimal;
6 |
7 | /**
8 | * @author cwj
9 | * 用户(被)评分信息
10 | */
11 | public interface UserEvaluateService {
12 |
13 | /**
14 | * 根据用户id获取评分信息
15 | * @param id 用户id
16 | * @return 评分信息
17 | */
18 | public UserEvaluate getScoreById(String id);
19 |
20 | /**
21 | * 更新用户分数和被评价数量
22 | * @param userId 用户id
23 | * @param score 分数
24 | * @param logId 日志id
25 | */
26 | public void updateScoreAndCount(String userId, BigDecimal score, String logId);
27 | }
28 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/DataAreaLevelEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | /**
7 | * 地理级别枚举
8 | */
9 | @Getter
10 | public enum DataAreaLevelEnum implements IEnum {
11 | PROVINCE(1, "省/直辖市"),
12 | CITY(2, "地级市"),
13 | COUNTY(3, "区县"),
14 | TOWN(4, "镇/街");
15 |
16 | private int level;
17 |
18 | private String name;
19 |
20 | DataAreaLevelEnum(int level, String name) {
21 | this.level = level;
22 | this.name = name;
23 | }
24 |
25 | @Override
26 | public Integer getValue() {
27 | return this.level;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/DayCode.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | import org.n3r.idworker.strategy.DayPrefixRandomCodeStrategy;
4 |
5 | public class DayCode {
6 | static RandomCodeStrategy strategy;
7 |
8 | static {
9 | DayPrefixRandomCodeStrategy dayPrefixCodeStrategy = new DayPrefixRandomCodeStrategy("yyMM");
10 | dayPrefixCodeStrategy.setMinRandomSize(7);
11 | dayPrefixCodeStrategy.setMaxRandomSize(7);
12 | strategy = dayPrefixCodeStrategy;
13 | strategy.init();
14 | }
15 |
16 | public static synchronized String next() {
17 | return String.format("%d-%04d-%07d", Id.getWorkerId(), strategy.prefix(), strategy.next());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/constant/RedisKeyConstant.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.constant;
2 |
3 | /**
4 | * Redis key 相关常量
5 | * @date 2019年04月20日 18:57
6 | */
7 | public class RedisKeyConstant {
8 | /**
9 | * OAuth鉴权时状态
10 | */
11 | public static String OAUTH_STATE = "OAUTH_STATE";
12 | /**
13 | * 快递公司列表
14 | */
15 | public static String DATA_COMPANY = "DATA_COMPANY";
16 | /**
17 | * 用户信息
18 | */
19 | public static String SYS_USER = "SYS_USER";
20 | /**
21 | * 高校信息
22 | */
23 | public static String DATA_SCHOOL = "DATA_SCHOOL";
24 | /**
25 | * 最后设置的人脸数据face_token
26 | */
27 | public static String LAST_FACE_TOKEN = "LAST_FACE_TOKEN";
28 | }
29 |
--------------------------------------------------------------------------------
/express-area/src/main/resources/mapping/DataSchoolMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/express-order/src/test/java/TimeTest.java:
--------------------------------------------------------------------------------
1 | import com.cwj.express.utils.LocalDateTimeUtils;
2 |
3 | import java.time.LocalDateTime;
4 | import java.time.format.DateTimeFormatter;
5 |
6 | public class TimeTest {
7 |
8 | public static void main(String[] args) {
9 | for (int i = 0; i < 100000; i++){
10 | LocalDateTime now = LocalDateTime.now();
11 | String timeString = LocalDateTimeUtils.formatToYMDHMS(now);
12 | LocalDateTime old = LocalDateTimeUtils.ymdhmsParseToLocalDataTime(timeString);
13 | if (!now.isEqual(old)){
14 | System.out.println("***** " + i);
15 | System.out.println(now);
16 | System.out.println(timeString);
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/CourierLeaveLogMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/CourierSignCountMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/CourierLeaveStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.*;
5 |
6 | /**
7 | *
8 | * 配送员请假日志对象
9 | *
10 | *
11 | * @author chenwenjie
12 | * @since 2019-11-21
13 | */
14 | @Getter
15 | public enum CourierLeaveStatusEnum implements IEnum {
16 |
17 | LEAVING(1, "请假中"),
18 | RETURNED(0, "已回岗位")
19 | ;
20 |
21 | private int status;
22 |
23 | private String cname;
24 |
25 | CourierLeaveStatusEnum(int status, String cname) {
26 | this.status = status;
27 | this.cname = cname;
28 | }
29 |
30 | @Override
31 | public Integer getValue() {
32 | return status;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/SysRolesLevelMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/auth/AuthControllerApi.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.auth;
2 |
3 | import com.cwj.express.common.model.response.ResponseResult;
4 | import com.cwj.express.domain.auth.request.LoginRequest;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import io.swagger.annotations.Api;
7 | import io.swagger.annotations.ApiOperation;
8 |
9 | import javax.security.auth.message.AuthException;
10 |
11 | /**
12 | * @author cwj
13 | */
14 | @Api(value="用户认证相关api",tags = "用户认证controller")
15 | public interface AuthControllerApi {
16 |
17 | @ApiOperation("用户名登录(暂时不要验证码)")
18 | public ResponseResult userLogin(LoginRequest loginRequest) throws AuthException;
19 |
20 | @ApiOperation("发送短信验证码接口-登录用")
21 | public ResponseResult LoginSendSms(LoginRequest loginRequest);
22 | }
23 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderEvaluateVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import com.cwj.express.domain.order.OrderEvaluate;
4 | import io.swagger.annotations.ApiModel;
5 | import io.swagger.annotations.ApiModelProperty;
6 | import lombok.AllArgsConstructor;
7 | import lombok.Builder;
8 | import lombok.Data;
9 | import lombok.NoArgsConstructor;
10 |
11 | import java.util.List;
12 |
13 | @Data
14 | @NoArgsConstructor
15 | @AllArgsConstructor
16 | @Builder
17 | @ApiModel(value="订单评价VO")
18 | public class OrderEvaluateVO {
19 |
20 | @ApiModelProperty(value = "收件人")
21 | private Long current;
22 |
23 | @ApiModelProperty(value = "分页总数量")
24 | private Long page;
25 |
26 | @ApiModelProperty(value = "评价信息列表")
27 | private List record;
28 | }
29 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/com/cwj/express/utils/BCryptUtil.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.utils;
2 |
3 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
4 | import org.springframework.security.crypto.password.PasswordEncoder;
5 |
6 | /**
7 | * Created by mrt on 2018/5/22.
8 | */
9 | public class BCryptUtil {
10 | public static String encode(String password){
11 | PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
12 | String hashPass = passwordEncoder.encode(password);
13 | return hashPass;
14 | }
15 | public static boolean matches(String password,String hashPass){
16 | PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
17 | boolean f = passwordEncoder.matches(password, hashPass);
18 | return f;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/FaceService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service;
2 |
3 | import com.cwj.express.common.model.response.ResponseResult;
4 |
5 | /**
6 | * 人脸识别业务接口
7 | * @author cwj
8 | */
9 | public interface FaceService {
10 | /**
11 | * 人脸检测
12 | * @param isQuality 是否开启质量校验
13 | */
14 | ResponseResult faceDetectByBase64(String image, boolean isQuality);
15 | /**
16 | * 人脸注册
17 | * 注:先调用人脸检测,开启质量校验
18 | */
19 | ResponseResult faceRegistryByFaceToken(String faceToken, String userId);
20 | /**
21 | * 人脸搜索
22 | */
23 | ResponseResult faceSearchByBase64(String image);
24 | /**
25 | * 人脸更新
26 | * 注:先调用人脸检测,开启质量校验
27 | */
28 | ResponseResult faceUpdateByFaceToken(String faceToken, String userId);
29 | }
30 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/rocketmq/MessageDelayLevel.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums.rocketmq;
2 |
3 | /**
4 | * @author cwj
5 | * rockmq延迟消息等级
6 | */
7 | public enum MessageDelayLevel {
8 |
9 | TIME_1S(1),
10 | TIME_5S(2),
11 | TIME_10S(3),
12 | TIME_30S(4),
13 | TIME_1M(5),
14 | TIME_2M(6),
15 | TIME_3M(7),
16 | TIME_4M(8),
17 | TIME_5M(9),
18 | TIME_6M(10),
19 | TIME_7M(11),
20 | TIME_8M(12),
21 | TIME_9M(13),
22 | TIME_10M(14),
23 | TIME_20M(15),
24 | TIME_30M(16),
25 | TIME_1H(17),
26 | TIME_2H(18),
27 | // 新增延迟类型需要在broker配置增加messageDelayLevel
28 | TIME_6H(19),
29 | TIME_12H(20);
30 |
31 | public int level;
32 |
33 | MessageDelayLevel(int level) {
34 | this.level = level;
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/web/BaseController.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.web;
2 |
3 | import org.springframework.web.bind.annotation.ModelAttribute;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpServletResponse;
7 | import javax.servlet.http.HttpSession;
8 |
9 | /**
10 | * Created by mrt on 2018/5/22.
11 | */
12 | public class BaseController {
13 | protected HttpServletRequest request;
14 |
15 | protected HttpServletResponse response;
16 |
17 | protected HttpSession session;
18 |
19 | @ModelAttribute
20 | public void setReqAndRes(HttpServletRequest request, HttpServletResponse response) {
21 |
22 | this.request = request;
23 |
24 | this.response = response;
25 |
26 | this.session = request.getSession();
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/ucenter/UserFeedbackVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.ucenter;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.*;
6 | import lombok.experimental.Accessors;
7 |
8 | import java.io.Serializable;
9 |
10 | @Builder
11 | @Data
12 | @NoArgsConstructor
13 | @AllArgsConstructor
14 | @EqualsAndHashCode(callSuper = false)
15 | @Accessors(chain = true)
16 | @ApiModel(value="仪表盘订单反馈信息对象", description="包含正在处理和未处理的反馈数量")
17 | public class UserFeedbackVO implements Serializable {
18 |
19 | @ApiModelProperty(value = "正在处理的反馈数量")
20 | private int processCount;
21 |
22 | @ApiModelProperty(value = "等待处理的反馈数量")
23 | private int waitCount;
24 |
25 | @ApiModelProperty(value = "已经完成的反馈数量")
26 | private int finishedCount;
27 |
28 |
29 | }
--------------------------------------------------------------------------------
/express-utils/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | express-parent
7 | com.cwj.express
8 | 1.0-SNAPSHOT
9 |
10 | 4.0.0
11 |
12 | express-utils
13 | express-utils
14 |
15 |
16 |
17 | com.cwj.express
18 | express-model
19 | 1.0-SNAPSHOT
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/js/bootstrap-table-zh-CN.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * bootstrap-table - v1.12.1 - 2018-03-12
3 | * https://github.com/wenzhixin/bootstrap-table
4 | * Copyright (c) 2018 zhixin wen
5 | * Licensed MIT License
6 | */
7 | !function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery);
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/OrderDeleteEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | /**
7 | * 订单删除类型枚举
8 | */
9 | @Getter
10 | public enum OrderDeleteEnum implements IEnum {
11 | /**
12 | * 没有被删除
13 | */
14 | NONE("没被删除", 0),
15 |
16 | /**
17 | * 订单撤销
18 | */
19 | CANCEL("订单撤销", 1),
20 | /**
21 | * 手动删除
22 | */
23 | MANUAL("手动删除", 2),
24 | /**
25 | * 系统删除
26 | */
27 | SYSTEM("系统删除", 3);
28 |
29 | private String name;
30 | private int type;
31 |
32 | OrderDeleteEnum(String name, int type) {
33 | this.name = name;
34 | this.type = type;
35 | }
36 |
37 | @Override
38 | public Integer getValue() {
39 | return this.type;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/js/bootstrap-table-zh-CN.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * bootstrap-table - v1.12.1 - 2018-03-12
3 | * https://github.com/wenzhixin/bootstrap-table
4 | * Copyright (c) 2018 zhixin wen
5 | * Licensed MIT License
6 | */
7 | !function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery);
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/UpdateOrderVo.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import com.cwj.express.common.enums.OrderStatusEnum;
4 | import com.cwj.express.common.enums.PaymentStatusEnum;
5 | import lombok.*;
6 | import lombok.experimental.Accessors;
7 |
8 | /**
9 | * @author cwj
10 | * 更新订单、订单支付信息对象
11 | */
12 | @Data
13 | @EqualsAndHashCode(callSuper = false)
14 | @Accessors(chain = true)
15 | @Builder
16 | @NoArgsConstructor
17 | @AllArgsConstructor
18 | public class UpdateOrderVo {
19 | /**
20 | * 订单号
21 | */
22 | private String orderId;
23 |
24 | /**
25 | * 支付宝返回的支付订单号(流水号)
26 | */
27 | private String trade_no;
28 |
29 | /**
30 | * 支付状态
31 | */
32 | private PaymentStatusEnum paymentStatusEnum;
33 |
34 | /**
35 | * 订单状态
36 | */
37 | private OrderStatusEnum orderStatusEnum;
38 | }
39 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/area/DataCompany.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.area;
2 |
3 | import java.io.Serializable;
4 | import io.swagger.annotations.ApiModel;
5 | import io.swagger.annotations.ApiModelProperty;
6 | import lombok.*;
7 | import lombok.experimental.Accessors;
8 |
9 | /**
10 | *
11 | * 快递公司数据表
12 | *
13 | *
14 | * @author chenwenjie
15 | * @since 2019-10-30
16 | */
17 | @Builder
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | @Data
21 | @EqualsAndHashCode(callSuper = false)
22 | @Accessors(chain = true)
23 | @ApiModel(value="DataCompany对象", description="快递公司数据表")
24 | public class DataCompany implements Serializable {
25 |
26 |
27 | private Integer id;
28 |
29 | @ApiModelProperty(value = "快递公司名")
30 | private String name;
31 |
32 | @ApiModelProperty(value = "快递公司代号")
33 | private String code;
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/FeedbackTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 反馈类型枚举
10 | */
11 | @Getter
12 | public enum FeedbackTypeEnum implements IEnum {
13 | ORDER(1, "订单反馈"),
14 | OPINION(2, "意见反馈"),
15 | BUG(3, "BUG反馈");
16 |
17 | private int type;
18 |
19 | private String name;
20 |
21 | FeedbackTypeEnum(int type, String name) {
22 | this.type = type;
23 | this.name = name;
24 | }
25 |
26 | @Override
27 | public Integer getValue() {
28 | return this.type;
29 | }
30 |
31 | public static FeedbackTypeEnum getByType(int type) {
32 | return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/UserFeedbackService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 | import com.cwj.express.common.enums.FeedbackStatusEnum;
4 | import com.cwj.express.vo.ucenter.UserFeedbackVO;
5 |
6 | import java.time.LocalDate;
7 |
8 | /**
9 | *
10 | * 用户反馈业务
11 | *
12 | *
13 | * @author chenwenjie
14 | * @since 2019-11-26
15 | */
16 | public interface UserFeedbackService{
17 | /**
18 | * 获取仪表盘用户部分反馈数量信息
19 | * @param userId 用户id
20 | * @return 用户反馈数量信息
21 | */
22 | public UserFeedbackVO getUserDashboardData(String userId);
23 |
24 | /**
25 | * 根据日期查找未处理的反馈数量
26 | * @param feedbackStatusEnum 类型枚举
27 | * @param start 开始日期
28 | * @param end 结束日期
29 | */
30 | public Integer getCountByStatusAndDate(FeedbackStatusEnum feedbackStatusEnum, LocalDate start, LocalDate end);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/ThirdLoginTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 角色枚举
10 | * @date 2019年04月17日 0:11
11 | */
12 | @Getter
13 | public enum ThirdLoginTypeEnum implements IEnum {
14 | NONE(0, "未绑定"),
15 | QQ(1, "QQ登陆");
16 |
17 | private int type;
18 |
19 | private String name;
20 |
21 | ThirdLoginTypeEnum(int type, String name) {
22 | this.type = type;
23 | this.name = name;
24 | }
25 |
26 | @Override
27 | public Integer getValue() {
28 | return this.type;
29 | }
30 |
31 | public static ThirdLoginTypeEnum getByType(Integer type) {
32 | return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/SysUserService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 |
5 | /**
6 | * @author chenwenjie
7 | */
8 | public interface SysUserService {
9 | /**
10 | * 根据用户名获取用户信息
11 | * @param username 用户名
12 | * @return 用户id和角色信息
13 | */
14 | public SysUser getExtByUserName(String username);
15 |
16 | /**
17 | * 根据手机号查询用户信息
18 | * @param tel 电话号码
19 | * @return 用户信息
20 | */
21 | public SysUser getExtByTel(String tel);
22 |
23 | /**
24 | * 根据用户id获取用户西南西
25 | * @param id 用户id
26 | * @return 用户信息
27 | */
28 | public SysUser getById(String id);
29 |
30 | /**
31 | * 判断电话号码是否注册
32 | * @param phoneNum 手机号
33 | * @return true:已注册 false:未注册
34 | */
35 | public boolean phoneNumExist(String phoneNum);
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/service/RedisService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.service;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * redis操作Service,
7 | * 对象和数组都以json形式进行存储
8 | * @author cwj
9 | */
10 | public interface RedisService {
11 | /**
12 | * 存储数据
13 | */
14 | void set(String key, String value);
15 |
16 | public void setList(String key, List list);
17 |
18 | /**
19 | * 获取数据
20 | */
21 | String get(String key);
22 |
23 | /**
24 | * 设置过期时间的键值对
25 | */
26 | boolean setKeyValTTL(String key, String value, long ttl);
27 |
28 | /**
29 | * 设置超期时间
30 | */
31 | boolean expire(String key, long expire);
32 |
33 | /**
34 | * 删除数据
35 | */
36 | void remove(String key);
37 |
38 | /**
39 | * 自增操作
40 | * @param delta 自增步长
41 | */
42 | Long increment(String key, long delta);
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/RedisService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * redis操作Service,
7 | * 对象和数组都以json形式进行存储
8 | * @author cwj
9 | */
10 | public interface RedisService {
11 | /**
12 | * 存储数据
13 | */
14 | void set(String key, String value);
15 |
16 | public void setList(String key, List list);
17 |
18 | /**
19 | * 获取数据
20 | */
21 | String get(String key);
22 |
23 | /**
24 | * 设置过期时间的键值对
25 | */
26 | boolean setKeyValTTL(String key,String value,long ttl);
27 |
28 | /**
29 | * 设置超期时间
30 | */
31 | boolean expire(String key, long expire);
32 |
33 | /**
34 | * 删除数据
35 | */
36 | void remove(String key);
37 |
38 | /**
39 | * 自增操作
40 | * @param delta 自增步长
41 | */
42 | Long increment(String key, long delta);
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/constant/SessionKeyConstant.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.constant;
2 |
3 | /**
4 | * Session key 相关常量
5 | * @date 2019年04月20日 18:57
6 | */
7 | public class SessionKeyConstant {
8 | /**
9 | * 发送短信验证码的手机号
10 | */
11 | public static String SMS_TEL = "SMS_TEL";
12 | /**
13 | * 短信验证码
14 | */
15 | public static String SMS_CODE = "SMS_CODE";
16 | /**
17 | * 发送短信验证码的时间
18 | */
19 | public static String SMS_TIMESTAMP = "SMS_TIMESTAMP";
20 | /**
21 | * 最新订单数据
22 | */
23 | public static String SESSION_LATEST_EXPRESS = "SESSION_LATEST_EXPRESS";
24 | /**
25 | * 最新支付数据
26 | */
27 | public static String SESSION_LATEST_PAYMENT = "SESSION_LATEST_PAYMENT";
28 | /**
29 | * 人脸注册校验通过后暂存的face_token
30 | */
31 | public static String REGISTER_FACE_TOKEN = "REGISTER_FACE_TOKEN";
32 | }
33 |
--------------------------------------------------------------------------------
/express-order/src/main/resources/lua/distribution.lua:
--------------------------------------------------------------------------------
1 | --- 学校所属id
2 | local school_id = KEYS[1]
3 | --- 订单id
4 | local order_id = KEYS[2]
5 | --- 有效时间
6 | local expire = ARGV[1]
7 |
8 | --- 获取分数最高配送员
9 | local res_courier_id = redis.call("ZREVRANGE", school_id, 0, 0)
10 | --- 不为空再执行
11 | if res_courier_id then
12 | --- 扣除该配送员10分
13 | if redis.call("ZINCRBY", school_id , "-10", res_courier_id[1]) then
14 | --- 记录日志,记录成功再设置过期时间
15 | if redis.call("set", order_id, res_courier_id[1]) then
16 | --- 需要类型转换才能比较
17 | if tonumber(expire) > 0 then
18 | redis.call("expire", order_id, expire)
19 | end
20 | end
21 | end
22 | end
23 | return res_courier_id
24 | --- 客户端执行: redis-cli -a 123456 --eval distribution.lua qid1 , orderid 600
25 | --- eval "local a=redis.call('hget','lme0225','margin1') local b=1 repeat b=b+1 until(b>100000000000000) return a" 0 (死循环)
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/FeedbackStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 反馈状态枚举
10 | */
11 | @Getter
12 | public enum FeedbackStatusEnum implements IEnum {
13 | WAIT(1, "等待处理"),
14 | PROCESS(2, "处理中"),
15 | COMPLETE(3, "处理完毕");
16 |
17 | private int status;
18 |
19 | private String name;
20 |
21 | FeedbackStatusEnum(int status, String name) {
22 | this.status = status;
23 | this.name = name;
24 | }
25 |
26 | @Override
27 | public Integer getValue() {
28 | return this.status;
29 | }
30 |
31 | public static FeedbackStatusEnum getByStatus(int status) {
32 | return Arrays.stream(values()).filter(e -> e.getStatus() == status).findFirst().orElse(null);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/config/lua/LuaConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.config.lua;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.core.io.ClassPathResource;
6 | import org.springframework.data.redis.core.script.DefaultRedisScript;
7 | import org.springframework.scripting.support.ResourceScriptSource;
8 |
9 | /**
10 | * lua脚本配置类
11 | * todo 还没进行测试
12 | */
13 |
14 | @Configuration
15 | public class LuaConfiguration {
16 | @Bean
17 | public DefaultRedisScript redisScript() {
18 | DefaultRedisScript redisScript = new DefaultRedisScript<>();
19 | redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("lua/distribution.lua")));
20 | redisScript.setResultType(String.class);
21 | return redisScript;
22 | }
23 | }
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/dao/UserEvaluateMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.dao;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.cwj.express.domain.ucenter.UserEvaluate;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.apache.ibatis.annotations.Update;
7 |
8 | import java.math.BigDecimal;
9 |
10 | /**
11 | *
12 | * 用户评分表 Mapper 接口
13 | *
14 | *
15 | * @author chenwenjie
16 | * @since 2019-11-02
17 | */
18 | public interface UserEvaluateMapper extends BaseMapper {
19 | @Update("update user_evaluate set score = (score + #{score}) where user_id = #{userId}")
20 | public void updateScore(@Param("userId") String userId, @Param("score") BigDecimal score);
21 |
22 | @Update("update user_evaluate set count = count + 1 where user_id = #{userId}")
23 | public void updateCount(@Param("userId") String userId);
24 | }
25 |
--------------------------------------------------------------------------------
/express-area/src/main/resources/mapping/DataAreaMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/Id.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | import org.n3r.idworker.strategy.DefaultWorkerIdStrategy;
4 |
5 | public class Id {
6 | private static WorkerIdStrategy workerIdStrategy;
7 | private static IdWorker idWorker;
8 |
9 | static {
10 | configure(DefaultWorkerIdStrategy.instance);
11 | }
12 |
13 | public static synchronized void configure(WorkerIdStrategy custom) {
14 | if (workerIdStrategy == custom) return;
15 |
16 | if (workerIdStrategy != null) workerIdStrategy.release();
17 | workerIdStrategy = custom;
18 | workerIdStrategy.initialize();
19 | idWorker = new IdWorker(workerIdStrategy.availableWorkerId());
20 | }
21 |
22 | public static long next() {
23 | return idWorker.nextId();
24 | }
25 |
26 | public static long getWorkerId() {
27 | return idWorker.getWorkerId();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/auth/request/LoginRequest.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.auth.request;
2 |
3 | import lombok.*;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by admin on 2018/3/5.
9 | */
10 | @Data
11 | @NoArgsConstructor
12 | @AllArgsConstructor
13 | @Builder
14 | public class LoginRequest implements Serializable {
15 |
16 | /**
17 | * 用户名
18 | */
19 | String username;
20 |
21 | /**
22 | * 密码
23 | */
24 | String password;
25 |
26 | /**
27 | * 认证类型
28 | * - password: 账号密码 - phone: 短信 - face: 人脸
29 | */
30 | String authType;
31 |
32 | /**
33 | * 人脸数据
34 | */
35 | String faceDate;
36 |
37 | /**
38 | * 手机号
39 | */
40 | String phoneNum;
41 |
42 | /**
43 | * 短信验证码
44 | */
45 | String phoneCode;
46 |
47 | /**
48 | * 目前没什么用
49 | */
50 | String verifycode;
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/css/completeInfo.css:
--------------------------------------------------------------------------------
1 | .main{
2 | width: 30vw;
3 | min-height:40vh;
4 | margin: 5vh auto;
5 | background-color: white;
6 | padding: 20px;
7 | border-radius: 7px;
8 | }
9 | .container{
10 | width: 100%;
11 | height: 100vh;
12 | background: #2848af url("../img/index1.png")right top no-repeat;
13 | background-size: cover;
14 | /*font-size: 1rem;*/
15 | text-align: center;
16 | vertical-align: middle;
17 | }
18 | .tab-content{
19 | margin-top: 5vh;
20 | text-align: left;
21 | }
22 | .title{
23 | margin-top: 15vh;
24 | color: white;
25 | }
26 |
27 |
28 | @media only screen and (max-width: 800px){
29 | html{
30 | font-size: 10px;
31 | }
32 | .main{
33 | width: 80vw;
34 | min-height:40vh;
35 | margin: 5vh auto;
36 | background-color: white;
37 | padding: 20px;
38 | border-radius: 7px;
39 | }
40 | }
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/OrderTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 订单状态枚举
10 | */
11 | @Getter
12 | public enum OrderTypeEnum implements IEnum {
13 | /**
14 | * 上门取件
15 | */
16 | PICK_UP("上门取件", 1),
17 |
18 | /**
19 | * 代拿快递
20 | */
21 | TRANSPORT("送件上门", 0);
22 |
23 | private String desc;
24 | private int type;
25 |
26 | OrderTypeEnum(String desc, int status) {
27 | this.desc = desc;
28 | this.type = status;
29 | }
30 |
31 | public static OrderTypeEnum getByType(Integer type) {
32 | return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
33 | }
34 |
35 | @Override
36 | public Integer getValue() {
37 | return this.type;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/express-order/src/main/resources/mapping/OrderPaymentMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/css/completeInfo.css:
--------------------------------------------------------------------------------
1 | .main{
2 | width: 30vw;
3 | min-height:40vh;
4 | margin: 5vh auto;
5 | background-color: white;
6 | padding: 20px;
7 | border-radius: 7px;
8 | }
9 | .container{
10 | width: 100%;
11 | height: 100vh;
12 | background: #2848af url("../img/index1.png")right top no-repeat;
13 | background-size: cover;
14 | /*font-size: 1rem;*/
15 | text-align: center;
16 | vertical-align: middle;
17 | }
18 | .tab-content{
19 | margin-top: 5vh;
20 | text-align: left;
21 | }
22 | .title{
23 | margin-top: 15vh;
24 | color: white;
25 | }
26 |
27 |
28 | @media only screen and (max-width: 800px){
29 | html{
30 | font-size: 10px;
31 | }
32 | .main{
33 | width: 80vw;
34 | min-height:40vh;
35 | margin: 5vh auto;
36 | background-color: white;
37 | padding: 20px;
38 | border-radius: 7px;
39 | }
40 | }
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/order/EchartOrderControllerApi.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.order;
2 |
3 | import com.cwj.express.common.model.response.ResponseResult;
4 | import com.cwj.express.vo.order.OrderChartParamVO;
5 | import io.swagger.annotations.Api;
6 | import io.swagger.annotations.ApiOperation;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 |
9 | @Api(value="获取前端图表需要的订单信息",tags = "订单图表信息controller")
10 | public interface EchartOrderControllerApi {
11 |
12 | @ApiOperation("管理员获取根据查询参数获取时间内【各天】的收/取/异件数量")
13 | public ResponseResult getOrderChartByParam(OrderChartParamVO orderChartParamVO);
14 |
15 | @ApiOperation("管理员获取根据查询参数获取时间内【所有】的收/取/异件数量")
16 | public ResponseResult getOrderCountByParam(OrderChartParamVO orderChartParamVO);
17 |
18 | @ApiOperation("获取配送员排行榜(包括工资,工资计算暂时是硬编码)")
19 | public ResponseResult getCourierRankList(@RequestParam String startTime, @RequestParam String endTime);
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/dao/OrderInfoMapper.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.dao;
2 |
3 | import com.cwj.express.domain.order.OrderInfo;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 | import com.cwj.express.vo.order.CourierRankVO;
6 | import org.apache.ibatis.annotations.Param;
7 | import org.apache.ibatis.annotations.Select;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | *
13 | * 订单信息表 Mapper 接口
14 | *
15 | *
16 | * @author chenwenjie
17 | * @since 2019-11-02
18 | */
19 | public interface OrderInfoMapper extends BaseMapper {
20 |
21 | /**
22 | * @author 森七柚子茶
23 | * @return 配送员id、完成单数,从大到小
24 | */
25 | @Select("select courier_id,count(courier_id) sum from order_info where (status='3') and (update_date between #{startTime} and #{endTime} ) group by courier_id order by sum")
26 | List selectCourierRank(@Param("startTime") String startTime, @Param("endTime") String endTime);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/config/sentinel/MyUrlCleaner.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.config.sentinel;
2 |
3 | import com.alibaba.csp.sentinel.adapter.servlet.callback.UrlCleaner;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.commons.lang.math.NumberUtils;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.Arrays;
9 |
10 | @Component
11 | @Slf4j
12 | public class MyUrlCleaner implements UrlCleaner {
13 | @Override
14 | public String clean(String originUrl) {
15 | // 让 /xxx/1 与 /xxx/2 的返回值相同
16 | // 返回/xxx/{number}
17 |
18 | String[] split = originUrl.split("/");
19 |
20 | return Arrays.stream(split)
21 | .map(string -> {
22 | if (NumberUtils.isNumber(string)) {
23 | return "{number}";
24 | }
25 | return string;
26 | })
27 | .reduce((a, b) -> a + "/" + b)
28 | .orElse("");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/mapping/UserFeedbackMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/config/rocket/RocketmqConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.config.rocket;
2 |
3 | import lombok.Getter;
4 | import lombok.ToString;
5 |
6 | /**
7 | * 本项目 rocketmq 的 destination 和 group 配置
8 | */
9 | @Getter
10 | @ToString
11 | public class RocketmqConfig {
12 | /**
13 | * 配置订阅、发布主题
14 | */
15 | public static final String CANCEL_ORDER_TOPIC = "CANCEL_ORDER_TOPIC";
16 | public static final String DISTRIBUTION_COURIER_TOPIC = "DISTRIBUTION_COURIER_TOPIC";
17 | public static final String EVALUATE_SCORE_TOPIC = "EVALUATE_SCORE_TOPIC";
18 |
19 | /**
20 | * 配置取消订单消息组
21 | */
22 | public static final String CANCEL_ORDER_GROUP = "CANCEL_ORDER_GROUP";
23 |
24 | /**
25 | * 配置分配配送员消息组
26 | */
27 | public static final String DISTRIBUTION_COURIER_GROUP = "DISTRIBUTION_COURIER_GROUP";
28 |
29 | /**
30 | * 订单评分消费组
31 | */
32 | public static final String EVALUATE_SCORE_GROUP = "EVALUATE_SCORE_GROUP";
33 | }
34 |
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/config/WebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.config;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
6 |
7 | /**
8 | * @author swj
9 | * 必须配置静态资源,security 放行 /public/** 才有效
10 | * 本项目因为集成了spring boot swagger,不设置成static是防止冲突
11 | */
12 | @Configuration
13 | public class WebMvcConfig extends WebMvcConfigurationSupport {
14 | /**
15 | * 配置静态资源
16 | */
17 | @Override
18 | protected void addResourceHandlers(ResourceHandlerRegistry registry) {
19 | registry.addResourceHandler("/**")
20 | //配置swagger,它是在这个目录下的
21 | .addResourceLocations("classpath:/META-INF/resources/");
22 | registry.addResourceHandler("/public/**")
23 | .addResourceLocations("classpath:/public/");
24 | super.addResourceHandlers(registry);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/feignclient/area/AreaFeignClient.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.feignclient.area;
2 |
3 | import com.cwj.express.common.constant.ExpressServiceListConstant;
4 | import com.cwj.express.domain.area.DataCompany;
5 | import com.cwj.express.domain.area.DataSchool;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 |
10 | /**
11 | * @author cwj
12 | * 订单服务调用
13 | * 提醒: fallbackFactory可以拿到异常, fallback不可以
14 | */
15 |
16 | @FeignClient(
17 | name = ExpressServiceListConstant.EXPRESS_AREA,
18 | fallbackFactory = AreaFeignClientFallbackFactory.class
19 | )
20 | public interface AreaFeignClient {
21 | @GetMapping("/area/company/{id}")
22 | public DataCompany getCompanyById(@PathVariable("id") Integer id);
23 |
24 | @GetMapping("/area/school/info/{schoolId}")
25 | public DataSchool getSchoolInfoById(@PathVariable("schoolId") String schoolId);
26 | }
27 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/ExpressOrderApplication.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.mybatis.spring.annotation.MapperScan;
5 | import org.springframework.boot.SpringApplication;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 | import org.springframework.cache.annotation.EnableCaching;
8 | import org.springframework.cloud.openfeign.EnableFeignClients;
9 | import org.springframework.context.annotation.ComponentScan;
10 |
11 | @SpringBootApplication
12 | @MapperScan(basePackages = "com.cwj.express.order.dao")
13 | @ComponentScan(basePackages = "com.cwj.express.common")
14 | @ComponentScan(basePackages = "com.cwj.express.api")
15 | @ComponentScan(basePackages = "com.cwj.express.utils")
16 | @ComponentScan(basePackages = "org.n3r.idworker")
17 | @Slf4j
18 | @EnableFeignClients
19 | @EnableCaching
20 | public class ExpressOrderApplication {
21 | public static void main(String[] args) {
22 | SpringApplication.run(ExpressOrderApplication.class, args);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/feignclient/area/AreaFeignClient.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.feignclient.area;
2 |
3 | import com.cwj.express.common.constant.ExpressServiceListConstant;
4 | import com.cwj.express.domain.area.DataCompany;
5 | import com.cwj.express.domain.area.DataSchool;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author cwj
14 | * 订单服务调用
15 | * 提醒: fallbackFactory可以拿到异常, fallback不可以
16 | */
17 |
18 | @FeignClient(
19 | name = ExpressServiceListConstant.EXPRESS_AREA,
20 | fallbackFactory = AreaFeignClientFallbackFactory.class
21 | )
22 | public interface AreaFeignClient {
23 | @GetMapping("/area/company/{id}")
24 | public DataCompany getCompanyById(@PathVariable("id") Integer id);
25 |
26 | @GetMapping("/area/school/info/{schoolId}")
27 | public DataSchool getSchoolInfoById(@PathVariable("schoolId") String schoolId);
28 | }
29 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/thirdapi/AipFaceConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.thirdapi;
2 |
3 | import com.baidu.aip.face.AipFace;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.context.annotation.DependsOn;
8 |
9 | @Configuration
10 | @DependsOn(value = "thirdApiConfig")
11 | public class AipFaceConfig {
12 | private final ThirdApiConfig thirdApiConfig;
13 |
14 | @Autowired
15 | public AipFaceConfig(ThirdApiConfig thirdApiConfig) {
16 | this.thirdApiConfig = thirdApiConfig;
17 | }
18 |
19 | @Bean
20 | public AipFace aipFace(){
21 | BaiduFaceConfig baidu = thirdApiConfig.getBaidu();
22 | AipFace aipFace = new AipFace(baidu.getAppId(), baidu.getAppKey(), baidu.getSecretKey());
23 | aipFace.setConnectionTimeoutInMillis(baidu.getConnTimeout());
24 | aipFace.setSocketTimeoutInMillis(baidu.getSocketTimeOut());
25 | return aipFace;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/controller/PageController.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.controller;
2 | import com.cwj.express.common.constant.SecurityConstant;
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import org.apache.commons.lang3.ObjectUtils;
5 | import org.springframework.security.core.annotation.AuthenticationPrincipal;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.ModelMap;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import springfox.documentation.annotations.ApiIgnore;
11 |
12 | import javax.servlet.http.HttpServletResponse;
13 | import java.io.IOException;
14 |
15 | @Controller
16 | @ApiIgnore
17 | @RequestMapping("/page")
18 | public class PageController {
19 |
20 | /**
21 | * 跳转到登录页
22 | */
23 | @GetMapping("/index")
24 | public String showAuthenticationPage(ModelMap map) {
25 | return "login";
26 | }
27 |
28 | @GetMapping("/register")
29 | public String showRegister(ModelMap map) { return "register"; }
30 | }
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/SexEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 角色枚举
10 | */
11 | @Getter
12 | public enum SexEnum implements IEnum {
13 | MALE(1, "male", "男"),
14 | FEMALE(0, "female", "女");
15 |
16 | private int type;
17 |
18 | private String name;
19 |
20 | private String cname;
21 |
22 | SexEnum(int type, String name, String cname) {
23 | this.type = type;
24 | this.name = name;
25 | this.cname = cname;
26 | }
27 |
28 | @Override
29 | public Integer getValue() {
30 | return this.type;
31 | }
32 |
33 | public static SexEnum getByType(int type) {
34 | return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
35 | }
36 |
37 | public static SexEnum getByName(String name) {
38 | return Arrays.stream(values()).filter(e -> e.getName().equalsIgnoreCase(name)).findFirst().orElse(null);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/config/alipay/AliPayConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.config.alipay;
2 |
3 | import com.alipay.api.AlipayClient;
4 | import com.alipay.api.DefaultAlipayClient;
5 | import lombok.Data;
6 | import org.springframework.beans.factory.annotation.Value;
7 | import org.springframework.boot.context.properties.ConfigurationProperties;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.stereotype.Component;
10 |
11 | /**
12 | * @author cwj
13 | */
14 |
15 | @Component
16 | @ConfigurationProperties(prefix = "alipay")
17 | @Data
18 | public class AliPayConfig {
19 | private String uid;
20 | private String appId;
21 | private String signType;
22 | private String gatewayUrl;
23 | private String merchantPrivateKey;
24 | private String alipayPublicKey;
25 | private String notifyUrl;
26 | private String returnUrl;
27 |
28 | @Bean
29 | public AlipayClient alipayClient() {
30 | return new DefaultAlipayClient(gatewayUrl, appId, merchantPrivateKey, "json", "utf-8", alipayPublicKey, signType);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/service/OrderPaymentService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.service;
2 |
3 | import com.alipay.api.AlipayApiException;
4 | import com.cwj.express.domain.order.OrderPayment;
5 | import com.cwj.express.vo.order.UpdateOrderVo;
6 |
7 | import java.util.Map;
8 |
9 | /**
10 | * 订单支付状态表
11 | */
12 | public interface OrderPaymentService {
13 |
14 |
15 | /**
16 | * 根据订单id获取支付相关信息
17 | * @param orderId 订单id
18 | * @return 支付信息
19 | */
20 | public OrderPayment getByOrderId(String orderId);
21 |
22 | /**
23 | * 校验订单(支付宝回调用)
24 | * @param params 订单参数
25 | * @return true - 校验通过 false - 校验失败
26 | */
27 | public boolean validAlipay(Map params) throws AlipayApiException;
28 |
29 | /**
30 | * 更新订单支付状态
31 | * @param updateOrderVo 订单等信息
32 | * @param userId 用户id(清除缓存)
33 | */
34 | public void updatePayment(UpdateOrderVo updateOrderVo, String userId);
35 |
36 | /**
37 | * 清除订单的配送员
38 | */
39 | public void clearOrderCourier(String orderId, String courierId, String schoolId);
40 | }
41 |
--------------------------------------------------------------------------------
/express-order/src/main/resources/mapping/OrderEvaluateMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/area/AreaControllerApi.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.area;
2 |
3 |
4 | import com.cwj.express.domain.area.DataArea;
5 | import com.cwj.express.domain.area.DataCompany;
6 | import com.cwj.express.domain.area.DataSchool;
7 | import io.swagger.annotations.Api;
8 | import io.swagger.annotations.ApiOperation;
9 | import org.springframework.web.bind.annotation.PathVariable;
10 |
11 | import java.util.List;
12 |
13 | @Api(value="获取地址相关api",tags = "地址controller")
14 | public interface AreaControllerApi {
15 |
16 | @ApiOperation("获取地址列表")
17 | public List getAreaDataByParentId(@PathVariable Integer id) throws Exception;
18 |
19 | @ApiOperation("获取所有快递公司信息列表")
20 | public List listCompany();
21 |
22 |
23 | @ApiOperation("根据id获取快递公司信息列表")
24 | public DataCompany getCompanyById(@PathVariable Integer id);
25 |
26 | @ApiOperation("根据行政id(provinceId)获取该区的学校信息列表")
27 | public List getSchoolByProvinceId(@PathVariable Integer provinceId);
28 |
29 | @ApiOperation("根据id获取学校详细信息")
30 | public DataSchool getSchoolInfoById(@PathVariable String schoolId);
31 | }
32 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/Code.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | import org.n3r.idworker.strategy.DefaultRandomCodeStrategy;
4 |
5 | public class Code {
6 | private static RandomCodeStrategy strategy;
7 |
8 | static {
9 | RandomCodeStrategy strategy = new DefaultRandomCodeStrategy();
10 | strategy.init();
11 | configure(strategy);
12 | }
13 |
14 | public static synchronized void configure(RandomCodeStrategy custom) {
15 | if (strategy == custom) return;
16 | if (strategy != null) strategy.release();
17 |
18 | strategy = custom;
19 | }
20 |
21 | /**
22 | * Next Unique code.
23 | * The max length will be 1024-Integer.MAX-Integer.MAX(2147483647) which has 4+10+10+2*1=26 characters.
24 | * The min length will be 0-0.
25 | *
26 | * @return unique string code.
27 | */
28 | public static synchronized String next() {
29 | long workerId = Id.getWorkerId();
30 | int prefix = strategy.prefix();
31 | int next = strategy.next();
32 |
33 | return String.format("%d-%03d-%06d", workerId, prefix, next);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/templates/admin/module/nav.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
25 |
26 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/area/DataSchool.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.area;
2 |
3 | import java.io.Serializable;
4 | import io.swagger.annotations.ApiModel;
5 | import io.swagger.annotations.ApiModelProperty;
6 | import lombok.*;
7 | import lombok.experimental.Accessors;
8 |
9 | /**
10 | *
11 | * 高校数据表
12 | *
13 | *
14 | * @author chenwenjie
15 | * @since 2019-10-30
16 | */
17 | @Builder
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | @Data
21 | @EqualsAndHashCode(callSuper = false)
22 | @Accessors(chain = true)
23 | @ApiModel(value="DataSchool对象", description="高校数据表")
24 | public class DataSchool implements Serializable {
25 |
26 | private static final long serialVersionUID=1L;
27 |
28 | private Integer id;
29 |
30 | @ApiModelProperty(value = "学校名称")
31 | private String name;
32 |
33 | @ApiModelProperty(value = "省份ID")
34 | private Integer provinceId;
35 |
36 | @ApiModelProperty(value = "学校级别")
37 | private String level;
38 |
39 | @ApiModelProperty(value = "学校网址")
40 | private String website;
41 |
42 | @ApiModelProperty(value = "学校简称")
43 | private String abbreviation;
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/feignclient/area/AreaFeignClientFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.feignclient.area;
2 |
3 | import com.cwj.express.domain.area.DataCompany;
4 | import com.cwj.express.domain.area.DataSchool;
5 | import feign.hystrix.FallbackFactory;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.stereotype.Component;
8 |
9 | @Component
10 | @Slf4j
11 | public class AreaFeignClientFallbackFactory implements FallbackFactory {
12 | @Override
13 | public AreaFeignClient create(Throwable throwable) {
14 | return new AreaFeignClient() {
15 | @Override
16 | public DataCompany getCompanyById(Integer id) {
17 | log.info("获取快递公司信息异常, 快递公司id:{},异常信息:{}", id, throwable.getMessage());
18 | return DataCompany.builder().name("获取快递公司信息异常!!!请联系网站管理员").build();
19 | }
20 |
21 | @Override
22 | public DataSchool getSchoolInfoById(String schoolId) {
23 | log.info("获取学校信息异常, 学校id:{},异常信息:{}", schoolId, throwable.getMessage());
24 | return null;
25 | }
26 | };
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/config/mybatis/MyBatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.config.mybatis;
2 |
3 | import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
4 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.transaction.annotation.EnableTransactionManagement;
8 |
9 | /**
10 | * @author cwj
11 | * mybatis-plus插件配置
12 | */
13 | @Configuration
14 | @EnableTransactionManagement
15 | public class MyBatisPlusConfig {
16 | /**
17 | * 分页插件
18 | */
19 | @Bean
20 | public PaginationInterceptor paginationInterceptor() {
21 | return new PaginationInterceptor();
22 | }
23 | // /**
24 | // * 逻辑删除 3.1.1 之后不再需要配置
25 | // */
26 | // @Bean
27 | // public ISqlInjector sqlInjector() {
28 | // return new LogicSqlInjector();
29 | // }
30 | /**
31 | * 乐观锁插件
32 | */
33 | @Bean
34 | public OptimisticLockerInterceptor optimisticLockerInterceptor() {
35 | return new OptimisticLockerInterceptor();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/impl/SysRolesLevelServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service.impl;
2 |
3 |
4 | import com.cwj.express.domain.ucenter.SysRolesLevel;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import com.cwj.express.ucenter.dao.SysRolesLevelMapper;
7 | import com.cwj.express.ucenter.dao.SysUserMapper;
8 | import com.cwj.express.ucenter.service.SysRolesLevelService;
9 | import com.cwj.express.ucenter.service.SysUserService;
10 | import lombok.RequiredArgsConstructor;
11 | import lombok.extern.slf4j.Slf4j;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.stereotype.Service;
14 |
15 | @Slf4j
16 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
17 | @Service
18 | public class SysRolesLevelServiceImpl implements SysRolesLevelService {
19 |
20 | private final SysUserMapper sysUserMapper;
21 | private final SysRolesLevelMapper sysRolesLevelMapper;
22 |
23 | @Override
24 | public SysRolesLevel getByUserId(String userId) {
25 | SysUser sysUser = sysUserMapper.selectById(userId);
26 | return sysRolesLevelMapper.selectById(sysUser.getRole().getType());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/feignclient/area/AreaFeignClientFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.feignclient.area;
2 |
3 | import com.cwj.express.domain.area.DataCompany;
4 | import com.cwj.express.domain.area.DataSchool;
5 | import feign.hystrix.FallbackFactory;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.stereotype.Component;
8 |
9 | @Component
10 | @Slf4j
11 | public class AreaFeignClientFallbackFactory implements FallbackFactory {
12 | @Override
13 | public AreaFeignClient create(Throwable throwable) {
14 | return new AreaFeignClient() {
15 | @Override
16 | public DataCompany getCompanyById(Integer id) {
17 | log.info("获取快递公司信息异常, 快递公司id:{},异常信息:{}", id, throwable.getMessage());
18 | return DataCompany.builder().name("获取快递公司信息异常!!!请联系网站管理员").build();
19 | }
20 |
21 | @Override
22 | public DataSchool getSchoolInfoById(String schoolId) {
23 | log.info("获取学校信息异常, 学校id:{},异常信息:{}", schoolId, throwable.getMessage());
24 | return new DataSchool();
25 | }
26 | };
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/css/register.css:
--------------------------------------------------------------------------------
1 | .main{
2 | width: 30vw;
3 | min-height:40vh;
4 | margin: 5vh auto;
5 | background-color: white;
6 | padding: 30px;
7 | border-radius: 7px;
8 | }
9 | .container{
10 | width: 100%;
11 | min-height: 100vh;
12 | background: #2848af url("../img/index1.png")right top no-repeat;
13 | background-size: cover;
14 | /*font-size: 1rem;*/
15 | text-align: center;
16 | vertical-align: middle;
17 | }
18 | .tab-content{
19 | margin-top: 5vh;
20 | text-align: left;
21 | }
22 | .title{
23 | margin-top: 15vh;
24 | color: white;
25 | }
26 | .capture{
27 | width: 100%;
28 | height: 70%;
29 | margin: 0 auto;
30 | background-color: red;
31 | }
32 | #video{
33 | height: 70%;
34 | width: 80%;
35 | margin: 0 auto;
36 | }
37 |
38 | @media only screen and (max-width: 800px){
39 | html{
40 | font-size: 10px;
41 | }
42 | .main{
43 | width: 80vw;
44 | min-height:40vh;
45 | margin: 5vh auto;
46 | background-color: white;
47 | padding: 20px;
48 | border-radius: 7px;
49 | }
50 | #getTelCode{
51 | margin-top: 10px;
52 | }
53 | }
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/css/register.css:
--------------------------------------------------------------------------------
1 | .main{
2 | width: 30vw;
3 | min-height:40vh;
4 | margin: 5vh auto;
5 | background-color: white;
6 | padding: 30px;
7 | border-radius: 7px;
8 | }
9 | .container{
10 | width: 100%;
11 | min-height: 100vh;
12 | background: #2848af url("../img/index1.png")right top no-repeat;
13 | background-size: cover;
14 | /*font-size: 1rem;*/
15 | text-align: center;
16 | vertical-align: middle;
17 | }
18 | .tab-content{
19 | margin-top: 5vh;
20 | text-align: left;
21 | }
22 | .title{
23 | margin-top: 15vh;
24 | color: white;
25 | }
26 | .capture{
27 | width: 100%;
28 | height: 70%;
29 | margin: 0 auto;
30 | background-color: red;
31 | }
32 | #video{
33 | height: 70%;
34 | width: 80%;
35 | margin: 0 auto;
36 | }
37 |
38 | @media only screen and (max-width: 800px){
39 | html{
40 | font-size: 10px;
41 | }
42 | .main{
43 | width: 80vw;
44 | min-height:40vh;
45 | margin: 5vh auto;
46 | background-color: white;
47 | padding: 20px;
48 | border-radius: 7px;
49 | }
50 | #getTelCode{
51 | margin-top: 10px;
52 | }
53 | }
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/ExpressAreaWebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area;
2 |
3 |
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.cors.CorsConfiguration;
7 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
8 | import org.springframework.web.filter.CorsFilter;
9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10 |
11 |
12 | @Configuration
13 | public class ExpressAreaWebMvcConfig implements WebMvcConfigurer {
14 | private CorsConfiguration buildConfig() {
15 | CorsConfiguration corsConfiguration = new CorsConfiguration();
16 | corsConfiguration.addAllowedOrigin("*"); //允许任何域名使用
17 | corsConfiguration.addAllowedHeader("*"); //允许任何头
18 | corsConfiguration.addAllowedMethod("*"); //允许任何方法(post、get等)
19 | return corsConfiguration;
20 | }
21 |
22 |
23 | @Bean
24 | public CorsFilter corsFilter() {
25 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
26 | source.registerCorsConfiguration("/**", buildConfig());
27 | return new CorsFilter(source);
28 | }
29 | }
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/strategy/DayPrefixRandomCodeStrategy.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker.strategy;
2 |
3 | import java.text.SimpleDateFormat;
4 | import java.util.Date;
5 |
6 | public class DayPrefixRandomCodeStrategy extends DefaultRandomCodeStrategy {
7 | private final String dayFormat;
8 | private String lastDay;
9 |
10 | public DayPrefixRandomCodeStrategy(String dayFormat) {
11 | this.dayFormat = dayFormat;
12 | }
13 |
14 | @Override
15 | public void init() {
16 | String day = createDate();
17 | if (day.equals(lastDay))
18 | throw new RuntimeException("init failed for day unrolled");
19 |
20 | lastDay = day;
21 |
22 | availableCodes.clear();
23 | release();
24 |
25 | prefixIndex = Integer.parseInt(lastDay);
26 | if (tryUsePrefix()) return;
27 |
28 | throw new RuntimeException("prefix is not available " + prefixIndex);
29 | }
30 |
31 | private String createDate() {
32 | return new SimpleDateFormat(dayFormat).format(new Date());
33 | }
34 |
35 | @Override
36 | public int next() {
37 | if (!lastDay.equals(createDate())) init();
38 |
39 | return super.next();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/feignclient/ucenter/UcenterFeignClient.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.feignclient.ucenter;
2 |
3 | import com.cwj.express.common.constant.ExpressServiceListConstant;
4 | import com.cwj.express.domain.ucenter.SysRolesLevel;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 | import org.springframework.web.bind.annotation.PostMapping;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * @author cwj
15 | * 用户中心服务调用
16 | * 提醒: fallbackFactory可以拿到异常, fallback不可以
17 | */
18 |
19 | @FeignClient(
20 | name = ExpressServiceListConstant.EXPRESS_UCENTER,
21 | fallbackFactory = UcenterFeignClientFallbackFactory.class
22 | )
23 | public interface UcenterFeignClient {
24 | @PostMapping("/ucenter/getRoleMsgByUserId")
25 | public SysRolesLevel getRoleMsgByUserId();
26 |
27 | @GetMapping("/ucenter/getAllCouriers")
28 | public List getAllCouriers();
29 |
30 | @GetMapping("/ucenter/getById/{userId}")
31 | public SysUser getById(@PathVariable("userId") String userId);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/express-auth/src/test/java/MyTest.java:
--------------------------------------------------------------------------------
1 | import com.cwj.express.auth.ExpressAuthApplication;
2 | import com.cwj.express.auth.config.auth.AuthConfig;
3 | import com.cwj.express.auth.service.AuthService;
4 | import com.cwj.express.auth.service.SysUserService;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.boot.test.context.SpringBootTest;
11 | import org.springframework.test.context.junit4.SpringRunner;
12 |
13 | @SpringBootTest(classes = ExpressAuthApplication.class)
14 | @RunWith(SpringRunner.class)
15 | @Slf4j
16 | public class MyTest {
17 | @Autowired
18 | private SysUserService sysUserService;
19 | @Autowired
20 | private AuthService authService;
21 | @Autowired
22 | private AuthConfig authConfig;
23 |
24 | @Test
25 | public void test1(){
26 | SysUser sysUser = sysUserService.getExtByUserName("chenwenjie");
27 | log.info(sysUser + "");
28 |
29 | String authToken = authService.login("chenwenjie","mimajiushi",authConfig.getClientId(),authConfig.getClientSecret());
30 | log.info(authToken + "");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/config/mybatis/MyBatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.config.mybatis;
2 |
3 | import com.baomidou.mybatisplus.core.injector.ISqlInjector;
4 | import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
5 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.transaction.annotation.EnableTransactionManagement;
9 |
10 | /**
11 | * @author cwj
12 | * mybatis-plus插件配置
13 | */
14 | @Configuration
15 | @EnableTransactionManagement
16 | public class MyBatisPlusConfig {
17 | /**
18 | * 分页插件
19 | */
20 | @Bean
21 | public PaginationInterceptor paginationInterceptor() {
22 | return new PaginationInterceptor();
23 | }
24 | // /**
25 | // * 逻辑删除 3.1.1版本之后不用配置
26 | // */
27 | // @Bean
28 | // public ISqlInjector sqlInjector() {
29 | // return new LogicSqlInjector();
30 | // }
31 | /**
32 | * 乐观锁插件
33 | */
34 | @Bean
35 | public OptimisticLockerInterceptor optimisticLockerInterceptor() {
36 | return new OptimisticLockerInterceptor();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderDashboardVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.*;
6 | import lombok.experimental.Accessors;
7 |
8 | import java.io.Serializable;
9 |
10 | /**
11 | * @author cwj
12 | */
13 |
14 | @Builder
15 | @Data
16 | @NoArgsConstructor
17 | @AllArgsConstructor
18 | @EqualsAndHashCode(callSuper = false)
19 | @Accessors(chain = true)
20 | @ApiModel(value="仪表盘订单信息对象")
21 | public class OrderDashboardVO implements Serializable {
22 | @ApiModelProperty(value = "待支付的订单数量(付费用户)")
23 | private Integer waitPaymentCount;
24 |
25 | @ApiModelProperty(value = "等待配送员配送的订单(付费用户,配送员)")
26 | private Integer waitCount;
27 |
28 | @ApiModelProperty(value = "等待配送员揽收的订单(配送员)")
29 | private Integer waitPickUpCount;
30 |
31 | @ApiModelProperty(value = "正在配送的订单(付费用户,配送员)")
32 | private Integer transportCount;
33 |
34 | @ApiModelProperty(value = "已完成送件上门的订单数量(管理员)")
35 | private Integer sendOrderCount;
36 |
37 | @ApiModelProperty(value = "已完成上门取件的订单数量(管理员)")
38 | private Integer pickOrderCount;
39 |
40 | @ApiModelProperty(value = "异常订单数量")
41 | private Integer exceptionOrderCount;
42 | }
43 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/OrderStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 订单状态枚举
10 | */
11 | @Getter
12 | public enum OrderStatusEnum implements IEnum {
13 |
14 | /**
15 | * 等待接单
16 | */
17 | WAIT_DIST("等待接单", 1),
18 |
19 | /**
20 | * 等待揽收
21 | */
22 | WAIT_PICK_UP("等待揽收", 6),
23 |
24 | /**
25 | * 派送中
26 | */
27 | TRANSPORT("派送中", 2),
28 |
29 | /**
30 | * 订单完成
31 | */
32 | COMPLETE("订单完成", 3),
33 |
34 | /**
35 | * '订单异常
36 | */
37 | ERROR("订单异常", 4),
38 |
39 | /**
40 | * 订单取消
41 | */
42 | CANCEL("订单取消", 5);
43 |
44 | private String name;
45 | private int status;
46 |
47 | OrderStatusEnum(String name, int status) {
48 | this.name = name;
49 | this.status = status;
50 | }
51 |
52 | public static OrderStatusEnum getByStatus(Integer status) {
53 | return Arrays.stream(values()).filter(e -> e.getStatus() == status).findFirst().orElse(null);
54 | }
55 |
56 | @Override
57 | public Integer getValue() {
58 | return this.status;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/ExpressOrderWebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order;
2 |
3 |
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.cors.CorsConfiguration;
7 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
8 | import org.springframework.web.filter.CorsFilter;
9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10 |
11 |
12 | @Configuration
13 | public class ExpressOrderWebMvcConfig implements WebMvcConfigurer {
14 | private CorsConfiguration buildConfig() {
15 | CorsConfiguration corsConfiguration = new CorsConfiguration();
16 | corsConfiguration.addAllowedOrigin("*"); //允许任何域名使用
17 | corsConfiguration.addAllowedHeader("*"); //允许任何头
18 | corsConfiguration.addAllowedMethod("*"); //允许任何方法(post、get等)
19 | corsConfiguration.setAllowCredentials(true);
20 | return corsConfiguration;
21 | }
22 |
23 |
24 | @Bean
25 | public CorsFilter corsFilter() {
26 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
27 | source.registerCorsConfiguration("/**", buildConfig());
28 | return new CorsFilter(source);
29 | }
30 | }
--------------------------------------------------------------------------------
/express-order/src/main/resources/mapping/OrderInfoMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/CourierSignService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 | import com.cwj.express.common.model.response.ResponseResult;
4 | import com.cwj.express.domain.ucenter.CourierSignCount;
5 | import com.cwj.express.domain.ucenter.CourierSignData;
6 |
7 | import java.time.LocalDate;
8 | import java.util.List;
9 |
10 | public interface CourierSignService {
11 |
12 | /**
13 | * 配送员日常签到接口
14 | * @param courierId 配送员id
15 | * @return 操作成功/失败信息
16 | */
17 | ResponseResult courierSignNormal(String courierId);
18 |
19 | /**
20 | * 配送员加班签到接口
21 | * @param courierId 配送员id
22 | * @return 操作成功/失败信息
23 | */
24 | ResponseResult courierSignOT(String courierId);
25 |
26 | /**
27 | * 获取配送员日期范围的签到记录
28 | * @param signDataType 0-日常签到 1-加班签到
29 | */
30 | List getSignDataList(String courierId, int signDataType, LocalDate startDate, LocalDate endDate);
31 |
32 | /**
33 | * 获取配送员连签记录
34 | * @param courierId 配送员id
35 | * @param type 0-断签记录 1-连签记录
36 | * @return 连签记录
37 | */
38 | CourierSignCount getSignCount(String courierId, int type);
39 |
40 | /**
41 | * 根据状态和日期查找签到记录数量
42 | */
43 | Integer getSignCount(String courierId, int type, LocalDate startDate, LocalDate endDate);
44 |
45 |
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/config/Swagger2Configuration.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import springfox.documentation.builders.ApiInfoBuilder;
6 | import springfox.documentation.builders.PathSelectors;
7 | import springfox.documentation.builders.RequestHandlerSelectors;
8 | import springfox.documentation.service.ApiInfo;
9 | import springfox.documentation.spi.DocumentationType;
10 | import springfox.documentation.spring.web.plugins.Docket;
11 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
12 |
13 | @Configuration
14 | @EnableSwagger2
15 | public class Swagger2Configuration {
16 | @Bean
17 | public Docket createRestApi() {
18 | return new Docket(DocumentationType.SWAGGER_2)
19 | .apiInfo(apiInfo())
20 | .select()
21 | .apis(RequestHandlerSelectors.basePackage("com.cwj"))
22 | .paths(PathSelectors.any())
23 | .build();
24 | }
25 |
26 | private ApiInfo apiInfo() {
27 |
28 | return new ApiInfoBuilder()
29 | .title("express")
30 | .description("espress接口文档")
31 | //.termsOfServiceUrl("/")
32 | .version("1.0")
33 | .build();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/express-api/src/main/java/com/cwj/express/api/order/PayControllerApi.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.api.order;
2 |
3 | import com.alipay.api.AlipayApiException;
4 | import io.swagger.annotations.Api;
5 | import io.swagger.annotations.ApiOperation;
6 | import org.springframework.ui.ModelMap;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 |
9 | import java.io.IOException;
10 |
11 | @Api(value="支付功能相关接口",tags = "支付controller")
12 | public interface PayControllerApi {
13 |
14 | @ApiOperation("支付宝支付")
15 | public void alipay(@PathVariable String orderId) throws AlipayApiException, IOException;
16 |
17 |
18 | @ApiOperation("支付宝同步回调接口(非前后分离接口)")
19 | public void alipayReturn() throws AlipayApiException, IOException;
20 |
21 |
22 | @ApiOperation(value = "支付宝异步回调接口",
23 | notes = "支付宝服务器异步通知,获取支付宝POST过来反馈信息\n" +
24 | "该方法无返回值,静默处理\n" +
25 | "订单的状态已该方法为主,其他的状态修改方法为辅 *\n" +
26 | "(1)程序执行完后必须打印输出“success”(不包含引号)。\n" +
27 | "如果商户反馈给支付宝的字符不是success这7个字符,支付宝服务器会不断重发通知,直到超过24小时22分钟。\n" +
28 | "(2)程序执行完成后,该页面不能执行页面跳转。\n" +
29 | "如果执行页面跳转,支付宝会收不到success字符,会被支付宝服务器判定为该页面程序运行出现异常,而重发处理结果通知\n" +
30 | "(3)cookies、session等在此页面会失效,即无法获取这些数据\n" +
31 | "(4)该方式的调试与运行必须在服务器上,即互联网上能访问 *\n"
32 | )
33 | public void alipayNotify() throws AlipayApiException, IOException;
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/rocketmq/EvaluateConsumer.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.rocketmq;
2 |
3 | import com.cwj.express.common.config.rocket.RocketmqConfig;
4 | import com.cwj.express.ucenter.service.UserEvaluateService;
5 | import lombok.RequiredArgsConstructor;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8 | import org.apache.rocketmq.spring.core.RocketMQListener;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Service;
11 | import java.math.BigDecimal;
12 |
13 |
14 | /**
15 | * @author cwj
16 | * 评价之后校准评分
17 | */
18 | @Service
19 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
20 | @RocketMQMessageListener(consumerGroup = RocketmqConfig.EVALUATE_SCORE_GROUP, topic = RocketmqConfig.EVALUATE_SCORE_TOPIC)
21 | @Slf4j
22 | public class EvaluateConsumer implements RocketMQListener {
23 |
24 | private final UserEvaluateService userEvaluateService;
25 |
26 | @Override
27 | public void onMessage(String userIdAndScore) {
28 | String[] values = userIdAndScore.split("@@");
29 | String userId = values[0];
30 | BigDecimal score = new BigDecimal(values[1]);
31 | String logId = values[2];
32 | userEvaluateService.updateScoreAndCount(userId, score, logId);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/config/security/JwtAuthenticationTokenFilter.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.config.security;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import com.cwj.express.utils.CookieUtil;
5 | import com.cwj.express.utils.ExpressOauth2Util;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.util.StringUtils;
8 | import org.springframework.web.filter.OncePerRequestFilter;
9 |
10 | import javax.servlet.FilterChain;
11 | import javax.servlet.ServletException;
12 | import javax.servlet.http.HttpServletRequest;
13 | import javax.servlet.http.HttpServletResponse;
14 | import java.io.IOException;
15 | import java.util.Map;
16 |
17 | /**
18 | * @author cwj
19 | * JWT登录授权过滤器
20 | */
21 | @Slf4j
22 | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
23 |
24 | @Override
25 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
26 | Map uid = CookieUtil.readCookie(request, "uid");
27 | request.setAttribute("access_token", uid.get("uid"));
28 | SysUser userId = ExpressOauth2Util.getUserJwtFromAttribute(request);
29 | if (!StringUtils.isEmpty(userId)){
30 | request.setAttribute("user_id", userId.getId());
31 | }
32 | chain.doFilter(request, response);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/templates/admin/module/sidebar.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | - 退出登录
14 |
15 |
16 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/config/security/RestAuthenticationEntryPoint.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.config.security;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.cwj.express.common.constant.URLConstant;
5 | import com.cwj.express.common.model.response.CommonCode;
6 | import com.cwj.express.common.model.response.ResponseResult;
7 | import org.springframework.security.core.AuthenticationException;
8 | import org.springframework.security.web.AuthenticationEntryPoint;
9 | import org.springframework.stereotype.Component;
10 |
11 | import javax.servlet.ServletException;
12 | import javax.servlet.http.HttpServletRequest;
13 | import javax.servlet.http.HttpServletResponse;
14 | import java.io.IOException;
15 |
16 | /**
17 | * 当未登录或者token失效访问接口时,自定义的返回结果
18 | */
19 | @Component
20 | public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
21 | @Override
22 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
23 | // response.setCharacterEncoding("UTF-8");
24 | // response.setContentType("application/json");
25 | // response.getWriter().println(JSON.toJSONString(ResponseResult.FAIL(CommonCode.AUTH_FALL)));
26 | // response.getWriter().flush();
27 | // 重定向到登录页
28 | response.sendRedirect(URLConstant.LOGIN_PAGE_URL);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/RedisService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * redis操作Service,
7 | * 对象和数组都以json形式进行存储
8 | * @author cwj
9 | */
10 | public interface RedisService {
11 | /**
12 | * 存储数据
13 | */
14 | void set(String key, String value);
15 |
16 | public void setList(String key, List list);
17 |
18 | /**
19 | * 获取数据
20 | */
21 | String get(String key);
22 |
23 | /**
24 | * 设置过期时间的键值对
25 | */
26 | boolean setKeyValTTL(String key, String value, long ttl);
27 |
28 | /**
29 | * 设置超期时间
30 | */
31 | boolean expire(String key, long expire);
32 |
33 | /**
34 | * 删除数据
35 | */
36 | void remove(String key);
37 |
38 | /**
39 | * zset插入操作
40 | */
41 | public Boolean zadd(String key, String menber, double score);
42 |
43 | /**
44 | * zet更改分数
45 | * @param key key
46 | * @param menber 成员值
47 | * @param delta 分数变动(可为正负数)
48 | * @return 更改后的分数
49 | */
50 | Double increment(String key, String menber, double delta);
51 |
52 | /**
53 | * 获取指定成员的分数(主要用于判断该成员是否存在)
54 | * @param key 键值
55 | * @param menber 成员值
56 | * @return 分数(成员不存在则为null)
57 | */
58 | Double zscore(String key, String menber);
59 |
60 | /**
61 | * 移除zset中的指定元素
62 | * @return 返回变成成功的数量
63 | */
64 | Long zrem(String key, Object... menbers);
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/com/cwj/express/utils/ExpressOauth2Util.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.utils;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import lombok.Data;
5 | import org.springframework.util.StringUtils;
6 | import javax.servlet.http.HttpServletRequest;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created by mrt on 2018/5/25.
11 | */
12 | public class ExpressOauth2Util {
13 |
14 | public static SysUser getUserJwtFromAttribute(HttpServletRequest request){
15 | Map jwtClaims = Oauth2Util.getJwtClaimsFromAttribute(request);
16 | if(jwtClaims == null || StringUtils.isEmpty(jwtClaims.get("id"))){
17 | return null;
18 | }
19 | String id = jwtClaims.get("id");
20 | String username = jwtClaims.get("user_name");
21 | //这里返回id即可
22 | return SysUser.builder()
23 | .id(id)
24 | .username(username).build();
25 | }
26 |
27 | public static SysUser getUserJwtFromHeader(HttpServletRequest request){
28 | Map jwtClaims = Oauth2Util.getJwtClaimsFromHeader(request);
29 | if(jwtClaims == null || StringUtils.isEmpty(jwtClaims.get("id"))){
30 | return null;
31 | }
32 | String id = jwtClaims.get("id");
33 | String username = jwtClaims.get("user_name");
34 | //这里返回id即可
35 | return SysUser.builder()
36 | .id(id)
37 | .username(username).build();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/config/security/JwtAuthenticationTokenFilter.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.config.security;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import com.cwj.express.utils.CookieUtil;
5 | import com.cwj.express.utils.ExpressOauth2Util;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.util.StringUtils;
8 | import org.springframework.web.filter.OncePerRequestFilter;
9 |
10 | import javax.servlet.FilterChain;
11 | import javax.servlet.ServletException;
12 | import javax.servlet.http.HttpServletRequest;
13 | import javax.servlet.http.HttpServletResponse;
14 | import java.io.IOException;
15 | import java.util.Map;
16 |
17 | /**
18 | * @author cwj
19 | * JWT登录授权过滤器
20 | */
21 | @Slf4j
22 | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
23 |
24 | @Override
25 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
26 | // log.info(request.getRequestURI());
27 | // log.info(request.getMethod());
28 | Map uid = CookieUtil.readCookie(request, "uid");
29 | request.setAttribute("access_token", uid.get("uid"));
30 | SysUser userId = ExpressOauth2Util.getUserJwtFromAttribute(request);
31 | if (!StringUtils.isEmpty(userId)){
32 | request.setAttribute("user_id", userId.getId());
33 | }
34 | chain.doFilter(request, response);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/SysRoleEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 | import org.springframework.stereotype.Component;
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 角色枚举(和数据库对应)
10 | * @author chenwenjie
11 | * @date 2019年04月17日 0:11
12 | * 因为对于一个正常的系统来说,这块的改动应该是几乎没有的,所以就写成枚举
13 | * 不过到订单等关键模块还是要强校验
14 | */
15 | @Getter
16 | public enum SysRoleEnum implements IEnum {
17 | DIS_FORMAL(-1, "ROLE_DIS_FORMAL", "非正式用户"),
18 | ADMIN(1, "ROLE_ADMIN", "系统管理员"),
19 | COURIER(2, "ROLE_COURIER", "配送员"),
20 | USER(3, "ROLE_USER", "普通用户"),
21 | VIP_USER(4, "ROLE_VIP_USER", "vip邮客"),
22 | SVIP_USER(5, "ROLE_SVIP_USER", "集团邮客")
23 | ;
24 |
25 | private int type;
26 |
27 | private String name;
28 |
29 | private String cnName;
30 |
31 | SysRoleEnum(int type, String name, String cnName) {
32 | this.type = type;
33 | this.name = name;
34 | this.cnName = cnName;
35 | }
36 |
37 | @Override
38 | public Integer getValue() {
39 | return this.type;
40 | }
41 |
42 | public static SysRoleEnum getByType(int type) {
43 | return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
44 | }
45 |
46 | public static SysRoleEnum getByName(String name) {
47 | return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/rocketmq/CancelOrderConsumer.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.rocketmq;
2 |
3 | import com.cwj.express.common.config.rocket.RocketmqConfig;
4 | import com.cwj.express.order.service.OrderInfoService;
5 | import com.cwj.express.utils.LocalDateTimeUtils;
6 | import lombok.RequiredArgsConstructor;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
9 | import org.apache.rocketmq.spring.core.RocketMQListener;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.stereotype.Service;
12 |
13 | import java.time.LocalDateTime;
14 |
15 | /**
16 | * @author cwj
17 | * 延时消息取消清单和关闭支付
18 | */
19 | @Service
20 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
21 | @RocketMQMessageListener(consumerGroup = RocketmqConfig.CANCEL_ORDER_GROUP, topic = RocketmqConfig.CANCEL_ORDER_TOPIC)
22 | @Slf4j
23 | public class CancelOrderConsumer implements RocketMQListener {
24 |
25 | private final OrderInfoService orderInfoService;
26 |
27 | @Override
28 | public void onMessage(String orderIdAndUserId) {
29 | log.info(orderIdAndUserId);
30 | String[] params = orderIdAndUserId.split("@@");
31 | String orderId = params[0];
32 | String userId = params[1];
33 | LocalDateTime timeVersion = LocalDateTimeUtils.ymdhmsParseToLocalDataTime(params[2]);
34 | orderInfoService.cancelOrder(orderId, userId, timeVersion);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/UserEvaluate.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import com.baomidou.mybatisplus.extension.activerecord.Model;
5 | import com.fasterxml.jackson.annotation.JsonFormat;
6 | import io.swagger.annotations.ApiModel;
7 | import io.swagger.annotations.ApiModelProperty;
8 | import lombok.*;
9 | import lombok.experimental.Accessors;
10 |
11 | import java.io.Serializable;
12 | import java.math.BigDecimal;
13 | import java.time.LocalDateTime;
14 |
15 | /**
16 | *
17 | * 用户评分表
18 | *
19 | *
20 | * @author chenwenjie
21 | * @since 2019-11-02
22 | */
23 | @EqualsAndHashCode(callSuper = false)
24 | @Accessors(chain = true)
25 | @Data
26 | @ApiModel(value="UserEvaluate对象", description="用户评分表")
27 | @Builder
28 | @NoArgsConstructor
29 | @AllArgsConstructor
30 | public class UserEvaluate extends Model {
31 |
32 | @ApiModelProperty(value = "用户ID")
33 | @TableId(type = IdType.INPUT)
34 | private String userId;
35 |
36 | @ApiModelProperty(value = "用户评分")
37 | private BigDecimal score;
38 |
39 | @ApiModelProperty(value = "评分基数")
40 | private Integer count;
41 |
42 | @ApiModelProperty(value = "更新时间")
43 | @Version
44 | @TableField(fill = FieldFill.UPDATE)
45 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
46 | private LocalDateTime updateDate;
47 |
48 |
49 | @Override
50 | protected Serializable pkVal() {
51 | return this.userId;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/UserEvaluateEventLog.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import java.math.BigDecimal;
4 |
5 | import com.baomidou.mybatisplus.annotation.IdType;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.extension.activerecord.Model;
8 | import java.time.LocalDateTime;
9 | import java.io.Serializable;
10 |
11 | import com.fasterxml.jackson.annotation.JsonFormat;
12 | import io.swagger.annotations.ApiModel;
13 | import lombok.*;
14 | import lombok.experimental.Accessors;
15 |
16 | /**
17 | *
18 | * 用户评分消息日志
19 | *
20 | * 用户处理rocketmq可能重复发送消息
21 | *
22 | * @author chenwenjie
23 | * @since 2019-12-03
24 | */
25 | @EqualsAndHashCode(callSuper = false)
26 | @Accessors(chain = true)
27 | @Data
28 | @Builder
29 | @NoArgsConstructor
30 | @AllArgsConstructor
31 | public class UserEvaluateEventLog extends Model {
32 |
33 | private static final long serialVersionUID=1L;
34 |
35 | /**
36 | * 订单id
37 | */
38 | @TableId(type = IdType.INPUT)
39 | private String logId;
40 |
41 | /**
42 | * 用户id
43 | */
44 | private String userId;
45 |
46 | /**
47 | * 用户评分
48 | */
49 | private BigDecimal score;
50 |
51 | /**
52 | * 创建日期
53 | */
54 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
55 | private LocalDateTime createDate;
56 |
57 |
58 | @Override
59 | protected Serializable pkVal() {
60 | return this.logId;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/feignclient/ucenter/UcenterFeignClientFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.feignclient.ucenter;
2 | import com.cwj.express.domain.order.OrderInfo;
3 | import com.cwj.express.domain.order.OrderPayment;
4 | import com.cwj.express.domain.ucenter.SysRolesLevel;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import com.cwj.express.vo.order.OrderDashboardVO;
7 | import feign.hystrix.FallbackFactory;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.stereotype.Component;
10 |
11 | import java.util.List;
12 |
13 | @Component
14 | @Slf4j
15 | public class UcenterFeignClientFallbackFactory implements FallbackFactory {
16 | @Override
17 | public UcenterFeignClient create(Throwable throwable) {
18 | return new UcenterFeignClient() {
19 | @Override
20 | public SysRolesLevel getRoleMsgByUserId() {
21 | log.error("用户中心远程调用异常!获取用户权限信息失败!异常信息:{}", throwable.getMessage());
22 | return null;
23 | }
24 |
25 | @Override
26 | public List getAllCouriers() {
27 | log.error("用户中心远程调用异常!获取所有配送员信息失败!异常信息:{}", throwable.getMessage());
28 | return null;
29 | }
30 |
31 | @Override
32 | public SysUser getById(String userId) {
33 | throwable.printStackTrace();
34 | log.error("用户中心远程调用异常!根据用户id获取用户信息失败!异常信息:{}", throwable.getMessage());
35 | return null;
36 | }
37 | };
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/ExpressUcenterApplication.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.mybatis.spring.annotation.MapperScan;
6 | import org.springframework.boot.SpringApplication;
7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
8 | import org.springframework.cache.annotation.EnableCaching;
9 | import org.springframework.cloud.openfeign.EnableFeignClients;
10 | import org.springframework.context.annotation.Bean;
11 | import org.springframework.context.annotation.ComponentScan;
12 | import org.springframework.security.web.firewall.DefaultHttpFirewall;
13 | import org.springframework.security.web.firewall.HttpFirewall;
14 |
15 | /**
16 | * @author chenwenjie
17 | */
18 | @SpringBootApplication
19 | @MapperScan(basePackages = "com.cwj.express.ucenter.dao")
20 | @ComponentScan(basePackages = "com.cwj.express.common")
21 | @ComponentScan(basePackages = "com.cwj.express.api")
22 | @ComponentScan(basePackages = "com.cwj.express.utils")
23 | @Slf4j
24 | @EnableFeignClients
25 | @EnableCaching
26 | public class ExpressUcenterApplication {
27 | public static void main(String[] args) throws Exception {
28 | SpringApplication.run(ExpressUcenterApplication.class, args);
29 | }
30 |
31 | /**
32 | * 引入 security 之后默认实现是 StrictHttpFirewall 会拦截带;号的请求(第一次请求静态资源url是http://xxx;jsessionid=xxx)
33 | * 这里覆盖 security 原来的实现解决。当然实际生产环境静态资源应由nginx代理,由nginx代理就不会产生这种问题了
34 | */
35 | @Bean
36 | public HttpFirewall httpFirewall() {
37 | return new DefaultHttpFirewall();
38 | }
39 |
40 |
41 | }
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/js/express.js:
--------------------------------------------------------------------------------
1 | // 是否合法手机号
2 | function isPoneAvailable(tel) {
3 | var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
4 | if (!myreg.test(tel)) {
5 | return false;
6 | } else {
7 | return true;
8 | }
9 | }
10 |
11 | // 是否正整数
12 | function isPositiveInteger(s){//是否为正整数
13 | let re = /^[0-9]+$/;
14 | return re.test(s)
15 | }
16 |
17 | //添加cookie
18 | function addCookie(name, value, expiresHours) {
19 | let cookieString = name + "=" + escape(value);
20 | //判断是否设置过期时间,0代表关闭浏览器时失效
21 | if (expiresHours > 0) {
22 | let date = new Date();
23 | date.setTime(date.getTime() + expiresHours * 1000);
24 | cookieString = cookieString + ";expires=" + date.toUTCString();
25 | }
26 | document.cookie = cookieString;
27 | }
28 |
29 | //修改cookie的值
30 | function editCookie(name, value, expiresHours) {
31 | let cookieString = name + "=" + escape(value);
32 | if (expiresHours > 0) {
33 | let date = new Date();
34 | date.setTime(date.getTime() + expiresHours * 1000); //单位是毫秒
35 | cookieString = cookieString + ";expires=" + date.toGMTString();
36 | }
37 | document.cookie = cookieString;
38 | }
39 |
40 | //根据名字获取cookie的值
41 | function getCookieValue(name) {
42 | let strCookie = document.cookie;
43 | let arrCookie = strCookie.split(";");
44 | for (let i = 0; i < arrCookie.length; i++) {
45 | let arr = arrCookie[i].split("=");
46 | if (arr[0] === name) {
47 | return unescape(arr[1]);
48 | } else {
49 | return "";
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/service/OrderEvaluateService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.service;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 | import com.cwj.express.common.enums.SysRoleEnum;
6 | import com.cwj.express.common.model.response.ResponseResult;
7 | import com.cwj.express.domain.order.OrderEvaluate;
8 | import com.cwj.express.order.dao.OrderEvaluateMapper;
9 | import com.cwj.express.vo.order.OrderEvaluateVO;
10 |
11 | import java.math.BigDecimal;
12 |
13 | /**
14 | * @author cwj
15 | * 订单评价业务
16 | */
17 |
18 | public interface OrderEvaluateService {
19 |
20 | /**
21 | * 根据用户id和角色获取被评价tiaoshu
22 | */
23 | int countEvaluate(String id, Integer roleId);
24 |
25 |
26 | /**
27 | * 用户评价
28 | * @param orderId 订单id
29 | * @param userId 用户id
30 | * @param score 评分
31 | * @param evaluate 评价内容
32 | * @param roleEnum 用户角色枚举
33 | * @return 操作成功/失败信息
34 | */
35 | ResponseResult evaluate(String orderId, String userId, BigDecimal score, String evaluate, SysRoleEnum roleEnum);
36 |
37 | /**
38 | * 根据id获取评价信心
39 | * @param orderId 订单id
40 | * @return 评价信息
41 | */
42 | OrderEvaluate getById(String orderId);
43 |
44 | /**
45 | * 分页获取用户评价信息
46 | * @param page 分页对象
47 | * @param userId 用户id
48 | * @param roleEnum 角色枚举
49 | * @return com.cwj.express.vo.order.OrderEvaluateVO
50 | */
51 | OrderEvaluateVO getPageByUserId(Page page, String userId, SysRoleEnum roleEnum);
52 | }
53 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/public/assets/js/express.js:
--------------------------------------------------------------------------------
1 | // 是否合法手机号
2 | function isPoneAvailable(tel) {
3 | var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
4 | if (!myreg.test(tel)) {
5 | return false;
6 | } else {
7 | return true;
8 | }
9 | }
10 |
11 | // 是否正整数
12 | function isPositiveInteger(s){//是否为正整数
13 | let re = /^[0-9]+$/;
14 | return re.test(s)
15 | }
16 |
17 | //添加cookie
18 | function addCookie(name, value, expiresHours) {
19 | let cookieString = name + "=" + escape(value);
20 | //判断是否设置过期时间,0代表关闭浏览器时失效
21 | if (expiresHours > 0) {
22 | let date = new Date();
23 | date.setTime(date.getTime() + expiresHours * 1000);
24 | cookieString = cookieString + ";expires=" + date.toUTCString();
25 | }
26 | document.cookie = cookieString;
27 | }
28 |
29 | //修改cookie的值
30 | function editCookie(name, value, expiresHours) {
31 | let cookieString = name + "=" + escape(value);
32 | if (expiresHours > 0) {
33 | let date = new Date();
34 | date.setTime(date.getTime() + expiresHours * 1000); //单位是毫秒
35 | cookieString = cookieString + ";expires=" + date.toGMTString();
36 | }
37 | document.cookie = cookieString;
38 | }
39 |
40 | //根据名字获取cookie的值
41 | function getCookieValue(name) {
42 | let strCookie = document.cookie;
43 | let arrCookie = strCookie.split(";");
44 | for (let i = 0; i < arrCookie.length; i++) {
45 | let arr = arrCookie[i].split("=");
46 | if (arr[0] === name) {
47 | return unescape(arr[1]);
48 | } else {
49 | return "";
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/enums/PaymentStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.enums;
2 |
3 | import com.baomidou.mybatisplus.core.enums.IEnum;
4 | import lombok.Getter;
5 |
6 | import java.util.Arrays;
7 |
8 | /**
9 | * 支付状态枚举
10 | */
11 | @Getter
12 | public enum PaymentStatusEnum implements IEnum {
13 | /**
14 | * 等待支付
15 | */
16 | WAIT_BUYER_PAY("等待支付", "WAIT_BUYER_PAY",1),
17 |
18 | /**
19 | * 未付款交易超时关闭,或支付完成后全额退款
20 | * (1)订单已创建,但用户未付款,调用关闭交易接口
21 | * (2)付款成功后,订单金额已全部退款【如果没有全部退完,仍是TRADE_SUCCESS状态】
22 | */
23 | TRADE_CLOSED("支付关闭", "TRADE_CLOSED",2),
24 |
25 | /**
26 | * 交易支付成功
27 | * (1)用户付款成功
28 | */
29 | TRADE_SUCCESS("支付成功", "TRADE_SUCCESS",3),
30 |
31 | /**
32 | * 支付结束,不可退款
33 | * (1)退款日期超过可退款期限后
34 | */
35 | TRADE_FINISHED("支付结束", "TRADE_FINISHED",4);
36 |
37 | private String name;
38 | private int status;
39 | private String desc;
40 |
41 | PaymentStatusEnum(String name, String desc, int status) {
42 | this.name = name;
43 | this.status = status;
44 | this.desc = desc;
45 | }
46 |
47 | public static PaymentStatusEnum getByStatus(Integer status) {
48 | return Arrays.stream(values()).filter(e -> e.getStatus() == status).findFirst().orElse(null);
49 | }
50 |
51 | public static PaymentStatusEnum getByDesc(String desc) {
52 | return Arrays.stream(values()).filter(e -> e.getDesc().equals(desc)).findFirst().orElse(null);
53 | }
54 |
55 | @Override
56 | public Integer getValue() {
57 | return this.status;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/area/DataArea.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.area;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.alibaba.fastjson.annotation.JSONField;
6 | import com.alibaba.fastjson.serializer.SerializerFeature;
7 | import com.cwj.express.common.enums.DataAreaLevelEnum;
8 | import io.swagger.annotations.ApiModel;
9 | import io.swagger.annotations.ApiModelProperty;
10 | import lombok.*;
11 | import lombok.experimental.Accessors;
12 |
13 | /**
14 | *
15 | * 行政区域数据表
16 | *
17 | *
18 | * @author chenwenjie
19 | * @since 2019-10-30
20 | */
21 | @Builder
22 | @NoArgsConstructor
23 | @AllArgsConstructor
24 | @Data
25 | @EqualsAndHashCode(callSuper = false)
26 | @Accessors(chain = true)
27 | @ApiModel(value="DataArea对象", description="行政区域数据表")
28 | public class DataArea implements Serializable {
29 |
30 | private Integer id;
31 |
32 | @ApiModelProperty(value = "父级ID")
33 | private Integer parentId;
34 |
35 | @ApiModelProperty(value = "名称")
36 | private String name;
37 |
38 | @ApiModelProperty(value = "简称")
39 | private String shortName;
40 |
41 | @ApiModelProperty(value = "经度")
42 | private Float longitude;
43 |
44 | @ApiModelProperty(value = "纬度")
45 | private Float latitude;
46 |
47 | @ApiModelProperty(value = "等级(1省/直辖市,2地级市,3区县,4镇/街道)")
48 | @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
49 | private DataAreaLevelEnum level;
50 |
51 | @ApiModelProperty(value = "排序")
52 | private Integer sort;
53 |
54 | @ApiModelProperty(value = "状态(0启用/1禁用)")
55 | private Integer status;
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/ExpressAuthApplication.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth;
2 |
3 | import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.mybatis.spring.annotation.MapperScan;
6 | import org.springframework.boot.SpringApplication;
7 | import org.springframework.boot.autoconfigure.SpringBootApplication;
8 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.ComponentScan;
11 | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
12 | import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
13 | import org.springframework.web.client.RestTemplate;
14 |
15 | /**
16 | * @author chenwenjie
17 | */
18 | @SpringBootApplication
19 | @MapperScan(basePackages = "com.cwj.express.auth.dao")
20 | @ComponentScan(basePackages = "com.cwj.express.common")
21 | @ComponentScan(basePackages = "com.cwj.express.api")
22 | @ComponentScan(basePackages = "com.cwj.express.utils")
23 | @Slf4j
24 | public class ExpressAuthApplication {
25 | public static void main(String[] args) throws Exception {
26 | SpringApplication.run(ExpressAuthApplication.class, args);
27 | }
28 |
29 | @Bean
30 | @LoadBalanced //ribbon负载均衡 https://blog.csdn.net/u011063112/article/details/81295376
31 | @SentinelRestTemplate //服务熔断
32 | public RestTemplate restTemplate() {
33 | // return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
34 | return new RestTemplate(new HttpComponentsClientHttpRequestFactory());
35 | }
36 |
37 |
38 | }
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderInfoVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import io.swagger.annotations.ApiModel;
4 | import io.swagger.annotations.ApiModelProperty;
5 | import lombok.*;
6 | import lombok.experimental.Accessors;
7 |
8 | import javax.validation.constraints.NotBlank;
9 | import javax.validation.constraints.NotEmpty;
10 |
11 | /**
12 | * @author cwj
13 | */
14 | @Data
15 | @EqualsAndHashCode(callSuper = false)
16 | @Accessors(chain = true)
17 | @ApiModel(value="订单信息vo", description="信息用于创建订单")
18 | @Builder
19 | @NoArgsConstructor
20 | @AllArgsConstructor
21 | public class OrderInfoVO {
22 | @ApiModelProperty(value = "收件人", required = true)
23 | @NotBlank(message = "收件人 必填")
24 | private String recName;
25 |
26 | @ApiModelProperty(value = "收件电话", required = true)
27 | @NotBlank(message = "收件电话 必填")
28 | private String recTel;
29 |
30 | @ApiModelProperty(value = "快递单号")
31 | private String odd;
32 |
33 | @ApiModelProperty(value = "快递公司", required = true)
34 | private Integer company;
35 |
36 | @ApiModelProperty(value = "服务类型", required = true)
37 | private Integer type;
38 |
39 | @ApiModelProperty(value = "快递寄达地址", required = true)
40 | @NotBlank(message = "快递寄达地址 必填")
41 | private String address;
42 |
43 | @ApiModelProperty(value = "收货地址", required = true)
44 | @NotBlank(message = "收货地址 必填")
45 | private String recAddress;
46 |
47 | @ApiModelProperty(value = "备注", required = true)
48 | @NotBlank(message = "备注 必填")
49 | private String remark;
50 |
51 | @ApiModelProperty(value = "重量(向上取整)", required = true)
52 | private Double weight;
53 | }
54 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/ExpressAreaApplication.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.mybatis.spring.annotation.MapperScan;
5 | import org.springframework.boot.SpringApplication;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.context.annotation.ComponentScan;
9 | import org.springframework.data.redis.connection.RedisConnectionFactory;
10 | import org.springframework.data.redis.core.RedisTemplate;
11 | import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
12 | import org.springframework.data.redis.serializer.StringRedisSerializer;
13 |
14 | /**
15 | * @author chenwenjie
16 | */
17 | @SpringBootApplication
18 | @MapperScan(basePackages = "com.cwj.express.area.dao")
19 | @ComponentScan(basePackages = "com.cwj.express.common")
20 | @ComponentScan(basePackages = "com.cwj.express.api")
21 | @ComponentScan(basePackages = "com.cwj.express.utils")
22 | @Slf4j
23 | public class ExpressAreaApplication {
24 | public static void main(String[] args) throws Exception {
25 | SpringApplication.run(ExpressAreaApplication.class, args);
26 | }
27 |
28 | @Bean
29 | public RedisTemplate, ?> redisTemplate(final RedisConnectionFactory connectionFactory) {
30 | final RedisTemplate, ?> template = new RedisTemplate<>();
31 | template.setConnectionFactory(connectionFactory);
32 | template.setKeySerializer(new StringRedisSerializer());
33 | template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
34 | return template;
35 | }
36 | }
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/model/response/ResponseResult.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.model.response;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 | import lombok.ToString;
6 |
7 | /**
8 | * @author cwj
9 | */
10 | @Data
11 | @ToString
12 | @NoArgsConstructor
13 | public class ResponseResult implements Response {
14 |
15 | /**
16 | * 操作是否成功
17 | */
18 | boolean success = SUCCESS;
19 |
20 | /**
21 | * 操作代码
22 | */
23 | int code = SUCCESS_CODE;
24 |
25 |
26 | /**
27 | * 返回数据
28 | */
29 | Object data;
30 |
31 | public ResponseResult(ResultCode resultCode){
32 | this.success = resultCode.success();
33 | this.code = resultCode.code();
34 | this.data = resultCode.message();
35 | }
36 |
37 | public static ResponseResult SUCCESS(){
38 | return new ResponseResult(CommonCode.SUCCESS);
39 | }
40 | public static ResponseResult FAIL(){
41 | return new ResponseResult(CommonCode.FAIL);
42 | }
43 |
44 | public static ResponseResult FAIL(ResultCode resultCode){
45 | return new ResponseResult(resultCode);
46 | }
47 |
48 | public static ResponseResult FAIL(Object data){
49 | ResponseResult res = new ResponseResult();
50 | res.setData(data);
51 | res.setSuccess(false);
52 | res.setCode(-999);
53 | return res;
54 | }
55 |
56 | public static ResponseResult SUCCESS(Object data){
57 | ResponseResult res = new ResponseResult();
58 | res.setData(data);
59 | res.setSuccess(true);
60 | res.setCode(SUCCESS_CODE);
61 | return res;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/com/cwj/express/utils/LocalDateTimeUtils.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.utils;
2 |
3 | import java.time.LocalDate;
4 | import java.time.LocalDateTime;
5 | import java.time.format.DateTimeFormatter;
6 | import java.time.temporal.ChronoUnit;
7 |
8 | public class LocalDateTimeUtils {
9 | public static String formatToYMDHMS(LocalDateTime time){
10 | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
11 | return time.format(df);
12 | }
13 |
14 | public static LocalDateTime ymdhmsParseToLocalDataTime(String timeString){
15 | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
16 | return LocalDateTime.parse(timeString, df);
17 | }
18 |
19 | public static String formatToYMD(LocalDateTime time){
20 | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
21 | return time.format(df);
22 | }
23 |
24 | public static LocalDate ymdParseToLocalData(String timeString){
25 | DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
26 | return LocalDate.parse(timeString, df);
27 | }
28 |
29 | public static void main(String[] args) {
30 | LocalDate now = LocalDate.now();
31 | LocalDate nowPlus = now.plusDays(1);
32 | LocalDate yes = now.plusDays(-1);
33 | LocalDateTime nowDateTime = now.atTime(0, 0, 0);
34 | System.out.println(now);
35 | System.out.println(nowDateTime);
36 | System.out.println(nowPlus);
37 | System.out.println(yes);
38 |
39 | System.out.println(ChronoUnit.DAYS.between(LocalDate.of(2019, 11,1), LocalDate.of(2019, 11,2)));
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/service/RedisService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.service;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * redis操作Service,
7 | * 对象和数组都以json形式进行存储
8 | * @author cwj
9 | */
10 | public interface RedisService {
11 | /**
12 | * 存储数据
13 | */
14 | void set(String key, String value);
15 |
16 | public void setList(String key, List list);
17 |
18 | /**
19 | * 获取数据
20 | */
21 | String get(String key);
22 |
23 | /**
24 | * 设置过期时间的键值对
25 | */
26 | boolean setKeyValTTL(String key, String value, long ttl);
27 |
28 | /**
29 | * zset插入操作
30 | */
31 | public Boolean zadd(String key, String menber, double score);
32 |
33 | /**
34 | * zset改变分数操作
35 | */
36 | double zincrby(String key, String menber, double score);
37 |
38 | /**
39 | * 移除zset中的指定元素
40 | */
41 | void zrem(String key, Object... menbers);
42 |
43 | /**
44 | * 设置超期时间
45 | */
46 | boolean expire(String key, long expire);
47 |
48 | /**
49 | * 删除数据
50 | */
51 | void remove(String key);
52 |
53 | /**
54 | * zet更改分数
55 | * @param key key
56 | * @param menber 成员值
57 | * @param delta 分数变动(可为正负数)
58 | * @return 更改后的分数
59 | */
60 | Double increment(String key, String menber, double delta);
61 |
62 | /**
63 | * 获取指定成员的分数(主要用于判断该成员是否存在)
64 | * @param key 键值
65 | * @param menber 成员值
66 | * @return 分数(成员不存在则为null)
67 | */
68 | Double zscore(String key, String menber);
69 |
70 | /**
71 | * 返回指定key的成员数量
72 | * @param key key值
73 | * @return 成员数量
74 | */
75 | public Long zcard(String key);
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/express-common/src/main/java/com/cwj/express/common/Interceptor/RestTempleInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.common.Interceptor;
2 |
3 | import org.springframework.http.HttpHeaders;
4 | import org.springframework.http.HttpRequest;
5 | import org.springframework.http.client.ClientHttpRequestExecution;
6 | import org.springframework.http.client.ClientHttpRequestInterceptor;
7 | import org.springframework.http.client.ClientHttpResponse;
8 | import org.springframework.util.StringUtils;
9 | import org.springframework.web.context.request.RequestAttributes;
10 | import org.springframework.web.context.request.RequestContextHolder;
11 | import org.springframework.web.context.request.ServletRequestAttributes;
12 |
13 | import javax.servlet.http.HttpServletRequest;
14 | import java.io.IOException;
15 |
16 |
17 | /**
18 | * @author cwj
19 | * @deprecated 因为用feign替代,这部分就不使用了,但代码还是留着
20 | */
21 |
22 | public class RestTempleInterceptor implements ClientHttpRequestInterceptor {
23 | @Override
24 | public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
25 | RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
26 | ServletRequestAttributes attributes = (ServletRequestAttributes) requestAttributes;
27 | HttpServletRequest request = attributes.getRequest();
28 | String token = (String) request.getAttribute("access_token");
29 | HttpHeaders headers = httpRequest.getHeaders();
30 | if (!StringUtils.isEmpty(token)){
31 | headers.add("Authorization", "Bearer " + token);
32 | }
33 |
34 | return clientHttpRequestExecution.execute(httpRequest, bytes);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/CourierSignData.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.extension.activerecord.Model;
8 | import java.time.LocalDateTime;
9 | import java.io.Serializable;
10 |
11 | import com.fasterxml.jackson.annotation.JsonFormat;
12 | import io.swagger.annotations.ApiModel;
13 | import io.swagger.annotations.ApiModelProperty;
14 | import lombok.*;
15 | import lombok.experimental.Accessors;
16 |
17 | /**
18 | *
19 | *
20 | *
21 | *
22 | * @author chenwenjie
23 | * @since 2019-11-24
24 | */
25 | @EqualsAndHashCode(callSuper = false)
26 | @Accessors(chain = true)
27 | @Data
28 | @Builder
29 | @NoArgsConstructor
30 | @AllArgsConstructor
31 | @ApiModel(value="CourierSignData对象", description="")
32 | public class CourierSignData extends Model {
33 |
34 | private static final long serialVersionUID=1L;
35 |
36 | @ApiModelProperty(value = "主键id")
37 | @TableId(type = IdType.ID_WORKER_STR)
38 | private String id;
39 |
40 | @ApiModelProperty(value = "配送员id")
41 | private String courierId;
42 |
43 | @ApiModelProperty(value = "签到日期")
44 | private LocalDateTime signDate;
45 |
46 | @ApiModelProperty(value = "0-日常 1-加班")
47 | @TableField(fill = FieldFill.INSERT)
48 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
49 | private Integer signDataType;
50 |
51 |
52 | @Override
53 | protected Serializable pkVal() {
54 | return this.id;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/init/InitCourierScoreTask.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.init;
2 |
3 |
4 | import com.cwj.express.common.config.redis.RedisConfig;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import com.cwj.express.order.feignclient.ucenter.UcenterFeignClient;
7 | import com.cwj.express.order.service.OrderInfoService;
8 | import com.cwj.express.order.service.RedisService;
9 | import lombok.RequiredArgsConstructor;
10 | import lombok.extern.slf4j.Slf4j;
11 | import org.springframework.beans.factory.annotation.Autowired;
12 | import org.springframework.stereotype.Component;
13 | import org.springframework.util.ObjectUtils;
14 |
15 | import javax.annotation.PostConstruct;
16 | import java.util.List;
17 |
18 | @Slf4j
19 | @Component
20 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
21 | public class InitCourierScoreTask {
22 |
23 | private final UcenterFeignClient ucenterFeignClient;
24 | private final OrderInfoService orderInfoService;
25 | private final RedisService redisService;
26 |
27 | /**
28 | * 初始化配送员分数
29 | */
30 | @PostConstruct
31 | private void init() {
32 | log.info("!!! 请注意要先启动 express-ucenter 服务 !!!");
33 | List allCouriers = ucenterFeignClient.getAllCouriers();
34 | if (ObjectUtils.isEmpty(allCouriers)){
35 | log.error("!!! 没有配送员/用户中心未启动 !!!");
36 | }
37 | for (SysUser courier : allCouriers) {
38 | Double socre = orderInfoService.countCourierScore(courier.getId());
39 | String key = RedisConfig.COURIER_WEIGHT_DATA + "::" + courier.getSchoolId();
40 | redisService.zadd(key, courier.getId(), socre);
41 | }
42 | log.info("配送员权重初始化完成!");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/CourierSignCount.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import com.baomidou.mybatisplus.extension.activerecord.Model;
5 | import java.time.LocalDateTime;
6 | import java.io.Serializable;
7 |
8 | import com.fasterxml.jackson.annotation.JsonFormat;
9 | import io.swagger.annotations.ApiModel;
10 | import io.swagger.annotations.ApiModelProperty;
11 | import lombok.*;
12 | import lombok.experimental.Accessors;
13 |
14 | /**
15 | *
16 | *
17 | *
18 | *
19 | * @author chenwenjie
20 | * @since 2019-11-24
21 | */
22 | @EqualsAndHashCode(callSuper = false)
23 | @Accessors(chain = true)
24 | @Data
25 | @Builder
26 | @NoArgsConstructor
27 | @AllArgsConstructor
28 | @ApiModel(value="CourierSignCount对象", description="")
29 | public class CourierSignCount extends Model {
30 |
31 | private static final long serialVersionUID=1L;
32 |
33 | @TableId(type = IdType.ID_WORKER_STR)
34 | private String id;
35 |
36 | @ApiModelProperty(value = "配送员id")
37 | private String courierId;
38 |
39 | @ApiModelProperty(value = "连续签到天数")
40 | private Integer signCount;
41 |
42 | @ApiModelProperty(value = "0 - 断签记录 1 - 正在连签")
43 | private Integer signCountType;
44 |
45 | @TableField(fill = FieldFill.INSERT)
46 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
47 | private LocalDateTime createDate;
48 |
49 | @Version
50 | @TableField(fill = FieldFill.UPDATE)
51 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
52 | private LocalDateTime updateDate;
53 |
54 |
55 | @Override
56 | protected Serializable pkVal() {
57 | return this.id;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/utils/Ip.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker.utils;
2 |
3 |
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import java.net.Inet4Address;
8 | import java.net.InetAddress;
9 | import java.net.NetworkInterface;
10 | import java.net.SocketException;
11 | import java.util.Enumeration;
12 |
13 | public class Ip {
14 | static Logger logger = LoggerFactory.getLogger(Ip.class);
15 |
16 | public static String ip;
17 | public static long lip;
18 |
19 | static {
20 | try {
21 | InetAddress localHostLANAddress = getFirstNonLoopbackAddress();
22 | ip = localHostLANAddress.getHostAddress();
23 |
24 | byte[] address = localHostLANAddress.getAddress();
25 | lip = ((address [0] & 0xFFL) << (3*8)) +
26 | ((address [1] & 0xFFL) << (2*8)) +
27 | ((address [2] & 0xFFL) << (1*8)) +
28 | (address [3] & 0xFFL);
29 | } catch (Exception e) {
30 | logger.error("get ipv4 failed ", e);
31 | }
32 | }
33 |
34 | private static InetAddress getFirstNonLoopbackAddress() throws SocketException {
35 | Enumeration en = NetworkInterface.getNetworkInterfaces();
36 | while (en.hasMoreElements()) {
37 | NetworkInterface i = (NetworkInterface) en.nextElement();
38 | for (Enumeration en2 = i.getInetAddresses(); en2.hasMoreElements(); ) {
39 | InetAddress addr = (InetAddress) en2.nextElement();
40 | if (addr.isLoopbackAddress()) continue;
41 |
42 | if (addr instanceof Inet4Address) {
43 | return addr;
44 | }
45 | }
46 | }
47 | return null;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/SysRolesLevel.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import com.baomidou.mybatisplus.extension.activerecord.Model;
5 | import com.fasterxml.jackson.annotation.JsonFormat;
6 | import io.swagger.annotations.ApiModel;
7 | import io.swagger.annotations.ApiModelProperty;
8 | import lombok.*;
9 | import lombok.experimental.Accessors;
10 |
11 | import java.io.Serializable;
12 | import java.math.BigDecimal;
13 | import java.time.LocalDateTime;
14 |
15 | /**
16 | *
17 | *
18 | *
19 | *
20 | * @author chenwenjie
21 | * @since 2019-11-12
22 | */
23 | @EqualsAndHashCode(callSuper = false)
24 | @Accessors(chain = true)
25 | @Data
26 | @ApiModel(value="UserEvaluate对象", description="用户评分表")
27 | @Builder
28 | @NoArgsConstructor
29 | @AllArgsConstructor
30 | public class SysRolesLevel extends Model {
31 |
32 | private static final long serialVersionUID=1L;
33 |
34 | @TableId(type = IdType.INPUT)
35 | private Integer roleId;
36 |
37 | @ApiModelProperty(value = "角色(会员)中文描述")
38 | private String roleDesc;
39 |
40 | @ApiModelProperty(value = "角色(会员)英文名")
41 | private String roleName;
42 |
43 | @ApiModelProperty(value = "折扣")
44 | private BigDecimal discount;
45 |
46 | @TableField(fill = FieldFill.INSERT)
47 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
48 | private LocalDateTime createDate;
49 |
50 | @Version
51 | @TableField(fill = FieldFill.UPDATE)
52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
53 | private LocalDateTime updateDate;
54 |
55 |
56 | @Override
57 | protected Serializable pkVal() {
58 | return this.roleId;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/impl/SysUserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service.impl;
2 |
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 | import com.cwj.express.auth.service.SysUserService;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import com.cwj.express.auth.dao.SysUserMapper;
7 | import lombok.RequiredArgsConstructor;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.stereotype.Service;
11 | import org.springframework.util.ObjectUtils;
12 |
13 | /**
14 | * @author cwj
15 | */
16 | @Slf4j
17 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
18 | @Service
19 | public class SysUserServiceImpl implements SysUserService {
20 |
21 | private final SysUserMapper sysUserMapper;
22 |
23 | @Override
24 | public SysUser getExtByUserName(String username) {
25 | SysUser sysUser = sysUserMapper.selectOne(
26 | new QueryWrapper()
27 | .eq("username", username)
28 | );
29 | return sysUser;
30 | }
31 |
32 | @Override
33 | public SysUser getExtByTel(String tel) {
34 | return sysUserMapper.selectOne(
35 | new QueryWrapper()
36 | .eq("tel", tel)
37 | );
38 | }
39 |
40 | @Override
41 | public SysUser getById(String id) {
42 | // todo 设置redis缓存
43 | return sysUserMapper.selectById(id);
44 | }
45 |
46 | @Override
47 | public boolean phoneNumExist(String phoneNum) {
48 | SysUser sysUser = sysUserMapper.selectOne(
49 | new QueryWrapper()
50 | .eq("tel", phoneNum)
51 | );
52 | return !ObjectUtils.isEmpty(sysUser);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/express-model/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.cwj.express
8 | express-parent
9 | 1.0-SNAPSHOT
10 |
11 | express-model
12 | express-model
13 |
14 |
15 |
16 |
17 | com.cwj.express
18 | express-common
19 | 1.0-SNAPSHOT
20 |
21 |
22 |
23 | io.springfox
24 | springfox-swagger2
25 |
26 |
27 | org.projectlombok
28 | lombok
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | com.baomidou
38 | mybatis-plus
39 | ${mybatis-plus.version}
40 |
41 |
42 |
43 | org.springframework.security
44 | spring-security-core
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/vo/order/OrderHistoryVO.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.vo.order;
2 |
3 | import com.fasterxml.jackson.annotation.JsonFormat;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.io.Serializable;
9 | import java.time.LocalDateTime;
10 |
11 | /**
12 | * 订单历史记录VO
13 | */
14 | @Data
15 | @NoArgsConstructor
16 | public class OrderHistoryVO implements Serializable {
17 | /**
18 | * 订单号
19 | */
20 | private String id;
21 | /**
22 | * 快递单号
23 | */
24 | private String odd;
25 | /**
26 | * 快递公司
27 | */
28 | private String company;
29 |
30 | /**
31 | * 服务类型
32 | */
33 | private String serverType;
34 |
35 | /**
36 | * 收件人
37 | */
38 | private String recName;
39 | /**
40 | * 收件电话
41 | */
42 | private String recTel;
43 | /**
44 | * 快递寄达地址
45 | */
46 | private String address;
47 | /**
48 | * 收货地址
49 | */
50 | private String recAddress;
51 | /**
52 | * 备注
53 | */
54 | private String remark;
55 |
56 | /**
57 | * 支付状态
58 | */
59 | private Integer paymentStatus;
60 | /**
61 | * 支付金额
62 | */
63 | private String payment;
64 | /**
65 | * 订单状态
66 | */
67 | private Integer orderStatus;
68 | /**
69 | * 删除原因
70 | */
71 | private Integer deleteType;
72 |
73 | /**
74 | * 开始时间
75 | */
76 | private String startDate;
77 |
78 | /**
79 | * 结束时间
80 | */
81 | private String endDate;
82 |
83 | /**
84 | * 下单时间
85 | */
86 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
87 | private LocalDateTime createDate;
88 |
89 | /**
90 | * 能否评分,1可以,0可以
91 | */
92 | private String canScore;
93 | }
94 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/org/n3r/idworker/Sid.java:
--------------------------------------------------------------------------------
1 | package org.n3r.idworker;
2 |
3 | import org.n3r.idworker.strategy.DefaultWorkerIdStrategy;
4 | import org.n3r.idworker.utils.Utils;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.text.SimpleDateFormat;
8 | import java.util.Date;
9 |
10 | @Component
11 | public class Sid {
12 | private static WorkerIdStrategy workerIdStrategy;
13 | private static IdWorker idWorker;
14 |
15 | static {
16 | configure(DefaultWorkerIdStrategy.instance);
17 | }
18 |
19 |
20 | public static synchronized void configure(WorkerIdStrategy custom) {
21 | if (workerIdStrategy != null) workerIdStrategy.release();
22 | workerIdStrategy = custom;
23 | idWorker = new IdWorker(workerIdStrategy.availableWorkerId()) {
24 | @Override
25 | public long getEpoch() {
26 | return Utils.midnightMillis();
27 | }
28 | };
29 | }
30 |
31 | /**
32 | * 一天最大毫秒86400000,最大占用27比特
33 | * 27+10+11=48位 最大值281474976710655(15字),YK0XXHZ827(10字)
34 | * 6位(YYMMDD)+15位,共21位
35 | *
36 | * @return 固定21位数字字符串
37 | */
38 |
39 | public String next() {
40 | long id = idWorker.nextId();
41 | String yyMMdd = new SimpleDateFormat("yyMMdd").format(new Date());
42 | return yyMMdd + String.format("%014d", id);
43 | }
44 |
45 |
46 | /**
47 | * 返回固定16位的字母数字混编的字符串。
48 | */
49 | public String nextShort() {
50 | long id = idWorker.nextId();
51 | String yyMMdd = new SimpleDateFormat("yyMMdd").format(new Date());
52 | return yyMMdd + Utils.padLeft(Utils.encode(id), 10, '0');
53 | }
54 |
55 | // public static void main(String[] args) {
56 | // String aa = new Sid().nextShort();
57 | // String bb = new Sid().next();
58 | //
59 | // System.out.println(aa);
60 | // System.out.println(bb);
61 | // }
62 | }
63 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/service/SysUserService.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.service;
2 |
3 | import com.baomidou.mybatisplus.core.metadata.IPage;
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 | import com.cwj.express.common.enums.SysRoleEnum;
6 | import com.cwj.express.domain.ucenter.SysUser;
7 | import com.cwj.express.vo.table.BootstrapTableVO;
8 | import com.cwj.express.vo.ucenter.UserInfoVo;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author chenwenjie
14 | */
15 | public interface SysUserService {
16 | /**
17 | * 根据用户名获取用户信息
18 | * @param username 用户名
19 | * @return 用户id和角色信息
20 | */
21 | public SysUser getExtByUserName(String username);
22 |
23 |
24 | /**
25 | * 根据用户id获取用户西南西
26 | * @param id 用户id
27 | * @return 用户信息
28 | */
29 | public SysUser getById(String id);
30 |
31 |
32 | /**
33 | * 获取全部配送员信息接口
34 | * @return 配送员信息列表
35 | */
36 | public List getAllCouriers();
37 |
38 | /**
39 | * 获取用户信息
40 | * @param userId 用户id
41 | * @return 用户信息
42 | */
43 | public UserInfoVo getUserInfo(String userId);
44 |
45 | /**
46 | * 配送员请假接口
47 | * @param sysUser 用户对象
48 | * @param reason 请假原因
49 | * @return true-操作成功 false-操作失败
50 | */
51 | public boolean courierLeave(SysUser sysUser, String reason);
52 |
53 | /**
54 | * 配送员回到岗位接口
55 | * @param sysUser 用户对象
56 | * 失败则抛出异常
57 | */
58 | public void courierReWork(SysUser sysUser);
59 |
60 | /**
61 | * 判断配送员是否请假
62 | * @param courier 配送员用户对象
63 | */
64 | public boolean isLeave(SysUser courier);
65 |
66 | /**
67 | * 条件查询用户列表
68 | * @param page 分页信息
69 | * @param userInfoVo 内含条件的对象
70 | * @return 数据+bootstrap需要的表结构
71 | */
72 | public BootstrapTableVO listByParam(Page page, UserInfoVo userInfoVo);
73 | }
74 |
--------------------------------------------------------------------------------
/express-area/src/main/java/com/cwj/express/area/service/impl/RedisServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.area.service.impl;
2 |
3 | import com.cwj.express.area.service.RedisService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.data.redis.core.RedisTemplate;
6 | import org.springframework.data.redis.core.StringRedisTemplate;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 | import java.util.concurrent.TimeUnit;
11 |
12 | /**
13 | * redis操作Service的实现类
14 | * Created by macro on 2018/8/7.
15 | */
16 | @Service
17 | public class RedisServiceImpl implements RedisService {
18 | @Autowired
19 | private StringRedisTemplate stringRedisTemplate;
20 | @Autowired
21 | private RedisTemplate redisTemplate;
22 |
23 | @Override
24 | public void set(String key, String value) {
25 | stringRedisTemplate.opsForValue().set(key, value);
26 | }
27 |
28 | @Override
29 | public void setList(String key, List list){
30 | redisTemplate.opsForList().rightPushAll(key, list);
31 | }
32 |
33 | @Override
34 | public String get(String key) {
35 | return stringRedisTemplate.opsForValue().get(key);
36 | }
37 |
38 | @Override
39 | public boolean setKeyValTTL(String key, String value, long ttl) {
40 | stringRedisTemplate.boundValueOps(key).set(value,ttl, TimeUnit.SECONDS);
41 | Long expire = stringRedisTemplate.getExpire(key, TimeUnit.SECONDS);
42 | return expire>0;
43 | }
44 |
45 | @Override
46 | public boolean expire(String key, long expire) {
47 | return stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
48 | }
49 |
50 | @Override
51 | public void remove(String key) {
52 | stringRedisTemplate.delete(key);
53 | }
54 |
55 | @Override
56 | public Long increment(String key, long delta) {
57 | return stringRedisTemplate.opsForValue().increment(key,delta);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/service/impl/RedisServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.service.impl;
2 |
3 | import com.cwj.express.auth.service.RedisService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.data.redis.core.RedisTemplate;
6 | import org.springframework.data.redis.core.StringRedisTemplate;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 | import java.util.concurrent.TimeUnit;
11 |
12 | /**
13 | * redis操作Service的实现类
14 | * Created by macro on 2018/8/7.
15 | */
16 | @Service
17 | public class RedisServiceImpl implements RedisService {
18 | @Autowired
19 | private StringRedisTemplate stringRedisTemplate;
20 | @Autowired
21 | private RedisTemplate redisTemplate;
22 |
23 | @Override
24 | public void set(String key, String value) {
25 | stringRedisTemplate.opsForValue().set(key, value);
26 | }
27 |
28 | @Override
29 | public void setList(String key, List list){
30 | redisTemplate.opsForList().rightPushAll(key, list);
31 | }
32 |
33 | @Override
34 | public String get(String key) {
35 | return stringRedisTemplate.opsForValue().get(key);
36 | }
37 |
38 | @Override
39 | public boolean setKeyValTTL(String key, String value, long ttl) {
40 | stringRedisTemplate.boundValueOps(key).set(value,ttl, TimeUnit.SECONDS);
41 | Long expire = stringRedisTemplate.getExpire(key, TimeUnit.SECONDS);
42 | return expire>0;
43 | }
44 |
45 | @Override
46 | public boolean expire(String key, long expire) {
47 | return stringRedisTemplate.expire(key, expire, TimeUnit.SECONDS);
48 | }
49 |
50 | @Override
51 | public void remove(String key) {
52 | stringRedisTemplate.delete(key);
53 | }
54 |
55 | @Override
56 | public Long increment(String key, long delta) {
57 | return stringRedisTemplate.opsForValue().increment(key,delta);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/express-order/src/main/java/com/cwj/express/order/rocketmq/DistributionCourierConsumer.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.order.rocketmq;
2 |
3 | import com.cwj.express.common.config.redis.RedisConfig;
4 | import com.cwj.express.common.config.rocket.RocketmqConfig;
5 | import com.cwj.express.domain.ucenter.SysUser;
6 | import com.cwj.express.order.feignclient.ucenter.UcenterFeignClient;
7 | import com.cwj.express.order.service.DistributionCourierService;
8 | import com.cwj.express.order.service.OrderInfoService;
9 | import com.cwj.express.order.service.RedisService;
10 | import com.cwj.express.utils.LocalDateTimeUtils;
11 | import lombok.RequiredArgsConstructor;
12 | import lombok.extern.slf4j.Slf4j;
13 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
14 | import org.apache.rocketmq.spring.core.RocketMQListener;
15 | import org.springframework.beans.factory.annotation.Autowired;
16 | import org.springframework.stereotype.Service;
17 |
18 | import java.time.LocalDateTime;
19 | import java.util.List;
20 |
21 | /**
22 | * @author cwj
23 | * 延时消息取消清单和关闭支付
24 | */
25 | @Service
26 | @RequiredArgsConstructor(onConstructor = @__(@Autowired))
27 | @RocketMQMessageListener(consumerGroup = RocketmqConfig.DISTRIBUTION_COURIER_GROUP, topic = RocketmqConfig.DISTRIBUTION_COURIER_TOPIC)
28 | @Slf4j
29 | public class DistributionCourierConsumer implements RocketMQListener {
30 |
31 | private final DistributionCourierService distributionCourierService;
32 | private final RedisService redisService;
33 |
34 | @Override
35 | public void onMessage(String orderIdAndType) {
36 | String[] values = orderIdAndType.split("@@");
37 | String orderId = values[0];
38 | String type = values[1];
39 | // 分配配送员业务
40 | distributionCourierService.distributionCourier(orderId, type);
41 |
42 | // 删除redis日志 (可以不删)
43 | String logKey = RedisConfig.ORDER_COURIER_DATA + "::" + orderId;
44 | redisService.remove(logKey);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/CourierLeaveLog.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.alibaba.fastjson.annotation.JSONField;
4 | import com.alibaba.fastjson.serializer.SerializerFeature;
5 | import com.baomidou.mybatisplus.annotation.*;
6 | import com.baomidou.mybatisplus.extension.activerecord.Model;
7 | import java.time.LocalDateTime;
8 | import java.io.Serializable;
9 |
10 | import com.cwj.express.common.enums.CourierLeaveStatusEnum;
11 | import com.fasterxml.jackson.annotation.JsonFormat;
12 | import io.swagger.annotations.ApiModel;
13 | import io.swagger.annotations.ApiModelProperty;
14 | import lombok.*;
15 | import lombok.experimental.Accessors;
16 |
17 | /**
18 | *
19 | *
20 | *
21 | *
22 | * @author chenwenjie
23 | * @since 2019-11-21
24 | */
25 | @EqualsAndHashCode(callSuper = false)
26 | @Accessors(chain = true)
27 | @Data
28 | @Builder
29 | @NoArgsConstructor
30 | @AllArgsConstructor
31 | @ApiModel(value="CourierLeaveLog对象", description="")
32 | public class CourierLeaveLog extends Model {
33 |
34 | private static final long serialVersionUID=1L;
35 |
36 | @TableId(type = IdType.INPUT)
37 | private String courierId;
38 |
39 | @TableField("leave_status")
40 | @ApiModelProperty(value = "0 - 请假中 1 - 已经回到岗位")
41 | @JSONField(serialzeFeatures= SerializerFeature.WriteEnumUsingToString)
42 | private CourierLeaveStatusEnum leaveStatusEnum;
43 |
44 | @ApiModelProperty(value = "请假原因")
45 | private String leaveResaon;
46 |
47 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
48 | @TableField(fill = FieldFill.INSERT)
49 | private LocalDateTime createDate;
50 |
51 | @Version
52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
53 | @TableField(fill = FieldFill.UPDATE)
54 | private LocalDateTime updateDate;
55 |
56 |
57 | @Override
58 | protected Serializable pkVal() {
59 | return this.courierId;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/java/com/cwj/express/ucenter/feignclient/order/OrderFeignClient.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.ucenter.feignclient.order;
2 |
3 | import com.cwj.express.common.constant.ExpressServiceListConstant;
4 | import com.cwj.express.common.model.response.ResponseResult;
5 | import com.cwj.express.domain.order.OrderInfo;
6 | import com.cwj.express.domain.order.OrderPayment;
7 | import com.cwj.express.vo.order.OrderDashboardVO;
8 | import org.springframework.cloud.openfeign.FeignClient;
9 | import org.springframework.security.access.prepost.PreAuthorize;
10 | import org.springframework.web.bind.annotation.GetMapping;
11 | import org.springframework.web.bind.annotation.PathVariable;
12 | import org.springframework.web.bind.annotation.PostMapping;
13 |
14 | /**
15 | * @author cwj
16 | * 订单服务调用
17 | * 提醒: fallbackFactory可以拿到异常, fallback不可以
18 | */
19 |
20 | @FeignClient(
21 | name = ExpressServiceListConstant.EXPRESS_ORDER,
22 | fallbackFactory = OrderFeignClientFallbackFactory.class
23 | )
24 | public interface OrderFeignClient {
25 | @GetMapping("/order/countEvaluate/{id}/{roleId}")
26 | public int countEvaluate(@PathVariable("id") String id, @PathVariable("roleId") Integer roleId);
27 |
28 | @GetMapping("/order/userDashboardData")
29 | public OrderDashboardVO getUserDashboardData();
30 |
31 | @GetMapping("/order/courierDashboardData")
32 | public OrderDashboardVO getCourerDashboardData();
33 |
34 | @PostMapping("/order/getOrder/{orderId}")
35 | public OrderInfo getOrderById(@PathVariable("orderId") String orderId);
36 |
37 | @PostMapping("/order/getPayment/{orderId}")
38 | public OrderPayment getPaymentById(@PathVariable("orderId") String orderId);
39 |
40 | @GetMapping("/order/countCourierScore/{courierId}")
41 | public Double countCourierScore(@PathVariable(required = false,value = "courierId") String courierId);
42 |
43 | @GetMapping("/order/adminDashboardOrderData")
44 | public OrderDashboardVO adminDashboardOrderData();
45 | }
46 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/com/cwj/express/utils/CookieUtil.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.utils;
2 |
3 | import javax.servlet.http.Cookie;
4 | import javax.servlet.http.HttpServletRequest;
5 | import javax.servlet.http.HttpServletResponse;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created by admin on 2018/3/18.
11 | */
12 | public class CookieUtil {
13 |
14 | /**
15 | * 设置cookie
16 | *
17 | * @param response
18 | * @param name cookie名字
19 | * @param value cookie值
20 | * @param maxAge cookie生命周期 以秒为单位
21 | */
22 | public static void addCookie(HttpServletResponse response, String domain, String path, String name,
23 | String value, int maxAge, boolean httpOnly) {
24 | Cookie cookie = new Cookie(name, value);
25 | cookie.setDomain(domain);
26 | cookie.setPath(path);
27 | cookie.setMaxAge(maxAge);
28 | cookie.setHttpOnly(httpOnly);
29 | response.addCookie(cookie);
30 | }
31 |
32 |
33 |
34 | /**
35 | * 根据cookie名称读取cookie
36 | * @param request
37 | * @param cookieName1,cookieName2
38 | * @return map
39 | */
40 |
41 | public static Map readCookie(HttpServletRequest request, String ... cookieNames) {
42 | Map cookieMap = new HashMap();
43 | Cookie[] cookies = request.getCookies();
44 | if (cookies != null) {
45 | for (Cookie cookie : cookies) {
46 | String cookieName = cookie.getName();
47 | String cookieValue = cookie.getValue();
48 | for(int i=0;i headerNames = request.getHeaderNames();
33 | if(headerNames!=null){
34 | while (headerNames.hasMoreElements()){
35 | String headerName = headerNames.nextElement();
36 | String headerValue = request.getHeader(headerName);
37 | // 将header向下传递
38 | template.header(headerName,headerValue);
39 | }
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/express-utils/src/main/java/com/cwj/express/utils/oldUtils/CookieUtil.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.utils.oldUtils;
2 |
3 | import javax.servlet.http.Cookie;
4 | import javax.servlet.http.HttpServletRequest;
5 | import javax.servlet.http.HttpServletResponse;
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * Created by admin on 2018/3/18.
11 | */
12 | public class CookieUtil {
13 |
14 | /**
15 | * 设置cookie
16 | *
17 | * @param response
18 | * @param name cookie名字
19 | * @param value cookie值
20 | * @param maxAge cookie生命周期 以秒为单位
21 | */
22 | public static void addCookie(HttpServletResponse response, String domain, String path, String name,
23 | String value, int maxAge, boolean httpOnly) {
24 | Cookie cookie = new Cookie(name, value);
25 | cookie.setDomain(domain);
26 | cookie.setPath(path);
27 | cookie.setMaxAge(maxAge);
28 | cookie.setHttpOnly(httpOnly);
29 | response.addCookie(cookie);
30 | }
31 |
32 |
33 |
34 | /**
35 | * 根据cookie名称读取cookie
36 | * @param request
37 | * @param cookieName1,cookieName2
38 | * @return map
39 | */
40 |
41 | public static Map readCookie(HttpServletRequest request, String ... cookieNames) {
42 | Map cookieMap = new HashMap();
43 | Cookie[] cookies = request.getCookies();
44 | if (cookies != null) {
45 | for (Cookie cookie : cookies) {
46 | String cookieName = cookie.getName();
47 | String cookieValue = cookie.getValue();
48 | for(int i=0;i getAreasByParentId(Integer parentId) {
29 | String key = RedisConfig.AREA_HEAD + "::" + parentId;
30 | String redisRes = redisService.get(key);
31 | if (StringUtils.isEmpty(redisRes)){
32 | List dataAreas = dataAreaMapper.
33 | selectList(
34 | new QueryWrapper().select("parent_id", "name").eq("parent_id", parentId).orderByAsc("sort"));
35 | if (!ObjectUtils.isEmpty(dataAreas)){
36 | String value = JSON.toJSONString(dataAreas);
37 | redisService.setKeyValTTL(key, value, RedisConfig.AREA_TTL);
38 | }
39 | return dataAreas;
40 | }
41 | return JSON.parseObject(redisRes, List.class);
42 | }
43 |
44 | @Override
45 | public List selectParentIdDistinct() {
46 | return dataAreaMapper.selectParentIdDistinct();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/express-auth/src/main/java/com/cwj/express/auth/config/auth/CustomUserAuthenticationConverter.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.auth.config.auth;
2 |
3 | import com.cwj.express.domain.ucenter.SysUser;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.security.core.Authentication;
6 | import org.springframework.security.core.authority.AuthorityUtils;
7 | import org.springframework.security.core.userdetails.UserDetails;
8 | import org.springframework.security.core.userdetails.UserDetailsService;
9 | import org.springframework.security.oauth2.provider.token.DefaultUserAuthenticationConverter;
10 | import org.springframework.stereotype.Component;
11 |
12 | import java.util.LinkedHashMap;
13 | import java.util.Map;
14 |
15 | /**
16 | * 用于自定义JwtAccessTokenConverter
17 | */
18 |
19 | @Component
20 | public class CustomUserAuthenticationConverter extends DefaultUserAuthenticationConverter {
21 | @Autowired
22 | UserDetailsService userDetailsService;
23 |
24 | @Override
25 | public Map convertUserAuthentication(Authentication authentication) {
26 | LinkedHashMap response = new LinkedHashMap();
27 | String name = authentication.getName();
28 | response.put("user_name", name);
29 |
30 | Object principal = authentication.getPrincipal();
31 | SysUser userJwt = null;
32 | if(principal instanceof SysUser){
33 | userJwt = (SysUser) principal;
34 | }else{
35 | //refresh_token默认不去调用userdetailService获取用户信息,这里我们手动去调用,得到 UserJwt
36 | UserDetails userDetails = userDetailsService.loadUserByUsername(name);
37 | userJwt = (SysUser) userDetails;
38 | }
39 |
40 | // 前端解析这个jwt,个人觉得jwt只需要唯一id和权限就够了,剩余信息通过请求获取(及时更新),虽然会浪费点性能,
41 | response.put("id", userJwt.getId());
42 | if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
43 | response.put("authorities", AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
44 | }
45 |
46 | return response;
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/express-auth/src/main/resources/public/assets/js/http.js:
--------------------------------------------------------------------------------
1 | /*
2 | desp:HTTP相关
3 | author:jitwxs
4 | time:2018-03-15
5 | */
6 |
7 | var HTTP = {
8 | GET : "GET",
9 | POST : "POST",
10 | DELETE : "DELETE",
11 | PUT : "PUT"
12 | };
13 |
14 | /*
15 | 功能:发送JSON串的AJAX
16 | _type:请求类型:get|post|put|delete
17 | _url:请求路径
18 | _data:json串
19 | _async:是否开启异步
20 | _successCallback:执行成功回调方法
21 | _errorCallback:执行失败回调方法
22 | */
23 | function sendJson(_type, _url, _data, _async, _successCallback, _errorCallback) {
24 | $.ajax({
25 | type: _type,
26 | async: _async,
27 | url: _url,
28 | dataType: 'json',
29 | data: _data,
30 | success: function (msg) {
31 | _successCallback(msg);
32 | },
33 | error: function (error) {
34 | _errorCallback(error);
35 | }
36 | });
37 | }
38 |
39 | function sendArray(_type, _url, _data, _async, _successCallback, _errorCallback) {
40 | $.ajax({
41 | type: _type,
42 | async: _async,
43 | url: _url,
44 | dataType: 'json',
45 | data: _data,
46 | traditional: true, //额外参数,用于传递数组
47 | success: function (msg) {
48 | _successCallback(msg);
49 | },
50 | error: function (error) {
51 | _errorCallback(error);
52 | }
53 | });
54 | }
55 |
56 | /*
57 | 功能:上传文件的AJAX
58 | _url:请求路径
59 | _data:formData对象
60 | _async:是否开启异步
61 | _successCallback:执行成功回调方法
62 | _errorCallback:执行失败回调方法
63 | */
64 | function sendFile(_url, _data, _async, _successCallback, _errorCallback) {
65 | $.ajax({
66 | type: "post",
67 | async: _async,
68 | url: _url,
69 | dataType: 'json',
70 | // 告诉jQuery不要去处理发送的数据
71 | processData : false,
72 | // 告诉jQuery不要去设置Content-Type请求头
73 | contentType: false,
74 | data: _data,
75 | success: function (msg) {
76 | _successCallback(msg);
77 | },
78 | error: function (error) {
79 | _errorCallback(error);
80 | }
81 | });
82 | }
--------------------------------------------------------------------------------
/express-model/src/main/java/com/cwj/express/domain/ucenter/UserFeedback.java:
--------------------------------------------------------------------------------
1 | package com.cwj.express.domain.ucenter;
2 |
3 | import com.baomidou.mybatisplus.annotation.*;
4 | import com.baomidou.mybatisplus.extension.activerecord.Model;
5 | import com.cwj.express.common.enums.FeedbackStatusEnum;
6 | import com.cwj.express.common.enums.FeedbackTypeEnum;
7 | import com.fasterxml.jackson.annotation.JsonFormat;
8 | import io.swagger.annotations.ApiModel;
9 | import io.swagger.annotations.ApiModelProperty;
10 | import lombok.*;
11 | import lombok.experimental.Accessors;
12 |
13 | import java.io.Serializable;
14 | import java.time.LocalDateTime;
15 |
16 | /**
17 | *
18 | * 用户反馈表
19 | *
20 | *
21 | * @author chenwenjie
22 | * @since 2019-11-02
23 | */
24 | @EqualsAndHashCode(callSuper = false)
25 | @Accessors(chain = true)
26 | @Data
27 | @ApiModel(value="UserFeedback对象", description="用户反馈表")
28 | @Builder
29 | @NoArgsConstructor
30 | @AllArgsConstructor
31 | public class UserFeedback extends Model {
32 |
33 | @TableId(type = IdType.INPUT)
34 | private String id;
35 |
36 | @ApiModelProperty(value = "用户ID")
37 | private String userId;
38 |
39 | @ApiModelProperty(value = "反馈类型")
40 | private FeedbackTypeEnum feedbackType;
41 |
42 | @ApiModelProperty(value = "订单ID")
43 | private Long orderId;
44 |
45 | @ApiModelProperty(value = "反馈内容")
46 | private String content;
47 |
48 | @ApiModelProperty(value = "反馈状态")
49 | private FeedbackStatusEnum feedbackStatus;
50 |
51 | @ApiModelProperty(value = "处理人")
52 | private String handler;
53 |
54 | @ApiModelProperty(value = "处理结果")
55 | private String result;
56 |
57 | @TableField(fill = FieldFill.INSERT)
58 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
59 | private LocalDateTime createDate;
60 |
61 | @Version
62 | @TableField(fill = FieldFill.UPDATE)
63 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
64 | private LocalDateTime updateDate;
65 |
66 |
67 | @Override
68 | protected Serializable pkVal() {
69 | return this.id;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/express-ucenter/src/main/resources/templates/common/nav.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | ...
9 |
10 |
23 |
24 |
45 |
--------------------------------------------------------------------------------