From 7de9ff551f6c1df61f8e4ff0eaa6ef5cc38af4c2 Mon Sep 17 00:00:00 2001 From: lcc <656068796@qq.com> Date: Tue, 12 Nov 2024 19:00:36 +0800 Subject: [PATCH] Initial commit --- .idea/inspectionProfiles/Project_Default.xml | 1 + wsf-system/pom.xml | 28 ++ .../cn/tedu/wsf/area/mapper/AreaMapper.java | 15 - .../cn/tedu/wsf/area/pojo/entity/City.java | 17 - .../cn/tedu/wsf/area/pojo/entity/County.java | 17 - .../tedu/wsf/area/pojo/entity/Province.java | 14 - .../java/cn/tedu/wsf/area/pojo/vo/CityVo.java | 17 - .../cn/tedu/wsf/area/pojo/vo/CountyVo.java | 17 - .../cn/tedu/wsf/area/pojo/vo/ProvinceVo.java | 14 - .../cn/tedu/wsf/area/service/AreaService.java | 13 - .../area/service/impl/AreaServiceImpl.java | 33 -- .../tedu/wsf/base/config/CaptchaConfig.java | 80 ++++ .../wsf/base/config/KaptchaTextCreator.java | 67 +++ .../tedu/wsf/base/config/Knife4jConfig.java | 4 +- .../cn/tedu/wsf/base/config/RedisConfig.java | 9 - .../tedu/wsf/base/config/SecurityConfig.java | 17 +- .../cn/tedu/wsf/base/config/SystemConfig.java | 117 +++++ .../cn/tedu/wsf/base/config/WebConfig.java | 36 +- .../tedu/wsf/base/config/WebSocketConfig.java | 19 + .../cn/tedu/wsf/base/config/XxlJobConfig.java | 49 ++ .../wsf/base/constant/CacheConstants.java | 2 +- .../wsf/base/enums/ApplicationStatusEnum.java | 25 - .../tedu/wsf/base/enums/AuditStatusEnum.java | 17 - .../cn/tedu/wsf/base/enums/StatusCode.java | 7 +- .../{handler => file}/UploadController.java | 8 +- .../filter/JwtAuthenticationFilter.java | 9 +- .../base/handler/GlobalExceptionHandler.java | 2 - .../wsf/base/handler/MyWebSocketHandler.java | 57 +++ .../AuthenticationFailureListener.java | 116 ++--- .../AuthenticationSuccessListener.java | 121 ++--- .../cn/tedu/wsf/base/pojo/vo/CaptchaVO.java | 9 + .../java/cn/tedu/wsf/base/utils/IdUtils.java | 49 ++ .../wsf/base/utils/PhoneMessageUtils.java | 54 +++ .../cn/tedu/wsf/base/utils/RedisUtils.java | 10 + .../controller/CategoryController.java} | 51 +-- .../wsf/category/mapper/CategoryMapper.java | 18 + .../pojo/dto/CategoryQueryParam.java} | 20 +- .../wsf/category/pojo/entity/Category.java | 32 ++ .../category/pojo/entity/WorkerCategory.java | 28 ++ .../tedu/wsf/category/pojo/vo/CategoryVo.java | 32 ++ .../wsf/category/service/CategoryService.java | 12 + .../service/impl/CategoryServiceImpl.java | 23 + .../wsf/city/controller/CityController.java | 44 ++ .../cn/tedu/wsf/city/mapper/CityMapper.java | 17 + .../wsf/city/pojo/dto/CityQueryParam.java | 24 + .../cn/tedu/wsf/city/pojo/entity/City.java | 37 ++ .../tedu/wsf/city/pojo/entity/WorkerCity.java | 28 ++ .../java/cn/tedu/wsf/city/pojo/vo/CityVO.java | 36 ++ .../cn/tedu/wsf/city/service/CityService.java | 13 + .../city/service/impl/CityServiceImpl.java | 31 ++ .../tedu/wsf/log/annotation/RequiredLog.java | 12 + .../wsf/log/aspect/OperationLogAspect.java | 120 +++++ .../wsf/log/controller/LogController.java | 43 ++ .../tedu/wsf/log/mapper/LoginInforMapper.java | 4 + .../wsf/log/mapper/OperationLogMapper.java | 17 + .../tedu/wsf/log/pojo/dto/LogQueryParam.java | 24 + .../wsf/log/pojo/dto/OperationQueryParam.java | 17 + .../tedu/wsf/log/pojo/entity/LoginInfor.java | 13 +- .../wsf/log/pojo/entity/OperationLog.java | 28 ++ .../cn/tedu/wsf/log/pojo/vo/LoginInforVO.java | 28 ++ .../tedu/wsf/log/pojo/vo/OperationLogVO.java | 27 ++ .../wsf/log/service/LoginInforService.java | 5 + .../wsf/log/service/OperationLogService.java | 13 + .../service/impl/LoginInforServiceImpl.java | 12 + .../service/impl/OperationLogServiceImpl.java | 29 ++ .../wsf/order/controller/OrderController.java | 48 +- .../cn/tedu/wsf/order/mapper/OrderMapper.java | 11 +- .../wsf/order/pojo/dto/GrabOrderParam.java | 16 + .../wsf/order/pojo/dto/OrderQueryParam.java | 46 ++ .../order/pojo/dto/ReqOrderQueryParam.java | 41 ++ .../order/pojo/dto/ResOrderQueryParams.java | 21 - .../wsf/order/pojo/dto/SaveOrderParam.java | 40 ++ .../cn/tedu/wsf/order/pojo/entity/Order.java | 46 ++ .../wsf/order/pojo/entity/RequestOrder.java | 28 +- .../cn/tedu/wsf/order/pojo/vo/OrderVO.java | 46 ++ .../wsf/order/pojo/vo/RequestOrderVo.java | 30 +- .../tedu/wsf/order/service/OrderService.java | 16 +- .../order/service/impl/OrderServiceImpl.java | 102 ++++- .../cn/tedu/wsf/pay/mapper/AccountMapper.java | 10 + .../cn/tedu/wsf/pay/pojo/entity/Account.java | 23 + .../tedu/wsf/pay/service/AccountService.java | 7 + .../pay/service/impl/AccountServiceImpl.java | 18 + .../cn/tedu/wsf/role/mapper/RoleMapper.java | 11 + .../cn/tedu/wsf/role/pojo/entity/Role.java | 22 + .../tedu/wsf/role/pojo/entity/UserRole.java | 12 + .../wsf/server/controller/TypeController.java | 36 -- .../cn/tedu/wsf/server/mapper/TypeMapper.java | 11 - .../cn/tedu/wsf/server/pojo/entity/Type.java | 14 - .../tedu/wsf/server/pojo/vo/CategoryVo.java | 11 - .../cn/tedu/wsf/server/pojo/vo/TypeVo.java | 10 - .../tedu/wsf/server/service/TypeService.java | 11 - .../server/service/impl/TypeServiceImpl.java | 26 -- .../java/cn/tedu/wsf/test/XxlJobTest.java | 25 + .../user/controller/CaptchaController.java | 76 +++ .../wsf/user/controller/UserController.java | 41 +- .../cn/tedu/wsf/user/mapper/UserMapper.java | 2 + .../wsf/user/pojo/dto/UserLoginParam.java | 4 + .../wsf/user/pojo/dto/UserMessageParam.java | 16 + .../wsf/user/pojo/dto/UserQueryParam.java | 7 +- .../wsf/user/pojo/dto/UserRegisterParam.java | 6 +- .../tedu/wsf/user/pojo/dto/UserSavaParam.java | 15 +- .../cn/tedu/wsf/user/pojo/entity/User.java | 12 +- .../cn/tedu/wsf/user/pojo/vo/CaptchaVo.java | 9 + .../java/cn/tedu/wsf/user/pojo/vo/UserVO.java | 22 +- .../cn/tedu/wsf/user/service/UserService.java | 9 +- .../user/service/impl/UserServiceImpl.java | 124 ++++- .../worker/controller/WorkerController.java | 54 ++- .../tedu/wsf/worker/mapper/WorkerMapper.java | 16 +- .../wsf/worker/pojo/dto/MoveInSaveParam.java | 24 + .../pojo/dto/WorkerAuditQueryParam.java | 25 + .../WorkerQueryParam.java} | 14 +- ...egisterParam.java => WorkerSaveParam.java} | 24 +- .../tedu/wsf/worker/pojo/entity/Worker.java | 14 +- .../wsf/worker/pojo/entity/WorkerAudit.java | 26 ++ .../worker/pojo/entity/WorkerCategory.java | 17 - .../wsf/worker/pojo/vo/WorkerAuditVO.java | 29 ++ .../cn/tedu/wsf/worker/pojo/vo/WorkerVO.java | 31 ++ .../tedu/wsf/worker/server/WorkerService.java | 11 - .../worker/server/impl/WorkerServiceImpl.java | 31 -- .../wsf/worker/service/WorkerService.java | 17 + .../service/impl/WorkerServiceImpl.java | 90 ++++ .../src/main/resources/application.properties | 21 +- .../src/main/resources/http/userhttp.http | 4 +- .../main/resources/mappers/AccountMapper.xml | 23 + .../src/main/resources/mappers/AreaMapper.xml | 15 - .../main/resources/mappers/CategoryMapper.xml | 43 ++ .../src/main/resources/mappers/CityMapper.xml | 45 ++ .../resources/mappers/LoginInforMapper.xml | 30 +- .../resources/mappers/OperationLogMapper.xml | 28 ++ .../main/resources/mappers/OrderMapper.xml | 173 ++++++- .../src/main/resources/mappers/RoleMapper.xml | 15 + .../src/main/resources/mappers/TypeMapper.xml | 12 - .../src/main/resources/mappers/UserMapper.xml | 44 +- .../main/resources/mappers/WorkerMapper.xml | 105 ++++- .../src/test/java/cn/tedu/wsf/CityTest.java | 25 + .../src/test/java/cn/tedu/wsf/ImageTest.java | 17 + .../src/test/java/cn/tedu/wsf/LoginTest.java | 11 + .../test/java/cn/tedu/wsf/WebSocketTest.java | 16 + .../src/test/java/cn/tedu/wsf/WorkerTest.java | 33 +- .../src/test/java/cn/tedu/wsf/XxlJobTest.java | 12 + wsf-ui/src/router/index.js | 7 +- wsf-ui/src/views/HomeView.vue | 101 ++-- wsf-ui/src/views/LoginView.vue | 80 ++-- wsf-ui/src/views/MessageLogin.vue | 101 ++++ wsf-ui/src/views/RegisterView.vue | 22 +- wsf-ui/src/views/log/LoginLogView.vue | 83 +++- wsf-ui/src/views/log/OperationLogView.vue | 89 +++- wsf-ui/src/views/order/OrderView.vue | 117 ++++- wsf-ui/src/views/order/ReqOrderView.vue | 432 ++++++++++++++++++ wsf-ui/src/views/order/WorkerOrderView.vue | 217 +++++++++ wsf-ui/src/views/user/UserView.vue | 335 +++++--------- wsf-ui/src/views/worker/AdminAudit.vue | 245 ++++++++++ wsf-ui/src/views/worker/WorkerAudit.vue | 130 ++++++ wsf-ui/src/views/worker/WorkerView.vue | 419 ++++++++++++++++- 154 files changed, 5314 insertions(+), 1148 deletions(-) delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java rename wsf-system/src/main/java/cn/tedu/wsf/base/{handler => file}/UploadController.java (95%) rename wsf-system/src/main/java/cn/tedu/wsf/{ => base}/filter/JwtAuthenticationFilter.java (90%) create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java rename wsf-system/src/main/java/cn/tedu/wsf/{area/controller/AreaController.java => category/controller/CategoryController.java} (31%) create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java rename wsf-system/src/main/java/cn/tedu/wsf/{server/pojo/entity/Category.java => category/pojo/dto/CategoryQueryParam.java} (35%) create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java rename wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/{entity/WorkerArea.java => dto/WorkerQueryParam.java} (47%) rename wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/{WorkerRegisterParam.java => WorkerSaveParam.java} (42%) create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java delete mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java create mode 100644 wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java create mode 100644 wsf-system/src/main/resources/mappers/AccountMapper.xml delete mode 100644 wsf-system/src/main/resources/mappers/AreaMapper.xml create mode 100644 wsf-system/src/main/resources/mappers/CategoryMapper.xml create mode 100644 wsf-system/src/main/resources/mappers/CityMapper.xml create mode 100644 wsf-system/src/main/resources/mappers/OperationLogMapper.xml create mode 100644 wsf-system/src/main/resources/mappers/RoleMapper.xml delete mode 100644 wsf-system/src/main/resources/mappers/TypeMapper.xml create mode 100644 wsf-system/src/test/java/cn/tedu/wsf/CityTest.java create mode 100644 wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java create mode 100644 wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java create mode 100644 wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java create mode 100644 wsf-ui/src/views/MessageLogin.vue create mode 100644 wsf-ui/src/views/order/ReqOrderView.vue create mode 100644 wsf-ui/src/views/order/WorkerOrderView.vue create mode 100644 wsf-ui/src/views/worker/AdminAudit.vue create mode 100644 wsf-ui/src/views/worker/WorkerAudit.vue diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 83e6c53..3e58c17 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -8,5 +8,6 @@ + \ No newline at end of file diff --git a/wsf-system/pom.xml b/wsf-system/pom.xml index 825a192..3d34b5a 100644 --- a/wsf-system/pom.xml +++ b/wsf-system/pom.xml @@ -14,6 +14,29 @@ 2.7.6 + + org.springframework.boot + spring-boot-starter-websocket + + + org.springframework.boot + spring-boot-starter-aop + + + + + + + + pro.fessional + kaptcha + 2.3.3 + + + cn.hutool + hutool-all + 5.8.27 + com.alibaba.fastjson2 fastjson2 @@ -76,6 +99,11 @@ spring-boot-starter-test test + + com.aliyun + alibabacloud-dysmsapi20170525 + 3.0.0 + diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java deleted file mode 100644 index 07309fb..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/mapper/AreaMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.tedu.wsf.area.mapper; - -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface AreaMapper { - List queryProvince(); - List queryCity(Long parentId); - List queryCounty(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java deleted file mode 100644 index f7b5bf4..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/City.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class City { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省id") - private Long parentId; - @ApiModelProperty(value = "市名") - private String cityName; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java deleted file mode 100644 index e91b85c..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/County.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class County { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "市id") - private Long parentId; - @ApiModelProperty(value = "县名") - private String countyeName; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java deleted file mode 100644 index cbfb530..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/entity/Province.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.area.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class Province { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省名") - private String provinceName; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java deleted file mode 100644 index b08089d..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CityVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class CityVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省id") - private Long parentId; - @ApiModelProperty(value = "市名") - private String cityname; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java deleted file mode 100644 index 42d20ba..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/CountyVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class CountyVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "市id") - private Long parentId; - @ApiModelProperty(value = "县名") - private String countyname; - @ApiModelProperty(value = "状态") - private String status; -} - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java b/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java deleted file mode 100644 index c68dabd..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/pojo/vo/ProvinceVo.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.area.pojo.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class ProvinceVo { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "省名") - private String provincename; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java b/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java deleted file mode 100644 index 0f89cfd..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/service/AreaService.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.tedu.wsf.area.service; - -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; - -import java.util.List; - -public interface AreaService { - List queryProvince(); - List queryCity(Long parentId); - List queryCounty(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java deleted file mode 100644 index af4bef4..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/service/impl/AreaServiceImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.tedu.wsf.area.service.impl; - -import cn.tedu.wsf.area.mapper.AreaMapper; -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import cn.tedu.wsf.area.service.AreaService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -@Service -public class AreaServiceImpl implements AreaService { - @Autowired - AreaMapper areaMapper; - @Override - public List queryProvince() { - List provinceVos = areaMapper.queryProvince(); - return provinceVos; - } - - @Override - public List queryCity(Long parentId) { - List cityVos = areaMapper.queryCity(parentId); - return cityVos; - } - - @Override - public List queryCounty(Long parentId) { - List countyVos = areaMapper.queryCounty(parentId); - return countyVos; - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java new file mode 100644 index 0000000..d1a64b6 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/CaptchaConfig.java @@ -0,0 +1,80 @@ +package cn.tedu.wsf.base.config; + +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Properties; + +import static com.google.code.kaptcha.Constants.*; + +@Configuration +public class CaptchaConfig +{ + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } + + @Bean(name = "captchaProducerMath") + public DefaultKaptcha getKaptchaBeanMath() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 边框颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); + // 验证码文本生成器 + properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "cn.tedu.wsf.base.config.KaptchaTextCreator"); + // 验证码文本字符间距 默认为2 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 验证码噪点颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); + // 干扰实现类 + properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java new file mode 100644 index 0000000..011361f --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/KaptchaTextCreator.java @@ -0,0 +1,67 @@ +package cn.tedu.wsf.base.config; + +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +import java.util.Random; + +/** + * 验证码文本生成器 + */ +public class KaptchaTextCreator extends DefaultTextCreator +{ + private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); + + @Override + public String getText() + { + Integer result = 0; + Random random = new Random(); + int x = random.nextInt(10); + int y = random.nextInt(10); + StringBuilder suChinese = new StringBuilder(); + int randomoperands = random.nextInt(3); + if (randomoperands == 0) + { + result = x * y; + suChinese.append(CNUMBERS[x]); + suChinese.append("*"); + suChinese.append(CNUMBERS[y]); + } + else if (randomoperands == 1) + { + if ((x != 0) && y % x == 0) + { + result = y / x; + suChinese.append(CNUMBERS[y]); + suChinese.append("/"); + suChinese.append(CNUMBERS[x]); + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + } + else + { + if (x >= y) + { + result = x - y; + suChinese.append(CNUMBERS[x]); + suChinese.append("-"); + suChinese.append(CNUMBERS[y]); + } + else + { + result = y - x; + suChinese.append(CNUMBERS[y]); + suChinese.append("-"); + suChinese.append(CNUMBERS[x]); + } + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java index 740e326..b557a65 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/Knife4jConfig.java @@ -34,9 +34,9 @@ public class Knife4jConfig { private ApiInfo apiInfo() { return new ApiInfoBuilder() // 文档标题 - .title("王师傅家具服务平台") + .title("王师傅上门服务平台") // 文档描述信息 - .description("王师傅家具服务平台在线API文档") + .description("王师傅上门服务平台在线API文档") // 文档版本号 .version("1.0") .build(); diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java index f401a92..f9a99bd 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/RedisConfig.java @@ -12,15 +12,6 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class RedisConfig { -// @Bean -// public RedisTemplate redisTemplate(RedisConnectionFactory redisFactory) -// { -// RedisTemplate redisTemplate = new RedisTemplate(); -// redisTemplate.setConnectionFactory(redisFactory); -// redisTemplate.setKeySerializer(RedisSerializer.string()); -// redisTemplate.setValueSerializer(RedisSerializer.json()); -// return redisTemplate; -// } @Bean @SuppressWarnings(value = { "unchecked", "rawtypes" }) public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java index 87541a2..16d004e 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SecurityConfig.java @@ -1,22 +1,21 @@ package cn.tedu.wsf.base.config; import cn.tedu.wsf.base.service.impl.AuthenticationEntryPointImpl; -import cn.tedu.wsf.filter.JwtAuthenticationFilter; +import cn.tedu.wsf.base.filter.JwtAuthenticationFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.filter.CorsFilter; + @EnableWebSecurity @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @@ -24,6 +23,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { private JwtAuthenticationFilter jwtAuthenticationFilter; @Autowired private AuthenticationEntryPointImpl authenticationEntryPoint; + @Autowired + CorsFilter corsFilter; @Bean public PasswordEncoder passwordEncoder(){ @@ -40,17 +41,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .csrf().disable(); http .authorizeRequests() - .antMatchers("/wsf/user/login").anonymous() - .antMatchers("/wsf/user/register").permitAll() + .antMatchers("/wsf/user/login","/wsf/notice","/captchaImage","/wsf/user/messagelogin").anonymous() + .antMatchers("/wsf/user/register","/wsf/file/upload").permitAll() + .antMatchers("/wsf/user/send").anonymous() .anyRequest().authenticated(); // 其他路径需要认证' http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.addFilterBefore(jwtAuthenticationFilter,UsernamePasswordAuthenticationFilter.class); http.exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint); + http.addFilterBefore(corsFilter, JwtAuthenticationFilter.class); } @Override public void configure(WebSecurity web) throws Exception { - web.ignoring().antMatchers("/*.html","/v2/**","/swagger-ui.html","/doc.html","/swagger-resources/**", "/webjars/**"); + web.ignoring().antMatchers("/*.html","/v2/**","/swagger-ui.html","/doc.html","/swagger-resources/**", "/webjars/**","/swagger-resources/**"); } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java new file mode 100644 index 0000000..7bf4574 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/SystemConfig.java @@ -0,0 +1,117 @@ +package cn.tedu.wsf.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "wsf") +public class SystemConfig +{ + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; + + /** 版权年份 */ + private String copyrightYear; + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + /** 验证码类型 */ + private static String captchaType; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getCopyrightYear() + { + return copyrightYear; + } + + public void setCopyrightYear(String copyrightYear) + { + this.copyrightYear = copyrightYear; + } + + public static String getProfile() + { + return profile; + } + + public void setProfile(String profile) + { + SystemConfig.profile = profile; + } + + public static boolean isAddressEnabled() + { + return addressEnabled; + } + + public void setAddressEnabled(boolean addressEnabled) + { + SystemConfig.addressEnabled = addressEnabled; + } + + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + SystemConfig.captchaType = captchaType; + } + + /** + * 获取导入上传路径 + */ + public static String getImportPath() + { + return getProfile() + "/import"; + } + + /** + * 获取头像上传路径 + */ + public static String getAvatarPath() + { + return getProfile() + "/avatar"; + } + + /** + * 获取下载路径 + */ + public static String getDownloadPath() + { + return getProfile() + "/download/"; + } + + /** + * 获取上传路径 + */ + public static String getUploadPath() + { + return getProfile() + "/upload"; + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java index e3a5132..6efec42 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebConfig.java @@ -1,24 +1,38 @@ package cn.tedu.wsf.base.config; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.servlet.http.HttpServletResponse; //1.添加注解 @Configuration -public class WebConfig implements WebMvcConfigurer{//2.implements WebMvcConfigurer - //3.输入addCors,看到提示后回车补全代码 - @Override - public void addCorsMappings(CorsRegistry registry) { - //4.去掉方法体里原有的内容,编写自己的请求策略 - registry.addMapping("/**")// /** 表示在后端允许匹配客户端发过来的任意请求 - .allowedHeaders("*")//请求带任意头都可以 - .allowedMethods("*")//任意请求方式都可以 get/post/put... - .allowedOriginPatterns("*")//任意域都可以(任意请求地址或端口号) - .allowCredentials(true)//请求可以携带会话相关信息(cookie/session) - .maxAge(3600);//同一请求一小时内不再检测 直接放行 +public class WebConfig { + @Bean + public CorsFilter corsFilter() + { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOriginPattern("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 有效期 1800秒 + config.setMaxAge(1800L); + // 添加映射路径,拦截一切请求 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + // 返回新的CorsFilter + return new CorsFilter(source); } + } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java new file mode 100644 index 0000000..d4feaed --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/WebSocketConfig.java @@ -0,0 +1,19 @@ +package cn.tedu.wsf.base.config; + + +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; + +@Configuration +@EnableWebSocket +public class WebSocketConfig implements WebSocketConfigurer { + + @Override + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { + registry.addHandler(new MyWebSocketHandler(), "/wsf/notice").setAllowedOrigins("*"); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java b/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java new file mode 100644 index 0000000..c73ab74 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/config/XxlJobConfig.java @@ -0,0 +1,49 @@ +//package cn.tedu.wsf.base.config; +// +//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.beans.factory.annotation.Value; +// +//@Configuration +//@Slf4j +//public class XxlJobConfig { +// +// @Value("${xxl.job.admin.addresses}") +// private String adminAddresses; +// +// @Value("${xxl.job.executor.appname}") +// private String appName; +// +// /*@Value("${xxl.job.executor.ip}") +// private String ip;*/ +// +// @Value("${xxl.job.executor.port}") +// private int port; +// +// @Value("${xxl.job.accessToken}") +// private String accessToken; +// +// @Value("${xxl.job.executor.logpath}") +// private String logPath; +// +// @Value("${xxl.job.executor.logretentiondays}") +// private int logRetentionDays; +// +// +// @Bean +// public XxlJobSpringExecutor xxlJobExecutor() { +// log.info(">>>>>>>>>>> xxl-job config init."); +// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); +// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); +// xxlJobSpringExecutor.setAppname(appName); +// xxlJobSpringExecutor.setPort(port); +// xxlJobSpringExecutor.setAccessToken(accessToken); +// xxlJobSpringExecutor.setLogPath(logPath); +// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); +// +// return xxlJobSpringExecutor; +// } +// +//} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java b/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java index 3861209..99e8bcc 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/constant/CacheConstants.java @@ -35,7 +35,7 @@ public class CacheConstants * 验证码 redis key */ public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; - + public static final String PHONE_CODE_KEY = "phone_codes:"; /** * 参数管理 cache key */ diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java deleted file mode 100644 index d694a6a..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/ApplicationStatusEnum.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.tedu.wsf.base.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/*车辆申请单状态枚举*/ -@Getter -@AllArgsConstructor -public enum ApplicationStatusEnum { - PENDING("10","已发起"), - CANCEL("20","撤销"), - AUDIT("30","审核中"), - REJECT("40","驳回"), - AUDITED("50","已审核"), - ALLOCATION("60","已分配用车"), - END("70","工单结束"); - - private String code; - private String msg; -} - - - - - diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java deleted file mode 100644 index 592b1aa..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/AuditStatusEnum.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.base.enums; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/*车辆审核状态枚举*/ -@Getter -@AllArgsConstructor -public enum AuditStatusEnum { - MY_PENDING("10","待我审核"), - PENDING("20","待他人审核"), - AUDITED("30","已审核"), - REJECT("40","驳回"); - - private String code; - private String msg; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java index bde1701..41beaba 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/enums/StatusCode.java @@ -11,12 +11,13 @@ public enum StatusCode { SUCCESS(2000, "OK"), LOGIN_SUCCESS(2001, "登录成功"), OPERATION_SUCCESS(2002, "操作成功"), - - + CAPTCHA_ERROR(4001, "验证码错误或过时"), + PHONE_ERROR(4005, "手机验证码错误或过时"), + USER_NOT_EXISTS(4000, "用户不存在"), NOT_LOGIN(4000, "未登录"), PASSWORD_ERROR(4002, "用户名错误"), USERNAME_ERROR(4003, "密码错误"), - + PHONE_CODE_EXIST(4004, "已发送,请等待"), OPERATION_FAILED(5001, "操作失败"), VALIDATE_ERROR(5002, "请求参数错误"), USERNAME_ALREADY_EXISTS(5003, "用户名被占用"), diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java b/wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java similarity index 95% rename from wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java rename to wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java index baea453..5b4282a 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/UploadController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/file/UploadController.java @@ -1,5 +1,6 @@ -package cn.tedu.wsf.base.handler; +package cn.tedu.wsf.base.file; +import cn.tedu.wsf.base.handler.JsonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -17,13 +18,13 @@ import java.util.UUID; @Api("文件上传") @Slf4j @RestController -@RequestMapping("/v1/file") +@RequestMapping("/wsf/file") public class UploadController { /* * 定义方法处理图片上传功能 */ @ApiOperation("上传文件") - @PostMapping("upload") + @PostMapping("/upload") @ApiImplicitParam(name = "file",value="文件路径",required = true) //MultipartFile用来接收上传图片文件的对象 //注意:形参file必须与前端upload上传组件的name一致! @@ -53,7 +54,6 @@ public class UploadController { //10.将图片保存在指定的文件夹中 file.transferTo(new File(filePath)); System.out.println(filePath); - System.out.println("lll"); //11.把日期路径+图片名 响应给前端,前端拿到这个数据后再回显图片 return JsonResult.ok(datePath+fileName); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java b/wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java similarity index 90% rename from wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java rename to wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java index 953c2bc..fa61526 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/filter/JwtAuthenticationFilter.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/filter/JwtAuthenticationFilter.java @@ -1,4 +1,4 @@ -package cn.tedu.wsf.filter; +package cn.tedu.wsf.base.filter; import cn.tedu.wsf.base.service.impl.LoginUser; import cn.tedu.wsf.base.utils.JwtUtils; @@ -17,6 +17,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Enumeration; import java.util.Objects; @Slf4j @Component @@ -27,8 +28,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { RedisUtils redisUtils; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - String token = request.getHeader("token"); - System.out.println("token:"+token); + Enumeration headerNames = request.getHeaderNames(); + String token = request.getHeader("Authorization"); if (!StringUtils.hasText(token)){ filterChain.doFilter(request,response); return; @@ -39,9 +40,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { } String userid = claims.getSubject(); - System.out.println(userid); LoginUser loginUser = (LoginUser) redisUtils.get("login:" + userid); - System.out.println("loginUser"+loginUser); if (Objects.isNull(loginUser)){ throw new RuntimeException("请重新登录"); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java index 00591d4..8525384 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/GlobalExceptionHandler.java @@ -80,7 +80,6 @@ public class GlobalExceptionHandler { */ @ExceptionHandler public JsonResult doHandleMethodArgumentNotValidException(MethodArgumentNotValidException ex) { - //Validation中,验证POJO类型参数获取提示消息使用: ex.getFieldError().getDefaultMessage() 方法. String message = ex.getFieldError().getDefaultMessage(); log.error("MethodArgumentNotValidException: " + message); @@ -95,7 +94,6 @@ public class GlobalExceptionHandler { */ @ExceptionHandler public JsonResult doHandleConstraintViolationException(ConstraintViolationException ex) { - // selectById.id: 微博ID必须在200-500之间 ----> 微博ID必须在200-500之间 String message = ex.getMessage().split(":")[1].trim(); log.error("ConstraintViolationException: " + message); diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java new file mode 100644 index 0000000..beb3b13 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/handler/MyWebSocketHandler.java @@ -0,0 +1,57 @@ +package cn.tedu.wsf.base.handler; + +import cn.tedu.wsf.base.utils.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; +import org.springframework.web.socket.CloseStatus; +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component +public class MyWebSocketHandler extends TextWebSocketHandler { + @Autowired + RedisUtils redisUtils; + private static final Map sessions = new ConcurrentHashMap<>(); + @Override + public void afterConnectionEstablished(WebSocketSession session) throws Exception { + // 从URL参数中获取userId + String userId = session.getUri().getQuery().split("=")[1]; + if (userId == null) { + throw new IllegalArgumentException("UserId is required"); + } +// redisUtils.set(userId,session); + sessions.put(userId, session); + System.out.println("WebSocket connection established for user: " + sessions); + } + + @Override + public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { + String userId = session.getUri().getQuery().split("=")[1]; +// redisUtils.delete(userId); + System.out.println("WebSocket connection closed for user: " + userId); + } + + // 发送通知的方法 + public void sendNotification(String userId, String notice){ +// WebSocketSession session = (WebSocketSession) redisUtils.get(userId); + WebSocketSession session = sessions.get(userId); + System.out.println("sessions: " + sessions); + if (session != null && session.isOpen()) { + try { + System.out.println("Sending notification to user: " + notice); + session.sendMessage(new TextMessage(notice)); + System.out.println("Sent notification to user: " + userId); + } catch (IOException e) { + // 处理发送失败的情况 + e.printStackTrace(); + } + } + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java index 62ada28..f0749c1 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationFailureListener.java @@ -1,58 +1,58 @@ -//package cn.tedu.wsf.base.listener; -// -//import cn.tedu.wsf.base.utils.AddressUtils; -//import cn.tedu.wsf.base.utils.IpUtils; -//import cn.tedu.wsf.base.utils.LoggerUtil; -//import cn.tedu.wsf.base.utils.WebUtil; -//import cn.tedu.wsf.log.pojo.entity.LoginInfor; -//import cn.tedu.wsf.log.service.LoginInforService; -//import lombok.extern.slf4j.Slf4j; -//import nl.bitwalker.useragentutils.Browser; -//import nl.bitwalker.useragentutils.OperatingSystem; -//import nl.bitwalker.useragentutils.UserAgent; -//import org.slf4j.Logger; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.ApplicationListener; -//import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; -//import org.springframework.security.core.userdetails.UserDetails; -//import org.springframework.stereotype.Component; -// -//import javax.servlet.http.HttpServletRequest; -//import java.util.Date; -// -//@Slf4j -//@Component -//public class AuthenticationFailureListener implements ApplicationListener { -// @Autowired -// LoginInforService loginInforService; -// private final Logger logger = LoggerUtil.getLogger(AuthenticationFailureListener.class); -// @Override -// public void onApplicationEvent(AbstractAuthenticationFailureEvent event) { -// String username = event.getAuthentication().getName(); -// saveLoginInfor(username); -// } -// private void saveLoginInfor(String username){ -// HttpServletRequest request = WebUtil.getRequest(); -// UserAgent userAgent = -// UserAgent.parseUserAgentString(request.getHeader("User-Agent")); -// // 获取客户端操作系统 -// String os = userAgent.getOperatingSystem().getName(); -// // 获取客户端浏览器 -// String browser = userAgent.getBrowser().getName(); -// System.out.println("os="+os+"browser="+browser); -// //获取ip地址以及位置 -// request.getRemoteAddr(); -// String ip = IpUtils.getIpAddress(request); -// String region= AddressUtils.getIpRegion(ip); -// LoginInfor loginInfor=new LoginInfor(); -// loginInfor.setLoginName(username); -// loginInfor.setBrowser(browser); -// loginInfor.setOs(os); -// loginInfor.setIpaddr(ip); -// loginInfor.setLoginLocation(region); -// loginInfor.setStatus("1"); -// loginInfor.setLoginTime(new Date()); -// loginInfor.setMsg("login error"); -// loginInforService.insert(loginInfor); -// } -//} +package cn.tedu.wsf.base.listener; + +import cn.tedu.wsf.base.utils.AddressUtils; +import cn.tedu.wsf.base.utils.IpUtils; +import cn.tedu.wsf.base.utils.LoggerUtil; +import cn.tedu.wsf.base.utils.WebUtil; +import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.service.LoginInforService; +import lombok.extern.slf4j.Slf4j; +import nl.bitwalker.useragentutils.Browser; +import nl.bitwalker.useragentutils.OperatingSystem; +import nl.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; + +@Slf4j +@Component +public class AuthenticationFailureListener implements ApplicationListener { + @Autowired + LoginInforService loginInforService; + private final Logger logger = LoggerUtil.getLogger(AuthenticationFailureListener.class); + @Override + public void onApplicationEvent(AbstractAuthenticationFailureEvent event) { + String username = event.getAuthentication().getName(); + saveLoginInfor(username); + } + private void saveLoginInfor(String username){ + HttpServletRequest request = WebUtil.getRequest(); + UserAgent userAgent = + UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + System.out.println("os="+os+"browser="+browser); + //获取ip地址以及位置 + request.getRemoteAddr(); + String ip = IpUtils.getIpAddress(request); + String region= AddressUtils.getIpRegion(ip); + LoginInfor loginInfor=new LoginInfor(); + loginInfor.setUserName(username); + loginInfor.setBrowser(browser); + loginInfor.setOs(os); + loginInfor.setIpaddr(ip); + loginInfor.setLoginLocation(region); + loginInfor.setStatus("1"); + loginInfor.setLoginTime(new Date()); + loginInfor.setMsg("login error"); + loginInforService.insert(loginInfor); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java index 16b023d..80db461 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/listener/AuthenticationSuccessListener.java @@ -1,60 +1,61 @@ -//package cn.tedu.wsf.base.listener; -// -//import cn.tedu.wsf.base.utils.AddressUtils; -//import cn.tedu.wsf.base.utils.IpUtils; -//import cn.tedu.wsf.base.utils.LoggerUtil; -//import cn.tedu.wsf.base.utils.WebUtil; -//import cn.tedu.wsf.log.pojo.entity.LoginInfor; -//import cn.tedu.wsf.log.service.LoginInforService; -//import lombok.extern.slf4j.Slf4j; -//import nl.bitwalker.useragentutils.UserAgent; -//import org.slf4j.Logger; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.ApplicationListener; -//import org.springframework.security.authentication.event.AuthenticationSuccessEvent; -//import org.springframework.security.core.userdetails.UserDetails; -//import org.springframework.stereotype.Component; -// -//import javax.servlet.http.HttpServletRequest; -//import java.util.Date; -// -//@Slf4j -//@Component -//public class AuthenticationSuccessListener implements ApplicationListener { -// -// private final Logger logger = LoggerUtil.getLogger(AuthenticationSuccessListener.class); -// @Autowired -// LoginInforService loginInforService; -// @Override -// public void onApplicationEvent(AuthenticationSuccessEvent event) { -// Object principal = event.getAuthentication().getPrincipal(); -// if(principal instanceof UserDetails){ -// String username=((UserDetails)principal).getUsername(); -// saveLoginInfor(username); -// } -// } -// private void saveLoginInfor(String username){ -// HttpServletRequest request = WebUtil.getRequest(); -// UserAgent userAgent = -// UserAgent.parseUserAgentString(request.getHeader("User-Agent")); -// // 获取客户端操作系统 -// String os = userAgent.getOperatingSystem().getName(); -// // 获取客户端浏览器 -// String browser = userAgent.getBrowser().getName(); -// System.out.println("os="+os+"browser="+browser); -// //获取ip地址以及位置 -// request.getRemoteAddr(); -// String ip = IpUtils.getIpAddress(request); -// String region= AddressUtils.getIpRegion(ip); -// LoginInfor loginInfor=new LoginInfor(); -// loginInfor.setLoginName(username); -// loginInfor.setBrowser(browser); -// loginInfor.setOs(os); -// loginInfor.setIpaddr(ip); -// loginInfor.setLoginLocation(region); -// loginInfor.setStatus("0"); -// loginInfor.setLoginTime(new Date()); -// loginInfor.setMsg("login ok"); -// loginInforService.insert(loginInfor); -// } -//} +package cn.tedu.wsf.base.listener; + +import cn.tedu.wsf.base.utils.AddressUtils; +import cn.tedu.wsf.base.utils.IpUtils; +import cn.tedu.wsf.base.utils.LoggerUtil; +import cn.tedu.wsf.base.utils.WebUtil; +import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.service.LoginInforService; +import lombok.extern.slf4j.Slf4j; +import nl.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.event.AuthenticationSuccessEvent; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; + +@Slf4j +@Component +public class AuthenticationSuccessListener implements ApplicationListener { + + private final Logger logger = LoggerUtil.getLogger(AuthenticationSuccessListener.class); + @Autowired + LoginInforService loginInforService; + @Override + public void onApplicationEvent(AuthenticationSuccessEvent event) { + Object principal = event.getAuthentication().getPrincipal(); + if(principal instanceof UserDetails){ + String username=((UserDetails)principal).getUsername(); + saveLoginInfor(username); + } + } + private void saveLoginInfor(String username){ + HttpServletRequest request = WebUtil.getRequest(); + UserAgent userAgent = + UserAgent.parseUserAgentString(request.getHeader("User-Agent")); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + System.out.println("os="+os+"browser="+browser); + //获取ip地址以及位置 + request.getRemoteAddr(); + String ip = IpUtils.getIpAddress(request); + String region= AddressUtils.getIpRegion(ip); + System.out.println(region+"........................."); + LoginInfor loginInfor=new LoginInfor(); + loginInfor.setUserName(username); + loginInfor.setBrowser(browser); + loginInfor.setOs(os); + loginInfor.setIpaddr(ip); + loginInfor.setLoginLocation(region); + loginInfor.setStatus("0"); + loginInfor.setLoginTime(new Date()); + loginInfor.setMsg("login ok"); + loginInforService.insert(loginInfor); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java b/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java new file mode 100644 index 0000000..91f88b2 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/pojo/vo/CaptchaVO.java @@ -0,0 +1,9 @@ +package cn.tedu.wsf.base.pojo.vo; + +import lombok.Data; + +@Data +public class CaptchaVO { + private String uuid; + private String img; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java new file mode 100644 index 0000000..1f42294 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/IdUtils.java @@ -0,0 +1,49 @@ +package cn.tedu.wsf.base.utils; + +import cn.hutool.core.lang.UUID; + +/** + * ID生成器工具类 + */ +public class IdUtils +{ + /** + * 获取随机UUID + * + * @return 随机UUID + */ + public static String randomUUID() + { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + */ + public static String simpleUUID() + { + return UUID.randomUUID().toString(true); + } + + /** + * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 随机UUID + */ + public static String fastUUID() + { + return UUID.fastUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 简化的UUID,去掉了横线 + */ + public static String fastSimpleUUID() + { + return UUID.fastUUID().toString(true); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java new file mode 100644 index 0000000..18d9265 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/PhoneMessageUtils.java @@ -0,0 +1,54 @@ +package cn.tedu.wsf.base.utils; + +import cn.tedu.wsf.base.constant.CacheConstants; +import cn.tedu.wsf.base.constant.Constants; +import com.aliyun.auth.credentials.Credential; +import com.aliyun.auth.credentials.provider.StaticCredentialProvider; +import com.aliyun.sdk.service.dysmsapi20170525.AsyncClient; +import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsRequest; +import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse; +import com.google.gson.Gson; +import darabonba.core.client.ClientOverrideConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +@Component +public class PhoneMessageUtils { + public int code; + @Autowired + RedisUtils redisUtils; + public void sendVerification(String phone) throws Exception{ + + StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() + .accessKeyId("LTAI5tLJQprLUNVGNBYwqkP5") + .accessKeySecret("PDLk0i2bGeCfTWsUIZlx4quTuq9eSS") + .build()); + AsyncClient client = AsyncClient.builder() + .credentialsProvider(provider) + .overrideConfiguration( + ClientOverrideConfiguration.create() + .setEndpointOverride("dysmsapi.aliyuncs.com") + ) + .build(); + + Random random = new Random(); + code=random.nextInt(9000) + 1000; + redisUtils.setCacheObject(CacheConstants.PHONE_CODE_KEY+phone,code , Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + SendSmsRequest sendSmsRequest = SendSmsRequest.builder() + .phoneNumbers(phone) + .signName("lichangcheng") + .templateCode("SMS_471250283") + .templateParam("{\"code\":\""+code+"\"}") + //.templateParam("{\"code\":\"123456\"}") + .build(); + CompletableFuture response = client.sendSms(sendSmsRequest); + SendSmsResponse resp = response.get(); + System.out.println(new Gson().toJson(resp)); + client.close(); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java index bac9c54..477d63c 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/base/utils/RedisUtils.java @@ -4,6 +4,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; +import java.util.concurrent.TimeUnit; + @Component public class RedisUtils { @Autowired @@ -18,4 +20,12 @@ public class RedisUtils { public void delete(String key) { redisTemplate.delete(key); } + public void setCacheObject(final String key, final String value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + public void setCacheObject(final String key, final int value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java b/wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java similarity index 31% rename from wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java rename to wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java index 165ee6a..efb40d4 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/area/controller/AreaController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/controller/CategoryController.java @@ -1,10 +1,8 @@ -package cn.tedu.wsf.area.controller; +package cn.tedu.wsf.category.controller; -import cn.tedu.wsf.area.pojo.vo.CityVo; -import cn.tedu.wsf.area.pojo.vo.CountyVo; -import cn.tedu.wsf.area.pojo.vo.ProvinceVo; -import cn.tedu.wsf.area.service.AreaService; import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.service.CategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -13,31 +11,28 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.List; - -@RestController @Slf4j -@RequestMapping("/wsf/area") -@Api("地区模块") -public class AreaController { +@RestController +@Api("品类模块") +@RequestMapping("/wsf/category") +public class CategoryController { @Autowired - AreaService areaService; - @ApiOperation("查询省份") - @GetMapping("queryprovince") - public JsonResult queryProvince(){ - List provinceVos = areaService.queryProvince(); - return JsonResult.ok(provinceVos); + CategoryService categoryService; + @ApiOperation("加载一级品类") + @GetMapping("/type") + public JsonResult loadType(){ + log.info("加载一级品类"); + Category category=new Category(); + category.setDepth(1); + return JsonResult.ok(categoryService.selectByQueryParam(category)); } - @ApiOperation("查询城市") - @GetMapping("querycity") - public JsonResult queryCity(Long provinceid){ - List cityVos = areaService.queryCity(provinceid); - return JsonResult.ok(cityVos); - } - @ApiOperation("查询县") - @GetMapping("querycounty") - public JsonResult queryCounty(Long cityid){ - List countyVos = areaService.queryCounty(cityid); - return JsonResult.ok(countyVos); + @ApiOperation("加载二级品类") + @GetMapping("/category") + public JsonResult loadCategory(Long categoryId){ + log.info("加载二级品类"); + Category category=new Category(); + category.setParentId(categoryId); + return JsonResult.ok(categoryService.selectByQueryParam(category)); } + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java new file mode 100644 index 0000000..0037826 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/mapper/CategoryMapper.java @@ -0,0 +1,18 @@ +package cn.tedu.wsf.category.mapper; + + +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CategoryMapper { + List selectByQueryParam(Category category); + int deleteWorkerCategory(Long workerId); + int insertWorkerCategory(@Param("workerId") Long workerId, @Param("categoryIds") Long[] categoryIds); + int insertCategory(Category category); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java similarity index 35% rename from wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java rename to wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java index 5cdb29f..bffc102 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Category.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/dto/CategoryQueryParam.java @@ -1,17 +1,21 @@ -package cn.tedu.wsf.server.pojo.entity; +package cn.tedu.wsf.category.pojo.dto; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data -public class Category { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "服务id") - private Long parentId; - @ApiModelProperty(value = "技能名") +public class CategoryQueryParam { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; @ApiModelProperty(value = "状态") private String status; + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java new file mode 100644 index 0000000..34def54 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/Category.java @@ -0,0 +1,32 @@ +package cn.tedu.wsf.category.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Category { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") + private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java new file mode 100644 index 0000000..4d8cd7a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/entity/WorkerCategory.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.category.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerCategory { + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "师傅ID") + private Long workerId; + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java new file mode 100644 index 0000000..8da55e8 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/pojo/vo/CategoryVo.java @@ -0,0 +1,32 @@ +package cn.tedu.wsf.category.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CategoryVo { + @ApiModelProperty(value = "分类ID") + private Long categoryId; + @ApiModelProperty(value = "分类名称") + private String categoryName; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "分类级别") + private Integer depth; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java b/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java new file mode 100644 index 0000000..575272f --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/service/CategoryService.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.category.service; + + +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; + +import java.util.List; + +public interface CategoryService { + List selectByQueryParam(Category category); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java new file mode 100644 index 0000000..d02e6f4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/category/service/impl/CategoryServiceImpl.java @@ -0,0 +1,23 @@ +package cn.tedu.wsf.category.service.impl; + +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import cn.tedu.wsf.category.service.CategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class CategoryServiceImpl implements CategoryService { + @Autowired + CategoryMapper categoryMapper; + + + @Override + public List selectByQueryParam(Category category) { + return categoryMapper.selectByQueryParam(category); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java b/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java new file mode 100644 index 0000000..b4d01c9 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/controller/CityController.java @@ -0,0 +1,44 @@ +package cn.tedu.wsf.city.controller; + + +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.city.service.CityService; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@Slf4j +@RequestMapping("/wsf/city") +@Api("地区模块") +public class CityController { + + @Autowired + CityService cityService; + @GetMapping("/query") + public JsonResult queryCityList(CityQueryParam cityQueryParam){ + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } + @GetMapping("/province") + public JsonResult loadProvince(){ + CityQueryParam cityQueryParam=new CityQueryParam(); + cityQueryParam.setDepth(1); + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } + @GetMapping("/city") + public JsonResult loadCity(Long cityId){ + CityQueryParam cityQueryParam=new CityQueryParam(); + cityQueryParam.setParentId(cityId); + List cityVOS = cityService.queryCityList(cityQueryParam); + return JsonResult.ok(cityVOS); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java new file mode 100644 index 0000000..aee3971 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/mapper/CityMapper.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.city.mapper; + + +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CityMapper { + List queryCityList(City city); + int deleteWorkerCity(Long workerId); + int insertWorkerCity(@Param("workerId") Long workerId, @Param("cityIds") Long[] cityIds); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java new file mode 100644 index 0000000..8544ad1 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/dto/CityQueryParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.city.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CityQueryParam { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java new file mode 100644 index 0000000..7b59f2a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/City.java @@ -0,0 +1,37 @@ +package cn.tedu.wsf.city.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class City { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java new file mode 100644 index 0000000..28bced4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/entity/WorkerCity.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.city.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerCity { + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "师傅ID") + private Long workerId; + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "状态") + private String status; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java new file mode 100644 index 0000000..def15c0 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/pojo/vo/CityVO.java @@ -0,0 +1,36 @@ +package cn.tedu.wsf.city.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class CityVO { + @ApiModelProperty(value = "城市ID") + private Long cityId; + @ApiModelProperty(value = "父亲ID") + private Long parentId; + @ApiModelProperty(value = "城市名称") + private String cityName; + @ApiModelProperty(value = "地址编码") + private String code; + @ApiModelProperty(value = "城市级别") + private Integer depth; + @ApiModelProperty(value = "城市编码") + private String cityCode; + @ApiModelProperty(value = "删除标记") + private String delFlag; + @ApiModelProperty(value = "是否是直辖市") + private Integer isMunicipality; + @ApiModelProperty(value = "创建人ID") + private Long createUserId; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改人ID") + private Long modifyUserId; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + @ApiModelProperty(value = "创建人名称") + private String createUserName; + @ApiModelProperty(value = "修改人名称") + private String modifiedUserName; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java b/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java new file mode 100644 index 0000000..e9e0709 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/service/CityService.java @@ -0,0 +1,13 @@ +package cn.tedu.wsf.city.service; + + +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; + +import java.util.List; + +public interface CityService { + List queryCityList(CityQueryParam cityQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java new file mode 100644 index 0000000..898aa4f --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/city/service/impl/CityServiceImpl.java @@ -0,0 +1,31 @@ +package cn.tedu.wsf.city.service.impl; + + +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.dto.CityQueryParam; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.city.service.CityService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Transactional +@Service +public class CityServiceImpl implements CityService { + @Autowired + CityMapper cityMapper; + + @Override + public List queryCityList(CityQueryParam cityQueryParam) { + + City city=new City(); + BeanUtils.copyProperties(cityQueryParam,city); + List cityVOS = cityMapper.queryCityList(city); + return cityVOS; + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java b/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java new file mode 100644 index 0000000..87ddb1b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/annotation/RequiredLog.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.log.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface RequiredLog { + String operation() default ""; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java b/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java new file mode 100644 index 0000000..a38e0ed --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/aspect/OperationLogAspect.java @@ -0,0 +1,120 @@ +package cn.tedu.wsf.log.aspect; + + +import cn.tedu.wsf.base.service.impl.LoginUser; +import cn.tedu.wsf.base.utils.JwtUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.service.OperationLogService; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.jsonwebtoken.Claims; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; +import java.util.Date; + +@Slf4j +@Aspect +@Component +public class OperationLogAspect { + + @Autowired + private OperationLogService operationLogService; + @Autowired + JwtUtils jwtUtils; + @Autowired + RedisUtils redisUtils; + + /** + * 通过@Pointcut定义切入点,@annotation是切入点表达式的一种写法, + * 这里表示基于@RequriedLog注解描述的方法为切入点方法。 + */ + @Pointcut("@annotation(cn.tedu.wsf.log.annotation.RequiredLog)") + public void doLog(){}//这个方法内部不用写任何代码,此方法只负责承载注解的定义。 + + /** + * 通过@Around注解描述功能拓展方法,表示我们在此方法内部可以为目标业务方法进行 + * 功能拓展,可以在目标业务执行之前,也可以在目标业务执行之后,添加拓展业务逻辑 + * @param joinPoint + */ + @Around("doLog()") + public Object doLogAround(ProceedingJoinPoint joinPoint)throws Throwable{ + int status=1;//初始状态 + String error="无";//初始错误信息 + long time=0l;//耗时 + long t1=System.currentTimeMillis(); + try{ + Object result=joinPoint.proceed();//调用目标业务执行链(可能会有其它切面的拓展业务+目标方法业务) + //System.out.println("@Around.After"); + long t2=System.currentTimeMillis(); + time=t2-t1; + return result; + }catch (Throwable e){ + long t3=System.currentTimeMillis(); + log.info("@Around.Exception {}",t3); + time=t3-t1; + status=0;//表示出错了 + error=e.getMessage(); + throw e; + }finally{ + //异步记录日志,要思考为什么要异步记录?使用tomcat的线程去记录不可以吗? + saveLog(joinPoint,time,status,error); + } + } + private void saveLog(ProceedingJoinPoint joinPoint,long time,int status,String error) + throws NoSuchMethodException, JsonProcessingException { + //1.获取用户行为日志 + //1.1获取ip地址 + ServletRequestAttributes requestAttributes= + (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = requestAttributes.getRequest(); + String ip=request.getRemoteAddr(); + //1.2获取登陆用户 + String token = request.getHeader("Authorization"); + Claims claims = jwtUtils.parseToken(token); + String userid = claims.getSubject(); + LoginUser loginUser = (LoginUser) redisUtils.get("login:" + userid); + String username=loginUser.getUsername(); + //1.3获取操作名 + //1.3.1获取类的字节码对象 + Class targetCls=joinPoint.getTarget().getClass(); + //1.3.2获取方法签名对象 + MethodSignature ms=(MethodSignature) joinPoint.getSignature(); + //1.3.3获取目标方法对象 + Method targetMethod = + targetCls.getDeclaredMethod( + ms.getName(),//方法名 + ms.getParameterTypes());//参数列表类型 + //1.3.4获取方法上的注解 + RequiredLog requiredLog = targetMethod.getAnnotation(RequiredLog.class); + //1.3.5获取操作名 + String operation=requiredLog.operation(); + //1.4获取目标方法名(类全名+方法名) + String method=targetCls.getName()+"."+targetMethod.getName(); + String param=new ObjectMapper().writeValueAsString(joinPoint.getArgs()); + //2.封装用户行为日志 + OperationLog userLog=new OperationLog(); + userLog.setIp(ip); + userLog.setUsername(username); + userLog.setCreateTime(new Date()); + userLog.setOperation(operation); + userLog.setMethod(method); + userLog.setParams(param); + userLog.setStatus(status); + userLog.setError(error); + userLog.setTime(time); + operationLogService.insertOperationLog(userLog); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java b/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java new file mode 100644 index 0000000..22f17eb --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/controller/LogController.java @@ -0,0 +1,43 @@ +package cn.tedu.wsf.log.controller; + +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import cn.tedu.wsf.log.service.LoginInforService; +import cn.tedu.wsf.log.service.OperationLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +@Slf4j +@Api(tags = "日志管理") +@RestController +@RequestMapping("/wsf/log") +public class LogController { + @Autowired + LoginInforService loginInforService; + @Autowired + OperationLogService operationLogService; + @ApiOperation("登录日志查询") + @GetMapping("/queryLoginList") + public JsonResult selectLogList(LogQueryParam logQueryParam){ + log.debug("logQueryParam:{}",logQueryParam); + List loginInforVOS = loginInforService.selectLoginList(logQueryParam); + return JsonResult.ok(loginInforVOS); + } + @ApiOperation("操作日志查询") + @GetMapping("/queryOperationLogList") + public JsonResult selectOperationLogList(OperationQueryParam operationQueryParam){ + log.debug("operationQueryParam:{}",operationQueryParam); + List operationLogVOS = operationLogService.selectOperationLogList(operationQueryParam); + return JsonResult.ok(operationLogVOS); + } + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java index 2401104..a3002ec 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/LoginInforMapper.java @@ -1,9 +1,13 @@ package cn.tedu.wsf.log.mapper; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface LoginInforMapper { void insert(LoginInfor loginInfor); + List selectLoginList(LoginInfor loginInfor); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java new file mode 100644 index 0000000..72766b4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/mapper/OperationLogMapper.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.log.mapper; + + +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface OperationLogMapper { + + int insert(OperationLog operationLog); + + List selectList(OperationQueryParam operationQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java new file mode 100644 index 0000000..8d04f7e --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/LogQueryParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.log.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class LogQueryParam { + @ApiModelProperty(value = "用户名") + private String usernName; + @ApiModelProperty(value = "登录时间") + private String loginTime; + @ApiModelProperty(value = "登录状态") + private String status; + @ApiModelProperty(value = "登录ip") + private String ipaddr; + @ApiModelProperty(value = "登录地点") + private String loginLocation; + @ApiModelProperty(value = "登录浏览器") + private String browser; + @ApiModelProperty(value = "登录操作系统") + private String os; + @ApiModelProperty(value = "登录信息") + private String msg; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java new file mode 100644 index 0000000..7399197 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/dto/OperationQueryParam.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.log.pojo.dto; + +import lombok.Data; + +import java.util.Date; + +@Data +public class OperationQueryParam { + + private String username; + + private String operation; + + private Integer status; + + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java index 0fecceb..4c90679 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/LoginInfor.java @@ -1,18 +1,29 @@ package cn.tedu.wsf.log.pojo.entity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @Data public class LoginInfor { + @ApiModelProperty(value = "id") private Long infoId; - private String loginName; + @ApiModelProperty(value = "用户名") + private String userName; + @ApiModelProperty(value = "ip地址") private String ipaddr; + @ApiModelProperty(value = "登录地点") private String loginLocation; + @ApiModelProperty(value = "浏览器") private String browser; + @ApiModelProperty(value = "操作系统") private String os; + @ApiModelProperty(value = "登录状态 0:成功 1:失败") private String status; + @ApiModelProperty(value = "登录信息") private String msg; + @ApiModelProperty(value = "登录时间") private Date loginTime; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java new file mode 100644 index 0000000..e17a1a7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/entity/OperationLog.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.log.pojo.entity; + +import lombok.Data; + +import java.util.Date; +@Data +public class OperationLog { + private Long id; + /**用户ip*/ + private String ip; + /**用户名*/ + private String username; + /**访问时间*/ + private Date createTime; + /**具体操作*/ + private String operation; + /**访问的方法*/ + private String method; + /**传递的参数*/ + private String params; + /**耗时*/ + private Long time; + /**操作状态*/ + private Integer status; + /**错误信息*/ + private String error; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java new file mode 100644 index 0000000..3d398a4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/LoginInforVO.java @@ -0,0 +1,28 @@ +package cn.tedu.wsf.log.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +@Data +public class LoginInforVO { + @ApiModelProperty(value = "id") + private Long infoId; + @ApiModelProperty(value = "用户名") + private String userName; + @ApiModelProperty(value = "ip地址") + private String ipaddr; + @ApiModelProperty(value = "登录地点") + private String loginLocation; + @ApiModelProperty(value = "浏览器") + private String browser; + @ApiModelProperty(value = "操作系统") + private String os; + @ApiModelProperty(value = "登录状态 0:成功 1:失败") + private String status; + @ApiModelProperty(value = "登录信息") + private String msg; + @ApiModelProperty(value = "登录时间") + private Date loginTime; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java new file mode 100644 index 0000000..de2cf6e --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/pojo/vo/OperationLogVO.java @@ -0,0 +1,27 @@ +package cn.tedu.wsf.log.pojo.vo; + +import lombok.Data; + +import java.util.Date; +@Data +public class OperationLogVO { + private Long id; + /**用户ip*/ + private String ip; + /**用户名*/ + private String username; + /**访问时间*/ + private Date createTime; + /**具体操作*/ + private String operation; + /**访问的方法*/ + private String method; + /**传递的参数*/ + private String params; + /**耗时*/ + private Long time; + /**操作状态*/ + private Integer status; + /**错误信息*/ + private String error; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java index ee8d0f0..bd433a5 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/LoginInforService.java @@ -1,7 +1,12 @@ package cn.tedu.wsf.log.service; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; + +import java.util.List; public interface LoginInforService { void insert(LoginInfor loginInfor); + List selectLoginList(LogQueryParam logQueryParam); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java new file mode 100644 index 0000000..bc3c837 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/OperationLogService.java @@ -0,0 +1,13 @@ +package cn.tedu.wsf.log.service; + + +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; + +import java.util.List; + +public interface OperationLogService { + void insertOperationLog(OperationLog operationLog); + List selectOperationLogList(OperationQueryParam operationQueryParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java index 6287f4c..bef6aa8 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/LoginInforServiceImpl.java @@ -1,12 +1,17 @@ package cn.tedu.wsf.log.service.impl; import cn.tedu.wsf.log.mapper.LoginInforMapper; +import cn.tedu.wsf.log.pojo.dto.LogQueryParam; import cn.tedu.wsf.log.pojo.entity.LoginInfor; +import cn.tedu.wsf.log.pojo.vo.LoginInforVO; import cn.tedu.wsf.log.service.LoginInforService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class LoginInforServiceImpl implements LoginInforService { @Autowired @@ -16,4 +21,11 @@ public class LoginInforServiceImpl implements LoginInforService { public void insert(LoginInfor loginInfor) { loginInforMapper.insert(loginInfor); } + + @Override + public List selectLoginList(LogQueryParam logQueryParam) { + LoginInfor loginInfor = new LoginInfor(); + BeanUtils.copyProperties(logQueryParam,loginInfor); + return loginInforMapper.selectLoginList(loginInfor); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java new file mode 100644 index 0000000..584b1ba --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/log/service/impl/OperationLogServiceImpl.java @@ -0,0 +1,29 @@ +package cn.tedu.wsf.log.service.impl; + + +import cn.tedu.wsf.log.mapper.OperationLogMapper; +import cn.tedu.wsf.log.pojo.dto.OperationQueryParam; +import cn.tedu.wsf.log.pojo.entity.OperationLog; +import cn.tedu.wsf.log.pojo.vo.OperationLogVO; +import cn.tedu.wsf.log.service.OperationLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class OperationLogServiceImpl implements OperationLogService { + @Autowired + OperationLogMapper operationLogMapper; + @Async + @Override + public void insertOperationLog(OperationLog operationLog) { + operationLogMapper.insert(operationLog); + } + + @Override + public List selectOperationLogList(OperationQueryParam operationQueryParam) { + return operationLogMapper.selectList(operationQueryParam); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java b/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java index 6260e87..f7ef3cf 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/controller/OrderController.java @@ -1,13 +1,19 @@ package cn.tedu.wsf.order.controller; import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import cn.tedu.wsf.order.service.OrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,10 +28,42 @@ public class OrderController { @Autowired OrderService orderService; @ApiOperation("任务查询") - @PostMapping("/selectOrder") - public JsonResult selectOrder(ResOrderQueryParams resOrderQueryParams){ - log.info("resOrderQueryParams:{}",resOrderQueryParams); - List requestOrderVos = orderService.selectOrder(resOrderQueryParams); + @GetMapping("/selectReqOrder") + public JsonResult selectOrder(ReqOrderQueryParam resOrderQueryParams){ + List requestOrderVos = orderService.selectReqOrderList(resOrderQueryParams); return JsonResult.ok(requestOrderVos); } + + @ApiOperation("任务修改") + @PostMapping("/updateReqOrder") + public JsonResult updateReqOrder(ReqOrderQueryParam resOrderQueryParams){ + orderService.updateReqOrder(resOrderQueryParams); + return JsonResult.ok(); + } + @ApiOperation("任务新增") + @PostMapping("/insertReqOrder") + public JsonResult insertReqOrder(ReqOrderQueryParam resOrderQueryParams){ + orderService.insertReqOrder(resOrderQueryParams); + return JsonResult.ok(); + } + @ApiOperation("任务抢单") + @PostMapping("/grabOrder") + public JsonResult grabOrder(GrabOrderParam grabOrderParam){ + log.info("grabOrderParam:{}",grabOrderParam); + orderService.grabOrder(grabOrderParam); + return JsonResult.ok(); + } + @ApiOperation("订单查询") + @GetMapping("/selectOrderList") + public JsonResult selectOrderList(OrderQueryParam orderQueryParam){ + List orderVOS = orderService.selectOrderList(orderQueryParam); + log.info("orderVOS:{}",orderVOS); + return JsonResult.ok(orderVOS); + } + @ApiOperation("订单更新") + @PostMapping("/updateOrder") + public JsonResult updateOrder(SaveOrderParam saveOrderParam){ + orderService.updateOrder(saveOrderParam); + return JsonResult.ok(); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java index 474f564..7428b13 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/mapper/OrderMapper.java @@ -1,12 +1,21 @@ package cn.tedu.wsf.order.mapper; +import cn.tedu.wsf.order.pojo.entity.Order; import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface OrderMapper { - List selectOrder(RequestOrder requestOrder); + List selectReqOrderList(RequestOrder requestOrder); + int insertReqOrder(RequestOrder requestOrder); + int updateReqOrder(RequestOrder requestOrder); + int updateReqOrderGrabStatus(@Param("id") Long id,@Param("grabStatus") Integer grabStatus); + int insertOrder(Order order); + List selectOrderList(Order order); + int updateOrder(Order order); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java new file mode 100644 index 0000000..73254b8 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/GrabOrderParam.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +@Data +public class GrabOrderParam { + + @ApiModelProperty("需求单id") + private Long id; + @ApiModelProperty("用户id") + private Long userId; + @ApiModelProperty("师傅手机号") + private String phone; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java new file mode 100644 index 0000000..88f8161 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/OrderQueryParam.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class OrderQueryParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java new file mode 100644 index 0000000..c973d5a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ReqOrderQueryParam.java @@ -0,0 +1,41 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class ReqOrderQueryParam { + + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String requestOrderNo; + @ApiModelProperty(value = "订单名称") + private String orderName; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double orderAmount; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "地址Id") + private Long areaId; + @ApiModelProperty(value = "用户地址") + private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; + @ApiModelProperty(value = "预约时间") + private String serviceTime; + @ApiModelProperty(value = "订单状态") + private String grabStatus; + @ApiModelProperty(value = "订单状态") + private String status; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java deleted file mode 100644 index fd62dc3..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/ResOrderQueryParams.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.tedu.wsf.order.pojo.dto; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@Data -public class ResOrderQueryParams { - - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子技能名称") - private String orderCategoryName; - @ApiModelProperty(value = "用户地址") - private String address; - @ApiModelProperty(value = "起始时间") - private Date startTime; - @ApiModelProperty(value = "结束时间") - private Date endTime; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java new file mode 100644 index 0000000..33a6cf5 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/dto/SaveOrderParam.java @@ -0,0 +1,40 @@ +package cn.tedu.wsf.order.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class SaveOrderParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java new file mode 100644 index 0000000..38a79e5 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/Order.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Order { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java index 95649e3..a66749f 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/entity/RequestOrder.java @@ -13,36 +13,34 @@ public class RequestOrder { private String requestOrderNo; @ApiModelProperty(value = "订单名称") private String orderName; - @ApiModelProperty(value = "服务id") - private Long orderServerId; - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子服务id") + @ApiModelProperty(value = "品类id") private Long orderCategoryId; - @ApiModelProperty(value = "子服务名称") + @ApiModelProperty(value = "品类名称") private String orderCategoryName; @ApiModelProperty(value = "订单金额") - private Long orderAmount; + private double orderAmount; @ApiModelProperty(value = "用户名称") private String userName; @ApiModelProperty(value = "用户手机号") private String userPhone; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "订单状态") + private String status; @ApiModelProperty(value = "地址Id") private Long areaId; @ApiModelProperty(value = "用户地址") private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; @ApiModelProperty(value = "预约时间") - private Date serviceTime; - @ApiModelProperty(value = "用户id") - private Long userId; + private String serviceTime; @ApiModelProperty(value = "订单状态") - private int grabStatus; + private String grabStatus; @ApiModelProperty(value = "修改次数") private int version; @ApiModelProperty(value = "创建时间") - private Date gmtCreate; + private String gmtCreate; @ApiModelProperty(value = "修改时间") - private Date gmtModified; - @ApiModelProperty(value = "详细地址") - private String detailAddress; + private String gmtModified; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java new file mode 100644 index 0000000..debe8d2 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/OrderVO.java @@ -0,0 +1,46 @@ +package cn.tedu.wsf.order.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class OrderVO { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "订单号") + private String orderNo; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "用户名称") + private String userName; + @ApiModelProperty(value = "用户手机号") + private String userPhone; + @ApiModelProperty(value = "用户地址") + private String userAddress; + @ApiModelProperty(value = "师傅名称") + private String workerName; + @ApiModelProperty(value = "师傅手机号") + private String workerPhone; + @ApiModelProperty(value = "需求订单号") + private String requestOrderNo; + @ApiModelProperty(value = "品类id") + private Long orderCategoryId; + @ApiModelProperty(value = "品类名称") + private String orderCategoryName; + @ApiModelProperty(value = "订单金额") + private double requestOrderPrice ; + @ApiModelProperty(value = "订单原始金额") + private double requestOrderRawPrice ; + @ApiModelProperty(value = "分润比例") + private double profitScale; + @ApiModelProperty(value = "服务时间") + private String serviceTime; + @ApiModelProperty(value = "操作步骤") + private String operateName; + @ApiModelProperty(value = "订单状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java index 58291ab..03b9027 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/pojo/vo/RequestOrderVo.java @@ -13,34 +13,34 @@ public class RequestOrderVo { private String requestOrderNo; @ApiModelProperty(value = "订单名称") private String orderName; - @ApiModelProperty(value = "服务id") - private Long orderServerId; - @ApiModelProperty(value = "服务名称") - private String orderServerName; - @ApiModelProperty(value = "子服务id") + @ApiModelProperty(value = "品类id") private Long orderCategoryId; - @ApiModelProperty(value = "子服务名称") + @ApiModelProperty(value = "品类名称") private String orderCategoryName; @ApiModelProperty(value = "订单金额") - private Long orderAmount; + private double orderAmount; @ApiModelProperty(value = "用户名称") private String userName; + @ApiModelProperty(value = "用户id") + private Long userId; @ApiModelProperty(value = "用户手机号") private String userPhone; @ApiModelProperty(value = "地址Id") private Long areaId; @ApiModelProperty(value = "用户地址") private String address; + @ApiModelProperty(value = "详细地址") + private String detailAddress; @ApiModelProperty(value = "预约时间") - private Date serviceTime; - @ApiModelProperty(value = "用户id") - private Long userId; + private String serviceTime; @ApiModelProperty(value = "订单状态") - private String status; - @ApiModelProperty(value = "抢单状态") - private int grabStatus; + private String grabStatus; + @ApiModelProperty(value = "修改次数") + private int version; @ApiModelProperty(value = "创建时间") - private Date gmtCreate; + private String gmtCreate; @ApiModelProperty(value = "修改时间") - private Date gmtModified; + private String gmtModified; + @ApiModelProperty(value = "订单状态") + private String status; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java b/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java index f0fef81..1e6935c 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/service/OrderService.java @@ -1,10 +1,22 @@ package cn.tedu.wsf.order.service; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import java.util.List; public interface OrderService { - List selectOrder(ResOrderQueryParams resOrderQueryParams); + List selectReqOrderList(ReqOrderQueryParam resOrderQueryParams); + void insertReqOrder(ReqOrderQueryParam reqOrderQueryParam); + void updateReqOrder(ReqOrderQueryParam reqOrderQueryParam); + + void grabOrder(GrabOrderParam grabOrderParam); + List selectOrderList(OrderQueryParam orderQueryParam); + + void updateOrder(SaveOrderParam saveOrderParam); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java index 1974d5a..ff2c79b 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/order/service/impl/OrderServiceImpl.java @@ -1,25 +1,121 @@ package cn.tedu.wsf.order.service.impl; +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.Category; +import cn.tedu.wsf.category.pojo.vo.CategoryVo; +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import cn.tedu.wsf.log.annotation.RequiredLog; import cn.tedu.wsf.order.mapper.OrderMapper; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; +import cn.tedu.wsf.order.pojo.dto.GrabOrderParam; +import cn.tedu.wsf.order.pojo.dto.OrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.ReqOrderQueryParam; +import cn.tedu.wsf.order.pojo.dto.SaveOrderParam; +import cn.tedu.wsf.order.pojo.entity.Order; import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.order.pojo.vo.OrderVO; import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; import cn.tedu.wsf.order.service.OrderService; +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.user.mapper.UserMapper; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.UUID; +@Transactional @Service public class OrderServiceImpl implements OrderService { @Autowired OrderMapper orderMapper; + @Autowired + CityMapper cityMapper; + @Autowired + CategoryMapper categoryMapper; + @Autowired + WorkerMapper workerMapper; + @Autowired + AccountMapper accountMapper; + @Autowired + MyWebSocketHandler myWebSocketHandler; @Override - public List selectOrder(ResOrderQueryParams resOrderQueryParams) { + public List selectReqOrderList(ReqOrderQueryParam resOrderQueryParams) { RequestOrder requestOrder=new RequestOrder(); BeanUtils.copyProperties(resOrderQueryParams,requestOrder); - List requestOrderVos = orderMapper.selectOrder(requestOrder); + List requestOrderVos = orderMapper.selectReqOrderList(requestOrder); return requestOrderVos; } + @RequiredLog(operation = "insertReqOrder") + @Override + public void insertReqOrder(ReqOrderQueryParam reqOrderQueryParam) { + RequestOrder requestOrder=new RequestOrder(); + BeanUtils.copyProperties(reqOrderQueryParam,requestOrder); + City city=new City(); + Category category=new Category(); + city.setCityId(reqOrderQueryParam.getAreaId()); + List cityVOS = cityMapper.queryCityList(city); + requestOrder.setAddress(cityVOS.get(0).getCityName()); + category.setCategoryId(reqOrderQueryParam.getOrderCategoryId()); + List categoryVos = categoryMapper.selectByQueryParam(category); + requestOrder.setOrderCategoryName(categoryVos.get(0).getCategoryName()); + if (reqOrderQueryParam.getId()==null){ + UUID uuid = UUID.randomUUID(); + requestOrder.setRequestOrderNo(uuid.toString().replace("-", "")); + orderMapper.insertReqOrder(requestOrder); + }else { + orderMapper.updateReqOrder(requestOrder); + } + } + @RequiredLog(operation = "updateReqOrder") + @Override + public void updateReqOrder(ReqOrderQueryParam reqOrderQueryParam) { + RequestOrder requestOrder=new RequestOrder(); + BeanUtils.copyProperties(reqOrderQueryParam,requestOrder); + orderMapper.updateReqOrder(requestOrder); + } + @RequiredLog(operation = "grabOrder") + @Override + public void grabOrder(GrabOrderParam grabOrderParam) { + RequestOrder requestOrder=new RequestOrder(); + requestOrder.setId(grabOrderParam.getId()); + List requestOrderVos = orderMapper.selectReqOrderList(requestOrder); + Order order=new Order(); + BeanUtils.copyProperties(requestOrderVos.get(0),order); + order.setWorkerPhone(grabOrderParam.getPhone()); + WorkerVO workerVO = workerMapper.selectByUserId(grabOrderParam.getUserId()); + order.setWorkerName(workerVO.getRealName()); + order.setRequestOrderRawPrice(requestOrderVos.get(0).getOrderAmount()); + order.setRequestOrderPrice(requestOrderVos.get(0).getOrderAmount()*0.8); + Account account=new Account(); + UUID uuid = UUID.randomUUID(); + order.setOrderNo(uuid.toString().replace("-", "")); + order.setUserAddress(requestOrderVos.get(0).getAddress()+requestOrderVos.get(0).getDetailAddress()); + account.setUserId(grabOrderParam.getUserId()); + account.setSettlingAmount(requestOrderVos.get(0).getOrderAmount()*0.8); + accountMapper.update(account); + orderMapper.updateReqOrderGrabStatus(grabOrderParam.getId(),1); + orderMapper.insertOrder(order); + } + @Override + public List selectOrderList(OrderQueryParam orderQueryParam) { + Order order=new Order(); + BeanUtils.copyProperties(orderQueryParam,order); + return orderMapper.selectOrderList(order); + } + @RequiredLog(operation = "updateOrder") + @Override + public void updateOrder(SaveOrderParam saveOrderParam) { + Order order=new Order(); + myWebSocketHandler.sendNotification("10", "你好,我是测试消息"); + BeanUtils.copyProperties(saveOrderParam,order); + orderMapper.updateOrder(order); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java new file mode 100644 index 0000000..ce7f6e3 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/mapper/AccountMapper.java @@ -0,0 +1,10 @@ +package cn.tedu.wsf.pay.mapper; + +import cn.tedu.wsf.pay.pojo.entity.Account; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AccountMapper { + int insert(Account account); + int update(Account account); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java new file mode 100644 index 0000000..eb4aed4 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/pojo/entity/Account.java @@ -0,0 +1,23 @@ +package cn.tedu.wsf.pay.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Account { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty("待结算金额") + private Double settlingAmount; + @ApiModelProperty("总金额") + private Double totalAmount; + @ApiModelProperty(value = "账户状态") + private String status; + @ApiModelProperty(value = "创建时间") + private String gmtCreate; + @ApiModelProperty(value = "修改时间") + private String gmtModified; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java new file mode 100644 index 0000000..20532fe --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/AccountService.java @@ -0,0 +1,7 @@ +package cn.tedu.wsf.pay.service; + +import cn.tedu.wsf.pay.pojo.entity.Account; + +public interface AccountService { + int insertAccount(Account account); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java new file mode 100644 index 0000000..273d0cc --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/pay/service/impl/AccountServiceImpl.java @@ -0,0 +1,18 @@ +package cn.tedu.wsf.pay.service.impl; + +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.pay.service.AccountService; + +public class AccountServiceImpl implements AccountService { + + private AccountMapper accountMapper; + + public AccountServiceImpl(AccountMapper accountMapper){ + this.accountMapper=accountMapper; + } + @Override + public int insertAccount(Account account) { + return accountMapper.insert(account); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java new file mode 100644 index 0000000..44d7553 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/mapper/RoleMapper.java @@ -0,0 +1,11 @@ +package cn.tedu.wsf.role.mapper; + +import cn.tedu.wsf.role.pojo.entity.Role; +import cn.tedu.wsf.role.pojo.entity.UserRole; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RoleMapper { + int insert(UserRole userRole); + int update(UserRole userRole); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java new file mode 100644 index 0000000..dfa9edf --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/Role.java @@ -0,0 +1,22 @@ +package cn.tedu.wsf.role.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class Role { + @ApiModelProperty("角色id") + private Long roleId; + @ApiModelProperty("角色名称") + private String roleName; + @ApiModelProperty("角色状态") + private Integer status; + @ApiModelProperty("删除标识") + private Integer delFlag; + @ApiModelProperty("创建时间") + private String createTime; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("创建人") + private String createBy; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java new file mode 100644 index 0000000..5393137 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/role/pojo/entity/UserRole.java @@ -0,0 +1,12 @@ +package cn.tedu.wsf.role.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class UserRole { + @ApiModelProperty(value = "用户id") + Long userId; + @ApiModelProperty(value = "角色id") + Long roleId; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java b/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java deleted file mode 100644 index 1e536c5..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/controller/TypeController.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.tedu.wsf.server.controller; - -import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; -import cn.tedu.wsf.server.service.TypeService; -import io.swagger.annotations.Api; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@Slf4j -@RestController -@Api("服务模块") -@RequestMapping("/wsf/server") -public class TypeController { - @Autowired - TypeService typeService; - @GetMapping("/queryCategory") - public JsonResult queryCategory(Long serverid) { - System.out.println("categoryid:"+serverid); - List categoryVos = typeService.queryCategory(serverid); - return JsonResult.ok(categoryVos); - } - - @GetMapping("/queryType") - public JsonResult queryType() { - List typeVos = typeService.queryType(); - return JsonResult.ok(typeVos); - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java deleted file mode 100644 index b9b47c2..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/mapper/TypeMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.mapper; - -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; - -import java.util.List; - -public interface TypeMapper { - List queryType(); - List queryCategory(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java deleted file mode 100644 index 7d756a1..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/entity/Type.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.tedu.wsf.server.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class Type { - @ApiModelProperty(value="id") - private Long id; - @ApiModelProperty(value = "服务名") - private String typeName; - @ApiModelProperty(value = "状态") - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java deleted file mode 100644 index 9a40079..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/CategoryVo.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.pojo.vo; - -import lombok.Data; - -@Data -public class CategoryVo { - private Long id; - private Long parentid; - private String categoryname; - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java b/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java deleted file mode 100644 index 669648f..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/pojo/vo/TypeVo.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.tedu.wsf.server.pojo.vo; - -import lombok.Data; - -@Data -public class TypeVo { - private Long id; - private String typename; - private String status; -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java b/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java deleted file mode 100644 index e40633c..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/service/TypeService.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.server.service; - -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; - -import java.util.List; - -public interface TypeService { - List queryType(); - List queryCategory(Long parentId); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java deleted file mode 100644 index ea15020..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/server/service/impl/TypeServiceImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.tedu.wsf.server.service.impl; - -import cn.tedu.wsf.server.mapper.TypeMapper; -import cn.tedu.wsf.server.pojo.vo.CategoryVo; -import cn.tedu.wsf.server.pojo.vo.TypeVo; -import cn.tedu.wsf.server.service.TypeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -@Service -public class TypeServiceImpl implements TypeService { - @Autowired - TypeMapper typeMapper; - @Override - public List queryType() { - List typeVos = typeMapper.queryType(); - return typeVos; - } - - @Override - public List queryCategory(Long parentId) { - List categoryVos = typeMapper.queryCategory(parentId); - return categoryVos; - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java b/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java new file mode 100644 index 0000000..eb9e9fa --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/test/XxlJobTest.java @@ -0,0 +1,25 @@ +//package cn.tedu.wsf.test; +// +//import com.xxl.job.core.biz.model.ReturnT; +//import com.xxl.job.core.context.XxlJobHelper; +//import com.xxl.job.core.handler.annotation.XxlJob; +//import org.springframework.stereotype.Component; +// +//@Component +//public class XxlJobTest { +// @XxlJob("testXxlJob") +// ReturnT testXxlJob(){ +// String jobParam = XxlJobHelper.getJobParam(); +// XxlJobHelper.log("测试开始"); +// System.out.println(); +// System.out.println(); +// System.out.println(); +// System.out.println(jobParam); +// System.out.println("测试完成!!!"); +// System.out.println(); +// System.out.println(); +// System.out.println(); +// XxlJobHelper.log("测试结束!!!"); +// return ReturnT.SUCCESS; +// } +//} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java new file mode 100644 index 0000000..4aab4fe --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/CaptchaController.java @@ -0,0 +1,76 @@ +package cn.tedu.wsf.user.controller; + +import cn.hutool.core.codec.Base64; +import cn.tedu.wsf.base.config.SystemConfig; +import cn.tedu.wsf.base.constant.CacheConstants; +import cn.tedu.wsf.base.constant.Constants; +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.base.pojo.vo.CaptchaVO; +import cn.tedu.wsf.base.utils.IdUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import com.google.code.kaptcha.Producer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisUtils redisUtils; + + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public JsonResult getCode(HttpServletResponse response) { + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + String capStr = null, code = null; + BufferedImage image = null; + // 生成验证码 + String captchaType = SystemConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + redisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return new JsonResult(e.getMessage()); + } + CaptchaVO captchaVO=new CaptchaVO(); + captchaVO.setUuid(uuid); + captchaVO.setImg(Base64.encode(os.toByteArray())); + return JsonResult.ok(captchaVO); + } +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java index ef97d99..36a7c60 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/controller/UserController.java @@ -1,11 +1,13 @@ package cn.tedu.wsf.user.controller; +import cn.tedu.wsf.base.constant.CacheConstants; import cn.tedu.wsf.base.enums.StatusCode; +import cn.tedu.wsf.base.exception.ServiceException; import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; +import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.user.pojo.dto.*; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import cn.tedu.wsf.user.service.UserService; import io.swagger.annotations.Api; @@ -16,7 +18,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import java.util.List; +import java.util.Map; @Api("用户模块") @Slf4j @@ -25,12 +29,18 @@ import java.util.List; public class UserController { @Autowired UserService userService; + @Autowired + RedisUtils redisUtils; + @ApiOperation("用户登录") @PostMapping("/login") public JsonResult login(@RequestBody UserLoginParam userLoginParam){ log.debug("用户登录:userLoginParam={}",userLoginParam); UserVO userVO = userService.login(userLoginParam); + if (userVO==null){ + return new JsonResult(2002,"验证码错误或过时"); + } return JsonResult.ok(StatusCode.LOGIN_SUCCESS,userVO); } @ApiOperation("用户注册") @@ -49,8 +59,8 @@ public class UserController { } @PostMapping("/delete/{userId}") public JsonResult deleteUser(@PathVariable Long userId){ - log.debug("删除用户:userId={}",userId); - userService.deleteById(userId); +// log.debug("删除用户:userId={}",userId); +// userService.deleteById(userId); return JsonResult.ok(); } @PostMapping("/save") @@ -64,4 +74,23 @@ public class UserController { userService.logout(); return JsonResult.ok(); } + + @PostMapping("/messagelogin") + public JsonResult messageLogin(@RequestBody UserMessageParam userMessageParam){ + log.debug("短信验证码登录:userMessageParam={}",userMessageParam); + UserVO userVO = userService.messageLogin(userMessageParam); + return JsonResult.ok(StatusCode.LOGIN_SUCCESS,userVO); + } + @GetMapping("/send") + public JsonResult sendMessage(String phone){ + log.debug("获取手机验证码"+phone); + userService.sendMessage(phone); + return new JsonResult(2001,"发送成功"); + } + @GetMapping("/becomeWorker") + public JsonResult becomeWorker(Long userId){ + log.debug("成为师傅:userId={}",userId); + userService.becomeWorker(userId); + return JsonResult.ok(); + } } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java index 9855deb..d968b5b 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/mapper/UserMapper.java @@ -15,4 +15,6 @@ public interface UserMapper { List selectByQueryParam(User user); int deleteById(Long id); int save(User user); + UserVO selectByPhone(String phone); + UserVO selectById(Long id); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java index ed11421..6e3460b 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserLoginParam.java @@ -9,4 +9,8 @@ public class UserLoginParam { private String username; @ApiModelProperty(value="密码") private String password; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java new file mode 100644 index 0000000..5a2a93b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserMessageParam.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf.user.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class UserMessageParam { + @ApiModelProperty("短信验证码") + private String messageCode; + @ApiModelProperty("手机号") + private String phone; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java index be8bf31..0652eba 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserQueryParam.java @@ -8,13 +8,14 @@ import java.util.Date; @Data public class UserQueryParam { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "昵称") private String nickname; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java index 6a1e1ae..984e645 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserRegisterParam.java @@ -10,7 +10,11 @@ public class UserRegisterParam { @ApiModelProperty(value = "密码") private String password; @ApiModelProperty(value = "昵称") - private String email; + private String nickname; @ApiModelProperty(value = "手机号") private String phone; + @ApiModelProperty(value = "uuid") + private String uuid; + @ApiModelProperty(value = "验证码") + private String code; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java index 60c4ba8..5061243 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/dto/UserSavaParam.java @@ -3,24 +3,23 @@ package cn.tedu.wsf.user.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; @Data public class UserSavaParam { @ApiModelProperty(value = "用户id") - private Long id; - @ApiModelProperty(value = "用户名") - private String username; + private Long userId; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; @ApiModelProperty(value = "手机号") private String phone; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; + @ApiModelProperty(value = "性别") + private String sex; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java index 6251b83..339eec5 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/entity/User.java @@ -9,21 +9,23 @@ import java.util.Date; @Data public class User implements Serializable { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "用户头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; + @ApiModelProperty(value = "性别") + private String sex; @ApiModelProperty(value = "手机号") private String phone; @ApiModelProperty(value = "1正常,0删除") - private String isDelete; + private String delFlag; @ApiModelProperty(value = "1启用,0禁用") - private String enable; + private String status; @ApiModelProperty(value = "创建时间") private Date gmtCreate; @ApiModelProperty(value = "更新时间") diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java new file mode 100644 index 0000000..226b5bb --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/CaptchaVo.java @@ -0,0 +1,9 @@ +package cn.tedu.wsf.user.pojo.vo; + +import lombok.Data; + +@Data +public class CaptchaVo { + private String imgurl; + private String captcha; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java index 2bc0d14..265d207 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/pojo/vo/UserVO.java @@ -10,27 +10,27 @@ import java.util.Date; @Data public class UserVO implements Serializable { @ApiModelProperty(value = "用户id") - private Long id; + private Long userId; @ApiModelProperty(value = "用户名") private String username; @ApiModelProperty(value = "密码") private String password; - @ApiModelProperty(value = "用户描述") - private String avator; + @ApiModelProperty(value = "用户头像地址") + private String avatar; @ApiModelProperty(value = "昵称") private String nickname; - @ApiModelProperty(value = "邮箱") - private String email; + @ApiModelProperty(value = "性别") + private String sex; @ApiModelProperty(value = "手机号") private String phone; - @ApiModelProperty(value = "1正常,0删除") - private String isDelete; - @ApiModelProperty(value = "1启用,0禁用") - private String enable; @ApiModelProperty(value = "创建时间") private Date gmtCreate; - @ApiModelProperty(value = "更新时间") - private Date gmtModified; + @ApiModelProperty(value = "1正常,0删除") + private String delFlag; + @ApiModelProperty(value = "1启用,0禁用") + private String status; @ApiModelProperty(value = "token") private String token; + @ApiModelProperty(value = "角色名称") + private String roleName; } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java b/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java index 527473a..4a1b676 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/service/UserService.java @@ -1,10 +1,8 @@ package cn.tedu.wsf.user.service; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.user.pojo.dto.*; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import java.util.List; @@ -18,4 +16,7 @@ public interface UserService { void deleteById(Long id); void save(UserSavaParam userSavaParam); void logout(); + UserVO messageLogin(UserMessageParam userMessageParam); + void sendMessage(String phone); + void becomeWorker(Long userId); } \ No newline at end of file diff --git a/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java index a95b286..5577b6a 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/user/service/impl/UserServiceImpl.java @@ -1,54 +1,77 @@ package cn.tedu.wsf.user.service.impl; +import cn.tedu.wsf.base.constant.CacheConstants; import cn.tedu.wsf.base.enums.StatusCode; import cn.tedu.wsf.base.exception.ServiceException; +import cn.tedu.wsf.base.handler.JsonResult; +import cn.tedu.wsf.base.handler.MyWebSocketHandler; import cn.tedu.wsf.base.service.impl.LoginUser; import cn.tedu.wsf.base.utils.JwtUtils; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; import cn.tedu.wsf.base.utils.RedisUtils; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.role.mapper.RoleMapper; +import cn.tedu.wsf.role.pojo.entity.UserRole; import cn.tedu.wsf.user.mapper.UserMapper; -import cn.tedu.wsf.user.pojo.dto.UserLoginParam; -import cn.tedu.wsf.user.pojo.dto.UserQueryParam; -import cn.tedu.wsf.user.pojo.dto.UserRegisterParam; -import cn.tedu.wsf.user.pojo.dto.UserSavaParam; +import cn.tedu.wsf.user.pojo.dto.*; import cn.tedu.wsf.user.pojo.entity.User; +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; import cn.tedu.wsf.user.pojo.vo.UserVO; import cn.tedu.wsf.user.service.UserService; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.entity.Worker; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.io.IOException; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; - +@Slf4j +@Transactional @Service public class UserServiceImpl implements UserService { @Autowired UserMapper userMapper; @Autowired + WorkerMapper workerMapper; + @Autowired AuthenticationManager authenticationManager; @Autowired RedisUtils redisUtils; @Autowired JwtUtils jwtUtils; - + @Autowired + PasswordEncoder passwordEncoder; + @Autowired + PhoneMessageUtils phoneMessageUtils; + @Autowired + RoleMapper roleMapper; + @Async + @RequiredLog(operation = "save") @Override public void save(UserSavaParam userSavaParam) { User user = new User(); BeanUtils.copyProperties(userSavaParam,user); userMapper.save(user); } - + @RequiredLog(operation = "save") @Override public void deleteById(Long id) { - userMapper.deleteById(id); +// userMapper.deleteById(id); } - @Override public List selectByQueryParam(UserQueryParam userQueryParam) { User user = new User(); @@ -56,24 +79,32 @@ public class UserServiceImpl implements UserService { List userVOS = userMapper.selectByQueryParam(user); return userVOS; } - @Override public void register(UserRegisterParam userRegisterParam) { System.out.println("userRegisterParam="+userRegisterParam); UserVO userVO = userMapper.selectByUsername(userRegisterParam.getUsername()); - System.out.println("userVO="+userVO); + UserRole userRole=new UserRole(); + userRole.setRoleId(1L); if (userVO==null){ User user = new User(); BeanUtils.copyProperties(userRegisterParam,user); + BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); + String encode = encoder.encode(userRegisterParam.getPassword()); + user.setPassword(encode); userMapper.register(user); + userRole.setUserId(user.getUserId()); + roleMapper.insert(userRole); }else { throw new ServiceException(StatusCode.USERNAME_ALREADY_EXISTS); } - } - @Override public UserVO login(UserLoginParam userLoginParam) { + String uuid = userLoginParam.getUuid(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + if (!userLoginParam.getCode().equals(redisUtils.get(verifyKey))){ + return null; + } UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userLoginParam.getUsername(), userLoginParam.getPassword()); Authentication authenticate = authenticationManager.authenticate(authentication); @@ -81,9 +112,8 @@ public class UserServiceImpl implements UserService { throw new RuntimeException("登录失败"); } LoginUser loginUser= (LoginUser) authenticate.getPrincipal(); - System.out.println(loginUser); User user = loginUser.getUser(); - String userid=user.getId().toString(); + String userid=user.getUserId().toString(); String token = jwtUtils.createToken(userid); redisUtils.set("login:"+userid,loginUser); UserVO userVO = new UserVO(); @@ -91,12 +121,72 @@ public class UserServiceImpl implements UserService { userVO.setToken(token); return userVO; } - + @RequiredLog(operation = "logout") @Override public void logout() { UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); - String userid = loginUser.getUser().getId().toString(); + String userid = loginUser.getUser().getUserId().toString(); redisUtils.delete("login:"+userid); } + + @Override + public UserVO messageLogin(UserMessageParam userMessageParam) { + String uuid = userMessageParam.getUuid(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + if (!userMessageParam.getCode().equals(redisUtils.get(verifyKey))){ + throw new ServiceException(StatusCode.CAPTCHA_ERROR); + } + System.out.println("验证码通过"); + UserVO userVO = userMapper.selectByPhone(userMessageParam.getPhone()); + if (userVO==null){ + throw new ServiceException(StatusCode.USER_NOT_EXISTS); + } + System.out.println("手机号通过"); + String messageKey= CacheConstants.PHONE_CODE_KEY+userMessageParam.getPhone(); + if (!userMessageParam.getMessageCode().equals(redisUtils.get(messageKey)+"")){ + System.out.println(redisUtils.get(messageKey)+""); + throw new ServiceException(StatusCode.PHONE_ERROR); + } + System.out.println("手机短信通过"); + LoginUser loginUser= new LoginUser(); + User user = new User(); + BeanUtils.copyProperties(userVO,user); + loginUser.setUser(user); + String userid=userVO.getUserId().toString(); + String token = jwtUtils.createToken(userid); + redisUtils.set("login:"+userid,loginUser); + userVO.setToken(token); + return userVO; + + } + + @Override + public void sendMessage(String phone) { + UserVO userVO = userMapper.selectByPhone(phone); + System.out.println(userVO==null); + if (userVO==null){ + throw new ServiceException(StatusCode.USER_NOT_EXISTS); + } + Object o = redisUtils.get(CacheConstants.PHONE_CODE_KEY + phone); + if (!Objects.isNull(o)){ + throw new ServiceException(StatusCode.PHONE_CODE_EXIST); + } + try { + phoneMessageUtils.sendVerification(phone); + } catch (Exception e) { + throw new ServiceException("发送短信失败"); + } + } + @RequiredLog(operation = "becomeWorker") + @Override + public void becomeWorker(Long userId) { + UserRole userRole=new UserRole(); + userRole.setUserId(userId); + userRole.setRoleId(2L); + roleMapper.update(userRole); + Worker worker=new Worker(); + worker.setUserId(userId); + workerMapper.insertWorker(worker); + } } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java index eb86d6a..50d482e 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/controller/WorkerController.java @@ -1,14 +1,19 @@ package cn.tedu.wsf.worker.controller; + import cn.tedu.wsf.base.handler.JsonResult; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; -import cn.tedu.wsf.worker.server.WorkerService; +import cn.tedu.wsf.worker.pojo.dto.MoveInSaveParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerQueryParam; +import cn.tedu.wsf.worker.pojo.dto.WorkerSaveParam; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; +import cn.tedu.wsf.worker.service.WorkerService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,11 +27,42 @@ import java.util.List; public class WorkerController { @Autowired WorkerService workerService; - @ApiOperation("变成师傅") - @PostMapping("/register") - public JsonResult becomeWorker(WorkerRegisterParam workerRegisterParam){ - log.info("workerRegisterParam:{}",workerRegisterParam); - workerService.becomeWorker(workerRegisterParam); + @ApiOperation("师傅查询") + @GetMapping("/query") + public JsonResult selectByQueryParams(WorkerQueryParam WorkerQueryParam){ + log.debug("查询用户:WorkerQueryParam={}",WorkerQueryParam); + List workerVOS = workerService.selectByQueryParam(WorkerQueryParam); + System.out.println("workerVOS:"+workerVOS); + return JsonResult.ok(workerVOS); + } + @ApiOperation("师傅更新") + @PostMapping("/save") + public JsonResult saveWorker(WorkerSaveParam workerSaveParam){ + log.debug("保存师傅:workerSaveParam={}",workerSaveParam); + workerService.saveWorker(workerSaveParam); return JsonResult.ok(); } + @ApiOperation("师傅入驻") + @PostMapping("/moveIn") + public JsonResult moveInWorker(MoveInSaveParam moveInSaveParam){ + log.debug("入驻师傅:moveInSaveParam={}",moveInSaveParam); + workerService.insertWorkerAudit(moveInSaveParam); + return JsonResult.ok(); + } + + @ApiOperation("审核列表") + @GetMapping("/auditList") + public JsonResult selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam){ + System.out.println("workerAuditQueryParam:"+workerAuditQueryParam); + List workerAuditVOS = workerService.selectWorkerAuditList(workerAuditQueryParam); + return JsonResult.ok(workerAuditVOS); + } + @ApiOperation("审核更新") + @PostMapping("/auditupdate") + public JsonResult updateWorkerAudit(MoveInSaveParam moveInSaveParam){ + log.debug("MoveInSaveParam审核参数"+moveInSaveParam); + workerService.WorkerAudit(moveInSaveParam); + return JsonResult.ok(); + } + } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java index b84085c..1da94ee 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/mapper/WorkerMapper.java @@ -1,16 +1,22 @@ package cn.tedu.wsf.worker.mapper; -import cn.tedu.wsf.order.pojo.entity.RequestOrder; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; import cn.tedu.wsf.worker.pojo.entity.Worker; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper public interface WorkerMapper { int insertWorker(Worker worker); - int insertArea(@Param("workerId") Long workerId,@Param("areaIds") Long[] areaIds); - int insertCategory(@Param("workerId") Long workerId,@Param("categoryIds")Long[] categoryIds); + void save(Worker worker); + List selectByQueryParam(Worker worker); + int insertWorkerAudit(WorkerAudit workerAudit); + List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam); + int updateWorkerAudit(WorkerAudit workerAudit); + WorkerVO selectByUserId(Long userId); + WorkerVO selectByWorkerId(Long workerId); } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java new file mode 100644 index 0000000..57995d0 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/MoveInSaveParam.java @@ -0,0 +1,24 @@ +package cn.tedu.wsf.worker.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class MoveInSaveParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "城市ids") + private Long[] countyIds; + @ApiModelProperty(value = "品类ids") + private Long[] categoryIds; + @ApiModelProperty(value = "审核状态") + private String auditStatus; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java new file mode 100644 index 0000000..eb4616b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerAuditQueryParam.java @@ -0,0 +1,25 @@ +package cn.tedu.wsf.worker.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +@Data +public class WorkerAuditQueryParam { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty("userId") + private Long userId; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "审核人id") + private Long auditId; + @ApiModelProperty(value = "师傅姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "审核状态 0:未审核,1已通过 2,驳回") + private Integer auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java similarity index 47% rename from wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java rename to wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java index 73a64c7..42857b7 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerArea.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerQueryParam.java @@ -1,16 +1,18 @@ -package cn.tedu.wsf.worker.pojo.entity; +package cn.tedu.wsf.worker.pojo.dto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.Date; + @Data -public class WorkerArea { - @ApiModelProperty(value = "id") - private Long id; +public class WorkerQueryParam { @ApiModelProperty(value = "师傅id") private Long workerId; - @ApiModelProperty(value = "地区名字") - private String areaName; + @ApiModelProperty(value = "真实姓名") + private String realName; @ApiModelProperty(value = "1启用,0禁用") private String status; + @ApiModelProperty(value = "认证状态") + private String certState; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java similarity index 42% rename from wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java rename to wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java index 648eded..c119e4d 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerRegisterParam.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/dto/WorkerSaveParam.java @@ -4,23 +4,25 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; -import java.util.List; @Data -public class WorkerRegisterParam { - +public class WorkerSaveParam { + @ApiModelProperty(value = "workerId") + private Long workerId; @ApiModelProperty(value = "用户id") private Long userId; - @ApiModelProperty(value = "出生日期") - private Date birthday; - @ApiModelProperty(value = "手机号") - private String phone; @ApiModelProperty(value = "真实姓名") private String realName; @ApiModelProperty(value = "身份证号") private String idCard; - @ApiModelProperty(value = "技能ids[]") - Long[] categoryIds; - @ApiModelProperty(value = "地区ids[]") - Long[] areaIds; + @ApiModelProperty(value = "1启用,0禁用") + private String status; + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + @ApiModelProperty(value = "认证状态") + private String certStatus; + @ApiModelProperty(value = "审核状态") + private String auditStatus; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java index f52473f..df9e029 100644 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/Worker.java @@ -7,14 +7,10 @@ import java.util.Date; @Data public class Worker { - @ApiModelProperty(value = "id") - private Long id; + @ApiModelProperty(value = "workerId") + private Long workerId; @ApiModelProperty(value = "用户id") private Long userId; - @ApiModelProperty(value = "出生日期") - private Date birthday; - @ApiModelProperty(value = "手机号") - private String phone; @ApiModelProperty(value = "真实姓名") private String realName; @ApiModelProperty(value = "身份证号") @@ -25,10 +21,8 @@ public class Worker { private Date gmtCreate; @ApiModelProperty(value = "修改时间") private Date gmtModified; - @ApiModelProperty(value = "分成比例") - private Double workerProportion; @ApiModelProperty(value = "认证状态") - private String certState; + private String certStatus; @ApiModelProperty(value = "审核状态") - private String auditState; + private String auditStatus; } diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java new file mode 100644 index 0000000..05982e7 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerAudit.java @@ -0,0 +1,26 @@ +package cn.tedu.wsf.worker.pojo.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerAudit { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "审核人id") + private Long auditId; + @ApiModelProperty(value = "审核人姓名") + private String userName; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "审核状态 0:待审核,1已通过 2,驳回") + private String auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "创建时间") + private Data createTime; +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java deleted file mode 100644 index d6c74a5..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/entity/WorkerCategory.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.tedu.wsf.worker.pojo.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class WorkerCategory { - @ApiModelProperty(value = "id") - private Long id; - @ApiModelProperty(value = "子服务id") - private Long workerId; - @ApiModelProperty(value = "技能id") - private String categoryId; - @ApiModelProperty(value = "1启用,0禁用") - private String status; - -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java new file mode 100644 index 0000000..1f5fb8b --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerAuditVO.java @@ -0,0 +1,29 @@ +package cn.tedu.wsf.worker.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class WorkerAuditVO { + @ApiModelProperty(value = "id") + private Long id; + @ApiModelProperty(value = "师傅id") + private Long workerId; + @ApiModelProperty(value = "师傅姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "联系电话") + private String phone; + @ApiModelProperty(value = "审核状态 0:未审核,1已通过 2,驳回") + private Integer auditStatus; + @ApiModelProperty(value = "审核时间") + private Data auditTime; + @ApiModelProperty(value = "拒绝原因") + private String rejectReason; + @ApiModelProperty(value = "证明材料") + private String passport; + @ApiModelProperty(value = "申请时间") + private Data createTime; + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java new file mode 100644 index 0000000..5460c06 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/pojo/vo/WorkerVO.java @@ -0,0 +1,31 @@ +package cn.tedu.wsf.worker.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class WorkerVO { + + @ApiModelProperty(value = "workerId") + private Long workerId; + @ApiModelProperty(value = "用户id") + private Long userId; + @ApiModelProperty(value = "真实姓名") + private String realName; + @ApiModelProperty(value = "身份证号") + private String idCard; + @ApiModelProperty(value = "1启用,0禁用") + private String status; + @ApiModelProperty(value = "创建时间") + private Date gmtCreate; + @ApiModelProperty(value = "修改时间") + private Date gmtModified; + @ApiModelProperty(value = "认证状态") + private String certStatus; + @ApiModelProperty(value = "审核状态") + private String auditStatus; + + +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java deleted file mode 100644 index e6e3517..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/WorkerService.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.tedu.wsf.worker.server; - -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; - -import java.util.List; - -public interface WorkerService { - void becomeWorker(WorkerRegisterParam workerRegisterParam); -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java deleted file mode 100644 index 48c3412..0000000 --- a/wsf-system/src/main/java/cn/tedu/wsf/worker/server/impl/WorkerServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.tedu.wsf.worker.server.impl; - -import cn.tedu.wsf.worker.mapper.WorkerMapper; -import cn.tedu.wsf.order.pojo.dto.ResOrderQueryParams; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.order.pojo.entity.RequestOrder; -import cn.tedu.wsf.worker.pojo.entity.Worker; -import cn.tedu.wsf.order.pojo.vo.RequestOrderVo; -import cn.tedu.wsf.worker.server.WorkerService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Service -public class WorkerServiceImpl implements WorkerService { - @Autowired - WorkerMapper workerMapper; - - @Transactional - @Override - public void becomeWorker(WorkerRegisterParam workerRegisterParam) { - Worker worker = new Worker(); - BeanUtils.copyProperties(workerRegisterParam,worker); - workerMapper.insertWorker(worker); - workerMapper.insertArea(worker.getId(),workerRegisterParam.getAreaIds()); - workerMapper.insertCategory(worker.getId(),workerRegisterParam.getCategoryIds()); - } -} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java new file mode 100644 index 0000000..c0cc089 --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/WorkerService.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf.worker.service; + +import cn.tedu.wsf.worker.pojo.dto.*; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; + +import java.util.List; + +public interface WorkerService { + + List selectByQueryParam(WorkerQueryParam workerQueryParam); + void saveWorker(WorkerSaveParam workerSaveParam); + void insertWorkerAudit(MoveInSaveParam moveInSaveParam); + List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam); + void WorkerAudit(MoveInSaveParam moveInSaveParam); +} diff --git a/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java new file mode 100644 index 0000000..fff0f5a --- /dev/null +++ b/wsf-system/src/main/java/cn/tedu/wsf/worker/service/impl/WorkerServiceImpl.java @@ -0,0 +1,90 @@ +package cn.tedu.wsf.worker.service.impl; + + +import cn.tedu.wsf.category.mapper.CategoryMapper; +import cn.tedu.wsf.category.pojo.entity.WorkerCategory; +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.WorkerCity; +import cn.tedu.wsf.log.annotation.RequiredLog; +import cn.tedu.wsf.pay.mapper.AccountMapper; +import cn.tedu.wsf.pay.pojo.entity.Account; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.dto.*; +import cn.tedu.wsf.worker.pojo.entity.Worker; +import cn.tedu.wsf.worker.pojo.entity.WorkerAudit; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.pojo.vo.WorkerVO; +import cn.tedu.wsf.worker.service.WorkerService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +@Transactional +@Service +public class WorkerServiceImpl implements WorkerService { + @Autowired + WorkerMapper workerMapper; + @Autowired + CityMapper cityMapper; + @Autowired + CategoryMapper categoryMapper; + @Autowired + AccountMapper accountMapper; + @Override + public List selectByQueryParam(WorkerQueryParam workerQueryParam) { + Worker worker=new Worker(); + BeanUtils.copyProperties(workerQueryParam,worker); + List workerVOS = workerMapper.selectByQueryParam(worker); + System.out.println("service=>workerVOS"+workerVOS); + return workerVOS; + } + @RequiredLog(operation = "saveWorker") + @Override + public void saveWorker(WorkerSaveParam workerSaveParam) { + + Worker worker=new Worker(); + BeanUtils.copyProperties(workerSaveParam,worker); + worker.setCertStatus("1"); + workerMapper.save(worker); + } + @RequiredLog(operation = "insertWorkerAudit") + @Override + public void insertWorkerAudit(MoveInSaveParam moveInSaveParam) { + WorkerAudit workerAudit=new WorkerAudit(); + BeanUtils.copyProperties(moveInSaveParam,workerAudit); + workerAudit.setAuditStatus("0"); + workerMapper.insertWorkerAudit(workerAudit); + cityMapper.insertWorkerCity(moveInSaveParam.getWorkerId(),moveInSaveParam.getCountyIds()); + categoryMapper.insertWorkerCategory(moveInSaveParam.getWorkerId(),moveInSaveParam.getCategoryIds()); + Worker worker=new Worker(); + worker.setAuditStatus("0"); + worker.setWorkerId(moveInSaveParam.getWorkerId()); + workerMapper.save(worker); + } + + @Override + public List selectWorkerAuditList(WorkerAuditQueryParam workerAuditQueryParam) { + return workerMapper.selectWorkerAuditList(workerAuditQueryParam); + } + @RequiredLog(operation = "WorkerAudit") + @Override + public void WorkerAudit(MoveInSaveParam moveInSaveParam) { + Worker worker=new Worker(); + WorkerAudit workerAudit=new WorkerAudit(); + BeanUtils.copyProperties(moveInSaveParam,worker); + BeanUtils.copyProperties(moveInSaveParam,workerAudit); + workerMapper.updateWorkerAudit(workerAudit); + workerMapper.save(worker); + if ("2".equals(moveInSaveParam.getAuditStatus())){ + cityMapper.deleteWorkerCity(moveInSaveParam.getWorkerId()); + categoryMapper.deleteWorkerCategory(moveInSaveParam.getWorkerId()); + }else { + Account account=new Account(); + WorkerVO workerVO = workerMapper.selectByWorkerId(moveInSaveParam.getWorkerId()); + account.setUserId(workerVO.getUserId()); + accountMapper.insert(account); + } + } +} diff --git a/wsf-system/src/main/resources/application.properties b/wsf-system/src/main/resources/application.properties index fcb90e4..0389f1c 100644 --- a/wsf-system/src/main/resources/application.properties +++ b/wsf-system/src/main/resources/application.properties @@ -1,14 +1,29 @@ server.port=8080 +#mysql ?? spring.datasource.url=jdbc:mysql://localhost:3306/db_wsf?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true spring.datasource.username=root spring.datasource.password=root mybatis.mapper-locations=classpath:mappers/*.xml mybatis.configuration.map-underscore-to-camel-case=true +#???? logging.level.root=WARN logging.level.cn.tedu.wsf=DEBUG +#knife4j?? knife4j.enable=true -spring.web.resources.static-locations=classpath:static - +#?????? +spring.web.resources.static-locations=classpath:static,file:${file.path}, +file.path=c:/pic +#redis ?? spring.redis.host=192.168.8.100 spring.redis.port=6379 -spring.redis.password=123456 \ No newline at end of file +spring.redis.password=123456 +#??? +wsf.captchaType=math +#xxl-job?? +xxl.job.admin.addresses=http://localhost:8090/xxl-job-admin +xxl.job.executor.appname=wsf-job +xxl.job.executor.port=9999 +xxl.job.executor.logpath=/xxljob/xxl-job/xxl-job-admin.log +xxl.job.executor.logretentiondays=30 +xxl.job.accessToken= + diff --git a/wsf-system/src/main/resources/http/userhttp.http b/wsf-system/src/main/resources/http/userhttp.http index aa59163..8502730 100644 --- a/wsf-system/src/main/resources/http/userhttp.http +++ b/wsf-system/src/main/resources/http/userhttp.http @@ -9,12 +9,14 @@ Content-Type: application/json # @no-cookie-jar POST http://localhost:8080/v1/file/upload Content-Type: multipart/form-data; boundary=WebAppBoundary -token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzI1MjY3MDQ0LCJleHAiOjE3MjU4NzE4NDR9.fz353Wsgzi80nRLPj4ZT6MZPY9U1m24Se69ufiK2e5pmw7bRwJ8rYH5CMbK70iCkvjoNffya6sr50cBj0mjlwQ +Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzI1Mjc3MjYwLCJleHAiOjE3MjU4ODIwNjB9.YSmnUNCu0ORygZduPgxcGNRh7bSGiI2ycVrdSC4NGFYQmmAkl-gGRrIDKovoyMOjIXUvLBpzY0bREyeKHG6tow --WebAppBoundary Content-Disposition: form-data; name="file"; filename="1.png" < C:/pic/1.png --WebAppBoundary-- +### +GET http://localhost:8080/wsf/user/code diff --git a/wsf-system/src/main/resources/mappers/AccountMapper.xml b/wsf-system/src/main/resources/mappers/AccountMapper.xml new file mode 100644 index 0000000..1a2aaf3 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/AccountMapper.xml @@ -0,0 +1,23 @@ + + + + + insert into tb_account(user_id,gmt_create) + values(#{userId},now()) + + + update tb_account + + + settling_amount=#{settlingAmount}, + + + total_amount=#{totalAmount}, + + gmt_modified=#{gmtModified} + + where user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/AreaMapper.xml b/wsf-system/src/main/resources/mappers/AreaMapper.xml deleted file mode 100644 index c217f40..0000000 --- a/wsf-system/src/main/resources/mappers/AreaMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/CategoryMapper.xml b/wsf-system/src/main/resources/mappers/CategoryMapper.xml new file mode 100644 index 0000000..e1d253b --- /dev/null +++ b/wsf-system/src/main/resources/mappers/CategoryMapper.xml @@ -0,0 +1,43 @@ + + + + + + insert into tb_worker_category(worker_id, category_id) values + + #{workerId}, #{item} + + + + delete from tb_worker_category where worker_id=#{workerId} + + + insert into tb_category(category_name, parent_id, depth, status) values + (#{categoryName}, #{parentId}, #{depth}, #{status}) + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/CityMapper.xml b/wsf-system/src/main/resources/mappers/CityMapper.xml new file mode 100644 index 0000000..4d83d02 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/CityMapper.xml @@ -0,0 +1,45 @@ + + + + + + insert into tb_worker_city(worker_id,city_id) values + + (#{workerId},#{item}) + + + + delete from tb_worker_city where worker_id=#{workerId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/LoginInforMapper.xml b/wsf-system/src/main/resources/mappers/LoginInforMapper.xml index 9bf3abc..70d5200 100644 --- a/wsf-system/src/main/resources/mappers/LoginInforMapper.xml +++ b/wsf-system/src/main/resources/mappers/LoginInforMapper.xml @@ -4,7 +4,33 @@ "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into tb_logininfor(login_name,status,msg,login_time,ipaddr,login_location,browser,os) - values(#{loginName},#{status},#{msg},#{loginTime},#{ipaddr},#{loginLocation},#{browser},#{os}) + insert into tb_logininfor(user_name,status,msg,login_time,ipaddr,login_location,browser,os) + values(#{userName},#{status},#{msg},#{loginTime},#{ipaddr},#{loginLocation},#{browser},#{os}) + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/OperationLogMapper.xml b/wsf-system/src/main/resources/mappers/OperationLogMapper.xml new file mode 100644 index 0000000..c44cb34 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/OperationLogMapper.xml @@ -0,0 +1,28 @@ + + + + + insert into tb_operation_log + (ip,username,create_time,operation,method,params,time,status,error) + values + (#{ip},#{username},now(),#{operation},#{method},#{params},#{time},#{status},#{error}) + + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/OrderMapper.xml b/wsf-system/src/main/resources/mappers/OrderMapper.xml index c62057e..ff01e21 100644 --- a/wsf-system/src/main/resources/mappers/OrderMapper.xml +++ b/wsf-system/src/main/resources/mappers/OrderMapper.xml @@ -4,26 +4,161 @@ "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + select * from tb_request_order - - order_server_name like CONCAT('%',#{orderServerName},'%') - - - and order_category_name like CONCAT('%',#{orderCategoryName},'%') - - - and address like CONCAT('%',#{address},'%') - - and status='1' - and grab_status='0' - - - - - - + + id=#{id} + + + and request_order_no=#{requestOrderNo} + + + and order_name=#{orderName} + + + and order_category_id=#{orderCategoryId} + + + and order_category_name=#{orderCategoryName} + + + and order_amount=#{orderAmount} + + + and user_id=#{userId} + + + and user_name=#{userName} + + + and user_phone=#{userPhone} + + + and area_id=#{areaId} + + + and address=#{address} + + + and detail_address=#{detailAddress} + + + and service_time=#{serviceTime} + + + and status=#{status} + + + and grab_status=#{grabStatus} + + + insert into tb_request_order(request_order_no,user_id,order_name,order_category_id,order_category_name,order_amount,user_name,user_phone,area_id,address,detail_address,service_time,gmt_create) + values(#{requestOrderNo},#{userId},#{orderName},#{orderCategoryId},#{orderCategoryName},#{orderAmount},#{userName},#{userPhone},#{areaId},#{address},#{detailAddress},#{serviceTime},now()) + + + update tb_request_order + set grab_status=#{grabStatus} + where id=#{id} + + + update tb_request_order + + + order_name=#{orderName}, + + + order_category_id=#{orderCategoryId}, + + + order_category_name=#{orderCategoryName}, + + + order_amount=#{orderAmount}, + + + user_name=#{userName}, + + + user_phone=#{userPhone}, + + + area_id=#{areaId}, + + + address=#{address}, + + + detail_address=#{detailAddress}, + + + service_time=#{serviceTime}, + + + status=#{status}, + + version=version+1 + + where id=#{id} + + + insert into tb_order(order_no,user_id,user_name,user_phone,user_address,worker_name,worker_phone,request_order_no,order_category_id,order_category_name,request_order_price,request_order_raw_price,profit_scale,service_time,gmt_create) + values(#{orderNo},#{userId},#{userName},#{userPhone},#{userAddress},#{workerName},#{workerPhone},#{requestOrderNo},#{orderCategoryId},#{orderCategoryName},#{requestOrderPrice},#{requestOrderRawPrice},#{profitScale},#{serviceTime},now()) + + + + update tb_order + + + operate_name=#{operateName}, + + + status=#{status}, + + gmt_modified=#{gmtModified} + + where id=#{id} + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/RoleMapper.xml b/wsf-system/src/main/resources/mappers/RoleMapper.xml new file mode 100644 index 0000000..7f3a129 --- /dev/null +++ b/wsf-system/src/main/resources/mappers/RoleMapper.xml @@ -0,0 +1,15 @@ + + + + + insert into tb_user_role(user_id,role_id) values(#{userId},#{roleId}) + + + update tb_user_role set role_id=#{roleId} where user_id=#{userId} + + + delete from tb_user_role where user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/TypeMapper.xml b/wsf-system/src/main/resources/mappers/TypeMapper.xml deleted file mode 100644 index 1b48b6b..0000000 --- a/wsf-system/src/main/resources/mappers/TypeMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/UserMapper.xml b/wsf-system/src/main/resources/mappers/UserMapper.xml index 659d647..b6c987f 100644 --- a/wsf-system/src/main/resources/mappers/UserMapper.xml +++ b/wsf-system/src/main/resources/mappers/UserMapper.xml @@ -3,14 +3,14 @@ - + INSERT INTO tb_users(username,password,nickname,phone,gmt_create,gmt_modified) VALUES(#{username},#{password},#{nickname},#{phone},now(),now()) - + SELECT user.* , role.role_name FROM tb_users user,tb_user_role urole,tb_role role username like CONCAT('%',#{username},'%') @@ -18,23 +18,21 @@ and nickname like CONCAT('%',#{nickname},'%') - - and enable=#{enable} + + and user.status=#{status} - - and is_delete=#{isDelete} - - - and id=#{id} + + and user.user_id=#{userId} - and is_delete=0 + and user.del_flag=0 + and urole.user_id=user.user_id and urole.role_id=role.role_id order by gmt_modified desc - UPDATE tb_users SET is_delete=1 WHERE id=#{id} + UPDATE tb_users SET del_flag=1 WHERE user_id=#{userId} UPDATE tb_users SET @@ -50,10 +48,22 @@ phone=#{phone}, - - enable=#{enable}, + + status=#{status}, + + + sex=#{sex}, + + + avatar=#{avatar}, - gmt_modified=now() - WHERE id=#{id} + gmt_modified=now() + WHERE user_id=#{userId} + + \ No newline at end of file diff --git a/wsf-system/src/main/resources/mappers/WorkerMapper.xml b/wsf-system/src/main/resources/mappers/WorkerMapper.xml index 2eeea00..ee8108f 100644 --- a/wsf-system/src/main/resources/mappers/WorkerMapper.xml +++ b/wsf-system/src/main/resources/mappers/WorkerMapper.xml @@ -3,20 +3,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - insert into tb_workers(user_id,birthday,phone,real_name,id_card - ) values(#{userId},#{birthday},#{phone},#{realName},#{idCard}) + + insert into tb_worker(user_id,gmt_create) values(#{userId},now()) - - insert into tb_worker_area(worker_id,area_id) values - - (#{workerId},#{areaId}) - - - - insert into tb_worker_categorys(worker_id,category_id) values - - (#{workerId},#{categoryId}) - + + update tb_worker set + + real_name=#{realName}, + + + id_card=#{idCard}, + + + cert_status=#{certStatus}, + + + audit_status=#{auditStatus}, + + + status=#{status}, + + gmt_modified=now() + + + worker_id=#{workerId} + + + + + + insert into tb_worker_audit(worker_id,passport,create_time,audit_status) + values(#{workerId},#{passport},now(),#{auditStatus}) + + + update tb_worker_audit set + + audit_status=#{auditStatus}, + + + reject_reason=#{rejectReason}, + + audit_time=now() + where id=#{id} + + + \ No newline at end of file diff --git a/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java b/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java new file mode 100644 index 0000000..ee52d67 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/CityTest.java @@ -0,0 +1,25 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.city.mapper.CityMapper; +import cn.tedu.wsf.city.pojo.entity.City; +import cn.tedu.wsf.city.pojo.vo.CityVO; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.List; + +@SpringBootTest +public class CityTest { + @Autowired + CityMapper cityMapper; + + @Test + void testQuery(){ + City city=new City(); +// city.setDepth(1); + city.setParentId(1801L); + List cityVOS = cityMapper.queryCityList(city); + cityVOS.forEach(System.out::println); + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java b/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java new file mode 100644 index 0000000..5406fee --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/ImageTest.java @@ -0,0 +1,17 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.user.pojo.vo.CaptchaVo; +import cn.tedu.wsf.user.service.UserService; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class ImageTest { + @Autowired + UserService userService; + @Test + public void testImage(){ + + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java b/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java index c85294a..5bb8567 100644 --- a/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java +++ b/wsf-system/src/test/java/cn/tedu/wsf/LoginTest.java @@ -1,6 +1,7 @@ package cn.tedu.wsf; import cn.tedu.wsf.base.service.impl.LoginUser; +import cn.tedu.wsf.base.utils.PhoneMessageUtils; import cn.tedu.wsf.base.utils.RedisUtils; import cn.tedu.wsf.user.mapper.UserMapper; import cn.tedu.wsf.user.pojo.entity.User; @@ -18,6 +19,8 @@ public class LoginTest { PasswordEncoder passwordEncoder; @Autowired RedisUtils redisUtils; + @Autowired + PhoneMessageUtils phoneMessageUtils; @Test void testLogin(){ // String encode = passwordEncoder.encode("123456"); @@ -35,4 +38,12 @@ public class LoginTest { System.out.println(o instanceof LoginUser); System.out.println(o instanceof UserDetails); } + @Test + void testSend(){ + try { + phoneMessageUtils.sendVerification("15939466965"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } } diff --git a/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java b/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java new file mode 100644 index 0000000..7631eeb --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/WebSocketTest.java @@ -0,0 +1,16 @@ +package cn.tedu.wsf; + +import cn.tedu.wsf.base.handler.MyWebSocketHandler; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class WebSocketTest { + @Autowired + MyWebSocketHandler myWebSocketHandler; + @Test + public void testConnect() { + myWebSocketHandler.sendNotification("10", "你好,我是测试消息"); + } +} diff --git a/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java b/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java index 4060440..37aa540 100644 --- a/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java +++ b/wsf-system/src/test/java/cn/tedu/wsf/WorkerTest.java @@ -1,28 +1,35 @@ package cn.tedu.wsf; -import cn.tedu.wsf.worker.pojo.dto.WorkerRegisterParam; -import cn.tedu.wsf.worker.server.impl.WorkerServiceImpl; +import cn.tedu.wsf.worker.mapper.WorkerMapper; +import cn.tedu.wsf.worker.pojo.dto.WorkerAuditQueryParam; +import cn.tedu.wsf.worker.pojo.vo.WorkerAuditVO; +import cn.tedu.wsf.worker.service.impl.WorkerServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import java.util.Date; +import java.util.List; @SpringBootTest public class WorkerTest { @Autowired WorkerServiceImpl workerService; + @Autowired + WorkerMapper workerMapper; @Test public void testBecomeWorker(){ - WorkerRegisterParam workerRegisterParam = new WorkerRegisterParam(); - workerRegisterParam.setUserId(1L); - workerRegisterParam.setRealName("张三"); - workerRegisterParam.setPhone("12345678901"); - workerRegisterParam.setIdCard("123456789012345678"); - workerRegisterParam.setBirthday(new Date()); - workerRegisterParam.setCategoryIds(new Long[]{1L,2L}); - workerRegisterParam.setAreaIds(new Long[]{1L,2L}); - System.out.println("workerRegisterParam="+workerRegisterParam); - workerService.becomeWorker(workerRegisterParam); +// WorkerRegisterParam workerRegisterParam = new WorkerRegisterParam(); +// workerRegisterParam.setUserId(1L); +// workerRegisterParam.setRealName("张三"); +// workerRegisterParam.setPhone("12345678901"); +// workerRegisterParam.setIdCard("123456789012345678"); +// workerRegisterParam.setBirthday(new Date()); +// workerRegisterParam.setCategoryIds(new Long[]{1L,2L}); +// workerRegisterParam.setAreaIds(new Long[]{1L,2L}); +// System.out.println("workerRegisterParam="+workerRegisterParam); +// workerService.becomeWorker(workerRegisterParam); + WorkerAuditQueryParam workerAuditQueryParam=new WorkerAuditQueryParam(); + List workerAuditVOS = workerMapper.selectWorkerAuditList(workerAuditQueryParam); + System.out.println(workerAuditVOS); } } diff --git a/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java b/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java new file mode 100644 index 0000000..7e6e262 --- /dev/null +++ b/wsf-system/src/test/java/cn/tedu/wsf/XxlJobTest.java @@ -0,0 +1,12 @@ +//package cn.tedu.wsf; +// +//import com.xxl.job.core.biz.model.ReturnT; +//import com.xxl.job.core.context.XxlJobHelper; +//import org.junit.jupiter.api.Test; +//import org.springframework.boot.test.context.SpringBootTest; +// +//@SpringBootTest +//public class XxlJobTest { +// +// +//} diff --git a/wsf-ui/src/router/index.js b/wsf-ui/src/router/index.js index 88aeb96..64a1e20 100644 --- a/wsf-ui/src/router/index.js +++ b/wsf-ui/src/router/index.js @@ -10,13 +10,18 @@ const routes = [ children:[ {path: '/user', component: () => import('../views/user/UserView.vue')}, {path: '/worker', component: () => import('../views/worker/WorkerView.vue')}, + {path: '/reqorder', component: () => import('../views/order/ReqOrderView.vue')}, {path: '/order', component: () => import('../views/order/OrderView.vue')}, + {path: '/workerOrder', component: () => import('../views/order/WorkerOrderView.vue')}, {path: '/loginlog', component: () => import('../views/log/LoginLogView.vue')}, - {path: '/operationlog', component: () => import('../views/log/OperationLogView.vue')} + {path: '/operationlog', component: () => import('../views/log/OperationLogView.vue')}, + {path: '/adminAudit', component: () => import('../views/worker/AdminAudit.vue')}, + {path: '/workerAudit', component: () => import('../views/worker/WorkerAudit.vue')}, ] }, {path: '/login', component: () => import('../views/LoginView')}, {path: '/register', component: () => import('../views/RegisterView.vue')}, + {path: '/message', component: () => import('../views/MessageLogin.vue')}, ] const router = createRouter({ diff --git a/wsf-ui/src/views/HomeView.vue b/wsf-ui/src/views/HomeView.vue index 08fb3d8..dfdf720 100644 --- a/wsf-ui/src/views/HomeView.vue +++ b/wsf-ui/src/views/HomeView.vue @@ -1,11 +1,7 @@ 基本信息 + 师傅审核 + 师傅审核查看 + 平台审核查看 - 订单信息 + 已入驻供应商 + 供应商审核 + 需求单列表 + + 用户工单 + 工单调度列表 + 师傅工单 + + + + 品类管理 + 区域管理 + + \ No newline at end of file diff --git a/wsf-ui/src/views/RegisterView.vue b/wsf-ui/src/views/RegisterView.vue index 37cb7d5..764cfa8 100644 --- a/wsf-ui/src/views/RegisterView.vue +++ b/wsf-ui/src/views/RegisterView.vue @@ -1,18 +1,11 @@